patternMenu.js 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. // pages/patternList/patternList.js
  2. var app = getApp();
  3. var yongtuList = [];
  4. var duxiangList = [];
  5. Page({
  6. data: {
  7. urlHttp: '',
  8. yongtuList : yongtuList,
  9. duxiangList : duxiangList,
  10. yongtuLength : 0,
  11. duixiangLength : 0,
  12. activeTab1 : -1, //tab选中状态值
  13. activeTab2: -1,
  14. activeTab3: -1,
  15. activeId1 : -1, //记录选中tab的id
  16. activeId2: -1,
  17. activeId3: -1,
  18. activeName1: '', //记录选中tab的名称
  19. activeName2: '',
  20. activeName3: '',
  21. hiddenmodal: true, //弹窗
  22. },
  23. onLoad: function (options) {
  24. var that = this;
  25. var host = getApp().globalData.servsers;
  26. that.setData({
  27. urlHttp: host
  28. })
  29. wx.request({
  30. url: host + "commodityapi/findAllScene",
  31. data: {
  32. },
  33. method: 'GET', // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
  34. header: {
  35. 'Accept': 'application/json'
  36. },
  37. success: function (res) {
  38. var yongtuLength = res.data.purposeList.length;
  39. console.log(res.data.objectList)
  40. var duixiangLength = res.data.objectList.length;
  41. that.setData({
  42. yongtuList: res.data.purposeList,
  43. duxiangList: res.data.objectList,
  44. yongtuLength: yongtuLength,
  45. duixiangLength: duixiangLength
  46. })
  47. }
  48. })
  49. },
  50. //送礼用途
  51. yongtuClick:function(e){
  52. var that = this;
  53. var id = e.currentTarget.dataset.id;
  54. var activeName1 = e.currentTarget.dataset.name;
  55. var flagId = e.currentTarget.dataset.flagid;
  56. that.setData({
  57. activeTab1 : id,
  58. activeName1: activeName1,
  59. activeId1: flagId
  60. })
  61. },
  62. //送礼对象
  63. duixiangClick: function (e) {
  64. var that = this;
  65. var id = e.currentTarget.dataset.id;
  66. var activeName2 = e.currentTarget.dataset.name;
  67. var flagId = e.currentTarget.dataset.flagid;
  68. that.setData({
  69. activeTab2: id,
  70. activeName2: activeName2,
  71. activeId2: flagId
  72. })
  73. },
  74. //预算范围
  75. fanweiClick:function(e){
  76. var that = this;
  77. var id = e.currentTarget.dataset.id;
  78. var activeName3 = e.currentTarget.dataset.name;
  79. var flagId = e.currentTarget.dataset.flagid;
  80. that.setData({
  81. activeTab3: id,
  82. activeName3: activeName3,
  83. activeId3: flagId
  84. })
  85. },
  86. //生成礼品清单
  87. saveChange:function(e){
  88. var that = this;
  89. var host = getApp().globalData.servsers;
  90. var activeId1 = that.data.activeId1;
  91. var activeId2 = that.data.activeId2;
  92. var activeId3 = that.data.activeId3;
  93. var activeName1 = that.data.activeName1;
  94. var activeName2 = that.data.activeName2;
  95. var activeName3 = that.data.activeName3;
  96. if (activeId1 == -1) {
  97. that.setData({
  98. hiddenmodal: false,
  99. modalCont: '请选择送礼用途'
  100. })
  101. setTimeout(function () {
  102. that.setData({
  103. hiddenmodal: true
  104. })
  105. }, 1000)
  106. return false;
  107. }
  108. if (activeId2 == -1) {
  109. that.setData({
  110. hiddenmodal: false,
  111. modalCont: '请选择送礼对象'
  112. })
  113. setTimeout(function () {
  114. that.setData({
  115. hiddenmodal: true
  116. })
  117. }, 1000)
  118. return false;
  119. }
  120. if (activeId3 == -1) {
  121. that.setData({
  122. hiddenmodal: false,
  123. modalCont: '请选择预算范围'
  124. })
  125. setTimeout(function () {
  126. that.setData({
  127. hiddenmodal: true
  128. })
  129. }, 1000)
  130. return false;
  131. }
  132. wx.navigateTo({
  133. url: '/pages/patternList/patternList?activeId1=' + that.data.activeId1 +
  134. '&activeName1=' + activeName1 +
  135. '&activeId2=' + that.data.activeId2 +
  136. '&activeName2=' + activeName2 +
  137. '&activeId3=' + activeId3 +
  138. '&activeName3=' + activeName3
  139. })
  140. }
  141. })
  142. var that;
  143. var Util = require('../../utils/util.js');