This commit is contained in:
parent
1bc75b1870
commit
37e415a9d9
|
@ -4,6 +4,7 @@ import Ipt from '@/components/input/main'
|
|||
import Form from '@/components/form/main'
|
||||
import FormItem from '@/components/form-item/main'
|
||||
import rules from './rules'
|
||||
import _ from 'lodash'
|
||||
import { Button, Notify } from 'zent'
|
||||
import { addFund, handelResponse } from '@/assets/api'
|
||||
export default ({ data, onChangeMoney }) => {
|
||||
|
@ -28,6 +29,14 @@ export default ({ data, onChangeMoney }) => {
|
|||
Notify.success('加款成功')
|
||||
setIsCount(true)
|
||||
setTimeout(() => {
|
||||
const newData = _.cloneDeep(stateData)
|
||||
newData.recharge_amount = (
|
||||
Number(stateData.addNew) + Number(stateData.recharge_amount)
|
||||
).toFixed(2)
|
||||
sessionStorage.setItem(
|
||||
'addMoneyData',
|
||||
JSON.stringify(newData)
|
||||
)
|
||||
onChangeMoney(false, Number(stateData.addNew))
|
||||
}, 1000)
|
||||
},
|
||||
|
|
|
@ -241,12 +241,6 @@ export default class exchangedit extends React.Component {
|
|||
})
|
||||
.catch((err) => {})
|
||||
} else {
|
||||
this.getTableList()
|
||||
}
|
||||
}
|
||||
|
||||
getTableList(cancel) {
|
||||
let code_batch_id = sessionStorage.getItem('code_id')
|
||||
getCodesDetail(code_batch_id)
|
||||
.then((res) => {
|
||||
handelResponse(
|
||||
|
@ -255,20 +249,6 @@ 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,
|
||||
|
@ -296,13 +276,7 @@ export default class exchangedit extends React.Component {
|
|||
this.setState({ codeInfo: codeInfo })
|
||||
this.setState({ isload: true })
|
||||
_.map(reqCopy.goods, (res) => {
|
||||
if (cancel) {
|
||||
if (res.checked) {
|
||||
res.checked = true
|
||||
}
|
||||
} else {
|
||||
res.checked = true
|
||||
}
|
||||
return res
|
||||
})
|
||||
this.setState({ tempdata: reqCopy.goods || [] })
|
||||
|
@ -319,8 +293,6 @@ export default class exchangedit extends React.Component {
|
|||
|
||||
let arr = []
|
||||
_.map(reqCopy.goods, (res) => {
|
||||
if (cancel) {
|
||||
if (res.checked) {
|
||||
let obj = {}
|
||||
obj.key = res.only
|
||||
obj.text = res.product_name
|
||||
|
@ -328,16 +300,6 @@ export default class exchangedit extends React.Component {
|
|||
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 })
|
||||
|
@ -347,6 +309,20 @@ export default class exchangedit extends React.Component {
|
|||
})
|
||||
.catch((err) => {})
|
||||
}
|
||||
}
|
||||
|
||||
getTableList() {
|
||||
if (sessionStorage.getItem('addMoneyData')) {
|
||||
const addMoneyData = JSON.parse(sessionStorage.getItem('addMoneyData'))
|
||||
const tempdata = _.cloneDeep(this.state.tempdata).map((item) => {
|
||||
if (item.channel_activity_id === addMoneyData.channel_activity_id) {
|
||||
item.origin.recharge_amount = addMoneyData.recharge_amount
|
||||
}
|
||||
return item
|
||||
})
|
||||
this.setState({ tempdata })
|
||||
}
|
||||
}
|
||||
|
||||
/* 转换数据 */
|
||||
transFormData(reqCopy) {
|
||||
|
@ -795,7 +771,7 @@ export default class exchangedit extends React.Component {
|
|||
})
|
||||
}
|
||||
let newArray = deWeightThree(temp.concat(concatData), 'only')
|
||||
console.log(newArray)
|
||||
|
||||
//select数据
|
||||
let arr = []
|
||||
let rank = []
|
||||
|
@ -809,6 +785,7 @@ export default class exchangedit extends React.Component {
|
|||
arr = deWeightThree(arr, 'key')
|
||||
|
||||
this.setState({ tempdata: newArray, rankoptions: arr, rank })
|
||||
this.getTableList()
|
||||
}, 500)
|
||||
}
|
||||
}
|
||||
|
@ -1403,7 +1380,7 @@ export default class exchangedit extends React.Component {
|
|||
<Button
|
||||
onClick={(e) => {
|
||||
this.setState({ drawerVisible2: false })
|
||||
this.getTableList('cancel')
|
||||
this.getTableList()
|
||||
}}>
|
||||
取消
|
||||
</Button>
|
||||
|
|
Loading…
Reference in New Issue