yuantianjiao před 6 roky
rodič
revize
531a78cd88

+ 30
- 20
src/pages/system/newOrder/newOrderList/index.vue Zobrazit soubor

@@ -43,28 +43,33 @@
43 43
             </div>
44 44
           </div>
45 45
           <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:{{item.Remark}}</div>
46
-          <div style="padding:10px 20px;">下单人:{{item.UserName}}</div>
46
+          <div style="padding:10px 20px;" @click="printPdf(`item${index}`)">下单人:{{item.UserName}}</div>
47 47
         </div>
48 48
         <div class="print-area" :class="'item' + index" style="width:180px;">
49
-          <div style="padding:25px 20px 5px;border-bottom:2px solid #cccccc;">
49
+          <div style="padding:0px 10px 5px;border-bottom:2px solid #cccccc;">
50 50
             <div style="display:inline-block;">
51
-              <img class="topIcon" style="display:block;width:60%;margin:0 0 20px 10px;" src="http://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/upload/111101940020.png" alt="">
52
-              <span style="display:block;font-size:20px;font-weight:700;"> <img width='25px' height="25px" src="http://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/upload/111101940020.png" alt=""> {{item.AreaName}}</span>
53
-              <span style="display:block;margin-top:10px;font-size:12px;">下单时间:{{toolClass.dateFormat(item.CreateDate)}}</span>
51
+              <img class="topIcon" style="display:block;width:60%;margin:0 0 20px 0px;" src="http://jingcheng-resourceplat.oss-cn-shanghai.aliyuncs.com/upload/111101940020.png" alt="">
52
+              <span style="display:block;font-size:20px;font-weight:700;text-align: center;"> <img width='25px' height="25px" :src='item.AreaIconWhite' alt=""> {{item.AreaName}}</span>
54 53
             </div>
55 54
           </div>
56
-          <div style="padding:10px 20px 5px;border-bottom:1px solid #cccccc;" v-for='(item1,index1) in item.Goods' :key='index1'>
57
-            <div style="display:flex;justify-content: space-between;align-items: center;"><span>{{item1.GoodsName}}</span><span style="display:inline-block;width:20%;text-align:right" v-if='!item1.SpecName'>x {{item1.Number}}</span></div>
55
+          <div style="padding:10px 10px 5px;border-bottom:1px solid #cccccc;" v-for='(item1,index1) in item.Goods' :key='index1'>
56
+            <div style="display:flex;justify-content: space-between;align-items: center;font-size:12px;"><span>{{item1.GoodsName}}</span><span style="display:inline-block;width:20%;text-align:right;font-size:12px;" v-if='!item1.SpecName'>x {{item1.Number}}</span></div>
58 57
             <div style="margin-top:8px;" v-if='item1.SpecName'>
59 58
               <span style="display:inline-block;width:75%;text-align:left;color:#cccccc;font-size:12px;">{{item1.SpecName}}</span>
60 59
               <span style="display:inline-block;width:20%;text-align:right;font-size:12px;">× {{item1.Number}}</span>
61 60
             </div>
62 61
           </div>
63
-          <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:{{item.Remark}}</div>
62
+          <div style="padding:10px 10px 5px;border-bottom:1px solid #cccccc;">
63
+            <div style="font-size:12px;">下单人:{{item.UserName}}</div>
64
+            <span style="display:block;margin-top:10px;font-size:12px;">下单时间:{{toolClass.dateFormat(item.CreateDate)}}</span>
65
+          </div>
66
+          <div style="padding:10px 10px;font-size:12px;">备注:{{item.Remark}}</div>
67
+          <div style="text-align: right;font-size: 12px;">城的空间.诚咖啡</div>
68
+          <div style="height:10px"></div>
64 69
         </div>
65 70
         <div class="btns">
66
-          <span @click="cancel(item.id)">取消</span>
67
-          <span @click="submit(item.id)">确定</span>
71
+          <span @click="cancel(item.OrdersId)">取消</span>
72
+          <span @click="submit(item.OrdersId)">确定</span>
68 73
         </div>
69 74
       </div>
70 75
     </div>
@@ -164,22 +169,25 @@ export default {
164 169
       'closeBusiness',
165 170
       'checkOrder',
166 171
       'cancelOrder',
167
-      'getBusinessStatus'
172
+      'getBusinessStatus',
173
+      'updateList'
168 174
     ]),
169 175
     ...mapActions([
170 176
       'updateSystemInfo'
171 177
     ]),
