Authored by yyq

Merge branch 'feature/returnOpt' into release/5.7

... ... @@ -533,7 +533,7 @@ const getOrderExchange = (orderCode, uid) => {
skc: value.product_skc,
sku: value.product_sku,
goods_type_id: value.goods_type_id,
reason: returnReason
reason: _.cloneDeep(returnReason)
};
// tar note 为每个特殊商品都添加标识
... ... @@ -544,13 +544,13 @@ const getOrderExchange = (orderCode, uid) => {
remark2: remarks[1] || ''
};
// tar note 对数组做处理,为不显示的添加 inactive
if (result.data.special_exchange_reason) {
let spReason = result.data.special_exchange_reason;
let spReason = _.get(result, 'data.special_exchange_reason', []);
_.forEach(item.reason, (subVal, subKey) => { // eslint-disable-line
if (_.indexOf(spReason, subKey)) {
_.set(item, `reason[${subKey}].inactive`, true);
// tar note 对数组做处理,为不显示的添加 inactive
if (spReason && spReason.length) {
_.forEach(item.reason, subVal => { // eslint-disable-line
if (!_.filter(spReason, ['id', subVal.id]).length) {
subVal.inactive = true;
}
});
}
... ...
... ... @@ -79,7 +79,7 @@
</p>
<p>
尺码要换成:
<select class="exchange-size" {{#if isLimitSkn}}disabled{{/if}}>
<select class="exchange-size" data-sku="{{sku}}" {{#if isLimitSkn}}disabled{{/if}}>
<option value="0">请选择尺码</option>
</select>
</p>
... ...
... ... @@ -4,7 +4,8 @@
* @date: 2016/2/29
*/
var $ = require('yoho-jquery'),
Addr = require('./common-address');
Addr = require('./common-address'),
_dialog = require('../common/dialog');
var $goodsTable = $('#goods-table'),
$checkBox = $goodsTable.find('input[type="checkbox"]'),
... ... @@ -54,7 +55,8 @@ var option = {
var refundConfirm = {};
var Dialog = require('../common/dialog').Dialog;
var Dialog = _dialog.Dialog,
Confirm = _dialog.Confirm;
var resetImg = function($p) {
$p.removeClass('selected');
... ... @@ -113,6 +115,42 @@ function setBackInput(type) {
}
}
function formatExchangeOption($dom, type) {
var sku = $dom.data('sku');
var $optItem;
var cd;
if (!$dom || !sku) {
return;
}
$dom.children().each(function() {
if (+sku === +$(this).attr('value')) {
$optItem = $(this);
}
});
if (!$optItem) {
return;
}
type = type * 1;
if (!type || type === 4 || type === 6 || type === 8) {
$optItem.removeAttr('disabled');
} else {
if (+$dom.val() === +sku) {
$dom.val(0);
cd = new Confirm({
content: '无理由换货不可选择换为相同颜色尺码',
cb: function() {
cd.close();
}
}).show();
}
$optItem.attr('disabled', 'disabled');
}
}
if ($refundInfo.length) {
pageType = 1;
... ... @@ -150,6 +188,8 @@ $reasons.change(function() {
} else {
$par.next().hide();
}
formatExchangeOption($par.find('.exchange-size'), type);
});
// 切换支行银行信息
... ... @@ -181,6 +221,7 @@ $checkBox.change(function() {
$goodsTable.on('change', '.exchange-color', function() {
var $warp = $(this).closest('.exchange-choose-wrap'),
$warpSize = $warp.find('.exchange-size'),
_html = '<option value="0">请选择尺码</option>',
id = $(this).val();
... ... @@ -189,7 +230,9 @@ $goodsTable.on('change', '.exchange-color', function() {
_html += '<option value="' + v.id + '">' + v.name + '</option>';
});
}
$warp.find('.exchange-size').html(_html).val(0);
$warpSize.html(_html).val(0);
formatExchangeOption($warpSize, $warp.find('.return-reason').val());
});
$goodsTable.on('click', '.btn-del', function(e) {
... ... @@ -277,6 +320,14 @@ $refundType.change(function() {
setBackInput(type);
});
$('#bank-card').keyup(function() {
var $this = $(this),
v = $this.val();
/(\S{5}|\D)/.test(v) && $this.val($.trim(v.replace(/\D/g, '').replace(/(.{4})/g, '$1 ')));
});
// 打包退换货商品信息
function packGoogsList() {
var goods = [],
... ... @@ -381,7 +432,7 @@ function packRefundInfo(returnMode) {
verifyTip = '请填写收款人姓名';
}
res.payment.bank_card = $.trim($refundInfo.find('input[name="bank-card"]').val());
res.payment.bank_card = $refundInfo.find('input[name="bank-card"]').val().replace(/\s/g, '');
if (!verifyTip && !res.payment.bank_card) {
verifyTip = '请填写收款账户';
}
... ...