service-card.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="service-card">
  3. <view class="service-row" @click="onClick">
  4. <view class="icon-box">
  5. <image src="/pages-sell/static/goods/icon-down.png" class="service-icon" mode="aspectFit"></image>
  6. </view>
  7. <text class="service-label">可降</text>
  8. <text class="separator">|</text>
  9. <text class="service-val red">分享一人助力,可降 {{bookInfo.reducePrice||1}} 元</text>
  10. <u-icon name="arrow-right" size="24" color="#999" class="arrow"></u-icon>
  11. </view>
  12. <view class="service-row">
  13. <view class="icon-box">
  14. <image src="/pages-sell/static/goods/icon-fee.png" class="service-icon" mode="aspectFit"></image>
  15. </view>
  16. <text class="service-label">运费</text>
  17. <text class="separator">|</text>
  18. <text class="service-val green">{{ bookInfo.expressDesc }}(偏远地区除外)</text>
  19. </view>
  20. <view class="service-row">
  21. <view class="icon-box">
  22. <image src="/pages-sell/static/goods/icon-fire.png" class="service-icon" mode="aspectFit"></image>
  23. </view>
  24. <text class="service-label">活动</text>
  25. <text class="separator">|</text>
  26. <text class="service-val red">{{ bookInfo.activityDesc }}</text>
  27. </view>
  28. <view class="service-row last" @click="openServicePopup">
  29. <view class="icon-box">
  30. <image src="/pages-sell/static/goods/icon-service.png" class="service-icon" mode="aspectFit"></image>
  31. </view>
  32. <text class="service-label">服务</text>
  33. <text class="separator">|</text>
  34. <text class="service-val">破损包赔 · 降价补差 · 24 小时发货</text>
  35. <u-icon name="arrow-right" size="24" color="#999" class="arrow"></u-icon>
  36. </view>
  37. <ServicePopup ref="servicePopup" />
  38. </view>
  39. </template>
  40. <script>
  41. import ServicePopup from '@/pages-sell/components/service-popup/index.vue';
  42. export default {
  43. name: 'ServiceCard',
  44. components: {
  45. ServicePopup
  46. },
  47. props: {
  48. bookInfo: {
  49. type: Object,
  50. default: () => ({})
  51. }
  52. },
  53. methods: {
  54. onClick() {
  55. this.$emit('click');
  56. },
  57. openServicePopup() {
  58. this.$refs.servicePopup.open();
  59. }
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .service-card {
  65. background: #fff;
  66. border-radius: 24rpx 24rpx 0 0;
  67. padding: 0 30rpx;
  68. margin-bottom: 20rpx;
  69. .service-row {
  70. display: flex;
  71. align-items: center;
  72. padding: 30rpx 0;
  73. font-size: 26rpx;
  74. position: relative;
  75. border-bottom: 1rpx solid #F5F5F5;
  76. &.last {
  77. border-bottom: none;
  78. }
  79. .icon-box {
  80. width: 32rpx;
  81. height: 32rpx;
  82. margin-right: 12rpx;
  83. display: flex;
  84. align-items: center;
  85. justify-content: center;
  86. .service-icon {
  87. width: 100%;
  88. height: 100%;
  89. }
  90. }
  91. .service-label {
  92. color: #333;
  93. font-weight: bold;
  94. min-width: 60rpx; // Fixed width for 2 characters to ensure alignment
  95. text-align: justify;
  96. text-align-last: justify;
  97. word-break: keep-all;
  98. white-space: nowrap;
  99. }
  100. .separator {
  101. color: #eee;
  102. margin: 0 10rpx;
  103. }
  104. .service-val {
  105. color: #666;
  106. flex: 1; // Allow text to take remaining space
  107. overflow: hidden;
  108. white-space: nowrap;
  109. text-overflow: ellipsis;
  110. &.red {
  111. color: #D81A00;
  112. }
  113. &.green {
  114. color: #38C248;
  115. }
  116. }
  117. .arrow {
  118. position: absolute;
  119. right: 0;
  120. }
  121. }
  122. }
  123. </style>