details.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678
  1. <template>
  2. <view class="time-head">
  3. <ujp-navbar title="充电详情">
  4. <view slot="right" style="margin-right: 10px;" @click="openModalBl=true">
  5. <view class="iconfont qr-code">
  6. &#xe60d;
  7. </view>
  8. </view>
  9. </ujp-navbar>
  10. <u-modal v-model="openModalBl" @confirm="confirmPhoneBl" confirm-text="拨打电话" confirm-color="#606266"
  11. :show-cancel-button="true" ref="uModal" :asyncClose="true" title="客服电话" :content="consumerPhone"
  12. :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
  13. <view class="details-time">
  14. <view class="time">
  15. <view class="time1">
  16. <view class="time11">
  17. {{getday(chargeDetail.startTime?chargeDetail.startTime:chargeDetail.createTime)}}</view>
  18. <view class="time12">{{geth(chargeDetail.startTime?chargeDetail.startTime:chargeDetail.createTime)}}
  19. </view>
  20. </view>
  21. <view class="time2">
  22. <view class="time21">起</view>
  23. <view class="time22"></view>
  24. <view class="time21">止</view>
  25. </view>
  26. <view class="time1">
  27. <view class="time11">{{getday(chargeDetail.endTime)}}</view>
  28. <view class="time12">{{geth(chargeDetail.endTime)}}</view>
  29. </view>
  30. </view>
  31. <view class="oldTextjp18px">
  32. <view class="details-row">
  33. <p>充电时长</p>
  34. <span>{{chargeDetail.chargingMinute != null ? getPercent(chargeDetail.chargingMinute) : '0秒'}}</span>
  35. </view>
  36. <view class="details-row">
  37. <p>充电度数</p>
  38. <span>{{chargeDetail.electricQuantity != null ? chargeDetail.electricQuantity/10000 : '0.000'}}度</span>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="details" style="padding: 20rpx;" v-show="electricRecordListBl">
  43. <view id="pieEcharts" style="min-height:180px;">
  44. </view>
  45. <view style="color:#9e9e9e;margin-top: 4px;">注:充电时间每5分钟获取一次数据</view>
  46. </view>
  47. <view class="details">
  48. <view class="details-title">
  49. <h4 class="oldTextjp20px" oldstyle="font-size: 20px;">费用信息</h4>
  50. </view>
  51. <view class="oldTextjp18px" oldstyle="font-size: 18px;">
  52. <view class="details-row">
  53. <p>订单总额</p><span>{{chargeDetail.dueFee != null ? chargeDetail.dueFee.toFixed(2) : '0.00'}}元</span>
  54. </view>
  55. <view class="details-row">
  56. <p>电费</p>
  57. <span>{{chargeDetail.totalElecMoney != null ? chargeDetail.totalElecMoney.toFixed(2) : '0.00'}}元</span>
  58. </view>
  59. <view class="details-row">
  60. <p>服务费</p>
  61. <span>{{chargeDetail.totalServiceMoney != null ? chargeDetail.totalServiceMoney.toFixed(2) : '0.00'}}元</span>
  62. </view>
  63. <view class="details-row"
  64. v-if="chargeDetail.serviceDiscountRatio&&chargeDetail.serviceDiscountRatio!=100">
  65. <p>折前服务费</p>
  66. <span>{{(chargeDetail.dueServiceMoney?chargeDetail.dueServiceMoney:0).toFixed(2)}}元</span>
  67. </view>
  68. <view class="details-row"
  69. v-if="chargeDetail.serviceDiscountRatio&&chargeDetail.serviceDiscountRatio!=100">
  70. <p>服务费折扣</p><span style="color:#ef7041">{{discountRatio10(chargeDetail.serviceDiscountRatio)}}折</span>
  71. </view>
  72. <view class="details-row">
  73. <p>优惠券抵扣</p><span style="color:#ef7041">{{userCouponObj? userCouponObj.useText : '未使用'}}</span>
  74. </view>
  75. <view class="details-row" v-if="chargeDetail.userCardId">
  76. <p>会员活动</p><span style="color:#ef7041">折扣卡</span>
  77. </view>
  78. <view class="details-row" v-if="chargeDetail.discountAmount">
  79. <p>实际减免</p><span style="color:#ef7041">-{{chargeDetail.discountAmount.toFixed(2)}}元</span>
  80. </view>
  81. <view class="details-row">
  82. <p>实付款</p>
  83. <span style="color:#ef7041;font-size: 20px;" ><b>{{chargeDetail.actualFee != null ? chargeDetail.actualFee.toFixed(2) : '0.00'}}元</b></span>
  84. </view>
  85. <view style=" border-top: dashed 1px #777; margin-top: 10px;">
  86. <view class="details-row"><p>开始时间</p><span style="color:#777777">{{chargeDetail.startTime}}</span></view>
  87. <view class="details-row"><p>结束时间</p><span style="color:#777777">{{chargeDetail.endTime}}</span></view>
  88. </view>
  89. <view class="chargeDetailsClass" style=" border-top: dashed 1px #777; margin-top: 10px;" v-if="chargeDetails.length">
  90. <view v-for="(item,i) in chargeDetails" :key="i" >
  91. <view class="details-row" style=" margin-top: 18px;" >
  92. <p>区间充电量({{item.startTime}}-{{item.endTime}})</p>
  93. <span >{{item.kwh }}度</span>
  94. </view>
  95. <view class="details-row" style="display: block;" >
  96. <p>
  97. <span style=" color: #37393c;">区间定价</span>
  98. <span style="float: right; color: #333;font-weight: normal;" v-if="item.discountServicePrice||item.discountServicePrice==0" >{{((item.electricityPrice*100+item.discountServicePrice*100)/100).toFixed(2)}}元/度 <span style="text-decoration:line-through;margin-left: 3px;">{{((item.electricityPrice*100+item.servicePrice*100)/100).toFixed(2)}}元/度</span></span>
  99. <span style="float: right; color: #333;font-weight: normal;" v-else >{{((item.electricityPrice*100+item.servicePrice*100)/100).toFixed(2)}}元/度</span>
  100. </p>
  101. <span class="details-row-sum" style="float:none" v-if="item.discountServicePrice||item.discountServicePrice==0" >电费{{item.electricityPrice.toFixed(2)}}元/度|服务费{{item.discountServicePrice.toFixed(2)}}元/度(折前{{item.servicePrice.toFixed(2)}}元/度) </span>
  102. <span class="details-row-sum" v-else >{{item.electricityPrice.toFixed(2)}}元/度(电费)+{{item.servicePrice.toFixed(2)}}元/度(服务费) </span>
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. <view class="piccBanner"
  109. v-for="(itemJNT,index ) in bannerListJNT" v-show="index==0"
  110. @click="gotoUrl2(itemJNT.linkUrl)" :key="index"
  111. style="
  112. text-align: center;
  113. padding: 0px 16px;">
  114. <image :src="itemJNT.picUrl" style="height: 204rpx;width: 100%;" ></image>
  115. </view>
  116. <view class="details" style="margin-bottom: 60px;">
  117. <view class="details-title">
  118. <h4 class="oldTextjp20px">更多信息</h4>
  119. </view>
  120. <view class="oldTextjp18px">
  121. <view class="details-row">
  122. <p>结束原因</p><span>{{chargeDetail.remark}}</span>
  123. </view>
  124. <view class="details-row">
  125. <p>订单状态</p><span>{{chargeDetail.statusText}}</span>
  126. </view>
  127. <view class="details-row" v-if="false">
  128. <p>更新时间</p><span>{{chargeDetail.updateTime}}</span>
  129. </view>
  130. <view class="details-row">
  131. <p>充电站点</p><span>{{chargeDetail.stationName}}</span>
  132. </view>
  133. <view class="details-row">
  134. <p>充电桩编号</p><span>{{chargeDetail.deviceName}}</span>
  135. </view>
  136. <view class="details-row">
  137. <p>充电车辆</p><span>{{chargeDetail.carNumber}}</span>
  138. </view>
  139. </view>
  140. </view>
  141. <view class="buttonClass" >
  142. <u-button size="medium" class="detailsBtn-btn " :customStyle="customStyle" type="info" shape="circle"
  143. @click="openModalBl=true">
  144. <view class="iconfont ">
  145. &#xe60d;
  146. </view>
  147. 联系客服</u-button>
  148. <u-button class="detailsBtn-btn " size="medium" type="success" shape="circle"
  149. @click="gotoUrl('pages/user/message')">填写反馈意见</u-button>
  150. </view>
  151. </view>
  152. </template>
  153. <script>
  154. import * as API from '@/apis/index.js'
  155. import * as echarts from "echarts";
  156. import * as newsApi from '@/apis/news.js'
  157. export default {
  158. data() {
  159. return {
  160. id: '',
  161. myChart: null,
  162. electricRecordList: [],
  163. chargeDetail: {},
  164. chargeDetails:[],
  165. bannerListJNT:[],
  166. userCouponObj: {},
  167. electricRecordListBl: true,
  168. elderStatus: false,
  169. consumerPhone: "",
  170. openModalBl: false,
  171. customStyle:{
  172. color: '#00B962'
  173. }
  174. }
  175. },
  176. onLoad(op) {
  177. if (op.id) {
  178. this.id = op.id;
  179. this.getchargingDetail();
  180. }
  181. if (this.carhelp.get("getElderModeClass") == "长辈模式") {
  182. this.elderStatus = true;
  183. } else {
  184. this.elderStatus = false;
  185. }
  186. var consumerPhone = "400-8899-619"
  187. // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
  188. if (consumerPhone) {
  189. this.consumerPhone = consumerPhone
  190. }
  191. this.getBannerInfo("JNT","bannerListJNT");
  192. },
  193. methods: {
  194. getBannerInfo(code,list) {
  195. newsApi.getBannerInfo(code).then((res) => {
  196. if(list){
  197. this[list] = res.data;
  198. }else{
  199. this.bannerList = res.data;
  200. }
  201. //uni.hideLoading()
  202. //document.getElementsByClassName("uni-swiper-wrapper")[0].parentNode.style="background-color: rgb(255, 255, 255); height: 120px;"
  203. }).catch(error => {
  204. uni.showToast({
  205. title: error,
  206. icon: "none"
  207. })
  208. })
  209. },
  210. confirmPhoneBl() {
  211. this.openModalBl = false;
  212. uni.makePhoneCall({
  213. phoneNumber: this.consumerPhone //仅为示例
  214. });
  215. },
  216. getday(time) {
  217. if (time) {
  218. return time.substring(5, 10).replace('-', '月') + '日'
  219. } else
  220. return ''
  221. },
  222. geth(time) {
  223. if (time) {
  224. return time.substring(11, 16)
  225. } else
  226. return ''
  227. },
  228. getPercent(estimateMinute) {
  229. var value = "";
  230. var ms = estimateMinute
  231. if (ms > 0) {
  232. var Hour = parseInt(Math.floor(ms / 60));
  233. var Fen = parseInt(Math.floor(ms % 60));
  234. // value = Hour + "小时" + Fen+"分钟"
  235. if (Hour) {
  236. value += Hour + "小时"
  237. }
  238. if (Fen) {
  239. value += Fen + "分钟"
  240. }
  241. } else {
  242. value = "0分钟"
  243. }
  244. return value;
  245. },
  246. toHome() {
  247. uni.navigateTo({
  248. url: '/pages/index/index'
  249. })
  250. },
  251. getPie(data) {
  252. if (!this.myChart) {
  253. this.myChart = echarts.init(document.getElementById('pieEcharts'));
  254. // this.myChart.on("dataZoom", (res) => {
  255. // showkey = "";
  256. // this.headitemby = "";
  257. // });
  258. }
  259. var timeList = []
  260. var seriesList1 = []
  261. var seriesList2 = []
  262. var seriesList3 = []
  263. //var sz2 = ['soc', 'power', 'ampere', 'voltage','temperature'];
  264. console.log(data)
  265. var dataInterval = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
  266. for (var i in data) {
  267. var item = data[i]
  268. timeList.push(this.geth(item.recordTime));
  269. seriesList1.push(item.soc ? item.soc : '')
  270. seriesList2.push(item.power ? (item.power / 1000).toFixed(1) : '')
  271. //seriesList3.push(item.temperature?item.temperature:0)
  272. seriesList3.push(item.temperature ? item.temperature : '')
  273. }
  274. var spaceNum = 5
  275. let maxA = Math.max(...seriesList2); // 最大值A
  276. let maxint = Math.ceil(maxA / spaceNum); //最大平均值(向上取整)= 最大值A / 间隔数
  277. let maxB = maxint * spaceNum; // 最大值B = 最大平均值 * 间隔数 (注:最大值B>最大值A)
  278. var max = Math.max(maxB, 10); // 为了防止maxB数据为0时,Y轴不显示,给个默认最大值10
  279. var interval = max / spaceNum;
  280. const colors = ['#ea9832', '#429fc8', '#b13331'];
  281. var option = {
  282. color: colors,
  283. tooltip: {
  284. formatter: (value) => {
  285. console.log(value)
  286. var name = value[0].axisValue;
  287. var style = "float: right;margin-left: 3px;"
  288. var text1 = ""
  289. var ulist = ['%', 'kW', '℃', '', '', '']
  290. for (var i in value) {
  291. var u = ulist[i];
  292. if (value[i].data == '') {
  293. continue
  294. }
  295. text1 += "<p>" + value[i].marker + value[i].seriesName + '<span style="' + style +
  296. '">' + value[i].data + u + '</span></p>';
  297. }
  298. return `<p>${name}</p>` + text1
  299. },
  300. trigger: 'axis',
  301. },
  302. grid: {
  303. top:'24%',
  304. left: '8%',
  305. right: '10%',
  306. bottom: '10%',
  307. // containLabel: true
  308. },
  309. legend: {
  310. data: ['SOC', '功率', '温度']
  311. },
  312. xAxis: [{
  313. type: 'category',
  314. axisTick: {
  315. alignWithLabel: true
  316. },
  317. splitNumber: 2,
  318. // prettier-ignore
  319. data: timeList
  320. }],
  321. yAxis: [{
  322. type: 'value',
  323. name: '℃/SOC',
  324. //data: [0,10,20,30,40,50,60,70,80,90,100],
  325. max: 100,
  326. min: 0,
  327. minInterval: 10,
  328. position: 'right',
  329. alignTicks: true,
  330. axisLine: {
  331. show: true,
  332. lineStyle: {
  333. color: colors[0]
  334. }
  335. },
  336. axisLabel: {
  337. formatter: '{value}'
  338. }
  339. },
  340. {
  341. type: 'value',
  342. name: 'kW',
  343. position: 'left',
  344. alignTicks: true,
  345. interval: interval,
  346. max: max,
  347. min: 0,
  348. axisLine: {
  349. show: true,
  350. lineStyle: {
  351. color: colors[1]
  352. }
  353. },
  354. axisLabel: {
  355. formatter: '{value}'
  356. }
  357. }
  358. ],
  359. series: [{
  360. name: 'SOC',
  361. type: 'line',
  362. symbolSize: 3,
  363. data: seriesList1
  364. },
  365. {
  366. name: '功率',
  367. type: 'line',
  368. symbolSize: 3,
  369. yAxisIndex: 1,
  370. data: seriesList2
  371. },
  372. {
  373. name: '温度',
  374. type: 'line',
  375. symbolSize: 3,
  376. yAxisIndex: 0,
  377. data: seriesList3
  378. }
  379. ]
  380. };
  381. console.log(option)
  382. this.myChart.setOption(option);
  383. },
  384. getchargingDetail() {
  385. uni.showLoading({
  386. title: "加载中",
  387. mask: true,
  388. })
  389. API.chargingDetail(this.id).then((res) => {
  390. uni.hideLoading();
  391. this.chargeDetail = res.data.chargingRecord;
  392. if(this.chargeDetail.chargeDetails){
  393. this.chargeDetails=JSON.parse(this.chargeDetail.chargeDetails)
  394. }
  395. this.userCouponObj = res.data.userCoupon;
  396. this.electricRecordList = res.data.electricRecordList
  397. if (res.data.electricRecordList && res.data.electricRecordList.length) {
  398. this.getPie(res.data.electricRecordList);
  399. } else {
  400. this.electricRecordListBl = false
  401. }
  402. }).catch(error => {
  403. uni.showToast({
  404. title: error,
  405. icon: "none"
  406. })
  407. })
  408. }
  409. }
  410. }
  411. </script>
  412. <style>
  413. page {
  414. background-color: #F7F7F7;
  415. }
  416. </style>
  417. <style lang="scss" scoped>
  418. .time-head {
  419. background: linear-gradient(180deg, rgba(0, 185, 98, 1) 0%, rgba(246, 248, 248, 1) 240px);
  420. padding-bottom: 20px;
  421. }
  422. .details-time {
  423. background: linear-gradient(180deg, #b7ebcf 0%, rgba(255, 255, 255, 1) 33%);
  424. .time {
  425. display: flex;
  426. justify-content: space-between;
  427. border-bottom: 1px solid #E8E8E8;
  428. padding-bottom: 20rpx;
  429. .time1 {
  430. .time11 {
  431. font-size: 28rpx;
  432. margin-bottom: 4rpx;
  433. }
  434. .time12 {
  435. font-size: 48rpx;
  436. color: #101010;
  437. font-weight: bold;
  438. text-align: center;
  439. }
  440. }
  441. .time2 {
  442. color: #B8B8B8;
  443. align-items: center;
  444. display: flex;
  445. justify-content: space-between;
  446. .time21 {
  447. border: 1px solid #B8B8B8;
  448. border-radius: 100rpx;
  449. line-height: 46rpx;
  450. height: 48rpx;
  451. width: 48rpx;
  452. text-align: center;
  453. }
  454. .time22 {
  455. width: 200rpx;
  456. border-top: 1px solid #CFCFCF;
  457. }
  458. }
  459. }
  460. }
  461. .oldTextClassF {
  462. .oldTextjp18px {
  463. font-size: 36rpx !important;
  464. }
  465. .oldTextjp20px {
  466. font-size: 40rpx !important;
  467. }
  468. }
  469. .detailsBtn {
  470. margin: 16px;
  471. .detailsBtn-btn {
  472. border-color: #00B962 !important;
  473. border-radius: 8px !important;
  474. background: none !important;
  475. color: #00B962 !important;
  476. }
  477. }
  478. .details-title {
  479. margin-bottom: 16px;
  480. h4 {
  481. font-weight: bold;
  482. font-size: 16px;
  483. position: relative;
  484. padding-left: 10px;
  485. &::after {
  486. content: '';
  487. position: absolute;
  488. height: 12px;
  489. width: 4px;
  490. background-color: #27B148;
  491. left: 0;
  492. top: 5px;
  493. }
  494. }
  495. }
  496. .details-row {
  497. display: flex;
  498. justify-content: space-between;
  499. align-items: center;
  500. margin-top: 10px;
  501. p {
  502. color: #333;
  503. //width: 180rpx;
  504. min-width: 80px;
  505. }
  506. span {
  507. color: #101010;
  508. font-weight: bold;
  509. }
  510. }
  511. .chargeDetailsClass{
  512. span {
  513. color: rgb(51, 51, 51);
  514. font-weight: normal;
  515. }
  516. .details-row-sum{
  517. float: right;
  518. color: #888;
  519. font-size: 24rpx;
  520. }
  521. }
  522. .details,
  523. .details-time {
  524. margin: 32rpx;
  525. padding: 40rpx;
  526. background-color: #fff;
  527. border-radius: 8px;
  528. box-shadow: 0px 2px 6px 0px #00b96226;
  529. border: 1px solid rgba(255, 255, 255, 1);
  530. .details-head {
  531. display: flex;
  532. align-items: center;
  533. justify-content: center;
  534. h4 {
  535. font-size: 18px;
  536. font-weight: normal;
  537. margin-left: 4px;
  538. }
  539. }
  540. .details-price {
  541. margin-top: 28px;
  542. display: flex;
  543. align-items: flex-end;
  544. justify-content: center;
  545. h3 {
  546. font-size: 36px;
  547. color: #FF6200;
  548. line-height: 36px;
  549. margin: 0 4px;
  550. font-weight: normal;
  551. }
  552. span {
  553. font-size: 20px;
  554. color: #FF6200;
  555. }
  556. }
  557. .details-main {
  558. text-align: center;
  559. margin-bottom: 20px;
  560. p {
  561. color: #777;
  562. margin-top: 4px;
  563. }
  564. }
  565. }
  566. .qr-code {
  567. font-size: 24px;
  568. color: #666666;
  569. // position: absolute;
  570. right: 16px;
  571. }
  572. .buttonClass{
  573. display: flex;
  574. text-align: center;
  575. position: fixed;
  576. bottom: 0px;
  577. width: 100%;
  578. background: #fff;
  579. padding: 10px 0;
  580. .detailsBtn-btn{
  581. // margin:0 32rpx;
  582. }
  583. }
  584. </style>