From e26b8ca57559c693da5cb64253f86c7763172dab Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Mon, 23 May 2022 11:40:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E6=95=B0=E9=87=8F=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E6=9B=B4=E6=94=B9,=20=E5=A4=96=E5=8D=96=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E6=9C=AA=E5=BC=80=E6=94=BE;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/order/order_history_page.dart | 15 +++++++++---- lib/order/order_view/order_commodity.dart | 15 +++++++++---- .../settlement_view/distribution.dart | 10 +++++---- .../settlement_order_commodity.dart | 22 +++++++++++++------ 4 files changed, 43 insertions(+), 19 deletions(-) diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index 9943d460..64206dae 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -220,6 +220,16 @@ class _OrderHistoryList extends State }); } + String orderAllGoods(OrderInfo orderInfo){ + int count = 0; + if(orderInfo.productList != null){ + orderInfo.productList.forEach((element) { + count += element.buyNum; + }); + } + return count.toString(); + } + Widget orderItem(OrderInfo orderInfo) { return Container( margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h), @@ -378,10 +388,7 @@ class _OrderHistoryList extends State ), ), TextSpan( - text: (orderInfo != null && - orderInfo.productList != null) - ? "${orderInfo.productList.length}" - : "0", + text:orderAllGoods(orderInfo), style: TextStyle( fontSize: 12.sp, fontWeight: FontWeight.bold, diff --git a/lib/order/order_view/order_commodity.dart b/lib/order/order_view/order_commodity.dart index ec16f24b..283488c6 100644 --- a/lib/order/order_view/order_commodity.dart +++ b/lib/order/order_view/order_commodity.dart @@ -389,6 +389,16 @@ class _OrderCommodity extends State { ); } + String buyNumAllGoods(){ + int count = 0; + if(widget.orderInfo != null){ + widget.orderInfo.productList.forEach((element) { + count += element.buyNum; + }); + } + return count.toString(); + } + Widget buildTotalPrice() { return Container( margin: EdgeInsets.only(top: 7.h, bottom: 11.h), @@ -399,10 +409,7 @@ class _OrderCommodity extends State { children: [ Expanded( child: Text( - S.of(context).gongjijianshangpin((widget.orderInfo != null && - widget.orderInfo.productList != null) - ? widget.orderInfo.productList.length - : "0"), + S.of(context).gongjijianshangpin(buyNumAllGoods()), style: TextStyle( fontSize: 10.sp, color: Color(0xFFA29E9E), diff --git a/lib/settlement/settlement_view/distribution.dart b/lib/settlement/settlement_view/distribution.dart index 48b9a07d..81124e74 100644 --- a/lib/settlement/settlement_view/distribution.dart +++ b/lib/settlement/settlement_view/distribution.dart @@ -153,10 +153,12 @@ class _DistributionMode extends State { flex: 1, child: GestureDetector( onTap: () { - setState(() { - selectedBtn = 1; - widget.queryAddress(selectedBtn); - }); + // setState(() { + // selectedBtn = 1; + // widget.queryAddress(selectedBtn); + // }); + SmartDialog.showToast("该功能暂未开放!", + alignment: Alignment.center); }, child: Container( height: 50.h, diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index d5c05e1e..0f68a674 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -316,6 +316,20 @@ class _SettlementOrderCommodity extends State { ); } + String countAllGoods(){ + int count = 0; + if(widget.minOrderInfo != null){ + widget.minOrderInfo.orderProductVOList.forEach((element) { + count += element.buyNum; + }); + }else if(widget.settleOrderInfo != null){ + widget.settleOrderInfo.orderProductList.forEach((element) { + count += element.buyNum; + }); + } + return count.toString(); + } + Widget buildTotalPrice() { return Container( margin: EdgeInsets.only(top: 7.h, bottom: 11.h), @@ -326,13 +340,7 @@ class _SettlementOrderCommodity extends State { children: [ Expanded( child: Text( - S.of(context).gongjijianshangpin((widget.minOrderInfo != null) - ? ((widget.minOrderInfo != null) - ? widget.minOrderInfo.orderProductVOList.length - : "0") - : (widget.settleOrderInfo != null) - ? widget.settleOrderInfo.orderProductList.length - : "0"), + S.of(context).gongjijianshangpin(countAllGoods()), style: TextStyle( fontSize: 10.sp, color: Color(0xFFA29E9E),