Moss 1 yıl önce
ebeveyn
işleme
b8d383425f

+ 23 - 21
src/views/mallManagement/order/offline_order_list/index.vue

@@ -792,33 +792,35 @@ export default {
       // 初始化请求省市区街道下拉选项数据
       lbsAmapRegion({ pid: 0 }).then(res => {
         this.provinceList = res.data
-        // 创建工单时获取ip地址定位赋值
-        if (!this.id && this.$IpAdd.province) {
-          var item = this.provinceList.find(item => item.name === this.$IpAdd.province)
-          if (item) {
-            this.formData.provinceId = item.id
-            this.formData.province = item.name
+        if (this.formData.province) {
+          var provinceItem = this.provinceList.find(o => o.name === this.formData.province)
+          if (provinceItem) {
+            this.formData.provinceId = provinceItem.id
           }
-        }
-        if (this.formData.provinceId) {
           lbsAmapRegion({ pid: this.formData.provinceId }).then(res => {
             this.cityList = res.data
-            // 创建工单时获取ip地址定位赋值
-            if (!this.id && this.$IpAdd.city) {
-              var item2 = this.cityList.find(item => item.name === this.$IpAdd.city)
-              if (item2) {
-                this.formData.cityId = item2.id
-                this.formData.city = item2.name
+            if (this.formData.city) {
+              var cityItem = this.cityList.find(o => o.name === this.formData.city)
+              if (cityItem) {
+                this.formData.cityId = cityItem.id
               }
-            }
-            if (this.formData.cityId) {
               lbsAmapRegion({ pid: this.formData.cityId }).then(res => {
                 this.areaList = res.data
-              })
-            }
-            if (this.formData.areaId) {
-              lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
-                this.streetList = res.data
+                if (this.formData.area) {
+                  var areaItem = this.areaList.find(o => o.name === this.formData.area)
+                  if (areaItem) {
+                    this.formData.areaId = areaItem.id
+                  }
+                  lbsAmapRegion({ pid: this.formData.areaId }).then(res => {
+                    this.streetList = res.data
+                    if (this.formData.street) {
+                      var streetItem = this.streetList.find(o => o.name === this.formData.street)
+                      if (streetItem) {
+                        this.formData.streetId = streetItem.id
+                      }
+                    }
+                  })
+                }
               })
             }
           })