chargingRe.vue 6.6 KB

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