<template>
    <div class="commission">
        <div class="commission-value">
            <div class="value">
                <span>{{ commission.total }}</span>
                <span>元</span>
            </div>
            <div class="sub">累计佣金</div>
        </div>

        <van-cell-group>
            <van-cell
                title="可提现佣金"
                :value="commission.available + '元'"
                title-class="cell-title"
                value-class="cell-value"
            />
        </van-cell-group>
        <van-cell-group>
            <van-cell title="已申请佣金" value="0.00元" title-class="cell-title" value-class="cell-value" />
            <van-cell title="待打款佣金" value="0.00元" title-class="cell-title" value-class="cell-value" />
            <van-cell title="无效佣金" value="0.00元" title-class="cell-title" value-class="cell-value" />
            <van-cell
                title="成功提现佣金"
                :value="commission.withdraw + '元'"
                title-class="cell-title"
                value-class="cell-value"
            />
        </van-cell-group>
        <van-cell-group>
            <van-cell
                title="待收货佣金"
                :value="commission.notChecked + '元'"
                title-class="cell-title"
                value-class="cell-value"
            />
            <van-cell
                title="未结算佣金"
                :value="commission.notChecked + '元'"
                title-class="cell-title"
                value-class="cell-value"
            />
        </van-cell-group>

        <div class="tips">
            <div class="tips-title">用户须知</div>

            <div class="tips-content">
                买家确认收货后，立即获得分销佣金
                <br />注意：可用佣金满 <span>1元</span>后才能申请提现
            </div>
        </div>
    </div>
</template>
<script>
import { mapState } from 'pinia'
import { useUserStore } from '@/stores/user'
export default {
    name: 'commissionPage',
    data() {
        return {
            commission: {}
        }
    },
    computed: {
        ...mapState(useUserStore, ['user'])
    },
    mounted() {
        this.$http.get('/commission/detail').then(res => {
            this.commission = res
        })
    }
}
</script>
<style lang="less" scoped>
.commission {
    background: rgba(242, 244, 245, 1);
    padding: 15px;
    box-sizing: border-box;
}

.commission-value {
    height: 110px;
    background: rgba(255, 143, 0, 1);
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--ion-color-step-0);
    font-size: 12px;
    line-height: 17px;

    .value {
        span {
            &:first-child {
                font-size: 24px;
                font-weight: bold;
            }

            &:last-child {
                margin-left: 4px;
            }
        }
    }

    .sub {
        margin-top: 7px;
    }
}
.cell-title {
    font-size: 14px;
    font-weight: bold;
    color: var(--ion-color-light-contrast);
}
.cell-value {
    font-size: 16px;
    color: var(--ion-color-light-contrast);
}

.van-cell {
    line-height: 40px;
}
.van-cell-group {
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.tips {
    margin-top: 15px;

    .tips-title {
        font-size: 14px;
        color: rgba(var(--ion-color-light-contrast-rgb), 1);
        line-height: 20px;
    }

    .tips-content {
        margin-top: 6px;
        font-size: 13px;
        color: rgba(102, 102, 102, 1);
        span {
            color: #ff8f00;
        }
    }
}
</style>
