list.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../../sheep/index.js");
  4. const sheep_api_promotion_combination = require("../../../sheep/api/promotion/combination.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_goods_column2 = common_vendor.resolveComponent("s-goods-column");
  38. const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  39. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  40. (_easycom_s_goods_column2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
  41. }
  42. const _easycom_s_goods_column = () => "../../../sheep/components/s-goods-column/s-goods-column.js";
  43. const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  44. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  45. if (!Math) {
  46. (_easycom_s_goods_column + _easycom_uni_load_more + _easycom_s_layout)();
  47. }
  48. const _sfc_main = {
  49. __name: "list",
  50. setup(__props) {
  51. common_vendor.useCssVars((_ctx) => ({
  52. "958cfdc2": common_vendor.unref(headerBg)
  53. }));
  54. const { safeAreaInsets, safeArea } = sheep_index.sheep.$platform.device;
  55. const sysNavBar = sheep_index.sheep.$platform.navbar;
  56. const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2;
  57. const pageHeight = (safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sysNavBar - 350;
  58. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/goods/groupon-header.png");
  59. const state = common_vendor.reactive({
  60. pagination: {
  61. list: [],
  62. total: 0,
  63. pageNo: 1,
  64. pageSize: 10
  65. },
  66. loadStatus: "",
  67. summaryData: {}
  68. });
  69. const getSummary = async () => {
  70. const { data } = await sheep_api_promotion_combination.CombinationApi.getCombinationRecordSummary();
  71. state.summaryData = data;
  72. };
  73. async function getList() {
  74. state.loadStatus = "loading";
  75. const { data } = await sheep_api_promotion_combination.CombinationApi.getCombinationActivityPage({
  76. pageNo: state.pagination.pageNo,
  77. pageSize: state.pagination.pageSize
  78. });
  79. data.list.forEach((activity) => {
  80. state.pagination.list.push({ ...activity, price: activity.combinationPrice });
  81. });
  82. state.pagination.total = data.total;
  83. state.loadStatus = state.pagination.list.length < state.pagination.total ? "more" : "noMore";
  84. }
  85. function loadMore() {
  86. if (state.loadStatus === "noMore") {
  87. return;
  88. }
  89. state.pagination.pageNo++;
  90. getList();
  91. }
  92. common_vendor.onReachBottom(() => loadMore());
  93. common_vendor.onLoad(() => {
  94. getSummary();
  95. getList();
  96. });
  97. return (_ctx, _cache) => {
  98. return common_vendor.e({
  99. a: common_vendor.s({
  100. marginTop: "-" + Number(statusBarHeight + 88) + "rpx"
  101. }),
  102. b: common_vendor.f(state.summaryData.avatars, (item, index, i0) => {
  103. return common_vendor.e({
  104. a: common_vendor.s(`background-image: url(${item})`),
  105. b: index === 6 && state.summaryData.avatars.length > 3
  106. }, index === 6 && state.summaryData.avatars.length > 3 ? {} : {}, {
  107. c: index,
  108. d: common_vendor.s(index === 6 ? "position: relative" : "position: static")
  109. });
  110. }),
  111. c: common_vendor.t(state.summaryData.userCount || 0),
  112. d: common_vendor.f(state.pagination.list, (item, k0, i0) => {
  113. return {
  114. a: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/groupon", {
  115. id: item.id
  116. }), item.id),
  117. b: "628ec892-1-" + i0 + ",628ec892-0",
  118. c: common_vendor.p({
  119. size: "lg",
  120. data: item,
  121. grouponTag: true
  122. }),
  123. d: item.id
  124. };
  125. }),
  126. e: state.pagination.total > 0
  127. }, state.pagination.total > 0 ? {
  128. f: common_vendor.o(loadMore),
  129. g: common_vendor.p({
  130. status: state.loadStatus,
  131. ["content-text"]: {
  132. contentdown: "上拉加载更多"
  133. }
  134. })
  135. } : {}, {
  136. h: pageHeight + "rpx",
  137. i: common_vendor.s(_ctx.__cssVars()),
  138. j: common_vendor.p({
  139. navbar: "inner",
  140. bgStyle: {
  141. color: "#FE832A"
  142. }
  143. })
  144. });
  145. };
  146. }
  147. };
  148. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-628ec892"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/activity/groupon/list.vue"]]);
  149. wx.createPage(MiniProgramPage);