list.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. import common from '../../utils/util';
  2. import server from '../../utils/main';
  3. const app = getApp();
  4. Page({
  5. data: {
  6. IsGift:true,
  7. },
  8. onLoad: function (options) {
  9. var isgift = Number(options.IsGift);
  10. this.setData({
  11. Containnerheight: common.getSystemHeight(),
  12. ProgramList: server.getProgramList(),
  13. MathShow: false,
  14. ChineseShow: false,
  15. AllShow: false,
  16. MathGiftShow: false,
  17. AllGiftShow: false,
  18. IsGift: isgift,
  19. });
  20. if (isgift==1){
  21. wx.setNavigationBarTitle({
  22. title: '购买礼品卡',
  23. })
  24. }
  25. this.init();
  26. },
  27. init:function(){
  28. var arrProduct = wx.getStorageSync("ProductPrice");
  29. var arr=[];
  30. for(var i=0;i<arrProduct.length;i++){
  31. if (arrProduct[i].ProductNum.indexOf(",")>0){
  32. arr.push(arrProduct[i]);
  33. }
  34. }
  35. var CurrentProduct;
  36. for (var i = 0; i < arrProduct.length; i++) {
  37. if (arrProduct[i].ProductNum == app.globalData.ProgramID) {
  38. CurrentProduct=arrProduct[i];
  39. }
  40. }
  41. this.setData({
  42. ProductList:arr,
  43. CurrentProduct: CurrentProduct,
  44. });
  45. },
  46. showList: function (e) {
  47. var id = e.currentTarget.dataset.id;
  48. this.data[id] = true;
  49. this.setData(this.data);
  50. },
  51. gotoOrder: function (e) {
  52. var id = e.currentTarget.dataset.id;
  53. var paytype = e.currentTarget.dataset.paytype;
  54. wx.navigateTo({
  55. url: "./order?id=" + id + "&paytype=" + paytype,
  56. });
  57. },
  58. switchProgram: function (e) {
  59. wx.navigateToMiniProgram({
  60. appId: e.currentTarget.dataset.appid,
  61. path: e.currentTarget.dataset.path,
  62. extraData: {
  63. },
  64. success(res) {
  65. // 打开成功
  66. }
  67. });
  68. },
  69. onShareAppMessage: function () {
  70. return {
  71. title: app.globalData.ShareTitle,
  72. path: app.globalData.SharePath + '?UserID=' + app.globalData.userInfo.UserID,
  73. imageUrl: app.globalData.ShareImage,
  74. }
  75. },
  76. })