123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- if (!Array) {
- const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
- const _easycom_u_line2 = common_vendor.resolveComponent("u-line");
- const _easycom_u_button2 = common_vendor.resolveComponent("u-button");
- (_easycom_u_icon2 + _easycom_u_line2 + _easycom_u_button2)();
- }
- const _easycom_u_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
- const _easycom_u_line = () => "../../node-modules/uview-plus/components/u-line/u-line.js";
- const _easycom_u_button = () => "../../node-modules/uview-plus/components/u-button/u-button.js";
- if (!Math) {
- (_easycom_u_icon + _easycom_u_line + _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("");
- common_vendor.ref("https://cdn.uviewui.com/uview/album/1.jpg");
- const shop = common_vendor.ref({});
- const type = common_vendor.ref("0");
- const is_show = common_vendor.ref(false);
- const searchList = common_vendor.ref([{ title: "默认排序", type: "0", is_open: false }, { title: "品牌", type: "1", is_open: false }, { title: "价格", type: "2", is_open: false }, { title: "车龄", type: "3", is_open: false }, { title: "更多筛选", type: "4", is_open: false }]);
- const sortList = common_vendor.ref([{ title: "默认排序", type: "0", is_open: true }, { title: "最新上架", type: "1", is_open: false }, { title: "车龄最短", type: "2", is_open: false }, { title: "里程最少", type: "3", is_open: false }, { title: "价格最高", type: "4", is_open: false }, { title: "价格最低", type: "5", is_open: false }]);
- const moneyList = common_vendor.ref([{ title: "不限价格", type: "0", is_open: true }, { title: "10万以下", type: "1", is_open: false }, { title: "10-15万", type: "2", is_open: false }, { title: "15-20万", type: "3", is_open: false }, { title: "20-25万", type: "4", is_open: false }, { title: "25-30万", type: "5", is_open: false }, { title: "30-50万", type: "6", is_open: false }, { title: "50万以上", type: "7", is_open: false }]);
- const yearList = common_vendor.ref([{ title: "不限车龄", type: "0", is_open: true }, { title: "2年以下", type: "1", is_open: false }, { title: "4年以下", type: "2", is_open: false }, { title: "6年以下", type: "3", is_open: false }]);
- const brandInfo = common_vendor.ref({});
- const moneyInfo = common_vendor.ref({});
- const yearInfo = common_vendor.ref({});
- const moreList = common_vendor.ref([]);
- common_vendor.ref([
- {
- title: "5万以下",
- type: "0"
- },
- {
- title: "5-10万",
- type: "1"
- },
- {
- title: "10-15万",
- type: "2"
- },
- {
- title: "更多条件",
- type: "3"
- }
- ]);
- common_vendor.ref([
- {
- title: "大众",
- type: "0"
- },
- {
- title: "宝马",
- type: "1"
- },
- {
- title: "本田",
- type: "2"
- },
- {
- title: "丰田",
- type: "3"
- },
- {
- title: "更多品牌",
- type: "4"
- }
- ]);
- const list = common_vendor.ref([]);
- const total = common_vendor.ref(0);
- const skip = common_vendor.ref(0);
- const limit = common_vendor.ref(6);
- const page = common_vendor.ref(0);
- const is_bottom = common_vendor.ref(false);
- common_vendor.ref(0);
- common_vendor.onLoad(async (options) => {
- id.value = options && options.id;
- common_vendor.index.setNavigationBarTitle({
- title: options && options.name || "车行详情"
- });
- await searchConfig();
- await search();
- await searchOther();
- });
- common_vendor.onShow(() => {
- common_vendor.index.$on("toRoute", function(data) {
- brandInfo.value = data;
- });
- });
- const searchConfig = async () => {
- config.value = common_vendor.index.getStorageSync("config");
- };
- const search = async () => {
- if (id.value) {
- const res = await $api(`shop/${id.value}`, "GET", {});
- if (res.errcode === 0) {
- shop.value = res.data;
- } else {
- common_vendor.index.showToast({
- title: res.errmsg || "",
- icon: "error"
- });
- }
- }
- };
- const searchOther = async () => {
- let res;
- const info = {
- skip: skip.value,
- limit: limit.value,
- status: "0",
- shop: id.value
- };
- res = await $api("car", "GET", {
- ...info
- });
- if (res.errcode === 0) {
- list.value = list.value.concat(res.data);
- total.value = res.total;
- shop.value.sale = res.total;
- } else {
- common_vendor.index.showToast({
- title: res.errmsg || "",
- icon: "error"
- });
- }
- res = await $api("car", "GET", {
- skip: 0,
- limit: 1,
- status: "1",
- shop: id.value
- });
- if (res.errcode === 0)
- shop.value.sold = res.total;
- };
- const toSearch = (value) => {
- searchList.value = searchList.value.map((item, index) => {
- if (item.type == value.type && !item.is_open)
- item.is_open = true;
- else
- item.is_open = false;
- return item;
- });
- type.value = value.type;
- if (value.type == "1") {
- toClose();
- common_vendor.index.navigateTo({
- url: `/pagesHome/brand/index`
- });
- } else if (value.type == "4") {
- toClose();
- common_vendor.index.navigateTo({
- url: `/pagesHome/condition/index`
- });
- } else
- is_show.value = searchList.value.some((item) => item.is_open == true);
- };
- const toClose = () => {
- is_show.value = false;
- searchList.value = searchList.value.map((item, index) => {
- item.is_open = false;
- return item;
- });
- };
- const toSelect = (data, type2) => {
- if (type2 == "0") {
- sortList.value = sortList.value.map((item, index) => {
- if (item.type == data.type)
- item.is_open = true;
- else
- item.is_open = false;
- return item;
- });
- searchList.value = searchList.value.map((i, index) => {
- if (i.type == "0")
- i.title = data.title;
- return i;
- });
- } else if (type2 == "2") {
- moneyList.value = moneyList.value.map((item, index) => {
- if (item.type == data.type)
- item.is_open = true;
- else
- item.is_open = false;
- return item;
- });
- moneyInfo.value = data;
- } else {
- yearList.value = yearList.value.map((item, index) => {
- if (item.type == data.type)
- item.is_open = true;
- else
- item.is_open = false;
- return item;
- });
- yearInfo.value = data;
- }
- };
- const toDelete = (item, type2) => {
- if (type2 == "0")
- brandInfo.value = {};
- else if (type2 == "1") {
- moneyList.value = moneyList.value.map((item2, index) => {
- if (item2.type == "0")
- item2.is_open = true;
- else
- item2.is_open = false;
- return item2;
- });
- moneyInfo.value = {};
- } else if (type2 == "2") {
- yearList.value = yearList.value.map((item2, index) => {
- if (item2.type == "0")
- item2.is_open = true;
- else
- item2.is_open = false;
- return item2;
- });
- yearInfo.value = {};
- } else
- moreList.value = moreList.value.filter((i, index) => i.type != item.type);
- };
- const toReset = () => {
- toDelete({}, "0");
- toDelete({}, "1");
- toDelete({}, "2");
- moreList.value = [];
- toClear();
- };
- const toClear = () => {
- searchList.value = searchList.value.map((i, index) => {
- if (i.type == "0")
- i.title = "默认排序";
- return i;
- });
- sortList.value = sortList.value.map((item, index) => {
- if (item.type == "0")
- item.is_open = true;
- else
- item.is_open = false;
- return item;
- });
- };
- const toChat = (item) => {
- common_vendor.index.makePhoneCall({
- phoneNumber: item.shop || "110",
- success: function() {
- console.log("拨打电话成功");
- },
- fail: function() {
- console.log("拨打电话失败");
- }
- });
- };
- const toView = (item) => {
- common_vendor.index.navigateTo({
- url: `/pagesHome/car/index?id=${item.id || item._id}`
- });
- };
- const toPage = () => {
- if (total.value > list.value.length) {
- common_vendor.index.showLoading({
- title: "加载中",
- mask: true
- });
- page.value = page.value + 1;
- skip.value = page.value * limit.value;
- search();
- common_vendor.index.hideLoading();
- } else
- is_bottom.value = true;
- };
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: common_vendor.t(shop.value.name || "暂无"),
- b: common_vendor.t(shop.value.sale || "0"),
- c: common_vendor.t(shop.value.sold || "0"),
- d: common_vendor.t(shop.value.status == "0" ? "营业中" : "休息中"),
- e: common_vendor.t(shop.value.start_time || "8:00"),
- f: common_vendor.t(shop.value.end_time || "17:00"),
- g: common_vendor.p({
- name: "file-text",
- size: "16"
- }),
- h: common_vendor.p({
- direction: "col"
- }),
- i: common_vendor.t(shop.value.address || "暂无"),
- j: common_vendor.f(searchList.value, (item, index, i0) => {
- return common_vendor.e({
- a: common_vendor.t(item.title),
- b: common_vendor.n(item.is_open == false ? "title_1" : "title_2"),
- c: item.is_open == false
- }, item.is_open == false ? {
- d: "88a3d2e5-2-" + i0,
- e: common_vendor.p({
- color: "#000",
- size: "10px",
- name: "arrow-down-fill"
- })
- } : {
- f: "88a3d2e5-3-" + i0,
- g: common_vendor.p({
- color: "#ffbc00",
- size: "10px",
- name: "arrow-up-fill"
- })
- }, {
- h: index,
- i: common_vendor.o(($event) => toSearch(item), index)
- });
- }),
- k: type.value == "0"
- }, type.value == "0" ? {
- l: common_vendor.f(sortList.value, (item, index, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: common_vendor.n(item.is_open == false ? "title_1" : "title_2"),
- c: index,
- d: common_vendor.o(($event) => toSelect(item, type.value), index)
- };
- })
- } : type.value == "2" ? {
- n: common_vendor.f(moneyList.value, (item, index, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: common_vendor.n(item.is_open == false ? "title_1" : "title_2"),
- c: index,
- d: common_vendor.o(($event) => toSelect(item, type.value), index)
- };
- })
- } : type.value == "3" ? {
- p: common_vendor.f(yearList.value, (item, index, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: common_vendor.n(item.is_open == false ? "title_1" : "title_2"),
- c: index,
- d: common_vendor.o(($event) => toSelect(item, type.value), index)
- };
- })
- } : {
- q: common_vendor.f(yearList.value, (item, index, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: common_vendor.n(item.is_open == false ? "title_1" : "title_2"),
- c: index,
- d: common_vendor.o(($event) => toSelect(item, type.value), index)
- };
- })
- }, {
- m: type.value == "2",
- o: type.value == "3",
- r: is_show.value,
- s: common_vendor.o(toClose),
- t: Object.keys(brandInfo.value).length > 0 || Object.keys(moneyInfo.value).length > 0 || Object.keys(yearInfo.value).length > 0 || moreList.value.length > 0
- }, Object.keys(brandInfo.value).length > 0 || Object.keys(moneyInfo.value).length > 0 || Object.keys(yearInfo.value).length > 0 || moreList.value.length > 0 ? common_vendor.e({
- v: brandInfo.value && brandInfo.value.type
- }, brandInfo.value && brandInfo.value.type ? {
- w: common_vendor.t(brandInfo.value.title),
- x: common_vendor.p({
- color: "#000",
- size: "14px",
- name: "close"
- }),
- y: common_vendor.o(($event) => toDelete({}, "0"))
- } : {}, {
- z: moneyInfo.value && moneyInfo.value.type
- }, moneyInfo.value && moneyInfo.value.type ? {
- A: common_vendor.t(moneyInfo.value.title),
- B: common_vendor.p({
- color: "#000",
- size: "14px",
- name: "close"
- }),
- C: common_vendor.o(($event) => toDelete({}, "1"))
- } : {}, {
- D: yearInfo.value && yearInfo.value.type
- }, yearInfo.value && yearInfo.value.type ? {
- E: common_vendor.t(yearInfo.value.title),
- F: common_vendor.p({
- color: "#000",
- size: "14px",
- name: "close"
- }),
- G: common_vendor.o(($event) => toDelete({}, "2"))
- } : {}, {
- H: moreList.value.length > 0
- }, moreList.value.length > 0 ? {
- I: common_vendor.f(moreList.value, (item, index, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: "88a3d2e5-7-" + i0,
- c: index,
- d: common_vendor.o(($event) => toDelete(item, "3"), index)
- };
- }),
- J: common_vendor.p({
- color: "#000",
- size: "14px",
- name: "close"
- })
- } : {}, {
- K: common_vendor.o(toReset)
- }) : {}, {
- L: 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)
- });
- }),
- M: is_bottom.value
- }, is_bottom.value ? {
- N: common_vendor.t(config.value.bottom_title || "没有更多了!")
- } : {}, {
- O: common_vendor.o(toPage),
- P: common_vendor.o(toChat),
- Q: common_vendor.p({
- icon: "phone",
- text: "电话联系",
- size: "normal",
- type: "info"
- })
- });
- };
- }
- });
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-88a3d2e5"], ["__file", "D:/project/二手车/car_applet/pagesHome/shop/index.vue"]]);
- wx.createPage(MiniProgramPage);
|