|
@@ -0,0 +1,291 @@
|
|
|
+<%@ 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.length == 0) {
|
|
|
+ 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/cmHeheProduct/">商品列表</a></li>
|
|
|
+ <li class="active"><a href="${ctx}/hehe/cmHeheProduct/form?id=${cmHeheProduct.id}">${not empty cmHeheProduct.id?'编辑':'添加'}</a></li>
|
|
|
+ </ul><br/>
|
|
|
+ <form:form id="inputForm" modelAttribute="cmHeheProduct" action="${ctx}/hehe/cmHeheProduct/save" method="post" class="form-horizontal">
|
|
|
+ <form:hidden path="id"/>
|
|
|
+ <form:hidden path="productId" id="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="${cmHeheProduct.mainImage}" width="50px" height="50px"></td>
|
|
|
+ <td style="text-align: center" id="name">${cmHeheProduct.name}</td>
|
|
|
+ <td id="shopName">${cmHeheProduct.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;" id="price" name="price" value="${cmHeheProduct.price}" required>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>是否含税:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:radiobutton id="includedTax1" path="includedTax" value="1" label="含税" onclick="chageIncludedTax()"/>
|
|
|
+ <form:radiobutton id="includedTax0" path="includedTax" value="0" label="不含税" onclick="chageIncludedTax()"/>
|
|
|
+ </div>
|
|
|
+ <br>
|
|
|
+ <div class="controls">
|
|
|
+ <form:radiobutton id="invoiceType1" path="invoiceType" value="1" label="增值税专用发票" onclick="showTaxPoint()"/>
|
|
|
+ <form:radiobutton id="invoiceType2" path="invoiceType" value="2" label="增值税普通发票" onclick="showTaxPoint()"/>
|
|
|
+ <span id="invoiceTypeShow"><form:radiobutton id="invoiceType3" path="invoiceType" value="3" label="不能开票" onclick="showTaxPoint()"/></span>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group taxPointShow">
|
|
|
+ <label class="control-label"><font color="red">*</font>机构税率:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <input type="number" style="width:100px;" id="clubTaxPoint" name="clubTaxPoint" value="${cmHeheProduct.clubTaxPoint}" required>%
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group taxPointShow">
|
|
|
+ <label class="control-label"><font color="red">*</font>供应商税率:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <input type="number" style="width:100px;" id="shopTaxPoint" name="shopTaxPoint" value="${cmHeheProduct.shopTaxPoint}" required>%
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>成本价类型:</label>
|
|
|
+ <div class="controls" id="costType">
|
|
|
+ ${cmHeheProduct.costType eq 1 ? '固定成本' : '比例成本'}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group" id="costPriceShow">
|
|
|
+ <label class="control-label"><font color="red">*</font>成本价:</label>
|
|
|
+ <div class="controls" id="costPrice">
|
|
|
+ ${cmHeheProduct.costPrice}
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group" id="costProportionalShow">
|
|
|
+ <label class="control-label"><font color="red">*</font>比例成本百分比:</label>
|
|
|
+ <div class="controls" id="costProportional">
|
|
|
+ ${cmHeheProduct.costProportional}%
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>排序:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:input path="sort" htmlEscape="false" class="input-xlarge required" onkeyup="onlynum(this)"/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>推荐状态:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:select path="recommend" class="input-small required">
|
|
|
+ <form:option value="" label="请选择"/>
|
|
|
+ <form:option value="0" label="不推荐"/>
|
|
|
+ <form:option value="1" label="推荐"/>
|
|
|
+ </form:select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>商品状态:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:select path="validFlag" class="input-small required">
|
|
|
+ <form:option value="" label="请选择"/>
|
|
|
+ <form:option value="1" label="已上架"/>
|
|
|
+ <form:option value="2" 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 cmHeheProduct.id}){
|
|
|
+ $('#contentTable').show();
|
|
|
+ $('#productInfo').show();
|
|
|
+ $('#addProduct').hide();
|
|
|
+ chageIncludedTax();
|
|
|
+ changeCostPriceShow(${cmHeheProduct.costType});
|
|
|
+ showTaxPoint();
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ //选择添加商品
|
|
|
+ function showSelect() {
|
|
|
+ var url = '';
|
|
|
+ var title = '';
|
|
|
+ url = "${ctx}/hehe/cmHeheProduct/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;
|
|
|
+ var includedTax = items[0].includedTax;
|
|
|
+ var invoiceType = items[0].invoiceType;
|
|
|
+ var clubTaxPoint = items[0].clubTaxPoint;
|
|
|
+ var shopTaxPoint = items[0].shopTaxPoint;
|
|
|
+ var costType = items[0].costType;
|
|
|
+ var costPrice = items[0].costPrice;
|
|
|
+ var costProportional = items[0].costProportional;
|
|
|
+ $("#mainImage").attr("src", mainImage);
|
|
|
+ $("#shopName").text(shopName);
|
|
|
+ $("#productId").val(productId);
|
|
|
+ $("#name").text(name);
|
|
|
+ $("#price").val(price);
|
|
|
+ if (includedTax == 1) {
|
|
|
+ $('#includedTax1').attr('checked', true);
|
|
|
+ } else {
|
|
|
+ $('#includedTax0').attr('checked', true);
|
|
|
+ }
|
|
|
+ if (invoiceType == 1) {
|
|
|
+ $('#invoiceType1').attr('checked', true);
|
|
|
+ } else if (invoiceType == 2) {
|
|
|
+ $('#invoiceType2').attr('checked', true);
|
|
|
+ } else {
|
|
|
+ $('#invoiceType3').attr('checked', true);
|
|
|
+ }
|
|
|
+ $("#clubTaxPoint").val(clubTaxPoint);
|
|
|
+ $("#shopTaxPoint").val(shopTaxPoint);
|
|
|
+ if (costType == 1) {
|
|
|
+ $('#costType').text('固定成本');
|
|
|
+ } else {
|
|
|
+ $('#costType').text('比例成本');
|
|
|
+ }
|
|
|
+ $("#costPrice").text(costPrice);
|
|
|
+ $("#costProportional").text(costProportional + '%');
|
|
|
+ chageIncludedTax();
|
|
|
+ changeCostPriceShow(costType);
|
|
|
+ showTaxPoint();
|
|
|
+ } else {
|
|
|
+ top.$.jBox.tip("请先勾选商品...");
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ //是否含税显示
|
|
|
+ function chageIncludedTax() {
|
|
|
+ var includedTax = $("input[name='includedTax']:checked").val();
|
|
|
+ if (includedTax == 1) {
|
|
|
+ $('#invoiceTypeShow').hide();
|
|
|
+ var invoiceType = $("input[name='invoiceType']:checked").val();
|
|
|
+ if (invoiceType == 3) {
|
|
|
+ $('#invoiceType1').attr('checked', true);
|
|
|
+ showTaxPoint();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ $('#invoiceTypeShow').show();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 是否固定成本
|
|
|
+ function changeCostPriceShow(costType) {
|
|
|
+ if (costType == 1) {
|
|
|
+ $("#costPriceShow").show();
|
|
|
+ $("#costProportionalShow").hide();
|
|
|
+ } else {
|
|
|
+ $("#costPriceShow").hide();
|
|
|
+ $("#costProportionalShow").show();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //税率显示
|
|
|
+ function showTaxPoint() {
|
|
|
+ var invoiceType = $("input[name='invoiceType']:checked").val();
|
|
|
+ if (invoiceType == 3) {
|
|
|
+ $('.taxPointShow').hide();
|
|
|
+ } else {
|
|
|
+ $('.taxPointShow').show();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //删除商品
|
|
|
+ function deleteProduct() {
|
|
|
+ $('#contentTable').hide();
|
|
|
+ $('#productInfo').hide();
|
|
|
+ $('#addProduct').show();
|
|
|
+ $('#productId').val('');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param obj
|
|
|
+ * jquery控制input只能输入数字
|
|
|
+ */
|
|
|
+ function onlynum(obj) {
|
|
|
+ obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
|
|
|
+ }
|
|
|
+</script>
|
|
|
+</body>
|
|
|
+</html>
|