Forráskód Böngészése

配件销售单里的付款

caojunjie 2 éve
szülő
commit
b2b4f360a4
1 módosított fájl, 61 hozzáadás és 59 törlés
  1. 61 59
      src/views/salesOrder/detailsPage.vue

+ 61 - 59
src/views/salesOrder/detailsPage.vue

@@ -151,7 +151,7 @@
 
       <!--付款的弹窗-->
       <el-dialog
-          title="收款"
+          title="收款"
           :visible.sync="paymentVisible"
           append-to-body
           :close-on-click-modal="false"
@@ -162,29 +162,50 @@
           v-loading="loadingBtn"
           :before-close="paymentClose">
           <div>
-              <div style="font-size: 16px">金额:{{zhifdingdan}}</div>
-
+              <!--<div style="font-size: 16px">金额:{{zhifdingdan}}</div>-->
+              <div style="display: flex;align-items: center;margin-top: 20px">
+                  <div style="margin-right: 10px;width: 90px;text-align: right">订单金额:</div>
+                  <el-input style="width: calc(100% - 90px)" type="number" v-model="form.orderAmount" disabled
+                            placeholder="请输入" size="small" :controls="false"
+                            @change="thisUsedchange" >
+                  </el-input>
+              </div>
               <div style="display: flex;align-items: center;margin-top: 20px">
                   <div style="margin-right: 10px;width: 90px;text-align: right">优惠金额:</div>
-                  <el-input style="width: 200px;" type="number" v-model="form.thisUsedProfit" :disabled="jsthisUsedProfit != 0"
-                                   placeholder="请输入" size="small" :controls="false"
-                                   @change="thisUsedchange" >
+                  <el-input style="width: calc(100% - 90px)" type="number" v-model="form.thisUsedProfit" :disabled="jsthisUsedProfit != 0"
+                            placeholder="请输入" size="small" :controls="false"
+                            @change="thisUsedchange" >
+                  </el-input>
+              </div>
+              <div style="display: flex;align-items: center;margin-top: 20px">
+                  <div style="margin-right: 10px;width: 90px;text-align: right">应收金额:</div>
+                  <el-input style="width: calc(100% - 90px)" type="number" v-model="form.debitAmount" disabled
+                            placeholder="请输入" size="small" :controls="false"
+                            @change="thisUsedchange" >
                   </el-input>
               </div>
               <div style="display: flex;align-items: center;margin-top: 20px">
-                  <div style="margin-right: 10px;width: 90px;text-align: right">会员卡金额:</div>
-                  <div style="display: flex">
-                      <el-input style="width: 200px;" type="number" v-model="form.memberAmout" size="small" placeholder="请输入会员卡金额"
-                                @change="memberchange"></el-input>
-                      <span style="margin-left: 10px;border: 1px solid #E4E7ED;padding: 6px;border-radius: 4px">
-                          余额:{{balanceAmounts}}
-                      </span>
+                  <div style="margin-right: 10px;width: 90px;text-align: right">已收金额:</div>
+                  <el-input style="width: calc(100% - 90px)" type="number" v-model="form.settlmentAmount" disabled
+                            placeholder="请输入" size="small" :controls="false"
+                            @change="thisUsedchange" >
+                  </el-input>
+              </div>
+              <div style="display: flex;align-items: center;margin-top: 20px">
+                  <div style="margin-right: 10px;width: 90px;text-align: right">会员卡:</div>
+                  <div style="display: flex;width: calc(100% - 90px)">
+                      <el-input type="number" v-model="form.memberAmout" size="small" placeholder="请输入会员卡金额"
+                                @change="memberchange">
+                          <template slot="append">
+                              <span>余额:{{balanceAmounts}}</span>
+                          </template>
+                      </el-input>
                   </div>
               </div>
               <div style="display: flex;align-items: center;margin-top: 20px">
                   <div style="margin-right: 10px;width: 90px;text-align: right">账户:</div>
-                  <div>
-                      <el-select v-model="form.account" size="small" placeholder="请选择">
+                  <div style="width: calc(100% - 90px)">
+                      <el-select style="width: 100%" v-model="form.account" size="small" placeholder="请选择">
                           <el-option
                               v-for="item in accountdata"
                               :key="item.dictKey"
@@ -196,8 +217,8 @@
               </div>
               <div style="display: flex;align-items: center;margin-top: 20px">
                   <div style="margin-right: 10px;width: 90px;text-align: right">收款金额:</div>
-                  <div>
-                      <el-input style="width: 200px;" type="number" v-model="form.currentAmount" size="small" placeholder="请输入支付金额"
+                  <div style="width: calc(100% - 90px)">
+                      <el-input type="number" v-model="form.currentAmount" size="small" placeholder="请输入支付金额"
                                 @change="currentchange"
                        ></el-input>
                   </div>
