"use strict"; const common_vendor = require("../../common/vendor.js"); if (!Array) { const _easycom_u_swiper2 = common_vendor.resolveComponent("u-swiper"); const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon"); const _easycom_u_button2 = common_vendor.resolveComponent("u-button"); (_easycom_u_swiper2 + _easycom_u_icon2 + _easycom_u_button2)(); } const _easycom_u_swiper = () => "../../node-modules/uview-plus/components/u-swiper/u-swiper.js"; const _easycom_u_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js"; const _easycom_u_button = () => "../../node-modules/uview-plus/components/u-button/u-button.js"; if (!Math) { (_easycom_u_swiper + _easycom_u_icon + _easycom_u_button)(); } 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 currentNum = common_vendor.ref(1); const info = common_vendor.ref({}); const shop = common_vendor.ref({}); const list = common_vendor.ref([]); const emissionList = common_vendor.ref([]); const boxTypeList = common_vendor.ref([]); common_vendor.onLoad(async (options) => { id.value = options && options.id; await searchConfig(); await search(); }); const searchConfig = async () => { config.value = common_vendor.index.getStorageSync("config"); }; const search = async () => { var _a2; if (id.value) { const res = await $api(`car/${id.value}`, "GET", {}); if (res.errcode === 0) { info.value = res.data; await searchShop((_a2 = res.data) == null ? void 0 : _a2.shop); await searchOther(); } else { common_vendor.index.showToast({ title: res.errmsg || "", icon: "error" }); } } }; const searchShop = async (e) => { if (!e) return; const res = await $api(`shop/${e}`, "GET", {}); if (res.errcode === 0) { shop.value = res.data; } else { common_vendor.index.showToast({ title: res.errmsg || "", icon: "error" }); } }; const searchOther = async () => { const info2 = { skip: 0, limit: 20, status: "0", shop: shop.value._id }; const arr = await $api("car", "GET", info2); if (arr.errcode === 0) { list.value = arr.data; shop.value.num = arr.total; } else { common_vendor.index.showToast({ title: arr.errmsg || "", icon: "error" }); } let res; res = await $api(`dictData`, "GET", { code: "boxType", is_use: "0" }); if (res.errcode === 0) boxTypeList.value = res.data; res = await $api(`dictData`, "GET", { code: "emission", is_use: "0" }); if (res.errcode === 0) emissionList.value = res.data; }; const getDict = (data, model) => { let list2; switch (model) { case "type": list2 = boxTypeList.value; break; case "emission": list2 = emissionList.value; break; } if (!list2) return; const res = list2.find((f) => f.value == data); return (res == null ? void 0 : res.label) || "暂无"; }; const PhoneNumber = (e) => { console.log(e); }; const toRecord = () => { common_vendor.index.navigateTo({ url: `/pagesHome/record/index?id=${info.value.id || info.value._id}` }); }; const toView = (item) => { common_vendor.index.navigateTo({ url: `/pagesHome/car/index?id=${item.id || item._id}` }); }; const toChat = (item) => { var _a2; common_vendor.index.makePhoneCall({ phoneNumber: (_a2 = shop.value) == null ? void 0 : _a2.tel, success: function() { console.log("拨打电话成功"); }, fail: function() { common_vendor.index.showToast({ title: "拨打电话失败", icon: "error" }); } }); }; const toShop = () => { common_vendor.index.navigateTo({ url: `/pagesHome/shop/index?id=${shop.value.id || shop.value._id}&name=${shop.value.name}` }); }; const toMore = () => { common_vendor.index.navigateTo({ url: `/pagesHome/picture/index?id=${info.value.id || info.value._id}&shop=${shop.value._id}` }); }; return (_ctx, _cache) => { var _a2, _b, _c, _d, _e, _f, _g; return { a: common_vendor.t(currentNum.value + 1), b: common_vendor.t((_a2 = info.value.file) == null ? void 0 : _a2.length), c: common_vendor.o((e) => currentNum.value = e.current), d: common_vendor.p({ list: info.value.file, height: "300px", keyName: "url", autoplay: false, indicatorStyle: "right: 20px", radius: "0" }), e: common_vendor.t(info.value.real_pay || "0"), f: common_vendor.t(info.value.price || "0"), g: common_vendor.o(PhoneNumber), h: common_vendor.t(info.value.series || "暂无"), i: common_vendor.t(info.value.year || "暂无"), j: common_vendor.t(info.value.style || "暂无"), k: common_vendor.t(info.value.series), l: common_vendor.p({ name: "arrow-right", size: "12" }), m: common_vendor.t(info.value.first_pay), n: common_vendor.p({ name: "arrow-right", size: "16" }), o: common_vendor.o(toChat), p: common_vendor.t(common_vendor.unref(common_vendor.hooks)(info.value.f_time).format("YYYY-MM") || "暂无日期"), q: common_vendor.t(info.value.mileage || "暂无"), r: common_vendor.t(getDict(info.value.emission, "emission")), s: common_vendor.t(info.value.place || "暂无"), t: common_vendor.o(toRecord), v: common_vendor.p({ name: "arrow-right", size: "16" }), w: common_vendor.t(info.value.hundred_time || "0"), x: common_vendor.t(info.value.displacement || "暂无"), y: common_vendor.t(info.value.wheelbase || "暂无"), z: common_vendor.t(getDict(info.value.type, "type")), A: common_vendor.t(info.value.oil || "0"), B: common_vendor.t(info.value.premium || "0"), C: common_vendor.t(info.value.maintenance || "0"), D: shop.value.logo && ((_b = shop.value.logo) == null ? void 0 : _b.length) > 0 ? shop.value.logo[0].url : "https://cdn.uviewui.com/uview/album/1.jpg", E: common_vendor.t(shop.value.name || "暂无"), F: common_vendor.p({ bold: true, color: "#000", name: "arrow-right", size: "16" }), G: common_vendor.o(toShop), H: common_vendor.t(shop.value.num || 0), I: common_vendor.o(toChat), J: common_vendor.p({ icon: "phone", text: "咨询卖家车况", size: "normal", type: "info" }), K: info.value.file && ((_c = info.value.file) == null ? void 0 : _c.length) > 0 ? info.value.file[0].url : "https://cdn.uviewui.com/uview/album/1.jpg", L: info.value.file && ((_d = info.value.file) == null ? void 0 : _d.length) > 1 ? info.value.file[1].url : "https://cdn.uviewui.com/uview/album/5.jpg", M: info.value.file && ((_e = info.value.file) == null ? void 0 : _e.length) > 2 ? info.value.file[2].url : "https://cdn.uviewui.com/uview/album/2.jpg", N: info.value.file && ((_f = info.value.file) == null ? void 0 : _f.length) > 3 ? info.value.file[3].url : "https://cdn.uviewui.com/uview/album/3.jpg", O: info.value.file && ((_g = info.value.file) == null ? void 0 : _g.length) > 4 ? info.value.file[4].url : "https://cdn.uviewui.com/uview/album/4.jpg", P: common_vendor.o(toMore), Q: common_vendor.p({ text: "查看更多图片", size: "normal", type: "info" }), R: common_vendor.f(list.value, (item, index, i0) => { return common_vendor.e({ a: item.file && item.file.length > 0 ? item.file[0].url : "", b: common_vendor.t(item.series || "暂无"), c: common_vendor.t(item.year || "暂无"), d: common_vendor.t(item.style || "暂无"), e: item.year }, item.year ? { f: common_vendor.t(item.year || "暂无") } : {}, { g: item.mileage }, item.mileage ? { h: common_vendor.t(item.mileage || "暂无") } : {}, { i: item.place }, item.place ? { j: common_vendor.t(item.place || "暂无") } : {}, { k: common_vendor.t(item.total_money || "0"), l: index, m: common_vendor.o(($event) => toView(item), index) }); }), S: common_vendor.p({ color: "#000", name: "red-packet", size: "20" }), T: common_vendor.o(toChat), U: common_vendor.o(toChat), V: common_vendor.o(toChat) }; }; } }); const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6b665083"], ["__file", "D:/project/二手车/car_applet/pagesHome/car/index.vue"]]); wx.createPage(MiniProgramPage);