pianoDetail.js 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. // pages/pianoDetail/pianoDetail.js
  2. const app = getApp()
  3. const util = require("../../utils/util")
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. imageUrl: app.globalData.imageUrl,
  10. num: 1,
  11. initMoney:19.90,
  12. item:{
  13. name: '19.9元特惠练琴卡',
  14. money: '19.90',
  15. beginDate: '2021-01-01',
  16. endDate: '2022-01-01'
  17. },
  18. id: "",
  19. payFlag: 1,
  20. schoolList:[],
  21. moreFlag: 0,
  22. isBuy: true,
  23. downLoadShow: false
  24. },
  25. getMoreSchool:function(){
  26. if(this.data.moreFlag == 0){
  27. this.setData({
  28. moreFlag: 1
  29. })
  30. } else{
  31. this.setData({
  32. moreFlag: 0
  33. })
  34. }
  35. },
  36. remNum:function(){
  37. var num = this.data.num
  38. if(num <= 1){
  39. return false
  40. } else {
  41. num--
  42. var money = this.data.initMoney
  43. money = parseFloat(money) * parseFloat(num).toFixed(2)
  44. this.setData({
  45. num : num,
  46. 'item.money': money.toFixed(2)
  47. })
  48. }
  49. },
  50. addNum:function(){
  51. var num = this.data.num
  52. if(num >= 10){
  53. wx.showToast({
  54. title: '已达单次购买上限',
  55. icon: "none"
  56. })
  57. return
  58. }
  59. num++;
  60. var money = this.data.initMoney
  61. money = parseFloat(money) * parseFloat(num).toFixed(2)
  62. this.setData({
  63. num:num,
  64. 'item.money': money.toFixed(2)
  65. })
  66. },
  67. callPhone(e) {
  68. const index = e.currentTarget.dataset.index
  69. const phone = this.data.schoolList[index].CONTRACT_TELEPHONE
  70. if(phone){
  71. wx.makePhoneCall({
  72. phoneNumber: phone
  73. })
  74. } else{
  75. wx.showToast({
  76. title: '暂无联系电话',
  77. icon:"none"
  78. })
  79. }
  80. },
  81. /**
  82. * 生命周期函数--监听页面加载
  83. */
  84. onLoad: function (options) {
  85. },
  86. /**
  87. * 生命周期函数--监听页面初次渲染完成
  88. */
  89. onReady: function () {
  90. },
  91. /**
  92. * 生命周期函数--监听页面显示
  93. */
  94. onShow: function () {
  95. },
  96. /**
  97. * 生命周期函数--监听页面隐藏
  98. */
  99. onHide: function () {
  100. },
  101. /**
  102. * 生命周期函数--监听页面卸载
  103. */
  104. onUnload: function () {
  105. },
  106. /**
  107. * 页面相关事件处理函数--监听用户下拉动作
  108. */
  109. onPullDownRefresh: function () {
  110. },
  111. /**
  112. * 页面上拉触底事件的处理函数
  113. */
  114. onReachBottom: function () {
  115. },
  116. /**
  117. * 用户点击右上角分享
  118. */
  119. onShareAppMessage: function () {
  120. }
  121. })