buy.ftl 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <div class="page__bd">
  2. <div class="weui-tab">
  3. <div class="weui-navbar">
  4. <a class="weui-navbar__item weui-bar__item_on" target="#buy_nav1" module="buy_zhu" onclick="buyGroup()">
  5. 团购信息
  6. </a>
  7. <a class="weui-navbar__item" target="#buy_nav2" module="buy_zhu" id="buy_help" onclick="buyGroup2()">
  8. 我的团购
  9. </a>
  10. </div>
  11. <div class="weui-tab__panel"><#--团购信息的列表-->
  12. <div id="buy_nav1" style="text-align: center ">
  13. 团购信息
  14. <div class="container">
  15. <div class="weui-form-preview"
  16. id="buyListGroup">
  17. <div style="display: flex; flex-direction: row; color: grey; font-size: medium;">
  18. <div style="width: 38%; text-align: center;color: #0a001f">标题</div>
  19. <div style="width: 12%; text-align: center;color: #0a001f">已团</div>
  20. <div style="width: 35%; text-align: center;color: #0a001f">截止时间</div>
  21. <div style="width: 15%; text-align: center;color: #0a001f">状态</div>
  22. </div>
  23. </div>
  24. </div>
  25. <div class="container">
  26. <div id="buyAll" class="weui-panel__bd">
  27. <#-- <a href="javascript:void(0);" style="color: grey;font-size: large">
  28. <div style="display: flex; flex-direction: row; text-align: center; font-size: x-small; line-height: 5vh;"
  29. onclick=" myBuyClick()">
  30. <div style="width: 40%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
  31. 蔬菜套餐,猪肉牛肉金针菇等
  32. </div>
  33. <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
  34. 24/100
  35. </div>
  36. <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
  37. 02/02 14:30
  38. </div>
  39. <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 12px">
  40. 在团
  41. </div>
  42. </div>
  43. </a>-->
  44. </div>
  45. <div style="height: 20vh"></div>
  46. </div>
  47. </div>
  48. <div id="buy_nav2" style="display: none"><#--我的团购信息-->
  49. <div class="weui-form-preview">
  50. <div style="display: flex; flex-direction: row; color: grey; font-size: medium;">
  51. <div style="width: 33%; text-align: center;color: #0a001f">我的订单</div>
  52. <div style="width: 33%; text-align: center;color: #0a001f">提交时间</div>
  53. <div style="width: 33%; text-align: center;color: #0a001f">订单状态</div>
  54. </div>
  55. </div>
  56. <div class="container">
  57. <div id="MyBuyAll">
  58. </div>
  59. <div style="height: 20vh"></div>
  60. </div>
  61. </div>
  62. </div>
  63. </div>
  64. <script>
  65. //商品的团购信息的展示
  66. function buyGroup() {
  67. console.log('商品团购')
  68. $('#buy_nav1')[0].style.display = '';
  69. $('#buyListGroup')[0].style.display = '';
  70. $('#buy_nav2')[0].style.display = 'none';
  71. $('#buyAll')[0].style.display = '';
  72. $('#buyAll').empty();//清除节点
  73. $.ajax({
  74. url: '/home/buy/group',
  75. type: 'get',
  76. data: {userId: $('#userId').val()},
  77. success: function (data) {
  78. if (data.success) {
  79. if (data.data.length > 0) {
  80. hasData = true;
  81. data.data.forEach(function (v) {
  82. buyList(v);
  83. });
  84. }
  85. else {
  86. }
  87. }
  88. },
  89. });
  90. }
  91. function buyList(v) {
  92. $('#buyAll').append(' <a href="javascript:void(0);" style="color: grey;font-size: large" data-id="form"\n' +
  93. ' onclick=\'myBuyClick(' + JSON.stringify(v) + ')\'>\n' +
  94. ' <div style="display: flex; flex-direction: row; text-align: center; font-size: x-small; line-height: 4vh;">\n' +
  95. ' <div style="width: 38%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px;text-align: left;">' + v.tgTitle + '</div>\n' +
  96. ' <div style="width: 12%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">\n' + v.count + '</div>\n' +
  97. ' <div style="width: 35%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + sub(v.tgEndTime) + '</div>\n' +
  98. ' <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + getStatus(v.tgStatus) + '</div>\n' +
  99. ' <div class="weui-textarea-counter">\n' + '</div></div>\n' +
  100. ' </a>');
  101. }
  102. //点击我的团购按钮
  103. function buyGroup2() {
  104. $('#buy_nav1')[0].style.display = 'none';
  105. $('#buyListGroup')[0].style.display = 'none';
  106. $('#buyAll')[0].style.display = 'none';
  107. $('#buy_nav2')[0].style.display = '';
  108. $('#MyBuyAll').empty();
  109. $.ajax({
  110. url: '/home/Mygroup/group',
  111. type: 'get',
  112. data: {userId: $('#userId').val()},
  113. success: function (data) {
  114. if (data.success) {
  115. if (data.data.length > 0) {
  116. hasData = true;
  117. data.data.forEach(function (v) {
  118. MybuyList(v);
  119. });
  120. }
  121. else {
  122. }
  123. }
  124. },
  125. });
  126. }
  127. function MybuyList(v) {
  128. $('#MyBuyAll').append('<a href="javascript:void(0);" style="color: grey;font-size: large" data-id="form" onclick=\'myBuyClick2(' + JSON.stringify(v) + ')\'>\n' +
  129. ' <div style="display: flex; flex-direction: row; text-align: center; font-size: x-small; line-height: 4vh;">\n' +
  130. ' <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px;text-align: left;">' + v.tgTitle + '</div>\n' +
  131. ' <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + timestampY(v.timeCreate) + '</div>\n' +
  132. ' <div style="width: 33%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size: 14px">' + getStatus(v.tgStatus) + '</div>\n' +
  133. ' </div>\n' + ' </a>')
  134. }
  135. function myBuyClick2(v) {
  136. if (v.buyStatus != 1) {
  137. return $.alert("该订单已经取消");
  138. }
  139. window.location.href = "/home/buytc.html?userId=" + $('#userId').val() + "&jmId=" + v.jmId + "&type=" + 2 + "&tgStatus=" + v.tgStatus + "&buyId=" + v.buyId;
  140. }
  141. /*居民求助信息*/
  142. function myBuyClick(v) {
  143. window.location.href = "/home/buytc.html?userId=" + $('#userId').val() + "&jmId=" + v.jmId + "&type=" + 1 + "&tgStatus=" + v.tgStatus + "&buyId=" + 1;
  144. }
  145. function tugouStatus(status) {
  146. if (status == 1) {
  147. return "<span style='color:Black;'>在团</span>";
  148. } else if (status == 2) {
  149. return "<span style='color:Black;'>处理中</span>";
  150. } else {
  151. return "<span style='color:green;'>已完成</span>";
  152. }
  153. }
  154. //1 在团 2 发货 3完成 4取消',
  155. function getStatus(v) {
  156. if (v == 1) {
  157. return "<span style='color:green;'>在团</span>";
  158. } else if (v == 2) {
  159. return "<span style='color:Black;'>发货</span>";
  160. } else if (v == 3) {
  161. return "完成";
  162. } else if (v == 4) {
  163. return "<span style='color:red;'>取消</span>";
  164. }
  165. }
  166. function timestampY(timestamp) {
  167. var date = new Date(timestamp); //时间戳为10位需*1000,时间戳为13位的话不需乘1000
  168. var Y = date.getFullYear() + '-';
  169. var M = ((date.getMonth() + 1) < 10) ? ('0' + (date.getMonth() + 1) + '-') : ((date.getMonth() + 1) + '-');
  170. var D = (date.getDate() < 10) ? ('0' + date.getDate() + ' ') : (date.getDate() + ' ');
  171. var h = (date.getHours() < 10) ? ('0' + date.getHours() + ':') : (date.getHours() + ':');
  172. var m = (date.getMinutes() < 10) ? ('0' + date.getMinutes() + '') : (date.getMinutes() + '');
  173. var s = (date.getSeconds() < 10) ? ('0' + date.getSeconds()) : (date.getSeconds());
  174. return M + D + h + m;
  175. }
  176. //保留月日时间
  177. function sub(v) {
  178. return v.substring(5, v.length);
  179. }
  180. //角色
  181. function type(v) {
  182. if (v == 0) {
  183. return "管理员";
  184. } else {
  185. return "指挥部";
  186. }
  187. }
  188. </script>