...
|
...
|
@@ -13,7 +13,8 @@ var $refundTable = $('.refund-goods'), |
|
|
|
|
|
var $applyBtn = $('#apply-btn');
|
|
|
|
|
|
var specialReason = $refundTable.data() || {},
|
|
|
var orderCode = $('#order-code').val() || 0,
|
|
|
specialReason = $refundTable.data() || {},
|
|
|
payInfo = { // 退款信息
|
|
|
type: 3, // 2--银行卡 3--支付宝 4--yoho币
|
|
|
dom: $typeInfo.eq(0)
|
...
|
...
|
@@ -34,9 +35,78 @@ function restApplyBtn() { |
|
|
}
|
|
|
|
|
|
function packApplyInfo() {
|
|
|
var dom,
|
|
|
isLack = false,
|
|
|
payment = {},
|
|
|
resData = {
|
|
|
order_code: orderCode
|
|
|
};
|
|
|
|
|
|
if (checked && checked.documents) {
|
|
|
console.log(checked);
|
|
|
dom = checked.documents;
|
|
|
resData.goods = [];
|
|
|
|
|
|
// 打包商品信息
|
|
|
$.each(dom, function(key) {
|
|
|
var data = $(dom[key]).data(),
|
|
|
good = {
|
|
|
last_price: data.price,
|
|
|
goods_type: data.type,
|
|
|
product_skn: data.skn,
|
|
|
product_skc: data.skc,
|
|
|
product_sku: data.sku
|
|
|
};
|
|
|
|
|
|
if (isLack || !data.reason) {
|
|
|
isLack = true;
|
|
|
return;
|
|
|
} else {
|
|
|
good.returned_reason = data.reason;
|
|
|
|
|
|
// if (specialReason.hasOwnProperty(data.reason)) {
|
|
|
// remark: ,
|
|
|
// returned_reason: 3,
|
|
|
// evidence_images: ,
|
|
|
// }
|
|
|
}
|
|
|
resData.goods.push(good);
|
|
|
});
|
|
|
|
|
|
// 处理退款信息
|
|
|
if (payInfo) {
|
|
|
payment = {
|
|
|
return_amount_mode: payInfo.type
|
|
|
};
|
|
|
switch (payInfo.type) {
|
|
|
case 2:
|
|
|
payment.bank_name = payInfo.dom.find('.bank').val();
|
|
|
payment.bank_card = payInfo.dom.find('.account').val();
|
|
|
payment.payee_name = payInfo.dom.find('.name').val();
|
|
|
break;
|
|
|
case 3:
|
|
|
payment.alipay_account = payInfo.dom.find('.account').val();
|
|
|
payment.alipay_name = payInfo.dom.find('.name').val();
|
|
|
break;
|
|
|
default:
|
|
|
isLack = true;
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
// 检查信息完整性
|
|
|
$.each(payment, function(key) {
|
|
|
if (!payment[key]) {
|
|
|
isLack = true;
|
|
|
}
|
|
|
});
|
|
|
resData.payment = payment;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (isLack) {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
return resData;
|
|
|
}
|
|
|
|
|
|
$check.check({
|
...
|
...
|
@@ -82,32 +152,28 @@ $refundType.on('click', '.type-item', function() { |
|
|
}
|
|
|
});
|
|
|
|
|
|
$applyBtn.click(function() {
|
|
|
var $tip = $applyBtn.siblings('.apply-tip'),
|
|
|
param = packApplyInfo();
|
|
|
|
|
|
// "last_price": "385.00",
|
|
|
// "remark": "重量不行",
|
|
|
// "returned_reason": "8",
|
|
|
// "evidence_images": [
|
|
|
// "/2016/06/30/11/02ba04e8b96654fc6c1fab12dda61bec21.png",
|
|
|
// "/2016/06/30/11/014c64b459499081c8bd237eb8e26decf8.png"
|
|
|
// ],
|
|
|
// "product_skn": "51177771",
|
|
|
// "goods_type": "1",
|
|
|
// "product_skc": "310207",
|
|
|
// "product_sku": "978129"
|
|
|
if (!param) {
|
|
|
$tip.removeClass('hide');
|
|
|
return;
|
|
|
} else {
|
|
|
$tip.addClass('hide');
|
|
|
}
|
|
|
|
|
|
$applyBtn.click(function() {
|
|
|
packApplyInfo();
|
|
|
|
|
|
// $.ajax({
|
|
|
// type: 'POST',
|
|
|
// url: '/me/return/refund/apply',
|
|
|
// data: {
|
|
|
// id: 11
|
|
|
// },
|
|
|
// success: function(data) {
|
|
|
// if (data.code === 200) {
|
|
|
// console.log(data);
|
|
|
// }
|
|
|
// }
|
|
|
// });
|
|
|
$.ajax({
|
|
|
type: 'POST',
|
|
|
url: '/me/return/refund/apply',
|
|
|
data: param,
|
|
|
success: function(data) {
|
|
|
if (data.code === 200) {
|
|
|
if (data.data && data.data.refer) {
|
|
|
location.href = data.data.refer;
|
|
|
}
|
|
|
$tip.text('申请成功').removeClass('hide');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}); |
...
|
...
|
|