list.js 1.9 KB

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