From 5223957c8e8eb947c5fb4a1f51b664b8e2a39876 Mon Sep 17 00:00:00 2001 From: zhangdingyu <974548713@qq.com> Date: Tue, 12 Nov 2019 16:54:49 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=90=88=E5=90=8C=E8=AF=B7?= =?UTF-8?q?=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PurchaseContractRequestFund.js | 18 +-- .../PurchaseContractRequestFund/index.vue | 152 ++++++++++++++---- 2 files changed, 131 insertions(+), 39 deletions(-) diff --git a/src/api/PurchasingCenter/PurchaseContractRequestFund.js b/src/api/PurchasingCenter/PurchaseContractRequestFund.js index 4c8c7443..e00fd12b 100644 --- a/src/api/PurchasingCenter/PurchaseContractRequestFund.js +++ b/src/api/PurchasingCenter/PurchaseContractRequestFund.js @@ -12,14 +12,14 @@ export function searchTable0(check, date1, date2) { }) } // 采购合同内容查询 -export function searchContract(num) { +export function searchContract(check, num1, num2) { return request({ url: '', method: 'post', data: { type: '1', - name: '采购管理_采购合同内容_查询数据', - param: '采购合同流水号=' + num + name: '采购管理_采购合同内容_查询数据_合并后', + param: `check=${check}&采购合同流水号=${num1}&离线合同流水号=${num2}` } }) } @@ -48,14 +48,14 @@ export function searchSupplier() { }) } // 采购合同请款 -export function submitRequestFund(contractGroup, sumGroup, supplier, money, person) { +export function submitRequestFund(contractGroup, offGroup, sumGroup, supplier, money, person) { return request({ url: '', method: 'post', data: { type: '2', - name: '采购管理_采购合同_请款_增加数据', - param: `采购合同流水号组=${contractGroup}&合同总额组=${sumGroup}&供应商流水号=${supplier}&请款金额=${money}&请款人=${person}` + name: '采购管理_采购合同_请款_增加数据_合并后', + param: `采购合同流水号组=${contractGroup}&离线合同流水号组=${offGroup}&合同总额组=${sumGroup}&供应商流水号=${supplier}&请款金额=${money}&请款人=${person}` } }) } @@ -84,14 +84,14 @@ export function cancelRequestFund(num) { }) } // 查询离线合同待请款信息 -export function searchPurchaseContract(check, num) { +export function searchPurchaseContract(check1, check, num) { return request({ url: '', method: 'post', data: { type: '1', - name: '采购管理_采购合同_查询数据', - param: `供应商流水号_check=${check}&供应商流水号=${num}` + name: '采购管理_采购合同_查询数据_合并后', + param: `check=${check1}&供应商流水号_check=${check}&供应商流水号=${num}` } }) } diff --git a/src/views/PurchasingCenter/PurchaseContractRequestFund/index.vue b/src/views/PurchasingCenter/PurchaseContractRequestFund/index.vue index eea2073c..b6373f37 100644 --- a/src/views/PurchasingCenter/PurchaseContractRequestFund/index.vue +++ b/src/views/PurchasingCenter/PurchaseContractRequestFund/index.vue @@ -11,12 +11,7 @@ :label="item.label" :value="item.value"/> - 查询 + 查询 请款

请款表

@@ -82,9 +77,9 @@ - + @@ -116,39 +111,98 @@ @current-change="handleCurrentChange1"/> - + +

