<template>
	<view class="salesSearch-wrap">
		<u-popup v-model="isShow" closeable class="search-popup" mode="right" @close="isShow=false" length="85%">
			<view class="form-title">选择货架(可多选)</view>
			<view class="form-content">
				<shelfList :checkEdList="defaultParams" @ok="submit"></shelfList>
			</view>
		</u-popup>
	</view>
</template>

<script>
	import shelfList from './shelfList.vue'
	export default{
		components: {
			shelfList,
		},
		props: {
			openModal: { //  弹框显示状态
				type: Boolean,
				default: false
			},
			defaultParams: {  //  默认查询条件
				type: Array,
				default: () => {
					return []
				}
			},
		},
		data(){
			return{
				isShow: this.openModal,
				customBtnStyle: {  //  自定义按钮样式
					borderColor: this.$config('primaryColor'),
					backgroundColor: this.$config('primaryColor'),
					color: '#fff'
				},
				showDate: false, // 是否显示时间弹窗
				settleStyleName: '',
				settleStyleModal: false,
			}
		},
		methods: {
			// 查询
			submit(data, shelfName) {
				this.$emit('refresh', data, shelfName)
				this.isShow = false
			},
		},
		watch: {
			//  父页面传过来的弹框状态
			openModal (newValue, oldValue) {
				this.isShow = newValue
			},
			//  重定义的弹框状态
			isShow (newValue, oldValue) {
				if (!newValue) {
					this.$emit('close')
				}
			}
		}
	}
</script>

<style lang="scss">
	.salesSearch-wrap{
		.search-popup {
			.form-title{
				text-align: center;
				padding: 30upx 20upx 0;
			}
			.form-content {
				display: block;
				padding: 20upx;
				box-sizing: content-box;
			}
			.uni-list-btns {
				display: flex;
				padding: 20upx;
				.handle-btn {
					font-size: 28upx;
					margin: 0 30upx;
					width: 100%;
					flex: 1;
				}
			}
		}
	}
</style>
