新增分享,找回密码,实名认证,签约

This commit is contained in:
唐明明
2023-08-25 14:04:31 +08:00
parent 32cc588ae7
commit 0f7c37d548
106 changed files with 2130 additions and 1313 deletions

View File

@@ -9,20 +9,104 @@ Page({
* 页面的初始数据
*/
data: {
total : "0.00",
orderNo : "",
modelId : "",
modelType : "",
payType : "",
can : {
coin : 0,
wechat : 0,
},
loding : false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
const params = JSON.parse(decodeURIComponent(options.params));
console.log(params)
const { order_id, order_type, order_no } = JSON.parse(decodeURIComponent(options.params))
wx.showLoading({
title: '加载中...',
mask : true
})
wx.$api.pay.info({ order_id, order_type }).then(res => {
let { can, total, model_type, model_id } = res.data
this.setData({
orderNo : order_no,
payType : res.data.default,
modelId : model_id,
modelType : model_type,
total,
can
})
wx.hideLoading()
})
},
/**
* 生命周期函数--监听页面显示
* 选择支付方式
*/
onShow() {
onPayType(e){
let { value } = e.detail
this.setData({
payType: value
})
},
/**
* 立即支付
*/
onPay(){
this.setData({
loding: true
})
switch (this.data.payType) {
case 'wechat':
this.wechatPay()
break;
case 'coin':
wx.showToast({
title: '支付方式暂未开放',
icon : 'none'
})
this.setData({
loding: false
})
break;
}
},
/**
* 微信支付
*/
wechatPay(){
wx.login({
success: wxCode => {
let { code } = wxCode;
wx.$api.pay.wechatPay({
order_type : this.data.modelType,
order_id : this.data.modelId,
type : "mini",
code : code
}).then(res => {
let { wechat, trade_id } = res.data
let wechatObj = JSON.parse(wechat)
wx.requestPayment({
nonceStr : wechatObj.nonceStr,
package : wechatObj.package,
paySign : wechatObj.paySign,
timeStamp: wechatObj.timeStamp,
signType : wechatObj.signType,
success : () => {
wx.redirectTo({
url: './success/success?trade_id=' + trade_id,
})
}
})
}).finally(() => {
this.setData({
loding: false
})
})
}
})
}
})