<template>
	<view class="content">
		<view style="background-color: #fff;padding: 18rpx 28rpx 0 18rpx;">
			<u-search placeholder="搜索你的订单" @search="getOrderList" :show-action='false' bg-color='#f5f5f5'
				v-model="keywords"></u-search>
		</view>
		<!-- <view style="margin: 10rpx 0 0 0;"></view> -->
		<u-sticky bgColor="#fff">
			<u-tabs :list="list" lineColor='#3274F9' inactiveStyle='color:#666' activeStyle="color:#3274F9"
				:current="curNow" @change="sectionChange" :scrollable="false"></u-tabs>
		</u-sticky>
		<view v-if="!orderlist.length">
			<u-empty mode="data" icon="../../static/img/empty/data.png">
			</u-empty>
		</view>

		<view v-else>
			<logistiCard v-for='(item,index) in orderlist' @getlist="getOrderList" @showTost='showToast'
				:goodsInfo="item" :key="index">



			</logistiCard>
		</view>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	import {
		getList
	} from "@/api/logistics.js"
	import {
		informationAdd
	} from "@/api/logistics.js"
	import logistiCard from "@/components/logistiComptent/logistiCard/logistiCard.vue"
	export default {
		components: {
			logistiCard
		},
		data() {
			return {
				keywords: "",
				list: [{
					name: '待取货'
				}, {
					name: '已取货'
				}, {
					name: '已送达'
				}],
				curNow: 0,
				orderlist: []
			}
		},
		methods: {
			sectionChange(e) {
				this.curNow = e.index;
				this.getOrderList()
			},
			showToast() {
				this.$refs.uToast.show({
					type: 'success',
					title: '成功主题(带图标)',
					message: "操作成功",
					iconUrl: 'https://cdn.uviewui.com/uview/demo/toast/success.png'
				})
			},
			getOrderList() {
				console.log("列表更新")
				let id = JSON.parse(uni.getStorageSync('USER_INFO')).id
				getList({
					status: this.curNow,
					// courier_id: 167,
					courier_id: id,
					keywords: this.keywords
				}).then(res => {
					this.orderlist = []
					this.orderlist = res.data.data
					for (let i = 0; i < this.orderlist.length; i++) {
						// this.logistiCard

					}


				})
			}

		},
		onShow() {
			this.getOrderList()

		}

	}
</script>

<style lang='scss'>
</style>