detail-comment-card.js 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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/url/index.js");
  6. require("../../../../sheep/store/index.js");
  7. require("../../../../sheep/store/app.js");
  8. require("../../../../sheep/api/promotion/diy.js");
  9. require("../../../../sheep/request/index.js");
  10. require("../../../../sheep/config/index.js");
  11. require("../../../../sheep/platform/index.js");
  12. require("../../../../sheep/platform/provider/wechat/index.js");
  13. require("../../../../sheep/platform/provider/wechat/miniProgram.js");
  14. require("../../../../sheep/api/member/auth.js");
  15. require("../../../../sheep/api/member/social.js");
  16. require("../../../../sheep/api/member/user.js");
  17. require("../../../../sheep/platform/provider/apple/index.js");
  18. require("../../../../sheep/platform/share.js");
  19. require("../../../../sheep/router/index.js");
  20. require("../../../../sheep/hooks/useModal.js");
  21. require("../../../../sheep/helper/index.js");
  22. require("../../../../sheep/helper/test.js");
  23. require("../../../../sheep/helper/digit.js");
  24. require("../../../../sheep/helper/throttle.js");
  25. require("../../../../sheep/platform/pay.js");
  26. require("../../../../sheep/api/pay/order.js");
  27. require("../../../../sheep/store/user.js");
  28. require("../../../../sheep/store/cart.js");
  29. require("../../../../sheep/api/trade/cart.js");
  30. require("../../../../sheep/api/pay/wallet.js");
  31. require("../../../../sheep/api/trade/order.js");
  32. require("../../../../sheep/api/promotion/coupon.js");
  33. require("../../../../sheep/store/sys.js");
  34. require("../../../../sheep/store/modal.js");
  35. require("../../../../sheep/config/zIndex.js");
  36. if (!Array) {
  37. const _easycom_s_empty2 = common_vendor.resolveComponent("s-empty");
  38. _easycom_s_empty2();
  39. }
  40. const _easycom_s_empty = () => "../../../../sheep/components/s-empty/s-empty.js";
  41. if (!Math) {
  42. (commentItem + _easycom_s_empty)();
  43. }
  44. const commentItem = () => "./comment-item.js";
  45. const _sfc_main = {
  46. __name: "detail-comment-card",
  47. props: {
  48. goodsId: {
  49. type: [Number, String],
  50. default: 0
  51. }
  52. },
  53. setup(__props) {
  54. const props = __props;
  55. const state = common_vendor.reactive({
  56. commentList: [],
  57. // 评论列表,只展示最近的 3 条
  58. total: 0
  59. // 总评论数
  60. });
  61. async function getComment(id) {
  62. const { data } = await sheep_api_product_comment.CommentApi.getCommentPage(id, 1, 3, 0);
  63. state.commentList = data.list;
  64. state.total = data.total;
  65. }
  66. common_vendor.onBeforeMount(() => {
  67. getComment(props.goodsId);
  68. });
  69. return (_ctx, _cache) => {
  70. return common_vendor.e({
  71. a: common_vendor.t(state.total),
  72. b: state.commentList.length > 0
  73. }, state.commentList.length > 0 ? {
  74. c: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/comment/list", {
  75. id: __props.goodsId
  76. }))
  77. } : {}, {
  78. d: common_vendor.f(state.commentList, (item, k0, i0) => {
  79. return {
  80. a: "489ea6d9-0-" + i0,
  81. b: common_vendor.p({
  82. item
  83. }),
  84. c: item.id
  85. };
  86. }),
  87. e: state.commentList.length === 0
  88. }, state.commentList.length === 0 ? {
  89. f: common_vendor.p({
  90. paddingTop: "0",
  91. icon: "/static/comment-empty.png",
  92. text: "期待您的第一个评价"
  93. })
  94. } : {});
  95. };
  96. }
  97. };
  98. const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-489ea6d9"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/goods/components/detail/detail-comment-card.vue"]]);
  99. wx.createComponent(Component);