reservationListDetails.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460
  1. <template>
  2. <view >
  3. <u-navbar title="预约单详情" :custom-back="customback" >
  4. </u-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="bottom" 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 shape='circle' type="success" @click="charge" >开始充电</u-button>
  133. </view>
  134. </view>
  135. </template>
  136. <script>
  137. import * as API from '@/apis/apointment.js'
  138. import {
  139. hourDistanceArr,
  140. currentTimeStamp,
  141. parseUnixTime
  142. } from '@/utils'
  143. export default {
  144. data() {
  145. return {
  146. gunNo:"",
  147. deviceNo:"",
  148. channelNo:"",
  149. carNumber:"",
  150. stationId:"",
  151. isback:false,
  152. detail:{},
  153. price:{},
  154. chargingDevice:{},
  155. description: '等待桩主确认预约单,剩余时间04:59:59'
  156. }
  157. },onLoad(op) {
  158. //预约充电跳转过来则 返回首页
  159. if(op.isback){
  160. this.isback=true
  161. }
  162. if(op.notice){
  163. this.isback=true
  164. }
  165. if(op.qr){
  166. //扫码进入的
  167. }
  168. if (op.deviceNo) {
  169. }
  170. this.id= op.id;
  171. this.getInfo()
  172. },
  173. methods:{
  174. getPercent(estimateMinute) {
  175. var value="";
  176. var ms =estimateMinute
  177. if (ms > 0) {
  178. var Hour = parseInt(Math.floor(ms / 60 ));
  179. var Fen = parseInt(Math.floor(ms % 60 ));
  180. if(Hour>0){
  181. value+=Hour + "小时"
  182. }
  183. if(Fen>0){
  184. value+=Fen + "分钟"
  185. }
  186. }
  187. return value;
  188. },
  189. charge(){
  190. uni.navigateTo({
  191. url:'/pages/searchPile/stationAndPile/chargingPileDetails?isback=1&id='+this.gunNo
  192. })
  193. },
  194. regChangeStatusSuccess(){
  195. uni.showLoading({
  196. title: "加载中",
  197. mask: true,
  198. })
  199. API.regChangeStatus({
  200. id:this.id,
  201. status:3
  202. }).then((res) => {
  203. uni.hideLoading()
  204. this.getInfo();
  205. }).catch(error => {
  206. uni.showToast({
  207. title: error
  208. })
  209. })
  210. },
  211. regChangeStatus(){
  212. uni.showModal({
  213. title:"提示",
  214. content: "请确认是否取消预约功能",
  215. success: (res1) => {
  216. if (res1.confirm) {
  217. this.regChangeStatusSuccess()
  218. } else if (res1.cancel) {
  219. //('用户点击取消');
  220. }
  221. }
  222. })
  223. },
  224. getInfo(bl,bl2){
  225. //(bl)
  226. if(!bl){
  227. uni.showLoading({
  228. title: "加载中",
  229. mask: true,
  230. })
  231. }
  232. API.myAppointmentDetail({
  233. id:this.id,
  234. }).then((res) => {
  235. if(!bl){
  236. uni.hideLoading()
  237. }
  238. this.detail= res.data.chargingAppointment;
  239. this.chargingDevice=res.data.chargingDevice;
  240. this.price=res.data.price;
  241. this.stationId= this.chargingDevice.stationId;
  242. this.deviceNo = this.chargingDevice.deviceNo;
  243. this.channelNo = res.data.channelNo;
  244. this.carNumber = res.data.carNumber;
  245. this.gunNo = res.data.gunNo;
  246. if(this.detail.status=="0"){
  247. //this.description= '等待桩主确认预约单,剩余时间'
  248. var data=new Date(this.detail.createTime).getTime()
  249. var c=hourDistanceArr(new Date(),new Date(data+5*60*1000))
  250. this.description= '等待桩主确认预约单,剩余时间'+c[1]+'分'+c[2]+"秒";
  251. setTimeout(()=>{
  252. this.getInfo(true);
  253. },2000)
  254. }
  255. if(this.detail.status=="1"){
  256. if(!bl2){
  257. this.indexstep()
  258. }
  259. }
  260. }).catch(error => {
  261. uni.showToast({
  262. title: error
  263. })
  264. })
  265. },
  266. indexstep(){
  267. //this.description= '等待桩主确认预约单,剩余时间'
  268. var data=new Date(this.detail.createTime).getTime()
  269. var c=hourDistanceArr(new Date(),new Date(data+this.detail.reserveMinutes*60*1000))
  270. this.description= c[1]+'分'+c[2]+"秒后预约授权将超时,如超时授权自动取消。";
  271. if( c[1]!=0||c[2]!=0){
  272. setTimeout(()=>{
  273. this.indexstep()
  274. },1000)
  275. }else{
  276. setTimeout(()=>{
  277. this.getInfo(true,true)
  278. },5000)
  279. }
  280. },
  281. customback(){
  282. if(this.isback){
  283. uni.reLaunch({
  284. url:"/pages/index/index"
  285. })
  286. }else{
  287. uni.navigateBack({
  288. })
  289. }
  290. },
  291. }
  292. }
  293. </script>
  294. <style lang="scss" scoped>
  295. .tittle-font {
  296. font-size: 24px;
  297. position: fixed;
  298. top: 12px;
  299. right: 16px;
  300. z-index: 99999;
  301. }
  302. /deep/.u-alert-desc{
  303. width: 100vw;
  304. text-align: center;
  305. color: #ff5a00;
  306. }
  307. .reverse-time{
  308. background-color: #fff;
  309. padding: 36px 28px 16px;
  310. .time{
  311. height: 36px;
  312. color: rgba(0, 185, 98, 100);
  313. font-size: 36px;
  314. text-align: center;
  315. position: relative;
  316. .img-box{
  317. width: 72px;
  318. height: 72px;
  319. img{
  320. width: 72px;
  321. height: 72px;
  322. position: absolute;
  323. top: -12px;
  324. right: -2px;
  325. }
  326. }
  327. }
  328. .refused{
  329. color: #666666;
  330. }
  331. }
  332. .details-item{
  333. margin-top: 32px;
  334. .item{
  335. display: flex;
  336. justify-content: space-between;
  337. margin-top: 8px;
  338. }
  339. }
  340. // 充电桩详情
  341. .charge-pile{
  342. background-color: #fff;
  343. margin-top: 12px;
  344. padding: 12px 28px;
  345. .box{
  346. position: relative;
  347. .more{
  348. position: absolute;
  349. top: 9px;
  350. right: 0px;
  351. font-size: 24px;
  352. color: #b3b3b3;
  353. }
  354. }
  355. .name{
  356. line-height: 18px;
  357. color: rgba(16, 16, 16, 100);
  358. font-size: 18px;
  359. font-weight: 600;
  360. }
  361. .ellipsis{
  362. white-space: nowrap;
  363. text-overflow: ellipsis;
  364. overflow: hidden;
  365. }
  366. .address{
  367. line-height: 20px;
  368. color: rgba(51, 51, 51, 100);
  369. margin-top: 4px;
  370. }
  371. .item{
  372. margin-top: 20px;
  373. }
  374. }
  375. // 按钮
  376. .bottom{
  377. width: 100%;
  378. height: 56px;
  379. position: fixed;
  380. bottom: 0;
  381. background-color: #fff;
  382. display: flex;
  383. .refuse-btn{
  384. background-color: #DBDBDB;
  385. }
  386. .u-btn{
  387. width: 91.4%;
  388. height: 40px;
  389. margin: auto;
  390. font-size: 18px;
  391. }
  392. // .cancel-btn{
  393. // width: 91.4%;
  394. // background-color: #dbdbdb;
  395. // color: #666666
  396. // }
  397. }
  398. </style>