<template>
	<view class="cart">
		<view class="head-box"></view>
        <Navbar title="我的订单" :bgColor="bgColor" leftIconSize="0px" height="100rpx" :titleStyle="{color:fontColor}" />
		<view class="content contentPosition_">
			<uv-tabs 
				:scrollable="false"
				@click= "tabs"
				:list="tabList" 
				lineWidth="40" 
				:lineColor="`url(${lineBg}) 100% 100%`"
				:activeStyle="{color: '#FD5C5C', fontWeight: 'bold',transform: 'scale(1.05)'}"
				:inactiveStyle="{color: '#999', transform: 'scale(1)'}" 
				itemStyle="padding-left: 15px; padding-right: 15px; height: 44px;"
			></uv-tabs>
			<cardList :cardListData="cardListData" @btnClick="btnClick" @toOrderDetails="toOrderDetails" />
		</view>
		<tabber select="cart" />
	</view>
</template>

<script>
	import tabber from '@/components/base/tabbar.vue'
	import cardList from '@/components/cart/cardList.vue'
	import Navbar from '@/pages/components/Navbar.vue'
    import { globalMixin } from '../mixins/globalMixin';

	export default {
        mixins: [globalMixin],
		components:{
			tabber,
            cardList,
            Navbar
		},
		data() {
			return {
				tabList: [{
						id: 0,
						name: '全部'
					},
					{
						id: 1,
						name: '待参加'
					},
					{
						id: 2,
						name: '已完成'
					},
					{
						id: 3,
						name: '已取消'
					},
				],
				lineBg: require('@/static/image/cart/tabIcon.png'),
				cardListData: [
					{
						imgUrl: 'https://up.zhuoku.org/22/a4/60/50/fc3bd0b4e656911fccdde4383637c1cd.jpg',
						orderTime: '2024.08.23 12:00',
						state: 'U',
						stateText: '待参加',
						title: '夏日去撒野旅游计划～',
						time: '2024.10.28 10:00',
						address: '成都市东丽湖露营地32号',
						totalPrice: '298.00',
						btnObj: [{
								id: '0',
								btnTitle: '取消活动',
								color: '#AFAFAF',
								bgColor: '#34312E'
							},
							{
								id: '1',
								btnTitle: '活动签到',
								color: '#FF4546',
								bgColor: '#492623'
							}
						]
					},
					{
						imgUrl: 'https://up.zhuoku.org/22/a4/60/50/fc3bd0b4e656911fccdde4383637c1cd.jpg',
						orderTime: '2024.08.23 12:00',
						state: 'S',
						stateText: '已完成',
						title: '夏日去撒野旅游计划～',
						time: '2024.10.28 10:00',
						address: '成都市东丽湖露营地32号',
						totalPrice: '298.00',
						btnObj: [{
								id: '2',
								btnTitle: '活动评价',
								color: '#FF4546',
								bgColor: '#492623'
							},
							{
								id: '3',
								btnTitle: '开具发票',
								color: '#FFB245',
								bgColor: '#49361D'
							}
						]
					},
					{
						imgUrl: 'https://up.zhuoku.org/22/a4/60/50/fc3bd0b4e656911fccdde4383637c1cd.jpg',
						orderTime: '2024.08.23 12:00',
						state: 'F',
						stateText: '已完成',
						title: '夏日去撒野旅游计划～',
						time: '2024.10.28 10:00',
						address: '成都市东丽湖露营地32号',
						totalPrice: '298.00',
						btnObj: []
					}
				]
			}
		},
		methods: {
			tabs(val) {
				console.log(val);
			},
			toOrderDetails(val) {
					uni.navigateTo({
						url: '/pages_order/orderDetails'
					})
			},
			btnClick({ id }) { // 0取消活动  1活动签到  2活动评价   3开具发票
				console.log(id);
				if(id === '2') {
					uni.navigateTo({
						url: '/pages_order/orderEvaluation'
					})
					return;
				}
				if(id === '3') {
					uni.navigateTo({
						url: '/pages_order/invoiceIssuance'
					})
					return;
				}
			}
		}
	}
</script>

<style scoped lang="scss"></style>
