offline_order.html 12.8 KB
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>线下订单</title>
    <include file="public/header"/>
    <script type="text/javascript" src="__STATIC__/js/layer.js"></script>
    <include file="public/menu"/>
    <include file="public/navBall"/>
    <style type="text/css">
        .sub-btn {
            margin: 20px 0 5px;
        }

        .offlion_head {
            width: 100%;
            margin: auto;
            background-color: #FFF;
            position: fixed;
            left: 0;
            top: 0px;
            z-index: 999;
        }

        .offlion_head .inner {
            margin: auto;
            max-width: 720px;
            text-align: center;
        }

        .offlion_head .titbox {
            width: 50%;
            float: left;
            height: 40px;
            line-height: 40px;
            font-size: 14px;
            border-bottom: 1px #ddd solid;
        }

        .offlion_head .titbox:hover,
        .offlion_head .titbox:active {
            color: #000;
        }

        .offlion_head .titbox.on {
            color: #C4182E;
            border-bottom: 2px #C4182E solid;
        }

        .offlion1 {
            display: inline-block;
            width: 20px;
            height: 17px;
            margin-top: -3px;
            vertical-align: middle;
            background-repeat: no-repeat;
            background-position: center center;
            background-image: url("__STATIC__/images/user/offlion1.png");
            background-size: 100% 100%;
        }

        .offlion_head .titbox.on .offlion1 {
            background-image: url("__STATIC__/images/user/offlion1on.png");
        }

        .offlion2 {
            display: inline-block;
            width: 20px;
            height: 18px;
            margin-top: -3px;
            vertical-align: middle;
            background-image: url("__STATIC__/images/user/offlion2.png");
            background-repeat: no-repeat;
            background-position: center center;
            background-size: 100% 100%;
        }

        .offlion_head .titbox.on .offlion2 {
            background-image: url("__STATIC__/images/user/offlion2on.png");
        }

        #offlinelist li {
            padding: 0 10px;
            border-bottom: 4px #ddd solid;
        }

        .ordernum {
            font-size: 0;
            padding: 5px 0;
            border-bottom: 1px #ddd solid;
        }

        .ordernum .num {
            display: inline-block;
            vertical-align: middle;
            width: 50%;
            font-size: 14px;
            color: #666;
        }

        .ordernum .pro {
            display: inline-block;
            vertical-align: middle;
            text-align: right;
            width: 50%;
            line-height: 18px;
            color: #999;
            font-size: 14px;

        }

        .orderinfo .goodsname {
            color: #666;
            padding: 5px 0;
        }

        .goodspro {
            font-size: 0;
        }

        .goodspro .threebox {
            width: 33.3%;
            display: inline-block;
            font-size: 14px;
            color: #999;
        }
    </style>
</head>
<body>

