<template>
	<view class="cust_detail">
		<view class="cust_item">
			<view class="signli" v-for="(item,liindex) in signlist" :key="item.id" @click="toDetail(item)">
				<view class="signtop">
					<image :src=" item.staff.img ? item.staff.img : BASE_IMG_URL+'headImg.png'" class="headimg"
						 mode="scaleToFill"></image>
					<view class="info">
						<view class="infotop">
							<view class="name">{{item.staff.name}}</view>
							<view class="time">{{item.createtime}}</view>
						</view>
						<view class="address">{{item.location}}</view>
					</view>
				</view>
			</view>
			
			<view style="height: 200rpx;"></view>
			<u-empty v-if="signlist.length == 0" text="暂无更多"></u-empty>
			
			<view class="icon_creat" v-if="type == 1" @click="toSigntrip">
				<image :src="BASE_IMG_URL+'1.png'"  mode="scaleToFill"></image>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		netContact,
		netContractList,
		netEditFileName,
		netPaymentList,
		netKehuFileList,
		netOperationList,
		netCostList,
		netSubordList
	} from '@/api/kehu.js'
	import {
		netGetSignList
	} from '@/api/index.js'
	import {
		BASE_IMG_URL
	} from '@/util/api.js'

	export default {
		data() {
			return {
				BASE_IMG_URL: BASE_IMG_URL,
				signlist: [], //签到记录列表
				page:1,
				totalPage:1,
				type:1,   //1普通客户  2公海客户
			}
		},
		onLoad(options) {
			this.kehuid = options.id
			this.type = options.type
		},
		onShow() {
			this.init()
		},
		created() {

		},
		onReachBottom() {
			if(this.page < this.totalPage){
				this.page ++
				this.getSignList()
			}
		},
		methods: {
			toDetail(item) {
				uni.navigateTo({
					url:'/pagesA/signin/signDetail?id='+item.id
				})
			},
			init() {
				this.page = 1
				this.signlist = []
				this.getSignList()
			},
			//签到 列表
			getSignList() {
				netGetSignList({
					customer_id: this.kehuid,
					page:this.page
				}).then(res => {
					let arr = res.data.data
					arr.forEach(ele=>{
						if(ele.file_ids && ele.file_ids.length > 3){
							ele.showMore = true
							ele.imglist = ele.file_ids.slice(0,3)
						}else{
							ele.showMore = false
							ele.imglist = ele.file_ids
						}
					})
					this.signlist = this.signlist.concat(arr)
					this.totalPage = res.data.last_page
				})
			},
			lookMore(index) {
				let arr = this.signlist
				arr.forEach((ele,eleindex)=>{
					if(eleindex == index) {
						ele.showMore = false
					}
					if((ele.file_ids.length > 3) && (eleindex != index)){
						ele.showMore = true
						ele.imglist = ele.file_ids.slice(0,3)
					}else{
						ele.showMore = false
						ele.imglist = ele.file_ids
					}
				})
			},
			//新增签到
			toSigntrip() {
				uni.navigateTo({
					url: '/pagesA/signin/busSign?customerid=' + this.kehuid
				})
			},
			selectPhone(mobile) {
				// #ifdef MP-ALIPAY
				dd.showCallMenu({
				    phoneNumber: mobile, 
				    code: '+86'
				})
				// #endif
				// #ifndef MP-ALIPAY || APP-PLUS
				uni.makePhoneCall({
					phoneNumber: mobile
				})
				// #endif
				// #ifdef APP-PLUS
				plus.device.dial(mobile, true);
				// #endif
			},
			// 点击 附件  查看
			previeImg(arr,index) {
				uni.previewImage({
					urls: arr,
					current:index
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	#btn {
		width: 500rpx;
		height: 88rpx;
		background: $uni-text-color;
		border-radius: 29rpx;
		font-size: 34rpx;
		color: #fff;
		line-height: 88rpx;
		text-align: center;
		margin: 30rpx auto;
	}

	// 签到记录
	.signli {
		padding: 30rpx;
		background: #fff;
		border-radius: 10rpx;
		margin-bottom: 20rpx;
		.signtop {
			display: flex;
			justify-content: flex-start;
			align-items: center;

			.headimg {
				width: 80rpx;
				height: 80rpx;
				border-radius: 50%;
				
			}

			.info {
				margin-left: 15rpx;

				.infotop {
					width: 600rpx;
					display: flex;
					justify-content: space-between;
					// align-items: center;

					.name {
						font-size: 30rpx;
						color: #333;
					}

					.time {
						font-size: 26rpx;
						color: #999;
						margin-left: 10rpx;
					}
				}

				.address {
					font-size: 26rpx;
					color: #666;
					margin-top: 24rpx;
				}
			}
		}

		.remark {
			padding: 20rpx;
			font-size: 26rpx;
			line-height: 32rpx;
		}

		.kehu {
			display: flex;
			justify-content: flex-start;
			align-items: center;
			font-size: 24rpx;
			padding: 0 20rpx;
			color: #666;

			.kehuinfo {
				font-size: 24rpx;
				color: $uni-text-color;
			}
		}
	}

	.fujian {
		font-size: 24rpx;
		color: #333;
		padding: 0 20rpx;
		.imgbox {
			align-items: center;
			margin-top: 15rpx;
			display: flex;
			justify-content: flex-start;
			align-items: center;
			.imgli{
				display: flex;
				justify-content: flex-start;
				align-items: center;
				.box {
					width: 150rpx;
					height: 150rpx;
					margin-right: 50rpx;
					background: #ededed;
				}
			}
			image {
				margin: auto 0;
			}
		}
	}

	.cust_detail {

		.cust_item {
			margin-bottom: 20rpx;

			.cust_item_head {
				background: #fff;
				display: flex;
				justify-content: space-between;
				line-height: 100rpx;
				border-bottom: 1rpx solid #EAEAEA;
				padding: 0 24rpx;

				.head_info {
					display: flex;
					align-items: center;

					.icon--task {
						margin-right: 10rpx;
					}
				}

				.head_new {
					display: flex;
					align-items: center;
					color: #1c9bfc;

					.icon-clock {
						margin-right: 10rpx;
					}
				}
			}

			.lxr_con_list {
				padding: 20rpx;
				background: #fff;
				// border-bottom: 1rpx solid #C0C0C0;
				margin-bottom: 20rpx;

				&:last-child {
					border-bottom: none;
				}

				.name {
					font-size: 28rpx;
					color: #333333;
					margin-top: 15rpx;
				}

				.info {
					font-size: 24rpx;
					color: #999999;
					margin: 10rpx 0;
				}

				.proce_li {
					display: flex;
					justify-content: space-between;
					align-items: center;

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

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

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

							.proin {
								width: 20%;
								height: 15rpx;
								border-radius: 8rpx;
								background: #ff7800;
							}
						}

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

					.pro_li_right {
						color: #ec7f51;
						font-size: 28rpx;
						font-weight: 500;
					}
				}

				.con_status {
					font-size: 24rpx;
					color: $uni-text-color;
					margin-top: 10rpx;
				}
			}

			.cust_item_con {
				padding: 15rpx 24rpx;
				display: flex;
				justify-content: space-between;
				align-items: center;
				background: #fff;
				margin-bottom: 20rpx;

				.con_info {
					flex: 1;
					padding: 10rpx 0;
					mrgin-right: 10rpx;

					:first-child {
						color: #060606;
						font-weight: 700;
						line-height: 50rpx;
						font-size: 28rpx;
					}

					:last-child {
						color: #469369;
						line-height: 50rpx;
					}
				}

				.con_money {
					flex-shrink: 0;
					color: #ec7f51;
					font-size: 28rpx;
					line-height: 150rpx;
					font-weight: 700;
				}
			}

			.item_doc {
				padding: 0 24rpx;
				background: #fff;

				.doc_item {
					display: flex;
					justify-content: space-between;
					align-items: center;
					background-color: #f7faff;
					line-height: 60rpx;
					margin-bottom: 20rpx;

					.icon--task {
						width: 50rpx;
						padding-left: 10rpx;
					}

					.doc_name {
						flex: 1;
						white-space: nowrap;
						overflow: hidden;
						text-overflow: ellipsis;
					}

					.doc_size {
						width: 130rpx;
					}

					.editimg {
						width: 40rpx;
						height: 40rpx;
					}

					.icon-clear {
						width: 50rpx;
					}
				}
			}

			.operation_record {
				padding: 20rpx 30rpx;
				background: #fff;

				.record_item {
					display: flex;
					justify-content: space-between;
					margin-bottom: 20rpx;
					padding-bottom: 1rpx solid #EAEAEA;
					padding-bottom: 20rpx;

					&:last-child {
						border-bottom: none;
					}

					image {
						width: 80rpx;
						height: 80rpx;
						border-radius: 50%;
						flex-shrink: 0;
					}

					.record_info {
						flex: 1;
						margin-left: 25rpx;
						line-height: 40rpx;
						font-size: 28rpx;

						.info_top {
							display: flex;
							justify-content: space-between;
							align-items: center;
							margin-bottom: 10rpx;
						}

						.shenhetext {
							font-size: 26rpx;
							color: #666;
							line-height: 34rpx;
						}
					}

					.record_line {
						position: absolute;
						top: -102rpx;
						left: -26rpx;
						height: 105rpx;
						border-left: 4rpx dotted #dedede;
					}
				}
			}
		}
	}

	.peopleimg {
		width: 35rpx;
		height: 35rpx;
		margin-right: 15rpx;
	}

	.phoneimg {
		width: 40rpx;
		height: 60rpx;
		margin-right: 20rpx;
	}

	.con-name,
	.con-mobile {
		line-height: 50rpx;
	}

	.con-mobile {
		color: #999;
	}

	.cline_li {
		padding: 20rpx 24rpx;
		background: #fff;
		// border-bottom:1rpx solid #CCCCCC;
		margin-bottom: 20rpx;

		&:last-child {
			border-bottom: 0;
		}
	}

	.clineInfo {
		.info_head {
			display: flex;
			justify-content: space-between;

			:first-child {
				font-size: 28rpx;
				font-weight: 700;
				color: #999;
			}

			:last-child {
				&::before {
					position: relative;
					display: block;
					content: '';
					width: 10rpx;
					height: 10rpx;
					top: 24rpx;
					left: -22rpx;
					background-color: #52c1f5;
					border-radius: 5rpx;
				}
			}
		}

		.info_main {
			display: flex;
			justify-content: space-between;

			.main_left {
				.left_followUp {
					display: flex;
					padding: 20rpx 0;
				}

				.left_star {
					display: flex;
					padding-bottom: 20rpx;
				}
			}

			.main_right {
				text-align: center;
				padding: 20rpx 20rpx 0 0;

				image {
					width: 44rpx;
					height: 44rpx;
					margin-bottom: 5rpx;
					border-radius: 50%;
				}
			}
		}
	}
</style>
