<template>
	<view>
		<view class="lxr_con_list" v-for="(item,index) in contract_list" :key="index"
			@click="toContractDetail(item.id)">
			<view class="name">{{item.name}}</view>
			<view class="info">已回款 &yen;{{item.receivables.repayment_money}}</view>
			<view class="info">待回款 &yen;{{item.receivables.be_money}}</view>
			<view class="proce_li">
				<view class="pro_li_left">
					<view class="protext">回款进度：</view>
					<view class="probox">
						<view class="proin"
							:style="{width:(item.receivables.ratio >= 100 ? 100 : item.receivables.ratio) +'%'}">
						</view>
					</view>
					<view class="pronum">{{item.receivables.ratio}}%</view>
				</view>
				<view class="pro_li_right">&yen;{{item.receivables.be_money}}</view>
			</view>
			<view class="info">签约时间：{{item.order_date}}</view>
			<view class="con_status" v-if="item.check_status == 0">
				<span>待审核</span>
			</view>
			<view class="con_status" v-if="item.check_status == 1">
				<span>审核中</span>
			</view>
			<view class="con_status pass" v-if="item.check_status == 2">
				<span>审核通过</span>
			</view>
			<view class="con_status nopass" v-if="item.check_status == 3">
				<span>审核未通过</span>
			</view>
			<view class="con_status nopass" v-if="item.check_status == 4">
				<span>已撤回</span>
			</view>
		</view>
		<view style="height:200rpx"></view>
		<u-empty v-if="contract_list.length == 0" text="暂无更多"></u-empty>
		<view class="icon_creat" v-if="type == 1" @click="addContract">
			<image :src="BASE_IMG_URL+'1.png'" mode="scaleToFill"></image>
		</view>
	</view>
</template>

