index.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387
  1. <template>
  2. <div class="page-container list-container">
  3. <!-- 功能按钮区 -->
  4. <div class="list-btns-container">
  5. <el-dropdown>
  6. <el-button type="primary" size="small">
  7. 其它<el-icon class="el-icon--right"><arrow-down /></el-icon>
  8. </el-button>
  9. <template #dropdown>
  10. <el-dropdown-menu>
  11. <el-dropdown-item
  12. icon="Download"
  13. @click="handleExport"
  14. v-hasPermi="['business:collection:export']"
  15. >
  16. 导出</el-dropdown-item
  17. >
  18. <el-dropdown-item
  19. icon="Upload"
  20. @click="handleImport"
  21. v-hasPermi="['business:collection:import']"
  22. >导入</el-dropdown-item
  23. >
  24. </el-dropdown-menu>
  25. </template>
  26. </el-dropdown>
  27. </div>
  28. <!-- 搜索区 -->
  29. <el-form
  30. class="list-search-container"
  31. size="small"
  32. :model="queryParams"
  33. ref="queryRef"
  34. :inline="true"
  35. label-width="68px"
  36. >
  37. <el-form-item label="客户名称:" prop="companyName">
  38. <el-input
  39. v-model="queryParams.companyName"
  40. style="width: 150px"
  41. placeholder="请输入客户名称"
  42. clearable
  43. @keyup.enter="handleQuery"
  44. />
  45. </el-form-item>
  46. <el-form-item>
  47. <el-button type="primary" icon="Search" @click="handleQuery"
  48. >搜索</el-button
  49. >
  50. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  51. </el-form-item>
  52. </el-form>
  53. <!-- 列表区 -->
  54. <!--
  55. :summary-method="getSummaries" -->
  56. <el-table
  57. v-loading="loading"
  58. :data="orderList"
  59. size="small"
  60. show-summary
  61. :summary-method="getSummaries"
  62. border
  63. height="100%"
  64. @selection-change="handleSelectionChange"
  65. >
  66. <el-table-column type="selection" width="55" align="center" />
  67. <el-table-column
  68. v-if="getShowStatus(2)"
  69. label="客户"
  70. prop="companyName"
  71. min-width="250"
  72. align="center"
  73. />
  74. <el-table-column
  75. v-if="getShowStatus(3)"
  76. label="合同编号"
  77. prop="contractNo"
  78. min-width="150"
  79. align="center"
  80. />
  81. <el-table-column
  82. v-if="getShowStatus(4)"
  83. label="收款日期"
  84. prop="arriveDate"
  85. width="100"
  86. align="center"
  87. />
  88. <el-table-column
  89. v-if="getShowStatus(5)"
  90. label="收款时间"
  91. prop="paymentCause"
  92. align="center"
  93. />
  94. <!-- <el-table-column label="支出科目" prop="paymentSubject" align="center" /> -->
  95. <el-table-column
  96. v-if="getShowStatus(8)"
  97. width="80"
  98. label="收款金额"
  99. prop="amount"
  100. header-align="center"
  101. align="right"
  102. >
  103. <template #default="scope">
  104. <span>{{ scope.row.amount.toFixed(2) }}</span>
  105. </template>
  106. </el-table-column>
  107. <el-table-column
  108. v-if="getShowStatus(9)"
  109. label="申请人"
  110. prop="applierName"
  111. min-width="100"
  112. align="center"
  113. />
  114. <el-table-column
  115. v-if="getShowStatus(11)"
  116. label="审核状态"
  117. prop="status"
  118. min-width="90"
  119. align="center"
  120. >
  121. <template #header>
  122. <!-- <el-badge v-if="unVerifiedNum > 0 && verifiable" is-dot>审核状态</el-badge> -->
  123. <div>审核状态</div>
  124. </template>
  125. <template #default="scope">
  126. <span v-if="scope.row.status === 0" style="color: #cd853f"
  127. >未审核</span
  128. >
  129. <span v-else-if="scope.row.status === 1" style="color: #32cd32"
  130. >审核通过</span
  131. >
  132. <span v-else-if="scope.row.status === 2" style="color: #dc143c"
  133. >审核不通过</span
  134. >
  135. </template>
  136. </el-table-column>
  137. <el-table-column
  138. v-if="getShowStatus(12)"
  139. label="支付状态"
  140. min-width="90"
  141. prop="arriveStatus"
  142. align="center"
  143. >
  144. <template #default="scope">
  145. <span v-if="scope.row.arriveStatus === 0" style="color: #dc143c"
  146. >未支付</span
  147. >
  148. <span v-else-if="scope.row.arriveStatus === 1" style="color: #32cd32"
  149. >已支付</span
  150. >
  151. <span v-else-if="scope.row.arriveStatus === 2" style="color: #cd853f"
  152. >部分支付</span
  153. >
  154. </template>
  155. </el-table-column>
  156. <el-table-column
  157. v-if="getShowStatus(14)"
  158. label="确认到账时间"
  159. prop="actuallyDate"
  160. align="center"
  161. >
  162. <template #default="scope">
  163. {{ scope.row.actuallyDate }}
  164. </template>
  165. </el-table-column>
  166. <el-table-column
  167. v-if="getShowStatus(13)"
  168. label="备注"
  169. prop="remark"
  170. align="center"
  171. min-width="100"
  172. />
  173. <el-table-column label="操作" width="80" align="center">
  174. <template #default="scope">
  175. <el-button
  176. type="primary"
  177. size="small"
  178. link
  179. @click="handleView(scope.row.id)"
  180. >查看</el-button
  181. >
  182. </template>
  183. </el-table-column>
  184. </el-table>
  185. <contract-form ref="contractRef" :get-list="getList" />
  186. <import-excel-dialog ref="importExcelDialogRef" :get-list="getList" />
  187. <pagination
  188. v-show="total > 0"
  189. :total="total"
  190. v-model:page="queryParams.pageNum"
  191. v-model:limit="queryParams.pageSize"
  192. @pagination="getList"
  193. />
  194. </div>
  195. </template>
  196. <script setup name="Company">
  197. import contractForm from "./form";
  198. import { listCollection } from "@/api/business/financial/collection";
  199. import importExcelDialog from "./importExcelDialog.vue";
  200. const { proxy } = getCurrentInstance();
  201. /** 字典数组区 */
  202. /** 查询 对象 */
  203. const orderList = ref([]);
  204. const loading = ref(true);
  205. const ids = ref([]);
  206. const single = ref(true);
  207. const multiple = ref(true);
  208. const total = ref(0);
  209. const showRows = ref([2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13]);
  210. const importExcelDialogRef = ref(null);
  211. const rows = ref([
  212. {
  213. key: 2,
  214. label: "客户名称",
  215. },
  216. {
  217. key: 3,
  218. label: "合同编号",
  219. },
  220. {
  221. key: 4,
  222. label: "收款日期",
  223. },
  224. {
  225. key: 5,
  226. label: "收款时间",
  227. },
  228. {
  229. key: 9,
  230. label: "申请人",
  231. },
  232. {
  233. key: 11,
  234. label: "审核状态",
  235. },
  236. {
  237. key: 12,
  238. label: "支付状态",
  239. },
  240. {
  241. key: 14,
  242. label: "确认到账时间",
  243. },
  244. {
  245. key: 13,
  246. label: "备注",
  247. },
  248. ]);
  249. const { contract_verify_status } = proxy.useDict("contract_verify_status");
  250. const { contract_status } = proxy.useDict("contract_status");
  251. /** 查询对象 */
  252. const queryParams = ref({
  253. pageNum: 1,
  254. orderByColumn: "create_time",
  255. pageSize: 10,
  256. });
  257. /*********************** 方法区 ****************************/
  258. /** 查询company列表 */
  259. function getList() {
  260. loading.value = true;
  261. listCollection(queryParams.value).then((response) => {
  262. orderList.value = response.rows;
  263. total.value = response.total;
  264. loading.value = false;
  265. });
  266. }
  267. function getSummaries(param) {
  268. // console.log("计算", param);
  269. const { columns, data } = param;
  270. const sums = [];
  271. columns.forEach((column, index) => {
  272. if (column.label != "收款金额") {
  273. return;
  274. }
  275. const values = [];
  276. data.map((item) => {
  277. if (item.arriveStatus == 1) {
  278. console.log(item);
  279. if (item.paymentAmount) {
  280. values.push(item.paymentAmount);
  281. }
  282. }
  283. });
  284. if (!values.every((value) => Number.isNaN(value))) {
  285. sums[index] = ` ${values.reduce((prev, curr) => {
  286. const value = Number(curr);
  287. if (!Number.isNaN(value)) {
  288. return Number(Number(prev) + value).toFixed(2);
  289. } else {
  290. return Number(prev).toFixed(2);
  291. }
  292. }, 0)}`;
  293. }
  294. });
  295. return sums;
  296. }
  297. /** 搜索按钮操作 */
  298. function handleQuery() {
  299. queryParams.value.pageNum = 1;
  300. getList();
  301. }
  302. /** 重置按钮操作 */
  303. function resetQuery() {
  304. // proxy.resetForm("queryRef");
  305. queryParams.value = {
  306. pageNum: 1,
  307. pageSize: 10,
  308. nonpayment: true,
  309. };
  310. handleQuery();
  311. }
  312. // 多选框选中数据
  313. function handleSelectionChange(selection) {
  314. ids.value = selection.map((item) => item.id);
  315. single.value = selection.length != 1;
  316. multiple.value = !selection.length;
  317. }
  318. /** 新增按钮操作 */
  319. function handleView(id) {
  320. proxy.$refs.contractRef.open(id);
  321. }
  322. /** 删除按钮操作 */
  323. function handleDelete(row) {
  324. const _ids = row.id || ids.value;
  325. proxy.$modal
  326. .confirm("是否确认删除选中的数据项?")
  327. .then(function () {
  328. return delOrder(_ids);
  329. })
  330. .then(() => {
  331. getList();
  332. proxy.$modal.msgSuccess("删除成功!");
  333. })
  334. .catch(() => {});
  335. }
  336. function handleAlter(row) {
  337. const id = row.id || ids.value;
  338. proxy.$refs.contractRef.openSimple(id, "alterOrder");
  339. }
  340. function handleDissolution() {
  341. const row = orderList.value.find((item) => item.id === ids.value[0]);
  342. proxy.$modal
  343. .confirm("是否确认解除合同?")
  344. .then(function () {
  345. return dissolutionOrder(row);
  346. })
  347. .then(() => {
  348. getList();
  349. proxy.$modal.msgSuccess("删除成功!");
  350. })
  351. .catch(() => {});
  352. }
  353. /** 导出按钮操作 */
  354. function handleExport() {
  355. exportOrder(queryParams.value);
  356. }
  357. function handleImport() {
  358. importExcelDialogRef.value.open();
  359. }
  360. function getShowStatus(key) {
  361. const index = showRows.value.findIndex((l) => l === key);
  362. return index >= 0;
  363. }
  364. getList();
  365. </script>