Authored by 刘传洋

m

... ... @@ -20,8 +20,7 @@
<div class="size-row {{#unless active}} hide{{/unless}}">
<div class="choose-size-detail">
{{#each sizes}}
<div class="dt {{#if sizeActive}}active{{/if}}"
{{#unless num}}class="disable"{{/unless}}
<div class="dt {{#if sizeActive}}active{{/if}} {{#unless num}}disabled{{/unless}}"
data-sku="{{sku}}"
data-num="{{num}}"
data-name="{{name}}">{{name}}</div>
... ...
... ... @@ -2,17 +2,18 @@
* Created by yoho on 2017-01-05.
*/
var $ = require('yoho-jquery');
var dialog = require('../common/dialog');
var Alert = dialog.Alert;
var $payWapper = $('.pay-wapper'),
var $ = require('yoho-jquery'),
capi = require('./cart-api'),
dialog = require('../common/dialog'),
Alert = dialog.Alert,
$payWapper = $('.pay-wapper'),
selColorWinTpl = require('hbs/cart/select-color-panel.hbs'),
capi = require('./cart-api');
ColorPanelAction;
$(document).bind("click",function(e){
$(document).bind('click', function(e) {
var target = $(e.target);
if(target.closest('.pay-pro-detail').length === 0 && target.closest('.goods-choose-box').length === 0){
if (target.closest('.pay-pro-detail').length === 0 && target.closest('.goods-choose-box').length === 0) {
$('.goods-choose-box').hide();
e.stopPropagation();
}
... ... @@ -20,11 +21,10 @@ $(document).bind("click",function(e){
function renderAndShowSelWin($item, pinfo) {
$item.find('.goods-choose-box').remove();
var $selWin = $(selColorWinTpl(pinfo)).appendTo($item);
$selWin.show();
$(selColorWinTpl(pinfo)).appendTo($item).show();
}
var ColorPanelAction = {
ColorPanelAction = {
showColorSizePanel: function() {
var $this = $(this);
... ... @@ -71,7 +71,7 @@ var ColorPanelAction = {
var $this = $(this);
var $item = $this.closest('li[data-role="pitem"]');
var pid = $item.data('pid');
// var pid = $item.data('pid');
var oldSku = $item.data('id');
var $size = $this.closest('.goods-choose-box').find('.choose-size .dt.active');
var newSku = $size.data('sku');
... ... @@ -106,7 +106,9 @@ var ColorPanelAction = {
var $srows = $this.closest('.goods-info').find('.choose-size .size-row');
var $bigImgs = $this.closest('.goods-choose-box').find('.goods-info-bigImg .bigImg');
if ($this.hasClass('active')) return;
if ($this.hasClass('active') || $this.hasClass('disabled')) {
return;
}
$this.siblings('.dt').removeClass('active');
$this.addClass('active');
... ... @@ -122,6 +124,9 @@ var ColorPanelAction = {
var $this = $(this);
if ($this.hasClass('disabled')) {
return;
}
$this.siblings('.dt').removeClass('active');
$this.addClass('active');
}
... ... @@ -131,7 +136,5 @@ var ColorPanelAction = {
$payWapper.on('click', 'li[data-role="pitem"] .pay-pro-detail', ColorPanelAction.showColorSizePanel);
$payWapper.on('click', 'li[data-role="pitem"] .button-cancel', ColorPanelAction.hideColorSizePanel);
$payWapper.on('click', 'li[data-role="pitem"] .button-sure', ColorPanelAction.editColorOrSize);
$payWapper.find('li[data-role="pitem"]').on('click', '.goods-choose-box .choose-color .dt', ColorPanelAction.selectColor);
$payWapper.find('li[data-role="pitem"]').on('click', '.goods-choose-box .choose-size .dt', ColorPanelAction.selectSize);
$payWapper.on('click', 'li[data-role="pitem"] .goods-choose-box .choose-color .dt', ColorPanelAction.selectColor);
$payWapper.on('click', 'li[data-role="pitem"] .goods-choose-box .choose-size .dt', ColorPanelAction.selectSize);
... ...