From b5ac3c6d75ce9373b38128266642ca1b1028baf7 Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Fri, 17 Jun 2022 15:48:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/knockGold/Dialog.jsx | 46 ++++++++++++++++------------- src/pages/exchangecode/edit/edit.js | 1 + 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/src/components/knockGold/Dialog.jsx b/src/components/knockGold/Dialog.jsx index 8d742dc1..e3ba599a 100644 --- a/src/components/knockGold/Dialog.jsx +++ b/src/components/knockGold/Dialog.jsx @@ -29,27 +29,7 @@ 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) - - let origin = [] - if (sessionStorage.getItem('addMoneyData')) { - origin = JSON.parse(sessionStorage.getItem('addMoneyData')) - } - - let index = origin.findIndex( - (o) => o.channel_activity_id == newData.channel_activity_id - ) - if (index !== -1) { - origin[index] = newData - } else { - origin.push(newData) - } - - sessionStorage.setItem('addMoneyData', JSON.stringify(origin)) - + setOrigin() onChangeMoney(false, Number(stateData.addNew)) }, 1000) }, @@ -65,6 +45,30 @@ export default ({ data, onChangeMoney }) => { } } + //存储原始加款的数据 + function setOrigin() { + const newData = _.cloneDeep(stateData) + newData.recharge_amount = ( + Number(stateData.addNew) + Number(stateData.recharge_amount) + ).toFixed(2) + + let origin = [] + if (sessionStorage.getItem('addMoneyData')) { + origin = JSON.parse(sessionStorage.getItem('addMoneyData')) + } + + let index = origin.findIndex( + (o) => o.channel_activity_id == newData.channel_activity_id + ) + if (index !== -1) { + origin[index] = newData + } else { + origin.push(newData) + } + + sessionStorage.setItem('addMoneyData', JSON.stringify(origin)) + } + return ( <>
diff --git a/src/pages/exchangecode/edit/edit.js b/src/pages/exchangecode/edit/edit.js index bedd1873..cdd12e2b 100644 --- a/src/pages/exchangecode/edit/edit.js +++ b/src/pages/exchangecode/edit/edit.js @@ -311,6 +311,7 @@ export default class exchangedit extends React.Component { } } + // 立减金 加款后 商品范围列表数据进行变动 getTableList() { if (sessionStorage.getItem('addMoneyData')) { const addMoneyData = JSON.parse(sessionStorage.getItem('addMoneyData'))