diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index 80f071ca..200147c6 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -167,6 +167,7 @@ class _OrderDetailPage extends State { ), ///订单取货地址,或, 收货地址 + if(orderInfo != null) OrderAddress( orderStatus, isTakeOut, @@ -181,9 +182,11 @@ class _OrderDetailPage extends State { ), ///订单商品 + if(orderInfo != null) OrderCommodity(orderInfo), ///显示订单信息 + if(orderInfo != null) OrderInfoView(orderInfo, isTakeOut), Container( diff --git a/lib/retrofit/data/findMiNiGroupList.dart b/lib/retrofit/data/findMiNiGroupList.dart index f43552ed..6b5a7d9b 100644 --- a/lib/retrofit/data/findMiNiGroupList.dart +++ b/lib/retrofit/data/findMiNiGroupList.dart @@ -12,6 +12,8 @@ class FindMiNiGroupList { String groupName; String groupImg; int sort; + double goodsIndex = 0; + double height = 0; List productList; dynamic productPageVO; diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 9c2b869f..71b46cfc 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -453,7 +453,7 @@ class _Settlement extends State { placeOrderFirst.orderTypeId = 0; placeOrderFirst.parentCode = parentCode; // 火锅加菜 placeOrderFirst.parentId = parentId; // 火锅加菜 - placeOrderFirst.payChannel = payChannel; + placeOrderFirst.payChannel = ((placeOrderFirst.cartSum == "0.00") ? payChannel = 0 : payChannel); placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); placeOrderFirst.promotionInfoDTO.promotionId = (promotion != null && tableId <= 0) ? promotion.id : ""; diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 158d90ac..0ec4ca31 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -207,7 +207,17 @@ class _StoreOrderPage extends State @override Widget build(BuildContext context) { - return Container( + return WillPopScope( + onWillPop: () async { + if (dialogShowing) { + debugPrint("ssssasdadsasdadasd"); + SmartDialog.dismiss(); + return false; + } else { + return true; + } + }, + child:Container( color: Colors.white, child: Stack( children: [ @@ -540,7 +550,7 @@ class _StoreOrderPage extends State ), ), ], - )); + ))); } ///领取优惠券 diff --git a/lib/store/store_view/shop_goods.dart b/lib/store/store_view/shop_goods.dart index 871de64e..b06ebb64 100644 --- a/lib/store/store_view/shop_goods.dart +++ b/lib/store/store_view/shop_goods.dart @@ -41,7 +41,7 @@ class _ShopGoods extends State { color: Colors.white, padding: EdgeInsets.only( right: 16.w, - bottom: 30.h, + // bottom: 20.h, top: 10.h, ), child: Row( @@ -77,6 +77,8 @@ class _ShopGoods extends State { widget.productListBean != null ? widget.productListBean.productName : widget.shoppingCartSkuItemListBean.productName, + overflow: TextOverflow.ellipsis, + maxLines: 2, style: TextStyle( color: Colors.black, fontSize: 13.sp, @@ -250,7 +252,6 @@ class _ShopGoods extends State { ), Text( "¥${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}", - // "¥191.00", style: TextStyle( color: Color(0xFFA29E9E), fontSize: 12.sp, diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index a4545452..e69ce32f 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -24,7 +24,6 @@ class StoreOrderListPage extends StatefulWidget { final Function(String id, int count) queryMiNiDetail; final Function queryShoppingCart; - ShoppingCart shopCarGoods; StoreOrderListPage( @@ -36,7 +35,7 @@ class StoreOrderListPage extends StatefulWidget { this.minToken, this.tenant, this.queryMiNiDetail, - this.queryShoppingCart, + this.queryShoppingCart, ); @override @@ -47,32 +46,43 @@ class StoreOrderListPage extends StatefulWidget { class _StoreOrderListPage extends State { int isSelected = 0; - int tempClickIndex = 0; + + // int tempClickIndex = 0; ApiService apiService; MinApiService minService; List appletProducts; List productListBeans = []; - - ScrollController controller = ScrollController(); + int currentIndex = 0; + final ScrollController controller = ScrollController(); @override void initState() { super.initState(); - + controller.addListener(() { + for (int i = 0; i < appletProducts.length; i++) { + if (currentIndex != i && + controller.offset >= appletProducts[i].goodsIndex && + (i == appletProducts.length - 1 || + controller.offset < appletProducts[i + 1].goodsIndex)) { + setState(() { + currentIndex = i; + }); + break; + } + } + }); appletGoods(); } ///小程序查询分组及商品列表 appletGoods() async { SharedPreferences value = await SharedPreferences.getInstance(); - minService = MinApiService( - Dio(), - context: context, - token: widget.minToken, - tenant: widget.tenant, - storeId: widget.arguments["id"], - showLoading: true - ); + minService = MinApiService(Dio(), + context: context, + token: widget.minToken, + tenant: widget.tenant, + storeId: widget.arguments["id"], + showLoading: true); BaseData> baseData = await minService.findMiNiGroupList({ @@ -83,10 +93,16 @@ class _StoreOrderListPage extends State { if (baseData != null && baseData.isSuccess) { // refreshController.refreshCompleted(); setState(() { - appletProducts = baseData.data; - productListBeans.clear(); - if (appletProducts.length > 0) - productListBeans.addAll(appletProducts[isSelected].productList); + appletProducts = baseData.data ?? []; + // productListBeans.clear(); + // if (appletProducts.length > 0) + // productListBeans.addAll(appletProducts[isSelected].productList); + double goodsIndex = 0; + appletProducts.forEach((element) { + element.goodsIndex = goodsIndex; + element.height = ((element.productList.length ?? 0) * 90.h + 76.h); + goodsIndex += element.height; + }); }); } else { // refreshController.refreshFailed(); @@ -110,74 +126,95 @@ class _StoreOrderListPage extends State { width: 100.w, child: ListView.builder( itemCount: appletProducts == null ? 0 : appletProducts.length, - controller: controller, + // controller: controller, physics: BouncingScrollPhysics(), shrinkWrap: true, padding: EdgeInsets.only(top: 0, bottom: 25), itemBuilder: (context, position) { - return orderItem(appletProducts[position], position); + return GestureDetector( + onTap: () { + }, + child: orderItem(position), + ); }, ), ), Container( width: MediaQuery.of(context).size.width - 100.w, child: ListView.builder( - itemCount: productListBeans == null ? 0 : productListBeans.length, + itemCount: appletProducts == null ? 0 : appletProducts.length, + controller: controller, physics: BouncingScrollPhysics(), shrinkWrap: true, - padding: EdgeInsets.zero, + padding: EdgeInsets.only(top: 0, bottom: 25), itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - if (widget.storeInfo.posType.code == - "NORMALSTORE" && - widget.storeInfo.storeName == "百年川椒(光谷店)"||widget.storeInfo.storeName == "百年川椒(汉街店)"||widget.storeInfo.storeName == "回乡农场火锅") - return; - else - goShopDetailsPage(position); - }, - child: goodsItem(position), - ); + return rightOrderItem(position); }, ), ), + // Container( + // width: MediaQuery.of(context).size.width - 100.w, + // child: ListView.builder( + // itemCount: productListBeans == null ? 0 : productListBeans.length, + // physics: BouncingScrollPhysics(), + // shrinkWrap: true, + // padding: EdgeInsets.zero, + // itemBuilder: (context, position) { + // return GestureDetector( + // onTap: () { + // if (widget.storeInfo.posType.code == + // "NORMALSTORE" && + // widget.storeInfo.storeName == "百年川椒(光谷店)"||widget.storeInfo.storeName == "百年川椒(汉街店)"||widget.storeInfo.storeName == "回乡农场火锅") + // return; + // else + // goShopDetailsPage(position); + // }, + // child: goodsItem(position), + // ); + // }, + // ), + // ), ], ), ); } - goShopDetailsPage(position) async{ - await Navigator.of(context).pushNamed('/router/shop_details_page',arguments: { - "id":productListBeans[position].id, - "storeId":productListBeans[position].storeId, + goShopDetailsPage(ProductListBean e) async { + await Navigator.of(context) + .pushNamed('/router/shop_details_page', arguments: { + "id": e.id, + "storeId": e.storeId, }); - widget. queryShoppingCart(); + widget.queryShoppingCart(); } - Widget orderItem(FindMiNiGroupList findMiNiGroupList, int index) { - int count = calculateItemCount(findMiNiGroupList); + Widget orderItem(int index) { + int count = calculateItemCount(appletProducts[index]); return Container( width: 100, child: GestureDetector( onTap: () { setState(() { - isSelected = index; - productListBeans.clear(); - productListBeans.addAll(findMiNiGroupList.productList); + // isSelected = index; + // productListBeans.clear(); + // productListBeans.addAll(appletProducts[index].productList); + controller.animateTo(appletProducts[index].goodsIndex, + duration: Duration(milliseconds: 300), + curve: Curves.ease); }); }, child: Stack( alignment: Alignment.center, children: [ Container( - color: isSelected != index ? Color(0xFFFAFAFA) : Colors.white, + color: currentIndex != index ? Color(0xFFFAFAFA) : Colors.white, alignment: Alignment.center, padding: EdgeInsets.all(15), child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - if (isSelected == index) + if (currentIndex == index) Container( width: 2, height: 17, @@ -186,14 +223,15 @@ class _StoreOrderListPage extends State { ), Expanded( child: Text( - findMiNiGroupList.groupName, + appletProducts[index].groupName, textAlign: TextAlign.center, style: TextStyle( - color: isSelected != index - ? Color(0xFF202020) + color: currentIndex != index + ? Color(0xFF4D4D4D) : Color(0xFF000000), fontSize: 12.sp, - fontWeight: MyFontWeight.medium, + fontWeight: currentIndex != index + ? MyFontWeight.medium : MyFontWeight.semi_bold , ), ), flex: 1, @@ -223,6 +261,51 @@ class _StoreOrderListPage extends State { ); } + Widget rightOrderItem(int rightIndex) { + return Container( + color: Colors.white, + padding: EdgeInsets.only( + right: 16.w, + bottom: 30.h, + top: 10.h, + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Padding( + padding: EdgeInsets.only(left: 16.w, bottom: 24.h), + child: Text( + appletProducts[rightIndex].groupName, + textAlign: TextAlign.center, + style: TextStyle( + color: Color(0xFF000000), + fontSize: 12.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + ), + Column( + children: appletProducts[rightIndex].productList.map((e) { + return GestureDetector( + onTap: (){ + if (widget.storeInfo.posType.code == + "NORMALSTORE" && + widget.storeInfo.storeName == "百年川椒(光谷店)"||widget.storeInfo.storeName == "百年川椒(汉街店)"||widget.storeInfo.storeName == "回乡农场火锅") + return; + else + goShopDetailsPage(e); + }, + child:goodsItem(e), + ); + }).toList() ?? + [], + ) + ], + ), + ); + } + int calculateItemCount(FindMiNiGroupList findMiNiGroupList) { if (widget.shopCarGoods == null) return 0; int count = 0; @@ -236,12 +319,12 @@ class _StoreOrderListPage extends State { return count; } - Widget goodsItem(position) { + Widget goodsItem(ProductListBean e) { ShoppingCartSkuItemListBean shoppingCartSkuItemListBean; int count = 0; if (widget.shopCarGoods != null) { widget.shopCarGoods.shoppingCartSkuItemList.forEach((element) { - if (productListBeans[position].id == element.productId) { + if (e.id == element.productId) { if (shoppingCartSkuItemListBean == null) { shoppingCartSkuItemListBean = element; count = shoppingCartSkuItemListBean.buyNum; @@ -253,13 +336,12 @@ class _StoreOrderListPage extends State { } return ShopGoods( (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { - widget.queryMiNiDetail(productListBeans[position].id, 1); + widget.queryMiNiDetail(e.id, 1); }, (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { - if (count > 0) - widget.queryMiNiDetail(productListBeans[position].id, -1); + if (count > 0) widget.queryMiNiDetail(e.id, -1); }, - productListBean: productListBeans[position], + productListBean: e, count: count, isShopCart: false, queryMiNiDetail: widget.queryMiNiDetail, diff --git a/pubspec.yaml b/pubspec.yaml index e29f45e9..c8a172b8 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: 一心回乡. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 2.0.26+14 +version: 2.0.28+16 environment: sdk: ">=2.7.0 <3.0.0"