paylist.js 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. import common from '../../utils/util';
  2. import server from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. PayList: null,
  7. IsLogin:1,
  8. },
  9. onLoad: function (options) {
  10. this.setData({
  11. Containnerheight: common.getSystemHeight(),
  12. });
  13. if (app.globalData.userInfo)
  14. this.init();
  15. else{
  16. this.setData({
  17. IsLogin: -1,
  18. });
  19. }
  20. },
  21. init: function () {
  22. var that = this;
  23. server.getData('GetWXUsersAllPayInfo500?UserID=' + app.globalData.userInfo.UserID + "&ProductID=" + app.globalData.ProgramID, function (data) {
  24. if (data) {
  25. var list = server.getProgramList();
  26. for(var i=0;i<data.length;i++){
  27. for (var k = 0; k < data[i].List.length; k++) {
  28. var item = data[i].List[k];
  29. for(var j=0;j<list.length;j++){
  30. if (item.ProductID == list[j].ID) {
  31. item.ImageName = list[j].ImageUrl;
  32. item.ProductName = list[j].Name;
  33. }
  34. }
  35. }
  36. }
  37. that.setData({
  38. IsLogin: 1,
  39. PayList: data,
  40. });
  41. }
  42. else {
  43. that.setData({
  44. IsLogin: 1,
  45. PayList: [],
  46. });
  47. }
  48. });
  49. },
  50. showLogin:function(){
  51. this.setData({
  52. IsLogin: -2,
  53. });
  54. },
  55. hideLogin:function(){
  56. this.setData({
  57. IsLogin: -1,
  58. });
  59. },
  60. onKeyInput: function (e) {
  61. var that=this;
  62. that.setData({
  63. UserName: e.detail.value
  64. });
  65. },
  66. onKeyInput2: function (e) {
  67. var that=this;
  68. that.setData({
  69. UserPwd: e.detail.value
  70. });
  71. },
  72. login: function () {
  73. var that = this;
  74. server.getData('Login20221228?UserName=' + that.data.UserName + "&UserPwd="+that.data.UserPwd+"&ProductID=" + app.globalData.ProgramID, function (data) {
  75. if (data) {
  76. if (data>0){
  77. app.globalData.userInfo={};
  78. app.globalData.userInfo.UserID=data;
  79. that.init();
  80. }
  81. else {
  82. wx.showToast({
  83. title: '用户名或密码不正确',
  84. });
  85. }
  86. }
  87. else {
  88. wx.showToast({
  89. title: '登录出错',
  90. });
  91. }
  92. });
  93. },
  94. onShareAppMessage: function () {
  95. return {
  96. title: app.globalData.ShareTitle,
  97. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  98. imageUrl: app.globalData.ShareImage,
  99. }
  100. },
  101. });