chuangte_bike_newxcx/page_user/yongche/orderxq.vue

286 lines
6.1 KiB
Vue
Raw Normal View History

2025-04-01 21:35:30 +08:00
<template>
<view class="page">
<u-navbar title="订单详情" :border-bottom="false" :background="bgc" title-color='#fff' title-size='36' height='45' back-icon-color='#fff'></u-navbar>
<view class="tit">
<view class="left">{{info.deviceVehicleNum == null ? '--' : info.deviceVehicleNum}}</view>
</view>
<view class="data">
{{info.createTime}}
</view>
<view class="card">
<view class="card_tit">
账单信息
</view>
<view class="cont">
<view class="cont_box" style="margin-top: 20rpx;">
<view class="cont_left">
支付金额
</view>
<view class="cont_right">
{{info.payAmount}}
</view>
</view>
<view class="cont_box" style="margin-top: 20rpx;">
<view class="cont_left">
预存金额
</view>
<view class="cont_right">
{{info.depositFee}}
</view>
</view>
<view class="cont_box" style="margin-top: 20rpx;">
<view class="cont_left">
骑行费
</view>
<view class="cont_right">
{{info.ridingFee}}
</view>
</view>
<view class="cont_box" style="margin-top: 20rpx;">
<view class="cont_left">
停车点外调度费
</view>
<view class="cont_right">
{{info.manageFee}}
</view>
</view>
<view class="cont_box" style="margin-top: 20rpx;">
<view class="cont_left">
运营区外调度费
</view>
<view class="cont_right">
{{info.dispatchFee}}
</view>
</view>
<view class="tip">
骑行时间{{ rideDuration == '' ? '--' : rideDuration}}
</view>
</view>
<view class="price">
<view class="zhanwei"></view>
<view class="prices">
共计<span style="font-size:48rpx ;">{{info.totalFee}}</span>
</view>
</view>
</view>
2025-04-10 08:57:21 +08:00
<view class="kefu" @click="btntel">
联系商家客服
</view>
2025-04-01 21:35:30 +08:00
</view>
</template>
<script>
export default {
data() {
return {
bgc: {
backgroundColor: "",
},
id: 0,
info: {},
rideDuration: '' // 新增属性用于存储骑行时间
}
},
onLoad(e) {
this.id = e.id
this.orderInfo()
},
methods: {
2025-04-10 08:57:21 +08:00
// 请求订单详情
2025-04-01 21:35:30 +08:00
orderInfo() {
this.$u.get("/app/order/mineDetail?id=" + this.id).then((res) => {
if (res.code == 200) {
this.info = res.data
2025-04-10 08:57:21 +08:00
this.calculateRideDuration() // 计算骑行时间
2025-04-01 21:35:30 +08:00
}
2025-04-10 08:57:21 +08:00
})
2025-04-01 21:35:30 +08:00
},
2025-04-10 08:57:21 +08:00
// 计算骑行时间
2025-04-01 21:35:30 +08:00
calculateRideDuration() {
2025-04-10 08:57:21 +08:00
const createTime = new Date(this.info.startTime)
let returnTime = ''
if(this.info.endTime == null){
returnTime = new Date()
}else{
returnTime = new Date(this.info.endTime)
}
console.log(returnTime,'0202020');
const duration = (returnTime - createTime) / 1000// 时间差,单位秒
const hours = Math.floor(duration / 3600)
const minutes = Math.floor((duration % 3600) / 60)
const seconds = Math.floor(duration % 60)
2025-04-01 21:35:30 +08:00
if (hours > 0) {
2025-04-10 08:57:21 +08:00
this.rideDuration = `${hours}小时${minutes}${seconds}`
2025-04-01 21:35:30 +08:00
} else {
2025-04-10 08:57:21 +08:00
this.rideDuration = `${minutes}${seconds}`
}
},
btntel(){
if(this.info.areaPhone == null){
uni.showToast({
title: '暂无商家客服电话',
icon: 'none',
duration:2000
})
}else{
uni.makePhoneCall({
phoneNumber: this.info.areaPhone,
success: function(res) {
console.log('拨打电话成功', res)
},
fail: function(err) {
console.error('拨打电话失败', err)
}
})
2025-04-01 21:35:30 +08:00
}
}
}
}
</script>
<style lang="scss" >
page{
background-color: #F7FAFE;
}
.page{
width: 750rpx;
background: linear-gradient( 180deg, #C4E1FF 0%, rgba(255,255,255,0) 100%), #FFFFFF;
border-radius: 0rpx 0rpx 0rpx 0rpx;
2025-04-10 08:57:21 +08:00
.kefu{
width: 680rpx;
height: 100rpx;
line-height: 100rpx;
background-color: #4297F3;
color: #fff;
font-size: 36rpx;
font-weight: 600;
text-align: center;
position: fixed;
left: 50%;
transform: translateX(-50%);
bottom: 50rpx;
border-radius: 20rpx;
}
2025-04-01 21:35:30 +08:00
.tit{
margin-left: 86rpx;
margin-right: 86rpx;
margin-top: 30rpx;
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
.left{
font-weight: 700;
font-size: 40rpx;
color: #3D3D3D;
}
.right{
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
}
}
.data{
margin-left: 86rpx;
font-weight: 400;
font-size: 24rpx;
color: #808080;
}
.card{
padding:34rpx 44rpx ;
margin: 68rpx auto;
width: 672rpx;
background: #FFFFFF;
box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0,0,0,0.08);
border-radius: 32rpx 32rpx 32rpx 32rpx;
.card_tit{
width: 112rpx;
height: 38rpx;
font-family: AlibabaPuHuiTi, AlibabaPuHuiTi;
font-weight: 400;
font-size: 28rpx;
color: #3D3D3D;
background: linear-gradient( 0deg, #C4E1FF 0.1%, rgba(255,255,255,0) 40%), #FFFFFF;
}
.cont{
padding: 32rpx 28rpx;
margin-top: 26rpx;
width: 586rpx;
background: #F3F3F3;
border-radius: 26rpx 26rpx 26rpx 26rpx;
.cont_box{
display: flex;
flex-wrap: nowrap;
justify-content: space-between;
.cont_left{
font-weight: 400;
font-size: 28rpx;
color: #3D3D3D;
}
.cont_right{
font-weight: 400;
font-size: 28rpx;
color: #3D3D3D;
}
}
.tip{
margin-top: 32rpx;
font-weight: 400;
font-size: 24rpx;
color: #808080;
}
}
.price{
margin-top: 28rpx;
display: flex;
flex-wrap: nowrap;
.prices{
margin-left: auto;
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
span{
margin-left: 2rpx;
margin-right: 2rpx;
}
}
.showmore{
margin-left: auto;
display: flex;
flex-wrap: nowrap;
align-items: center;
font-weight: 400;
font-size: 20rpx;
color: #3D3D3D;
.icon-xiangshang1{
font-size: 20rpx;
color: #3D3D3D;
}
.icon-xiangxia1{
font-size: 20rpx;
color: #3D3D3D;
}
}
}
.info_cont{
margin-top: 12rpx;
display: flex;
flex-wrap: nowrap;
align-items: center;
justify-content: space-between;
.cont_left{
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
}
.cont_right{
font-weight: 400;
font-size: 24rpx;
color: #3D3D3D;
}
}
}
}
</style>