my_order.html 8.9 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/style.css">
    <link rel="stylesheet" href="../../assets/css/index.css">
    <link rel="stylesheet" href="../../assets/css/doc.css">
    <link rel="stylesheet" href="../../assets/css/pay.css">
    <link rel="stylesheet" href="../../assets/icon/iconfont.css">
    <title></title>
    <style type="text/css">
        .hr {
            height: 0.11rem;
            background-color: #f2f2f2;
        }

        .pay_date {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.2rem 0.53rem 0.2rem 0.77rem;
            font-size: 14px;
            color: #424242;
        }

        .bordert {
            border-top: 1px solid #ececec;
        }

        .order_num {
            padding: 0.2rem 0.44rem;
            background-color: #f2f2f2;
            font-size: 14px;
            color: #424242;
        }

        .order_btn_box {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            margin: 0.82rem 0;
            padding: 0 0.5rem;
            font-size: 17px;
            color: #D8B25F;
        }

        .order_btn_box span {
            border: 1px solid #D8B25F;
            border-radius: 0.16rem;
            width: 1.81rem;
            text-align: center;
            padding: 0.15rem 0;
            margin-left: 0.44rem;
        }
    </style>
</head>
<body>
<div id="loadStart"></div>
<div id="app" v-cloak>
    <div class="pay_time" v-if="order_type=='待付款'||order_type=='支付中'">支付剩余时间:{{minute}}:{{second}}</div>
    <div class="pay_box">
        <div class="pay_item_title"><span class="pay_item_title_span">{{order_info.post_title}}</span><span>{{order_info.order_type}}</span>
        </div>
        <div class="pay_detail">
            <div class="pay_detail_item"><span class="iconfont icon-yonghu"></span><span
                    class="pay_detail_label">服务对象</span><span>{{order_info.name}}</span></div>
            <div class="pay_detail_item"><span class="iconfont icon-dianhua-1"></span><span
                    class="pay_detail_label">联系电话</span><span>{{order_info.mobile}}</span></div>
        </div>
    </div>
    <div class="hr"></div>
    <div class="pay_date">
        <span>下单日期</span><span>{{order_info.addtime}}</span>
    </div>
    <!--<div class="swiper_item" @click="go_detail(order_info.gid)">-->
    <div class="swiper_item">
        <div class="swiper_item_img"><img :src="order_info.icon" alt=""></div>
        <div class="swiper_item_right">
            <div class="swiper_item_title">{{order_info.post_title}}</div>
            <div class="swiper_item_content">{{order_info.other_title}}</div>
            <div class="swiper_item_type">
                <div class="swiper_item_type1" v-for="(item,item2_index) in order_info.tag">
                    <div class="icon_img"><img :src="item.url" alt=""></div>
                    <span>{{item.text}}</span>
                </div>
            </div>
            <div class="swiper_item_money">¥{{order_info.price}}</div>
        </div>
    </div>
    <div class="pay_date bordert">
        <span>总服务费</span><span>{{order_info.good_price?order_info.good_price:0}}元</span>
    </div>
    <div class="order_num">订单号:{{order_info.order_sn}}</div>
    <div class="order_btn_box" v-if="order_type=='待付款'">
        <span @click="cancel_order" v-if="order_type=='待付款'">取消支付</span>
        <span @click="pay_moneny">支付</span>
    </div>
    <div class="order_btn_box" v-if="order_type=='支付中'">
        <span @click="pay_moneny">支付</span>
    </div>
    <div class="order_btn_box" v-if="order_type=='进行中'">
        <span @click="re_money">退款</span>
    </div>
    <!--<div class="order_btn_box" v-else-if="order_type=='进行中'"><span @click="cancel_order">取消支付</span></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/vue.min.js"></script>
<script type="text/javascript" src="../../assets/js/index.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/axios.min.js"></script>
<script type="text/javascript" src="../../assets/icon/iconfont.js"></script>
<script>
    var app = new Vue({
        el: '#app',
        data: {
            minutes: 30,
            seconds: 0,
            order_id: '',
            order_type: '',
            order_info: []
        },
        created: function () {
            apiready = function () {
                app.add();
                app.order_id = api.pageParam.order_id;
                app.order_type = api.pageParam.order_type;
                app.myOrder();
            }
        },
        watch: {
            second: {
                handler(newVal) {
                    this.num(newVal)
                }
            },
            minute: {
                handler(newVal) {
                    this.num(newVal)
                }
            }
        },
        computed: {
            second: function () {
                return this.num(this.seconds)
            },
            minute: function () {
                return this.num(this.minutes)
            }
        },

        methods: {
            num: function (n) {
                return n < 10 ? "0" + n : "" + n
            },
            add: function () {
                var time = window.setInterval(function () {
                    if (app.seconds == 0 && app.minutes != 0) {
                        app.seconds = 59;
                        app.minutes -= 1;
                    } else if (app.minutes == 0 && app.seconds == 0) {
                        app.seconds = 0;
                        window.clearInterval(time);
                        app.cancel_order();
                        closeWindow('my_order')
                    } else {
                        app.seconds -= 1
                    }
                }, 1000);
            },
            pay_moneny: function () {
                openView('my_pay', 'my/my_pay', '支付', 'my_pay', false, {order_id: app.order_id});
            },
            myOrder: function () {
                var post = {
                    order_id: app.order_id
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken(),
                };
                getRequest('post', 'user/Order/getOrderInfo', post, header).then(function (res) {
                    // alert(JSON.stringify(res));
                    if (res.data.code == 1) {
                        app.order_info = res.data.data;
                        loadEnd();
                    } else {
                        toastMsg(res.data.msg)
                    }
                })
            },
            // 取消订单
            cancel_order: function () {
                api.showProgress({
                    title: '取消订单',
                    text: '正在取消订单',
                    modal: false
                });
                var post = {
                    order_id: app.order_id
                };
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken(),
                };
                getRequest('post', 'user/Order/cancleOrder', post, header).then(function (res) {
                    if (res.data.code == 1) {
                        api.hideProgress();
                        toastMsg(res.data.msg);
                        api.sendEvent({
                            name: 'cancel_order',
                        });
                        setTimeout(res => {
                            openView('my_orderlist', 'my/my_orderlist', '我的订单','',false,false,false)
                        }, 2000);
                    } else {
                        toastMsg(res.data.msg)
                    }
                });
            },

            // 退款
            re_money: function () {
                openView('my_re_money', 'my/my_re_money', '退款', 'my_re_money', false, {
                    order_id: app.order_id,
                })
            }
        }
    })
</script>