index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <template>
  2. <div class="tenant">
  3. <div class="content">
  4. <byTable
  5. :source="sourceList.data"
  6. :pagination="sourceList.pagination"
  7. :config="config"
  8. :loading="loading"
  9. :selectConfig="selectConfig"
  10. highlight-current-row
  11. :action-list="[
  12. {
  13. text: '退款申请',
  14. action: () => applyForRefund(),
  15. },
  16. ]"
  17. @get-list="getList"
  18. >
  19. <template #amount="{ item }">
  20. <div style="color: #409eff">{{ moneyFormat(item.amount, 2) }}</div>
  21. </template>
  22. <template #sumRefundMoney="{ item }">
  23. <div>{{ moneyFormat(item.sumRefundMoney, 2) }}</div>
  24. </template>
  25. </byTable>
  26. </div>
  27. <el-dialog
  28. title="到款登记"
  29. v-if="dialogVisible"
  30. v-model="dialogVisible"
  31. width="600"
  32. v-loading="loadingDialog"
  33. >
  34. <byForm
  35. :formConfig="formConfig"
  36. :formOption="formOption"
  37. v-model="formData.data"
  38. :rules="rules"
  39. ref="submit"
  40. >
  41. <template #receiptAmount>
  42. <div style="width: 100%">
  43. <el-input-number
  44. v-model="formData.data.receiptAmount"
  45. placeholder="请输入到款金额"
  46. :min="0"
  47. :precision="2"
  48. :controls="false"
  49. style="width: 100%"
  50. />
  51. </div>
  52. </template>
  53. </byForm>
  54. <template #footer>
  55. <el-button @click="dialogVisible = false" size="large">取 消</el-button>
  56. <el-button type="primary" @click="submitForm()" size="large"
  57. >确 定</el-button
  58. >
  59. </template>
  60. </el-dialog>
  61. </div>
  62. </template>
  63. <script setup>
  64. import { computed, ref } from "vue";
  65. import byTable from "@/components/byTable/index";
  66. import byForm from "@/components/byForm/index";
  67. import useUserStore from "@/store/modules/user";
  68. import { ElMessage } from "element-plus";
  69. const { proxy } = getCurrentInstance();
  70. const refundStatus = ref([]);
  71. const accountList = ref([]);
  72. const status = ref([
  73. {
  74. label: "草稿",
  75. value: 0,
  76. },
  77. {
  78. label: "审批中",
  79. value: 10,
  80. },
  81. {
  82. label: "驳回",
  83. value: 20,
  84. },
  85. {
  86. label: "审批通过",
  87. value: 30,
  88. },
  89. {
  90. label: "终止",
  91. value: 99,
  92. },
  93. ]);
  94. const sourceList = ref({
  95. data: [],
  96. pagination: {
  97. total: 0,
  98. pageNum: 1,
  99. pageSize: 10,
  100. keyword: "",
  101. refundStatus: "",
  102. status: "",
  103. },
  104. });
  105. const loading = ref(false);
  106. const selectConfig = computed(() => {
  107. return [
  108. {
  109. label: "退款状态",
  110. prop: "refundStatus",
  111. data: refundStatus.value,
  112. },
  113. {
  114. label: "审批状态",
  115. prop: "status",
  116. data: status.value,
  117. },
  118. ];
  119. });
  120. const config = computed(() => {
  121. return [
  122. {
  123. attrs: {
  124. label: "供应商",
  125. prop: "supplyName",
  126. width: 300,
  127. },
  128. },
  129. {
  130. attrs: {
  131. label: "应退款金额",
  132. slot: "amount",
  133. },
  134. },
  135. {
  136. attrs: {
  137. label: "已退款金额",
  138. slot: "sumRefundMoney",
  139. },
  140. },
  141. {
  142. attrs: {
  143. label: "申请人",
  144. prop: "refundName",
  145. },
  146. },
  147. {
  148. attrs: {
  149. label: "申请时间",
  150. prop: "refundTime",
  151. width: 180,
  152. },
  153. },
  154. {
  155. attrs: {
  156. label: "审批状态",
  157. prop: "status",
  158. },
  159. render(type) {
  160. let text = "";
  161. if (status.value && status.value.length > 0) {
  162. let data = status.value.filter((item) => item.value == type);
  163. if (data && data.length > 0) {
  164. text = data[0].label;
  165. }
  166. }
  167. return text;
  168. },
  169. },
  170. {
  171. attrs: {
  172. label: "退款状态",
  173. prop: "refundStatus",
  174. },
  175. render(type) {
  176. let text = "";
  177. if (refundStatus.value && refundStatus.value.length > 0) {
  178. let data = refundStatus.value.filter((item) => item.value == type);
  179. if (data && data.length > 0) {
  180. text = data[0].label;
  181. }
  182. }
  183. return text;
  184. },
  185. },
  186. {
  187. attrs: {
  188. label: "操作",
  189. width: "100",
  190. align: "center",
  191. },
  192. renderHTML(row) {
  193. return [
  194. {
  195. attrs: {
  196. label: "到款登记",
  197. type: "primary",
  198. text: true,
  199. },
  200. el: "button",
  201. click() {
  202. receiptRegistration(row);
  203. },
  204. },
  205. ];
  206. },
  207. },
  208. ];
  209. });
  210. const getDict = () => {
  211. proxy
  212. .post("/dictTenantData/page", {
  213. pageNum: 1,
  214. pageSize: 999,
  215. dictCode: "refund_status",
  216. tenantId: useUserStore().user.tenantId,
  217. })
  218. .then((res) => {
  219. if (res.rows && res.rows.length > 0) {
  220. refundStatus.value = res.rows.map((item) => {
  221. return {
  222. label: item.dictValue,
  223. value: item.dictKey,
  224. };
  225. });
  226. }
  227. });
  228. proxy
  229. .post("/accountManagement/page", { pageNum: 1, pageSize: 999 })
  230. .then((res) => {
  231. accountList.value = res.rows.map((item) => {
  232. return {
  233. bankName: item.name,
  234. accountOpening: item.accountOpening,
  235. openingBank: item.openingBank,
  236. interbankNumber: item.interbankNumber,
  237. label: item.alias,
  238. value: item.id,
  239. };
  240. });
  241. });
  242. };
  243. const getList = async (req) => {
  244. sourceList.value.pagination = { ...sourceList.value.pagination, ...req };
  245. loading.value = true;
  246. proxy.post("/refund/page", sourceList.value.pagination).then((res) => {
  247. sourceList.value.data = res.rows;
  248. sourceList.value.pagination.total = res.total;
  249. setTimeout(() => {
  250. loading.value = false;
  251. }, 200);
  252. });
  253. };
  254. getDict();
  255. getList();
  256. const applyForRefund = () => {
  257. proxy.$router.replace({
  258. path: "/platform_manage/process/processApproval",
  259. query: {
  260. flowKey: "refund_flow",
  261. flowName: "退款申请",
  262. },
  263. });
  264. };
  265. const dialogVisible = ref(false);
  266. const loadingDialog = ref(false);
  267. const submit = ref(null);
  268. const formOption = reactive({
  269. inline: true,
  270. labelWidth: 100,
  271. itemWidth: 100,
  272. rules: [],
  273. });
  274. const formConfig = computed(() => {
  275. return [
  276. {
  277. label: "应退款信息",
  278. },
  279. {
  280. type: "input",
  281. prop: "supplyName",
  282. label: "供应商",
  283. itemType: "text",
  284. disabled: true,
  285. },
  286. {
  287. type: "input",
  288. prop: "amount",
  289. label: "应退金额",
  290. itemType: "text",
  291. disabled: true,
  292. },
  293. {
  294. label: "退款信息",
  295. },
  296. {
  297. type: "select",
  298. label: "到款账户",
  299. prop: "receiptAccountManagementId",
  300. data: accountList.value,
  301. itemWidth: 50,
  302. },
  303. {
  304. type: "slot",
  305. prop: "receiptAmount",
  306. slotName: "receiptAmount",
  307. label: "到款金额",
  308. },
  309. {
  310. type: "input",
  311. prop: "receiptName",
  312. label: "对方户名",
  313. itemType: "text",
  314. },
  315. {
  316. type: "input",
  317. prop: "receiptOpeningBank",
  318. label: "对方开户银行",
  319. itemType: "text",
  320. },
  321. {
  322. type: "input",
  323. prop: "receiptAccountOpening",
  324. label: "对方银行账号",
  325. itemType: "text",
  326. },
  327. ];
  328. });
  329. const rules = ref({
  330. receiptAccountManagementId: [
  331. { required: true, message: "请选择到款账户", trigger: "change" },
  332. ],
  333. receiptAmount: [
  334. { required: true, message: "请输入到款金额", trigger: "blur" },
  335. ],
  336. });
  337. const formData = reactive({
  338. data: {},
  339. });
  340. const receiptRegistration = (row) => {
  341. formData.data = {
  342. supplyName: row.supplyName,
  343. amount: row.amount,
  344. id: row.id,
  345. };
  346. loadingDialog.value = false;
  347. dialogVisible.value = true;
  348. };
  349. const submitForm = () => {
  350. submit.value.handleSubmit(() => {
  351. loadingDialog.value = true;
  352. proxy.post("/refund/receipt/registration", formData.data).then(
  353. () => {
  354. ElMessage({
  355. message: "提交成功",
  356. type: "success",
  357. });
  358. dialogVisible.value = false;
  359. getList();
  360. },
  361. (err) => {
  362. console.log(err);
  363. loadingDialog.value = false;
  364. }
  365. );
  366. });
  367. };
  368. </script>
  369. <style lang="scss" scoped>
  370. .tenant {
  371. padding: 20px;
  372. }
  373. ::v-deep(.el-input-number .el-input__inner) {
  374. text-align: left;
  375. }
  376. </style>