This commit is contained in:
liushuai
2019-09-24 17:25:50 +08:00
parent a59d1358c1
commit 2482179bbd
13 changed files with 237 additions and 111 deletions

View File

@@ -32,7 +32,7 @@
</el-card>
<el-card>
<el-table v-loading="" :data="tableData1" border style="max-height: 500px;" height="500px" size="mini">
<el-table v-loading="" :data="tableData1" border style="max-height: 500px;" height="500px" size="mini" stripe>
<el-table-column label="供应商" align="center" min-width="250">
<template slot-scope="scope">
{{ scope.row.供应商名称 }}
@@ -100,9 +100,9 @@
</template>
</el-table-column>
</el-table>
<el-button slot="reference" type="success" size="mini" icon="el-icon-search" @click="searchTable02(scope.row)">查看详情</el-button>
<el-button slot="reference" type="primary" size="mini" icon="el-icon-search" plain @click="searchTable02(scope.row)">查看详情</el-button>
</el-popover>
<el-button :disabled="Number(scope.row.审批情况流水号)!==3" type="danger" size="mini" icon="el-icon-delete" style="margin-left: 10px" @click="cancelRequestFund(scope.row)">取消请款</el-button>
<el-button :disabled="Number(id)!==Number(scope.row.请款人) || (Number(scope.row.审批情况流水号)===1 && Number(scope.row.付款情况流水号)!==2)" type="danger" size="mini" icon="el-icon-delete" style="margin-left: 10px" plain @click="cancelRequestFund(scope.row)">取消请款</el-button>
</template>
</el-table-column>
</el-table>
@@ -167,9 +167,14 @@
{{ scope.row.已付金额 }}
</template>
</el-table-column>
<el-table-column label="申请中金额" align="center" min-width="100" prop="申请中金额">
<template slot-scope="scope">
{{ scope.row.申请中金额 }}
</template>
</el-table-column>
<el-table-column label="请款金额" align="center" min-width="100" prop="请款金额">
<template slot-scope="scope">
<el-input-number :max="scope.row.含税总金额 - scope.row.已付金额" :disabled="(scope.row.含税总金额 - scope.row.已付金额) === 0" v-model="scope.row.请款金额" controls-position="right" size="mini" style="width: 100%;"/>
<el-input-number :max="scope.row.含税总金额 - scope.row.已付金额 - scope.row.申请中金额" :disabled="(scope.row.含税总金额 - scope.row.已付金额 - scope.row.申请中金额) === 0" v-model="scope.row.请款金额" controls-position="right" size="mini" style="width: 100%;"/>
</template>
</el-table-column>
</el-table>
@@ -187,6 +192,7 @@ import { timeToStamp } from '@/utils/tool'
export default {
data() {
return {
selectContents: [],
getDate: null,
tableData0: [],
pickerOptions: {
@@ -319,7 +325,7 @@ export default {
this.tableData01 = response.data
this.tableData01.map(v => {
this.$set(v, '请款金额', 0)
v.请款金额 = v.含税总金额 - v.已付金额
v.请款金额 = v.含税总金额 - v.已付金额 - v.申请中金额
return v
})
})
@@ -331,6 +337,7 @@ export default {
return parseInt(row.已请款) !== 1 // 已经请款
},
handleSelectionChange(val) {
this.selectContents = val
this.SUM = 0
this.contractGroup = []
this.sumGroup = []
@@ -342,13 +349,31 @@ export default {
},
submitRequestFund() { // 确认请款
if (this.supplierValue && this.contractGroup.length !== 0) {
submitRequestFund(this.contractGroup, this.sumGroup, this.supplierValue, this.SUM, this.id).then(response => {
if (response.data[0].result === '1') {
this.$message.success('请款成功')
this.searchTable1()
this.dialogVisible2 = false
} else { this.$message.error('请款失败') }
})
this.SUM = 0
this.contractGroup = []
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.SUM === 0) {
this.$message.error('请款金额不能为0')
} else {
submitRequestFund(this.contractGroup, this.sumGroup, this.supplierValue, this.SUM, this.id).then(response => {
if (response.data[0].result === '1') {
this.$message.success('请款成功')
this.searchTable1()
this.dialogVisible2 = false
} else {
this.$message.error('请款失败')
}
})
}
} else {
this.$message.error('请选择需要请款的合同')
}