Browse Source

修改bug

Qukatie 10 months ago
parent
commit
d2b1df3e43

+ 6 - 16
src/views/tirePartsMall/financialManagement/collectionSettlement/detailsPage.vue

@@ -59,12 +59,12 @@
           </template>
           <template slot-scope="{ row, index }" slot="thisAmount">
             <el-input-number size="small" v-model="row.thisAmount" :precision="2" :controls="false"
-              v-if="row.$cellEdit && row.businesType == 'XS'" @change="thisAmountChange(row)"></el-input-number>
+              v-if="row.$cellEdit && row.businesType == 'XS'" @change="thisAmountChange(row)" :max="row.accountsAmount-row.settlmentAmount"></el-input-number>
             <span v-else>{{ row.thisAmount }}</span>
           </template>
           <template slot-scope="{ row, index }" slot="thisRefundAmount">
             <el-input-number size="small" width="100" v-model="row.thisRefundAmount" :precision="2" :controls="false"
-              v-if="row.$cellEdit && row.businesType == 'TKXS'" @change="thisReAmountChange(row)"></el-input-number>
+              v-if="row.$cellEdit && row.businesType == 'TKXS'" @change="thisReAmountChange(row)" :max="row.accountsAmount-row.settlmentAmount"></el-input-number>
             <span v-else>{{ row.thisRefundAmount }}</span>
           </template>
           <template slot-scope="{type,size,row,index,disabled}" slot="menu">
@@ -380,30 +380,20 @@ export default {
   },
   methods: {
     thisAmountChange(row){
-      let num=Number(row.accountsAmount)-Number(row.settlmentAmount)
-      if(row.thisAmount>num){
-        this.$message.error("请正确输入本次金额!");
-        this.$set(row,'thisAmount',0)
-      }
       let sum1=0
       let sum2=0
       this.form.settlementItemsList.forEach(e=>{
-        sum1+=e.thisAmount;
-        sum2+=e.thisRefundAmount;
+        sum1 += e.thisAmount ? Number(e.thisAmount) : 0;
+        sum2 += e.thisRefundAmount ? Number(e.thisRefundAmount) : 0;
         this.$set(this.form,'amount',sum1-sum2)
       })
     },
     thisReAmountChange(row){
-      let num=Number(row.accountsAmount)-Number(row.settlmentAmount)
-      if(row.thisRefundAmount>num){
-        this.$message.error("请正确输入本次金额!");
-        this.$set(row,'thisRefundAmount',0)
-      }
       let sum1=0
       let sum2=0
       this.form.settlementItemsList.forEach(e=>{
-        sum1+=e.thisAmount;
-        sum2+=e.thisRefundAmount;
+        sum1 += e.thisAmount ? Number(e.thisAmount) : 0;
+        sum2 += e.thisRefundAmount ? Number(e.thisRefundAmount) : 0;
         this.$set(this.form,'amount',sum1-sum2)
       })
     },

+ 7 - 17
src/views/tirePartsMall/financialManagement/paymentSettlement/detailsPage.vue

@@ -40,12 +40,12 @@
           </template>
           <template slot-scope="{ row, index }" slot="thisAmount">
             <el-input-number size="small" v-model="row.thisAmount" :precision="2" :controls="false"
-              v-if="row.$cellEdit && row.businesType == 'CG'" @change="thisAmountChange(row)"></el-input-number>
+              v-if="row.$cellEdit && row.businesType == 'CG'" @change="thisAmountChange(row)" :max="row.accountsAmount-row.settlmentAmount"></el-input-number>
             <span v-else>{{ row.thisAmount }}</span>
           </template>
           <template slot-scope="{ row, index }" slot="thisRefundAmount">
             <el-input-number size="small" width="100" v-model="row.thisRefundAmount" :precision="2" :controls="false"
-              v-if="row.$cellEdit && row.businesType == 'TKCG'" @change="thisReAmountChange(row)"></el-input-number>
+              v-if="row.$cellEdit && row.businesType == 'TKCG'" @change="thisReAmountChange(row)" :max="row.accountsAmount-row.settlmentAmount"></el-input-number>
             <span v-else>{{ row.thisRefundAmount }}</span>
           </template>
           <template slot-scope="{type,size,row,index,disabled}" slot="menu">
@@ -323,30 +323,20 @@ export default {
   },
   methods: {
     thisAmountChange(row) {
-      let num = Number(row.accountsAmount) - Number(row.accountsAmount)
-      if (row.thisAmount > num) {
-        this.$message.error("请正确输入本次金额!");
-        this.$set(row, 'thisAmount', 0)
-      }
       let sum1 = 0
       let sum2 = 0
       this.form.settlementItemsList.forEach(e => {
-        sum1 += e.thisAmount;
-        sum2 += e.thisRefundAmount;
+        sum1 += e.thisAmount ? Number(e.thisAmount) : 0;
+        sum2 += e.thisRefundAmount ? Number(e.thisRefundAmount) : 0;
         this.$set(this.form, 'amount', sum1 - sum2)
       })
     },
     thisReAmountChange(row) {
-      let num = Number(row.accountsAmount) - Number(row.accountsAmount)
-      if (row.thisRefundAmount > num) {
-        this.$message.error("请正确输入本次金额!");
-        this.$set(row, 'thisRefundAmount', 0)
-      }
       let sum1 = 0
       let sum2 = 0
       this.form.settlementItemsList.forEach(e => {
-        sum1 += e.thisAmount;
-        sum2 += e.thisRefundAmount;
+        sum1 += e.thisAmount ? Number(e.thisAmount) : 0;
+        sum2 += e.thisRefundAmount ? Number(e.thisRefundAmount) : 0;
         this.$set(this.form, 'amount', sum1 - sum2)
       })
     },
@@ -478,7 +468,7 @@ export default {
       let sum2 = 0
       list.forEach((item, index) => {
         item.contractNumber = item.ordNo;
-        item.accountsAmount = item.bsType == "CG"?item.totalMoney:item.returnsAmount
+        item.accountsAmount = item.bsType == "CG" ? item.totalMoney : item.returnsAmount
         item.settlmentAmount = item.paymentAmountTl
         item.businesType = item.bsType
         this.$set(item, 'thisAmount', item.bsType == "CG" ? (Number(item.totalMoney) - Number(item.paymentAmountTl)) : 0)