|
@@ -0,0 +1,225 @@
|
|
|
+<%@ page contentType="text/html;charset=UTF-8" %>
|
|
|
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
|
|
|
+<html>
|
|
|
+<head>
|
|
|
+ <title>活动商品管理</title>
|
|
|
+ <meta name="decorator" content="default"/>
|
|
|
+ <style type="text/css">
|
|
|
+ .table th {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+
|
|
|
+ .table td {
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ <script type="text/javascript">
|
|
|
+ $(document).ready(function () {
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+ function page(n, s) {
|
|
|
+ $("#pageNo").val(n);
|
|
|
+ $("#pageSize").val(s);
|
|
|
+ $("#searchForm").submit();
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ </script>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+<ul class="nav nav-tabs">
|
|
|
+ <li><a href="${ctx}/hehe/cmHeheUser/">分销者列表</a></li>
|
|
|
+ <li><a href="${ctx}/hehe/cmHeheActivity/list?userId=${activityProduct.userId}">活动列表</a></li>
|
|
|
+ <li class="active"><a
|
|
|
+ href="${ctx}/hehe/cmHeheActivityProduct/list?activityId=${activityProduct.activityId}&userId=${activityProduct.userId}">活动商品列表</a>
|
|
|
+ </li>
|
|
|
+</ul>
|
|
|
+<form:form id="searchForm" modelAttribute="cmHeheActivityProduct" action="${ctx}/hehe/cmHeheActivityProduct/"
|
|
|
+ method="post" class="breadcrumb form-search">
|
|
|
+ <input type="hidden" name="activityId" value="${activityProduct.activityId}"/>
|
|
|
+ <input type="hidden" name="userId" value="${activityProduct.userId}"/>
|
|
|
+ <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
|
|
|
+ <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
|
|
|
+ <div class="ul-form">
|
|
|
+ <label>商品名称:</label>
|
|
|
+ <form:input path="name" htmlEscape="false" class="input-medium"/>
|
|
|
+ <label>供应商名称:</label>
|
|
|
+ <form:input path="shopName" htmlEscape="false" class="input-medium"/>
|
|
|
+ <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
|
|
|
+ <input class="btn btn-primary" type="button" value="一键排序" onclick="batchSaveSort()" style="margin-left: 15px"/>
|
|
|
+ <input class="btn btn-primary" style="width: 80px" onclick="showSelect()" value="添加商品"/>
|
|
|
+ <div class="clearfix"></div>
|
|
|
+ </div>
|
|
|
+</form:form>
|
|
|
+<sys:message content="${message}"/>
|
|
|
+<table id="contentTable" class="table table-striped table-bordered table-condensed">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>图片</th>
|
|
|
+ <th>名称</th>
|
|
|
+ <th>供应商</th>
|
|
|
+ <th>售价</th>
|
|
|
+ <th>活动价</th>
|
|
|
+ <th>排序</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <c:forEach items="${page.list}" var="cmHeheActivityProduct">
|
|
|
+ <tr>
|
|
|
+ <input class="check-item" type="hidden" id="preferredProductSort${cmHeheActivityProduct.id}"
|
|
|
+ value='${cmHeheActivityProduct.id}-${cmHeheActivityProduct.sort}'/>
|
|
|
+ <td>
|
|
|
+ <img class="mainImage" src="${cmHeheActivityProduct.mainImage}" width="50px" height="50px">
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ ${cmHeheActivityProduct.name}
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ ${cmHeheActivityProduct.shopName}
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ ${cmHeheActivityProduct.price}
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 1}">
|
|
|
+ <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[0].buyNum})</label><br>
|
|
|
+ </c:if>
|
|
|
+ <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 2}">
|
|
|
+ <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[0].buyNum}-${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
|
|
|
+ <label>¥${cmHeheActivityProduct.activityLadderList[1].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
|
|
|
+ </c:if>
|
|
|
+ <c:if test="${cmHeheActivityProduct.activityLadderList.size() eq 3}">
|
|
|
+ <label>¥${cmHeheActivityProduct.activityLadderList[0].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[0].buyNum}-${cmHeheActivityProduct.activityLadderList[1].buyNum})</label><br>
|
|
|
+ <label>¥${cmHeheActivityProduct.activityLadderList[1].buyPrice}(购买数${cmHeheActivityProduct.activityLadderList[1].buyNum}-${cmHeheActivityProduct.activityLadderList[2].buyNum})</label><br>
|
|
|
+ <label>¥${cmHeheActivityProduct.activityLadderList[2].buyPrice}(购买数≥${cmHeheActivityProduct.activityLadderList[2].buyNum})</label><br>
|
|
|
+ </c:if>
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <input id="sort" name="sort" style="width:50px;" value="${cmHeheActivityProduct.sort}"
|
|
|
+ onkeyup="onlynum(this)" onchange="changeSort(${cmHeheActivityProduct.id},this)">
|
|
|
+ </td>
|
|
|
+ <td>
|
|
|
+ <a href="javascript:void(0);" onclick="showLadder(${cmHeheActivityProduct.id})">编辑</a>
|
|
|
+ <a href="${ctx}/hehe/cmHeheActivityProduct/delete?id=${cmHeheActivityProduct.id}"
|
|
|
+ onclick="return confirmx('确认要删除该商品吗?', this.href)">删除</a>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </c:forEach>
|
|
|
+ </tbody>
|
|
|
+</table>
|
|
|
+<div class="pagination">${page}</div>
|
|
|
+
|
|
|
+<script>
|
|
|
+ //选择添加
|
|
|
+ function showSelect() {
|
|
|
+ var url = '';
|
|
|
+ var title = '';
|
|
|
+ url = "${ctx}/hehe/cmHeheActivityProduct/findProductPage";
|
|
|
+ title = "添加商品";
|
|
|
+ top.$.jBox("iframe:" + url + "?userId=${activityProduct.userId}", {
|
|
|
+ iframeScrolling: 'yes',
|
|
|
+ width: $(top.document).width() - 600,
|
|
|
+ height: $(top.document).height() - 160,
|
|
|
+ persistent: true,
|
|
|
+ title: title,
|
|
|
+ buttons: {"确定": '1', "关闭": '-1'},
|
|
|
+ submit: function (v, h, f) {
|
|
|
+ //确定
|
|
|
+ var $jboxFrame = top.$('#jbox-iframe');
|
|
|
+ var $mainFrame = top.$('#mainFrame');
|
|
|
+ if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
|
|
|
+ var items = $jboxFrame[0].contentWindow.getCheckedItems(0);
|
|
|
+ if (items.length > 0) {
|
|
|
+ console.log(items);
|
|
|
+ //添加数据
|
|
|
+ $.post("${ctx}/hehe/cmHeheActivityProduct/addProducts?activityId=${activityProduct.activityId}&productIds=" + items, function (data) {
|
|
|
+ if (true == data.success) {
|
|
|
+ $.jBox.tip(data.info, 'info');
|
|
|
+ setTimeout(function () {
|
|
|
+ window.location.href = "${ctx}/hehe/cmHeheActivityProduct/list?activityId=${activityProduct.activityId}&userId=${activityProduct.userId}"
|
|
|
+ }, 1300);
|
|
|
+ } else {
|
|
|
+ $.jBox.tip(data.info, 'error');
|
|
|
+ }
|
|
|
+ }, "JSON");//这里返回的类型有:json,html,xml,text
|
|
|
+ return true;
|
|
|
+ } else {
|
|
|
+ top.$.jBox.tip("请先勾选商品...");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改排序值
|
|
|
+ function changeSort(id, sortThis) {
|
|
|
+ var value = sortThis.value;
|
|
|
+ $("#preferredProductSort" + id).val(id + "-" + value);
|
|
|
+ }
|
|
|
+
|
|
|
+ //批量保存排序
|
|
|
+ function batchSaveSort() {
|
|
|
+ var items = new Array();
|
|
|
+ var $items = $('.check-item');
|
|
|
+ $items.each(function () {
|
|
|
+ items.push($(this).val());
|
|
|
+ });
|
|
|
+ //保存批量排序
|
|
|
+ $.post("${ctx}/hehe/cmHeheActivityProduct/batchSaveSort?sortList=" + items, function (data) {
|
|
|
+ if (true == data.success) {
|
|
|
+ $.jBox.tip(data.msg, 'info');
|
|
|
+ window.location.href = "${ctx}/hehe/cmHeheActivityProduct/list?activityId=${activityProduct.activityId}&userId=${activityProduct.userId}";
|
|
|
+ } else {
|
|
|
+ $.jBox.tip(data.msg, 'error');
|
|
|
+ }
|
|
|
+ }, "JSON");//这里返回的类型有:json,html,xml,text
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param obj
|
|
|
+ * jquery控制input只能输入数字
|
|
|
+ */
|
|
|
+ function onlynum(obj) {
|
|
|
+ obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
|
|
|
+ }
|
|
|
+
|
|
|
+ function showLadder(id) {
|
|
|
+ var url = '';
|
|
|
+ var title = '';
|
|
|
+ url = "${ctx}/hehe/cmHeheActivityProduct/form?id=" + id;
|
|
|
+ title = "编辑";
|
|
|
+ top.$.jBox("iframe:" + url, {
|
|
|
+ iframeScrolling: 'yes',
|
|
|
+ width: 550,
|
|
|
+ height: 450,
|
|
|
+ persistent: true,
|
|
|
+ title: title,
|
|
|
+ buttons: {"确定": '1', "关闭": '-1'},
|
|
|
+ submit: function (v, h, f) {
|
|
|
+ //确定
|
|
|
+ var $jboxFrame = top.$('#jbox-iframe');
|
|
|
+ var $mainFrame = top.$('#mainFrame');
|
|
|
+ if ('1' == v && 1 == $jboxFrame.size() && 1 == $mainFrame.size()) {
|
|
|
+ var params = $jboxFrame[0].contentWindow.onclickSave();
|
|
|
+ console.log(params);
|
|
|
+ $.post("${ctx}/hehe/cmHeheActivityProduct/saveActivityLadder?params=" + params + "&id=" + id, function (data) {
|
|
|
+ if (true == data.success) {
|
|
|
+ $.jBox.tip(data.info, 'info');
|
|
|
+ setTimeout(function () {
|
|
|
+ window.location.href = "${ctx}/hehe/cmHeheActivityProduct/list?activityId=${activityProduct.activityId}&userId=${activityProduct.userId}"
|
|
|
+ }, 1300);
|
|
|
+ } else {
|
|
|
+ $.jBox.tip(data.info, 'error');
|
|
|
+ }
|
|
|
+ }, "JSON");//这里返回的类型有:json,html,xml,text
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|