Authored by htoooth

Merge branch 'release/1.0' of http://git.yoho.cn/fe/yoho-blk into release/1.0

... ... @@ -205,6 +205,17 @@ const setEepress = (req, res, next) => {
}).catch(next);
};
/**
* 获取银行列表
* @function setEepress
* @return { Object } 银行列表
*/
const getUnion = (req, res, next) => {
returns.getUnionData().then(result => {
res.json(result);
}).catch(next);
};
module.exports = {
index,
refund,
... ... @@ -215,5 +226,6 @@ module.exports = {
exchangeDeatail,
exchangeSubmit,
cancelApply,
setEepress
setEepress,
getUnion
};
... ...
... ... @@ -101,6 +101,12 @@ const cancelReturnAsync = (id, uid, isChange) => {
});
};
const getRefundBank = () => {
return api.get('', {
method: 'app.refund.refundBank'
});
};
module.exports = {
getExpressCompanyAsync,
getOrderInfoAsync,
... ... @@ -112,6 +118,7 @@ module.exports = {
getExchangeDetail,
changeSubmitAsync,
setExpressNumberAsync,
cancelReturnAsync
cancelReturnAsync,
getRefundBank
};
... ...
... ... @@ -250,6 +250,33 @@ const _setRefundGoodList = (data) => {
}
resData.speclialReason = data.special_return_reason;
let returnMode = [];
_.forEach(data.return_amount_mode, value => {
let mode = {
title: value.name,
id: value.id,
cur: value.is_default === 'Y'
};
// 退货类型根据id匹配
switch (mode.id) {
case 2:
mode.class = 'ali-item';
mode.alipay = true;
break;
case 3:
mode.class = 'union-item';
mode.unionpay = true;
break;
default:
mode.name = value.name;
break;
}
returnMode.push(mode);
});
resData.returnMode = returnMode;
return resData;
};
... ... @@ -646,6 +673,22 @@ const setBackEepress = (uid, param) => {
});
};
/**
* 获取银行列表
* @function getUnionData
* @return { Object } 银行列表数据
*/
const getUnionData = () => {
return returnsAPI.getRefundBank().then(result => {
let resData = result || {
code: 400,
message: '获取银行列表失败'
};
return resData;
});
};
module.exports = {
getUserReturn,
getRefundGoodsData,
... ... @@ -656,5 +699,6 @@ module.exports = {
getExchangeDetailData,
submitChange,
cancelReturnApply,
setBackEepress
setBackEepress,
getUnionData
};
... ...
... ... @@ -45,6 +45,7 @@ router.post('/return/cancel', returns.cancelApply);
router.post('/return/setEepress', returns.setEepress);
router.get('/return/getProductInfo', returns.getProductInfo);
router.get('/return/submitExchange', returns.exchangeSubmit);
router.get('/return/unionInfo', returns.getUnion);
// 个人中心首页/收货地址
router.get('/address', auth, address.index);
... ...
... ... @@ -46,28 +46,32 @@
<div class="refund-type">
<div>
<label class="type-item ali-item cur" title="支付宝"></label>
<label class="type-item union-item" title="银行卡"></label>
{{# returnMode}}
<label class="type-item {{class}}{{#if cur}} cur{{/if}}" title="{{title}}" data-id="{{id}}">{{name}}</label>
{{/ returnMode}}
</div>
<dl class="alipay">
<dd>账号:<input type="text" class="name" placeholder="收款人支付宝账号"></dd>
<dd>姓名:<input type="text" class="account" placeholder="姓名"></dd>
</dl>
<dl class="unionpay hide">
<dd>
银行:
<select class="bank">
<option>中国银行</option>
<option>中国农业银行</option>
<option>中国工商银行</option>
<option>中国建设银行</option>
</select>
<input type="text" placeholder="开户支行">
<span class="blue" class="area">例:江苏省南京市奥体支行</span>
</dd>
<dd>账号:<input type="text" class="account" placeholder="收款人银行卡号"></dd>
<dd>姓名:<input type="text" class="name" placeholder="姓名"></dd>
</dl>
{{# returnMode}}
{{#if alipay}}
<dl class="alipay mode{{id}} hide">
<dd>账号:<input type="text" class="name" placeholder="收款人支付宝账号"></dd>
<dd>姓名:<input type="text" class="account" placeholder="姓名"></dd>
</dl>
{{/if}}
{{#if unionpay}}
<dl class="unionpay mode{{id}} hide">
<dd>
银行:
<select class="bank">
<option>请选择银行</option>
</select>
<input type="text" placeholder="开户支行" class="open-bank">
<span class="blue" class="area">例:江苏省南京市奥体支行</span>
</dd>
<dd>账号:<input type="text" class="account" placeholder="收款人银行卡号"></dd>
<dd>姓名:<input type="text" class="name" placeholder="姓名"></dd>
</dl>
{{/if}}
{{/ returnMode}}
</div>
<div class="opt-btn">
<span class="apply-tip blue hide">请填写完整</span>
... ...
... ... @@ -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);
}
});
... ...
... ... @@ -100,8 +100,11 @@
.type-item {
width: 118px;
height: 38px;
line-height: 38px;
text-align: center;
border: 1px solid #eee;
display: inline-block;
vertical-align: top;
margin-right: 16px;
cursor: pointer;
... ...