抖音b端
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. // pages/getMerchant/index.js
  2. const config = require('../../config/config.js')
  3. const Http = require('../../utils/HttpBasics.js')
  4. const util = require('../../utils/util.js')
  5. const app = getApp();
  6. Page({
  7. /**
  8. * 页面的初始数据
  9. */
  10. data: {
  11. phone:'',
  12. paramData:[]
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad: function (options) {
  18. console.log(options)
  19. this.setData({
  20. paramData: options
  21. })
  22. if (options.a == 2){
  23. tt.setNavigationBarTitle({
  24. title: '会员赠券'
  25. })
  26. }else{
  27. tt.setNavigationBarTitle({
  28. title: '会员积分'
  29. })
  30. }
  31. },//204391258
  32. /**
  33. * 生命周期函数--监听页面初次渲染完成
  34. */
  35. onReady: function () {
  36. },
  37. checkMerchant(e) {
  38. let id = e.target.id;
  39. this.data.selectList.map((item, index) => {
  40. if (id == item.id) {
  41. this.setData({
  42. selectMerchant: item``
  43. })
  44. }
  45. })
  46. },
  47. submitForm() {
  48. const reg = /^1[0|1|2|3|4|5|6|7|8|9]\d{9}$/;
  49. let _this=this;
  50. if (!reg.test(this.data.phone)) {
  51. tt.showToast({
  52. title: '抱歉,请输入正确的手机号',
  53. icon: 'none',
  54. duration: 2000,
  55. mask: false
  56. });
  57. return;
  58. }
  59. Http.get({
  60. url: config.api.findByPhone,
  61. data: {
  62. phone: _this.data.phone,
  63. }
  64. })
  65. .then(res => {
  66. if (res.data.id){
  67. if(res.data.status == 1){
  68. tt.showModal({
  69. title: "抱歉",
  70. content: "会员已被锁定",
  71. showCancel: false
  72. })
  73. return;
  74. }
  75. if (this.data.paramData.a == 1){
  76. tt.setStorageSync("avatarUrl", res.data.avatarUrl?res.data.avatarUrl:'');
  77. tt.navigateTo({
  78. url: `/pages/Add/index?id=${res.data.id}&levelName=${res.data.level}&nickName=${res.data.nickName}&name=${res.data.name}&phone=${res.data.phone}&score=${res.data.score}&credit=${res.data.credit}`
  79. })
  80. }
  81. if (this.data.paramData.a == 2) {
  82. tt.setStorageSync("avatarUrl", res.data.avatarUrl?res.data.avatarUrl:'');
  83. tt.navigateTo({
  84. url: `/pages/giveCoupon/index?id=${res.data.id}&levelName=${res.data.level}&nickName=${res.data.nickName}&name=${res.data.name}&phone=${res
  85. .data.phone}&score=${res.data.score}&credit=${res.data.credit}`
  86. })
  87. }
  88. }else{
  89. tt.showToast({
  90. title: '抱歉,会员信息不存在!',
  91. icon: 'none',
  92. duration: 2000,
  93. mask: false
  94. });
  95. }
  96. })
  97. .catch(err => {
  98. tt.showToast({
  99. title: err.message,
  100. icon: 'none',
  101. duration: 2000,
  102. mask: false
  103. });
  104. });
  105. },
  106. getList(e) {
  107. console.log(e.detail.value)
  108. this.setData({
  109. phone: e.detail.value
  110. })
  111. },
  112. /**
  113. * 生命周期函数--监听页面显示
  114. */
  115. onShow: function () {
  116. },
  117. /**
  118. * 生命周期函数--监听页面隐藏
  119. */
  120. onHide: function () {
  121. },
  122. /**
  123. * 生命周期函数--监听页面卸载
  124. */
  125. onUnload: function () {
  126. },
  127. /**
  128. * 页面相关事件处理函数--监听用户下拉动作
  129. */
  130. onPullDownRefresh: function () {
  131. },
  132. /**
  133. * 页面上拉触底事件的处理函数
  134. */
  135. onReachBottom: function () {
  136. },
  137. /**
  138. * 用户点击右上角分享
  139. */
  140. onShareAppMessage: function () {
  141. }
  142. })