list.js 5.3 KB

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