|
@@ -207,6 +207,7 @@ export default {
|
207
|
207
|
...caseTableActions([
|
208
|
208
|
'getGoodsTypeList',
|
209
|
209
|
'getGoodsList',
|
|
210
|
+ 'toPayBefore',
|
210
|
211
|
'toPay',
|
211
|
212
|
]),
|
212
|
213
|
...mapCaseActions([
|
|
@@ -215,7 +216,46 @@ export default {
|
215
|
216
|
toPlaceOrder () { // 下单
|
216
|
217
|
if (this.selGoods.length) {
|
217
|
218
|
if (this.userInfo.customer.MapUser === '' || (this.userInfo.customer.MapUser !== '' && sessionStorage.getItem('from') !== 'sales')) {
|
218
|
|
- 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) } })
|
|
219
|
+ if (this.ajaxOff) {
|
|
220
|
+ this.ajaxOff = false
|
|
221
|
+ this.postData.info.OrgId = this.orgId
|
|
222
|
+ this.postData.info.UserId = this.userInfo.CustomerId
|
|
223
|
+ this.postData.info.UserName = this.userInfo.customer.CustomerName
|
|
224
|
+ this.postData.info.PayType = 'sys user'
|
|
225
|
+ this.postData.info.Remark = ''
|
|
226
|
+ this.postData.from = sessionStorage.getItem('from') ? sessionStorage.getItem('from') : ''
|
|
227
|
+ var orderInfo = this.selGoods
|
|
228
|
+ this.postData.detail = []
|
|
229
|
+ var amount = 0
|
|
230
|
+ var num = 0
|
|
231
|
+ for (var n = 0; n < orderInfo.length; n++) {
|
|
232
|
+ this.postData.detail.push({
|
|
233
|
+ GoodsId: orderInfo[n].id,
|
|
234
|
+ GoodsName: orderInfo[n].name,
|
|
235
|
+ SpecId: orderInfo[n].spec,
|
|
236
|
+ SpecName: orderInfo[n].specname,
|
|
237
|
+ Number: orderInfo[n].num - 0,
|
|
238
|
+ Price: String(orderInfo[n].price - 0),
|
|
239
|
+ })
|
|
240
|
+ amount += (orderInfo[n].price - 0) * orderInfo[n].num
|
|
241
|
+ num += orderInfo[n].num - 0
|
|
242
|
+ }
|
|
243
|
+ this.postData.info.Amount = String(amount)
|
|
244
|
+ this.postData.info.OrdersNum = num
|
|
245
|
+ // console.log(JSON.stringify(this.postData))
|
|
246
|
+ this.toPayBefore({
|
|
247
|
+ info: JSON.stringify(this.postData.info),
|
|
248
|
+ detail: JSON.stringify(this.postData.detail),
|
|
249
|
+ customercouponid: '',
|
|
250
|
+ from: this.postData.from
|
|
251
|
+ }).then((res) => {
|
|
252
|
+ // console.log(JSON.stringify(res))
|
|
253
|
+ this.ajaxOff = true
|
|
254
|
+ 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), ordersid: res.OrdersId } })
|
|
255
|
+ }).catch(() => {
|
|
256
|
+ this.ajaxOff = true
|
|
257
|
+ })
|
|
258
|
+ }
|
219
|
259
|
} else {
|
220
|
260
|
this.showCalcMenu = true
|
221
|
261
|
}
|