|
|
@ -10,6 +10,7 @@ import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
import 'package:huixiang/store/store_view/shop_goods.dart'; |
|
|
|
import 'package:huixiang/store/store_view/shop_goods.dart'; |
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class StoreOrderListPage extends StatefulWidget { |
|
|
|
class StoreOrderListPage extends StatefulWidget { |
|
|
@ -30,18 +31,15 @@ class StoreOrderListPage extends StatefulWidget { |
|
|
|
this.controller, |
|
|
|
this.controller, |
|
|
|
this.queryMiNiDetail, |
|
|
|
this.queryMiNiDetail, |
|
|
|
this.productListResult, |
|
|
|
this.productListResult, |
|
|
|
this.fc |
|
|
|
this.fc); |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
State<StatefulWidget> createState() { |
|
|
|
State<StatefulWidget> createState() { |
|
|
|
return _StoreOrderListPage(); |
|
|
|
return _StoreOrderListPage(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
|
|
|
|
|
|
|
|
int isSelected = 0; |
|
|
|
int isSelected = 0; |
|
|
|
int tempClickIndex = 0; |
|
|
|
int tempClickIndex = 0; |
|
|
|
ApiService apiService; |
|
|
|
ApiService apiService; |
|
|
@ -54,7 +52,6 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
super.initState(); |
|
|
|
super.initState(); |
|
|
|
|
|
|
|
|
|
|
|
appletGoods(); |
|
|
|
appletGoods(); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
///小程序查询分组及商品列表 |
|
|
|
///小程序查询分组及商品列表 |
|
|
@ -90,7 +87,8 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
width: MediaQuery.of(context).size.width, |
|
|
|
width: MediaQuery.of(context).size.width, |
|
|
|
height: MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h), |
|
|
|
height: |
|
|
|
|
|
|
|
MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h), |
|
|
|
margin: EdgeInsets.only( |
|
|
|
margin: EdgeInsets.only( |
|
|
|
top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight), |
|
|
|
top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight), |
|
|
|
), |
|
|
|
), |
|
|
@ -101,7 +99,8 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
Container( |
|
|
|
Container( |
|
|
|
width: 100.w, |
|
|
|
width: 100.w, |
|
|
|
child: ListView.builder( |
|
|
|
child: ListView.builder( |
|
|
|
itemCount: appletProducts == null ? 0 : appletProducts.length, |
|
|
|
itemCount: |
|
|
|
|
|
|
|
appletProducts == null ? 0 : appletProducts.length, |
|
|
|
controller: controller1, |
|
|
|
controller: controller1, |
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
padding: EdgeInsets.only(top: 0, bottom: 25), |
|
|
|
padding: EdgeInsets.only(top: 0, bottom: 25), |
|
|
@ -113,7 +112,9 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
Container( |
|
|
|
Container( |
|
|
|
width: MediaQuery.of(context).size.width - 100.w, |
|
|
|
width: MediaQuery.of(context).size.width - 100.w, |
|
|
|
child: ListView.builder( |
|
|
|
child: ListView.builder( |
|
|
|
itemCount: productListBeans == null ? 0 : productListBeans.length, |
|
|
|
itemCount: productListBeans == null |
|
|
|
|
|
|
|
? 0 |
|
|
|
|
|
|
|
: productListBeans.length, |
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
padding: EdgeInsets.zero, |
|
|
|
padding: EdgeInsets.zero, |
|
|
|
itemBuilder: (context, position) { |
|
|
|
itemBuilder: (context, position) { |
|
|
@ -130,12 +131,10 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
ScrollController controller2 = ScrollController(); |
|
|
|
ScrollController controller2 = ScrollController(); |
|
|
|
|
|
|
|
|
|
|
|
Widget orderItem(FindMiNiGroupList findMiNiGroupList, int index) { |
|
|
|
Widget orderItem(FindMiNiGroupList findMiNiGroupList, int index) { |
|
|
|
|
|
|
|
int count = calculateItemCount(findMiNiGroupList); |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
child: Column( |
|
|
|
width: 100, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
child: GestureDetector( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
GestureDetector( |
|
|
|
|
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
|
isSelected = index; |
|
|
|
isSelected = index; |
|
|
@ -143,10 +142,25 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
productListBeans.addAll(findMiNiGroupList.productList); |
|
|
|
productListBeans.addAll(findMiNiGroupList.productList); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
child: Stack( |
|
|
|
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
Container( |
|
|
|
color: isSelected != index ? Color(0xFFFAFAFA) : Colors.white, |
|
|
|
color: isSelected != index ? Color(0xFFFAFAFA) : Colors.white, |
|
|
|
alignment: Alignment.center, |
|
|
|
alignment: Alignment.center, |
|
|
|
padding: EdgeInsets.all(15), |
|
|
|
padding: EdgeInsets.all(15), |
|
|
|
|
|
|
|
child: Row( |
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
|
|
|
children: [ |
|
|
|
|
|
|
|
if (isSelected == index) |
|
|
|
|
|
|
|
Container( |
|
|
|
|
|
|
|
width: 2, |
|
|
|
|
|
|
|
height: 17, |
|
|
|
|
|
|
|
color: Color(0xFF32A060), |
|
|
|
|
|
|
|
margin: EdgeInsets.only(right: 10), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Expanded( |
|
|
|
child: Text( |
|
|
|
child: Text( |
|
|
|
findMiNiGroupList.groupName, |
|
|
|
findMiNiGroupList.groupName, |
|
|
|
textAlign: TextAlign.center, |
|
|
|
textAlign: TextAlign.center, |
|
|
@ -158,13 +172,45 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
flex: 1, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
], |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
Positioned( |
|
|
|
|
|
|
|
right: 0, |
|
|
|
|
|
|
|
child: Visibility( |
|
|
|
|
|
|
|
visible: count > 0, |
|
|
|
|
|
|
|
child: RoundButton( |
|
|
|
|
|
|
|
width: 17, |
|
|
|
|
|
|
|
height: 17, |
|
|
|
|
|
|
|
text: "$count", |
|
|
|
|
|
|
|
textColor: Colors.white, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
|
|
|
radius: 100, |
|
|
|
|
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int calculateItemCount(FindMiNiGroupList findMiNiGroupList) { |
|
|
|
|
|
|
|
int count = 0; |
|
|
|
|
|
|
|
findMiNiGroupList.productList.forEach((element) { |
|
|
|
|
|
|
|
widget.shopCarGoods.forEach((element1) { |
|
|
|
|
|
|
|
if (element.id == element1["id"]) { |
|
|
|
|
|
|
|
count += element1["count"]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return count; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Widget goodsItem(position) { |
|
|
|
Widget goodsItem(position) { |
|
|
|
Map<String, dynamic> map; |
|
|
|
Map<String, dynamic> map; |
|
|
|
widget.shopCarGoods.forEach((element) { |
|
|
|
widget.shopCarGoods.forEach((element) { |
|
|
@ -189,10 +235,10 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
widget.fc(count, productId, allCount, allPrice.toDouble()); |
|
|
|
widget.fc(count, productId, allCount, allPrice.toDouble()); |
|
|
|
|
|
|
|
setState(() {}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
queryMiNiDetail: widget.queryMiNiDetail, |
|
|
|
queryMiNiDetail: widget.queryMiNiDetail, |
|
|
|
shopCarGoods: map, |
|
|
|
shopCarGoods: map, |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|