<template>
	<Layout :index="-1" :banner="0"  :img="'/static/img/about.jpg'" :titles="'个人中心'" :title_content="'个人中心'">
		<view class="bg ptm-80">
			<view class="content">
				<view class="content_left">
					<memberleft :index="'5'"></memberleft>
				</view>
				<view class="content_right">
					<view class="tops">
						<view class="mtitle">
							<image src="../static/img/member/back.png" class="bimg" @tap="goBack()"></image>
							<image src="../static/img/member/tz.png" class="mimg"></image>
							信息详情
						</view>
						<view class="del" @tap="ndel()">
							<image src="../static/img/member/del.png" class="delimg"></image>
							删除
						</view>
					</view>
					<view class="lines"></view>
					
					<view class="content_r">
						<view class="notice_title">
							{{detailData.title}}
						</view>
						<view class="notice_time">
							{{detailData.create_time}}
						</view>
						<view class="notice_desc">
							<!-- 用于处理 \n 换行和多空行安全显示 -->
							<view v-html="(detailData.content || '').replace(/\n/g, '<br>')"></view>
						</view>
						<!-- 合同信息 -->
						 <view class="contract" v-if="1==2">
							<view class="contract_title">
								合同信息
							</view>
							<view class="contract_list">
								<view class="contract_item">
									<view class="contract_item_title">
										合同名称
									</view>
									<view class="contract_item_content">
										xxxxxx资产项目与平台签署的评估服务协议
									</view>
								</view>
								<view class="contract_item">
									<view class="contract_item_title">
										合同编号
									</view>
									<view class="contract_item_content">
										HT202405200001
									</view>
								</view>
								<!-- 签约时间 生效日期 到期时间 -->
								 <view class="contract_item">
									<view class="contract_item_title">
										签约时间
									</view>
									<view class="contract_item_content">
										2026-04-16 10:30:25
									</view>
								</view>
								<view class="contract_item">
									<view class="contract_item_title">
										生效日期
									</view>
									<view class="contract_item_content">
										2026-04-16 10:30:25
									</view>
								</view>
								<view class="contract_item">
									<view class="contract_item_title">
										到期时间
									</view>
									<view class="contract_item_content">
										2026-04-16 10:30:25
									</view>
								</view>
							</view>
						 </view>
						 <!-- 相关操作 -->
						 
						<view class="notice_btn" v-if="1==2">
							<view class="notice_cz">相关操作</view> 
							<button class="btn">下载服务合同</button>
						</view>
					</view>
					
				</view>
			</view>
			
		</view>
	</Layout>
</template>

<script>
	import Layout from './part/layouts.vue';
	import memberleft from './part/member_left.vue';
	export default {
		components:{
			Layout,
			memberleft
		},
		data(){
			return {
				page: 1,
				list_rows: 10,
				detailData: [],
				total: 0,
				name:'',
				id:''
			}
		},
		created() {
			const width = window.innerWidth;
			const height = window.innerHeight;
			const mobileWidth = 768; // 可以根据需要调整这个值
			const isMobile = width <= mobileWidth || height <= mobileWidth;
			if(isMobile){
				this.list_rows = 30;
			}
			let obj = this.$Route.query;
			if(obj.hasOwnProperty('id')){
				this.id = obj.id;
			}
			this.getData();
			console.log(this.id,222222222);
		},
		onShow() {
		},
		
		methods:{
			goBack(){
				uni.navigateTo({
				  url: '/notice_list'
				});

			},
			 downloadPDF(e) {
				 if(!e){
				 	 this.$message.error('评估报告生成中~');
				 }else{
					window.open(e, '_blank'); 
				 }
				// 下载
				// const pdfUrl = e; 
				// const a = document.createElement('a');
				// a.href = pdfUrl;
				// a.download = '评估报告.pdf'; 
				// a.click();
				// document.body.removeChild(a); 
			 },
			goEdit(e){
				this.$router.push({
					path: 'notice_details',
					query: {
						id: e
					}
				})
			},
			
			/*每页多少条*/
			handleSizeChange(val){
				this.list_rows = val;
				this.getData();
			},
			/*选择第几页*/
			handleCurrentChange(val){
				this.page = val;
				this.getData();
			},
			getData(){
				this._get('notice.Notice/detail',{
					notice_id: this.id,
				},res=>{
					this.detailData = res.data;
				}
				,err=>{
					uni.showToast({
						icon:'none',
						title: err.data.msg
					})
					return;
					// this.$message(err.data.msg);
				}
				);
			},
			ndel() {
				// 优化加上二次确认
				this.$confirm && typeof this.$confirm === 'function'
				? this.$confirm('确定要删除该通知信息吗？', '提示', {
						confirmButtonText: '确定',
						cancelButtonText: '取消',
						type: 'warning'
					}).then(() => {
						this._post('/notice.Notice/delete', {
							notice_id: this.id,
						}, res => {
							uni.showToast({
								icon: 'none',
								title: '操作成功'
							})
							setTimeout(() => {
								this.$router.push({ path: 'notice_list' });
							}, 1500);
						}, err => {
							uni.showToast({
								icon: 'none',
								title: err.data.msg
							})
							return;
						});
					}).catch(() => {
						// 用户取消了删除，不做处理
					})
				:'';
			}
		}
	}
