"use strict"; const common_vendor = require("../../../common/vendor.js"); const sheep_index = require("../../../sheep/index.js"); const sheep_hooks_useGoods = require("../../../sheep/hooks/useGoods.js"); const sheep_api_promotion_seckill = require("../../../sheep/api/promotion/seckill.js"); const sheep_util_const = require("../../../sheep/util/const.js"); require("../../../sheep/api/index.js"); require("../../../sheep/api/distri/score.js"); require("../../../sheep/request/index.js"); require("../../../sheep/config/index.js"); require("../../../sheep/store/index.js"); require("../../../sheep/store/app.js"); require("../../../sheep/api/promotion/diy.js"); require("../../../sheep/platform/index.js"); require("../../../sheep/platform/provider/wechat/index.js"); require("../../../sheep/platform/provider/wechat/miniProgram.js"); require("../../../sheep/api/member/auth.js"); require("../../../sheep/api/member/social.js"); require("../../../sheep/api/member/user.js"); require("../../../sheep/platform/provider/apple/index.js"); require("../../../sheep/platform/share.js"); require("../../../sheep/router/index.js"); require("../../../sheep/hooks/useModal.js"); require("../../../sheep/helper/index.js"); require("../../../sheep/helper/test.js"); require("../../../sheep/helper/digit.js"); require("../../../sheep/api/member/signin.js"); require("../../../sheep/helper/throttle.js"); require("../../../sheep/url/index.js"); require("../../../sheep/platform/pay.js"); require("../../../sheep/api/pay/order.js"); require("../../../sheep/store/user.js"); require("../../../sheep/store/cart.js"); require("../../../sheep/api/trade/cart.js"); require("../../../sheep/api/pay/wallet.js"); require("../../../sheep/api/trade/order.js"); require("../../../sheep/api/promotion/coupon.js"); require("../../../sheep/store/sys.js"); require("../../../sheep/store/modal.js"); require("../../../sheep/api/distri/share.js"); require("../../../sheep/api/distri/team.js"); require("../../../sheep/api/infra/file.js"); require("../../../sheep/api/member/address.js"); require("../../../sheep/api/member/point.js"); require("../../../sheep/api/migration/app.js"); require("../../../sheep/api/migration/chat.js"); require("../../../sheep/api/migration/index.js"); require("../../../sheep/api/migration/third.js"); require("../../../sheep/api/pay/channel.js"); require("../../../sheep/api/product/category.js"); require("../../../sheep/api/product/comment.js"); require("../../../sheep/api/product/favorite.js"); require("../../../sheep/api/product/history.js"); require("../../../sheep/api/product/spu.js"); require("../../../sheep/api/promotion/activity.js"); require("../../../sheep/api/promotion/article.js"); require("../../../sheep/api/promotion/bargain.js"); require("../../../sheep/api/promotion/combination.js"); require("../../../sheep/api/promotion/rewardActivity.js"); require("../../../sheep/api/system/area.js"); require("../../../sheep/api/system/voice.js"); require("../../../sheep/api/trade/afterSale.js"); require("../../../sheep/api/trade/brokerage.js"); require("../../../sheep/api/trade/config.js"); require("../../../sheep/api/trade/delivery.js"); require("../../../sheep/config/zIndex.js"); require("../../../sheep/util/index.js"); if (!Array) { const _easycom_su_progress2 = common_vendor.resolveComponent("su-progress"); const _easycom_s_goods_column2 = common_vendor.resolveComponent("s-goods-column"); const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more"); const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout"); (_easycom_su_progress2 + _easycom_s_goods_column2 + _easycom_uni_load_more2 + _easycom_s_layout2)(); } const _easycom_su_progress = () => "../../../sheep/ui/su-progress/su-progress.js"; const _easycom_s_goods_column = () => "../../../sheep/components/s-goods-column/s-goods-column.js"; const _easycom_uni_load_more = () => "../../../uni_modules/uni-load-more/components/uni-load-more/uni-load-more.js"; const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js"; if (!Math) { (_easycom_su_progress + _easycom_s_goods_column + _easycom_uni_load_more + _easycom_s_layout)(); } const _sfc_main = { __name: "list", setup(__props) { common_vendor.useCssVars((_ctx) => ({ "ac2cc216": common_vendor.unref(headerBg) })); const { safeAreaInsets, safeArea } = sheep_index.sheep.$platform.device; const statusBarHeight = sheep_index.sheep.$platform.device.statusBarHeight * 2; const pageHeight = (safeArea.height + safeAreaInsets.bottom) * 2 + statusBarHeight - sheep_index.sheep.$platform.navbar - 350; const headerBg = sheep_index.sheep.$url.css("/static/img/shop/goods/seckill-header.png"); const goodsFields = { name: { show: true }, introduction: { show: true }, price: { show: true }, marketPrice: { show: true } }; const timeConfigList = common_vendor.ref([]); const getSeckillConfigList = async () => { const { data } = await sheep_api_promotion_seckill.SeckillApi.getSeckillConfigList(); const now = common_vendor.dayjs(); const today = now.format("YYYY-MM-DD"); data.forEach((config, index) => { const startTime = common_vendor.dayjs(`${today} ${config.startTime}`); const endTime = common_vendor.dayjs(`${today} ${config.endTime}`); if (now.isBefore(startTime)) { config.status = sheep_util_const.TimeStatusEnum.WAIT_START; } else if (now.isAfter(endTime)) { config.status = sheep_util_const.TimeStatusEnum.END; } else { config.status = sheep_util_const.TimeStatusEnum.STARTED; activeTimeIndex.value = index; } }); timeConfigList.value = data; handleChangeTimeConfig(activeTimeIndex.value); scrollToTimeConfig(activeTimeIndex.value); }; const activeTimeElId = common_vendor.ref(""); const scrollToTimeConfig = (index) => { common_vendor.nextTick$1(() => activeTimeElId.value = `timeItem${index}`); }; const activeTimeIndex = common_vendor.ref(0); const activeTimeConfig = common_vendor.computed(() => timeConfigList.value[activeTimeIndex.value]); const handleChangeTimeConfig = (index) => { activeTimeIndex.value = index; activityPageParams.pageNo = 1; activityList.value = []; getActivityList(); }; const countDown = common_vendor.computed(() => { var _a; const endTime = (_a = activeTimeConfig.value) == null ? void 0 : _a.endTime; if (endTime) { return sheep_hooks_useGoods.useDurationTime(`${common_vendor.dayjs().format("YYYY-MM-DD")} ${endTime}`); } }); const activityPageParams = common_vendor.reactive({ id: 0, // 时间段 ID pageNo: 1, // 页码 pageSize: 5 // 每页数量 }); const activityTotal = common_vendor.ref(0); const activityList = common_vendor.ref([]); const loadStatus = common_vendor.ref(""); async function getActivityList() { loadStatus.value = "loading"; const { data } = await sheep_api_promotion_seckill.SeckillApi.getSeckillActivityPage(activityPageParams); data.list.forEach((activity) => { activity.percent = parseInt(100 * (activity.totalStock - activity.stock) / activity.totalStock); }); activityList.value = activityList.value.concat(...data.list); activityTotal.value = data.total; loadStatus.value = activityList.value.length < activityTotal.value ? "more" : "noMore"; } function loadMore() { if (loadStatus.value !== "noMore") { activityPageParams.pageNo += 1; getActivityList(); } } common_vendor.onReachBottom(() => loadMore()); common_vendor.onLoad(async () => { await getSeckillConfigList(); }); return (_ctx, _cache) => { var _a, _b, _c, _d, _e, _f, _g, _h, _i; return common_vendor.e({ a: common_vendor.s({ marginTop: "-" + Number(statusBarHeight + 88) + "rpx" }), b: ((_b = (_a = activeTimeConfig.value) == null ? void 0 : _a.sliderPicUrls) == null ? void 0 : _b.length) > 0 }, ((_d = (_c = activeTimeConfig.value) == null ? void 0 : _c.sliderPicUrls) == null ? void 0 : _d.length) > 0 ? { c: common_vendor.f(activeTimeConfig.value.sliderPicUrls, (picUrl, index, i0) => { return { a: picUrl, b: index }; }) } : {}, { d: common_vendor.f(timeConfigList.value, (config, index, i0) => { return { a: common_vendor.t(config.startTime), b: common_vendor.t(config.status), c: index, d: common_vendor.n({ active: activeTimeIndex.value === index }), e: `timeItem${index}`, f: common_vendor.o(($event) => handleChangeTimeConfig(index), index) }; }), e: activeTimeElId.value, f: ((_e = activeTimeConfig.value) == null ? void 0 : _e.status) === common_vendor.unref(sheep_util_const.TimeStatusEnum).STARTED }, ((_f = activeTimeConfig.value) == null ? void 0 : _f.status) === common_vendor.unref(sheep_util_const.TimeStatusEnum).STARTED ? { g: common_vendor.t(countDown.value.h), h: common_vendor.t(countDown.value.m), i: common_vendor.t(countDown.value.s) } : { j: common_vendor.t((_g = activeTimeConfig.value) == null ? void 0 : _g.status) }, { k: common_vendor.f(activityList.value, (activity, k0, i0) => { var _a2, _b2; return common_vendor.e({ a: common_vendor.t(activity.stock), b: common_vendor.t(activity.unitName), c: "de8354c5-2-" + i0 + "," + ("de8354c5-1-" + i0), d: common_vendor.p({ percentage: activity.percent, strokeWidth: "10", textInside: true, isAnimate: true }) }, ((_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 ? {} : {}, { e: common_vendor.o(($event) => common_vendor.unref(sheep_index.sheep).$router.go("/pages/goods/seckill", { id: activity.id }), activity.id), f: "de8354c5-1-" + i0 + ",de8354c5-0", g: common_vendor.p({ size: "lg", data: { ...activity, price: activity.seckillPrice }, goodsFields, seckillTag: true }), h: activity.id }); }), l: ((_h = activeTimeConfig.value) == null ? void 0 : _h.status) === common_vendor.unref(sheep_util_const.TimeStatusEnum).WAIT_START, m: ((_i = activeTimeConfig.value) == null ? void 0 : _i.status) === common_vendor.unref(sheep_util_const.TimeStatusEnum).STARTED, n: common_vendor.n({ disabled: activeTimeConfig.value.status === common_vendor.unref(sheep_util_const.TimeStatusEnum).END }), o: activityTotal.value > 0 }, activityTotal.value > 0 ? { p: common_vendor.o(loadMore), q: common_vendor.p({ status: loadStatus.value, ["content-text"]: { contentdown: "上拉加载更多" } }) } : {}, { r: pageHeight + "rpx", s: common_vendor.s(_ctx.__cssVars()), t: common_vendor.p({ navbar: "inner", bgStyle: { color: "rgb(245,28,19)" } }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-de8354c5"], ["__file", "D:/zx/mall-front-app/pages/activity/seckill/list.vue"]]); wx.createPage(MiniProgramPage);