<template>
	<view class="footer">
		<view class="footer-amount" hover-class="app-tap-hover" @click="$emit('open-detail')">
			<view class="amt-top">
				<text class="amt-label">应收金额</text>
				<text class="amt-detail-link" v-if="selectedSuitId">明细</text>
			</view>
			<view class="amt-bottom">
				<text class="amt-value"><text class="amt-symbol">¥</text>{{ displayDeposit }}</text>
				<u-icon v-if="selectedSuitId" name="arrow-up" color="#9AA7B8" size="24"></u-icon>
			</view>
		</view>
		<view class="submit-btn" :class="{ disabled: submitting }" hover-class="app-tap-hover" @click="$emit('submit')">
			{{ submitting ? '处理中…' : '立即下单' }}
		</view>
	</view>
</template>

<script>
	export default {
		name: 'AgentOrderFooter',
		props: {
			displayDeposit: {
				type: [String, Number],
				default: '--'
			},
			selectedSuitId: {
				type: [String, Number],
				default: null
			},
			submitting: {
				type: Boolean,
				default: false
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import './agent-order-theme.scss';

	.footer {
		flex-shrink: 0;
		width: 100%;
		display: flex;
		align-items: center;
		background: #fff;
		padding: 18rpx 32rpx;
		padding-bottom: calc(18rpx + env(safe-area-inset-bottom));
		box-shadow: 0 -6rpx 24rpx rgba(46, 73, 117, 0.08);
		box-sizing: border-box;
	}

	.footer-amount {
		flex: 1;
		min-width: 0;
		padding-right: 20rpx;
	}

	.amt-top {
		display: flex;
		align-items: center;
		margin-bottom: 6rpx;
	}

	.amt-label {
		font-size: 22rpx;
		color: $ao-text-muted;
	}

	.amt-detail-link {
		margin-left: 12rpx;
		font-size: 22rpx;
		color: $ao-primary;
	}

	.amt-bottom {
		display: flex;
		align-items: center;
	}

	.amt-value {
		font-size: 44rpx;
		font-weight: 700;
		color: $ao-accent;
		line-height: 1;
	}

	.amt-symbol {
		font-size: 28rpx;
		margin-right: 2rpx;
	}

	.submit-btn {
		flex-shrink: 0;
		@include ao-primary-btn;
		min-width: 280rpx;
		border-radius: 45rpx;
		font-size: 32rpx;
		font-weight: 600;

		&:active {
			opacity: 0.88;
		}

		&.disabled {
			background: #C7CDD3;
			box-shadow: none;
		}
	}
</style>
