...
|
...
|
@@ -99,6 +99,86 @@ exports.getCommentList = (uid, isComment, page, limit) => { |
|
|
return co(process)();
|
|
|
};
|
|
|
|
|
|
exports.getCommentList4Order = (uid, orderId) => {
|
|
|
|
|
|
// limit = limit || 10;
|
|
|
|
|
|
const process = function*() {
|
|
|
|
|
|
let result = yield api.post('', {
|
|
|
method: 'web.show.queryOrderProductCommentList',
|
|
|
uid: uid,
|
|
|
orderId: orderId
|
|
|
});
|
|
|
|
|
|
let isComment = true;
|
|
|
|
|
|
let commentList = {
|
|
|
isComment: isComment,
|
|
|
goodsNum: 0,
|
|
|
orders: []
|
|
|
};
|
|
|
//let pagerObj = {};
|
|
|
|
|
|
// 接口返回成功, 处理数据
|
|
|
if (result.code === 200 && !_.isEmpty(result.data)) {
|
|
|
_.forEach(result.data, (value) => {
|
|
|
|
|
|
let order = {
|
|
|
orderNum: value.orderCode,
|
|
|
orderTime: value.createTime,
|
|
|
orderId: value.orderId,
|
|
|
goods: []
|
|
|
};
|
|
|
|
|
|
_.forEach(value.orderGoods, (v) => {
|
|
|
let cnAlphabet = v.cnAlphabet || '';
|
|
|
let good = {
|
|
|
href: helpers.getUrlBySkc(v.productId, v.goodsId, cnAlphabet),
|
|
|
thumb: imgUtils.getImageUrl(v.imageUrl, 100, 100),
|
|
|
name: v.productName || '',
|
|
|
productSkn: v.productSkn,
|
|
|
productId: v.productId,
|
|
|
goodsId: v.goodsId,
|
|
|
erpSkuId: v.erpSkuId
|
|
|
};
|
|
|
|
|
|
if (isComment === v.hasOwnProperty('comment')) {
|
|
|
if (isComment) {
|
|
|
good.remark = v.comment;
|
|
|
}
|
|
|
order.goods.push(good);
|
|
|
commentList.goodsNum++;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
order.goods.length && commentList.orders.push(order);
|
|
|
});
|
|
|
|
|
|
|
|
|
//let total = commentList.orders.length;
|
|
|
|
|
|
// let totalPage = Math.ceil(total / limit);
|
|
|
// let begin = (page - 1) * limit;
|
|
|
|
|
|
// commentList.orders = commentList.orders.slice(begin, begin + limit); // [begin, begin+limit)
|
|
|
|
|
|
// pagerObj = pager(total, {
|
|
|
// isComment: isComment ? 'Y' : 'N'//,
|
|
|
// //page: page
|
|
|
// });
|
|
|
} else {
|
|
|
commentList.empty = isComment ? NO_COMMENTED_GOODS : NO_UNCOMMENT_GOODS; // 空数据 提示文字
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
comment: commentList// ,
|
|
|
// pager: pagerObj
|
|
|
};
|
|
|
};
|
|
|
|
|
|
return co(process)();
|
|
|
};
|
|
|
|
|
|
exports.saveShareOrder = data => {
|
|
|
let process = function*() {
|
...
|
...
|
|