my_orderlist.html 12.0 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>
        body {
            background-color: #f2f2f2;
            height: 100%;
        }

        .order_box {
            background-color: #fff;
            display: flex;
            align-items: center;
            justify-content: space-around;
            font-size: 14px;
            color: #656565;
            padding: 0.16rem 0;
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
        }

        .order_box span {
            padding: 0.12rem 0.1rem;
        }

        .order_box .order_box_active {
            color: #DDBB73;
            border-bottom: 0.04rem solid #DDBB73;
            box-sizing: border-box;
        }

        .hr {
            height: 0.15rem;
            background-color: #f5f5f5;
        }

        .order_num_box {
            display: flex;
            background-color: #fff;
            align-items: center;
            justify-content: space-between;
            font-size: 14px;
            color: #878787;
            padding: 0.28rem 0.5rem 0.17rem 0.5rem;
            border-bottom: 1px solid #E4E4E4;
        }

        .order_num {
            font-size: 12px;
        }

        .all_order {
            font-size: 16px;
            padding-top: 1.2rem;

        }

        .all_order_item {
            /*border-top: 1px solid #E4E4E4;*/
            background-color: #fff;
            margin-bottom: 0.2rem;
        }

        .order_label {
            padding: 0.05rem 0.16rem;
            margin: 0 0 0.22rem 0;
            background-color: #dbb25f;
            font-size: 15px;
            color: #fff;
            border-radius: 0 0 0.1rem 0.1rem;
        }

        .order_time {
            color: #878787;
            font-size: 12px;
            padding: 0.25rem 0 0 0;
        }

        .order_total {
            font-size: 14px;
            color: #2E2D2D;
            display: flex;
            justify-content: flex-end;
            padding: 0 0 0.4rem 0;
        }

        .total_num {
            font-weight: 600;
            font-size: 17px;
        }

        .all_order_item_detail {
            padding: 0 0.5rem;
        }
    </style>
