index.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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" @click="go('/trip/expense/rules')">
  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" @click="go('/trip/expense/question')">
  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. methods: {
  46. go(path) {
  47. uni.navigateTo({
  48. url: path
  49. });
  50. }
  51. },
  52. onLoad({ priceItems }) {
  53. if (priceItems) {
  54. this.priceItems = JSON.parse(priceItems)
  55. }
  56. },
  57. computed:{
  58. getPrice(){
  59. return this.priceItems.reduce((total, item) => total + item.value, 0);
  60. }
  61. }
  62. }
  63. </script>
  64. <style lang="scss" scoped>
  65. .expense {
  66. background: #f5f5f5;
  67. height: 100vh;
  68. padding-top: 20rpx;
  69. .block {
  70. margin-bottom: 20rpx;
  71. background: #fff;
  72. padding: 28rpx 34rpx;
  73. }
  74. .item {
  75. display: flex;
  76. align-items: center;
  77. justify-content: space-between;
  78. color: #AAAAAA;
  79. font-size: 28rpx;
  80. line-height: 70rpx;
  81. position: relative;
  82. .jiantou {
  83. position: absolute;
  84. top: 50%;
  85. right: 0%;
  86. transform: translateY(-50%);
  87. width: 20rpx;
  88. height: 20rpx;
  89. }
  90. }
  91. .item.title {
  92. color: #222222;
  93. }
  94. .item.border {
  95. border-bottom: 2rpx solid #F0F0F0;
  96. padding-bottom: 20rpx;
  97. margin-bottom: 20rpx;
  98. }
  99. .total {
  100. text-align: right;
  101. color: #222222;
  102. font-size: 28rpx;
  103. margin: 28rpx 0;
  104. .num {
  105. font-weight: bold;
  106. font-size: 36rpx;
  107. }
  108. }
  109. .notice {
  110. color: #AAAAAA;
  111. font-size: 24rpx;
  112. }
  113. }
  114. </style>