<div class="hasdata" style="display:block;">
    <div class="offlion_head">
        <div class="inner">
            <a class="titbox" href="{:U('/Mobile/User/order_list',array('stoid'=>$Think.request.stoid))}"><span
                    class="offlion1"></span> 线上订单</a>
            <a class="titbox on"><span class="offlion2"></span> 线下订单</a>
            <div class="clear"></div>
        </div>
    </div>
    <div class="funds" style="margin-top: 50px">
        <div class="fundsQuery">
            <span>日期:</span>
            <input type="date" placeholder="请选择开始时间" id="stime" min="{$tyear}" max="{$hyear}" name="start"
                   value="{$Think.request.start}"/>
            <span class="ml10 mr10"></span>
            <input type="date" placeholder="请选择结束时间" id="etime" min="{$tyear}" max="{$hyear}" name="end"
                   value="{$Think.request.end}"/>
            <div class="sub-btn">查询明细</div>
            <p>注:读取时段内近10笔记录</p>
        </div>
        <ul id="offlinelist">
            <!--<li>-->
            <!--<div class="ordernum">-->
            <!--<span class="num cut">-->
            <!--<img src="__STATIC__/images/user/offlionimg.png" style="margin-right: 5px;width: 20px" alt="">171212Z0100004171212Z0100004171212Z0100004-->
            <!--</span>-->
            <!--<span class="pro">-->
            <!--<div>2017-12-13 16:54:12</div>-->
            <!--<div>消费总额(元):100.00</div>-->
            <!--</span>-->
            <!--</div>-->
            <!--<div class="orderinfo">-->
            <!--<div class="goodsname cut">-->
            <!--消费总额消费总额消费总额消费总额消费总额-->
            <!--</div>-->
            <!--<div class="goodspro">-->
            <!--<div class="threebox">-->
            <!--<div>数量</div>-->
            <!--<div class="red">2</div>-->
            <!--</div>-->
            <!--<div class="threebox tac    ">-->
            <!--<div>零售价</div>-->
            <!--<del class="red">2.00</del>-->
            <!--</div>-->
            <!--<div class="threebox tar">-->
            <!--<div>实收价</div>-->
            <!--<div class="red">2</div>-->
            <!--</div>-->

            <!--</div>-->
            <!--</div>-->
            <!--</li>-->
            <!--<li>-->
            <!--<div class="ordernum">-->
            <!--<span class="num cut">-->
            <!--<img src="__STATIC__/images/user/offlionimg.png" style="margin-right: 5px;width: 20px" alt="">171212Z0100004171212Z0100004171212Z0100004-->
            <!--</span>-->
            <!--<span class="pro">-->
            <!--<div>2017-12-13 16:54:12</div>-->
            <!--<div>消费总额(元):100.00</div>-->
            <!--</span>-->
            <!--</div>-->
            <!--<div class="orderinfo">-->
            <!--<div class="goodsname cut">-->
            <!--消费总额消费总额消费总额消费总额消费总额-->
            <!--</div>-->
            <!--<div class="goodspro">-->
            <!--<div class="threebox">-->
            <!--<div>数量</div>-->
            <!--<div class="red">2</div>-->
            <!--</div>-->
            <!--<div class="threebox tac    ">-->
            <!--<div>零售价</div>-->
            <!--<del class="red">2.00</del>-->
            <!--</div>-->
            <!--<div class="threebox tar">-->
            <!--<div>实收价</div>-->
            <!--<div class="red">2</div>-->
            <!--</div>-->

            <!--</div>-->
            <!--</div>-->
            <!--<div class="orderinfo">-->
            <!--<div class="goodsname cut">-->
            <!--消费总额消费总额消费总额消费总额消费总额-->
            <!--</div>-->
            <!--<div class="goodspro">-->
            <!--<div class="threebox">-->
            <!--<div>数量</div>-->
            <!--<div class="red">2</div>-->
            <!--</div>-->
            <!--<div class="threebox tac    ">-->
            <!--<div>零售价</div>-->
            <!--<del class="red">2.00</del>-->
            <!--</div>-->
            <!--<div class="threebox tar">-->
            <!--<div>实收价</div>-->
            <!--<div class="red">2</div>-->
            <!--</div>-->

            <!--</div>-->
            <!--</div>-->
            <!--</li>-->
        </ul>
        <!--<div class="datanone" style="display: none;margin-top: 80px;">没有更多订单</div>-->
        <div class="loadBtn">加载更多</div>
    </div>
