<template>
	<div>
		<div class="analysis-cell" @tap="toggleShow" :class="{ 'active': item.show }">
			<div class="shop-title">
				<span> {{ (i > 8 ? i + 1 : '0' + (i + 1)) + ' ' + item.SHOPNAME }}</span>
				<p>
					<span v-show="item.UNACCOUNT_SIGN">￥</span>
					<span class="cell-price"
						:style="{ 'padding-right': !item.UNACCOUNT_SIGN ? '0' : '0', 'font-size': !item.UNACCOUNT_SIGN ? '24rpx' : '24rpx' }">{{
							item.UNACCOUNT_SIGN
								? $util.fmoney(item.CASHPAY_TOTAL, 2) : '无结账信息' }}</span>
					<image src="/static/images/effective/true.png" mode="aspectFit" class="" v-if='item.SHOWDEAL_SIGN'>
					</image>
					<!-- <text class="uni-icon uni-icon-checkmarkempty"  v-if='item.SHOWDEAL_SIGN'></text> -->

				</p>
			</div>
			<p v-if="item.detail.length > 0" style="line-height: 1.2;">
				<span v-for="(child, index) in item.detail" :key="index" class="atribute-tag">{{ child }} </span>
			</p>
		</div>
		<div class="analysis-detail" v-show="item.show">
			<div class="detail-unit" v-for="(unit, o) in item.ShopEndAccountList" :key="o">
				<div class="uni-inline-flex">
					<span class="detail-title">结账时间：</span>
					<div style="flex: 1;text-align: left;">
						<div style="font-size: 24rpx;">起 {{ unit.ENDACCOUNT_STARTDATE }}</div>
						<div style="font-size: 24rpx;">止 {{ unit.ENDACCOUNT_DATE }}</div>
					</div>
					<span style="color:#EE7941;margin-right:50rpx;padding-top: 20rpx;font-size: 24rpx;">{{
						getHour(unit.ENDACCOUNT_STARTDATE, unit.ENDACCOUNT_DATE) }}小时</span>
				</div>
				<block v-if="unit.DESCRIPTION_DATE">

					<div class="detail-title">日结校验：{{ unit.DESCRIPTION_DATE }}</div>
					<p><span class="detail-title">{{ unit.DESCRIPTION_STAFF }}：</span><span>{{ unit.DIFFERENCE_REASON
							}}</span>
					</p>
				</block>
				<block v-if="unit.APPROVE_DATE">
					<div><span class="detail-title">日结审核：{{ unit.APPROVE_DATE }}</span></div>
					<p><span class="detail-title">{{ unit.APPROVE_STAFF }}：</span><span>{{ unit.APPROVED_INFO }}</span>
					</p>
				</block>
				<div>
					<p class="detail-short-info" v-show="unit.FACTAMOUNT_SALE">单品报表：<text
							class="uni-icon uni-icon-checkmarkempty"></text></p>
					<p class="detail-short-info" v-show="unit.FACTAMOUNT_CIGARETTE">香烟数据：<span
							class="uni-icon uni-icon-checkmarkempty"></span></p>
				</div>
				<div><span class="detail-title detail-short-info">稽核次数：{{ unit.CHECK_COUNT }} 次</span><span
						class="detail-short-info">长短款额：{{ $util.fmoney(unit.DIFFERENT_PRICE) }} 元</span></div>
				<div>
					<span class="detail-title detail-short-info">现金缴款：{{ $util.fmoney(unit.CASHPAY_DOWNLORD) }} 元</span>
					<span class="detail-short-info">移动支付：{{ $util.fmoney(unit.MOBILEPAYMENT) }} 元</span>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
export default {
	props: {
		item: {
			type: Object,
			required: true
		},
		i: {
			type: Number,
			required: true
		}
	},
	data() {
		return {


		}
	},
	computed: {

	},
	methods: {
		getHour(start, end) {
			return parseInt((new Date(end) - new Date(start)) / (1000 * 3600))
		},

		toggleShow() {
			this.$emit('toggleShow', this.i)
		}
	}
}
</script>

