shish 1 miesiąc temu
rodzic
commit
de885cc0df
1 zmienionych plików z 68 dodań i 3 usunięć
  1. 68 3
      ghsApp/src/admin/billing/affirm.vue

+ 68 - 3
ghsApp/src/admin/billing/affirm.vue

@@ -148,11 +148,21 @@
                 <view class="tui-input">{{ form.customName }}</view>
                 <view class="tui-input">{{ form.customName }}</view>
               </tui-list-cell>
               </tui-list-cell>
 
 
+              <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-if="Number(customNetBalance) > 0">
+                <view class="tui-title">余额</view>
+                <view class="tui-input" style="color:#3385FF;font-weight:bold;">
+                  ¥{{ parseFloat(customNetBalance) }}
+                  <text v-if="Number(customNetBalance) >= Number(modifyPrice)" style="margin-left:20upx;">余额充足,已用余额支付</text>
+                  <text v-else-if="form.hasPay == 2" style="margin-left:20upx;font-size:26upx;">余额¥{{ parseFloat(customNetBalance) }}将先抵本单</text>
+                </view>
+              </tui-list-cell>
+
               <tui-list-cell class="line-cell" :hover="false" :arrow="false">
               <tui-list-cell class="line-cell" :hover="false" :arrow="false">
                 <view class="tui-title">收款方式</view>
                 <view class="tui-title">收款方式</view>
-                <button @click="form.hasPay = 2" class="admin-button-com big" :class="form.hasPay == 2 ? 'blue' : 'default'" style="margin-right:20upx;width:130upx;"> 挂账 </button>
-                <button @click="form.hasPay = 0" class="admin-button-com big" :class="form.hasPay == 0 ? 'blue' : 'default'" style="margin-right:20upx;width:130upx;"> 扫码 </button>
-                <button @tap="form.hasPay = 1" class="admin-button-com big" :class="form.hasPay == 1 ? 'blue' : 'default'" style="margin-right:0upx;width:130upx;">线下</button>
+                <button @click="selectHasPay(2)" class="admin-button-com big pay-way-btn" :class="form.hasPay == 2 ? 'blue' : 'default'">挂账</button>
+                <button @click="selectHasPay(4)" class="admin-button-com big pay-way-btn" :class="form.hasPay == 4 ? 'blue' : 'default'" v-if="Number(customNetBalance) > 0">余额</button>
+                <button @click="selectHasPay(0)" class="admin-button-com big pay-way-btn" :class="form.hasPay == 0 ? 'blue' : 'default'">扫码</button>
+                <button @tap="selectHasPay(1)" class="admin-button-com big pay-way-btn" :class="form.hasPay == 1 ? 'blue' : 'default'">线下</button>
               </tui-list-cell>
               </tui-list-cell>
 
 
               <tui-list-cell class="line-cell" :arrow="true" v-if="form.hasPay == 1">
               <tui-list-cell class="line-cell" :arrow="true" v-if="form.hasPay == 1">
@@ -173,6 +183,11 @@
                 <view class="tui-input" style="color:#3385ff;">客户要赊账欠款的,选挂账</view>
                 <view class="tui-input" style="color:#3385ff;">客户要赊账欠款的,选挂账</view>
               </tui-list-cell>
               </tui-list-cell>
 
 
+              <tui-list-cell class="line-cell" :arrow="false" v-if="form.hasPay == 4">
+                <view class="tui-title">余额</view>
+                <view class="tui-input" style="color:#3385ff;">使用账户余额支付</view>
+              </tui-list-cell>
+
               <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-show="displayPackCost == true">
               <tui-list-cell class="line-cell" :hover="false" :arrow="false" v-show="displayPackCost == true">
                 <view class="tui-title">打包费</view>
                 <view class="tui-title">打包费</view>
                 <input type="digit" placeholder="请填写打包费" v-model="form.packCost" placeholder-class="tui-placeholder" />
                 <input type="digit" placeholder="请填写打包费" v-model="form.packCost" placeholder-class="tui-placeholder" />