</script>

<style lang="scss">
	.bg{
		width: 100%;
		background: #F1F1F1;
		min-height: 800px;
	}
	.content{
		width: 1290px;
		margin: 0 auto;
		padding-top: 14px;
		display: flex;
		justify-content: space-between;
	}
	.content_left{
		width: 245px;
		min-height: 789px;
		background: #FFFFFF;
		box-shadow: 0px 4px 10px 0px rgba(78,89,105,0.06);
		border-radius: 0px 0px 0px 0px;
	}
	.content_right{
		width: 1024px;
		min-height: 789px;
		background: #FFFFFF;
		box-shadow: 0px 4px 10px 0px rgba(78,89,105,0.06);
		border-radius: 0px 0px 0px 0px;
	}
	.mtitle{
		font-weight: 500;
		font-size: 16px;
		color: #3D3D3D;
		height: 48px;
		line-height: 48px;
		display: flex;
		width: 500px;
		align-items: center;
	}
	.lines{
		width: 985px;
		height: 0px;
		border: 1px solid #D8D8D8;
		opacity: 0.6;
		margin:0 auto;
	}
	.bimg{
		width: 20px;
		height: 20px;
		margin-right: 14px;
		margin-left: 38px;
	}
	.mimg{
		width: 20px;
		height: 20px;
		margin-right: 10px;
	}
	.content_r{
		padding: 30px 40px;
	}
	
	
	
	.tops{
		display: flex;
		justify-content: space-between;
		align-items: center;
	}
	.del{
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 54px;
		margin-right: 52px;
		font-family: Source Han Sans, Source Han Sans;
		font-weight: 400;
		font-size: 14px;
		color: #7B7B7B;
		line-height: 22px;
		text-align: right;
		cursor: pointer;
	}
	.delimg{
		width: 20px;
		height: 20px;
	}
	.notice_title{
		font-family: Source Han Sans, Source Han Sans;
		font-weight: 700;
		font-size: 18px;
		color: #3D3D3D;
		line-height: 22px;
		text-align: left;
		font-style: normal;
		text-transform: none;
	}
	.notice_time{
		font-family: Source Han Sans, Source Han Sans;
		font-weight: 400;
		font-size: 14px;
		color: #767676;
		line-height: 22px;
		text-align: left;
		font-style: normal;
		text-transform: none;
		margin-top: 8px;
	}
	.notice_desc{
		width: 765px;
		min-height: 134px;
		font-family: Source Han Sans, Source Han Sans;
		font-weight: 400;
		font-size: 14px;
		color: #3D3D3D;
		line-height: 22px;
		text-align: left;
		margin-top: 32px;
		margin-left: 6px;
	}

	.contract{
		width: 568px;
		height: 238px;
		border-radius: 10px;
		background-color: #f7f9f8;
		padding: 26px 0;
	}
	.contract_title{
		color: #3D3D3D;
		font-size: 16px;
		font-weight: 500;
		margin-left: 21px;
		margin-bottom: 20px;
	}
	.contract_item{
		display: flex;
		margin-bottom: 20px;
	}
	.contract_item_title{
		font-size: 16px;
		color: #767d8c;
		margin-left: 21px;
	}
	.contract_item_content{
		margin-left: 80px;
		font-size: 16px;
		color: #434a5a;
	}
	.notice_cz{
		margin-top: 30px;
		margin-bottom: 25px;
		font-size: 18px;
		font-weight: 500;
	}
	.notice_btn .btn{
		width: 154px;
		height: 46px;
		border-radius: 4px;
		background-color: #F78A30;
		line-height: 46px;
		text-align: center;
		margin-left: 0;
		color: #ffffff;
		font-size: 16px;
	}
	@media screen and (max-width: 768px) {
	
	}
</style>