</head>
<body>
<div id="loadStart"></div>
<div id="app" v-cloak>
    <div class="order_box">
        <span :class="{'order_box_active':all}" @click="all_show">全部</span>
        <span :class="{'order_box_active':paying}" @click="paying_show">待付款</span>
        <span :class="{'order_box_active':pay}" @click="pay_show">进行中</span>
        <span :class="{'order_box_active':paied}" @click="paied_show">已完成</span>
    </div>
    <div class="all_order" v-if="all">
        <div class="all_order_item nodata" v-if="myOrder_data.all.length==0">暂无相关订单</div>
        <div class="all_order_item" v-esle @click="go_detail(item.id,item.order_type,item.goods_type)"
             v-for="(item,index) in myOrder_data.all">
            <div class="order_num_box">
                <span class="order_num">订单号:{{item.order_sn}}</span><span>{{item.order_type}}</span>
            </div>
            <div class="all_order_item_detail">
                <span class="order_label">{{item.name}}</span>
                <div class="order_content clamp1">【{{item.post_title}}】{{item.other_title}}</div>
                <div class="order_time">
                    <div v-if="item.goods_type==2||item.goods_type==4">下单时间:{{item.addtime}}</div>
                    <div v-else>预约服务时间:{{item.service_time}}</div>
                </div>
                <div class="order_total"><span>合计:</span><span class="total_num">¥{{item.price}}</span></div>
            </div>
        </div>
    </div>
    <div class="all_order" v-else-if="paying">
        <div class="all_order_item nodata" v-if="myOrder_data.unpay.length==0">暂无相关订单</div>
        <div class="all_order_item" v-else @click="go_detail(item.id,item.order_type,item.goods_type)"
             v-for="(item,index) in myOrder_data.unpay">
            <div class="order_num_box"><span
                    class="order_num">订单号:{{item.order_sn}}</span><span>{{item.order_type}}</span></div>
            <div class="all_order_item_detail">
                <span class="order_label">{{item.name}}</span>
                <div class="order_content clamp1">【{{item.post_title}}】{{item.other_title}}</div>
                <div class="order_time">
                    <div v-if="item.goods_type==2||item.goods_type==4">下单时间:{{item.addtime}}</div>
                    <div v-else>预约服务时间:{{item.service_time}}</div>
                </div>
                <div class="order_total"><span>合计:</span><span class="total_num">¥{{item.price}}</span></div>
            </div>
        </div>
    </div>
    <div class="all_order" v-else-if="pay">
        <div class="all_order_item nodata" v-if="myOrder_data.doing.length==0">暂无相关订单</div>
        <div class="all_order_item" v-else @click="go_detail(item.id,item.order_type,item.goods_type)"
             v-for="(item,index) in myOrder_data.doing">
            <div class="order_num_box"><span
                    class="order_num">订单号:{{item.order_sn}}</span><span>{{item.order_type}}</span></div>
            <div class="all_order_item_detail">
                <span class="order_label">{{item.name}}</span>
                <div class="order_content clamp1">【{{item.post_title}}】{{item.other_title}}</div>
                <div class="order_time">
                    <div v-if="item.goods_type==2||item.goods_type==4">下单时间:{{item.addtime}}</div>
                    <div v-else>预约服务时间:{{item.service_time}}</div>
                </div>
                <div class="order_total"><span>合计:</span><span class="total_num">¥{{item.price}}</span></div>
            </div>
        </div>
    </div>
    <div class="all_order" v-else>
        <!--<div>{{myOrder_data.complete}}</div>-->
        <div class="all_order_item nodata" v-if="myOrder_data.complete.length==0">暂无相关订单</div>
        <div class="all_order_item" v-else @click="go_detail(item.id,item.order_type,item.goods_type)"
             v-for="(item,index) in myOrder_data.complete">
            <div class="order_num_box"><span
                    class="order_num">订单号:{{item.order_sn}}</span><span>{{item.order_type}}</span></div>
            <div class="all_order_item_detail">
                <span class="order_label">{{item.name}}</span>
                <div class="order_content clamp1">【{{item.post_title}}】{{item.other_title}}</div>
                <div class="order_time">
                    <div v-if="item.goods_type==2||item.goods_type==4">下单时间:{{item.addtime}}</div>
                    <div v-else>预约服务时间:{{item.service_time}}</div>
                </div>
                <div class="order_total"><span>合计:</span><span class="total_num">¥{{item.price}}</span></div>
            </div>
        </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: {
            all: true,
            paying: false,
            pay: false,
            paied: false,
            myOrder_data: {
                all: [],
                complete: [],
                unpay: [],
                doing: []
            }
        },
        created: function () {
            var app = this;
            this.myOrder();
            // api.addEventListener({
            //     name: 'cancel_order'
            // }, function (ret, err) {
            //     if (ret) {
            //         app.myOrder();
            //     }
            // });
            // api.addEventListener({
            //     name: 're_money'
            // }, function (ret, err) {
            //     if (ret) {
            //         app.myOrder();
            //     }
            // });
        },
        methods: {
            // 去详情页
            go_detail: function (order_id, order_type, goods_type) {
                var app = this;
                // alert(goods_type);
                if (goods_type == 2) {
                    openView('my_order', 'my/my_order', '订单详情', 'my_order', false, {
                        order_id: order_id,
                        order_type: order_type
                    })
                }
                else if (goods_type == 1) {
                    openView('my_order_go', 'my/my_order_go', '订单详情', 'my_order_go', false, {
                        order_id: order_id,
                        order_type: order_type
                    })
                }
                else if (goods_type == 4) {
                    openView('my_order_ben', 'my/my_order_ben', '订单详情', 'my_order_ben', false, {
                        order_id: order_id,
                        order_type: order_type
                    })
                }
                else {
                    openView('my_order_insure', 'my/my_order_insure', '订单详情', 'my_order_insure', false, {
                        order_id: order_id,
                        order_type: order_type
                    })
                }
            },
            all_show: function () {
                var app = this;
                app.all = true;
                app.paying = false;
                app.pay = false;
                app.paied = false;
            },
            paying_show: function () {
                var app = this;
                app.all = false;
                app.paying = true;
                app.pay = false;
                app.paied = false;
            },
            pay_show: function () {
                var app = this;
                app.pay = true;
                app.all = false;
                app.paying = false;
                app.paied = false;
            },
            paied_show: function () {
                var app = this;
                app.pay = false;
                app.all = false;
                app.paying = false;
                app.paied = true;
            },
            // 获取我的订单列表
            myOrder: function () {
                var app = this;
                var header = {
                    "XX-Device-Type": getDevice(),
                    'XX-Token': getToken()
                };
                getRequest('post', 'user/Order/myOrder', null, header).then(function (res) {
                    // alert(JSON.stringify(res));
                    if (res.data.code == 1) {
                        app.myOrder_data.all = res.data.data.all;
                        app.myOrder_data.unpay = res.data.data.unpay;
                        app.myOrder_data.doing = res.data.data.doing;
                        app.myOrder_data.complete = res.data.data.complete;
                        loadEnd()
                    } else {
                        toastMsg(res.data.msg)
                    }
                })
            }
        }
    })
</script>