Page({ data: { crowdfund_item_id: '', addressList: [], info: '', remark: '', crowdfund_id: '' }, onLoad(e) { wx.$api.companyModule.crowdfundsCreat(e.crowdfund_item_id).then(res => { console.log(res); if (res.address.length > 0) { this.setData({ address_id: res.address[0].address_id, addressList: res.address, }) } this.setData({ crowdfund_item_id: e.crowdfund_item_id, info: res.info, crowdfund_id: e.crowdfund_id }) console.log(this.data.info); }).catch(res => { wx.navigateBack({}) }) }, input(e) { this.setData({ remark: e.detail.value }) }, nowActed(e) { wx.showLoading({ title: '创建中...', mask: 'true' }) wx.$api.companyModule.crowdfundsCreatOrder(this.data.crowdfund_item_id, this.data.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 => { wx.navigateBack({}) }) } })