"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 files = common_vendor.ref([{ name: "上牌时间", content: "2013-10" }, { name: "表显里程", content: "8.0万公里" }, { name: "排放标准", content: "国六" }, { name: "车源地", content: "长春" }]); const parameter = common_vendor.ref([{ name: "发动机", content: "1.8L" }, { name: "轴距", content: "2700mm" }, { name: "变速箱", content: "自动" }, { name: "最大功率", content: "103kW" }]); const info = common_vendor.ref({ url: [{ url: "https://cdn.uviewui.com/uview/album/1.jpg" }, { url: "https://cdn.uviewui.com/uview/album/2.jpg" }, { url: "https://cdn.uviewui.com/uview/album/3.jpg" }, { url: "https://cdn.uviewui.com/uview/album/4.jpg" }, { url: "https://cdn.uviewui.com/uview/album/5.jpg" }], payment: "2.7", rankNum: "11", rank: "全国紧凑型SUV销售榜", type: "夏朗", name: "夏朗 2013款 1.8TSI 标配型 欧IV", money: "7.80", price: "29.06" }); const shop = common_vendor.ref({}); const list = 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 res = await $api("car", "GET", { ...info2 }); if (res.errcode === 0) { list.value = res.data; shop.value.num = res.total; } else { common_vendor.index.showToast({ title: res.errmsg || "", icon: "error" }); } }; 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) => { common_vendor.index.makePhoneCall({ phoneNumber: (item == null ? void 0 : item.shop) || "110", success: function() { console.log("拨打电话成功"); }, fail: function() { console.log("拨打电话失败"); } }); }; 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}` }); }; const toCollect = () => { console.log("收藏"); }; 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.rank), n: common_vendor.t(info.value.rankNum), o: common_vendor.p({ name: "arrow-right", size: "12" }), p: common_vendor.t(info.value.first_pay), q: common_vendor.p({ name: "arrow-right", size: "16" }), r: common_vendor.f(files.value, (item, index, i0) => { return { a: common_vendor.t(item.content), b: common_vendor.t(item.name), c: index, d: common_vendor.o(($event) => _ctx.toCommon(item), index) }; }), s: common_vendor.o(toRecord), t: common_vendor.p({ name: "arrow-right", size: "16" }), v: common_vendor.f(parameter.value, (item, index, i0) => { return { a: common_vendor.t(item.content), b: common_vendor.t(item.name), c: index, d: common_vendor.o(($event) => _ctx.toCommon(item), index) }; }), w: 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", x: common_vendor.t(shop.value.name || "暂无"), y: common_vendor.p({ bold: true, color: "#000", name: "arrow-right", size: "16" }), z: common_vendor.o(toShop), A: common_vendor.t(shop.value.num || 0), B: common_vendor.o(toChat), C: common_vendor.p({ icon: "phone", text: "咨询卖家车况", size: "normal", type: "info" }), D: 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", E: 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", F: 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", G: 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", H: 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", I: common_vendor.o(toMore), J: common_vendor.p({ text: "查看更多图片", size: "normal", type: "info" }), K: 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) }); }), L: common_vendor.p({ color: "#000", name: "red-packet", size: "20" }), M: common_vendor.o(toChat), N: common_vendor.p({ color: "#000", name: "heart", size: "20" }), O: common_vendor.o(toCollect), P: common_vendor.o(toChat), Q: 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);