tuangou.js 5.2 KB

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