Authored by xuqi

order catch

... ... @@ -12,7 +12,7 @@ const orderModel = require('../models/order');
/**
* 我的订单
*/
const index = (req, res) => {
const index = (req, res, next) => {
const type = req.query.type;
const page = req.query.page;
const uid = req.user.uid;
... ... @@ -30,10 +30,10 @@ const index = (req, res) => {
banner: thumb
}, pageData)
});
});
}).catch(next);
};
const detail = (req, res) => {
const detail = (req, res, next) => {
const code = req.query.orderCode;
const uid = req.user.uid;
... ... @@ -51,10 +51,10 @@ const detail = (req, res) => {
banner: thumb
}, pageData)
});
});
}).catch(next);
};
const getOrderList = (req, res) => {
const getOrderList = (req, res, next) => {
const type = req.query.type;
const page = req.query.page;
const uid = req.user.uid;
... ... @@ -68,10 +68,10 @@ const getOrderList = (req, res) => {
paginationOpts: result.order.paginationOpts,
orderData: result.order.orderData
});
});
}).catch(next);
};
const getOrderTotal = (req, res) => {
const getOrderTotal = (req, res, next) => {
const type = req.query.type;
const uid = req.user.uid;
... ... @@ -82,43 +82,43 @@ const getOrderTotal = (req, res) => {
total: result.order.total,
type: result.order.type
});
});
}).catch(next);
};
const cancelOrder = (req, res) => {
const cancelOrder = (req, res, next) => {
const uid = req.user.uid;
const data = req.query;
orderModel.cancelOrder(uid, data).then(result => {
res.json(result);
});
}).catch(next);
};
const deleteOrder = (req, res) => {
const deleteOrder = (req, res, next) => {
const uid = req.user.uid;
const code = req.query.orderCode;
orderModel.deleteOrder(uid, code).then(result => {
res.json(result);
});
}).catch(next);
};
const getExpressInfo = (req, res) => {
const getExpressInfo = (req, res, next) => {
const uid = req.user.uid;
const code = req.query.orderCode;
orderModel.getExpressInfo(uid, code).then(result => {
res.json(result);
});
}).catch(next);
};
const getCancelOrderReason = (req, res) => {
const getCancelOrderReason = (req, res, next) => {
orderModel.getCancelOrderReason().then(result => {
res.json(result);
});
}).catch(next);
};
const editOrder = (req, res) => {
const editOrder = (req, res, next) => {
const uid = req.user.uid;
const query = req.query;
... ... @@ -126,25 +126,25 @@ const editOrder = (req, res) => {
orderModel.editOrder(query).then(result => {
res.json(result);
});
}).catch(next);
};
const reAdd = (req, res) => {
const reAdd = (req, res, next) => {
const uid = req.user.uid;
const code = req.query.orderCode;
orderModel.reAddCart(uid, code).then(result => {
res.json(result);
});
}).catch(next);
};
const confirmReceive = (req, res) => {
const confirmReceive = (req, res, next) => {
const uid = req.user.uid;
const code = req.query.orderCode;
orderModel.confirmReceive(uid, code).then(result => {
res.json(result);
});
}).catch(next);
};
module.exports = {
... ...
... ... @@ -30,8 +30,8 @@ const getMeThumb = () => {
if (result.data) {
return {
banner: result.data.list[0].data[0].src,
url: result.data.list[0].data[0].url
banner: result.data.list ? result.data.list[0].data[0].src : '',
url: result.data.list ? result.data.list[0].data[0].url : ''
};
}
return {
... ...