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.

215 lines
4.3 KiB

  1. <template>
  2. <view class="service-items-card">
  3. <view class="card-title">
  4. <text>服务项目及费用</text>
  5. </view>
  6. <!-- 服务项目列表 -->
  7. <view class="service-items-list">
  8. <view class="service-item" v-for="(item, index) in items" :key="index">
  9. <view class="item-header">
  10. <view class="item-id">{{item.id}}</view>
  11. <view class="item-name">{{item.name}}</view>
  12. <view class="item-price">¥{{item.price.toFixed(2)}}</view>
  13. </view>
  14. <!-- 宠物名称 -->
  15. <view class="item-pet">
  16. <text>{{item.pet}}</text>
  17. </view>
  18. <!-- 定制服务 -->
  19. <view class="custom-services" v-if="item.customServices && item.customServices.length > 0">
  20. <view class="custom-service-item" v-for="(service, serviceIndex) in item.customServices" :key="serviceIndex">
  21. <view class="service-name">- {{service.name}}</view>
  22. <view class="service-price">¥{{service.price.toFixed(2)}} × {{service.quantity}} </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <!-- 费用合计 -->
  28. <view class="cost-summary">
  29. <view class="cost-item">
  30. <text class="cost-label">费用合计</text>
  31. <text class="cost-value">¥{{totalAmount.toFixed(2)}}</text>
  32. </view>
  33. <view class="cost-item discount" v-if="discount > 0">
  34. <text class="cost-label">平台优惠</text>
  35. <text class="cost-value">- ¥{{discount.toFixed(2)}}</text>
  36. </view>
  37. <view class="cost-item discount" v-if="memberDiscount > 0">
  38. <text class="cost-label">会员优惠</text>
  39. <text class="cost-value">- ¥{{memberDiscount.toFixed(2)}}</text>
  40. </view>
  41. <view class="cost-item total">
  42. <text class="cost-label">应付金额</text>
  43. <text class="cost-value">¥{{finalAmount.toFixed(2)}}</text>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. props: {
  51. items: {
  52. type: Array,
  53. default: () => []
  54. },
  55. totalAmount: {
  56. type: Number,
  57. default: 0
  58. },
  59. discount: {
  60. type: Number,
  61. default: 0
  62. },
  63. memberDiscount: {
  64. type: Number,
  65. default: 0
  66. },
  67. finalAmount: {
  68. type: Number,
  69. default: 0
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .service-items-card {
  76. background-color: #FFFFFF;
  77. border-radius: 20rpx;
  78. padding: 30rpx;
  79. margin-bottom: 20rpx;
  80. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
  81. }
  82. .card-title {
  83. font-size: 32rpx;
  84. font-weight: bold;
  85. color: #333;
  86. margin-bottom: 20rpx;
  87. display: flex;
  88. align-items: center;
  89. &::before {
  90. content: '';
  91. display: inline-block;
  92. width: 8rpx;
  93. height: 32rpx;
  94. background-color: #FFAA48;
  95. margin-right: 16rpx;
  96. border-radius: 4rpx;
  97. }
  98. }
  99. .service-items-list {
  100. .service-item {
  101. padding: 20rpx 0;
  102. border-bottom: 1px solid #EEEEEE;
  103. &:last-child {
  104. border-bottom: none;
  105. }
  106. .item-header {
  107. display: flex;
  108. align-items: center;
  109. margin-bottom: 10rpx;
  110. .item-id {
  111. font-size: 24rpx;
  112. color: #999;
  113. margin-right: 10rpx;
  114. }
  115. .item-name {
  116. font-size: 28rpx;
  117. color: #333;
  118. flex: 1;
  119. }
  120. .item-price {
  121. font-size: 28rpx;
  122. color: #FF5252;
  123. font-weight: bold;
  124. }
  125. }
  126. .item-pet {
  127. font-size: 24rpx;
  128. color: #666;
  129. margin-bottom: 10rpx;
  130. }
  131. .custom-services {
  132. padding: 10rpx 0 10rpx 20rpx;
  133. .custom-service-item {
  134. display: flex;
  135. justify-content: space-between;
  136. align-items: center;
  137. margin-bottom: 6rpx;
  138. .service-name {
  139. font-size: 24rpx;
  140. color: #666;
  141. }
  142. .service-price {
  143. font-size: 24rpx;
  144. color: #999;
  145. }
  146. }
  147. }
  148. }
  149. }
  150. .cost-summary {
  151. margin-top: 30rpx;
  152. padding-top: 20rpx;
  153. border-top: 1px dashed #EEEEEE;
  154. .cost-item {
  155. display: flex;
  156. justify-content: space-between;
  157. align-items: center;
  158. margin-bottom: 10rpx;
  159. .cost-label {
  160. font-size: 26rpx;
  161. color: #666;
  162. }
  163. .cost-value {
  164. font-size: 26rpx;
  165. color: #333;
  166. }
  167. &.discount {
  168. .cost-value {
  169. color: #FF5252;
  170. }
  171. }
  172. &.total {
  173. margin-top: 20rpx;
  174. padding-top: 20rpx;
  175. border-top: 1px dashed #EEEEEE;
  176. .cost-label {
  177. font-size: 28rpx;
  178. font-weight: bold;
  179. color: #333;
  180. }
  181. .cost-value {
  182. font-size: 32rpx;
  183. font-weight: bold;
  184. color: #FF5252;
  185. }
  186. }
  187. }
  188. }
  189. </style>