<template>
	<view class="cust_detail">
		<view class="planinfo" v-for="(item,index) in plan_list" :key="index">
			<view class="planfir">
				<view class="name">回款期数：{{item.num}}</view>
			</view>
			<view class="plansec"> 
				<view class="plantime">
					<view class="plantype">计划回款方式：{{item.return_type}}</view>
					<view class="plantype" style="padding-bottom: 34rpx;">计划回款日期：{{item.return_date}}</view>
				</view>
				<view class="planmoney">&yen;{{item.money}}</view>
			</view>
		</view>
		<view style="height: 200rpx;"></view>
		<u-empty v-if="plan_list.length == 0" text="暂无更多"></u-empty>
		
		<view class="icon_creat" @click="toAddPlan">
			<image :src="BASE_IMG_URL+'1.png'" mode="scaleToFill"></image>
		</view>
	</view>
</template>

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

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

<style lang="scss" scoped>
	.cust_detail {
		.planinfo {
			margin-top: 20rpx;
			background: #fff;
			.planfir {
				border-bottom: 1px solid #ededed;
				.name {
					font-size: 34rpx;
					color: #333;
					padding: 28rpx 0 31rpx 63rpx;
				}
			}
			.plansec {
				display: flex;
				justify-content: space-between;
				.plantime {
					padding-left: 63rpx;
					.plantype {
						font-size: 26rpx;
						color: #999;
						margin-top: 34rpx;
					}
				}

				.planmoney {
					margin-right: 31rpx;
					margin-top: 63rpx;
					font-size: 34rpx;
					color: $uni-text-color;
					font-weight: 500;
				}
			}
		}
	}
</style>
