|
@@ -0,0 +1,157 @@
|
|
|
+<%@ page contentType="text/html;charset=UTF-8" %>
|
|
|
+<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
|
|
|
+<html>
|
|
|
+<head>
|
|
|
+ <title>商品管理</title>
|
|
|
+ <meta name="decorator" content="default"/>
|
|
|
+ <script type="text/javascript">
|
|
|
+ $(document).ready(function() {
|
|
|
+ //$("#name").focus();
|
|
|
+ $("#inputForm").validate({
|
|
|
+ submitHandler: function(form){
|
|
|
+ loading('正在提交,请稍等...');
|
|
|
+ form.submit();
|
|
|
+ },
|
|
|
+ errorContainer: "#messageBox",
|
|
|
+ errorPlacement: function(error, element) {
|
|
|
+ $("#messageBox").text("输入有误,请先更正。");
|
|
|
+ if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
|
|
|
+ error.appendTo(element.parent().parent());
|
|
|
+ } else {
|
|
|
+ error.insertAfter(element);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+ </script>
|
|
|
+</head>
|
|
|
+<body>
|
|
|
+ <ul class="nav nav-tabs">
|
|
|
+ <li><a href="${ctx}/hehe/heheDiscountActivityProduct/?activityId=${heheDiscountActivityProduct.activityId}">商品列表</a></li>
|
|
|
+ <li class="active"><a href="${ctx}/hehe/heheDiscountActivityProduct/form?id=${heheDiscountActivityProduct.id}&activityId=${heheDiscountActivityProduct.activityId}">商品${not empty heheDiscountActivityProduct.id?'编辑':'添加'}</a></li>
|
|
|
+ </ul><br/>
|
|
|
+ <form:form id="inputForm" modelAttribute="heheDiscountActivityProduct" action="${ctx}/hehe/heheDiscountActivityProduct/save" method="post" class="form-horizontal">
|
|
|
+ <form:hidden path="id"/>
|
|
|
+ <form:hidden path="activityId"/>
|
|
|
+ <form:hidden path="productId"/>
|
|
|
+ <sys:message content="${message}"/>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>商品:</label>
|
|
|
+ <div class="controls" id="addProduct">
|
|
|
+ <a href="JavaScript:;" onclick="showSelect()">请选择加入呵呵商城的商品</a>
|
|
|
+ </div>
|
|
|
+ <table id="contentTable" class="table table-striped table-bordered table-condensed" hidden="hidden">
|
|
|
+ <thead>
|
|
|
+ <tr>
|
|
|
+ <th>图片</th>
|
|
|
+ <th>商品名称</th>
|
|
|
+ <th>供应商</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </tr>
|
|
|
+ </thead>
|
|
|
+ <tbody>
|
|
|
+ <tr>
|
|
|
+ <td><img id="mainImage" src="${heheDiscountActivityProduct.mainImage}" width="50px" height="50px"></td>
|
|
|
+ <td style="text-align: center" id="name">${heheDiscountActivityProduct.name}</td>
|
|
|
+ <td id="shopName">${heheDiscountActivityProduct.shopName}</td>
|
|
|
+ <td><a href="javascript:void(0);" onclick="deleteProduct()">删除</a></td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <div id="productInfo" hidden="hidden">
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>限时特价:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <input type="number" style="width:100px;" min="0" id="discountPrice" name="discountPrice" value="${heheDiscountActivityProduct.discountPrice}" required onblur="checkPrice(this)">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>商品状态:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:select path="status" class="input-small required">
|
|
|
+ <form:option value="1" label="已上架"/>
|
|
|
+ <form:option value="0" label="已下架"/>
|
|
|
+ </form:select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="form-actions">
|
|
|
+ <input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/>
|
|
|
+ <input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
|
|
|
+ </div>
|
|
|
+ </form:form>
|
|
|
+<script>
|
|
|
+ $(function () {
|
|
|
+ //初始化商品信息
|
|
|
+ if (${not empty heheDiscountActivityProduct.id}){
|
|
|
+ $('#contentTable').show();
|
|
|
+ $('#productInfo').show();
|
|
|
+ $('#addProduct').hide();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ //选择添加商品
|
|
|
+ function showSelect() {
|
|
|
+ var url = '';
|
|
|
+ var title = '';
|
|
|
+ url = "${ctx}/hehe/heheDiscountActivityProduct/findProductPage";
|
|
|
+ title = "选择商品";
|
|
|
+ top.$.jBox("iframe:" + url, {
|
|
|
+ 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);
|
|
|
+ $('#contentTable').show();
|
|
|
+ $('#productInfo').show();
|
|
|
+ $('#addProduct').hide();
|
|
|
+ var productId = items[0].productId;
|
|
|
+ var mainImage = items[0].mainImage;
|
|
|
+ var name = items[0].name;
|
|
|
+ var shopName = items[0].shopName;
|
|
|
+ var price = items[0].price;
|
|
|
+ $("#mainImage").attr("src", mainImage);
|
|
|
+ $("#shopName").text(shopName);
|
|
|
+ $("#productId").val(productId);
|
|
|
+ $("#name").text(name);
|
|
|
+ $("#discountPrice").val(price);
|
|
|
+ } else {
|
|
|
+ top.$.jBox.tip("请先勾选商品...");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //删除商品
|
|
|
+ function deleteProduct() {
|
|
|
+ $('#contentTable').hide();
|
|
|
+ $('#productInfo').hide();
|
|
|
+ $('#addProduct').show();
|
|
|
+ $('#productId').val('');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param obj
|
|
|
+ * jquery检验售价
|
|
|
+ */
|
|
|
+ function checkPrice(obj) {
|
|
|
+ if (obj.value == '0') {
|
|
|
+ obj.value = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|