yuantianjiao 6 years ago
parent
commit
9ce7c9078e

+ 2
- 2
config/index.js View File

12
     proxyTable: {
12
     proxyTable: {
13
       '/api': {
13
       '/api': {
14
         // target: 'https://dp.huiju360.com.cn/hj_operations',
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
         // target: 'http://dev.ycjcjy.com/', //frp
17
         // target: 'http://dev.ycjcjy.com/', //frp
18
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
18
         changeOrigin: true, // 如果接口跨域,需要进行这个参数配置
19
         // pathRewrite: {
19
         // pathRewrite: {

+ 94
- 36
src/pages/system/newOrder/newOrderList/index.vue View File

3
     <div class="system-table-search">
3
     <div class="system-table-search">
4
       <div class="flex-h">
4
       <div class="flex-h">
5
         <div class="flex-item flex-h">
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
         </div>
8
         </div>
8
         <ul>
9
         <ul>
9
           <li>
10
           <li>
10
-            <!-- <span>选择案场:</span> -->
11
-            <el-select v-model="CaseId" placeholder="请选择">
11
+            <el-select v-model="caseid" placeholder="请选择案场">
12
               <el-option
12
               <el-option
13
                 v-for="item in cases"
13
                 v-for="item in cases"
14
                 :key="item.CaseId"
14
                 :key="item.CaseId"
20
         </ul>
20
         </ul>
21
         <el-button
21
         <el-button
22
           size="mini"
22
           size="mini"
23
-          type="primary" @click="GetOrdersList({ caseid: CaseId })">搜索</el-button>
23
+          type="primary" @click="init">搜索</el-button>
24
       </div>
24
       </div>
25
       <div class="moreFilter"></div>
25
       <div class="moreFilter"></div>
26
     </div>
26
     </div>
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>
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
             <div style="margin-top:8px;" v-if='item1.SpecName'>
40
             <div style="margin-top:8px;" v-if='item1.SpecName'>
41
               <span style="display:inline-block;width:75%;text-align:left;color:#cccccc">{{item1.SpecName}}</span>
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
             </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>
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="">
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>
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>
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
             </div>
54
             </div>
56
           </div>
55
           </div>
57
           <div style="padding:10px 20px 5px;border-bottom:1px solid #cccccc;" v-for='(item1,index1) in item.Goods' :key='index1'>
56
           <div style="padding:10px 20px 5px;border-bottom:1px solid #cccccc;" v-for='(item1,index1) in item.Goods' :key='index1'>
58
             <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>
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
             <div style="margin-top:8px;" v-if='item1.SpecName'>
58
             <div style="margin-top:8px;" v-if='item1.SpecName'>
60
               <span style="display:inline-block;width:75%;text-align:left;color:#cccccc;font-size:12px;">{{item1.SpecName}}</span>
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
             </div>
61
             </div>
63
           </div>
62
           </div>
64
           <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:{{item.Remark}}</div>
63
           <div style="padding:10px 20px;border-bottom:1px solid #cccccc">备注:{{item.Remark}}</div>
65
-          <div style="padding:10px 20px;">下单人:{{item.UserName}}</div>
66
         </div>
64
         </div>
67
         <div class="btns">
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
         </div>
68
         </div>
71
       </div>
69
       </div>
72
     </div>
70
     </div>
95
       },
93
       },
96
       currentList: [],
94
       currentList: [],
97
       leftTimes: {},
95
       leftTimes: {},
96
+      business: false,
97
+      caseid: '',
98
+      interval: () => { }
98
     }
99
     }
99
   },
100
   },
100
   computed: {
101
   computed: {
101
     ...mapOrderState({
102
     ...mapOrderState({
102
       list: x => (x.ordersList || {}).list || [],
103
       list: x => (x.ordersList || {}).list || [],
104
+      businessStatus: x => x.businessStatus
103
     }),
105
     }),
104
     ...mapState({
106
     ...mapState({
105
       cases: x => x.app.cases.list,
107
       cases: x => x.app.cases.list,
117
   },
119
   },
118
   created () {
120
   created () {
119
     this.updateSystemInfo().then(() => {
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
           const now = (new Date()).valueOf()
143
           const now = (new Date()).valueOf()
124
           this.leftTimes = this.list.reduce((acc, it) => {
144
           this.leftTimes = this.list.reduce((acc, it) => {
125
             const showDT = now - ((new Date(it.CreateDate)).valueOf())
145
             const showDT = now - ((new Date(it.CreateDate)).valueOf())
126
-
127
             return { ...acc, [`${it.OrdersId}`]: formatTimeBySeconds(showDT) }
146
             return { ...acc, [`${it.OrdersId}`]: formatTimeBySeconds(showDT) }
128
           }, {})
147
           }, {})
129
         }, 1000)
148
         }, 1000)
130
       })
149
       })
