Funny 2 anos atrás
pai
commit
f75d400e16

+ 3 - 1
public/order-print-module/module0.html

@@ -63,6 +63,7 @@
     .other-info p {
       line-height: 30px;
     }
+
     .contact {
       text-align: center;
     }
@@ -98,7 +99,8 @@
           <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">
+              <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>

+ 2 - 1
public/order-print-module/module1.html

@@ -97,7 +97,8 @@
           <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">
+              <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>

+ 2 - 1
public/order-print-module/module2.html

@@ -119,7 +119,8 @@
           <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">
+              <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>

+ 1 - 0
src/components/orderComponents/orderList.vue

@@ -392,6 +392,7 @@ export default {
   methods: {
     exceptTimeFn(item) {
       let con = item.exceptTime || item.takeDate;
+      
       return con
         ? `${this.$tool.getFormatDate(
             new Date(con).getTime(),

+ 102 - 17
src/components/settingComponents/print/a4Printer.vue

@@ -18,12 +18,12 @@
                     <div class="module-name">{{module.name}}</div>
                     <div class="module-tips">{{module.tips}}</div>
                   </div>
-                  <div v-if="activeModuleIndex === index" class="module-status">使用中</div>
+                  <div v-if="picturePrintModule === index+1" class="module-status">使用中</div>
                 </div>
               </div>
             </div>
           </div>
-          <!-- <div class="item" v-for="(v,i) in list" :key=i>
+          <div class="item" v-for="v in list" :key="v.field">
             <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">
@@ -42,7 +42,7 @@
               <div class="left-bot">设置的店铺电话会打印在A4纸张上</div>
             </div>
             <div class="right" @click="openSettingPhone">
-              <div class="right-name">{{phoneSetting}}</div>
+              <div class="right-name">{{picturePrintMobile}}</div>
               <i class="el-icon-arrow-right"></i>
             </div>
           </div>
@@ -53,7 +53,7 @@
               </div>
               <div class="printer-list">
                 <div class="printer-item" v-for="(v,i) in printerList" :key="i">
-                  <img class="img" :src="require(`../../../../static/image/printer-online-${v.onlineStatus}.png`)" alt="">
+                  <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">
@@ -85,11 +85,11 @@
     </div>
     <!-- 设置联系电话 -->
     <el-dialog title="电话设置" :visible.sync="showSettingPhone" width="500px">
-      <el-select size="small" v-model="phoneSettingStyle" placeholder="请选择">
+      <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="phoneSettingStyle===1" v-model="unifyPhone" placeholder="请输入统一的电话号码"></el-input>
+      <el-input class="unify-phone" size="small" v-if="picturePrintMobileType===1" v-model="unifyPhone" 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>
@@ -129,7 +129,7 @@
       </span>
     </el-dialog>
     <!-- A4打印模板 -->
-    <el-dialog title="选择默认模板" :visible.sync="showModule" width="850px" top="5vh">
+    <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>
@@ -142,7 +142,10 @@
 </template>
 
 <script>
-import { getNewShopList, deviceAdd } from "../../../api/shop";
+import { getNewShopList, deviceAdd, shopDeviceList } from "../../../api/shop";
+import { getConfig, updateConfig } from "../../../api/setting.js";
+import { mapState, mapMutations, mapGetters, mapActions } from "vuex";
+
 export default {
   name: "a4Printer",
   data() {
@@ -161,13 +164,13 @@ export default {
           tips: "配货签收",
         },
       ],
-      activeModuleIndex: 0,
-      phoneSetting: "各店铺联系电话",
+      picturePrintModule: 1,
+      picturePrintMobile: "",
       list: [
         {
           name: "开启A4带图打印",
           value: 1,
-          field: "openAutoorder",
+          field: "openPicturePrint",
           tips: "开启A4带图打印需要打印机连接电脑,添加云盒可实现自动打印",
         },
       ],
@@ -175,16 +178,16 @@ export default {
         {
           name: "开启自动打印",
           value: 1,
-          field: "openAutoorder",
+          field: "openAutoPicturePrint",
           tips: "云盒添加后才可实现来单自动打印",
         },
       ],
       showSettingPhone: false,
-      phoneSettingStyle: 0,
+      picturePrintMobileType: 2,
       unifyPhone: "",
       options: [
         {
-          value: 0,
+          value: 2,
           label: "各店铺联系电话",
         },
         {
@@ -208,6 +211,8 @@ export default {
       moduleSrc: "",
       origin: "",
       cloudList: [],
+      openModuleIndex: 0,
+      showTitle: "选择默认模板",
     };
   },
   // 监听属性 类似于data概念
@@ -218,11 +223,14 @@ export default {
   created() {
     this.origin = window.location.origin;
     this.getNewShopList();
+    this.getCloudPrinterList();
+    this.getConfig();
   },
   // 生命周期 - 挂载完成(可以访问DOM元素)
   mounted() {},
   // 方法集合
   methods: {
+    ...mapMutations(["SET_USERINFO"]),
     getCloudPrinterInfo() {
       if (!this.form.deviceSn) {
         return this.$message.warning(`请输入云盒序列号!`);
@@ -261,16 +269,41 @@ export default {
     },
     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() {},
+    saveModule() {
+      this.picturePrintModule = this.openModuleIndex;
+      this.updateConfig({ picturePrintModule: this.picturePrintModule });
+    },
     openSettingPhone() {
       this.showSettingPhone = true;
     },
     confirmSettingPhone() {
-      if (this.phoneSettingStyle === 1 && !this.$tool.mobile(this.unifyPhone)) {
+      if (
+        this.picturePrintMobileType === 1 &&
+        !this.$tool.mobile(this.unifyPhone)
+      ) {
         this.$message.error("请输入正确的电话号码!");
       }
+      this.updateConfig({
+        picturePrintMobileType: this.picturePrintMobileType,
+        picturePrintMobile: this.picturePrintMobile,
+      });
     },
     getNewShopList() {
       getNewShopList().then((res) => {
@@ -330,6 +363,58 @@ export default {
         shopId: 0,
       };
     },
+    getConfig() {
+      getConfig().then((res) => {
+        if (res.code === 200) {
+          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",
+            message: res.msg,
+          });
+        }
+      });
+    },
+    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 }).then((res) => {
+        if (res.code === 200) {
+          this.printerList = res.data;
+        } else {
+          this.$message({
+            type: "error",
+            message: res.msg,
+          });
+        }
+      });
+    },
   },
 };
 </script>