pay.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. import common from '../../utils/util';
  2. import main from '../../utils/main';
  3. var app = getApp();
  4. var userid = 0;
  5. Page({
  6. data: {
  7. PayPanel: 0,
  8. },
  9. onPullDownRefresh: function () {
  10. this.gotoIndex();
  11. wx.stopPullDownRefresh();
  12. },
  13. onLoad: function (options) {
  14. userid = options.UserID;
  15. var PayType = options.PayType;
  16. var EndDate = options.EndDate;
  17. this.init(PayType, EndDate);
  18. },
  19. init: function (PayType, EndDate) {
  20. var that = this;
  21. EndDate = common.formatDateENG(EndDate, "/");
  22. main.getData('GetMiaoguoPayInfo3?EndDate=' + EndDate + '&PayType=' + PayType + '&UserID=' + app.globalData.userInfo.UserID, function (data) {
  23. if (data) {
  24. that.setData({
  25. Info: data,
  26. });
  27. }
  28. });
  29. },
  30. payMoney: function () {
  31. var that = this;
  32. var money = this.data.Info.PayMoney;
  33. var detail = {};
  34. detail.UserID = app.globalData.userInfo.UserID;
  35. detail.Introducer = app.globalData.userInfo.Introducer;
  36. for (var i = 0; i < that.data.Info.List1.length; i++) {
  37. if (that.data.Info.List1[i].Name == "有效期") {
  38. detail.EndTime = common.formatDateENG(that.data.Info.List1[i].Content,"/");
  39. }
  40. }
  41. detail = JSON.stringify(detail);
  42. console.log(detail);
  43. console.log(money);
  44. main.payMoney(7, null, money, detail, function () {
  45. that.setData({
  46. PayPanel: 1,
  47. });
  48. });
  49. },
  50. gotoIndex: function () {
  51. wx.reLaunch({
  52. url: '../index/index',
  53. })
  54. },
  55. onShareAppMessage: function () {
  56. return {
  57. title: app.globalData.ShareTitle,
  58. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  59. imageUrl: app.globalData.ShareImage,
  60. }
  61. },
  62. })