Funny 3 年之前
父节点
当前提交
4fd74895b1

+ 0 - 1
package.json

@@ -11,7 +11,6 @@
   },
   "dependencies": {
     "@amap/amap-vue": "^2.0.13",
-    "amap-js": "^2.3.0",
     "axios": "^0.21.4",
     "element-ui": "^2.15.5",
     "moment": "^2.29.1",

+ 1 - 1
src/components/manualCreate.vue

@@ -137,7 +137,7 @@
     </el-form>
     <el-button class="btn" size="small" type="primary" @click="onSubmit">{{form.takeType ? '保存' : '去结算'}}</el-button>
     <!-- 通过地图选择地理位置 -->
-    <order-map @getAddressDetail="getAddressDetail" ref="orderMap"></order-map>
+    <order-map :key="new Date().getTime()" @getAddressDetail="getAddressDetail" ref="orderMap"></order-map>
     <!-- 发起配送 -->
     <send-order-popup ref="sendOrderPopup"></send-order-popup>
     <!-- 地址管理 -->

+ 1 - 1
src/components/merchantAdd.vue

@@ -103,7 +103,7 @@ export default {
           address: "",
           contactName: "",
           mobile: "",
-          name: "",
+          merchantName: "",
           street: "",
           categoryId: "",
         };

+ 33 - 55
src/components/orderComponents/orderAMap.vue

@@ -2,7 +2,7 @@
   <el-dialog v-loading='loading' element-loading-text="拼命加载中" width="80%" destroy-on-close :visible.sync="dialogTableVisible" append-to-body>
     <el-form v-if="showSearch" ref="ruleForm" class="demo-form-inline" :inline="true">
       <el-form-item class="search-box">
-        <el-input size="small" @keydown.enter.native="seachEnterFun" v-model="searchKey" type="search" id="search" style="width: 219px" placeholder="请输入关键字进行搜索" />
+        <el-input size="small" @keydown.enter.native="seachEnterFun" v-model="searchKey" type="search" id="search" style="width: 280px" placeholder="请输入关键字进行搜索" />
       </el-form-item>
       <el-form-item>
         <el-button size="small" type="primary" class="map-btn" @click="searchMap">搜索</el-button>
@@ -12,7 +12,7 @@
         <el-input size="small" maxlength="11" v-model="lng" style="width: 140px" disabled></el-input>
       </el-form-item>
       <el-form-item label="纬度:" prop="lat">
-        <el-input size="small"  maxlength="10" v-model="lat" style="width: 140px" disabled></el-input>
+        <el-input size="small" maxlength="10" v-model="lat" style="width: 140px" disabled></el-input>
       </el-form-item>
       <el-form-item>
         <el-button size="small" type="primary" class="map-btn" @click="clickSureMap">确定</el-button>
@@ -24,7 +24,7 @@
         </div>
       </div>
     </el-form>
-    <amap @click="onMapClick" ref="map" :zoom="zoom" :center="center" style="height: 600px;" class="amap-demo">
+    <amap @click="onMapClick" ref="map" :zoom="zoom" :center="center" style="height: 620px;" class="amap-demo">
       <amap-marker v-for="(marker,index) in markers" :key="index" :offset="marker.offset" :position="marker.position" :icon="marker.icon" :label="marker.label" />
     </amap>
   </el-dialog>
@@ -38,7 +38,6 @@ import {
   getLocation,
 } from "../../api/order.js";
 // import AmapVue from "@amap/amap-vue";
-// import { AMapUILoader } from "amap-js";
 export default {
   data() {
     return {
@@ -61,14 +60,7 @@ export default {
     };
   },
   created() {},
-  mounted() {
-    // const loader = AMapUILoader.loadUI(["overlay/SimpleMarker"])
-    //   .then(([SimpleMarker]) => {
-    //     // 其他逻辑
-    //     console.log(SimpleMarker);
-    //   })
-    //   .catch((e) => {});
-  },
+  mounted() {},
   methods: {
     seachEnterFun(e) {
       var keyCode = window.event ? e.keyCode : e.which;
@@ -78,36 +70,18 @@ export default {
     },
     getGeoCode(v) {
       this.showAddressList = false;
-      let address =
-        (v.district ? v.district : v.cityname + v.adname) + v.address + v.name;
-      getGeoCode({ address }).then((res) => {
-        if (res.code === 200) {
-          if (!res.data.length) {
-            return this.$message({
-              type: "error",
-              message: "该点没有具体的地址信息,请重新选点!",
-            });
-          }
-          this.addressDetail = res.data[0];
-          this.addressDetail.address = address;
-          let splitPoint = this.addressDetail.location.indexOf(",");
-          this.lng = this.addressDetail.location.slice(0, splitPoint);
-          this.lat = this.addressDetail.location.slice(splitPoint + 1);
-          this.center = [this.lng, this.lat];
-          this.markers = [
-            {
-              id: 1,
-              position: this.center,
-              icon: "/static/image/map_current.png",
-            },
-          ];
-        } else {
-          this.$message({
-            type: "error",
-            message: res.msg,
-          });
-        }
-      });
+      let splitPoint = v.location.indexOf(",");
+      this.lng = v.location.slice(0, splitPoint);
+      this.lat = v.location.slice(splitPoint + 1);
+      this.center = [this.lng, this.lat];
+      this.markers = [
+        {
+          id: 1,
+          position: this.center,
+          icon: "/static/image/map_current.png",
+        },
+      ];
+      this.getLocation();
     },
     searchMap() {
       if (!this.searchKey.trim()) {
@@ -238,6 +212,7 @@ export default {
         this.position = null;
       }
     },
+    // 获取当前点详细地址信息
     getLocation() {
       this.$axios
         .get("https://restapi.amap.com/v3/geocode/regeo", {
@@ -247,22 +222,25 @@ export default {
             extensions: "all",
           },
         })
-        .then(function (res) {
-          console.log("数据", res);
+        .then((res) => {
+          let data = res.data;
+          let address = data.regeocode.formatted_address.split(
+            data.regeocode.addressComponent.township
+          );
+          this.searchKey = address[address.length - 1];
+          this.addressDetail = {
+            address: this.searchKey,
+            province: data.regeocode.addressComponent.province,
+            city: data.regeocode.addressComponent.city.length
+              ? data.regeocode.addressComponent.city
+              : data.regeocode.addressComponent.province,
+            citycode: data.regeocode.addressComponent.citycode,
+            district: data.regeocode.addressComponent.district,
+          };
         })
-        .catch(function (res) {
+        .catch((res) => {
           console.log(res);
         });
-      // getLocation({
-      //   location: `${this.lng},${this.lat}`,
-      //   radius: 500,
-      //   page: 1,
-      //   offset: 20,
-      // }).then((res) => {
-      //   console.log("数据", res);
-      //   this.promptList = res.data;
-      //   this.showAddressList = true;
-      // });
     },
     // 定位
     getCurrentLocation() {

+ 4 - 1
src/components/shopCompoents/shopAdd.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="shopAdd">
-    <el-dialog width="600px" :title="title" destroy-on-close center :visible.sync="showVisible">
+    <el-dialog @close="closeShop" width="600px" :title="title" destroy-on-close center :visible.sync="showVisible">
       <el-form :model="form">
         <el-form-item label="门店名称" label-width="103px">
           <el-input v-model="form.name" placeholder="请输入店铺名称" autocomplete="off" style="width: 100%"></el-input>
@@ -98,6 +98,9 @@ export default {
     orderMap,
   },
   methods: {
+    closeShop() {
+      this.loading = false;
+    },
     init(e) {
       if (e) {
         this.title = "编辑门店";

+ 4 - 1
src/components/shopCompoents/shopList.vue

@@ -48,11 +48,14 @@ export default {
       loading: false,
       shopList: [],
       productList: [],
+      memberType: this.$store.state.userInfo.memberType,
     };
   },
 
   mounted() {
-    this.getData();
+    if (this.memberType !== 1) {
+      this.getData();
+    }
     this.getProductList();
     // this.$refs.map.setDialogStatus()
   },