Funny %!s(int64=3) %!d(string=hai) anos
pai
achega
fe069e878d

+ 1 - 0
package.json

@@ -11,6 +11,7 @@
   },
   "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",

+ 9 - 11
src/components/Home.vue

@@ -44,7 +44,7 @@ import sendOrderPopup from "./orderComponents/sendOrderPopup.vue";
 import OrderList from "./orderComponents/orderList.vue";
 import { getOrderList, getOrderMarker, getRefreshOrder } from "../api/order.js";
 export default {
-  name: 'HomeIndex',
+  name: "HomeIndex",
   data() {
     return {
       isLoading: false,
@@ -109,11 +109,11 @@ export default {
   },
 
   created() {
-    if(this.$route.params.tabNum === 2){
-      this.changeTab(2,1)
+    if (this.$route.params.tabNum === 2) {
+      this.changeTab(2, 1);
     }
-    if(this.$route.params.tabNum === 1){
-      this.changeTab(1,10)
+    if (this.$route.params.tabNum === 1) {
+      this.changeTab(1, 10);
     }
     this.init();
     this.getOrder();
@@ -277,16 +277,14 @@ export default {
             });
           // tabNum  0 是新订单 1是预约单
           if (this.tabNum === 1) {
-            this.orderList = this.orderList.concat(appointList);
+            this.orderList = appointList.concat(this.orderList);
           } else if (this.tabNum === 0) {
-            this.orderList = this.orderList.concat(normalList);
+            this.orderList = normalList.concat(this.orderList);
           } else {
-            this.orderList = this.orderList.concat(newList);
+            this.orderList = newList.concat(this.orderList);
           }
-          console.log("1111", deliveryList);
           deliveryList.forEach((item) => {
             this.orderList = this.orderList.filter((v) => {
-              console.log("2222", v, item);
               return v.id !== item;
             });
           });
@@ -440,7 +438,7 @@ export default {
         height: 222px;
       }
       .no-data {
-        color: #9EA7B7;
+        color: #9ea7b7;
       }
     }
   }

+ 99 - 63
src/components/manualCreate.vue

@@ -14,9 +14,9 @@
 
           <el-form-item :label="sendType ? '发件门店' : '发件人姓名'" required>
             <el-input v-show="!sendType" size="small" class="input" v-model="form.sendAddress.contact" placeholder="请填写发件人姓名" clearable></el-input>
-            <el-input v-show="sendType" disabled size="small" class="input" v-model="form.sendAddress.name" placeholder="请填写发件门店"></el-input>
+            <el-input v-show="sendType" disabled size="small" class="input" v-model="name" placeholder="请填写发件门店"></el-input>
             <el-button v-show="sendType" @click="showShop(1)" class="but1 active" type="info">选择门店</el-button>
-            <el-button v-show="!sendType" @click="showShop(1)" class="but1 active" type="info">常用地址</el-button>
+            <el-button v-show="!sendType" @click="showShop(2)" class="but1 active" type="info">常用地址</el-button>
           </el-form-item>
           <el-form-item label="发件人电话" required>
             <el-input size="small" class="phone-before" v-model="form.sendAddress.phone" placeholder="请填写发件人电话" clearable></el-input>
@@ -40,7 +40,7 @@
           <el-form-item label="收件人姓名" required>
             <el-input size="small" v-model="form.receiptAddress.contact" placeholder="请填写收件人姓名" clearable>
             </el-input>
-            <el-button @click="showShop(2)" class="but1 active" type="info">常用地址</el-button>
+            <el-button @click="showShop(3)" class="but1 active" type="info">常用地址</el-button>
           </el-form-item>
           <el-form-item label="收件人电话" required>
             <el-input size="small" class="phone-before" v-model="form.receiptAddress.phone" placeholder="请填写收件人电话" clearable></el-input>
@@ -74,7 +74,7 @@
           <el-form-item label="物品重量" required>
             <div class="printer-num">
               <img @click="reduce()" src="../../static/image/icon_reduce.png" class="reduce" alt="" srcset="" />
-              <el-input ref="weight" @blur="checkWeight" size="small" class="num" v-model="form.weight" clearable>
+              <el-input ref="weight" size="small" class="num" v-model="form.weight" clearable>
                 <template slot="append">KG</template>
               </el-input>
               <img @click="add()" src="../../static/image/icon_add.png" class="add" alt="" srcset="" />
@@ -83,7 +83,7 @@
             </el-input-number> -->
           </el-form-item>
           <el-form-item label="物品价值" required>
-            <el-input class="product-amount" ref="productAmount" @blur="checkProductAmount" size="small" v-model="form.productAmount" placeholder="请输入物品价值!" clearable>
+            <el-input class="product-amount" ref="productAmount" size="small" v-model="form.productAmount" placeholder="请输入物品价值!" clearable>
               <template slot="append">元</template>
             </el-input>
           </el-form-item>
@@ -115,9 +115,9 @@
       </div>
 
       <!-- 选择门店 -->
-      <el-dialog v-loading="loading" element-loading-text="拼命加载中" :title="sendType === 1 && addressType !== 2  ? '选择门店' : '常用地址'" :visible.sync="showChooseShop" width="600px" center>
+      <el-dialog v-loading="loading" element-loading-text="拼命加载中" :title="addressType === 1 ? '选择门店' : '常用地址'" :visible.sync="showChooseShop" width="600px" center>
         <div class="shop-top">
-          <div @click="showAddress = true" v-if="sendType === 0 || addressType === 2" class="management-address">地址管理</div>
+          <div @click="showAddress = true" v-if="addressType === 3 || addressType === 2" class="management-address">地址管理</div>
           <el-input size="small" placeholder="请输入姓名/手机号/地址" v-model="searchKey" @keydown.enter.native="seachEnterFun" clearable>
             <el-button type="primary" @click.stop="getData" slot="append" icon="el-icon-search"></el-button>
           </el-input>
@@ -153,17 +153,18 @@ import addressManagement from "../components/settingComponents/addressManagement
 import { getProductList } from "../api/shop.js";
 import { sendValuation, saveOrder, getAddressList } from "../api/order.js";
 import sendOrderPopup from "../components/orderComponents/sendOrderPopup.vue";
+import { send } from "process";
 export default {
   name: "manualCreate",
   data() {
     return {
       products: [],
-      sendType: this.$store.state.userInfo.memberType === 1 ? 0 : 1,
+      sendType: this.$store.state.userInfo.memberType === 1 ? 0 : 1, // 0是个人地址发单 1是门店地址发单
       addressType: 1,
+      name: "",
       form: {
         name: "",
         sendAddress: {
-          name: "",
           id: "",
           address: "",
           cityCode: "",
@@ -218,6 +219,8 @@ export default {
       memberType: this.$store.state.userInfo.memberType,
       min: 15,
       showAddress: false,
+      personalSendAddressId: "",
+      personalReceiptAddressId: "",
     };
   },
   components: {
@@ -229,12 +232,20 @@ export default {
   computed: {},
   // 监控data中的数据变化
   watch: {
-    sendType(newVal, oldVal) {
-      this.searchKey = "";
-      Object.keys(this.form.sendAddress).map((v) => {
-        this.form.sendAddress[v] = "";
-      });
-      this.getData();
+    sendType: {
+      handler(newVal, oldVal) {
+        this.searchKey = "";
+        Object.keys(this.form.sendAddress).map((v) => {
+          this.form.sendAddress[v] = "";
+        });
+        if (newVal) {
+          this.addressType = 1;
+        } else {
+          this.addressType = 2;
+        }
+        this.getData();
+      },
+      // immediaty: true,
     },
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
@@ -244,33 +255,6 @@ export default {
   },
   // 方法集合
   methods: {
-    checkWeight() {
-      let reg = new RegExp(/^([1-4][0-9]{0,1}|50)$/);
-      if (!reg.test(Number(this.form.weight))) {
-        this.$refs.weight.focus();
-        return this.$message({
-          type: "error",
-          message: "物品重量为正整数且不得超过50KG!",
-        });
-      }
-    },
-    checkProductAmount() {
-      let reg1 = new RegExp(/(^[1-9]{1}[0-9]*$)|(^[0-9]*\.[0-9]{2}$)/);
-      if (!reg1.test(Number(this.form.productAmount))) {
-        this.$refs.productAmount.focus();
-        return this.$message({
-          type: "error",
-          message: "请输入正确的金额!",
-        });
-      }
-      if (Number(this.form.productAmount) > 20000) {
-        this.$refs.productAmount.focus();
-        return this.$message({
-          type: "error",
-          message: "物品价值不得超过20000元!",
-        });
-      }
-    },
     closeAddress() {
       this.getData();
     },
@@ -301,25 +285,20 @@ export default {
         Object.keys(this.form.sendAddress).map((v) => {
           this.form.sendAddress[v] = sendAddress[v];
         });
-        if (!this.sendType) {
-          this.shopId = "";
-        } else {
-          this.form.shopId = sendAddress.id;
-        }
+        this.name = sendAddress.name;
+        this.form.shopId = sendAddress.id;
+      } else if (this.addressType === 2) {
+        this.form.sendAddress = sendAddress;
+        this.personalSendAddressId = sendAddress.id;
       } else {
         this.form.receiptAddress = sendAddress;
+        this.personalReceiptAddressId = sendAddress.id;
       }
     },
     showShop(addressType) {
+      // 1门店地址发单选择门店 2是个人地址发单选择常用地址 3是收件地址选择常用地址
       this.addressType = addressType;
       this.searchKey = "";
-      if (this.sendType) {
-        this.addressList.forEach((v, index) => {
-          if (v.id === this.form.shopId) {
-            this.curIdx = index;
-          }
-        });
-      }
       this.getData();
       this.showChooseShop = true;
     },
@@ -330,17 +309,57 @@ export default {
       }).then((res) => {
         this.loading = false;
         if (res.code === 200) {
-          if (this.sendType && this.addressType !== 2) {
+          let sendAddress;
+          if (this.addressType === 1) {
             this.addressList = res.data.shop;
-            let sendAddress = this.addressList.filter((v) => {
+            sendAddress = this.addressList.filter((v) => {
               return v.id === this.form.shopId;
             })[0];
+            this.curIdx = this.addressList.findIndex((v) => {
+              return v.id === this.form.shopId;
+            });
+            console.log("sendAddress1", sendAddress);
             Object.keys(this.form.sendAddress).map((v) => {
               this.form.sendAddress[v] = sendAddress[v];
             });
+            this.name = sendAddress.name;
           }
-          if (!this.sendType || this.addressType === 2) {
+          if (this.addressType === 2) {
             this.addressList = res.data.personal;
+            if (this.personalSendAddressId) {
+              sendAddress = this.addressList.filter((v) => {
+                return v.id === this.personalSendAddressId;
+              })[0];
+              this.curIdx = this.addressList.findIndex((v) => {
+                return v.id === this.personalSendAddressId;
+              });
+            } else {
+              sendAddress = this.addressList.filter((v) => {
+                return v.isDefault;
+              })[0];
+              this.curIdx = this.addressList.findIndex((v) => {
+                return v.isDefault;
+              });
+            }
+            console.log("sendAddress2", sendAddress);
+            Object.keys(this.form.sendAddress).map((v) => {
+              this.form.sendAddress[v] = sendAddress ? sendAddress[v] : "";
+            });
+          }
+          if (this.addressType === 3) {
+            this.addressList = res.data.personal;
+            let receiptAddress = this.addressList.filter((v) => {
+              return v.id === this.personalReceiptAddressId;
+            })[0];
+            this.curIdx = this.addressList.findIndex((v) => {
+              return v.id === this.personalReceiptAddressId;
+            });
+            console.log("receiptAddress", receiptAddress);
+            Object.keys(this.form.receiptAddress).map((v) => {
+              this.form.receiptAddress[v] = receiptAddress
+                ? receiptAddress[v]
+                : "";
+            });
           }
         } else {
           this.$message({
@@ -387,9 +406,9 @@ export default {
           message: "请输入正确的发件人电话!",
         });
       }
-      // 个人发件
+      // 个人发件
       if (!this.sendType) {
-        this.form.shopId = "";
+        this.form.shopId = this.$store.state.userInfo.shopId;
         if (!this.form.sendAddress.contact.trim()) {
           return this.$message({
             type: "error",
@@ -428,11 +447,28 @@ export default {
           message: "请先选择收件人地址!",
         });
       }
-      if (this.checkWeight()) {
-        return;
+      let reg = new RegExp(/^([1-4][0-9]{0,1}|50)$/);
+      if (!reg.test(Number(this.form.weight))) {
+        this.$refs.weight.focus();
+        return this.$message({
+          type: "error",
+          message: "物品重量为正整数且不得超过50KG!",
+        });
+      }
+      let reg1 = new RegExp(/(^[1-9]{1}[0-9]*$)|(^[0-9]*\.[0-9]{2}$)/);
+      if (!reg1.test(Number(this.form.productAmount))) {
+        this.$refs.productAmount.focus();
+        return this.$message({
+          type: "error",
+          message: "请输入正确的金额!",
+        });
       }
-      if (this.checkProductAmount()) {
-        return;
+      if (Number(this.form.productAmount) > 20000) {
+        this.$refs.productAmount.focus();
+        return this.$message({
+          type: "error",
+          message: "物品价值不得超过20000元!",
+        });
       }
       // 预约发单
       if (this.form.takeType) {

+ 11 - 3
src/components/orderComponents/orderAMap.vue

@@ -37,7 +37,8 @@ import {
   getMapData,
   getLocation,
 } from "../../api/order.js";
-import AmapVue from "@amap/amap-vue";
+// import AmapVue from "@amap/amap-vue";
+// import { AMapUILoader } from "amap-js";
 export default {
   data() {
     return {
@@ -60,7 +61,14 @@ export default {
     };
   },
   created() {},
-  mounted() {},
+  mounted() {
+    // const loader = AMapUILoader.loadUI(["overlay/SimpleMarker"])
+    //   .then(([SimpleMarker]) => {
+    //     // 其他逻辑
+    //     console.log(SimpleMarker);
+    //   })
+    //   .catch((e) => {});
+  },
   methods: {
     seachEnterFun(e) {
       var keyCode = window.event ? e.keyCode : e.which;
@@ -338,7 +346,7 @@ export default {
   width: 100%;
   height: 400px;
 }
-/deep/ .amap-container img {
+/deep/ .amap-marker img {
   width: 40px !important;
   height: 40px !important;
 }

+ 28 - 8
src/components/orderComponents/orderDetail.vue

@@ -50,20 +50,40 @@
         </div>
         <div class="detail_ine"></div>
       </template>
+      <template v-if="orderDetail.sendAddress || orderDetail.receiptAddress">
+        <div class="detail_title2">地址信息</div>
+        <div class="info2 info4" v-if="orderDetail.sendAddress">
+          <div class="title">发件地址:</div>
+          <div class="cont">{{orderDetail.sendAddress}}</div>
+        </div>
+        <div class="info2 info4" v-if="orderDetail.receiptAddress">
+          <div class="title">收件地址:</div>
+          <div class="cont">{{orderDetail.receiptAddress}}</div>
+        </div>
+        <div class="detail_ine"></div>
+      </template>
       <template v-if="orderDetail.receiptContactName">
         <div class="detail_title2">顾客信息</div>
         <div class="info2 info4">
           <div class="title">姓名:</div>
           <div class="cont">{{orderDetail.receiptContactName}}</div>
         </div>
-        <div class="info2 info4" v-if="orderDetail.receiptPhone">
-          <div class="title">隐私号:</div>
-          <div class="cont">{{orderDetail.receiptPhone}}</div>
-        </div>
-        <div class="info2 info4" v-if="orderDetail.receiptPrivacyPhone">
-          <div class="title">手机号:</div>
-          <div class="cont">{{orderDetail.receiptPrivacyPhone}}</div>
-        </div>
+        <template v-if="orderDetail.waimaiOrderId">
+          <div class="info2 info4" v-if="orderDetail.receiptPhone">
+            <div class="title">隐私号:</div>
+            <div class="cont">{{orderDetail.receiptPhone}}</div>
+          </div>
+          <div class="info2 info4" v-if="orderDetail.receiptPrivacyPhone">
+            <div class="title">手机号:</div>
+            <div class="cont">{{orderDetail.receiptPrivacyPhone}}</div>
+          </div>
+        </template>
+        <template v-else>
+          <div class="info2 info4" v-if="orderDetail.receiptPhone">
+            <div class="title">手机号:</div>
+            <div class="cont">{{orderDetail.receiptPhone}}{{orderDetail.receiptExtension ? "_" + orderDetail.receiptExtension : ""}}</div>
+          </div>
+        </template>
       </template>
       <div class="detail_ine"></div>
       <div class="detail_title2">订单金额</div>

+ 2 - 7
src/components/orderComponents/orderList.vue

@@ -164,15 +164,11 @@
               <div class="address">
                 <!-- {{ item.receiptProvinceName }}
                 {{ item.receiptCityName }} -->
-                {{ item.receiptDistrictName }}
+                <!-- {{ item.receiptDistrictName }} -->
                 {{ item.receiptAddress }}
                 <span class="distance" @click.stop="checkMap(item)">
                   <i class="el-icon-location"></i>
                   <span>查看地图</span>
-                  <!-- <span v-if="item.orderDistance < 1000">
-                    {{ item.orderDistance }}m
-                  </span>
-                  <span v-else> {{ item.orderDistance / 1000 }}km </span> -->
                 </span>
               </div>
               <div v-if="item.caution" class="itme_r">
@@ -180,7 +176,6 @@
               </div>
             </div>
           </div>
-          <!-- <div v-if="item.caution" class="itme_r">备注:{{ item.caution }}</div> -->
         </div>
       </el-col>
     </el-row>
@@ -751,7 +746,7 @@ export default {
         },
         takeTime: order.takeTime,
         weight: order.weight,
-        takeType: order.takeType,
+        takeType: order.waimaiOrderId ? order.takeType : 0,
         type: this.userInfo.memberType == 1 ? 1 : 2,
         isWaimai: order.waimaiId ? true : false,
         waimaiOrderId: order.waimaiOrderId,