|
@@ -9,10 +9,12 @@ import orderService from '../orderService' |
|
@@ -9,10 +9,12 @@ import orderService from '../orderService' |
9
|
import {getImgUrl} from '../../../utils';
|
9
|
import {getImgUrl} from '../../../utils';
|
10
|
import router from '../../../router/index.js'
|
10
|
import router from '../../../router/index.js'
|
11
|
import { prePay } from '../../order/wxpay.js'
|
11
|
import { prePay } from '../../order/wxpay.js'
|
12
|
-import Yas from '../../../utils/yas';
|
12
|
+import Yas from '../../../utils/yas'
|
13
|
|
13
|
|
14
|
let yas;
|
14
|
let yas;
|
15
|
|
15
|
|
|
|
16
|
+const ACTIVITY_TYPE = 18; // 砍价
|
|
|
17
|
+
|
16
|
const api = new orderService();
|
18
|
const api = new orderService();
|
17
|
Page({
|
19
|
Page({
|
18
|
|
20
|
|
|
@@ -29,7 +31,8 @@ Page({ |
|
@@ -29,7 +31,8 @@ Page({ |
29
|
coupons: [],
|
31
|
coupons: [],
|
30
|
selectCouponCode: '',
|
32
|
selectCouponCode: '',
|
31
|
selectCouponAmount: '',
|
33
|
selectCouponAmount: '',
|
32
|
- selectingCoupon: false
|
34
|
+ selectingCoupon: false,
|
|
|
35
|
+ user_activity_id: '' // 有值代表砍价
|
33
|
},
|
36
|
},
|
34
|
onLoad: async function (option) {
|
37
|
onLoad: async function (option) {
|
35
|
yas = new Yas(this);
|
38
|
yas = new Yas(this);
|
|
@@ -39,7 +42,8 @@ Page({ |
|
@@ -39,7 +42,8 @@ Page({ |
39
|
storeId: option.store_id || 0,
|
42
|
storeId: option.store_id || 0,
|
40
|
skup: option.skup || '',
|
43
|
skup: option.skup || '',
|
41
|
product_id: option.product_id || '',
|
44
|
product_id: option.product_id || '',
|
42
|
- hasAddress: false
|
45
|
+ hasAddress: false,
|
|
|
46
|
+ user_activity_id: option.user_activity_id || ''
|
43
|
})
|
47
|
})
|
44
|
await this.fetchData(option.is_store);
|
48
|
await this.fetchData(option.is_store);
|
45
|
if (!option.is_store) {
|
49
|
if (!option.is_store) {
|
|
@@ -72,10 +76,19 @@ Page({ |
|
@@ -72,10 +76,19 @@ Page({ |
72
|
coupon_code: code
|
76
|
coupon_code: code
|
73
|
}, () => wx.hideLoading());
|
77
|
}, () => wx.hideLoading());
|
74
|
} else {
|
78
|
} else {
|
75
|
- info = await api.orderCompute({
|
79
|
+ const params = {
|
76
|
skup: this.data.skup,
|
80
|
skup: this.data.skup,
|
77
|
coupon_code: code
|
81
|
coupon_code: code
|
78
|
- }, () => wx.hideLoading());
|
82
|
+ };
|
|
|
83
|
+
|
|
|
84
|
+ if (this.data.user_activity_id) {
|
|
|
85
|
+ Object.assign(params, {
|
|
|
86
|
+ user_activity_id: this.data.user_activity_id,
|
|
|
87
|
+ activity_type: ACTIVITY_TYPE
|
|
|
88
|
+ });
|
|
|
89
|
+ }
|
|
|
90
|
+
|
|
|
91
|
+ info = await api.orderCompute(params, () => wx.hideLoading());
|
79
|
}
|
92
|
}
|
80
|
} catch(e) {}
|
93
|
} catch(e) {}
|
81
|
|
94
|
|
|
@@ -99,6 +112,14 @@ Page({ |
|
@@ -99,6 +112,14 @@ Page({ |
99
|
skup: this.data.skup,
|
112
|
skup: this.data.skup,
|
100
|
store_id: this.data.storeId
|
113
|
store_id: this.data.storeId
|
101
|
}
|
114
|
}
|
|
|
115
|
+
|
|
|
116
|
+ if (this.data.user_activity_id) {
|
|
|
117
|
+ Object.assign(params, {
|
|
|
118
|
+ user_activity_id: this.data.user_activity_id,
|
|
|
119
|
+ activity_type: ACTIVITY_TYPE
|
|
|
120
|
+ })
|
|
|
121
|
+ }
|
|
|
122
|
+
|
102
|
let data;
|
123
|
let data;
|
103
|
if (isStore) {
|
124
|
if (isStore) {
|
104
|
data = await api.createOfflinePayment(params, () => wx.hideLoading())
|
125
|
data = await api.createOfflinePayment(params, () => wx.hideLoading())
|
|
@@ -191,11 +212,19 @@ Page({ |
|
@@ -191,11 +212,19 @@ Page({ |
191
|
let skup = this.data.skup
|
212
|
let skup = this.data.skup
|
192
|
let channelNo = '';
|
213
|
let channelNo = '';
|
193
|
let couponCode = this.data.selectCouponCode || '';
|
214
|
let couponCode = this.data.selectCouponCode || '';
|
|
|
215
|
+ let extra = null;
|
|
|
216
|
+
|
|
|
217
|
+ if (this.data.user_activity_id) {
|
|
|
218
|
+ extra = {
|
|
|
219
|
+ user_activity_id: this.data.user_activity_id,
|
|
|
220
|
+ activity_type: ACTIVITY_TYPE
|
|
|
221
|
+ };
|
|
|
222
|
+ }
|
194
|
|
223
|
|
195
|
// wx.showLoading({
|
224
|
// wx.showLoading({
|
196
|
// title: '',
|
225
|
// title: '',
|
197
|
// })
|
226
|
// })
|
198
|
- data = await api.buyerSubmit(skup, channelNo, addressId, couponCode, () => wx.hideLoading());
|
227
|
+ data = await api.buyerSubmit({skup, channelNo, addressId, couponCode, extra}, () => wx.hideLoading());
|
199
|
}
|
228
|
}
|
200
|
if (data && data.orderCode) {
|
229
|
if (data && data.orderCode) {
|
201
|
let skup = this.data.skup
|
230
|
let skup = this.data.skup
|