<template>
	<!-- 各个tab -->
	<view class="tools-box">
		<view class="search-sub">
			<u-subsection
				:current="current"
				:list="receiveStatusOptions"
				active-color="white"
				bg-color="white"
				inactive-color="#666"
				button-color="#2272FF"
				border-radius="36"
				@change="change"
				height="72"
				bold
			></u-subsection>
		</view>
		<view class="select-view"><xh-picker-select placeholder="品牌" :list="brandList" :rangeKey="rangeKey" :value="value" @change="pickerchange"></xh-picker-select></view>
	</view>
</template>

<script>
import XhPickerSelect from '../XhPickerSelect.vue';
import { receiveStatusOptions } from '@/common/optinos/mine/received.js';
import { showToast } from '@/common/common.js';
export default {
	props: ['current', 'value'],
	components: {
		XhPickerSelect
	},
	data() {
		return {
			receiveStatusOptions,
			rangeKey: 'name',
			brandList: []
		};
	},
	methods: {
		// 获取品牌列表
		async getBrandList() {
			let res = await this.$u.api.brandListByReceivedModules();
			let { code, data, message } = res;
			if (code === 200) {
				this.brandList = data || [];
			} else {
				showToast(message);
			}
		},
		// tab栏切换
		change(index) {
			this.$emit('update:current', index);
			this.$emit('currentChange');
		},
		pickerchange(data) {
			this.$emit('pickerchange', data);
		}
	}
};
</script>

<style lang="scss" scoped>
.tools-box {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	margin-bottom: 30rpx;

	.search-sub {
		height: 72rpx;
		width: 320rpx;
	}
	.select-view {
		width: 240rpx;
		background-color: #ffffff;
		border-radius: 8rpx;
	}
}
</style>