131
-    })
132
-  },
133
-  methods: {
150
+    },
134
     timeOut (c) {
151
     timeOut (c) {
135
       let cTime = new Date(c).valueOf()
152
       let cTime = new Date(c).valueOf()
136
       let time = new Date().valueOf()
153
       let time = new Date().valueOf()
143
     },
160
     },
144
     ...mapOrderActions([
161
     ...mapOrderActions([
145
       'GetOrdersList',
162
       'GetOrdersList',
163
+      'openBusiness',
164
+      'closeBusiness',
165
+      'checkOrder',
166
+      'cancelOrder',
167
+      'getBusinessStatus'
146
     ]),
168
     ]),
147
     ...mapActions([
169
     ...mapActions([
148
       'updateSystemInfo'
170
       'updateSystemInfo'
149
     ]),
171
     ]),
150
-    submit (cl) {
172
+    submit (id) {
151
       this.$confirm('确定完成此饮品?', '提示', {
173
       this.$confirm('确定完成此饮品?', '提示', {
152
         confirmButtonText: '确定',
174
         confirmButtonText: '确定',
153
         cancelButtonText: '取消',
175
         cancelButtonText: '取消',
154
         type: 'warning'
176
         type: 'warning'
155
       }).then((res) => {
177
       }).then((res) => {
156
-        this.printPdf(cl)
178
+        this.checkOrder().then(() => {
179
+          this.$message({
180
+            type: 'success',
181
+            message: '确认订单成功'
182
+          })
183
+        })
157
       }).catch((res) => {
184
       }).catch((res) => {
158
         this.$message({
185
         this.$message({
159
           type: 'info',
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
       this.$confirm('确定取消此饮品?', '提示', {
192
       this.$confirm('确定取消此饮品?', '提示', {
177
         confirmButtonText: '确定',
193
         confirmButtonText: '确定',
178
         cancelButtonText: '取消',
194
         cancelButtonText: '取消',
179
         type: 'warning'
195
         type: 'warning'
180
       }).then((res) => {
196
       }).then((res) => {
181
-        // this.cancel()
197
+        this.cancelOrder().then(() => {
198
+          this.$message({
199
+            type: 'success',
200
+            message: '取消订单成功'
201
+          })
202
+        })
182
       }).catch((res) => {
203
       }).catch((res) => {
183
         this.$message({
204
         this.$message({
184
           type: 'info',
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
     initWebSocket () {
221
     initWebSocket () {
190
       console.log(this.user)
222
       console.log(this.user)
191
-      let caseid = this.defaultCaseId
223
+      let caseid = this.caseid
192
       let id = this.userInfo.UserId
224
       let id = this.userInfo.UserId
193
       // const wsuri = `${window.location.origin.replace('http', 'ws')}/api/common/MQ/websocket/${caseid}/${id}`
225
       // const wsuri = `${window.location.origin.replace('http', 'ws')}/api/common/MQ/websocket/${caseid}/${id}`
194
       const wsuri = `ws://192.168.0.11/api/guest/MQ/websocket/${caseid}/${id}`
226
       const wsuri = `ws://192.168.0.11/api/guest/MQ/websocket/${caseid}/${id}`
203
     },
235
     },
204
     websocketonmessage (e) {
236
     websocketonmessage (e) {
205
       console.log(e)
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
       this.list = JSON.parse(e.data).data.refreshOnlineGoodsOrders
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 View File

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

+ 62
- 0
src/store/goods/order.js View File

6
   state: {
6
   state: {
7
     ordersList: [],
7
     ordersList: [],
8
     recordOrders: [],
8
     recordOrders: [],
9
+    business: false,
10
+    businessStatus: false
9
   },
11
   },
10
   mutations: {
12
   mutations: {
11
     updateList (state, payload) {
13
     updateList (state, payload) {
14
     updateRecordList (state, payload) {
16
     updateRecordList (state, payload) {
15
       state.recordOrders = payload || []
17
       state.recordOrders = payload || []
16
     },
18
     },
19
+    updateBusiness (state, data) {
20
+      state.businessStatus = data
21
+    }
17
   },
22
   },
18
   actions: {
23
   actions: {
19
     GetOrdersList ({ commit }, payload) {
24
     GetOrdersList ({ commit }, payload) {
38
           callback()
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 View File

546
       method: 'get',
546
       method: 'get',
547
       url: `${baseUrl}${common}/order/goods/record/:id`
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
   cardManager: {
562
   cardManager: {
551
     viplist: {
563
     viplist: {