"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const api_index = require("../../api/index.js");
const store_index = require("../../store/index.js");
const utils_fun = require("../../utils/fun.js");
if (!Array) {
  const _easycom_wd_navbar2 = common_vendor.resolveComponent("wd-navbar");
  const _easycom_wd_picker2 = common_vendor.resolveComponent("wd-picker");
  const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
  (_easycom_wd_navbar2 + _easycom_wd_picker2 + _easycom_z_paging2)();
}
const _easycom_wd_navbar = () => "../../uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js";
const _easycom_wd_picker = () => "../../uni_modules/wot-design-uni/components/wd-picker/wd-picker.js";
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
if (!Math) {
  (_easycom_wd_navbar + _easycom_wd_picker + _easycom_z_paging)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "wallet",
  setup(__props) {
    const rewardReportInfo = common_vendor.ref({});
    const store = store_index.Store();
    const paging = common_vendor.ref(null);
    const dataList = common_vendor.ref([]);
    const columns = common_vendor.ref([]);
    const showLoading = common_vendor.ref(true);
    const typeName = common_vendor.ref("");
    const toeasTrue = common_vendor.ref(false);
    const queryPrams = common_vendor.ref({
      bizType: ""
    });
    const userInfo = common_vendor.computed(
      () => store.userInfo || {
        inviteCode: "",
        nickname: "",
        mobile: "",
        avatar: "",
        paywallet: {
          balance: 0
        }
      }
    );
    common_vendor.onShow(async () => {
      if (userInfo.value.branchCompany) {
        api_index.api.rewardReport().then((res) => {
          rewardReportInfo.value = res;
        });
      }
    });
    const queryList = (pageNo, pageSize) => {
      api_index.api.moneyRecord({ pageNo, pageSize, ...queryPrams.value }).then((res) => {
        columns.value = Object.entries(res.bizType).map(([value, label]) => ({
          value,
          label
        }));
        columns.value.unshift({
          label: "全部",
          value: ""
        });
        paging.value.complete(res.list);
      }).catch((res) => {
        paging.value.complete(false);
      });
    };
    const handleConfirm = (e) => {
      if (!e.value) {
        typeName.value = "";
      } else {
        typeName.value = e.selectedItems.label;
      }
      paging.value.reload();
    };
    const back = () => {
      common_vendor.index.navigateBack();
    };
    const tishi = () => {
      common_vendor.index.showModal({
        title: "提示",
        content: "每月初结算上月业绩，“团队补货”为团队补货回款，例：本月整个团队总补货回款为20W，则月度团队补货收益为20W×12%=24000元",
        showCancel: false
      });
    };
    const toeas = () => {
      toeasTrue.value = !toeasTrue.value;
    };
    const toZhuan = () => {
      common_vendor.index.navigateTo({
        url: "/pages/wallet/zhaun"
      });
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.o(back),
        b: common_vendor.p({
          title: "钱包",
          bordered: false,
          ["left-arrow"]: true,
          ["custom-style"]: "background-color: transparent !important;",
          safeAreaInsetTop: true
        }),
        c: common_assets._imports_0$9,
        d: common_assets._imports_1$7,
        e: common_vendor.o(toeas),
        f: `/static/icons/yan${toeasTrue.value ? "s" : ""}.png`,
        g: common_vendor.t(toeasTrue.value ? "****" : userInfo.value.money),
        h: common_assets._imports_2$3,
        i: common_vendor.o(toZhuan),
        j: common_vendor.t(userInfo.value.performanceReward || 0),
        k: common_vendor.t(userInfo.value.directReferralReward || 0),
        l: common_vendor.t(userInfo.value.indirectReferralReward || 0),
        m: common_vendor.t(userInfo.value.specialReward || 0),
        n: userInfo.value.branchCompany
      }, userInfo.value.branchCompany ? {
        o: common_assets._imports_3$2,
        p: common_vendor.o(tishi),
        q: common_vendor.t(rewardReportInfo.value.total_monthly_performance),
        r: common_vendor.f(rewardReportInfo.value.money_count, (item, index, i0) => {
          return {
            a: common_vendor.t(item.money || 0),
            b: common_vendor.t(item.name),
            c: common_vendor.t(item.count || 0),
            d: index
          };
        }),
        s: common_vendor.t(rewardReportInfo.value.restock_reward || 0)
      } : {}, {
        t: common_assets._imports_0$8,
        v: common_vendor.t(typeName.value || "筛选"),
        w: common_assets._imports_1$6,
        x: common_vendor.o(($event) => showLoading.value = true),
        y: common_vendor.o(($event) => showLoading.value = false),
        z: common_vendor.o(handleConfirm),
        A: common_vendor.o(($event) => queryPrams.value.bizType = $event),
        B: common_vendor.p({
          columns: columns.value,
          ["use-default-slot"]: true,
          modelValue: queryPrams.value.bizType
        }),
        C: common_vendor.f(dataList.value, (item, index, i0) => {
          return {
            a: common_vendor.t(item.title),
            b: common_vendor.t(common_vendor.unref(utils_fun.timeFormat)(item.createTime, "yyyy-MM-dd hh:mm:ss")),
            c: common_vendor.t(item.money),
            d: index
          };
        }),
        D: common_vendor.sr(paging, "4c380209-0", {
          "k": "paging"
        }),
        E: common_vendor.o(queryList),
        F: common_vendor.o(($event) => dataList.value = $event),
        G: common_vendor.p({
          ["refresher-enabled"]: showLoading.value,
          modelValue: dataList.value
        })
      });
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4c380209"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/wallet/wallet.js.map
