Переглянути джерело

调整修改收货地址未出现问题

yfh 1 день тому
батько
коміт
7f3dcf7e7a
1 змінених файлів з 21 додано та 20 видалено
  1. 21 20
      src/views/hisStore/components/productOrder.vue

+ 21 - 20
src/views/hisStore/components/productOrder.vue

@@ -368,9 +368,9 @@
              <el-select @change="provinceChange" v-model="editAddressForm.provinceId" placeholder="请选择">
                 <el-option
                   v-for="item in province"
-                  :key="item.cityId"
-                  :label="item.name"
-                  :value="item.cityId">
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value">
                 </el-option>
               </el-select>
           </el-col>
@@ -378,9 +378,9 @@
             <el-select @change="cityChange" v-model="editAddressForm.cityId" placeholder="请选择">
                 <el-option
                   v-for="item in city"
-                  :key="item.cityId"
-                  :label="item.name"
-                  :value="item.cityId">
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value">
                 </el-option>
               </el-select>
           </el-col>
@@ -388,9 +388,9 @@
              <el-select @change="districtChange" v-model="editAddressForm.districtId" placeholder="请选择">
                 <el-option
                   v-for="item in district"
-                  :key="item.cityId"
-                  :label="item.name"
-                  :value="item.cityId">
+                  :key="item.value"
+                  :label="item.label"
+                  :value="item.value">
                 </el-option>
               </el-select>
           </el-col>
@@ -725,36 +725,37 @@ export default {
 
     },
     districtChange(val){
-      var item=this.citys.find((item)=>{
-        return item.cityId==val&&item.level==2;
+      var item=this.district.find((item)=>{
+        return  item.value==val;
       })
-      this.editAddressForm.district=item.name;
+      this.editAddressForm.district=item.label;
 
     },
     cityChange(val){
-      this.district=this.citys.filter(item => item.parentId===val )
+      this.district=this.city.filter(item => item.value===val )[0].children
+
       this.editAddressForm.districtId=null;
-      var item=this.citys.find((item)=>{
-        return item.cityId==val&&item.level==1;
+      var item=this.city.find((item)=>{
+        return  item.value==val;
       })
-      this.editAddressForm.city=item.name;
+      this.editAddressForm.city=item.label;
 
 
     },
     provinceChange(val){
-      this.city=this.citys.filter(item => item.parentId===val )
+      this.city=this.citys.filter(item => item.value===val )[0].children
       this.district=[];
       this.editAddressForm.cityId=null;
       this.editAddressForm.districtId=null;
       var item=this.citys.find((item)=>{
-        return item.cityId==val&&item.level==0;
+        return item.value==val;
       })
-      this.editAddressForm.province=item.name;
+      this.editAddressForm.province=item.label;
     },
     getCityList(){
       getCitys().then(res => {
           this.citys=res.data;
-          this.province=res.data.filter(item => item.level===0 )
+          this.province=res.data.filter(item => item.pid===0 )
         })
     },
     handleEditAddress() {