list.js 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  1. "use strict";
  2. const common_vendor = require("../../../common/vendor.js");
  3. const sheep_index = require("../../../sheep/index.js");
  4. const sheep_hooks_useGoods = require("../../../sheep/hooks/useGoods.js");
  5. const sheep_api_promotion_seckill = require("../../../sheep/api/promotion/seckill.js");
  6. const sheep_util_const = require("../../../sheep/util/const.js");
  7. require("../../../sheep/api/index.js");
  8. require("../../../sheep/api/distri/score.js");
  9. require("../../../sheep/request/index.js");
  10. require("../../../sheep/config/index.js");
  11. require("../../../sheep/store/index.js");
  12. require("../../../sheep/store/app.js");
  13. require("../../../sheep/api/promotion/diy.js");
  14. require("../../../sheep/platform/index.js");
  15. require("../../../sheep/platform/provider/wechat/index.js");
  16. require("../../../sheep/platform/provider/wechat/miniProgram.js");
  17. require("../../../sheep/api/member/auth.js");
  18. require("../../../sheep/api/member/social.js");
  19. require("../../../sheep/api/member/user.js");
  20. require("../../../sheep/platform/provider/apple/index.js");
  21. require("../../../sheep/platform/share.js");
  22. require("../../../sheep/router/index.js");
  23. require("../../../sheep/hooks/useModal.js");
  24. require("../../../sheep/helper/index.js");
  25. require("../../../sheep/helper/test.js");
  26. require("../../../sheep/helper/digit.js");
  27. require("../../../sheep/api/member/signin.js");
  28. require("../../../sheep/helper/throttle.js");
  29. require("../../../sheep/url/index.js");
  30. require("../../../sheep/platform/pay.js");
  31. require("../../../sheep/api/pay/order.js");
  32. require("../../../sheep/store/user.js");
  33. require("../../../sheep/store/cart.js");
  34. require("../../../sheep/api/trade/cart.js");
  35. require("../../../sheep/api/pay/wallet.js");
  36. require("../../../sheep/api/trade/order.js");
  37. require("../../../sheep/api/promotion/coupon.js");
  38. require("../../../sheep/store/sys.js");
  39. require("../../../sheep/store/modal.js");
  40. require("../../../sheep/api/distri/share.js");
  41. require("../../../sheep/api/distri/team.js");
  42. require("../../../sheep/api/infra/file.js");
  43. require("../../../sheep/api/member/address.js");
  44. require("../../../sheep/api/member/point.js");
  45. require("../../../sheep/api/migration/app.js");
  46. require("../../../sheep/api/migration/chat.js");
  47. require("../../../sheep/api/migration/index.js");
  48. require("../../../sheep/api/migration/third.js");
  49. require("../../../sheep/api/pay/channel.js");
  50. require("../../../sheep/api/product/category.js");
  51. require("../../../sheep/api/product/comment.js");
  52. require("../../../sheep/api/product/favorite.js");
  53. require("../../../sheep/api/product/history.js");
  54. require("../../../sheep/api/product/spu.js");
  55. require("../../../sheep/api/promotion/activity.js");
  56. require("../../../sheep/api/promotion/article.js");
  57. require("../../../sheep/api/promotion/bargain.js");
  58. require("../../../sheep/api/promotion/combination.js");
  59. require("../../../sheep/api/promotion/rewardActivity.js");
  60. require("../../../sheep/api/system/area.js");
  61. require("../../../sheep/api/system/voice.js");
  62. require("../../../sheep/api/trade/afterSale.js");
  63. require("../../../sheep/api/trade/brokerage.js");
  64. require("../../../sheep/api/trade/config.js");
  65. require("../../../sheep/api/trade/delivery.js");
  66. require("../../../sheep/config/zIndex.js");
  67. require("../../../sheep/util/index.js");
  68. if (!Array) {
  69. const _easycom_su_progress2 = common_vendor.resolveComponent("su-progress");
  70. const _easycom_s_goods_column2 = common_vendor.resolveComponent("s-goods-column");
  71. const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  72. const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  73. (_easycom_su_progress2 + _easycom_s_goods_column2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
  74. }
  75. const _easycom_su_progress = () => "../../../sheep/ui/su-progress/su-progress.js";
  76. const _easycom_s_goods_column = () => "../../../sheep/components/s-goods-column/s-goods-column.js";
  77. const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js";
  78. const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
  79. if (!Math) {
  80. (_easycom_su_progress + _easycom_s_goods_column + _easycom_uni_load_more + _easycom_s_layout)();
  81. }
  82. const _sfc_main = {
  83. __name: "list",
  84. setup(__props) {
  85. common_vendor.useCssVars((_ctx) => ({
  86. "ac2cc216": common_vendor.unref(headerBg)
  87. }));
  88. const { safeAreaInsets, safeArea } = sheep_index.sheep.$platform.device;
  89. const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2;
  90. const pageHeight = (safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sheep_index.sheep.$platform.navbar - 350;
  91. const headerBg = sheep_index.sheep.$url.css("/static/img/shop/goods/seckill-header.png");
  92. const goodsFields = {
  93. name: { show: true },
  94. introduction: { show: true },
  95. price: { show: true },
  96. marketPrice: { show: true }
  97. };
  98. const timeConfigList = common_vendor.ref([]);
  99. const getSeckillConfigList = async () => {
  100. const { data } = await sheep_api_promotion_seckill.SeckillApi.getSeckillConfigList();
  101. const now = common_vendor.dayjs();
  102. const today = now.format("YYYY-MM-DD");
  103. data.forEach((config, index) => {
  104. const startTime = common_vendor.dayjs(`${today} ${config.startTime}`);
  105. const endTime = common_vendor.dayjs(`${today} ${config.endTime}`);
  106. if (now.isBefore(startTime)) {
  107. config.status = sheep_util_const.TimeStatusEnum.WAIT_START;
  108. } else if (now.isAfter(endTime)) {
  109. config.status = sheep_util_const.TimeStatusEnum.END;
  110. } else {
  111. config.status = sheep_util_const.TimeStatusEnum.STARTED;
  112. activeTimeIndex.value = index;
  113. }
  114. });
  115. timeConfigList.value = data;
  116. handleChangeTimeConfig(activeTimeIndex.value);
  117. scrollToTimeConfig(activeTimeIndex.value);
  118. };
  119. const activeTimeElId = common_vendor.ref("");
  120. const scrollToTimeConfig = (index) => {
  121. common_vendor.nextTick$1(() => activeTimeElId.value = `timeItem${index}`);
  122. };
  123. const activeTimeIndex = common_vendor.ref(0);
  124. const activeTimeConfig = common_vendor.computed(() => timeConfigList.value[activeTimeIndex.value]);
  125. const handleChangeTimeConfig = (index) => {
  126. activeTimeIndex.value = index;
  127. activityPageParams.pageNo = 1;
  128. activityList.value = [];
  129. getActivityList();
  130. };
  131. const countDown = common_vendor.computed(() => {
  132. var _a;
  133. const endTime = (_a = activeTimeConfig.value) == null ? void 0 : _a.endTime;
  134. if (endTime) {
  135. return sheep_hooks_useGoods.useDurationTime(`${common_vendor.dayjs().format("YYYY-MM-DD")} ${endTime}`);
  136. }
  137. });
  138. const activityPageParams = common_vendor.reactive({
  139. id: 0,
  140. // 时间段 ID
  141. pageNo: 1,
  142. // 页码
  143. pageSize: 5
  144. // 每页数量
  145. });
  146. const activityTotal = common_vendor.ref(0);
  147. const activityList = common_vendor.ref([]);
  148. const loadStatus = common_vendor.ref("");
  149. async function getActivityList() {
  150. loadStatus.value = "loading";
  151. const { data } = await sheep_api_promotion_seckill.SeckillApi.getSeckillActivityPage(activityPageParams);
  152. data.list.forEach((activity) => {
  153. activity.percent = parseInt(100 * (activity.totalStock - activity.stock) / activity.totalStock);
  154. });
  155. activityList.value = activityList.value.concat(...data.list);
  156. activityTotal.value = data.total;
  157. loadStatus.value = activityList.value.length < activityTotal.value ? "more" : "noMore";
  158. }
  159. function loadMore() {
  160. if (loadStatus.value !== "noMore") {
  161. activityPageParams.pageNo += 1;
  162. getActivityList();
  163. }
  164. }
  165. common_vendor.onReachBottom(() => loadMore());
  166. common_vendor.onLoad(async () => {
  167. await getSeckillConfigList();
  168. });
  169. return (_ctx, _cache) => {
  170. var _a, _b, _c, _d, _e, _f, _g, _h, _i;
  171. return common_vendor.e({
  172. a: common_vendor.s({
  173. marginTop: "-" + Number(statusBarHeight + 88) + "rpx"
  174. }),
  175. b: ((_b = (_a = activeTimeConfig.value) == null ? void 0 : _a.sliderPicUrls) == null ? void 0 : _b.length) > 0
  176. }, ((_d = (_c = activeTimeConfig.value) == null ? void 0 : _c.sliderPicUrls) == null ? void 0 : _d.length) > 0 ? {
  177. c: common_vendor.f(activeTimeConfig.value.sliderPicUrls, (picUrl, index, i0) => {
  178. return {
  179. a: picUrl,
  180. b: index
  181. };
  182. })
  183. } : {}, {
  184. d: common_vendor.f(timeConfigList.value, (config, index, i0) => {
  185. return {
  186. a: common_vendor.t(config.startTime),
  187. b: common_vendor.t(config.status),
  188. c: index,
  189. d: common_vendor.n({
  190. active: activeTimeIndex.value === index
  191. }),
  192. e: `timeItem${index}`,
  193. f: common_vendor.o(($event) => handleChangeTimeConfig(index), index)
  194. };
  195. }),
  196. e: activeTimeElId.value,
  197. f: ((_e = activeTimeConfig.value) == null ? void 0 : _e.status) === common_vendor.unref(sheep_util_const.TimeStatusEnum).STARTED
  198. }, ((_f = activeTimeConfig.value) == null ? void 0 : _f.status) === common_vendor.unref(sheep_util_const.TimeStatusEnum).STARTED ? {
  199. g: common_vendor.t(countDown.value.h),
  200. h: common_vendor.t(countDown.value.m),
  201. i: common_vendor.t(countDown.value.s)
  202. } : {
  203. j: common_vendor.t((_g = activeTimeConfig.value) == null ? void 0 : _g.status)
  204. }, {
  205. k: common_vendor.f(activityList.value, (activity, k0, i0) => {
  206. var _a2, _b2;
  207. return common_vendor.e({
  208. a: common_vendor.t(activity.stock),
  209. b: common_vendor.t(activity.unitName),
  210. c: "de8354c5-2-" + i0 + "," + ("de8354c5-1-" + i0),
  211. d: common_vendor.p({
  212. percentage: activity.percent,
  213. strokeWidth: "10",
  214. textInside: true,
  215. isAnimate: true
  216. })
  217. }, ((_a2 = activeTimeConfig.value) == null ? void 0 : _a2.status) === common_vendor.unref(sheep_util_const.TimeStatusEnum).WAIT_START ? {} : ((_b2 = activeTimeConfig.value) == null ? void 0 : _b2.status) === common_vendor.unref(sheep_util_const.TimeStatusEnum).STARTED ? {} : {}, {
  218. e: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/seckill", {
  219. id: activity.id
  220. }), activity.id),
  221. f: "de8354c5-1-" + i0 + ",de8354c5-0",
  222. g: common_vendor.p({
  223. size: "lg",
  224. data: {
  225. ...activity,
  226. price: activity.seckillPrice
  227. },
  228. goodsFields,
  229. seckillTag: true
  230. }),
  231. h: activity.id
  232. });
  233. }),
  234. l: ((_h = activeTimeConfig.value) == null ? void 0 : _h.status) === common_vendor.unref(sheep_util_const.TimeStatusEnum).WAIT_START,
  235. m: ((_i = activeTimeConfig.value) == null ? void 0 : _i.status) === common_vendor.unref(sheep_util_const.TimeStatusEnum).STARTED,
  236. n: common_vendor.n({
  237. disabled: activeTimeConfig.value.status === common_vendor.unref(sheep_util_const.TimeStatusEnum).END
  238. }),
  239. o: activityTotal.value > 0
  240. }, activityTotal.value > 0 ? {
  241. p: common_vendor.o(loadMore),
  242. q: common_vendor.p({
  243. status: loadStatus.value,
  244. ["content-text"]: {
  245. contentdown: "上拉加载更多"
  246. }
  247. })
  248. } : {}, {
  249. r: pageHeight + "rpx",
  250. s: common_vendor.s(_ctx.__cssVars()),
  251. t: common_vendor.p({
  252. navbar: "inner",
  253. bgStyle: {
  254. color: "rgb(245,28,19)"
  255. }
  256. })
  257. });
  258. };
  259. }
  260. };
  261. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-de8354c5"], ["__file", "D:/zx/mall-front-app/pages/activity/seckill/list.vue"]]);
  262. wx.createPage(MiniProgramPage);