reservationListDetails.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484
  1. <template>
  2. <view >
  3. <ujp-navbar title="预约单详情" :custom-back="customback" >
  4. </ujp-navbar>
  5. <!-- <view class="iconfont tittle-font">
  6. &#xe616;
  7. </view> -->
  8. <u-alert-tips type="warning" v-if="detail.status==0" :description="description"></u-alert-tips>
  9. <view class="reverse-time">
  10. <view class="time refused" v-if="detail.status==4||detail.status==5||detail.status==6">
  11. {{detail.statusText}}
  12. </view>
  13. <view class="time" v-else >
  14. 预留{{detail.reserveMinutes}}分钟
  15. <view class="img-box" >
  16. <img src="@/assets/img/finished.png" v-if="detail.status==1" alt="">
  17. <!-- 已取消 -->
  18. <img src="../../../static/img/canc.png" v-if="detail.status==3" alt="">
  19. <!-- 已完成-->
  20. <img src="../../../static/img/f.png" v-if="detail.status==2" alt="">
  21. </view>
  22. </view>
  23. <!-- 已取消/已拒绝 -->
  24. <!-- -->
  25. <view class="details-item">
  26. <view class="item">
  27. <view class="item-name">
  28. 预约单号
  29. </view>
  30. <view class="item-content">
  31. {{detail.flowNo}}
  32. </view>
  33. </view>
  34. <view class="item">
  35. <view class="item-name">
  36. 预计开始充电
  37. </view>
  38. <view class="item-content">
  39. {{detail.startTime}}
  40. </view>
  41. </view>
  42. <view class="item">
  43. <view class="item-name">
  44. 预计充电时长
  45. </view>
  46. <view class="item-content">
  47. {{getPercent(detail.estimateMinutes)}}
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <u-alert-tips type="warning" v-if="detail.status==1" :description="description"></u-alert-tips>
  53. <!-- 充电桩详情 -->
  54. <view class="charge-pile">
  55. <view class="box" @click="gotoUrl('pages/searchPile/stationAndPile/stationDetails?id='+chargingDevice.stationId)">
  56. <view class="name ellipsis">
  57. {{chargingDevice.stationName}}/{{chargingDevice.name}}
  58. </view>
  59. <view class="address ellipsis">
  60. {{chargingDevice.address}}
  61. </view>
  62. <text class="iconfont more">
  63. &#xe600;
  64. </text>
  65. </view>
  66. <view class="details-item">
  67. <view class="item">
  68. <view class="item-name">
  69. 预约单生成时间
  70. </view>
  71. <view class="item-content">
  72. {{detail.createTime}}
  73. </view>
  74. </view>
  75. <view class="item">
  76. <view class="item-name">
  77. 电费单价
  78. </view>
  79. <view class="item-content">
  80. {{price.electricityPrice}}元/度
  81. </view>
  82. </view>
  83. <view class="item">
  84. <view class="item-name">
  85. 充电服务费
  86. </view>
  87. <view class="item-content">
  88. {{price.servicePrice}}元/度
  89. </view>
  90. </view>
  91. <view class="item" v-if="detail.status==3" >
  92. <view class="item-name" >
  93. 取消时间
  94. </view>
  95. <view class="item-content">
  96. {{detail.updateTime}}
  97. </view>
  98. </view>
  99. <template v-if="detail.status==5||detail.status==6" >
  100. <view class="item" >
  101. <view class="item-name" >
  102. 过期时间
  103. </view>
  104. <view class="item-content">
  105. {{detail.updateTime}}
  106. </view>
  107. </view>
  108. <view class="item" >
  109. <view class="item-name" >
  110. 过期原因
  111. </view>
  112. <view class="item-content">
  113. {{detail.remark}}
  114. </view>
  115. </view>
  116. </template>
  117. </view>
  118. </view>
  119. <!-- 底部按钮 -->
  120. <view class="bottom" v-if="detail.status==0" >
  121. <!-- <u-button shape='circle' class="refuse-btn">拒绝</u-button>
  122. <u-button type="success" shape='circle'>确认</u-button>
  123. --><!-- 删除订单按钮 -->
  124. <u-button shape='circle'
  125. @click="regChangeStatus()"
  126. class="cancel-btn">取消预约</u-button>
  127. </view>
  128. <view class="bottom2" v-if="detail.status==1" >
  129. <!-- <u-button shape='circle' class="refuse-btn">拒绝</u-button>
  130. <u-button type="success" shape='circle'>确认</u-button>
  131. --><!-- 删除订单按钮 -->
  132. <u-button size="medium" shape='circle' @click="regChangeStatus()" class="cancel-btn">取消预约</u-button>
  133. <u-button size="medium" shape='circle' type="success" @click="charge" >开始充电</u-button>
  134. </view>
  135. </view>
  136. </template>
  137. <script>
  138. import * as API from '@/apis/apointment.js'
  139. import {
  140. newDate,
  141. hourDistanceArr,
  142. currentTimeStamp,
  143. parseUnixTime
  144. } from '@/utils'
  145. export default {
  146. data() {
  147. return {
  148. gunNo:"",
  149. deviceNo:"",
  150. channelNo:"",
  151. carNumber:"",
  152. stationId:"",
  153. isback:false,
  154. detail:{},
  155. price:{},
  156. chargingDevice:{},
  157. description: '等待桩主确认预约单,剩余时间04:59:59'
  158. }
  159. },onLoad(op) {
  160. //预约充电跳转过来则 返回首页
  161. if(op.isback){
  162. this.isback=true
  163. }
  164. if(op.notice){
  165. this.isback=true
  166. }
  167. if(op.qr){
  168. //扫码进入的
  169. }
  170. if (op.deviceNo) {
  171. }
  172. this.id= op.id;
  173. this.getInfo()
  174. },
  175. methods:{
  176. getPercent(estimateMinute) {
  177. var value="";
  178. var ms =estimateMinute
  179. if (ms > 0) {
  180. var Hour = parseInt(Math.floor(ms / 60 ));
  181. var Fen = parseInt(Math.floor(ms % 60 ));
  182. if(Hour>0){
  183. value+=Hour + "小时"
  184. }
  185. if(Fen>0){
  186. value+=Fen + "分钟"
  187. }
  188. }
  189. return value;
  190. },
  191. charge(){
  192. uni.navigateTo({
  193. url:'/pages/searchPile/stationAndPile/chargingPileDetails?isback=1&id='+this.gunNo
  194. })
  195. },
  196. regChangeStatusSuccess(){
  197. uni.showLoading({
  198. title: "加载中",
  199. mask: true,
  200. })
  201. API.regChangeStatus({
  202. id:this.id,
  203. status:3
  204. }).then((res) => {
  205. uni.hideLoading()
  206. this.getInfo();
  207. }).catch(error => {
  208. uni.showToast({
  209. title: error
  210. })
  211. })
  212. },
  213. regChangeStatus(){
  214. uni.showModal({
  215. title:"提示",
  216. content: "请确认是否取消预约功能",
  217. success: (res1) => {
  218. if (res1.confirm) {
  219. this.regChangeStatusSuccess()
  220. } else if (res1.cancel) {
  221. //('用户点击取消');
  222. }
  223. }
  224. })
  225. },
  226. getInfo(bl,bl2){
  227. //(bl)
  228. if(!bl){
  229. uni.showLoading({
  230. title: "加载中",
  231. mask: true,
  232. })
  233. }
  234. API.myAppointmentDetail({
  235. id:this.id,
  236. }).then((res) => {
  237. if(!bl){
  238. uni.hideLoading()
  239. }
  240. this.detail= res.data.chargingAppointment;
  241. this.chargingDevice=res.data.chargingDevice;
  242. this.price=res.data.price;
  243. this.stationId= this.chargingDevice.stationId;
  244. this.deviceNo = this.chargingDevice.deviceNo;
  245. this.channelNo = res.data.channelNo;
  246. this.carNumber = res.data.carNumber;
  247. this.gunNo = res.data.gunNo;
  248. if(this.detail.status=="0"){
  249. //this.description= '等待桩主确认预约单,剩余时间'
  250. var data=newDate(this.detail.createTime).getTime()
  251. var c=hourDistanceArr(new Date(),new Date(data+5*60*1000))
  252. this.description= '等待桩主确认预约单,剩余时间'+c[1]+'分'+c[2]+"秒";
  253. setTimeout(()=>{
  254. this.getInfo(true);
  255. },2000)
  256. }
  257. if(this.detail.status=="1"){
  258. if(!bl2){
  259. this.indexstep()
  260. }
  261. }
  262. }).catch(error => {
  263. uni.showToast({
  264. title: error
  265. })
  266. })
  267. },
  268. indexstep(){
  269. //this.description= '等待桩主确认预约单,剩余时间'
  270. var data=newDate(this.detail.createTime).getTime()
  271. var c=hourDistanceArr(new Date(),new Date(data+this.detail.reserveMinutes*60*1000))
  272. this.description= c[1]+'分'+c[2]+"秒后预约授权将超时,如超时授权自动取消。";
  273. if( c[1]!=0||c[2]!=0){
  274. setTimeout(()=>{
  275. this.indexstep()
  276. },1000)
  277. }else{
  278. setTimeout(()=>{
  279. this.getInfo(true,true)
  280. },5000)
  281. }
  282. },
  283. customback(){
  284. if(this.isback){
  285. uni.reLaunch({
  286. url:"/pages/index/index"
  287. })
  288. }else{
  289. uni.navigateBack({
  290. })
  291. }
  292. },
  293. }
  294. }
  295. </script>
  296. <style lang="scss" scoped>
  297. .tittle-font {
  298. font-size: 24px;
  299. position: fixed;
  300. top: 12px;
  301. right: 16px;
  302. z-index: 99999;
  303. }
  304. /deep/.u-alert-desc{
  305. width: 100vw;
  306. text-align: center;
  307. color: #ff5a00;
  308. }
  309. .reverse-time{
  310. background-color: #fff;
  311. padding: 36px 28px 16px;
  312. .time{
  313. height: 36px;
  314. color: rgba(0, 185, 98, 100);
  315. font-size: 36px;
  316. text-align: center;
  317. position: relative;
  318. .img-box{
  319. width: 72px;
  320. height: 72px;
  321. img{
  322. width: 72px;
  323. height: 72px;
  324. position: absolute;
  325. top: -12px;
  326. right: -2px;
  327. }
  328. }
  329. }
  330. .refused{
  331. color: #666666;
  332. }
  333. }
  334. .details-item{
  335. margin-top: 32px;
  336. .item{
  337. display: flex;
  338. justify-content: space-between;
  339. margin-top: 8px;
  340. }
  341. }
  342. // 充电桩详情
  343. .charge-pile{
  344. background-color: #fff;
  345. margin-top: 12px;
  346. padding: 12px 28px;
  347. .box{
  348. position: relative;
  349. .more{
  350. position: absolute;
  351. top: 9px;
  352. right: 0px;
  353. font-size: 24px;
  354. color: #b3b3b3;
  355. }
  356. }
  357. .name{
  358. line-height: 18px;
  359. color: rgba(16, 16, 16, 100);
  360. font-size: 18px;
  361. font-weight: 600;
  362. }
  363. .ellipsis{
  364. white-space: nowrap;
  365. text-overflow: ellipsis;
  366. overflow: hidden;
  367. }
  368. .address{
  369. line-height: 20px;
  370. color: rgba(51, 51, 51, 100);
  371. margin-top: 4px;
  372. }
  373. .item{
  374. margin-top: 20px;
  375. }
  376. }
  377. // 按钮
  378. .bottom{
  379. width: 100%;
  380. height: 56px;
  381. position: fixed;
  382. bottom: 0;
  383. background-color: #fff;
  384. display: flex;
  385. .refuse-btn{
  386. background-color: #DBDBDB;
  387. }
  388. .u-btn{
  389. width: 91.4%;
  390. height: 40px;
  391. margin: auto;
  392. font-size: 18px;
  393. }
  394. // .cancel-btn{
  395. // width: 91.4%;
  396. // background-color: #dbdbdb;
  397. // color: #666666
  398. // }
  399. }
  400. .bottom2{
  401. width: 100%;
  402. height: 56px;
  403. position: fixed;
  404. bottom: 0;
  405. background-color: #fff;
  406. display: flex;
  407. .refuse-btn{
  408. background-color: #DBDBDB;
  409. }
  410. .u-btn{
  411. height: 40px;
  412. margin: auto;
  413. font-size: 18px;
  414. }
  415. // .cancel-btn{
  416. // width: 91.4%;
  417. // background-color: #dbdbdb;
  418. // color: #666666
  419. // }
  420. }
  421. </style>