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
1.4KB

  1. // pages/buyTicket/buyTicket.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. buyNumber:1,
  8. num : 1,
  9. },
  10. /**
  11. * 生命周期函数--监听页面加载
  12. */
  13. onLoad: function (options) {
  14. console.log(options)
  15. },
  16. /**
  17. * 生命周期函数--监听页面初次渲染完成
  18. */
  19. onReady: function () {
  20. },
  21. /**
  22. * 生命周期函数--监听页面显示
  23. */
  24. onShow: function () {
  25. },
  26. /**
  27. * 生命周期函数--监听页面隐藏
  28. */
  29. onHide: function () {
  30. },
  31. /**
  32. * 生命周期函数--监听页面卸载
  33. */
  34. onUnload: function () {
  35. },
  36. /**
  37. * 页面相关事件处理函数--监听用户下拉动作
  38. */
  39. onPullDownRefresh: function () {
  40. },
  41. /**
  42. * 页面上拉触底事件的处理函数
  43. */
  44. onReachBottom: function () {
  45. },
  46. /**
  47. * 用户点击右上角分享
  48. */
  49. onShareAppMessage: function () {
  50. },
  51. addFn:function(){
  52. if (this.data.num<5){
  53. this.data.num++;
  54. this.setData({
  55. buyNumber: this.data.num
  56. })
  57. }
  58. },
  59. subtractFn:function(){
  60. if (this.data.num > 1) {
  61. this.data.num--;
  62. this.setData({
  63. buyNumber: this.data.num
  64. })
  65. }
  66. },
  67. buySuccess:function(){
  68. wx.requestPayment({
  69. success:res=>{
  70. console.log(res)
  71. // wx.switchTab({
  72. // url: '../index/index'
  73. // })
  74. },
  75. })
  76. }
  77. })