yuantianjiao před 6 roky
rodič
revize
9ce7c9078e

+ 2
- 2
config/index.js Zobrazit soubor

@@ -12,8 +12,8 @@ module.exports = {
12 12
     proxyTable: {
13 13
       '/api': {
14 14
         // target: 'https://dp.huiju360.com.cn/hj_operations',
15
-        // target: 'http://192.168.0.62:8080', //wf
16
-        target: 'http://192.168.0.11', //ys
15
+        target: 'http://192.168.0.62:8080', //wf
16
+        // target: 'http://192.168.0.11', //ys
17 17
         // target: 'http://dev.ycjcjy.com/', //frp
18 18
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
19 19
         // pathRewrite: {

+ 94
- 36
src/pages/system/newOrder/newOrderList/index.vue Zobrazit soubor

@@ -3,12 +3,12 @@
3 3
     <div class="system-table-search">
4 4
       <div class="flex-h">
5 5
         <div class="flex-item flex-h">
6
-          <el-button size="mini" type="danger">营业</el-button>
6
+          <el-button size="mini" v-if="!businessStatus" type="danger" @click="open">营业</el-button>
7
+          <el-button size="mini" v-else type="submit" @click="close">歇业</el-button>
7 8
         </div>
8 9
         <ul>
9 10
           <li>
10
-            <!-- <span>选择案场:</span> -->
11
-            <el-select v-model="CaseId" placeholder="请选择">
11
+            <el-select v-model="caseid" placeholder="请选择案场">
12 12
               <el-option
13 13
                 v-for="item in cases"
14 14
                 :key="item.CaseId"
@@ -20,7 +20,7 @@
20 20
         </ul>
21 21
         <el-button
22 22
           size="mini"
23
-          type="primary" @click="GetOrdersList({ caseid: CaseId })">搜索</el-button>
23
+          type="primary" @click="init">搜索</el-button>
24 24
       </div>
25 25
       <div class="moreFilter"></div>
26 26
     </div>
@@ -39,7 +39,7 @@
39 39
             <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>
40 40
             <div style="margin-top:8px;" v-if='item1.SpecName'>
41 41
               <span style="display:inline-block;width:75%;text-align:left;color:#cccccc">{{item1.SpecName}}</span>
42
-              <span style="display:inline-block;width:20%;text-align:right">x {{item1.Number}}</span>
42
+              <span style="display:inline-block;width:20%;text-align:right">× {{item1.Number}}</span>
43 43
             </div>
44 44
           </div>
45 45
           <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:{{item.Remark}}</div>
@@ -51,22 +51,20 @@
51 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 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 53
               <span style="display:block;margin-top:10px;font-size:12px;">下单时间:{{toolClass.dateFormat(item.CreateDate)}}</span>
54
-              <span style="display:block;margin-top:10px;font-size:12px;">已等待:<span style="color:red;font-weight:700;">{{leftTimes[item.OrdersId]}}</span></span>
55 54
             </div>
56 55
           </div>
57 56
           <div style="padding:10px 20px 5px;border-bottom:1px solid #cccccc;" v-for='(item1,index1) in item.Goods' :key='index1'>
58 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>
59 58
             <div style="margin-top:8px;" v-if='item1.SpecName'>
60 59
               <span style="display:inline-block;width:75%;text-align:left;color:#cccccc;font-size:12px;">{{item1.SpecName}}</span>
61
-              <span style="display:inline-block;width:20%;text-align:right;font-size:12px;">x {{item1.Number}}</span>
60
+              <span style="display:inline-block;width:20%;text-align:right;font-size:12px;">× {{item1.Number}}</span>
62 61
             </div>
63 62
           </div>
64 63
           <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:{{item.Remark}}</div>
65
-          <div style="padding:10px 20px;">下单人:{{item.UserName}}</div>
66 64
         </div>
67 65
         <div class="btns">
68
-          <span @click="cancel">取消</span>
69
-          <span @click="submit(`item${index}`)">确定</span>
66
+          <span @click="cancel(item.id)">取消</span>
67
+          <span @click="submit(item.id)">确定</span>
70 68
         </div>
71 69
       </div>
72 70
     </div>
@@ -95,11 +93,15 @@ export default {
95 93
       },
96 94
       currentList: [],
97 95
       leftTimes: {},
96
+      business: false,
97
+      caseid: '',
98
+      interval: () => { }
98 99
     }
99 100
   },
100 101
   computed: {
101 102
     ...mapOrderState({
102 103
       list: x => (x.ordersList || {}).list || [],
104
+      businessStatus: x => x.businessStatus
103 105
     }),
104 106
     ...mapState({
105 107
       cases: x => x.app.cases.list,
@@ -117,20 +119,35 @@ export default {
117 119
   },
118 120
   created () {
119 121
     this.updateSystemInfo().then(() => {
120
-      this.initWebSocket()
121
-      this.GetOrdersList({ caseid: this.CaseId }).then(() => {
122
-        setInterval(() => {
122
+      if (this.caseid) {
123
+        this.init()
124
+      }
125
+    })
126
+  },
127
+  methods: {
128
+    init () {
129
+      if (!this.caseid) {
130
+        this.$message({
131
+          type: 'info',
132
+          message: '请先选择案场'
133
+        })
134
+        return
135
+      }
136
+      this.getBusinessStatus(this.caseid)
137
+      clearInterval(this.interval)
138
+      this.GetOrdersList({ caseid: this.caseid }).then(() => {
139
+        if (this.business) {
140
+          this.initWebSocket()
141
+        }
142
+        this.interval = setInterval(() => {
123 143
           const now = (new Date()).valueOf()
124 144
           this.leftTimes = this.list.reduce((acc, it) => {
125 145
             const showDT = now - ((new Date(it.CreateDate)).valueOf())
126
-
127 146
             return { ...acc, [`${it.OrdersId}`]: formatTimeBySeconds(showDT) }
128 147
           }, {})
129 148
         }, 1000)
130 149
       })
131
-    })
132
-  },
133
-  methods: {
150
+    },
134 151
     timeOut (c) {
135 152
       let cTime = new Date(c).valueOf()
136 153
       let time = new Date().valueOf()
@@ -143,52 +160,67 @@ export default {
143 160
     },
144 161
     ...mapOrderActions([
145 162
       'GetOrdersList',
163
+      'openBusiness',
164
+      'closeBusiness',
165
+      'checkOrder',
166
+      'cancelOrder',
167
+      'getBusinessStatus'
146 168
     ]),
147 169
     ...mapActions([
148 170
       'updateSystemInfo'
149 171
     ]),
150
-    submit (cl) {
172
+    submit (id) {
151 173
       this.$confirm('确定完成此饮品?', '提示', {
152 174
         confirmButtonText: '确定',
153 175
         cancelButtonText: '取消',
154 176
         type: 'warning'
155 177
       }).then((res) => {
156
-        this.printPdf(cl)
178
+        this.checkOrder().then(() => {
179
+          this.$message({
180
+            type: 'success',
181
+            message: '确认订单成功'
182
+          })
183
+        })
157 184
       }).catch((res) => {
158 185
         this.$message({
159 186
           type: 'info',
160
-          message: '已取消'
187
+          message: '已取消操作'
161 188
         })
162 189
       })
163 190
     },
164
-    printPdf (cl) {
165
-      this.CreateOneFormPage(cl)
166
-      LODOP.PRINT()
167
-      // LODOP.PREVIEW()
168
-    },
169
-    CreateOneFormPage (cl) {
170
-      LODOP = getLodop()
171
-      LODOP.PRINT_INIT('订单')
172
-      LODOP.SET_PRINT_PAGESIZE(3, 480, 40, '')
173
-      LODOP.ADD_PRINT_HTM(0, 0, document.getElementsByClassName(cl)[0].offsetWidth, document.getElementsByClassName(cl)[0].offsetHeight, document.getElementsByClassName(cl)[0].innerHTML)
174
-    },
175
-    cancel () {
191
+    cancel (id) {
176 192
       this.$confirm('确定取消此饮品?', '提示', {
177 193
         confirmButtonText: '确定',
178 194
         cancelButtonText: '取消',
179 195
         type: 'warning'
180 196
       }).then((res) => {
181
-        // this.cancel()
197
+        this.cancelOrder().then(() => {
198
+          this.$message({
199
+            type: 'success',
200
+            message: '取消订单成功'
201
+          })
202
+        })
182 203
       }).catch((res) => {
183 204
         this.$message({
184 205
           type: 'info',
185
-          message: '已取消'
206
+          message: '已取消操作'
186 207
         })
187 208
       })
188 209
     },
210
+    printPdf (cl) {
211
+      this.CreateOneFormPage(cl)
212
+      LODOP.PRINT()
213
+      // LODOP.PREVIEW()
214
+    },
215
+    CreateOneFormPage (cl) {
216
+      LODOP = getLodop()
217
+      LODOP.PRINT_INIT('订单')
218
+      LODOP.SET_PRINT_PAGESIZE(3, 480, 40, '')
219
+      LODOP.ADD_PRINT_HTM(0, 0, document.getElementsByClassName(cl)[0].offsetWidth, document.getElementsByClassName(cl)[0].offsetHeight, document.getElementsByClassName(cl)[0].innerHTML)
220
+    },
189 221
     initWebSocket () {
190 222
       console.log(this.user)
191
-      let caseid = this.defaultCaseId
223
+      let caseid = this.caseid
192 224
       let id = this.userInfo.UserId
193 225
       // const wsuri = `${window.location.origin.replace('http', 'ws')}/api/common/MQ/websocket/${caseid}/${id}`
194 226
       const wsuri = `ws://192.168.0.11/api/guest/MQ/websocket/${caseid}/${id}`
@@ -203,8 +235,34 @@ export default {
203 235
     },
204 236
     websocketonmessage (e) {
205 237
       console.log(e)
206
-      // const redata = JSON.parse(e.data)
238
+      let lengthOld = this.list.length
239
+      let lengthNew = JSON.parse(e.data).data.refreshOnlineGoodsOrders.length
240
+      let newData = JSON.parse(e.data).data.refreshOnlineGoodsOrders.slice(lengthOld - lengthNew)
207 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
+      }
246
+    },
247
+    open () {
248
+      if (!this.caseid) {
249
+        this.$message({
250
+          type: 'info',
251
+          message: '请先选择案场'
252
+        })
253
+        return
254
+      }
255
+      this.openBusiness(this.caseid)
256
+    },
257
+    close () {
258
+      if (!this.caseid) {
259
+        this.$message({
260
+          type: 'info',
261
+          message: '请先选择案场'
262
+        })
263
+        return
264
+      }
265
+      this.closeBusiness(this.caseid)
208 266
     }
209 267
   }
210 268
 }

+ 0
- 2
src/pages/system/newOrder/newOrderList/page.scss Zobrazit soubor

@@ -4,8 +4,6 @@
4 4
   overflow: scroll;
5 5
   width: auto;
6 6
   height: 600px;
7
-  display: flex;
8
-  flex-flow: column wrap;
9 7
   margin-top: 10px;
10 8
   >div{
11 9
     display: inline-block;

+ 62
- 0
src/store/goods/order.js Zobrazit soubor

@@ -6,6 +6,8 @@ export default {
6 6
   state: {
7 7
     ordersList: [],
8 8
     recordOrders: [],
9
+    business: false,
10
+    businessStatus: false
9 11
   },
10 12
   mutations: {
11 13
     updateList (state, payload) {
@@ -14,6 +16,9 @@ export default {
14 16
     updateRecordList (state, payload) {
15 17
       state.recordOrders = payload || []
16 18
     },
19
+    updateBusiness (state, data) {
20
+      state.businessStatus = data
21
+    }
17 22
   },
18 23
   actions: {
19 24
     GetOrdersList ({ commit }, payload) {
@@ -38,6 +43,63 @@ export default {
38 43
           callback()
39 44
         }
40 45
       })
46
+    },
47
+    openBusiness ({ commit }, caseid) {
48
+      return new Promise((resolve) => {
49
+        ajax(api.goodsOrder.openBusiness.url, {
50
+          method: api.goodsOrder.openBusiness.method,
51
+          urlData: {
52
+            caseid
53
+          }
54
+        }).then(res => {
55
+          commit('updateBusiness', true)
56
+          resolve(res)
57
+        })
58
+      })
59
+    },
60
+    closeBusiness ({ commit }, caseid) {
61
+      return new Promise((resolve) => {
62
+        ajax(api.goodsOrder.closeBusiness.url, {
63
+          method: api.goodsOrder.closeBusiness.method,
64
+          urlData: {
65
+            caseid
66
+          }
67
+        }).then(res => {
68
+          commit('updateBusiness', false)
69
+          resolve(res)
70
+        })
71
+      })
72
+    },
73
+    getBusinessStatus ({ commit }, caseid) {
74
+      return new Promise((resolve) => {
75
+        ajax(api.goodsOrder.getBusinessStatus.url, {
76
+          method: api.goodsOrder.getBusinessStatus.method,
77
+          urlData: {
78
+            id: caseid
79
+          }
80
+        }).then(res => {
81
+          commit('updateBusiness', res)
82
+          resolve(res)
83
+        })
84
+      })
85
+    },
86
+    checkOrder ({ commit }, data) {
87
+      return new Promise((resolve) => {
88
+        ajax(api.goodsOrder.checkOrder.url, {
89
+          method: api.goodsOrder.checkOrder.method
90
+        }).then(res => {
91
+          resolve(res)
92
+        })
93
+      })
94
+    },
95
+    cancelOrder ({ commit }, data) {
96
+      return new Promise((resolve) => {
97
+        ajax(api.goodsOrder.cancelOrder.url, {
98
+          method: api.goodsOrder.cancelOrder.method
99
+        }).then(res => {
100
+          resolve(res)
101
+        })
102
+      })
41 103
     }
42 104
   }
43 105
 }

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

@@ -546,6 +546,18 @@ const $api = {
546 546
       method: 'get',
547 547
       url: `${baseUrl}${common}/order/goods/record/:id`
548 548
     },
549
+    openBusiness: {
550
+      method: 'put',
551
+      url: `${baseUrl}${common}/case/open/:caseid`
552
+    },
553
+    closeBusiness: {
554
+      method: 'put',
555
+      url: `${baseUrl}${common}/case/close/:caseid`
556
+    },
557
+    getBusinessStatus: {
558
+      method: 'get',
559
+      url: `${baseUrl}${common}/case/conf/:id`
560
+    }
549 561
   },
550 562
   cardManager: {
551 563
     viplist: {