@@ -845,6 +860,10 @@ export default {
       let currentPrice = parseFloat(finalPrice);
       let currentPrice = parseFloat(finalPrice);
       this.modifyPrice = currentPrice;
       this.modifyPrice = currentPrice;
       return currentPrice;
       return currentPrice;
+    },
+    customNetBalance() {
+      const balance = Number(this.customInfo && this.customInfo.balance != null ? this.customInfo.balance : 0);
+      return isNaN(balance) ? 0 : balance;
     }
     }
   },
   },
   watch: {
   watch: {
@@ -889,6 +908,12 @@ export default {
       if (this.form.sendType == 2) {
       if (this.form.sendType == 2) {
         this.getDeliveryQuotes();
         this.getDeliveryQuotes();
       }
       }
+    },
+    modifyPrice() {
+      this.syncPayWayByBalance();
+    },
+    customNetBalance() {
+      this.syncPayWayByBalance();
     }
     }
   },
   },
   methods: {
   methods: {
@@ -968,6 +993,26 @@ export default {
       this.payWayindex = index;
       this.payWayindex = index;
       this.form.payWay = this.payWayList[index].id;
       this.form.payWay = this.payWayList[index].id;
     },
     },
+    selectHasPay(type) {
+      if (type == 2 && Number(this.customNetBalance) >= Number(this.modifyPrice)) {
+        this.$msg('余额充足,请用余额支付');
+        this.form.hasPay = 4;
+        return;
+      }
+      if (type == 4 && Number(this.customNetBalance) < Number(this.modifyPrice)) {
+        this.$msg('余额不足,无法余额支付');
+        return;
+      }
+      this.form.hasPay = type;
+    },
+    syncPayWayByBalance() {
+      if (Number(this.modifyPrice) <= 0) {
+        return;
+      }
+      if (Number(this.customNetBalance) >= Number(this.modifyPrice) && this.form.hasPay == 2) {
+        this.form.hasPay = 4;
+      }
+    },
     setTransType(type) {
     setTransType(type) {
       this.form.transType = type;
       this.form.transType = type;
     },
     },
@@ -1009,6 +1054,8 @@ export default {
         name = '确认线下已付?';
         name = '确认线下已付?';
       } else if (this.form.hasPay == 2) {
       } else if (this.form.hasPay == 2) {
         name = '确认挂账?';
         name = '确认挂账?';
+      } else if (this.form.hasPay == 4) {
+        name = '确认余额支付?';
       } else {
       } else {
         name = '确认提交';
         name = '确认提交';
       }
       }
@@ -1092,6 +1139,15 @@ export default {
           }
           }
         }
         }
 
 
+        if (this.form.hasPay == 4 && Number(this.customNetBalance) < Number(this.modifyPrice)) {
+          this.$msg('余额不足');
+          return false;
+        }
+        if (this.form.hasPay == 2 && Number(this.customNetBalance) >= Number(this.modifyPrice)) {
+          this.$msg('余额充足,请用余额支付');
+          return false;
+        }
+
         //多颜色
         //多颜色
         let xj = null;
         let xj = null;
         if (this.option && this.option.customId) {
         if (this.option && this.option.customId) {
@@ -1323,6 +1379,7 @@ export default {
         that.form.customName = res.data.name;
         that.form.customName = res.data.name;
         that.customInfo = res.data;
         that.customInfo = res.data;
         that.form.wlName = res.data.wlName ? res.data.wlName : '';
         that.form.wlName = res.data.wlName ? res.data.wlName : '';
+        that.syncPayWayByBalance();
         that.$forceUpdate();
         that.$forceUpdate();
       });
       });
     },
     },
@@ -1353,6 +1410,14 @@ export default {
 .admin-button-com {
 .admin-button-com {
   margin-right: 30upx;
   margin-right: 30upx;
 }
 }
+.pay-way-btn {
+  margin-right: 12upx;
+  width: 120upx;
+  padding: 0;
+  &:last-child {
+    margin-right: 0;
+  }
+}
 .checkbox-row-call {
 .checkbox-row-call {
   display: flex;
   display: flex;
   align-items: center;
   align-items: center;