<template>
  <view>
	<view v-if="datalist.length>0">
		<!-- 我的提案 -->
		<block v-if="listtype=='case'">
			<view class="caselist" v-for="(ite,idx) in datalist" :key='idx' @click="getDetail(ite.proposalId)">
				<view class="tit overtwo">{{ite.title}}</view>
				
				<view class="flexcw" >
					<view class="ftxt" v-if="type!='wdta'&&type!='gkta'">
						<text>提案者</text>
						<view>{{ite.proposalName}}</view>
					</view>
					<view class="ftxt" v-if="type=='lmta'||type=='tjyx'||type=='tjzd'||type=='lmta'||type=='gkta'">
						<text>案号</text>
						<view>{{ite.proposalType}}</view>
					</view>
					<view class="ftxt" v-if="type=='tasc'||type=='tajb'||type=='tabl'||type=='bjsh'||type=='tacb'">
						<text>提案类型</text>
						<view>{{ite.proposalType==0?'大会提案':'平时提案'}}</view>
					</view>
				</view>
				<view class="ftxt" v-if="type=='tjyx'||type=='tjzd'">
					<text>推荐截止</text>
					<view>{{ite.categoryName}}</view>
				</view>
				<block v-if="type!='tjyx'&&type!='tjzd'">
					<view class="ftxt">
						<text>提案类别</text>
						<view>{{ite.categoryName}}</view>
					</view>
					<view class="ftxt">
						<text>提交时间</text>
						<view>{{ite.createTime}}</view>
					</view>
					<view class="ftxt">
						<text>提案状态</text>
						<view class="co0b">{{kaType(ite.proposalProgress)}}</view>
					</view>
				</block>
				
				<!-- 委员反馈 提案办理 -->
				<view class="casebtn flexc" v-if="type=='tabl'">
					<view class="ftit">办理状态<text>待反馈</text></view>
					<view class="btn btn3" v-if="ite.satisfaction">已反馈</view>
					<view class="btn btn2" v-else>反馈意见</view>
				</view>
				<!-- 提案审查 -->
				<view class="casebtn flexc" v-if="type=='tasc'">
					<block v-if="!ite.isRecord">
						<view class="lftit">该提案暂未审查立案</view>
						<view class="btn btn1" @click.stop="getTuiFn(ite,'scfk','1')">不予立案</view>
						<view class="btn btn2" @click.stop="getTuiFn(ite,'scfk','0')">立案</view>
					</block>
					<!-- <block v-if="ite.isRecord=='0'">
						<view class="lftit">该提案已审查立案,查看<text class="lfdet">审查反馈</text></view>
						<view class="btn btn3">已立案</view>
					</block>
					<block v-if="ite.isRecord==1">
						<view class="lftit">该提案暂未通过审查立案</view>
					</block> -->
				</view>
				<!--提案交办  -->
				<view class="casebtn flexc" v-if="type=='tajb'">
					<block v-if="ite.isRecord=='0'">
						<view class="lftit">该提案已进行交办,查看<text class="lfdet">交办详情</text></view>
						<view class="btn btn3">已交办</view>
					</block>
					<block v-if="ite.isRecord==1">
						<view class="lftit">该提案暂未进行交办</view>
						<view class="btn btn2" @click.stop="getTuiFn(ite,'tajb')">交办</view>
					</block>
				</view>
				<!--办结审核  -->
				<view class="casebtn flexc" v-if="type=='jbsh'">
					<block v-if="ite.isRecord=='0'">
						<view class="lftit">该提案已办结,查看<text class="lfdet">办结审核情况</text></view>
						<view class="btn btn3">已办结</view>
					</block>
					<block v-if="ite.isRecord==1">
						<view class="lftit">该提案暂未办结</view>
						<view class="btn btn2" @click.stop="getTuiFn(ite,'jbsh')">交办审核</view>
					</block>
				</view>
				<!--催办  4(不包含4) 之后 可以催办-->
				<view class="casebtn flexc" v-if="type=='tacb'">
					<!-- <block v-if="ite.isRecord=='0'">
						<view class="lftit">该提案已被催办 <text class="co1d">1次</text></view>
						<view class="btn btn3">再次催办</view>
					</block> -->
					<!-- <block v-if="ite.isRecord==1">
						<view class="lftit">该提案暂未被催办</view>
						<view class="btn btn2" @click.stop="getTuiFn(ite,'tacb')">催办</view>
					</block> -->
					<view class="lftit"></view>
					<view class="btn btn2" @click.stop="getTuiFn(ite,'tacb')">催办</view>
				</view>
				<!-- 联名提案 -->
				<view class="casebtn flexc" v-if="type=='lmta'">
					<view class="lftit">您的联名提案未反馈</view>
					<!-- <view class="lftit">您的联名提案已反馈,查看<text class="lfdet">反馈详情</text></view> -->
					<view class="btn  btn1" @click.stop="getTuiFn(ite,'lmta','2')">反对</view>
					<view class="btn btn2" @click.stop="getTuiFn(ite,'lmta','1')">同意</view>
					<view class="btn btn3">已同意</view>
				</view>
				<!-- 推荐优秀 -->
				<view class="casebtn flexc" v-if="type=='tjyx'">
					<block v-if="ite.isOutstanding==0">
						<view class="lftit" >该提案已推荐为优秀,查看<text class="lfdet">推荐理由</text></view>
						<view class="btn btn2"><image :src="zanimg" class="zanimg"></image>推荐优秀</view>
					</block>
					<block v-else>
						<view class="lftit">该提案暂未推荐为优秀</view>
						<view class="btn btn3"  @click.stop="getTuiFn(ite,'tjyx')"><image :src="nzanimg" class="zanimg"></image>推荐优秀</view>
					</block>
				</view>
				<!-- 推荐重点 -->
				<view class="casebtn flexc" v-if="type=='tjzd'">
					<block v-if="ite.isKeyPoint==0">
						<view class="lftit" >该提案已推荐为重点,查看<text class="lfdet">推荐理由</text></view>
						<view class="btn btn2"  @click.stop="getTuiFn(ite,'tjzd')"><image :src="start" class="staimg"></image>推荐重点</view>
					</block>
					<block v-else>
						<view class="lftit" >该提案暂未推荐为重点</view>
						<view class="btn btn3"><image :src="nstart" class="staimg"></image>推荐重点</view>
					</block>
				</view>
				<!-- 质量评议 -->
				<!-- <view class="casebtn flexc" v-if="type=='lmta'">
					<view class="lftit">该提案暂未进行质量评议</view>
					<view class="lftit">该提案已评议,查看<text class="lfdet">评议详情</text></view>
					<view class="btn btn2" @click="getTuiFn('zlpy')"><image :src="flower" class="staimg"></image>质量评议</view>
					<view class="btn btn3"><image :src="nflower" class="staimg"></image>已评议</view>
				</view> -->
			</view>
		</block>
		<view class="shax" v-if="wtdt">{{wtdt}}</view>
	</view>
	<block v-else>
		<no-data></no-data>
	</block>
  </view>
