Browse Source

Merge branch 'feature_20250917_仿石漆潜在客户区域创建' into uat(dev)

zhujindu 2 months ago
parent
commit
364ea275f8

+ 27 - 0
src/api/store.js

@@ -27,3 +27,30 @@ export function checkStoreBeforeAdd(data) {
     data,
   });
 }
+
+// 获取潜在客户类型接口
+export function qzStoreCategory(query) {
+  return request({
+    url: 'mobile/store/qzStoreCategory',
+    method: 'get',
+    params: query,
+  });
+}
+
+// 获取下级销售部接口
+export function getChildDeptList(query) {
+  return request({
+    url: 'mobile/store/getChildDeptList',
+    method: 'get',
+    params: query,
+  });
+}
+
+// 新增潜在客户接口
+export function addQzStore(data) {
+  return request({
+    url: 'mobile/store/addQzStore',
+    method: 'post',
+    data,
+  });
+}

+ 7 - 239
src/router/index.js

@@ -30,68 +30,44 @@ const router = new VueRouter({
           path: '/home',
           name: 'home',
           component: () => import('@/views/home/index.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/reportingRate',
           name: 'reportingRate',
           component: () => import('@/views/home/reportingRate.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/err',
           name: 'err',
           component: () => import('@/views/home/err.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/login',
           name: 'login',
           component: () => import('@/views/home/login.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/logincs',
           name: 'logincs',
           component: () => import('@/views/home/logincs.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/noVisit',
           name: 'noVisit',
+          meta: { title: '未拜访门店' },
           component: () => import('@/views/home/hintTabPage/noVisit.vue'),
-          meta: {
-            keepAlive: true,
-            title: '未拜访门店',
-          },
         },
         {
           path: '/hintDetail',
           name: 'hintDetail',
+          meta: { title: '提示类-拜访(实时) ' },
           component: () => import('@/views/home/hintTabPage/hintDetail.vue'),
-          meta: {
-            keepAlive: true,
-            title: '提示类-拜访(实时) ',
-          },
         },
         {
           path: '/pantoneNoGet',
           name: 'pantoneNoGet',
+          meta: { title: '提示类-业务员未领取色卡门店 ' },
           component: () => import('@/views/home/hintTabPage/pantoneNoGet.vue'),
-          meta: {
-            keepAlive: true,
-            title: '提示类-业务员未领取色卡门店 ',
-          },
         },
         {
           path: '/unCreateStore',
@@ -113,57 +89,36 @@ const router = new VueRouter({
           path: '/storemanagement/index',
           name: 'storeManagement',
           component: () => import('@/views/storeManagement/index.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/storeDetail',
           name: 'storeDetail',
           component: () => import('@/views/storeManagement/storeDetail.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/storeAdd',
           name: 'storeAdd',
           component: () => import('@/views/storeManagement/storeAdd.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/storeAddress',
           name: 'storeAddress',
           component: () => import('@/views/storeManagement/storeAddress.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/odersuccess',
           name: 'storeAdd',
           component: () => import('@/views/deviceOutside/oderSuccess.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/storeEdit',
           name: 'storeEdit',
           component: () => import('@/views/storeManagement/storeEdit.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/success',
           name: 'success',
           component: () => import('@/views/storeManagement/success.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/chainMaintain',
@@ -235,90 +190,56 @@ const router = new VueRouter({
           path: '/outsidelist/index',
           name: 'outsidelist',
           component: () => import('@/views/deviceOutside/index.vue'),
-          meta: {
-            keepAlive: true,
-            scrollTop: 0,
-          },
         },
         {
           path: '/ai',
           name: 'ai',
           component: () => import('@/views/intelligence/index.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/topStore',
           name: 'topStore',
           component: () => import('@/views/deviceOutside/topStore.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/pItem',
           name: 'pItem',
           component: () => import('@/views/deviceOutside/productItem.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/suishenbangOutstoreVisit',
           name: 'suishenbangOutstoreVisit',
           component: () => import('@/views/deviceOutside/suishenbangOutstoreVisit.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/projectOut',
           name: 'projectOut',
           component: () => import('@/views/deviceOutside/projectOut.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/rangeStore',
           name: 'rangeStore',
           component: () => import('@/views/deviceOutside/rangeStore.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/outstoreVisit',
           name: 'outstoreVisit',
           component: () => import('@/views/deviceOutside/outstoreVisit.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/taskList',
           name: 'taskList',
           component: () => import('@/views/deviceOutside/taskList.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/storeGroup',
           name: 'storeGroup',
           component: () => import('@/views/deviceOutside/storeGroup.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/outabnormalVisit',
           name: 'outabnormalVisit',
           component: () => import('@/views/deviceOutside/outabnormalVisit.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
       ],
     },
@@ -331,34 +252,22 @@ const router = new VueRouter({
           path: '/historicalVisit/index',
           name: 'historicalVisit',
           component: () => import('@/views/historicalVisit/index.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/historAllVisit',
           name: 'historAllVisit',
           component: () => import('@/views/historicalVisit/historAllVisit.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
 
         {
           path: '/historicalDetails',
           name: 'historicalDetails',
           component: () => import('@/views/historicalVisit/historicalDetails.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/historiStoreVisit',
           name: 'historiStoreVisit',
           component: () => import('@/views/historicalVisit/hisvistdeils.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/skuRecognize',
@@ -376,91 +285,58 @@ const router = new VueRouter({
           path: '/deviceWithin/index',
           name: 'deviceWithin',
           component: () => import('@/views/deviceWithin/index.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/storeVisitpage',
           name: 'storeVisitpage',
           component: () => import('@/views/deviceWithin/storeVisit.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/addStoreVisit',
           name: 'addStoreVisit',
           component: () => import('@/views/deviceWithin/addStoreVisit.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
 
         {
           path: '/addStoreVisitd',
           name: 'addStoreVisitd',
           component: () => import('@/views/deviceWithin/addStoreVisitd.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/addStoreVisitP',
           name: 'addStoreVisitP',
           component: () => import('@/views/deviceWithin/addStoreVisitP.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/abnormalVisit',
           name: 'abnormalVisit',
           component: () => import('@/views/deviceWithin/abnormalVisit.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/sign',
           name: 'sign',
           component: () => import('@/views/sign/index.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/signApprovalList',
           name: 'signApproval',
           component: () => import('@/views/signApproval/index.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/signApproval',
           name: 'signApproval',
           component: () => import('@/views/signApproval/signApproval.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         // 同城店铺建店审批
         {
           path: '/newStoreApprovalList',
           name: 'newStoreApprovalList',
           component: () => import('@/views/signApproval/newStoreApprovalList.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/newStoreApprovalDetail',
           name: 'newStoreApprovalDetail',
           component: () => import('@/views/signApproval/newStoreApprovalDetail.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
       ],
     },
@@ -474,209 +350,131 @@ const router = new VueRouter({
           path: '/My/index',
           name: 'MyList',
           component: () => import('@/views/week/index.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/myInventory',
           name: 'myInventory',
           component: () => import('@/views/my/myInventory.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/material',
           name: 'material',
           component: () => import('@/views/my/material.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/subordinateHistoricalDaily',
           name: 'subordinateHistoricalDaily',
           component: () => import('@/views/week/dailyHistorical.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/subordinateHistoricalWeekly',
           name: 'subordinateHistoricalWeekly',
           component: () => import('@/views/week/weeklyHistorical.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/myHistoricalDaily',
           name: 'myHistoricalDaily',
           component: () => import('@/views/week/myHistoricalDaily.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/weeklyApproval',
           name: 'weeklyApproval',
           component: () => import('@/views/week/weeklyApproval.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/weeklyApprovalDetils',
           name: 'weeklyApprovalDetils',
           component: () => import('@/views/week/weeklyApprovalDetils.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/myComment',
           name: 'myComment',
           component: () => import('@/views/week/myComment.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/doubleWeeklyDetils',
           name: 'doubleWeeklyDetils',
           component: () => import('@/views/week/doubleWeeklyDetils.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/daily',
           name: 'daily',
           component: () => import('@/views/week/daily.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/dailyApprovalList',
           name: 'dailyApprovalList',
           component: () => import('@/views/week/dailyApprovalList.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/dailyApproval',
           name: 'dailyApproval',
           component: () => import('@/views/week/dailyApproval.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/dailyDetails',
           name: 'dailyDetails',
           component: () => import('@/views/week/dailyDetails.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/weeklyApproval',
           name: 'weeklyApproval',
           component: () => import('@/views/week/weeklyApproval.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/weekly',
           name: 'weekly',
           component: () => import('@/views/week/weekly.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/doubleWeekly',
           name: 'doubleWeekly',
           component: () => import('@/views/week/doubleWeekly.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/doubleWeeklyApproval',
           name: 'doubleWeeklyApproval',
           component: () => import('@/views/week/doubleWeeklyApproval.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/doubleWeeklyHistorical',
           name: 'doubleWeeklyHistorical',
           component: () => import('@/views/week/doubleWeeklyHistorical.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/dailyHistoricalDetails',
           name: 'dailyHistoricalDetails',
           component: () => import('@/views/week/dailyHistoricalDetails.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/doubleHistoricalWeeklyDetils',
           name: 'doubleHistoricalWeeklyDetils',
           component: () => import('@/views/week/doubleHistoricalWeeklyDetils.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/weeklyHistoricalDetils',
           name: 'weeklyHistoricalDetils',
           component: () => import('@/views/week/weeklyHistoricalDetils.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/VisitSummary',
           name: 'VisitSummary',
           component: () => import('@/views/week/VisitSummary.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/VisitSummaryMy',
           name: 'VisitSummaryMy',
           component: () => import('@/views/week/VisitSummaryMy.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/VisitSummaryAdd',
           name: 'VisitSummaryAdd',
           component: () => import('@/views/week/VisitSummaryAdd.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/VisitSummaryDetail',
           name: 'VisitSummaryDetail',
           component: () => import('@/views/week/VisitSummaryDetail.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/VisitSummaryStorageDetail',
@@ -686,29 +484,20 @@ const router = new VueRouter({
         {
           path: '/assignAwait',
           name: 'assignAwait',
+          meta: { title: '待分配客资' },
           component: () => import('@/views/week/assignAwait/index.vue'),
-          meta: {
-            keepAlive: true,
-            title: '待分配客资',
-          },
         },
         {
           path: '/assignPage',
           name: 'assignPage',
+          meta: { title: '分配客资' },
           component: () => import('@/views/week/assignAwait/assignPage.vue'),
-          meta: {
-            keepAlive: true,
-            title: '分配客资',
-          },
         },
         {
           path: '/JZfollowUp',
           name: 'JZfollowUp',
+          meta: { title: '客资跟进' },
           component: () => import('@/views/week/assignAwait/JZfollowUp.vue'),
-          meta: {
-            keepAlive: true,
-            title: '客资跟进',
-          },
         },
         {
           path: '/systemSettings',
@@ -740,26 +529,17 @@ const router = new VueRouter({
           path: '/clew',
           name: 'clew',
           component: () => import('@/views/clew/index.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/clewent',
           name: 'clewent',
           component: () => import('@/views/clew/clewent.vue'),
-          meta: {
-            keepAlive: true,
-          },
         },
         {
           path: '/complaintDetail',
           name: 'complaintDetail',
+          meta: { title: '渠道投诉' },
           component: () => import('@/views/clew/complaintDetail/index.vue'),
-          meta: {
-            keepAlive: true,
-            title: '渠道投诉',
-          },
         },
       ],
     },
@@ -780,18 +560,6 @@ const router = new VueRouter({
         },
       ],
     },
-    {
-      path: '/chatAIPage',
-      component: layout,
-      redirect: '/chatAIPage',
-      children: [
-        {
-          path: '/chatAIPage',
-          name: 'chatAIPage',
-          component: () => import('@/views/chatAIPage/index.vue'),
-        },
-      ],
-    },
   ],
 });
 export default router;

+ 97 - 67
src/views/storeManagement/competingStoresAdd.vue

@@ -6,7 +6,7 @@
         title="潜在店"
         left-arrow
         @click-left="onClickLeft"
-        right-text="保存"
+        right-text="提交"
         @click-right="clickSubmit" />
     </div>
     <div class="content">
@@ -32,6 +32,7 @@
           :value="fromData.storeCategoryName"
           label="客户类型"
           placeholder="点击选择客户类型"
+          @click="showPicker = true"
           :rules="[{ required: true, message: '请选择客户类型' }]">
           <template #left-icon>
             <span class="van-f-red">*</span>
@@ -164,7 +165,7 @@
           </template>
         </van-field>
         <van-field
-          v-model="fromData.salesmanName"
+          v-model="fromData.contactName"
           label="门店联系人"
           placeholder="请输入门店联系人"
           :rules="[{ required: true, message: '请输入门店联系人' }]">
@@ -174,6 +175,15 @@
         </van-field>
       </van-form>
     </div>
+    <!--客户类型-->
+    <van-popup v-model="showPicker" position="bottom">
+      <van-picker
+        show-toolbar
+        value-key="dictLabel"
+        :columns="storeCategoryList"
+        @confirm="onConfirm"
+        @cancel="showPicker = false" />
+    </van-popup>
     <!--省、市、区、街道-->
     <van-popup v-model="showProvincePicker" position="bottom">
       <van-picker
@@ -264,11 +274,12 @@
 </template>
 
 <script>
-import { phoneCheck, streetQuery, getChainsByDeptCode } from '@/api/index';
+import { phoneCheck, streetQuery } from '@/api/index';
 import { updateStore } from '@/api/FSQStore';
-import { getPosition, getTicketFun, getMapPoi, getkeywordPoi, getGeocoder } from '@/utils/TXApiFun';
+import { getPosition, getTicketFun, getGeocoder } from '@/utils/TXApiFun';
 import { jsonp } from 'vue-jsonp';
 import { getstreetInfoList } from '@/api/addDesigner';
+import { qzStoreCategory, getChildDeptList, addQzStore } from '@/api/store';
 export default {
   data() {
     return {
@@ -281,7 +292,7 @@ export default {
         districtName: '',
         addressLine: '',
         orgName: '',
-        salesmanName: '',
+        contactName: '',
         lat: '',
         lon: '',
         cityNameOld: '',
@@ -305,6 +316,8 @@ export default {
       deptShow: false,
       showPickerDept: false,
       deptList: [],
+      showPicker: false,
+      storeCategoryList: [],
       // 地图信息
       showmap: false,
       search: '',
@@ -315,7 +328,22 @@ export default {
       maplist: [],
     };
   },
-  created() {
+  activated() {
+    this.fromData = {
+      storeName: '',
+      telephone: '',
+      storeCategoryName: '',
+      provinceName: '',
+      cityName: '',
+      districtName: '',
+      addressLine: '',
+      orgName: '',
+      contactName: '',
+      lat: '',
+      lon: '',
+      cityNameOld: '',
+      districtNameOld: '',
+    };
     this.showmap = false;
     this.getStoreCategoryList();
     // this.toastLoading(0, '加载中...', true);
@@ -414,24 +442,31 @@ export default {
     clickSubmit(values) {
       this.$refs.tabstoreVal.submit();
     },
+    onConfirm(value) {
+      if (!value) return;
+      this.fromData.storeCategoryName = value.dictLabel;
+      this.fromData.storeCategory = value.dictValue;
+      this.showPicker = false;
+    },
     getStoreCategoryList() {
-      // designerStoreCategory().then((res) => {
-      //   if (res.code == 200) {
-      //     this.storeCategoryList = res.data;
-      //     this.fromData.storeCategoryName = this.storeCategoryList[0].dictLabel;
-      //     this.fromData.storeCategory = this.storeCategoryList[0].dictValue;
-      //   }
-      // });
+      qzStoreCategory().then((res) => {
+        if (res.code == 200) {
+          this.storeCategoryList = res.data;
+          this.fromData.storeCategoryName = this.storeCategoryList[0].dictLabel;
+          this.fromData.storeCategory = this.storeCategoryList[0].dictValue;
+        }
+      });
     },
     onSubmit(value) {
       this.toastLoading(0, '提交中...', true);
-      updateStore(this.fromData).then((res) => {
+      console.log(this.fromData);
+      addQzStore(this.fromData).then((res) => {
         this.toastLoading().clear();
         if (res.code == 200) {
           this.$dialog
             .confirm({
               title: '系统提示',
-              message: '修改成功',
+              message: '添加成功',
               showCancelButton: false,
             })
             .then(() => {
@@ -445,7 +480,7 @@ export default {
         if (telephone == '') {
           resolve();
         }
-        var telrg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
+        var telrg = /^1[123456789]\d{9}$/;
         if (telephone.trim() == '') {
           reject();
         } else if (!telrg.test(telephone)) {
@@ -734,9 +769,8 @@ export default {
       );
     },
     PickerDept() {
-      if (this.deptShow) {
-        this.showPickerDept = true;
-      }
+      this.getChildDeptListFun();
+      this.showPickerDept = true;
     },
     onDeptConfirm(value) {
       this.fromData.orgName = value.text;
@@ -744,66 +778,62 @@ export default {
       this.fromData.orgId = value.deptId;
       // this.fromData.chainCode = '';
       // this.fromData.chainName = '';
-      this.getChainsByDeptId(value.deptId, this.fromData.ifJzStoreType);
       this.showPickerDept = false;
     },
-    getChainsByDeptId(deptCode, ifJzStoreType) {
-      getChainsByDeptCode({
+    getChildDeptListFun() {
+      getChildDeptList({
         cityName: this.fromData.cityName,
         districtName: this.fromData.districtName,
-        deptId: deptCode,
-        ifJzStoreType: ifJzStoreType,
-        storeCategory: this.fromData.storeCategory,
       }).then((res) => {
-        if (res.data.sfaOrderProducts != null) {
-          res.data.sfaOrderProducts.forEach((item) => {
-            item.orderNum = '';
-            item.storeProductId = item.orderProductId;
-          });
-          this.sfaOrderProducts = res.data.sfaOrderProducts;
-        }
-        this.ChainsList = res.data.sfaChains;
-      });
-    },
-    getChainsByDeptCode(deptId, ifJzStoreType, type) {
-      getChainsByDeptCode({
-        cityName: this.fromData.cityNameOld,
-        districtName: this.fromData.districtNameOld,
-        deptId: deptId,
-        ifJzStoreType: ifJzStoreType,
-        storeCategory: this.fromData.storeCategory,
-      }).then((res) => {
-        // if (this.ChainsList.length == 1) {
-        //   this.fromData.chainName = this.ChainsList[0].chainName;
-        //   this.fromData.chainCode = this.ChainsList[0].chainCode;
-        // }
-        if (res.data.sfaOrderProducts != null) {
-          res.data.sfaOrderProducts.forEach((item) => {
-            item.orderNum = '';
-            item.storeProductId = item.orderProductId;
-          });
-          this.sfaOrderProducts = res.data.sfaOrderProducts;
-        }
         var deptList = [];
-        for (var t1 = 0; t1 < res.data.deptList.length; t1++) {
+        for (var t1 = 0; t1 < res.data.length; t1++) {
           deptList.push({
-            deptId: res.data.deptList[t1].deptId,
-            text: res.data.deptList[t1].deptName,
+            deptId: res.data[t1].deptId,
+            text: res.data[t1].deptName,
           });
         }
         this.deptList = deptList;
-        if (deptList.length == 1) {
-          this.fromData.orgId = deptList[0].deptId;
-          this.fromData.orgName = deptList[0].text;
-          localStorage.setItem('orgName', deptList[0].text);
-          this.deptShow = false;
-          this.ChainsList = res.data.sfaChains;
-        } else {
-          this.ChainsList = [];
-          this.deptShow = true;
-        }
       });
     },
+    // getChainsByDeptCode(deptId, ifJzStoreType, type) {
+    //   getChainsByDeptCode({
+    //     cityName: this.fromData.cityNameOld,
+    //     districtName: this.fromData.districtNameOld,
+    //     deptId: deptId,
+    //     ifJzStoreType: ifJzStoreType,
+    //     storeCategory: this.fromData.storeCategory,
+    //   }).then((res) => {
+    //     // if (this.ChainsList.length == 1) {
+    //     //   this.fromData.chainName = this.ChainsList[0].chainName;
+    //     //   this.fromData.chainCode = this.ChainsList[0].chainCode;
+    //     // }
+    //     if (res.data.sfaOrderProducts != null) {
+    //       res.data.sfaOrderProducts.forEach((item) => {
+    //         item.orderNum = '';
+    //         item.storeProductId = item.orderProductId;
+    //       });
+    //       this.sfaOrderProducts = res.data.sfaOrderProducts;
+    //     }
+    //     var deptList = [];
+    //     for (var t1 = 0; t1 < res.data.deptList.length; t1++) {
+    //       deptList.push({
+    //         deptId: res.data.deptList[t1].deptId,
+    //         text: res.data.deptList[t1].deptName,
+    //       });
+    //     }
+    //     this.deptList = deptList;
+    //     if (deptList.length == 1) {
+    //       this.fromData.orgId = deptList[0].deptId;
+    //       this.fromData.orgName = deptList[0].text;
+    //       localStorage.setItem('orgName', deptList[0].text);
+    //       this.deptShow = false;
+    //       this.ChainsList = res.data.sfaChains;
+    //     } else {
+    //       this.ChainsList = [];
+    //       this.deptShow = true;
+    //     }
+    //   });
+    // },
     onClickLeft() {
       this.$router.go(-1);
     },

+ 1 - 1
src/views/storeManagement/competingStoresDetail.vue

@@ -2,7 +2,7 @@
   <div class="FSQStoreDetail">
     <div class="header">
       <van-nav-bar class="navBar" title="客户详情" left-arrow @click-left="onClickLeft">
-        <template #right>
+        <template #right v-if="fromData.updatable">
           <span style="color: #0057ba" @click="editorFn">编辑 </span>
         </template>
       </van-nav-bar>

+ 117 - 62
src/views/storeManagement/competingStoresEdit.vue

@@ -32,6 +32,7 @@
           :value="fromData.storeCategoryName"
           label="客户类型"
           placeholder="点击选择客户类型"
+          @click="getStoreCategoryListFun"
           :rules="[{ required: true, message: '请选择客户类型' }]">
           <template #left-icon>
             <span class="van-f-red">*</span>
@@ -111,6 +112,11 @@
             <span class="van-f-red">*</span>
           </template>
         </van-field>
+        <van-field readonly v-model="fromData.cityLevel" label="城市等级">
+          <template #left-icon>
+            <span class="van-f-red">*</span>
+          </template>
+        </van-field>
         <!-- <van-field
           readonly
           clickable
@@ -159,7 +165,7 @@
           </template>
         </van-field>
         <van-field
-          v-model="fromData.salesmanName"
+          v-model="fromData.contactName"
           label="门店联系人"
           placeholder="请输入门店联系人"
           :rules="[{ required: true, message: '请输入门店联系人' }]">
@@ -169,6 +175,15 @@
         </van-field>
       </van-form>
     </div>
+    <!--客户类型-->
+    <van-popup v-model="showPicker" position="bottom">
+      <van-picker
+        show-toolbar
+        value-key="dictLabel"
+        :columns="storeCategoryList"
+        @confirm="onConfirm"
+        @cancel="showPicker = false" />
+    </van-popup>
     <!--省、市、区、街道-->
     <van-popup v-model="showProvincePicker" position="bottom">
       <van-picker
@@ -259,16 +274,15 @@
 </template>
 
 <script>
-import { phoneCheck, streetQuery, getChainsByDeptCode } from '@/api/index';
-import { updateStore } from '@/api/FSQStore';
-import { getPosition, getTicketFun, getMapPoi, getkeywordPoi, getGeocoder } from '@/utils/TXApiFun';
+import { phoneCheck, streetQuery, getById } from '@/api/index';
+import { getPosition, getTicketFun, getGeocoder } from '@/utils/TXApiFun';
 import { jsonp } from 'vue-jsonp';
 import { getstreetInfoList } from '@/api/addDesigner';
+import { qzStoreCategory, getChildDeptList, addQzStore } from '@/api/store';
 export default {
   data() {
     return {
       fromData: {
-        storeCode: '',
         storeName: '',
         telephone: '',
         storeCategoryName: '',
@@ -277,9 +291,7 @@ export default {
         districtName: '',
         addressLine: '',
         orgName: '',
-        // chainName: '',
-        // townName: '',
-        salesmanName: '',
+        contactName: '',
         lat: '',
         lon: '',
         cityNameOld: '',
@@ -303,6 +315,8 @@ export default {
       deptShow: false,
       showPickerDept: false,
       deptList: [],
+      showPicker: false,
+      storeCategoryList: [],
       // 地图信息
       showmap: false,
       search: '',
@@ -314,6 +328,21 @@ export default {
     };
   },
   activated() {
+    this.fromData = {
+      storeName: '',
+      telephone: '',
+      storeCategoryName: '',
+      provinceName: '',
+      cityName: '',
+      districtName: '',
+      addressLine: '',
+      orgName: '',
+      contactName: '',
+      lat: '',
+      lon: '',
+      cityNameOld: '',
+      districtNameOld: '',
+    };
     this.showmap = false;
     // this.toastLoading(0, '加载中...', true);
     // 授权
@@ -324,6 +353,14 @@ export default {
     });
   },
   methods: {
+    getDetail() {
+      getById({ storeId: this.$route.query.id }).then((res) => {
+        this.toastLoading().clear();
+        if (res.code == 200) {
+          this.fromData = res.data;
+        }
+      });
+    },
     getLocation() {
       getPosition()
         .then((res) => {
@@ -337,6 +374,8 @@ export default {
           this.location.lon1 = resData.longitude;
           this.addVisits();
           this.initData();
+          // 获取详情
+          this.getDetail();
         })
         .catch((error) => {
           // this.beforeAddFn();
@@ -361,6 +400,7 @@ export default {
                 this.fromData.provinceName = response.data.provinceName;
                 this.fromData.cityName = response.data.cityName;
                 this.fromData.districtName = response.data.countyName;
+                this.fromData.cityLevel = response.data.countyLevel;
                 this.$nextTick(() => {
                   this.getStreetQuery();
                   this.getStreetQuery('1');
@@ -410,15 +450,35 @@ export default {
     clickSubmit(values) {
       this.$refs.tabstoreVal.submit();
     },
+    getStoreCategoryListFun() {
+      this.getStoreCategoryList();
+      this.showPicker = true;
+    },
+    onConfirm(value) {
+      if (!value) return;
+      this.fromData.storeCategoryName = value.dictLabel;
+      this.fromData.storeCategory = value.dictValue;
+      this.showPicker = false;
+    },
+    getStoreCategoryList() {
+      qzStoreCategory().then((res) => {
+        if (res.code == 200) {
+          this.storeCategoryList = res.data;
+          this.fromData.storeCategoryName = this.storeCategoryList[0].dictLabel;
+          this.fromData.storeCategory = this.storeCategoryList[0].dictValue;
+        }
+      });
+    },
     onSubmit(value) {
       this.toastLoading(0, '提交中...', true);
-      updateStore(this.fromData).then((res) => {
+      console.log(this.fromData);
+      addQzStore(this.fromData).then((res) => {
         this.toastLoading().clear();
         if (res.code == 200) {
           this.$dialog
             .confirm({
               title: '系统提示',
-              message: '修改成功',
+              message: '添加成功',
               showCancelButton: false,
             })
             .then(() => {
@@ -432,7 +492,7 @@ export default {
         if (telephone == '') {
           resolve();
         }
-        var telrg = /^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\d{8}$/;
+        var telrg = /^1[123456789]\d{9}$/;
         if (telephone.trim() == '') {
           reject();
         } else if (!telrg.test(telephone)) {
@@ -721,9 +781,8 @@ export default {
       );
     },
     PickerDept() {
-      if (this.deptShow) {
-        this.showPickerDept = true;
-      }
+      this.getChildDeptListFun();
+      this.showPickerDept = true;
     },
     onDeptConfirm(value) {
       this.fromData.orgName = value.text;
@@ -731,66 +790,62 @@ export default {
       this.fromData.orgId = value.deptId;
       // this.fromData.chainCode = '';
       // this.fromData.chainName = '';
-      this.getChainsByDeptId(value.deptId, this.fromData.ifJzStoreType);
       this.showPickerDept = false;
     },
-    getChainsByDeptId(deptCode, ifJzStoreType) {
-      getChainsByDeptCode({
+    getChildDeptListFun() {
+      getChildDeptList({
         cityName: this.fromData.cityName,
         districtName: this.fromData.districtName,
-        deptId: deptCode,
-        ifJzStoreType: ifJzStoreType,
-        storeCategory: this.fromData.storeCategory,
-      }).then((res) => {
-        if (res.data.sfaOrderProducts != null) {
-          res.data.sfaOrderProducts.forEach((item) => {
-            item.orderNum = '';
-            item.storeProductId = item.orderProductId;
-          });
-          this.sfaOrderProducts = res.data.sfaOrderProducts;
-        }
-        this.ChainsList = res.data.sfaChains;
-      });
-    },
-    getChainsByDeptCode(deptId, ifJzStoreType, type) {
-      getChainsByDeptCode({
-        cityName: this.fromData.cityNameOld,
-        districtName: this.fromData.districtNameOld,
-        deptId: deptId,
-        ifJzStoreType: ifJzStoreType,
-        storeCategory: this.fromData.storeCategory,
       }).then((res) => {
-        // if (this.ChainsList.length == 1) {
-        //   this.fromData.chainName = this.ChainsList[0].chainName;
-        //   this.fromData.chainCode = this.ChainsList[0].chainCode;
-        // }
-        if (res.data.sfaOrderProducts != null) {
-          res.data.sfaOrderProducts.forEach((item) => {
-            item.orderNum = '';
-            item.storeProductId = item.orderProductId;
-          });
-          this.sfaOrderProducts = res.data.sfaOrderProducts;
-        }
         var deptList = [];
-        for (var t1 = 0; t1 < res.data.deptList.length; t1++) {
+        for (var t1 = 0; t1 < res.data.length; t1++) {
           deptList.push({
-            deptId: res.data.deptList[t1].deptId,
-            text: res.data.deptList[t1].deptName,
+            deptId: res.data[t1].deptId,
+            text: res.data[t1].deptName,
           });
         }
         this.deptList = deptList;
-        if (deptList.length == 1) {
-          this.fromData.orgId = deptList[0].deptId;
-          this.fromData.orgName = deptList[0].text;
-          localStorage.setItem('orgName', deptList[0].text);
-          this.deptShow = false;
-          this.ChainsList = res.data.sfaChains;
-        } else {
-          this.ChainsList = [];
-          this.deptShow = true;
-        }
       });
     },
+    // getChainsByDeptCode(deptId, ifJzStoreType, type) {
+    //   getChainsByDeptCode({
+    //     cityName: this.fromData.cityNameOld,
+    //     districtName: this.fromData.districtNameOld,
+    //     deptId: deptId,
+    //     ifJzStoreType: ifJzStoreType,
+    //     storeCategory: this.fromData.storeCategory,
+    //   }).then((res) => {
+    //     // if (this.ChainsList.length == 1) {
+    //     //   this.fromData.chainName = this.ChainsList[0].chainName;
+    //     //   this.fromData.chainCode = this.ChainsList[0].chainCode;
+    //     // }
+    //     if (res.data.sfaOrderProducts != null) {
+    //       res.data.sfaOrderProducts.forEach((item) => {
+    //         item.orderNum = '';
+    //         item.storeProductId = item.orderProductId;
+    //       });
+    //       this.sfaOrderProducts = res.data.sfaOrderProducts;
+    //     }
+    //     var deptList = [];
+    //     for (var t1 = 0; t1 < res.data.deptList.length; t1++) {
+    //       deptList.push({
+    //         deptId: res.data.deptList[t1].deptId,
+    //         text: res.data.deptList[t1].deptName,
+    //       });
+    //     }
+    //     this.deptList = deptList;
+    //     if (deptList.length == 1) {
+    //       this.fromData.orgId = deptList[0].deptId;
+    //       this.fromData.orgName = deptList[0].text;
+    //       localStorage.setItem('orgName', deptList[0].text);
+    //       this.deptShow = false;
+    //       this.ChainsList = res.data.sfaChains;
+    //     } else {
+    //       this.ChainsList = [];
+    //       this.deptShow = true;
+    //     }
+    //   });
+    // },
     onClickLeft() {
       this.$router.go(-1);
     },