|
@@ -43,6 +43,7 @@
|
43
|
43
|
<div class="bottom">
|
44
|
44
|
<a @click="cancel">取消</a>
|
45
|
45
|
<a @click="toPayer">确定</a>
|
|
46
|
+ <div style="width: 100%;position: absolute;left: 0;bottom: 0;top: 0;" v-if="!ajaxoff"></div>
|
46
|
47
|
</div>
|
47
|
48
|
</div>
|
48
|
49
|
<div class="selectCouponLayer" :class="{'show': showSelectCouponLayer}">
|
|
@@ -79,12 +80,12 @@
|
79
|
80
|
import { mapState, createNamespacedHelpers } from 'vuex'
|
80
|
81
|
const { mapActions: caseTableActions } = createNamespacedHelpers('placeOrderForCoffee')
|
81
|
82
|
import discounts from '../../../components/discounts/discounts'
|
82
|
|
-
|
83
|
83
|
export default {
|
84
|
84
|
name: '',
|
85
|
85
|
data () {
|
86
|
86
|
var _self = this
|
87
|
87
|
return {
|
|
88
|
+ ajaxoff: true,
|
88
|
89
|
showSelectCouponLayer: false,
|
89
|
90
|
getCouponOff: false,
|
90
|
91
|
couponList: [], // 优惠券列表
|
|
@@ -135,7 +136,7 @@ export default {
|
135
|
136
|
if (res[n].Coupon.IsAll && nowDate >= new Date(res[n].StartDate).getTime() && nowDate < new Date(res[n].EndDate).getTime() && res[n].CaseId === this.$route.query.caseid) {
|
136
|
137
|
this.couponList.push({
|
137
|
138
|
title: res[n].Coupon.CouponName,
|
138
|
|
- desc: res[n].Coupon.Share.UseInstruction,
|
|
139
|
+ desc: res[n].Coupon.Share.UseRule,
|
139
|
140
|
time: this.toolClass.dateFormat(res[n].EndDate),
|
140
|
141
|
useType: '未使用',
|
141
|
142
|
tag: '商品',
|
|
@@ -206,49 +207,56 @@ export default {
|
206
|
207
|
return [amount, num]
|
207
|
208
|
},
|
208
|
209
|
toPayer () { // 下单
|
209
|
|
- this.postData.info.OrgId = this.orgId
|
210
|
|
- this.postData.info.UserId = this.userInfo.CustomerId
|
211
|
|
- this.postData.info.UserName = this.userInfo.customer.CustomerName
|
212
|
|
- this.postData.info.PayType = this.postData.customercouponid === '' ? 'coupon' : 'vip'
|
213
|
|
- var orderInfo = JSON.parse(this.$route.query.info)
|
214
|
|
- this.postData.detail = []
|
215
|
|
- var amount = 0
|
216
|
|
- var num = 0
|
217
|
|
- for (var n = 0; n < orderInfo.length; n++) {
|
218
|
|
- this.postData.detail.push({
|
219
|
|
- GoodsId: orderInfo[n].id,
|
220
|
|
- GoodsName: orderInfo[n].name,
|
221
|
|
- SpecId: orderInfo[n].spec,
|
222
|
|
- SpecName: orderInfo[n].specname,
|
223
|
|
- Number: orderInfo[n].num - 0,
|
224
|
|
- Price: String(orderInfo[n].price - 0),
|
|
210
|
+ if (this.ajaxoff) {
|
|
211
|
+ this.ajaxoff = false
|
|
212
|
+ this.postData.info.OrgId = this.orgId
|
|
213
|
+ this.postData.info.UserId = this.userInfo.CustomerId
|
|
214
|
+ this.postData.info.UserName = this.userInfo.customer.CustomerName
|
|
215
|
+ this.postData.info.PayType = this.postData.customercouponid === '' ? 'coupon' : 'vip'
|
|
216
|
+ var orderInfo = JSON.parse(this.$route.query.info)
|
|
217
|
+ this.postData.detail = []
|
|
218
|
+ var amount = 0
|
|
219
|
+ var num = 0
|
|
220
|
+ for (var n = 0; n < orderInfo.length; n++) {
|
|
221
|
+ this.postData.detail.push({
|
|
222
|
+ GoodsId: orderInfo[n].id,
|
|
223
|
+ GoodsName: orderInfo[n].name,
|
|
224
|
+ SpecId: orderInfo[n].spec,
|
|
225
|
+ SpecName: orderInfo[n].specname,
|
|
226
|
+ Number: orderInfo[n].num - 0,
|
|
227
|
+ Price: String(orderInfo[n].price - 0),
|
|
228
|
+ })
|
|
229
|
+ amount += (orderInfo[n].price - 0) * orderInfo[n].num
|
|
230
|
+ num += orderInfo[n].num - 0
|
|
231
|
+ }
|
|
232
|
+ this.postData.info.Amount = String(amount)
|
|
233
|
+ this.postData.info.OrdersNum = num
|
|
234
|
+ console.log(JSON.stringify(this.postData))
|
|
235
|
+ this.toPay({
|
|
236
|
+ info: JSON.stringify(this.postData.info),
|
|
237
|
+ detail: JSON.stringify(this.postData.detail),
|
|
238
|
+ customercouponid: this.postData.customercouponid
|
|
239
|
+ }).then((res) => {
|
|
240
|
+ this.showSuccessPopup = true
|
|
241
|
+ // this.$dialog.alert({
|
|
242
|
+ // message: '下单成功!'
|
|
243
|
+ // }).then(() => {
|
|
244
|
+ // window.history.go(-2)
|
|
245
|
+ // })
|
|
246
|
+ }).catch(() => {
|
|
247
|
+ this.ajaxoff = true
|
225
|
248
|
})
|
226
|
|
- amount += (orderInfo[n].price - 0) * orderInfo[n].num
|
227
|
|
- num += orderInfo[n].num - 0
|
228
|
249
|
}
|
229
|
|
- this.postData.info.Amount = String(amount)
|
230
|
|
- this.postData.info.OrdersNum = num
|
231
|
|
- console.log(JSON.stringify(this.postData))
|
232
|
|
- this.toPay({
|
233
|
|
- info: JSON.stringify(this.postData.info),
|
234
|
|
- detail: JSON.stringify(this.postData.detail),
|
235
|
|
- customercouponid: this.postData.customercouponid
|
236
|
|
- }).then((res) => {
|
237
|
|
- this.showSuccessPopup = true
|
238
|
|
- // this.$dialog.alert({
|
239
|
|
- // message: '下单成功!'
|
240
|
|
- // }).then(() => {
|
241
|
|
- // window.history.go(-2)
|
242
|
|
- // })
|
243
|
|
- })
|
244
|
250
|
},
|
245
|
251
|
|
246
|
252
|
popBack () {
|
247
|
253
|
this.showSuccessPopup = false
|
248
|
|
- window.history.go(-2)
|
|
254
|
+ // window.history.go(-2)
|
|
255
|
+ this.$router.push({name: 'coffeeIndex'})
|
249
|
256
|
},
|
250
|
257
|
cancel () {
|
251
|
|
- window.history.go(-1)
|
|
258
|
+ // window.history.go(-1)
|
|
259
|
+ this.$router.push({name: 'coffeeIndex'})
|
252
|
260
|
},
|
253
|
261
|
}
|
254
|
262
|
}
|