<template name="cm-price">
    <!--促销活动弹窗提示-->
    <tui-bottom-popup :radius="true" :show="popupShow" @close="hidePopup()">
        <view class="tui-popup-box clearfix">
            <template v-if="product.activeStatus == 1">
                <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 product.ladderList" :key="index">
                            <view class="ladder-item-td">{{ ladd.buyNum }}</view>
                            <view class="ladder-item-td">{{ ladd.buyPrice | NumFormat }}</view>
                        </view>
                    </view>
                </view>
            </template>
            <view class="tui-right-flex tui-popup-btn">
                <view class="tui-flex-1"> <view class="tui-button" @click="hidePopup()">了解</view> </view>
            </view>
        </view>
    </tui-bottom-popup>
</template>

<script>
import { mapGetters } from 'vuex'
export default {
    name: 'cm-price',
    props: {
        product: {
            type: Object
        },
        popupShow: {
            type: Boolean,
            default: false
        }
    },
    filters: {
        NumFormat: function(text) {
            //处理金额
            return Number(text).toFixed(2)
        }
    },
    created() {
        console.log(this.product)
    },
    computed: {
        ...mapGetters(['hasLogin', 'isWxAuthorize', 'isIphoneX'])
    },
    methods: {
        hidePopup() {
            this.$parent.popupShow = false
        },
        goGoodActiveFn(id) {
            this.$parent.popupShow = false
            this.$api.navigateTo('/pages/goods/goods-active?id=' + id)
        }
    }
}
</script>

<style lang="scss">
.tui-flex-1 {
    flex: 1;
}
.tui-popup-box {
    position: relative;
    box-sizing: border-box;
    min-height: 220rpx;
    padding: 24rpx 24rpx 0 24rpx;
    z-index: 9999;
}
.tui-scrollview-box {
    width: 100%;
    height: auto;
    float: left;
    box-sizing: border-box;
    .ladder-main {
        width: 100%;
        border: 1px solid $color-system;
        border-radius: 10rpx;
        .ladder-item {
            width: 100%;
            height: 80rpx;
            float: left;
            border-bottom: 1px solid $color-system;
            &: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-24;
                color: $color-system;
                box-sizing: border-box;
                float: left;
                &:nth-child(1) {
                    border-right: 1px solid $color-system;
                }
            }
        }
    }
    .box-title {
        font-size: $font-size-26;
        color: $text-color;
        text-align: left;
        line-height: 56rpx;
        .txt {
            color: $color-system;
            margin: 0 8rpx;
        }
    }
    .box-text {
        font-size: $font-size-26;
        color: $text-color;
        text-align: left;
        line-height: 56rpx;
        .txt {
            color: #ff457b;
        }
    }
    .box-product {
        width: 100%;
        height: auto;
        margin-top: 20rpx;
        .title {
            font-size: $font-size-24;
            color: $text-color;
            text-align: left;
            line-height: 54rpx;
        }
        .box-product-main {
            width: 100%;
            height: 136rpx;
            float: left;
            margin: 10rpx 0;
            .image {
                width: 134rpx;
                height: 134rpx;
                border: 1px solid #ebebeb;
                float: left;
                image {
                    width: 100%;
                    height: 100%;
                    display: block;
                }
            }
            .info {
                width: 540rpx;
                height: 134rpx;
                float: left;
                margin-left: 16rpx;
                position: relative;
                .name {
                    width: 100%;
                    float: left;
                    line-height: 40rpx;
                    font-size: $font-size-28;
                    color: $text-color;
                    -o-text-overflow: ellipsis;
                    text-overflow: ellipsis;
                    display: -webkit-box;
                    word-break: break-all;
                    -webkit-box-orient: vertical;
                    -webkit-line-clamp: 2;
                    overflow: hidden;
                }
                .num {
                    width: 100%;
                    height: 44rpx;
                    font-size: $font-size-24;
                    color: $text-color;
                    text-align: left;
                    line-height: 44rpx;
                    position: absolute;
                    bottom: 0;
                    left: 0;
                }
            }
        }
    }
}

.tui-popup-btn {
    width: 100%;
    height: auto;
    float: left;
    margin-top: 24rpx;
    .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>
