ts_aimz/pages/copyright/payment/payment.js
itgaojian163 cbf7c00399 页面
2025-03-24 18:05:54 +08:00

65 lines
1.5 KiB
JavaScript

// pages/copyright/payment/payment.js
Page({
/**
* 页面的初始数据
*/
data: {
paySumOptions: [100, 300, 500, 1000, 2000, 5000],
currentTab: 0, //充值金额选项
payMoney: 100, //支付金额
currentBagTab: 1, //当前套餐包tab
payWay: 1, //支付方式 1微信 2对公
},
onLoad(options) {
},
//监听充值金额选项
doChangePayMoney(e) {
this.setData({
payMoney: e.currentTarget.dataset.value
})
},
//监听充值金额变化
obMoney(e) {
console.log(e)
var _self = this
const inputValue = e.detail.value
const regex = /^[+-]?(\d+(\.\d*)?|\.\d+)$/;
if (regex.test(inputValue)) {
//数字
_self.setData({
payMoney: e.detail.value
})
} else {
wx.showToast({
title: '请输入数字',
icon: 'error',
success: () => {
setTimeout(() => {
_self.setData({
payMoney: 100
})
}, 1000);
}
})
}
},
//切换套餐包
doChangeBagTab(e) {
this.setData({
currentBagTab: e.currentTarget.dataset.value
})
},
//切换支付方式
doChangePayWay(e) {
console.log(e)
this.setData({
payWay: e.detail.value
})
},
//去支付
doPay() {
}
})