|
@@ -22,8 +22,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
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 }]);
|
|
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 }]);
|
|
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 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 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 brandInfo = common_vendor.ref({});
|
|
|
|
- const moneyInfo = common_vendor.ref({});
|
|
|
|
|
|
+ const searchInfo = common_vendor.ref({});
|
|
const moreList = common_vendor.ref([]);
|
|
const moreList = common_vendor.ref([]);
|
|
const list = common_vendor.ref([]);
|
|
const list = common_vendor.ref([]);
|
|
const total = common_vendor.ref(0);
|
|
const total = common_vendor.ref(0);
|
|
@@ -32,53 +31,17 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
const page = common_vendor.ref(0);
|
|
const page = common_vendor.ref(0);
|
|
const is_bottom = common_vendor.ref(false);
|
|
const is_bottom = common_vendor.ref(false);
|
|
common_vendor.ref(0);
|
|
common_vendor.ref(0);
|
|
- 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"
|
|
|
|
- }
|
|
|
|
- ]);
|
|
|
|
- common_vendor.onLoad(async () => {
|
|
|
|
|
|
+ common_vendor.onLoad(async (options) => {
|
|
|
|
+ searchInfo.value.brand = options && options.brand || "";
|
|
|
|
+ searchInfo.value.money = options && options.money || "";
|
|
await searchConfig();
|
|
await searchConfig();
|
|
|
|
+ await clearPage();
|
|
await search();
|
|
await search();
|
|
});
|
|
});
|
|
common_vendor.onShow(() => {
|
|
common_vendor.onShow(() => {
|
|
common_vendor.index.$on("toRoute", function(data) {
|
|
common_vendor.index.$on("toRoute", function(data) {
|
|
- brandInfo.value = data;
|
|
|
|
|
|
+ if (data && data.name)
|
|
|
|
+ searchInfo.value.brand = data.name;
|
|
});
|
|
});
|
|
});
|
|
});
|
|
const searchConfig = async () => {
|
|
const searchConfig = async () => {
|
|
@@ -90,7 +53,11 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
limit: limit.value,
|
|
limit: limit.value,
|
|
status: "0"
|
|
status: "0"
|
|
};
|
|
};
|
|
- const res = await $api("car", "GET", info);
|
|
|
|
|
|
+ console.log(searchInfo.value);
|
|
|
|
+ const res = await $api("car", "GET", {
|
|
|
|
+ ...info,
|
|
|
|
+ ...searchInfo.value
|
|
|
|
+ });
|
|
if (res.errcode === 0) {
|
|
if (res.errcode === 0) {
|
|
list.value = list.value.concat(res.data);
|
|
list.value = list.value.concat(res.data);
|
|
total.value = res.total;
|
|
total.value = res.total;
|
|
@@ -135,7 +102,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
return item;
|
|
return item;
|
|
});
|
|
});
|
|
};
|
|
};
|
|
- const toSelect = (data, type2) => {
|
|
|
|
|
|
+ const toSelect = async (data, type2) => {
|
|
if (type2 == "0") {
|
|
if (type2 == "0") {
|
|
sortList.value = sortList.value.map((item, index) => {
|
|
sortList.value = sortList.value.map((item, index) => {
|
|
if (item.type == data.type)
|
|
if (item.type == data.type)
|
|
@@ -157,12 +124,14 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
item.is_open = false;
|
|
item.is_open = false;
|
|
return item;
|
|
return item;
|
|
});
|
|
});
|
|
- moneyInfo.value = data;
|
|
|
|
|
|
+ searchInfo.value.money = data.title;
|
|
}
|
|
}
|
|
|
|
+ await clearPage();
|
|
|
|
+ await search();
|
|
};
|
|
};
|
|
const toDelete = (item, type2) => {
|
|
const toDelete = (item, type2) => {
|
|
if (type2 == "0")
|
|
if (type2 == "0")
|
|
- brandInfo.value = {};
|
|
|
|
|
|
+ searchInfo.value.brand = "";
|
|
else if (type2 == "1") {
|
|
else if (type2 == "1") {
|
|
moneyList.value = moneyList.value.map((item2, index) => {
|
|
moneyList.value = moneyList.value.map((item2, index) => {
|
|
if (item2.type == "0")
|
|
if (item2.type == "0")
|
|
@@ -171,15 +140,17 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
item2.is_open = false;
|
|
item2.is_open = false;
|
|
return item2;
|
|
return item2;
|
|
});
|
|
});
|
|
- moneyInfo.value = {};
|
|
|
|
|
|
+ searchInfo.value.money = "";
|
|
} else
|
|
} else
|
|
moreList.value = moreList.value.filter((i, index) => i.type != item.type);
|
|
moreList.value = moreList.value.filter((i, index) => i.type != item.type);
|
|
};
|
|
};
|
|
- const toReset = () => {
|
|
|
|
- brandInfo.value = {};
|
|
|
|
- moneyInfo.value = {};
|
|
|
|
|
|
+ const toReset = async () => {
|
|
|
|
+ searchInfo.value.brand = "";
|
|
|
|
+ searchInfo.value.money = "";
|
|
moreList.value = [];
|
|
moreList.value = [];
|
|
toClear();
|
|
toClear();
|
|
|
|
+ await clearPage();
|
|
|
|
+ await search();
|
|
};
|
|
};
|
|
const toClear = () => {
|
|
const toClear = () => {
|
|
searchList.value = searchList.value.map((i, index) => {
|
|
searchList.value = searchList.value.map((i, index) => {
|
|
@@ -235,6 +206,12 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
} else
|
|
} else
|
|
is_bottom.value = true;
|
|
is_bottom.value = true;
|
|
};
|
|
};
|
|
|
|
+ const clearPage = () => {
|
|
|
|
+ list.value = [];
|
|
|
|
+ skip.value = 0;
|
|
|
|
+ limit.value = 6;
|
|
|
|
+ page.value = 0;
|
|
|
|
+ };
|
|
return (_ctx, _cache) => {
|
|
return (_ctx, _cache) => {
|
|
return common_vendor.e({
|
|
return common_vendor.e({
|
|
a: common_vendor.o(toChange),
|
|
a: common_vendor.o(toChange),
|
|
@@ -290,11 +267,11 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
f: type.value == "2",
|
|
f: type.value == "2",
|
|
h: is_show.value,
|
|
h: is_show.value,
|
|
i: common_vendor.o(toClose),
|
|
i: common_vendor.o(toClose),
|
|
- j: Object.keys(brandInfo.value).length > 0 || Object.keys(moneyInfo.value).length > 0 || moreList.value.length > 0
|
|
|
|
- }, Object.keys(brandInfo.value).length > 0 || Object.keys(moneyInfo.value).length > 0 || moreList.value.length > 0 ? common_vendor.e({
|
|
|
|
- k: brandInfo.value && brandInfo.value.type
|
|
|
|
- }, brandInfo.value && brandInfo.value.type ? {
|
|
|
|
- l: common_vendor.t(brandInfo.value.title),
|
|
|
|
|
|
+ j: searchInfo.value.brand || searchInfo.value.money || moreList.value.length > 0
|
|
|
|
+ }, searchInfo.value.brand || searchInfo.value.money || moreList.value.length > 0 ? common_vendor.e({
|
|
|
|
+ k: searchInfo.value && searchInfo.value.brand
|
|
|
|
+ }, searchInfo.value && searchInfo.value.brand ? {
|
|
|
|
+ l: common_vendor.t(searchInfo.value.brand),
|
|
m: common_vendor.p({
|
|
m: common_vendor.p({
|
|
color: "#000",
|
|
color: "#000",
|
|
size: "14px",
|
|
size: "14px",
|
|
@@ -302,9 +279,9 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
}),
|
|
}),
|
|
n: common_vendor.o(($event) => toDelete({}, "0"))
|
|
n: common_vendor.o(($event) => toDelete({}, "0"))
|
|
} : {}, {
|
|
} : {}, {
|
|
- o: moneyInfo.value && moneyInfo.value.type
|
|
|
|
- }, moneyInfo.value && moneyInfo.value.type ? {
|
|
|
|
- p: common_vendor.t(moneyInfo.value.title),
|
|
|
|
|
|
+ o: searchInfo.value && searchInfo.value.money
|
|
|
|
+ }, searchInfo.value && searchInfo.value.money ? {
|
|
|
|
+ p: common_vendor.t(searchInfo.value.money),
|
|
q: common_vendor.p({
|
|
q: common_vendor.p({
|
|
color: "#000",
|
|
color: "#000",
|
|
size: "14px",
|
|
size: "14px",
|