"use strict";
const common_vendor = require("../../../common/vendor.js");
const sheep_index = require("../../../sheep/index.js");
const sheep_api_distri_team = require("../../../sheep/api/distri/team.js");
const sheep_hooks_useGoods = require("../../../sheep/hooks/useGoods.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/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/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_s_empty2 = common_vendor.resolveComponent("s-empty");
  const _easycom_uni_load_more2 = common_vendor.resolveComponent("uni-load-more");
  const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  (_easycom_s_empty2 + _easycom_uni_load_more2 + _easycom_s_layout2)();
}
const _easycom_s_empty = () => "../../../sheep/components/s-empty/s-empty.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_s_empty + _easycom_uni_load_more + _easycom_s_layout)();
}
const _sfc_main = {
  __name: "team",
  setup(__props) {
    sheep_index.sheep.$platform.device.statusBarHeight * 2;
    common_vendor.computed(() => sheep_index.sheep.$store("user").userInfo);
    sheep_index.sheep.$platform.navbar;
    const state = common_vendor.reactive({
      currentTab: 0,
      pagination: {
        list: 0,
        total: 0,
        pageSize: 10,
        pageNo: 1
      },
      loadStatus: "",
      descendants: {
        total: 0,
        list: []
      },
      teamCount: 0,
      ancestor: {}
    });
    common_vendor.computed(() => {
      if (state.date[0] === state.date[1]) {
        return state.date[0];
      } else {
        return state.date.join("~");
      }
    });
    async function getTeam() {
      state.loadStatus = "loading";
      let {
        code,
        data
      } = await sheep_api_distri_team.TeamApi.getTeam({
        pageNo: state.pagination.pageNo,
        pageSize: state.pagination.pageSize
      });
      if (code !== 0) {
        return;
      }
      state.teamCount = data.teamCount;
      state.ancestor = data.ancestor;
      let descendantsList = common_vendor._.concat(state.descendants.list, data.descendants.list);
      state.descendants.list = descendantsList;
      state.descendants.total = data.descendants.total;
      state.pagination.total = data.descendants.total;
      state.loadStatus = state.descendants.list.length < state.descendants.total ? "more" : "noMore";
    }
    common_vendor.onLoad(() => {
      state.today = common_vendor.dayjs().format("YYYY-MM-DD");
      state.date = [state.today, state.today];
      getTeam();
    });
    function loadMore() {
      if (state.loadStatus === "noMore") {
        return;
      }
      state.pagination.pageNo++;
      getTeam();
    }
    common_vendor.onReachBottom(() => {
      loadMore();
    });
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.t(state.teamCount),
        b: state.ancestor.avatar,
        c: common_vendor.t(state.ancestor.username || "昵称:" + state.ancestor.descNickName),
        d: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.points2point)(state.ancestor.residueSocial)),
        e: common_vendor.t(state.ancestor.socialStatusLevel || "等级1"),
        f: common_vendor.t(state.ancestor.descendantsCount),
        g: state.descendants.total > 0
      }, state.descendants.total > 0 ? {
        h: common_vendor.f(state.descendants.list, (item, index, i0) => {
          return {
            a: common_vendor.t(item.sort),
            b: item.avatar || common_vendor.unref(sheep_index.sheep).$url.static("/static/images/default_avatar.png"),
            c: common_vendor.t(item.username || "昵称:" + item.descNickName),
            d: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.points2point)(item.residueSocial)),
            e: common_vendor.t(item.socialStatusLevel),
            f: common_vendor.t(item.depth == 1 ? "直推人" : ""),
            g: common_vendor.t(item.descendantsCount),
            h: item.id
          };
        })
      } : {
        i: common_vendor.p({
          text: "暂无团队成员",
          icon: "/static/data-empty.png"
        })
      }, {
        j: common_vendor.o(() => {
        }),
        k: state.descendants.total > 0
      }, state.descendants.total > 0 ? {
        l: common_vendor.o(loadMore),
        m: common_vendor.p({
          status: state.loadStatus,
          ["content-text"]: {
            contentdown: "点击加载更多"
          }
        })
      } : {}, {
        n: common_vendor.p({
          bgStyle: {
            "backgroundColor": "#ffffff"
          },
          title: "",
          navbar: "normal"
        })
      });
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-f08f8293"], ["__file", "D:/zx/mall-front-app/pages/user/wallet/team.vue"]]);
wx.createPage(MiniProgramPage);
