| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- import common from '../../utils/util';
- import server from '../../utils/main';
- const app = getApp();
- Page({
- data: {
- PayList: null,
- IsShowActivty: false,
- },
- onLoad: function (options) {
- //测试*****************
- // if (!app.globalData.userInfo)
- // app.globalData.userInfo = { UserID: 4 };
- var UnloadType = "";
- if (options && options.type)
- UnloadType = options.type;
- this.setData({
- Height: common.getSystemHeight(),
- UnloadType: UnloadType,
- });
- this.init();
- },
- onUnload: function () {
- if (this.data.UnloadType == "finished") {
- wx.reLaunch({
- url: '../main/index'
- });
- }
- },
- init: function () {
- var that = this;
- server.getData('GetWXUsersAllPayInfo?UserID=' + app.globalData.userInfo.UserID + "&ProductID=" + app.globalData.ProgramID, function (data) {
- if (data) {
- var isShowActivty = false;
- for (var i = 0; i < data.length; i++) {
- for (var j = 0; j < data[i].List.length; j++) {
- data[i].List[j].isShowActivty = false;
- if (data[i].List[j].Status == 0) {
- data[i].List[j].isShowActivty = true;
- isShowActivty = true;
- }
- }
- }
- that.setData({
- PayList: data,
- IsShowActivty: isShowActivty,
- });
- if (isShowActivty)
- wx.setStorageSync("IsShowActivty", isShowActivty);
- else
- wx.removeStorageSync("IsShowActivty");
- }
- else {
- that.setData({
- PayList: [],
- });
- }
- });
- },
- gotoActive: function (e) {
- var that = this;
- var productid = e.currentTarget.dataset.productid;
- var list = server.getProgramList();
- for (var i = 0; i < list.length; i++) {
- if (productid == list[i].ID) {
- var path = list[i].path;
- path += "&ProductBuyInfoID=" + e.currentTarget.dataset.id;
- path += "&ProductID=" + app.globalData.ProgramID;
- path += "&ProductUserID=" + app.globalData.userInfo.UserID;
- path += "&BuyType=" + e.currentTarget.dataset.buytype;
- wx.navigateToMiniProgram({
- appId: list[i].appId,
- path: path,
- success(res) {
- }
- });
- var data = this.data.PayList;
- for (var i = 0; i < data.length; i++) {
- for (var j = 0; j < data[i].List.length; j++) {
- if (data[i].List[j].ProductID == productid) {
- data[i].List[j].isShowActivty = false;
- }
- }
- }
- that.setData({
- PayList: data,
- });
- break;
- }
- }
- },
- gotoFeedback: function () {
- server.gotoFeedback();
- },
- refresh: function () {
- var that = this;
- wx.showLoading({
- title: '加载中',
- });
- setTimeout(function () {
- wx.hideLoading();
- that.init();
- }, 1000);
- },
- onShareAppMessage: function () {
- return {
- title: app.globalData.ShareTitle,
- path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
- imageUrl: '../../images/07001.png',
- }
- },
- })
|