"use strict";
const common_vendor = require("../../../common/vendor.js");
if (!Array) {
  const _easycom_uni_icons2 = common_vendor.resolveComponent("uni-icons");
  const _easycom_hs_button2 = common_vendor.resolveComponent("hs-button");
  const _easycom_up_keyboard2 = common_vendor.resolveComponent("up-keyboard");
  (_easycom_uni_icons2 + _easycom_hs_button2 + _easycom_up_keyboard2)();
}
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_up_keyboard = () => "../../../node-modules/uview-plus/components/u-keyboard/u-keyboard.js";
if (!Math) {
  (_easycom_uni_icons + _easycom_hs_button + _easycom_up_keyboard)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    const licensePlateNumber = common_vendor.ref(["", "", "", "", "", "", "", ""]);
    const licensePlateNumberValue = common_vendor.ref("");
    const isFocus = common_vendor.ref(false);
    const ketMode = common_vendor.ref("car");
    const showKeyboard = common_vendor.ref(true);
    const handleProvinceClick = () => {
      showKeyboard.value = true;
      ketMode.value = "car";
      isFocus.value = false;
    };
    const handleInputChange = (e) => {
      var _a, _b;
      if (((_a = licensePlateNumberValue == null ? void 0 : licensePlateNumberValue.value) == null ? void 0 : _a.length) < 8) {
        licensePlateNumberValue.value += e;
        for (let i = 0; i < 8; i++) {
          licensePlateNumber.value[i] = licensePlateNumberValue.value[i] || "";
          console.log(licensePlateNumberValue.value[i]);
        }
      }
      if (((_b = licensePlateNumberValue == null ? void 0 : licensePlateNumberValue.value) == null ? void 0 : _b.length) === 8) {
        showKeyboard.value = false;
        isFocus.value = false;
      }
    };
    const handleBackspaceChange = () => {
      var _a;
      licensePlateNumberValue.value = (_a = licensePlateNumberValue.value) == null ? void 0 : _a.slice(0, -1);
      for (let i = 0; i < 8; i++) {
        licensePlateNumber.value[i] = licensePlateNumberValue.value[i] || "";
        console.log(licensePlateNumberValue.value[i]);
      }
    };
    const handleAddVehicle = () => {
      var _a;
      if (((_a = licensePlateNumberValue == null ? void 0 : licensePlateNumberValue.value) == null ? void 0 : _a.length) < 7) {
        common_vendor.index.showToast({
          title: "请输入完整的车牌号！",
          icon: "none"
        });
        return;
      }
      common_vendor.index.showModal({
        title: "提示",
        content: "暂不能添加车辆！",
        showCancel: false,
        confirmColor: "#0082FA",
        success: function(res) {
          if (res.confirm) {
            console.log("用户点击确定");
          } else if (res.cancel) {
            console.log("用户点击取消");
          }
        }
      });
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.f(licensePlateNumber.value, (i, index, i0) => {
          return common_vendor.e({
            a: !i && index === 7
          }, !i && index === 7 ? {
            b: "0e44bb83-0-" + i0,
            c: common_vendor.p({
              type: "plusempty",
              color: "#2A7EFB",
              size: "13"
            })
          } : {
            d: common_vendor.t(i)
          }, {
            e: index === 1
          }, index === 1 ? {} : {}, {
            f: `iten_${index}`
          });
        }),
        b: common_vendor.o(handleProvinceClick),
        c: common_vendor.o(handleAddVehicle),
        d: common_vendor.p({
          label: "添加车辆",
          size: "md"
        }),
        e: common_vendor.sr("uKeyboard", "0e44bb83-2"),
        f: common_vendor.o(($event) => showKeyboard.value = false),
        g: common_vendor.o(handleInputChange),
        h: common_vendor.o(handleBackspaceChange),
        i: common_vendor.o(($event) => showKeyboard.value = false),
        j: common_vendor.o(($event) => showKeyboard.value = false),
        k: common_vendor.p({
          mode: ketMode.value,
          show: showKeyboard.value
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "/Users/zsq/Sources/github/2025property-pay/pay-customer/src/ME/vehicle_management/add/index.vue"]]);
wx.createPage(MiniProgramPage);
