This commit is contained in:
zdx
2020-12-28 17:25:45 +08:00
parent 092f0bad14
commit e93ee1ed17
21 changed files with 703 additions and 145 deletions

View File

@@ -5,7 +5,7 @@ Page({
info: '',
remark: '',
crowdfund_id: '',
addressDel: {},
addressDel:'',
},
onLoad(e) {
@@ -41,50 +41,63 @@ Page({
title: '创建中...',
mask: 'true'
})
wx.$api.companyModule.crowdfundsCreatOrder(this.data.crowdfund_item_id, this.data.addressDel.address_id, this.data.remark).then(res => {
var data = {};
if (res.trade_no) {
wx.login({
success: res1 => {
data = {
trade_no: res.trade_no,
code: res1.code
}
wx.$api.companyModule.wechat(data).then(res => {
var ress = JSON.parse(res);
wx.hideLoading({});
wx.requestPayment({
timeStamp: ress.timeStamp,
nonceStr: ress.nonceStr,
package: ress.package,
signType: 'MD5',
paySign: ress.paySign,
success: res => {
wx.showToast({
title: '创建订单成功',
})
wx.navigateTo({
url: '/pages/home/projectSuccess/projectSuccess?crowdfund_id=' + this.data.crowdfund_id,
})
},
fail(res) {
wx.showToast({
title: '支付失败',
})
}
if (this.data.addressDel) {
wx.$api.companyModule.crowdfundsCreatOrder(this.data.crowdfund_item_id, this.data.addressDel.address_id, this.data.remark).then(res => {
var data = {};
if (res.trade_no) {
wx.login({
success: res1 => {
data = {
trade_no: res.trade_no,
code: res1.code
}
wx.$api.companyModule.wechat(data).then(res => {
var ress = JSON.parse(res);
wx.hideLoading({});
wx.requestPayment({
timeStamp: ress.timeStamp,
nonceStr: ress.nonceStr,
package: ress.package,
signType: 'MD5',
paySign: ress.paySign,
success: res => {
wx.showToast({
title: '创建订单成功',
})
wx.navigateTo({
url: '/pages/home/projectSuccess/projectSuccess?crowdfund_id=' + this.data.crowdfund_id,
})
},
fail(res) {
wx.showToast({
title: '支付失败',
})
}
})
}).catch(res => {
console.log(res)
})
}).catch(res => {
console.log(res)
})
}
})
}
}).catch(res => {
wx.navigateBack({})
})
}
})
}
}).catch(res => {
wx.navigateBack({})
})
} else {
wx.hideLoading({
success: (res) => {
wx.showToast({
icon: 'none',
title: '请选择收货地址',
duration: 2000
})
},
})
}
},
// 跳转到地址列表和新增地址页面
goAddress(){
goAddress() {
wx.navigateTo({
url: '/pages/mall/mall_address/mall_address?type=selectAddress',
})