list.js 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_api_product_comment = require("../../../sheep/api/product/comment.js");
  4. require("../../../sheep/request/index.js");
  5. require("../../../sheep/config/index.js");
  6. require("../../../sheep/store/index.js");
  7. require("../../../sheep/store/app.js");
  8. require("../../../sheep/api/promotion/diy.js");
  9. require("../../../sheep/platform/index.js");
  10. require("../../../sheep/platform/provider/wechat/index.js");
  11. require("../../../sheep/platform/provider/wechat/miniProgram.js");
  12. require("../../../sheep/api/member/auth.js");
  13. require("../../../sheep/api/member/social.js");
  14. require("../../../sheep/api/member/user.js");
  15. require("../../../sheep/platform/provider/apple/index.js");
  16. require("../../../sheep/platform/share.js");
  17. require("../../../sheep/router/index.js");
  18. require("../../../sheep/hooks/useModal.js");
  19. require("../../../sheep/helper/index.js");
  20. require("../../../sheep/helper/test.js");
  21. require("../../../sheep/helper/digit.js");
  22. require("../../../sheep/index.js");
  23. require("../../../sheep/api/index.js");
  24. require("../../../sheep/api/distri/score.js");
  25. require("../../../sheep/api/distri/share.js");
  26. require("../../../sheep/api/distri/team.js");
  27. require("../../../sheep/api/infra/file.js");
  28. require("../../../sheep/api/member/address.js");
  29. require("../../../sheep/api/member/point.js");
  30. require("../../../sheep/api/member/signin.js");
  31. require("../../../sheep/api/migration/app.js");
  32. require("../../../sheep/api/migration/chat.js");
  33. require("../../../sheep/api/migration/index.js");
  34. require("../../../sheep/api/migration/third.js");
  35. require("../../../sheep/api/pay/channel.js");
  36. require("../../../sheep/api/pay/order.js");
  37. require("../../../sheep/api/pay/wallet.js");
  38. require("../../../sheep/api/product/category.js");
  39. require("../../../sheep/api/product/favorite.js");
  40. require("../../../sheep/api/product/history.js");
  41. require("../../../sheep/api/product/spu.js");
  42. require("../../../sheep/api/promotion/activity.js");
  43. require("../../../sheep/api/promotion/article.js");
  44. require("../../../sheep/api/promotion/bargain.js");
  45. require("../../../sheep/api/promotion/combination.js");
  46. require("../../../sheep/api/promotion/coupon.js");
  47. require("../../../sheep/api/promotion/rewardActivity.js");
  48. require("../../../sheep/api/promotion/seckill.js");
  49. require("../../../sheep/api/system/area.js");
  50. require("../../../sheep/api/system/voice.js");
  51. require("../../../sheep/api/trade/afterSale.js");
  52. require("../../../sheep/api/trade/brokerage.js");
  53. require("../../../sheep/api/trade/cart.js");
  54. require("../../../sheep/api/trade/config.js");
  55. require("../../../sheep/api/trade/delivery.js");
  56. require("../../../sheep/api/trade/order.js");
  57. require("../../../sheep/url/index.js");
  58. require("../../../sheep/config/zIndex.js");
  59. require("../../../sheep/helper/throttle.js");
  60. require("../../../sheep/platform/pay.js");
  61. require("../../../sheep/store/user.js");
  62. require("../../../sheep/store/cart.js");
  63. require("../../../sheep/store/sys.js");
  64. require("../../../sheep/store/modal.js");
  65. if (!Array) {
  66. const _easycom_su_tabs2 = common_vendor.resolveComponent("su-tabs");
  67. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  68. const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  69. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  70. (_easycom_su_tabs2 + _easycom_s_empty2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
  71. }
  72. const _easycom_su_tabs = () => "../../../sheep/ui/su-tabs/su-tabs.js";
  73. const _easycom_s_empty = () => "../../../sheep/components/s-empty/s-empty.js";
  74. const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  75. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  76. if (!Math) {
  77. (_easycom_su_tabs + commentItem + _easycom_s_empty + _easycom_uni_load_more + _easycom_s_layout)();
  78. }
  79. const commentItem = () => "../components/detail/comment-item.js";
  80. const _sfc_main = {
  81. __name: "list",
  82. setup(__props) {
  83. const state = common_vendor.reactive({
  84. id: 0,
  85. // 商品 SPU 编号
  86. type: [
  87. { type: 0, name: "全部" },
  88. { type: 1, name: "好评" },
  89. { type: 2, name: "中评" },
  90. { type: 3, name: "差评" }
  91. ],
  92. currentTab: 0,
  93. // 选中的 TAB
  94. loadStatus: "",
  95. pagination: {
  96. list: [],
  97. total: 0,
  98. pageNo: 1,
  99. pageSize: 10
  100. }
  101. });
  102. function onTabsChange(e) {
  103. state.currentTab = e.index;
  104. state.pagination.pageNo = 1;
  105. state.pagination.list = [];
  106. state.pagination.total = 0;
  107. getList();
  108. }
  109. async function getList() {
  110. state.loadStatus = "loading";
  111. let res = await sheep_api_product_comment.CommentApi.getCommentPage(
  112. state.id,
  113. state.pagination.pageNo,
  114. state.pagination.pageSize,
  115. state.type[state.currentTab].type
  116. );
  117. if (res.code !== 0) {
  118. return;
  119. }
  120. console.log(res);
  121. state.pagination.list = common_vendor._.concat(state.pagination.list, res.data.list);
  122. state.pagination.total = res.data.total;
  123. state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
  124. }
  125. function loadMore() {
  126. if (state.loadStatus === "noMore") {
  127. return;
  128. }
  129. state.pagination.pageNo++;
  130. getList();
  131. }
  132. common_vendor.onLoad((options) => {
  133. state.id = options.id;
  134. getList();
  135. });
  136. common_vendor.onReachBottom(() => {
  137. loadMore();
  138. });
  139. return (_ctx, _cache) => {
  140. return common_vendor.e({
  141. a: common_vendor.o(onTabsChange),
  142. b: common_vendor.p({
  143. list: state.type,
  144. scrollable: false,
  145. current: state.currentTab
  146. }),
  147. c: common_vendor.f(state.pagination.list, (item, k0, i0) => {
  148. return {
  149. a: "0df9e865-2-" + i0 + ",0df9e865-0",
  150. b: common_vendor.p({
  151. item
  152. }),
  153. c: item
  154. };
  155. }),
  156. d: state.pagination.total === 0
  157. }, state.pagination.total === 0 ? {
  158. e: common_vendor.p({
  159. text: "暂无数据",
  160. icon: "/static/data-empty.png"
  161. })
  162. } : {}, {
  163. f: state.pagination.total > 0
  164. }, state.pagination.total > 0 ? {
  165. g: common_vendor.o(loadMore),
  166. h: common_vendor.p({
  167. status: state.loadStatus,
  168. ["content-text"]: {
  169. contentdown: "上拉加载更多"
  170. }
  171. })
  172. } : {}, {
  173. i: common_vendor.p({
  174. title: "全部评价"
  175. })
  176. });
  177. };
  178. }
  179. };
  180. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0df9e865"], ["__file", "D:/zx/mall-front-app/pages/goods/comment/list.vue"]]);
  181. wx.createPage(MiniProgramPage);