myReservation.vue 8.9 KB

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