myorder.html 8.4 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>
    <script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></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 || val.orderStatus == 10){
                    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+","+val.logId+")'>\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" ;
                if(val.orderStatus == 6 || val.orderStatus == 7 || val.orderStatus == 8 ){
                    html += "                        <p class=\"itembody_date\">雇佣人员:"+val.resume_name+"</p>\n" +
                        "                        <p class=\"itembody_date\">联系电话:"+val.resume_tel+"1</p>\n" ;
                }

                html +=
                    "                    </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+")'>取消订单</p>\n" +
                        "                        <p class=\"sureorder \" onclick='toPay("+val.id+")'>付款</p>" ;
                }else  if(val.orderStatus == 6){
                    html += "<p class=\"sureorder\"  onclick='sure("+val.logId+")'>确认完成</p>" ;
                }else if(val.orderStatus == 7){
                    html += "<p class=\"sureorder\"  onclick='common("+val.logId+")'>评价</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,logId) {
    console.log('11111111');
    console.log(logId);
    var url = "{:url('Member/detail')}";
    url = url.split('.');
    url = url[0] + '/id/' + id + '/logId/' + logId + ".html";
    window.location.href = url;
}
// 取消
function change(id) {
        window.event.stopPropagation();
        var a=confirm("是否取消订单");
        if(a==true){
            $.ajax({
                type: 'POST',
                url: "{:url('Member/changeStatus')}",
                data: {
                    'id':id,
                },
                success: function (res) {
                    // console.log(res);
                    popup(res.message);
                    if(res.code == 1){
                        setTimeout("def()",2500);
                    }
                },
                error: function (res) {
                    // console.log(res);
                }
            });
        }
}
// 确认
function sure(id) {
    $.ajax({
        type: 'POST',
        url: "{:url('Member/sureStatus')}",
        data: {
            'id':id,
        },
        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;
}
wx.config({
    debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
    appId: "{$config.appId}", // 必填,公众号的唯一标识
    timestamp: "{$config.timestamp}", // 必填,生成签名的时间戳
    nonceStr: "{$config.nonceStr}", // 必填,生成签名的随机串
    signature: "{$config.signature}",// 必填,签名
    jsApiList: [
        'chooseWXPay'
    ] // 必填,需要使用的JS接口列表
});
// 支付
function toPay(id){
    $.ajax({
        type: 'POST',
        url: "{:url('Member/toPay')}",
        data: {
            'id': id,
        },
        success: function (res) {
            wx.chooseWXPay({
                timestamp: res.data.timeStamp , // 支付签名时间戳,注意微信jssdk中的所有使用timestamp字段均为小写。但最新版的支付后台生成签名使用的timeStamp字段名需大写其中的S字符
                nonceStr: res.data.nonceStr, // 支付签名随机串,不长于 32 位
                package: res.data.package, // 统一支付接口返回的prepay_id参数值,提交格式如:prepay_id=\*\*\*)
                signType: res.data.signType, // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
                paySign: res.data.paySign, // 支付签名
                success: function (res) {
                    location.reload();
                    // window.location.href = "{:url('User/myOrder')}"
// 支付成功后的回调函数
                },
                error:function () {
                    alert('3333')
                }
            });
            console.log(res);
        },
        error: function (res) {
            console.log(res);
        }
    });
}

</script>
</body>
</html>