diff --git a/src/components/BottomNav.vue b/src/components/BottomNav.vue index e3a226e..89e3216 100644 --- a/src/components/BottomNav.vue +++ b/src/components/BottomNav.vue @@ -2,7 +2,7 @@
@@ -151,34 +146,7 @@ const backgroundImage = computed(() => { } .nav-image-active { - transform: translateY(-30px); -} - -.nav-label { - font-size: 12px; - color: white; - margin-top: 4px; - text-align: center; -} - -.nav-item-first { - margin-left: 20px; -} - -.nav-item-second { - margin-left: -10px; -} - -.nav-item-third { - margin-left: 15px; -} - -.nav-item-fourth { - margin-right: -10px; -} - -.nav-item-last { - margin-right: 20px; + transform: translateY(-50px); } /* 移动端适配 */ @@ -200,31 +168,7 @@ const backgroundImage = computed(() => { } .nav-image-active { - transform: translateY(-25px); - } - - .nav-label { - font-size: 10px; - } - - .nav-item-first { - margin-left: 15px; - } - - .nav-item-second { - margin-left: -8px; - } - - .nav-item-third { - margin-left: 12px; - } - - .nav-item-fourth { - margin-right: -8px; - } - - .nav-item-last { - margin-right: 15px; + transform: translateY(-40px); } } @@ -241,36 +185,12 @@ const backgroundImage = computed(() => { } .nav-image { - width: 40px; - height: 40px; + width: 30px; + height: 30px; } .nav-image-active { - transform: translateY(-20px); - } - - .nav-label { - font-size: 9px; - } - - .nav-item-first { - margin-left: 10px; - } - - .nav-item-second { - margin-left: -6px; - } - - .nav-item-third { - margin-left: 10px; - } - - .nav-item-fourth { - margin-right: -6px; - } - - .nav-item-last { - margin-right: 10px; + transform: translateY(-35px); } } @@ -291,31 +211,7 @@ const backgroundImage = computed(() => { } .nav-image-active { - transform: translateY(-18px); - } - - .nav-label { - font-size: 8px; - } - - .nav-item-first { - margin-left: 15px; - } - - .nav-item-second { - margin-left: -8px; - } - - .nav-item-third { - margin-left: 12px; - } - - .nav-item-fourth { - margin-right: -8px; - } - - .nav-item-last { - margin-right: 15px; + transform: translateY(-30px); } } \ No newline at end of file diff --git a/src/views/BuyDetails.vue b/src/views/BuyDetails.vue index 30b0755..2a4731e 100644 --- a/src/views/BuyDetails.vue +++ b/src/views/BuyDetails.vue @@ -30,8 +30,16 @@
实付 - - {{ totalPrice }} +
+
+ 融豆 + {{ totalPrice }} +
+
+ + {{ totalPointsPrice }} +
+
- @@ -144,6 +152,11 @@ const totalPrice = computed(() => { return product.value.rongdou_price * quantity.value }) +const totalPointsPrice = computed(() => { + if (!product.value) return 0 + return product.value.points_price * quantity.value +}) + const canPurchase = computed(() => { const specNames = Object.keys(specGroups.value) const allSpecsSelected = specNames.every(specName => selectedSpecs.value[specName]) @@ -534,23 +547,58 @@ onMounted(() => { .product-price { display: flex; - align-items: center; - gap: 4px; + align-items: flex-start; + gap: 8px; } .price-label { font-size: 14px; color: #666; + margin-top: 2px; } -.coin-icon { - color: #ffae00; +.price-container { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 4px; } -.price-value { +.main-price { + display: flex; + align-items: center; + gap: 4px; +} + +.rongdou-icon { + width: 20px; + height: 20px; + object-fit: contain; +} + +.rongdou-price { font-size: 18px; font-weight: bold; - color: #ffae00; + color: #ff6b35; +} + +.sub-price { + display: flex; + align-items: center; + gap: 3px; + margin-left: 24px; +} + +.points-icon { + width: 14px; + height: 14px; + color: #666; +} + +.points-price { + font-size: 14px; + color: #666; + font-weight: normal; } .quantity-selector { diff --git a/src/views/MyShop.vue b/src/views/MyShop.vue index ff5de4c..dd26b4f 100644 --- a/src/views/MyShop.vue +++ b/src/views/MyShop.vue @@ -55,8 +55,14 @@
{{ product.name }}
- {{ product.rongdou_price }} - {{ product.originalPoints }} +
+ 融豆 + {{ product.rongdou_price }} +
+
+ + {{ product.points_price }} +
@@ -75,6 +81,7 @@ import { ref, onMounted } from 'vue' import { useRouter } from 'vue-router' import api from '@/utils/api' // 确保导入正确的api模块 import { ElMessage } from 'element-plus' +import { Coin } from '@element-plus/icons-vue' import {getImageUrl} from '@/config' @@ -460,21 +467,43 @@ export default { .product-price { margin-top: auto; /* 将价格推到底部 */ + position: relative; +} + +.main-price { display: flex; align-items: center; - gap: 8px; + gap: 4px; } -.points { +.rongdou-icon { + width: 16px; + height: 16px; + object-fit: contain; +} + +.rongdou-price { color: #ff6b35; - font-weight: 600; - font-size: 14px; + font-weight: bold; + font-size: 16px; } -.original-price { +.sub-price { + display: flex; + align-items: center; + gap: 2px; + margin-top: 4px; +} + +.points-icon { + font-size: 10px; + width: 10px; + height: 10px; +} + +.points-price { color: #999; - font-size: 12px; - text-decoration: line-through; + font-size: 10px; } /* 使用与主页面一致的变量 */ diff --git a/src/views/Orders.vue b/src/views/Orders.vue index 1e30c4f..7c023f2 100644 --- a/src/views/Orders.vue +++ b/src/views/Orders.vue @@ -73,11 +73,15 @@

{{ item.product.name }}

{{ truncateText(item.product.description, 40) }}

-
- - - {{ item.points }} - +
+
+ 融豆 + {{ item.rongdouPrice }} +
+
+ + {{ item.points }} +
x{{ item.quantity }}
@@ -92,8 +96,9 @@
总计:
- - {{ order.totalPoints }} + + 融豆 + {{ order.totalRongdou }}
@@ -248,8 +253,15 @@

{{ item.product.description }}

规格:{{ item.specInfo }}

-
- {{ item.points }} +
+
+ 融豆 + {{ item.rongdouPrice }} +
+
+ + {{ item.points }} +
x {{ item.quantity }}
@@ -271,7 +283,8 @@ 商品总计:
- {{ orderDetail.totalPoints }} + 融豆 + {{ orderDetail.totalRongdou }}
@@ -279,7 +292,8 @@ 实付:
- {{ orderDetail.totalPoints }} + 融豆 + {{ orderDetail.totalRongdou }}
@@ -1045,6 +1059,11 @@ onMounted(() => { font-size: 14px; } +.detail-item-price-group img { + width: 12px !important; + height: 12px !important; +} + .quantity-text { color: #999; font-size: 12px; @@ -1058,6 +1077,11 @@ onMounted(() => { font-weight: 600; } +.detail-price-group img { + width: 14px !important; + height: 14px !important; +} + .spec-info { font-size: 12px; color: #666; @@ -1068,6 +1092,113 @@ onMounted(() => { display: inline-block; } +/* 商品价格显示样式 */ +.item-price-container { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 2px; + margin-bottom: 4px; +} + +.item-main-price { + display: flex; + align-items: center; + gap: 2px; +} + +.item-rongdou-icon { + width: 12px; + height: 12px; +} + +.item-rongdou-price { + font-size: 12px; + font-weight: 500; + color: #333; +} + +.item-sub-price { + display: flex; + align-items: center; + gap: 2px; +} + +.item-points-icon { + font-size: 10px; + color: #ffae00; +} + +.item-points-price { + font-size: 10px; + color: #666; +} + +/* 订单总计融豆图标样式 */ +.total-rongdou-icon { + width: 14px; + height: 14px; + margin-right: 2px; +} + +/* 订单详情商品价格样式 */ +.detail-item-price-container { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 2px; +} + +.detail-item-main-price { + display: flex; + align-items: center; + gap: 2px; +} + +.detail-rongdou-icon { + width: 12px !important; + height: 12px !important; +} + +.detail-item-price-container .detail-rongdou-icon { + width: 12px !important; + height: 12px !important; +} + +.detail-rongdou-price { + font-size: 12px; + font-weight: 500; + color: #333; +} + +.detail-item-sub-price { + display: flex; + align-items: center; + gap: 2px; +} + +.detail-points-icon { + font-size: 10px; + color: #ffae00; +} + +.detail-points-price { + font-size: 10px; + color: #666; +} + +/* 费用明细融豆图标样式 */ +.cost-rongdou-icon { + width: 14px !important; + height: 14px !important; + margin-right: 2px; +} + +.detail-price-group .cost-rongdou-icon { + width: 14px !important; + height: 14px !important; +} + /* 响应式设计 */ @media (max-width: 480px) { .order-header { diff --git a/src/views/Pay.vue b/src/views/Pay.vue index f22c1ec..30630a4 100644 --- a/src/views/Pay.vue +++ b/src/views/Pay.vue @@ -72,31 +72,55 @@
@@ -131,8 +155,16 @@ {{ item.size }}
- - {{ item.points }} +
+
+ 融豆 + {{ item.rongdouPrice }} +
+
+ + {{ item.points }} +
+
@@ -224,31 +256,59 @@
@@ -294,6 +354,21 @@ const paymentData = ref({ cartId: null, items: [] // 添加商品列表 }) + +// 计算商品总价 +const totalRongdouPrice = computed(() => { + return paymentData.value.items.reduce((sum, item) => { + const rongdouPrice = item.rongdouPrice || (item.rongdou_price || 0) + return sum + (rongdouPrice * item.quantity) + }, 0) +}) + +const totalPointsPrice = computed(() => { + return paymentData.value.items.reduce((sum, item) => { + const pointsPrice = item.points || (item.points_price || 0) + return sum + (pointsPrice * item.quantity) + }, 0) +}) // 用户余额数据 const userBalance = ref({ points: 0, // 用户积分 @@ -1207,4 +1282,140 @@ onMounted(() => { background: #ccc; cursor: not-allowed; } + +/* 商品单价双价格显示样式 */ +.item-price-container { + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 2px; +} + +.item-main-price { + display: flex; + align-items: center; + gap: 2px; +} + +.item-rongdou-icon { + width: 10px; + height: 10px; +} + +.item-rongdou-price { + font-size: 16px; + font-weight: 500; + color: #333; +} + +.item-sub-price { + display: flex; + align-items: center; + gap: 2px; +} + +.item-points-icon { + font-size: 12px; + color: #ffae00; +} + +.item-points-price { + font-size: 12px; + color: #666; +} + +/* 支付金额双价格显示样式 */ +.payment-price-container { + display: flex; + flex-direction: column; + align-items: center; + gap: 4px; +} + +.payment-main-price { + display: flex; + align-items: center; + gap: 4px; +} + +.payment-rongdou-icon { + width: 24px; + height: 24px; +} + +.payment-rongdou-price { + font-size: 24px; + font-weight: bold; + color: #333; +} + +.payment-sub-price { + display: flex; + align-items: center; + gap: 2px; +} + +.payment-points-icon { + font-size: 16px; + color: #ffae00; +} + +.payment-points-price { + font-size: 16px; + color: #666; +} + +/* 底部实付双价格显示样式 */ +.bottom-price-container { + display: flex; + align-items: center; + gap: 8px; +} + +.bottom-main-price { + display: flex; + align-items: center; + gap: 2px; +} + +.bottom-rongdou-icon { + width: 18px; + height: 18px; +} + +.bottom-rongdou-price { + font-size: 18px; + font-weight: bold; + color: #ff4757; +} + +.bottom-plus-sign { + font-size: 16px; + font-weight: bold; + color: #666; + margin: 0 2px; +} + +.bottom-sub-price { + display: flex; + align-items: center; + gap: 2px; + margin-left: 0px; + padding-left: 0px; +} + +.bottom-points-icon { + font-size: 14px; + color: #ffae00; +} + +.bottom-points-price { + font-size: 14px; + color: #666; +} + +.bottom-points-price { + font-size: 14px; + color: #666; +} \ No newline at end of file diff --git a/src/views/PayLoading.vue b/src/views/PayLoading.vue index 872b70c..f278a00 100644 --- a/src/views/PayLoading.vue +++ b/src/views/PayLoading.vue @@ -63,13 +63,30 @@
{{ item.name }}
{{ item.specification || '默认规格' }}
- - {{ item.price }} × {{ item.quantity }} +
+
+ 融豆 + {{ item.rongdou_price }} +
+
+ + {{ item.points_price }} +
+
+ × {{ item.quantity }}
- - {{ (item.price * item.quantity) }} +
+
+ 融豆 + {{ (item.rongdou_price * item.quantity) }} +
+
+ + {{ (item.points_price * item.quantity) }} +
+
@@ -81,21 +98,21 @@
商品总价: - - {{ orderData.subtotal || 0 }} + 融豆 + {{ orderData.totalAmount || 0 }}
运费: - + 融豆 {{ orderData.shippingFee || 0 }}
总计: - + 融豆 {{ orderData.totalAmount || 0 }}
@@ -180,8 +197,8 @@ const fetchOrderData = async () => { orderData.value = { orderNumber: order.order_no || 'ORD' + Date.now(), createTime: order.created_at || new Date().toISOString(), - totalAmount: order.total_points || 0, - subtotal: order.total_points || 0, + totalAmount: order.total_amount || 0, + subtotal: order.total_amount || 0, shippingFee: 0, address: { recipient: data.address?.receiver_name || order.username || '收件人', @@ -196,7 +213,9 @@ const fetchOrderData = async () => { name: item.product_name, image: item.image_url || '/imgs/loading.png', specification: item.spec_info || '默认规格', - price: item.points_price || 0, + price: item.price || 0, + points_price: item.points_price || 0, + rongdou_price: item.rongdou_price || 0, quantity: item.quantity || 1 })) } @@ -472,5 +491,100 @@ onMounted(() => { font-size: 16px; } +/* 商品价格显示样式 */ +.item-price-container { + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 2px; + margin-bottom: 4px; +} + +.item-main-price { + display: flex; + align-items: center; + gap: 2px; +} + +.item-rongdou-icon { + width: 12px; + height: 12px; +} + +.item-rongdou-price { + font-size: 12px; + font-weight: 500; + color: #333; +} + +.item-sub-price { + display: flex; + align-items: center; + gap: 2px; +} + +.item-points-icon { + font-size: 10px; + color: #ffae00; +} + +.item-points-price { + font-size: 10px; + color: #666; +} + +.quantity-label { + font-size: 12px; + color: #666; + margin-top: 2px; +} + +/* 商品总价显示样式 */ +.total-price-container { + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 2px; +} + +.total-main-price { + display: flex; + align-items: center; + gap: 2px; +} + +.total-rongdou-icon { + width: 14px; + height: 14px; +} + +.total-rongdou-price { + font-size: 14px; + font-weight: 500; + color: #ff4757; +} + +.total-sub-price { + display: flex; + align-items: center; + gap: 2px; +} + +.total-points-icon { + font-size: 12px; + color: #ffae00; +} + +.total-points-price { + font-size: 12px; + color: #666; +} + +/* 费用明细融豆图标样式 */ +.cost-rongdou-icon { + width: 14px; + height: 14px; + margin-right: 2px; +} \ No newline at end of file diff --git a/src/views/ProductDetail.vue b/src/views/ProductDetail.vue index e74eeb7..221509a 100644 --- a/src/views/ProductDetail.vue +++ b/src/views/ProductDetail.vue @@ -56,13 +56,15 @@
-
- - {{ product.rongdou_price }} - 融豆 -
-
- 原价:{{ product.originalPoints }}积分 +
+
+ 融豆 + {{ product.rongdou_price }} +
+
+ + {{ product.points_price }} +
{{ product.discount }}折优惠 @@ -107,12 +109,6 @@ ||{{product.brand}}||{{product.origin}}
- - -
- 小货车 - 预计两小时内发货,后天送达 -
@@ -530,34 +526,50 @@ watch( margin-bottom: 20px; } -.current-price { +.price-container { display: flex; - align-items: center; - gap: 4px; + flex-direction: column; + align-items: flex-start; + gap: 6px; margin-bottom: 8px; } -.current-price .el-icon { - color: #ff6b35; - font-size: 20px; +.main-price { + display: flex; + align-items: center; + gap: 6px; } -.price-number { +.rongdou-icon { + width: 24px; + height: 24px; + object-fit: contain; +} + +.rongdou-price { font-size: 28px; font-weight: 700; color: #ff6b35; } -.price-unit { - font-size: 16px; - color: #ff6b35; +.sub-price { + display: flex; + align-items: center; + gap: 4px; + margin-left: 30px; + margin-top: 2px; } -.original-price { - color: #999; - font-size: 14px; - text-decoration: line-through; - margin-bottom: 4px; +.points-icon { + width: 16px; + height: 16px; + color: #666; +} + +.points-price { + font-size: 16px; + color: #666; + font-weight: normal; } .discount-info { diff --git a/src/views/ProductSummary.vue b/src/views/ProductSummary.vue index 2f0544f..e148805 100644 --- a/src/views/ProductSummary.vue +++ b/src/views/ProductSummary.vue @@ -32,7 +32,16 @@
{{ firstProduct.name }} - {{ firstProduct.rongdou_price }} 融豆 +
+
+ 融豆 + {{ firstProduct.rongdou_price }} +
+
+ + {{ firstProduct.points_price }} +
+
详情>
@@ -68,7 +77,16 @@
{{ product.name }} - {{ product.rongdou_price }} 融豆 +
+
+ 融豆 + {{ product.rongdou_price }} +
+
+ + {{ product.points_price }} +
+
详情> @@ -85,7 +103,7 @@ import { ref, onMounted } from 'vue' import api from '@/utils/api' import { useRoute, useRouter } from 'vue-router' import {ElMessage} from "element-plus"; -import {Bottom, ShoppingCart} from "@element-plus/icons-vue"; +import {Bottom, ShoppingCart, Coin} from "@element-plus/icons-vue"; import { getImageUrl } from '@/config' @@ -171,36 +189,36 @@ const getFirstProduct = async () => { } } -const getProductDetail = async (productId) => { - try { - const response = await api.get(`/products/${productId}`) +// const getProductDetail = async (productId) => { +// try { +// const response = await api.get(`/products/${productId}`) - if (response.data && response.data.data && response.data.data.product) { - productDetail.value = response.data.data.product +// if (response.data && response.data.data && response.data.data.product) { +// productDetail.value = response.data.data.product - // 处理商品详情的图片路径 - if (productDetail.value.image) { - productDetail.value.image = getImageUrl(productDetail.value.image) - } - if (productDetail.value.images && Array.isArray(productDetail.value.images)) { - productDetail.value.images = productDetail.value.images.map(img => getImageUrl(img)) - } +// // 处理商品详情的图片路径 +// if (productDetail.value.image) { +// productDetail.value.image = getImageUrl(productDetail.value.image) +// } +// if (productDetail.value.images && Array.isArray(productDetail.value.images)) { +// productDetail.value.images = productDetail.value.images.map(img => getImageUrl(img)) +// } - // 缓存商品详情 - productDetailsCache.value[productId] = productDetail.value - } else { - console.error('无法解析商品详情数据:', response.data) - ElMessage.error('获取商品详情失败') - } +// // 缓存商品详情 +// productDetailsCache.value[productId] = productDetail.value +// } else { +// console.error('无法解析商品详情数据:', response.data) +// ElMessage.error('获取商品详情失败') +// } - return productDetail.value - } catch (error) { - console.error('获取商品详情失败:', error) - console.error('错误详情:', error.response?.data) - ElMessage.error('获取商品详情失败') - throw error - } -} +// return productDetail.value +// } catch (error) { +// console.error('获取商品详情失败:', error) +// console.error('错误详情:', error.response?.data) +// ElMessage.error('获取商品详情失败') +// throw error +// } +// } // 预加载所有商品详情的函数 const loadAllProductDetails = async () => { @@ -407,13 +425,51 @@ onMounted(async () => { } .product-price { - color: #e53935; - font-weight: bold; - font-size: 18px; + display: flex; + flex-direction: column; + align-items: flex-start; + gap: 4px; + margin-top: auto; /* 推到底部 */ +} + +.main-price { display: flex; align-items: center; gap: 4px; - margin-top: auto; /* 推到底部 */ + color: #e53935; + font-weight: bold; + font-size: 18px; +} + +.rongdou-icon { + width: 16px; + height: 16px; + object-fit: contain; +} + +.rongdou-price { + color: #e53935; + font-weight: bold; +} + +.sub-price { + display: flex; + align-items: center; + gap: 2px; + margin-left: 20px; + margin-top: 2px; +} + +.points-icon { + width: 12px; + height: 12px; + color: #666; +} + +.points-price { + font-size: 12px; + color: #666; + font-weight: normal; } .link { diff --git a/src/views/Shop.vue b/src/views/Shop.vue index dd5ca58..452d007 100644 --- a/src/views/Shop.vue +++ b/src/views/Shop.vue @@ -64,12 +64,13 @@

{{ product.name }}

-
- - {{ product.rongdou_price }} +
+ 融豆 + {{ product.rongdou_price }}
-
- {{ product.originalPoints }} +
+ + {{ product.points_price }}
@@ -89,12 +90,13 @@

{{ product.name }}

-
- - {{ product.rongdou_price }} +
+ 融豆 + {{ product.rongdou_price }}
-
- {{ product.originalPoints }} +
+ + {{ product.points_price }}
@@ -137,13 +139,14 @@

{{ product.name }}

- - - {{ product.rongdou_price }} - - - {{ product.originalPoints }} - +
+ 融豆 + {{ product.rongdou_price }} +
+
+ + {{ product.points_price }} +
@@ -617,26 +620,45 @@ onMounted(() => { } .product-price { - display: flex; - align-items: center; - gap: 8px; margin: 0 8px; padding-bottom: 8px; + position: relative; } -.current-price { +.main-price { + display: flex; + align-items: center; + gap: 4px; +} + +.rongdou-icon { + width: 16px; + height: 16px; + object-fit: contain; +} + +.rongdou-price { + color: #ff6b35; + font-weight: bold; + font-size: 16px; +} + +.sub-price { display: flex; align-items: center; gap: 2px; - color: #ff6b35; - font-weight: 600; - font-size: 14px; + margin-top: 4px; } -.original-price { +.points-icon { + font-size: 10px; + width: 10px; + height: 10px; +} + +.points-price { color: #999; - font-size: 12px; - text-decoration: line-through; + font-size: 10px; } .empty-state { @@ -750,25 +772,44 @@ onMounted(() => { } .recommend-price-container { - display: flex; - flex-direction: column; - gap: 1px; + position: relative; } -.recommend-price { +.recommend-price-container .main-price { display: flex; align-items: center; gap: 2px; +} + +.recommend-price-container .rongdou-icon { + width: 12px; + height: 12px; + object-fit: contain; +} + +.recommend-price-container .rongdou-price { color: #ff6b35; font-weight: 600; font-size: 12px; line-height: 1; } -.recommend-original-price { +.recommend-price-container .sub-price { + display: flex; + align-items: center; + gap: 1px; + margin-top: 2px; +} + +.recommend-price-container .points-icon { + font-size: 8px; + width: 8px; + height: 8px; +} + +.recommend-price-container .points-price { color: #999; - font-size: 10px; - text-decoration: line-through; + font-size: 8px; line-height: 1; }