<template>
	<dm-pop-view ref='popView' :title="isZj?'客户归属判定':'客户到访判定'"  :isShowTitle="true" :isShowClose="true" :isShowConfirm="false" :maskTapHide='maskTapHide'>
		<view class="content">
			<view class="content_title">{{isZj?'请判定客户归属':'请判定到访归属'}}</view>
			<scroll-view class="explain-contain" :scroll-y="true">
				<view v-for="(item, index) in daofangList" :key="index" class="content_item" @click="selectDf(index)">
					<view class="item_title">
						<view v-if="item.isZrSf">
							<view class="content-des" v-if="isZj">案场自然获电</view>
							<view class="content-des" v-else>案场自然顺访</view>
						</view>
						<view v-else>
							<view class="content-des">{{item.reporterOrganizeName||""}}{{item.reporterName||""}}-{{item.reporterHiddenMobile}}
							 <text v-if="item.isInterceptorInvalid">（截客失效）</text>
							 <text v-if="item.isRecommendRelation">{{isZj?'（推荐获电）':'（推荐到访）'}}</text>
							</view>
						</view>
						
						<image v-if="item.isSelected" class="select_status" src="../../static/icons/icon_selected@2x.png" mode=""></image>
						<image v-else class="select_status" src="../../static/icons/icon_unselected@2x.png" mode=""></image>
					</view>
				    <view class="content-time" v-if="item.isZrSf">选择此项则客户所有报备关系失效，归类为案场自然{{isZj?"获电":"顺访"}}</view>
					<view class="content-time" v-else>{{item.isRecommendRelation?"推荐时间":"报备时间"}} - {{item.reportTimeStr}} <text v-if="item.isImportReport">（导入）</text></view>
					<view class="line_gray"></view>
				</view>
			</scroll-view>
			
			<view class="content_bottom">
				<view class="goBtn" :style="`background-color: ${themeColor};`" @click="confirmAction">{{confirmStr}}</view>
			</view>
			
		</view>
	</dm-pop-view>
</template>

<script>
	import dmPopView from './dmPopView.vue'
	
	let app = getApp();
	export default {
		props: {
			maskTapHide: {
				type: Boolean,
				default: true
			},
			daofangList:Array,
			confirmStr: {
				type: String,
				default: '确认'
			},
			isZj:{
				type: Boolean,
				default: false
			}
		},
		data() {
			return {
				themeColor: null,
				fuzhuColor: null,
				themeColor50: null,
				themeColor25: null,
				fuzhuColor50: null,
				currentItem:null,
			}
		},
		mounted() {
			this.themeColor = app.globalData.themeColor
			this.themeColor50 = app.globalData.themeColor50
			this.themeColor25 = app.globalData.themeColor25
			this.fuzhuColor = app.globalData.fuzhuColor
			this.fuzhuColor50 = app.globalData.fuzhuColor50
			
		},
		methods: {
			show() {
				this.$refs.popView.show()
			},
			knowAction(){
				this.$refs.popView.hide()
			},
			confirmAction() {
				this.$refs.popView.hide();
				this.$emit('confirmAction',this.currentItem)
				
			},
			selectDf(index){
				this.currentItem  = null
				this.daofangList.forEach((item,ind)=>{
					if(index==ind){
						item.isSelected = true;
						this.currentItem = item;
					}else{
						item.isSelected = false;
					}
				})
			}
		},
		components: {
			dmPopView
		}
	}
</script>

<style scoped lang="scss">
	.content {
		width: 100%;
		height: 760rpx;
		font-family: Verdana;
		display: flex;
		flex-direction: column;
		
		.explain-contain {
			width: 100%;
			height: 600rpx;
			font-family: Verdana;
			color: #454545;
			overflow-y: scroll;
			padding-left: 32rpx;
			padding-right: 32rpx;
			box-sizing: border-box;
		}
		
		.content_title{
			font-size: 32rpx;
			font-family: Verdana, Verdana-Bold;
			font-weight: 700;
			text-align: left;
			color: #454545;
			margin-left: 30rpx;
			margin-top: 40rpx;
			margin-bottom: 36rpx;
		}
		
		.content_item{
			display: flex;
			flex-direction: column;
			.item_title{
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
				
				
				.content-des{
					font-size: 28rpx;
					font-family: Verdana, Verdana-Regular;
					font-weight: 400;
					text-align: left;
					color: #333333;
					max-width: 600rpx;
				}
				
				.select_status{
					width: 32rpx;
					height: 32rpx;
				}
			}
			.content-time{
				font-size: 24rpx;
				font-family: Verdana, Verdana-Regular;
				font-weight: 400;
				text-align: left;
				color: #999999;
				margin-top: 4rpx;
			}
			.line_gray{
				height: 2rpx;
				margin:22rpx 0rpx;
				opacity: 0.05;
				background: #546074;
			}
		}
		
		
		.content_bottom{
			width: 100%;
			height: 200rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
		}
		.goBtn {
			width: 260rpx;
			height: 84rpx;
			border-radius: 42rpx;
			
			font-size: 32rpx;
			color: #FFFFFF;
			line-height: 84rpx;
			text-align: center;
		}
		
		.knowBtn {
			width: 260rpx;
			height: 84rpx;
			border-radius: 42rpx;
			margin-left: calc((100% - 260rpx) / 2);
			margin-top: 20rpx;
			color: #666666;
			font-size: 32rpx;
			line-height: 84rpx;
			text-align: center;
		}
		
	}
</style>
