Authored by yyq

fix color select

... ... @@ -600,6 +600,7 @@ const getOrderExchange = (orderCode, uid) => {
color: val.factory_goods_name,
colorId: val.color_id,
goodsId: val.goods_id,
skc: val.product_skc,
sizeList: size
});
}
... ...
... ... @@ -74,11 +74,11 @@
<select class="exchange-color" {{#if isLimitSkn}}disabled{{/if}}>
<option value="0">请选择颜色</option>
{{# colorSize}}
<option value="{{goodsId}}">{{color}}</option>
<option value="{{skc}}">{{color}}</option>
{{/ colorSize}}
</select>
{{# colorSize}}
<ul class="sizeinfo" data-id="{{goodsId}}">
<ul class="sizeinfo" data-id="{{skc}}">
{{#each sizeList}}
<li data-id={{product_sku}} data-name={{size_name}}></li>
{{/each}}
... ... @@ -87,7 +87,7 @@
</p>
<p>
尺码要换成:
<select class="exchange-size" data-sku="{{sku}}" {{#if isLimitSkn}}disabled{{/if}}>
<select class="exchange-size" data-sku="{{sku}}" data-skc="{{skc}}" {{#if isLimitSkn}}disabled{{/if}}>
<option value="0">请选择尺码</option>
</select>
</p>
... ...
... ... @@ -116,8 +116,11 @@ function setBackInput(type) {
}
function formatExchangeOption($dom, type) {
var sku = $dom.data('sku');
var $optItem;
var sku = $dom.data('sku'),
skc = $dom.data('skc');
var $optItem,
$colorDom,
$colorItem;
var cd;
if (!$dom || !sku) {
... ... @@ -130,13 +133,18 @@ function formatExchangeOption($dom, type) {
}
});
if (!$optItem) {
return;
}
$colorDom = $dom.closest('.exchange-choose-wrap').find('.exchange-color');
$colorDom.children().each(function() {
if (+skc === +$(this).attr('value')) {
$colorItem = $(this);
}
});
type = type * 1;
if (!type || type === 4 || type === 6 || type === 8) {
$optItem.removeAttr('disabled');
$optItem && $optItem.removeAttr('disabled');
$colorItem && $colorItem.removeAttr('disabled');
} else {
if (+$dom.val() === +sku) {
$dom.val(0);
... ... @@ -147,7 +155,16 @@ function formatExchangeOption($dom, type) {
}
}).show();
}
$optItem.attr('disabled', 'disabled');
$optItem && $optItem.attr('disabled', 'disabled');
if (colorSize[skc].length === 1 && +colorSize[skc][0].id === +sku) {
if (+$colorDom.val() === +skc) {
$colorDom.val(0).change();
}
$colorItem && $colorItem.attr('disabled', 'disabled');
} else {
$colorItem && $colorItem.removeAttr('disabled');
}
}
}
... ...