<template>
    <div id="personal">
        <Nav :title="$t('personal.title')" :iconType="false" :out="true"></Nav>
        <div class="content">
            <div class="top">
                <div class="perfect">
                    <div>
                        <span>{{userData.name}}</span>
                    </div>
                    <div @click="getPerfect">
                        <van-icon name="edit" color="#38d0c9" size="14" />
                        <span>{{$t('personal.perfect')}}</span>
                    </div>
                </div>
                <!--
                <div class="phone">
                    <van-icon class="iconfont" class-prefix="icon" name="shouji" size="14"></van-icon>
                    <span>{{userData.phone}}</span>
                </div>
                -->
                <div class="cell">
                    <div class="title">
                        <span>{{$t('personal.myOrder')}}</span>
                    </div>
                    <div class="list">
                        <div v-for="item,index in orderList" :key="index" @click="gePath(item.path,item.query)">
                            <div>
                                <img :src="require('@/../public/static/images/icon/'+item.icon+'.png')" alt="" srcset="">
                            </div>
                            <span>{{item.text}}</span>
                        </div>
                    </div>
                </div>
            </div>
            <div class="bottom">
                <div class="cell">
                    <div class="title">
                        <span>{{$t('personal.myIntegral')}}</span>
                    </div>
                    <div class="list">
                        <div v-for="item,index in integralList" :key="index" @click="gePath(item.path)">
                            <img :src="require('@/../public/static/images/icon/'+item.icon+'.png')" alt="" srcset="">
                            <span>{{item.text}}</span>
                        </div>
                    </div>
                </div>
                <!--
                <div class="cell">
                    <div class="title">
                        <span>{{$t('personal.mySale')}}</span>
                    </div>
                    <div class="list">
                        <div v-for="item,index in distributionList" :key="index" @click="gePath(item.path)">
                            <img :src="require('@/../public/static/images/icon/'+item.icon+'.png')" alt="" srcset="">
                            <span>{{item.text}}</span>
                        </div>
                    </div>
                </div>-->
                <div class="cell">
                    <div class="title">
                        <span>{{$t('personal.myDiscount')}}</span>
                    </div>
                    <div class="list">
                        <div v-for="item,index in couponList" :key="index" @click="gePath(item.path,item.query)">
                            <img :src="require('@/../public/static/images/icon/'+item.icon+'.png')" alt="" srcset="">
                            <span>{{item.text}}</span>
                        </div>
                    </div>
                </div>
                <div class="cell">
                    <div class="title">
                        <span>{{$t('personal.myFootprint')}}</span>
                    </div>
                    <div class="list">
                        <div v-for="item,index in footprintList" :key="index" @click="gePath(item.path)">
                            <img :src="require('@/../public/static/images/icon/'+item.icon+'.png')" alt="" srcset="">
                            <span>{{item.text}}</span>
                        </div>
                    </div>
                </div>
                <div class="cell">
                    <div class="title">
                        <span>{{$t('personal.messageCenter')}}</span>
                    </div>
                    <div class="list">
                        <div v-for="item,index in newsList" :key="index" @click="gePath(item.path)">
                            <img :src="require('@/../public/static/images/icon/'+item.icon+'.png')" alt="" srcset="">
                            <span>{{item.text}}</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
import Nav from "@/components/pages/nav";
export default {
    data() {
        return {
            //我的订单
            orderList: [
                {
                    icon: "待付款",
                    text: this.$t('personal.toBePaid'),
                    path: "toBePaid",
                    query: { type: 1 },
                },
                {
                    icon: "待发货",
                    text: this.$t('personal.toBeAttended'),
                    path: "toBePaid",
                    query: { type: 2 },
                },
                {
                    icon: "路径 11039",
                    text: this.$t('personal.completed'),
                    path: "toBePaid",
                    query: { type: 3 },
                },
                {
                    icon: "退款售后",
                    text: this.$t('personal.refunded'),
                    path: "toBePaid",
                    query: { type: 4 },
                },
                {
                    icon: "组 11486",
                    text: this.$t('personal.evaluated'),
                    path: "toBePaid",
                    query: { type: 5 },
                },
            ],
            //我的积分
            integralList: [
                {
                    icon: "积分说明",
                    text: this.$t('personal.integralDescription'),
                    path: "integralDescription",
                },
                { icon: "组 11487", text: this.$t('personal.scoreRecord'), path: "integralRecord" },
                /**{ icon: "积分兑换", text: this.$t('personal.transferPoints'), path: "transferPoints" },*/
            ],
            //我的分销
            distributionList: [
                {
                    icon: "会员说明",
                    text: this.$t('personal.distributionDescription'),
                    path: "dstributionDescription",
                },
                {
                    icon: "组 11488",
                    text: this.$t('personal.distributionRecords'),
                    path: "distributionRecord",
                },
                {
                    icon: "组 11542",
                    text: this.$t('personal.distributionRWM'),
                    path: "distributionCode",
                },
            ],
            //我的优惠券
            couponList: [
                {
                    icon: "组 11489",
                    text: this.$t('personal.couponDescription'),
                    path: "couponDescription",
                },
                {
                    icon: "积分使用",
                    text: this.$t('personal.notUsed'),
                    path: "coupon",
                    query: { type: 1 },
                },
                {
                    icon: "积分使用2",
                    text: this.$t('personal.used'),
                    path: "coupon",
                    query: { type: 2 },
                },
                {
                    icon: "组 11490",
                    text: this.$t('personal.expired'),
                    path: "coupon",
                    query: { type: 3 },
                },
            ],
            //我的收藏/足迹
            footprintList: [
                { icon: "组 11491", text: this.$t('personal.myCollection'), path: "myCollection" },
                { icon: "组 11492", text: this.$t('personal.myTracks'), path: "myTracks" },
            ],
            //消息中心
            newsList: [{ icon: "组 11493", text: this.$t('personal.onlineService')}],
            userData:{
                name:'',
                phone:''
            }
        };
    },
    components: {
        Nav,
    },
    created() {
        //获取用户信息
        let userInfo = this.$store.state.user.userInfo;
        //写入用户信息
        this.userData.name=userInfo.nickName||this.$t('personal.noneName');
        this.userData.phone = userInfo.username;
    },
    methods: {
        getPerfect() {
            this.$router.push({
                path: "/perfect",
            });
        },
        gePath(path, query) {
            if (path) {
                let json = {
                    path: "/" + path,
                };
                if (query) {
                    json.query = query;
                }
                console.log(json, "888");
                this.$router.push(json);
            }
        },
    },
};
</script>

