reservationListDetails.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  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="@/assets/static/img/canc.png" v-if="detail.status==3" alt="">
  19. <!-- 已完成-->
  20. <img src="@/assets/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.toFixed(2)}}元/度
  81. </view>
  82. </view>
  83. <view class="item">
  84. <view class="item-name">
  85. 充电服务费
  86. </view>
  87. <view class="item-content">
  88. {{price.servicePrice.toFixed(2)}}元/度
  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(detail.status)"
  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(detail.status)" 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(status){
  214. if(status=='0'){
  215. uni.showModal({
  216. title:"提示",
  217. content: "请确认是否取消预约功能",
  218. success: (res1) => {
  219. if (res1.confirm) {
  220. this.regChangeStatusSuccess()
  221. } else if (res1.cancel) {
  222. //('用户点击取消');
  223. }
  224. }
  225. })
  226. }else{
  227. uni.showModal({
  228. title: '强制取消',
  229. cancelText:'我再想想',
  230. confirmText:'取消预约',
  231. content: '您的预约单已被确认,如强制取消,平台为保证每位车主的合理权益,会对您作出停用预约充电功能1天的处罚。确定取消预约吗?',
  232. success: res => {
  233. if (res.confirm) {
  234. //付钱 改为组件
  235. this.regChangeStatusSuccess()
  236. } else if (res.cancel) {
  237. //('用户点击取消');
  238. }
  239. }
  240. });
  241. }
  242. },
  243. getInfo(bl,bl2){
  244. //(bl)
  245. if(!bl){
  246. uni.showLoading({
  247. title: "加载中",
  248. mask: true,
  249. })
  250. }
  251. API.myAppointmentDetail({
  252. id:this.id,
  253. }).then((res) => {
  254. if(!bl){
  255. uni.hideLoading()
  256. }
  257. this.detail= res.data.chargingAppointment;
  258. this.chargingDevice=res.data.chargingDevice;
  259. this.price=res.data.price;
  260. this.stationId= this.chargingDevice.stationId;
  261. this.deviceNo = this.chargingDevice.deviceNo;
  262. this.channelNo = res.data.channelNo;
  263. this.carNumber = res.data.carNumber;
  264. this.gunNo = res.data.gunNo;
  265. if(this.detail.status=="0"){
  266. //this.description= '等待桩主确认预约单,剩余时间'
  267. var data=newDate(this.detail.createTime).getTime()
  268. var c=hourDistanceArr(new Date(),new Date(data+5*60*1000))
  269. this.description= '等待桩主确认预约单,剩余时间'+c[1]+'分'+c[2]+"秒";
  270. setTimeout(()=>{
  271. this.getInfo(true);
  272. },2000)
  273. }
  274. if(this.detail.status=="1"){
  275. if(!bl2){
  276. this.indexstep()
  277. }
  278. }
  279. }).catch(error => {
  280. uni.showToast({
  281. title: error
  282. })
  283. })
  284. },
  285. indexstep(){
  286. //this.description= '等待桩主确认预约单,剩余时间'
  287. var data=newDate(this.detail.createTime).getTime()
  288. var c=hourDistanceArr(new Date(),new Date(data+this.detail.reserveMinutes*60*1000))
  289. this.description= c[1]+'分'+c[2]+"秒后预约授权将超时,如超时授权自动取消。";
  290. if( c[1]!=0||c[2]!=0){
  291. setTimeout(()=>{
  292. this.indexstep()
  293. },1000)
  294. }else{
  295. setTimeout(()=>{
  296. this.getInfo(true,true)
  297. },5000)
  298. }
  299. },
  300. customback(){
  301. if(this.isback){
  302. uni.reLaunch({
  303. url:"/pages/index/index"
  304. })
  305. }else{
  306. uni.navigateBack({
  307. })
  308. }
  309. },
  310. }
  311. }
  312. </script>
  313. <style lang="scss" scoped>
  314. .tittle-font {
  315. font-size: 24px;
  316. position: fixed;
  317. top: 12px;
  318. right: 16px;
  319. z-index: 99999;
  320. }
  321. /deep/.u-alert-desc{
  322. width: 100vw;
  323. text-align: center;
  324. color: #ff5a00;
  325. }
  326. .reverse-time{
  327. background-color: #fff;
  328. padding: 36px 28px 16px;
  329. .time{
  330. height: 36px;
  331. color: rgba(0, 185, 98, 100);
  332. font-size: 36px;
  333. text-align: center;
  334. position: relative;
  335. .img-box{
  336. width: 72px;
  337. height: 72px;
  338. img{
  339. width: 72px;
  340. height: 72px;
  341. position: absolute;
  342. top: -12px;
  343. right: -2px;
  344. }
  345. }
  346. }
  347. .refused{
  348. color: #666666;
  349. }
  350. }
  351. .details-item{
  352. margin-top: 32px;
  353. .item{
  354. display: flex;
  355. justify-content: space-between;
  356. margin-top: 8px;
  357. }
  358. }
  359. // 充电桩详情
  360. .charge-pile{
  361. background-color: #fff;
  362. margin-top: 12px;
  363. padding: 12px 28px;
  364. .box{
  365. position: relative;
  366. .more{
  367. position: absolute;
  368. top: 9px;
  369. right: 0px;
  370. font-size: 24px;
  371. color: #b3b3b3;
  372. }
  373. }
  374. .name{
  375. line-height: 18px;
  376. color: rgba(16, 16, 16, 100);
  377. font-size: 18px;
  378. font-weight: 600;
  379. }
  380. .ellipsis{
  381. white-space: nowrap;
  382. text-overflow: ellipsis;
  383. overflow: hidden;
  384. }
  385. .address{
  386. line-height: 20px;
  387. color: rgba(51, 51, 51, 100);
  388. margin-top: 4px;
  389. }
  390. .item{
  391. margin-top: 20px;
  392. }
  393. }
  394. // 按钮
  395. .bottom{
  396. width: 100%;
  397. height: 56px;
  398. position: fixed;
  399. bottom: 0;
  400. background-color: #fff;
  401. display: flex;
  402. .refuse-btn{
  403. background-color: #DBDBDB;
  404. }
  405. .u-btn{
  406. width: 91.4%;
  407. height: 40px;
  408. margin: auto;
  409. font-size: 18px;
  410. }
  411. // .cancel-btn{
  412. // width: 91.4%;
  413. // background-color: #dbdbdb;
  414. // color: #666666
  415. // }
  416. }
  417. .bottom2{
  418. width: 100%;
  419. height: 56px;
  420. position: fixed;
  421. bottom: 0;
  422. background-color: #fff;
  423. display: flex;
  424. .refuse-btn{
  425. background-color: #DBDBDB;
  426. }
  427. .u-btn{
  428. height: 40px;
  429. margin: auto;
  430. font-size: 18px;
  431. }
  432. // .cancel-btn{
  433. // width: 91.4%;
  434. // background-color: #dbdbdb;
  435. // color: #666666
  436. // }
  437. }
  438. </style>