<template>
	<dm-pop-view ref="popView" title="更多筛选" :isShowConfirm="false" :maskTapHide="true">
		<scroll-view class="screen_container" scroll-y="true">
			<dm-time-level-screen :sortType="sortType" :queryDateType="queryDateType" @queryDateTypeAction="queryDateTypeAction" @sortTypeAction="sortTypeAction"></dm-time-level-screen>
			<dm-date-screen style="margin-top: 40rpx;" :defaultParameter="defaultParameter" @screenDateAction="screenDateAction"></dm-date-screen>
			<view class="screen_item_title" v-if='isSingleProject && roleType != 12'>选择报备组织</view>
			<view class="reportOrganize" @click="openReportOrganizePicker">
				<view class="organizeName">
					{{holdReportOrganize.title}}
				</view>
				<image class="organizeIcon" src="../../static/icons/icon_aboutUs_DropDown.png" mode=""></image>
			</view>

			<view class="screen_item_title">报备方式</view>
			<view class="level_tag_view">
				<text class="level_tag" :style="{ color: holdReportType == item.value ? '#fff' : '#666', 'background-color': holdReportType == item.value ? themeColor : '#F1F5F9' }"
				 v-for="(item, i) in reportTypeList" :key="i" @click="chooseType(item)">
					{{ item.title }}
				</text>
			</view>
			<view class="screen_item_title">客户最新动态</view>
			<view class="level_tag_view">
				<text class="level_tag" :style="{ color: holdReportState == item.value ? '#fff' : '#666', 'background-color': holdReportState == item.value ? themeColor : '#F1F5F9' }"
				 v-for="(item, i) in reportStateList" :key="i" @click="chooseState(item)">
					{{ item.title }}
				</text>
			</view>

			<view class="bottom_btn" style="margin-top: 60rpx;">
				<text class="reset_btn" :style="{'background-color':themeColor25}" @click="resetAction">重置</text>
				<text class="pop_btn" :style="{'background-color':themeColor}" @click="popConfirm">确定</text>
			</view>

			<dm-picker-view ref="reportOrganizePicker" :options="reportOrganizeList" :value="holdReportOrganize.value" title="选择报备组织"
			 @confirm="confirmReportOrganize"></dm-picker-view>
		</scroll-view>
	</dm-pop-view>
</template>

<script>
	import dmPopView from './dmPopView.vue'
	import dmTimeLevelScreen from './dmTimeLevelScreen.vue'
	import dmDateScreen from './dmDateScreen.vue'
	import dmPickerView from './dmPickerView.vue'

	export default {
		props: {
			defaultParameter: Object,
			isSingleProject: {
				type: Boolean,
				default: true
			},
			roleType: {
				type: [Number, String],
				default: '0'
			},
			holdReportOrganize: Object,
			holdReportType: String,
			holdReportState: String,
			reportTypeList: Array,
			reportStateList: Array,
			reportOrganizeList: Array,
			queryDateType: [Number, String],
			sortType: {
				type: [Number, String],
				default: 1
			}
		},
		data() {
			return {
				themeColor: '',
				fuzhuColor: '',
				themeColor50: '',
				themeColor25: '',
				fuzhuColor50: '',
			}
		},
		mounted() {
			let globalData = getApp().globalData
			this.themeColor = globalData.themeColor
			this.themeColor50 = globalData.themeColor50
			this.themeColor25 = globalData.themeColor25
			this.fuzhuColor = globalData.fuzhuColor
			this.fuzhuColor50 = globalData.fuzhuColor50
		},
		methods: {
			show() {
				this.$refs.popView.show()
			},
			queryDateTypeAction(e) {
				// this.queryDateType = e
				// this.getPageData()
				this.$emit('queryDateTypeAction', e)
			},

			sortTypeAction(e) {
				// this.sortType = e
				// this.getPageData()
				this.$emit('sortTypeAction', e)
			},
			// 筛选中时间选择
			screenDateAction(val, start, end) {
				this.$emit('screenDateAction', val, start, end)
				// this.defaultParameter.dateType = val
				// this.defaultParameter.startDate = start
				// this.defaultParameter.endDate = end
			},
			openReportOrganizePicker() {
				this.$refs.reportOrganizePicker.show()
			},
			chooseType(item) {
				// this.holdReportType = item.value;
				this.$emit('chooseType', item)
			},
			chooseState(item) {
				// this.holdReportState = item.value;
				this.$emit('chooseState', item)
			},
			confirmReportOrganize(e) {
				this.$emit('confirmReportOrganize', e)
				// this.holdReportOrganize = {
				// 	title: e.selItem.title,
				// 	value: e.selItem.value
				// }
			},
			resetAction() {
				this.$refs.popView.hide()
				this.$emit('resetAction')
			},
			popConfirm() {
				this.$refs.popView.hide()
				this.$emit('sureAction')
			}
		},
		components: {
			dmPopView,
			dmTimeLevelScreen,
			dmDateScreen,
			dmPickerView
		}
	}
