list.js 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  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/url/index.js");
  24. require("../../../sheep/config/zIndex.js");
  25. require("../../../sheep/api/member/signin.js");
  26. require("../../../sheep/helper/throttle.js");
  27. require("../../../sheep/platform/pay.js");
  28. require("../../../sheep/api/pay/order.js");
  29. require("../../../sheep/store/user.js");
  30. require("../../../sheep/store/cart.js");
  31. require("../../../sheep/api/trade/cart.js");
  32. require("../../../sheep/api/pay/wallet.js");
  33. require("../../../sheep/api/trade/order.js");
  34. require("../../../sheep/api/promotion/coupon.js");
  35. require("../../../sheep/store/sys.js");
  36. require("../../../sheep/store/modal.js");
  37. if (!Array) {
  38. const _easycom_su_tabs2 = common_vendor.resolveComponent("su-tabs");
  39. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  40. const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  41. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  42. (_easycom_su_tabs2 + _easycom_s_empty2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
  43. }
  44. const _easycom_su_tabs = () => "../../../sheep/ui/su-tabs/su-tabs.js";
  45. const _easycom_s_empty = () => "../../../sheep/components/s-empty/s-empty.js";
  46. const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  47. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  48. if (!Math) {
  49. (_easycom_su_tabs + commentItem + _easycom_s_empty + _easycom_uni_load_more + _easycom_s_layout)();
  50. }
  51. const commentItem = () => "../components/detail/comment-item.js";
  52. const _sfc_main = {
  53. __name: "list",
  54. setup(__props) {
  55. const state = common_vendor.reactive({
  56. id: 0,
  57. // 商品 SPU 编号
  58. type: [
  59. { type: 0, name: "全部" },
  60. { type: 1, name: "好评" },
  61. { type: 2, name: "中评" },
  62. { type: 3, name: "差评" }
  63. ],
  64. currentTab: 0,
  65. // 选中的 TAB
  66. loadStatus: "",
  67. pagination: {
  68. list: [],
  69. total: 0,
  70. pageNo: 1,
  71. pageSize: 10
  72. }
  73. });
  74. function onTabsChange(e) {
  75. state.currentTab = e.index;
  76. state.pagination.pageNo = 1;
  77. state.pagination.list = [];
  78. state.pagination.total = 0;
  79. getList();
  80. }
  81. async function getList() {
  82. state.loadStatus = "loading";
  83. let res = await sheep_api_product_comment.CommentApi.getCommentPage(
  84. state.id,
  85. state.pagination.pageNo,
  86. state.pagination.pageSize,
  87. state.type[state.currentTab].type
  88. );
  89. if (res.code !== 0) {
  90. return;
  91. }
  92. console.log(res);
  93. state.pagination.list = common_vendor._.concat(state.pagination.list, res.data.list);
  94. state.pagination.total = res.data.total;
  95. state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
  96. }
  97. function loadMore() {
  98. if (state.loadStatus === "noMore") {
  99. return;
  100. }
  101. state.pagination.pageNo++;
  102. getList();
  103. }
  104. common_vendor.onLoad((options) => {
  105. state.id = options.id;
  106. getList();
  107. });
  108. common_vendor.onReachBottom(() => {
  109. loadMore();
  110. });
  111. return (_ctx, _cache) => {
  112. return common_vendor.e({
  113. a: common_vendor.o(onTabsChange),
  114. b: common_vendor.p({
  115. list: state.type,
  116. scrollable: false,
  117. current: state.currentTab
  118. }),
  119. c: common_vendor.f(state.pagination.list, (item, k0, i0) => {
  120. return {
  121. a: "0df9e865-2-" + i0 + ",0df9e865-0",
  122. b: common_vendor.p({
  123. item
  124. }),
  125. c: item
  126. };
  127. }),
  128. d: state.pagination.total === 0
  129. }, state.pagination.total === 0 ? {
  130. e: common_vendor.p({
  131. text: "暂无数据",
  132. icon: "/static/data-empty.png"
  133. })
  134. } : {}, {
  135. f: state.pagination.total > 0
  136. }, state.pagination.total > 0 ? {
  137. g: common_vendor.o(loadMore),
  138. h: common_vendor.p({
  139. status: state.loadStatus,
  140. ["content-text"]: {
  141. contentdown: "上拉加载更多"
  142. }
  143. })
  144. } : {}, {
  145. i: common_vendor.p({
  146. title: "全部评价"
  147. })
  148. });
  149. };
  150. }
  151. };
  152. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-0df9e865"], ["__file", "D:/zx/mall-front-app/pages/goods/comment/list.vue"]]);
  153. wx.createPage(MiniProgramPage);