浏览代码

bug修改

zjxpcyc 6 年前
父节点
当前提交
cac93925fb
共有 3 个文件被更改,包括 24 次插入19 次删除
  1. 1
    1
      dist/index.html
  2. 8
    12
      src/pages/system/newOrder/newOrderList/index.vue
  3. 15
    6
      src/pages/system/newOrder/newOrderList/print.vue

+ 1
- 1
dist/index.html 查看文件

@@ -1 +1 @@
1
-<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=//at.alicdn.com/t/font_775069_dwqa9wy3lkh.css><link rel="shortcut icon" href=favorite.ico><title>城的空间后台管理系统</title><link href=./static/css/app.3b0e57e32c2c7a560985f9057266d39c.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.d824a66773bc281133c0.js></script><script type=text/javascript src=./static/js/vendor.d372c8cfdbe37ad99178.js></script><script type=text/javascript src=./static/js/app.deea2a2370b09a46e854.js></script></body></html>
1
+<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><link rel=stylesheet href=//at.alicdn.com/t/font_775069_dwqa9wy3lkh.css><link rel="shortcut icon" href=favorite.ico><title>城的空间后台管理系统</title><link href=./static/css/app.1e46d4b9ed3f88714e0c317131c4541c.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=./static/js/manifest.6b46e7152ec420b1195e.js></script><script type=text/javascript src=./static/js/vendor.d93cccd3231f9f669168.js></script><script type=text/javascript src=./static/js/app.d106b851cc4f54209d51.js></script></body></html>

+ 8
- 12
src/pages/system/newOrder/newOrderList/index.vue 查看文件

@@ -25,6 +25,7 @@
25 25
       <div class="moreFilter"></div>
26 26
     </div>
27 27
     <div class="order-list-box">
28
+      <print-list :print-list="printList" v-if="printList.length>0" @printed="clearPrintList" />
28 29
       <div style='position:relative;' v-for="(item,index) in ordersList" :key="index">
29 30
         <div>
30 31
           <div style="padding:25px 20px 5px;border-bottom:2px solid #cccccc;display:flex;align-items: center;">
@@ -46,7 +47,6 @@
46 47
           <div style="padding:10px 20px;border-bottom:1px solid #cccccc;white-space: normal;">备注:{{item.Remark}}</div>
47 48
           <div style="padding:10px 20px;">下单人:{{item.UserName}}</div>
48 49
         </div>
49
-        <print-list :print-list="printList" :lodop="lodop" @printed="clearPrintList" />
50 50
         <div class="btns">
51 51
           <span @click="cancel(item.OrdersId,index)">取消</span>
52 52
           <span @click="submit(item.OrdersId,index)">确定</span>
@@ -58,7 +58,6 @@
58 58
 
59 59
 <script>
60 60
 import { createNamespacedHelpers, mapState, mapActions } from 'vuex'
61
-import { getLodop } from '@/util/LodopFuncs'
62 61
 import { formatTimeBySeconds } from '@/util/util'
63 62
 import { replaceURLParams } from '@/util/ajax'
64 63
 import XWebSocket from '@/util/websocket'
@@ -73,7 +72,6 @@ export default {
73 72
   },
74 73
   data () {
75 74
     return {
76
-      lodop: null,
77 75
       ws: null,
78 76
       wsID: '',
79 77
       printList: [],
@@ -129,11 +127,6 @@ export default {
129 127
       autoConnect: true,
130 128
     })
131 129
   },
132
-  mounted () {
133
-    this.lodop = getLodop()
134
-    this.lodop.PRINT_INIT('城咖啡订单')
135
-    this.lodop.SET_PRINT_PAGESIZE(3, 480, 40, '')
136
-  },
137 130
   beforeDestroyed () {
138 131
     this.ws.close()
139 132
   },
@@ -152,7 +145,8 @@ export default {
152 145
       this.GetOrdersList({ caseid: this.CaseId }).then(list => {
153 146
         // 打印新单
154 147
         if (list) {
155
-          this.printList = list.map(x => x.IsIntimidate === 0)
148
+          this.printList = list.filter(x => x.IsIntimidate === 0)
149
+          console.log(this.printList)
156 150
         }
157 151
 
158 152
         // 开张, 则实时监控新单
@@ -265,9 +259,9 @@ export default {
265 259
     receviedNewOrders (e) {
266 260
       const newOrders = JSON.parse(e.data).data.refreshOnlineGoodsOrders
267 261
       if (!newOrders || !newOrders.length) return
268
-      const newList = this.ordersList.concat(newOrders)
262
+
269 263
       // 放入待制作队列
270
-      this.updateList({ list: newList })
264
+      this.updateList(this.ordersList.concat(newOrders))
271 265
 
272 266
       // 放入待打队列
273 267
       const ps = newOrders.filter(x => x.IsIntimidate === 0).map((orders) => {
@@ -283,7 +277,9 @@ export default {
283 277
         })
284 278
       })
285 279
 
286
-      Promise.all(ps).then((its = []) => this.printList.concat(its.filter(x => x)))
280
+      Promise.all(ps).then((its = []) => {
281
+        this.printList.concat(its.filter(x => x))
282
+      })
287 283
     },
288 284
     open () {
289 285
       if (!this.CaseId) {

+ 15
- 6
src/pages/system/newOrder/newOrderList/print.vue 查看文件

@@ -26,23 +26,32 @@
26 26
 </template>
27 27
 
28 28
 <script>
29
+import { getLodop } from '@/util/LodopFuncs'
30
+
29 31
 export default {
30 32
   name: 'orderPrintList',
31 33
   props: [
32
-    'lodop',
33 34
     'printList',
34 35
   ],
35 36
   data () {
36
-    return {}
37
+    return {
38
+      lodop: null
39
+    }
37 40
   },
38
-  updated () {
41
+  mounted () {
39 42
     this.print()
40 43
   },
41 44
   methods: {
42 45
     print () {
43
-      if (this.$refs.printPages && this.$refs.printPages.length > 0) {
44
-        this.$refs.printPages.forEach(($el) => {
45
-          this.lodop.ADD_PRINT_HTM(0, 0, $el.offsetWidth, $el.offsetHeight, $el.innerHTML)
46
+      this.lodop = getLodop()
47
+      this.lodop.PRINT_INIT('城咖啡订单')
48
+      this.lodop.SET_PRINT_PAGESIZE(3, 480, 40, '')
49
+      let top = 0
50
+      if (this.printList && this.printList.length > 0) {
51
+        this.printList.forEach((orders) => {
52
+          const el = document.getElementsByClassName('item_' + orders.OrdersId)[0]
53
+          this.lodop.ADD_PRINT_HTM(top, 0, el.offsetWidth, el.offsetHeight, el.innerHTML)
54
+          top = top + el.offsetHeight + 40
46 55
         })
47 56
 
48 57
         this.lodop.PRINT()