@@ -599,37 +620,21 @@ export default {
       // },
       // 优惠金额的监听
       thisUsedchange(){
-          // this.form.memberBalance = this.form.memberBalance?this.form.memberBalance:0
-          this.form.memberAmout = 0
           if(Number(this.form.thisUsedProfit) < 0) {
               this.$nextTick(()=>{
+                  this.$message.error('优惠金额不能小于零');
                   this.form.thisUsedProfit = 0
               })
           }
-          if (Number(this.form.thisUsedProfit) >= Number(this.form.orderAmount)) {
+          if (Number(this.form.thisUsedProfit) > Number(this.form.orderAmount)){
               this.$nextTick(()=>{
-                  this.form.thisUsedProfit = Number(this.form.orderAmount) - 1
-                  // this.form.memberBalance = 0
-                  this.form.currentAmount = 0
-              })
-          }
-          // let sum = Number(this.form.orderAmount) - Number(this.form.memberBalance)
-          let sum = Number(this.form.orderAmount)
-          if (Number(this.form.thisUsedProfit) > sum){
-              this.$nextTick(()=>{
-                  console.log(this.form.thisUsedProfit)
-                  // this.form.thisUsedProfit = sum
-                  this.form.currentAmount = 0
+                  this.$message.error('优惠金额不能大于未收金额');
+                  this.form.thisUsedProfit = 0
               })
           }
-
           this.$nextTick(()=>{
-              // console.log(sum - this.form.thisUsedProfit)
-              this.form.settlmentAmount = this.form.settlmentAmount?this.form.settlmentAmount:0
-              // this.$set(this.form,'currentAmount',sum - this.form.thisUsedProfit - this.form.settlmentAmount)
-              this.form.currentAmount = sum - this.form.thisUsedProfit - this.form.settlmentAmount - this.form.memberAmout
-              this.form.debitAmount = subtract(this.form.orderAmount, this.form.thisUsedProfit)
-              this.zhifdingdan = Number(this.form.debitAmount) - Number(this.form.settlmentAmount)
+              this.form.debitAmount = this.form.orderAmount - this.form.thisUsedProfit
+              this.form.currentAmount = this.form.debitAmount - this.form.settlmentAmount - this.form.memberAmout
           })
       },
       // 会员卡金额的监听
@@ -644,31 +649,26 @@ export default {
           this.form.memberAmout = this.form.memberAmout?this.form.memberAmout:0
           if (this.form.memberAmout < 0) {
               this.$nextTick(()=>{
+                  this.$message.error('会员卡不能小于零');
                   this.form.memberAmout = 0
                   let a = Number(this.form.debitAmount) - Number(this.form.settlmentAmount)
                   this.$set(this.form,'currentAmount',a)
               })
           }
-          if (this.form.memberAmout > Number(this.balanceAmounts)) {
-              this.$nextTick(()=>{
-                  this.form.memberAmout = Number(this.balanceAmounts)
-              })
-          }
+          // if (this.form.memberAmout > Number(this.balanceAmounts)) {
+          //     this.$nextTick(()=>{
+          //         this.form.memberAmout = Number(this.balanceAmounts)
+          //     })
+          // }
           this.form.settlmentAmount = this.form.settlmentAmount?this.form.settlmentAmount:0
-          let sum = Number(this.form.orderAmount) - Number(this.form.thisUsedProfit) - Number(this.form.settlmentAmount)
+          let sum = this.form.debitAmount - this.form.settlmentAmount
           if (this.form.memberAmout > sum) {
               this.$nextTick(()=>{
-                  this.form.memberAmout = sum
+                  this.form.memberAmout = 0
                   this.$delete(this.form, 'currentAmount')
-                  this.$set(this.form,'currentAmount',0)
+                  this.$set(this.form,'currentAmount',sum - this.form.memberAmout)
               })
           }
-          this.$nextTick(()=>{
-              console.log(sum - this.form.memberAmout)
-
-              // this.$set(this.form,'currentAmount',(sum - this.form.memberAmout).toFixed(2))
-              // this.form.currentAmount = sum - this.form.memberAmout
-          })
           this.$delete(this.form, 'currentAmount')
           this.$set(this.form,'currentAmount',sum - this.form.memberAmout)
           console.log(this.form.currentAmount,666)
@@ -676,13 +676,14 @@ export default {
       // 本次金额监听
       currentchange(){
           if (this.form.currentAmount < 0) {
+              this.$message.error('收款金额不能小于零');
               this.form.currentAmount = 0
           }
           this.form.memberAmout = this.form.memberAmout?this.form.memberAmout:0
-          if ((Number(this.form.currentAmount) + Number(this.form.memberAmout)) > this.zhifdingdan) {
-              this.form.currentAmount = this.zhifdingdan
-              this.form.memberAmout = 0
-          }
+          // if ((Number(this.form.currentAmount) + Number(this.form.memberAmout)) > this.zhifdingdan) {
+          //     this.form.currentAmount = this.zhifdingdan
+          //     this.form.memberAmout = 0
+          // }
       },
       // 收款点击事件
       clickPayment(){
@@ -708,7 +709,7 @@ export default {
           this.getWorkDicts("account").then(res => {
               this.accountdata = res.data.data;
           });
-          this.zhifdingdan = Number(this.form.debitAmount) - Number(this.form.settlmentAmount)
+          this.zhifdingdan = Number(this.form.orderAmount) - Number(this.form.settlmentAmount)
           this.form.memberAmout = this.form.memberAmout?this.form.memberAmout:0
           this.form.currentAmount = this.form.currentAmount?this.form.currentAmount:0
           this.paymentVisible = true
@@ -740,7 +741,8 @@ export default {
               this.$message.success('收款成功');
               this.paymentVisible = false
               this.loadingBtn = false
-              this.getDetail(this.detailData.id);
+              console.log(this.form.id,741)
+              this.getDetail(this.form.id);
           })
       },
       // // 付款弹窗的关闭