<template>
	<view>
		<customNav :shownav="true" :title="$t('dache.xingchengjl')" titledetl=""></customNav>
		<view class="toptalbarCtv"  :style="{top: statusBarHeight+'rpx'}">
			<view class="toptalbar">
				<view v-for="(item,index) in tableList">
					<view :class="index==toptableindex?'tableLabzh textfontB4 tableselect':'tableLabzh textfontS1'">
						<text @click="tableselct(item.value,index)">{{item.text}}</text>
					</view>
				</view>
			</view>
		</view>
		<view style="margin-top: 140rpx;">
			<view class="" v-for="(item,index) in orderList">
				<view class="contentColumn itemCTv">
					<view class="contentInRowS listItemTop">
						<text v-if="item.taxiType=='0'" class="ztextfontB2">快车</text>
						<text v-if="item.taxiType!='0'" class="ztextfontB2">顺风车</text>
						<text v-if="item.state!=3" class="textfontB4" style="color: darkgray;">{{getOrderSate(item.state)}}</text>
						<text v-if="item.state==3" class="textfontB4" style="color:#E86E48;">{{getOrderSate(item.state)}}</text>
					</view>
					<view class="contentInRowS marginSizesp">
						<text class="textfontB4" style="color: darkgray;">下单时间：{{item.orderTime}}</text>
						<text class="textfontB4">￥{{item.amount}}元</text>
					</view>
					<view class="contentInRowL marginSizesp">
						<text class="textfontB4" style="color: darkgray;">出发地点：{{item.boardingAddress}}</text>
					</view>
					<view class="contentInRowL marginSizesp">
						<text class="textfontB4" style="color: darkgray;">目的地：{{item.downAddress}}</text>
					</view>
					<view class="contentInRowR marginSizesp">
						<text v-if="item.state>5" class="actBTzl">再来一单</text>
						<text v-if="item.state==3" class="actBTzhifu">{{$t('order.quzhifu')}}</text>
					</view>
				</view>
				<!-- <view class="contentColumn itemCTv">
					<view class="contentInRowS listItemTop">
						<text class="ztextfontB2">快车</text>
						
						<text class="textfontB4" style="color:#E86E48;">{{$t('order.daifukuan')}}</text>
					</view>
					<view class="contentInRowS marginSizesp">
						<text class="textfontB4" style="color: darkgray;">下单时间</text>
						<text class="textfontB4">￥14.20</text>
					</view>
					<view class="contentInRowL marginSizesp">
						<text class="textfontB4" style="color: darkgray;">出发地点</text>
					</view>
					<view class="contentInRowL marginSizesp">
						<text class="textfontB4" style="color: darkgray;">目的地</text>
					</view>
					<view class="contentInRowR marginSizesp">
						<text class="actBTzhifu">{{$t('order.quzhifu')}}</text>
					</view>
				</view> -->
			</view>
		</view>
		<view style="height: 40rpx;"></view>
	</view>
</template>

<script>
import api from "@/pages/api/api.js"
	export default {
		data() {
			return {
				statusBarHeight:0,
				tableList:[],
				toptableindex:0,
				page:1,
				orderList:[]
			}
		},
		onLoad() {
			var systemInfo = uni.getSystemInfoSync();
			this.statusBarHeight=systemInfo.statusBarHeight*2+84;
		},
		onShow() {
			this.tableList=[
				{ value: -1, text: this.$t('order.quanbudd') },
				{ value: 0, text: this.$t('order.daifukuan') },
				{ value: 5, text: this.$t('order.yiwancheng')},
			];
			this.getOrderlist();
		},
		methods: {
			tableselct(value,index){
				this.toptableindex = index;
			},
			
			getOrderSate(state){
				switch(state){
					case "0":
					return '待司机接单';
					break;
					case "1":
					return '司机已接单';
					break;
					case "2":
					return '乘客已上车';
					break;
					case "3":
					return '待支付';
					break;
					case "4":
					return '已支付';
					break;
					case "5":
					return '用户投诉';
					break;
					case "6":
					return '订单取消';
					break;
					case "7":
					return '修改取消';
					break;
				}
				return '';
			},
			
			getOrderlist(){
				api('getUsTxorder',{
					page:this.page,
					size:20,
					state:'',
					type:0
				},res=>{
					console.log('getUsTxorder-------',res)
					if(res.data.code==200){
						this.orderList= res.data.data;
					}
					else{
						uni.showToast({
							title:'获取列表失败',//that.i18n('api.wangluoshibai'),
							icon: 'none',
							duration: 2500
						})
					}
				},failc=>{
					//console.log('getTaxiPrices----',failc)
					uni.showToast({
						title:'网络错误',//that.i18n('api.wangluoshibai'),
						icon: 'none',
						duration: 2500
					})
				})
			},
		},
	}
</script>

<style lang="scss">
page{
	background-color: #F4F4F4;
}

.toptalbarCtv{
	position: fixed;
	background-color: #F4F4F4;
	left: 0;
	right: 0;
	top: 0;
	z-index: 999;
}
.tableLabzh{
	text-align: center;
	margin-left: 14rpx;
	margin-right: 14rpx;
	color: darkgray;
}
	
.tableselect{
	border-bottom-width: 6rpx;
	border-bottom-style:solid;
	border-bottom-color:#00A6FF;
	color: #00A6FF;
}
.toptalbar{
	display: flex;
	flex-direction: row;
	justify-content:space-between;
	align-items: center;
	background-color:#F4F4F4;
	padding-top: 20rpx;
	height: 80rpx;
	width: 90%;
	margin-left: 5%;
}
.itemCTv{
	width: 90%;
	margin-left: 5%;
	margin-top: 30rpx;
	background-color: white;
	border-radius: 20rpx;
}
.listItemTop{
	margin-left: 16rpx;
	margin-right: 16rpx;
	height: 80rpx;
	align-items: center;
	border: solid lavender;
	border-width: 0px 0px 1rpx 0px;
}
.marginSizesp{
	margin-left: 16rpx;
	margin-right: 16rpx;
}

.actBTzl{
	font-size: 30rpx;
	line-height: 48rpx;
	padding-left: 20rpx;
	padding-right: 20rpx;
	border-radius: 24rpx;
	color: #E86E48;
	border: 1rpx solid #E86E48;
	background-color: white;
	margin-bottom: 16rpx;
	margin-right: 16rpx;
}

.actBTzhifu{
	font-size: 30rpx;
	line-height: 48rpx;
	padding-left: 20rpx;
	padding-right: 20rpx;
	border-radius: 24rpx;
	color: white;
	background-color: #E86E48;
	margin-bottom: 16rpx;
	margin-right: 16rpx;
}


</style>
