|
|
@ -32,32 +32,37 @@ Page({ |
|
|
onLoad: function (options) { |
|
|
onLoad: function (options) { |
|
|
if(options.mobile){ |
|
|
if(options.mobile){ |
|
|
this.data.form.mobile = options.mobile |
|
|
this.data.form.mobile = options.mobile |
|
|
|
|
|
wx.showLoading({ title: '正在获取', mask: true }) |
|
|
|
|
|
getPeymentList(this.data.form).then(result => { |
|
|
|
|
|
wx.hideLoading() |
|
|
|
|
|
this.amountList(result.data.records) |
|
|
|
|
|
}).catch(err => { |
|
|
|
|
|
wx.hideLoading() |
|
|
|
|
|
this.setData({ safeBottom: app.globalData.safeBottom }) |
|
|
|
|
|
util.showToast(err) |
|
|
|
|
|
}) |
|
|
|
|
|
} else if(options.order){ |
|
|
|
|
|
var list = [JSON.parse(decodeURIComponent(options.order))] |
|
|
|
|
|
this.amountList(list) |
|
|
} |
|
|
} |
|
|
wx.showLoading({ title: '正在获取', mask: true }) |
|
|
|
|
|
getPeymentList(this.data.form).then(result => { |
|
|
|
|
|
wx.hideLoading() |
|
|
|
|
|
var amount = 0 |
|
|
|
|
|
this.data.params.ids = [] |
|
|
|
|
|
if (result.data && result.data.records.length) { |
|
|
|
|
|
for (let index = 0; index < result.data.records.length; index++) { |
|
|
|
|
|
const element = result.data.records[index] |
|
|
|
|
|
amount = math.plus(amount, element.settlePrice) |
|
|
|
|
|
this.data.params.ids.push(element.id) |
|
|
|
|
|
if(index == 0 && Number(element.settleType) == 2 && !util.isEmpty(element.bankCardNo)){ |
|
|
|
|
|
this.data.params.settleType = '2' |
|
|
|
|
|
this.data.params.bankCardNo = element.bankCardNo |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
amountList: function(orderList){ |
|
|
|
|
|
var amount = 0 |
|
|
|
|
|
this.data.params.ids = [] |
|
|
|
|
|
if (orderList && orderList.length) { |
|
|
|
|
|
for (let index = 0; index < orderList.length; index++) { |
|
|
|
|
|
const element = orderList[index] |
|
|
|
|
|
amount = math.plus(amount, element.settlePrice) |
|
|
|
|
|
this.data.params.ids.push(element.id) |
|
|
|
|
|
if(index == 0 && Number(element.settleType) == 2 && !util.isEmpty(element.bankCardNo)){ |
|
|
|
|
|
this.data.params.settleType = '2' |
|
|
|
|
|
this.data.params.bankCardNo = element.bankCardNo |
|
|
} |
|
|
} |
|
|
this.setData({ safeBottom: app.globalData.safeBottom, orderList: result.data.records, amount, params: this.data.params }) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.setData({ safeBottom: app.globalData.safeBottom }) |
|
|
|
|
|
} |
|
|
} |
|
|
}).catch(err => { |
|
|
|
|
|
wx.hideLoading() |
|
|
|
|
|
|
|
|
this.setData({ safeBottom: app.globalData.safeBottom, orderList, amount, params: this.data.params }) |
|
|
|
|
|
} else { |
|
|
this.setData({ safeBottom: app.globalData.safeBottom }) |
|
|
this.setData({ safeBottom: app.globalData.safeBottom }) |
|
|
util.showToast(err) |
|
|
|
|
|
console.log(err) |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
} |
|
|
}, |
|
|
}, |
|
|
onTypeChange: function({detail}){ |
|
|
onTypeChange: function({detail}){ |
|
|
this.setData({ ['params.settleType']: detail }) |
|
|
this.setData({ ['params.settleType']: detail }) |
|
|
@ -100,6 +105,8 @@ Page({ |
|
|
paymentOrder(this.data.params).then(result => { |
|
|
paymentOrder(this.data.params).then(result => { |
|
|
wx.hideLoading() |
|
|
wx.hideLoading() |
|
|
util.showBackToast('订单已经付款') |
|
|
util.showBackToast('订单已经付款') |
|
|
|
|
|
const channel = this.getOpenerEventChannel() |
|
|
|
|
|
channel.emit('onOrderChange', { what: 12, desc: 'PaymentOrder' }) |
|
|
event.emit('OrderMessage', { what: 12, desc: 'PaymentOrder' }) |
|
|
event.emit('OrderMessage', { what: 12, desc: 'PaymentOrder' }) |
|
|
}).catch(err => { |
|
|
}).catch(err => { |
|
|
wx.hideLoading() |
|
|
wx.hideLoading() |
|
|
|