Kaynağa Gözat

配送地址数据获取与验证更新

shizhongqi 6 ay önce
ebeveyn
işleme
d0e2c8cd81

+ 18 - 18
ghsApp/src/admin/delivery/allDelivery.vue

@@ -128,11 +128,15 @@ export default {
         orderId: null,
         orderId: null,
         senderInfo: {
         senderInfo: {
             name: '门店',
             name: '门店',
-            address: ''
+            address: '',
+            long: '',
+            lat: '',
         },
         },
         receiverInfo: {
         receiverInfo: {
             name: '客户',
             name: '客户',
-            address: ''
+            address: '',
+            long: '',
+            lat: '',
         },
         },
         deliveryList: [],
         deliveryList: [],
         weight: 1,
         weight: 1,
@@ -171,12 +175,6 @@ export default {
         return 0;
         return 0;
       }
       }
       return parseInt(item.price);
       return parseInt(item.price);
-    },
-    isClientAddressInvalid() {
-      return this.$util.isEmpty(this.receiverInfo.long) || this.$util.isEmpty(this.receiverInfo.lat) || this.$util.isEmpty(this.receiverInfo.address)
-    },
-    isSenderAddressInvalid() {
-      return this.$util.isEmpty(this.senderInfo.long) || this.$util.isEmpty(this.senderInfo.lat) || this.$util.isEmpty(this.senderInfo.address)
     }
     }
   },
   },
   onLoad(options) {
   onLoad(options) {
@@ -195,8 +193,9 @@ export default {
 
 
   },
   },
   onShow() {
   onShow() {
-    this.loadOrderData();
-    this.handleLoadDelivery();
+    this.loadOrderData().then(() => {
+      this.handleLoadDelivery();
+    });
   },
   },
   created() {
   created() {
       if (this.deliveryList.length > 0 && !this.selectedDelivery) {
       if (this.deliveryList.length > 0 && !this.selectedDelivery) {
@@ -271,10 +270,10 @@ export default {
      * 获取订单详情
      * 获取订单详情
      */
      */
     loadOrderData() {
     loadOrderData() {
-      address({ orderId: this.orderId }).then(res => {
+      return address({ orderId: this.orderId }).then(res => {
         if (res && res.code === 1) {
         if (res && res.code === 1) {
-          this.senderInfo.address = res.data.send_address;
-          this.receiverInfo.address = res.data.receive_address;
+          this.senderInfo = res.data.sender;
+          this.receiverInfo = res.data.receiver;
         }
         }
       }).catch(err => {
       }).catch(err => {
         console.log('获取发货与收货地址失败:', err);
         console.log('获取发货与收货地址失败:', err);
@@ -282,13 +281,14 @@ export default {
     },
     },
     loadDeliveryList() {
     loadDeliveryList() {
       //客户地址不完善
       //客户地址不完善
-      if (this.isClientAddressInvalid) {
-        //this.$msg('客户地址不完善,无法获取运力');
+      if(this.$util.isEmpty(this.receiverInfo.long) || this.$util.isEmpty(this.receiverInfo.lat) || this.$util.isEmpty(this.receiverInfo.address)) {
+        this.$msg('客户地址不完善,无法获取运力');
         return;
         return;
       }
       }
-      //门店
-      if (this.isSenderAddressInvalid) {
-        //this.$msg('门店地址不完善,无法获取运力');
+
+      //门店地址不完善
+      if(this.$util.isEmpty(this.senderInfo.long) || this.$util.isEmpty(this.senderInfo.lat) || this.$util.isEmpty(this.senderInfo.address)) {
+        this.$msg('门店地址不完善,无法获取运力');
         return;
         return;
       }
       }
       
       

+ 14 - 16
hdApp/src/admin/delivery/allDelivery.vue

@@ -123,11 +123,15 @@ export default {
         orderId: null,
         orderId: null,
         senderInfo: {
         senderInfo: {
             name: '门店',
             name: '门店',
-            address: ''
+            address: '',
+            long: '',
+            lat: '',
         },
         },
         receiverInfo: {
         receiverInfo: {
             name: '客户',
             name: '客户',
-            address: ''
+            address: '',
+            long: '',
+            lat: '',
         },
         },
         deliveryList: [],
         deliveryList: [],
         weight: 1,
         weight: 1,
@@ -164,12 +168,6 @@ export default {
         return 0;
         return 0;
       }
       }
       return parseInt(item.price);
       return parseInt(item.price);
-    },
-    isClientAddressInvalid() {
-      return this.$util.isEmpty(this.receiverInfo.long) || this.$util.isEmpty(this.receiverInfo.lat) || this.$util.isEmpty(this.receiverInfo.address)
-    },
-    isSenderAddressInvalid() {
-      return this.$util.isEmpty(this.senderInfo.long) || this.$util.isEmpty(this.senderInfo.lat) || this.$util.isEmpty(this.senderInfo.address)
     }
     }
   },
   },
   onLoad(options) {
   onLoad(options) {
@@ -188,7 +186,7 @@ export default {
 
 
   },
   },
   onShow() {
   onShow() {
-    this.loadOrderData();
+    this.loadOrderData().then(() => {
     this.handleLoadDelivery();
     this.handleLoadDelivery();
   },
   },
   created() {
   created() {
@@ -263,10 +261,10 @@ export default {
     },
     },
 
 
     loadOrderData() {
     loadOrderData() {
-      address({ orderId: this.orderId }).then(res => {
+      return address({ orderId: this.orderId }).then(res => {
         if (res && res.code === 1) {
         if (res && res.code === 1) {
-          this.senderInfo.address = res.data.send_address;
-          this.receiverInfo.address = res.data.receive_address;
+          this.senderInfo = res.data.sender;
+          this.receiverInfo = res.data.receiver;
         }
         }
       }).catch(err => {
       }).catch(err => {
         console.log('获取发货与收货地址失败:', err);
         console.log('获取发货与收货地址失败:', err);
@@ -274,13 +272,13 @@ export default {
     },
     },
     loadDeliveryList() {
     loadDeliveryList() {
       //客户地址不完善
       //客户地址不完善
-      if (this.isClientAddressInvalid) {
-        //this.$msg('客户地址不完善,无法获取运力');
+      if (this.$util.isEmpty(this.receiverInfo.long) || this.$util.isEmpty(this.receiverInfo.lat) || this.$util.isEmpty(this.receiverInfo.address)) {
+        this.$msg('客户地址不完善,无法获取运力');
         return;
         return;
       }
       }
       //门店
       //门店
-      if (this.isSenderAddressInvalid) {
-        //this.$msg('门店地址不完善,无法获取运力');
+      if (this.$util.isEmpty(this.senderInfo.long) || this.$util.isEmpty(this.senderInfo.lat) || this.$util.isEmpty(this.senderInfo.address)) {
+        this.$msg('门店地址不完善,无法获取运力');
         return;
         return;
       }
       }