C端小程序
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

53 行
1.5 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: "",
  8. couponId:""
  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. console.log("这是用户授权手机号的结果")
  32. console.log(that.data.couponChannelId)
  33. console.log(that.data.couponId)
  34. console.log("这是从立即支付传回来的值 因为用户没有授权手机号")
  35. app.globalData.phone = res.data.phone;
  36. wx.showToast({
  37. title: res.data.msg,
  38. icon: "success",
  39. success: function(res) {
  40. wx.redirectTo({
  41. url: '/pages/coupon/detail/index?couponChannelId='+ that.data.couponChannelId + '&couponId='+ that.data.couponId +'&flag=pay'
  42. })
  43. }
  44. })
  45. },
  46. function(error) {
  47. wx.showToast({
  48. title: '请重新授权手机号',
  49. icon: "none",
  50. })
  51. })
  52. }
  53. })