543 lines
12 KiB
Vue
543 lines
12 KiB
Vue
<template>
|
||
<view class="page">
|
||
<u-navbar title="我的订单" :border-bottom="false" :background="bgc" back-icon-color="#262B37" title-color='#262B37'
|
||
title-size='36' height='36' id="navbar">
|
||
</u-navbar>
|
||
<view class="topbj"></view>
|
||
<view class="navtab" v-if="activeindex == 2">
|
||
<view class="zctab">
|
||
租车订单
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uwzdktgeyR4JgzgUeOOd" mode=""></image>
|
||
<text></text>
|
||
</view>
|
||
<view class="qxtab" @click="btnac(1)">
|
||
骑行订单
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uSsQmBFEejLf0rHSDJFw" mode=""></image>
|
||
</view>
|
||
</view>
|
||
<view class="navtab" v-else>
|
||
<view class="zctabs" @click="btnac(2)">
|
||
租车订单
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uduOC3zyhXDBftRcCA77" mode=""></image>
|
||
</view>
|
||
<view class="qxtabs">
|
||
骑行订单
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uQ4WOC2D9wPq93sPNQTW" mode=""></image>
|
||
<text></text>
|
||
</view>
|
||
</view>
|
||
<u-tabs v-if="activeindex == 2" :list="list" :is-scroll="false" :current="current" inactive-color="#89bdef" @change="change"></u-tabs>
|
||
<u-tabs v-else :list="lists" :is-scroll="false" :current="currents" inactive-color="#89bdef" @change="changes"></u-tabs>
|
||
<!-- 租车订单 -->
|
||
<scroll-view class="zuchelist" v-if="activeindex == 2" @scrolltolower="handleScrollToLower" scroll-y>
|
||
<view class="zuchelist_item" v-for="(item,index) in qixinglist" :key="index" @click="btnxq">
|
||
<view class="top">
|
||
订单编号:123456789123456 <text style="font-size: 30rpx;font-weight: 600;color: #4297F3;">使用中</text>
|
||
</view>
|
||
<view class="quche">
|
||
<text style="font-size: 36rpx;font-weight: 600;">车辆名称</text> <text>玛丽电动车</text>
|
||
</view>
|
||
<view class="quche">
|
||
<text>门店:云行租车(汇丰公寓)</text> <text>¥118</text>
|
||
</view>
|
||
<view class="quche">
|
||
<text>租期</text> <text>1天</text>
|
||
</view>
|
||
<view class="bot">
|
||
<view class="lt"></view>
|
||
<view class="rt">
|
||
<view class="xuzu" style="width: 120rpx;">
|
||
临时停车
|
||
</view>
|
||
<view class="xuzu" style="margin-left: 10rpx;">
|
||
续租
|
||
</view>
|
||
<view class="huan">
|
||
还车
|
||
</view>
|
||
<view class="huan">
|
||
取车
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="dibutishi">
|
||
当前没有更多租车订单咯...
|
||
</view>
|
||
</scroll-view>
|
||
<!-- 骑行订单 -->
|
||
<scroll-view v-else class="qixinglist" @scrolltolower="handqixing" scroll-y>
|
||
<view class="qixinglist_item" v-for="(item,index) in qixinglist" :key="index" @click="btnxqqx(item.id)">
|
||
<view class="top">
|
||
<view class="lt">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/u6uVoMfLXtkWyF9gg2mY" mode=""></image> {{item.deviceVehicleNum == null ? '--' : item.deviceVehicleNum}}
|
||
</view>
|
||
<view class="rt" v-if="item.status == 'WAIT_PAY'">
|
||
待支付 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
|
||
</view>
|
||
<view class="rt" v-if="item.status == 'CANCELED'">
|
||
已取消 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
|
||
</view>
|
||
<view class="rt" v-if="item.status == 'PROCESSING'">
|
||
进行中 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
|
||
</view>
|
||
<view class="rt" v-if="item.status == 'FINISHED'">
|
||
已完成 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
|
||
</view>
|
||
<view class="rt" v-if="item.status == 'WAIT_VERIFY'">
|
||
待审核 <u-icon name="arrow-right" color="#808080" size="28"></u-icon>
|
||
</view>
|
||
</view>
|
||
<view class="bot">
|
||
<view class="lt">
|
||
<view class="">
|
||
<text>开始时间:</text> {{item.startTime == null ? '--' : item.startTime}}
|
||
</view>
|
||
<view class="">
|
||
<text>时长:</text> {{computedList(item.duration)}}
|
||
</view>
|
||
<view class="">
|
||
<text>距离:</text> {{item.distance > 1000 ? (item.distance / 1000).toFixed(2) + 'km' : item.distance + 'm'}}
|
||
</view>
|
||
<view class="" v-if="item.status == 'WAIT_VERIFY'">
|
||
<text>还车审核:</text> 未审核
|
||
</view>
|
||
</view>
|
||
<view class="rt">
|
||
{{item.totalFee == null ? '--' : item.totalFee}}元
|
||
</view>
|
||
</view>
|
||
</view>
|
||
<view class="dibutishi">
|
||
当前没有更多骑行订单咯...
|
||
</view>
|
||
</scroll-view>
|
||
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
bgc: {
|
||
backgroundColor: "#C4E1FF",
|
||
},
|
||
activeindex:1,
|
||
list: [{
|
||
name: '全部'
|
||
}, {
|
||
name: '待取车'
|
||
}, {
|
||
name: '使用中',
|
||
}, {
|
||
name: '已完成',
|
||
}, {
|
||
name: '已取消',
|
||
}],
|
||
lists: [{
|
||
name: '全部'
|
||
}, {
|
||
name: '待支付'
|
||
}, {
|
||
name: '已完成',
|
||
}],
|
||
current: 0,
|
||
currents: 0,
|
||
pageNum:1,
|
||
qixinglist:[],
|
||
total:'',
|
||
status:''
|
||
}
|
||
},
|
||
onLoad() {
|
||
this.getlist()
|
||
},
|
||
onShow() {
|
||
|
||
},
|
||
methods: {
|
||
// 跳转到骑行订单详情
|
||
btnxqqx(id){
|
||
uni.navigateTo({
|
||
url:'/page_user/yongche/orderxq?id=' + id
|
||
})
|
||
},
|
||
computedList(seconds, showSeconds = true) {
|
||
if (isNaN(seconds)) return "--"
|
||
const h = Math.floor(seconds / 3600)
|
||
const m = Math.floor((seconds % 3600) / 60)
|
||
const s = seconds % 60
|
||
const parts = []
|
||
if (h > 0) parts.push(`${h}时`)
|
||
if (m > 0 || h > 0) parts.push(`${m}分`) // 如果有小时则始终显示分钟
|
||
if (showSeconds) parts.push(`${s}秒`)
|
||
return parts.join("") || "0钟"
|
||
},
|
||
// 请求订单列表
|
||
getlist(){
|
||
this.$u.get(`/app/order/mineList?pageNum=${this.pageNum}&pageSize=10&suitType=${this.activeindex}&status=${this.status}&isAsc=desc&orderByColumn=createTime`).then((res) => {
|
||
if (res.code == 200) {
|
||
if(this.pageNum == 1){
|
||
this.qixinglist = res.rows
|
||
}else{
|
||
this.qixinglist = this.qixinglist.concat(res.rows)
|
||
}
|
||
this.pageNum ++
|
||
this.total = res.total
|
||
}else if(res.code == 401){
|
||
uni.showModal({
|
||
title: '提示',
|
||
content: '您当前未登录,是否前去登录?',
|
||
showCancel: true,
|
||
success: function (res) {
|
||
if (res.confirm) {
|
||
uni.reLaunch({
|
||
url:'/pages/login/login'
|
||
})
|
||
} else if (res.cancel) {
|
||
|
||
}
|
||
}
|
||
})
|
||
}
|
||
})
|
||
},
|
||
|
||
// 点击进入订单详情
|
||
btnxq(){
|
||
uni.navigateTo({
|
||
url:'/page_fenbao/orderxq'
|
||
})
|
||
},
|
||
// 滚动骑行订单到底部分页请求
|
||
handqixing() {
|
||
if(this.total > this.qixinglist.length){
|
||
this.getlist()
|
||
}
|
||
},
|
||
// 滚动租车订单到底部分页请求
|
||
handleScrollToLower() {
|
||
console.log(11)
|
||
},
|
||
// 点击骑行订单tabs筛选
|
||
changes(index) {
|
||
this.currents = index
|
||
if(index == 0){
|
||
this.status = ''
|
||
}else if(index == 1){
|
||
this.status = 'WAIT_PAY'
|
||
}else if(index == 2){
|
||
this.status = 'FINISHED'
|
||
}
|
||
this.pageNum = 1
|
||
this.getlist()
|
||
},
|
||
// 点击租车tabs筛选
|
||
change(index) {
|
||
this.current = index
|
||
},
|
||
// 点击切换tab选项
|
||
btnac(num){
|
||
if(num == 1){
|
||
this.activeindex = 1
|
||
}else{
|
||
this.activeindex = 2
|
||
}
|
||
this.pageNum = 1
|
||
this.getlist()
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
page {
|
||
background: #F7F7F7;
|
||
}
|
||
.qixinglist{
|
||
height: 76vh;
|
||
overflow: scroll;
|
||
padding-bottom: 20rpx;
|
||
box-sizing: border-box;
|
||
.dibutishi{
|
||
width: 100%;
|
||
text-align: center;
|
||
margin-top: 18rpx;
|
||
color: #ccc;
|
||
}
|
||
.qixinglist_item{
|
||
margin-top: 18rpx;
|
||
width: 714rpx;
|
||
max-height: 452rpx;
|
||
background: #FFFFFF;
|
||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||
margin: auto;
|
||
margin-top: 20rpx;
|
||
padding: 24rpx 28rpx;
|
||
box-sizing: border-box;
|
||
.bot{
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
margin-top: 22rpx;
|
||
.lt{
|
||
font-size: 28rpx;
|
||
color:#3D3D3D;
|
||
view{
|
||
margin-top: 8rpx;
|
||
}
|
||
text{
|
||
color: #808080;
|
||
}
|
||
}
|
||
.rt{
|
||
font-weight: 600;
|
||
font-size: 40rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
}
|
||
.top{
|
||
display: flex;
|
||
justify-content: space-between;
|
||
.rt{
|
||
font-size: 26rpx;
|
||
color: #808080;
|
||
}
|
||
.lt{
|
||
display: flex;
|
||
align-items: center;
|
||
font-weight: 600;
|
||
font-size: 32rpx;
|
||
color: #3D3D3D;
|
||
image{
|
||
width: 42rpx;
|
||
height: 42rpx;
|
||
margin-right: 18rpx;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
.zuchelist{
|
||
height: 76vh;
|
||
overflow: scroll;
|
||
padding-bottom: 20rpx;
|
||
box-sizing: border-box;
|
||
.dibutishi{
|
||
width: 100%;
|
||
text-align: center;
|
||
margin-top: 18rpx;
|
||
color: #ccc;
|
||
}
|
||
.zuchelist_item{
|
||
width: 714rpx;
|
||
max-height: 700rpx;
|
||
padding-bottom: 28rpx;
|
||
box-sizing: border-box;
|
||
background: #FFFFFF;
|
||
border-radius: 20rpx 20rpx 20rpx 20rpx;
|
||
margin: auto;
|
||
margin-top: 20rpx;
|
||
overflow: hidden;
|
||
}
|
||
.bot{
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
width: 693rpx;
|
||
margin: auto;
|
||
padding: 0 14rpx;
|
||
box-sizing: border-box;
|
||
margin-top: 40rpx;
|
||
.rt{
|
||
display: flex;
|
||
justify-content: space-between;
|
||
.huan{
|
||
width: 106rpx;
|
||
height: 52rpx;
|
||
background: #4297F3;
|
||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||
border: 2rpx solid #4297F3;
|
||
text-align: center;
|
||
line-height: 52rpx;
|
||
font-size: 26rpx;
|
||
color: #FFFFFF;
|
||
margin-left: 10rpx;
|
||
}
|
||
.xuzu{
|
||
width: 106rpx;
|
||
height: 52rpx;
|
||
border-radius: 8rpx 8rpx 8rpx 8rpx;
|
||
border: 2rpx solid #4297F3;
|
||
font-size: 26rpx;
|
||
color: #4297F3;
|
||
text-align: center;
|
||
line-height: 52rpx;
|
||
}
|
||
}
|
||
.lt{
|
||
view{
|
||
font-size: 26rpx;
|
||
color: #3D3D3D;
|
||
margin-top: 18rpx;
|
||
}
|
||
}
|
||
}
|
||
.quche{
|
||
padding: 0 24rpx;
|
||
box-sizing: border-box;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
margin-top: 18rpx;
|
||
.price{
|
||
font-weight: 600;
|
||
font-size: 32rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
text{
|
||
font-size: 26rpx;
|
||
color: #3D3D3D;
|
||
}
|
||
}
|
||
.top{
|
||
width: 714rpx;
|
||
height: 84rpx;
|
||
background: linear-gradient( 270deg, rgba(220,237,255,0) 0%, #DCEDFF 80%);
|
||
line-height: 84rpx;
|
||
font-size: 24rpx;
|
||
color: #3D3D3D;
|
||
padding:0 24rpx;
|
||
box-sizing: border-box;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
}
|
||
}
|
||
@keyframes fadeIn {
|
||
from {
|
||
opacity: 0;
|
||
}
|
||
to {
|
||
opacity: 1;
|
||
}
|
||
}
|
||
@keyframes fadeIns {
|
||
from {
|
||
transform: translateX(-500%);
|
||
}
|
||
to {
|
||
transform: translateX(0%);
|
||
}
|
||
}
|
||
@keyframes fadeInss {
|
||
from {
|
||
transform: translateX(500%);
|
||
}
|
||
to {
|
||
transform: translateX(0%);
|
||
}
|
||
}
|
||
.navtab{
|
||
display: flex;
|
||
width: 100%;
|
||
height: 114rpx;
|
||
position: relative;
|
||
background-color: #C4E1FF;
|
||
z-index: 1;
|
||
.qxtabs{
|
||
width: 50%;
|
||
text-align: center;
|
||
padding-top: 40rpx;
|
||
box-sizing: border-box;
|
||
font-weight: 600;
|
||
font-size: 36rpx;
|
||
color: #3D3D3D;
|
||
animation: fadeIn 0.3s ease-in-out forwards;
|
||
text{
|
||
width: 54rpx;
|
||
height: 6rpx;
|
||
background: #4297F3;
|
||
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||
display: block;
|
||
margin: auto;
|
||
margin-top: 8rpx;
|
||
animation: fadeIns 0.5s ease-in-out forwards;
|
||
}
|
||
image{
|
||
width: 439rpx;
|
||
height: 114rpx;
|
||
position: absolute;
|
||
bottom:0;
|
||
right: 0;
|
||
z-index: -1;
|
||
}
|
||
}
|
||
.zctabs{
|
||
width: 50%;
|
||
font-size: 32rpx;
|
||
font-weight: 600;
|
||
color: #3D3D3D;
|
||
text-align: center;
|
||
padding-top: 46rpx;
|
||
box-sizing: border-box;
|
||
image{
|
||
width: 400rpx;
|
||
height: 94rpx;
|
||
position: absolute;
|
||
bottom: 0;
|
||
left:0;
|
||
z-index: -2;
|
||
}
|
||
}
|
||
.qxtab{
|
||
width: 50%;
|
||
text-align: center;
|
||
padding-top: 46rpx;
|
||
box-sizing: border-box;
|
||
font-weight: 600;
|
||
font-size: 32rpx;
|
||
color: #3D3D3D;
|
||
image{
|
||
width: 439rpx;
|
||
height: 94rpx;
|
||
position: absolute;
|
||
bottom:0;
|
||
right: 0;
|
||
z-index: -2;
|
||
}
|
||
}
|
||
.zctab{
|
||
width: 50%;
|
||
font-weight: 600;
|
||
font-size: 36rpx;
|
||
color: #3D3D3D;
|
||
text-align: center;
|
||
padding-top: 40rpx;
|
||
box-sizing: border-box;
|
||
animation: fadeIn 0.3s ease-in-out forwards;
|
||
text{
|
||
animation: fadeInss 0.5s ease-in-out forwards;
|
||
width: 54rpx;
|
||
height: 6rpx;
|
||
background: #4297F3;
|
||
border-radius: 4rpx 4rpx 4rpx 4rpx;
|
||
display: block;
|
||
margin: auto;
|
||
margin-top: 8rpx;
|
||
}
|
||
image{
|
||
width: 400rpx;
|
||
height: 114rpx;
|
||
position: absolute;
|
||
top: 0;
|
||
left:0;
|
||
z-index: -1;
|
||
}
|
||
}
|
||
}
|
||
.topbj{
|
||
width: 100%;
|
||
height: 22rpx;
|
||
background-color: #C4E1FF;
|
||
}
|
||
</style> |