<template>
    <view class="main">
        <!-- nav -->
        <navigation>{{ i18n.WalletHistory }}</navigation>
        <!-- headBtn -->
        <view class="head">
            <view class="headItem" @click="pageState = 'balance'" :class="{ select: pageState === 'balance' }">
                {{ i18n.Balance }}
            </view>
            <view class="headItem" @click="pageState = 'contarct'" :class="{ select: pageState === 'contarct' }">
                {{ i18n.Contarct }}
            </view>
        </view>

        <view class="cardList">
            <view class="card" v-for="(item, index) in 4" :key="index">
                <!-- 卡片条件渲染 -->
                <!-- balance -->
                <card-header v-if="pageState === 'balance'"
                    :iconName="`../../static/me/${(0 + +balanceTestValue) > 0 ? 'ic_wallet_add' : 'ic_wallet_minus'}.png`"
                    :title="'973430980989323445'" :rightName="balanceTestValue"
                    :fontColor="`${(0 + +balanceTestValue) > 0 ? '#00E8A2' : '#F4506A'}`">
                </card-header>
                <view class="dataBody" v-if="pageState === 'balance'">
                    <Key-value-row :keyName="i18n.Time" :value="'2022/08/06 14:51'"></Key-value-row>
                    <view class="text">Postscript : ontact customer service on the top-left corner for identity verific
                    </view>
                </view>


                <!-- contarct -->
                <card-header v-if="pageState === 'contarct'"
                    :iconName="`../../static/me/${(0 + +contarctTestValue) > 0 ? 'ic_wallet_add' : 'ic_wallet_minus'}.png`"
                    :title="'973430980989323445'" :rightName="contarctTestValue"
                    :fontColor="`${(0 + +contarctTestValue) > 0 ? '#00E8A2' : '#F4506A'}`">
                </card-header>
                <view class="dataBody" v-if="pageState === 'contarct'">
                    <Key-value-row :keyName="i18n.Time" :value="'2022/08/06 14:51'"></Key-value-row>
                    <view class="text">Postscript : ontact customer service on the top-left corner for identity verific
                    </view>
                </view>



            </view>
        </view>
    </view>
</template>

<script>
import KeyValueRow from '../../components/KeyValueRow/KeyValueRow.vue';
import CardHeader from '../../components/cardHeader/cardHeader.vue';
export default {
    components: { KeyValueRow, CardHeader },
    name: "walletHistory",
    data() {
        return {
            pageState: 'balance',
            balanceTestValue: '+100', //测试用数据
            contarctTestValue: '-100',
        };
    },
    computed: {
        i18n() {
            return this.$t("me");
        },
    },
    onLoad() {
    },
    onShow() { },
    methods: {


    },
}
</script>

<style lang="scss" scoped>
.main {

    .head {
        margin-top: 200rpx;
        margin-left: 60rpx;
        width: 632rpx;
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 48rpx 0;

        .headItem {
            width: 300rpx;
            height: 68rpx;
            line-height: 68rpx;
            background: #211F32;
            border-radius: 16rpx;
            text-align: center;
            font-size: 32rpx;
            color: #A1A0A8;

            &.select {
                background: #00E8A2;
                color: #15141F;
            }

        }
    }

    .cardList {
        padding-bottom: 40rpx;

        .card {
            overflow: hidden;
            background: #211F32;
            border-radius: 32rpx;
            margin: 0 32rpx 32rpx;



            .dataBody {
                box-sizing: border-box;
                padding: 32rpx;

                .text {
                    margin-top: 20rpx;
                    padding: 10rpx 16rpx;
                    background: #323045;
                    border-radius: 8rpx;
                    font-size: 24rpx;
                    color: #A1A0A8;
                }
            }

        }
    }

}
</style>
