Authored by htoooth

Merge branch 'release/6.0.2' of http://git.yoho.cn/fe/yohobuy-node into release/6.0.2

... ... @@ -135,16 +135,15 @@ const exchangeDetail = (req, res, next) => {
* 我的订单-获取换货方式
*/
const getDelivery = (req, res, next) => {
let orderCode = req.body.orderCode;
let areaCode = req.body.areaCode;
let skns = req.body.skns;
// 获取必要参数
let uid = req.user.uid;
let gender = req.yoho.gender;
let channel = req.yoho.channel;
// 调用接口获得该用户支持的换货方式(白金会员可享受上门换货,偏远地区不支持上门换货)
req.ctx(returnsModel).getDelivery(areaCode, uid, gender, channel).then(result => {
req.ctx(returnsModel).getDelivery(orderCode, areaCode, uid, skns).then(result => {
res.send(result);
}).catch(next);
};
... ...
... ... @@ -445,7 +445,7 @@ module.exports = class extends global.yoho.BaseModel {
op.push('refund');
}
if (+order.attribute === 9) {
if (+order.attribute === 9 || +order.attribute === 11) {
op = ['deposit'];
}
... ... @@ -618,18 +618,18 @@ module.exports = class extends global.yoho.BaseModel {
_getOrderDetailOp(orderId, payment, status,
isCancel, paymentStatus, paymentType,
orderType, attribute, refundStatus) {
orderType, attribute, refundStatus, links) {
let operation = {};
// 立刻付款
if (paymentType === 1 && paymentStatus === 'N' && isCancel === 'N' && payment !== 19) {
if (_.includes(links, 'buyNow')) {
Object.assign(operation, {
goPay: helpers.urlFormat('/shopping/newpay', {ordercode: orderId})
});
}
// 取消订单
if (status < 3 && isCancel === 'N' && paymentStatus === 'N' && orderType !== 5) {
if (_.includes(links, 'closeOrder')) {
Object.assign(operation, {
cancelOrder: true
});
... ... @@ -874,7 +874,8 @@ module.exports = class extends global.yoho.BaseModel {
detail.operation = that._getOrderDetailOp(
orderDetail.order_code, +orderDetail.payment, +orderDetail.status,
orderDetail.is_cancel, orderDetail.payment_status, orderDetail.payment_type,
+orderDetail.order_type, +orderDetail.attribute, +orderDetail.refund_status
+orderDetail.order_type, +orderDetail.attribute, +orderDetail.refund_status,
orderDetail.links
);
detail.packageTitle = orderDetail.package_title;
... ...
... ... @@ -203,14 +203,15 @@ module.exports = class extends global.yoho.BaseModel {
* @param $yhChannel
* @return mixed
*/
getDeliveryAsync(areaCode, uid, gender, channel) {
getDeliveryAsync(orderCode, areaCode, uid, skns) {
skns = skns || [];
let options = {
method: 'app.change.getDelivery',
method: 'app.change.refreshDelivery',
uid: uid,
order_code: orderCode,
area_code: areaCode,
gender: gender,
yh_channel: channel
skns: JSON.stringify(skns)
};
return this.post({data: options});
... ...
... ... @@ -677,8 +677,16 @@ module.exports = class extends global.yoho.BaseModel {
}
// 获取换货方式
getDelivery(areaCode, uid, gender, channel) {
return new ReturnAPI(this.ctx).getDeliveryAsync(areaCode, uid, gender, channel);
getDelivery(orderCode, areaCode, uid, skns) {
return new ReturnAPI(this.ctx).getDeliveryAsync(orderCode, areaCode, uid, _.split(skns, ',')).then(result => {
if (+result.code === 200) {
_.remove(result.data, n => {
return n.is_support !== 'Y';
});
}
return result;
});
}
// 取消退货申请
... ...
... ... @@ -120,12 +120,24 @@ function getRefundCompute() {
});
}
function syncRefundMode(code) {
function syncRefundMode() {
var skns = [];
if (!defaultArea) {
return;
}
$goodsTable.find('input[type="checkbox"]:checked').each(function() {
skns.push($(this).siblings('input[name="skn"]').val());
});
$.ajax({
type: 'POST',
url: '/home/returns/getDelivery',
data: {
areaCode: code
orderCode: orderCode,
areaCode: defaultArea,
skns: skns.join(',')
}
}).then(function(jsonData) {
var _html = '';
... ... @@ -224,7 +236,7 @@ if ($refundInfo.length) {
}
});
} else if (defaultArea) {
syncRefundMode(defaultArea);
syncRefundMode();
}
defaultArea = defaultArea ? defaultArea : '';
... ... @@ -282,6 +294,7 @@ $checkBox.change(function() {
$par.next().hide();
}
syncRefundMode();
getRefundCompute();
});
... ... @@ -373,11 +386,9 @@ function fileChangeEvent() {
fileChangeEvent();// 初始化上传图片事件
$exchange.on('change', '#streets', function() {
var code = $(this).val() * 1;
defaultArea = $(this).val() * 1;
if (code) {
syncRefundMode(code);
}
syncRefundMode();
});
$refundType.change(function() {
... ...
... ... @@ -142,7 +142,7 @@ function syncCouponStatus() {
if (couponObj.hasOwnProperty(i)) {
coup = asyncObj[i];
if (coup) {
if (coup && (coup.status === 1 || coup.status === 3)) {
couponObj[i].status = coup.status;
coup.status === 3 ? setPicked(couponObj[i]) : false;
} else {
... ...