tuangou.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. function tuangou_init(tt) {
  2. $('#tg_publish').on('click', function () {
  3. window.location.href = "/yeweihui/tgPublish.html?userId=" + $('#userId').val();
  4. });
  5. $('#tg_publish2').on('click', function () {
  6. window.location.href = "/yeweihui/tgPublish.html?userId=" + $('#userId').val();
  7. });
  8. $('#tg_btnQZ1').on('click', function () {
  9. getListData();
  10. });
  11. $('#tg_btnQZ2').on('click', function () {
  12. getMyPbListData();
  13. });
  14. getListData();
  15. getMyPbListData();
  16. };
  17. function getListData() {
  18. let searchTitle = $('#tg_searchNum1').val();
  19. $.ajax({
  20. url: '/yeweihui/tuangou/list/query.json',
  21. type: 'post',
  22. data: {
  23. userId: $('#userId').val(),
  24. title: searchTitle
  25. },
  26. success: function (data) {
  27. if (data.success) {
  28. makeList(data.data);
  29. }
  30. else {
  31. $.alert("操作失败");
  32. }
  33. },
  34. error: function () {
  35. $.alert("网络异常");
  36. }
  37. });
  38. }
  39. function getMyPbListData() {
  40. let searchTitle = $('#tg_searchNum2').val();
  41. $.ajax({
  42. url: '/yeweihui/tuangou/mylist/query.json',
  43. type: 'post',
  44. data: {
  45. userId: $('#userId').val(),
  46. title: searchTitle
  47. },
  48. success: function (data) {
  49. if (data.success) {
  50. makeMyPublishList(data.data);
  51. }
  52. else {
  53. $.alert("操作失败");
  54. }
  55. },
  56. error: function () {
  57. $.alert("网络异常");
  58. }
  59. });
  60. }
  61. function makeList(list) {
  62. $('#tg_list1').empty();
  63. if (list == undefined || list.length <= 0) {
  64. $('#tg_list1').append('<div class="weui-loadmore weui-loadmore_line">\n' +
  65. ' <span class="weui-loadmore__tips">暂无数据</span>\n' +
  66. '</div>');
  67. return;
  68. }
  69. for (let i = 0; i < list.length; i++) {
  70. let item = list[i];
  71. let status = '';
  72. if (item.tgStatus == 1) {
  73. status = "在团";
  74. }
  75. else if (item.tgStatus == 2) {
  76. status = "发货";
  77. }
  78. else if (item.tgStatus == 3) {
  79. status = "完成";
  80. }
  81. else if (item.tgStatus == 4) {
  82. status = "取消";
  83. }
  84. let sstime = item.tgEndTime.toString().substring(5);
  85. $('#tg_list1').append($('<a href="javascript:tgItemSelect(' + "'" + item.jmId + "'" + ');" style="color: grey;">\n' +
  86. ' <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">\n' +
  87. ' <div style="width: 40%; padding-left:3vw; text-align: left; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.tgTitle + '</div>\n' +
  88. ' <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.currentNum + '</div>\n' +
  89. ' <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + sstime + '</div>\n' +
  90. ' <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + status + '</div>\n' +
  91. ' </div>\n' +
  92. ' </a>'));
  93. }
  94. }
  95. function makeMyPublishList(list) {
  96. $('#tg_list2').empty();
  97. if (list == undefined || list.length <= 0) {
  98. $('#tg_list2').append('<div class="weui-loadmore weui-loadmore_line">\n' +
  99. ' <span class="weui-loadmore__tips">暂无数据</span>\n' +
  100. '</div>');
  101. return;
  102. }
  103. for (let i = 0; i < list.length; i++) {
  104. let item = list[i];
  105. let status = '';
  106. if (item.tgStatus == 1) {
  107. status = "在团";
  108. }
  109. else if (item.tgStatus == 2) {
  110. status = "发货";
  111. }
  112. else if (item.tgStatus == 3) {
  113. status = "完成";
  114. }
  115. else if (item.tgStatus == 4) {
  116. status = "取消";
  117. }
  118. let sstime = item.tgEndTime.toString().substring(5);
  119. $('#tg_list2').append($('<a href="javascript:tgMyItemSelect(' + "'" + item.jmId + "'" + ');" style="color: grey;">\n' +
  120. ' <div style="display: flex; flex-direction: row; text-align: center; font-size: small; line-height: 5vh;">\n' +
  121. ' <div style="width: 40%; padding-left:3vw; text-align: left; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.tgTitle + '</div>\n' +
  122. ' <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + item.currentNum + '</div>\n' +
  123. ' <div style="width: 30%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + sstime + '</div>\n' +
  124. ' <div style="width: 15%; overflow:hidden;text-overflow:ellipsis;white-space:nowrap;">' + status + '</div>\n' +
  125. ' </div>\n' +
  126. ' </a>'));
  127. }
  128. }
  129. function tgItemSelect(jmId) {
  130. window.location.href = "/yeweihui/groupBuyingXx.html?jmId=" + jmId + "&userId=" + $('#userId').val();
  131. }
  132. function tgMyItemSelect(jmId) {
  133. window.location.href = "/yeweihui/groupBuyingXx.html?jmId=" + jmId + "&userId=" + $('#userId').val();
  134. }