"use strict"; const common_vendor = require("../../common/vendor.js"); const sheep_index = require("../../sheep/index.js"); const sheep_api_trade_brokerage = require("../../sheep/api/trade/brokerage.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/promotion/seckill.js"); require("../../sheep/api/system/area.js"); require("../../sheep/api/system/voice.js"); require("../../sheep/api/trade/afterSale.js"); require("../../sheep/api/trade/config.js"); require("../../sheep/api/trade/delivery.js"); require("../../sheep/config/zIndex.js"); if (!Array) { const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout"); _easycom_s_layout2(); } const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js"; if (!Math) { _easycom_s_layout(); } const _sfc_main = { __name: "promoter", setup(__props) { const tabMaps = ["周排行", "月排行"]; const state = common_vendor.reactive({ currentTab: 0, rankList: [], times: [], one: {}, // 排名第一 two: {}, // 排名第二 three: {} // 排名第三 }); function switchTap(index) { if (state.currentTab === index) { return; } state.currentTab = index; calculateTimes(); getRankList(); } async function getRankList() { state.one = {}; state.two = {}; state.three = {}; state.rankList = []; const { code, data } = await sheep_api_trade_brokerage.BrokerageApi.getBrokerageUserRankPageByUserCount({ pageNo: 1, pageSize: 10, "times[0]": state.times[0], "times[1]": state.times[1] }); if (code !== 0) { return; } state.rankList = data.list; state.one = state.rankList.shift() || {}; state.two = state.rankList.shift() || {}; state.trhee = state.rankList.shift() || {}; } function calculateTimes() { let times; if (state.currentTab === 0) { times = getWeekTimes(); } else { times = getMonthTimes(); } state.times = [formatDate(times[0]), formatDate(times[1])]; } common_vendor.onLoad(function() { calculateTimes(); getRankList(); }); function formatDate(date) { return sheep_index.sheep.$helper.timeFormat(date, "yyyy-mm-dd hh:MM:ss"); } function getWeekTimes() { const today = /* @__PURE__ */ new Date(); const dayOfWeek = today.getDay(); return [ new Date(today.getFullYear(), today.getMonth(), today.getDate() - dayOfWeek, 0, 0, 0), new Date(today.getFullYear(), today.getMonth(), today.getDate() + (6 - dayOfWeek), 23, 59, 59) ]; } function getMonthTimes() { const today = /* @__PURE__ */ new Date(); const year = today.getFullYear(); const month = today.getMonth(); const startDate = new Date(year, month, 1, 0, 0, 0); const nextMonth = new Date(year, month + 1, 1); const endDate = new Date(nextMonth.getTime() - 1); return [startDate, endDate]; } return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.f(tabMaps, (item, index, i0) => { return { a: common_vendor.t(item), b: common_vendor.n(state.currentTab === index ? "font-color" : ""), c: index, d: common_vendor.o(($event) => switchTap(index), index) }; }), b: state.two.avatar, c: common_vendor.t(state.two.nickname), d: common_vendor.t(state.two.brokerageUserCount), e: state.two.id, f: state.one.avatar, g: common_vendor.t(state.one.nickname), h: common_vendor.t(state.one.brokerageUserCount), i: state.one.id, j: state.three.avatar, k: common_vendor.t(state.three.nickname), l: common_vendor.t(state.three.brokerageUserCount), m: state.three.id, n: state.rankList.length }, state.rankList.length ? { o: common_vendor.f(state.rankList, (item, index, i0) => { return { a: common_vendor.t(index + 4), b: item.avatar, c: common_vendor.t(item.nickname), d: common_vendor.t(item.brokerageUserCount), e: index }; }) } : {}, { p: common_vendor.p({ title: "推广人排行榜" }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-fe20a205"], ["__file", "D:/zx/mall-front-app/pages/commission/promoter.vue"]]); wx.createPage(MiniProgramPage);