123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351 |
- <template>
- <view>
- <ujp-navbar title="预约充电">
-
- </ujp-navbar>
-
- <view class="carNone" v-if="appointmentList.length == 0">
- <img src="@/assets/static/img/暂无数据-缺省页.png" alt="">
- <p>暂无预约</p>
- </view>
- <view class="reservation-items" v-for="(item,index) in appointmentList" :key="item.id" >
- <view class="station-name ellipsis">
- {{item.stationName}}/{{item.deviceName}}
- <view class=" btn" :class="{
- 'toBe-confirmed':item.status==0,
- 'confirmed':item.status==1,
- 'have-expired':item.status==2
- }" >{{item.statusN}}</view>
-
- </view>
- <view class="details-items">
-
- <view class="items">
- <view class="items-name">
- 预约启动时间
- </view>
- <view class="items-content">
- {{item.startTime}}
- </view>
- </view>
- <view class="items">
- <view class="items-name">
- 创建时间
- </view>
- <view class="items-content">
- {{item.createTime}}
- </view>
- </view>
- <view class="items" v-if="item.status==2">
- <view class="items-name">
- 失败原因
- </view>
- <view class="items-content">
- {{item.remark}}
- </view>
- </view>
- </view>
- <view class="button" v-if="item.status == '0'">
- <u-button class="cancel" shape="circle" @click="refuseClick(item,item.status)">取消预约</u-button>
- </view>
-
-
- </view>
- <u-divider v-if="appointmentList.length == recordsTotal && recordsTotal != 0" style="margin-top: 10px;background-color: #F2F4F4;">已经到底了</u-divider>
- </view>
- </template>
- <script>
- import * as API from '@/apis/apointment.js'
-
- import {
- hourDistanceArr,
- currentTimeStamp,
- parseUnixTime
- } from '@/utils'
-
- export default {
- data() {
- return {
- screenShow: false,
- navBarHeight:44,
- statusList: [
- {id:"",name:"全部预约单"},
- {id:"1",name:"已确认"},
- {id:"0",name:"待确认"},
- {id:"2",name:"已完成"},
- {id:"3",name:"已取消"},
- {id:"4",name:"已拒绝"},
- {id:"9",name:"已过期"},
- ],
- statusClass: '',
- pageIndex: 1,
- recordsTotal: 0,
- appointmentList: [],
- status: '',
- }
- },
- onShow() {
- this.getAppointmentList(true);
- },
- onReachBottom() {
- if (this.appointmentList.length < this.recordsTotal) {
- this.myLoadmore();
- }
- },
- methods: {
- statusClick(index,item) {
- this.statusClass = index;
- this.screenShow = false;
- this.status = item.id;
- this.getAppointmentList(true);
- },
- screenClick() {
- this.screenShow = !this.screenShow;
- },
- getAppointmentList(bl) {
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- if (bl) {
- this.appointmentList = [];
- this.pageIndex = 1;
- }
- API.timingList({
- pageIndex: this.pageIndex,
- status: this.status
- }).then((res) => {
- uni.hideLoading();
- this.appointmentList = [
- ...this.appointmentList,
- ...res.data.data
- ];
- this.recordsTotal = res.data.recordsTotal;
-
- var list = res.data.data;
- for (let i = 0; i < list.length; i++) {
- if(list[i].status == '0') {
-
- }
- }
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- myLoadmore() {
- this.pageIndex += 1;
- this.getAppointmentList()
- },
- confirmrefuse(item){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- API.deleteTiming({
- id: item.id,
- status: '3'
- }).then((res) => {
- uni.hideLoading();
- this.getAppointmentList(true);
- }).catch(error => {
- uni.showToast({
- title: error,
- icon: "none"
- })
- })
- },
- refuseClick(item,status) {
- uni.showModal({
- title:"提示",
- content: "请确认是否取消预约充电",
-
- success: (res1) => {
- if (res1.confirm) {
- this.confirmrefuse(item)
- } else if (res1.cancel) {
- //('用户点击取消');
- }
- }
- })
-
-
- },
- }
- }
- </script>
- <style lang="scss" scoped>
- .carNone{
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- img{
- width: 100%;
- height: 100%;
- }
- p{
- margin-top: -60px;
- }
- }
- .preference {
- background-color: #ffffff;
- left: 0rpx;
- position: fixed
-
- }
- .preference_group_item {
- padding: 15rpx;
- text-align: center;
- color: #777777;
- }
- .active {
- color: #00B962;
- font-size: 18px;
- }
- .preference_group {
- padding-bottom: 20rpx;
- }
- .content-s{
- height: 240px;
- overflow-y:scroll;
- }
- page {
- padding-bottom: 155px;
- }
- .screen {
- margin-left: 85.3%;
- color: rgba(119, 119, 119, 100);
- font-size: 12px
- }
- .btn {
- width: 60px;
- height: 24px;
- line-height: 20px;
- border-radius: 4px;
- background-color: rgba(255, 255, 255, 100);
- font-size: 14px;
- text-align: center;
- float: right;
- margin-right: 24px;
- margin-top: 12px;
- }
- // 待确认按钮
- .toBe-confirmed {
- color: rgba(78, 141, 246, 100);
- border: 1px solid rgba(78, 141, 246, 100);
- }
- // 已确认按钮
- .confirmed {
- border: 1px solid rgba(0, 185, 98, 100);
- color: rgba(0, 185, 98, 100);
- }
- // 已取消按钮
- .canceled {
- border: 1px solid rgba(153, 153, 153, 100);
- color: rgba(153, 153, 153, 100);
- ;
- }
- // 已过期按钮
- .have-expired {
- color: rgba(162, 169, 181, 100);
- border: 1px solid rgba(162, 169, 181, 100);
- }
- // 已拒绝
- .refused {
- color: rgba(255, 79, 63, 100);
- border: 1px solid rgba(255, 79, 63, 100);
- }
- .reservation-items {
- width: 100%;
- background-color: #fff;
- padding-left: 14px;
- margin-bottom: 12px;
- .station-name {
- line-height: 48px;
- color: rgba(16, 16, 16, 100);
- font-size: 20px
- }
- .ellipsis{
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- .details-items {
- border: 1px solid rgba(238, 242, 240, 100);
- border-left: none;
- padding-bottom: 13px;
- .items {
- display: flex;
- justify-content: space-between;
- padding: 12px 14px 0px 0;
- line-height: 20px;
- }
- }
- ::v-deep.u-alert-tips--bg--warning-light {
- background-color: #fff !important;
- border: none;
- margin-top: 12px;
- padding: 8px 0;
- .u-alert-desc {
- color: #ff7300;
- }
- }
- .button {
- height: 56px;
- padding: 12px 0;
- ::v-deep.u-btn {
- width: 100px;
- height: 32px;
- line-height: 23px;
- background-color: rgba(255, 255, 255, 100);
- color: rgba(153, 153, 153, 100);
- font-size: 16px;
- text-align: center;
- float: right;
- margin-right: 16px;
- }
- .navigation,
- .start {
- color: rgba(0, 185, 98, 100);
- }
- .check {
- color: rgba(153, 153, 153, 100);
- }
- .canc {
- color: rgba(153, 153, 153, 100);
- }
- .rebook {
- color: rgba(0, 185, 98, 100);
- }
- }
- }
- </style>
|