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. 182
      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

182
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 {
@ -23,25 +24,22 @@ class StoreOrderListPage extends StatefulWidget {
List<Map<String, dynamic>> shopCarGoods; List<Map<String, dynamic>> shopCarGoods;
StoreOrderListPage( StoreOrderListPage(
this.arguments, this.arguments,
this.activitys, this.activitys,
this.storeInfo, this.storeInfo,
this.shopCarGoods, this.shopCarGoods,
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();
} }
/// ///
@ -89,40 +86,44 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
@override @override
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:
margin: EdgeInsets.only( MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h),
top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight), margin: EdgeInsets.only(
), top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight),
child: Row( ),
mainAxisAlignment: MainAxisAlignment.start, child: Row(
mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start,
children: [ mainAxisSize: MainAxisSize.max,
Container( children: [
width: 100.w, Container(
child: ListView.builder( width: 100.w,
itemCount: appletProducts == null ? 0 : appletProducts.length, child: ListView.builder(
controller: controller1, itemCount:
physics: BouncingScrollPhysics(), appletProducts == null ? 0 : appletProducts.length,
padding: EdgeInsets.only(top: 0, bottom: 25), controller: controller1,
itemBuilder: (context, position) { physics: BouncingScrollPhysics(),
return orderItem(appletProducts[position], position); padding: EdgeInsets.only(top: 0, bottom: 25),
}, itemBuilder: (context, position) {
return orderItem(appletProducts[position], position);
},
),
), ),
), 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
itemCount: productListBeans == null ? 0 : productListBeans.length, ? 0
physics: BouncingScrollPhysics(), : productListBeans.length,
padding: EdgeInsets.zero, physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { padding: EdgeInsets.zero,
return goodsItem(position); itemBuilder: (context, position) {
}, return goodsItem(position);
},
),
), ),
), ],
], ),
),
); );
} }
@ -130,41 +131,86 @@ 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, onTap: () {
children: [ setState(() {
GestureDetector( isSelected = index;
onTap: () { productListBeans.clear();
setState(() { productListBeans.addAll(findMiNiGroupList.productList);
isSelected = index; });
productListBeans.clear(); },
productListBeans.addAll(findMiNiGroupList.productList); child: Stack(
}); alignment: Alignment.center,
}, children: [
child: Container( 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: Text( child: Row(
findMiNiGroupList.groupName, mainAxisAlignment: MainAxisAlignment.center,
textAlign: TextAlign.center, crossAxisAlignment: CrossAxisAlignment.center,
style: TextStyle( children: [
color: isSelected != index if (isSelected == index)
? Color(0xFF202020) Container(
: Color(0xFF000000), width: 2,
height: 17,
color: Color(0xFF32A060),
margin: EdgeInsets.only(right: 10),
),
Expanded(
child: Text(
findMiNiGroupList.groupName,
textAlign: TextAlign.center,
style: TextStyle(
color: isSelected != index
? Color(0xFF202020)
: Color(0xFF000000),
fontSize: 12.sp,
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, fontSize: 12.sp,
fontWeight: MyFontWeight.medium, 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