Bläddra i källkod

Merge branch 'release/2.0.3'

Funny 2 år sedan
förälder
incheckning
0c42390fbf

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "liebao-web",
-  "version": "2.0.2",
+  "version": "2.0.3",
   "private": true,
   "author": "优巨引擎",
   "description": "有运力的地方,就有猎豹AI。",

+ 131 - 0
public/order-print-module/module0.html

@@ -0,0 +1,131 @@
+<html lang="zh-CN">
+
+<head>
+  <meta charset="UTF-8">
+  <title>平台店铺名称</title>
+  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
+  <meta name="apple-mobile-web-app-capable" content="no">
+  <meta name="format-detection" content="telephone=no">
+  <meta http-equiv="X-UA-Compatible" content="”IE=edge,chrome=1″/">
+  <style type="text/css">
+    .table {
+      width: 700px;
+      display: block;
+      margin: 0 auto;
+    }
+
+    .table table td,
+    .table table th {
+      padding: 15px;
+      font-size: 16px;
+    }
+
+    .table table {
+      position: relative;
+      border-collapse: collapse;
+      width: 100%;
+    }
+
+    .table .title {
+      position: relative;
+      display: flex;
+      justify-content: center;
+      font-size: 25px;
+      font-weight: bold;
+      padding: 10px 0;
+    }
+
+    .order-num {
+      position: absolute;
+      top: 10px;
+      right: 10px;
+    }
+
+    .content {
+      font-weight: bold;
+    }
+
+    .product-info {
+      display: flex;
+      padding: 15px 0;
+    }
+
+    .product-img {
+      width: 220px;
+      height: 220px;
+      margin-right: 15px;
+    }
+
+    .other-info p {
+      line-height: 30px;
+    }
+
+    .contact {
+      text-align: center;
+    }
+  </style>
+</head>
+
+<body id="body-box">
+  <div class="table">
+    <table border="1" cellspacing="0">
+      <tbody>
+        <tr>
+          <td colspan="4">
+            <div class="title">
+              <div>平台店铺名称(配送单)</div>
+              <div class="order-num">订单号:M1</div>
+            </div>
+          </td>
+        </tr>
+        <tr>
+          <td>收货人</td>
+          <td>李女士</td>
+          <td>联系电话</td>
+          <td>13867810912</td>
+        </tr>
+        <tr>
+          <td>配送时间</td>
+          <td colspan="3" class="content">
+            <span>立即发单</span>
+            2021年08月08日 08时08分
+          </td>
+        </tr>
+        <tr class="tr-goods">
+          <td style="line-height: 1.5">商品信息</td>
+          <td colspan="3">
+            <div class="product-info">
+              <img class="product-img"
+                src="https://ecloud-cdn.51sssd.com/20230309/9cd72cf69ade42b398aededd219c53a0.jpg">
+              <div class="other-info">
+                <p class="product-name content">这里是商品标题</p>
+                <p class="product-tips">这里是商品的描述信息</p>
+              </div>
+            </div>
+          </td>
+        </tr>
+        <tr class="tr-address">
+          <td width="18%">配送地址</td>
+          <td class="content" colspan="3">
+            这里是顾客收货地址
+          </td>
+        </tr>
+        <tr>
+          <td>备注信息</td>
+          <td class="content" colspan="3">
+            顾客备注显示在这里
+          </td>
+        </tr>
+        <tr>
+          <td>贺卡祝福语</td>
+          <td class="content" colspan="3">这里是贺卡内容</td>
+        </tr>
+        <tr>
+          <td class="content contact" colspan="4">如在制作,配送环节出现问题或疑问,欢迎随时致电: 18601227599</td>
+        </tr>
+      </tbody>
+    </table>
+  </div>
+</body>
+
+</html>

+ 155 - 0
public/order-print-module/module1.html

@@ -0,0 +1,155 @@
+<html lang="zh-CN">
+
+<head>
+  <meta charset="UTF-8">
+  <title>平台店铺名称</title>
+  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
+  <meta name="apple-mobile-web-app-capable" content="no">
+  <meta name="format-detection" content="telephone=no">
+  <meta http-equiv="X-UA-Compatible" content="”IE=edge,chrome=1″/">
+  <style type="text/css">
+    .table {
+      width: 700px;
+      display: block;
+      margin: 0 auto;
+    }
+
+    .table table td,
+    .table table th {
+      padding: 15px;
+      font-size: 16px;
+    }
+
+    .table table {
+      position: relative;
+      border-collapse: collapse;
+      width: 100%;
+    }
+
+    .table .title {
+      position: relative;
+      display: flex;
+      justify-content: center;
+      font-size: 25px;
+      font-weight: bold;
+      padding: 10px 0;
+    }
+
+    .order-num {
+      position: absolute;
+      top: 10px;
+      right: 10px;
+    }
+
+    .content {
+      font-weight: bold;
+    }
+
+    .product-info {
+      display: flex;
+      padding: 15px 0;
+    }
+
+    .product-img {
+      width: 220px;
+      height: 220px;
+      margin-right: 15px;
+    }
+
+    .other-info p {
+      line-height: 30px;
+    }
+
+    .cut-line {
+      border-top: 1px dashed #333;
+      margin: 20px 0;
+    }
+
+    .contact {
+      text-align: center;
+    }
+  </style>
+</head>
+
+<body id="body-box">
+  <div class="table">
+    <table border="1" cellspacing="0">
+      <tbody>
+        <tr>
+          <td colspan="4">
+            <div class="title">
+              <div>平台店铺名称(预订单)</div>
+              <div class="order-num">订单号:M1</div>
+            </div>
+          </td>
+        </tr>
+        <tr>
+          <td>收货人</td>
+          <td>李女士</td>
+          <td>联系电话</td>
+          <td>13867810912</td>
+        </tr>
+        <tr>
+          <td style="line-height: 1.5">商品信息</td>
+          <td colspan="3">
+            <div class="product-info">
+              <img class="product-img"
+                src="https://ecloud-cdn.51sssd.com/20230309/9cd72cf69ade42b398aededd219c53a0.jpg">
+              <div class="other-info">
+                <p class="product-name content">这里是商品标题</p>
+                <p class="product-tips">这里是商品的描述信息</p>
+              </div>
+            </div>
+          </td>
+        </tr>
+        <tr>
+          <td>备注信息</td>
+          <td class="content" colspan="3">
+            顾客备注显示在这里
+          </td>
+        </tr>
+        <tr>
+          <td>贺卡祝福语</td>
+          <td class="content" colspan="3">这里是贺卡内容</td>
+        </tr>
+        <tr>
+          <td class="content contact" colspan="4">如在制作,配送环节出现问题或疑问,欢迎随时致电: 18601227599</td>
+        </tr>
+      </tbody>
+    </table>
+    <div class="cut-line"></div>
+    <table border="1" cellspacing="0">
+      <tbody>
+        <tr>
+          <td colspan="4">
+            <div class="title">
+              <div>平台店铺名称(配送单)</div>
+              <div class="order-num">订单号:M1</div>
+            </div>
+          </td>
+        </tr>
+        <tr>
+          <td>收货人</td>
+          <td>李女士</td>
+          <td>联系电话</td>
+          <td>13867810912</td>
+        </tr>
+        <tr>
+          <td style="line-height: 1.5">顾客信息</td>
+          <td class="content" colspan="3">
+            <div>立即发单 2021年08月08日 08时08分</div>
+            <div>这里是顾客收货地址</div>
+          </td>
+        </tr>
+        <tr>
+          <td>店铺电话</td>
+          <td class="content" colspan="3">
+            13893120909 店铺名称(有任何问题一定要与掌柜联系哦!)
+          </td>
+        </tr>
+      </tbody>
+    </table>
+  </div>
+</body>
+
+</html>

