"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
  const _easycom_hs_page_head_information2 = common_vendor.resolveComponent("hs-page-head-information");
  const _easycom_hs_footer2 = common_vendor.resolveComponent("hs-footer");
  (_easycom_hs_page_head_information2 + _easycom_hs_footer2)();
}
const _easycom_hs_page_head_information = () => "../../components/hs-page-head-information/hs-page-head-information.js";
const _easycom_hs_footer = () => "../../components/hs-footer/hs-footer.js";
if (!Math) {
  (_easycom_hs_page_head_information + _easycom_hs_footer)();
}
const _sfc_defineComponent = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    const current = common_vendor.ref(-1);
    const invitationArr = common_vendor.ref([]);
    const list = common_vendor.ref([
      { label: "北大门闸机", checked: false },
      { label: "3座1楼大堂", checked: false },
      { label: "3座负1楼", checked: false },
      { label: "3座负2楼", checked: false }
    ]);
    const dayList = [
      { label: "1小时", checked: false },
      { label: "3小时", checked: false },
      { label: "6小时", checked: false },
      { label: "12小时", checked: false },
      { label: "1天", checked: false },
      { label: "2天", checked: false },
      { label: "3天", checked: false },
      { label: "4天", checked: false }
    ];
    const handleSelectLock = (index) => {
      var _a;
      list.value[index].checked = !list.value[index].checked;
      (_a = list == null ? void 0 : list.value) == null ? void 0 : _a.forEach((e) => {
        var _a2;
        if (e.checked) {
          (_a2 = invitationArr == null ? void 0 : invitationArr.value) == null ? void 0 : _a2.push(1);
        }
      });
    };
    const handleSelectDay = (index) => {
      current.value = index;
    };
    const handleShareBtn = () => {
      var _a;
      if (!((_a = invitationArr == null ? void 0 : invitationArr.value) == null ? void 0 : _a.length)) {
        common_vendor.index.showToast({
          title: "请选择门禁！",
          icon: "none"
        });
        return false;
      }
      if ((current == null ? void 0 : current.value) < 0) {
        common_vendor.index.showToast({
          title: "请选择授权时长！",
          icon: "none"
        });
        return false;
      }
    };
    common_vendor.onShareAppMessage(() => {
      return {
        title: "您的好友给您授权门禁！",
        path: "/INDEX/open_door/index",
        imageUrl: "https://pay-prod-1369486729.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01K5B5RY2TQQAJ1GT2RZSK426V.jpg"
      };
    });
    return (_ctx, _cache) => {
      var _a, _b;
      return common_vendor.e({
        a: common_vendor.p({
          title: "可以把您所在的小区下单元开门权限分享给好友，好友即可一键开门，方便快捷!"
        }),
        b: common_vendor.f(list.value, (i, index, i0) => {
          return common_vendor.e({
            a: common_vendor.t(i.label),
            b: i.checked
          }, i.checked ? {} : {}, {
            c: `item_${index}`,
            d: common_vendor.n(`item ${i.checked ? "active" : ""}`),
            e: common_vendor.o(($event) => handleSelectLock(index), `item_${index}`)
          });
        }),
        c: common_vendor.f(dayList, (i, index, i0) => {
          return {
            a: common_vendor.t(i.label),
            b: `item_${index}`,
            c: common_vendor.n(`item ${current.value === index ? "active" : ""}`),
            d: common_vendor.o(($event) => handleSelectDay(index), `item_${index}`)
          };
        }),
        d: current.value > -1 && ((_a = invitationArr.value) == null ? void 0 : _a.length)
      }, current.value > -1 && ((_b = invitationArr.value) == null ? void 0 : _b.length) ? {
        e: common_vendor.p({
          btnParimaryName: "分享给访客开门",
          openType: "share"
        })
      } : {
        f: common_vendor.o(handleShareBtn),
        g: common_vendor.p({
          btnParimaryName: "分享给访客开门"
        })
      });
    };
  }
});
_sfc_defineComponent.__runtimeHooks = 6;
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_defineComponent, [["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/INDEX/invitation/index.vue"]]);
wx.createPage(MiniProgramPage);
