| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 | "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");const sheep_hooks_useGoods = require("../../sheep/hooks/useGoods.js");require("../../sheep/url/index.js");require("../../sheep/store/index.js");require("../../sheep/store/app.js");require("../../sheep/api/promotion/diy.js");require("../../sheep/request/index.js");require("../../sheep/config/index.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/helper/throttle.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/config/zIndex.js");require("../../sheep/util/index.js");if (!Array) {  const _component_emptyPage = common_vendor.resolveComponent("emptyPage");  const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");  (_component_emptyPage + _easycom_s_layout2)();}const _easycom_s_layout = () => "../../sheep/components/s-layout/s-layout.js";if (!Math) {  _easycom_s_layout();}const _sfc_main = {  __name: "commission-ranking",  setup(__props) {    const tabMaps = ["周排行", "月排行"];    const state = common_vendor.reactive({      currentTab: 0,      position: 0,      // 排名      rankList: []    });    async function switchTap(index) {      state.currentTab = index;      state.rankList = [];      calculateTimes();      getBrokerageRankList();      getBrokerageRankNumber();    }    async function getBrokerageRankList() {      const {        code,        data      } = await sheep_api_trade_brokerage.BrokerageApi.getBrokerageUserChildSummaryPageByPrice({        pageNo: 1,        pageSize: 10,        "times[0]": state.times[0],        "times[1]": state.times[1]      });      if (code !== 0) {        return;      }      state.rankList = data.list;    }    async function getBrokerageRankNumber() {      const {        code,        data      } = await sheep_api_trade_brokerage.BrokerageApi.getRankByPrice({        times: state.times      });      if (code !== 0) {        return;      }      state.position = data;    }    function formatDate(date) {      return sheep_index.sheep.$helper.timeFormat(date, "yyyy-mm-dd hh:MM:ss");    }    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();      getBrokerageRankList();      getBrokerageRankNumber();    });    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: state.position      }, state.position ? {        b: common_vendor.t(state.position)      } : {}, {        c: 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)          };        }),        d: common_vendor.f(state.rankList, (item, index, i0) => {          return common_vendor.e({            a: index <= 2          }, index <= 2 ? {            b: "/static/images/medal0" + (index + 1) + ".png"          } : {            c: common_vendor.t(index + 1)          }, {            d: item.avatar,            e: common_vendor.t(item.nickname),            f: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(item.brokeragePrice)),            g: index          });        }),        e: state.rankList.length === 0 && (state.page !== 1 || state.active === 0)      }, state.rankList.length === 0 && (state.page !== 1 || state.active === 0) ? {        f: common_vendor.p({          title: "暂无排行~"        })      } : {}, {        g: common_vendor.p({          title: "佣金排行榜"        })      });    };  }};const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4b4e4229"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/commission/commission-ranking.vue"]]);wx.createPage(MiniProgramPage);
 |