From 6a419a6658d211bba7b3c0ca52e305e950be84da Mon Sep 17 00:00:00 2001 From: gongfuxiang <2499232802@qq.com> Date: Tue, 25 Dec 2018 00:52:19 +0800 Subject: [PATCH] goods --- .../admin/view/default/goods/save_info.html | 217 +++++++++--------- .../admin/view/default/public/header.html | 3 + public/static/admin/default/css/goods.css | 16 +- public/static/admin/default/js/goods.js | 65 +++++- 4 files changed, 182 insertions(+), 119 deletions(-) diff --git a/application/admin/view/default/goods/save_info.html b/application/admin/view/default/goods/save_info.html index 3357ea812..64984e0a5 100755 --- a/application/admin/view/default/goods/save_info.html +++ b/application/admin/view/default/goods/save_info.html @@ -153,124 +153,117 @@ -
diff --git a/application/admin/view/default/public/header.html b/application/admin/view/default/public/header.html index 7c00b0a19..6813703a8 100755 --- a/application/admin/view/default/public/header.html +++ b/application/admin/view/default/public/header.html @@ -16,4 +16,7 @@ {{/if}} + \ No newline at end of file diff --git a/public/static/admin/default/css/goods.css b/public/static/admin/default/css/goods.css index 006cd13cb..d2bfa8899 100755 --- a/public/static/admin/default/css/goods.css +++ b/public/static/admin/default/css/goods.css @@ -66,8 +66,8 @@ } .spec-images-tips { position: absolute; - left: 100px; - top: 60px; + left: 9px; + top: 30px; z-index: 2; padding: 2px 5px; white-space: nowrap; @@ -101,10 +101,20 @@ .spec-images-tips .am-checkbox { margin: 0px; min-height: auto; + height: 15px; + line-height: 15px; +} +.spec-images-tips .am-ucheck-icons { + width: 15px; + height: 15px; + line-height: 15px; } .spec-images-tips .am-checkbox input[type="checkbox"] { margin: 0 0 0 -4px; } +.spec-images-tips .msg-tips { + vertical-align: super; +} .spec-images-list { border: 1px solid #eee; padding: 10px; @@ -112,6 +122,8 @@ } .spec-images-list li { display: inline-block; + width: 100px; + margin: 0 10px 3px 0; } /** diff --git a/public/static/admin/default/js/goods.js b/public/static/admin/default/js/goods.js index 31213e762..12e498061 100755 --- a/public/static/admin/default/js/goods.js +++ b/public/static/admin/default/js/goods.js @@ -29,6 +29,9 @@ $(function() html += ''; html += ''; $('.value-start').before(html); + + // 规格图片 + SpecImagesHandle(); }); // 规格列移除 @@ -42,6 +45,9 @@ $(function() { $('.specifications-table tr.line-not-first').remove(); } + + // 规格图片 + SpecImagesHandle(); }); // 添加一行规格值 @@ -66,6 +72,9 @@ $(function() { $(this).attr('value', ''); }); + + // 规格图片 + SpecImagesHandle(); }); // 规格行复制 @@ -77,6 +86,9 @@ $(function() $(this).attr('value', $(this).val()); }); $parent.after($parent.prop('outerHTML')); + + // 规格图片 + SpecImagesHandle(); }); // 规格行移除 @@ -89,19 +101,62 @@ $(function() $('.specifications-table th.table-title').remove(); $('.specifications-table td.table-value').remove(); } + + // 规格图片 + SpecImagesHandle(); }); // 规格首列事件 $('.spec-images-tips').on('change', 'input', function() { - if($(this).prop('checked')) + // 规格图片 + SpecImagesHandle(); + }); + + // 规格第一列输入事件 + $('.specifications-table tbody tr').on('change', 'td:eq(0) input', function() + { + // 规格图片 + SpecImagesHandle(); + }); + + // 规格图片 + function SpecImagesHandle() + { + if($('.spec-images-tips input').prop('checked')) { - console.log(1); + var temp_spec_all = {}, spec_all = []; + $('.specifications-table tbody tr').each(function(k, v) + { + var value = $(this).find('td:eq(0) input').val(); + temp_spec_all[value] = value; + }); + spec_all = Object.keys(temp_spec_all); + if(spec_all.length > 0) + { + for(var i in spec_all) + { + var temp_class = 'spec-images-items-'+spec_all[i]; + if($('ul.spec-images-list').find('.'+temp_class).length <= 0) + { + var html = '