<template>
	<view>
		<view class="orderCardCss usuallyCard">
			<view class="flex justify-between">
				<view class="text-lg">
					我的订单
				</view>
				<view class="flex align-center text-gray" @click="goToOrderPage('全部')">
					<view class="">查看全部订单</view>
					<u-icon name="arrow-right" color="#666666"></u-icon>
				</view>
			</view>
			<view class="margin-top-lg">
				<u-line></u-line>
			</view>
			<view class="flex justify-around margin-top-lg">
				<view class="flex flex-direction align-center justify-center" v-for="(item,index) of orderCardList"
					:key="`${$assignKeys(item.name)}`">
					<view class="" @click="goToOrderPage(item.name)">
						<u-image width="30px" height="25px" :src="item.imgIcon" mode="heightFix"></u-image>
					</view>
					<view class="text-sm margin-top-sm">
						{{ item.name }}
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		components: {},
		props: {

		},
		data() {
			return {
				orderCardList: [{
					name: '待付款',
					imgIcon: "/static/images/mine/orderCard-01.png",
					path: "/pages/mine/emptyPage"
				}, {
					name: '待配送',
					imgIcon: "/static/images/mine/orderCard-02.png",
					path: "/pages/mine/appList/gasInformation/gasInformation"
				}, {
					name: '配送中',
					imgIcon: "/static/images/mine/orderCard-03.png",
					path: ""
				}, {
					name: '待评价',
					imgIcon: "/static/images/mine/orderCard-04.png",
					path: "/pages/mine/emptyPage"
				}, ],
				checkOrderList: ['待配送', '配送中', '全部']

			}
		},
		computed: {

		},
		onLoad() {

		},
		methods: {
			goToOrderPage(val) {
				console.log('打印orderIndex', val);
				let orderIndex = this.checkOrderList.findIndex(el => val == el);
				if (orderIndex > -1) {
					uni.setStorageSync('orderCardType', val);
					uni.switchTab({
						url: `/pages/order/order`
					})
				} else {
					let url = this.orderCardList.filter((item) => item.name == val)[0].path;
					console.log('打印orderIndex', url);
					uni.navigateTo({
						url: `${url}?pageName=${val}`
					})
					// uni.switchTab({
					//   url:`/pages/order/order`
					// })
					// this.$modal.msg('待开发')
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.orderCardCss {
		margin: 10px;
		padding: 20px 10px 20px 10px;
	}
</style>