|
|
@ -9,6 +9,7 @@ import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
import 'package:huixiang/view_widget/separator.dart'; |
|
|
|
import 'package:huixiang/view_widget/separator.dart'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import '../../retrofit/data/shoppingCart.dart'; |
|
|
|
import '../../utils/flutter_utils.dart'; |
|
|
|
import '../../utils/flutter_utils.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class OrderCommodity extends StatefulWidget { |
|
|
|
class OrderCommodity extends StatefulWidget { |
|
|
@ -182,95 +183,160 @@ class _OrderCommodity extends State<OrderCommodity> { |
|
|
|
Widget commodityItem(OrderProductVOList productList) { |
|
|
|
Widget commodityItem(OrderProductVOList productList) { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 8.h), |
|
|
|
margin: EdgeInsets.only(top: 8.h, bottom: 8.h), |
|
|
|
child: Row( |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
MImage( |
|
|
|
Row( |
|
|
|
productList.skuImg, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
width: 49, |
|
|
|
children: [ |
|
|
|
height: 49, |
|
|
|
MImage( |
|
|
|
fit: BoxFit.cover, |
|
|
|
productList.skuImg, |
|
|
|
radius: BorderRadius.circular(2), |
|
|
|
width: 49, |
|
|
|
errorSrc: "assets/image/default_1.webp", |
|
|
|
height: 49, |
|
|
|
fadeSrc: "assets/image/default_1.webp", |
|
|
|
fit: BoxFit.cover, |
|
|
|
), |
|
|
|
radius: BorderRadius.circular(2), |
|
|
|
Expanded( |
|
|
|
errorSrc: "assets/image/default_1.webp", |
|
|
|
flex: 1, |
|
|
|
fadeSrc: "assets/image/default_1.webp", |
|
|
|
child: Container( |
|
|
|
|
|
|
|
margin: EdgeInsets.only( |
|
|
|
|
|
|
|
left: 8.w, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
// height: 44.h, |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
flex: 1, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
child: Container( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
margin: EdgeInsets.only( |
|
|
|
children: [ |
|
|
|
left: 8.w, |
|
|
|
Text( |
|
|
|
|
|
|
|
productList.productName, |
|
|
|
|
|
|
|
maxLines: 1, |
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox( |
|
|
|
|
|
|
|
height: 4.h, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
// height: 44.h, |
|
|
|
productList.skuNameStr != null |
|
|
|
child: Column( |
|
|
|
? "${productList.skuNameStr ?? ""}" |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
: "", |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
children: [ |
|
|
|
style: TextStyle( |
|
|
|
Text( |
|
|
|
fontSize: 10.sp, |
|
|
|
productList.productName, |
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
maxLines: 1, |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
|
|
color: Color(0xFF353535), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
SizedBox( |
|
|
|
|
|
|
|
height: 4.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
productList.skuNameStr != null |
|
|
|
|
|
|
|
? "${productList.skuNameStr ?? ""}" |
|
|
|
|
|
|
|
: "", |
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
"x${productList.buyNum}", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
color: Color(0xFF727272), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Column( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
|
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"x${productList.buyNum}", |
|
|
|
productList.buyNum > 1 |
|
|
|
|
|
|
|
? S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - AppUtils.stringAsFixedDouble2((double.tryParse(productList.discountAmount ?? "0") / productList.buyNum)))) |
|
|
|
|
|
|
|
: S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - double.tryParse(productList.discountAmount ?? "0"))), |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
color: Color(0xFF727272), |
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
|
|
color: Color(0xFF4C4C4C), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
if (productList.discountAmount != null && productList.discountAmount != "0") |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
S.of(context).yuan_(productList.sellPrice), |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
|
|
|
|
decoration: TextDecoration.lineThrough, |
|
|
|
|
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Column( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.end, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
productList.buyNum > 1 |
|
|
|
|
|
|
|
? S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - AppUtils.stringAsFixedDouble2((double.tryParse(productList.discountAmount ?? "0") / productList.buyNum)))) |
|
|
|
|
|
|
|
: S.of(context).yuan_(AppUtils.calculateDouble(double.tryParse(productList.sellPrice ?? "0") - double.tryParse(productList.discountAmount ?? "0"))), |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
|
|
color: Color(0xFF4C4C4C), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
if (productList.discountAmount != null && productList.discountAmount != "0") |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
S.of(context).yuan_(productList.sellPrice), |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
fontFamily: 'JDZhengHT', |
|
|
|
|
|
|
|
decoration: TextDecoration.lineThrough, |
|
|
|
|
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
if (productList.setMealDataList.length != 0) |
|
|
|
|
|
|
|
ListView.builder( |
|
|
|
|
|
|
|
itemCount: productList.setMealDataList.length, |
|
|
|
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
|
|
|
shrinkWrap: true, |
|
|
|
|
|
|
|
padding: EdgeInsets.zero, |
|
|
|
|
|
|
|
itemBuilder: (context, index) { |
|
|
|
|
|
|
|
return orderMealsItem(productList.setMealDataList[index]); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget orderMealsItem(SetMealDataList setMealDataList) { |
|
|
|
|
|
|
|
return Column(children: setMealDataList.productInfoList.map((e) { |
|
|
|
|
|
|
|
return Container( |
|
|
|
|
|
|
|
margin: EdgeInsets.symmetric( |
|
|
|
|
|
|
|
vertical: 10.h, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
child: Row( |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
flex: 2, |
|
|
|
|
|
|
|
child: Text( |
|
|
|
|
|
|
|
e.productName, |
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
|
|
maxLines: 1, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
color: Color(0xffA29E9E), |
|
|
|
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Expanded( |
|
|
|
|
|
|
|
flex: 3, |
|
|
|
|
|
|
|
child: Text( |
|
|
|
|
|
|
|
"${(e.skuName == "") ? "" : e.skuName}", |
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
|
|
maxLines: 1, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
color: Color(0xffA29E9E), |
|
|
|
|
|
|
|
fontSize: 13.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Text( |
|
|
|
|
|
|
|
"x${e.buyNumber.toString()}", |
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
|
|
maxLines: 1, |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
color: Color(0xffFF7A1A), |
|
|
|
|
|
|
|
fontSize: 13.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}).toList(),); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Widget discountItem(Color color, textName, condition, amount) { |
|
|
|
Widget discountItem(Color color, textName, condition, amount) { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
margin: EdgeInsets.only(top: 9.h, bottom: 9.h), |
|
|
|
margin: EdgeInsets.only(top: 9.h, bottom: 9.h), |
|
|
|