diff --git a/src/api/flow/pay.js b/src/api/flow/pay.js index 86c2ba9..29a3281 100644 --- a/src/api/flow/pay.js +++ b/src/api/flow/pay.js @@ -35,3 +35,13 @@ export function getFundLog(params,noloading = false){ noloading }) } + +// 设置最后一笔为 最后一笔支付 + +export function fundLogEnd(params){ + return request({ + method:'get', + url:'/api/ht/fund_log/end', + params + }) +} diff --git a/src/views/SpecialDays/components/AddSpecialDays.vue b/src/views/SpecialDays/components/AddSpecialDays.vue index a5ece60..a469458 100644 --- a/src/views/SpecialDays/components/AddSpecialDays.vue +++ b/src/views/SpecialDays/components/AddSpecialDays.vue @@ -23,6 +23,7 @@ + diff --git a/src/views/SpecialDays/index.vue b/src/views/SpecialDays/index.vue index 2c43b2d..cee6295 100644 --- a/src/views/SpecialDays/index.vue +++ b/src/views/SpecialDays/index.vue @@ -31,6 +31,7 @@ + diff --git a/src/views/flow/components/payMx.vue b/src/views/flow/components/payMx.vue index 0346399..c6411c9 100644 --- a/src/views/flow/components/payMx.vue +++ b/src/views/flow/components/payMx.vue @@ -2,40 +2,135 @@
-
-
-
-
- *申请付款金额 -
-
- -
-
-
-
- *款项类型 -
-
- - - - -
-
-
-
- *是否为最后一笔 -
-
- - -
-
+
+ +

历史支付记录查看

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ 设为已支付完毕
+ +

发起新的支付审批

