You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

420 lines
9.5 KiB

<template>
<view class="content">
<view class="" style="height: 500rpx; margin-top: 100rpx;">
<piaoyi-text-animate3
:text="detail.list.currentSoc == '' || detail.list.currentSoc == null ? 0: detail.list.currentSoc "></piaoyi-text-animate3>
</view>
<view class="content_item">
<view class="">
<text>剩余时长()</text>
<text>{{detail.list.remainingChargingTime || 0 }}</text>
</view>
<view class="">
<text>已充时长()</text>
<text>{{detail.list.chargingTime || 0}}</text>
</view>
</view>
<view class="content_item" style="margin-top: 30rpx;">
<view class="">
<text>已充电量()</text>
<text>{{detail.list.chargingCapacity || 0}}</text>
</view>
<view class="">
<text>充电费用()</text>
<text>{{detail.list.totalFee / 100 || 0}}</text>
</view>
</view>
<!-- -->
<view class="more_position" style="margin-top: 20rpx;" @click="handle_more_info">
</view>
<!-- -->
<view class="btn_pay" v-if="detail.list.orderStatus == 1">
<button style="font-size: 14px;" @click="finish_charg">结束充电</button>
</view>
<view class="btn_pay" v-if="detail.list.orderStatus == 4">
<button style="font-size: 14px; background: #ff7131;" type="primary" @click="handle_pay">去支付</button>
</view>
<!-- -->
<uv-popup ref="more_popup" round="30" :overlay="true" :safeAreaInsetBottom="false">
<view style="width: 100%;">
<view class="cu-card article">
<view class="cu-item shadow">
<view class="flex justify-between flex-wrap padding-sm">
<view class="name">{{detail.list.stationName==null?'--':detail.list.stationName}}</view>
</view>
<view class="flex padding-lr-sm justify-between flex-wrap list-view">
<view class="staName">场站编码 </view>
<view class="staNum">{{detail.list.stationNo==null?'--':detail.list.stationNo}}</view>
</view>
<view class="flex justify-between flex-wrap list-view">
<view class="staName">充电订单号 </view>
<view class="staNum">{{detail.list.chargeOrder==null?'--':detail.list.chargeOrder}}</view>
</view>
<view class="flex justify-between list-view">
<view class="staName">车牌号 </view>
<view class="staNum">{{detail.list.vehicleNo==null?'--':detail.list.vehicleNo}}</view>
</view>
<view class="flex padding-lr-sm justify-between list-view">
<view class="staName">车辆vin</view>
<view class="staNum">{{detail.list.vin==null?'--':detail.list.vin}}</view>
</view>
<view class="flex padding-lr-sm justify-between list-view">
<view class="staName">总电量 </view>
<view class="staNum">
{{detail.list.totalElectricity==null?'0':detail.list.totalElectricity}}kW·h
</view>
</view>
<view class="flex justify-between list-view">
<view class="staName">平台服务费</view>
<view class="staNum">
{{detail.list.cloudTotalFee==null?'0':detail.list.cloudTotalFee / 100}}
</view>
</view>
<view class="flex justify-between list-view">
<view class="staName">电池服务费</view>
<view class="staNum">{{detail.list.batTotalFee==null?'0':detail.list.batTotalFee / 100}}
</view>
</view>
<view class="flex padding-lr-sm justify-between list-view">
<view class="staName">充电服务总费用</view>
<view class="staNum">
{{detail.list.chargeTotalFee==null?'0':detail.list.chargeTotalFee / 100}}
</view>
</view>
<view class="flex padding-sm justify-between flex-wrap">
<view class="titleName">费用合计</view>
<view class="money text-price">
{{detail.list.totalFee==null?'0':detail.list.totalFee / 100}}
</view>
</view>
</view>
</view>
</view>
</uv-popup>
</view>
</template>
<script setup>
import config from '@/common/config/config.js';
import sheep from '@/sheep';
import {
reactive,
ref,
} from "vue";
import {
onLoad,
onShow,
onUnload
} from "@dcloudio/uni-app";
import {
useCounterStore
} from '@/stores/counter.js';
const isDetail = useCounterStore()
const now_ingtext = ref()
const detail = reactive({
list: {
chargingTime: null,
chargingCapacity: null,
remainingChargingTime: null,
totalFee: null,
vehicleNo: null,
stationName: null,
stationNo: null,
chargeOrder: null,
vin: null,
totalElectricity: null,
cloudTotalFee: null,
batTotalFee: null,
chargeTotalFee: null
}
})
const timer = ref(null)
const isorderStatus = ref(false)
const more_popup = ref(false)
onLoad((options) => {
var station = JSON.parse(options.details);
detail.list = station
// console.log(detail.list, '订单详情');
// if (station.orderStatus == 1) {
// isorderStatus.value = true
// }
queryRealTimeOrder()
timer.value = setInterval(() => {
queryRealTimeOrder()
}, 5000)
})
onShow(() => {
queryRealTimeOrder()
isDetail.value = true
})
onUnload(() => {
if (timer.value) {
clearInterval(timer.value)
timer.value = null
}
})
const charging_data = ref({})
const istipsonly = ref(0)
const queryRealTimeOrder = async () => {
let config_url = ''
if (uni.getStorageSync("version") == '个人版') {
config_url = 'app-api/cloud/personal/queryRealTimeOrder/'
} else {
config_url = 'app-api/cloud/team/queryRealTimeOrder/'
}
await uni.$request({
url: config.baseUrl + config_url + detail.list.id,
method: 'GET'
}).then(res => {
// console.log(res, '==========>');
detail.list = res.data.data
if (res.data.data.orderStatus == 1) {
isorderStatus.value = true
} else if (res.data.data.orderStatus == 3) {
if (istipsonly.value == 0) {
uni.showModal({
title: '成功',
showCancel: false,
content: '结束充电成功,请拔插头',
success: function(res) {}
});
istipsonly.value++
}
}
}).catch((err) => {
uni.showToast({
title: '订单加载失败',
duration: 2000,
icon: 'error'
});
})
}
const handle_more_info = () => {
console.log('1');
more_popup.value.open('bottom')
}
const finish_charg = async () => {
let config_url = ''
if (uni.getStorageSync("version") == '个人版') {
config_url = 'app-api/cloud/personal/endCharge/'
} else {
config_url = 'app-api/cloud/team/endCharge/'
}
await uni.$request({
url: config.baseUrl + config_url + detail.list.id,
method: 'GET'
}).then(res => {
// console.log(res, '==========>');
if (res.data.code == 0) {
// uni.showToast({
// title: '结束成功',
// duration: 2000,
// icon: 'success'
// });
uni.showModal({
title: '提示',
showCancel: false,
content: '请等待充电机结束充电...',
success: function(res) {}
});
} else {
uni.showToast({
title: res.data.msg,
duration: 2000,
icon: 'error'
});
}
}).catch((err) => {
uni.showToast({
title: '结束失败',
duration: 2000,
icon: 'error'
});
})
}
const handle_pay = async () => {
await uni.request({ //刷新token
url: config.baseUrl + "app-api/cloud/outCharge/createPayOrder/" + detail.list.id,
method: 'GET',
header: {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Bearer ' + uni.getStorageSync('token'),
'tenant-id': 1
}
}).then(res => {
console.log(res, '支付信息')
if (res.data.code == 0) {
handle_pay_money(res.data.data)
}
})
}
const handle_pay_money = async (e) => {
sheep.$router.go('/pagesCenter/pay/index', {
id: e.payOrderId,
orderType: 'recharge',
});
}
</script>
<style lang="scss" scoped>
.content {
height: 100vh;
background: #fff;
position: relative;
padding: 20rpx;
box-sizing: border-box;
}
.cu-card.article>.cu-item {
padding-bottom: 0rpx;
}
.payState {
color: #4C91FF;
font-size: 39rpx;
}
.non-payment {
color: #FF7B0E;
font-size: 39rpx;
}
.refunded_0 {
color: #06efef;
font-size: 39rpx;
}
.refunded_1 {
color: #00aaff;
font-size: 39rpx;
}
.refunded_2 {
color: #00aa00;
font-size: 39rpx;
}
.refunded_3 {
color: #aa0000;
font-size: 39rpx;
}
.refunded_4 {
color: #ffff00;
font-size: 39rpx;
}
.refunded_5 {
color: #55557f;
font-size: 39rpx;
}
.refunded_6 {
color: #aaaa7f;
font-size: 39rpx;
}
.name {
color: #333;
font-size: 39rpx;
font-weight: 400;
}
.titleName {
color: #808080;
font-size: 28rpx;
font-weight: 400;
}
.staName {
color: #808080;
font-size: 28rpx;
font-weight: 400;
}
.staNum {
color: #333333;
font-size: 28rpx;
font-weight: 400;
}
.money {
color: #4C91FF;
font-size: 32rpx;
font-weight: 600;
}
.list-view {
padding: 0rpx 20rpx 20rpx 20rpx;
}
.btn_pay {
// width: 100%;
position: absolute;
bottom: 200rpx;
left: 50%;
transform: translateX(-50%);
// padding: 0 30rpx;
width: 50%;
>button {
border-radius: 40rpx;
background: #33c973;
font-size: 14px;
color: #fff;
}
}
.posi_loading {
position: absolute;
right: 50rpx;
top: 50%;
transform: translateY(-50%);
}
.content_item {
display: flex;
align-items: center;
justify-content: space-evenly;
>view {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
>text:first-child {
color: #868686;
font-size: 14px;
}
>text:last-child {
margin-top: 10rpx;
color: #000;
font-size: 18px;
font-weight: 600;
}
}
}
.more_position {
position: absolute;
top: 30rpx;
right: 30rpx;
font-size: 12px;
font-weight: bold;
color: #29cd5f;
text-decoration: underline;
}
</style>