You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
95 lines
2.2 KiB
95 lines
2.2 KiB
import { urlPrefix } from '../../config/index';
|
|
import Toast from 'tdesign-miniprogram/toast/index';
|
|
|
|
Page({
|
|
/**
|
|
* 页面的初始数据
|
|
*/
|
|
data: {
|
|
items: [],
|
|
selectedIndex: 0,
|
|
selectmoney: 1
|
|
},
|
|
onItemTap: function (event) {
|
|
this.setData({
|
|
selectedIndex: event.currentTarget.dataset.index,
|
|
selectmoney: this.data.items[event.currentTarget.dataset.index].money
|
|
});
|
|
},
|
|
|
|
payHandle(e) {
|
|
wx.request({
|
|
url: urlPrefix + '/QingLong/HuiYa/createOrderV3',
|
|
method: "POST",
|
|
header: {
|
|
'content-type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: {
|
|
token: wx.getStorageSync('token'),
|
|
total: this.data.selectmoney
|
|
},
|
|
success(res) {
|
|
if (res.data.token) {
|
|
wx.setStorageSync('token', res.data.token);
|
|
}
|
|
if (res.data.success) {
|
|
wx.requestPayment({
|
|
timeStamp: res.data.result.timeStamp,
|
|
nonceStr: res.data.result.nonceStr,
|
|
package: res.data.result.packageValue,
|
|
signType: res.data.result.signType,
|
|
paySign: res.data.result.paySign,
|
|
success(res) {
|
|
console.log(res)
|
|
},
|
|
fail(res) {
|
|
console.log(res)
|
|
}
|
|
});
|
|
} else {
|
|
console.log('获取支付相关信息失败!')
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
agreeHandle(e) {
|
|
wx.navigateTo({
|
|
url: '/pages/agree/index',
|
|
});
|
|
},
|
|
/**
|
|
* 生命周期函数--监听页面加载
|
|
*/
|
|
onLoad(options) {
|
|
let that = this;
|
|
wx.request({
|
|
url: urlPrefix + '/QingLong/HuiYa/wxGetJinDouPrice',
|
|
method: "POST",
|
|
header: {
|
|
'content-type': 'application/x-www-form-urlencoded'
|
|
},
|
|
data: {
|
|
token: wx.getStorageSync('token'),
|
|
},
|
|
success(res) {
|
|
if (res.data.token) {
|
|
wx.setStorageSync('token', res.data.token);
|
|
}
|
|
if (res.data.success) {
|
|
that.setData({
|
|
items: res.data.data,
|
|
});
|
|
}
|
|
}
|
|
});
|
|
},
|
|
|
|
/**
|
|
* 生命周期函数--监听页面显示
|
|
*/
|
|
onShow() {
|
|
},
|
|
|
|
});
|