<template name="cm-ladder-popup">
	<!-- 规格阶梯价 -->
	<view class="tui-popup-maskmodel" v-show="show" @click.stop="hidePopup">
		<view class="tui-popup-ladder">
			<view class="tui-scrollview-box">
				<view class="ladder-main clearfix">
					<view class="ladder-item">
						<view class="ladder-item-td">起订量</view> 
                        <view class="ladder-item-td">价格</view>
					</view>
					<view class="ladder-item" v-for="(ladd, index) in ladderPriceList" :key="index">
						<view class="ladder-item-td">{{ ladd.numRange }}</view>
						<view class="ladder-item-td">￥{{ ladd.buyPrice | NumFormat }}</view>
					</view>
				</view>
			</view>
			<view class="tui-right-flex tui-popup-btn" :style="{ paddingBottom: isIphoneX ? '68rpx' : '34rpx' }">
				<view class="tui-flex-1">
					<view class="tui-button" @click.stop="hidePopup">了解</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
import { mapState, mapMutations } from 'vuex'
export default {
	name: 'cm-ladder-popup',
	props: {
		list: {
			type: Array
		},
		show: {
			type: Boolean,
			default: false
		},
		type: { 
			type: Number,
			default: 1
		}
	},
	data() {
		return {
			ladderPriceList:[]
		}
	},
	filters: {
		NumFormat: function(value) {
			//处理金额
			if (!value) return '0.00'
			let number = Number(value).toFixed(2)
			return number
		}
	},
	created() {
		this.ladderPriceList = this.list
	},
	methods: {
		hidePopup() {
			this.$parent.laddePopupShow = false
		}
	}
}
</script>

<style lang="scss">
.tui-popup-maskmodel{
	width: 100%;
	height: 100%;
	position: fixed;
	top: 0;
	left: 0;
	background: rgba(0, 0, 0, 0.6);
	z-index: 1000;
}
.tui-popup-ladder {
	width: 100%;
	height: 700rpx;
	box-sizing: border-box;
	padding: 40rpx 24rpx 0 24rpx;
	border-radius: 16rpx;
	background-color: #ffffff;
	box-shadow: 0px 10rpx 12rpx 0px rgba(0, 0, 0, 0.2);
	position: absolute;
	bottom: 0;
	left: 0;
	z-index: 1009;
	.tui-scrollview-box {
		width: 100%;
		height: auto;
		float: left;
		box-sizing: border-box;
		.ladder-main {
			width: 100%;
			min-height: 240rpx;
			border: 1px solid rgba(225, 86, 22, 0.6);
			border-radius: 10rpx;
			.ladder-item {
				width: 100%;
				height: 80rpx;
				float: left;
				border-bottom: 1px solid rgba(225, 86, 22, 0.6);
				&:nth-child(1) {
					.ladder-item-td {
						color: #333333;
					}
				}
				&:last-child {
					border-bottom: none;
				}
				.ladder-item-td {
					width: 50%;
					text-align: center;
					line-height: 80rpx;
					font-size: $font-size-28;
					color: $color-system;
					box-sizing: border-box;
					float: left;
					&:nth-child(1) {
						border-right: 1px solid rgba(225, 86, 22, 0.6);
					}
				}
			}
		}
	}	
}

.tui-popup-btn {
	width: 100%;
	height: auto;
	float: left;
	margin-top: 200rpx;
	.tui-button {
		width: 100%;
		height: 88rpx;
		background: $btn-confirm;
		line-height: 88rpx;
		text-align: center;
		color: #ffffff;
		font-size: $font-size-28;
		border-radius: 44rpx;
	}
}
</style>