</div>
</body>
<script type="text/javascript">
    var getstoid = {$Think.request.stoid};
    var page = 1;
    //页面一开始执行ajax加载数据
    $(function () {
        window.scrollTo(0,0);
        seach_offlion();
    })

    //查询按钮
    $(".sub-btn").click(function () {
        page = 1;
        seach_offlion();
    });
    //滚动加载
    $(document).unbind("scroll");
    $(document).bind("scroll", function (event) {
        var text = $(".loadBtn").text();
        if ($(document).scrollTop() >= $(document).height() - $(window).height() && text == '加载更多') {
            if(IsLoading==true) {
                seach_offlion();
                IsLoading = false;
            }
        }
    });

    function seach_offlion() {
        var oo=layer.open({type: 2, shadeClose: false});
        var stime = $("#stime").val();//起始时间
        var etime = $("#etime").val();//结束时间
        var isajax = 'isajax';//传值方式
        var date=new Date;
        var year=date.getFullYear();
        if(stime!="") {
            layer.close(oo);
            var diff=year-stime.substr(0,4);
            if (diff > 20 || diff < -20) {
                layer.open({content: '开始时间不能超出前后20年', time: 2});
                return false;
            }
        }
        if(etime!="") {
            layer.close(oo);
            var diff2=year-etime.substr(0,4);
            if (diff2 > 20 || diff2 < -20) {
                layer.open({content: '结束时间不能超出前后20年', time: 2});
                return false;
            }
        }
        $.ajax({
            type: "post",
            url: '/index.php?m=Mobile&c=User&a=offline_order&stoid=' + getstoid + '',
            data: {
                stime: stime,
                etime: etime,
                isajax: isajax,
                morepage: page,
            },
            dataType: 'json',
            success: function (data) {
                if (data.code == -1) {
                    $(".loadBtn").text("暂无更多订单");
                    IsLoading = false;
                } else if (data.code == 1) {
                    $(".hasdata").css("display", "block");
                    var htm1 = '';
                    for (var i = 0; i < data.data.data.length; i++) {
                        var arry = data.data.data[i]['data_list'];
                        htm1 += "<li> <div class=\"ordernum\"> <span class=\"num cut\"> <img src=\"__STATIC__/images/user/offlionimg.png\" style=\"margin-right: 5px;margin-top: -3px;width: 20px\" alt=\"\">" + data.data.data[i]['No'] + " </span> <span class=\"pro\"> <div>" + data.data.data[i]['BillDate'].toString().substring(0, 19) + "</div> <div>消费总额:¥" + data.data.data[i]['Sum'] + "</div> </span> </div> ";
                        for (var t = 0; t < arry.length; t++) {
                            htm1 += "<div class=\"orderinfo\"> <div class=\"goodsname cut\">" + arry[t]['WareName'] + "  </div> <div class=\"goodspro\"> <div class=\"threebox\"> <div>数量</div> <div class=\"red\">" + arry[t]['Qty'] + " </div> </div> <div class=\"threebox tac \"> <div>零售价</div> <del>¥" + arry[t]['PosPrice'] + " </del> </div> <div class=\"threebox tar\"> <div>实收价</div> <div class=\"red\">¥ " + arry[t]['Price'] + " </div> </div> </div> </div>";
                        }
                        htm1 += " </li>";
                    };
                    $("#offlinelist").html(htm1);
                    IsLoading = false;
                    $(".loadBtn").text("暂无更多订单");
                } else if (data.code == 2) {
                    var htm1 = '';
                    for (var i = 0; i < data.data.data.length; i++) {
                        var arry = data.data.data[i]['data_list'];
                        htm1 += "<li> <div class=\"ordernum\"> <span class=\"num cut\"> <img src=\"__STATIC__/images/user/offlionimg.png\" style=\"margin-right: 5px;margin-top: -3px;width: 20px\" alt=\"\">" + data.data.data[i]['No'] + " </span> <span class=\"pro\"> <div>" + data.data.data[i]['BillDate'].toString().substring(0, 19) + "</div> <div>消费总额:¥" + data.data.data[i]['Sum'] + "</div> </span> </div> ";
                        for (var t = 0; t < arry.length; t++) {
                            htm1 += "<div class=\"orderinfo\"> <div class=\"goodsname cut\">" + arry[t]['WareName'] + "  </div> <div class=\"goodspro\"> <div class=\"threebox\"> <div>数量</div> <div class=\"red\">" + arry[t]['Qty'] + " </div> </div> <div class=\"threebox tac \"> <div>零售价</div> <del>¥ " + arry[t]['PosPrice'] + " </del> </div> <div class=\"threebox tar\"> <div>实收价</div> <div class=\"red\">¥ " + arry[t]['Price'] + " </div> </div> </div> </div>";
                        }
                        htm1 += " </li>";
                    };
                    $("#offlinelist").append(htm1);
                    if (data.ordnum == page){
                        IsLoading = false;
                        $(".loadBtn").text("暂无更多订单");
                    }else{
                        IsLoading = true;
                        $(".loadBtn").text("加载更多");
                        page++;
                    }
                }
                layer.closeAll();

            }
        });
    }
</script>
</html>