fix:修复兑换码编辑、赋值、新增剩余数量 已使用数量计算错误

This commit is contained in:
wangsongsole 2022-10-12 17:25:41 +08:00
parent e3c81251f9
commit eb85be4aa5
1 changed files with 14 additions and 2 deletions

View File

@ -905,8 +905,20 @@ export default class exchangeAdd extends React.Component {
item.type = 1
item.only = item.product_id
item.upstream = "直连天下"
item.stock = item.stock ? item.stock : item.quantity
item.usage = item.usage ? item.usage : 0
/* 赋值 剩余数量 已使用数量*/
/* 新增\复制 */
if ([0, 1].includes(this.state.isState)) {
item.stock = item.quantity
item.usage = 0
}
/* 编辑 */
if (this.state.isState === 2) {
item.stock = parseInt(item.quantity - item.usage)
item.usage = item.usage
}
return item
})
} else {