|
@@ -0,0 +1,205 @@
|
|
|
+<%@ 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){
|
|
|
+ var productId = $("#productId").val();
|
|
|
+ if (productId == '') {
|
|
|
+ alertx("请选择商品");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ 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/cmHeheCollageProduct/">商品列表</a></li>
|
|
|
+ <li class="active"><a href="${ctx}/hehe/cmHeheCollageProduct/form?id=${cmHeheCollageProduct.id}">商品${not empty cmHeheCollageProduct.id?'编辑':'添加'}</a></li>
|
|
|
+ </ul><br/>
|
|
|
+ <form:form id="inputForm" modelAttribute="cmHeheCollageProduct" action="${ctx}/hehe/cmHeheCollageProduct/save" method="post" class="form-horizontal">
|
|
|
+ <form:hidden path="id"/>
|
|
|
+ <sys:message content="${message}"/>
|
|
|
+ <form:hidden path="productId"/>
|
|
|
+ <form:hidden path="unlimitedFlag"/>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>商品:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <label class="noProd"><a href="JavaScript:;" onclick="showSelect()">请选择加入呵呵商城的商品</a></label>
|
|
|
+ </div>
|
|
|
+ <table id="contentTable" class="table table-striped table-bordered table-condensed hasProd">
|
|
|
+ <thead>
|
|
|
+ <th>商品ID</th>
|
|
|
+ <th>图片</th>
|
|
|
+ <th>商品名称</th>
|
|
|
+ <th>供应商</th>
|
|
|
+ <th>操作</th>
|
|
|
+ </thead>
|
|
|
+ <tbody id="contentTbody">
|
|
|
+ <tr>
|
|
|
+ <td id="productIdTd">${cmHeheCollageProduct.productId}</td>
|
|
|
+ <td><img id="productImageTd" src="${cmHeheCollageProduct.productImage}" width="50px" height="50px"></td>
|
|
|
+ <td id="productNameTd">${cmHeheCollageProduct.productName}</td>
|
|
|
+ <td id="shopNameTd">${cmHeheCollageProduct.shopName}</td>
|
|
|
+ <td>
|
|
|
+ <a href="javaScript:;"
|
|
|
+ onclick="deleteProduct()">删除</a>
|
|
|
+ </td>
|
|
|
+ </tr>
|
|
|
+ </tbody>
|
|
|
+ </table>
|
|
|
+ </div>
|
|
|
+ <div class="hasProd">
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>拼团价格:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:input path="price" htmlEscape="false" class="input-xlarge number required"/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>单人限购量:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <input type="number" id="limitedNum" name="limitedNum" onkeyup="onlynum(this)" value="${cmHeheCollageProduct.limitedNum}" min="1" required>
|
|
|
+ <input type="checkbox" id="unlimitedFlag" name="unlimitedFlag" class="formCheck" value="${cmHeheCollageProduct.unlimitedFlag eq 1?1:0}"
|
|
|
+ ${cmHeheCollageProduct.unlimitedFlag eq 1 ? "checked" : ""} onclick="changeCondition()" />不限
|
|
|
+ <input id="limitedNumTemp" type="hidden" value="${cmHeheCollageProduct.limitedNum}">
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>拼团人数:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:input path="memberNum" htmlEscape="false" min="2" class="input-xlarge digits required"/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label">商品状态:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:select path="status" class="input-xlarge ">
|
|
|
+ <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 () {
|
|
|
+ showInfo();
|
|
|
+ });
|
|
|
+
|
|
|
+ function showInfo() {
|
|
|
+ var productId = $("#productId").val();
|
|
|
+ if (productId != '') {
|
|
|
+ $(".hasProd").show();
|
|
|
+ $(".noProd").hide();
|
|
|
+ } else {
|
|
|
+ $(".hasProd").hide();
|
|
|
+ $(".noProd").show();
|
|
|
+ }
|
|
|
+ var unlimitedFlag = $("#unlimitedFlag").val();
|
|
|
+ if (unlimitedFlag == '') {
|
|
|
+ $("#unlimitedFlag").val(0);
|
|
|
+ unlimitedFlag = '0';
|
|
|
+ }
|
|
|
+ if (unlimitedFlag === '1') {
|
|
|
+ $("#limitedNum").attr('readonly', true);
|
|
|
+ $("#limitedNum").attr('required', false);
|
|
|
+ } else {
|
|
|
+ $("#limitedNum").attr('readonly', false);
|
|
|
+ $("#limitedNum").attr('required', true);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function changeCondition() {
|
|
|
+ var obj = $("#unlimitedFlag");
|
|
|
+ var val = obj.val();
|
|
|
+ if (val === '1') {
|
|
|
+ obj.val(0);
|
|
|
+ val = '0';
|
|
|
+ } else {
|
|
|
+ obj.val(1);
|
|
|
+ val = '1';
|
|
|
+ }
|
|
|
+ var inputObj = $("#limitedNum");
|
|
|
+ // 临时数据
|
|
|
+ var tempObj = $("#limitedNumTemp");
|
|
|
+ if (val === '1') {
|
|
|
+ inputObj.attr('readonly', true);
|
|
|
+ inputObj.attr('required', false);
|
|
|
+ tempObj.val(inputObj.val());
|
|
|
+ inputObj.val('');
|
|
|
+ } else {
|
|
|
+ inputObj.attr('readonly', false);
|
|
|
+ inputObj.attr('required', true);
|
|
|
+ inputObj.val(tempObj.val());
|
|
|
+ tempObj.val('');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function showSelect() {
|
|
|
+ var url = "${ctx}/hehe/cmHeheCollageProduct/toAddProduct";
|
|
|
+ var title = '';
|
|
|
+ title = "选择商品";
|
|
|
+ top.$.jBox("iframe:" + url, {
|
|
|
+ iframeScrolling: 'yes',
|
|
|
+ width: $(top.document).width() - 400,
|
|
|
+ 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();
|
|
|
+ $("#productId").val(items[0].productId);
|
|
|
+ $("#productIdTd").text(items[0].productId);
|
|
|
+ $("#productImageTd").attr('src', items[0].image);
|
|
|
+ $("#productNameTd").text(items[0].productName);
|
|
|
+ $("#shopNameTd").text(items[0].shopName);
|
|
|
+ showInfo();
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ function deleteProduct() {
|
|
|
+ $("#productId").val('');
|
|
|
+ showInfo();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param obj
|
|
|
+ * jquery控制input只能输入数字
|
|
|
+ */
|
|
|
+ function onlynum(obj) {
|
|
|
+ obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
|
|
|
+ }
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|