This commit is contained in:
wangsongsole 2022-06-17 14:20:07 +08:00
parent 1f44a225f4
commit 0be43d1a94
2 changed files with 45 additions and 11 deletions

View File

@ -1153,7 +1153,9 @@ export default class addKnockGold extends Component {
data={this.state.model}
onChangeMoney={(isVisible, data = 0) => {
const models = this.state.model
models.recharge_amount = data + Number(models.recharge_amount)
models.recharge_amount = (
data + Number(models.recharge_amount)
).toFixed(2)
this.setState({ visible: isVisible, model: models })
}}
/>

View File

@ -245,7 +245,7 @@ export default class exchangedit extends React.Component {
}
}
getTableList() {
getTableList(cancel) {
let code_batch_id = sessionStorage.getItem('code_id')
getCodesDetail(code_batch_id)
.then((res) => {
@ -255,6 +255,20 @@ export default class exchangedit extends React.Component {
let reqCopy = _.cloneDeep(req)
const resData = this.transFormData(reqCopy)
reqCopy.goods = resData
//取消
if (cancel) {
const newConcatData = []
reqCopy.goods.filter((item) => {
this.state.tempdata.filter((item1) => {
if (item.only === item1.only) {
item1.origin.recharge_amount = item.origin.recharge_amount
}
newConcatData.push(item1)
})
})
reqCopy.goods = newConcatData
}
let codeInfo = {
code_name: reqCopy.title,
issued: reqCopy.quantity,
@ -282,7 +296,13 @@ export default class exchangedit extends React.Component {
this.setState({ codeInfo: codeInfo })
this.setState({ isload: true })
_.map(reqCopy.goods, (res) => {
res.checked = true
if (cancel) {
if (res.checked) {
res.checked = true
}
} else {
res.checked = true
}
return res
})
this.setState({ tempdata: reqCopy.goods || [] })
@ -299,13 +319,25 @@ export default class exchangedit extends React.Component {
let arr = []
_.map(reqCopy.goods, (res) => {
let obj = {}
obj.key = res.only
obj.text = res.product_name
obj.id = res.id
this.state.oldProduct.push(res.id)
arr.push(obj)
return obj
if (cancel) {
if (res.checked) {
let obj = {}
obj.key = res.only
obj.text = res.product_name
obj.id = res.id
this.state.oldProduct.push(res.id)
arr.push(obj)
return obj
}
} else {
let obj = {}
obj.key = res.only
obj.text = res.product_name
obj.id = res.id
this.state.oldProduct.push(res.id)
arr.push(obj)
return obj
}
})
this.setState({ rankoptions: arr })
this.setState({ rank: arr })
@ -1371,7 +1403,7 @@ export default class exchangedit extends React.Component {
<Button
onClick={(e) => {
this.setState({ drawerVisible2: false })
// this.getTableList()
this.getTableList('cancel')
}}>
取消
</Button>