Commit 60fe6a69 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复积分订单商品信息没有返回报错的问题

parent bf65463f
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-04 15:09:09
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-07 16:57:04
* @LastEditTime: 2021-01-21 14:50:59
* @Description: 维修商品抽屉组件
*/
import React, { useState, useEffect } from 'react';
......@@ -94,7 +94,7 @@ function transformParentKeys(data: any[], childCheckedKeys: string[]) {
}
// 判断两者长度 一样 就表示父节点时候选中的
if (atom.checkeds.length === atom.productDateilss.length) {
if (atom.checkeds.length === (atom.productDateilss && atom.productDateilss.length)) {
ret.push(atom.id);
}
});
......@@ -233,16 +233,18 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
const payload = [];
orderListRes.data.forEach(item => {
item.productDateilss.forEach(product => {
const atom = {
productId: product.productId,
memberId: product.memberId,
memberRoleId: product.memberRoleId,
shopId: item.shopId,
type, // 流程类型
};
payload.push(atom);
});
if (item.productDateilss) {
item.productDateilss.forEach(product => {
const atom = {
productId: product.productId,
memberId: product.memberId,
memberRoleId: product.memberRoleId,
shopId: item.shopId,
type, // 流程类型
};
payload.push(atom);
});
}
});
if (!payload.length) {
......@@ -272,19 +274,21 @@ class GoodsDrawer extends React.Component<GoodsDrawerProps, GoodsDrawerState> {
// 组装数据
let i = 0;
orderListRes.data.forEach(item => {
item.productDateilss.forEach(product => {
product.processEnum = processEnumRes.data[i] ? processEnumRes.data[i].processEnum : undefined;
// product.processEnum = mockMap[Math.floor(Math.random()*2 + 1)];
i++;
// 防止重复添加数据
if (!this.flattened.find(flat => flat.id === product.id)) {
this.flattened.push({
...product,
orderNo: item.orderNo,
payInfoList: item.payInfoList,
});
}
});
if (item.productDateilss) {
item.productDateilss.forEach(product => {
product.processEnum = processEnumRes.data[i] ? processEnumRes.data[i].processEnum : undefined;
// product.processEnum = mockMap[Math.floor(Math.random()*2 + 1)];
i++;
// 防止重复添加数据
if (!this.flattened.find(flat => flat.id === product.id)) {
this.flattened.push({
...product,
orderNo: item.orderNo,
payInfoList: item.payInfoList,
});
}
});
}
});
this.setState({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment