Przeglądaj źródła

1.零售收银跑腿展示地址 2.校验地址是否为空及相关优化

shizhongqi 6 miesięcy temu
rodzic
commit
552f5e4fe1

+ 1 - 1
ghsApp/src/admin/billing/affirm.vue

@@ -1172,7 +1172,7 @@ export default {
     getDeliveryQuotes() {
       //如果客户地址缺少经度、纬度和address,任何一个,则不要请求后端询价接口
       if (this.$util.isEmpty(this.customInfo.long) || this.$util.isEmpty(this.customInfo.lat) || this.$util.isEmpty(this.customInfo.address)) {
-        this.$msg('客户地址缺少经纬度或地址,任何一个,无法获取运费', 'none', 2200);
+        this.$msg('客户地址缺少经纬度或地址,无法获取运费', 'none', 2200);
         return;
       }
       

+ 21 - 2
ghsPad/src/pages/home/components/settlePop.vue

@@ -22,7 +22,7 @@
                     <view class="select-item_box" style="display: flex; align-items: center; border-bottom:1upx solid #eee; margin-bottom:3upx;">
                         <view class="title">客户地址</view>
                         <view class="address-box">
-                            <view v-if="$util.isEmpty(custom.long) || $util.isEmpty(custom.lat) || $util.isEmpty(custom.address)" class="addr-main" style="color: red; font-size: 28rpx;">
+                            <view v-if="$util.isEmpty(custom.long) || $util.isEmpty(custom.lat) || $util.isEmpty(custom.address)" class="addr-main" style="color: red; font-size: 11upx;">
                                 客户地址不完善,请修改
                             </view>
                             <view v-else>
@@ -358,6 +358,9 @@ export default {
                 price = parseFloat(price.toFixed(2))
             }
             return Number(price)
+        },
+        isAddressInvalid() {
+            return this.$util.isEmpty(this.custom.long) || this.$util.isEmpty(this.custom.lat) || this.$util.isEmpty(this.custom.address)
         }
     },
     watch:{
@@ -373,6 +376,9 @@ export default {
             
             this.weightDebounceTimer = setTimeout(() => {
                 if (newVal && Number(newVal) > 0 && this.form.sendType == 2) {
+                    if (this.isAddressInvalid) {
+                        return;
+                    }
                     this.handleLoadDelivery();
                 }
             }, 1000);
@@ -383,6 +389,9 @@ export default {
                     this.clearDeliveryList();
                 }
                 if (this.form.sendType == 2) {
+                    if (this.isAddressInvalid) {
+                        return;
+                    }
                     this.getDeliveryQuotes();
                 }
             },
@@ -393,6 +402,9 @@ export default {
                 this.clearDeliveryList();
             }
             if (this.form.sendType == 2) {
+                if (this.isAddressInvalid) {
+                    return;
+                }
                 this.getDeliveryQuotes();
             }
         },
@@ -699,6 +711,13 @@ export default {
                 this.$msg('请先选择客户');
                 return false;
             }
+
+            //客户地址不完善
+            if (this.isAddressInvalid) {
+                this.$msg('客户地址不完善,无法发跑腿');
+                return false;
+            }
+
             this.deliveryQuotes = [];
             this.selectedDeliveryIndex = -1;
             this.selectedDeliveryData = null;
@@ -753,7 +772,7 @@ export default {
                 } else {
                     uni.showToast({ title: '获取跑腿平台报价失败', icon: 'none' });
                 }
-                this.form.sendType = 1; // 切换回自取
+                //this.form.sendType = 1; // 切换回自取
                 this.deliveryQuotes = [];
             });
         },

+ 1 - 1
hdApp/src/admin/billing/affirm.vue

