"use strict";
var common_vendor = require("../../common/vendor.js");
var api_index = require("../../api/index.js");
require("../../utils/request.js");
if (!Array) {
  const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
  const _easycom_u_badge2 = common_vendor.resolveComponent("u-badge");
  (_easycom_u_navbar2 + _easycom_u_badge2)();
}
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
const _easycom_u_badge = () => "../../uni_modules/uview-plus/components/u-badge/u-badge.js";
if (!Math) {
  (_easycom_u_navbar + _easycom_u_badge)();
}
const _sfc_main = {
  setup(__props) {
    common_vendor.onShow(() => {
      getMines();
    });
    let classList = common_vendor.reactive([
      { id: 1, name: "\u5F85\u4ED8\u6B3E", num: 0, ic: "/static/mineIc/obligation.png" },
      { id: 2, name: "\u5F85\u53D1\u8D27", num: 0, ic: "/static/mineIc/shipped.png" },
      { id: 3, name: "\u5F85\u6536\u8D27", num: 0, ic: "/static/mineIc/received.png" },
      { id: 4, name: "\u5F85\u8BC4\u4EF7", num: 0, ic: "/static/mineIc/evaluated.png" },
      { id: 5, name: "\u552E\u540E", num: 0, ic: "/static/mineIc/afterSales.png" }
    ]);
    let functionList = common_vendor.reactive([
      { id: 1, name: "\u6211\u7684\u4F59\u989D", ic: "/static/mineIc/balance.png" },
      { id: 2, name: "\u6211\u7684\u79EF\u5206", ic: "/static/mineIc/collect.png" },
      { id: 3, name: "\u6211\u7684\u5730\u5740", ic: "/static/mineIc/addressBlack.png" }
    ]);
    let info = common_vendor.ref({});
    const orderStatus = (index) => {
      common_vendor.index.navigateTo({
        url: `/pages/mine/myOrder?status=${index == 5 ? 0 : Number(index) + 1}`
      });
    };
    const functionC = (index) => {
      if (index < 2) {
        common_vendor.index.navigateTo({
          url: `/pages/mine/myPoints?type=${index}`
        });
      } else {
        common_vendor.index.navigateTo({
          url: "/pages/mine/myAddress"
        });
      }
    };
    const toRecharg = () => {
      common_vendor.index.navigateTo({
        url: "/pages/mine/recharge"
      });
    };
    const getMines = async () => {
      try {
        const res = await api_index.getMine();
        classList[0].num = res.dfk;
        classList[1].num = res.dfh;
        classList[2].num = res.dsh;
        classList[3].num = res.ywc;
        classList[4].num = res.yth;
        info.value = res.userInfo;
        console.log("getMine", res);
      } catch (err) {
        common_vendor.index.showToast({ title: err, icon: "none" });
        console.log("getMine", err);
      }
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          title: "\u6211\u7684",
          bgColor: "transparent"
        }),
        b: common_vendor.o(toRecharg),
        c: common_vendor.o(($event) => orderStatus(5)),
        d: common_vendor.f(common_vendor.unref(classList), (item, index, i0) => {
          return {
            a: "6cbe0492-1-" + i0,
            b: common_vendor.p({
              absolute: true,
              offset: [-4, -10],
              color: "#FFFFFF",
              bgColor: "#F74637",
              max: "99",
              value: item.num
            }),
            c: item.ic,
            d: common_vendor.t(item.name),
            e: item.id,
            f: common_vendor.o(($event) => orderStatus(index), item.id)
          };
        }),
        e: common_vendor.f(common_vendor.unref(functionList), (item, index, i0) => {
          return {
            a: item.ic,
            b: common_vendor.t(item.name),
            c: item.id,
            d: common_vendor.o(($event) => functionC(index), item.id)
          };
        })
      };
    };
  }
};
var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/vue/\u5927\u5065\u5EB7\u5546\u57CE/healthMall/pages/mine/mine.vue"]]);
wx.createPage(MiniProgramPage);