forked from kidgrow-microservices-platform

dougang
2020-05-26 e6ba57b6f4be54633931ac13078d59978fe01852
消费记录增加按照时间段查询功能
2 files modified
46 ■■■■■ changed files
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml 6 ●●●●● patch | view | raw | blame | history
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/productdetail.html 40 ●●●●● patch | view | raw | blame | history
kidgrow-business/kidgrow-opration-center/kidgrow-opration-center-biz/src/main/resources/mapper/ProductOrderDetailMapper.xml
@@ -104,6 +104,12 @@
            <if test="p.createTime != null and p.createTime !='' and p.updateTime != null and p.updateTime !=''">
                and (DE.create_time between #{p.createTime} and #{p.updateTime})
            </if>
            <if test="p.startTime!= null and p.startTime !=''">
                and DE.create_time &gt;= #{p.startTime}
            </if>
            <if test="p.endTime!= null and p.endTime !=''">
                and DE.create_time &lt;= #{p.endTime}
            </if>
            <include refid="com.kidgrow.oprationcenter.mapper.SysProductMapper.Role_Organization"></include>
        </where>
    </sql>
kidgrow-web/kidgrow-web-manager/src/main/resources/static/pages/opration/productdetail.html
@@ -8,6 +8,8 @@
    </div>
    <div class="layui-card-body">
        <div class="layui-form toolbar">&emsp;
            <input type="text" class="layui-input search-input" id="startTime"> 至 <input type="text"
                class="layui-input search-input" id="endTime"> &emsp;
            <input id="product-search-value" class="layui-input search-input" type="text" placeholder="按产品名" />&emsp;
            <input id="hospital-search-value" class="layui-input search-input" type="text" placeholder="按医院名" />&emsp;
            <button id="product-btn-search" class="layui-btn icon-btn"><i class="layui-icon">&#xe615;</i>搜索</button>
@@ -97,9 +99,45 @@
        // 搜索按钮点击事件
        $('#product-btn-search').click(function () {
            var startTime = $('#startTime').val();
            var endTime = $('#endTime').val();
            if (startTime != null && endTime != null) {
                var flag = compareDate(startTime, endTime);
                if (!flag) {
                    layer.msg('结束时间不得小于开始时间');
                    return;
                }
            }
            var proName = $('#product-search-value').val();
            var hospitalName = $('#hospital-search-value').val();
            table.reload('product-table', { where: { proName: proName,hospitalName: hospitalName } });
            table.reload('product-table', { where: { proName: proName,hospitalName: hospitalName,startTime: startTime, endTime: endTime } });
        });
        //时间格式
        var laydate = layui.laydate;
        //执行一个laydate实例
        laydate.render({
            elem: '#startTime' //指定元素
        });
        laydate.render({
            elem: '#endTime' //指定元素
        });
        //比较日期大小
        function compareDate(logintime, logouttime) {
            var arys1 = new Array();
            var arys2 = new Array();
            if (logintime != null && logouttime != null) {
                arys1 = logintime.split('-');
                var logindate = new Date(arys1[0], parseInt(arys1[1] - 1), arys1[2]);
                arys2 = logouttime.split('-');
                var logoutdate = new Date(arys2[0], parseInt(arys2[1] - 1), arys2[2]);
                if (logindate > logoutdate) {
                    return false;
                } else {
                    return true;
                }
            }
        }
    });
</script>