Browse Source

Revert "feat: 修改地址和手机号"

xdd 1 day ago
parent
commit
cf98555eb3

+ 1 - 7
src/api/hisStore/storeOrder.js

@@ -85,13 +85,7 @@ export function updateStoreOrder(data) {
     data: data
   })
 }
-export function updateAddressErpFsStoreOrder(data) {
-  return request({
-    url: '/store/store/storeOrder/updateAddressErpFsStoreOrder',
-    method: 'put',
-    data: data
-  })
-}
+
 // 删除订单
 export function delStoreOrder(id) {
   return request({

+ 1 - 7
src/api/store/storeOrder.js

@@ -138,13 +138,7 @@ export function updateStoreOrder(data) {
     data: data
   })
 }
-export function updateAddressErpFsStoreOrder(data) {
-  return request({
-    url: '/store/storeOrder/updateAddressErpFsStoreOrder',
-    method: 'put',
-    data: data
-  })
-}
+
 export function bindCustomer(data) {
   return request({
     url: '/store/storeOrder/bindCustomer',

+ 28 - 156
src/views/hisStore/components/productOrder.vue

@@ -356,10 +356,10 @@
     </el-dialog>
     <el-dialog :title="editAddress.title" :visible.sync="editAddress.open" width="600px" append-to-body>
       <el-form ref="editAddressForm" :model="editAddressForm" :rules="editAddressRules" label-width="100px">
-        <el-form-item label="收件人" prop="realName" required>
+        <el-form-item label="收件人" prop="realName">
           <el-input v-model="editAddressForm.realName" placeholder="请输入收件人" />
         </el-form-item>
-          <el-form-item label="联系电话" prop="userPhone" required>
+          <el-form-item label="联系电话" prop="source">
           <el-input v-model="editAddressForm.userPhone" placeholder="请输入联系电话" />
         </el-form-item>
         <el-form-item label="收货地址" prop="district">
@@ -396,7 +396,7 @@
           </el-col>
         </el-row>
         </el-form-item>
-        <el-form-item label="详细地址" prop="detail" required>
+        <el-form-item label="详细地址" prop="detail">
           <el-input v-model="editAddressForm.detail" placeholder="请输入收货人详细地址" />
         </el-form-item>
       </el-form>
@@ -494,20 +494,7 @@ import { getTcmScheduleList } from "@/api/company/tcmScheduleReport";
 import {getCustomerListBySearch } from "@/api/crm/customer";
 import ImageUpload from '@/components/ImageUpload'
 import Material from '@/components/Material'
-import {
-  bindCustomer,
-  getExpress,
-  listStoreOrder,
-  getStoreOrder,
-  delStoreOrder,
-  addStoreOrder,
-  updateStoreOrder,
-  exportStoreOrder,
-  uploadCredentials,
-  getStoreOrderAddress,
-  getUserPhone,
-  updateAddressErpFsStoreOrder
-} from "@/api/hisStore/storeOrder";
+import {bindCustomer,getExpress, listStoreOrder, getStoreOrder, delStoreOrder, addStoreOrder, updateStoreOrder, exportStoreOrder,uploadCredentials, getStoreOrderAddress,getUserPhone} from "@/api/hisStore/storeOrder";
 import {getCitys} from "@/api/hisStore/city";
 import customerDetails from '../../crm/components/customerDetails.vue';
 import addSms from '../../crm/components/addSms.vue';
@@ -770,157 +757,42 @@ export default {
           this.province=res.data.filter(item => item.level===0 )
         })
     },
-    flattenCityData(data, level = 0) {
-      let result = [];
-      data.forEach(item => {
-        // 转换字段名
-        const cityItem = {
-          cityId: item.value,
-          name: item.label,
-          parentId: item.pid,
-          level: level
-        };
-        result.push(cityItem);
-
-        // 递归处理子节点
-        if (item.children && item.children.length > 0) {
-          result = result.concat(this.flattenCityData(item.children, level + 1));
-        }
-      });
-      return result;
-    },
     handleEditAddress() {
-      let loading = this.$loading({
-        lock: true,
-        text: "请求中...",
-        background: "rgba(0, 0, 0, 0.7)",
-      });
-      const orderId = this.order.id;
-
-      getStoreOrderAddress(orderId).then(addressResponse => {
-        // 更新解密后的地址
-        this.order.userAddress = addressResponse.address;
-
-      }).then(res=>{
-        const id = this.order.id;
-        return getUserPhone(id).then(response =>{
-          this.order.userPhone = response.userPhone;
+        this.getCityList();
+        this.editAddressForm.id=this.order.id;
+        this.editAddressForm.realName=this.order.realName;
+        this.editAddressForm.userPhone=this.order.userPhone;
+        var address=this.order.userAddress.split(' ')
+        var province=this.citys.find((item)=>{
+          return item.name==address[0]&&item.level==0;
+        })
+        if(province!=null){
+          this.editAddressForm.provinceId=province.cityId;
+          this.city=this.citys.filter(item => item.parentId===province.cityId&&item.level==1 )
+        }
+        var city=this.citys.find((item)=>{
+          return item.name==address[1]&&item.level==1;
         })
-      }).then(res=>{
-        return getCitys();
-      }).then(res => {
-        this.citys = this.flattenCityData(res.data);
-        this.province = this.citys.filter(item => item.level === 0);
-
-        this.editAddressForm = {
-          id: this.order.id,
-          realName: this.order.realName,
-          userPhone: this.order.userPhone,
-          provinceId: null,
-          cityId: null,
-          districtId: null,
-          province: '',
-          city: '',
-          district: '',
-          detail: ''
-        };
-
-        // 解析地址
-        if (this.order.userAddress) {
-          var addressParts = this.order.userAddress.split(' ');
-
-          // 查找省份
-          if (addressParts.length > 0) {
-            var province = this.citys.find((item) => {
-              return item.name === addressParts[0] && item.level === 0;
-            });
-            if (province != null) {
-              this.editAddressForm.provinceId = province.cityId;
-              this.editAddressForm.province = province.name;
-
-              // 检查是否为直辖市(北京、上海、天津、重庆)
-              const isDirectMunicipality = ['北京市', '上海市', '天津市', '重庆市'].includes(province.name);
-
-              if (isDirectMunicipality) {
-                // 直辖市处理:先找到市级节点(市辖区)
-                if (addressParts.length > 1) {
-                  // 查找市级节点(第2部分,如"市辖区")
-                  var cityLevel = this.citys.find((item) => {
-                    return item.name === addressParts[1] && item.level === 1 && item.parentId === province.cityId;
-                  });
-
-                  if (cityLevel != null) {
-                    this.editAddressForm.cityId = cityLevel.cityId;
-                    this.editAddressForm.city = cityLevel.name;
-                    this.city = this.citys.filter(item => item.parentId === province.cityId && item.level === 1);
-
-                    // 使用市级节点的cityId作为parentId查找区县
-                    if (addressParts.length > 2) {
-                      var district = this.citys.find((item) => {
-                        return item.name === addressParts[2] && item.level === 2 && item.parentId === cityLevel.cityId;
-                      });
-
-                      if (district != null) {
-                        this.editAddressForm.districtId = district.cityId;
-                        this.editAddressForm.district = district.name;
-                        this.district = this.citys.filter(item => item.parentId === cityLevel.cityId && item.level === 2);
-                      }
-                    }
-
-                    // 提取详细地址(第4部分及之后)
-                    if (addressParts.length > 3) {
-                      this.editAddressForm.detail = addressParts.slice(3).join(' ');
-                    }
-                  }
-                }
-              } else {
-                // 普通省份处理:正常匹配市、区
-                this.city = this.citys.filter(item => item.parentId === province.cityId && item.level === 1);
 
-                // 查找城市
-                if (addressParts.length > 1) {
-                  var city = this.citys.find((item) => {
-                    return item.name === addressParts[1] && item.level === 1;
-                  });
-                  if (city != null) {
-                    this.editAddressForm.cityId = city.cityId;
-                    this.editAddressForm.city = city.name;
-                    this.district = this.citys.filter(item => item.parentId === city.cityId && item.level === 2);
-                  }
-                }
-                // 查找区县
-                if (addressParts.length > 2) {
-                  var district = this.citys.find((item) => {
-                    return item.name === addressParts[2] && item.level === 2;
-                  });
-                  if (district != null) {
-                    this.editAddressForm.districtId = district.cityId;
-                    this.editAddressForm.district = district.name;
-                  }
-                }
-                // 提取详细地址(第4部分及之后)
-                if (addressParts.length > 3) {
-                  this.editAddressForm.detail = addressParts.slice(3).join(' ');
-                }
-              }
-            }
-          }
+        if(city!=null){
+          this.editAddressForm.cityId=city.cityId;
+          this.district=this.citys.filter(item => item.parentId===city.cityId&&item.level==2 )
+        }
+        var district=this.citys.find((item)=>{
+          return item.name==address[2]&&item.level==2;
+        })
+        if(district!=null){
+          this.editAddressForm.districtId=district.cityId;
         }
 
         this.editAddress.open = true;
-      }).catch(error => {
-        this.msgError("加载数据失败");
-        console.error(error);
-      }).finally(()=>{
-        loading.close();
-      })
     },
     /** 提交按钮 */
     submitEditAddressForm() {
       this.$refs["editAddressForm"].validate(valid => {
         if (valid) {
            this.editAddressForm.userAddress=this.editAddressForm.province+" "+this.editAddressForm.city+" "+this.editAddressForm.district+" "+this.editAddressForm.detail;
-            updateAddressErpFsStoreOrder(this.editAddressForm).then(response => {
+            updateStoreOrder(this.editAddressForm).then(response => {
               if (response.code === 200) {
                 this.msgSuccess("修改成功");
                 this.editAddress.open = false;

+ 20 - 31
src/views/store/components/productOrder.vue

@@ -15,14 +15,14 @@
         <span  style="margin-left: 20px" class="color-danger">订单状态:
            <el-tag prop="status" v-for="(item, index) in statusOptions"    v-if="order.status==item.dictValue">{{item.dictLabel}}</el-tag>
         </span>
-
+       
         <div class="operate-button-container" >
           <el-button size="mini" @click="handleCertificates()"  v-hasPermi="['store:storeOrder:uploadCredentials']" >上传凭证</el-button>
           <el-button size="mini" @click="handleEditAddress()" v-if="order.status==0||order.status==1"  v-hasPermi="['store:storeOrder:editAddress']" >修改收货地址</el-button>
           <el-button size="mini" @click="handleBindCustomer()"  v-hasPermi="['store:storeOrder:bindCustomer']" >关联客户</el-button>
           <el-button size="mini" @click="editOrder()"  v-hasPermi="['store:storeOrder:edit']" >修改订单</el-button>
           <!-- <el-button size="mini" @click="handleEditUser()"  v-hasPermi="['users:user:edit']" >修改会员修改</el-button> -->
-          <el-button size="mini" v-if="order.customerId!=null&&order.customerId>0"  @click="handleCustomer()"    >查看客户详情</el-button>
+          <el-button size="mini" v-if="order.customerId!=null&&order.customerId>0"  @click="handleCustomer()"    >查看客户详情</el-button>         
         </div>
         <div class="operate-button-container"  v-hasPermi="['store:storeOrder:express']"  >
           <el-button size="mini" @click="showExpress()" >查看物流</el-button>
@@ -48,7 +48,7 @@
             </el-descriptions-item>
             <!-- <el-descriptions-item label="进线时间"  >
                 <span v-if="user!=null">
-                  {{user.registerDate}}
+                  {{user.registerDate}} 
                 </span>
             </el-descriptions-item>
             <el-descriptions-item label="推线编码"  >
@@ -56,7 +56,7 @@
                   {{user.registerCode}}
                 </span>
             </el-descriptions-item> -->
-
+             
             <el-descriptions-item label="收货人"  >
                 <span v-if="order!=null ">
                   {{order.realName }}
@@ -123,7 +123,7 @@
                   {{customerInfo.registerDate }}
                 </span>
             </el-descriptions-item>
-
+        
       </el-descriptions>
       <div style="margin: 20px 0px"  v-if="order!=null">
         <span class="font-small">
@@ -286,7 +286,7 @@
     <el-dialog :title="editUser.title" :visible.sync="editUser.open" width="600px" append-to-body>
       <el-form ref="editUserForm" :model="editUserForm" :rules="editUserRules" label-width="100px">
          <el-form-item label="进线时间" prop="registerDate">
-          <el-date-picker clearable size="small"
+          <el-date-picker clearable size="small"  
             v-model="editUserForm.registerDate"
             type="date"
             value-format="yyyy-MM-dd"
@@ -386,7 +386,7 @@
               <el-button type="primary" @click="searchCustomer">查看</el-button>
             </el-col>
           </el-row>
-
+          
         </el-form-item>
         <el-form-item label="客户选择"  prop="customerIds">
           <el-table   @selection-change="handleSelectionChange"
@@ -440,23 +440,12 @@ import {updateUser,getUser } from "@/api/users/user";
 
 import {getCustomerListBySearch } from "@/api/crm/customer";
 import ImageUpload from '@/components/ImageUpload'
-import {
-  bindCustomer,
-  getExpress,
-  listStoreOrder,
-  getStoreOrder,
-  delStoreOrder,
-  addStoreOrder,
-  updateStoreOrder,
-  exportStoreOrder,
-  uploadCredentials,
-  updateAddressErpFsStoreOrder
-} from "@/api/store/storeOrder";
+import {bindCustomer,getExpress, listStoreOrder, getStoreOrder, delStoreOrder, addStoreOrder, updateStoreOrder, exportStoreOrder,uploadCredentials } from "@/api/store/storeOrder";
 import {getAllList} from "@/api/store/city";
 import customerDetails from '../../crm/components/customerDetails.vue';
 export default {
   name: "order",
-  components: {customerDetails,
+  components: {customerDetails, 
     ImageUpload },
   data() {
     return {
@@ -509,7 +498,7 @@ export default {
       },
       editAddressForm:{
         districtId:null,
-
+        
       },
       editAddressRules:{
 
@@ -564,7 +553,7 @@ export default {
     this.getDicts("store_order_create_type").then((response) => {
       this.createTypeOptions = response.data;
     });
-
+   
   },
   methods: {
     showImageDialog() {
@@ -587,7 +576,7 @@ export default {
       }
       var data={mobile:this.bindCustomerForm.mobile};
       getCustomerListBySearch(data).then(response => {
-          this.customers=response.data;
+          this.customers=response.data;        
       });
     },
     handleBindCustomer() {
@@ -632,7 +621,7 @@ export default {
           if(this.express!=null&&this.express.Traces!=null){
               this.traces=this.express.Traces
           }
-
+          
       });
 
     },
@@ -651,8 +640,8 @@ export default {
       })
       console.log(item)
       this.editAddressForm.city=item.name;
-
-
+ 
+        
     },
     provinceChange(val){
       this.city=this.citys.filter(item => item.parentId===val )
@@ -686,7 +675,7 @@ export default {
         var city=this.citys.find((item)=>{
           return item.name==address[1]&&item.level==1;
         })
-
+        
         if(city!=null){
           this.editAddressForm.cityId=city.cityId;
           this.district=this.citys.filter(item => item.parentId===city.cityId&&item.level==2 )
@@ -697,7 +686,7 @@ export default {
         if(district!=null){
           this.editAddressForm.districtId=district.cityId;
         }
-
+        
         this.editAddress.open = true;
     },
     /** 提交按钮 */
@@ -705,7 +694,7 @@ export default {
       this.$refs["editAddressForm"].validate(valid => {
         if (valid) {
            this.editAddressForm.userAddress=this.editAddressForm.province+" "+this.editAddressForm.city+" "+this.editAddressForm.district+" "+this.editAddressForm.detail;
-            updateAddressErpFsStoreOrder(this.editAddressForm).then(response => {
+            updateStoreOrder(this.editAddressForm).then(response => {
               if (response.code === 200) {
                 this.msgSuccess("修改成功");
                 this.editAddress.open = false;
@@ -749,7 +738,7 @@ export default {
               this.getOrder(this.order.id);
             }
           });
-
+       
         }
       });
     },
@@ -768,7 +757,7 @@ export default {
             this.order = response.order;
             if(response.order.certificates != null){
               this.certificates = response.order.certificates;
-            }
+            }  
             this.user = response.user;
             this.logs = response.logs;
             this.items = response.items;

+ 43 - 76
src/views/store/components/storeOrderDetails.vue

@@ -411,36 +411,7 @@
 </template>
 
 <script>
-import {
-  bindCustomer,
-  msgList,
-  getMsgFollow,
-  updateMoney,
-  getGoods,
-  getEroOrder,
-  editTuiMoney,
-  updateDelivery,
-  createErpOrder,
-  updateExpress,
-  afterSales,
-  sendgoods,
-  logList,
-  listOrder,
-  getExpress,
-  syncExpress,
-  listOrderitem,
-  getOrder,
-  getOrderAddress,
-  getUserPhone,
-  delOrder,
-  addOrder,
-  updateStoreOrder,
-  exportOrder,
-  payment,
-  tuiOrder,
-  getPrescribe,
-  updateAddressErpFsStoreOrder
-} from "@/api/store/storeOrder";
+import {bindCustomer, msgList,getMsgFollow,updateMoney,getGoods,getEroOrder,editTuiMoney,updateDelivery,createErpOrder,updateExpress, afterSales,sendgoods,logList,listOrder,getExpress,syncExpress, listOrderitem,getOrder,getOrderAddress,getUserPhone, delOrder, addOrder, updateStoreOrder, exportOrder,payment,tuiOrder ,getPrescribe} from "@/api/store/storeOrder";
 import packageOrderDetails from '../components/packageOrderDetails2.vue';
 import {getCustomerListBySearch } from "@/api/crm/customer";
 import { getTcmScheduleList } from "@/api/company/tcmScheduleReport";
@@ -741,13 +712,13 @@ import {getCitys} from "@/api/store/city";
       },
       handlePhone(){
         const orderId = this.item.orderId;
-        return getUserPhone(orderId).then(response =>{
+        getUserPhone(orderId).then(response =>{
             this.item.userPhone = response.userPhone;
         })
       },
       handleAddress(){
         const orderId = this.item.orderId;
-        return getOrderAddress(orderId).then(response =>{
+        getOrderAddress(orderId).then(response =>{
             this.item.userAddress = response.address;
         })
       },
@@ -807,7 +778,7 @@ import {getCitys} from "@/api/store/city";
           userAddress: addressModified ? this.buildFullAddress() : (this.originalAddress || this.item.userAddress || ''),
         };
 
-        updateAddressErpFsStoreOrder(payload).then(response => {
+        updateStoreOrder(payload).then(response => {
           if (response.code === 200) {
             this.msgSuccess("操作成功");
             this.edit.open = false;
@@ -821,52 +792,48 @@ import {getCitys} from "@/api/store/city";
       });
     },
     editOrder() {
-      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;
+      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;