paylist.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. import common from '../../utils/util';
  2. import server from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. PayList: [],
  7. IsActive: false,
  8. },
  9. onLoad: function (options) {
  10. //测试*****************
  11. if (!app.globalData.userInfo)
  12. app.globalData.userInfo = { UserID: 4 };
  13. this.setData({
  14. Height: common.getSystemHeight(),
  15. });
  16. this.init();
  17. },
  18. init: function () {
  19. var that = this;
  20. server.getLocalHost(function () {
  21. server.getData('GetWXUsersAllPayInfo?UserID=' + app.globalData.userInfo.UserID, function (data) {
  22. if (data) {
  23. for (var i = 0; i < data.length; i++) {
  24. for (var j = 0; j < data[i].List.length; j++) {
  25. data[i].List[j].isShowActivty = false;
  26. if (data[i].List[j].Status == 0) {
  27. data[i].List[j].isShowActivty = true;
  28. }
  29. }
  30. }
  31. that.setData({
  32. PayList: data,
  33. });
  34. }
  35. });
  36. });
  37. },
  38. gotoActive: function (e) {
  39. var that = this;
  40. var productid = e.currentTarget.dataset.productid;
  41. var list = server.getProgramList();
  42. for (var i = 0; i < list.length; i++) {
  43. if (productid == list[i].ID) {
  44. var path = list[i].path;
  45. path += "&ProductBuyInfoID=" + e.currentTarget.dataset.id;
  46. path += "&ProductID=" + app.globalData.ProgramID;
  47. path += "&ProductUserID=" + app.globalData.userInfo.UserID;
  48. path += "&BuyType=" + e.currentTarget.dataset.buytype;
  49. wx.navigateToMiniProgram({
  50. appId: list[i].appId,
  51. path: path,
  52. success(res) {
  53. }
  54. });
  55. var data = this.data.PayList;
  56. for (var i = 0; i < data.length; i++) {
  57. for (var j = 0; j < data[i].List.length; j++) {
  58. if (data[i].List[j].ProductID == productid) {
  59. data[i].List[j].isShowActivty = false;
  60. }
  61. }
  62. }
  63. that.setData({
  64. PayList: data,
  65. });
  66. break;
  67. }
  68. }
  69. },
  70. refresh: function () {
  71. var that = this;
  72. wx.showLoading({
  73. title: '加载中',
  74. });
  75. setTimeout(function () {
  76. wx.hideLoading();
  77. that.init();
  78. }, 1000);
  79. },
  80. onShareAppMessage: function () {
  81. return {
  82. title: app.globalData.ShareTitle,
  83. path: 'pages/index/index?UserID=' + app.globalData.userInfo.UserID,
  84. imageUrl: '../../images/07001.png',
  85. }
  86. },
  87. })