reservationListDetails.vue 7.4 KB

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