Funny 3 yıl önce
ebeveyn
işleme
aa961a4746

+ 13 - 9
src/api/tool.js

@@ -96,15 +96,19 @@ export default {
   },
 
   eosFormatTime2(oldTimes1, disparityTime) {
-    let time1 = oldTimes1.split(" ");
-    let time2 = time1[1].split(":");
-    let time3 = time1[0].split("-");
-    if (disparityTime % 1 === 0) {
-      return `${time3[1]}-${time3[2]} ${time2[0] - disparityTime}:00`;
-    } else {
-      return `${time3[1]}-${time3[2]} ${time2[0] -
-        Math.ceil(disparityTime)}:30`;
-    }
+    // let time1 = oldTimes1.split(" ");
+    // let time2 = time1[1].split(":");
+    // let time3 = time1[0].split("-");
+    // if (disparityTime % 1 === 0) {
+    //   return `${time3[1]}-${time3[2]} ${time2[0] - disparityTime}:00`;
+    // } else {
+    //   return `${time3[1]}-${time3[2]} ${time2[0] -
+    //     Math.ceil(disparityTime)}:30`;
+    // }
+    var date = new Date(oldTimes1)
+    let newDate = date-disparityTime*60*60*1000
+    let showDate = this.getFormatDate(newDate,'MM-dd hh:mm:ss')
+    return showDate
   },
   timeago(hisTime) {
     var diffValue = new Date().getTime() - hisTime,

+ 21 - 18
src/components/Home.vue

@@ -23,16 +23,16 @@
     </el-row>
 
     <el-row class="order_list">
-      <el-col :span="24" v-if="orderList.length" v-loading="isLoading">
+      <el-col :span="24" v-loading="isLoading">
         <order-list class="list" :list="orderList" :tabNum="tabNum"></order-list>
         <div style="text-align: center">
           <el-pagination :current-page.sync="params.pageNum" @size-change="handleSizeChange" @current-change="handleCurrentChange" :page-sizes="[10, 20, 50, 100]" :page-size="params.pageSize" layout="total, sizes, prev, pager, next, jumper" :total="total" background>
           </el-pagination>
         </div>
       </el-col>
-      <el-col class="empty-data" v-else>
+      <!-- <el-col class="empty-data" v-else>
         <img src="../../static/image/empty-data.png" />
-      </el-col>
+      </el-col> -->
     </el-row>
   </div>
 </template>
@@ -112,20 +112,16 @@ export default {
     this.getMarker();
     this.timer = setInterval(() => {
       this.getMarker();
-      if (this.tabNum < 2) {
-        this.getRefreshOrder();
-      }
+      this.getRefreshOrder();
     }, 5000);
-    this.timer2 = setInterval(() => {
-      this.getMarker();
-      if (this.tabNum >= 2) {
-        this.getOrder();
-      }
-    }, 60000);
-  },
-  mounted() {
-    
+    // this.timer2 = setInterval(() => {
+    //   this.getMarker();
+    //   if (this.tabNum >= 2) {
+    //     this.getOrder();
+    //   }
+    // }, 60000);
   },
+  mounted() {},
   beforeDestroy() {
     clearInterval(this.timer);
     this.timer = null;
@@ -247,7 +243,11 @@ export default {
       let orderIds = this.orderList.map((v) => {
         return v.id;
       });
-      getRefreshOrder({ orderIds }).then((res) => {
+      let params = {
+        orderIds: orderIds,
+        status: this.tabList[this.tabNum].status,
+      };
+      getRefreshOrder(params).then((res) => {
         if (res.code === 200) {
           let newList = res.data.newList;
           let deliveryList = res.data.deliveryList;
@@ -274,11 +274,14 @@ export default {
               return item;
             });
           // tabNum  0 是新订单 1是预约单
-          if (this.tabNum) {
+          if (this.tabNum === 1) {
             this.orderList = this.orderList.concat(appointList);
-          } else {
+          } else if (this.tabNum === 0) {
             this.orderList = this.orderList.concat(normalList);
+          } else {
+            this.orderList = this.orderList.concat(newList);
           }
+          console.log("deliveryList", deliveryList);
           deliveryList.forEach((item) => {
             this.orderList = this.orderList.filter((v) => {
               return v.id !== item;

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

@@ -1,5 +1,5 @@
 <template>
-  <el-dialog width="80%" destroy-on-close :visible.sync="dialogTableVisible">
+  <el-dialog v-loading='loading' element-loading-text="拼命加载中" width="80%" destroy-on-close :visible.sync="dialogTableVisible">
     <el-form v-if="showSearch" ref="ruleForm" class="demo-form-inline" :inline="true">
       <el-form-item class="search-box">
         <el-input @keydown.enter.native="seachEnterFun" v-model="searchKey" type="search" id="search" style="width: 219px" placeholder="请输入关键字进行搜索" />
@@ -26,6 +26,7 @@
     </el-form>
     <el-amap vid="container" :zoom="zoom" :center="center" style="height: 600px;" class="amap-demo">
       <el-amap-marker v-for="(marker,index) in markers" :key="index" :position="marker.position" :icon="marker.icon"></el-amap-marker>
+      <el-amap-text v-for="text in texts" :key="text.id" :text="text.text" :offset="text.offset" :position="text.position" :events="text.events"></el-amap-text>
       <!-- <el-amap-polyline :path="polyline.path"></el-amap-polyline> -->
       <!-- <el-amap-info-window v-if="window" :position="window.position" :visible="window.visible"
         :content="window.content"></el-amap-info-window> -->
@@ -34,7 +35,7 @@
 </template>
 
 <script>
-import { getInputPrompt, getGeoCode } from "../../api/order.js";
+import { getInputPrompt, getGeoCode, getMapData } from "../../api/order.js";
 export default {
   data() {
     return {
@@ -42,6 +43,7 @@ export default {
       dialogTableVisible: false,
       order: {},
       markers: [],
+      texts: [],
       defaultCity: "北京",
       zoom: 18,
       center: [116.39747132275389, 39.908857325556404],
@@ -52,6 +54,7 @@ export default {
       lat: "",
       showAddressList: false,
       showSearch: false,
+      loading: false,
     };
   },
   created() {},
@@ -111,7 +114,8 @@ export default {
         }
       });
     },
-    setDialogStatus(data, mapData) {
+    init(data, mapData) {
+      console.log("地图数据:", data, mapData);
       let sendM = {
         id: 1,
         position: [data.sendLng, data.sendLat],
@@ -122,6 +126,11 @@ export default {
         position: [data.receiptLng, data.receiptLat],
         icon: "/static/image/map-shou.png",
       };
+      let riderM = {
+        id: 3,
+        position: [mapData.shipperLng, mapData.shipperLat],
+        icon: "/static/image/map-rider.png",
+      };
       // 中心点
       this.center = [
         ((data.receiptLng * 1 + data.sendLng * 1) / 2).toFixed(6),
@@ -129,13 +138,62 @@ export default {
       ];
       // marker标记
       this.markers = [sendM, receiptM];
+      if (mapData.shipperLng && mapData.shipperLat) {
+        this.markers.push(riderM);
+      }
+
+      let orderDistance =
+        mapData.orderDistance > 1000
+          ? mapData.orderDistance / 1000 + "公里"
+          : mapData.orderDistance + "米";
+      this.texts = [
+        {
+          id: 4,
+          position: [data.sendLng, data.sendLat],
+          text: `商家距离目的地${orderDistance}`,
+          offset: [10, -50],
+        },
+      ];
+      if (mapData.shipperLng && mapData.shipperLat && mapData.shipperDistance) {
+        let distance =
+          mapData.shipperDistance > 1000
+            ? mapData.shipperDistance / 1000 + "公里"
+            : mapData.shipperDistance + "米";
+        this.texts.push({
+          id: 5,
+          position: [mapData.shipperLng, mapData.shipperLat],
+          text:
+            data.buttonStatus === 2
+              ? `骑手距离商家${distance} | 预计${mapData.riderArriveMinute}分钟后到店`
+              : data.buttonStatus === 3
+              ? `骑手距离目的地${distance} | 预计${mapData.estimateArriveTime}送达`
+              : "",
+          offset: [15, -50],
+        });
+      }
+
       // 绘制折线
       // this.polyline.path = [
       //   new AMap.LngLat(mapData.receiptLng, mapData.receiptLat),
       //   new AMap.LngLat(mapData.sendLng, mapData.sendLat),
       //   new AMap.LngLat(mapData.shipperLng, mapData.shipperLat),
       // ];
+    },
+    setDialogStatus(data) {
       this.dialogTableVisible = true;
+      this.loading = true;
+      getMapData({ orderId: data.id }).then((res) => {
+        if (res.code === 200) {
+          console.log(11111, res.data);
+          this.loading = false;
+          this.init(data, res.data);
+        } else {
+          this.$message({
+            type: "error",
+            message: res.msg,
+          });
+        }
+      });
     },
     chooseLocation() {
       this.dialogTableVisible = true;
@@ -153,6 +211,25 @@ export default {
 </script>
 
 <style lang="scss" scoped>
+/deep/ .amap-overlay-text-container {
+  font-size: 12px;
+  background: #fc7200;
+  color: #fff;
+  padding: 4px 8px;
+  border: none;
+}
+/deep/ .amap-overlay-text-container:before{
+    content: '';
+    width: 0;
+    height: 0;
+    border-left: 10px solid transparent;
+    border-right: 10px solid transparent;
+    border-top: 10px solid #fc7200;
+    position: absolute;
+    bottom: -10px;
+    left: 50%;
+    transform: translateX(-50%);
+  }
 .map-btn {
   background: #fc7200;
   border: none;

+ 16 - 3
src/components/orderComponents/orderDetail.vue

@@ -2,7 +2,7 @@
   <div>
     <!-- 新订单 -->
     <div class="detail_cont">
-      <template v-if="orderDetail.detailItems">
+      <template v-if="orderDetail.waimaiOrderId && orderDetail.detailItems">
         <div class="detail_title2">商品详情</div>
         <div class="shop_detail" v-for="(item,i) in orderDetail.detailItems" :key="i">
           <div class="info">
@@ -13,7 +13,18 @@
         </div>
         <div class="detail_ine"></div>
       </template>
-
+      <template v-if="!orderDetail.waimaiOrderId">
+        <div class="detail_title2">商品详情</div>
+        <div class="info2 info4">
+          <div class="title">物品类型:</div>
+          <div class="cont">{{orderDetail.productName}}</div>
+        </div>
+        <div class="info2 info4">
+          <div class="title">物品重量:</div>
+          <div class="cont">{{orderDetail.weight}}KG</div>
+        </div>
+        <div class="detail_ine"></div>
+      </template>
       <template v-if="orderDetail.caution || orderDetail.takeRemark">
         <div class="info2" v-if="orderDetail.caution">
           <div class="title">用户备注:</div>
@@ -132,7 +143,9 @@ export default {
 <style lang="scss" scoped="scoped">
 .detail_cont {
   width: 100%;
-  padding: 16px;
+  height: calc(100vh - 250px);
+  overflow: auto;
+  padding: 16px 16px 50px;
   box-sizing: border-box;
   .detail_title2 {
     width: 100%;

+ 31 - 28
src/components/orderComponents/orderList.vue

@@ -71,7 +71,6 @@
     <el-row class="list-info">
       <el-col :span="17">
         <div v-loading="isLoading" element-loading-text="正在计算中...">
-          
           <div :class="
               curIdx === i ? 'order_item active-order-item' : 'order_item'
             " @click="chooseOrder(item, i)" v-for="(item, i) in list" :key="i">
@@ -169,10 +168,11 @@
                 {{ item.receiptAddress }}
                 <span class="distance" v-if="item.orderDistance" @click.stop="checkMap(item)">
                   <i class="el-icon-location"></i>
-                  <span v-if="item.orderDistance < 1000">
+                  <span>查看地图</span>
+                  <!-- <span v-if="item.orderDistance < 1000">
                     {{ item.orderDistance }}m
                   </span>
-                  <span v-else> {{ item.orderDistance / 1000 }}km </span>
+                  <span v-else> {{ item.orderDistance / 1000 }}km </span> -->
                 </span>
               </div>
               <div v-if="item.caution" class="itme_r">
@@ -373,16 +373,21 @@ export default {
     tabNum(newVal, oldVal) {
       this.curIdx = 0;
     },
-    list(newVal, oldVal) {
-      this.buttonStatus = newVal.length ? newVal[0].buttonStatus : 0;
-      this.hasLocation = newVal.length ? !!newVal[0].orderDistance : false;
-      if (this.buttonStatus === 0 || this.buttonStatus === 10) {
-        this.needTrack = false;
-      } else {
-        this.needTrack = true;
-      }
-      this.getDetailOrder();
-      this.getTrackOrder();
+    list: {
+      handler(newVal, oldVal) {
+        this.buttonStatus = newVal.length ? newVal[0].buttonStatus : 0;
+        this.hasLocation = newVal.length ? !!newVal[0].orderDistance : false;
+        if (this.buttonStatus === 0 || this.buttonStatus === 10) {
+          this.needTrack = false;
+          this.orderDetailStutus = 1;
+        } else {
+          this.needTrack = true;
+          this.orderDetailStutus = 0;
+        }
+        this.getDetailOrder();
+        this.getTrackOrder();
+      },
+      immediate: true,
     },
   },
   destroyed() {},
@@ -561,8 +566,10 @@ export default {
       this.hasLocation = !!this.list[index].orderDistance;
       if (this.buttonStatus === 0 || this.buttonStatus === 10) {
         this.needTrack = false;
+        this.orderDetailStutus = 1;
       } else {
         this.needTrack = true;
+        this.orderDetailStutus = 0;
       }
       this.curIdx = index;
       this.getDetailOrder();
@@ -647,17 +654,7 @@ export default {
     },
     // 查看地图
     checkMap(item) {
-      getMapData({ orderId: item.id }).then((res) => {
-        if (res.code === 200) {
-          console.log(res.data);
-          this.$refs.orderMap.setDialogStatus(item, res.data);
-        } else {
-          this.$message({
-            type: "error",
-            message: res.msg,
-          });
-        }
-      });
+      this.$refs.orderMap.setDialogStatus(item);
     },
     deleteItem(item) {
       this.getValuation(item);
@@ -817,7 +814,6 @@ export default {
         case 5:
           name = "平台取消";
           break;
-
         default:
           name = "已取消";
           break;
@@ -842,7 +838,6 @@ export default {
   },
 };
 </script>
-
 <!-- Add "scoped" attribute to limit CSS to this component only -->
 <style lang="scss" scoped="scoped">
 .el-row {
@@ -858,7 +853,15 @@ export default {
   /deep/ .el-col {
     // margin-right: 15px;
     height: 100%;
-    // z-index: 2;
+    z-index: 2;
+  }
+  .order-detail {
+    height: calc(100vh - 250px);
+    overflow: auto;
+  }
+  .detail_cont {
+    height: calc(100vh - 250px);
+    overflow: auto;
   }
 }
 .list-info {
@@ -1154,7 +1157,7 @@ export default {
   .address {
     .distance {
       margin-left: 10px;
-      color: blue;
+      color: #409eff;
       cursor: pointer;
       font-size: 16px;
     }

+ 4 - 4
src/components/orderComponents/orderTrack.vue

@@ -82,12 +82,9 @@
             <el-timeline-item class="p-item" v-for="(v, i) in trackOrder.itemList" :key="i" type="info" size="large" :icon="i ? 'el-icon-success' : 'el-icon-circle-check'">
               <div class="p-right">
                 <div class="p-top">
-                  <span class="p-status">{{ orderStatus(v.orderStatus) }}</span>
+                  <span class="p-status">{{ [-1,-2].includes(v.orderStatus) ? showCancelType(trackOrder.cancelType) : orderStatus(v.orderStatus) }}</span>
                   <span class="p-time">{{ v.nodeTime }}</span>
                 </div>
-                <div class="p-bottom" v-if="v.orderStatus === -1 || v.orderStatus===-2">
-                  <span class="send">{{showCancelType(trackOrder.cancelType)}}</span>
-                </div>
                 <div class="p-bottom" v-if="v.orderStatus === 1">
                   <span>20分钟内无骑手接单将自动取消订单</span>
                 </div>
@@ -196,6 +193,9 @@ export default {
 /deep/ .el-timeline {
   padding: 0 0 0 5px !important;
 }
+/deep/ .el-timeline-item__wrapper {
+  width: 100%;
+}
 .clearfix:after {
   content: "";
   font-size: 0;

+ 5 - 6
src/components/orderSearch.vue

@@ -103,6 +103,10 @@ export default {
           status: 99,
         },
         {
+          name: "待发单",
+          status: 95,
+        },
+        {
           name: "进行中",
           status: 96,
         },
@@ -142,12 +146,7 @@ export default {
     this.getShopList();
     this.getOrder();
   },
-  mounted(){
-    this.$nextTick(()=>{
-      let bady = document.getElementById("scroll")
-      console.log(1111,bady);
-    })
-  },
+  mounted() {},
   destroyed() {
     bus.$off("refreshData2");
   },

+ 1 - 1
src/components/settingComponents/voiceSetting.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="voice">
-    <template v-if="memberType === 1">
+    <template v-if="memberType !== 1">
       <div class="top-set">
         <div class="t-left">
           自动接单

+ 1 - 1
src/views/home.vue

@@ -88,7 +88,7 @@ export default {
   right: 0;
   top: 80px;
   bottom: 0;
-  overflow-y: hidden;
+  // overflow-y: hidden;
   background-color: #f1f2f5;
   padding: 10px;
   min-width: 550px;

BIN
static/image/map-rider.png