|
@@ -16,7 +16,7 @@
|
16
|
16
|
<div class="flex-item">
|
17
|
17
|
<div>
|
18
|
18
|
<span>桌号:{{tableNo}}</span>
|
19
|
|
- <!-- <span>本月已用:150杯</span> -->
|
|
19
|
+ <span v-if="userInfo.customer.MapUser !== ''">本月已用:{{caseTotal.monthtotal}}杯</span>
|
20
|
20
|
</div>
|
21
|
21
|
</div>
|
22
|
22
|
<a @click="reback">返回选择桌号</a>
|
|
@@ -78,6 +78,7 @@
|
78
|
78
|
<script>
|
79
|
79
|
import { mapState, createNamespacedHelpers } from 'vuex'
|
80
|
80
|
const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
|
|
81
|
+const { mapState: mapCaseState, mapActions: mapCaseActions } = createNamespacedHelpers('case')
|
81
|
82
|
import orderItem from '../../../components/orderItem/index'
|
82
|
83
|
import orderPopup from '../../../components/orderPopup/index'
|
83
|
84
|
import calcMenu from '../../../components/calcMenu/index'
|
|
@@ -89,6 +90,20 @@ export default {
|
89
|
90
|
data () {
|
90
|
91
|
const _self = this
|
91
|
92
|
return {
|
|
93
|
+ postData: {
|
|
94
|
+ info: {
|
|
95
|
+ CaseId: decodeURI(_self.$route.query.caseid),
|
|
96
|
+ AreaId: decodeURI(_self.$route.query.areaid),
|
|
97
|
+ AreaName: decodeURI(_self.$route.query.areaname),
|
|
98
|
+ TableId: decodeURI(_self.$route.query.tableid),
|
|
99
|
+ TableNo: decodeURI(_self.$route.query.tableno),
|
|
100
|
+ Amount: 0, // 订单金额
|
|
101
|
+ OrdersNum: 0,
|
|
102
|
+ Remark: '',
|
|
103
|
+ },
|
|
104
|
+ detail: [],
|
|
105
|
+ coupon: [],
|
|
106
|
+ },
|
92
|
107
|
tableNo: decodeURI(this.$route.query.tableno),
|
93
|
108
|
tableId: decodeURI(this.$route.query.tableid),
|
94
|
109
|
areaId: decodeURI(this.$route.query.areaid),
|
|
@@ -131,6 +146,9 @@ export default {
|
131
|
146
|
goodsTypeList: x => x.placeOrderForCoffee.goodsTypeList,
|
132
|
147
|
goodsList: x => x.placeOrderForCoffee.goodsList
|
133
|
148
|
}),
|
|
149
|
+ ...mapCaseState({
|
|
150
|
+ caseTotal: x => x.caseTotal,
|
|
151
|
+ }),
|
134
|
152
|
MySwiper () {
|
135
|
153
|
return this.$refs.mySwiper.swiper
|
136
|
154
|
},
|
|
@@ -147,7 +165,7 @@ export default {
|
147
|
165
|
sumPrice () {
|
148
|
166
|
let price = 0
|
149
|
167
|
this.selGoods.map(x => {
|
150
|
|
- price += x.price*x.num - 0
|
|
168
|
+ price += x.price * x.num - 0
|
151
|
169
|
})
|
152
|
170
|
return price
|
153
|
171
|
}
|
|
@@ -170,17 +188,28 @@ export default {
|
170
|
188
|
// console.log(JSON.stringify(res))
|
171
|
189
|
this.mapArr()
|
172
|
190
|
})
|
|
191
|
+ this.getCaseTotal({
|
|
192
|
+ caseid: this.caseId
|
|
193
|
+ })
|
173
|
194
|
})
|
174
|
195
|
},
|
175
|
196
|
methods: {
|
176
|
197
|
...caseTableActions([
|
177
|
198
|
'getGoodsTypeList',
|
178
|
199
|
'getGoodsList',
|
|
200
|
+ 'toPay',
|
|
201
|
+ ]),
|
|
202
|
+ ...mapCaseActions([
|
|
203
|
+ 'getCaseTotal',
|
179
|
204
|
]),
|
180
|
205
|
toPlaceOrder () { // 下单
|
181
|
|
- if(this.selGoods.length){
|
182
|
|
- this.$router.push({name: 'placeOrderDetail', query: {info: JSON.stringify(this.selGoods), caseid: encodeURI(this.caseId), areaid: encodeURI(this.areaId), areaname: encodeURI(this.areaName), areaid: encodeURI(this.areaId), tableid: encodeURI(this.tableId), tableno: encodeURI(this.tableNo)}})
|
183
|
|
- }else{
|
|
206
|
+ if (this.selGoods.length) {
|
|
207
|
+ if (this.userInfo.customer.MapUser === '') {
|
|
208
|
+ this.$router.push({ name: 'placeOrderDetail', query: { info: JSON.stringify(this.selGoods), caseid: encodeURI(this.caseId), areaid: encodeURI(this.areaId), areaname: encodeURI(this.areaName), areaid: encodeURI(this.areaId), tableid: encodeURI(this.tableId), tableno: encodeURI(this.tableNo) } })
|
|
209
|
+ } else {
|
|
210
|
+ this.showCalcMenu = true
|
|
211
|
+ }
|
|
212
|
+ } else {
|
184
|
213
|
this.$toast('您还没有选择商品哦~')
|
185
|
214
|
}
|
186
|
215
|
},
|
|
@@ -236,7 +265,41 @@ export default {
|
236
|
265
|
})
|
237
|
266
|
},
|
238
|
267
|
placeOrder () { // 下单
|
239
|
|
- this.$router.push({ name: 'orderList', query: {} })
|
|
268
|
+ // this.$router.push({ name: 'orderList', query: {} })
|
|
269
|
+ this.postData.info.OrgId = this.orgId
|
|
270
|
+ this.postData.info.UserId = this.userInfo.CustomerId
|
|
271
|
+ this.postData.info.UserName = this.userInfo.customer.CustomerName
|
|
272
|
+ this.postData.info.PayType = 'sys user'
|
|
273
|
+ var orderInfo = this.selGoods
|
|
274
|
+ this.postData.detail = []
|
|
275
|
+ var amount = 0
|
|
276
|
+ var num = 0
|
|
277
|
+ for (var n = 0; n < orderInfo.length; n++) {
|
|
278
|
+ this.postData.detail.push({
|
|
279
|
+ GoodsId: orderInfo[n].id,
|
|
280
|
+ GoodsName: orderInfo[n].name,
|
|
281
|
+ SpecId: orderInfo[n].spec,
|
|
282
|
+ SpecName: orderInfo[n].specname,
|
|
283
|
+ Number: orderInfo[n].num - 0,
|
|
284
|
+ Price: String(orderInfo[n].price-0),
|
|
285
|
+ })
|
|
286
|
+ amount += (orderInfo[n].price-0) * orderInfo[n].num
|
|
287
|
+ num += orderInfo[n].num-0
|
|
288
|
+ }
|
|
289
|
+ this.postData.info.Amount = String(amount)
|
|
290
|
+ this.postData.info.OrdersNum = num
|
|
291
|
+ // console.log(JSON.stringify(this.postData))
|
|
292
|
+ this.toPay({
|
|
293
|
+ info: JSON.stringify(this.postData.info),
|
|
294
|
+ detail: JSON.stringify(this.postData.detail),
|
|
295
|
+ coupon: JSON.stringify(this.postData.coupon)
|
|
296
|
+ }).then((res) => {
|
|
297
|
+ this.$dialog.alert({
|
|
298
|
+ message: '下单成功!'
|
|
299
|
+ }).then(() => {
|
|
300
|
+ this.$router.push({name: 'orderList'})
|
|
301
|
+ })
|
|
302
|
+ })
|
240
|
303
|
},
|
241
|
304
|
closeCalcMenu () { // 关闭已选菜单
|
242
|
305
|
this.showCalcMenu = false
|
|
@@ -249,7 +312,6 @@ export default {
|
249
|
312
|
this.currentSpec = null
|
250
|
313
|
},
|
251
|
314
|
selectSpec (val) { // 选规格
|
252
|
|
- console.log(val)
|
253
|
315
|
this.currentSpec = val
|
254
|
316
|
this.showPopup = true
|
255
|
317
|
},
|
|
@@ -259,8 +321,8 @@ export default {
|
259
|
321
|
calcMenus (val) { // 计算清单
|
260
|
322
|
var ishas = false
|
261
|
323
|
const _that = this
|
262
|
|
- this.selGoods.map((goods,inx) => {
|
263
|
|
- if(goods.id === val.id && goods.spec === (val.spec || '')){
|
|
324
|
+ this.selGoods.map((goods, inx) => {
|
|
325
|
+ if (goods.id === val.id && goods.spec === (val.spec || '')) {
|
264
|
326
|
ishas = true
|
265
|
327
|
_that.selGoods[inx].num = val.defaultNum
|
266
|
328
|
}
|
|
@@ -275,43 +337,6 @@ export default {
|
275
|
337
|
specname: (val.specname || ''),
|
276
|
338
|
})
|
277
|
339
|
}
|
278
|
|
- console.log(this.selGoods)
|
279
|
|
- // var settlementList = this.settlementList
|
280
|
|
- // val.spec.map(spec => {
|
281
|
|
- // settlementList.filter
|
282
|
|
- // })
|
283
|
|
-
|
284
|
|
-
|
285
|
|
- // var bool = true, arr = this.settlementList.slice()
|
286
|
|
- // if (val.specId === null) {
|
287
|
|
- // for (var n = 0; n < arr.length; n++) {
|
288
|
|
- // if (arr[n].id === val.id && arr[n].specId === null) {
|
289
|
|
- // bool = false
|
290
|
|
- // arr[n] = val
|
291
|
|
- // }
|
292
|
|
- // }
|
293
|
|
- // if (bool) {
|
294
|
|
- // arr.push(val)
|
295
|
|
- // }
|
296
|
|
- // } else {
|
297
|
|
- // for (var n = 0; n < arr.length; n++) {
|
298
|
|
- // if (arr[n].specId === val.specId) {
|
299
|
|
- // bool = false
|
300
|
|
- // arr[n] = val
|
301
|
|
- // }
|
302
|
|
- // }
|
303
|
|
- // if (bool) {
|
304
|
|
- // arr.push(val)
|
305
|
|
- // }
|
306
|
|
- // }
|
307
|
|
- // for (var n = 0; n < arr.length; n++) {
|
308
|
|
- // if (arr[n].num === 0 || arr[n].defaultNum === 0) {
|
309
|
|
- // arr.splice(n, 1)
|
310
|
|
- // }
|
311
|
|
- // }
|
312
|
|
- // this.settlementList = arr
|
313
|
|
- // console.log(JSON.stringify(this.settlementList))
|
314
|
|
- // this.calcTotalNum()
|
315
|
340
|
},
|
316
|
341
|
calcTotalNum () { // 计算总数量、价格
|
317
|
342
|
var num = 0, price = 0
|