172 178
     submit (id) {
179
+      console.log(id)
173 180
       this.$confirm('确定完成此饮品?', '提示', {
174 181
         confirmButtonText: '确定',
175 182
         cancelButtonText: '取消',
176 183
         type: 'warning'
177 184
       }).then((res) => {
178
-        this.checkOrder().then(() => {
185
+        this.checkOrder({ id: id }).then(() => {
179 186
           this.$message({
180 187
             type: 'success',
181 188
             message: '确认订单成功'
182 189
           })
190
+          this.init()
183 191
         })
184 192
       }).catch((res) => {
185 193
         this.$message({
@@ -194,11 +202,12 @@ export default {
194 202
         cancelButtonText: '取消',
195 203
         type: 'warning'
196 204
       }).then((res) => {
197
-        this.cancelOrder().then(() => {
205
+        this.cancelOrder({ id: id }).then(() => {
198 206
           this.$message({
199 207
             type: 'success',
200 208
             message: '取消订单成功'
201 209
           })
210
+          this.init()
202 211
         })
203 212
       }).catch((res) => {
204 213
         this.$message({
@@ -222,8 +231,8 @@ export default {
222 231
       console.log(this.user)
223 232
       let caseid = this.caseid
224 233
       let id = this.userInfo.UserId
225
-      // const wsuri = `${window.location.origin.replace('http', 'ws')}/api/common/MQ/websocket/${caseid}/${id}`
226
-      const wsuri = `ws://192.168.0.11/api/guest/MQ/websocket/${caseid}/${id}`
234
+      const wsuri = `${window.location.origin.replace('http', 'ws')}/api/common/MQ/websocket/${caseid}/${id}`
235
+      // const wsuri = `ws://192.168.0.11/api/guest/MQ/websocket/${caseid}/${id}`
227 236
       try {
228 237
         this.websock = new WebSocket(wsuri)
229 238
       } catch (e) {
@@ -238,11 +247,12 @@ export default {
238 247
       let lengthOld = this.list.length
239 248
       let lengthNew = JSON.parse(e.data).data.refreshOnlineGoodsOrders.length
240 249
       let newData = JSON.parse(e.data).data.refreshOnlineGoodsOrders.slice(lengthOld - lengthNew)
241
-      this.list = JSON.parse(e.data).data.refreshOnlineGoodsOrders
242
-      for (let i = 0; i < newData.length; i++) {
243
-        let index = newData.indexOf(this.list)
244
-        this.printPdf(`item${index}`)
245
-      }
250
+      this.updateList(JSON.parse(e.data).data.refreshOnlineGoodsOrders).then(() => {
251
+        for (let i = 0; i < newData.length; i++) {
252
+          let index = newData[i].indexOf(this.list)
253
+          this.printPdf(`item${index}`)
254
+        }
255
+      })
246 256
     },
247 257
     open () {
248 258
       if (!this.caseid) {

+ 21
- 3
src/store/goods/order.js Zobrazit soubor

@@ -44,6 +44,12 @@ export default {
44 44
         }
45 45
       })
46 46
     },
47
+    updateList ({ commit }, data) {
48
+      return new Promise((resolve) => {
49
+        commit('updateList', data)
50
+        resolve()
51
+      })
52
+    },
47 53
     openBusiness ({ commit }, caseid) {
48 54
       return new Promise((resolve) => {
49 55
         ajax(api.goodsOrder.openBusiness.url, {
@@ -78,7 +84,13 @@ export default {
78 84
             id: caseid
79 85
           }
80 86
         }).then(res => {
81
-          commit('updateBusiness', res)
87
+          let status
88
+          if (res.Status === 1) {
89
+            status = true
90
+          } else {
91
+            status = false
92
+          }
93
+          commit('updateBusiness', status)
82 94
           resolve(res)
83 95
         })
84 96
       })
@@ -86,7 +98,10 @@ export default {
86 98
     checkOrder ({ commit }, data) {
87 99
       return new Promise((resolve) => {
88 100
         ajax(api.goodsOrder.checkOrder.url, {
89
-          method: api.goodsOrder.checkOrder.method
101
+          method: api.goodsOrder.checkOrder.method,
102
+          urlData: {
103
+            id: data.id
104
+          }
90 105
         }).then(res => {
91 106
           resolve(res)
92 107
         })
@@ -95,7 +110,10 @@ export default {
95 110
     cancelOrder ({ commit }, data) {
96 111
       return new Promise((resolve) => {
97 112
         ajax(api.goodsOrder.cancelOrder.url, {
98
-          method: api.goodsOrder.cancelOrder.method
113
+          method: api.goodsOrder.cancelOrder.method,
114
+          urlData: {
115
+            id: data.id
116
+          }
99 117
         }).then(res => {
100 118
           resolve(res)
101 119
         })

+ 8
- 0
src/util/api.js Zobrazit soubor

@@ -557,6 +557,14 @@ const $api = {
557 557
     getBusinessStatus: {
558 558
       method: 'get',
559 559
       url: `${baseUrl}${common}/case/conf/:id`
560
+    },
561
+    checkOrder: {
562
+      method: 'put',
563
+      url: `${baseUrl}${common}/order/goods/finish/:id`
564
+    },
565
+    cancelOrder: {
566
+      method: 'put',
567
+      url: `${baseUrl}${common}/order/goods/cancel/:id`
560 568
     }
561 569
   },
562 570
   cardManager: {

+ 6
- 4
src/util/util.js Zobrazit soubor

@@ -28,10 +28,12 @@ const toolClass = {
28 28
 }
29 29
 
30 30
 export function formatTimeBySeconds (ms) {
31
-  const hs = ms / 3600000 | 0
32
-  const min = (ms - (hs * 3600000)) / 60000 | 0
33
-  const sec = (ms - (hs * 3600000) - (min * 60000)) / 1000 | 0
34
-
31
+  let hs = ms / 3600000 | 0
32
+  let min = (ms - (hs * 3600000)) / 60000 | 0
33
+  let sec = (ms - (hs * 3600000) - (min * 60000)) / 1000 | 0
34
+  hs = hs < 10 ? '0' + hs : hs
35
+  min = min < 10 ? '0' + min : min
36
+  sec = sec < 10 ? '0' + sec : sec
35 37
   return hs > 0 ? `${hs}:${min}:${sec}` : `${min}:${sec}`
36 38
 }
37 39