|
@@ -26,8 +26,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
const itemId = common_vendor.ref("");
|
|
|
const tabbar = common_vendor.ref([]);
|
|
|
const scrollRightTop = common_vendor.ref(0);
|
|
|
- const brandInfo = common_vendor.ref({});
|
|
|
- const cityInfo = common_vendor.ref({});
|
|
|
+ common_vendor.ref({});
|
|
|
const searchList = common_vendor.ref([]);
|
|
|
const searchInfo = common_vendor.ref({});
|
|
|
const boxTypeList = common_vendor.ref([]);
|
|
@@ -39,12 +38,13 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
common_vendor.onLoad(async (options) => {
|
|
|
id.value = options && options.id;
|
|
|
await searchOther();
|
|
|
+ await searchCar();
|
|
|
await searchConfig();
|
|
|
await search();
|
|
|
});
|
|
|
common_vendor.onShow(async () => {
|
|
|
common_vendor.index.$on("toRoute", function(data) {
|
|
|
- brandInfo.value = data;
|
|
|
+ searchInfo.value.brand = data.name;
|
|
|
tabbar.value = tabbar.value.map((item, index) => {
|
|
|
if (item.type == "1" && item.value == "0")
|
|
|
item.text = data.name;
|
|
@@ -52,13 +52,14 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
});
|
|
|
});
|
|
|
common_vendor.index.$on("toCity", function(data) {
|
|
|
- cityInfo.value = data;
|
|
|
+ searchInfo.value.place = data.name;
|
|
|
tabbar.value = tabbar.value.map((item, index) => {
|
|
|
if (item.type == "1" && item.value == "1")
|
|
|
item.text = data.name;
|
|
|
return item;
|
|
|
});
|
|
|
});
|
|
|
+ await searchCar();
|
|
|
});
|
|
|
const searchOther = async () => {
|
|
|
let res;
|
|
@@ -84,6 +85,28 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
const searchConfig = async () => {
|
|
|
config.value = common_vendor.index.getStorageSync("config");
|
|
|
};
|
|
|
+ const searchCar = async () => {
|
|
|
+ const info = {
|
|
|
+ skip: 0,
|
|
|
+ limit: 1,
|
|
|
+ status: "0"
|
|
|
+ };
|
|
|
+ if (searchInfo.value.brand)
|
|
|
+ info.brand = searchInfo.value.brand;
|
|
|
+ if (searchInfo.value.place)
|
|
|
+ info.place = searchInfo.value.place;
|
|
|
+ const res = await $api("car", "GET", {
|
|
|
+ ...info
|
|
|
+ });
|
|
|
+ if (res.errcode === 0) {
|
|
|
+ total.value = res.total;
|
|
|
+ } else {
|
|
|
+ common_vendor.index.showToast({
|
|
|
+ title: res.errmsg || "",
|
|
|
+ icon: "error"
|
|
|
+ });
|
|
|
+ }
|
|
|
+ };
|
|
|
const search = async () => {
|
|
|
const data = pagesHome_condition_common_classify.classifyData.map((item, index) => {
|
|
|
if (item.type == "boxType") {
|
|
@@ -120,23 +143,6 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
return item;
|
|
|
});
|
|
|
tabbar.value = data;
|
|
|
- const info = {
|
|
|
- skip: 0,
|
|
|
- limit: 1,
|
|
|
- status: "0"
|
|
|
- };
|
|
|
- const res = await $api("car", "GET", {
|
|
|
- ...info,
|
|
|
- ...searchInfo.value
|
|
|
- });
|
|
|
- if (res.errcode === 0) {
|
|
|
- total.value = res.total;
|
|
|
- } else {
|
|
|
- common_vendor.index.showToast({
|
|
|
- title: res.errmsg || "",
|
|
|
- icon: "error"
|
|
|
- });
|
|
|
- }
|
|
|
};
|
|
|
const swichMenu = (index) => {
|
|
|
if (index == current.value)
|
|
@@ -190,7 +196,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
|
|
|
};
|
|
|
const toReset = () => {
|
|
|
searchInfo.value = {};
|
|
|
- search();
|
|
|
+ searchCar();
|
|
|
};
|
|
|
return (_ctx, _cache) => {
|
|
|
return {
|