import common from '../../utils/util'; import main from '../../utils/main'; var app = getApp(); var userid = 0; var introducer = 0; var payindex=1; Page({ data: { PayPanel: 0, }, onPullDownRefresh: function () { this.gotoIndex(); wx.stopPullDownRefresh(); }, onLoad: function (options) { userid = options.UserID; introducer = options.Introducer; payindex = options.payindex; if (!payindex) payindex = 1; this.init(payindex); if (options.paypanel){ this.setData({ PayPanel: options.paypanel, }); } if (!app.globalData.userInfo.IsMember){ var imageUrl = wx.getStorageSync("MiaoguoCode"); if (imageUrl) { this.setData({ PayPanel: 2, }); } } else{ wx.removeStorageSync("MiaoguoCode"); } }, gotoPay: function () { this.setData({ PayPanel: 1, }); }, init: function (param) { var that = this; main.getData('GetMiaoguoPayInfo2?payType=' + param+'&UserID='+app.globalData.userInfo.UserID, function (data) { if (data) { that.setData({ Info: data, }); } }); }, payMoney: function () { var that = this; var money = this.data.Info.PayMoney; var detail = {}; detail.UserID = app.globalData.userInfo.UserID; detail.Introducer = app.globalData.introducer; detail = JSON.stringify(detail); console.log(money); main.payMoney(7, null, money, detail,function(){ if (that.data.PayPanel == 1 && payindex==1){ that.setData({ PayPanel: 2, }); wx.setStorageSync("MiaoguoCode", that.data.Info.Text7); } else if (that.data.PayPanel == 3 || (that.data.PayPanel == 1 && payindex > 1)) { that.setData({ PayPanel: 4, }) } }) }, copyManager: function () { wx.setClipboardData({ data: this.data.Info.Text7, success(res) { wx.showModal({ title: '已复制', showCancel: false, content: "复制成功,请在“添加朋友”中长按粘贴微信号。", confirmText: "知道了", }); } }) wx.setStorageSync("MiaoguoCode", this.data.Info.Text7); }, gotoIndex:function(){ wx.reLaunch({ url: '../index/index', }) }, onShareAppMessage: function () { return { title: app.globalData.ShareTitle, path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID, imageUrl: app.globalData.ShareImage, } }, })