"use strict";
const common_vendor = require("../../common/vendor.js");
if (!Array) {
  const _easycom_u_notice_bar2 = common_vendor.resolveComponent("u-notice-bar");
  const _easycom_u_divider2 = common_vendor.resolveComponent("u-divider");
  (_easycom_u_notice_bar2 + _easycom_u_divider2)();
}
const _easycom_u_notice_bar = () => "../../node-modules/uview-plus/components/u-notice-bar/u-notice-bar.js";
const _easycom_u_divider = () => "../../node-modules/uview-plus/components/u-divider/u-divider.js";
if (!Math) {
  (_easycom_u_notice_bar + _easycom_u_divider)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "index",
  setup(__props) {
    var _a;
    const $api = (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
    common_vendor.computed(() => {
      return common_vendor.index.getStorageSync("openid");
    });
    const config = common_vendor.ref({});
    const id = common_vendor.ref("");
    const text = common_vendor.ref("以下内容为商家填写 购车前请谨慎核对，以实际情况为准");
    const info = common_vendor.ref({});
    const useTypeList = common_vendor.ref([]);
    const boxTypeList = common_vendor.ref([]);
    const structureList = common_vendor.ref([]);
    const emissionList = common_vendor.ref([]);
    const energyList = common_vendor.ref([]);
    const setList = common_vendor.ref([]);
    const levelList = common_vendor.ref([]);
    const driveList = common_vendor.ref([]);
    common_vendor.onLoad(async (options) => {
      id.value = options && options.id;
      await searchConfig();
      await searchOther();
      await search();
    });
    const searchOther = async () => {
      let res;
      res = await $api(`dictData`, "GET", { code: "useType", is_use: "0" });
      if (res.errcode === 0)
        useTypeList.value = res.data;
      res = await $api(`dictData`, "GET", { code: "boxType", is_use: "0" });
      if (res.errcode === 0)
        boxTypeList.value = res.data;
      res = await $api(`dictData`, "GET", { code: "structure", is_use: "0" });
      if (res.errcode === 0)
        structureList.value = res.data;
      res = await $api(`dictData`, "GET", { code: "emission", is_use: "0" });
      if (res.errcode === 0)
        emissionList.value = res.data;
      res = await $api(`dictData`, "GET", { code: "energy", is_use: "0" });
      if (res.errcode === 0)
        energyList.value = res.data;
      res = await $api(`dictData`, "GET", { code: "set", is_use: "0" });
      if (res.errcode === 0)
        setList.value = res.data;
      res = await $api(`dictData`, "GET", { code: "level", is_use: "0" });
      if (res.errcode === 0)
        levelList.value = res.data;
      res = await $api(`dictData`, "GET", { code: "drive", is_use: "0" });
      if (res.errcode === 0)
        driveList.value = res.data;
    };
    const searchConfig = async () => {
      config.value = common_vendor.index.getStorageSync("config");
    };
    const search = async () => {
      if (id.value) {
        const res = await $api(`car/${id.value}`, "GET", {});
        if (res.errcode === 0) {
          info.value = res.data;
        } else {
          common_vendor.index.showToast({
            title: res.errmsg || "",
            icon: "error"
          });
        }
      }
    };
    const getDict = (data, model) => {
      let list;
      switch (model) {
        case "use_type":
          list = useTypeList.value;
          break;
        case "type":
          list = boxTypeList.value;
          break;
        case "structure":
          list = structureList.value;
          break;
        case "emission":
          list = emissionList.value;
          break;
        case "energy":
          list = energyList.value;
          break;
        case "set":
          list = setList.value;
          break;
        case "level":
          list = levelList.value;
          break;
        case "drive":
          list = driveList.value;
          break;
      }
      if (!list)
        return;
      const res = list.find((f) => f.value == data);
      return (res == null ? void 0 : res.label) || "暂无";
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          text: text.value
        }),
        b: common_vendor.t(info.value._id || "暂无"),
        c: common_vendor.t(info.value.series || "暂无"),
        d: common_vendor.t(info.value.year || "暂无"),
        e: common_vendor.t(info.value.style || "暂无"),
        f: common_vendor.t(info.value.vin ? "已上传" : "未上传"),
        g: common_vendor.t(info.value.mileage || "暂无"),
        h: common_vendor.t(getDict(info.value.emission, "emission")),
        i: common_vendor.t(common_vendor.unref(common_vendor.hooks)(info.value.f_time).format("YYYY-MM") || "暂无日期"),
        j: common_vendor.t(info.value.number || "0"),
        k: common_vendor.t(info.value.place || "暂无"),
        l: common_vendor.t(info.value.license || "暂无"),
        m: common_vendor.t(info.value.out_color || "暂无"),
        n: common_vendor.t(info.value.in_color || "暂无"),
        o: common_vendor.t(getDict(info.value.use_type, "use_type")),
        p: common_vendor.t(getDict(info.value.energy, "energy")),
        q: common_vendor.t(info.value.displacement || "暂无"),
        r: common_vendor.t(getDict(info.value.level, "level")),
        s: common_vendor.t(getDict(info.value.type, "type")),
        t: common_vendor.t(getDict(info.value.drive, "drive")),
        v: common_vendor.t(getDict(info.value.set, "set")),
        w: common_vendor.p({
          text: "以上为全部内容"
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-ec8f841d"], ["__file", "D:/project/赋强公证/notarization_applet/pagesHome/record/index.vue"]]);
wx.createPage(MiniProgramPage);
