You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

216 lines
4.3 KiB

<template>
<view class="service-items-card">
<view class="card-title">
<text>服务项目及费用</text>
</view>
<!-- 服务项目列表 -->
<view class="service-items-list">
<view class="service-item" v-for="(item, index) in items" :key="index">
<view class="item-header">
<view class="item-id">{{item.id}}</view>
<view class="item-name">{{item.name}}</view>
<view class="item-price">¥{{item.price.toFixed(2)}}</view>
</view>
<!-- 宠物名称 -->
<view class="item-pet">
<text>{{item.pet}}</text>
</view>
<!-- 定制服务 -->
<view class="custom-services" v-if="item.customServices && item.customServices.length > 0">
<view class="custom-service-item" v-for="(service, serviceIndex) in item.customServices" :key="serviceIndex">
<view class="service-name">- {{service.name}}</view>
<view class="service-price">¥{{service.price.toFixed(2)}} × {{service.quantity}} </view>
</view>
</view>
</view>
</view>
<!-- 费用合计 -->
<view class="cost-summary">
<view class="cost-item">
<text class="cost-label">费用合计</text>
<text class="cost-value">¥{{totalAmount.toFixed(2)}}</text>
</view>
<view class="cost-item discount" v-if="discount > 0">
<text class="cost-label">平台优惠</text>
<text class="cost-value">- ¥{{discount.toFixed(2)}}</text>
</view>
<view class="cost-item discount" v-if="memberDiscount > 0">
<text class="cost-label">会员优惠</text>
<text class="cost-value">- ¥{{memberDiscount.toFixed(2)}}</text>
</view>
<view class="cost-item total">
<text class="cost-label">应付金额</text>
<text class="cost-value">¥{{finalAmount.toFixed(2)}}</text>
</view>
</view>
</view>
</template>
<script>
export default {
props: {
items: {
type: Array,
default: () => []
},
totalAmount: {
type: Number,
default: 0
},
discount: {
type: Number,
default: 0
},
memberDiscount: {
type: Number,
default: 0
},
finalAmount: {
type: Number,
default: 0
}
}
}
</script>
<style lang="scss" scoped>
.service-items-card {
background-color: #FFFFFF;
border-radius: 20rpx;
padding: 30rpx;
margin-bottom: 20rpx;
box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
.card-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-bottom: 20rpx;
display: flex;
align-items: center;
&::before {
content: '';
display: inline-block;
width: 8rpx;
height: 32rpx;
background-color: #FFAA48;
margin-right: 16rpx;
border-radius: 4rpx;
}
}
.service-items-list {
.service-item {
padding: 20rpx 0;
border-bottom: 1px solid #EEEEEE;
&:last-child {
border-bottom: none;
}
.item-header {
display: flex;
align-items: center;
margin-bottom: 10rpx;
.item-id {
font-size: 24rpx;
color: #999;
margin-right: 10rpx;
}
.item-name {
font-size: 28rpx;
color: #333;
flex: 1;
}
.item-price {
font-size: 28rpx;
color: #FF5252;
font-weight: bold;
}
}
.item-pet {
font-size: 24rpx;
color: #666;
margin-bottom: 10rpx;
}
.custom-services {
padding: 10rpx 0 10rpx 20rpx;
.custom-service-item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 6rpx;
.service-name {
font-size: 24rpx;
color: #666;
}
.service-price {
font-size: 24rpx;
color: #999;
}
}
}
}
}
.cost-summary {
margin-top: 30rpx;
padding-top: 20rpx;
border-top: 1px dashed #EEEEEE;
.cost-item {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 10rpx;
.cost-label {
font-size: 26rpx;
color: #666;
}
.cost-value {
font-size: 26rpx;
color: #333;
}
&.discount {
.cost-value {
color: #FF5252;
}
}
&.total {
margin-top: 20rpx;
padding-top: 20rpx;
border-top: 1px dashed #EEEEEE;
.cost-label {
font-size: 28rpx;
font-weight: bold;
color: #333;
}
.cost-value {
font-size: 32rpx;
font-weight: bold;
color: #FF5252;
}
}
}
}
</style>