+ 196 - 0
public/order-print-module/module2.html

@@ -0,0 +1,196 @@
+<html lang="zh-CN">
+
+<head>
+  <meta charset="UTF-8">
+  <title>平台店铺名称</title>
+  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
+  <meta name="apple-mobile-web-app-capable" content="no">
+  <meta name="format-detection" content="telephone=no">
+  <meta http-equiv="X-UA-Compatible" content="”IE=edge,chrome=1″/">
+  <style type="text/css">
+    .table {
+      width: 700px;
+      display: block;
+      margin: 0 auto;
+    }
+
+    .table table td,
+    .table table th {
+      padding: 15px;
+      font-size: 16px;
+    }
+
+    .table table {
+      position: relative;
+      border-collapse: collapse;
+      width: 100%;
+    }
+
+    .table .title {
+      position: relative;
+      display: flex;
+      justify-content: center;
+      font-size: 25px;
+      font-weight: bold;
+      padding: 10px 0;
+    }
+
+    .order-num {
+      position: absolute;
+      top: 10px;
+      right: 10px;
+    }
+
+    .content {
+      font-weight: bold;
+    }
+
+    .product-info {
+      display: flex;
+      padding: 15px 0;
+    }
+
+    .product-img {
+      width: 220px;
+      height: 220px;
+      margin-right: 15px;
+    }
+
+    .other-info p {
+      line-height: 30px;
+    }
+
+    .cut-line {
+      border-top: 1px dashed #333;
+      margin: 20px 0;
+    }
+
+    .appraise {
+      display: flex;
+      justify-content: space-around;
+    }
+
+    .appraise div {
+      display: flex;
+      align-items: center;
+    }
+
+    .appraise p {
+      width: 15px;
+      height: 15px;
+      border: 1px solid #333;
+      margin-left: 5px;
+    }
+
+    .contact {
+      text-align: center;
+      line-height: 35px !important;
+    }
+
+    .contact1 {
+      text-align: center;
+    }
+  </style>
+</head>
+
+<body id="body-box">
+  <div class="table">
+    <table border="1" cellspacing="0">
+      <tbody>
+        <tr>
+          <td colspan="4">
+            <div class="title">
+              <div>平台店铺名称(配送单)</div>
+              <div class="order-num">订单号:M1</div>
+            </div>
+          </td>
+        </tr>
+        <tr>
+          <td>收货人</td>
+          <td>李女士</td>
+          <td>联系电话</td>
+          <td>13867810912</td>
+        </tr>
+        <tr class="tr-goods">
+          <td style="line-height: 1.5">商品信息</td>
+          <td colspan="3">
+            <div class="product-info">
+              <img class="product-img"
+                src="https://ecloud-cdn.51sssd.com/20230309/9cd72cf69ade42b398aededd219c53a0.jpg">
+              <div class="other-info">
+                <p class="product-name content">这里是商品标题</p>
+                <p class="product-tips">这里是商品的描述信息</p>
+              </div>
+            </div>
+          </td>
+        </tr>
+        <tr class="tr-address">
+          <td width="18%">配送信息</td>
+          <td class="content" colspan="3">
+            <div>
+              立即发单 2021年08月08日 08时08分
+            </div>
+            <div>这里是顾客收货地址</div>
+          </td>
+        </tr>
+        <tr>
+          <td>备注信息</td>
+          <td class="content" colspan="3">
+            顾客备注显示在这里
+          </td>
+        </tr>
+        <tr>
+          <td>贺卡祝福语</td>
+          <td class="content" colspan="3">这里是贺卡内容</td>
+        </tr>
+        <tr>
+          <td class="content contact1" colspan="4">如在制作,配送环节出现问题或疑问,欢迎随时致电: 18601227599</td>
+        </tr>
+      </tbody>
+    </table>
+    <div class="cut-line"></div>
+    <table border="1" cellspacing="0">
+      <tbody>
+        <tr>
+          <td colspan="4">
+            <div class="title">
+              <div>平台店铺名称(签收单)</div>
+              <div class="order-num">订单号:M1</div>
+            </div>
+          </td>
+        </tr>
+        <tr>
+          <td>收货人</td>
+          <td>李女士</td>
+          <td>联系电话</td>
+          <td>13867810912</td>
+        </tr>
+        <tr>
+          <td>收货人评价</td>
+          <td colspan="3" class="content">
+            <div class="appraise">
+              <div>满意<p></p>
+              </div>
+              <div>一般<p></p>
+              </div>
+              <div>不满意<p></p>
+              </div>
+            </div>
+          </td>
+        </tr>
+        <tr>
+          <td>收货人签字</td>
+          <td class="content" colspan="3"></td>
+        </tr>
+        <tr>
+          <td class="content contact" colspan="4">
+            祝您每天都有好心情~<br>
+            有任何问题请于本店联系,联系电话:18393130909
+          </td>
+        </tr>
+      </tbody>
+    </table>
+  </div>
+</body>
+
+</html>

+ 8 - 10
src/components/Home.vue