合同明细

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
供应商: - + - 查询 - - - + + + + - + - + - + + + + - + @@ -174,7 +228,6 @@ 确定请款 -
@@ -248,6 +301,7 @@ export default { tableData01: [], SUM: 0, contractGroup: [], + offGroup: [], gridData: [] } }, @@ -287,10 +341,37 @@ export default { }) }, searchContract(row) { - searchContract(row.采购合同流水号).then(response => { - this.returns = response.data[0].合同内容 + var check + row.采购合同流水号 ? check = 1 : check = 2 + searchContract(check, row.采购合同流水号, row.离线合同流水号).then(response => { + this.tableData2 = response.data }) }, + getSummaries(param) { // 合计 + const { columns, data } = param + const sums = [] + columns.forEach((column, index) => { + if (index === 0) { + sums[index] = '总价' + } else if (index === 6) { + const values = data.map(item => Number(parseFloat(item['单价']) * parseInt(item['数量']))) + if (!values.every(value => isNaN(value))) { + sums[index] = values.reduce((prev, curr) => { + const value = Number(curr) + if (!isNaN(value)) { + return prev + curr + } else { + return prev + } + }, 0) + sums[index] += ' 元' + } else { + sums[index] = 'N/A' + } + } + }) + return sums + }, handleSizeChange1(val) { this.pageSize1 = val this.pageCurrent1 = 1 @@ -310,7 +391,7 @@ export default { }) this.totalSum = 0 this.totalPay = 0 - searchPurchaseContract(check2, this.supplierValue).then(response => { + searchPurchaseContract(1, check2, this.supplierValue).then(response => { response.data.map(data => { this.totalSum += data.合同总额 this.totalPay += data.已付金额 @@ -327,18 +408,18 @@ export default { searchTable01() { // 查询待请款 if (this.supplierValue) { this.contractGroup = [] + this.offGroup = [] let check this.supplierValue ? check = 1 : check = 0 - searchPurchaseContract(check, this.supplierValue).then(response => { + searchPurchaseContract(2, check, this.supplierValue).then(response => { this.tableData01 = response.data this.tableData01.map(v => { this.$set(v, '请款金额', 0) v.请款金额 = v.合同总额 - v.已付金额 - v.申请中金额 return v }) + console.log(this.tableData01) }) - } else { - this.$message.error('请选择供应商') } }, selectable(row, index) { // 控制某行是否可选 @@ -348,10 +429,12 @@ export default { this.selectContents = val this.SUM = 0 this.contractGroup = [] + this.offGroup = [] this.sumGroup = [] for (let i = 0; i < val.length; i++) { this.SUM += parseFloat(val[i].请款金额) this.contractGroup.push(val[i].采购合同流水号) + this.offGroup.push(val[i].采购合同流水号) this.sumGroup.push(val[i].请款金额) } }, @@ -359,20 +442,29 @@ export default { if (this.supplierValue && this.contractGroup.length !== 0) { this.SUM = 0 this.contractGroup = [] + this.offGroup = [] this.sumGroup = [] for (let i = 0; i < this.tableData01.length; i++) { for (let j = 0; j < this.selectContents.length; j++) { - if (this.selectContents[j].采购合同流水号 === this.tableData01[i].采购合同流水号) { - this.SUM += parseFloat(this.tableData01[i].请款金额) - this.contractGroup.push(this.tableData01[i].采购合同流水号) - this.sumGroup.push(this.tableData01[i].请款金额) + if (this.selectContents[j].采购合同流水号 === this.tableData01[i].采购合同流水号 && this.selectContents[j].合同类型 === this.tableData01[i].合同类型) { + if (this.selectContents[j].合同类型 === 1) { + this.SUM += parseFloat(this.tableData01[i].请款金额) + this.contractGroup.push(this.tableData01[i].采购合同流水号) + this.offGroup.push('a974548') + this.sumGroup.push(this.tableData01[i].请款金额) + } else { + this.SUM += parseFloat(this.tableData01[i].请款金额) + this.contractGroup.push('a974548') + this.offGroup.push(this.tableData01[i].采购合同流水号) + this.sumGroup.push(this.tableData01[i].请款金额) + } } } } if (this.SUM === 0) { this.$message.error('请款金额不能为0') } else { - submitRequestFund(this.contractGroup, this.sumGroup, this.supplierValue, this.SUM, this.id).then(response => { // 采购合同流水号组=${contractGroup}&合同总额组=${sumGroup}&供应商流水号=${supplier}&请款金额=${money}&请款人=${person + submitRequestFund(this.contractGroup, this.offGroup, this.sumGroup, this.supplierValue, this.SUM, this.id).then(response => { if (response.data[0].result === '1') { this.$message.success('请款成功') this.searchTable1()