reservationListDetails.vue 9.4 KB

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