pay.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. var app = getApp();
  4. var userid = 0;
  5. var introducer = 0;
  6. var payindex=1;
  7. Page({
  8. data: {
  9. PayPanel: 0,
  10. },
  11. onPullDownRefresh: function () {
  12. this.gotoIndex();
  13. wx.stopPullDownRefresh();
  14. },
  15. onLoad: function (options) {
  16. userid = options.UserID;
  17. introducer = options.Introducer;
  18. payindex = options.payindex;
  19. if (!payindex)
  20. payindex = 1;
  21. this.init(payindex);
  22. if (options.paypanel){
  23. this.setData({
  24. PayPanel: options.paypanel,
  25. });
  26. }
  27. if (!app.globalData.userInfo.IsMember){
  28. var imageUrl = wx.getStorageSync("MiaoguoCode");
  29. if (imageUrl) {
  30. this.setData({
  31. PayPanel: 2,
  32. });
  33. }
  34. }
  35. else{
  36. wx.removeStorageSync("MiaoguoCode");
  37. }
  38. },
  39. gotoPay: function () {
  40. this.setData({
  41. PayPanel: 1,
  42. });
  43. },
  44. init: function (param) {
  45. var that = this;
  46. main.getData('GetMiaoguoPayInfo2?payType=' + param+'&UserID='+app.globalData.userInfo.UserID, function (data) {
  47. if (data) {
  48. that.setData({
  49. Info: data,
  50. });
  51. }
  52. });
  53. },
  54. payMoney: function () {
  55. var that = this;
  56. var money = this.data.Info.PayMoney;
  57. var detail = {};
  58. detail.UserID = app.globalData.userInfo.UserID;
  59. detail.Introducer = app.globalData.introducer;
  60. detail = JSON.stringify(detail);
  61. console.log(money);
  62. main.payMoney(7, null, money, detail,function(){
  63. if (that.data.PayPanel == 1 && payindex==1){
  64. that.setData({
  65. PayPanel: 2,
  66. });
  67. wx.setStorageSync("MiaoguoCode", that.data.Info.Text7);
  68. }
  69. else if (that.data.PayPanel == 3 || (that.data.PayPanel == 1 && payindex > 1)) {
  70. that.setData({
  71. PayPanel: 4,
  72. })
  73. }
  74. })
  75. },
  76. copyManager: function () {
  77. wx.setClipboardData({
  78. data: this.data.Info.Text7,
  79. success(res) {
  80. wx.showModal({
  81. title: '已复制',
  82. showCancel: false,
  83. content: "复制成功,请在“添加朋友”中长按粘贴微信号。",
  84. confirmText: "知道了",
  85. });
  86. }
  87. })
  88. wx.setStorageSync("MiaoguoCode", this.data.Info.Text7);
  89. },
  90. gotoIndex:function(){
  91. wx.reLaunch({
  92. url: '../index/index',
  93. })
  94. },
  95. onShareAppMessage: function () {
  96. return {
  97. title: app.globalData.ShareTitle,
  98. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  99. imageUrl: app.globalData.ShareImage,
  100. }
  101. },
  102. })