Authored by 毕凯

Merge branch 'feature/goodLimit' into 'release/6.0.2'

换货是否支持上门换货



See merge request !857
... ... @@ -73,7 +73,24 @@ const exchange = {
exchangeModel.cancelApply(uid, id).then(result => {
return res.json(result);
}).catch(next);
}
},
// 商品是否支持上门换货
refreshDelivery(req, res, next) {
const uid = req.user.uid;
const areaCode = req.query.areaCode;
const skns = req.query.skns;
const orderCode = req.query.orderCode;
if (!areaCode || !skns || !orderCode) {
return next();
}
exchangeModel.getrefreshDelivery(uid, areaCode, skns, orderCode).then(result => {
res.json(result);
}).catch(next);
},
};
module.exports = exchange;
... ...
... ... @@ -4,6 +4,7 @@
*/
const api = global.yoho.API;
const crypto = global.yoho.crypto;
const _ = require('lodash');
const exchange = {
// 获取 换货列表
... ... @@ -58,6 +59,26 @@ const exchange = {
id: id,
method: 'app.change.cancel'
});
},
// 获取商品持否支持上门换货
getrefreshDelivery(uid, areaCode, skns, orderCode) {
return api.get('', {
method: 'app.change.refreshDelivery',
area_code: areaCode,
uid: uid,
skns: skns,
order_code: orderCode
}, {
code: 200
}).then(result => {
_.forEach(result.data, function(val, index) {
if (val.is_support === 'N') {
result.data.splice(index, 1);
}
});
return result;
});
}
};
... ...
... ... @@ -173,6 +173,7 @@ router.get('/return/exchange/order', auth, exchange.order); // AJAX 获取订单
router.get('/return/exchange/delivery', auth, exchange.delivery); // AJAX 获取 退货方式
router.post('/return/exchange/submit', auth, exchange.submit); // AJAX 提交换货 申请
router.post('/return/exchange/cancel-apply', auth, exchange.cancelApply); // AJAX 取消换货申请
router.get('/return/exchange/refreshDelivery', auth, exchange.refreshDelivery); // 获取商品的退换货方式
router.get('/tide-command', auth, tideCommand.tideCommand); // 设置潮流口令
module.exports = router;
... ...
... ... @@ -218,6 +218,23 @@
});
},
goodReflushDelivery(code, skns, orderCode) {
$.get('/home/return/exchange/refreshDelivery', {
areaCode: code,
skns: skns,
orderCode: orderCode
}).then(result => {
this.delivery = result.data;
$.each(result.data, (index, obj) => {
if (obj.is_default === 'Y') {
this.deliveryTpye = obj.id;
return false;
}
});
});
},
// 生成提交数据
submitData() {
const data = {
... ... @@ -321,7 +338,17 @@
}
},
'address.areaCode': function(newVal) { // area code 改变,重新获取 换货方式
this.reflushDeliveryTpye(newVal);
let skns = [];
this.goodsArr.filter(function(item) {
if (item.checked) {
skns.push(item.productSkn);
}
return skns;
});
this.goodReflushDelivery(newVal, JSON.stringify(skns), this.orderCode);
},
processing(val) {
if (val) {
... ... @@ -329,6 +356,24 @@
} else {
loading.hideLoading();
}
},
goodsArr: {
handler: function() {
let skns = [];
this.goodsArr.filter(function(item) {
if (item.checked) {
skns.push(item.productSkn);
}
return skns;
});
if (skns.length > 0) {
this.goodReflushDelivery(this.address.areaCode, JSON.stringify(skns), this.orderCode);
}
},
deep: true
}
},
components: {
... ...
... ... @@ -43,7 +43,7 @@
showTip() {
modal.alert('该商品非质量问题不支持退换货,如有疑问请联系在线客服', '不支持无理由退换');
}
},
}
};
</script>
... ...