+
+
+
+ *申请付款金额 +
+
+ +
+
+
+
+ *款项类型 +
+
+ + + + +
+
+
+
+ *是否为最后一笔 +
+
+ + +
+
+
- - - + :z-index="zIndex+100" + > +
+ +
+
@@ -93,7 +188,8 @@ import { getItems, detailContract, - getFundLog + getFundLog, + fundLogEnd } from '@/api/flow/pay' import { PopupManager @@ -101,7 +197,7 @@ import { defaultModalSize } from "@/settings"; - +import {getToken} from "@/utils/auth"; export default { props: { isShow: { @@ -117,15 +213,21 @@ zIndex: PopupManager.nextZIndex(), list: [], table_item: [], - flowDetail: {}, - fundlogForm:{ - applyMoney:0, - type:'', - isLast:false, - }, - paymentType: ["进度款", "结算款", "质保金"], - oaUrl:'', - isShowOaModal:false, + flowDetail: {}, + fundlogForm: { + applyMoney: 0, + type: '', + isLast: false, + }, + paymentType: ["进度款", "结算款", "质保金"], + oaUrl: '', + isShowOaModal: false, + paymentsList: [], + flowStatus: { + '-1': '已退回', + '0': '办理中', + '1': '已完成' + } } }, methods: { @@ -151,13 +253,14 @@ // 增加 自己提交的数量 和 已提交的数量 this.list = JSON.parse(data[field.name]) this.list.map(item => { - item.payNum = 0 + item.payNum = 0 item.hasPayNum = 0 - }) + }) this.getItemNum(this.payId) this.getFieldConfig(field.sub_custom_model_id) } }); + this.getFundLogList() console.log("this.list", this.list) loading.close(); } catch (err) { @@ -166,6 +269,18 @@ loading.close(); } }, + // 获取历史支付明细 + async getFundLogList() { + let payments = + ( + await getFundLog({ + contract_id: this.flowDetail.out_contract_id, + show_type: 1 + }) + )?.data || []; + this.paymentsList = payments + console.log("paymentsList", this.paymentsList) + }, // 获取采购明细 async getFieldConfig(id) { try { @@ -177,8 +292,8 @@ label: field.label, prop: field.name }) - }); - + }); + } catch (err) { console.error(err) @@ -190,46 +305,73 @@ try { const item = await getItems({ flow_id: id - }) - console.log("item",item) - if(item.length>0){ - const itemMap = new Map(); - item.forEach(item => { - itemMap.set(item.wuzicaigou_item_id, item.total_num); - }); - // 遍历 list 数组,根据 id 从 Map 中获取 total_num 并赋值给 hasPayNum - this.list.forEach(item => { - if (itemMap.has(item.id)) { - item.hasPayNum = itemMap.get(item.id); - } - }); + }) + console.log("item", item) + if (item.length > 0) { + const itemMap = new Map(); + item.forEach(item => { + itemMap.set(item.wuzicaigou_item_id, item.total_num); + }); + // 遍历 list 数组,根据 id 从 Map 中获取 total_num 并赋值给 hasPayNum + this.list.forEach(item => { + if (itemMap.has(item.id)) { + item.hasPayNum = itemMap.get(item.id); + } + }); } } catch (err) { console.error(err) } + }, + showDetail(row){ + let url = `/oa/#/flow/detail?module_name=oa&auth_token=${window.encodeURIComponent(getToken())}&isSinglePage=1&flow_id=` + let pay = row.fund_log_flow_links.find(i => i.tag === 'pay') + //url += `&to=/flow/detail?flow_id=${caigou.id}` + url += pay?.flow_id + this.oaUrl = url + this.isShowOaModal = true + }, + payClose(){ + this.$confirm('将此采购记录设为“已⽀付完毕”,同时会将最后⼀笔⽀付记录的“是否为最后⼀笔”属性设置为“是”,请确认是否要进⾏此操作', '提示', { + confirmButtonText: '确定', + callback: action => { + if(action==='confirm'){ + fundLogEnd({ + contract_id:this.flowDetail.out_contract_id, + }).then(res=>{ + this.$emit('update:isShow', false) + this.$emit('refresh') + }) + } + + + // this.fundlogForm.isLast = true + } + }); }, async submit() { - try { - if(!this.fundlogForm.applyMoney){ - this.$message({ - message: '请填写本次申请付款金额', - duration: 2000, - type: 'warning' - }) - return - } - if(!this.fundlogForm.type){ - this.$message({ - message: '请选择款项类型', - duration: 2000, - type: 'warning' - }) - return + try { + if (!this.fundlogForm.applyMoney) { + this.$message({ + message: '请填写本次申请付款金额', + duration: 2000, + type: 'warning' + }) + return + } + if (!this.fundlogForm.type) { + this.$message({ + message: '请选择款项类型', + duration: 2000, + type: 'warning' + }) + return } const records = this.$refs.table.getCheckboxRecords() console.log("records", records) - let count = 0 + let count = 0 let totalCount = 0 + let allCount = 0 // 每一条本次报销数量+已报销数量 = 数量 if (records.length < 1) { this.$message({ message: '请选择需要报销的明细', @@ -241,9 +383,12 @@ records.map(item => { if (parseFloat(item.payNum) === 0 || parseFloat(item.payNum) > parseFloat(item.num)) { count++ - } - if(parseFloat(item.payNum)+parseFloat(item.hasPayNum) > parseFloat(item.num)){ - totalCount++ + } + if (parseFloat(item.payNum) + parseFloat(item.hasPayNum) > parseFloat(item.num)) { + totalCount++ + } + if (parseFloat(item.payNum) + parseFloat(item.hasPayNum) === parseFloat(item.num)) { + allCount++ } }) if (count > 0) { @@ -253,32 +398,41 @@ type: 'warning' }) return - } - if (totalCount > 0) { - this.$message({ - message: '本次报销数量大于剩余可报销数量', - duration: 2000, - type: 'warning' - }) - return - } - //wuzicaigou_items 报销的物资明细数组 - let wuzicaigou_items = [] - let zhifutitle = '' - records.map(item=>{ - wuzicaigou_items.push({ - flow_id:this.payId, - wuzicaigou_id:item.belongs_id, - wuzicaigou_item_id:item.id, - name:item.pinminghuofuwuxuqiu, - num:item.payNum, - total:item.num - }) - zhifutitle+= item.pinminghuofuwuxuqiu+'*'+item.payNum+',' - }) + } + if (totalCount > 0) { + this.$message({ + message: '本次报销数量大于剩余可报销数量', + duration: 2000, + type: 'warning' + }) + return + } + if (allCount === records.length) { + this.$alert('本次报销数量已等于总数量,默认为最后一笔', '提示', { + confirmButtonText: '确定', + callback: action => { + this.fundlogForm.isLast = true + } + }); + } + // return + //wuzicaigou_items 报销的物资明细数组 + let wuzicaigou_items = [] + let zhifutitle = '' + records.map(item => { + wuzicaigou_items.push({ + flow_id: this.payId, + wuzicaigou_id: item.belongs_id, + wuzicaigou_item_id: item.id, + name: item.pinminghuofuwuxuqiu, + num: item.payNum, + total: item.num + }) + zhifutitle += item.pinminghuofuwuxuqiu + '*' + item.payNum + ',' + }) // 跳转到支付审批流程 - let payments = []; + let payments = this.paymentsList; const actNumsTotal = () => { return payments.reduce((pre, cur) => { return pre + (!!Number(cur.act_money) ? Number(cur.act_money) : 0); @@ -291,45 +445,45 @@ }); } - payments = - ( - await getFundLog({ - contract_id: this.flowDetail.out_contract_id, - show_type: 1 - }) - )?.data || []; - // 付款登记的字段 - let zhifutitle2 = zhifutitle.slice(0,-1) - zhifutitle += "("+this.flowDetail.title+')' - let baseInfo = { - "oaUrl": contract?.number, - "zhifutitle": zhifutitle, - -// ?contract?.name - "contract_id":contract.id, - "type":this.fundlogForm.type, - "is_end":this.fundlogForm.isLast ? 1 : 0, - "amt": this.fundlogForm.applyMoney, - // out_pay_id: row?.id, - "xiangxishuoming": zhifutitle, - "yifujine": actNumsTotal(), - "xiangmuzonge": contract.money, - "zhifucishu": contract?.sign_plan?.length, - "cishu": payments.length, + // payments = this.paymentsList + // ( + // await getFundLog({ + // contract_id: this.flowDetail.out_contract_id, + // show_type: 1 + // }) + // )?.data || []; + // 付款登记的字段 + let zhifutitle2 = zhifutitle.slice(0, -1) + zhifutitle += "(" + this.flowDetail.title + ')' + let baseInfo = { + "oaUrl": contract?.number, + "zhifutitle": zhifutitle, + // ?contract?.name + "contract_id": contract.id, + "type": this.fundlogForm.type, + "is_end": this.fundlogForm.isLast ? 1 : 0, + "amt": this.fundlogForm.applyMoney, + // out_pay_id: row?.id, + "xiangxishuoming": zhifutitle, + "yifujine": actNumsTotal(), + "xiangmuzonge": contract.money, + "zhifucishu": contract?.sign_plan?.length, + "cishu": payments.length, - "liezhiqudao": contract?.plans.map(i => i.name)?.toString(), - "contractno": contract?.number, - "guanlianliucheng": contract?.contract_flow_links?.map(i => i.flow_id)?.toString(), - "wuzicaigou_items":wuzicaigou_items - }; - console.log(baseInfo,baseInfo) - let url = `/flow/create?&module_name=oa&isSinglePage=1&module_id=75&default_json=${window.encodeURIComponent(JSON.stringify(baseInfo))}`; - this.$router.push( - url - ); - // this.oaUrl = url; - // this.isShowOaModal = true; - this.$emit('update:isShow',false) + "liezhiqudao": contract?.plans.map(i => i.name)?.toString(), + "contractno": contract?.number, + "guanlianliucheng": contract?.contract_flow_links?.map(i => i.flow_id)?.toString(), + "wuzicaigou_items": wuzicaigou_items + }; + console.log(baseInfo, baseInfo) + let url = + `/flow/create?&module_name=oa&isSinglePage=1&module_id=75&default_json=${window.encodeURIComponent(JSON.stringify(baseInfo))}`; + this.$router.push( + url + ); + // this.oaUrl = url; + // this.isShowOaModal = true; + this.$emit('update:isShow', false) } catch (err) { console.error(err) } @@ -346,17 +500,18 @@ } } else { - this.list = [] - this.payId = '' - this.oaUrl = '' - this.isShowOaModal = false - this.table_item = [] - this.flowDetail = {} - this.fundlogForm = { - applyMoney:0, - type:'', - isLast:false, - } + this.list = [] + this.payId = '' + this.oaUrl = '' + this.isShowOaModal = false + this.table_item = [] + this.paymentsList = [] + this.flowDetail = {} + this.fundlogForm = { + applyMoney: 0, + type: '', + isLast: false, + } this.$refs.table.clearCheckboxRow() } } diff --git a/src/views/flow/list.vue b/src/views/flow/list.vue index 3872986..a46f254 100644 --- a/src/views/flow/list.vue +++ b/src/views/flow/list.vue @@ -491,7 +491,7 @@ >删除 - +