Jelajahi Sumber

bugfix 代码优化修改

Funny 3 tahun lalu
induk
melakukan
40424b9400

+ 6 - 5
src/App.vue

@@ -18,11 +18,12 @@ export default {
       url: "../static/audio/test.mp3",
       audioList: [
         require("../static/audio/new-order.mp3"),
-        require("../static/audio/新提示音+语音 1-1.mp3"),
-        require("../static/audio/新提示音+语音 1-2.mp3"),
-        require("../static/audio/新提示音+语音 1-3.mp3"),
-        require("../static/audio/新提示音+语音 1-4.mp3"),
-        require("../static/audio/新提示音+语音 1-5.mp3"),
+        require("../static/audio/lower-than.mp3"),
+        require("../static/audio/missed-orders.mp3"),
+        require("../static/audio/not-enough.mp3"),
+        require("../static/audio/order-received.mp3"),
+        require("../static/audio/rider-cancel.mp3"),
+        require("../static/audio/user-go-cancel.mp3"),
       ],
       src: require("../static/audio/alone.mp3"),
       timer: null,

+ 47 - 0
src/api/tool.js

@@ -1,4 +1,51 @@
 export default {
+  /**
+* 日期时间格式转换
+* @param {String || Number} dateStr  "1995-12-17T03:24:00" || 1605592704154
+* @param {String} format  "yyyy-MM-dd hh:mm:ss"
+* @returns "2020-05-29 12:32:12"
+*/
+  getFormatDate(dateStr = null, format = "yyyy-MM-dd hh:mm:ss") {
+    const date = new Date(
+      typeof dateStr === "number" ? dateStr : Number(dateStr)
+    );
+    const o = {
+      "M+": date.getMonth() + 1, //month
+      "d+": date.getDate(), //day
+      "h+": date.getHours(), //hour
+      "m+": date.getMinutes(), //minute
+      "s+": date.getSeconds(), //second
+      "q+": Math.floor((date.getMonth() + 3) / 3), //quarter(季度)
+      S: date.getMilliseconds() //millisecond
+    };
+
+    if (/(y+)/.test(format)) {
+      const m = RegExp.$1; // yyyy
+      format = format.replace( //匹配年份
+        m,
+        (date.getFullYear() + "").substr(4 - m.length) //从末尾截取
+        /* 1. substr(start, num) 从start 开始截取num 位
+         * 2. substring(start, end) 从start 开始截取到end  start 取得到,end 取不到
+         */
+      );
+    }
+    for (let k in o) {
+      if (new RegExp(`(${k})`).test(format)) {
+        // console.log(RegExp.$1); MM dd hh mm ss
+        format = format.replace( //匹配月、日、时分秒
+          RegExp.$1,
+          RegExp.$1.length == 1
+            ? o[k]
+            : ("00" + o[k]).substr(("" + o[k]).length)
+              // 拼接 '00' 的目的是如果当前月份、天数、小时...是小于10的话, 拼接成 '01'的形式
+              // ('' + o[k]).padStart(2, '0') 也可实现
+        );
+      }
+    }
+
+    return format;
+  },
+
   // 将Thu Sep 20 2018 16:23:03 GMT+0800 (中国标准时间)转换为"2018-09-20 16:23:03"
   formatDateTime(inputTime) {
     var date = new Date(inputTime);

+ 7 - 2
src/components/accountCompoents/coupon.vue

@@ -13,7 +13,7 @@
           </div>
           <div class="man-jian" v-if="v.type === 2">最高可减{{v.maxDiscount}}元</div>
           <div class="man-jian" v-if="v.type === 1">{{v.name}}</div>
-          <div class="time">{{v.validStartTime.slice(0,10)}}--{{v.validEndTime}}</div>
+          <div class="time">{{v.validStartTime}} - {{v.validEndTime}}</div>
         </div>
         <div class="bottom">
           <div class="lei-xing">
@@ -34,6 +34,7 @@
 
 <script>
 import { getCouponList, getCouponExplain } from "../../api/amount.js";
+import tool from '../../api/tool.js'
 export default {
   data() {
     return {
@@ -63,7 +64,11 @@ export default {
     getCouponList() {
       getCouponList({ status: 0, isNew: 1 }).then((res) => {
         if (res.code === 200) {
-          this.couponList = res.data.data;
+          this.couponList = res.data.data.map(v=>{
+            v.validStartTime = tool.getFormatDate(new Date(v.validStartTime),'yyyy.MM.dd')
+            v.validEndTime = tool.getFormatDate(new Date(v.validEndTime),'yyyy.MM.dd')
+            return v
+          });
           this.total = res.data.totalNums || 0;
         } else {
           this.$message({

+ 32 - 53
src/components/orderComponents/orderList.vue

@@ -165,26 +165,6 @@
         <el-button type="primary" class="submit-btn" @click.stop="commitRemark(orderId, item)">确定</el-button>
       </div>
     </el-dialog>
-    <!-- 忽略订单弹出层 -->
-    <el-dialog width="580px" center title="忽略订单" destroy-on-close :visible.sync="ignoreStatus">
-      <div class="ignore-modal">
-        <div class="title">请选择忽略该笔订单的原因</div>
-        <div class="check-item">
-          <img src="../../../static/image/check-radio.png" @click.stop="changeRadio(1)" v-if="radio != 1" class="radio" />
-          <img src="../../../static/image/check-radio-active.png" v-if="radio == 1" class="radio" />
-          <span>通过其他配送方式完成</span>
-        </div>
-        <div class="check-item">
-          <img src="../../../static/image/check-radio.png" @click.stop="changeRadio(2)" v-if="radio != 2" class="radio" />
-          <img src="../../../static/image/check-radio-active.png" v-if="radio == 2" class="radio" />
-          <span>取消该笔订单(由于用户取消或其他原因)</span>
-        </div>
-      </div>
-      <div style="text-align: center;margin-top: 20px;">
-        <el-button @click.stop="ignoreStatus = false">取消</el-button>
-        <el-button type="primary" class="submit-btn" @click.stop="commitIGnore(orderId)">确定</el-button>
-      </div>
-    </el-dialog>
     <!-- 设置预约发单时间弹出层 -->
     <el-dialog width="580px" center title="设置预约时间" destroy-on-close :visible.sync="settingTimeStatus">
       <div>
@@ -319,7 +299,6 @@ export default {
       orderDetailStutus: 0,
       isLoading: false,
       dialogTableVisible: false,
-      ignoreStatus: false, // 忽略订单弹出层
       remark: "",
       orderId: "",
       item: {},
@@ -539,40 +518,38 @@ export default {
       this.getDetailOrder();
       this.getTrackOrder();
     },
-    changeRadio(i) {
-      this.radio = i;
-    },
     // 忽略订单
     iGnoreOrder(orderId) {
       this.orderId = orderId;
-      this.ignoreStatus = true;
-    },
-    commitIGnore(orderId) {
-      if (!this.radio) {
-        return this.$message({
-          message: "请选择忽略原因",
-          type: "error",
-        });
-      }
-      let params = {
-        orderId,
-        ignoreReason: this.radio == 1 ? 0 : 1,
-      };
-      ignoreOrder(params).then((res) => {
-        this.ignoreStatus = false;
-        if (res.code == 200) {
-          this.$message({
-            message: "操作成功",
-            type: "success",
+      this.$confirm("确定要忽略此单?", "提示", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        center: true,
+        type: "warning",
+      })
+        .then(() => {
+          console.log(11111);
+          ignoreOrder({ orderId }).then((res) => {
+            if (res.code == 200) {
+              this.$message({
+                type: "success",
+                message: "已忽略!",
+              });
+              bus.$emit("refreshData");
+            } else {
+              this.$message({
+                message: res.msg,
+                type: "error",
+              });
+            }
           });
-          bus.$emit("refreshData");
-        } else {
+        })
+        .catch(() => {
           this.$message({
-            message: res.msg,
-            type: "error",
+            type: "info",
+            message: "已取消",
           });
-        }
-      });
+        });
     },
     itemAddRemark(orderId, item) {
       this.dialogTableVisible = true;
@@ -789,15 +766,17 @@ export default {
     showDeliveryStatus(item) {
       let name = "";
       if (item.wmstatus === 4) {
-        name = "其他平台完成";
+        return (name = "其他平台完成");
       }
       if (item.deliveryStatus === 4) {
-        name = "已完成";
+        return (name = "已完成");
       }
       if (item.deliveryStatus === -1) {
-        name = "已取消";
+        return (name = "已取消");
       }
-      return name;
+      // if (item.deliveryStatus === -2) {
+      //   return this.showCancelType(item.cancelType);
+      // }
     },
   },
 };

+ 4 - 0
src/components/orderSearch.vue

@@ -104,6 +104,10 @@ export default {
           status: 99,
         },
         {
+          name: "进行中",
+          status: 96,
+        },
+        {
           name: "已完成",
           status: 97,
         },

+ 1 - 1
src/components/shopCompoents/bindPrinter.vue

@@ -1,7 +1,7 @@
 <template>
   <div class="bind-printer" v-loading="loading" element-loading-text="数据加载中">
     <div class="store-list">
-      <div class="store-list-item" :class=" index == 0 ? 'active' : '' " v-for="(item, index) in shopList" :key="index">{{ item.name }}</div>
+      <div class="store-list-item" @click="curIdx = index" :class=" index == curIdx ? 'active' : '' " v-for="(item, index) in shopList" :key="index">{{ item.name }}</div>
     </div>
     <div class="header">
       <div class="left">

static/audio/新提示音+语音 3-3.mp3 → static/audio/lower-than.mp3


static/audio/新提示音+语音 1-3.mp3 → static/audio/missed-orders.mp3


TEMPAT SAMPAH
static/audio/new-order.mp3


static/audio/新提示音+语音 3-2.mp3 → static/audio/not-enough.mp3


static/audio/新提示音+语音 1-2.mp3 → static/audio/order-received.mp3


static/audio/新提示音+语音 2-1.mp3 → static/audio/rider-cancel.mp3


static/audio/新提示音+语音 2-2.mp3 → static/audio/user-go-cancel.mp3


TEMPAT SAMPAH
static/audio/新提示音+语音 1-1.mp3