<!--分销记录-->
<template>
    <div id="distributionRecord">
        <Nav :title="$t('distributionRecord.title')"></Nav>
        <div class="content">
            <template v-if="recordList.length">
                <div class="cell" v-for="item,index in recordList" :key="index">
                    <div class="top">
                        <div>
                            <!-- <div><span>{{$t('distributionRecord.orderNim')}}:</span><span>{{item.orderNo}}</span></div> -->
                            <div><span>{{$t('distributionRecord.distributionUser')}}:</span><span>{{item.customerName}}</span></div>
                            <!-- <div><span>{{$t('distributionRecord.tradeName')}}:</span><span>{{item.commodityName}}</span></div> -->
                        </div>
                        <div>
                            <div><span>¥{{item.orderMoney}}</span></div>
                            <div style="marginTop:.08rem"><span style="fontSize: 0.14rem">积分</span></div>
                            <div><span>+{{item.distributionIntegral}}</span></div>
                        </div>
                    </div>
                    <div class="bottom">
                        <div><span>{{$t('distributionRecord.completionTime')}}:</span><span>{{item.createTime}}</span></div>
                    </div>
                </div>
            </template>
            <template v-else>
                <van-empty :description="$t('distributionRecord.none')"></van-empty>
            </template>
        </div>
        <van-overlay :show="loading" @click="loading = false">
            <div class="wrapper" @click.stop>
                <div class="block">
                    <van-loading color="#1989fa" size="50" />
                </div>
            </div>
        </van-overlay>
    </div>
</template>

<script>
import Nav from "@/components/pages/nav";
import { customerDistributionList } from "@/api/comp/personal.js";
export default {
    data() {
        return {
            loading: true,
            recordList: [],
        };
    },
    mounted() {
        this.getData();
        // setTimeout(() => {
        //     for (let i = 0; i < 5; i++) {
        //         this.recordList.push({
        //             orderNum: "1231465969004",
        //             user: "张三",
        //             commodity: "商品名称商品名称商品名称商品名称",
        //             money: 20,
        //             complete: "2022-08-12  13:30",
        //         });
        //     }
        //     this.loading = false;
        // }, 1000);
    },
    components: {
        Nav,
    },
    methods:{
        getData(){
            this.loading = true;
            customerDistributionList().then(res=>{
                if(res.code==200){
                    this.recordList=res.data;
                    this.loading = false;
                }
            })
        }
    }
};
</script>

<style lang="scss" scoped>
#distributionRecord {
    .content {
        background: #f9f9f9;
        padding: 0.12rem /* 12/100 */;
        box-sizing: border-box;
        color: #333333;
        min-height: calc(100vh - 0.44rem /* 128/100 */);
        .cell {
            width: 100%;
            background: #fff;
            border-radius: 0.05rem /* 5/100 */;
            box-shadow: 0px 0px 5px #e9e9e9;
            padding: 0.12rem /* 12/100 */;
            box-sizing: border-box;
            text-align: left;
            margin-bottom: 0.12rem /* 12/100 */;
            .top {
                font-size: 0.14rem /* 15/100 */;
                font-weight: bold;
                display: flex;
                justify-content: space-between;
                padding-bottom: 0.12rem /* 12/100 */;
                border-bottom: 1px solid #eeeeee;
                > div:nth-child(1) {
                    > div {
                        > span:nth-child(1) {
                            margin-right: 0.08rem /* 5/100 */;
                            line-height: 0.26rem /* 22/100 */;
                        }
                    }
                }
                > div:nth-child(2) {
                    > div {
                        > span {
                            font-size: 0.17rem /* 17/100 */;
                            color: #38d0c9;
                        }
                    }
                }
            }
            .bottom {
                font-size: 0.13rem /* 13/100 */;
                padding: 0.12rem /* 12/100 */ 0;
                > div {
                    > span {
                        color: #999999;
                    }
                    >span:nth-child(1){
                        margin-right: 0.08rem /* 5/100 */;
                    }
                }
            }
        }
    }
}
</style>