<%@include file="/WEB-INF/common/layouts/common.jsp" %>
<%@ page language="java" pageEncoding="UTF-8" %>
<html>
<head>
    <title>商品列表</title>
    <style type="text/css">
        #filterForm input {
            margin-top: 3px;
        }

        #filterForm div {
            margin-top: 3px;
        }
    </style>
</head>
<body>

<!-- 面包屑 begin -->
<div class="row-fluid">
    <div class="span12">
        <ul class="breadcrumb">
            <%--<li class="active" ><span class="divider" style="color:#26a0da;font-weight:bold;">/</span>商品列表</li>--%>
            <li class="active"><span class="divider" style="color:#26a0da;font-weight:bold;">/</span>淘房币兑换查询</li>
        </ul>
    </div>
</div>
<!-- 面包屑 begin -->

<div class="page-container">
    <div class="row${fluid}">
        <div class="span12">
            <form id="filterForm" class="form-inline filterForm valid" action="${ctx}/cmcreditgoods/listCreditsOfAll"
                  method="get">
                <input type="hidden" name="orderColumn" value="${param['orderColumn']}"/>
                <input type="hidden" name="orderMode" value="${param['orderMode']}"/>
                <input type="text" name="search_LIKE_goodsId" value="${param['search_LIKE_goodsId']}"
                       class="m-wrap small" placeholder="商品编码" style="height:20px;">
                <input type="text" name="search_LIKE_goodsName" value="${param['search_LIKE_goodsName']}"
                       class="m-wrap small" placeholder="商品名称" style="height:20px;">
                <%--<c:if test="${1 eq userRole}">--%>
                <%--<select class="span2" style="width:220px;height: 20px" name="search_EQ_cityKey" onchange="changeCity(this)" id="citySelect">--%>
                <%--<option value="">不限(站点)</option>--%>
                <%--<option value="zbu" <c:if test="${param['search_EQ_cityKey'] eq 'zbu' }"> selected="selected"</c:if>>事业部</option>--%>
                <%--<c:forEach items="${cityList}" var="city">--%>
                <%--<option value="<c:out value="${city.code}"/>" <c:if test="${param['search_EQ_cityKey'] eq city.code }"> selected="selected"</c:if>><c:out value="${city.name}" />--%>
                <%--</option>--%>
                <%--</c:forEach>--%>
                <%--</select>--%>
                <%--</c:if>	--%>

                <c:if test="${1 eq userRole}">
                    <select class="span2" style="width:220px;height: 20px" name="search_EQ_city" id="citySelect">
                        <option value="">不限(站点)</option>
                        <option value="zbu" <c:if
                                test="${param['search_EQ_city'] eq 'zbu' }"> selected="selected"</c:if>>事业部
                        </option>
                        <c:forEach items="${cityList}" var="city">
                            <option value="${city.code}"
                                    <c:if test="${param['search_EQ_city'] eq city.code}"> selected="selected"</c:if>>${city.name}
                            </option>
                        </c:forEach>
                    </select>
                    <%--<select class="span2" style="width:220px;height: 20px" name="search_EQ_cityKey" onchange="changeCity(this)" id="citySelect">--%>
                    <%--<option value="">不限(站点)</option>--%>
                    <%--<option value="zbu" <c:if test="${param['search_EQ_cityKey'] eq 'zbu' }"> selected="selected"</c:if>>事业部</option>--%>
                    <%--<c:forEach items="${cityList}" var="city">--%>
                    <%--<option value="${city.code}"--%>
                    <%--<c:if test="${param['search_EQ_cityKey'] eq city.code}"> selected="selected"</c:if>>${city.name}--%>
                    <%--</option>--%>
                    <%--</c:forEach>--%>
                    <%--</select>--%>
                </c:if>

                <input type="text" class="datetime-picker span2 small" name="search_GTE_startUpdateTime"
                       dateLte="#endUpdateTimeInput" id="startUpdateTimeInput"
                       value="${param['search_GTE_startUpdateTime']}" date-format="yyyy-mm-dd hh:ii:ss"
                       placeholder="开始时间"/>

                <input type="text" class="datetime-picker span2 small" name="search_LTE_endUpdateTime"
                       id="endUpdateTimeInput" dateGte="#startUpdateTimeInput"
                       value="${param['search_LTE_endUpdateTime']}" date-format="yyyy-mm-dd hh:ii:ss"
                       placeholder="结束时间"/>
                <select class="m-wrap small" name="search_EQ_status"
                        data-placeholder="不限(状态)" style="width:220px; height: 20px">
                    <option value="" selected="selected">状态</option>
                    <option value="0" <c:if test="${param['search_EQ_status'] eq '0' }"> selected="selected"</c:if>>
                        已上架
                    </option>
                    <option value="1" <c:if test="${param['search_EQ_status'] eq '1' }"> selected="selected"</c:if>>
                        未上架
                    </option>
                </select>

                <div class="buttons pull-right" style="margin:3px 30px 0 0;">
                    <i class="icon-search icon-2x pointer" onclick="$('#filterForm').submit();" title="搜索"></i>
                </div>
            </form>
        </div>
    </div>
    <table class="table table-striped table-advance table-hover">
        <thead>
        <tr>
            <th width="100">ID</th>
            <th width="100">编码</th>
            <th width="100">商品名称</th>
            <th width="100">商品类型</th>
            <th width="100" style="cursor:pointer;" onclick="sortBy('exchanged_count','
            <c:if test="${param['orderMode'] eq 'desc'}">asc</c:if>
            <c:if test="${param['orderMode'] eq 'asc' || empty param['orderMode']}">desc</c:if>')">销量↑↓
            </th>
            <th width="100">状态</th>
        </tr>
        </thead>
        <c:if test="${empty cmCreditGoods && !isFirst}">
            <tr>
                <td colspan="10" style="text-align: center;">
                    <span color="red">未找到商品信息</span>
                </td>
            </tr>
        </c:if>
        <c:if test="${!empty cmCreditGoods}">
            <c:forEach items="${cmCreditGoods}" var="creditGoods">
                <tr>
                    <td nowrap="nowrap">
                        <c:out value="${creditGoods.id}"/>
                    </td>
                    <td nowrap="nowrap">
                        <c:out value="${creditGoods.goodsId}"/>
                    </td>
                    <td nowrap="nowrap">
                        <c:out value="${creditGoods.goodsName}"/>
                    </td>
                    <td nowrap="nowrap">
                        <c:choose>
                            <c:when test="${creditGoods.goodsType==1}">
                                虚拟商品
                            </c:when>
                            <c:otherwise>实物商品 <span class="inline">${entity.exchangeProcess}&nbsp;</span>
                            </c:otherwise>
                        </c:choose>
                    </td>
                    <td nowrap="nowrap">

                        <c:if test="${not empty creditGoods.exchangedCount}">
                            <c:out value="${creditGoods.exchangedCount}"/>
                        </c:if>
                        <c:if test="${empty creditGoods.exchangedCount}">
                            0
                        </c:if>
                    </td>
                    <td nowrap="nowrap">
                        <c:if test="${0 eq creditGoods.status}">
                            上架
                        </c:if>
                        <c:if test="${1 eq creditGoods.status}">
                            未上架
                        </c:if>
                    </td>
                </tr>
            </c:forEach>
        </c:if>
    </table>
    <div class="row${fluid}">
        <house365:pagination page="${page}"/>
    </div>
</div>
<script type="text/javascript">

    //排序
    function sortBy(column, mode) {
        $("form input[name='orderColumn']").val(column);
        $("form input[name='orderMode']").val(mode);
        $('#filterForm').submit();
    }

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