|
|
|
@ -1,9 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/order_info.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; |
|
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
@ -11,15 +9,16 @@ import 'package:huixiang/view_widget/separator.dart';
|
|
|
|
|
|
|
|
|
|
class SettlementOrderCommodity extends StatefulWidget { |
|
|
|
|
final int isTakeOut; |
|
|
|
|
final SettleOrderInfo orderInfo; |
|
|
|
|
final List<ProductListBean> orderInfo; |
|
|
|
|
final List<Map<String, dynamic>> shopCarGood; |
|
|
|
|
final SettleOrderInfo settleOrderInfo; |
|
|
|
|
|
|
|
|
|
SettlementOrderCommodity(this.orderInfo,this.isTakeOut); |
|
|
|
|
SettlementOrderCommodity(this.orderInfo, this.isTakeOut,this.shopCarGood,this.settleOrderInfo); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
State<StatefulWidget> createState() { |
|
|
|
|
return _SettlementOrderCommodity(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _SettlementOrderCommodity extends State<SettlementOrderCommodity> { |
|
|
|
@ -66,13 +65,12 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Widget> commodityList() { |
|
|
|
|
if (widget.orderInfo == null) return []; |
|
|
|
|
List<Widget> widgets = []; |
|
|
|
|
if (widget.orderInfo.orderProductList != null) { |
|
|
|
|
widgets |
|
|
|
|
.addAll(widget.orderInfo.orderProductList.map((e) => commodityItem(e)).toList()); |
|
|
|
|
if (widget.orderInfo != null) { |
|
|
|
|
widgets.addAll( |
|
|
|
|
widget.orderInfo.map((e) => commodityItem(e)).toList()); |
|
|
|
|
} |
|
|
|
|
widgets.add(SizedBox(height: 20.h)); |
|
|
|
|
|
|
|
|
@ -84,7 +82,8 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
|
|
|
|
|
? S.of(context).peisongfei |
|
|
|
|
: S.of(context).yunfei, |
|
|
|
|
"", |
|
|
|
|
"+${widget.orderInfo.postAge}")); |
|
|
|
|
"+${widget.settleOrderInfo?.postAge??"0"}" |
|
|
|
|
)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
widgets.add(Container( |
|
|
|
@ -102,13 +101,20 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
|
|
|
|
|
return widgets; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget commodityItem(OrderProductListBean productList) { |
|
|
|
|
Widget commodityItem(ProductListBean productList) { |
|
|
|
|
Map<String,dynamic> goodsBuyInfo; |
|
|
|
|
widget.shopCarGood.forEach((element) { |
|
|
|
|
if(element["id"] == productList.id){ |
|
|
|
|
goodsBuyInfo = element; |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
return Container( |
|
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 8.h), |
|
|
|
|
child: Row( |
|
|
|
|
children: [ |
|
|
|
|
MImage( |
|
|
|
|
productList.skuImg, |
|
|
|
|
productList.imgPath, |
|
|
|
|
width: 44.w, |
|
|
|
|
height: 44, |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
@ -139,7 +145,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"x${productList.buyNum}", |
|
|
|
|
"x${goodsBuyInfo["count"]}", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
color: Color(0xFF727272), |
|
|
|
@ -165,7 +171,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
S.of(context).yuan_(productList.sellPrice), |
|
|
|
|
S.of(context).yuan_(productList.price), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
fontSize: 12.sp, |
|
|
|
@ -312,15 +318,14 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
|
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
S.of(context).gongjijianshangpin( |
|
|
|
|
(widget.orderInfo != null && widget.orderInfo.orderProductList != null) |
|
|
|
|
? widget.orderInfo.orderProductList.length |
|
|
|
|
S.of(context).gongjijianshangpin((widget.orderInfo != null && |
|
|
|
|
widget.orderInfo != null) |
|
|
|
|
? widget.orderInfo.length |
|
|
|
|
: "0"), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
|
fontWeight: MyFontWeight.semi_bold |
|
|
|
|
), |
|
|
|
|
fontWeight: MyFontWeight.semi_bold), |
|
|
|
|
), |
|
|
|
|
flex: 1, |
|
|
|
|
), |
|
|
|
@ -330,8 +335,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
fontWeight:MyFontWeight.semi_bold |
|
|
|
|
), |
|
|
|
|
fontWeight: MyFontWeight.semi_bold), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
@ -341,10 +345,9 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
|
|
|
|
|
totalPrice(), |
|
|
|
|
textAlign: TextAlign.end, |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize:14.sp, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
fontWeight: MyFontWeight.semi_bold |
|
|
|
|
), |
|
|
|
|
fontWeight: MyFontWeight.semi_bold), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -352,10 +355,11 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
String totalPrice() { |
|
|
|
|
if (widget.orderInfo == null) return ""; |
|
|
|
|
double totalPrice = (double.tryParse(widget.orderInfo.orderSum) + |
|
|
|
|
double.tryParse(widget.orderInfo.postAge)); |
|
|
|
|
if (widget.shopCarGood == null) return ""; |
|
|
|
|
double totalPrice = 0; |
|
|
|
|
widget.shopCarGood.forEach((element) { |
|
|
|
|
totalPrice += double.tryParse(element["price"]) * element["count"]; |
|
|
|
|
}); |
|
|
|
|
return "$totalPrice"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |