Authored by OF1706

setExpress api

... ... @@ -98,8 +98,8 @@ const exchangeApply = (req, res, next) => {
* 取消退货申请
*/
const cancelRefund = (req, res, next) => {
const id = req.body.id;
const uid = req.user.uid;
let id = req.body.id;
let uid = req.user.uid;
returnsModel.getCancelRefund(id, uid).then(result => {
res.send(result);
... ... @@ -110,14 +110,47 @@ const cancelRefund = (req, res, next) => {
* 取消换货申请
*/
const cancelChange = (req, res, next) => {
const id = req.body.id;
const uid = req.user.uid;
let id = req.body.id;
let uid = req.user.uid;
returnsModel.getCancelChange(id, uid).then(result => {
res.send(result);
}).catch(next);
};
/**
* 我的退换货-设置快递单号
*/
const setExpressNumber = (req, res, next) => {
let uid = req.user.uid;
let id = req.body.id;
let isChange = req.body.isChange === 'false'? false: true;
let expressId = req.body.expressId;
let expressNumber = req.body.expressNumber;
let expressCompany = req.body.expressCompany;
console.log('uid'+uid);
console.log('id'+id);
console.log('isChange'+isChange);
console.log('expressId'+expressId);
console.log('expressNumber'+expressNumber);
console.log('expressCompany'+expressCompany);
returnsModel.setExpressNumber(id, expressId, expressNumber, uid, expressCompany, isChange).then(result => {
if(res.code && res.code == 201){
res.json({message:'请求失败'});
}
if (id || expressId || expressNumber || uid || expressCompany || isChange) {
res.send(result);
}
}).catch(next);
};
module.exports = {
index,
... ... @@ -127,5 +160,6 @@ module.exports = {
exchangeApply,
exchangeDetail,
cancelRefund,
cancelChange
cancelChange,
setExpressNumber
};
... ...
... ... @@ -84,7 +84,7 @@ const cancelRefundAsync = (id, uid) =>{
uid: uid
};
return api.get('', options);
return api.post('', options);
};
/**
... ... @@ -101,7 +101,33 @@ const cancelChangeAsync = (id, uid) =>{
uid: uid
};
return api.get('', options);
return api.post('', options);
};
/**
* 设置快递
* @param $id
* @param $expressId
* @param $expressNumber
* @param $uid
* @param $expressCompany
* @param $isChange
* @return mixed
*/
const setExpressNumberAsync = (id, expressId, expressNumber, uid, expressCompany, isChange) =>{
let options = {
method: isChange ? 'app.change.setexpress' : 'app.refund.setexpress',
id: id,
express_id: expressId,
express_number: expressNumber,
uid: uid,
express_company: expressCompany
};
console.log(options);
return api.post('', options);
};
/**
... ... @@ -162,6 +188,7 @@ module.exports = {
getChangeDetailAsync,
getProductDataAsync,
getExpressCompanyAsync,
cancelRefundAsync, // 取消退货申请
cancelChangeAsync // 取消换货申请
cancelRefundAsync,
cancelChangeAsync,
setExpressNumberAsync
};
... ...
... ... @@ -554,6 +554,12 @@ const getCancelChange = (id, uid) => {
});
};
const setExpressNumber = (id, expressId, expressNumber, uid, expressCompany, isChange) => {
return returnAPI.setExpressNumberAsync(id, expressId, expressNumber, uid, expressCompany, isChange).then((result) => {
return result;
});
};
module.exports = {
getReturnsList, // 我的订单,退换货列表
getOrderRefund, // 我的订单,申请退货
... ... @@ -561,6 +567,7 @@ module.exports = {
getRefundDetail, // 退货详情
getChangeDetail, // 换货详情
getOrderExchange, // 我的订单,申请换货
getCancelRefund, // 取消退货申请
getCancelChange // 取消换货申请
getCancelRefund, // 取消退货申请
getCancelChange, // 取消换货申请
setExpressNumber // 设置快递
};
... ...
... ... @@ -82,8 +82,9 @@ router.get('/returns/refundDetail', tabsMiddleware.getCommonHeader, returnsContr
router.get('/returns/exchangerequest', tabsMiddleware.getCommonHeader, returnsController.exchangeApply);
router.get('/exchange/detail', tabsMiddleware.getCommonHeader, returnsController.refundDetail);
router.get('/returns/exchangeDetail', tabsMiddleware.getCommonHeader, returnsController.exchangeDetail);
router.get('/returns/cancelRefund', tabsMiddleware.getCommonHeader, returnsController.cancelRefund);// 取消退
router.post('/returns/cancelRefund', tabsMiddleware.getCommonHeader, returnsController.cancelRefund);// 取消换
router.post('/returns/cancelChange', tabsMiddleware.getCommonHeader, returnsController.cancelChange);// 取消退货
router.post('/returns/setExpressNumber', tabsMiddleware.getCommonHeader, returnsController.setExpressNumber);// 取消退货
router.get('/returns/success', returnsController.index);
// router.get('/index', [tabsMiddleware.getCommonHeader, tabsMiddleware.getHomeNav], IndexController.index);
... ...
... ... @@ -73,6 +73,9 @@ function sendExpressCode() {
return;
}
console.log("returnId"+returnId);
console.log("isChange"+isChange);
$.ajax({
type: 'POST',
url: '/home/returns/setExpressNumber',
... ...