index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view class="expense">
  3. <view class="block">
  4. <view class="item title" v-for="(item, i) in priceItems" :key="i"
  5. :class="i == priceItems.length - 1 ? 'border' : ''">
  6. <view class="label">
  7. {{ item.title }}
  8. </view>
  9. <view class="value">
  10. {{ item.value }}元
  11. </view>
  12. </view>
  13. <view class="total">
  14. 预估金额 <text class="num">{{ getPrice }}</text> 元
  15. </view>
  16. <view class="notice">
  17. 预付费用是根据实时交通情况、预估行驶里程、时间等因素计算
  18. 得出,存在波动,仅供参考。(行程调整、路线修改、高速费等
  19. 将影响最终价格)
  20. </view>
  21. </view>
  22. <view class="block">
  23. <view class="item title">
  24. <view class="label">
  25. 计费规则
  26. </view>
  27. <image class="jiantou" src="../../static/jiantou-icon.png" mode=""></image>
  28. </view>
  29. <view class="item title">
  30. <view class="label">
  31. 常见问题
  32. </view>
  33. <image class="jiantou" src="../../static/jiantou-icon.png" mode=""></image>
  34. </view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. export default {
  40. data() {
  41. return {
  42. priceItems: []
  43. }
  44. },
  45. onLoad({ priceItems }) {
  46. if (priceItems) {
  47. this.priceItems = JSON.parse(priceItems)
  48. }
  49. },
  50. computed:{
  51. getPrice(){
  52. return this.priceItems.reduce((total, item) => total + item.value, 0);
  53. }
  54. }
  55. }
  56. </script>
  57. <style lang="scss" scoped>
  58. .expense {
  59. background: #f5f5f5;
  60. height: 100vh;
  61. padding-top: 20rpx;
  62. .block {
  63. margin-bottom: 20rpx;
  64. background: #fff;
  65. padding: 28rpx 34rpx;
  66. }
  67. .item {
  68. display: flex;
  69. align-items: center;
  70. justify-content: space-between;
  71. color: #AAAAAA;
  72. font-size: 28rpx;
  73. line-height: 70rpx;
  74. position: relative;
  75. .jiantou {
  76. position: absolute;
  77. top: 50%;
  78. right: 0%;
  79. transform: translateY(-50%);
  80. width: 20rpx;
  81. height: 20rpx;
  82. }
  83. }
  84. .item.title {
  85. color: #222222;
  86. }
  87. .item.border {
  88. border-bottom: 2rpx solid #F0F0F0;
  89. padding-bottom: 20rpx;
  90. margin-bottom: 20rpx;
  91. }
  92. .total {
  93. text-align: right;
  94. color: #222222;
  95. font-size: 28rpx;
  96. margin: 28rpx 0;
  97. .num {
  98. font-weight: bold;
  99. font-size: 36rpx;
  100. }
  101. }
  102. .notice {
  103. color: #AAAAAA;
  104. font-size: 24rpx;
  105. }
  106. }
  107. </style>