Procházet zdrojové kódy

重复门店经销商维护

zhujindu před 9 měsíci
rodič
revize
4f92662044

+ 9 - 0
src/api/store.js

@@ -9,3 +9,12 @@ export function listChainsByCategory(query) {
     params: query,
   });
 }
+
+// 门店~扩展经销商(经销商人员)
+export function addStoreChainContact(data) {
+  return request({
+    url: 'mobile/store/addStoreChainContact',
+    method: 'post',
+    data,
+  });
+}

+ 1 - 0
src/store/modules/user.js

@@ -35,6 +35,7 @@ const user = {
             localStorage.setItem('deptLevel', res.data.depts[0].deptLevel);
             localStorage.setItem('userId', res.data.userId);
             localStorage.setItem('deptIds', JSON.stringify(res.data.deptIds));
+            localStorage.setItem('chainUser', res.data.chainUser); //是否经销商用户 true
             // 门店类型
             getDictOption({}, 'sfa_store_type').then((res) => {
               commit('SET_STORE_TYPE', res.data);

+ 7 - 2
src/views/storeManagement/chainMaintain.vue

@@ -321,7 +321,7 @@ import txmapimg2 from '@/assets/txmap2.svg';
 import txmapimg3 from '@/assets/marker_blue.png';
 import uploadImg from '@/components/viewaddreddUploadImg.vue';
 import { getPosition, getMapPoi, getkeywordPoi, getTicketFun } from '@/utils/TXApiFun';
-import { listChainsByCategory } from '@/api/store';
+import { listChainsByCategory, addStoreChainContact } from '@/api/store';
 export default {
   components: { uploadImg, mapmarker, viewUploadImg },
   data() {
@@ -431,7 +431,12 @@ export default {
     newimgarr1(val) {
       this.img = val.fileUrl;
     },
-    onSubmit() {},
+    onSubmit() {
+      addStoreChainContact({
+        storeId: this.$route.query.id, //long	门店id
+        sfaStoreChainsContactList: this.sfaStoreChainsContactList, //对象数组	门店选择的品类经销商列表(只传新增的)
+      }).then((res) => {});
+    },
     getStreetQuery(type) {
       var provinceCode = this.list.province;
       var cityCode = this.list.city;

+ 84 - 87
src/views/storeManagement/storeAdd.vue

@@ -1867,8 +1867,85 @@ export default {
     addStoreFun() {
       addStore(this.fromValue).then((res) => {
         this.toastLoading().clear();
-        // 门店重复判断
-        if (true) {
+        if (res.code == 200) {
+          if (res.data.serverCode) {
+            this.fromValue.storeCode = res.data.sfaStore.storeCode;
+            this.fromValue.storeId = res.data.sfaStore.storeId;
+            if (
+              res.data.orderUrl != null &&
+              (res.data.orderUrl != '') & (res.data.orderUrl != undefined)
+            ) {
+              window.location.replace(res.data.orderUrl);
+            } else {
+              this.$dialog
+                .confirm({
+                  title: '系统提示',
+                  message: '建店成功,是否立即拜访?',
+                  confirmButtonText: '立即拜访',
+                  cancelButtonText: '返回上一页',
+                })
+                .then(() => {
+                  checkVisit({ storeId: res.data.sfaStore.storeId }).then((response) => {
+                    localStorage.setItem('startTime', new Date());
+                    localStorage.setItem('ORGName', this.fromValue.deptName);
+                    localStorage.setItem('chainNameR', this.fromValue.storeName);
+                    if (response.code == 200) {
+                      localStorage.setItem('startTime', new Date());
+                      localStorage.setItem('ORGName', res.data.sfaStore.deptName);
+                      localStorage.setItem('chainNameR', res.data.sfaStore.storeName);
+                      window.location.replace(
+                        window.location.origin +
+                          '/mobile/suishenbangOutstoreVisit?PointSum=0&visitModel=1&tabVal=1&hisTime=null&pageType=out&visitId=null&rdId=null&storeId=' +
+                          res.data.sfaStore.storeId +
+                          '&lat=' +
+                          this.fromValue.lat +
+                          '&lon=' +
+                          this.fromValue.lon +
+                          '&addressLine=' +
+                          this.fromValue.addressLine +
+                          '&storeCategory=' +
+                          res.data.sfaStore.storeCategory +
+                          '&storeName=' +
+                          this.fromValue.storeName +
+                          '&contactName=' +
+                          this.fromValue.contactName +
+                          '&storeCode=' +
+                          res.data.sfaStore.storeCode +
+                          '&latNew=' +
+                          this.fromValue.lat +
+                          '&lonNew=' +
+                          this.fromValue.lon +
+                          '&marklat=' +
+                          this.mlan +
+                          '&marklon=' +
+                          this.mlon
+                      );
+                    } else {
+                      this.$dialog
+                        .alert({
+                          title: '系统提示',
+                          message: response.msg,
+                        })
+                        .then((res) => {
+                          this.$router.go(-1);
+                        });
+                    }
+                  });
+                })
+                .catch(() => {
+                  this.$router.go(-1);
+                });
+            }
+          } else {
+            this.fromValue.storeCode = res.data.sfaStore.storeCode;
+            this.fromValue.storeId = res.data.sfaStore.storeId;
+            this.$dialog.alert({
+              title: '系统提示',
+              message: res.data.serverMsg,
+            });
+          }
+        } else {
+          // 门店重复判断
           this.$dialog
             .confirm({
               title: '门店已存在',
@@ -1883,91 +1960,11 @@ export default {
                 query: { id: 'res.id' },
               });
             });
-        } else {
-          if (res.code == 200) {
-            if (res.data.serverCode) {
-              this.fromValue.storeCode = res.data.sfaStore.storeCode;
-              this.fromValue.storeId = res.data.sfaStore.storeId;
-              if (
-                res.data.orderUrl != null &&
-                (res.data.orderUrl != '') & (res.data.orderUrl != undefined)
-              ) {
-                window.location.replace(res.data.orderUrl);
-              } else {
-                this.$dialog
-                  .confirm({
-                    title: '系统提示',
-                    message: '建店成功,是否立即拜访?',
-                    confirmButtonText: '立即拜访',
-                    cancelButtonText: '返回上一页',
-                  })
-                  .then(() => {
-                    checkVisit({ storeId: res.data.sfaStore.storeId }).then((response) => {
-                      localStorage.setItem('startTime', new Date());
-                      localStorage.setItem('ORGName', this.fromValue.deptName);
-                      localStorage.setItem('chainNameR', this.fromValue.storeName);
-                      if (response.code == 200) {
-                        localStorage.setItem('startTime', new Date());
-                        localStorage.setItem('ORGName', res.data.sfaStore.deptName);
-                        localStorage.setItem('chainNameR', res.data.sfaStore.storeName);
-                        window.location.replace(
-                          window.location.origin +
-                            '/mobile/suishenbangOutstoreVisit?PointSum=0&visitModel=1&tabVal=1&hisTime=null&pageType=out&visitId=null&rdId=null&storeId=' +
-                            res.data.sfaStore.storeId +
-                            '&lat=' +
-                            this.fromValue.lat +
-                            '&lon=' +
-                            this.fromValue.lon +
-                            '&addressLine=' +
-                            this.fromValue.addressLine +
-                            '&storeCategory=' +
-                            res.data.sfaStore.storeCategory +
-                            '&storeName=' +
-                            this.fromValue.storeName +
-                            '&contactName=' +
-                            this.fromValue.contactName +
-                            '&storeCode=' +
-                            res.data.sfaStore.storeCode +
-                            '&latNew=' +
-                            this.fromValue.lat +
-                            '&lonNew=' +
-                            this.fromValue.lon +
-                            '&marklat=' +
-                            this.mlan +
-                            '&marklon=' +
-                            this.mlon
-                        );
-                      } else {
-                        this.$dialog
-                          .alert({
-                            title: '系统提示',
-                            message: response.msg,
-                          })
-                          .then((res) => {
-                            this.$router.go(-1);
-                          });
-                      }
-                    });
-                  })
-                  .catch(() => {
-                    this.$router.go(-1);
-                  });
-              }
-            } else {
-              this.fromValue.storeCode = res.data.sfaStore.storeCode;
-              this.fromValue.storeId = res.data.sfaStore.storeId;
-              this.$dialog.alert({
-                title: '系统提示',
-                message: res.data.serverMsg,
-              });
-            }
-          } else {
-            this.$dialog.alert({
-              title: '系统提示',
-              message: res.msg,
-              messageAlign: 'left',
-            });
-          }
+          // this.$dialog.alert({
+          //   title: '系统提示',
+          //   message: res.msg,
+          //   messageAlign: 'left',
+          // });
         }
       });
     },

+ 7 - 1
src/views/storeManagement/storeEdit.vue

@@ -59,7 +59,11 @@
                 ">
                 <van-row style="border-bottom: 1px solid #ebedf0">
                   <van-col span="24">
-                    <van-field label="经销商名称" @click="showPickerChainsListFn" class="TCFXList">
+                    <van-field
+                      label="经销商名称"
+                      :readonly="chainUser == 'true'"
+                      @click="showPickerChainsListFn"
+                      class="TCFXList">
                       <template #left-icon>
                         <span class="van-f-red">*</span>
                       </template>
@@ -814,9 +818,11 @@ export default {
       treeSelect: [],
       sfaStoreChainsContactList: [], //选中确定的经销商
       activatedTCFXList: [], //选中的经销商
+      chainUser: false, //是否经销商用户 true
     };
   },
   activated() {
+    this.chainUser = localStorage.getItem('chainUser');
     this.tabVal = 'insidePlan';
     this.treeSelect = [];
     // 授权