...
|
...
|
@@ -136,22 +136,15 @@ exports.getCommentList = (uid, isComment, page, limit) => { |
|
|
return co(process)();
|
|
|
};
|
|
|
|
|
|
exports.getCommentList4Order = (uid, orderId) => {
|
|
|
|
|
|
// limit = limit || 10;
|
|
|
// http://api.yoho.cn/?app_version=5.0.0&client_secret=e8098ddd3129372e8c93daea6600eda4&client_type=android&gender=1%2C3&
|
|
|
// method=show.toShareOrderList&
|
|
|
// orderCode=1617595089&os_version=android6.0.1%3AMI_MAX&screen_size=1080x1920&session_key=
|
|
|
// 720e95e42f9c1edc5940f1d49c34b68e&uid=9963947&v=7&yh_channel=1
|
|
|
exports.getCommentList4Order = (uid, orderCode) => {
|
|
|
|
|
|
const process = function*() {
|
|
|
|
|
|
let result = yield api.post('', {
|
|
|
// method: 'web.show.queryOrderProductCommentList',
|
|
|
method: 'show.toShareOrderList',
|
|
|
// method: 'show.toShareOrderList',
|
|
|
method: 'web.show.queryCommentListByOrderCode',
|
|
|
uid: uid,
|
|
|
orderCode: orderId// ,
|
|
|
// orderId: orderId
|
|
|
orderCode: orderCode
|
|
|
});
|
|
|
|
|
|
let commentList = {
|
...
|
...
|
@@ -162,7 +155,7 @@ exports.getCommentList4Order = (uid, orderId) => { |
|
|
// 接口返回成功, 处理数据
|
|
|
if (result.code === 200 && !_.isEmpty(result.data)) {
|
|
|
|
|
|
let order = {
|
|
|
/* let order = {
|
|
|
// orderNum: value.orderCode,
|
|
|
// orderTime: value.createTime,
|
|
|
orderNum: orderId,
|
...
|
...
|
@@ -190,28 +183,63 @@ exports.getCommentList4Order = (uid, orderId) => { |
|
|
commentList.goodsNum++;
|
|
|
});
|
|
|
|
|
|
order.goods.length && commentList.orders.push(order);
|
|
|
order.goods.length && commentList.orders.push(order);*/
|
|
|
|
|
|
// let total = commentList.orders.length;
|
|
|
_.forEach(result.data, (value) => {
|
|
|
|
|
|
let order = {
|
|
|
orderNum: value.orderCode,
|
|
|
orderTime: value.createTime,
|
|
|
orderId: value.orderId,
|
|
|
goods: []
|
|
|
};
|
|
|
|
|
|
// let totalPage = Math.ceil(total / limit);
|
|
|
// let begin = (page - 1) * limit;
|
|
|
_.forEach(value.orderGoods, (v) => {
|
|
|
let cnAlphabet = v.cnAlphabet || '';
|
|
|
let good = {
|
|
|
href: helpers.getUrlBySkc(v.productId, v.goodsId, cnAlphabet),
|
|
|
thumb: helpers.image(imgUtils.getImageUrl(v.imageUrl, 100, 100), 100, 100),
|
|
|
name: v.productName || '',
|
|
|
productSkn: v.productSkn,
|
|
|
productId: v.productId,
|
|
|
goodsId: v.goodsId,
|
|
|
erpSkuId: v.erpSkuId,
|
|
|
orderId: value.orderId,
|
|
|
orderCode: value.orderCode,
|
|
|
orderTime: value.createTime ? value.createTime.substr(0, 10) : ''
|
|
|
};
|
|
|
|
|
|
// commentList.orders = commentList.orders.slice(begin, begin + limit); // [begin, begin+limit)
|
|
|
if (v.commentDetailBoDetail && v.commentDetailBoDetail.length > 0) {
|
|
|
|
|
|
good.comments = v.commentDetailBoDetail.map((cm) => {
|
|
|
return {
|
|
|
content: cm.content,
|
|
|
createTime: moment(cm.createTime * 1000).format('YYYY-MM-DD HH:mm:ss'),
|
|
|
satisfied: cm.satisfied,
|
|
|
size: cm.size,
|
|
|
sizeLabel: sizeLabelMap[cm.size],
|
|
|
url: helpers.image(cm.url, 100, 100),
|
|
|
sourceUrl: helpers.image(cm.url, 400, 400),
|
|
|
height: cm.height,
|
|
|
weight: cm.weight
|
|
|
};
|
|
|
});
|
|
|
}
|
|
|
|
|
|
order.goods.push(good);
|
|
|
commentList.goodsNum++;
|
|
|
});
|
|
|
|
|
|
order.goods.length && commentList.orders.push(order);
|
|
|
});
|
|
|
|
|
|
// pagerObj = pager(total, {
|
|
|
// isComment: isComment ? 'Y' : 'N'//,
|
|
|
// //page: page
|
|
|
// });
|
|
|
} else {
|
|
|
commentList.empty = NO_UNCOMMENT_GOODS; // 空数据 提示文字
|
|
|
}
|
|
|
|
|
|
return {
|
|
|
comment: commentList,
|
|
|
isFromOrder: true// ,
|
|
|
// pager: pagerObj
|
|
|
isFromOrder: true
|
|
|
};
|
|
|
};
|
|
|
|
...
|
...
|
|