list.js 6.0 KB

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