Pārlūkot izejas kodu

A4打印、记住密码

Funny 2 gadi atpakaļ
vecāks
revīzija
eb19af2b9a

+ 1 - 1
package.json

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

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

@@ -0,0 +1,133 @@
+<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 {
+      line-height: 68px;
+    }
+
+    .table table td,
+    .table table th {
+      padding: 0 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://static.maiyatian.com/saas/other/preview.jpeg">
+              <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>

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

@@ -0,0 +1,158 @@
+<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 {
+      line-height: 60px;
+    }
+
+    .table table td,
+    .table table th {
+      padding: 0 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://static.maiyatian.com/saas/other/preview.jpeg">
+              <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>

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

@@ -0,0 +1,199 @@
+<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 {
+      line-height: 60px;
+    }
+
+    .table table td,
+    .table table th {
+      padding: 0 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://static.maiyatian.com/saas/other/preview.jpeg">
+              <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>

+ 60 - 3
src/components/settingComponents/print/a4Printer.vue

@@ -10,7 +10,7 @@
               </div>
               <div class="left-bot">根据您的制作和配送的场景选择适合的模板</div>
               <div class="module-list">
-                <div class="module" v-for="(module,index) in moduleList" :key=index>
+                <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>
@@ -23,7 +23,7 @@
               </div>
             </div>
           </div>
-          <div class="item" v-for="(v,i) in list" :key=i>
+          <!-- <div class="item" v-for="(v,i) in list" :key=i>
             <div class="left">
               <div class="left-top">
                 <div class="name">{{v.name}}</div>
@@ -33,7 +33,7 @@
             <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">
             <div class="left">
               <div class="left-top">
@@ -128,6 +128,16 @@
         <el-button type="primary" @click="cloudPrinterManager">确 定</el-button>
       </span>
     </el-dialog>
+    <!-- A4打印模板 -->
+    <el-dialog title="选择默认模板" :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>
 
@@ -194,6 +204,10 @@ export default {
         deviceType: 28,
         shopId: 0,
       },
+      showModule: false,
+      moduleSrc: "",
+      origin: "",
+      cloudList: [],
     };
   },
   // 监听属性 类似于data概念
@@ -202,12 +216,54 @@ export default {
   watch: {},
   // 生命周期 - 创建完成(可以访问当前this实例)
   created() {
+    this.origin = window.location.origin;
     this.getNewShopList();
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   // 方法集合
   methods: {
+    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",
+            message: res.msg,
+          });
+        }
+      });
+    },
+    changePrinterShop() {
+      if (e.at(-1)) {
+        this.form.shopIdList = e.filter((v) => {
+          return v;
+        });
+      } else {
+        this.form.shopIdList = [0];
+      }
+    },
+    openModule(index) {
+      this.showModule = true;
+      this.moduleSrc = `order-print-module/module${index}.html`;
+    },
+    saveModule() {},
     openSettingPhone() {
       this.showSettingPhone = true;
     },
@@ -310,6 +366,7 @@ export default {
     background-color: #fc7200;
     border-color: #fc7200;
   }
+
   .setting-model {
     .title {
       position: relative;

+ 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;