// pages/buy/buy.js Page({ /** * 页面的初始数据 */ data: { payType: 1, }, /** * 生命周期函数--监听页面加载 */ onLoad(options) { }, /** * 生命周期函数--监听页面初次渲染完成 */ onReady() { }, /** * 生命周期函数--监听页面显示 */ onShow() { }, handlePayType (e) { var type = Number(e.currentTarget.dataset.type) console.log(type); this.setData({ payType: type }) }, // 调用微信支付 handleWXPay () { var that = this wx.showLoading({ title: '支付中...', mask: true }) setTimeout(() => { wx.hideLoading({ success: () => { wx.showModal({ content: '支付成功,立即去预约', cancelColor: '#666', confirmText: '去预约', confirmColor: '#333', success (res) { if (res.confirm) { that.handleAppointment() } } }) } }) }, 1000); }, handleAppointment () { wx.navigateTo({ url: '/pages/appointment/appointment', }) } })