|
|
|
|
@ -24,7 +24,7 @@
|
|
|
|
|
<div class="banner-box product-banner">
|
|
|
|
|
<van-swipe>
|
|
|
|
|
<van-swipe-item v-for="images in goods.goods_gallery" :index="images.img_id">
|
|
|
|
|
<img class="banner_img" :src="images.img_url">
|
|
|
|
|
<img class="banner_img" :src="images.img_url" />
|
|
|
|
|
</van-swipe-item>
|
|
|
|
|
<template #indicator="{ active, total }">
|
|
|
|
|
<div class="custom-indicator">{{ active + 1 }}/{{ total }}</div>
|
|
|
|
|
@ -45,14 +45,90 @@
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="rating">
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-star"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-star"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-star"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-star"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>
|
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-star"><polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"></polygon></svg>
|
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
width="24"
|
|
|
|
|
height="24"
|
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
|
fill="none"
|
|
|
|
|
stroke="currentColor"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
class="feather feather-star"
|
|
|
|
|
>
|
|
|
|
|
<polygon
|
|
|
|
|
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
|
|
|
|
|
></polygon>
|
|
|
|
|
</svg>
|
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
width="24"
|
|
|
|
|
height="24"
|
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
|
fill="none"
|
|
|
|
|
stroke="currentColor"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
class="feather feather-star"
|
|
|
|
|
>
|
|
|
|
|
<polygon
|
|
|
|
|
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
|
|
|
|
|
></polygon>
|
|
|
|
|
</svg>
|
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
width="24"
|
|
|
|
|
height="24"
|
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
|
fill="none"
|
|
|
|
|
stroke="currentColor"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
class="feather feather-star"
|
|
|
|
|
>
|
|
|
|
|
<polygon
|
|
|
|
|
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
|
|
|
|
|
></polygon>
|
|
|
|
|
</svg>
|
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
width="24"
|
|
|
|
|
height="24"
|
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
|
fill="none"
|
|
|
|
|
stroke="currentColor"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
class="feather feather-star"
|
|
|
|
|
>
|
|
|
|
|
<polygon
|
|
|
|
|
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
|
|
|
|
|
></polygon>
|
|
|
|
|
</svg>
|
|
|
|
|
<svg
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
width="24"
|
|
|
|
|
height="24"
|
|
|
|
|
viewBox="0 0 24 24"
|
|
|
|
|
fill="none"
|
|
|
|
|
stroke="currentColor"
|
|
|
|
|
stroke-width="2"
|
|
|
|
|
stroke-linecap="round"
|
|
|
|
|
stroke-linejoin="round"
|
|
|
|
|
class="feather feather-star"
|
|
|
|
|
>
|
|
|
|
|
<polygon
|
|
|
|
|
points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"
|
|
|
|
|
></polygon>
|
|
|
|
|
</svg>
|
|
|
|
|
<span class="font-xs content-color">(150次點擊)</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="price"><span>${{ goods.shop_price }}</span>
|
|
|
|
|
<div class="price">
|
|
|
|
|
<span>${{ goods.shop_price }}</span>
|
|
|
|
|
<del>${{ goods.market_price }}</del>
|
|
|
|
|
<span>{{ discount }}折</span>
|
|
|
|
|
</div>
|
|
|
|
|
@ -70,20 +146,29 @@
|
|
|
|
|
<!-- Accordion Start -->
|
|
|
|
|
<div class="accordion-item">
|
|
|
|
|
<h2 class="accordion-header" id="headingOne">
|
|
|
|
|
<button class="accordion-button" type="button" data-bs-toggle="collapse"
|
|
|
|
|
data-bs-target="#collapseOne" aria-expanded="true"
|
|
|
|
|
aria-controls="collapseOne">商品詳情</button>
|
|
|
|
|
<button
|
|
|
|
|
class="accordion-button"
|
|
|
|
|
type="button"
|
|
|
|
|
data-bs-toggle="collapse"
|
|
|
|
|
data-bs-target="#collapseOne"
|
|
|
|
|
aria-expanded="true"
|
|
|
|
|
aria-controls="collapseOne"
|
|
|
|
|
>
|
|
|
|
|
商品詳情
|
|
|
|
|
</button>
|
|
|
|
|
</h2>
|
|
|
|
|
<div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne"
|
|
|
|
|
data-bs-parent="#accordionExample">
|
|
|
|
|
<div
|
|
|
|
|
id="collapseOne"
|
|
|
|
|
class="accordion-collapse collapse show"
|
|
|
|
|
aria-labelledby="headingOne"
|
|
|
|
|
data-bs-parent="#accordionExample"
|
|
|
|
|
>
|
|
|
|
|
<div class="accordion-body">
|
|
|
|
|
<p class="content-color font-base">
|
|
|
|
|
</p>
|
|
|
|
|
<p class="content-color font-base"></p>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- Accordion End -->
|
|
|
|
|
|
|
|
|
|
</div>
|
|
|
|
|
<!-- Product Detail Accordian End -->
|
|
|
|
|
</div>
|
|
|
|
|
@ -140,38 +225,34 @@
|
|
|
|
|
<section class="check-delivery-section">
|
|
|
|
|
<div class="service-section">
|
|
|
|
|
<ul>
|
|
|
|
|
<li class="font-sm content-color"><img src="@/assets/icons/svg/delivery.svg" class="img-fluid"
|
|
|
|
|
alt="" />
|
|
|
|
|
<li class="font-sm content-color">
|
|
|
|
|
<img src="@/assets/icons/svg/delivery.svg" class="img-fluid" alt="" />
|
|
|
|
|
滿$200元即可免運
|
|
|
|
|
</li>
|
|
|
|
|
<li class="font-sm content-color"><img src="@/assets/icons/svg/payment.svg" class="img-fluid"
|
|
|
|
|
alt="" />
|
|
|
|
|
<li class="font-sm content-color">
|
|
|
|
|
<img src="@/assets/icons/svg/payment.svg" class="img-fluid" alt="" />
|
|
|
|
|
可貨到付款
|
|
|
|
|
</li>
|
|
|
|
|
<li class="font-sm content-color"><img src="@/assets/icons/svg/refund.svg" class="img-fluid"
|
|
|
|
|
alt="" />
|
|
|
|
|
<li class="font-sm content-color">
|
|
|
|
|
<img src="@/assets/icons/svg/refund.svg" class="img-fluid" alt="" />
|
|
|
|
|
7日不滿意包退
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</div>
|
|
|
|
|
</section>
|
|
|
|
|
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
<!-- Main End -->
|
|
|
|
|
|
|
|
|
|
<!-- Main Start -->
|
|
|
|
|
<main class="main-wrap detail-page mb-xxl" v-if="active == 1">
|
|
|
|
|
<section class="detail-section" v-html="goods.goods_desc">
|
|
|
|
|
</section>
|
|
|
|
|
<section class="detail-section" v-html="goods.goods_desc"></section>
|
|
|
|
|
</main>
|
|
|
|
|
<!-- Main End -->
|
|
|
|
|
|
|
|
|
|
<!-- Main Start -->
|
|
|
|
|
<main class="main-wrap comment-page mb-xxl" v-if="active == 2">
|
|
|
|
|
<section class="comment-section">
|
|
|
|
|
評論
|
|
|
|
|
</section>
|
|
|
|
|
<section class="comment-section">評論</section>
|
|
|
|
|
</main>
|
|
|
|
|
<!-- Main End -->
|
|
|
|
|
|
|
|
|
|
@ -182,100 +263,88 @@
|
|
|
|
|
<div class="icon">
|
|
|
|
|
<i class="icon-home"></i>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text">
|
|
|
|
|
首頁
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text">首頁</div>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="footer-item">
|
|
|
|
|
<div class="icon">
|
|
|
|
|
<i class="icon-chat-dots"></i>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text">
|
|
|
|
|
客服
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text">客服</div>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="footer-item">
|
|
|
|
|
<div class="icon">
|
|
|
|
|
<i class="icon-favorite"></i>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text">
|
|
|
|
|
最愛
|
|
|
|
|
</div>
|
|
|
|
|
<div class="text">最愛</div>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<ul class="footer-right">
|
|
|
|
|
<li class="add-cart" @click="addToCart(goods.goods_id,0)">
|
|
|
|
|
加入購物車
|
|
|
|
|
</li>
|
|
|
|
|
<li class="buy-now" @click="addToCart(goods.goods_id,1)">
|
|
|
|
|
立即購買
|
|
|
|
|
</li>
|
|
|
|
|
<li class="add-cart" @click="addToCart(goods.goods_id, 0)">加入購物車</li>
|
|
|
|
|
<li class="buy-now" @click="addToCart(goods.goods_id, 1)">立即購買</li>
|
|
|
|
|
</ul>
|
|
|
|
|
</footer>
|
|
|
|
|
<!-- Footer End -->
|
|
|
|
|
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup>
|
|
|
|
|
import { ref, onMounted, computed } from 'vue'
|
|
|
|
|
import { getGoods } from '@/services/goods'
|
|
|
|
|
import { useRoute, useRouter } from 'vue-router'
|
|
|
|
|
import { ref, onMounted, computed } from "vue";
|
|
|
|
|
import { getGoods } from "@/services/goods";
|
|
|
|
|
import { useRoute, useRouter } from "vue-router";
|
|
|
|
|
|
|
|
|
|
import { useCartStore } from "@/store/Cart.js";
|
|
|
|
|
import { storeToRefs } from "pinia";
|
|
|
|
|
|
|
|
|
|
import { showToast } from 'vant'
|
|
|
|
|
import 'vant/es/toast/style'
|
|
|
|
|
import { showToast } from "vant";
|
|
|
|
|
import "vant/es/toast/style";
|
|
|
|
|
|
|
|
|
|
const route = useRoute()
|
|
|
|
|
const router = useRouter()
|
|
|
|
|
const route = useRoute();
|
|
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
|
|
const cartStore = useCartStore();
|
|
|
|
|
|
|
|
|
|
const active = ref(0)
|
|
|
|
|
const goods = ref({})
|
|
|
|
|
const active = ref(0);
|
|
|
|
|
const goods = ref({});
|
|
|
|
|
|
|
|
|
|
onMounted(async () => {
|
|
|
|
|
const id = route.params.id
|
|
|
|
|
const id = route.params.id;
|
|
|
|
|
|
|
|
|
|
let res = await getGoods(id)
|
|
|
|
|
let res = await getGoods(id);
|
|
|
|
|
// console.log(res)
|
|
|
|
|
if (res.code === 200) {
|
|
|
|
|
goods.value = res.data
|
|
|
|
|
goods.value = res.data;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const discount = computed(() => {
|
|
|
|
|
return Math.floor(goods.value.shop_price / goods.value.market_price * 100)
|
|
|
|
|
})
|
|
|
|
|
return Math.floor((goods.value.shop_price / goods.value.market_price) * 100);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const addToCart = async (id, type) => {
|
|
|
|
|
//上傳商品至購物車
|
|
|
|
|
|
|
|
|
|
let goods = {
|
|
|
|
|
quick: 1,
|
|
|
|
|
spec:'',
|
|
|
|
|
spec: "",
|
|
|
|
|
goods_id: id,
|
|
|
|
|
number: 1,
|
|
|
|
|
parent: 0,
|
|
|
|
|
cardInfo: ''
|
|
|
|
|
}
|
|
|
|
|
cardInfo: "",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
let res = await cartStore.addCart(goods)
|
|
|
|
|
let res = await cartStore.addCart(goods);
|
|
|
|
|
|
|
|
|
|
if (!res) {
|
|
|
|
|
return showToast('添加失敗!');
|
|
|
|
|
return showToast("添加失敗!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (type === 0) {
|
|
|
|
|
showToast('添加成功!');
|
|
|
|
|
showToast("添加成功!");
|
|
|
|
|
} else {
|
|
|
|
|
router.push('/cart')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
router.push("/cart");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style lang="less" scoped>
|
|
|
|
|
@ -405,5 +474,4 @@ const addToCart = async (id , type) =>{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
</style>
|
|
|
|
|
|