From 50c74d1f4394013a4ed2f508a4b2aeda5828bde0 Mon Sep 17 00:00:00 2001 From: red-deng-deng <1924913374@qq.com> Date: Tue, 23 Nov 2021 21:38:13 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E8=AE=A2=E5=8D=95=E7=BB=93?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/order/list/list.js | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/pages/order/list/list.js b/src/pages/order/list/list.js index daf82975..afa51b72 100644 --- a/src/pages/order/list/list.js +++ b/src/pages/order/list/list.js @@ -128,13 +128,24 @@ export default class orderlist extends React.Component{ tableHeight:500, page:1, limit:10, - key_word:'' + key_word:'', + officialprice:0,contractprice:0,costprice:0,totalprice:0 } } //选中表格的选框 selection(selection){ this.setState({selectiondata:selection}); - + let officialprice=0; + let contractprice=0; + let costprice=0; + let totalprice=0; + selection.forEach(item=>{ + officialprice+=Number(item.official_price); + contractprice+=Number(item.contract_price); + costprice+=Number(item.cost_price); + totalprice+=Number(item.total); + }); + this.setState({officialprice,contractprice,costprice,totalprice}); } //新建订单 clickFn(){ @@ -400,8 +411,8 @@ componentDidUpdate(prevProps,prevState){ type="info" extraContent={} > - 已选择{this.state.selectiondata.length}项,官方价金额总计¥30.00万,合同价金额总计¥30.00万,成本价金额总计:¥36.4万,结算价金额总计:¥36.4万 - ):null + 已选择{this.state.selectiondata.length}项,官方价金额总计¥{this.state.officialprice.toFixed(4)}万,合同价金额总计¥{this.state.contractprice.toFixed(4)}万,成本价金额总计:¥{this.state.costprice.toFixed(4)}万,结算价金额总计:¥{this.state.totalprice.toFixed(4)}万 + ):null }