</template>

<script>
	import { selectValue } from '@/utils/common.js';
	import noData from "@/components/nodata/nodata.vue"
  export default {
	props:{
		datalist: {
			type: Array,
			default () {
				return []
			}
		},
		tajdlist: {
			type: Array,
			default () {
				return []
			}
		},
		wtdt:{
			type: String,
			default () {
				return ''
			}
		},
		type:{
			type: [String,Number],
			default () {
				return ''
			}
		},
		listtype:{
			type: [String,Number],
			default () {
				return ''
			}
		}
	},
	components:{
		noData
	},
	data(){
		return{
			start:require("@/work/static/images/start.png"),
			nstart:require("@/work/static/images/nstart.png"),
			zanimg:require("@/work/static/images/zanico.png"),
			nzanimg:require("@/work/static/images/nzanico.png"),
			flower:require("@/work/static/images/flower.png"),
			nflower:require("@/work/static/images/nflower.png"),
		}
	},
	onLoad: function() {
	},
	methods:{
		kaType(ite){
			return selectValue(this.tajdlist, ite);
		},
		getDetail(e){
			this.$emit('getDetail',e)
		},
		getTuiFn(ite,txt,sh){
			var that=this;
			if(txt=='scfk'&&sh==0){
				uni.showModal({
					title: '确认立案',
					content: "是否确认立案",
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							var obj={
								id:ite.proposalId,
								type:txt,
								sh:sh,
							}
							that.$emit('getTuiFn',obj)
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			}else if(txt=='lmta'&&sh==1){
				uni.showModal({
					title: '确认联名',
					content: "是否确认联名",
					cancelText: '取消',
					confirmText: '确认',
					success: function(res) {
						if (res.confirm) {
							var obj={
								id:ite.proposalId,
								type:txt,
								sh:sh,
							}
							that.$emit('getTuiFn',obj)
						} else if (res.cancel) {
							// console.log('用户点击取消');
						}
					}
				});
			}else{
				var obj={
					id:ite.proposalId,
					type:txt,
					sh:sh,
				}
				this.$emit('getTuiFn',obj)
			}
			
		},
		typeFn(data){
			if(data){
				var newArr=[]
				var astr=data.split('-')
				astr.forEach(ite=>{
					var a=ite.substring(0,5);
					newArr.push(a)
				})
				return newArr.join('-')
			}else{
				return ''
			}
		},
	},
	
  }
</script>

<style lang="scss" scoped>
.caselist{background: #FFFFFF;border-radius: 30rpx;margin-top: 24rpx;padding: 38rpx 24rpx 8rpx;
	.tit{font-weight: bold;font-size: 32rpx;color: #222327;margin-bottom: 42rpx;}
	.ftxt{display: flex;align-items: flex-start;margin-bottom: 32rpx;flex:0 1 auto;min-width: 50%;
		text{font-weight: bold;font-size: 26rpx;color: #CACACA;flex: 0 0 auto;min-width: 104rpx;text-align-last: justify;}
		view{flex: 1;color: #343434;font-size: 26rpx;margin-left: 20rpx;line-height: 34rpx;}
	}
	.casebtn{padding: 24rpx 0;border-top: 2rpx solid #E6E6E6;
		.ftit{font-weight: bold;font-size: 26rpx;color: #CACACA;flex: 1;
			text{color: $com-cd3;margin-left: 20rpx;font-weight:500;min-width: 104rpx;text-align-last: justify;}
		}
		.lftit{font-weight: 500;font-size: 26rpx;color: #666666;flex:1;
			.lfdet{color: $com-cd3;text-decoration: underline;}
		}
		.zanimg{width: 22rpx;height: 20rpx;margin-right: 14rpx;}
		.staimg{width: 24rpx;height: 24rpx;margin-right: 14rpx;}
		.btn{min-width: 118rpx;height: 52rpx;border-radius: 26rpx;font-weight: bold;flex: 0 0 auto;display: flex;align-items: center;
font-size: 26rpx;margin-left: 26rpx;line-height: 52rpx;text-align: center;padding: 0 32rpx;box-sizing: border-box;
		&.btn1{background: #FFEDED;color: #FF4141;}
		&.btn2{background: #E4EEFF;color: #1D64E2;}
		&.btn3{background: #ECECEC;color: #666666;}
		
		}
	}
}

</style>