kabaw_center.js 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. // pages/kabaw/kabaw.js
  2. Page({
  3. /**
  4. * 页面的初始数据
  5. */
  6. data: {
  7. quans: ['1', '2', '1', '2', '1', '2'],
  8. lindex: 0,
  9. lquans:[
  10. { name: '洗车券', shop_name: '', use_limit: 1, pic_url: '' },
  11. { name: '洗车券', shop_name: '', use_limit: 1, pic_url: '' },
  12. { name: '洗车券', shop_name: '', use_limit: 1, pic_url: '' }
  13. ] ,
  14. is_vip: 1,
  15. userinfo: '',
  16. users: '',
  17. levelname: '',
  18. send_id: '',
  19. keyword:'',
  20. list:''
  21. },
  22. gousers: function () {
  23. wx.redirectTo({
  24. url: '/pages/user/user',
  25. })
  26. },
  27. gouser: function () {
  28. var id = e.currentTarget.dataset.id
  29. },
  30. godetail: function (e) {
  31. var id = e.currentTarget.dataset.way
  32. var item = e.currentTarget.dataset.item
  33. var send_id = this.data.send_id
  34. // console.log(item)
  35. // var it = JSON.stringify(item)
  36. wx.navigateTo({
  37. url: '/pages/kabaw/detail?id=' + item + '&send_id=' + send_id + '&way=' + id,
  38. })
  39. },
  40. getkey:function(e){
  41. var vl = e.detail.value
  42. console.log(vl)
  43. this.setData({
  44. keyword:vl
  45. })
  46. this.getcoupon()
  47. },
  48. bevip: function () {
  49. wx.navigateTo({
  50. url: '/pages/member/member',
  51. })
  52. },
  53. gocenter: function () {
  54. var that = this
  55. var is_vip = this.data.is_vip
  56. if (is_vip == 1) {
  57. wx.navigateTo({
  58. url: '/pages/kabaw/mykabaw',
  59. })
  60. } else {
  61. wx.showModal({
  62. title: '提示',
  63. content: '您还不是会员哦',
  64. confirmText: '成为会员',
  65. success: function (res) {
  66. if (res.confirm) {
  67. that.bevip()
  68. }
  69. }
  70. })
  71. }
  72. },
  73. govip: function () {
  74. wx.navigateTo({
  75. url: '/pages/member/member',
  76. })
  77. },
  78. showmore: function () {
  79. wx.navigateTo({
  80. url: '/pages/kabaw/mykabaw',
  81. })
  82. },
  83. thisone: function (e) {
  84. var index = e.currentTarget.dataset.index
  85. var li = index == 0 ? 1 : 0
  86. this.getlingcoupon(li)
  87. this.setData({
  88. lindex: index
  89. })
  90. },
  91. /**
  92. * 生命周期函数--监听页面加载
  93. */
  94. onLoad: function (options) {
  95. var userinfo = wx.getStorageSync('USER_INFO') ? wx.getStorageSync('USER_INFO') : ''
  96. this.setData({
  97. userinfo: userinfo
  98. })
  99. this.getcoupon()
  100. },
  101. getcoupon: function () {
  102. var that = this
  103. var keyword = this.data.keyword
  104. console.log(getApp().api.everyday_coupon.user_info)
  105. getApp().request({
  106. url: getApp().api.everyday_coupon.getquans,
  107. data: {
  108. keyword:keyword
  109. },
  110. success: function (t) {
  111. console.log(t)
  112. var quan = t.data.list
  113. that.setData({
  114. list:quan,
  115. send_id:t.data.send_id
  116. })
  117. }
  118. })
  119. },
  120. /**
  121. * 生命周期函数--监听页面初次渲染完成
  122. */
  123. onReady: function () {
  124. },
  125. /**
  126. * 生命周期函数--监听页面显示
  127. */
  128. onShow: function () {
  129. var userinfo = wx.getStorageSync('USER_INFO') ? wx.getStorageSync('USER_INFO') : ''
  130. this.setData({
  131. userinfo: userinfo
  132. })
  133. this.getcoupon()
  134. },
  135. /**
  136. * 生命周期函数--监听页面隐藏
  137. */
  138. onHide: function () {
  139. },
  140. /**
  141. * 生命周期函数--监听页面卸载
  142. */
  143. onUnload: function () {
  144. },
  145. /**
  146. * 页面相关事件处理函数--监听用户下拉动作
  147. */
  148. onPullDownRefresh: function () {
  149. },
  150. /**
  151. * 页面上拉触底事件的处理函数
  152. */
  153. onReachBottom: function () {
  154. },
  155. /**
  156. * 用户点击右上角分享
  157. */
  158. onShareAppMessage: function () {
  159. }
  160. })