<script> 
	import {
		netContractList
	} from '@/api/kehu.js'
	import {
		BASE_IMG_URL
	} from '@/util/api.js'

	export default {
		data() {
			return {
				BASE_IMG_URL:BASE_IMG_URL,
				contract_list: [],
				page: 1,
				limit: 10,
				totalPage: 1,
				type:1,   //1普通客户  2公海客户
				// id:'',
				customer_id:''
			}
		},
		onLoad(options) {
			this.id = options.id
			this.type = options.type
		},
		onShow() {
			this.contract_list = []
			this.page = 1
			this.getList()
		},
		onReachBottom() {
			if (this.page >= this.totalPage) {
				return
			}
			this.page++
			this.getList()
		},
		methods: {
			//新增合同
			addContract() {
				uni.navigateTo({
					url: '/pagesA/crm/contract/contract?id='+this.id
				})
			},
			getList() {
				netContractList({customer_id:this.id}).then(res => {
					this.contract_list = res.data
				})
			},
			//合同详情
			toContractDetail(id) {
				uni.navigateTo({
					url: '/pagesB/contract/contractDetail?id=' + id
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.active {
		
		text-align: center;
		border: none;
		background:$uni-text-color;
		padding: 5rpx 10rpx ;
		border-radius: 10rpx;
		color: #FFFFFF;
	}

	.list-box {
		// 　　　　width: 100%;
		overflow: hidden;
		white-space: nowrap;
	}
	.list-box {
		// 　　　　width: 100%;
		overflow: hidden;
		white-space: nowrap;
	}

	.list-item {
		border: 1px solid #999;
		// color: #999;
		padding: 5rpx 10rpx ;border-radius: 10rpx;
	}

	.valueactive {
		color: #666;
	}

	.select_warp {
		z-index: 9;
	}

	.searchbox {
		display: flex;
		justify-content: flex-end;
		margin: 20rpx 0;
		background: #ffffff;
		height: 100rpx;

		.searchtext {
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 30rpx;
			color: #999;
			margin-right: 55rpx;
		}
	}

	.warpbox {
		position: fixed;
		width: 750rpx;
		left: 0;
		top: 0rpx;
		bottom: 0;
		z-index: 2;
		background: rgba(0, 0, 0, 0.7);

		.screen_content {
			width: 702rpx;
			z-index: 2;
			border-top: 1rpx solid #CCCCCC;
			background-color: #fff;
			padding: 24rpx;

			.fir_li {
				margin-bottom: 20rpx;

				.li_label {
					font-size: 28rpx;
					color: $uni-text-color;
					margin-top: 30rpx;
					margin-bottom: 20rpx;
				}

				.classify {
					// background: red;
					display: flex;
					justify-content: space-around;

					.classify_flex {
						padding: 5rpx 16rpx;
						color: #999;
						font-size: 30rpx;
						border: 1px solid #999;
						border-radius: 10rpx;
					}

					.c_f {
						background: $uni-text-color !important;
						color: #fff;
					}
				}

				.li_box {
					// width:700rpx;
					
					height: 60rpx;
					padding: 0 35rpx;
					line-height: 60rpx;
					display: flex;
					justify-content: space-around;
					color: #999;
					
				}

				.form_right {
					// display: flex;
					color: #999;
					text-align: center;

					// justify-content: space-between;
					image {
						width: 40rpx;
						height: 40rpx;
						margin: 28rpx 5rpx 0 0;
					}

				}
			}
		}

		.button_bottom {
			display: flex;
			width: 100%;
			height: 90rpx;
			background-color: #fff;
			line-height: 90rpx;
			text-align: center;
			font-size: 32rpx;
			justify-content: space-around;
			padding-bottom: 100rpx;

			:first-child {
				color: #999;
				border: 1rpx solid #999;
				width: 260rpx;
				height: 88rpx;
				line-height: 88rpx;
				border-radius: 30rpx;
			}

			:last-child {
				background-color: $uni-text-color;
				color: #fff;
				width: 260rpx;
				height: 88rpx;
				line-height: 88rpx;
				border-radius: 30rpx;
			}
		}
	}

	.lxr_con_list {
		padding: 20rpx 0;
		margin-bottom: 20rpx;
		background: #fff;
		margin-top: 20rpx;
		&:last-child {
			border-bottom: none;
		}

		.name {
			font-size: 34rpx;
			color: #333333;
			// margin-top: 15rpx;
			font-weight: 500;
			border-bottom: 1rpx solid #ededed;
			padding: 0 0 30rpx 63rpx;
		}

		.info {
			font-size: 32rpx;
			color: #999999;
			margin: 10rpx 0;
			padding-left: 63rpx;
		}

		.proce_li {
			display: flex;
			justify-content: space-between;
			align-items: center;
			padding-left: 63rpx;
			margin: 10rpx 0;

			.pro_li_left {
				display: flex;
				justify-content: flex-start;
				align-items: center;

				.protext {
					font-size: 32rpx;
					color: #999999;
				}

				.probox {
					width: 120rpx;
					height: 30rpx;
					border-radius: 15rpx;
					background: #C0C0C0;
					margin: 0 15rpx;

					.proin {
						width: 20%;
						height: 30rpx;
						border-radius: 15rpx;
						background: $uni-text-color;
					}
				}

				.pronum {
					font-size: 24rpx;
					color: #999999;
				}
			}

			.pro_li_right {
				color: $uni-text-color;
				font-size: 40rpx;
				font-weight: 500;
				margin-right: 28rpx;
			}
		}

		.con_status {
			width: 130rpx;
			height: 36rpx;
			text-align: center;
			line-height: 36rpx;
			background: $uni-text-color-opcity;
			margin-top: 30rpx;
			margin-left: 63rpx;

			span {
				font-size: 26rpx;
				color: $uni-text-color;


			}
		}

		.nopass {
			color: #ec7f51;
		}

		.pass {
			color: #22A7F6;
		}
		
	}
	#btn{
			width: 500rpx;
			height: 88rpx;
			background: $uni-text-color;
			border-radius: 29rpx;
			font-size: 34rpx;
			color: #fff;
			line-height: 88rpx;
		}
</style>
