"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const store_index = require("../../store/index.js");
const utils_fun = require("../../utils/fun.js");
const api_index = require("../../api/index.js");
const hooks_useNav = require("../../hooks/useNav.js");
if (!Array) {
  const _easycom_wd_navbar2 = common_vendor.resolveComponent("wd-navbar");
  const _easycom_wd_swiper2 = common_vendor.resolveComponent("wd-swiper");
  const _easycom_wd_notice_bar2 = common_vendor.resolveComponent("wd-notice-bar");
  const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
  const _easycom_uni_popup2 = common_vendor.resolveComponent("uni-popup");
  (_easycom_wd_navbar2 + _easycom_wd_swiper2 + _easycom_wd_notice_bar2 + _easycom_z_paging2 + _easycom_uni_popup2)();
}
const _easycom_wd_navbar = () => "../../uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js";
const _easycom_wd_swiper = () => "../../uni_modules/wot-design-uni/components/wd-swiper/wd-swiper.js";
const _easycom_wd_notice_bar = () => "../../uni_modules/wot-design-uni/components/wd-notice-bar/wd-notice-bar.js";
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
const _easycom_uni_popup = () => "../../uni_modules/uni-popup/components/uni-popup/uni-popup.js";
if (!Math) {
  (_easycom_wd_navbar + _easycom_wd_swiper + _easycom_wd_notice_bar + _easycom_z_paging + _easycom_uni_popup)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    const store = store_index.Store();
    const userInfo = common_vendor.computed(() => store.userInfo || {});
    const popup = common_vendor.ref();
    const current = common_vendor.ref(0);
    common_vendor.ref(false);
    const swiperList = common_vendor.ref([]);
    const noticeList = common_vendor.ref({
      content: ""
    });
    common_vendor.ref([]);
    const paging = common_vendor.ref(null);
    const dataList = common_vendor.ref([]);
    const { navTo } = hooks_useNav.useNav();
    const queryList = (pageNo, pageSize) => {
      api_index.api.goodsPage({ pageNo, pageSize, recommended: 1 }).then((res) => {
        paging.value.complete(res.list);
      }).catch((res) => {
        paging.value.complete(false);
      });
    };
    common_vendor.onLoad(() => {
      api_index.api.banner({
        imageAddress: 1
      }).then((res) => {
        swiperList.value = res.list;
      });
      api_index.api.noticePage({ type: 1 }).then((res) => {
        if (res.list != 0) {
          noticeList.value = res.list[0];
        }
      });
    });
    const openCode = async () => {
      await store.usersGetInfo();
      popup.value.open();
    };
    const toGoods = (e) => {
      common_vendor.index.navigateTo({
        url: `/pages/goods/goods?id=${e}`
      });
    };
    const toPrefecture = () => {
      common_vendor.index.navigateTo({
        url: "/pages/goods/prefecture"
      });
    };
    const toNotice = () => {
      common_vendor.index.navigateTo({
        url: "/pages/notice/notice"
      });
    };
    return (_ctx, _cache) => {
      return {
        a: common_assets._imports_0,
        b: common_assets._imports_1,
        c: common_vendor.p({
          bordered: false,
          ["custom-style"]: "background-color: transparent !important;",
          safeAreaInsetTop: true
        }),
        d: common_vendor.o(($event) => current.value = $event),
        e: common_vendor.p({
          customItemClass: "bannerRadius",
          height: "292rpx",
          list: ["/static/homeY.png"],
          autoplay: true,
          current: current.value
        }),
        f: common_vendor.o(toPrefecture),
        g: common_assets._imports_2,
        h: common_vendor.o(($event) => common_vendor.unref(navTo)("/pages/equity/equity", true)),
        i: common_assets._imports_3,
        j: common_vendor.o(openCode),
        k: common_vendor.o(($event) => current.value = $event),
        l: common_vendor.p({
          list: swiperList.value,
          ["value-key"]: "image",
          autoplay: true,
          current: current.value
        }),
        m: common_assets._imports_4,
        n: common_vendor.t(noticeList.value.content),
        o: common_vendor.p({
          color: "#90B77B",
          ["background-color"]: "#E2ECDC"
        }),
        p: common_vendor.o(toNotice),
        q: common_vendor.f(dataList.value, (item, index, i0) => {
          return {
            a: item.cover,
            b: common_vendor.t(item.name),
            c: common_vendor.t(item.specs),
            d: common_vendor.t(item.currentPrice),
            e: common_vendor.o(($event) => toGoods(item.id), index),
            f: index
          };
        }),
        r: common_vendor.sr(paging, "1cf27b2a-4", {
          "k": "paging"
        }),
        s: common_vendor.o(queryList),
        t: common_vendor.o(($event) => dataList.value = $event),
        v: common_vendor.p({
          ["use-page-scroll"]: true,
          modelValue: dataList.value
        }),
        w: common_vendor.o(($event) => _ctx.$refs.popup.close()),
        x: common_assets._imports_9,
        y: userInfo.value.inviteCodeImg,
        z: common_vendor.t(userInfo.value.inviteCode),
        A: common_vendor.o(($event) => common_vendor.unref(utils_fun.copy)(userInfo.value.inviteCode)),
        B: common_vendor.sr(popup, "1cf27b2a-5", {
          "k": "popup"
        }),
        C: common_vendor.p({
          type: "center",
          ["border-radius"]: "16rpx"
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1cf27b2a"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/index/index.js.map