<style lang="scss" scoped>
.analysis-cell {
	background-color: #fff;
	border-radius: 16rpx;
	margin-bottom: 16rpx;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
	padding: 16rpx 16rpx 8rpx;
	display: flex;
	flex-direction: column;
	transition: all 0.3s ease;
	position: relative;

	&.active {
		border: 2rpx solid #27B25F;
		box-shadow: 0 4px 20px rgba(39, 178, 95, 0.15);
	}
}

.analysis-cell .shop-title {
	display: flex;
	justify-content: space-between;
	position: relative;
	font-size: 24rpx;
	font-weight: 600;
	align-items: flex-start;

	span {
		color: #333;
		flex: 1;
	}

	p {
		display: flex;
		align-items: center;
		flex-shrink: 0;
	}
}

.analysis-cell .shop-title:before {
	content: '';
	position: absolute;
	width: 24rpx;
	height: 24rpx;
	border-radius: 50%;
	left: -40rpx;
	top: 4rpx;
	background: #e0e0e0;
	border: 3rpx solid #fff;
	box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.1);
	transition: all 0.3s ease;
}

.analysis-cell.active .shop-title:before {
	background: #27B25F;
	box-shadow: 0 2rpx 12rpx rgba(39, 178, 95, 0.3);
}

.shop-title image {
	width: 32rpx;
	height: 32rpx;
	margin-left: 12rpx;
	border-radius: 4rpx;
}

.analysis-cell .cell-price {
	color: #27B25F;
	font-family: 'PingFang SC', sans-serif;
	font-size: 24rpx;
	font-weight: 700;
}

.atribute-tag {
	display: inline-block;
	background: linear-gradient(135deg, #ff9f43, #ff8c42);
	color: #fff;
	padding: 4rpx 12rpx;
	margin: 4rpx 8rpx 4rpx 0;
	border-radius: 20rpx;
	font-size: 20rpx;
	font-weight: 500;
	box-shadow: 0 2rpx 8rpx rgba(255, 159, 67, 0.2);
}

.analysis-detail {
	background-color: #f8f9fa;
	border-radius: 12rpx;
	position: relative;
	overflow: hidden;
	// margin-top: 16rpx;
	border: 1rpx solid #f0f0f0;
}

.analysis-detail span,
.analysis-detail view {
	color: #333;
	font-size: 26rpx;
}

.uni-icon-checkmarkempty,
.analysis-detail span.uni-icon-checkmarkempty {
	color: #2ed573;
	font-size: 32rpx;
	font-weight: 600;
}

.analysis-detail::before {
	content: '';
	width: 0;
	height: 0;
	border-left: 12rpx solid transparent;
	border-right: 12rpx solid transparent;
	border-bottom: 16rpx solid #f8f9fa;
	position: absolute;
	top: -16rpx;
	left: 32rpx;
}

.analysis-detail .detail-unit {
	background-color: #fff;
	padding: 24rpx;
	border-radius: 8rpx;
	// margin: 16rpx;
	box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);

	&:first-child {
		// margin-top: 24rpx;
	}

	&:last-child {
		margin-bottom: 24rpx;
	}
}

.analysis-detail .detail-unit>div {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 16rpx;

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

.analysis-detail .detail-unit>p {
	margin-bottom: 16rpx;

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

.analysis-detail span {
	display: inline-block;
	vertical-align: middle;
	line-height: 1.4;
}

.analysis-detail .detail-title {
	min-width: 140rpx;
	color: #666;
	font-weight: 500;
	font-size: 24rpx;
}

.analysis-detail .detail-short-info {
	width: 50%;
	color: #333;
	font-size: 24rpx;

	&:first-child {
		padding-right: 16rpx;
	}
}

.uni-inline-flex {
	span:last-child {
		color: #ff9f43;
		font-weight: 600;
		font-size: 28rpx;
	}
}
</style>
