|
@@ -1,190 +1,270 @@
|
|
|
<%@ page contentType="text/html;charset=UTF-8" %>
|
|
|
-<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
|
|
|
+<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
|
|
|
<html>
|
|
|
<head>
|
|
|
- <title>商品管理</title>
|
|
|
- <meta name="decorator" content="default"/>
|
|
|
- <style>
|
|
|
- .showLabel{
|
|
|
- margin-top:3px
|
|
|
- }
|
|
|
- </style>
|
|
|
- <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>
|
|
|
+ <title>商品管理</title>
|
|
|
+ <meta name="decorator" content="default"/>
|
|
|
+ <style>
|
|
|
+ .showLabel {
|
|
|
+ margin-top: 3px
|
|
|
+ }
|
|
|
+ </style>
|
|
|
+ <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}/svip/cmSvipProduct/">商品列表</a></li>
|
|
|
- <li class="active"><a href="${ctx}/svip/cmSvipProduct/form?id=${cmSvipProduct.id}">商品${not empty cmSvipProduct.id?'编辑':'添加'}</a></li>
|
|
|
- </ul><br/>
|
|
|
- <form:form id="inputForm" modelAttribute="cmSvipProduct" action="${ctx}/svip/cmSvipProduct/save" method="post" class="form-horizontal">
|
|
|
- <form:hidden path="id"/>
|
|
|
- <sys:message content="${message}"/>
|
|
|
- <div class="control-group">
|
|
|
- <label class="control-label">商品ID:</label>
|
|
|
- <div class="controls">
|
|
|
- <label class="showLabel">${cmSvipProduct.productId}</label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group">
|
|
|
- <label class="control-label">商品名称:</label>
|
|
|
- <div class="controls">
|
|
|
- <label class="showLabel">${cmSvipProduct.productName}</label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group">
|
|
|
- <label class="control-label">供应商:</label>
|
|
|
- <div class="controls">
|
|
|
- <label class="showLabel">${cmSvipProduct.shopName}</label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group">
|
|
|
- <label class="control-label">机构价:</label>
|
|
|
- <div class="controls">
|
|
|
- <label class="showLabel">¥${cmSvipProduct.price}</label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group">
|
|
|
- <label class="control-label">是否含税:</label>
|
|
|
- <div class="controls">
|
|
|
- <label class="showLabel">${cmSvipProduct.includedTax == '1'?'含税':(cmSvipProduct.includedTax == '0'?'不含税':'未知')}
|
|
|
- ${cmSvipProduct.includedTax == '2'?'':(cmSvipProduct.invoiceType == '1'?'-开增值税专用发票':(cmSvipProduct.invoiceType == '2'?'-开增值税普通发票':'-不能开票'))}</label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group" style="display: ${cmSvipProduct.includedTax == '2'?'none':''}">
|
|
|
- <label class="control-label">机构税率:</label>
|
|
|
- <div class="controls">
|
|
|
- <label class="showLabel">${cmSvipProduct.taxPoint}%</label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group" style="display: ${cmSvipProduct.includedTax == '2'?'none':''}">
|
|
|
- <label class="control-label">供应商税率:</label>
|
|
|
- <div class="controls">
|
|
|
- <label class="showLabel">${cmSvipProduct.supplierTaxPoint}%</label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group">
|
|
|
- <label class="control-label">成本:</label>
|
|
|
- <div class="controls">
|
|
|
- <label class="showLabel">${cmSvipProduct.costCheckFlag eq '1'?'固定成本':'比例成本'}</label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group" style="display: ${cmSvipProduct.costCheckFlag eq '1'?'none':''}">
|
|
|
- <label class="control-label">比例成本百分比:</label>
|
|
|
- <div class="controls">
|
|
|
- <label class="showLabel">${cmSvipProduct.costProportional}%</label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group">
|
|
|
- <label class="control-label">成本价:</label>
|
|
|
- <div class="controls">
|
|
|
- <label class="showLabel">
|
|
|
- <fmt:formatNumber value="${cmSvipProduct.costPrice}" type="number" pattern="#0.00"/>
|
|
|
- </label>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group">
|
|
|
- <label class="control-label"><font color="red">*</font>会员价:</label>
|
|
|
- <div class="controls">
|
|
|
- <form:radiobutton path="priceType" onchange="changePriceType(1)" value="1" label="折扣价"/>
|
|
|
- <form:radiobutton path="priceType" onchange="changePriceType(2)" value="2" label="直接优惠价"/>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group discountInput" hidden>
|
|
|
- <div class="controls">
|
|
|
- <form:input path="discount" htmlEscape="false" onchange="changeDiscount(this,1)" class="input-medium required"/> %
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group discountPriceInput" hidden>
|
|
|
- <div class="controls">
|
|
|
- <form:input path="discountPrice" htmlEscape="false" onchange="changeDiscount(this,2)" class="input-medium required"/>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="control-group">
|
|
|
- <label class="control-label"><font color="red">*</font>排序值:</label>
|
|
|
- <div class="controls">
|
|
|
- <form:input path="sort" htmlEscape="false" placeholder="请填写排序值" class="input-xlarge required"/>
|
|
|
- </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>
|
|
|
+<ul class="nav nav-tabs">
|
|
|
+ <li><a href="${ctx}/svip/cmSvipProduct/">商品列表</a></li>
|
|
|
+ <li class="active"><a
|
|
|
+ href="${ctx}/svip/cmSvipProduct/form?id=${cmSvipProduct.id}">商品${not empty cmSvipProduct.id?'编辑':'添加'}</a>
|
|
|
+ </li>
|
|
|
+</ul>
|
|
|
+<br/>
|
|
|
+<form:form id="inputForm" modelAttribute="cmSvipProduct" action="${ctx}/svip/cmSvipProduct/save" method="post"
|
|
|
+ class="form-horizontal">
|
|
|
+ <form:hidden path="id"/>
|
|
|
+ <sys:message content="${message}"/>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label">商品ID:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <label class="showLabel">${cmSvipProduct.productId}</label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label">商品名称:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <label class="showLabel">${cmSvipProduct.productName}</label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label">供应商:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <label class="showLabel">${cmSvipProduct.shopName}</label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <%-- <div class="control-group">--%>
|
|
|
+ <%-- <label class="control-label">机构价:</label>--%>
|
|
|
+ <%-- <div class="controls">--%>
|
|
|
+ <%-- <label class="showLabel">¥${cmSvipProduct.price}</label>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- <div class="control-group">--%>
|
|
|
+ <%-- <label class="control-label">是否含税:</label>--%>
|
|
|
+ <%-- <div class="controls">--%>
|
|
|
+ <%-- <label class="showLabel">${cmSvipProduct.includedTax == '1'?'含税':(cmSvipProduct.includedTax == '0'?'不含税':'未知')}--%>
|
|
|
+ <%-- ${cmSvipProduct.includedTax == '2'?'':(cmSvipProduct.invoiceType == '1'?'-开增值税专用发票':(cmSvipProduct.invoiceType == '2'?'-开增值税普通发票':'-不能开票'))}</label>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <div class="control-group" style="display: ${cmSvipProduct.includedTax == '2'?'none':''}">
|
|
|
+ <label class="control-label">机构税率:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <label class="showLabel">${cmSvipProduct.taxPoint}%</label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group" style="display: ${cmSvipProduct.includedTax == '2'?'none':''}">
|
|
|
+ <label class="control-label">供应商税率:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <label class="showLabel">${cmSvipProduct.supplierTaxPoint}%</label>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <%-- <div class="control-group">--%>
|
|
|
+ <%-- <label class="control-label">成本:</label>--%>
|
|
|
+ <%-- <div class="controls">--%>
|
|
|
+ <%-- <label class="showLabel">${cmSvipProduct.costCheckFlag eq '1'?'固定成本':'比例成本'}</label>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- <div class="control-group" style="display: ${cmSvipProduct.costCheckFlag eq '1'?'none':''}">--%>
|
|
|
+ <%-- <label class="control-label">比例成本百分比:</label>--%>
|
|
|
+ <%-- <div class="controls">--%>
|
|
|
+ <%-- <label class="showLabel">${cmSvipProduct.costProportional}%</label>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- <div class="control-group">--%>
|
|
|
+ <%-- <label class="control-label">成本价:</label>--%>
|
|
|
+ <%-- <div class="controls">--%>
|
|
|
+ <%-- <label class="showLabel">--%>
|
|
|
+ <%-- <fmt:formatNumber value="${cmSvipProduct.costPrice}" type="number" pattern="#0.00"/>--%>
|
|
|
+ <%-- </label>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- <div class="control-group">--%>
|
|
|
+ <%-- <label class="control-label"><font color="red">*</font>会员价:</label>--%>
|
|
|
+ <%-- <div class="controls">--%>
|
|
|
+ <%-- <form:radiobutton path="priceType" onchange="changePriceType(1)" value="1" label="折扣价"/>--%>
|
|
|
+ <%-- <form:radiobutton path="priceType" onchange="changePriceType(2)" value="2" label="直接优惠价"/>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- <div class="control-group discountInput" hidden>--%>
|
|
|
+ <%-- <div class="controls">--%>
|
|
|
+ <%-- <form:input path="discount" htmlEscape="false" onchange="changeDiscount(this,1)" class="input-medium required"/> %--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- <div class="control-group discountPriceInput" hidden>--%>
|
|
|
+ <%-- <div class="controls">--%>
|
|
|
+ <%-- <form:input path="discountPrice" htmlEscape="false" onchange="changeDiscount(this,2)" class="input-medium required"/>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <%-- </div>--%>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>排序值:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:input path="sort" htmlEscape="false" placeholder="请填写排序值" class="input-xlarge required"/>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label"><font color="red">*</font>优惠状态:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <select name="status" id="vipStatus" class="input-medium">
|
|
|
+ <c:choose>
|
|
|
+ <c:when test="${cmSvipProduct.status eq 1}">
|
|
|
+ <option value="1">已下架</option>
|
|
|
+ <option value="0">已上架</option>
|
|
|
+ </c:when>
|
|
|
+ <c:otherwise>
|
|
|
+ <option value="0">已上架</option>
|
|
|
+ <option value="1">已下架</option>
|
|
|
+ </c:otherwise>
|
|
|
+ </c:choose>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <div class="control-group">
|
|
|
+ <table id="refundTable" class="table table-striped table-bordered table-condensed">
|
|
|
+ <tr>
|
|
|
+ <th>商品规格</th>
|
|
|
+ <th>机构价</th>
|
|
|
+ <th>成本类型</th>
|
|
|
+ <th>成本价/成本比例</th>
|
|
|
+ <th>会员折扣(%)</th>
|
|
|
+ <th>会员价</th>
|
|
|
+ </tr>
|
|
|
+ <c:forEach items="${cmSvipProduct.skus}" var="sku" varStatus="s">
|
|
|
+ <tr>
|
|
|
+ <td hidden><input name="skus[${s.index}].skuId" value="${sku.skuId}"/></td>
|
|
|
+ <td>${sku.unit}</td>
|
|
|
+ <td>${sku.price}</td>
|
|
|
+ <td>${1 eq sku.costCheckFlag?"固定成本":"比例成本"}</td>
|
|
|
+ <td>${1 eq sku.costCheckFlag?sku.costPrice:sku.costProportional}</td>
|
|
|
+ <td><input class="discount" id="discount${sku.skuId}${s.index}" name="skus[${s.index}].discount"
|
|
|
+ onchange="changeDiscount(${sku.skuId},1,${s.index})" type="number" maxlength="11"
|
|
|
+ style="width: 100px"> %
|
|
|
+ </td>
|
|
|
+ <td><input class="discountPrice" id="discountPrice${sku.skuId}${s.index}"
|
|
|
+ name="skus[${s.index}].discountPrice"
|
|
|
+ onchange="changeDiscount(${sku.skuId},2,${s.index})" type="number" maxlength="11"
|
|
|
+ style="width: 100px"></td>
|
|
|
+ </tr>
|
|
|
+ </c:forEach>
|
|
|
+ </table>
|
|
|
+ </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 () {
|
|
|
- var priceType = ${cmSvipProduct.priceType}
|
|
|
- if (priceType == 1) {
|
|
|
- $(".discountInput").show();
|
|
|
- } else {
|
|
|
- $(".discountPriceInput").show();
|
|
|
- }
|
|
|
- })
|
|
|
- function changePriceType(priceType) {
|
|
|
- if (priceType == 1) {
|
|
|
- $(".discountInput").show();
|
|
|
- $(".discountPriceInput").hide();
|
|
|
- } else {
|
|
|
- $(".discountInput").hide();
|
|
|
- $(".discountPriceInput").show();
|
|
|
- }
|
|
|
- }
|
|
|
+ $(function () {
|
|
|
+ debugger
|
|
|
+ var priceType = '${cmSvipProduct.priceType}';
|
|
|
+ if (priceType == '2') {
|
|
|
+ $(".discount").prop('disabled',true);
|
|
|
+ } else if(priceType == '1'){
|
|
|
+ $(".discountPrice").prop('disabled',true);
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
- * @param obj
|
|
|
- * jquery控制input只能输入数字
|
|
|
- */
|
|
|
- function onlynum(obj) {
|
|
|
- obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
|
|
|
- }
|
|
|
+ })
|
|
|
|
|
|
- /**
|
|
|
- * 更改折扣/折扣价
|
|
|
- */
|
|
|
- function changeDiscount(obj,priceType) {
|
|
|
- var val = obj.value;
|
|
|
- var number = Number(val).toFixed(2);
|
|
|
- if (priceType == 1) {
|
|
|
- if (val > 100 || val <= 0) {
|
|
|
- $.jBox.tip("请输入0-100之间的数字", 'info');
|
|
|
- obj.value = '';
|
|
|
- }else {
|
|
|
- if (number == 'NaN') {
|
|
|
- $.jBox.tip("请输入正确的数字", 'info');
|
|
|
- obj.value = '';
|
|
|
- } else {
|
|
|
- obj.value = number;
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (val != '' && val != undefined) {
|
|
|
- if (number == 'NaN') {
|
|
|
- $.jBox.tip("请输入正确的数字", 'info');
|
|
|
- obj.value = '';
|
|
|
- } else {
|
|
|
- obj.value = number;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ function changePriceType(priceType) {
|
|
|
+ if (priceType == 1) {
|
|
|
+ $(".discountInput").show();
|
|
|
+ $(".discountPriceInput").hide();
|
|
|
+ } else {
|
|
|
+ $(".discountInput").hide();
|
|
|
+ $(".discountPriceInput").show();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ function changeDiscount(skuId, priceType, ind) {
|
|
|
+ var cd = skuId + "" + ind;
|
|
|
+ if (priceType == 1) {
|
|
|
+ var val = $("#discount" + cd).val();
|
|
|
+ if (val == '') {
|
|
|
+ $("#discountPrice" + cd).removeAttr('readonly');
|
|
|
+ } else if (val > 100 || val <= 0) {
|
|
|
+ $.jBox.tip("请输入0-100之间的数字", 'info');
|
|
|
+ $("#discount" + cd).val('');
|
|
|
+ $("#discountPrice" + cd).removeAttr('readonly');
|
|
|
+ } else {
|
|
|
+ val = Number(val).toFixed(2);
|
|
|
+ $("#discount" + cd).val(val);
|
|
|
+ $("#discountPrice" + cd).attr('readonly', 'readonly');
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ var val = $("#discountPrice" + cd).val();
|
|
|
+ if (val != '' && val != undefined) {
|
|
|
+ val = Number(val).toFixed(2);
|
|
|
+ $("#discountPrice" + cd).val(val);
|
|
|
+ $("#discount" + cd).attr('readonly', 'readonly');
|
|
|
+ } else {
|
|
|
+ $("#discount" + cd).removeAttr('readonly');
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param obj
|
|
|
+ * jquery控制input只能输入数字
|
|
|
+ */
|
|
|
+ function onlynum(obj) {
|
|
|
+ obj.value = obj.value.replace(/[^\d]/g, ""); //清除"数字"以外的字符
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更改折扣/折扣价
|
|
|
+ */
|
|
|
+ // function changeDiscount(obj,priceType) {
|
|
|
+ // var val = obj.value;
|
|
|
+ // var number = Number(val).toFixed(2);
|
|
|
+ // if (priceType == 1) {
|
|
|
+ // if (val > 100 || val <= 0) {
|
|
|
+ // $.jBox.tip("请输入0-100之间的数字", 'info');
|
|
|
+ // obj.value = '';
|
|
|
+ // }else {
|
|
|
+ // if (number == 'NaN') {
|
|
|
+ // $.jBox.tip("请输入正确的数字", 'info');
|
|
|
+ // obj.value = '';
|
|
|
+ // } else {
|
|
|
+ // obj.value = number;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // } else {
|
|
|
+ // if (val != '' && val != undefined) {
|
|
|
+ // if (number == 'NaN') {
|
|
|
+ // $.jBox.tip("请输入正确的数字", 'info');
|
|
|
+ // obj.value = '';
|
|
|
+ // } else {
|
|
|
+ // obj.value = number;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
</script>
|
|
|
</body>
|
|
|
</html>
|