Explorar el Código

feat: 修改地址和手机号

xdd hace 2 días
padre
commit
e7420d0a0a
Se han modificado 1 ficheros con 45 adiciones y 41 borrados
  1. 45 41
      src/views/store/components/storeOrderDetails.vue

+ 45 - 41
src/views/store/components/storeOrderDetails.vue

@@ -712,13 +712,13 @@ import {getCitys} from "@/api/store/city";
       },
       handlePhone(){
         const orderId = this.item.orderId;
-        getUserPhone(orderId).then(response =>{
+        return getUserPhone(orderId).then(response =>{
             this.item.userPhone = response.userPhone;
         })
       },
       handleAddress(){
         const orderId = this.item.orderId;
-        getOrderAddress(orderId).then(response =>{
+        return getOrderAddress(orderId).then(response =>{
             this.item.userAddress = response.address;
         })
       },
@@ -792,48 +792,52 @@ import {getCitys} from "@/api/store/city";
       });
     },
     editOrder() {
-      this.edit.open = true;
-      this.editForm.orderId = this.item.orderId;
-      this.editForm.remark = this.item.remark;
-      this.editForm.userPhone = this.item.userPhone != null ? this.item.userPhone.toString() : "";
-      if (this.item.orderBuyType != null) {
-        this.editForm.orderBuyType = this.item.orderBuyType.toString();
-      }
-      this.editForm.orderChannel = this.item.orderChannel;
-      this.editForm.qwSubject = this.item.qwSubject;
-      this.editForm.scheduleId = this.item.scheduleId;
+      this.handlePhone().then(res=>{
+        return this.handleAddress()
+      }).then(res=>{
+        this.edit.open = true;
+        this.editForm.orderId = this.item.orderId;
+        this.editForm.remark = this.item.remark;
+        this.editForm.userPhone = this.item.userPhone != null ? this.item.userPhone.toString() : "";
+        if (this.item.orderBuyType != null) {
+          this.editForm.orderBuyType = this.item.orderBuyType.toString();
+        }
+        this.editForm.orderChannel = this.item.orderChannel;
+        this.editForm.qwSubject = this.item.qwSubject;
+        this.editForm.scheduleId = this.item.scheduleId;
 
-      const currentAddress = (this.item.userAddress || "").toString().trim();
-      // 记录原始完整地址
-      this.originalAddress = currentAddress;
+        const currentAddress = (this.item.userAddress || "").toString().trim();
+        // 记录原始完整地址
+        this.originalAddress = currentAddress;
 
-      this.getCitys().then(() => {
-        if (!currentAddress) {
-          this.cityIds = [];
-          this.editForm.userAddress = "";
-          this.originalDetail = "";
-          return;
-        }
-        // 按“省 市 区 详细地址(空格分隔)”进行拆分。若无区或无市也不报错。
-        const parts = currentAddress.split(/\s+/);
-        const detail = parts.pop() || "";           // 末尾作为详细地址
-        const provLabel = parts[0];
-        const cityLabel = parts[1];
-        const areaLabel = parts[2];
+        this.getCitys().then(() => {
+          if (!currentAddress) {
+            this.cityIds = [];
+            this.editForm.userAddress = "";
+            this.originalDetail = "";
+            return;
+          }
+          // 按“省 市 区 详细地址(空格分隔)”进行拆分。若无区或无市也不报错。
+          const parts = currentAddress.split(/\s+/);
+          const detail = parts.pop() || "";           // 末尾作为详细地址
+          const provLabel = parts[0];
+          const cityLabel = parts[1];
+          const areaLabel = parts[2];
 
-        const province = this.citys.find(p => p.label === provLabel);
-        if (province) {
-          // 只回显省,不预选市/区
-          this.cityIds = [province.value];
-        } else {
-          console.warn("未匹配到省:", { provLabel });
-          this.cityIds = [];
-        }
-        // 输入框只放“详细地址(不含省市区)”
-        this.editForm.userAddress = detail;
-        // 记录原始详细地址(用于判断有无修改)
-        this.originalDetail = detail;
-      });
+          const province = this.citys.find(p => p.label === provLabel);
+          if (province) {
+            // 只回显省,不预选市/区
+            this.cityIds = [province.value];
+          } else {
+            console.warn("未匹配到省:", { provLabel });
+            this.cityIds = [];
+          }
+          // 输入框只放“详细地址(不含省市区)”
+          this.editForm.userAddress = detail;
+          // 记录原始详细地址(用于判断有无修改)
+          this.originalDetail = detail;
+        });
+      })
     },
     updateExpress(){
       var that=this;