</script>

<style scoped lang="scss">
	.screen_container {
		margin-top: 40rpx;
		margin-bottom: 50rpx;
		overflow-y: scroll;
		// display: flex;
		// flex-direction: column;
		width: 750rpx;
		height: 960rpx;
		min-height: 960rpx;
		max-height: 960rpx;
		// max-height: 1200rpx;

		.screen_item_title {
			margin-left: 30rpx;
			margin-top: 40rpx;
			line-height: 44rpx;
			font-size: 32rpx;
			font-family: Verdana, Verdana-Bold;
			font-weight: 700;
			text-align: left;
			color: #454545;
		}

		.level_tag_view {
			margin-left: 30rpx;
			margin-top: 0rpx;
			display: flex;
			flex-wrap: wrap;

			.level_tag {
				margin-right: 16rpx;
				// padding: 0 20rpx;
				// height: 56rpx;
				// border-radius: 8rpx;
				width: 220rpx;
				height: 72rpx;
				border-radius: 12rpx;
				font-size: 28rpx;
				font-family: Verdana, Verdana-Regular;
				font-weight: 400;
				text-align: center;
				line-height: 72rpx;
				margin-top: 20rpx;
				// margin-bottom: 10rpx;
			}
		}

		.reportOrganize {
			margin-top: 20rpx;
			margin-left: 30rpx;
			margin-right: 30rpx;
			padding: 0 30rpx;
			box-sizing: border-box;
			border-radius: 16rpx;
			background-color: #F1F5F9;
			height: 94rpx;
			min-height: 94rpx;
			max-height: 94rpx;
			display: flex;
			justify-content: space-between;
			align-items: center;
			line-height: 94rpx;

			.organizeName {
				font-size: 28rpx;
				font-family: Verdana;
			}

			.organizeIcon {
				width: 14rpx;
				height: 9rpx;
			}
		}

		.screen_item_sub {
			margin-top: 8rpx;
			margin-bottom: 40rpx;
			margin-left: 30rpx;
			line-height: 34rpx;
			font-size: 24rpx;
			font-family: Verdana, Verdana-Regular;
			font-weight: 400;
			text-align: left;
			color: #999999;
		}

		.score_view {
			margin-top: 30rpx;
			margin-bottom: 120rpx;
			display: flex;
			justify-content: center;
			align-items: center;
			height: 82rpx;

			.score_text {
				font-size: 70rpx;
				font-family: 'DIN Alternate', 'DIN Alternate-Bold';
				font-weight: 700;
			}

			.score_unit {
				padding-top: 25rpx;
				font-size: 28rpx;
				font-family: Verdana, Verdana-Regular;
				font-weight: 400;
			}
		}

		.bottom_btn {
			display: flex;
			justify-content: center;
			margin-bottom: 60rpx;

			.reset_btn {
				width: 156rpx;
				height: 80rpx;
				border-radius: 40rpx;
				font-size: 28rpx;
				font-family: Verdana, Verdana-Bold;
				font-weight: 700;
				text-align: center;
				line-height: 80rpx;
				color: #666666;
			}

			.pop_btn {
				margin-left: 30rpx;
				width: 444rpx;
				height: 80rpx;
				border-radius: 40rpx;
				font-size: 28rpx;
				font-family: Verdana, Verdana-Bold;
				font-weight: 700;
				text-align: center;
				line-height: 80rpx;
				color: #ffffff;
			}
		}
	}
</style>
