Commit 07c0fc90 authored by 沈良进's avatar 沈良进

搜索优化

parent 68cf57d3
...@@ -588,6 +588,7 @@ export default { ...@@ -588,6 +588,7 @@ export default {
}); });
this.msg.dayNumList = arr; this.msg.dayNumList = arr;
this.goSearchHandler(); this.goSearchHandler();
}, },
optionsFn(cd) { optionsFn(cd) {
return ( return (
...@@ -731,9 +732,9 @@ export default { ...@@ -731,9 +732,9 @@ export default {
this.$q.loading.hide(); this.$q.loading.hide();
if (res.data.resultCode == 1) { if (res.data.resultCode == 1) {
this.PageCount = res.data.data.List.pageCount; this.PageCount = res.data.data.pageData.pageCount;
this.TotalCount = res.data.data.List.count; this.TotalCount = res.data.data.pageData.count;
var tempArray = res.data.data.List.pageData; var tempArray = res.data.data.pageData.list;
console.log('getSearch data', tempArray) console.log('getSearch data', tempArray)
if (tempArray && tempArray.length > 0) { if (tempArray && tempArray.length > 0) {
// tempArray.forEach(item => { // tempArray.forEach(item => {
...@@ -749,6 +750,7 @@ export default { ...@@ -749,6 +750,7 @@ export default {
// } // }
// }); // });
this.DataList = tempArray; this.DataList = tempArray;
this.renderSearchInfo(res.data.data.pageData.condition)
this.$forceUpdate(); this.$forceUpdate();
} }
} }
...@@ -756,6 +758,38 @@ export default { ...@@ -756,6 +758,38 @@ export default {
(err) => {} (err) => {}
); );
}, },
renderSearchInfo(condition) {
if(!condition.length) {
return
}
let areaInfo = condition.find(item => item.type === 1).list
let dayInfo = condition.find(item => item.type === 2).list
let priceInfo = condition.find(item => item.type === 3)
let categoryInfo = condition.find(item => item.type === 4).list
this.areaTicked = areaInfo;
this.ticked = categoryInfo;
this.msg.priceRange = {min: priceInfo.minPrice, max: priceInfo.maxPrice}
let arr = []
dayInfo.forEach(item => {
if(item < 6) {
arr.push(item)
} else if(item === 7 || item ===8) {
arr.push(7)
} else if(item === 8 || item ===10) {
arr.push(8)
} else {
arr.push(9)
}
})
console.log('dayInfo', arr, dayInfo, this.dayArray)
// arr = [... new Set(arr)]
this.dayArray.forEach(item => {
if(arr.includes(item.id)) {
item.checked = true
}
})
this.msg.dayNumList = arr;
},
GotoDetails(item) { GotoDetails(item) {
if(item.productType === 4) { // 接送机,包车 if(item.productType === 4) { // 接送机,包车
this.CommonJump( this.CommonJump(
......
...@@ -367,8 +367,9 @@ ...@@ -367,8 +367,9 @@
<div style="width: 40%; margin-left: 10%"> <div style="width: 40%; margin-left: 10%">
<div class="mt mb">车辆选择</div> <div class="mt mb">车辆选择</div>
<div> <div>
<q-btn <q-btn @click="handleSelect(item.Id)"
class="car-tag mr" class="car-tag mr"
:class="{'car-select': item.Id === selectedCar}"
v-for="item in dataList.CarTypeList" v-for="item in dataList.CarTypeList"
:key="item.Id" :key="item.Id"
> >
...@@ -665,6 +666,7 @@ export default { ...@@ -665,6 +666,7 @@ export default {
props: [], props: [],
data() { data() {
return { return {
selectedCar: '',
currentYM: { year: 2023, month: 2, str: "2023-02" }, // 当前年月 currentYM: { year: 2023, month: 2, str: "2023-02" }, // 当前年月
isCurrent: false, isCurrent: false,
isLast: false, isLast: false,
...@@ -794,6 +796,13 @@ export default { ...@@ -794,6 +796,13 @@ export default {
this.getCarPriceData(); this.getCarPriceData();
}, },
methods: { methods: {
handleSelect(id) {
if(this.selectedCar === id) {
this.selectedCar = ''
} else {
this.selectedCar = id
}
},
handleMinus() { handleMinus() {
if(this.isCurrent) return; if(this.isCurrent) return;
const { str, year, month } = this.currentYM; const { str, year, month } = this.currentYM;
...@@ -1115,6 +1124,10 @@ export default { ...@@ -1115,6 +1124,10 @@ export default {
} }
</style> </style>
<style scoped> <style scoped>
.car-select {
background: #ef7a70;
color: #fff;
}
.gray { .gray {
color: #999; color: #999;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment