浏览代码

资金支付功能修改

ellisran 7 月之前
父节点
当前提交
b98a87f7da

+ 2 - 2
app/controller/financial_controller.js

@@ -889,10 +889,10 @@ module.exports = app => {
                         responseData.data = await ctx.service.financialPay.savePay(ctx.financialPay.id, data);
                         break;
                     case 'pay_contract_list':
-                        responseData.data = await ctx.service.financialPayContract.getContractList(ctx.financialPay.id);
+                        responseData.data = await ctx.service.financialPayContract.getContractList(ctx.financialPay.id, ctx.financialPay.status !== auditConst.financial.status.checked);
                         break;
                     case 'contract_list':
-                        responseData.data.contracts = await ctx.service.contract.getAllDataByCondition({ where: { tid: ctx.financialPay.tid, contract_type: 1 } });
+                        responseData.data.contracts = await ctx.service.contract.getAllDataByCondition({ where: { tid: ctx.financialPay.tid, contract_type: 1 }, orders: [['level', 'asc'], ['order', 'asc']] });
                         responseData.data.contractTrees = await ctx.service.contractTree.getAllDataByCondition({ where: { tid: ctx.financialPay.tid, contract_type: 1 } });
                         break;
                     case 'contract_white_add':

+ 3 - 3
app/public/js/financial_pay_detail.js

@@ -116,9 +116,9 @@ $(function () {
             {title: '合同编号', colSpan: '1', rowSpan: '2', field: 'c_code', hAlign: 0, width: 110, formatter: '@', readOnly: true, backColor2: 'backColor.fromContract'},
             {title: '合同名称', colSpan: '1', rowSpan: '2', field: 'name', hAlign: 0, width: 130, formatter: '@', readOnly: true, backColor2: 'backColor.fromContract'},
             {title: '合同金额', colSpan: '1', rowSpan: '2', field: 'total_price', hAlign: 2, width: 80, type: 'Number', readOnly: 'readOnly.isEdit'},
-            {title: '收款单位', colSpan: '1', rowSpan: '2', field: 'entity', hAlign: 1, width: 130, formatter: '@', readOnly: 'readOnly.isEdit2'},
-            {title: '收款单位账号', colSpan: '1', rowSpan: '2', field: 'bank_account', hAlign: 1, formatter: '@', width: 130, readOnly: 'readOnly.isEdit2'},
-            {title: '收款单位开户行', colSpan: '1', rowSpan: '2', field: 'bank', hAlign: 1, formatter: '@', width: 130, readOnly: 'readOnly.isEdit2'},
+            {title: '收款单位', colSpan: '1', rowSpan: '2', field: 'entity', hAlign: 1, width: 130, formatter: '@', readOnly: 'readOnly.isEdit', cellType: 'ellipsisAutoTip', scrollHeightClass: '.sjs-height-0'},
+            {title: '收款单位账号', colSpan: '1', rowSpan: '2', field: 'bank_account', hAlign: 1, formatter: '@', width: 130, readOnly: 'readOnly.isEdit', cellType: 'ellipsisAutoTip', scrollHeightClass: '.sjs-height-0'},
+            {title: '收款单位开户行', colSpan: '1', rowSpan: '2', field: 'bank', hAlign: 1, formatter: '@', width: 130, readOnly: 'readOnly.isEdit', cellType: 'ellipsisAutoTip', scrollHeightClass: '.sjs-height-0'},
             {title: '小额支出', colSpan: '1', rowSpan: '2', field: 'small_expenses', cellType: 'checkbox', hAlign: 1, width: 60, readOnly: 'readOnly.isEdit2'},
             {title: '支付金额', colSpan: '1', rowSpan: '2', field: 'pay_price', hAlign: 2, width: 80, type: 'Number', readOnly: 'readOnly.isEdit2'},
             {title: '累计支付', colSpan: '1', rowSpan: '2', field: 'accumulate_pay_price', getValue: 'getValue.accumulate_pay_price', hAlign: 2, width: 80, type: 'Number', readOnly: true },

+ 36 - 1
app/service/financial_pay_contract.js

@@ -22,14 +22,49 @@ module.exports = app => {
             this.dataId = 'id';
         }
 
-        async getContractList(fpid) {
+        async getContractList(fpid, needCheck = false) {
             const list = await this.getAllDataByCondition({ where: { fpid }, orders: [['id', 'asc']] });
+            const updateData = [];
             for (const l of list) {
                 const allList = l.cid ? await this.getAllDataByCondition({ where: { spid: l.spid, cid: l.cid } }) : [];
                 l.accumulate_pay_price = this._.sumBy(allList, 'pay_price');
                 l.accumulate_settle_price = this._.sumBy(allList, 'settle_price');
                 l.files = await this.ctx.service.financialPayAtt.getAtt(l.fpid, l.id);
+                if (l.cid && needCheck) {
+                    const contractInfo = await this.ctx.service.contract.getDataById(l.cid);
+                    if (contractInfo) {
+                        const condition = {};
+                        if (l.c_code !== contractInfo.c_code) {
+                            condition.c_code = contractInfo.c_code;
+                            l.c_code = contractInfo.c_code;
+                        }
+                        if (l.name !== contractInfo.name) {
+                            condition.name = contractInfo.name;
+                            l.name = contractInfo.name;
+                        }
+                        if (l.total_price !== contractInfo.total_price) {
+                            condition.total_price = contractInfo.total_price;
+                            l.total_price = contractInfo.total_price;
+                        }
+                        if (l.entity !== contractInfo.entity) {
+                            condition.entity = contractInfo.entity;
+                            l.entity = contractInfo.entity;
+                        }
+                        if (l.bank !== contractInfo.bank) {
+                            condition.bank = contractInfo.bank;
+                            l.bank = contractInfo.bank;
+                        }
+                        if (l.bank_account !== contractInfo.bank_account) {
+                            condition.bank_account = contractInfo.bank_account;
+                            l.bank_account = contractInfo.bank_account;
+                        }
+                        if (Object.keys(condition).length > 0) {
+                            updateData.push({ id: l.id, ...condition });
+                        }
+                    }
+                }
             }
+            if (updateData.length > 0) await this.db.updateRows(this.tableName, updateData);
             return list;
         }