Commit b6b529b1 authored by XieZhiXiong's avatar XieZhiXiong

fix: 修复会员可以重复添加的问题

parent 2789f1c9
......@@ -251,7 +251,16 @@ const DeliverCoupon: React.FC<IProps> = (props) => {
return;
}
let newData = [...suitableMemberList];
newData = newData.concat(RowCtl.selectRow.map((item) => ({ ...item, disabled: false })));
for (let i = 0; i < RowCtl.selectRow.length; i++) {
const item = RowCtl.selectRow[i];
// 防止重复添加
if (!newData.find((current) => current.onlyId === item.onlyId)) {
newData.push({
...item,
disabled: false,
});
}
}
setSuitableMemberList(newData);
const filtered = newData.map(({ onlyId, disabled, ...rest }) => ({ ...rest }));
triggerChange(filtered);
......
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