123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369 |
- <template>
- <view >
- <u-navbar title="预约单详情" :custom-back="customback" >
-
- </u-navbar>
- <view class="iconfont tittle-font">
- 
- </view>
- <u-alert-tips type="warning" v-if="detail.status==0" :description="description"></u-alert-tips>
-
- <view class="reverse-time">
- <view class="time">
- 预留{{detail.reserveMinutes}}分钟
- <view class="img-box" v-if="detail.status==1">
- <img src="@/assets/img/finished.png" alt="">
- <!-- 已取消 -->
- <!-- <img src="../../../static/img/canc.png" alt=""> -->
- <!-- 已完成-->
- <!-- <img src="../../../static/img/f.png" alt=""> -->
- </view>
- </view>
- <!-- 已取消/已拒绝 -->
- <!-- <view class="time refused">
- 已取消
- </view> -->
- <view class="details-item">
- <view class="item">
- <view class="item-name">
- 预约单号
- </view>
- <view class="item-content">
- {{detail.flowNo}}
- </view>
- </view>
- <view class="item">
- <view class="item-name">
- 预计开始充电
- </view>
- <view class="item-content">
-
- {{detail.startTime}}
-
- </view>
- </view>
- <view class="item">
- <view class="item-name">
- 预计充电时长
- </view>
- <view class="item-content">
- {{detail.estimateMinutes}}分钟
- </view>
- </view>
- </view>
-
- </view>
- <!-- 充电桩详情 -->
- <view class="charge-pile">
- <view class="box" @click="gotoUrl('pages/searchPile/stationAndPile/stationDetails?id=3865b3a3-13fd-461a-8145-ee9711df35a2')">
-
- <view class="name ellipsis">
- {{chargingDevice.stationName}}/{{chargingDevice.name}}
- </view>
- <view class="address ellipsis">
- {{chargingDevice.address}}
- </view>
- <text class="iconfont more">
- 
- </text>
- </view>
-
- <view class="details-item">
- <view class="item">
- <view class="item-name">
- 预约单生成时间
-
- </view>
- <view class="item-content">
- {{detail.createTime}}
-
- </view>
- </view>
- <view class="item">
- <view class="item-name">
-
- 电费单价
-
- </view>
- <view class="item-content">
- {{price.electricityPrice}}元/度
- </view>
- </view>
- <view class="item">
- <view class="item-name">
-
- 充电服务费
- </view>
- <view class="item-content">
- {{price.servicePrice}}元/度
- </view>
- </view>
- </view>
- </view>
- <!-- 底部按钮 -->
- <view class="bottom" v-if="detail.status==0" >
- <!-- <u-button shape='circle' class="refuse-btn">拒绝</u-button>
- <u-button type="success" shape='circle'>确认</u-button>
- --><!-- 删除订单按钮 -->
- <u-button shape='circle'
- @click="regChangeStatus()"
- class="cancel-btn">取消预约</u-button>
- </view>
- <view class="bottom" v-if="detail.status==1" >
- <!-- <u-button shape='circle' class="refuse-btn">拒绝</u-button>
- <u-button type="success" shape='circle'>确认</u-button>
- --><!-- 删除订单按钮 -->
- <u-button shape='circle' type="success" @click="charge" >开始充电</u-button>
- </view>
- </view>
- </template>
- <script>
- import * as API from '@/apis/apointment.js'
-
- import {
- hourDistanceArr,
- currentTimeStamp,
- parseUnixTime
- } from '@/utils'
- export default {
- data() {
- return {
- deviceNo:"",
- channelNo:"",
- carNumber:"",
- stationId:"",
- isback:false,
- detail:{},
- price:{},
- chargingDevice:{},
- description: '等待桩主确认预约单,剩余时间04:59:59'
- }
-
- },onLoad(op) {
- //预约充电跳转过来则 返回首页
- if(op.isback){
- this.isback=true
- }
- if(op.qr){
- //扫码进入的
- }
- if (op.deviceNo) {
- this.stationId= op.stationId;
- this.deviceNo = op.deviceNo;
- this.channelNo = op.gun;
- this.carNumber = op.carNumber;
-
- }
- this.id= op.id;
- this.getInfo()
- },
- methods:{
- charge(){
- uni.navigateTo({
- url:'/pages/searchPile/chargeProcess/charge?stationId='+this.stationId+'&deviceNo='+this.deviceNo+"&gun="+this.channelNo+"&carNumber="+(this.carNumber?this.carNumber:'')
- })
- },
- regChangeStatusSuccess(){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
-
- API.regChangeStatus({
- id:this.id,
- status:3
- }).then((res) => {
- uni.hideLoading()
- this.getInfo();
-
- }).catch(error => {
- uni.showToast({
- title: error
- })
- })
- },
- regChangeStatus(){
-
- uni.showModal({
- title:"提示",
- content: "请确认是否取消预约功能",
-
- success: (res1) => {
- if (res1.confirm) {
- this.regChangeStatusSuccess()
- } else if (res1.cancel) {
- console.log('用户点击取消');
- }
- }
- })
-
-
- },
- getInfo(bl){
- console.log(bl)
- if(!bl){
- uni.showLoading({
- title: "加载中",
- mask: true,
- })
- }
-
- API.myAppointmentDetail({
- id:this.id,
-
- }).then((res) => {
- if(!bl){
- uni.hideLoading()
- }
- this.detail= res.data.chargingAppointment;
- this.chargingDevice=res.data.chargingDevice;
- this.price=res.data.price;
-
- if(this.detail.status=="0"){
- //this.description= '等待桩主确认预约单,剩余时间'
- var data=new Date(this.detail.createTime).getTime()
- var c=hourDistanceArr(new Date(),new Date(data+5*60*1000))
-
- this.description= '等待桩主确认预约单,剩余时间'+c[1]+'分'+c[2]+"秒";
-
-
- setTimeout(()=>{
- this.getInfo(true);
- },2000)
- }
-
- }).catch(error => {
- uni.showToast({
- title: error
- })
- })
-
- },
- customback(){
- if(this.isback){
- uni.reLaunch({
- url:"/pages/index/index"
- })
- }else{
- uni.navigateBack({
-
- })
- }
-
- },
- }
-
- }
- </script>
- <style lang="scss" scoped>
- .tittle-font {
-
- font-size: 24px;
- position: fixed;
- top: 12px;
- right: 16px;
- z-index: 99999;
-
- }
- /deep/.u-alert-desc{
- width: 100vw;
- text-align: center;
- color: #ff5a00;
- }
- .reverse-time{
- background-color: #fff;
- padding: 36px 28px 16px;
- .time{
- height: 36px;
- color: rgba(0, 185, 98, 100);
- font-size: 36px;
- text-align: center;
- position: relative;
- .img-box{
- width: 72px;
- height: 72px;
- img{
- width: 72px;
- height: 72px;
- position: absolute;
- top: -12px;
- right: -2px;
- }
- }
- }
- .refused{
- color: #666666;
- }
- }
- .details-item{
- margin-top: 32px;
- .item{
- display: flex;
- justify-content: space-between;
- margin-top: 8px;
- }
- }
- // 充电桩详情
- .charge-pile{
- background-color: #fff;
- margin-top: 12px;
- padding: 12px 28px;
- .box{
- position: relative;
- .more{
- position: absolute;
- top: 9px;
- right: 0px;
- font-size: 24px;
- color: #b3b3b3;
- }
- }
- .name{
- line-height: 18px;
- color: rgba(16, 16, 16, 100);
- font-size: 18px;
- font-weight: 600;
- }
- .ellipsis{
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- }
- .address{
- line-height: 20px;
- color: rgba(51, 51, 51, 100);
- margin-top: 4px;
- }
- .item{
- margin-top: 20px;
- }
- }
-
- // 按钮
- .bottom{
- width: 100%;
- height: 56px;
- position: fixed;
- bottom: 0;
- background-color: #fff;
- display: flex;
- .refuse-btn{
- background-color: #DBDBDB;
- }
- .u-btn{
- width: 91.4%;
- height: 40px;
- margin: auto;
- font-size: 18px;
-
- }
- // .cancel-btn{
- // width: 91.4%;
- // background-color: #dbdbdb;
- // color: #666666
- // }
- }
- </style>
|