chargePriceDetails.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. <template>
  2. <view style="padding-bottom: 296rpx;">
  3. <u-navbar title="充电价格详情"></u-navbar>
  4. <view class="main" >
  5. <view class="tabs-box">
  6. <u-tabs inactive-color="#888888" active-color="#101010" :list="list" :is-scroll="true"
  7. :current="current" @change="change"></u-tabs>
  8. </view>
  9. <view class="line-box"><u-line color="#999999" /></view>
  10. <view class="time-frame" v-for="(item,index) in items" :key="index">
  11. <view class="time-items">
  12. <view class="time-price">
  13. <view class="time">
  14. {{item.time}}
  15. </view>
  16. <view class="price">
  17. <text style="color: #ff3d00; font-size: 36rpx;">{{item.price.toFixed(2)}}</text>
  18. <text class="unit">元/度</text>
  19. </view>
  20. </view>
  21. <view class="unitPrice-serviceCharge">
  22. 充电单价:¥{{item.single_price.toFixed(4)}} | 服务费:¥{{item.service_price.toFixed(4)}}
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. <view class="hint">
  28. *充电费用仅供参考,请以充电桩上的费用为准。
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import * as api from "@/apis/site.js"
  34. let _self;
  35. export default {
  36. data() {
  37. return {
  38. elderMode:false,
  39. list: [
  40. {
  41. name: '直流快充',
  42. },
  43. {
  44. name: '交流慢充',
  45. } ,
  46. {
  47. name: '交流慢充',
  48. } ,
  49. {
  50. name: '交流慢充',
  51. } ,
  52. {
  53. name: '交流慢充',
  54. }
  55. ],
  56. items:[],
  57. current: 0
  58. }
  59. },
  60. onLoad(op){
  61. _self = this;
  62. if(op!=null && op.stationId!=null){
  63. console.log('stationId'+JSON.stringify(op.stationId))
  64. let data = {stationId:op.stationId};
  65. api.getChargingStationPrice(data).then(function(res){
  66. // console.log('data'+JSON.stringify(res))
  67. if(res.result){
  68. let data = res.data;
  69. if(data.prices){
  70. console.log('data'+JSON.stringify(data.prices))
  71. _self.list = [];
  72. for(let i = 0;i< data.prices.length;i++){
  73. let _item = data.prices[i];
  74. let item = {name:data.prices[i].name,items:[]};
  75. for(let j = 0;j<_item.priceList.length;j++){
  76. let _subitem = _item.priceList[j];
  77. console.log('priceList'+JSON.stringify(_subitem))
  78. let subitem = {time:'00:00-07:00',single_price:0.5,service_price:0.25,price:0.75};
  79. subitem.time = _subitem.startTime + '-'+_subitem.endTime;
  80. subitem.single_price = _subitem.electricityPrice;
  81. subitem.service_price = _subitem.servicePrice;
  82. subitem.price = _subitem.costPrice;
  83. item.items.push(subitem);
  84. }
  85. _self.list.push(item);
  86. }
  87. if(_self.list.length>0){
  88. _self.change(0);
  89. }
  90. console.log('站点价格详情'+JSON.stringify(_self.list));
  91. }
  92. }
  93. })
  94. }
  95. /* api.getPriceDetails(op).then(function(res){
  96. _self.list = res;
  97. },function(err){
  98. }
  99. );*/
  100. },
  101. onReady(){
  102. if(this.elderMode)
  103. this.theme('elder')
  104. else
  105. this.theme('standard')
  106. },
  107. methods: {
  108. change(index) {
  109. this.current = index;
  110. this.items = this.list[index].items;
  111. },
  112. theme(type) {
  113. if(type == 'dark')
  114. {
  115. document.getElementsByTagName('body')[0].setAttribute('data-theme',type);
  116. }
  117. else
  118. {
  119. document.getElementsByTagName('body')[0].setAttribute('data-theme',type);
  120. }
  121. }
  122. }
  123. }
  124. </script>
  125. <style lang="scss" scoped>
  126. @import "@/_theme.scss";
  127. .main {
  128. background-color: #fff;
  129. .tabs-box {
  130. width: 55%;
  131. height: 88rpx;
  132. margin: 0 auto;
  133. // line-height: 44px;
  134. position: relative;
  135. }
  136. .line-box{
  137. width: 100%;
  138. height: 88rpx;
  139. position: absolute;
  140. top: 172rpx;
  141. }
  142. .time-frame {
  143. padding-left: 32rpx;
  144. .time-items {
  145. padding-right: 32rpx;
  146. height: 152rpx;
  147. border-bottom: #F2F4F4 2rpx solid;
  148. position: relative;
  149. .time-price {
  150. display: flex;
  151. justify-content: space-between;
  152. padding: 32rpx 0 20rpx;
  153. .time {
  154. color: rgba(16, 16, 16, 100);
  155. font-size: 32rpx;
  156. }
  157. .price {
  158. .unit {
  159. color: rgba(102, 102, 102, 100);
  160. font-size: 28rpx;
  161. margin-left: 8rpx;
  162. }
  163. }
  164. }
  165. .unitPrice-serviceCharge {
  166. float: right;
  167. font-size: 24rpx;
  168. color: #888888;
  169. }
  170. }
  171. }
  172. }
  173. .hint{
  174. width: 100%;
  175. text-align: center;
  176. color: #999999;
  177. font-size: 24rpx;
  178. position: absolute;
  179. bottom: 24rpx;
  180. left: 0;
  181. }
  182. .tabs-box{
  183. width: 90% !important;
  184. }
  185. </style>