...
|
...
|
@@ -11,21 +11,21 @@ var $ = require('yoho-jquery'), |
|
|
var $refundTable = $('.refund-goods'),
|
|
|
$check = $('.check'),
|
|
|
$refundType = $('.refund-type'),
|
|
|
$typeInfo = $refundType.children('dl');
|
|
|
$typeInfo = $refundType.children('dl'),
|
|
|
$bankSelect = $refundType.find('.unionpay .bank');
|
|
|
|
|
|
var $applyBtn = $('#apply-btn');
|
|
|
|
|
|
var orderCode = $('#order-code').val() || 0,
|
|
|
specialReason = $refundTable.data() || {},
|
|
|
payInfo = { // 退款信息
|
|
|
type: 3, // 2--银行卡 3--支付宝 4--yoho币
|
|
|
dom: $typeInfo.eq(0)
|
|
|
type: $refundType.find('.type-item.cur').data('id') // 1--原卡返回 2--银行卡 3--支付宝 4--yoho币
|
|
|
};
|
|
|
|
|
|
var tpl = '<div class="img-wrap">' +
|
|
|
var tpl = '<div class="img-wrap" data-img="{{data}}">' +
|
|
|
'<div class="img-opt">' +
|
|
|
'<span>查看</span>' +
|
|
|
'<span>删除</span>' +
|
|
|
'<span class="review-upimg">查看</span>' +
|
|
|
'<span class="cancel-upimg">删除</span>' +
|
|
|
'</div>' +
|
|
|
'<div class="img-view"><img src="{{data}}"></div>' +
|
|
|
'</div>',
|
...
|
...
|
@@ -37,6 +37,47 @@ require('../plugins/check'); |
|
|
|
|
|
lazyload($('img.lazy'));
|
|
|
|
|
|
function setUnionList(list) {
|
|
|
var i, html = '';
|
|
|
|
|
|
if (list && list.length) {
|
|
|
for (i = 0; i < list.length; i++) {
|
|
|
html += '<option>' + list[i].title + '</option>';
|
|
|
}
|
|
|
$bankSelect.html(html);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function getUnionList() {
|
|
|
var that = this;
|
|
|
|
|
|
if (!this.geted) {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/me/return/unionInfo',
|
|
|
data: {},
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
that.geted = true;
|
|
|
setUnionList(data.data);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
function changePayMode(id) {
|
|
|
payInfo.type = id;
|
|
|
|
|
|
// 切换退款信息输入容器
|
|
|
payInfo.dom = $refundType.children('.mode' + payInfo.type);
|
|
|
$typeInfo.addClass('hide');
|
|
|
payInfo.dom.removeClass('hide');
|
|
|
getUnionList();
|
|
|
}
|
|
|
|
|
|
changePayMode(payInfo.type);
|
|
|
|
|
|
function restApplyBtn() {
|
|
|
if (checked.documents && checked.documents.length) {
|
|
|
$applyBtn.removeClass('disable');
|
...
|
...
|
@@ -67,6 +108,7 @@ function packApplyInfo() { |
|
|
product_skc: data.skc,
|
|
|
product_sku: data.sku
|
|
|
};
|
|
|
var $special = $(dom[key]).siblings('.special-reason');
|
|
|
|
|
|
if (isLack || !data.reason) {
|
|
|
isLack = true;
|
...
|
...
|
@@ -74,11 +116,24 @@ function packApplyInfo() { |
|
|
} else {
|
|
|
good.returned_reason = data.reason;
|
|
|
|
|
|
// if (specialReason.hasOwnProperty(data.reason)) {
|
|
|
// remark: ,
|
|
|
// returned_reason: 3,
|
|
|
// evidence_images: ,
|
|
|
// }
|
|
|
if (specialReason.hasOwnProperty(data.reason)) {
|
|
|
good.remark = $special.find('.mark-text').val();
|
|
|
if (!good.remark) {
|
|
|
isLack = true;
|
|
|
}
|
|
|
|
|
|
good.evidence_images = [];
|
|
|
$special.find('.img-wrap').each(function() {
|
|
|
var img = $(this).data('img');
|
|
|
|
|
|
if (img) {
|
|
|
good.evidence_images.push(img);
|
|
|
}
|
|
|
});
|
|
|
if (!good.evidence_images.length) {
|
|
|
isLack = true;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
resData.goods.push(good);
|
|
|
});
|
...
|
...
|
@@ -91,6 +146,7 @@ function packApplyInfo() { |
|
|
switch (payInfo.type) {
|
|
|
case 2:
|
|
|
payment.bank_name = payInfo.dom.find('.bank').val();
|
|
|
payment.bank_name += '-' + payInfo.dom.find('.open-bank').val();
|
|
|
payment.bank_card = payInfo.dom.find('.account').val();
|
|
|
payment.payee_name = payInfo.dom.find('.name').val();
|
|
|
break;
|
...
|
...
|
@@ -99,7 +155,6 @@ function packApplyInfo() { |
|
|
payment.alipay_name = payInfo.dom.find('.name').val();
|
|
|
break;
|
|
|
default:
|
|
|
isLack = true;
|
|
|
break;
|
|
|
}
|
|
|
|
...
|
...
|
@@ -140,38 +195,44 @@ $refundTable.on('change', '.refund-reason', function() { |
|
|
}
|
|
|
$specialDom.siblings('.check').data({reason: val});
|
|
|
}).on('click', '.img-upload', function() {
|
|
|
var $this = $(this);
|
|
|
var $this = $(this),
|
|
|
num = $this.data('num') || 0;
|
|
|
|
|
|
if (num > 3) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
upload.up({
|
|
|
callback: function(result) {
|
|
|
if (result && result.code === 200) {
|
|
|
$this.before(imgFn(result));
|
|
|
$this.siblings('.img-up-tip').text(++num + '/4');
|
|
|
$this.data('num', num);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
});
|
|
|
|
|
|
}).on('click', '.img-opt > span', function() {
|
|
|
var $this = $(this),
|
|
|
$wrap = $this.closest('.img-wrap'),
|
|
|
$upBtn = $wrap.siblings('.img-upload'),
|
|
|
num = $upBtn.data('num') || 0;
|
|
|
|
|
|
if ($this.hasClass('cancel-upimg')) {
|
|
|
$wrap.siblings('.img-up-tip').text(--num + '/4');
|
|
|
$wrap.remove();
|
|
|
$upBtn.data('num', num);
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$refundType.on('click', '.type-item', function() {
|
|
|
var $this = $(this),
|
|
|
index;
|
|
|
id = $this.data('id');
|
|
|
|
|
|
if (!$this.hasClass('cur')) {
|
|
|
if ($this.hasClass('ali-item')) {
|
|
|
payInfo.type = 3;
|
|
|
} else {
|
|
|
payInfo.type = 2;
|
|
|
}
|
|
|
index = $this.index();
|
|
|
|
|
|
// 切换退款卡片
|
|
|
$this.addClass('cur').siblings('.cur').removeClass('cur');
|
|
|
|
|
|
// 切换退款信息输入容器
|
|
|
payInfo.dom = $typeInfo.eq(index);
|
|
|
$typeInfo.addClass('hide');
|
|
|
payInfo.dom.removeClass('hide');
|
|
|
changePayMode(id);
|
|
|
}
|
|
|
});
|
|
|
|
...
|
...
|
|