|
@@ -14,33 +14,23 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
__name: "index",
|
|
|
setup(__props) {
|
|
|
var _a;
|
|
|
- (_a = common_vendor.getCurrentInstance()) == null ? void 0 : _a.appContext.config.globalProperties.$api;
|
|
|
+ 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({
|
|
|
- num: "13238468",
|
|
|
- name: "雅阁 2015款 2.0L LX 舒适版",
|
|
|
- feel: "车辆识别号(VIN)",
|
|
|
- km: "8.70万公里",
|
|
|
- emission: "国V",
|
|
|
- first: "2016-03",
|
|
|
- number: "0次",
|
|
|
- city: "长春",
|
|
|
- address: "长春",
|
|
|
- color: "黑色",
|
|
|
- colorn: "深色",
|
|
|
- nature: "非营运",
|
|
|
- type: "汽油",
|
|
|
- displacement: "2.0L",
|
|
|
- level: "中型车",
|
|
|
- gearbox: "自动",
|
|
|
- way: "前驱",
|
|
|
- seat: "5座"
|
|
|
- });
|
|
|
+ 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 displacementList = 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();
|
|
@@ -48,36 +38,113 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
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: "displacement", is_use: "0" });
|
|
|
+ if (res.errcode === 0)
|
|
|
+ displacementList.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 "displacement":
|
|
|
+ list = displacementList.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.num || "暂无"),
|
|
|
- c: common_vendor.t(info.value.name || "暂无"),
|
|
|
- d: common_vendor.t(info.value.feel || "暂无"),
|
|
|
- e: common_vendor.t(info.value.km || "暂无"),
|
|
|
- f: common_vendor.t(info.value.emission || "暂无"),
|
|
|
- g: common_vendor.t(info.value.first || "暂无"),
|
|
|
- h: common_vendor.t(info.value.number || "暂无"),
|
|
|
- i: common_vendor.t(info.value.city || "暂无"),
|
|
|
- j: common_vendor.t(info.value.address || "暂无"),
|
|
|
- k: common_vendor.t(info.value.color || "暂无"),
|
|
|
- l: common_vendor.t(info.value.colorn || "暂无"),
|
|
|
- m: common_vendor.t(info.value.nature || "暂无"),
|
|
|
- n: common_vendor.t(info.value.type || "暂无"),
|
|
|
- o: common_vendor.t(info.value.displacement || "暂无"),
|
|
|
- p: common_vendor.t(info.value.level || "暂无"),
|
|
|
- q: common_vendor.t(info.value.gearbox || "暂无"),
|
|
|
- r: common_vendor.t(info.value.way || "暂无"),
|
|
|
- s: common_vendor.t(info.value.seat || "暂无"),
|
|
|
- t: common_vendor.p({
|
|
|
+ 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(info.value.f_time || "暂无"),
|
|
|
+ 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(getDict(info.value.displacement, "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: "以上为全部内容"
|
|
|
})
|
|
|
};
|