chargingPileDetails.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820
  1. <template>
  2. <view>
  3. <view v-show="step==1">
  4. <ujp-navbar title="费用说明页" :custom-back="customback2" ref="ujpnavbar" >
  5. </ujp-navbar>
  6. <view class="main2">
  7. <view class="item">
  8. <view class="title">
  9. 充电枪编号
  10. </view>
  11. <view class="content">
  12. {{gun.gunNo}}
  13. </view>
  14. </view>
  15. <view class="item">
  16. <view class="title">
  17. 充电枪名称-充电枪类型
  18. </view>
  19. <view class="content">
  20. {{detail.name}}-{{detail.interfaceType}}{{detail.chargingType}}
  21. </view>
  22. </view>
  23. <view class="item">
  24. <view class="title">
  25. 充电枪功率
  26. </view>
  27. <view class="content">
  28. {{detail.chargingPower}}kW
  29. </view>
  30. </view>
  31. <view class="item" @click="priceDetail" v-if="price">
  32. <view class="title">
  33. 电费+服务费
  34. <view class="iconfont more">
  35. &#xe600;
  36. </view>
  37. </view>
  38. <view class="content">
  39. 当前时段:{{price.startTime}}~{{price.endTime}} 费用为<span style="color: #00b962;">{{price.costPrice.toFixed(2)}} </span>元/度
  40. <span v-if="station.giveDiscount">(含电费{{price.electricityPrice.toFixed(2)}}元/度 + 服务费{{price.discountServicePrice.toFixed(2)}}元/度(折前价{{price.servicePrice.toFixed(2)}}元/度))</span>
  41. <span v-if="!station.giveDiscount">(含电费{{price.electricityPrice.toFixed(2)}}元/度 + 服务费{{price.servicePrice.toFixed(2)}}元/度)</span>
  42. </view>
  43. </view>
  44. <view class="item" v-if="station.parkingDescription" >
  45. <view class="title">
  46. 停车费用
  47. </view>
  48. <view class="content" v-html="station.parkingSimpleDescription?station.parkingSimpleDescription:station.parkingDescription">
  49. </view>
  50. </view>
  51. </view>
  52. </view >
  53. <view v-show="step==0">
  54. <ujp-navbar title="充电枪详情" :custom-back="customback">
  55. <view class="iconfont service" @click="openModal">
  56. &#xe60d;
  57. </view>
  58. </ujp-navbar>
  59. <!-- 未插枪提示 -->
  60. <!-- <u-alert-tips type="warning" v-if="!isInsert" :description="description" :show-icon="true"></u-alert-tips>
  61. -->
  62. <view class="main">
  63. <view class="main-head">
  64. <view class="text" v-if="haveLock&&lockStatus==1">
  65. <view class="text-1">
  66. 请下降地锁
  67. </view>
  68. <view class="text-2">
  69. 请在<span style="color:red">{{lockSafeStopTime}}秒</span>内停车入位,以免地锁抬升对您的爱车造成损伤。
  70. </view>
  71. </view>
  72. <view class="text" v-else >
  73. <view class="text-1">
  74. {{isInsert?'可充电':'未插枪'}}
  75. </view>
  76. <view class="text-2">
  77. {{isInsert?'充电枪已连接,可进行充电':'未检测到充电枪,若已插枪,请拔出重插'}}
  78. </view>
  79. </view>
  80. <view class="charge-img">
  81. <img src="../../../assets/img/charge.png" alt="">
  82. </view>
  83. </view>
  84. <view class="charging-info">
  85. <view class="address">
  86. {{station.name}}
  87. <!-- <text class="explain" @click="step=1">费用说明</text> -->
  88. </view>
  89. <view class="name">
  90. {{gun.sortNo}}号/{{detail.name}}枪{{gun.channelNo}}
  91. <text class="free" v-if="gunDetail.chargingAppointment&&gunDetail.isMeAppoint">您已预约</text>
  92. <text class="free" v-else-if="gunDetail.chargingAppointment&&!gunDetail.isMeAppoint">已被预约</text>
  93. <text class="free" v-else>{{gun.workStatusText}}</text>
  94. </view>
  95. <view class="price" v-if="price">
  96. <text>{{price.costPrice.toFixed(2)}}</text><text class="unit">元/度</text>
  97. <text class="unit" v-if="station.giveDiscount" >(折前价{{((price.electricityPrice*1000+price.servicePrice*1000)/1000).toFixed(2)}}元/度)</text>
  98. </view>
  99. </view>
  100. </view>
  101. <view class="cost-explain">
  102. <view class="text">
  103. 费用说明
  104. </view>
  105. <view class="iconfont" style="
  106. width: 80px;
  107. text-align: right;
  108. "
  109. @click="step=1">
  110. &#xe600;
  111. </view>
  112. </view>
  113. <!--提示 -->
  114. <view class="tips" v-if="userCardBool" style="margin-bottom: 40rpx;" >
  115. <p class="p">会员活动:</p>
  116. <!-- <view class="content" v-if="!isInsert">
  117. 点击降锁后,请稍等几十秒,待地锁完全下降后,再驶入车位。
  118. </view> -->
  119. <view class="content" :style="canUse?'':'color: red;'" >
  120. {{canUse?'充电服务费月卡':'此充电站不支持月卡服务'}}
  121. </view>
  122. </view>
  123. <!-- 填写车牌后状态 -->
  124. <view class="car">
  125. <view class="car-name">
  126. 入场车辆
  127. </view>
  128. <view class="car-number">
  129. {{car?car.carNum:''}}
  130. <img v-if="!car" @click="carDet(car?car.carNum:'')" src="../../../static/img/riLine-edit-box-line2.svg" alt="">
  131. </view>
  132. </view>
  133. <view class="bottom">
  134. <!-- 解锁中 -->
  135. <!-- <u-button shape="circle" type="success" style="opacity: 0.4;">
  136. 解锁中<img style="margin-left: 4px;" src="../../../static/img/riLine-refresh-line.svg" alt="">
  137. </u-button> -->
  138. <!-- 刷新充电枪状态 -->
  139. <u-button shape="circle" type="success" v-if="gun&&gun.workStatus==2" >充电中</u-button>
  140. <u-button shape="circle" type="success" v-else-if="!openBool" >仅单位内部员工可用</u-button>
  141. <u-button shape="circle" type="success" @click="getPile()" v-else-if="gunDetail.chargingAppointment&&!gunDetail.isMeAppoint" >已被预约</u-button>
  142. <u-button shape="circle" v-else-if="haveLock&&lockStatus==1" @click="lockDown()" style="background-color:#009ED7" type="success">下降地锁</u-button>
  143. <u-button shape="circle" v-else-if="!isInsert" @click="getPile()" type="success">刷新充电枪状态</u-button>
  144. <!-- 开始充电 -->
  145. <u-button shape="circle" type="success" v-else @click="charge" >开始充电</u-button>
  146. </view>
  147. <!--提示 -->
  148. <view class="tips" >
  149. <p class="p">注意事项:</p>
  150. <!-- <view class="content" v-if="!isInsert">
  151. 点击降锁后,请稍等几十秒,待地锁完全下降后,再驶入车位。
  152. </view> -->
  153. <view class="content">
  154. 1.车停好,请熄火后再充电;<br/>
  155. 2.请确保充电枪插接到位;<br/>
  156. 3.车辆充电时,请关闭车内电源;<br/>
  157. 4.充电完毕,请及时拔枪;<br/>
  158. 5.填写车牌号,离场时可减免部分停车费。
  159. </view>
  160. </view>
  161. <!-- 弹窗 -->
  162. <view>
  163. <u-modal v-model="show" @confirm="confirmPhone" :confirm-text="confirmText" confirm-color="#606266"
  164. :show-cancel-button="true" ref="uModal" :asyncClose="true" :title="title" :content="consumerPhone"
  165. :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
  166. </view>
  167. </view>
  168. </view>
  169. </template>
  170. <script>
  171. import * as API_index from '@/apis/index.js'
  172. import * as API from "@/apis/chargeProcess.js"
  173. import {
  174. newDate,
  175. hourDistanceArr,
  176. currentTimeStamp,
  177. parseUnixTime
  178. } from '@/utils'
  179. export default {
  180. data() {
  181. return {
  182. station:{},
  183. step:0,
  184. isInsert:false,
  185. isReady: false,
  186. onShowRole: false,
  187. id: "",
  188. car: {},
  189. isback: false,
  190. gun: {},
  191. prices: {},
  192. price: {},
  193. gunDetail:{},
  194. haveLock :false,
  195. lockSafeStopTime:0,
  196. lockStatus:'',// 1抬锁 2落锁
  197. detail: {
  198. no: '',
  199. interface: '',
  200. type: '',
  201. power: 0,
  202. price: [
  203. ]
  204. },
  205. consumerPhone: "",
  206. description: '充电前请确保您的车辆已与充电桩连接!并关闭车内电源。',
  207. show: false,
  208. title: '联系客服',
  209. showVin:false,
  210. confirmText: '拨打电话',
  211. content: '余额不足5,请先充值。',
  212. carDetText: '',
  213. userCard:null,
  214. canUse:false,
  215. openStatus:0,
  216. isVip:false,
  217. openBoolShow:false,
  218. }
  219. },
  220. computed:{
  221. openBool(){
  222. if(this.openStatus=='3'){
  223. return this.isVip
  224. }
  225. return true
  226. },
  227. userCardBool(){
  228. if(this.userCard){
  229. var date=new Date().getTime()
  230. var reg=new RegExp('-','gi')
  231. var str=this.userCard.endTime;
  232. //console.log(str.replace(reg,'/'))
  233. var date2=new Date(str.replace(reg,'/')).getTime();
  234. if(date<date2){
  235. return true;
  236. }
  237. }
  238. return false
  239. },
  240. },
  241. onShow() {
  242. uni.hideToast();
  243. if (this.onShowRole) {
  244. this.getPile()
  245. }
  246. },
  247. methods: {
  248. lockDown(){
  249. uni.showLoading({
  250. title: "加载中",
  251. mask: true,
  252. })
  253. API.lockDown({
  254. gunId:this.gun.id
  255. }).then((res) => {
  256. uni.hideLoading()
  257. this.lockStatus =res.data.lockStatus
  258. setTimeout(()=>{
  259. this.getPile()
  260. },5*1000)
  261. }).catch(error2 => {
  262. uni.showToast({
  263. title: error2
  264. })
  265. })
  266. },
  267. workStatus2(){
  268. API_index.findChargeData().then((res) => {
  269. var list = res.data.chargingRecordList;
  270. var obj=null;
  271. for (var i = 0; i < list.length; i++) {
  272. if (list[i].deviceNo==this.detail.deviceNo&&list[i].channelNo==this.gun.channelNo) {
  273. obj=list[i];
  274. break;
  275. }
  276. }
  277. if(obj){
  278. uni.redirectTo({
  279. url:"/pages/searchPile/chargeProcess/dcCharging?id="+obj.id
  280. })
  281. }
  282. }).catch(error => {
  283. uni.showToast({
  284. title: error,
  285. icon: "none"
  286. })
  287. })
  288. },
  289. vinCk(){
  290. if(this.userCard&&this.userCard.vin&&this.gun&&this.gun.vin){
  291. if(this.userCard.vin==this.gun.vin){
  292. return true
  293. }else{
  294. return false
  295. }
  296. }else{
  297. return true
  298. }
  299. },
  300. priceDetail(){
  301. uni.navigateTo({
  302. url:'chargePriceDetails?stationId='+this.detail.stationId+"&type="+this.detail.type+"&id="+this.detail.id
  303. })
  304. },
  305. customback2(){
  306. this.step=0;
  307. },
  308. customback(){
  309. if(this.isback){
  310. if(this.$refs.ujpnavbar){
  311. this.$refs.ujpnavbar.navberBack()
  312. }else{
  313. uni.navigateBack({
  314. })
  315. }
  316. }else{
  317. uni.reLaunch({
  318. url:"/pages/login/welcome"
  319. })
  320. }
  321. },
  322. carDet(t){
  323. this.onShowRole = true
  324. if(false){
  325. }else{
  326. uni.navigateTo({
  327. url: "/pages/user/car/carDet?jpcode=jp_team51_charge_id:A_" + this.id
  328. })
  329. }
  330. },
  331. openModal() {
  332. this.show = true;
  333. },
  334. confirmPhone() {
  335. this.show = false;
  336. uni.makePhoneCall({
  337. phoneNumber: this.consumerPhone //仅为示例
  338. });
  339. },
  340. role() {
  341. },
  342. getUserCard(){
  343. uni.showLoading({
  344. title: "加载中",
  345. mask: true,
  346. })
  347. API.userCard({
  348. stationId:this.detail.stationId
  349. }).then((res2) => {
  350. uni.hideLoading()
  351. console.log(res2)
  352. this.userCard=res2.data.regUserCard
  353. this.canUse=res2.data.canUse
  354. //this.user = res.data
  355. if(this.userCardBool){
  356. //检查vin码
  357. }
  358. }).catch(error2 => {
  359. uni.showToast({
  360. title: error2
  361. })
  362. })
  363. },
  364. getPile() {
  365. uni.showLoading({
  366. title: "加载中",
  367. mask: true,
  368. })
  369. API.chargingDeviceGunDetail({
  370. gunNo: this.id,
  371. jpcode: "jp_team51_charge_id:A_" + this.id
  372. }).then((res) => {
  373. uni.hideLoading()
  374. this.gunDetail= res.data;
  375. this.detail = res.data.device
  376. this.station = res.data.station
  377. this.prices = res.data.prices
  378. this.price=res.data.price
  379. this.gun = res.data.gun
  380. this.car = res.data.car
  381. this.lockStatus=res.data.lockStatus;
  382. this.haveLock=res.data.haveLock;
  383. this.lockSafeStopTime=res.data.lockSafeStopTime
  384. this.isVip=res.data.isVip
  385. this.openStatus=res.data.station.openStatus
  386. this.isInsert=this.gun.insertStatus
  387. if(!this.openBool){
  388. //this.openBoolShow=true;
  389. uni.showModal({
  390. title:"提示",
  391. content: "当前设备仅单位内部员工可用,如有问题可联系客服",
  392. showCancel: false,
  393. success: () => {
  394. }
  395. })
  396. }
  397. this.role()
  398. if (res.data.chargingAppointment) {
  399. if (res.data.isMeAppoint) {
  400. this.getUserCard();
  401. } else {
  402. var chargingAppointment = res.data.chargingAppointment
  403. var data = newDate(chargingAppointment.createTime).getTime()
  404. var c = hourDistanceArr(new Date(), new Date(data + chargingAppointment
  405. .reserveMinutes * 60 * 1000))
  406. var description = '当前充电枪已被其他车主预约,' + c[1] + '分' + c[2] + "秒后预约自动失效。";
  407. this.isReady = false;
  408. uni.showModal({
  409. title:"提示",
  410. content: description,
  411. showCancel: false,
  412. success: () => {
  413. }
  414. })
  415. }
  416. }else{
  417. this.getUserCard();
  418. }
  419. if(this.gun.workStatus==2){
  420. this.workStatus2()
  421. }
  422. }).catch(error => {
  423. uni.hideLoading()
  424. uni.showModal({
  425. title:"提示",
  426. content: "设备扫码异常",
  427. confirmText:"前往首页",
  428. showCancel: false,
  429. success: () => {
  430. uni.reLaunch({
  431. url:"/pages/index/index"
  432. })
  433. }
  434. })
  435. // uni.showToast({
  436. // title: error
  437. // })
  438. })
  439. },
  440. charge() {
  441. //this.role()
  442. var url='/pages/searchPile/chargeProcess/charge?stationId=' + this.detail.stationId +
  443. '&deviceNo=' + this.detail.deviceNo + "&gun=" + this.gun.channelNo + "&carNumber=" + (
  444. this.car ? this.car.carNum : '');
  445. uni.navigateTo({
  446. url: url
  447. })
  448. },
  449. isInsertBtn(){
  450. this.isInsert=true;
  451. }
  452. },
  453. onReady() {
  454. var consumerPhone = this.carhelp.getConfig().consumerPhone
  455. // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
  456. if (consumerPhone) {
  457. this.consumerPhone = consumerPhone
  458. }
  459. var carDetText = this.carhelp.getConfig().carDet
  460. // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
  461. if (carDetText) {
  462. this.carDetText = carDetText
  463. }
  464. },
  465. onLoad(op) {
  466. if (op.isback) {
  467. this.isback = true
  468. }
  469. if (op.id) {
  470. this.id = op.id
  471. //this.carhelp.setGunId(op.id)
  472. this.getPile()
  473. } else {
  474. uni.showToast({
  475. title: "请扫码充电"
  476. })
  477. }
  478. }
  479. }
  480. </script>
  481. <style lang="scss">
  482. .oldTextClassF{
  483. .tips{
  484. padding: 36rpx;
  485. .p{
  486. font-size: 42rpx!important;
  487. }
  488. .content{
  489. font-size: 34rpx !important;
  490. }
  491. }
  492. .bottom {
  493. .u-btn {
  494. font-size: 48rpx
  495. }
  496. }
  497. .text-1{
  498. font-size: 56rpx !important;
  499. }
  500. .text-2 {
  501. font-size: 38rpx !important;
  502. }
  503. .charging-info{
  504. .name {
  505. font-size: 36rpx!important;
  506. .free {
  507. font-weight: bold;
  508. font-size:36rpx!important;
  509. }
  510. }
  511. .address {
  512. font-size: 44rpx;
  513. font-weight: bold;
  514. }
  515. .price {
  516. font-weight: bold;
  517. font-size: 60rpx!important;
  518. .unit {
  519. font-weight: normal;
  520. font-size: 36rpx!important;
  521. }
  522. }
  523. }
  524. }
  525. page {
  526. background-color: #F6F8F8;
  527. padding-bottom: 100px;
  528. }
  529. .service {
  530. font-size: 24px;
  531. color: #101010;
  532. position: absolute;
  533. right: 16px;
  534. }
  535. .main2{
  536. background-color: #fff;
  537. padding-left: 16px;
  538. .item{
  539. border-bottom: 1px solid #e5e7ea;
  540. padding: 16px 0 ;
  541. .title{
  542. line-height: 16px;
  543. color: rgba(119, 119, 119, 100);
  544. font-size: 16px;
  545. .more{
  546. font-size: 24px;
  547. color: #b3b3b3;
  548. float: right;
  549. margin-right: 8px;
  550. }
  551. }
  552. .content{
  553. line-height: 24px;
  554. color: rgba(16, 16, 16, 100);
  555. font-size: 16px;
  556. margin-top: 8px;
  557. padding-right: 30px;
  558. }
  559. }
  560. }
  561. .main {
  562. padding: 40rpx 40rpx 24rpx 40rpx;
  563. background-image: linear-gradient(#D6EEDC, #F6F8F8);
  564. .text-1 {
  565. color: rgba(0, 170, 90, 100);
  566. font-size: 48rpx;
  567. line-height: 33px;
  568. }
  569. .text-2 {
  570. color: rgba(102, 102, 102, 100);
  571. font-size: 32rpx;
  572. line-height: 22px;
  573. }
  574. .charging-info {
  575. background-color: #fff;
  576. margin: 0px auto ;
  577. border-radius: 12px;
  578. padding:20rpx 38rpx ;
  579. .name {
  580. margin-top: 8rpx;
  581. color: #777777;
  582. font-size: 32rpx;
  583. .free {
  584. display: inline-block;
  585. width: 72px;
  586. height: 20px;
  587. line-height: 20px;
  588. border-radius: 50px;
  589. background-color: rgba(208, 246, 228, 100);
  590. color: rgba(0, 185, 98, 100);
  591. font-size: 28rpx;
  592. text-align: center;
  593. margin-left: 12px;
  594. }
  595. }
  596. .price {
  597. color: rgba(0, 185, 98, 100);
  598. font-size: 56rpx;
  599. margin-top: 0rpx;
  600. .unit {
  601. font-size: 32rpx;
  602. color: #666666;
  603. margin-left: 4px;
  604. }
  605. }
  606. .address {
  607. color:#333333;
  608. font-size: 40rpx;
  609. .explain {
  610. line-height: 22px;
  611. color: rgba(22, 119, 255, 100);
  612. font-size: 32rpx;
  613. float: right;
  614. }
  615. }
  616. }
  617. }
  618. .main-head{
  619. display: flex;
  620. justify-content: space-between;
  621. }
  622. .charge-img{
  623. width: 80px;
  624. overflow: hidden;
  625. height: 80px;
  626. // margin-right: 16rpx;
  627. img{
  628. width: 100%;
  629. }
  630. }
  631. // 费用说明
  632. .cost-explain{
  633. margin: 0px 40rpx 24rpx 40rpx;
  634. padding: 40rpx;
  635. background-color: #fff;
  636. border-radius: 12px;
  637. display: flex;
  638. justify-content: space-between;
  639. align-items: center;
  640. .text{
  641. font-size: 36rpx;
  642. color: #101010;
  643. }
  644. .iconfont{
  645. color: #b3b3b3;
  646. font-size: 48rpx
  647. }
  648. }
  649. .tips {
  650. background-color: #fff;
  651. padding: 40rpx;
  652. margin: 8rpx 40rpx 0 40rpx;
  653. border-radius: 12px;
  654. .p {
  655. line-height: 25px;
  656. color: #333333;
  657. font-size: 32rpx;
  658. font-weight: 550;
  659. }
  660. .content {
  661. margin-top: 16rpx;
  662. line-height: 22px;
  663. color: #666666;
  664. font-size: 28rpx;
  665. }
  666. }
  667. .bottom {
  668. width: 100%;
  669. padding: 28rpx 0;
  670. .u-btn {
  671. margin: 0 40rpx;
  672. line-height: 88rpx;
  673. height: 88rpx;
  674. font-size: 40rpx
  675. }
  676. }
  677. /deep/.u-alert-desc {
  678. color: rgba(255, 115, 0, 100);
  679. font-size: 16px
  680. }
  681. // 入场车辆
  682. .car {
  683. background-color: #fff;
  684. margin: 0 40rpx;
  685. border-radius: 12px;
  686. padding:38rpx 40rpx;
  687. display: flex;
  688. justify-content: space-between;
  689. font-size: 36rpx;
  690. .car-number{
  691. display: flex;
  692. }
  693. img {
  694. vertical-align: middle;
  695. }
  696. }
  697. </style>