<style lang="scss" scoped>

#personal {

    .content {
        background: #f6f6f6;
        .top {
            padding: 0.12rem /* 12/100 */;

            .perfect {
                display: flex;
                align-items: center;
                justify-content: space-between;
                padding: 0.1rem /* 10/100 */ 0;
                > div:nth-child(1) {
                    font-size: 0.15rem /* 17/100 */;
                    text-align:left;
                    font-weight:600;
                    padding-right:50px;
                }
                > div:nth-child(2) {
                    font-size: 0.12rem /* 14/100 */;
                    color: #818181;
                    padding-left:30px;
                    border: 1px #818181 solid;
                    border-radius: 20px;
                    padding: 0 5px;
                    width:30%;
                    > span {
                        margin-left: 0.03rem /* 3/100 */;
                    }
                }
            }
            .phone {
                font-size: 0.14rem /* 14/100 */;
                text-align: left;
                padding: 0.1rem /* 10/100 */ 0;
            }
            .cell {
                /*background-image: linear-gradient(#38d0c9, #adebc3);*/
                background-color:#fff;
                padding: 0.12rem /* 12/100 */;
                box-sizing: border-box;
                border-radius: 15px 15px 0 0;
                .title {
                    font-size: 0.14rem /* 14/100 */;
                    text-align: left;
                    // padding: .08rem /* 8/100 */ 0;
                    font-weight:600;
                }
                .list {
                    padding: 0.12rem /* 12/100 */ 0;
                    font-size: 0.12rem /* 14/100 */;
                    box-sizing: border-box;
                    display: flex;
                    align-items: center;
                    flex-wrap: wrap;
                    justify-content: space-between;
                    > div {
                        width: 25%;
                        height: 0.6rem /* 42/100 */;
                        display: flex;
                        align-items: center;
                        justify-content: space-between;
                        flex-direction: column;

                        box-sizing: border-box;
                        margin: 0.1rem /* 10/100 */ 0;
                        > div {
                            height: 0.34rem /* 24/100 */;
                            width: 100%;
                            > img {
                                height: 100%;
                            }
                        }
                    }
                    > div:nth-child(1) {
                        /*background-image: linear-gradient(#6fc6c4, #6fc6c4);*/
                    }


                }
            }
        }
        .bottom {
            padding: 12px;
            .cell {
                padding: 0.12rem /* 12/100 */;
                box-sizing: border-box;
                border-radius: 15px 15px 0 0;
                background-color:#fff;
                margin-bottom: 0.12rem /* 12/100 */;

                .title {
                    font-size: 0.14rem /* 14/100 */;
                    color: #333;
                    text-align: left;
                    font-weight:600;
                    // padding: .08rem /* 8/100 */ 0;
                }
                .list {
                    padding: 0.12rem /* 12/100 */ 0;
                    font-size: 0.12rem /* 14/100 */;
                    box-sizing: border-box;
                    display: flex;
                    align-items: center;
                    flex-wrap: wrap;
                    > div {
                        width: 25%;
                        height: 0.5rem /* 42/100 */;
                        display: flex;
                        align-items: center;
                        justify-content: space-between;
                        flex-direction: column;
                        color: #333;
                        margin: 0.1rem /* 10/100 */ 0;
                        > div {
                            height: 0.24rem /* 24/100 */;
                            width: 100%;
                            > img {
                                height: 100%;
                            }
                        }
                    }
                }
            }
            > div:nth-child(1) {
                /*background-image: linear-gradient(#adebc3, #fff);*/
                }
            > div:nth-child(2) {
                /*background-image: linear-gradient(#eef3f2, #fff);*/
                }
        }
    }
}
</style>