buy.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // pages/buy/buy.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. payType: 1,
  8. },
  9. /**
  10. * 生命周期函数--监听页面加载
  11. */
  12. onLoad(options) {
  13. },
  14. /**
  15. * 生命周期函数--监听页面初次渲染完成
  16. */
  17. onReady() {
  18. },
  19. /**
  20. * 生命周期函数--监听页面显示
  21. */
  22. onShow() {
  23. },
  24. handlePayType (e) {
  25. var type = Number(e.currentTarget.dataset.type)
  26. console.log(type);
  27. this.setData({
  28. payType: type
  29. })
  30. },
  31. // 调用微信支付
  32. handleWXPay () {
  33. var that = this
  34. wx.showLoading({
  35. title: '支付中...',
  36. mask: true
  37. })
  38. setTimeout(() => {
  39. wx.hideLoading({
  40. success: () => {
  41. wx.showModal({
  42. content: '支付成功,立即去预约',
  43. cancelColor: '#666',
  44. confirmText: '去预约',
  45. confirmColor: '#333',
  46. success (res) {
  47. if (res.confirm) {
  48. that.handleAppointment()
  49. }
  50. }
  51. })
  52. }
  53. })
  54. }, 1000);
  55. },
  56. handleAppointment () {
  57. wx.navigateTo({
  58. url: '/pages/appointment/appointment',
  59. })
  60. }
  61. })