...
|
...
|
@@ -9,10 +9,12 @@ import orderService from '../orderService' |
|
|
import {getImgUrl} from '../../../utils';
|
|
|
import router from '../../../router/index.js'
|
|
|
import { prePay } from '../../order/wxpay.js'
|
|
|
import Yas from '../../../utils/yas';
|
|
|
import Yas from '../../../utils/yas'
|
|
|
|
|
|
let yas;
|
|
|
|
|
|
const ACTIVITY_TYPE = 18; // 砍价
|
|
|
|
|
|
const api = new orderService();
|
|
|
Page({
|
|
|
|
...
|
...
|
@@ -29,7 +31,8 @@ Page({ |
|
|
coupons: [],
|
|
|
selectCouponCode: '',
|
|
|
selectCouponAmount: '',
|
|
|
selectingCoupon: false
|
|
|
selectingCoupon: false,
|
|
|
user_activity_id: '' // 有值代表砍价
|
|
|
},
|
|
|
onLoad: async function (option) {
|
|
|
yas = new Yas(this);
|
...
|
...
|
@@ -39,7 +42,8 @@ Page({ |
|
|
storeId: option.store_id || 0,
|
|
|
skup: option.skup || '',
|
|
|
product_id: option.product_id || '',
|
|
|
hasAddress: false
|
|
|
hasAddress: false,
|
|
|
user_activity_id: option.user_activity_id || ''
|
|
|
})
|
|
|
await this.fetchData(option.is_store);
|
|
|
if (!option.is_store) {
|
...
|
...
|
@@ -72,10 +76,19 @@ Page({ |
|
|
coupon_code: code
|
|
|
}, () => wx.hideLoading());
|
|
|
} else {
|
|
|
info = await api.orderCompute({
|
|
|
const params = {
|
|
|
skup: this.data.skup,
|
|
|
coupon_code: code
|
|
|
}, () => wx.hideLoading());
|
|
|
};
|
|
|
|
|
|
if (this.data.user_activity_id) {
|
|
|
Object.assign(params, {
|
|
|
user_activity_id: this.data.user_activity_id,
|
|
|
activity_type: ACTIVITY_TYPE
|
|
|
});
|
|
|
}
|
|
|
|
|
|
info = await api.orderCompute(params, () => wx.hideLoading());
|
|
|
}
|
|
|
} catch(e) {}
|
|
|
|
...
|
...
|
@@ -99,6 +112,14 @@ Page({ |
|
|
skup: this.data.skup,
|
|
|
store_id: this.data.storeId
|
|
|
}
|
|
|
|
|
|
if (this.data.user_activity_id) {
|
|
|
Object.assign(params, {
|
|
|
user_activity_id: this.data.user_activity_id,
|
|
|
activity_type: ACTIVITY_TYPE
|
|
|
})
|
|
|
}
|
|
|
|
|
|
let data;
|
|
|
if (isStore) {
|
|
|
data = await api.createOfflinePayment(params, () => wx.hideLoading())
|
...
|
...
|
@@ -191,11 +212,19 @@ Page({ |
|
|
let skup = this.data.skup
|
|
|
let channelNo = '';
|
|
|
let couponCode = this.data.selectCouponCode || '';
|
|
|
let extra = null;
|
|
|
|
|
|
if (this.data.user_activity_id) {
|
|
|
extra = {
|
|
|
user_activity_id: this.data.user_activity_id,
|
|
|
activity_type: ACTIVITY_TYPE
|
|
|
};
|
|
|
}
|
|
|
|
|
|
// wx.showLoading({
|
|
|
// title: '',
|
|
|
// })
|
|
|
data = await api.buyerSubmit(skup, channelNo, addressId, couponCode, () => wx.hideLoading());
|
|
|
data = await api.buyerSubmit({skup, channelNo, addressId, couponCode, extra}, () => wx.hideLoading());
|
|
|
}
|
|
|
if (data && data.orderCode) {
|
|
|
let skup = this.data.skup
|
...
|
...
|
|