Browse Source

Merge branch 'master' into dev

master
w-R 3 years ago
parent
commit
712e79501b
  1. 3
      lib/store/store_order.dart
  2. 20
      lib/store/store_view/settlement.dart
  3. 76
      lib/store/store_view/store_order_list.dart

3
lib/store/store_order.dart

@ -405,7 +405,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
fontSize: 12.sp, fontSize: 12.sp,
radius: 100, radius: 100,
), ),
) ),
], ],
), ),
], ],
@ -555,7 +555,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
} }
calculatePrice() { calculatePrice() {
AiDecimalAccuracy allPriceDecimal = AiDecimalAccuracy.zero; AiDecimalAccuracy allPriceDecimal = AiDecimalAccuracy.zero;
int allCount = 0; int allCount = 0;
shopCarGoods.forEach((element2) { shopCarGoods.forEach((element2) {

20
lib/store/store_view/settlement.dart

@ -81,16 +81,16 @@ class _Settlement extends State<Settlement> {
/// ///
queryOrderInfo() async { queryOrderInfo() async {
BaseData<SettleOrderInfo> baseData = await minService.getOrderInfo({ // BaseData<SettleOrderInfo> baseData = await minService.getOrderInfo({
"addressId":0, // "addressId":0,
"isTake": 0, // "isTake": 0,
"memberCouponId": 0, // "memberCouponId": 0,
"orderId": widget.arguments["orderId"], // "orderId": widget.arguments["orderId"],
"promotionId": 0 // "promotionId": 0
}); // });
if (baseData != null && baseData.isSuccess) { // if (baseData != null && baseData.isSuccess) {
setState(() {}); // setState(() {});
} // }
} }
@override @override

76
lib/store/store_view/store_order_list.dart

@ -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,
); );
} }
} }

Loading…
Cancel
Save