Browse Source

修改服務跳轉到詳情頁

Dev
18300102974 2 years ago
parent
commit
73ea1b8307
  1. 10
      FrontEnd/components/NavBar.vue
  2. 6
      FrontEnd/components/service/ServiceListCard.vue
  3. 147
      FrontEnd/pages/service/index.vue

10
FrontEnd/components/NavBar.vue

@ -482,7 +482,7 @@
class="customMenuLink tw-relative tw-flex tw-justify-start tw-items-center tw-z-3"
>
<a
:href="localePath('/service')"
href="javascript:void(0);"
:class="[
'tw-text-black tw-body-3 tw-font-normal hover:tw-text-primary-default',
$route.path.match('\/service') ? 'tw-text-primary-default' : '',
@ -500,7 +500,7 @@
>
<li class="tw-list-none">
<a
:href="localePath(`/service?category=${item.id}`)"
:href="localePath(`/service/${item.id}`)"
class="tw-block tw-mb-[16px] tw-grid tw-grid-cols-[16px_auto] tw-gap-[10px] tw-body-4 tw-font-normal tw-text-primary-default hover:tw-text-primary-default"
>
<svg
@ -533,7 +533,7 @@
class="tw-list-none"
>
<a
:href="localePath(`/service?subcatg=${sub.id}`)"
:href="localePath(`/service/${sub.id}`)"
class="tw-block tw-body-4 tw-font-normal tw-text-neutral-800 hover:tw-text-primary-default"
>{{ sub.title }}</a
>
@ -555,7 +555,7 @@
:key="item.id"
>
<a
:href="localePath(`/service?category=${item.id}`)"
:href="localePath(`/service/${item.id}`)"
class="tw-text-black tw-body-3 tw-font-normal hover:tw-text-primary-default tw-whitespace-nowrap"
>{{ item.title }}</a
>
@ -568,7 +568,7 @@
class="tw-list-none"
>
<a
:href="localePath(`/service?subcatg=${sub.id}`)"
:href="localePath(`/service/${sub.id}`)"
class="tw-block tw-body-4 tw-font-normal tw-text-black hover:tw-text-primary-default"
>{{ sub.title }}</a
>

6
FrontEnd/components/service/ServiceListCard.vue

@ -3,12 +3,12 @@
class="card tw-bg-white tw-rounded-[25px] md:tw-rounded-[30px] tw-border tw-border-solid tw-border-neutrals-200 tw-relative tw-shadow-[0px_1px_1px_0px_rgba(0,0,0,0.03)] tw-shadow-neutral-200"
>
<div class="tw-absolute like tw-w-[20px] tw-h-[18px]">
<like
<!-- <like
:like="service.liked"
:serviceId="service.id"
:isForUserprofile="service.isUserProfile"
@remove-relation="$emit('remove-relation')"
></like>
></like> -->
</div>
<div
class="tw-grid tw-grid-cols-1 md:tw-grid-cols-[35%_65%] xl:tw-grid-cols-[264px_auto]"
@ -73,7 +73,6 @@
</div>
<div class="tw-flex tw-justify-end">
<div
v-show="service.disacount"
:class="[
'tw-mb-[8px]',
'tw-text-right',
@ -92,7 +91,6 @@
</div>
<div class="tw-flex tw-justify-end md:tw-py-2">
<div
v-show="service.disacount"
class="tw-body-3 tw-text-right tw-text-base-hint tw-line-through md:tw-body-2"
>
${{ formatTotal(40500) }}

147
FrontEnd/pages/service/index.vue

@ -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];

Loading…
Cancel
Save