...
|
...
|
@@ -24,18 +24,18 @@ Page({ |
|
|
isStore: 0,
|
|
|
storeId: 0
|
|
|
},
|
|
|
onLoad: function (option) {
|
|
|
onLoad: async function (option) {
|
|
|
console.log(option)
|
|
|
this.setData({
|
|
|
isStore: option.is_store || 0,
|
|
|
isStore: Number(option.is_store) || 0,
|
|
|
storeId: option.store_id || 0,
|
|
|
skup: option.skup || '',
|
|
|
product_id: option.product_id || '',
|
|
|
hasAddress: false
|
|
|
})
|
|
|
this.fetchData(option.is_store);
|
|
|
await this.fetchData(option.is_store);
|
|
|
if (!option.is_store) {
|
|
|
this.fetchAddress()
|
|
|
await this.fetchAddress()
|
|
|
}
|
|
|
},
|
|
|
|
...
|
...
|
@@ -50,6 +50,14 @@ Page({ |
|
|
let data;
|
|
|
if (isStore) {
|
|
|
data = await api.createOfflinePayment(params, () => wx.hideLoading())
|
|
|
// let index;
|
|
|
// data.promotionFormulaList.forEach((value, i) => {
|
|
|
// if (value.promotion === '运费') {
|
|
|
// index = i;
|
|
|
// break;
|
|
|
// }
|
|
|
// })
|
|
|
// data.promotionFormulaList.splice(index,1)
|
|
|
} else {
|
|
|
data = await api.createPaymentInfo(params, () => wx.hideLoading())
|
|
|
}
|
...
|
...
|
@@ -59,14 +67,14 @@ Page({ |
|
|
this.setData(data)
|
|
|
},
|
|
|
|
|
|
fetchAddress() {
|
|
|
async fetchAddress() {
|
|
|
wx.showLoading({
|
|
|
title: '',
|
|
|
})
|
|
|
|
|
|
let params = {}
|
|
|
|
|
|
api.yohoApi().buyerGetAddress(params, () => wx.hideLoading())
|
|
|
await api.yohoApi().buyerGetAddress(params, () => wx.hideLoading())
|
|
|
.then(data => {
|
|
|
if (Array.isArray(data)) {
|
|
|
for (let item of data) {
|
...
|
...
|
@@ -91,6 +99,7 @@ Page({ |
|
|
.catch(error => {
|
|
|
console.log(error)
|
|
|
})
|
|
|
api.defaultApi();
|
|
|
},
|
|
|
|
|
|
async submit() {
|
...
|
...
|
@@ -121,12 +130,12 @@ Page({ |
|
|
|
|
|
let addressId = this.data.hasAddress && this.data.address && this.data.address.address_id
|
|
|
let skup = this.data.skup
|
|
|
let channelNo = ''
|
|
|
let channelNo = '';
|
|
|
|
|
|
wx.showLoading({
|
|
|
title: '',
|
|
|
})
|
|
|
|
|
|
debugger;
|
|
|
data = await api.buyerSubmit(skup, channelNo, addressId, () => wx.hideLoading());
|
|
|
}
|
|
|
if (data && data.orderCode) {
|
...
|
...
|
|