reservationListDetails.vue 8.7 KB

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