myReservation.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <template>
  2. <view>
  3. <ujp-navbar title="我的预约">
  4. <view class="screen oldTextjp2" oldstyle="font-size: 16px;" @click="screenClick">筛选</view>
  5. </ujp-navbar>
  6. <view>
  7. <view v-if="screenShow" class="preference" :style="screenShow ? 'z-index:1024;top:'+navBarHeight+'px;' : 'z-index:0'"
  8. style="width: 100%;">
  9. <view class="content-s">
  10. <view class="preference_group">
  11. <view class="preference_group_item" :class="statusClass == index ? 'active' : ''" v-for="(item,index) in statusList" :key="item.id" @click="statusClick(index,item)">{{item.name}}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <u-mask :show="screenShow" @click="screenShow = false" z-index="100"></u-mask>
  16. </view>
  17. <view class="carNone" v-if="appointmentList.length == 0">
  18. <img src="static/img/暂无数据-缺省页.png" alt="">
  19. <p>暂无预约</p>
  20. </view>
  21. <view class="reservation-items" v-for="(item,index) in appointmentList" :key="item.id" @click="gotoUrl('pages/user/myReservation/reservationListDetails?id='+item.id)">
  22. <view class="station-name ellipsis">
  23. {{item.stationName}}/{{item.deviceName}}
  24. <view class="toBe-confirmed btn" v-if="item.status == '0'">{{item.statusText}}</view>
  25. <view class="confirmed btn" v-if="item.status == '1'">已确认</view>
  26. <view class="canceled btn" v-if="item.status == '3'">{{item.statusText}}</view>
  27. <view class="have-expired btn" v-if="item.status == '9'">{{item.statusText}}</view>
  28. <view class="confirmed btn" v-if="item.status == '2'">{{item.statusText}}</view>
  29. <view class="refused btn" v-if="item.status == '4'">{{item.statusText}}</view>
  30. <view class="have-expired btn" v-if="item.status == '5'">已过期</view>
  31. <view class="have-expired btn" v-if="item.status == '6'">已过期</view>
  32. </view>
  33. <view class="details-items">
  34. <view class="items">
  35. <view class="items-name">
  36. 预约单号
  37. </view>
  38. <view class="items-content">
  39. {{item.flowNo}}
  40. </view>
  41. </view>
  42. <view class="items">
  43. <view class="items-name">
  44. 充电类型
  45. </view>
  46. <view class="items-content">
  47. {{item.typeText}}
  48. </view>
  49. </view>
  50. <view class="items">
  51. <view class="items-name">
  52. 预约预留时长
  53. </view>
  54. <view class="items-content">
  55. {{item.reserveMinutes}}分钟
  56. </view>
  57. </view>
  58. <view class="items">
  59. <view class="items-name">
  60. 预留截至时间
  61. </view>
  62. <view class="items-content">
  63. {{item.endTime}}
  64. </view>
  65. </view>
  66. <view class="items">
  67. <view class="items-name">
  68. 预约充电时长
  69. </view>
  70. <view class="items-content">
  71. {{item.estimateMinutes != null ? (item.estimateMinutes/60).toFixed(1)+'小时' : '0'}}
  72. </view>
  73. </view>
  74. </view>
  75. <view class="button" v-if="item.status == '0'">
  76. <u-button class="cancel" shape="circle" @click="refuseClick(item)">取消预约</u-button>
  77. </view>
  78. <view class="button" v-if="item.status == '1'">
  79. <u-button class="navigation" shape="circle" @click="gotoUrl('pages/searchPile/stationAndPile/stationDetailsMap?stationId='+item.stationId)">导航</u-button>
  80. <u-button class="cancel" shape="circle" @click="refuseClick(item)">取消预约</u-button>
  81. </view>
  82. <view class="button" v-if="item.status == '2'">
  83. <u-button class="check" shape="circle" @click="gotoUrl('pages/user/myReservation/reservationListDetails?id='+item.id)">查看详情</u-button>
  84. </view>
  85. <!-- <view class="button" v-if="item.status == '3'">
  86. <u-button class="rebook" shape="circle" @click="remakeClick(item)">重新预约</u-button>
  87. <u-button class="canc" shape="circle">删除</u-button>
  88. </view> -->
  89. <!-- <view class="button" v-if="item.status == '9'">
  90. <u-button class="canc" shape="circle">删除</u-button>
  91. </view> -->
  92. </view>
  93. <u-divider v-if="appointmentList.length == recordsTotal && recordsTotal != 0" style="margin-top: 10px;background-color: #F2F4F4;">已经到底了</u-divider>
  94. </view>
  95. </template>
  96. <script>
  97. import * as API from '@/apis/apointment.js'
  98. import {
  99. hourDistanceArr,
  100. currentTimeStamp,
  101. parseUnixTime
  102. } from '@/utils'
  103. export default {
  104. data() {
  105. return {
  106. screenShow: false,
  107. navBarHeight:44,
  108. statusList: [
  109. {id:"",name:"全部预约单"},
  110. {id:"1",name:"已确认"},
  111. {id:"0",name:"待确认"},
  112. {id:"2",name:"已完成"},
  113. {id:"3",name:"已取消"},
  114. {id:"4",name:"已拒绝"},
  115. {id:"9",name:"已过期"},
  116. ],
  117. statusClass: '',
  118. pageIndex: 1,
  119. recordsTotal: 0,
  120. appointmentList: [],
  121. status: '',
  122. }
  123. },
  124. onShow() {
  125. this.getAppointmentList(true);
  126. },
  127. onReachBottom() {
  128. if (this.appointmentList.length < this.recordsTotal) {
  129. this.myLoadmore();
  130. }
  131. },
  132. methods: {
  133. statusClick(index,item) {
  134. this.statusClass = index;
  135. this.screenShow = false;
  136. this.status = item.id;
  137. this.getAppointmentList(true);
  138. },
  139. screenClick() {
  140. this.screenShow = !this.screenShow;
  141. },
  142. getAppointmentList(bl) {
  143. uni.showLoading({
  144. title: "加载中",
  145. mask: true,
  146. })
  147. if (bl) {
  148. this.appointmentList = [];
  149. this.pageIndex = 1;
  150. }
  151. API.myAppointmentList({
  152. pageIndex: this.pageIndex,
  153. status: this.status
  154. }).then((res) => {
  155. uni.hideLoading();
  156. this.appointmentList = [
  157. ...this.appointmentList,
  158. ...res.data.data
  159. ];
  160. this.recordsTotal = res.data.recordsTotal;
  161. var list = res.data.data;
  162. for (let i = 0; i < list.length; i++) {
  163. if(list[i].status == '0') {
  164. }
  165. }
  166. }).catch(error => {
  167. uni.showToast({
  168. title: error,
  169. icon: "none"
  170. })
  171. })
  172. },
  173. myLoadmore() {
  174. this.pageIndex += 1;
  175. this.getAppointmentList()
  176. },
  177. refuseClick(item) {
  178. uni.showLoading({
  179. title: "加载中",
  180. mask: true,
  181. })
  182. API.regChangeStatus({
  183. id: item.id,
  184. status: '3'
  185. }).then((res) => {
  186. uni.hideLoading();
  187. this.getAppointmentList(true);
  188. }).catch(error => {
  189. uni.showToast({
  190. title: error,
  191. icon: "none"
  192. })
  193. })
  194. },
  195. }
  196. }
  197. </script>
  198. <style lang="scss" scoped>
  199. .carNone{
  200. display: flex;
  201. flex-direction: column;
  202. justify-content: center;
  203. align-items: center;
  204. img{
  205. width: 100%;
  206. height: 100%;
  207. }
  208. p{
  209. margin-top: -60px;
  210. }
  211. }
  212. .preference {
  213. background-color: #ffffff;
  214. left: 0rpx;
  215. position: absolute
  216. }
  217. .preference_group_item {
  218. padding: 15rpx;
  219. text-align: center;
  220. color: #777777;
  221. }
  222. .active {
  223. color: #00B962;
  224. font-size: 18px;
  225. }
  226. .preference_group {
  227. padding-bottom: 20rpx;
  228. }
  229. .content-s{
  230. height: 240px;
  231. overflow-y:scroll;
  232. }
  233. page {
  234. padding-bottom: 155px;
  235. }
  236. .screen {
  237. margin-left: 85.3%;
  238. color: rgba(119, 119, 119, 100);
  239. font-size: 12px
  240. }
  241. .btn {
  242. width: 60px;
  243. height: 24px;
  244. line-height: 20px;
  245. border-radius: 4px;
  246. background-color: rgba(255, 255, 255, 100);
  247. font-size: 14px;
  248. text-align: center;
  249. float: right;
  250. margin-right: 24px;
  251. margin-top: 12px;
  252. }
  253. // 待确认按钮
  254. .toBe-confirmed {
  255. color: rgba(78, 141, 246, 100);
  256. border: 1px solid rgba(78, 141, 246, 100);
  257. }
  258. // 已确认按钮
  259. .confirmed {
  260. border: 1px solid rgba(0, 185, 98, 100);
  261. color: rgba(0, 185, 98, 100);
  262. }
  263. // 已取消按钮
  264. .canceled {
  265. border: 1px solid rgba(153, 153, 153, 100);
  266. color: rgba(153, 153, 153, 100);
  267. ;
  268. }
  269. // 已过期按钮
  270. .have-expired {
  271. color: rgba(162, 169, 181, 100);
  272. border: 1px solid rgba(162, 169, 181, 100);
  273. }
  274. // 已拒绝
  275. .refused {
  276. color: rgba(255, 79, 63, 100);
  277. border: 1px solid rgba(255, 79, 63, 100);
  278. }
  279. .reservation-items {
  280. width: 100%;
  281. background-color: #fff;
  282. padding-left: 14px;
  283. margin-bottom: 12px;
  284. .station-name {
  285. line-height: 48px;
  286. color: rgba(16, 16, 16, 100);
  287. font-size: 20px
  288. }
  289. .ellipsis{
  290. white-space: nowrap;
  291. text-overflow: ellipsis;
  292. overflow: hidden;
  293. }
  294. .details-items {
  295. border: 1px solid rgba(238, 242, 240, 100);
  296. border-left: none;
  297. padding-bottom: 13px;
  298. .items {
  299. display: flex;
  300. justify-content: space-between;
  301. padding: 12px 14px 0px 0;
  302. line-height: 20px;
  303. }
  304. }
  305. /deep/.u-alert-tips--bg--warning-light {
  306. background-color: #fff !important;
  307. border: none;
  308. margin-top: 12px;
  309. padding: 8px 0;
  310. .u-alert-desc {
  311. color: #ff7300;
  312. }
  313. }
  314. .button {
  315. height: 56px;
  316. padding: 12px 0;
  317. /deep/.u-btn {
  318. width: 100px;
  319. height: 32px;
  320. line-height: 23px;
  321. background-color: rgba(255, 255, 255, 100);
  322. color: rgba(153, 153, 153, 100);
  323. font-size: 16px;
  324. text-align: center;
  325. float: right;
  326. margin-right: 16px;
  327. }
  328. .navigation,
  329. .start {
  330. color: rgba(0, 185, 98, 100);
  331. }
  332. .check {
  333. color: rgba(153, 153, 153, 100);
  334. }
  335. .canc {
  336. color: rgba(153, 153, 153, 100);
  337. }
  338. .rebook {
  339. color: rgba(0, 185, 98, 100);
  340. }
  341. }
  342. }
  343. </style>