index.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <div class="page-container list-container">
  3. <el-row :gutter="24" style="width: 100%">
  4. <el-col :span="12">
  5. <div class="dashboard-total-item">
  6. <div class="dashboard-total-item-label">
  7. <span>
  8. <span>预存款余额</span>
  9. </span>
  10. </div>
  11. <div class="number-label">
  12. ¥ {{ rowNum(totalRemain ? totalRemain : 0) }}
  13. </div>
  14. </div>
  15. </el-col>
  16. <el-col :span="12">
  17. <div class="dashboard-total-item">
  18. <div class="dashboard-total-item-label">
  19. <span>
  20. <span>赠送余额</span>
  21. </span>
  22. </div>
  23. <div class="number-label">
  24. ¥ {{ rowNum(donateRemain ? donateRemain : 0) }}
  25. </div>
  26. </div>
  27. </el-col>
  28. </el-row>
  29. <!-- 功能按钮区 -->
  30. <div class="list-btns-container">
  31. <el-button type="success" size="small" icon="Refresh" @click="getList"
  32. >刷新</el-button
  33. >
  34. <el-dropdown>
  35. <el-button type="primary" size="small">
  36. 其它<el-icon class="el-icon--right"><arrow-down /></el-icon>
  37. </el-button>
  38. <template #dropdown>
  39. <el-dropdown-menu>
  40. <el-dropdown-item
  41. icon="Download"
  42. @click="handleExport"
  43. v-hasPermi="['business:deduct:export']"
  44. >
  45. 导出</el-dropdown-item
  46. >
  47. </el-dropdown-menu>
  48. </template>
  49. </el-dropdown>
  50. </div>
  51. <!-- 列表区 -->
  52. <el-table
  53. v-loading="loading"
  54. :data="orderList"
  55. size="small"
  56. border
  57. height="100%"
  58. @selection-change="handleSelectionChange"
  59. >
  60. <el-table-column type="selection" width="55" align="center" />
  61. <el-table-column
  62. label="委托单号"
  63. align="center"
  64. prop="formNo"
  65. min-width="140"
  66. />
  67. <el-table-column
  68. label="扣款单位"
  69. align="center"
  70. prop="contactCompany"
  71. min-width="150"
  72. />
  73. <el-table-column label="扣款信息" align="center">
  74. <template #default="scope">
  75. {{ scope.row.year }}年{{ scope.row.month }}月扣款
  76. </template>
  77. </el-table-column>
  78. <el-table-column
  79. label="扣款时间"
  80. align="center"
  81. prop="deductDate"
  82. min-width="120"
  83. />
  84. <el-table-column
  85. label="扣款金额"
  86. header-align="center"
  87. align="right"
  88. prop="amount"
  89. min-width="80"
  90. >
  91. <template #default="scope">
  92. <span> {{ rowNum(scope.row.amount) }}</span>
  93. </template>
  94. </el-table-column>
  95. <el-table-column
  96. label="扣款明细"
  97. align="center"
  98. prop="amount"
  99. min-width="80"
  100. >
  101. <template #default="scope">
  102. <!-- <el-button link size="small" type="primary" @click="handleDetail(scope.row)">查看明细</el-button> -->
  103. <el-button
  104. link
  105. size="small"
  106. type="primary"
  107. v-hasPermi="['business:deduct:info']"
  108. @click="handleStatementAccount(scope.row)"
  109. >跳转对账单</el-button
  110. >
  111. </template>
  112. </el-table-column>
  113. </el-table>
  114. <statementAccountForm ref="statementAccountFormRef" :get-list="getList" />
  115. <!-- 分页 -->
  116. <pagination
  117. v-show="total > 0"
  118. :total="total"
  119. v-model:page="queryParams.pageNum"
  120. v-model:limit="queryParams.pageSize"
  121. @pagination="getList"
  122. />
  123. </div>
  124. </template>
  125. <script setup name="Company">
  126. // import contractForm from "./form";
  127. import {
  128. listDeduct,
  129. delDeduct,
  130. exportDeduct,
  131. } from "@/api/business/entrust/deduct";
  132. import { rowNum } from "@/utils/index";
  133. import statementAccountForm from "./form.vue";
  134. import { getRemain } from "@/api/business/entrust/deposit";
  135. // import companyForm from "./form"
  136. const { proxy } = getCurrentInstance();
  137. /** 字典数组区 */
  138. /** 查询 对象 */
  139. const orderList = ref([]);
  140. const loading = ref(true);
  141. const ids = ref([]);
  142. const single = ref(true);
  143. const multiple = ref(true);
  144. const total = ref(0);
  145. const prev = ref([]);
  146. const statementAccountFormRef = ref(null);
  147. const totalRemain = ref(0);
  148. const donateRemain = ref(0);
  149. const { contract_verify_status } = proxy.useDict("contract_verify_status");
  150. const { contract_status } = proxy.useDict("contract_status");
  151. /** 查询对象 */
  152. const queryParams = ref({
  153. pageNum: 1,
  154. pageSize: 20,
  155. orderByColumn: "create_time",
  156. companyName: "",
  157. noContract: 0,
  158. });
  159. const editStatus = {
  160. startMonth: false,
  161. };
  162. /*********************** 方法区 ****************************/
  163. /** 查询company列表 */
  164. function getList() {
  165. loading.value = true;
  166. Promise.all([listDeduct(queryParams.value), getRemain()]).then((res) => {
  167. orderList.value = res[0].rows.map((l) => ({ ...l }));
  168. prev.value = proxy.deepClone(res[0].rows);
  169. total.value = res[0].total;
  170. totalRemain.value = res[1].data.totalRemain;
  171. donateRemain.value = res[1].data.donateRemain;
  172. loading.value = false;
  173. });
  174. }
  175. /** 搜索按钮操作 */
  176. function handleQuery() {
  177. queryParams.value.pageNum = 1;
  178. getList();
  179. }
  180. /** 重置按钮操作 */
  181. function resetQuery() {
  182. proxy.resetForm("queryRef");
  183. handleQuery();
  184. }
  185. // 多选框选中数据
  186. function handleSelectionChange(selection) {
  187. ids.value = selection.map((item) => item.id);
  188. single.value = selection.length != 1;
  189. multiple.value = !selection.length;
  190. }
  191. /** 删除按钮操作 */
  192. function handleDelete(row) {
  193. const _ids = row.id || ids.value;
  194. proxy.$modal
  195. .confirm("是否确认删除选中的数据项?")
  196. .then(function () {
  197. return delDeduct(_ids);
  198. })
  199. .then(() => {
  200. getList();
  201. proxy.$modal.msgSuccess("删除成功!");
  202. })
  203. .catch(() => {});
  204. }
  205. /** 导出按钮操作 */
  206. function handleExport() {
  207. exportDeduct(queryParams.value);
  208. }
  209. function startDateChangeHandler(row, startDate) {
  210. if (startDate) {
  211. // console.log(startDate)
  212. row.endMonth = proxy
  213. .moment(startDate)
  214. .add(row.monthNum - 1, "M")
  215. .format("YYYY-MM-DD");
  216. } else row.endMonth = null;
  217. console.log(row);
  218. }
  219. function saveHandler(row, field) {
  220. const index = prev.value.findIndex((l) => l.id === row.id);
  221. if (prev.value[index][field] === row[field]) {
  222. row.editStatus[field] = !row.editStatus[field];
  223. } else {
  224. proxy.$modal
  225. .confirm("确定修改起始月么?")
  226. .then((_) => {
  227. updateDeduct(row).then((res) => {
  228. getList();
  229. });
  230. })
  231. .catch((_) => {});
  232. }
  233. }
  234. function handleDetail(row) {}
  235. function handleStatementAccount(row) {
  236. statementAccountFormRef.value.open(row.id);
  237. }
  238. getList();
  239. </script>
  240. <style>
  241. .dashboard-total-item {
  242. display: flex;
  243. align-items: center;
  244. padding: 0 24px;
  245. height: 80px;
  246. background-color: #fff;
  247. font-size: 16px;
  248. justify-content: space-between;
  249. }
  250. </style>