<template>
	<view class="erp-submit-bar">
		<button class="submit-btn" :disabled="disabled" @click="handleClick">
			<slot>{{ text }}</slot>
		</button>
	</view>
</template>

<script>
export default {
	name: 'ErpSubmitBar',
	props: {
		text: { type: String, default: '' },
		disabled: { type: Boolean, default: false }
	},
	methods: {
		handleClick() {
			if (!this.disabled) {
				this.$emit('click');
			}
		}
	}
}
</script>

<style scoped>
.erp-submit-bar {
	position: fixed;
	bottom: 0;
	left: 0;
	width: 100%;
	background: #fff;
	padding: 20rpx 30rpx calc(env(safe-area-inset-bottom) + 20rpx);
	box-sizing: border-box;
	box-shadow: 0 -10rpx 30rpx rgba(0, 0, 0, 0.05);
	z-index: 100;
}

.submit-btn {
	background: #C1001C;
	color: #fff;
	height: 100rpx;
	border-radius: 50rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 34rpx;
	font-weight: bold;
	border: none;
}

.submit-btn:active {
	opacity: 0.9;
	transform: scale(0.98);
}

.submit-btn[disabled] {
	background: #e0e0e0;
	color: #999;
}
</style>
