chargingPileDetails.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <template>
  2. <view>
  3. <view v-show="step==1">
  4. <ujp-navbar title="费用说明页" :custom-back="customback2">
  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">
  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}} 费用为{{price.costPrice}} 元/度(含电费{{price.electricityPrice}}元/度 + 服务费{{price.servicePrice}}元/度)
  40. </view>
  41. </view>
  42. <view class="item" v-if="false">
  43. <view class="title">
  44. 停车费用
  45. </view>
  46. <view class="content">
  47. 充电免停2小时停车费(临牌车不享受免停)
  48. </view>
  49. </view>
  50. </view>
  51. </view >
  52. <view v-show="step==0">
  53. <ujp-navbar title="充电枪详情" :custom-back="customback">
  54. <view class="iconfont service" @click="openModal">
  55. &#xe60d;
  56. </view>
  57. </ujp-navbar>
  58. <!-- 未插枪提示 -->
  59. <u-alert-tips type="warning" v-if="!isInsert" :description="description" :show-icon="true"></u-alert-tips>
  60. <view class="main">
  61. <view class="text-1">
  62. {{isInsert?'可充电':'未插枪'}}
  63. </view>
  64. <view class="text-2">
  65. {{isInsert?'充电枪已连接,可进行充电':'未检测到充电枪,若已插枪,请拔出重插'}}
  66. </view>
  67. <view class="charging-info">
  68. <view class="name">
  69. {{detail.name}}/充电枪{{gun.channelNo>9?gun.channelNo:'0'+gun.channelNo}}
  70. <text class="free" v-if="gunDetail.chargingAppointment&&gunDetail.isMeAppoint">您已预约</text>
  71. <text class="free" v-else-if="gunDetail.chargingAppointment&&!gunDetail.isMeAppoint">已被预约</text>
  72. <text class="free" v-else>{{gun.workStatusText}}</text>
  73. </view>
  74. <view class="price">
  75. <text>{{price.costPrice}}</text><text class="unit">元/度</text>
  76. </view>
  77. <view class="address">
  78. {{detail.stationAddress}}
  79. <text class="explain" @click="step=1">费用说明</text>
  80. </view>
  81. </view>
  82. </view>
  83. <!--提示 -->
  84. <view class="tips" >
  85. <p class="p">提示:</p>
  86. <!-- <view class="content" v-if="!isInsert">
  87. 点击降锁后,请稍等几十秒,待地锁完全下降后,再驶入车位。
  88. </view> -->
  89. <view class="content">
  90. {{carDetText}}
  91. </view>
  92. </view>
  93. <!-- 入场车辆 -->
  94. <!-- 未填写车牌状态 -->
  95. <view class="car" v-if="false">
  96. <view class="car-name">
  97. 入场车辆
  98. </view>
  99. <input type="text" placeholder="填写车牌号减免停车费">
  100. </view>
  101. <!-- 填写车牌后状态 -->
  102. <view class="car">
  103. <view class="car-name">
  104. 入场车辆
  105. </view>
  106. <view class="car-number">
  107. {{car?car.carNum:''}}
  108. <img @click="carDet(car?car.carNum:'')" src="../../../static/img/riLine-edit-box-line Copy.svg" alt="">
  109. </view>
  110. </view>
  111. <view class="bottom">
  112. <!-- 解锁中 -->
  113. <!-- <u-button shape="circle" type="success" style="opacity: 0.4;">
  114. 解锁中<img style="margin-left: 4px;" src="../../../static/img/riLine-refresh-line.svg" alt="">
  115. </u-button> -->
  116. <!-- 刷新充电枪状态 -->
  117. <u-button shape="circle" type="success" @click="getPile()" v-if="gunDetail.chargingAppointment&&!gunDetail.isMeAppoint" >已被预约</u-button>
  118. <u-button shape="circle" v-else-if="!isInsert" @click="getPile()" type="success">刷新充电枪状态</u-button>
  119. <!-- 开始充电 -->
  120. <u-button shape="circle" type="success" v-else @click="charge" >开始充电</u-button>
  121. </view>
  122. <!-- 弹窗 -->
  123. <view>
  124. <u-modal v-model="show" @confirm="confirmPhone" :confirm-text="confirmText" confirm-color="#606266"
  125. :show-cancel-button="true" ref="uModal" :asyncClose="true" :title="title" :content="consumerPhone"
  126. :content-style="{fontSize: '24px',color: '#101010'}"></u-modal>
  127. </view>
  128. </view>
  129. </view>
  130. </template>
  131. <script>
  132. import * as API from "@/apis/chargeProcess.js"
  133. import {
  134. hourDistanceArr,
  135. currentTimeStamp,
  136. parseUnixTime
  137. } from '@/utils'
  138. export default {
  139. data() {
  140. return {
  141. step:0,
  142. isInsert:false,
  143. isReady: false,
  144. onShowRole: false,
  145. id: "",
  146. car: {},
  147. isback: false,
  148. gun: {},
  149. prices: {},
  150. price: {},
  151. gunDetail:{},
  152. detail: {
  153. no: '',
  154. interface: '',
  155. type: '',
  156. power: 0,
  157. price: [
  158. ]
  159. },
  160. consumerPhone: "",
  161. description: '温馨提示:充电前请确保您的车辆已与充电桩连接!并关闭车内电源。',
  162. show: false,
  163. title: '联系客服',
  164. confirmText: '拨打电话',
  165. content: '余额不足5,请先充值。',
  166. carDetText: '',
  167. }
  168. },
  169. onShow() {
  170. uni.hideToast();
  171. if (this.onShowRole) {
  172. this.getPile()
  173. }
  174. },
  175. methods: {
  176. priceDetail(){
  177. uni.navigateTo({
  178. url:'chargePriceDetails?stationId='+this.detail.stationId+"&type="+this.detail.type+"&id="+this.detail.id
  179. })
  180. },
  181. customback2(){
  182. this.step=0;
  183. },
  184. customback(){
  185. if(this.isback){
  186. uni.navigateBack({
  187. })
  188. }else{
  189. uni.reLaunch({
  190. url:"/pages/login/welcome"
  191. })
  192. }
  193. },
  194. carDet(t){
  195. this.onShowRole = true
  196. if(t){
  197. uni.navigateTo({
  198. url: "/pages/user/car/index?jpcode=jp_team51_charge_id:A_" + this.id
  199. })
  200. }else{
  201. uni.navigateTo({
  202. url: "/pages/user/car/carDet?jpcode=jp_team51_charge_id:A_" + this.id
  203. })
  204. }
  205. },
  206. openModal() {
  207. this.show = true;
  208. },
  209. confirmPhone() {
  210. this.show = false;
  211. uni.makePhoneCall({
  212. phoneNumber: this.consumerPhone //仅为示例
  213. });
  214. },
  215. role() {
  216. },
  217. getPile() {
  218. uni.showLoading({
  219. title: "加载中",
  220. mask: true,
  221. })
  222. API.chargingDeviceGunDetail({
  223. gunNo: this.id,
  224. jpcode: "jp_team51_charge_id:A_" + this.id
  225. }).then((res) => {
  226. this.gunDetail= res.data;
  227. this.detail = res.data.device
  228. this.prices = res.data.prices
  229. this.price=res.data.price
  230. this.gun = res.data.gun
  231. this.car = res.data.car
  232. this.isInsert=this.gun.insertStatus
  233. this.role()
  234. if (res.data.chargingAppointment) {
  235. if (res.data.isMeAppoint) {
  236. } else {
  237. var chargingAppointment = res.data.chargingAppointment
  238. var data = new Date(chargingAppointment.createTime).getTime()
  239. var c = hourDistanceArr(new Date(), new Date(data + chargingAppointment
  240. .reserveMinutes * 60 * 1000))
  241. var description = '当前充电枪已被其他车主预约,' + c[1] + '分' + c[2] + "秒后预约自动失效。";
  242. this.isReady = false;
  243. uni.showModal({
  244. title:"提示",
  245. content: description,
  246. showCancel: false,
  247. success: () => {
  248. }
  249. })
  250. }
  251. }
  252. uni.hideLoading()
  253. }).catch(error => {
  254. uni.showToast({
  255. title: error
  256. })
  257. })
  258. },
  259. charge() {
  260. //this.role()
  261. uni.navigateTo({
  262. url: '/pages/searchPile/chargeProcess/charge?stationId=' + this.detail.stationId +
  263. '&deviceNo=' + this.detail.deviceNo + "&gun=" + this.gun.channelNo + "&carNumber=" + (
  264. this.car ? this.car.carNum : '')
  265. })
  266. },
  267. isInsertBtn(){
  268. this.isInsert=true;
  269. }
  270. },
  271. onReady() {
  272. var consumerPhone = this.carhelp.getConfig().consumerPhone
  273. // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
  274. if (consumerPhone) {
  275. this.consumerPhone = consumerPhone
  276. }
  277. var carDetText = this.carhelp.getConfig().carDet
  278. // img="https://yktwechat.xiaoxinda.com/config/xxd2021.jpg"
  279. if (carDetText) {
  280. this.carDetText = carDetText
  281. }
  282. },
  283. onLoad(op) {
  284. if (op.isback) {
  285. this.isback = true
  286. }
  287. if (op.id) {
  288. this.id = op.id
  289. //this.carhelp.setGunId(op.id)
  290. this.getPile()
  291. } else {
  292. uni.showToast({
  293. title: "请扫码充电"
  294. })
  295. }
  296. }
  297. }
  298. </script>
  299. <style lang="scss">
  300. page {
  301. background-color: #F6F8F8;
  302. padding-bottom: 100px;
  303. }
  304. .service {
  305. font-size: 24px;
  306. color: #101010;
  307. position: absolute;
  308. right: 16px;
  309. }
  310. .main2{
  311. background-color: #fff;
  312. padding-left: 16px;
  313. .item{
  314. border-bottom: 1px solid #e5e7ea;
  315. padding: 16px 0 ;
  316. .title{
  317. line-height: 16px;
  318. color: rgba(119, 119, 119, 100);
  319. font-size: 16px;
  320. .more{
  321. font-size: 24px;
  322. color: #b3b3b3;
  323. float: right;
  324. margin-right: 8px;
  325. }
  326. }
  327. .content{
  328. line-height: 24px;
  329. color: rgba(16, 16, 16, 100);
  330. font-size: 16px;
  331. margin-top: 8px;
  332. padding-right: 30px;
  333. }
  334. }
  335. }
  336. .main {
  337. padding: 28px 20px;
  338. background-image: linear-gradient(#D6EEDC, #F6F8F8);
  339. .text-1 {
  340. color: rgba(0, 170, 90, 100);
  341. font-size: 24px;
  342. line-height: 33px;
  343. }
  344. .text2 {
  345. color: rgba(102, 102, 102, 100);
  346. font-size: 16px;
  347. line-height: 22px;
  348. }
  349. .charging-info {
  350. background-color: #fff;
  351. margin: 20px auto 0;
  352. border-radius: 12px;
  353. padding: 20px;
  354. .name {
  355. line-height: 23px;
  356. color: rgba(16, 16, 16, 100);
  357. font-size: 18px;
  358. .free {
  359. display: inline-block;
  360. width: 72px;
  361. height: 20px;
  362. line-height: 20px;
  363. border-radius: 50px;
  364. background-color: rgba(208, 246, 228, 100);
  365. color: rgba(0, 185, 98, 100);
  366. font-size: 14px;
  367. text-align: center;
  368. margin-left: 12px;
  369. }
  370. }
  371. .price {
  372. color: rgba(0, 185, 98, 100);
  373. font-size: 28px;
  374. margin-top: 12px;
  375. .unit {
  376. font-size: 16px
  377. }
  378. }
  379. .address {
  380. line-height: 23px;
  381. color: rgba(102, 102, 102, 100);
  382. font-size: 16px;
  383. margin-top: 12px;
  384. .explain {
  385. line-height: 22px;
  386. color: rgba(22, 119, 255, 100);
  387. font-size: 16px;
  388. float: right;
  389. }
  390. }
  391. }
  392. }
  393. .tips {
  394. background-color: #fff;
  395. margin: 0 20px;
  396. border-radius: 12px;
  397. padding: 20px;
  398. .p {
  399. line-height: 25px;
  400. color: rgba(16, 16, 16, 100);
  401. font-size: 18px;
  402. }
  403. .content {
  404. margin-top: 8px;
  405. line-height: 22px;
  406. color: rgba(102, 102, 102, 100);
  407. font-size: 16px;
  408. }
  409. }
  410. .bottom {
  411. background-color: #fff;
  412. width: 100%;
  413. padding: 12px 0;
  414. position: fixed;
  415. bottom: 0;
  416. left: 0;
  417. .u-btn {
  418. width: 91.4%
  419. }
  420. }
  421. /deep/.u-alert-desc {
  422. color: rgba(255, 115, 0, 100);
  423. font-size: 16px
  424. }
  425. // 入场车辆
  426. .car {
  427. background-color: #fff;
  428. margin: 20px;
  429. border-radius: 12px;
  430. padding: 20px;
  431. display: flex;
  432. justify-content: space-between;
  433. font-size: 18px;
  434. img {
  435. vertical-align: middle;
  436. }
  437. }
  438. </style>