reservationListDetails.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  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" >开始充电</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. isback:false,
  119. detail:{},
  120. price:{},
  121. chargingDevice:{},
  122. description: '等待桩主确认预约单,剩余时间04:59:59'
  123. }
  124. },onLoad(op) {
  125. //预约充电跳转过来则 返回首页
  126. if(op.isback){
  127. this.isback=true
  128. }
  129. if(op.qr){
  130. //扫码进入的
  131. }
  132. this.id= op.id;
  133. this.getInfo()
  134. },
  135. methods:{
  136. regChangeStatusSuccess(){
  137. uni.showLoading({
  138. title: "加载中",
  139. mask: true,
  140. })
  141. API.regChangeStatus({
  142. id:this.id,
  143. status:3
  144. }).then((res) => {
  145. uni.hideLoading()
  146. this.getInfo();
  147. }).catch(error => {
  148. uni.showToast({
  149. title: error
  150. })
  151. })
  152. },
  153. regChangeStatus(){
  154. uni.showModal({
  155. title:"提示",
  156. content: "请确认是否取消预约功能",
  157. success: (res1) => {
  158. if (res1.confirm) {
  159. this.regChangeStatusSuccess()
  160. } else if (res1.cancel) {
  161. console.log('用户点击取消');
  162. }
  163. }
  164. })
  165. },
  166. getInfo(bl){
  167. console.log(bl)
  168. if(!bl){
  169. uni.showLoading({
  170. title: "加载中",
  171. mask: true,
  172. })
  173. }
  174. API.myAppointmentDetail({
  175. id:this.id,
  176. }).then((res) => {
  177. if(!bl){
  178. uni.hideLoading()
  179. }
  180. this.detail= res.data.chargingAppointment;
  181. this.chargingDevice=res.data.chargingDevice;
  182. this.price=res.data.price;
  183. if(this.detail.status=="0"){
  184. //this.description= '等待桩主确认预约单,剩余时间'
  185. var data=new Date(this.detail.createTime).getTime()
  186. var c=hourDistanceArr(new Date(),new Date(data+5*60*1000))
  187. this.description= '等待桩主确认预约单,剩余时间'+c[1]+'分'+c[2]+"秒";
  188. setTimeout(()=>{
  189. this.getInfo(true);
  190. },2000)
  191. }
  192. }).catch(error => {
  193. uni.showToast({
  194. title: error
  195. })
  196. })
  197. },
  198. customback(){
  199. if(this.isback){
  200. uni.reLaunch({
  201. url:"/pages/index/index"
  202. })
  203. }else{
  204. uni.navigateBack({
  205. })
  206. }
  207. },
  208. }
  209. }
  210. </script>
  211. <style lang="scss" scoped>
  212. .tittle-font {
  213. font-size: 24px;
  214. position: fixed;
  215. top: 12px;
  216. right: 16px;
  217. z-index: 99999;
  218. }
  219. /deep/.u-alert-desc{
  220. width: 100vw;
  221. text-align: center;
  222. color: #ff5a00;
  223. }
  224. .reverse-time{
  225. background-color: #fff;
  226. padding: 36px 28px 16px;
  227. .time{
  228. height: 36px;
  229. color: rgba(0, 185, 98, 100);
  230. font-size: 36px;
  231. text-align: center;
  232. position: relative;
  233. .img-box{
  234. width: 72px;
  235. height: 72px;
  236. img{
  237. width: 72px;
  238. height: 72px;
  239. position: absolute;
  240. top: -12px;
  241. right: -2px;
  242. }
  243. }
  244. }
  245. .refused{
  246. color: #666666;
  247. }
  248. }
  249. .details-item{
  250. margin-top: 32px;
  251. .item{
  252. display: flex;
  253. justify-content: space-between;
  254. margin-top: 8px;
  255. }
  256. }
  257. // 充电桩详情
  258. .charge-pile{
  259. background-color: #fff;
  260. margin-top: 12px;
  261. padding: 12px 28px;
  262. .box{
  263. position: relative;
  264. .more{
  265. position: absolute;
  266. top: 9px;
  267. right: 0px;
  268. font-size: 24px;
  269. color: #b3b3b3;
  270. }
  271. }
  272. .name{
  273. line-height: 18px;
  274. color: rgba(16, 16, 16, 100);
  275. font-size: 18px;
  276. font-weight: 600;
  277. }
  278. .ellipsis{
  279. white-space: nowrap;
  280. text-overflow: ellipsis;
  281. overflow: hidden;
  282. }
  283. .address{
  284. line-height: 20px;
  285. color: rgba(51, 51, 51, 100);
  286. margin-top: 4px;
  287. }
  288. .item{
  289. margin-top: 20px;
  290. }
  291. }
  292. // 按钮
  293. .bottom{
  294. width: 100%;
  295. height: 56px;
  296. position: fixed;
  297. bottom: 0;
  298. background-color: #fff;
  299. display: flex;
  300. .refuse-btn{
  301. background-color: #DBDBDB;
  302. }
  303. .u-btn{
  304. width: 91.4%;
  305. height: 40px;
  306. margin: auto;
  307. font-size: 18px;
  308. }
  309. // .cancel-btn{
  310. // width: 91.4%;
  311. // background-color: #dbdbdb;
  312. // color: #666666
  313. // }
  314. }
  315. </style>