|
|
@ -70,7 +70,25 @@ export default { |
|
|
|
}, |
|
|
|
data() { |
|
|
|
return { |
|
|
|
serviceList: [], |
|
|
|
serviceList: [ |
|
|
|
// { |
|
|
|
// id: '1', |
|
|
|
// name: 'test', |
|
|
|
// category: '111', |
|
|
|
// categoryName: '123', |
|
|
|
// rating: '123', |
|
|
|
// reviews: 231132, |
|
|
|
// country:'s', |
|
|
|
// city: '2222', |
|
|
|
// cityName: '2134', |
|
|
|
// disacount: '12312', |
|
|
|
// price: 50, |
|
|
|
// payment_currency: 'USD', |
|
|
|
// preview_image: '', |
|
|
|
// isUserProfile: 'lin', |
|
|
|
// liked: '123', |
|
|
|
// } |
|
|
|
], |
|
|
|
sortType: [ |
|
|
|
// { name: "Ratings", value: "Ratings" }, |
|
|
|
// { name: "ShowEasy Recommended", value: "ShowEasy Recommended" }, |
|
|
@ -87,7 +105,7 @@ export default { |
|
|
|
subcategoryNameList: [], |
|
|
|
sortBy: "Ratings", |
|
|
|
maxPrice: 100, |
|
|
|
priceRangeFilter: [], |
|
|
|
priceRangeFilter: [0,100], |
|
|
|
ratingRangeFilter: [0, 5], |
|
|
|
locationNameFilter: [], |
|
|
|
categoryFilter: [], |
|
|
@ -128,6 +146,7 @@ export default { |
|
|
|
locationList, |
|
|
|
vm.categoryFilter |
|
|
|
); |
|
|
|
|
|
|
|
const sortedList = vm.sortServiceList(categoryList); |
|
|
|
return sortedList; |
|
|
|
} else { |
|
|
@ -141,7 +160,8 @@ export default { |
|
|
|
return Math.ceil(this.result / this.perPageItems); |
|
|
|
}, |
|
|
|
renderList() { |
|
|
|
return this.sliceRenderList(this.serviceFilter); |
|
|
|
let arr = this.sliceRenderList(this.serviceFilter); |
|
|
|
return arr; |
|
|
|
}, |
|
|
|
currency() { |
|
|
|
return this.$store.getters.getCurrency; |
|
|
@ -240,13 +260,13 @@ export default { |
|
|
|
.then((result) => { |
|
|
|
var vm = this; |
|
|
|
const lang = vm.$i18n.localeProperties.langQuery; |
|
|
|
vm.categoryList = result.data.map((item) => { |
|
|
|
return { |
|
|
|
id: item.id, |
|
|
|
title: item.language_text[0].text, |
|
|
|
key: item.language_text[0].text, |
|
|
|
}; |
|
|
|
}); |
|
|
|
// vm.categoryList = result.data.map((item) => { |
|
|
|
// return { |
|
|
|
// id: item.id, |
|
|
|
// title: item.language_text[0].text, |
|
|
|
// key: item.language_text[0].text, |
|
|
|
// }; |
|
|
|
// }); |
|
|
|
|
|
|
|
// vm.categoryList = result.data.sort_results; |
|
|
|
// vm.categoryList = vm.categoryList.map((item) => { |
|
|
@ -278,26 +298,26 @@ export default { |
|
|
|
.then((result) => { |
|
|
|
var vm = this; |
|
|
|
vm.locationList = result.data.sort_results; |
|
|
|
vm.locationList = vm.locationList.map((item) => { |
|
|
|
item.country_list = item.country_list.map((country) => { |
|
|
|
country.city_list = country.city_list.map((city) => { |
|
|
|
return { |
|
|
|
title: city.city_name, |
|
|
|
key: city.city_name, |
|
|
|
}; |
|
|
|
}); |
|
|
|
return { |
|
|
|
title: country.country_name, |
|
|
|
key: country.country_name, |
|
|
|
children: country.city_list, |
|
|
|
}; |
|
|
|
}); |
|
|
|
return { |
|
|
|
title: item.region_name, |
|
|
|
key: item.region_name, |
|
|
|
children: item.country_list, |
|
|
|
}; |
|
|
|
}); |
|
|
|
// vm.locationList = vm.locationList.map((item) => { |
|
|
|
// item.country_list = item.country_list.map((country) => { |
|
|
|
// country.city_list = country.city_list.map((city) => { |
|
|
|
// return { |
|
|
|
// title: city.city_name, |
|
|
|
// key: city.city_name, |
|
|
|
// }; |
|
|
|
// }); |
|
|
|
// return { |
|
|
|
// title: country.country_name, |
|
|
|
// key: country.country_name, |
|
|
|
// children: country.city_list, |
|
|
|
// }; |
|
|
|
// }); |
|
|
|
// return { |
|
|
|
// title: item.region_name, |
|
|
|
// key: item.region_name, |
|
|
|
// children: item.country_list, |
|
|
|
// }; |
|
|
|
// }); |
|
|
|
return result.data; |
|
|
|
}) |
|
|
|
.catch((err) => { |
|
|
@ -383,50 +403,51 @@ export default { |
|
|
|
} |
|
|
|
}, |
|
|
|
mapSavedService(data, savedList) { |
|
|
|
return data.map((item) => { |
|
|
|
item.liked = false; |
|
|
|
if (savedList.includes(item.id)) { |
|
|
|
item.liked = true; |
|
|
|
} |
|
|
|
return item; |
|
|
|
}); |
|
|
|
// return data.map((item) => { |
|
|
|
// item.liked = false; |
|
|
|
// if (savedList.includes(item.id)) { |
|
|
|
// item.liked = true; |
|
|
|
// } |
|
|
|
// return item; |
|
|
|
// }); |
|
|
|
}, |
|
|
|
mapServiceLocationName(data, countryList, cityList) { |
|
|
|
data = data.map((item) => { |
|
|
|
Number(item.country) > 0 |
|
|
|
? (item.countryName = countryList[item.country]) |
|
|
|
: (item.countryName = ""); |
|
|
|
return item; |
|
|
|
}); |
|
|
|
data = data.map((item) => { |
|
|
|
Number(item.city) > 0 |
|
|
|
? (item.cityName = cityList[item.city]) |
|
|
|
: (item.cityName = ""); |
|
|
|
return item; |
|
|
|
}); |
|
|
|
return data; |
|
|
|
// data = data.map((item) => { |
|
|
|
// Number(item.country) > 0 |
|
|
|
// ? (item.countryName = countryList[item.country]) |
|
|
|
// : (item.countryName = ""); |
|
|
|
// return item; |
|
|
|
// }); |
|
|
|
// data = data.map((item) => { |
|
|
|
// Number(item.city) > 0 |
|
|
|
// ? (item.cityName = cityList[item.city]) |
|
|
|
// : (item.cityName = ""); |
|
|
|
// return item; |
|
|
|
// }); |
|
|
|
// return data; |
|
|
|
}, |
|
|
|
mapServiceCategoryName(data, categoryList) { |
|
|
|
data = data.map((item) => { |
|
|
|
Number(item.category) > 0 |
|
|
|
? (item.categoryName = categoryList[item.category]) |
|
|
|
: (item.categoryName = ""); |
|
|
|
return item; |
|
|
|
}); |
|
|
|
return data; |
|
|
|
// data = data.map((item) => { |
|
|
|
// Number(item.category) > 0 |
|
|
|
// ? (item.categoryName = categoryList[item.category]) |
|
|
|
// : (item.categoryName = ""); |
|
|
|
// return item; |
|
|
|
// }); |
|
|
|
// return data; |
|
|
|
}, |
|
|
|
async getPriceRange() { |
|
|
|
let max = 0; |
|
|
|
this.serviceList.forEach((element) => { |
|
|
|
if (element.price > max) { |
|
|
|
max = element.price; |
|
|
|
} |
|
|
|
}); |
|
|
|
// this.serviceList.forEach((element) => { |
|
|
|
// if (element.price > max) { |
|
|
|
// max = element.price; |
|
|
|
// } |
|
|
|
// }); |
|
|
|
this.maxPrice = max; |
|
|
|
this.priceRangeFilter = [0, max]; |
|
|
|
}, |
|
|
|
filterByPrice(data, min, max) { |
|
|
|
return data.filter((item) => item.price >= min && item.price <= max); |
|
|
|
let item = data.filter((item) => item.price >= min && item.price <= max); |
|
|
|
return item; |
|
|
|
}, |
|
|
|
updatePriceRange(value) { |
|
|
|
this.priceRangeFilter = [...value]; |
|
|
|