Browse Source

safety

master
fmk 3 years ago
parent
commit
db51f2a678
  1. 2
      lib/community/community_page.dart
  2. 4
      lib/main_page.dart
  3. 34
      lib/settlement/settlement.dart
  4. 48
      lib/settlement/settlement_view/activity_coupon_remarks.dart
  5. 37
      lib/store/store_order.dart
  6. 6
      lib/store/store_view/product_sku.dart
  7. 1
      lib/store/store_view/shop_car.dart
  8. 58
      lib/store/store_view/shop_goods.dart
  9. 18
      lib/store/store_view/store_order_list.dart

2
lib/community/community_page.dart

@ -32,7 +32,7 @@ class _CommunityPage extends State<CommunityPage>
super.initState();
if (tabcontroller == null)
tabcontroller = TabController(length: lables.length, vsync: this);
tabcontroller = TabController(length: lables.length, vsync: this, initialIndex: 1);
}
_toRelease() async {

4
lib/main_page.dart

@ -229,7 +229,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
}
}
final PageController pageController = PageController(initialPage: 1);
final PageController pageController = PageController(initialPage: 0);
@override
Widget build(BuildContext context) {
@ -279,7 +279,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
);
}
var clickIndex = 1;
var clickIndex = 0;
Widget bottomNavigationItem(text, index) {
var isSelected = index == clickIndex;

34
lib/settlement/settlement.dart

@ -109,7 +109,8 @@ class _Settlement extends State<Settlement> {
if (baseData != null && baseData.isSuccess) {
setState(() {
settleOrderInfo = baseData.data;
if (settleOrderInfo.orderProductList == null || settleOrderInfo.orderProductList.length == 0) {
if (settleOrderInfo.orderProductList == null ||
settleOrderInfo.orderProductList.length == 0) {
queryOrderDetails(parentId);
}
});
@ -216,7 +217,8 @@ class _Settlement extends State<Settlement> {
placeOrderFirst.subcribeTime = null;
placeOrderFirst.tableId = "$tableId";
if (tableId == 0) {///
if (tableId == 0) {
///
BaseData<DownOrder> baseData = await minService
.placeOrderFirst(placeOrderFirst.toJson())
.catchError((error) {
@ -227,7 +229,8 @@ class _Settlement extends State<Settlement> {
this.downOrder = baseData.data;
querySettlement();
}
} else { ///
} else {
///
BaseData<DownOrder> baseData;
if (parentId == "") {
baseData = await minService
@ -368,8 +371,9 @@ class _Settlement extends State<Settlement> {
ActivityCouponRemarks(
couponCart,
activityCart,
couponListBean,
promotion,
settleOrderInfo,
coupons,
promotions,
couponCount(),
),
@ -398,9 +402,9 @@ class _Settlement extends State<Settlement> {
),
),
Text(
minOrderInfo != null ?
"${minOrderInfo.orderSumPrice}" :
"${settleOrderInfo == null ? "0" : settleOrderInfo.price}",
minOrderInfo != null
? "${minOrderInfo.orderSumPrice}"
: "${settleOrderInfo == null ? "0" : settleOrderInfo.price}",
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold,
@ -462,6 +466,9 @@ class _Settlement extends State<Settlement> {
return count;
}
String coupons = "";
String promotions = "";
///
couponCart() async {
CouponListBean couponBean = await showModalBottomSheet(
@ -474,13 +481,15 @@ class _Settlement extends State<Settlement> {
);
if (couponBean != null) {
this.couponListBean = couponBean;
this.promotion = null;
coupons = couponListBean.promotionName;
promotions = "";
queryOrderInfo(
address != null ? address.id : null,
selectedBtn,
couponListBean != null ? couponListBean.id : null,
0,
promotion != null ? promotion.id : null);
null,
);
}
}
@ -496,11 +505,12 @@ class _Settlement extends State<Settlement> {
);
if (pro != null) {
this.promotion = pro;
this.couponListBean = null;
promotions = promotion.name;
coupons = "";
queryOrderInfo(
address != null ? address.id : null,
selectedBtn,
couponListBean != null ? couponListBean.id : null,
null,
0,
promotion != null ? promotion.id : null,
);

48
lib/settlement/settlement_view/activity_coupon_remarks.dart

@ -7,15 +7,18 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class ActivityCouponRemarks extends StatefulWidget {
final Function() couponCart;
final Function() activityCart;
final CouponListBean couponListBean;
final PromotionInfoListBean promotion;
final String coupons;
final String promotions;
final SettleOrderInfo settleOrderInfo;
final int couponCount;
ActivityCouponRemarks(
this.couponCart,
this.activityCart,
this.couponListBean,
this.promotion,
this.settleOrderInfo,
this.coupons,
this.promotions,
this.couponCount,
);
@ -26,7 +29,6 @@ class ActivityCouponRemarks extends StatefulWidget {
}
class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
@override
Widget build(BuildContext context) {
return Container(
@ -78,7 +80,7 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
),
),
Text(
widget.promotion == null ? "*优惠券与活动不可同时选择" : widget.promotion.name,
activityText(),
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 14.sp,
@ -116,9 +118,7 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
),
),
Text(
(widget.couponListBean == null)
? ("未使用优惠券")
: widget.couponListBean.promotionName,
couponText(),
textAlign: TextAlign.end,
style: TextStyle(
fontSize: 14.sp,
@ -170,4 +170,34 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
),
);
}
String activityText() {
String promotion = "";
if (widget.promotions == null || widget.promotions == "") {
promotion = "未选择任何活动";
if (widget.settleOrderInfo == null || widget.settleOrderInfo.promotionInfoList == null) {
promotion = "暂无可选活动";
} else if (widget.coupons != null && widget.coupons != "") {
promotion = "活动与优惠券不可同享";
}
} else {
promotion = widget.promotions;
}
return promotion;
}
String couponText() {
String coupon = "";
if (widget.coupons == null || widget.coupons == "") {
coupon = "未选择任何优惠券";
if (widget.settleOrderInfo == null || widget.settleOrderInfo.couponList == null) {
coupon = "暂无可选优惠券";
} else if (widget.promotions != null && widget.promotions != "") {
coupon = "优惠券与活动不可同享";
}
} else {
coupon = widget.coupons;
}
return coupon;
}
}

37
lib/store/store_order.dart

@ -577,26 +577,13 @@ class _StoreOrderPage extends State<StoreOrderPage>
);
}
/// key,UI
GlobalKey shopCartKey = GlobalKey();
///
showShoppingCart() {
queryShopCar().then((value) {
this.shopCarGoods = value;
// showModalBottomSheet(
// context: context,
// backgroundColor: Colors.transparent,
// builder: (context) {
// return ShopCar(
// shopCartKey,
// this.shopCarGoods,
// clearShopCar,
// toDownOrder,
// shopCartAdd,
// shopCartReduce,
// );
// },
// );
dialogShowing = true;
SmartDialog.show(
widget: ShopCar(
@ -626,6 +613,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
///
_queryMiNiDetail(String id) async {
EasyLoading.show(status: S.current.zhengzaijiazai);
BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
if (baseData != null && baseData.isSuccess) {
showStoreSelector(baseData.data, id);
@ -634,6 +622,10 @@ class _StoreOrderPage extends State<StoreOrderPage>
///
showStoreSelector(MiNiDetail miNiDetail, String id) async {
if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1) {
_addShopCar(miNiDetail, [], 1);
} else {
EasyLoading.dismiss();
dialogShowing = true;
SmartDialog.show(
widget: ProductSku(
@ -647,13 +639,18 @@ class _StoreOrderPage extends State<StoreOrderPage>
onDismiss: () {
dialogShowing = false;
},
alignmentTemp: Alignment.bottomCenter,);
alignmentTemp: Alignment.bottomCenter,
);
}
}
///
Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async {
ProductSkuVOListBean productSku =
miNiDetail.productSkuVOList.firstWhere((element) {
ProductSkuVOListBean productSku;
if (selectSkus!= null && selectSkus.length == 0) {
productSku = miNiDetail.productSkuVOList.first;
} else {
productSku = miNiDetail.productSkuVOList.firstWhere((element) {
bool gg = true;
selectSkus.forEach((element1) {
if (element.skuNameStr.indexOf(element1) < 0) {
@ -663,6 +660,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
});
return gg;
});
}
if (productSku == null) return;
String skuId = productSku.id;
String skuValue = selectSkus
@ -693,6 +691,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
},
],
});
EasyLoading.dismiss();
if (baseDate != null && baseDate.isSuccess) {
queryShopCar().then((value) {
this.shopCarGoods = value;
@ -726,8 +725,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) {
this.shopCarGoods = await queryShopCar();
print("shopingCar111111: ${this.shopCarGoods.toJson()}");
if (shopCartKey != null) {
shopCartKey.currentState.setState(() {});
}
@ -746,8 +743,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) {
this.shopCarGoods = await queryShopCar();
print("shopingCar111111: ${this.shopCarGoods.toJson()}");
if (shopCartKey != null) {
shopCartKey.currentState.setState(() {});
}

6
lib/store/store_view/product_sku.dart

@ -177,9 +177,11 @@ class _ProductSku extends State<ProductSku> {
),
],
),
if (widget.miNiDetail.attrList != null && widget.miNiDetail.attrList.length > 0)
SizedBox(
height: 23,
),
if (widget.miNiDetail.attrList != null && widget.miNiDetail.attrList.length > 0)
Expanded(
child: ListView.builder(
itemCount: widget.miNiDetail.attrList.length,
@ -286,6 +288,7 @@ class _ProductSku extends State<ProductSku> {
}
Widget attrItem(Function fc, AttrListBean attrListBean, position) {
if (attrListBean.attrValueList != null && attrListBean.attrValueList.length > 0)
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -303,6 +306,9 @@ class _ProductSku extends State<ProductSku> {
sweetnessStore(fc, attrListBean.attrValueList, position),
],
);
else {
return Container();
}
}
Widget sweetnessStore(Function fc, List<AttrValueListBean> arrays, position) {

1
lib/store/store_view/shop_car.dart

@ -121,6 +121,7 @@ class _ShopCar extends State<ShopCar> {
await widget.shopCartReduce(cart);
setState(() {});
},
isShopCart: true,
count: widget.shopingCar
.shoppingCartSkuItemList[position].buyNum,
shoppingCartSkuItemListBean: widget.shopingCar

58
lib/store/store_view/shop_goods.dart

@ -8,19 +8,21 @@ import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/round_button.dart';
class ShopGoods extends StatefulWidget {
final Function(String id) queryMiNiDetail;
final Function(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) add;
final Function(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) reduce;
final Function(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean)
reduce;
final ProductListBean productListBean;
final ShoppingCartSkuItemListBean shoppingCartSkuItemListBean;
final int count;
final bool isShopCart;
ShopGoods(
this.add,
this.reduce, {
this.productListBean,
this.count = 0,
this.isShopCart = false,
this.queryMiNiDetail,
this.shoppingCartSkuItemListBean,
});
@ -48,8 +50,9 @@ class _ShopGoods extends State<ShopGoods> {
children: [
SizedBox(width: 12.w),
MImage(
widget.productListBean != null ? widget.productListBean.imgPath :
(widget.shoppingCartSkuItemListBean != null
widget.productListBean != null
? widget.productListBean.imgPath
: (widget.shoppingCartSkuItemListBean != null
? widget.shoppingCartSkuItemListBean.skuImg
: ""),
width: 70,
@ -66,7 +69,9 @@ class _ShopGoods extends State<ShopGoods> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
widget.productListBean != null ? widget.productListBean.productName : widget.shoppingCartSkuItemListBean.productName,
widget.productListBean != null
? widget.productListBean.productName
: widget.shoppingCartSkuItemListBean.productName,
style: TextStyle(
color: Colors.black,
fontSize: 13.sp,
@ -76,13 +81,16 @@ class _ShopGoods extends State<ShopGoods> {
SizedBox(
height: 2,
),
///{"id":"1442420413828169728","productId":"1432652566000304128","productName":"桂花乌龙茶","skuName":null,"buyNum":1,"skuStock":1000,"skuImg":"https://pos.upload.gznl.top/1177/2021/08/f855ffb8-d473-4f5f-93c9-5907b539b2fd.jpg",
///"skuPrice":"0.00","selected":1,"storeId":null,"groupId":"1426067376096411648","createTime":"2021-10-20 10:27:46","tableId":null,"platterList":null}
Row(
children: [
Expanded(
child: Text(
(widget.productListBean != null ? widget.productListBean.shortName : widget.shoppingCartSkuItemListBean.skuName ?? ""),
(widget.productListBean != null
? widget.productListBean.shortName
: widget.shoppingCartSkuItemListBean.skuName ?? ""),
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
@ -154,8 +162,12 @@ class _ShopGoods extends State<ShopGoods> {
],
),
Spacer(),
if (widget.count == 0)
RoundButton(
if (!widget.isShopCart)
Stack(
children: [
Container(
margin: EdgeInsets.only(right: 8, top: 4),
child: RoundButton(
width: 49.w,
text: S.of(context).xuanguige,
textColor: Colors.white,
@ -166,10 +178,32 @@ class _ShopGoods extends State<ShopGoods> {
padding: EdgeInsets.symmetric(vertical: 5.h),
callback: () {
widget.queryMiNiDetail(
widget.productListBean != null ? widget.productListBean.id : widget.shoppingCartSkuItemListBean.productId);
widget.productListBean != null
? widget.productListBean.id
: widget.shoppingCartSkuItemListBean
.productId);
},
),
if (widget.count > 0)
),
Positioned(
right: 0,
child: Visibility(
visible: widget.count > 0,
child: RoundButton(
width: 17,
height: 17,
text: "${widget.count}",
textColor: Color(0xFF32A060),
fontWeight: MyFontWeight.regular,
backgroup: Colors.white,
fontSize: 12.sp,
radius: 100,
),
),
),
],
),
if (widget.isShopCart)
InkWell(
onTap: () {
widget.reduce(widget.shoppingCartSkuItemListBean);
@ -180,7 +214,7 @@ class _ShopGoods extends State<ShopGoods> {
height: 22,
),
),
if (widget.count > 0)
if (widget.isShopCart)
Container(
width: 30,
alignment: Alignment.center,
@ -193,7 +227,7 @@ class _ShopGoods extends State<ShopGoods> {
),
),
),
if (widget.count > 0)
if (widget.isShopCart)
InkWell(
onTap: () {
widget.add(widget.shoppingCartSkuItemListBean);

18
lib/store/store_view/store_order_list.dart

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart';
import 'package:huixiang/retrofit/data/shoppingCart.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart';
@ -19,6 +20,7 @@ class StoreOrderListPage extends StatefulWidget {
final StoreInfo storeInfo;
final ScrollController controller;
final Function(String id) queryMiNiDetail;
ShoppingCart shopCarGoods;
StoreOrderListPage(
@ -44,6 +46,9 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
List<FindMiNiGroupList> appletProducts;
List<ProductListBean> productListBeans = [];
ScrollController controller1 = ScrollController();
ScrollController controller2 = ScrollController();
@override
void initState() {
super.initState();
@ -83,8 +88,6 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
}
}
// RefreshController refreshController;
@override
Widget build(BuildContext context) {
return Container(
@ -114,8 +117,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
Container(
width: MediaQuery.of(context).size.width - 100.w,
child: ListView.builder(
itemCount:
productListBeans == null ? 0 : productListBeans.length,
itemCount: productListBeans == null ? 0 : productListBeans.length,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
@ -129,9 +131,6 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
);
}
ScrollController controller1 = ScrollController();
ScrollController controller2 = ScrollController();
Widget orderItem(FindMiNiGroupList findMiNiGroupList, int index) {
int count = calculateItemCount(findMiNiGroupList);
return Container(
@ -235,13 +234,14 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
},
child: ShopGoods(
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
widget.queryMiNiDetail(productListBeans[position].id);
// widget.add(productListBeans[position].id);
},
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
widget.queryMiNiDetail(productListBeans[position].id);
// widget.reduce(productListBeans[position].id);
},
productListBean: productListBeans[position],
count: count,
isShopCart: false,
queryMiNiDetail: widget.queryMiNiDetail,
shoppingCartSkuItemListBean: shoppingCartSkuItemListBean,
),

Loading…
Cancel
Save