From 0be43d1a945b16dd9e7ceca6af4c1a32a5cccfa2 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Fri, 17 Jun 2022 14:20:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/knockGold/index.jsx | 4 ++- src/pages/exchangecode/edit/edit.js | 52 +++++++++++++++++++++++------ 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/components/knockGold/index.jsx b/src/components/knockGold/index.jsx index f4ec3aed..3723436c 100644 --- a/src/components/knockGold/index.jsx +++ b/src/components/knockGold/index.jsx @@ -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 }) }} /> diff --git a/src/pages/exchangecode/edit/edit.js b/src/pages/exchangecode/edit/edit.js index 24582755..3e6dabf8 100644 --- a/src/pages/exchangecode/edit/edit.js +++ b/src/pages/exchangecode/edit/edit.js @@ -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 {