@@ -1122,7 +1122,7 @@ export default {
     getDeliveryQuotes(){
       //如果客户地址缺少经纬度或地址,任何一个,则不要请求后端询价接口
       if (this.$util.isEmpty(this.customInfo.long) || this.$util.isEmpty(this.customInfo.lat) || this.$util.isEmpty(this.customInfo.address)) {
-        this.$msg('客户地址缺少经纬度或地址,任何一个,无法获取运费', 'none', 2200);
+        this.$msg('客户地址缺少经纬度或地址,无法获取运费', 'none', 2200);
         return;
       }
       this.deliveryQuotes = []

+ 1 - 1
hdPad/src/pages/home/components/console.vue

@@ -42,7 +42,7 @@
 
     <!-- 结算弹框 -->
     <uni-popup ref="settlePopRef" background-color="#fff" type="center" :animation="false">
-        <settlePop @settleCommit="settleCommit" @cancelSettle="cancelSettle" ref="settlePop" :settleOpenStatus.sync="settleOpenStatus" :balance.sync="balance" :customId.sync="customId"></settlePop>
+        <settlePop @settleCommit="settleCommit" @cancelSettle="cancelSettle" ref="settlePop" :settleOpenStatus.sync="settleOpenStatus" :balance.sync="balance" :customId.sync="customId" :custom.sync="custom"></settlePop>
     </uni-popup>
 
     <!-- 扫码付款 -->

+ 14 - 9
hdPad/src/pages/home/components/deliveryPop.vue

@@ -10,7 +10,7 @@
       <view class="select-item_box address-section">
         <view class="title">客户地址</view>
         <view class="address-box">
-          <view v-if="$util.isEmpty(custom.long) || $util.isEmpty(custom.lat) || $util.isEmpty(custom.address)"
+          <view v-if="isAddressInvalid"
             class="addr-main" style="color: red; font-size: 10upx">
             客户地址不完善,请修改
           </view>
@@ -118,6 +118,11 @@ export default {
       weightDebounceTimer: null
     }
   },
+  computed: {
+    isAddressInvalid() {
+      return this.$util.isEmpty(this.custom.long) || this.$util.isEmpty(this.custom.lat) || this.$util.isEmpty(this.custom.address)
+    }
+  },
   watch: {
     'form.weight'(newVal) {
       if (this.weightDebounceTimer) {
@@ -131,7 +136,7 @@ export default {
 
       this.weightDebounceTimer = setTimeout(() => {
         if (newVal && Number(newVal) > 0) {
-          if (this.$util.isEmpty(this.custom.long) || this.$util.isEmpty(this.custom.lat) || this.$util.isEmpty(this.custom.address)) {
+          if (this.isAddressInvalid) {
             return
           }
           this.getDeliveryQuotes()
@@ -141,7 +146,7 @@ export default {
     pickupTime: {
       handler() {
         this.clearDeliveryList()
-        if (this.$util.isEmpty(this.custom.long) || this.$util.isEmpty(this.custom.lat) || this.$util.isEmpty(this.custom.address)) {
+        if (this.isAddressInvalid) {
           return
         }
         this.getDeliveryQuotes()
@@ -150,7 +155,7 @@ export default {
     },
     'form.deliveryRemark'() {
       this.clearDeliveryList()
-      if (this.$util.isEmpty(this.custom.long) || this.$util.isEmpty(this.custom.lat) || this.$util.isEmpty(this.custom.address)) {
+      if (this.isAddressInvalid) {
         return
       }
       this.getDeliveryQuotes()
@@ -159,7 +164,7 @@ export default {
     custom: {
       handler(val) {
         if (val && val.id) {
-          if (this.$util.isEmpty(this.custom.long) || this.$util.isEmpty(this.custom.lat) || this.$util.isEmpty(this.custom.address)) {
+          if (this.isAddressInvalid) {
             return
           }
           this.getDeliveryQuotes()
@@ -191,8 +196,8 @@ export default {
         return
       }
       //客户地址不完善
-      if (this.$util.isEmpty(this.custom.long) || this.$util.isEmpty(this.custom.lat) || this.$util.isEmpty(this.custom.address)) {
-        this.$msg('客户地址不完善,无法发跑腿 --- 1')
+      if (this.isAddressInvalid) {
+        this.$msg('客户地址不完善,无法发跑腿')
         return
       }
       const params = {
@@ -231,8 +236,8 @@ export default {
       }
 
       //客户地址不完善
-      if (this.$util.isEmpty(this.custom.long) || this.$util.isEmpty(this.custom.lat) || this.$util.isEmpty(this.custom.address)) {
-        this.$msg('客户地址不完善,无法发跑腿 --- 2')
+      if (this.isAddressInvalid) {
+        this.$msg('客户地址不完善,无法发跑腿')
         return
       }
 

+ 52 - 1
hdPad/src/pages/home/components/settlePop.vue

@@ -37,6 +37,20 @@
             </view>
             <view class="select-item_box" v-if="form.sendType == 2">
                 <view v-if="openIntraCity == 1" class="delivery-section">
+                    <!-- 客户地址 -->
+                    <view class="select-item_box" style="display: flex; align-items: center; border-bottom:1upx solid #eee; margin-bottom:3upx;">
+                        <view class="title">客户地址</view>
+                        <view class="address-box">
+                            <view v-if="$util.isEmpty(custom.long) || $util.isEmpty(custom.lat) || $util.isEmpty(custom.address)" class="addr-main" style="color: red; font-size: 11upx;">
+                                客户地址不完善,请修改
+                            </view>
+                            <view v-else>
+                                <view class="addr-main">{{ custom.address }}</view>
+                                <view class="addr-sub">{{ custom.showAddress }}</view>
+                            </view>
+                        </view>
+                    </view>
+
                     <!-- 跑腿平台报价列表 -->
                     <view class="select-item_box" v-if="deliveryQuotes.length > 0">
                         <!-- <view class="title">选择跑腿</view> -->
@@ -313,6 +327,10 @@ export default {
 			type: Number,
 			default: 0
 		},
+        custom:{
+            type:Object,
+            default:()=>{}
+        },
         customId:{
             type:Number,
             default:0
@@ -346,6 +364,9 @@ export default {
                 price = parseFloat(price.toFixed(2))
             }
             return Number(price)
+        },
+        isAddressInvalid() {
+            return this.$util.isEmpty(this.custom.long) || this.$util.isEmpty(this.custom.lat) || this.$util.isEmpty(this.custom.address)
         }
     },
     watch:{
@@ -398,6 +419,9 @@ export default {
             
             this.weightDebounceTimer = setTimeout(() => {
                 if (newVal && Number(newVal) > 0 && this.form.sendType == 2) {
+                    if (this.isAddressInvalid) {
+                        return;
+                    }
                     this.getDeliveryQuotes();
                 }
             }, 1000);
@@ -408,6 +432,9 @@ export default {
                     this.clearDeliveryList();
                 }
                 if (this.form.sendType == 2) {
+                    if (this.isAddressInvalid) {
+                        return;
+                    }
                     this.getDeliveryQuotes();
                 }
             },
@@ -418,6 +445,9 @@ export default {
                 this.clearDeliveryList();
             }
             if (this.form.sendType == 2) {
+                if (this.isAddressInvalid) {
+                    return;
+                }
                 this.getDeliveryQuotes();
             }
         },
@@ -453,7 +483,6 @@ export default {
         if(Number(this.balance)>Number(this.form.modifyPrice)){
             this.changeHasPay(4)
         }
-
     },
     methods: {
         confirmDiff(){
@@ -547,6 +576,11 @@ export default {
                 this.$msg('请先选择客户');
                 return false;
             }
+            if (this.isAddressInvalid) {
+                this.$msg('客户地址不完善,无法发跑腿');
+                return false;
+            }
+
             quickOrderAllDeliveryQuotes({
                 totalPrice: this.allPrice,
                 weight: this.form.weight || 1,
@@ -979,4 +1013,21 @@ export default {
     color: #3385FF;
     margin-left: 5upx;
 }
+.address-box {
+    flex: 1;
+    text-align: center;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+    .addr-main {
+        font-size: 10upx;
+        color: #333;
+    }
+    .addr-sub {
+        font-size: 8upx;
+        color: #999;
+        margin-top: 2upx;
+    }
+}
 </style>