<template>
	<view class="container">
		<view class="list-box">
			<view class="list-item" v-for="(item,index) in listData" :key="index">
				<view class="item-info">
					<view class="name u-line-1">{{item.applyUserName}}({{item.applyDeptName}})</view>
					<view class="right">{{item.applyTime}}</view>
				</view>
				<view class="item-info">
					<view class="address u-line-1">{{item.address}}</view>
					<view class="right">台账号：{{item.accountNo}}</view>
				</view>
				<view class="item-info">
					<view class="left ">原价：<view class="oldprice">{{item.originPrice}}</view></view>
					<view class="right">改价：<view class="newprice">{{item.price}}</view></view>
				</view>
				<view class="btn-box">
					<!-- 申请状态【0 未审核 1 已审核 2 拒绝】 -->
					<view class="btn pass" @click="clickFun(1,item)">通过</view>
					<view class="btn refuse" @click="clickFun(2,item)">拒绝</view>
				</view>
			</view>
			<view class="empty-box" v-if="listData.length==0">
			<image class="img" src="http://images.2weisou.com/20221031114904TSF6jF4S.png" mode=""/>
			<view class="no-data">暂无数据</view>
		</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				roomId: '',
				listData: []
			};
		},
		onLoad(options) {
			this.roomId = options.id;
			this.getList()
		},
		methods: {
				// 申请状态【0 未审核 1 已审核 2 拒绝】
			clickFun(type,item){
				let body = {
					processId:item.assignmentId,//房源ID
					status:type,//审核状态 0 未审核 1 已审核 2 拒绝
				}
				this.$u.api.appChangePriceaccept({body:body}).then((res)=>{
					// console.log(res)
					if(res.ErrNo=='0000'){
						uni.showToast({
							title: res.ErrMsg,
							icon: 'none'
						})
						this.getList()
					}
				})
			},
			getList(){
				this.$u.api.appChangePricelist({body:{
					roomId: this.roomId
				}}).then((res)=>{
					// console.log(res)
					if(res.result&&res.result.length){
							this.listData = res.result
					}else{
							this.listData = []
					}
				})
			}
		},
	};
</script>

<style lang="scss" scoped>
.container{
	width: 750rpx;
	min-height: 100vh;
	background: #F8F8F8;
	padding-top: 20rpx;
	.list-box{
		.list-item{
			padding: 30rpx;
			height: 306rpx;
			background: #fff;
			font-size: 28rpx;
			font-family: PingFangSC-Regular, PingFang SC;
			font-weight: 400;
			color: #333333;
			margin-bottom: 20rpx;
			.item-info{
				display: flex;
				margin-bottom: 24rpx;
				justify-content: space-between;
				align-items: center;
				font-size: 28rpx;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #333333;
				line-height: 40rpx;
				.name{
					flex: 1;
				}
				.address{
				}
				.left{
					flex: 1;
					display: flex;
					align-items: center;
					.oldprice{
						font-family: PingFangSC-Semibold, PingFang SC;
						font-weight: 600;
						color: #333333;
					}
				}
				.right{
					flex: 0 0 278rpx;
					margin-left: 30rpx;
					display: flex;
					align-items: center;
					.newprice{
						font-family: PingFangSC-Semibold, PingFang SC;
						font-weight: 600;
						color: #FF6D25;
					}
				}
			}
			.btn-box{
				display: flex;
				justify-content: flex-end;
				.btn{
					width: 128rpx;
					height: 54rpx;
					line-height: 54rpx;
					text-align: center;
					font-size: 26rpx;
					font-family: PingFangSC-Regular, PingFang SC;
					font-weight: 400;
					border-radius: 8rpx;
				}
				.pass{
					background: #FF6D25;
					color: #fff;
					border: 1px solid #FF6D25;
					margin-right: 30rpx;
				}
				.refuse{
					background: #FFFFFF;
					border: 1px solid #FF6D25;
					color: #FF6D25;
				}
			}
			
		}
	}
}
</style>
