feat(payment): 集成 PayPal 支付并添加货币转换功能
- 集成 PayPal 支付流程,包括订单创建、支付确认和取消页面 - 实现货币转换功能,支持不支持的货币自动转换为 PayPal 支持的货币 - 在订单确认页面显示货币转换信息,包括实际支付金额和汇率 - 添加 PayPal 支付成功和取消的路由处理 - 优化商品详情页图片预览,支持鼠标悬停显示主图 - 添加货币转换相关的 API 接口和工具函数
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
class="thumbnail-item"
|
||||
:class="{ active: currentImageIndex === index }"
|
||||
@click="selectImage(index)"
|
||||
@mouseenter="hoverImage(img)"
|
||||
@mouseleave="hoverImage(null)"
|
||||
>
|
||||
<el-image :src="img" fit="cover" class="thumbnail-img" />
|
||||
</div>
|
||||
@@ -263,6 +265,8 @@ const router = useRouter()
|
||||
const loading = ref(false)
|
||||
const productLoading = ref(true)
|
||||
const currentImageIndex = ref(0)
|
||||
// 鼠标悬停的主图(优先展示)
|
||||
const hoveredImage = ref(null)
|
||||
const quantity = ref(1)
|
||||
const activeTab = ref('detail')
|
||||
const selectedSku = ref(null)
|
||||
@@ -324,12 +328,19 @@ const currentCurrencySkus = computed(() => {
|
||||
|
||||
// 当前显示的图片
|
||||
const currentImage = computed(() => {
|
||||
// 1) 若有悬停主图,优先展示
|
||||
if (hoveredImage.value) {
|
||||
return hoveredImage.value
|
||||
}
|
||||
// 2) 已选SKU且有SKU图
|
||||
if (selectedSku.value && selectedSku.value.skuImage) {
|
||||
return selectedSku.value.skuImage
|
||||
}
|
||||
// 3) 主图列表
|
||||
if (product.value.mainImages && product.value.mainImages.length > 0) {
|
||||
return product.value.mainImages[currentImageIndex.value] || product.value.mainImages[0]
|
||||
}
|
||||
// 4) 兜底单张主图
|
||||
return product.value.mainImage || ''
|
||||
})
|
||||
|
||||
@@ -378,6 +389,10 @@ const formatSize = (sizeJson) => {
|
||||
const selectImage = (index) => {
|
||||
currentImageIndex.value = index
|
||||
}
|
||||
// 悬停主图时优先展示该主图
|
||||
const hoverImage = (img) => {
|
||||
hoveredImage.value = img
|
||||
}
|
||||
|
||||
// 立即购买
|
||||
const handleBuyNow = () => {
|
||||
|
||||
Reference in New Issue
Block a user