فهرست منبع

送货上门优化

shish 1 ماه پیش
والد
کامیت
c2c41d2651
1فایلهای تغییر یافته به همراه63 افزوده شده و 5 حذف شده
  1. 63 5
      ghsApp/src/pagesClient/member/detail.vue

+ 63 - 5
ghsApp/src/pagesClient/member/detail.vue

@@ -225,6 +225,23 @@
                 </view>
                 <button class="admin-button-com blue middle" @tap="changeHomeParams">确定</button>
               </tui-list-cell>
+              <!-- 不满最低消费要求时的处理方式:收运费 / 收包装费 / 不能下单 -->
+              <tui-list-cell class="line-cell" :hover="false" v-if="form.home == 1">
+                <div class="tui-title">不满最低要求</div>
+                <button class="admin-button-com middle" :class="[form.homeUnMeet == 0 ? 'blue' : 'default']" @click="homeUnMeetBtn(0)">收运费</button>
+                <button class="admin-button-com middle" :class="[form.homeUnMeet == 1 ? 'blue' : 'default']" @click="homeUnMeetBtn(1)" style="margin-left:4upx;">收包装费</button>
+                <button class="admin-button-com middle" :class="[form.homeUnMeet == 2 ? 'blue' : 'default']" @click="homeUnMeetBtn(2)" style="margin-left:4upx;">不能买</button>
+              </tui-list-cell>
+              <!-- homeUnMeet 为 0/1 时填写对应费用;为 2(不能下单)时不展示 -->
+              <tui-list-cell class="line-cell" :hover="false" v-if="form.home == 1 && form.homeUnMeet != 2">
+                <div class="tui-title">{{ homeUnFeeLabel }}</div>
+                <view style="display:flex;align-items:center;">
+                  <input v-model="userInfo.homeUnFee" @click="userInfo.homeUnFee=''" placeholder-class="phcolor" class="tui-input" confirm-type="go" placeholder="请填写" type="digit" style="width:245upx;border:1upx solid #ddd;margin-right:10upx;height:70upx;text-align:center;" />
+                  <text style="margin-right:30upx;">元</text>
+                </view>
+                <button class="admin-button-com blue middle" @tap="changeHomeParams(true)">确定</button>
+              </tui-list-cell>
+
             </view>
 
             <tui-list-cell class="line-cell" :hover="false">
@@ -475,6 +492,7 @@ export default {
         home:1,
         homeAmount:0,
         homeNum:0,
+        homeUnMeet:0,
         risePercent:0,
         riseRange:0,
         wlId:0,
@@ -547,7 +565,11 @@ export default {
     };
   },
 	computed: {
-		...mapGetters({ dictInfo:"getDictionariesInfo" })
+		...mapGetters({ dictInfo:"getDictionariesInfo" }),
+    /** 不满最低要求时:0 收运费,1 收包装费,对应费用输入框标题 */
+    homeUnFeeLabel () {
+      return Number(this.form.homeUnMeet) === 1 ? '包装费' : '运费'
+    }
 	},
 	onShareAppMessage(res) {
     let id = this.userInfo.ghsId ? this.userInfo.ghsId : 0
@@ -850,7 +872,11 @@ export default {
         }
       })
     },
-    changeHomeParams(){
+    /**
+     * 保存送货上门相关参数
+     * @param {boolean} validateFee - 是否校验运费/包装费(费用行点确定时为 true)
+     */
+    changeHomeParams(validateFee = false){
       if(this.$util.isEmpty(this.userInfo.homeAmount)){
         this.$msg('请填写最低消费金额')
         return false
@@ -859,14 +885,45 @@ export default {
         this.$msg('请填写最低消费扎数')
         return false
       }
-      let homeAmount = this.userInfo.homeAmount
-      let homeNum = this.userInfo.homeNum
-      modifyHomeParams({id:this.option.id,homeAmount:homeAmount,homeNum:homeNum}).then(res=>{
+      const homeUnMeet = Number(this.form.homeUnMeet) || 0
+      if (validateFee && homeUnMeet !== 2 && this.$util.isEmpty(this.userInfo.homeUnFee)) {
+        this.$msg(homeUnMeet === 1 ? '请填写包装费' : '请填写运费')
+        return false
+      }
+      modifyHomeParams({
+        id: this.option.id,
+        homeAmount: this.userInfo.homeAmount,
+        homeNum: this.userInfo.homeNum,
+        homeUnMeet: homeUnMeet,
+        homeUnFee: homeUnMeet === 2 ? 0 : (this.userInfo.homeUnFee || 0)
+      }).then(res=>{
         if(res.code == 1){
           this.$msg(res.msg)
         }
       })
     },
+    /**
+     * 切换「不满最低要求时」的处理方式
+     * @param {number} value - 0 收运费,1 收包装费,2 不能下单
+     */
+    homeUnMeetBtn (value) {
+      if (Number(this.form.homeUnMeet) === value) {
+        return true
+      }
+      this.form.homeUnMeet = value
+      this.userInfo.homeUnMeet = value
+      modifyHomeParams({
+        id: this.option.id,
+        homeAmount: this.userInfo.homeAmount,
+        homeNum: this.userInfo.homeNum,
+        homeUnMeet: value,
+        homeUnFee: value === 2 ? 0 : (this.userInfo.homeUnFee || 0)
+      }).then(res => {
+        if (res.code == 1) {
+          this.$msg(res.msg)
+        }
+      })
+    },
     changeShortName(){
       let shortName = this.userInfo.shortName||''
       modifyShortName({id:this.option.id,shortName:shortName}).then(res=>{
@@ -1120,6 +1177,7 @@ export default {
         this.form.showStock = this.userInfo.showStock
         this.form.passStatus = this.userInfo.passStatus
         this.form.home = this.userInfo.home
+        this.form.homeUnMeet = this.userInfo.homeUnMeet != null ? Number(this.userInfo.homeUnMeet) : 0
         this.form.staffId = this.userInfo.staffId
         this.form.staffName = this.userInfo.staffName
         this.form.debtLimitPay = this.userInfo.debtLimitPay||0