Pārlūkot izejas kodu

feature_20250917_仿石漆潜在客户区域创建

zhujindu 2 mēneši atpakaļ
vecāks
revīzija
d9f39de949
1 mainītis faili ar 92 papildinājumiem un 7 dzēšanām
  1. 92 7
      src/views/storeManagement/competingStoresAdd.vue

+ 92 - 7
src/views/storeManagement/competingStoresAdd.vue

@@ -37,13 +37,15 @@
           </template>
         </van-field>
         <van-field
-          v-model="fromData.orgName"
-          label="销售部"
-          placeholder="请输入销售部"
           readonly
-          :rules="[{ required: true, message: '请输入销售部' }]">
+          clickable
+          name="picker"
+          :value="fromData.orgName"
+          label="部门名称"
+          placeholder="点击选择部门名称"
+          @click="PickerDept">
           <template #left-icon>
-            <span class="van-f-red"></span>
+            <span class="van-f-red">*</span>
           </template>
         </van-field>
         <!-- <van-row style="border-bottom: 1px solid #ebedf0">
@@ -194,6 +196,15 @@
         @confirm="onTownConfirm"
         @cancel="showTownPicker = false" />
     </van-popup>
+    <!--    部门数据 -->
+    <van-popup v-model="showPickerDept" position="bottom">
+      <van-picker
+        show-toolbar
+        title="部门名称"
+        :columns="deptList"
+        @confirm="onDeptConfirm"
+        @cancel="showPickerDept = false" />
+    </van-popup>
     <div id="allmap"></div>
     <div style="position: fixed; top: 0; height: 100%; z-index: 3000; width: 100%" v-if="showmap">
       <div id="allmap1" style="height: 100%; width: 100%"></div>
@@ -242,7 +253,7 @@
 </template>
 
 <script>
-import { phoneCheck, streetQuery } from '@/api/index';
+import { phoneCheck, streetQuery, getChainsByDeptCode } from '@/api/index';
 import { updateStore } from '@/api/FSQStore';
 import { getPosition, getTicketFun } from '@/utils/TXApiFun';
 import { jsonp } from 'vue-jsonp';
@@ -283,6 +294,9 @@ export default {
       districtList: [],
       townList: [],
       provinceCode: '',
+      deptShow: false,
+      showPickerDept: false,
+      deptList: [],
       // 地图信息
       showmap: false,
       search: '',
@@ -423,7 +437,7 @@ export default {
     },
     confirmMap() {
       if (this.addresssb > -1) {
-        this.fromValue.addressLine = this.maplist[this.addresssb].address;
+        this.fromData.addressLine = this.maplist[this.addresssb].address;
       }
       this.showmap = false;
     },
@@ -671,6 +685,77 @@ export default {
         }
       );
     },
+    PickerDept() {
+      if (this.deptShow) {
+        this.showPickerDept = true;
+      }
+    },
+    onDeptConfirm(value) {
+      this.fromData.orgName = value.text;
+      localStorage.setItem('orgName', value.text);
+      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({
+        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++) {
+          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);
     },