diff --git a/application/index/view/default/goods/index.html b/application/index/view/default/goods/index.html index b2275c4be15544c8dc582444cbe9d32dd4d69e3c..448c8df947dcc01acc9ef418f1fc4cab62a3a90e 100755 --- a/application/index/view/default/goods/index.html +++ b/application/index/view/default/goods/index.html @@ -264,10 +264,10 @@
- +
- 库存{{$goods.inventory}}{{$goods.inventory_unit}} + 库存{{$goods.inventory}}{{$goods.inventory_unit}}
diff --git a/public/static/admin/default/css/order.css b/public/static/admin/default/css/order.css index b96399a5ee42fe90c39a4fabd71379743f547ddb..8d8c1ff35d1e03b0eabe3afa6d6fe02121def6ef 100755 --- a/public/static/admin/default/css/order.css +++ b/public/static/admin/default/css/order.css @@ -39,7 +39,8 @@ form.am-form .am-form-group { padding-right: 5px; } .business-item ul { padding: 10px 3px 5px 5px; overflow: hidden; } .business-item ul li { border:1px solid transparent ;overflow: hidden; float: left; cursor: pointer; padding: 5px; border: 1px solid #eee; margin: 0 10px 10px 0; } .business-item ul li img { width: 36px; height: 36px; vertical-align: middle; } -.business-item ul li.selected { border-color: #d2364c ; position: relative; } +.business-item ul li:hover {border: 1px solid #d2364c;box-shadow: 0px 0 0px 1px #d2364c;} +.business-item ul li.selected { border-color: #d2364c ; position: relative; box-shadow: 0px 0 0px 1px #d2364c; } .business-item ul li.selected i.icon-active { position: absolute; width: 10px; height: 10px; font-size: 0; line-height: 0; right: 0px; bottom: 0px; background: url(../images/sys-item-selected.gif) no-repeat right bottom; } @media only screen and (min-width:640px) { .business-item ul li {width:calc(33% - 5px); } @@ -60,6 +61,6 @@ form.am-form .am-form-group { padding-right: 5px; } } .content-right ul { list-style: none; - padding: 0; - margin: 0; + padding: 1px; + margin: 10px 0 0 0; } \ No newline at end of file diff --git a/public/static/admin/default/images/sys_item_selected.gif b/public/static/admin/default/images/sys-item-selected.gif similarity index 100% rename from public/static/admin/default/images/sys_item_selected.gif rename to public/static/admin/default/images/sys-item-selected.gif diff --git a/public/static/index/default/js/goods.js b/public/static/index/default/js/goods.js index c1407268525c67a58c9509320cdefc99cd826235..96d1b9b33c41ab612112745ecc65aa8f93cabcdb 100755 --- a/public/static/index/default/js/goods.js +++ b/public/static/index/default/js/goods.js @@ -111,10 +111,24 @@ function CartAdd(e) { // 参数 var type = e.attr('data-type'); - var stock = $('#text_box').val() || 0; - if(stock <= 0 || stock < 1) + var stock = parseInt($('#text_box').val()) || 1; + var inventory = parseInt($('.stock-tips .stock').text()); + var min = $('.stock-tips .stock').data('min-limit') || 1; + var max = $('.stock-tips .stock').data('max-limit') || 0; + var unit = $('.stock-tips .stock').data('unit') || ''; + if(stock < min) { - PromptCenter('购买数量有误'); + PromptCenter('最低起购数量'+min+unit); + return false; + } + if(max > 0 && stock > max) + { + PromptCenter('最大限购数量'+max+unit); + return false; + } + if(stock > inventory) + { + PromptCenter('库存数量'+inventory+unit); return false; } @@ -375,7 +389,7 @@ $(function() { $(this).find('ul>li').on('click', function() { // 切换规格购买数量清空 - $('#text_box').val(1); + $('#text_box').val($('.stock-tips .stock').data('min-limit') || 1); // 规格处理 var length = $('.theme-signin-left .sku-items').length; @@ -574,23 +588,38 @@ $(function() { }); //获得文本框对象 - var t = $('#text_box'); + var $sotck = $('#text_box'); + var min = $('.stock-tips .stock').data('min-limit') || 1; + var max = $('.stock-tips .stock').data('max-limit') || 0; + var unit = $('.stock-tips .stock').data('unit') || ''; //数量增加操作 - $('#add').on('click', function() { - var stock = parseInt($('.stock-tips .stock').text()); - var number = parseInt(t.val()); - if(number < stock) + $('#add').on('click', function() + { + var inventory = parseInt($('.stock-tips .stock').text()); + var number = parseInt($sotck.val())+1; + if(max > 0 && number > max) { - t.val(number + 1) - } else { - Prompt('超出库存数量'); + Prompt('最大限购数量'+max+unit); + return false; + } + if(number > inventory) + { + Prompt('库存数量'+inventory+unit); + return false; } + $sotck.val(number); }); //数量减少操作 - $('#min').on('click', function() { - var value = parseInt(t.val())-1 || 1; - t.val((value <= 1) ? 1 : value); + $('#min').on('click', function() + { + var value = parseInt($sotckt.val())-1 || 1; + if(value < min) + { + Prompt('最低起购数量'+min+unit); + return false; + } + $sotck.val(value); }); // 评论