yuantianjiao пре 6 година
родитељ
комит
531a78cd88
4 измењених фајлова са 65 додато и 27 уклоњено
  1. 30
    20
      src/pages/system/newOrder/newOrderList/index.vue
  2. 21
    3
      src/store/goods/order.js
  3. 8
    0
      src/util/api.js
  4. 6
    4
      src/util/util.js

+ 30
- 20
src/pages/system/newOrder/newOrderList/index.vue Прегледај датотеку

43
             </div>
43
             </div>
44
           </div>
44
           </div>
45
           <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:{{item.Remark}}</div>
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
         </div>
47
         </div>
48
         <div class="print-area" :class="'item' + index" style="width:180px;">
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
             <div style="display:inline-block;">
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
             </div>
53
             </div>
55
           </div>
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
             <div style="margin-top:8px;" v-if='item1.SpecName'>
57
             <div style="margin-top:8px;" v-if='item1.SpecName'>
59
               <span style="display:inline-block;width:75%;text-align:left;color:#cccccc;font-size:12px;">{{item1.SpecName}}</span>
58
               <span style="display:inline-block;width:75%;text-align:left;color:#cccccc;font-size:12px;">{{item1.SpecName}}</span>
60
               <span style="display:inline-block;width:20%;text-align:right;font-size:12px;">× {{item1.Number}}</span>
59
               <span style="display:inline-block;width:20%;text-align:right;font-size:12px;">× {{item1.Number}}</span>
61
             </div>
60
             </div>
62
           </div>
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
         </div>
69
         </div>
65
         <div class="btns">
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
         </div>
73
         </div>
69
       </div>
74
       </div>
70
     </div>
75
     </div>
164
       'closeBusiness',
169
       'closeBusiness',
165
       'checkOrder',
170
       'checkOrder',
166
       'cancelOrder',
171
       'cancelOrder',
167
-      'getBusinessStatus'
172
+      'getBusinessStatus',
173
+      'updateList'
168
     ]),
174
     ]),
169
     ...mapActions([
175
     ...mapActions([
170
       'updateSystemInfo'
176
       'updateSystemInfo'
171
     ]),
177
     ]),
172
     submit (id) {
178
     submit (id) {
179
+      console.log(id)
173
       this.$confirm('确定完成此饮品?', '提示', {
180
       this.$confirm('确定完成此饮品?', '提示', {
174
         confirmButtonText: '确定',
181
         confirmButtonText: '确定',
175
         cancelButtonText: '取消',
182
         cancelButtonText: '取消',
176
         type: 'warning'
183
         type: 'warning'
177
       }).then((res) => {
184
       }).then((res) => {
178
-        this.checkOrder().then(() => {
185
+        this.checkOrder({ id: id }).then(() => {
179
           this.$message({
186
           this.$message({
180
             type: 'success',
187
             type: 'success',
181
             message: '确认订单成功'
188
             message: '确认订单成功'
182
           })
189
           })
190
+          this.init()
183
         })
191
         })
184
       }).catch((res) => {
192
       }).catch((res) => {
185
         this.$message({
193
         this.$message({
194
         cancelButtonText: '取消',
202
         cancelButtonText: '取消',
195
         type: 'warning'
203
         type: 'warning'
196
       }).then((res) => {
204
       }).then((res) => {
197
-        this.cancelOrder().then(() => {
205
+        this.cancelOrder({ id: id }).then(() => {
198
           this.$message({
206
           this.$message({
199
             type: 'success',
207
             type: 'success',
200
             message: '取消订单成功'
208
             message: '取消订单成功'
201
           })
209
           })
210
+          this.init()
202
         })
211
         })
203
       }).catch((res) => {
212
       }).catch((res) => {
204
         this.$message({
213
         this.$message({
222
       console.log(this.user)
231
       console.log(this.user)
223
       let caseid = this.caseid
232
       let caseid = this.caseid
224
       let id = this.userInfo.UserId
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
       try {
236
       try {
228
         this.websock = new WebSocket(wsuri)
237
         this.websock = new WebSocket(wsuri)
229
       } catch (e) {
238
       } catch (e) {
238
       let lengthOld = this.list.length
247
       let lengthOld = this.list.length
239
       let lengthNew = JSON.parse(e.data).data.refreshOnlineGoodsOrders.length
248
       let lengthNew = JSON.parse(e.data).data.refreshOnlineGoodsOrders.length
240
       let newData = JSON.parse(e.data).data.refreshOnlineGoodsOrders.slice(lengthOld - lengthNew)
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
     open () {
257
     open () {
248
       if (!this.caseid) {
258
       if (!this.caseid) {

+ 21
- 3
src/store/goods/order.js Прегледај датотеку

44
         }
44
         }
45
       })
45
       })
46
     },
46
     },
47
+    updateList ({ commit }, data) {
48
+      return new Promise((resolve) => {
49
+        commit('updateList', data)
50
+        resolve()
51
+      })
52
+    },
47
     openBusiness ({ commit }, caseid) {
53
     openBusiness ({ commit }, caseid) {
48
       return new Promise((resolve) => {
54
       return new Promise((resolve) => {
49
         ajax(api.goodsOrder.openBusiness.url, {
55
         ajax(api.goodsOrder.openBusiness.url, {
78
             id: caseid
84
             id: caseid
79
           }
85
           }
80
         }).then(res => {
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
           resolve(res)
94
           resolve(res)
83
         })
95
         })
84
       })
96
       })
86
     checkOrder ({ commit }, data) {
98
     checkOrder ({ commit }, data) {
87
       return new Promise((resolve) => {
99
       return new Promise((resolve) => {
88
         ajax(api.goodsOrder.checkOrder.url, {
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
         }).then(res => {
105
         }).then(res => {
91
           resolve(res)
106
           resolve(res)
92
         })
107
         })
95
     cancelOrder ({ commit }, data) {
110
     cancelOrder ({ commit }, data) {
96
       return new Promise((resolve) => {
111
       return new Promise((resolve) => {
97
         ajax(api.goodsOrder.cancelOrder.url, {
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
         }).then(res => {
117
         }).then(res => {
100
           resolve(res)
118
           resolve(res)
101
         })
119
         })

+ 8
- 0
src/util/api.js Прегледај датотеку

557
     getBusinessStatus: {
557
     getBusinessStatus: {
558
       method: 'get',
558
       method: 'get',
559
       url: `${baseUrl}${common}/case/conf/:id`
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
   cardManager: {
570
   cardManager: {

+ 6
- 4
src/util/util.js Прегледај датотеку

28
 }
28
 }
29
 
29
 
30
 export function formatTimeBySeconds (ms) {
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
   return hs > 0 ? `${hs}:${min}:${sec}` : `${min}:${sec}`
37
   return hs > 0 ? `${hs}:${min}:${sec}` : `${min}:${sec}`
36
 }
38
 }
37
 
39