myorder.html 6.6 KB
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <link rel="stylesheet" href="https://at.alicdn.com/t/font_750594_itt4qc4xfcg.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css/base.css">
    <link rel="stylesheet" href="__TMPL__/public/assets/css/personcenter.css">
    <title>我的订单</title>
    <script type="text/javascript" src="__TMPL__/public/assets/js/jquery.min.js"></script>
    <script type="text/javascript" src="__TMPL__/public/assets/js/base.js" charset="utf-8"></script>

</head>
<body>
<div class="container">
    <div class="head">
        <ul class="headlist">
            <li class="active" id="0">全部</li>
            <li id="2">待审核</li>
            <li id="3">待付款</li>
            <li id="6">待完成</li>
            <li id="7">已完成</li>
            <li id="4">审核不通过</li>
        </ul>
    </div>
    <div class="orderlist">
        <!--全部订单-->
        <div class="allist orders" >

        </div>

    </div>
</div>

<!--begin:提示弹层-->
<div class="pop_fn"></div>
<script>
def();
function def() {
    var  orderid = $('.active').attr('id');
    $.ajax({
        type: 'POST',
        url: "{:url('Member/orderContent')}",
        data: {
            'type':orderid,
        },
        success: function (res) {
            var html = '';
            $.each(res.data,function (index,val) {
                html += "<div class=\"allist_item\">\n" +
                    "                    <div class=\"item_head\">\n" +
                    "                        <div class=\"order\">\n" +
                    "                            <p class=\"ordername\">订单号:</p>\n" +
                    "                            <p class=\"ordernum\">"+val.order_sn+"</p>\n" +
                    "                        </div>\n"
                if(val.orderStatus == 2){
                    html += "<div class=\"orderstate\">待审核</div>\n" ;
                }else if(val.orderStatus == 3){
                    html += "<div class=\"orderstate\">待付款</div>\n" ;
                }else if(val.orderStatus == 4){
                    html += "<div class=\"orderstate\">审核未通过</div>\n" ;
                }else if(val.orderStatus == 5){
                    html += "<div class=\"orderstate\">已取消</div>\n" ;
                }else if(val.orderStatus == 6){
                    html += "<div class=\"orderstate\">待完成</div>\n" ;
                }else if(val.orderStatus == 7){
                    html += "<div class=\"orderstate\">待评价</div>\n" ;
                }else if(val.orderStatus == 8){
                    html += "<div class=\"orderstate\">已评价</div>\n" ;
                }

                html +=
                    "                    </div>\n" +
                    "                    <div class=\"item_body\" onclick='jump("+val.id+")'>\n" +
                    "                        <p class=\"itembody_name\">"+val.title+"</p>\n" +
                    "                        <p class=\"itembody_price\">¥"+val.money+"/天</p>\n" +
                    "                        <p class=\"itembody_date\">工作时间:"+val.start_time+"-"+val.start_time+"</p>\n" +
                    "                        <p class=\"itembody_date\">雇佣人员:王晓明</p>\n" +
                    "                        <p class=\"itembody_date\">联系电话:12345678901</p>\n" +
                    "                    </div>\n" +
                    "                    <div class=\"footbtn\">\n" ;
                // 2待审核,3审核通过,待付款,4审核未通过,5已取消,6待完成,7待评价,8已评价
                if(val.orderStatus == 3){
                    html += "<p class=\"cancelorder\"  onclick='change("+val.id+",1)'>取消订单</p>\n" +
                        "                        <p class=\"sureorder\">付款</p>" ;
                }else  if(val.orderStatus == 6){
                    html += "<p class=\"sureorder\"  onclick='change("+val.id+",2)'>确认完成</p>" ;
                }else if(val.orderStatus == 7){
                    html += "<p class=\"sureorder\"  onclick='common("+val.id+")'>评价</p>\n" ;
                }
                html +=
                    "                    </div>\n" +
                    "                </div>"
            });
            $('.allist').html(html);
            console.log(res);
        },
        error: function (res) {
            console.log(res);
        }
    });
}

// tab
$("ul li").click(function(){
    $(this).addClass("active");
    $(this).siblings("li").removeClass("active");
    def();
});
// 详情
function jump(id) {
    var url = "{:url('Member/detail')}";
    url = url.split('.');
    url = url[0] + '/id/' + id + ".html";
    window.location.href = url;
}
// 取消/确认
function change(id,type) {
    if(type == 1){
        window.event.stopPropagation();
        var a=confirm("是否取消订单");
        if(a==true){
            order(id,type)
        }
    }else{
        order(id,type)
    }
}
function order(id,type) {
    $.ajax({
        type: 'POST',
        url: "{:url('Member/changeStatus')}",
        data: {
            'id':id,
            'type':type,
        },
        success: function (res) {
            console.log(res);
            popup(res.message);
            if(res.code == 1){
                setTimeout("def()",2500);
            }
        },
        error: function (res) {
            console.log(res);
        }
    });
}
//评价页面
function common(id) {
    var url = "{:url('Member/common')}";
    url = url.split('.');
    url = url[0] + '/id/' + id + ".html";
    window.location.href = url;
}

//取消订单
// window.alert = function(name){
//     var iframe = document.createElement("IFRAME");
//     iframe.style.display="none";
//     document.documentElement.appendChild(iframe);
//     window.frames[0].window.alert(name);
//     iframe.parentNode.removeChild(iframe);
// }
// window.confirm = function (message) {
//     var iframe = document.createElement("IFRAME");
//     iframe.style.display = "none";
//     iframe.setAttribute("src", 'data:text/plain,');
//     document.documentElement.appendChild(iframe);
//     var alertFrame = window.frames[0];
//     var result = alertFrame.window.confirm(message);
//     iframe.parentNode.removeChild(iframe);
//     return result;
// }
//
//
// $(".cancelorder").click(function(){
//     window.event.stopPropagation();
//     var a=confirm("是否取消订单");
//     if(a==true){
//         alert("取消订单")
//     }
// })
</script>
</body>
</html>