feat: 商品详情的价格的计算处理
This commit is contained in:
@@ -39,8 +39,18 @@
|
||||
}}</view>
|
||||
<view class="goods-price">
|
||||
<text class="currency">¥</text>
|
||||
<text class="price">
|
||||
{{ goodsData.specificationPrice || 399 }}
|
||||
<template v-if="goodsData.commodityTypeCode === '0'">
|
||||
<text class="price">
|
||||
{{ goodsData.calculatedTotalPrice || 0 }}
|
||||
</text>
|
||||
<text class="price-desc">
|
||||
({{ goodsData.startDate }}至{{ goodsData.endDate }}) 共{{
|
||||
goodsData.totalDays
|
||||
}}晚
|
||||
</text>
|
||||
</template>
|
||||
<text v-else class="price">
|
||||
{{ goodsData.specificationPrice || 0 }}
|
||||
</text>
|
||||
</view>
|
||||
<view
|
||||
@@ -95,7 +105,11 @@
|
||||
|
||||
<!-- 总价区域 -->
|
||||
<SumCard
|
||||
:referencePrice="goodsData.specificationPrice"
|
||||
:referencePrice="
|
||||
goodsData.commodityTypeCode === '0'
|
||||
? goodsData.calculatedTotalPrice
|
||||
: goodsData.specificationPrice
|
||||
"
|
||||
:discount="totalPrice"
|
||||
/>
|
||||
</view>
|
||||
@@ -180,7 +194,10 @@ const isDeleting = ref(false); // 标志位,防止删除时watch冲突
|
||||
|
||||
// 计算属性
|
||||
const totalPrice = computed(() => {
|
||||
const price = props.goodsData?.specificationPrice || DEFAULT_PRICE;
|
||||
const price =
|
||||
props.goodsData?.commodityTypeCode === "0"
|
||||
? props.goodsData?.calculatedTotalPrice
|
||||
: props.goodsData?.specificationPrice || 0;
|
||||
return (price * quantity.value).toFixed(0);
|
||||
});
|
||||
|
||||
|
||||
@@ -92,6 +92,13 @@
|
||||
font-weight: 600;
|
||||
margin-left: 2px;
|
||||
}
|
||||
|
||||
.price-desc {
|
||||
font-size: 14px;
|
||||
color: #999;
|
||||
font-weight: 400;
|
||||
margin-left: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-service-list {
|
||||
|
||||
Reference in New Issue
Block a user