detail-comment-card.js 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. "use strict";
  2. const common_vendor = require("../../../../common/vendor.js");
  3. const sheep_index = require("../../../../sheep/index.js");
  4. const sheep_api_product_comment = require("../../../../sheep/api/product/comment.js");
  5. require("../../../../sheep/api/index.js");
  6. require("../../../../sheep/api/distri/score.js");
  7. require("../../../../sheep/request/index.js");
  8. require("../../../../sheep/config/index.js");
  9. require("../../../../sheep/store/index.js");
  10. require("../../../../sheep/store/app.js");
  11. require("../../../../sheep/api/promotion/diy.js");
  12. require("../../../../sheep/platform/index.js");
  13. require("../../../../sheep/platform/provider/wechat/index.js");
  14. require("../../../../sheep/platform/provider/wechat/miniProgram.js");
  15. require("../../../../sheep/api/member/auth.js");
  16. require("../../../../sheep/api/member/social.js");
  17. require("../../../../sheep/api/member/user.js");
  18. require("../../../../sheep/platform/provider/apple/index.js");
  19. require("../../../../sheep/platform/share.js");
  20. require("../../../../sheep/router/index.js");
  21. require("../../../../sheep/hooks/useModal.js");
  22. require("../../../../sheep/helper/index.js");
  23. require("../../../../sheep/helper/test.js");
  24. require("../../../../sheep/helper/digit.js");
  25. require("../../../../sheep/api/member/signin.js");
  26. require("../../../../sheep/helper/throttle.js");
  27. require("../../../../sheep/url/index.js");
  28. require("../../../../sheep/platform/pay.js");
  29. require("../../../../sheep/api/pay/order.js");
  30. require("../../../../sheep/store/user.js");
  31. require("../../../../sheep/store/cart.js");
  32. require("../../../../sheep/api/trade/cart.js");
  33. require("../../../../sheep/api/pay/wallet.js");
  34. require("../../../../sheep/api/trade/order.js");
  35. require("../../../../sheep/api/promotion/coupon.js");
  36. require("../../../../sheep/store/sys.js");
  37. require("../../../../sheep/store/modal.js");
  38. require("../../../../sheep/api/distri/share.js");
  39. require("../../../../sheep/api/distri/team.js");
  40. require("../../../../sheep/api/infra/file.js");
  41. require("../../../../sheep/api/member/address.js");
  42. require("../../../../sheep/api/member/point.js");
  43. require("../../../../sheep/api/migration/app.js");
  44. require("../../../../sheep/api/migration/chat.js");
  45. require("../../../../sheep/api/migration/index.js");
  46. require("../../../../sheep/api/migration/third.js");
  47. require("../../../../sheep/api/pay/channel.js");
  48. require("../../../../sheep/api/product/category.js");
  49. require("../../../../sheep/api/product/favorite.js");
  50. require("../../../../sheep/api/product/history.js");
  51. require("../../../../sheep/api/product/spu.js");
  52. require("../../../../sheep/api/promotion/activity.js");
  53. require("../../../../sheep/api/promotion/article.js");
  54. require("../../../../sheep/api/promotion/bargain.js");
  55. require("../../../../sheep/api/promotion/combination.js");
  56. require("../../../../sheep/api/promotion/rewardActivity.js");
  57. require("../../../../sheep/api/promotion/seckill.js");
  58. require("../../../../sheep/api/system/area.js");
  59. require("../../../../sheep/api/system/voice.js");
  60. require("../../../../sheep/api/trade/afterSale.js");
  61. require("../../../../sheep/api/trade/brokerage.js");
  62. require("../../../../sheep/api/trade/config.js");
  63. require("../../../../sheep/api/trade/delivery.js");
  64. require("../../../../sheep/config/zIndex.js");
  65. if (!Array) {
  66. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  67. _easycom_s_empty2();
  68. }
  69. const _easycom_s_empty = () => "../../../../sheep/components/s-empty/s-empty.js";
  70. if (!Math) {
  71. (commentItem + _easycom_s_empty)();
  72. }
  73. const commentItem = () => "./comment-item.js";
  74. const _sfc_main = {
  75. __name: "detail-comment-card",
  76. props: {
  77. goodsId: {
  78. type: [Number, String],
  79. default: 0
  80. }
  81. },
  82. setup(__props) {
  83. const props = __props;
  84. const state = common_vendor.reactive({
  85. commentList: [],
  86. // 评论列表,只展示最近的 3 条
  87. total: 0
  88. // 总评论数
  89. });
  90. async function getComment(id) {
  91. const { data } = await sheep_api_product_comment.CommentApi.getCommentPage(id, 1, 3, 0);
  92. state.commentList = data.list;
  93. state.total = data.total;
  94. }
  95. common_vendor.onBeforeMount(() => {
  96. getComment(props.goodsId);
  97. });
  98. return (_ctx, _cache) => {
  99. return common_vendor.e({
  100. a: common_vendor.t(state.total),
  101. b: state.commentList.length > 0
  102. }, state.commentList.length > 0 ? {
  103. c: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/comment/list", {
  104. id: __props.goodsId
  105. }))
  106. } : {}, {
  107. d: common_vendor.f(state.commentList, (item, k0, i0) => {
  108. return {
  109. a: "489ea6d9-0-" + i0,
  110. b: common_vendor.p({
  111. item
  112. }),
  113. c: item.id
  114. };
  115. }),
  116. e: state.commentList.length === 0
  117. }, state.commentList.length === 0 ? {
  118. f: common_vendor.p({
  119. paddingTop: "0",
  120. icon: "/static/comment-empty.png",
  121. text: "期待您的第一个评价"
  122. })
  123. } : {});
  124. };
  125. }
  126. };
  127. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-489ea6d9"], ["__file", "D:/zx/mall-front-app/pages/goods/components/detail/detail-comment-card.vue"]]);
  128. wx.createComponent(Component);