<template>
	<view>
		<view class="box">
			<view class="top">
				<text class="title">业务详情</text>
			</view>
		</view>
		<view class="card-box">
			<view class="card" v-for="(businessItem,index) in items" :key="businessItem.id">
				<view class="t">
					<image class="icon" src="../../static/home-icon-01.png"></image>
					<text class="title">{{businessItem.itemTypeName}}</text>
				</view>
				<view class="c">
					<view class="item car-num-item">
						<text class="car-num">{{businessItem.itemName}}</text>
					</view>
				</view>
				<view class="c">
					<view class="item">
						<text class="p1">录入时间:</text>
						<text class="p2">{{businessItem.createTime}}</text>
					</view>
				</view>
				<view class="c">
					<view class="item" v-if="businessItem.pickTime">
						<text class="p1">接单时间:</text>
						<text class="p2">
							<text>{{businessItem.pickTime}}</text>
						</text>
					</view>
				</view>
				<view class="c" v-if="businessItem.pick==1">
					<view class="item">
						<text class="p1">客户确认:</text>
						<text class="p2">
							<text v-if="businessItem.confirm==1">已确认</text>
							<text v-else>未确认</text>
						</text>
					</view>
				</view>
				<view class="c" v-if="businessItem.confirm==1">
					<view class="item">
						<text class="p1">确认时间:</text>
						<text class="p2">
							<text>{{businessItem.confirmTime}}</text>
						</text>
					</view>
				</view>
			</view>
		</view>
		<noData v-if="items.length==0"></noData>
		<u-loadmore style="margin: 30rpx;" :status="status" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				customerId: '',
				form: {},
				items: [],
				status: 'loadmore',
				p: {
					pageNo: 1,
					pageSize: 3,
					dataCount: 0
				},
			}
		},
		onShow() {
			this.getPartnerBusinessItem();
		},
		onBackPress() {
			this.$common.to('/pages/index/index')
			return true;
		},
		methods: {
			getPartnerBusinessItem() {
				this.$api.getPartnerBusinessItem(this.p).then(resp => {
					this.status = 'loadmore';
					this.p.pageNo = resp.pageNo;
					this.p.pageSize = resp.pageSize;
					this.p.dataCount = resp.dataCount;
					this.items = resp.data;
				})
			},
			//上拉加载更多，分页模拟数据
			onReachBottom() {
				if (parseInt(this.p.dataCount) > parseInt(this.p.pageSize) * parseInt(this.p.pageNo)) {
					this.status = 'loading';
					this.p.pageSize += 5;
					this.getPartnerBusinessItem();
				} else {
					this.status = 'nomore';
				}
			}
		}
	}
</script>

<style lang="scss">
	.card-box {
		display: flex;
		width: 100%;
		flex-direction: column;

		.card {
			background-color: #fff;
			border-radius: 20rpx;
			margin: 20rpx 20rpx 0 20rpx;
			padding: 30rpx;
			box-sizing: border-box;
			display: flex;
			flex-direction: column;

			.t {
				width: 100%;
				display: flex;
				align-items: center;
				padding-bottom: 30rpx;
				border-bottom: 1rpx solid #f5f5f5;

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

				.title {
					font-size: 35rpx;
					font-weight: bold;
					margin-left: 20rpx;
				}
			}

			.c {
				padding: 15rpx 0 30rpx 0;
				display: flex;
				flex-wrap: wrap;
				border-bottom: 1rpx solid #f5f5f5;

				.item {
					padding: 20rpx 0;

					.car-num {
						background-color: #edf6ff;
						color: #0080ff;
						font-size: 38rpx;
						padding: 15rpx 0;
						text-align: center;
						width: 100%;
						border-radius: 10rpx;
						font-weight: bold;
					}

					.p1 {
						font-size: 28rpx;
						color: #999;
					}

					.p2 {
						font-size: 28rpx;
						color: #191919;
						font-weight: bold;
						margin-left: 20rpx;
					}
				}

				.car-num-item {
					width: 100%;
					display: flex;
					align-items: center;
					justify-content: center;
				}
			}

			.b {
				display: flex;
				width: 100%;
				align-items: center;
				justify-content: space-between;

				.btn {
					height: 70rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					width: calc(100% - 15rpx);
					margin: 30rpx 0 0 0;
					border-radius: 10rpx;
					border-width: 1rpx;
					box-sizing: border-box;
				}

				.b1 {
					background-color: #0080ff;
					color: #fff;
				}

				.b2 {
					background-color: #f7f7f7;
					color: #191919;
				}

				.b3 {
					background-color: #fff;
					color: #0080ff;
					border: 1rpx solid #0080ff;
				}

				.b4 {
					background-color: #ff0000;
					color: #fff;
				}
			}
		}
	}

	@import '@/common/common.scss'
</style>
