my_f.html 9.7 KB
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <script src="../../assets/js/fontsize.js"></script>
    <link rel="stylesheet" href="../../assets/css/weui.min.css">
    <link rel="stylesheet" href="../../assets/css/api.css"/>
    <link rel="stylesheet" href="../../assets/css/my_f.css"/>
    <link rel="stylesheet" href="../../assets/icon/iconfont.css">
    <title></title>
</head>
<body>
<div id="loadStart"></div>
<div id="app" v-cloak>
    <header class="" id="header">
        <div class="my_top">
            <div class="my_header_boxs" @click="my_detail">
                <div class="my_header_box">
                    <img :src="user_type.avatar?user_type.avatar:'../../assets/image/default_img.png'" alt="">
                </div>
                <span :class="['my_vip',user_type.is_vip==1?'vip_show':'no_vip']">V</span>
            </div>
            <div class="my_name">{{user_type.name}}</div>
        </div>
    </header>
    <div class="my_count">
        <div class="my_count_item" @click="my_balance(user_type.balance)">
            <div class="my_price">{{user_type.balance?user_type.balance:0.00}}元</div>
            <div>账户余额</div>
        </div>
        <div class="my_count_item" @click="my_consumption">
            <div class="my_price">{{user_type.count?user_type.count:0}}张</div>
            <div>消费金额</div>
        </div>
    </div>
    <div class="my_item_box">
        <div class="my_item" @click="goPay">
            <img src="../../assets/image/my0.png" alt="">
            <span>我的订单</span>
        </div>
        <div class="my_item" @click="go_hearth">
            <img src="../../assets/image/my1.png" alt="">
            <span>健康档案</span>
        </div>
        <div class="my_item border_2" @click="my_power">
            <img src="../../assets/image/my2.png" alt="">
            <span>我的权益</span>
        </div>
        <div class="my_item border_1" @click="question">
            <img src="../../assets/image/my3.png" alt="">
            <span>常见问题</span>
        </div>
        <div class="my_item border_1 " @click="friend">
            <img src="../../assets/image/my4.png" alt="">
            <span>邀请好友</span>
            <span class="my_money">领取高额消费金额</span>
        </div>
        <div class="my_item border_1 border_2" @click="set">
            <img src="../../assets/image/my5.png" alt="">
            <span>设置</span>
        </div>
    </div>
</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.js"></script>
<script type="text/javascript" src="../../assets/js/weui.min.js"></script>
<script type="text/javascript" src="../../assets/js/public.js"></script>
<script type="text/javascript" src="../../assets/js/fastclick.js"></script>
<script>
    new FastClick(document.body);
</script>
<script type="text/javascript" src="../../assets/js/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            isLogin: true,
            // user_info: [],
            user_type: [1],
            avatar_default: '../../assets/image/mblogo_03.png',
            default_name: '',
            marginTop: '',
            newList: [],
            type: 0
        },
        created: function () {
            apiready = function () {
                app.type = api.pageParam.type ? api.pageParam.type : 0;
                app.getUserIndexInfo()
                if (getToken()) {
                    app.getUserIndexInfo()
                    app.getNews();
                }
                api.addEventListener({
                    name: 'changeInfo'
                }, function (ret, err) {
                    app.getUserIndexInfo();
                });
                api.addEventListener({
                    name: 'login'
                }, function (ret, err) {
                    app.getUserIndexInfo();
                });
                api.addEventListener({
                    name: 'pay_success'
                }, function (ret, err) {
                    app.getUserIndexInfo();
                });
                api.addEventListener({
                    name: 'add_success'
                }, function (ret, err) {
                    app.getUserIndexInfo();
                });
            }
        },
        methods: {
            // 个人资料
            my_detail: function () {
                if (app.user_type == '') {
                    toastMsg('未登录')
                } else {
                    openView('my_detail', 'my/my_detail', '个人资料', 'my_detail', false, {rid: 0, type: 0})
                }
            },
            // 设置
            set: function () {
                openView('my_set', 'my/my_set', '设置', 'my_set', false, false, false)
            },
            // 常见问题
            question: function () {
                if (app.user_type == '') {
                    toastMsg('未登录')
                } else {
                    openView('my_que', 'my/my_que', '常见问题', 'my_que', false, false, false)
                }
            },
            // 邀友有赚
            friend: function () {
                if (app.user_type == '') {
                    toastMsg('未登录')
                } else {
                    openView('my_invite', 'my/my_invite', '邀请好友', 'my_invite', false, {invite_type: 0})
                }
            },
            // 我的订单
            goPay: function () {
                if (app.user_type == '') {
                    toastMsg('未登录')
                } else {
                    openView('my_orderlist', 'my/my_orderlist', '我的订单', 'my_orderlist', false, false, false);
                }
            },
            // 我的消息
            my_news: function () {
                if (app.user_type == '') {
                    toastMsg('未登录')
                } else {
                    openView('my_news', 'my/my_news', '消息通知', 'my_news', false, {new_type: 0})
                }
            },
            // 有无消息判断
            getNews: function () {
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken()
                };
                getRequest('post', 'user/index/getUserMessageList', null, header).then(function (res) {
                    if (res.data.code == 1) {
                        app.newList = res.data.data.unread;
                    } else {
                        toastMsg(res.data.msg)
                    }
                    loadEnd();
                })
            },
            // 我的账号
            my_balance: function () {
                if (app.user_type == '') {
                    toastMsg('未登录')
                } else {
                    openView('my_balance', 'my/my_balance', '我的账号', 'my_balance', false, false, false)
                }
            },
            // 我的消费金
            my_consumption: function () {
                if (app.user_type == '') {
                    toastMsg('未登录')
                } else {
                    openView('my_consumption', 'my/my_consumption', '我的消费金', 'my_consumption', false, false, false)
                }
            },
            // 我的权益
            my_power: function () {
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken()
                };
                if (app.user_type == '') {
                    toastMsg('未登录')
                } else {
                    getRequest('post', 'user/index/myRights', null, header).then(function (res) {
                        if (res.data.code == 1) {
                            openView('my_benefit', 'my/my_benefit', '我的权益', 'my_benefit', false, false, false)
                        } else {
                            toastMsg(res.data.msg);
                        }
                    });
                }
            },
            // 健康档案
            go_hearth: function () {
                if (app.user_type == '') {
                    toastMsg('未登录')
                } else {
                    api.openFrame({
                        name: 'my_health',
                        url: './my_health.html',
                        // bounces: true,
                        rect: {
                            x: 0,
                            y: 0,
                            w: 'auto',
                            h: 'auto',
                        },
                        pageParam: {
                            rid: 0,
                            type: 0
                        }
                    });
                }
            },
            // 获取个人信息
            getUserIndexInfo: function () {
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken()
                };
                getRequest('post', 'user/index/getUserIndexInfo', null, header).then(function (res) {
                    // alert(JSON.stringify(res));
                    if (res.data.code == 1) {
                        app.user_type = res.data.data;
                    } else {
                    }
                    loadEnd()
                });
            }
        }
    })
</script>