|
@@ -1,651 +1,723 @@
|
|
|
<%@ 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>
|
|
|
- body {
|
|
|
- font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
|
- font-size: 14px;
|
|
|
- line-height: 1.42857143;
|
|
|
- color: #666;
|
|
|
- margin: 0;
|
|
|
- }
|
|
|
-
|
|
|
- .hidden {
|
|
|
- display: none !important;
|
|
|
- }
|
|
|
- .selectPickerWrapper * {
|
|
|
- box-sizing: border-box;
|
|
|
- }
|
|
|
- .selectPickerWrapper {
|
|
|
- position: relative;
|
|
|
- /* margin: 50px; */
|
|
|
- display: inline-block;
|
|
|
- }
|
|
|
- .select-picker-search {
|
|
|
- width: 200px;
|
|
|
- height: 32px;
|
|
|
- line-height: 32px;
|
|
|
- color: #666;
|
|
|
- border-radius: 3px;
|
|
|
- border: 1px solid #ddd;
|
|
|
- padding: 0 10px;
|
|
|
- font-size: 14px;
|
|
|
- cursor: pointer;
|
|
|
- }
|
|
|
- .select-picker-search-checked {
|
|
|
- position: relative;
|
|
|
- width: 180px;
|
|
|
- white-space: nowrap;
|
|
|
- text-overflow: ellipsis;
|
|
|
- overflow: hidden;
|
|
|
- padding-right: 5px;
|
|
|
- }
|
|
|
- .select-picker-search-checked:after {
|
|
|
- border: 5px solid transparent;
|
|
|
- content: ' ';
|
|
|
- height: 0;
|
|
|
- position: absolute;
|
|
|
- width: 0;
|
|
|
- top: 12.2px;
|
|
|
- border-top: 8px solid #666;
|
|
|
- right: 0;
|
|
|
- }
|
|
|
- .select-picker-options-wrp {
|
|
|
- display: none;
|
|
|
- width: 200px;
|
|
|
- border-radius: 2px;
|
|
|
- box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
|
|
|
- background-color: #fff;
|
|
|
- position: absolute;
|
|
|
- top: 36px;
|
|
|
- left: 0;
|
|
|
- z-index: 999;
|
|
|
- }
|
|
|
- .select-picker-options-serch input {
|
|
|
- width: 160px;
|
|
|
- height: 32px;
|
|
|
- line-height: 32px;
|
|
|
- border: 1px solid #ddd;
|
|
|
- border-radius: 3px;
|
|
|
- margin: 12px 0 0 10px;
|
|
|
- padding-left: 8px;
|
|
|
- }
|
|
|
- .select-picker-options-serch input:focus {
|
|
|
- border-color: #2fa4e7;
|
|
|
- outline: 0;
|
|
|
- -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
|
|
- box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
|
|
- }
|
|
|
- .select-picker-options-list {
|
|
|
- width: 100%;
|
|
|
- padding: 8px 0;
|
|
|
- }
|
|
|
- .select-picker-options-list-item {
|
|
|
- width: 100%;
|
|
|
- line-height: 36px;
|
|
|
- cursor: pointer;
|
|
|
- padding: 0 12px;
|
|
|
- }
|
|
|
- .select-picker-options-list-item:hover {
|
|
|
- background: #ebf1f5;
|
|
|
- }
|
|
|
- .duihao {
|
|
|
- display: inline-block;
|
|
|
- width: 18px;
|
|
|
- height: 18px;
|
|
|
- border-radius: 3px;
|
|
|
- transform: translateY(4px);
|
|
|
- margin-right: 6px;
|
|
|
- }
|
|
|
- .duihao-checked {
|
|
|
- background: #2fa4e7;
|
|
|
- position: relative;
|
|
|
- }
|
|
|
- .duihao-checked:before,
|
|
|
- .duihao-checked::after {
|
|
|
- content: '';
|
|
|
- height: 10px;
|
|
|
- width: 2px;
|
|
|
- border-radius: 10px;
|
|
|
- display: block;
|
|
|
- background: white;
|
|
|
- position: absolute;
|
|
|
- top: 4px;
|
|
|
- left: 10px;
|
|
|
- transform: rotate(45deg);
|
|
|
- -ms-transform: rotate(45deg);
|
|
|
- }
|
|
|
- .duihao-checked::before {
|
|
|
- height: 6px;
|
|
|
- transform: rotate(-45deg);
|
|
|
- -ms-transform: rotate(-45deg);
|
|
|
- position: absolute;
|
|
|
- top: 7px;
|
|
|
- left: 5px;
|
|
|
- }
|
|
|
- .duihao-nocheck {
|
|
|
- border: 1px solid #ddd;
|
|
|
- }
|
|
|
-
|
|
|
- </style>
|
|
|
- <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);
|
|
|
- }
|
|
|
- }
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
-
|
|
|
- /*;(function ($, window, document, undefined) {
|
|
|
- //用一个自调用匿名函数把插架代码包裹起来,防止代码污染
|
|
|
- $.fn.mySelect = function (options) {
|
|
|
- var defaults = {
|
|
|
- //defaults 使我们设置的默认参数。
|
|
|
- callback: function (res) {
|
|
|
- console.log(res)
|
|
|
- },
|
|
|
- }
|
|
|
- var options = $.extend(defaults, options) //将传入参数和默认参数合并
|
|
|
- var $this = $(this) //当然响应事件对象
|
|
|
- var selectValues = []
|
|
|
- //生成option-item并追加展示
|
|
|
- var html = ''
|
|
|
- html += '<div class="select-picker-search">'
|
|
|
- html += '<div class="select-picker-search-checked">请选择</div>'
|
|
|
- html += '</div>'
|
|
|
- html += '<div class="select-picker-options-wrp">'
|
|
|
- // html += '<div class="select-picker-options-serch">';
|
|
|
- // html += '<input type="text" placeholder="">';
|
|
|
- // html += '</div>';
|
|
|
- html += '<div class="select-picker-options-list">'
|
|
|
- $this.find('option').each(function () {
|
|
|
- let _this = $(this)
|
|
|
- html += '<div class="select-picker-options-list-item"'
|
|
|
- html += 'value="' + _this.attr('value') + '">'
|
|
|
- html += '<b class="duihao duihao-nocheck"></b>'
|
|
|
- html += '<span>' + _this.text() + '</span>'
|
|
|
- html += '</div>'
|
|
|
- })
|
|
|
- html += '</div>'
|
|
|
- html += '</div>'
|
|
|
- $this.append(html)
|
|
|
- // 下拉显示隐藏
|
|
|
- $this.on('click', '.select-picker-search', function (e) {
|
|
|
- //功能代码部分,绑定事件
|
|
|
- $(this).next('.select-picker-options-wrp').toggle()
|
|
|
- // $(this).next('.select-picker-options-wrp').find('.select-picker-options-serch input').focus()
|
|
|
- })
|
|
|
- // 点击选中或不选
|
|
|
- $this.on('click', '.select-picker-options-list-item', function () {
|
|
|
- let _this = $(this)
|
|
|
- if (_this.find('.duihao-nocheck').length > 0) {
|
|
|
- _this.find('.duihao').removeClass('duihao-nocheck').addClass('duihao-checked')
|
|
|
- } else {
|
|
|
- _this.find('.duihao').addClass('duihao-nocheck').removeClass('duihao-checked')
|
|
|
- }
|
|
|
- // 循环遍历options中选中的项添加到选项栏中
|
|
|
- var checkedArr = []
|
|
|
- selectValues = []
|
|
|
- $this.find('.select-picker-options-list-item').each(function () {
|
|
|
- let _this = $(this)
|
|
|
- if (_this.find('.duihao-checked').length > 0) {
|
|
|
- checkedArr.push($.trim(_this.text()))
|
|
|
- selectValues.push(_this.attr('value'))
|
|
|
- }
|
|
|
- })
|
|
|
- if (checkedArr.length > 0) {
|
|
|
- $this.find('.select-picker-search-checked').text(checkedArr.join(','))
|
|
|
- // $this.find('.select-picker-search-checked').text(checkedArr.join(',')).css('color', '#fff');
|
|
|
- } else {
|
|
|
- $this.find('.select-picker-search-checked').text('请选择').css('color', '#757575')
|
|
|
- }
|
|
|
- // 回调
|
|
|
- options.callback(selectValues)
|
|
|
- })
|
|
|
- // 前端实现下拉搜索
|
|
|
- // $this.on('keyup', '.select-picker-options-serch input', function () {
|
|
|
- // var text = $(this).val()
|
|
|
- // var html = ''
|
|
|
- // $this.find('option').each(function () {
|
|
|
- // let _this = $(this)
|
|
|
- // if (_this.text().indexOf(text) != -1) {
|
|
|
- // html += '<div class="select-picker-options-list-item">'
|
|
|
- // html += '<b class="duihao duihao-nocheck"></b>'
|
|
|
- // html += '<span>' + _this.text() + '</span>'
|
|
|
- // html += '</div>'
|
|
|
- // }
|
|
|
- // })
|
|
|
- // if (html == '') {
|
|
|
- // html += '<p style="text-align:center;">没有相关内容</p>'
|
|
|
- // }
|
|
|
- // $this.find('.select-picker-options-list').html('').append(html)
|
|
|
- // })
|
|
|
- // 点击document任意地方 下拉消失
|
|
|
- $(document).click(function (event) {
|
|
|
- var _con = $('.select-picker-options-wrp') // 设置目标区域
|
|
|
- var _con2 = $('.select-picker-search-checked') // 设置目标区域
|
|
|
- if (!_con2.is(event.target) && !_con.is(event.target) && _con.has(event.target).length === 0) {
|
|
|
- // Mark 1
|
|
|
- $('.select-picker-options-wrp').hide() //淡出消失
|
|
|
- }
|
|
|
- })
|
|
|
- }
|
|
|
- })(jQuery, window, document)
|
|
|
-
|
|
|
- $(function () {
|
|
|
- $('#demo1').mySelect({
|
|
|
- callback: function (res) {
|
|
|
- console.log(res);
|
|
|
- $("#floorIds").val(res)
|
|
|
- },
|
|
|
- })
|
|
|
- })*/
|
|
|
- </script>
|
|
|
+ <title>呵呵商品管理</title>
|
|
|
+ <meta name="decorator" content="default"/>
|
|
|
+ <style>
|
|
|
+ body {
|
|
|
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
|
|
+ font-size: 14px;
|
|
|
+ line-height: 1.42857143;
|
|
|
+ color: #666;
|
|
|
+ margin: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .hidden {
|
|
|
+ display: none !important;
|
|
|
+ }
|
|
|
+
|
|
|
+ .selectPickerWrapper * {
|
|
|
+ box-sizing: border-box;
|
|
|
+ }
|
|
|
+
|
|
|
+ .selectPickerWrapper {
|
|
|
+ position: relative;
|
|
|
+ /* margin: 50px; */
|
|
|
+ display: inline-block;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-picker-search {
|
|
|
+ width: 200px;
|
|
|
+ height: 32px;
|
|
|
+ line-height: 32px;
|
|
|
+ color: #666;
|
|
|
+ border-radius: 3px;
|
|
|
+ border: 1px solid #ddd;
|
|
|
+ padding: 0 10px;
|
|
|
+ font-size: 14px;
|
|
|
+ cursor: pointer;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-picker-search-checked {
|
|
|
+ position: relative;
|
|
|
+ width: 180px;
|
|
|
+ white-space: nowrap;
|
|
|
+ text-overflow: ellipsis;
|
|
|
+ overflow: hidden;
|
|
|
+ padding-right: 5px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-picker-search-checked:after {
|
|
|
+ border: 5px solid transparent;
|
|
|
+ content: ' ';
|
|
|
+ height: 0;
|
|
|
+ position: absolute;
|
|
|
+ width: 0;
|
|
|
+ top: 12.2px;
|
|
|
+ border-top: 8px solid #666;
|
|
|
+ right: 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-picker-options-wrp {
|
|
|
+ display: none;
|
|
|
+ width: 200px;
|
|
|
+ border-radius: 2px;
|
|
|
+ box-shadow: 0 1px 5px rgba(0, 0, 0, 0.2);
|
|
|
+ background-color: #fff;
|
|
|
+ position: absolute;
|
|
|
+ top: 36px;
|
|
|
+ left: 0;
|
|
|
+ z-index: 999;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-picker-options-serch input {
|
|
|
+ width: 160px;
|
|
|
+ height: 32px;
|
|
|
+ line-height: 32px;
|
|
|
+ border: 1px solid #ddd;
|
|
|
+ border-radius: 3px;
|
|
|
+ margin: 12px 0 0 10px;
|
|
|
+ padding-left: 8px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-picker-options-serch input:focus {
|
|
|
+ border-color: #2fa4e7;
|
|
|
+ outline: 0;
|
|
|
+ -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
|
|
+ box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 8px rgba(102, 175, 233, 0.6);
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-picker-options-list {
|
|
|
+ width: 100%;
|
|
|
+ padding: 8px 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-picker-options-list-item {
|
|
|
+ width: 100%;
|
|
|
+ line-height: 36px;
|
|
|
+ cursor: pointer;
|
|
|
+ padding: 0 12px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .select-picker-options-list-item:hover {
|
|
|
+ background: #ebf1f5;
|
|
|
+ }
|
|
|
+
|
|
|
+ .duihao {
|
|
|
+ display: inline-block;
|
|
|
+ width: 18px;
|
|
|
+ height: 18px;
|
|
|
+ border-radius: 3px;
|
|
|
+ transform: translateY(4px);
|
|
|
+ margin-right: 6px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .duihao-checked {
|
|
|
+ background: #2fa4e7;
|
|
|
+ position: relative;
|
|
|
+ }
|
|
|
+
|
|
|
+ .duihao-checked:before,
|
|
|
+ .duihao-checked::after {
|
|
|
+ content: '';
|
|
|
+ height: 10px;
|
|
|
+ width: 2px;
|
|
|
+ border-radius: 10px;
|
|
|
+ display: block;
|
|
|
+ background: white;
|
|
|
+ position: absolute;
|
|
|
+ top: 4px;
|
|
|
+ left: 10px;
|
|
|
+ transform: rotate(45deg);
|
|
|
+ -ms-transform: rotate(45deg);
|
|
|
+ }
|
|
|
+
|
|
|
+ .duihao-checked::before {
|
|
|
+ height: 6px;
|
|
|
+ transform: rotate(-45deg);
|
|
|
+ -ms-transform: rotate(-45deg);
|
|
|
+ position: absolute;
|
|
|
+ top: 7px;
|
|
|
+ left: 5px;
|
|
|
+ }
|
|
|
+
|
|
|
+ .duihao-nocheck {
|
|
|
+ border: 1px solid #ddd;
|
|
|
+ }
|
|
|
+
|
|
|
+ </style>
|
|
|
+ <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);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+
|
|
|
+ /*;(function ($, window, document, undefined) {
|
|
|
+ //用一个自调用匿名函数把插架代码包裹起来,防止代码污染
|
|
|
+ $.fn.mySelect = function (options) {
|
|
|
+ var defaults = {
|
|
|
+ //defaults 使我们设置的默认参数。
|
|
|
+ callback: function (res) {
|
|
|
+ console.log(res)
|
|
|
+ },
|
|
|
+ }
|
|
|
+ var options = $.extend(defaults, options) //将传入参数和默认参数合并
|
|
|
+ var $this = $(this) //当然响应事件对象
|
|
|
+ var selectValues = []
|
|
|
+ //生成option-item并追加展示
|
|
|
+ var html = ''
|
|
|
+ html += '<div class="select-picker-search">'
|
|
|
+ html += '<div class="select-picker-search-checked">请选择</div>'
|
|
|
+ html += '</div>'
|
|
|
+ html += '<div class="select-picker-options-wrp">'
|
|
|
+ // html += '<div class="select-picker-options-serch">';
|
|
|
+ // html += '<input type="text" placeholder="">';
|
|
|
+ // html += '</div>';
|
|
|
+ html += '<div class="select-picker-options-list">'
|
|
|
+ $this.find('option').each(function () {
|
|
|
+ let _this = $(this)
|
|
|
+ html += '<div class="select-picker-options-list-item"'
|
|
|
+ html += 'value="' + _this.attr('value') + '">'
|
|
|
+ html += '<b class="duihao duihao-nocheck"></b>'
|
|
|
+ html += '<span>' + _this.text() + '</span>'
|
|
|
+ html += '</div>'
|
|
|
+ })
|
|
|
+ html += '</div>'
|
|
|
+ html += '</div>'
|
|
|
+ $this.append(html)
|
|
|
+ // 下拉显示隐藏
|
|
|
+ $this.on('click', '.select-picker-search', function (e) {
|
|
|
+ //功能代码部分,绑定事件
|
|
|
+ $(this).next('.select-picker-options-wrp').toggle()
|
|
|
+ // $(this).next('.select-picker-options-wrp').find('.select-picker-options-serch input').focus()
|
|
|
+ })
|
|
|
+ // 点击选中或不选
|
|
|
+ $this.on('click', '.select-picker-options-list-item', function () {
|
|
|
+ let _this = $(this)
|
|
|
+ if (_this.find('.duihao-nocheck').length > 0) {
|
|
|
+ _this.find('.duihao').removeClass('duihao-nocheck').addClass('duihao-checked')
|
|
|
+ } else {
|
|
|
+ _this.find('.duihao').addClass('duihao-nocheck').removeClass('duihao-checked')
|
|
|
+ }
|
|
|
+ // 循环遍历options中选中的项添加到选项栏中
|
|
|
+ var checkedArr = []
|
|
|
+ selectValues = []
|
|
|
+ $this.find('.select-picker-options-list-item').each(function () {
|
|
|
+ let _this = $(this)
|
|
|
+ if (_this.find('.duihao-checked').length > 0) {
|
|
|
+ checkedArr.push($.trim(_this.text()))
|
|
|
+ selectValues.push(_this.attr('value'))
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if (checkedArr.length > 0) {
|
|
|
+ $this.find('.select-picker-search-checked').text(checkedArr.join(','))
|
|
|
+ // $this.find('.select-picker-search-checked').text(checkedArr.join(',')).css('color', '#fff');
|
|
|
+ } else {
|
|
|
+ $this.find('.select-picker-search-checked').text('请选择').css('color', '#757575')
|
|
|
+ }
|
|
|
+ // 回调
|
|
|
+ options.callback(selectValues)
|
|
|
+ })
|
|
|
+ // 前端实现下拉搜索
|
|
|
+ // $this.on('keyup', '.select-picker-options-serch input', function () {
|
|
|
+ // var text = $(this).val()
|
|
|
+ // var html = ''
|
|
|
+ // $this.find('option').each(function () {
|
|
|
+ // let _this = $(this)
|
|
|
+ // if (_this.text().indexOf(text) != -1) {
|
|
|
+ // html += '<div class="select-picker-options-list-item">'
|
|
|
+ // html += '<b class="duihao duihao-nocheck"></b>'
|
|
|
+ // html += '<span>' + _this.text() + '</span>'
|
|
|
+ // html += '</div>'
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // if (html == '') {
|
|
|
+ // html += '<p style="text-align:center;">没有相关内容</p>'
|
|
|
+ // }
|
|
|
+ // $this.find('.select-picker-options-list').html('').append(html)
|
|
|
+ // })
|
|
|
+ // 点击document任意地方 下拉消失
|
|
|
+ $(document).click(function (event) {
|
|
|
+ var _con = $('.select-picker-options-wrp') // 设置目标区域
|
|
|
+ var _con2 = $('.select-picker-search-checked') // 设置目标区域
|
|
|
+ if (!_con2.is(event.target) && !_con.is(event.target) && _con.has(event.target).length === 0) {
|
|
|
+ // Mark 1
|
|
|
+ $('.select-picker-options-wrp').hide() //淡出消失
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })(jQuery, window, document)
|
|
|
+
|
|
|
+ $(function () {
|
|
|
+ $('#demo1').mySelect({
|
|
|
+ callback: function (res) {
|
|
|
+ console.log(res);
|
|
|
+ $("#floorIds").val(res)
|
|
|
+ },
|
|
|
+ })
|
|
|
+ })*/
|
|
|
+ </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}"/>
|
|
|
-<%-- <form:hidden path="floorIds"/>--%>
|
|
|
- <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;" min="0" id="price" name="price" value="${cmHeheProduct.price}" required onblur="checkPrice(this)">
|
|
|
- </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:select path="bigTypeId" class="input-small required" id="bigType" onchange="loadSmallType()">
|
|
|
- <form:option value="" label="请选择"/>
|
|
|
- <form:options items="${classify.bigTypeList}" itemLabel="name" itemValue="bigTypeID"
|
|
|
- htmlEscape="false"/>
|
|
|
- </form:select>
|
|
|
- <form:select path="smallTypeId" class="input-small required" id="smallType">
|
|
|
- <form:option value="" label="请选择"/>
|
|
|
- <c:forEach items="${classify.smalltypeList}" var="smallType">
|
|
|
- <form:option value="${smallType.smallTypeID}" label="${smallType.name}"
|
|
|
- bigTypeId="${smallType.bigTypeID}"/>
|
|
|
- </c:forEach>
|
|
|
- </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>
|
|
|
- <c:if test="${cmHeheProduct.id eq null}">
|
|
|
- <%--<div class="control-group">
|
|
|
- <label class="control-label">首页楼层:</label>
|
|
|
- <div class="controls" style="overflow: visible">
|
|
|
- <div id="demo1" class="selectPickerWrapper">
|
|
|
- <select class="hidden" multiple="multiple" id="select">
|
|
|
- <c:forEach items="${floorList}" var="floor">
|
|
|
- <option value="${floor.id}" checked="${floor.checked?'checked':''}">${floor.title}</option>
|
|
|
- </c:forEach>
|
|
|
- </select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>--%>
|
|
|
- <div class="control-group">
|
|
|
- <label class="control-label">商城活动:</label>
|
|
|
- <div class="controls">
|
|
|
- <form:select path="activityId" class="input-small">
|
|
|
- <form:option value="" label="选择活动"/>
|
|
|
- <form:options items="${activityList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
|
|
|
- </form:select>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </c:if>
|
|
|
- <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, ""); //清除"数字"以外的字符
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * @param obj
|
|
|
- * jquery检验售价
|
|
|
- */
|
|
|
- function checkPrice(obj) {
|
|
|
- if (obj.value == '0') {
|
|
|
- obj.value = '';
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- $(window).load(function () {
|
|
|
- loadInitType();
|
|
|
- });
|
|
|
-
|
|
|
- // 网站分类
|
|
|
- var currentBigtype = ${empty cmHeheProduct.bigTypeId?0:cmHeheProduct.bigTypeId};
|
|
|
- var currentSmalltype = ${empty cmHeheProduct.smallTypeId?0:cmHeheProduct.smallTypeId};
|
|
|
- var bigTypeList = [
|
|
|
- <c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
|
|
|
- <c:if test="${index.index > 0}">, </c:if>
|
|
|
- {
|
|
|
- bigTypeId: ${bigType.bigTypeID},
|
|
|
- name: "${bigType.name}",
|
|
|
- typeSort: ${bigType.typeSort}
|
|
|
- }
|
|
|
- </c:forEach>
|
|
|
- ];
|
|
|
- var smalltypeList = [
|
|
|
- <c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
|
|
|
- <c:if test="${index.index > 0}">, </c:if>
|
|
|
- {
|
|
|
- smallTypeId: ${smalltype.smallTypeID},
|
|
|
- name: "${smalltype.name}",
|
|
|
- bigTypeId: ${smalltype.bigTypeID},
|
|
|
- }
|
|
|
- </c:forEach>
|
|
|
- ];
|
|
|
-
|
|
|
-
|
|
|
- // 初始分类
|
|
|
- function loadInitType() {
|
|
|
- if (currentBigtype != null && typeof (currentBigtype) != "undefined") {
|
|
|
- setTimeout(function () {
|
|
|
- loadBigType();
|
|
|
- }, 0);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 分类联动
|
|
|
- function loadBigType() {
|
|
|
- $("#bigType").html("");
|
|
|
- $("#bigType").prev().find(".select2-chosen").text("请选择");
|
|
|
- $("#bigType").append("<option value=''>请选择</option>");
|
|
|
- $("#smallType").html("");
|
|
|
- $("#smallType").prev().find(".select2-chosen").text("请选择");
|
|
|
- $("#smallType").append("<option value=''>请选择</option>");
|
|
|
- $("#tinyType").html("");
|
|
|
- $("#tinyType").prev().find(".select2-chosen").text("请选择");
|
|
|
- $("#tinyType").append("<option value=''>请选择</option>");
|
|
|
- for (var i = 0; i < bigTypeList.length; i++) {
|
|
|
- if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeId) {
|
|
|
- $("#bigType").append("<option selected value='" + bigTypeList[i].bigTypeId + "'>" + bigTypeList[i].name + "</option>");
|
|
|
- $("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
|
|
|
- setTimeout(function () {
|
|
|
- loadSmallType();
|
|
|
- }, 500);
|
|
|
- } else {
|
|
|
- $("#bigType").append("<option value='" + bigTypeList[i].bigTypeId + "'>" + bigTypeList[i].name + "</option>");
|
|
|
- }
|
|
|
- }
|
|
|
- loadSmallType();
|
|
|
- }
|
|
|
-
|
|
|
- function loadSmallType(id) {
|
|
|
- if (id) {
|
|
|
- $("#bigType").val(id);
|
|
|
- $("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
|
|
|
- }
|
|
|
- var bigType = $("#bigType").val();
|
|
|
- $("#smallType").html("");
|
|
|
- $("#smallType").prev().find(".select2-chosen").text("请选择");
|
|
|
- $("#smallType").append("<option value=''>请选择</option>");
|
|
|
- $("#tinyType").html("");
|
|
|
- $("#tinyType").prev().find(".select2-chosen").text("请选择");
|
|
|
- $("#tinyType").append("<option value=''>请选择</option>");
|
|
|
- if (typeof (bigType) != "undefined" && bigType != "") {
|
|
|
- var smallTypeNum = 0;
|
|
|
- for (var i = 0; i < smalltypeList.length; i++) {
|
|
|
- if (bigType == smalltypeList[i].bigTypeId) {
|
|
|
- smallTypeNum = smallTypeNum + 1;
|
|
|
- if (currentSmalltype != null && typeof (currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeId) {
|
|
|
- $("#smallType").append("<option selected value='" + smalltypeList[i].smallTypeId + "'>" + smalltypeList[i].name + "</option>");
|
|
|
- $("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
|
|
|
- } else {
|
|
|
- $("#smallType").append("<option value='" + smalltypeList[i].smallTypeId + "'>" + smalltypeList[i].name + "</option>");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
|
|
|
- }
|
|
|
- }
|
|
|
-</script>
|
|
|
+<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}"/>
|
|
|
+ <%-- <form:hidden path="floorIds"/>--%>
|
|
|
+<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">
|
|
|
+ <c:if test="${empty cmHeheProduct.skus}">
|
|
|
+ <div class="control-group" hidden id="skuPrice">
|
|
|
+ </c:if>
|
|
|
+ <c:if test="${not empty cmHeheProduct.skus}">
|
|
|
+ <div class="control-group" id="skuPrice">
|
|
|
+ </c:if>
|
|
|
+ <c:forEach items="${cmHeheProduct.skus}" var="sku" varStatus="index">
|
|
|
+ <div>
|
|
|
+ <input type="number" style="display:none" value="${sku.skuId}" name="skus[${index.index}].skuId">
|
|
|
+ <label class="control-label">
|
|
|
+ <font color="red">*</font>规格:规格${index.index+1}
|
|
|
+
|
|
|
+ </label>
|
|
|
+ <div class="controls">
|
|
|
+ <font color="red">*</font>售价:
|
|
|
+ <input type="number" style="width:100px;" min="0" id="price" name="skus[${index.index}].price"
|
|
|
+ value="${sku.price}" required onblur="checkPrice(this)">
|
|
|
+
|
|
|
+ <label><font color="red">*</font>成本: ${sku.costCheckFlag eq 1 ? '固定成本' : '比例成本'}</label>
|
|
|
+
|
|
|
+ <c:if test="${sku.costCheckFlag eq 1}">
|
|
|
+ <label><font color="red">*</font>成本价:${sku.costPrice}</label>
|
|
|
+ </c:if>
|
|
|
+ <c:if test="${sku.costCheckFlag eq 2}">
|
|
|
+ <label><font color="red">*</font>成本比例百分比:${sku.costProportional}</label>
|
|
|
+ </c:if>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </c:forEach>
|
|
|
+ </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:select path="bigTypeId" class="input-small required" id="bigType" onchange="loadSmallType()">
|
|
|
+ <form:option value="" label="请选择"/>
|
|
|
+ <form:options items="${classify.bigTypeList}" itemLabel="name" itemValue="bigTypeID"
|
|
|
+ htmlEscape="false"/>
|
|
|
+ </form:select>
|
|
|
+ <form:select path="smallTypeId" class="input-small required" id="smallType">
|
|
|
+ <form:option value="" label="请选择"/>
|
|
|
+ <c:forEach items="${classify.smalltypeList}" var="smallType">
|
|
|
+ <form:option value="${smallType.smallTypeID}" label="${smallType.name}"
|
|
|
+ bigTypeId="${smallType.bigTypeID}"/>
|
|
|
+ </c:forEach>
|
|
|
+ </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>
|
|
|
+ <c:if test="${cmHeheProduct.id eq null}">
|
|
|
+ <%--<div class="control-group">
|
|
|
+ <label class="control-label">首页楼层:</label>
|
|
|
+ <div class="controls" style="overflow: visible">
|
|
|
+ <div id="demo1" class="selectPickerWrapper">
|
|
|
+ <select class="hidden" multiple="multiple" id="select">
|
|
|
+ <c:forEach items="${floorList}" var="floor">
|
|
|
+ <option value="${floor.id}" checked="${floor.checked?'checked':''}">${floor.title}</option>
|
|
|
+ </c:forEach>
|
|
|
+ </select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </div>--%>
|
|
|
+ <div class="control-group">
|
|
|
+ <label class="control-label">商城活动:</label>
|
|
|
+ <div class="controls">
|
|
|
+ <form:select path="activityId" class="input-small">
|
|
|
+ <form:option value="" label="选择活动"/>
|
|
|
+ <form:options items="${activityList}" itemLabel="name" itemValue="id" htmlEscape="false"/>
|
|
|
+ </form:select>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </c:if>
|
|
|
+ <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);
|
|
|
+ var skus = {};
|
|
|
+ skus = items[0].skuList;
|
|
|
+ var html = '';
|
|
|
+
|
|
|
+ for (let i = 0; i < skus.length; i++) {
|
|
|
+ var unit=i+1;
|
|
|
+ var cost = skus[i].costCheckFlag == 1 ? '固定成本' : '比例成本';
|
|
|
+ var costShow = skus[i].costCheckFlag == 1 ? '<label><font color="red">*</font>成本价:' + skus[i].costPrice + '</label>' : '<label><font color="red">*</font>成本比例百分比:' + skus[i].costProportional + '</label>';
|
|
|
+ html += '<div><input type="number" style="display:none" value="' + skus[i].skuId + '" name="skus[' + i + '].skuId">';
|
|
|
+ html += '<label class="control-label"><font color="red">*</font>规格:规格' + unit;
|
|
|
+ html += ' </label>';
|
|
|
+ html += '<div class="controls"><font color="red">*</font>售价:';
|
|
|
+ html += '<input type="number" style="width:100px;" min="0" id="price" name="skus[' + i + '].price" value="' + skus[i].price + '" required onblur="checkPrice(this)">';
|
|
|
+ html += ' ';
|
|
|
+ html += '<label><font color="red">*</font>成本: ' + cost + '</label>';
|
|
|
+ html += ' ';
|
|
|
+ html += costShow + '</div></div>';
|
|
|
+ }
|
|
|
+ $("#skuPrice").html(html);
|
|
|
+ $("#skuPrice").show();
|
|
|
+
|
|
|
+ $('#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, ""); //清除"数字"以外的字符
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param obj
|
|
|
+ * jquery检验售价
|
|
|
+ */
|
|
|
+ function checkPrice(obj) {
|
|
|
+ if (obj.value == '0') {
|
|
|
+ obj.value = '';
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $(window).load(function () {
|
|
|
+ loadInitType();
|
|
|
+ });
|
|
|
+
|
|
|
+ // 网站分类
|
|
|
+ var currentBigtype = ${empty cmHeheProduct.bigTypeId?0:cmHeheProduct.bigTypeId};
|
|
|
+ var currentSmalltype = ${empty cmHeheProduct.smallTypeId?0:cmHeheProduct.smallTypeId};
|
|
|
+ var bigTypeList = [
|
|
|
+ <c:forEach items="${classify.bigTypeList}" var="bigType" varStatus="index">
|
|
|
+ <c:if test="${index.index > 0}">, </c:if>
|
|
|
+ {
|
|
|
+ bigTypeId: ${bigType.bigTypeID},
|
|
|
+ name: "${bigType.name}",
|
|
|
+ typeSort: ${bigType.typeSort}
|
|
|
+ }
|
|
|
+ </c:forEach>
|
|
|
+ ];
|
|
|
+ var smalltypeList = [
|
|
|
+ <c:forEach items="${classify.smalltypeList}" var="smalltype" varStatus="index">
|
|
|
+ <c:if test="${index.index > 0}">, </c:if>
|
|
|
+ {
|
|
|
+ smallTypeId: ${smalltype.smallTypeID},
|
|
|
+ name: "${smalltype.name}",
|
|
|
+ bigTypeId: ${smalltype.bigTypeID},
|
|
|
+ }
|
|
|
+ </c:forEach>
|
|
|
+ ];
|
|
|
+
|
|
|
+
|
|
|
+ // 初始分类
|
|
|
+ function loadInitType() {
|
|
|
+ if (currentBigtype != null && typeof (currentBigtype) != "undefined") {
|
|
|
+ setTimeout(function () {
|
|
|
+ loadBigType();
|
|
|
+ }, 0);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 分类联动
|
|
|
+ function loadBigType() {
|
|
|
+ $("#bigType").html("");
|
|
|
+ $("#bigType").prev().find(".select2-chosen").text("请选择");
|
|
|
+ $("#bigType").append("<option value=''>请选择</option>");
|
|
|
+ $("#smallType").html("");
|
|
|
+ $("#smallType").prev().find(".select2-chosen").text("请选择");
|
|
|
+ $("#smallType").append("<option value=''>请选择</option>");
|
|
|
+ $("#tinyType").html("");
|
|
|
+ $("#tinyType").prev().find(".select2-chosen").text("请选择");
|
|
|
+ $("#tinyType").append("<option value=''>请选择</option>");
|
|
|
+ for (var i = 0; i < bigTypeList.length; i++) {
|
|
|
+ if (currentBigtype != null && typeof (currentBigtype) != "undefined" && currentBigtype == bigTypeList[i].bigTypeId) {
|
|
|
+ $("#bigType").append("<option selected value='" + bigTypeList[i].bigTypeId + "'>" + bigTypeList[i].name + "</option>");
|
|
|
+ $("#bigType").prev().find(".select2-chosen").text(bigTypeList[i].name);
|
|
|
+ setTimeout(function () {
|
|
|
+ loadSmallType();
|
|
|
+ }, 500);
|
|
|
+ } else {
|
|
|
+ $("#bigType").append("<option value='" + bigTypeList[i].bigTypeId + "'>" + bigTypeList[i].name + "</option>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ loadSmallType();
|
|
|
+ }
|
|
|
+
|
|
|
+ function loadSmallType(id) {
|
|
|
+ if (id) {
|
|
|
+ $("#bigType").val(id);
|
|
|
+ $("#bigType").prev().find(".select2-chosen").text($("#bigType option:selected").text());
|
|
|
+ }
|
|
|
+ var bigType = $("#bigType").val();
|
|
|
+ $("#smallType").html("");
|
|
|
+ $("#smallType").prev().find(".select2-chosen").text("请选择");
|
|
|
+ $("#smallType").append("<option value=''>请选择</option>");
|
|
|
+ $("#tinyType").html("");
|
|
|
+ $("#tinyType").prev().find(".select2-chosen").text("请选择");
|
|
|
+ $("#tinyType").append("<option value=''>请选择</option>");
|
|
|
+ if (typeof (bigType) != "undefined" && bigType != "") {
|
|
|
+ var smallTypeNum = 0;
|
|
|
+ for (var i = 0; i < smalltypeList.length; i++) {
|
|
|
+ if (bigType == smalltypeList[i].bigTypeId) {
|
|
|
+ smallTypeNum = smallTypeNum + 1;
|
|
|
+ if (currentSmalltype != null && typeof (currentSmalltype) != "undefined" && currentSmalltype == smalltypeList[i].smallTypeId) {
|
|
|
+ $("#smallType").append("<option selected value='" + smalltypeList[i].smallTypeId + "'>" + smalltypeList[i].name + "</option>");
|
|
|
+ $("#smallType").prev().find(".select2-chosen").text(smalltypeList[i].name);
|
|
|
+ } else {
|
|
|
+ $("#smallType").append("<option value='" + smalltypeList[i].smallTypeId + "'>" + smalltypeList[i].name + "</option>");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ document.getElementById("s2id_smallType").style.cssText = "display: inline-block";
|
|
|
+ }
|
|
|
+ }
|
|
|
+ </script>
|
|
|
</body>
|
|
|
</html>
|