<template>
	<view class="cust_detail">
		<view class="recordinfo" v-for="(item,index) in payment_list" :key="index" @click="toDetail(item.id)">
			<view class="reconame">{{item.number}}</view>
			<view class="reconmoney">
				<view class="r_left">
					<view class="recostatus" v-if="item.check_status == 0"><span>待审核</span></view>
					<view class="recostatus" v-if="item.check_status == 1"><span>审核中</span></view>
					<view class="recostatus" v-if="item.check_status == 2"><span>审核通过</span></view>
					<view class="recostatus" v-if="item.check_status == 3"><span>审核未通过</span></view>
					<view class="recostatus" v-if="item.check_status == 4"><span>已撤回</span></view>
				</view>
				<view class="r_center">
					<view class="recostatus">
						<span>{{item.return_type}}</span>
					</view>
				</view>
				<view class="r_right">
					&yen;{{item.money}}
				</view>
			</view>
			<view class="recontime">
				回款日期 {{item.return_time}}
			</view>
		</view>
		<view style="height: 200rpx;"></view>
		<u-empty v-if="payment_list.length == 0" text="暂无更多"></u-empty>
		
		<view class="icon_creat" @click="toAddPayment">
			<image :src="BASE_IMG_URL+'1.png'" mode="scaleToFill"></image>
		</view>
		
	</view>
</template>

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

	export default {
		data() {
			return {
				BASE_IMG_URL:BASE_IMG_URL,
				plan_list: [], //回款计划 列表
				payment_list: [], //回款  列表 
				contactid:'',   //合同id
				customerid:'',  //客户id
			}
		},
		onLoad(options) {
			this.contactid = options.id
			this.customerid = options.kehuid
		},
		onShow() {
			//获取  回款  列表
			this.getPaymentlist()
		},
		methods: {
			//添加  回款
			toAddPayment(id) {
				uni.navigateTo({
					url: '/pagesB/contract/addPayment?id=' + this.contactid +'&kehuid='+this.customerid
				})
			},
			//回款  列表
			getPaymentlist() {
				netPaymentList({
					contract_id: this.contactid
				}).then(res => {
					this.payment_list = res.data.data
				})
			},
			// 回款  详情
			toDetail(id) {
				uni.navigateTo({
					url: '/pagesB/contract/paymentDetail?id=' + id
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.cust_detail {
		.recordinfo {
			background: #FFFFFF;
			margin-top: 20rpx;

			.reconame {
				font-size: 34rpx;
				color: #333;
				padding: 31rpx 0 34rpx 66rpx;
				border-bottom: 1px solid #ededed;
			}

			.reconmoney {
				display: flex;
				justify-content: space-between;
				padding: 24rpx 31rpx 20rpx 66rpx;
				.r_left {
					.recostatus{
						span{
							background:$uni-text-color-opcity;
							border-radius: 5rpx;
							font-size: 26rpx;
							color: $uni-text-color;
							padding: 5rpx 12rpx;
						}
					}
				}

				.r_center {
					.recostatus{
						span{
							background:$uni-text-color-opcity;
							border-radius: 5rpx;
							font-size: 26rpx;
							color: $uni-text-color;
							padding: 5rpx 12rpx;
						}
					}
				}

				.r_right {
					color: $uni-text-color;
					font-size: 34rpx;
					font-weight: 600;
				}
			}

			.recontime {
				color: #999;
				font-size: 26rpx;
				padding-left: 66rpx;
				padding-bottom: 33rpx;
			}
		}
	}
</style>
