consumer模块完成度95%,优化安卓端界面和小程序测试2
This commit is contained in:
@@ -14,16 +14,30 @@
|
||||
|
||||
<!-- 商品基本信息 -->
|
||||
<view class="product-info">
|
||||
<!-- 价格区域 -->
|
||||
<view class="price-section">
|
||||
<text class="current-price">¥{{ product.price }}</text>
|
||||
<!-- 会员价功能已禁用 -->
|
||||
<!-- <text v-if="memberPrice > 0 && memberPrice < product.price" class="member-price-tag">会员价 ¥{{ memberPrice }}</text> -->
|
||||
<text v-if="product.original_price" class="original-price">¥{{ product.original_price }}</text>
|
||||
<!-- 会员折扣标签行 -->
|
||||
<view v-if="memberDiscount > 0 && memberPrice > 0 && memberPrice < product.price" class="price-header">
|
||||
<view class="member-badge">
|
||||
<text class="member-badge-text">VIP</text>
|
||||
</view>
|
||||
<text class="member-discount-label">{{ memberDiscount }}折</text>
|
||||
</view>
|
||||
|
||||
<!-- 价格行 -->
|
||||
<view class="price-row">
|
||||
<text class="price-symbol">¥</text>
|
||||
<text class="price-value">{{ memberPrice > 0 && memberPrice < product.price ? memberPrice : product.price }}</text>
|
||||
<text v-if="memberPrice > 0 && memberPrice < product.price" class="price-original">¥{{ product.price }}</text>
|
||||
<text v-else-if="product.original_price != null && product.original_price > product.price" class="price-original">¥{{ product.original_price }}</text>
|
||||
</view>
|
||||
|
||||
<!-- 节省金额 -->
|
||||
<view v-if="memberPrice > 0 && memberPrice < product.price" class="save-row">
|
||||
<text class="save-text">已省 ¥{{ (product.price - memberPrice).toFixed(2) }}</text>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 会员专享折扣功能已禁用 -->
|
||||
<!-- <view v-if="memberDiscount > 0" class="member-discount-row">
|
||||
<text class="member-discount-text">会员专享 {{ memberDiscount }}折优惠</text>
|
||||
</view> -->
|
||||
|
||||
<text class="product-name">{{ product.name }}</text>
|
||||
<text class="sales-info">已售{{ product.sales }}件 · 库存{{ product.stock }}件</text>
|
||||
</view>
|
||||
@@ -137,9 +151,13 @@
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<!-- 规格选择弹窗 (京东风格) -->
|
||||
<!-- 规格选择弹窗 (京东风格) -->
|
||||
<view v-if="showSpec" class="spec-modal" @click="hideSpecModal">
|
||||
<view class="spec-content" @click.stop>
|
||||
<!-- 强化提示语显示逻辑 -->
|
||||
<view v-if="selectedSkuId == ''" class="spec-error-tip">
|
||||
<text class="error-tip-text">请选择规格</text>
|
||||
</view>
|
||||
<view class="spec-header-jd">
|
||||
<image :src="getSelectedSkuImage()" class="spec-product-img" mode="aspectFill" />
|
||||
<view class="spec-info-jd">
|
||||
@@ -614,10 +632,14 @@ export default {
|
||||
}
|
||||
|
||||
if (discountRaw != null) {
|
||||
const discount = discountRaw as number
|
||||
if (discount > 0 && discount < 10) {
|
||||
this.memberDiscount = discount
|
||||
this.memberPrice = Math.round(this.product.price * discount) / 10
|
||||
const discountRate = discountRaw as number
|
||||
// discountRate 是折扣率,如 0.9 表示 9 折
|
||||
// 会员价 = 原价 × 折扣率
|
||||
if (discountRate > 0 && discountRate < 1) {
|
||||
// 计算折扣显示值:0.9 -> 9 折
|
||||
this.memberDiscount = Math.round(discountRate * 10) / 10 * 10
|
||||
// 计算会员价:原价 × 折扣率
|
||||
this.memberPrice = Math.round(this.product.price * discountRate * 100) / 100
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
@@ -804,11 +826,9 @@ export default {
|
||||
|
||||
async addToCart() {
|
||||
if (this.productSkus.length > 0 && (this.selectedSkuId == null || this.selectedSkuId === '')) {
|
||||
this.showSpecModal()
|
||||
uni.showToast({
|
||||
title: '请选择规格',
|
||||
icon: 'none'
|
||||
})
|
||||
if (!this.showSpec) {
|
||||
this.showSpecModal()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -839,11 +859,9 @@ export default {
|
||||
|
||||
buyNow() {
|
||||
if (this.productSkus.length > 0 && (this.selectedSkuId == null || this.selectedSkuId === '')) {
|
||||
this.showSpecModal()
|
||||
uni.showToast({
|
||||
title: '请选择规格',
|
||||
icon: 'none'
|
||||
})
|
||||
if (!this.showSpec) {
|
||||
this.showSpecModal()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -1043,6 +1061,74 @@ export default {
|
||||
|
||||
.price-section {
|
||||
margin-bottom: 20rpx;
|
||||
background: linear-gradient(135deg, #fff5f0 0%, #ffffff 100%);
|
||||
border-radius: 16rpx;
|
||||
padding: 20rpx;
|
||||
margin: -10rpx -10rpx 20rpx -10rpx;
|
||||
}
|
||||
|
||||
.price-header {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-bottom: 12rpx;
|
||||
}
|
||||
|
||||
.member-badge {
|
||||
background: linear-gradient(135deg, #ff5000 0%, #ff7a00 100%);
|
||||
border-radius: 6rpx;
|
||||
padding: 4rpx 16rpx;
|
||||
margin-right: 12rpx;
|
||||
}
|
||||
|
||||
.member-badge-text {
|
||||
font-size: 22rpx;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.member-discount-label {
|
||||
font-size: 26rpx;
|
||||
color: #ff5000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.price-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.price-symbol {
|
||||
font-size: 32rpx;
|
||||
color: #ff5000;
|
||||
font-weight: bold;
|
||||
margin-right: 4rpx;
|
||||
}
|
||||
|
||||
.price-value {
|
||||
font-size: 56rpx;
|
||||
color: #ff5000;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.price-original {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
text-decoration-line: line-through;
|
||||
margin-left: 16rpx;
|
||||
}
|
||||
|
||||
.save-row {
|
||||
margin-top: 12rpx;
|
||||
}
|
||||
|
||||
.save-text {
|
||||
font-size: 24rpx;
|
||||
color: #52c41a;
|
||||
background-color: #f6ffed;
|
||||
padding: 6rpx 16rpx;
|
||||
border-radius: 6rpx;
|
||||
}
|
||||
|
||||
.current-price {
|
||||
@@ -1063,14 +1149,39 @@ export default {
|
||||
}
|
||||
|
||||
.member-discount-row {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
margin-bottom: 15rpx;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
.member-tag {
|
||||
font-size: 20rpx;
|
||||
color: #fff;
|
||||
background: linear-gradient(135deg, #ff5000 0%, #ff7a00 100%);
|
||||
padding: 4rpx 12rpx;
|
||||
border-radius: 4rpx;
|
||||
margin-right: 10rpx;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.member-discount-text {
|
||||
font-size: 24rpx;
|
||||
color: #ff5000;
|
||||
font-weight: bold;
|
||||
margin-right: 15rpx;
|
||||
}
|
||||
|
||||
.member-save-text {
|
||||
font-size: 22rpx;
|
||||
color: #52c41a;
|
||||
}
|
||||
|
||||
.current-price.has-discount {
|
||||
color: #ff5000;
|
||||
}
|
||||
|
||||
.original-price {
|
||||
font-size: 28rpx;
|
||||
color: #999;
|
||||
@@ -1451,6 +1562,7 @@ export default {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
max-height: 80vh;
|
||||
position: relative; /* 确保子元素绝对定位相对于此容器 */
|
||||
}
|
||||
|
||||
.spec-header-jd {
|
||||
@@ -1500,6 +1612,24 @@ export default {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
/* 规格未选提示样式 */
|
||||
.spec-error-tip {
|
||||
position: absolute;
|
||||
top: -80rpx;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
padding: 12rpx 30rpx;
|
||||
border-radius: 40rpx;
|
||||
z-index: 2000;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.error-tip-text {
|
||||
color: #fff;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
|
||||
.spec-stock-jd {
|
||||
font-size: 24rpx;
|
||||
color: #999;
|
||||
|
||||
Reference in New Issue
Block a user