@@ -291,19 +291,17 @@ export default {
           this.orderList = [];
           this.total = res.data.totalNums || 0;
           this.params.pageNum = res.data.pageNum;
-          res.data.data.forEach((element) => {
-            element.takeTimeTxt = this.$tool.timeago(
-              new Date(element.sendTime).getTime()
-            );
-            if (element.exceptTime && element.delayTime) {
-              element.timeTxt = _this.$tool.eosFormatTime2(
-                element.exceptTime,
-                element.delayTime
+          res.data.data.forEach((e) => {
+            e.takeTimeTxt = this.$tool.timeago(new Date(e.sendTime).getTime());
+            if (e.exceptTime && e.delayMinutes&&e.autoDelivery) {
+              e.timeTxt = _this.$tool.getFormatDate(
+                new Date(e.exceptTime).getTime() - e.delayMinutes * 60 * 1000,
+                "MM-dd hh:mm"
               );
             } else {
-              element.timeTxt = "";
+              e.timeTxt = "";
             }
-            this.orderList.push(element);
+            this.orderList.push(e);
           });
         } else {
           this.$message({

+ 66 - 62
src/components/orderComponents/orderList.vue

@@ -35,9 +35,7 @@
                 </el-dropdown>
               </div>
               <el-button v-else size="small" @click.native="itemAddRemark(list[curIdx].id, list[curIdx])" class="btn_bots">添加备注</el-button>
-              <el-button v-if="list[curIdx].waimaiOrderId" size="small" @click.native="settingTime(list[curIdx])" class="btn_bots btn">{{
-                  list[curIdx].delayTime ? "修改定时" : "预约发单"
-                }}</el-button>
+              <el-button v-if="list[curIdx].waimaiOrderId" size="small" @click.native="settingTime(list[curIdx])" class="btn_bots btn">预约发单</el-button>
               <el-button v-else size="small" @click.native="cancelOrder(list[curIdx].id)" class="btn_bots">取消订单</el-button>
               <el-button size="small" @click.native="iGnoreOrder(list[curIdx].id)" class="btn_bots btn">忽略订单</el-button>
               <el-button size="small" @click.native="sendNow(list[curIdx])" class="btn_bots btn">发起配送</el-button>
@@ -56,7 +54,6 @@
             <!-- 配送中 -->
             <div class="btns" v-if="buttonStatus === 3">
               <el-button size="small" @click.native="orderPrinter(list[curIdx].waimaiOrderId)" v-if="list[curIdx].waimaiOrderId" class="btn_bots btn">补打小票</el-button>
-              <!-- <el-button size='small' @click.native="againOrder(list[curIdx])" class="btn_bots btn">再来一单</el-button> -->
             </div>
             <!-- 异常单 -->
             <div class="btns" v-if="buttonStatus === -2">
@@ -96,17 +93,9 @@
                 <div class="sign_txt">
                   {{ exceptTimeFn(item) }}
                 </div>
-                <!-- <div class="sign_time" v-if="item.waimaiOrderId && [1,2].includes(item.takeType)">
-                  {{ item.exceptTime.slice(5,16) }}前送达
-                </div>
-                <div class="sign_txt" v-if="item.buttonStatus === 0 && item.waimaiOrderId && item.takeType == 0">
-                  立即送达,{{item.orderTime.slice(-8,-3)}}下单
-                </div> -->
                 <div class="sign_d" v-if="item.buttonStatus === 10 && item.timeTxt">{{item.timeTxt}}自动发起配送</div>
 
                 <div v-if="item.buttonStatus === 10 && !item.waimaiOrderId" class="sign_d">{{item.deliveryTime.slice(5)}}自动发起配送</div>
-                <!-- 近三日订单 -->
-                <!-- <div class="sign_f" v-if="[-1,7].includes(tabNum) &&item.finishTime">{{item.finishTime && item.finishTime.slice(5)}}已完成</div> -->
               </div>
               <!-- 新订单 -->
               <div class="order_item_header_r" v-if="item.buttonStatus === 0">
@@ -116,33 +105,23 @@
               <!-- 预约单 -->
               <div class="order_item_header_r" v-if="item.buttonStatus === 10">
                 <el-tag v-if="[-1,7].includes(tabNum)" class="header_r">预约单</el-tag>
-                <!-- <el-button size='small' @click.stop="iGnoreOrder(item.id)">忽略订单</el-button> -->
-                <!-- <el-button size='small' @click.stop="itemAddRemark(item.id, item)">添加备注</el-button> -->
-                <el-button v-if="item.waimaiOrderId" size="small" class="btn" @click.stop="settingTime(item)">{{
-                  item.delayTime ? "修改定时" : "预约发单"
-                }}</el-button>
-
+                <el-button v-if="item.waimaiOrderId" size="small" class="btn" @click.stop="settingTime(item)">预约发单</el-button>
                 <el-button v-else size="small" class="btn" @click.stop="sendNow(item)">立即配送</el-button>
               </div>
               <!-- 待接单 -->
               <div class="order_item_header_r" v-if="item.buttonStatus === 1">
                 <el-tag v-if="[-1,7].includes(tabNum)" class="header_r">待接单</el-tag>
                 <span class="header_r">已发单{{ item.takeTimeTxt }}</span>
-                <!-- <el-button size='small' @click.stop="cancelOrder(item.id)">取消订单</el-button> -->
                 <el-button size="small" class="btn" @click.stop="orderPrinter(item.waimaiOrderId,item.id)" v-if="item.waimaiOrderId">补打小票</el-button>
-                <!-- <el-button size='small' class="btn" @click.stop="addTip(item.id)">加&nbsp;小&nbsp;费</el-button> -->
               </div>
               <!-- 取货中 -->
               <div class="order_item_header_r" v-if="item.buttonStatus === 2">
                 <el-tag v-if="[-1,7].includes(tabNum)" class="header_r">取货中</el-tag>
-                <!-- <span v-show="Number(item.riderArriveMinute)" class="header_r">预计{{Number(item.riderArriveMinute)}}分钟取件</span> -->
-                <!-- <el-button size='small' @click.stop="cancelOrder(item.id)">取消订单</el-button> -->
                 <el-button size="small" class="btn" @click.stop="orderPrinter(item.waimaiOrderId,item.id)" v-if="item.waimaiOrderId">补打小票</el-button>
               </div>
               <!-- 配送中 -->
               <div class="order_item_header_r" v-if="item.buttonStatus === 3">
                 <el-tag v-if="[-1,7].includes(tabNum)" class="header_r">配送中</el-tag>
-                <!-- <span class="header_r" v-if="item.exceptTime">预计{{ item.exceptTime }}送达,{{item.surPlusMinute >= 0 ? '剩余'+item.surPlusMinute + '分钟' : '超时' +item.surPlusMinute +"分钟" }}</span> -->
                 <el-button size="small" class="btn" @click.stop="orderPrinter(item.waimaiOrderId,item.id)" v-if="item.waimaiOrderId">补打小票</el-button>
               </div>
               <!-- 异常单 -->
@@ -157,7 +136,6 @@
                 <el-tag class="header_r">{{
                   showCancelType(item.cancelType)
                 }}</el-tag>
-                <!-- <el-button v-if="item.cancelType===4&&item.waimaiOrderId" size='small' class="btn" @click.stop="orderPrinter(item.waimaiOrderId,item.id)">补打小票</el-button> -->
                 <el-button size="small" class="btn" @click.stop="againSend(item)">再次配送</el-button>
               </div>
               <!-- 猎豹平台已完成 -->
@@ -206,20 +184,19 @@
       </div>
     </el-dialog>
     <!-- 设置预约发单时间弹出层 -->
-    <el-dialog width="580px" center :title="exceptTime" destroy-on-close :visible.sync="settingTimeStatus">
-      <div>
-        <span>提前多长时间发起配送:</span>
-        <el-select size="small" style="width: 80px" v-model="timeValue" placeholder="请选择">
-          <el-option v-for="(item, index) in timeList" :key="index" :label="item" :value="item"></el-option>
-        </el-select>
-        <span>小时</span>
+    <el-dialog width="580px" center :title="`预约期望${exceptTime.slice(5)}送达`" destroy-on-close :visible.sync="settingTimeStatus">
+      <div class="expect-time">
+        <span>提前</span>
+        <el-input class="time" v-model="delayMinutes"></el-input>
+        <span>分钟发起配送</span>
       </div>
+      <div class="send-time">系统将于<span class="time">{{sendTime}}</span>自动发起配送</div>
       <p style="color: #f74141">
-        提示:设置后系统将根据您设置的提前时间自动发单。{{delayTime ? '' : '如需骑手立即取件请点击立即配送!'}}
+        请确保平台账户和绑定的运力账户余额充足,骑手接单后将立即取件
       </p>
       <div style="text-align: center; margin-top: 20px">
-        <el-button v-if="delayTime" @click.stop="cancalSettingTime">取消预约发单</el-button>
-        <el-button type="primary" class="submit-btn" @click.stop="commitTimeValue(orderId)">{{delayTime ? '确定修改' : '保存'}}</el-button>
+        <el-button v-if="order&&order.autoDeliveryTime" @click.stop="cancalSettingTime">取消预约发单</el-button>
+        <el-button type="primary" class="submit-btn" @click.stop="commitTimeValue(orderId)">{{order&&order.autoDeliveryTime ? '确定修改' : '保存'}}</el-button>
       </div>
     </el-dialog>
     <!-- 取消订单弹出层 -->
@@ -340,7 +317,7 @@ export default {
         { id: 8, name: "其他原因" },
       ],
       timeList: [1, 1.5, 2, 2.5, 3, 3.5, 4, 5, 6, 7, 8, 9, 10, 11, 12],
-      timeValue: 1, // 定时发单,默认1小时
+      delayMinutes: 30, // 定时发单
       cancelStatus: false, // 取消订单弹出层
       settingTimeStatus: false, // 定时发单弹出层
       needTrack: false,
@@ -349,7 +326,6 @@ export default {
       dialogTableVisible: false,
       remark: "",
       orderId: "",
-      item: {},
       radio: "",
       needTrack: false,
       curIdx: 0,
@@ -361,7 +337,6 @@ export default {
       link: "",
       buttonStatus: 0,
       exceptTime: "",
-      delayTime: "", // 预约延迟时间
       riderArriveTime: {}, //骑手预计取货送达时间
       showParentOrderSn: false,
     };
@@ -400,11 +375,30 @@ export default {
   },
   computed: {
     ...mapState(["userInfo"]),
+    sendTime() {
+      return (
+        this.exceptTime &&
+        this.delayMinutes &&
+        this.$tool.getFormatDate(
+          new Date(this.exceptTime).getTime() - this.delayMinutes * 60 * 1000,
+          "MM-dd hh:mm"
+        )
+      );
+    },
+    order() {
+      return this.list[this.curIdx] || {};
+    },
   },
   methods: {
     exceptTimeFn(item) {
       let con = item.exceptTime || item.takeDate;
-      return con ? `${con.slice(5)}前送达` : "立即送达";
+      
+      return con
+        ? `${this.$tool.getFormatDate(
+            new Date(con).getTime(),
+            "MM-dd hh:mm"
+          )}前送达`
+        : "立即送达";
     },
     daySeqColor(type) {
       let bgColor = "";
@@ -586,14 +580,13 @@ export default {
     },
     // 取消定时发单
     cancalSettingTime() {
-      cancelTimingPublish({ orderId: this.item.id }).then((res) => {
+      cancelTimingPublish({ orderId: this.order.id }).then((res) => {
         this.settingTimeStatus = false;
         if (res.code == 200) {
           this.$message({
-            message: "取消定时发单成功",
+            message: "已取消预约发单",
             type: "success",
           });
-          this.item = {};
           bus.$emit("refreshData");
           bus.$emit("refreshData2");
         } else {
@@ -605,30 +598,23 @@ export default {
       });
     },
     commitTimeValue() {
-      let timestamp = new Date().valueOf();
-      let exT = moment(this.item.exceptTime).valueOf();
-      let nowTime = moment(exT)
-        .subtract(this.timeValue, "hours")
-        .format("YYYY-MM-DD HH:mm:ss"); //当前时间的前n小时时间
-      let t1 = moment(nowTime).valueOf(); // 时间戳
-      console.log(nowTime, this.item, "-------------");
-      if (t1 - timestamp < 0) {
-        return this.$message({
-          message: `设置发单时间超出当前时间`,
-          type: "error",
-        });
+      if (!this.delayMinutes) {
+        return this.$message.error('请输入提前发单时间');
+      }
+      if (this.delayMinutes < 30) {
+        return this.$message.error('预约发单时间必须大于30分钟');
       }
       setDeliveryTime({
-        orderId: this.item.id,
-        delayTime: this.timeValue,
+        orderId: this.order.id,
+        delayTime: this.delayMinutes,
+        delayTimeType: 1,
       }).then((res) => {
         this.settingTimeStatus = false;
         if (res.code == 200) {
           this.$message({
-            message: "设置定时发单成功",
+            message: "已成功设置预约发单时间",
             type: "success",
           });
-          this.item = {};
           bus.$emit("refreshData");
           bus.$emit("refreshData2");
         } else {
@@ -641,11 +627,9 @@ export default {
     },
     // 定时发单
     settingTime(item) {
-      this.item = item;
       this.settingTimeStatus = true;
-      this.delayTime = item.delayTime;
-      this.timeValue = item.delayTime ? item.delayTime : 1;
-      this.exceptTime = `预约期望${item.exceptTime.slice(5)}送达`;
+      this.delayMinutes = item.delayMinutes;
+      this.exceptTime = item.exceptTime;
     },
     // 取消订单
     cancelOrder(orderId) {
@@ -704,7 +688,6 @@ export default {
     itemAddRemark(orderId, item) {
       this.dialogTableVisible = true;
       this.orderId = orderId;
-      this.item = item;
       this.remark = item.takeRemark || "";
     },
     // 一键发单备注
@@ -1473,4 +1456,25 @@ export default {
     }
   }
 }
+.expect-time {
+  display: flex;
+  align-items: center;
+  .time {
+    width: 100px;
+    margin: 0 10px;
+    /deep/ .el-input__inner {
+      height: 35px;
+      text-align: center;
+    }
+  }
+}
+.send-time {
+  margin-top: 20px;
+  font-size: 14px;
+  font-weight: bold;
+  color: #999;
+  .time {
+    color: #fc7200;
+  }
+}
 </style>

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

@@ -9,7 +9,7 @@
           <img @click.stop="deleteAddress(v)" src="../../../static/image/delete-icon.png" alt="">
         </div>
       </div>
-      <div class="item1" @click.stop="showAddress(0,v)">
+      <div class="item1" @click.stop="showAddress(0)">
         <img class="img" src="../../../static/image/icon-add.png" alt="">
         <div class="shop-name">添加常用地址</div>
       </div>

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

@@ -43,7 +43,7 @@ export default {
       tabList: [
         { name: "云打印", index: 0, activeName: "printerList" },
         { name: "有线打印", index: 1, activeName: "usbPrinter" },
-        // { name: "A4打印", index: 2, activeName: "a4Printer" },
+        { name: "A4打印", index: 2, activeName: "a4Printer" },
         { name: "贺卡打印", index: 3, activeName: "greetingCardPrinter" },
       ],
       tabNum: 0,

+ 459 - 142
src/components/settingComponents/print/a4Printer.vue

@@ -1,12 +1,29 @@
 <template>
-  <div class="printer-list">
+  <div class="a4-printer">
     <div class="model">
-      <div class="title">
-        <div class="name">A4打印</div>
-      </div>
       <div class="setting-model">
         <div class="list">
-          <div class="item" v-for="(v,i) in list" :key=i>
+          <div class="item">
+            <div class="left">
+              <div class="left-top">
+                <div class="name">选择打印模板</div>
+              </div>
+              <div class="left-bot">根据您的制作和配送的场景选择适合的模板</div>
+              <div class="module-list">
+                <div @click="openModule(index)" class="module" v-for="(module,index) in moduleList" :key='index'>
+                  <div class="img-wrap">
+                    <img class="img" src="../../../../static/image/print-module.png" alt="">
+                  </div>
+                  <div class="module-right">
+                    <div class="module-name">{{module.name}}</div>
+                    <div class="module-tips">{{module.tips}}</div>
+                  </div>
+                  <div v-if="picturePrintModule === index+1" class="module-status">使用中</div>
+                </div>
+              </div>
+            </div>
+          </div>
+          <div class="item" v-for="v in list" :key="v.field">
             <div class="left">
               <div class="left-top">
                 <div class="name">{{v.name}}</div>
@@ -17,84 +34,239 @@
               <el-switch @change="change(v)" v-model="v.value" :active-value="1" :inactive-value="0" active-color="#FC7200" inactive-color="#999" />
             </div>
           </div>
-        </div>
-      </div>
-      <div class="printer-list">
-        <div class="item" v-for="(v,i) in printerList" :key="i">
-          <img class="img" :src="require(`../../../../static/image/printer-online-${v.onlineStatus}.png`)" alt="">
-          <div class="name">{{v.name}}</div>
-          <div class="shop-name">{{v.shopName}}</div>
-          <div class="btns">
-            <img @click.stop="printTest(v)" src="../../../../static/image/print-icon.png" alt="">
-            <img @click.stop="addPrinter(v)" src="../../../../static/image/edit-icon.png" alt="">
-            <img @click.stop="deletePrinter(v)" src="../../../../static/image/delete-icon.png" alt="">
+          <div class="item">
+            <div class="left">
+              <div class="left-top">
+                <div class="name">设置店铺联系号码</div>
+              </div>
+              <div class="left-bot">设置的店铺电话会打印在A4纸张上</div>
+            </div>
+            <div class="right" @click="openSettingPhone">
+              <div class="right-name">{{picturePrintMobileType === 1 ? '统一设置' : '各店铺电话'}}</div>
+              <i class="el-icon-arrow-right"></i>
+            </div>
+          </div>
+          <div class="item">
+            <div class="left">
+              <div class="left-top">
+                <div class="name">使用云盒打印</div>
+              </div>
+              <div class="printer-list">
+                <div class="printer-item" v-for="(v,i) in printerList" :key="i">
+                  <img class="img" src="../../../../static/image/printer-online-1.png" alt="">
+                  <div class="name">{{v.name}}</div>
+                  <div class="shop-name">{{v.shopName}}</div>
+                  <div class="btns">
+                    <img @click.stop="addPrinter(v)" src="../../../../static/image/edit-icon.png" alt="">
+                    <img @click.stop="deletePrinter(v)" src="../../../../static/image/delete-icon.png" alt="">
+                  </div>
+                </div>
+                <div v-if="!this.printerList.length" class="printer-item" @click.stop="addPrinter('')">
+                  <img class="img" src="../../../../static/image/icon-add.png" alt="">
+                  <div class="name">添加打印云盒</div>
+                  <div class="shop-name"> </div>
+                </div>
+              </div>
+            </div>
+          </div>
+          <div class="item" v-for="(v,i) in list1" :key=i>
+            <div class="left">
+              <div class="left-top">
+                <div class="name">{{v.name}}</div>
+              </div>
+              <div class="left-bot">{{v.tips}}</div>
+            </div>
+            <div class="right">
+              <el-switch @change="change(v)" v-model="v.value" :active-value="1" :inactive-value="0" active-color="#FC7200" inactive-color="#999" />
+            </div>
           </div>
-        </div>
-        <div class="item" @click.stop="addPrinter('')">
-          <img class="img" src="../../../../static/image/icon-add.png" alt="">
-          <div class="name">添加打印云盒</div>
-          <div class="shop-name"> </div>
         </div>
       </div>
     </div>
+    <!-- 设置联系电话 -->
+    <el-dialog title="电话设置" :visible.sync="showSettingPhone" width="500px" @close="getConfig">
+      <el-select size="small" v-model="picturePrintMobileType" placeholder="请选择">
+        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value">
+        </el-option>
+      </el-select>
+      <el-input class="unify-phone" size="small" v-if="picturePrintMobileType===1" v-model="picturePrintMobile" placeholder="请输入统一的电话号码"></el-input>
+      <span slot="footer" class="dialog-footer">
+        <el-button size="small" @click="showSettingPhone = false">取 消</el-button>
+        <el-button size="small" type="primary" @click="confirmSettingPhone">确 定</el-button>
+      </span>
+    </el-dialog>
+    <!-- 新增、编辑云盒 -->
+    <el-dialog title="云盒管理" :visible.sync="dialogVisible" @close="resetData" width="600px">
+      <el-form ref="form" :model="form" label-width="120px">
+        <el-form-item label="云盒名称">
+          <el-input v-model="form.name" clearable placeholder="请自定义云盒名称"></el-input>
+        </el-form-item>
+        <el-form-item label="云盒序列号">
+          <el-input v-model="form.deviceSn" clearable placeholder="请填写云盒序列号"></el-input>
+        </el-form-item>
+        <el-form-item label="云盒秘钥">
+          <el-input v-model="form.deviceSecret" clearable placeholder="请填写云盒秘钥"></el-input>
+        </el-form-item>
+        <el-form-item label="关联门店">
+          <el-select style="width:300px;" clearable v-model="form.shopIdList" multiple @change="changePrinterShop" max-width="300px">
+            <el-option v-for="item in shopList" :key="item.id" :value="item.id" :label="item.name">
+              <div>{{ item.name }}</div>
+            </el-option>
+          </el-select>
+        </el-form-item>
+        <el-form-item label="选择打印机">
+          <el-select style="width:300px;" v-model="form.deviceName" placeholder="请选择打印机">
+            <el-option v-for="item in cloudList" :key="item.id" :value="`${ item.driverName }(USB${item.port})`">
+              <div>{{ item.driverName }}(USB{{item.port}})</div>
+            </el-option>
+          </el-select>
+          <el-button type="success" @click="getCloudPrinterInfo">获取打印机信息</el-button>
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="dialogVisible = false">取 消</el-button>
+        <el-button type="primary" @click="cloudPrinterManager">确 定</el-button>
+      </span>
+    </el-dialog>
+    <!-- A4打印模板 -->
+    <el-dialog :title="showTitle" :visible.sync="showModule" width="850px" top="5vh">
+      <div style="height: 70vh">
+        <iframe :src="moduleSrc" width="800px" height="100%" frameborder="0"></iframe>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <el-button @click="showModule = false">取 消</el-button>
+        <el-button type="primary" @click="saveModule">使 用</el-button>
+      </span>
+    </el-dialog>
   </div>
 </template>
 
 <script>
-import printerAdd from "./printerAdd";
 import {
-  getShopList,
-  shopDeviceList,
-  deviceDetail,
-  deviceList,
+  getNewShopList,
   deviceAdd,
+  shopDeviceList,
   deviceDelete,
-  deviceStatus,
-  printTest,
-  shopListNew,
+  getCloudDevice,
 } from "../../../api/shop";
+import { getConfig, updateConfig } from "../../../api/setting.js";
+import { mapState, mapMutations, mapGetters, mapActions } from "vuex";
+
 export default {
   name: "a4Printer",
-  components: {
-    printerAdd,
-  },
   data() {
     return {
+      moduleList: [
+        {
+          name: "默认模板",
+          tips: "配送单,不包含回执",
+        },
+        {
+          name: "配送模板",
+          tips: "配货单,包含预定人信息",
+        },
+        {
+          name: "签收模板",
+          tips: "配货签收",
+        },
+      ],
+      picturePrintModule: 1,
+      picturePrintMobile: "",
       list: [
         {
-          name: "开启电脑打印",
+          name: "开启A4带图打印",
           value: 1,
-          field: "openAutoorder",
-          tips: "开启后订单打印将使用电脑打印机,如需自动打印,请开启下方云盒打印",
+          field: "openPicturePrint",
+          tips: "开启A4带图打印需要打印机连接电脑,添加云盒可实现自动打印",
         },
+      ],
+      list1: [
         {
-          name: "使用云盒打印",
+          name: "开启自动打印",
           value: 1,
-          field: "openAutoorder",
-          tips: "使用智能打印云盒,实现A4带图自动打印",
+          field: "openAutoPicturePrint",
+          tips: "云盒添加后才可实现来单自动打印",
+        },
+      ],
+      showSettingPhone: false,
+      picturePrintMobileType: 2,
+      options: [
+        {
+          value: 2,
+          label: "各店铺联系电话",
         },
         {
-          name: "开通自动打印",
           value: 1,
-          field: "openAutoorder",
-          tips: "开通后将使用云盒模式自动打印订单",
-        }
+          label: "统一设置",
+        },
       ],
+      printerList: [],
+      dialogVisible: false,
+      shopList: [],
+      form: {
+        name: "",
+        deviceSn: "",
+        deviceSecret: "",
+        shopIdList: [],
+        deviceName: "",
+        deviceType: 28,
+        shopId: 0,
+        lkyPrintType: 1,
+      },
+      showModule: false,
+      moduleSrc: "",
+      origin: "",
+      cloudList: [],
+      openModuleIndex: 0,
+      showTitle: "选择默认模板",
+      memberType: 2,
     };
   },
   // 监听属性 类似于data概念
   computed: {},
   // 监控data中的数据变化
   watch: {},
+  // 生命周期 - 创建完成(可以访问当前this实例)
+  created() {
+    let userInfo = JSON.parse(localStorage.getItem("userInfo"));
+    this.memberType = userInfo.memberType;
+    if (this.memberType === 3) {
+      this.options = [
+        {
+          value: 2,
+          label: "各店铺联系电话",
+        },
+      ];
+    }
+    this.origin = window.location.origin;
+    this.getNewShopList();
+    this.getCloudPrinterList();
+    this.getConfig();
+  },
+  // 生命周期 - 挂载完成(可以访问DOM元素)
+  mounted() {},
   // 方法集合
   methods: {
-    printTest(v) {
-      printTest({ deviceSn: v.deviceSn }).then((res) => {
-        if (res.code === 200) {
-          this.$message({
-            type: "success",
-            message: "操作成功!",
-          });
+    ...mapMutations(["SET_USERINFO"]),
+    getCloudPrinterInfo() {
+      if (!this.form.deviceSn) {
+        return this.$message.warning(`请输入云盒序列号!`);
+      }
+      if (!this.form.deviceSecret) {
+        return this.$message.warning(`请输入云盒秘钥!`);
+      }
+      let params = {
+        deviceId: this.form.deviceSn,
+        deviceKey: this.form.deviceSecret,
+        printerType: 1,
+      };
+      getCloudDevice(params).then((res) => {
+        console.log("云盒信息", res);
+        if (!res.code) {
+          this.cloudList = res.data;
+          let cloud = this.cloudList[0];
+          if (!cloud) return;
+          this.form.deviceName = `${cloud.driverName}(USB${cloud.port})`;
         } else {
           this.$message({
             type: "error",
@@ -103,8 +275,59 @@ export default {
         }
       });
     },
+    changePrinterShop(e) {
+      if (e.at(-1)) {
+        this.form.shopIdList = e.filter((v) => {
+          return v;
+        });
+      } else {
+        if (this.memberType === 2) {
+          this.form.shopIdList = [0];
+        } else {
+          this.form.shopIdList = [];
+        }
+      }
+    },
+    openModule(index) {
+      this.showModule = true;
+      this.openModuleIndex = index + 1;
+      switch (this.openModuleIndex) {
+        case 1:
+          this.showTitle = `选择默认模板`;
+          break;
+        case 2:
+          this.showTitle = `选择配送模板`;
+          break;
+        case 3:
+          this.showTitle = `选择签收模板`;
+          break;
+
+        default:
+          break;
+      }
+      this.moduleSrc = `order-print-module/module${index}.html`;
+    },
+    saveModule() {
+      this.picturePrintModule = this.openModuleIndex;
+      this.updateConfig({ picturePrintModule: this.picturePrintModule });
+    },
+    openSettingPhone() {
+      this.showSettingPhone = true;
+    },
+    confirmSettingPhone() {
+      if (
+        this.picturePrintMobileType === 1 &&
+        !this.$tool.mobile(this.picturePrintMobile)
+      ) {
+        return this.$message.error("请输入正确的电话号码!");
+      }
+      this.updateConfig({
+        picturePrintMobileType: this.picturePrintMobileType,
+        picturePrintMobile: this.picturePrintMobile,
+      });
+    },
     deletePrinter(v) {
-      this.$confirm("此操作将删除打印机, 是否继续?", "提示", {
+      this.$confirm("此操作将删除打印云盒, 是否继续?", "提示", {
         confirmButtonText: "确定",
         cancelButtonText: "取消",
         type: "warning",
@@ -114,10 +337,10 @@ export default {
           deviceDelete({ id: v.id }).then((res) => {
             if (res.code === 200) {
               this.$message({
-                type: "error",
+                type: "success",
                 message: "删除成功!",
               });
-              this.refreshData();
+              this.getCloudPrinterList();
             } else {
               this.$message({
                 type: "error",
@@ -133,22 +356,13 @@ export default {
           });
         });
     },
-    refreshData() {
-      this.getPrinterNum();
-      this.getPrinterList();
-    },
-    addPrinter(e) {
-      console.log(e);
-      if (!e) {
-        this.$refs.printerAdd.init();
-      } else {
-        this.$refs.printerAdd.init(JSON.parse(JSON.stringify(e)));
-      }
-    },
-    getPrinterList() {
-      shopDeviceList({ deviceType: 2 }).then((res) => {
+    getNewShopList() {
+      getNewShopList().then((res) => {
         if (res.code === 200) {
-          this.printerList = res.data;
+          if (this.memberType === 2) {
+            res.data.unshift({ id: 0, name: "全部门店" });
+          }
+          this.shopList = res.data;
         } else {
           this.$message({
             type: "error",
@@ -157,10 +371,32 @@ export default {
         }
       });
     },
-    getPrinterNum() {
-      deviceStatus().then((res) => {
+    addPrinter(v) {
+      this.dialogVisible = true;
+      if (v) this.form = this.$tool.deepClone(v);
+      if (this.form.id) return;
+      this.form.name = `贺卡打印云盒${new Date().getTime()}`;
+      this.cloudList = [];
+    },
+    cloudPrinterManager() {
+      if (!this.form.name) {
+        return this.$message.warning(`请输入云盒名称!`);
+      }
+      if (!this.form.deviceSn) {
+        return this.$message.warning(`请输入云盒序列号!`);
+      }
+      if (!this.form.deviceSecret) {
+        return this.$message.warning(`请输入云盒秘钥!`);
+      }
+      let form = this.$tool.deepClone(this.form);
+      form.shopIds = form.shopIdList.join();
+      deviceAdd(form).then((res) => {
+        console.log("添加云盒信息", res);
         if (res.code === 200) {
-          this.pinter = res.data;
+          this.$message.success(`成功添加云盒!`);
+          this.dialogVisible = false;
+          this.getCloudPrinterList();
+          this.resetData();
         } else {
           this.$message({
             type: "error",
@@ -169,10 +405,32 @@ export default {
         }
       });
     },
-    getDeviceList() {
-      deviceList({ type: 2 }).then((res) => {
+    resetData() {
+      this.form = {
+        name: "",
+        deviceSn: "",
+        deviceSecret: "",
+        shopIdList: [],
+        deviceName: "",
+        deviceType: 28,
+        shopId: 0,
+      };
+    },
+    getConfig() {
+      getConfig().then((res) => {
         if (res.code === 200) {
-          this.deviceList = res.data;
+          this.SET_USERINFO(res.data);
+          this.list = this.list.map((v) => {
+            v.value = res.data[v.field];
+            return v;
+          });
+          this.list1 = this.list1.map((v) => {
+            v.value = res.data[v.field];
+            return v;
+          });
+          this.picturePrintMobileType = res.data.picturePrintMobileType;
+          this.picturePrintModule = res.data.picturePrintModule;
+          this.picturePrintMobile = res.data.picturePrintMobile;
         } else {
           this.$message({
             type: "error",
@@ -181,10 +439,27 @@ export default {
         }
       });
     },
-    getShopList() {
-      shopListNew().then((res) => {
+    change(e) {
+      let data = { [e.field]: e.value };
+      this.updateConfig(data);
+    },
+    updateConfig(data) {
+      updateConfig(data).then((res) => {
+        if (res.code !== 200) {
+          this.$message({
+            type: "error",
+            message: res.msg,
+          });
+        }
+        this.showModule = false;
+        this.showSettingPhone = false;
+        this.getConfig();
+      });
+    },
+    getCloudPrinterList() {
+      shopDeviceList({ deviceType: 28, lkyPrintType: 1 }).then((res) => {
         if (res.code === 200) {
-          this.shopList = res.data;
+          this.printerList = res.data;
         } else {
           this.$message({
             type: "error",
@@ -194,29 +469,6 @@ export default {
       });
     },
   },
-  // 生命周期 - 创建完成(可以访问当前this实例)
-  created() {
-    this.getPrinterNum();
-    this.getPrinterList();
-    this.getDeviceList();
-    this.getShopList();
-  },
-  // 生命周期 - 挂载完成(可以访问DOM元素)
-  mounted() {},
-  // 生命周期 - 创建之前
-  beforeCreate() {},
-  // 生命周期 - 挂载之前
-  beforeMount() {},
-  // 生命周期 - 更新之前
-  beforeUpdate() {},
-  // 生命周期 - 更新之后
-  updated() {},
-  // 生命周期 - 销毁之前
-  beforeDestroy() {},
-  // 生命周期 - 销毁完成
-  destroyed() {},
-  // 如果页面有keep-alive缓存功能,这个函数会触发
-  activated() {},
 };
 </script>
 
@@ -252,6 +504,7 @@ export default {
     background-color: #fc7200;
     border-color: #fc7200;
   }
+
   .setting-model {
     .title {
       position: relative;
@@ -310,10 +563,114 @@ export default {
             line-height: 17px;
             color: #999999;
           }
+          .module-list {
+            display: flex;
+            align-items: center;
+            margin-top: 10px;
+            .module {
+              position: relative;
+              display: flex;
+              align-items: center;
+              justify-content: center;
+              width: 250px;
+              height: 150px;
+              background: #f7f1f1;
+              border-radius: 5px;
+              cursor: pointer;
+              margin-right: 20px;
+              .module-status {
+                position: absolute;
+                top: 0;
+                right: 0;
+                color: #fc7200;
+                font-size: 12px;
+                font-weight: bold;
+                padding: 4px;
+              }
+              .img-wrap {
+                display: flex;
+                align-items: center;
+                justify-content: center;
+                width: 60px;
+                height: 60px;
+                background: #fc7200;
+                border-radius: 50%;
+                .img {
+                  width: 30px;
+                  height: 30px;
+                }
+              }
+              .module-right {
+                margin-left: 5px;
+
+                .module-name {
+                  font-size: 14px;
+                  color: #666;
+                }
+                .module-tips {
+                  font-size: 12px;
+                  color: #999;
+                  margin-top: 5px;
+                }
+              }
+            }
+          }
+          .printer-list {
+            display: flex;
+            flex-wrap: wrap;
+            .printer-item {
+              position: relative;
+              display: flex;
+              flex-direction: column;
+              align-items: center;
+              justify-content: center;
+              width: 250px;
+              height: 150px;
+              background: #f7f1f1;
+              border-radius: 8px;
+              margin: 10px 20px 0 0;
+              cursor: pointer;
+              .img {
+                width: 80px;
+                height: 80px;
+              }
+              .name {
+                font-size: 14px;
+                font-weight: 500;
+                line-height: 20px;
+                color: #333333;
+              }
+              .shop-name {
+                font-size: 12px;
+                font-weight: 400;
+                line-height: 20px;
+                color: #999999;
+              }
+              .btns {
+                position: absolute;
+                top: 10px;
+                right: 0;
+                img {
+                  width: 20px;
+                  height: 20px;
+                  margin-right: 10px;
+                }
+              }
+            }
+          }
         }
         .right {
           display: flex;
           align-items: center;
+          .right-name {
+            font-size: 13px;
+            color: #fc7200;
+            cursor: pointer;
+          }
+          .el-icon-arrow-right {
+            color: #fc7200 !important;
+            cursor: pointer;
+          }
           .time {
             font-size: 12px;
             font-family: PingFang SC;
@@ -340,48 +697,8 @@ export default {
       }
     }
   }
-  .printer-list {
-    display: flex;
-    flex-wrap: wrap;
-    .item {
-      position: relative;
-      display: flex;
-      flex-direction: column;
-      align-items: center;
-      justify-content: center;
-      width: 320px;
-      height: 182px;
-      background: #ffffff;
-      border-radius: 8px;
-      margin: 10px 20px 0 0;
-      cursor: pointer;
-      .img {
-        width: 80px;
-        height: 80px;
-      }
-      .name {
-        font-size: 14px;
-        font-weight: 500;
-        line-height: 20px;
-        color: #333333;
-      }
-      .shop-name {
-        font-size: 12px;
-        font-weight: 400;
-        line-height: 20px;
-        color: #999999;
-      }
-      .btns {
-        position: absolute;
-        top: 10px;
-        right: 0;
-        img {
-          width: 20px;
-          height: 20px;
-          margin-right: 10px;
-        }
-      }
-    }
-  }
+}
+.unify-phone {
+  margin-top: 20px;
 }
 </style>

+ 19 - 6
src/components/settingComponents/print/greetingCardPrinter.vue

@@ -198,7 +198,7 @@ export default {
         name: "",
         deviceSn: "",
         deviceSecret: "",
-        shopIdList: [0],
+        shopIdList: [],
         deviceName: "",
         deviceType: 28,
         shopId: 0,
@@ -214,7 +214,7 @@ export default {
         paddingRight: 10,
         direction: 1, // 1:竖向 2:横向
         fontFamily: "FangZhengKaiTi",
-        shopIdList: [0],
+        shopIdList: [],
         sizeType: 9, // 纸张尺寸
         jpAutoAlign: "z5",
       },
@@ -317,6 +317,7 @@ export default {
         // },
       ],
       dialogVisible: false,
+      memberType: 2,
     };
   },
   // 监听属性 类似于data概念
@@ -409,6 +410,8 @@ export default {
   },
   // 生命周期 - 创建完成(可以访问当前this实例)
   created() {
+    let userInfo = JSON.parse(localStorage.getItem("userInfo"));
+    this.memberType = userInfo.memberType;
     this.getNewShopList();
     this.getCloudPrinterList();
     this.getCloudConfigList();
@@ -645,7 +648,7 @@ export default {
         name: "",
         deviceSn: "",
         deviceSecret: "",
-        shopIdList: [0],
+        shopIdList: [],
         deviceName: "",
         deviceType: 28,
         shopId: 0,
@@ -691,7 +694,11 @@ export default {
           return v;
         });
       } else {
-        this.params.shopIdList = [0];
+        if (this.memberType === 2) {
+          this.params.shopIdList = [0];
+        } else {
+          this.params.shopIdList = [];
+        }
       }
     },
     changePrinterShop(e) {
@@ -700,7 +707,11 @@ export default {
           return v;
         });
       } else {
-        this.form.shopIdList = [0];
+        if (this.memberType === 2) {
+          this.form.shopIdList = [0];
+        } else {
+          this.form.shopIdList = [];
+        }
       }
     },
     changeDmPaperSize(e) {
@@ -750,7 +761,9 @@ export default {
     getNewShopList() {
       getNewShopList().then((res) => {
         if (res.code === 200) {
-          res.data.unshift({ id: 0, name: "全部门店" });
+          if (this.memberType === 2) {
+            res.data.unshift({ id: 0, name: "全部门店" });
+          }
           this.shopList = res.data;
         } else {
           this.$message({

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

@@ -169,7 +169,7 @@ export default {
           setContent: "设置时长",
           value: 1,
           field: "openAutodelivery",
-          tips: "非冲突绑定模式,不支持自动发单",
+          tips: "根据设置的时间进行自动发单",
           time: 0,
         },
         {

+ 4 - 1
src/router/index.js

@@ -149,7 +149,10 @@ const router = new Router({
 
 router.beforeEach((to, from, next) => {
   if (to.path === '/login') {
-    localStorage.clear()
+    // localStorage.clear()
+    localStorage.removeItem('token')
+    localStorage.removeItem('userInfo')
+    localStorage.removeItem('usbPrinter')
     next()
   } else {
     const token = localStorage.getItem('token') || null;

+ 1 - 1
src/views/home.vue

@@ -100,7 +100,7 @@ export default {
         cancelButtonText: "取消",
         type: "warning",
       }).then(() => {
-        localStorage.clear();
+        // localStorage.clear();
         this.$store.commit("setFirstLogin", true);
         bus.$emit("closeGetSoundMsg");
         this.$router.push({

+ 32 - 3
src/views/login.vue

@@ -39,7 +39,8 @@
           </div>
         </div>
         <div class="forgot-pass">
-          <span @click.stop="$router.push('/resetPassword')">忘记密码?</span>
+          <el-checkbox v-show="activeIndex === 1" @change="changeRememberPw" v-model="rememberPw">记住密码</el-checkbox>
+          <span v-show="activeIndex === 1" @click.stop="$router.push('/resetPassword')">忘记密码?</span>
         </div>
         <div class="login-btn" @click.stop="toLogin">登录</div>
         <div class="xie-yi">
@@ -67,6 +68,7 @@ export default {
       timer: null, // 计时器
       errCount: 0,
       checked: false,
+      rememberPw: false,
     };
   },
   destroyed() {
@@ -78,11 +80,25 @@ export default {
     // ...mapGetters(["userInfo"]),
   },
   created() {
-    console.log("vuex", this.userInfo);
+    let rememberPw = localStorage.getItem("rememberPw");
+    if (rememberPw) {
+      this.rememberPw = rememberPw === "1" ? true : false;
+    } else {
+      this.rememberPw = false;
+    }
+    if (this.rememberPw) {
+      let loginInfo = JSON.parse(localStorage.getItem("loginInfo"));
+      this.mobile = loginInfo.mobile;
+      this.password = loginInfo.password;
+      this.checked = true;
+    }
   },
   methods: {
     ...mapMutations(["SET_USERINFO"]),
     ...mapActions(["getUserInfo"]),
+    changeRememberPw() {
+      localStorage.setItem("rememberPw", this.rememberPw ? 1 : 0);
+    },
     seachEnterFun(e) {
       var keyCode = window.event ? e.keyCode : e.which;
       if (keyCode == 13) {
@@ -119,6 +135,17 @@ export default {
       };
       loginPassword(params).then((res) => {
         if (res.code == 200) {
+          if (this.rememberPw) {
+            localStorage.setItem(
+              "loginInfo",
+              JSON.stringify({
+                mobile: this.mobile,
+                password: this.password,
+              })
+            );
+          } else {
+            localStorage.removeItem("loginInfo");
+          }
           this.errCount = 0;
           localStorage.setItem("token", res.data.token);
           this.SET_USERINFO(res.data.member);
@@ -363,7 +390,9 @@ export default {
       }
 
       .forgot-pass {
-        text-align: right;
+        display: flex;
+        justify-content: space-between;
+        height: 30px;
         font-size: 14px;
         font-family: PingFang SC;
         font-weight: 400;

BIN
static/image/print-module.png