C端小程序
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

49 righe
1.3 KiB

  1. var config = require('../../config/config.js');
  2. const Http = require("../../utils/HttpBasics");
  3. var app = getApp();
  4. Page({
  5. data: {
  6. canIUse: wx.canIUse('button.open-type.getPhoneNumber'),
  7. couponChannelId: null,
  8. couponId: null
  9. },
  10. onLoad: function(options) {
  11. var that = this;
  12. console.log(options);
  13. that.setData({
  14. couponChannelId: options.couponChannelId,
  15. couponId: options.couponId
  16. })
  17. },
  18. getPhoneNumber: function(e) {
  19. var that = this;
  20. var iv = e.detail.iv;
  21. var encryptedData = e.detail.encryptedData;
  22. Http.post({
  23. url: config.api.getUserPhone,
  24. data: {
  25. encryptedData: encryptedData,
  26. iv: iv,
  27. }
  28. })
  29. .then(function(res) {
  30. console.log(res);
  31. app.globalData.phone = res.data.phone;
  32. wx.showToast({
  33. title: res.data.msg,
  34. icon: "success",
  35. success: function(res) {
  36. wx.redirectTo({
  37. url: '/pages/coupon/detail/index?id='+ that.data.couponChannelId + '&couponId='+ that.data.couponId +'&flag=pay'
  38. })
  39. }
  40. })
  41. },
  42. function(error) {
  43. wx.showToast({
  44. title: '请重新授权手机号',
  45. icon: "none",
  46. })
  47. })
  48. }
  49. })