|
@@ -46,16 +46,19 @@ class ChatService extends CrudService {
|
|
|
throw new BusinessError('没有查询到该对接会');
|
|
|
}
|
|
|
if (body._id) {
|
|
|
- const goods = dock.apply.map(i => i.goodsList).flat().find(function(item) {
|
|
|
- return item.id === body._id;
|
|
|
- });
|
|
|
- if (body.dockStatus) {
|
|
|
- goods.dockStatus = body.dockStatus;
|
|
|
- }
|
|
|
- } else {
|
|
|
- dock.apply.goodsList.push({
|
|
|
- ...body,
|
|
|
+ let { apply } = dock;
|
|
|
+ apply = apply.map(a => {
|
|
|
+ a.goodsList = a.goodsList.map(g => {
|
|
|
+ if (g.id === body._id) { g.dockStatus = body.dockStatus; }
|
|
|
+
|
|
|
+ return g;
|
|
|
+ });
|
|
|
+ // goodsList中有一个是审核通过的,就把这个人通过 dockStatus === 1
|
|
|
+ const r = a.goodsList.find(f => f.dockStatus === '1');
|
|
|
+ if (r) a.status = '1';
|
|
|
+ return a;
|
|
|
});
|
|
|
+ dock.apply = apply;
|
|
|
}
|
|
|
|
|
|
const res = await dock.save();
|