my_benefit.html 5.6 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/api.css"/>
    <link rel="stylesheet" href="../../assets/css/index.css">
    <link rel="stylesheet" href="../../assets/icon/iconfont.css">
    <title>我的权益</title>
    <style>
        body {
            /*background-color: #f2f2f2;*/
            height: 100%;
            position: relative;
        }

        .post_title_box {
            top: 0;
            left: 0;
            position: fixed;
            height: 100%;
            width: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .post_title {
            font-size: 15px;
            color: #424242;
            text-align: center;
            padding: 20px 0;
            width: 100%;
        }

        .benefit_btn {
            display: flex;
            align-items: center;
            justify-content: space-around;
            font-size: 15px;
            color: #DDBB73;
            padding: 25px 0;
            margin: 16px 14px;
            border-radius: 8px;
            /*border: 4px solid #DDBB73;*/
        }

        .benefit_btn span {
            border: 1px solid #DDBB73;
            border-radius: 10px;
            width: 40%;
            text-align: center;
            padding: 7px 0;
        }
        .content{
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 0.25rem;
        }
        .content img{
            width: 100%;
        }
    </style>
</head>
<body>
<div id="loadStart"></div>
<div id="app" v-cloak>
    <div v-if="post_content==null" class="post_title_box">
        <div class="benefit_btn post_title">你还没有购买权益哦</div>
    </div>
    <div v-else>
        <!--<div class="post_title">{{post_title}}</div>-->
        <div v-html="post_content" class="content"></div>
        <div class="benefit_btn">
            <span @click="changeEqual(1)">申请转让</span>
            <span @click="changeEqual(2)">申请转等额转消费金</span>
        </div>
    </div>
</div>
</body>
</html>
<script type="text/javascript" src="../../assets/js/api.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: {
            post_title: '',
            post_content: '',
            able: ''
        },
        created: function () {
            apiready = function () {
                app.getMyRight();
                app.changeValue();
            }
        },
        methods: {
            getMyRight: function () {
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken()
                };
                getRequest('post', 'user/index/myRights', null, header).then(function (res) {

                    if (res.data.code == 1) {
                        app.post_title = res.data.data.post_title;
                        app.post_content = res.data.data.post_content;
                    } else {
                        toastMsg(res.data.msg);
                    }
                    loadEnd()
                });
            },
            changeValue: function () {
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken()
                };
                getRequest('post', 'user/index/myRightsCheck', null, header).then(function (res) {
                    // alert(JSON.stringify(res))
                    if (res.data.code == 1) {
                        app.able = res.data.data.able
                    }
                    else {
                    }
                })
            },
            changeEqual: function (type) {
                if (app.able == 1) {
                    var post = {
                        change_type: type
                    };
                    var header = {
                        "XX-Device-Type": getDevice(),
                        'XX-Token': getToken()
                    }
                    api.confirm({
                        title: '确定转让?',
                        msg: '转让权益',
                        buttons: ['确定', '取消']
                    }, function (ret, err) {
                        var index = ret.buttonIndex;
                        if (index == 1) {
                            getRequest('post', 'user/index/confirmChangeRights', post, header).then(function (res) {
                                if (res.data.code == 1) {
                                    toastMsg(res.data.msg)
                                }
                            })
                        } else {
                            toastMsg('取消')
                        }
                    });
                } else {
                    toastMsg('您好!您的权益还未到期转让')
                }
            }
        }
    })
</script>