diff --git a/src/pages/exchangecode/exchangecodeAdd/index.jsx b/src/pages/exchangecode/exchangecodeAdd/index.jsx index 0218d550..b7e8c285 100644 --- a/src/pages/exchangecode/exchangecodeAdd/index.jsx +++ b/src/pages/exchangecode/exchangecodeAdd/index.jsx @@ -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 {