فهرست منبع

设计师招募

zhujindu 5 ماه پیش
والد
کامیت
e409af3655
3فایلهای تغییر یافته به همراه44 افزوده شده و 4 حذف شده
  1. 22 0
      src/utils/TXApiFun.js
  2. 20 4
      src/views/storeManagement/addDesignerPage.vue
  3. 2 0
      src/views/storeManagement/storeEdit.vue

+ 22 - 0
src/utils/TXApiFun.js

@@ -192,3 +192,25 @@ export function getkeywordPoi(location, keywordValue) {
       });
   });
 }
+
+/**
+ * 逆地址解析
+ * @param {*object} location //当前位置
+ * @returns
+ */
+export function getGeocoder(location) {
+  return new Promise((resolve, reject) => {
+    let api = 'https://apis.map.qq.com/ws/geocoder/v1/?get_poi=0&output=jsonp';
+    let key = `&key=${TxMapKey}`;
+    let locationPos = `&location=${location.latitude},${location.longitude}`;
+    jsonp(api + locationPos + key)
+      .then((res) => {
+        console.log(res);
+        resolve(res);
+      })
+      .catch((err) => {
+        console.log(err);
+        reject(err);
+      });
+  });
+}

+ 20 - 4
src/views/storeManagement/addDesignerPage.vue

@@ -332,7 +332,7 @@ import {
 } from '@/api/index';
 import { validatePhone } from '@/utils';
 import { jsonp } from 'vue-jsonp';
-import { getPosition, getTicketFun } from '@/utils/TXApiFun';
+import { getPosition, getTicketFun, getGeocoder } from '@/utils/TXApiFun';
 export default {
   data() {
     return {
@@ -405,7 +405,7 @@ export default {
           this.fromData.lon = TXisBD.lon;
           this.location.lat1 = resData.latitude;
           this.location.lon1 = resData.longitude;
-          this.addVisits();
+          this.initData();
         })
         .catch((error) => {
           this.beforeAddFn();
@@ -414,16 +414,32 @@ export default {
           });
         });
     },
+    initData() {
+      getGeocoder({ latitude: this.location.lat1, longitude: this.location.lon1 }).then((res) => {
+        if (res.status == 0 && res.result) {
+          let result = res.result;
+          this.fromData.cityNameOld = result.ad_info.city;
+          this.fromData.districtNameOld = result.ad_info.district;
+          let addresses = result.formatted_addresses; // 描述性地址
+          if (addresses) {
+            this.fromData.addressLine = addresses.recommend;
+            localStorage.setItem('locationRemark', addresses.recommend);
+          }
+          //   this.beforeAddFn();
+        }
+      });
+    },
     moreTypeShowfn() {
       this.chainsData = [];
       this.moreTypeShow = true;
     },
+    // 搜索经销商列表
     getChainsByDeptCodesearch(chainName) {
       this.chainsData = [];
       getChainsByDeptCode({
         chainName: this.searchChainName,
-        // cityName: this.fromData.cityNameOld,
-        // districtName: this.fromData.districtNameOld,
+        cityName: this.fromData.cityNameOld,
+        districtName: this.fromData.districtNameOld,
         // deptId: this.fromData.orgId,
         // ifJzStoreType: this.fromData.ifJzStoreType,
         // storeCategory: this.fromData.storeCategory,

+ 2 - 0
src/views/storeManagement/storeEdit.vue

@@ -873,8 +873,10 @@ export default {
       });
     },
     searchFn(val) {
+      debugger;
       this.searchSHow = false;
       getkeywordPoi({ latitude: this.pLat, longitude: this.pLot }, val).then((res) => {
+        debugger;
         // 不显示下拉选择
         if (!res.data.length && !val) {
           this.searchSHow = false;