فهرست منبع

修改条件选车

zs 1 سال پیش
والد
کامیت
d89b881c8e

+ 26 - 21
pagesHome/condition/index.vue

@@ -80,7 +80,6 @@
 	const itemId = ref(''); // 栏目右边scroll-view用于滚动的id
 	const tabbar = ref([]);
 	const scrollRightTop = ref(0); // 右边栏目scroll-view的滚动条高度
-	const brandInfo = ref({}); // 车牌信息
 	const cityInfo = ref({}); // 城市信息
 	const searchList = ref([]); // 选中的搜索信息
 	// 查询
@@ -95,24 +94,26 @@
 	onLoad(async (options) => {
 		id.value = options && options.id
 		await searchOther();
+		await searchCar();
 		await searchConfig();
 		await search();
 	})
 	onShow(async () => {
 		uni.$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
 				return item
 			})
 		})
 		uni.$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 () => {
@@ -140,6 +141,27 @@
 	const searchConfig = async () => {
 		config.value = uni.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 {
+			uni.showToast({
+				title: res.errmsg || '',
+				icon: 'error',
+			});
+		}
+	};
 	// 查询
 	const search = async () => {
 		const data = classifyData.map((item, index) => {
@@ -183,23 +205,6 @@
 			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 {
-			uni.showToast({
-				title: res.errmsg || '',
-				icon: 'error',
-			});
-		}
 	};
 	// 点击左边的栏目切换
 	const swichMenu = (index) => {
@@ -256,7 +261,7 @@
 	// 重置
 	const toReset = () => {
 		searchInfo.value = {}
-		search()
+		searchCar()
 	};
 </script>
 <style lang="scss" scoped>

+ 1 - 1
pagesHome/rank/index.vue

@@ -232,7 +232,7 @@
 			.list {
 				position: relative;
 				display: flex;
-				margin: 1vw 0 0 0;
+				margin: 2vw 0 0 0;
 				padding: 2vw 2vw 0 2vw;
 
 				.rank {

+ 9 - 5
pagesHome/search/index.vue

@@ -124,10 +124,12 @@
 		await clearPage();
 		await search();
 	})
-	onShow(() => {
+	onShow(async () => {
 		uni.$on('toRoute', function (data) {
 			if (data && data.name) searchInfo.value.brand = data.name
 		})
+		await clearPage();
+		await search();
 	})
 	// config信息
 	const searchConfig = async () => {
@@ -140,10 +142,10 @@
 			limit: limit.value,
 			status: '0'
 		}
-		console.log(searchInfo.value);
+		if (searchInfo.value.brand) info.brand = searchInfo.value.brand
+		if (searchInfo.value.money) info.money = searchInfo.value.money
 		const res = await $api('car', 'GET', {
-			...info,
-			...searchInfo.value
+			...info
 		});
 		if (res.errcode === 0) {
 			list.value = list.value.concat(res.data)
@@ -216,7 +218,7 @@
 		await search();
 	};
 	// 删除筛选
-	const toDelete = (item, type) => {
+	const toDelete = async (item, type) => {
 		if (type == '0') searchInfo.value.brand = ''
 		else if (type == '1') {
 			moneyList.value = moneyList.value.map((item, index) => {
@@ -227,6 +229,8 @@
 			searchInfo.value.money = ''
 		}
 		else moreList.value = moreList.value.filter((i, index) => i.type != item.type)
+		await clearPage();
+		await search();
 	};
 	// 重置
 	const toReset = async () => {

+ 28 - 22
unpackage/dist/dev/mp-weixin/pagesHome/condition/index.js

@@ -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 {

+ 1 - 1
unpackage/dist/dev/mp-weixin/pagesHome/rank/index.wxss

@@ -20,7 +20,7 @@
 .content .bottom .list.data-v-581af8d0 {
   position: relative;
   display: flex;
-  margin: 1vw 0 0 0;
+  margin: 2vw 0 0 0;
   padding: 2vw 2vw 0 2vw;
 }
 .content .bottom .list .rank.data-v-581af8d0 {

+ 11 - 5
unpackage/dist/dev/mp-weixin/pagesHome/search/index.js

@@ -38,11 +38,13 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       await clearPage();
       await search();
     });
-    common_vendor.onShow(() => {
+    common_vendor.onShow(async () => {
       common_vendor.index.$on("toRoute", function(data) {
         if (data && data.name)
           searchInfo.value.brand = data.name;
       });
+      await clearPage();
+      await search();
     });
     const searchConfig = async () => {
       config.value = common_vendor.index.getStorageSync("config");
@@ -53,10 +55,12 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         limit: limit.value,
         status: "0"
       };
-      console.log(searchInfo.value);
+      if (searchInfo.value.brand)
+        info.brand = searchInfo.value.brand;
+      if (searchInfo.value.money)
+        info.money = searchInfo.value.money;
       const res = await $api("car", "GET", {
-        ...info,
-        ...searchInfo.value
+        ...info
       });
       if (res.errcode === 0) {
         list.value = list.value.concat(res.data);
@@ -129,7 +133,7 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
       await clearPage();
       await search();
     };
-    const toDelete = (item, type2) => {
+    const toDelete = async (item, type2) => {
       if (type2 == "0")
         searchInfo.value.brand = "";
       else if (type2 == "1") {
@@ -143,6 +147,8 @@ const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
         searchInfo.value.money = "";
       } else
         moreList.value = moreList.value.filter((i, index) => i.type != item.type);
+      await clearPage();
+      await search();
     };
     const toReset = async () => {
       searchInfo.value.brand = "";