"use strict";
const common_vendor = require("../common/vendor.js");
require("../common/libraries/request.js");
const common_store_useWeAppAuthStore = require("../common/store/useWeAppAuthStore.js");
require("../common/store/useWorkStore.js");
require("../gen/Apis.js");
require("../common/libraries/setTabBar.js");
require("../common/libraries/apiLoading.js");
if (!Array) {
  const _easycom_hs_all_page_bg2 = common_vendor.resolveComponent("hs-all-page-bg");
  const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  const _easycom_hs_button2 = common_vendor.resolveComponent("hs-button");
  const _easycom_hs_private_policy2 = common_vendor.resolveComponent("hs-private-policy");
  (_easycom_hs_all_page_bg2 + _easycom_uni_icons2 + _easycom_hs_button2 + _easycom_hs_private_policy2)();
}
const _easycom_hs_all_page_bg = () => "../components/hs-all-page-bg/hs-all-page-bg.js";
const _easycom_uni_icons = () => "../uni_modules/uni-icons/components/uni-icons/uni-icons.js";
const _easycom_hs_button = () => "../components/hs-button/hs-button.js";
const _easycom_hs_private_policy = () => "../components/hs-private-policy/hs-private-policy.js";
if (!Math) {
  (_easycom_hs_all_page_bg + _easycom_uni_icons + _easycom_hs_button + _easycom_hs_private_policy)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "login",
  setup(__props) {
    const capsuleRect = common_vendor.ref({});
    common_vendor.ref("");
    const pageSource = common_vendor.ref("");
    common_vendor.ref({
      username: "",
      password: ""
    });
    const auth = common_store_useWeAppAuthStore.useWeAppAuthStore();
    let CheckedVal = common_vendor.ref(false);
    common_vendor.onLoad((e) => {
      pageSource.value = e == null ? void 0 : e.source;
    });
    const handleBack = () => {
      if (pageSource.value === "transfer") {
        common_vendor.index.switchTab({
          url: "/pages/index/index"
        });
      } else {
        common_vendor.index.navigateBack({
          delta: 1
        });
      }
    };
    const handleGetPhoneNumber = async (data) => {
      if (!CheckedVal.value) {
        return false;
      }
      common_vendor.index.showLoading({
        title: "正在登录...",
        mask: true
      });
      auth == null ? void 0 : auth.handleUserLogin({ code: data.detail.code });
    };
    const privacyToast = () => {
      if (!CheckedVal.value) {
        common_vendor.index.showToast({
          title: "请阅读并勾选隐私政策！",
          icon: "none"
        });
        return false;
      }
      return true;
    };
    const previewPdf = () => {
      common_vendor.index.showLoading({
        title: "加载中...",
        mask: true
      });
      common_vendor.index.downloadFile({
        url: "https://pay-test-1369486729.cos.ap-guangzhou.myqcloud.com/uploads/cs-test/01K44N70AAG2V678XATHQTH1RC.pdf",
        success: function(e) {
          const filePath = e.tempFilePath;
          common_vendor.index.hideLoading();
          common_vendor.index.openDocument({
            filePath,
            showMenu: true
          });
        }
      });
    };
    common_vendor.onShow(() => {
      capsuleRect.value = common_vendor.index.getMenuButtonBoundingClientRect();
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          type: "left",
          size: "20"
        }),
        b: common_vendor.s(`height:${capsuleRect.value.height}px;width:${capsuleRect.value.height}px;`),
        c: common_vendor.o(handleBack),
        d: common_vendor.s(`padding-top:${capsuleRect.value.top}px;height:${capsuleRect.value.height}px;line-height:${capsuleRect.value.height}px;`),
        e: common_vendor.o(handleGetPhoneNumber),
        f: common_vendor.o(privacyToast),
        g: common_vendor.p({
          type: "primary",
          size: "lg",
          label: "快捷登录",
          openType: common_vendor.unref(CheckedVal) ? "getPhoneNumber" : ""
        }),
        h: common_vendor.o(previewPdf),
        i: common_vendor.o(($event) => common_vendor.isRef(CheckedVal) ? CheckedVal.value = $event : CheckedVal = $event),
        j: common_vendor.p({
          policyName: "《用户协议》",
          isAgree: common_vendor.unref(CheckedVal)
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/pages/login.vue"]]);
wx.createPage(MiniProgramPage);
