Browse Source

点单页列表更改;

增加可0元购;
zyh
w-R 3 years ago
parent
commit
b09c747dc7
  1. 3
      lib/order/order_detail_page.dart
  2. 2
      lib/retrofit/data/findMiNiGroupList.dart
  3. 2
      lib/settlement/settlement.dart
  4. 14
      lib/store/store_order.dart
  5. 5
      lib/store/store_view/shop_goods.dart
  6. 180
      lib/store/store_view/store_order_list.dart
  7. 2
      pubspec.yaml

3
lib/order/order_detail_page.dart

@ -167,6 +167,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
), ),
/// ///
if(orderInfo != null)
OrderAddress( OrderAddress(
orderStatus, orderStatus,
isTakeOut, isTakeOut,
@ -181,9 +182,11 @@ class _OrderDetailPage extends State<OrderDetailPage> {
), ),
/// ///
if(orderInfo != null)
OrderCommodity(orderInfo), OrderCommodity(orderInfo),
/// ///
if(orderInfo != null)
OrderInfoView(orderInfo, isTakeOut), OrderInfoView(orderInfo, isTakeOut),
Container( Container(

2
lib/retrofit/data/findMiNiGroupList.dart

@ -12,6 +12,8 @@ class FindMiNiGroupList {
String groupName; String groupName;
String groupImg; String groupImg;
int sort; int sort;
double goodsIndex = 0;
double height = 0;
List<ProductListBean> productList; List<ProductListBean> productList;
dynamic productPageVO; dynamic productPageVO;

2
lib/settlement/settlement.dart

@ -453,7 +453,7 @@ class _Settlement extends State<Settlement> {
placeOrderFirst.orderTypeId = 0; placeOrderFirst.orderTypeId = 0;
placeOrderFirst.parentCode = parentCode; // placeOrderFirst.parentCode = parentCode; //
placeOrderFirst.parentId = parentId; // placeOrderFirst.parentId = parentId; //
placeOrderFirst.payChannel = payChannel; placeOrderFirst.payChannel = ((placeOrderFirst.cartSum == "0.00") ? payChannel = 0 : payChannel);
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
placeOrderFirst.promotionInfoDTO.promotionId = placeOrderFirst.promotionInfoDTO.promotionId =
(promotion != null && tableId <= 0) ? promotion.id : ""; (promotion != null && tableId <= 0) ? promotion.id : "";

14
lib/store/store_order.dart

@ -207,7 +207,17 @@ class _StoreOrderPage extends State<StoreOrderPage>
@override @override
Widget build(BuildContext context) { 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, color: Colors.white,
child: Stack( child: Stack(
children: [ children: [
@ -540,7 +550,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
), ),
), ),
], ],
)); )));
} }
/// ///

5
lib/store/store_view/shop_goods.dart

@ -41,7 +41,7 @@ class _ShopGoods extends State<ShopGoods> {
color: Colors.white, color: Colors.white,
padding: EdgeInsets.only( padding: EdgeInsets.only(
right: 16.w, right: 16.w,
bottom: 30.h, // bottom: 20.h,
top: 10.h, top: 10.h,
), ),
child: Row( child: Row(
@ -77,6 +77,8 @@ class _ShopGoods extends State<ShopGoods> {
widget.productListBean != null widget.productListBean != null
? widget.productListBean.productName ? widget.productListBean.productName
: widget.shoppingCartSkuItemListBean.productName, : widget.shoppingCartSkuItemListBean.productName,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 13.sp, fontSize: 13.sp,
@ -250,7 +252,6 @@ class _ShopGoods extends State<ShopGoods> {
), ),
Text( Text(
"${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}", "${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}",
// "¥191.00",
style: TextStyle( style: TextStyle(
color: Color(0xFFA29E9E), color: Color(0xFFA29E9E),
fontSize: 12.sp, fontSize: 12.sp,

180
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(String id, int count) queryMiNiDetail;
final Function queryShoppingCart; final Function queryShoppingCart;
ShoppingCart shopCarGoods; ShoppingCart shopCarGoods;
StoreOrderListPage( StoreOrderListPage(
@ -47,32 +46,43 @@ class StoreOrderListPage extends StatefulWidget {
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;
MinApiService minService; MinApiService minService;
List<FindMiNiGroupList> appletProducts; List<FindMiNiGroupList> appletProducts;
List<ProductListBean> productListBeans = []; List<ProductListBean> productListBeans = [];
int currentIndex = 0;
ScrollController controller = ScrollController(); final ScrollController controller = ScrollController();
@override @override
void initState() { void initState() {
super.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();
} }
/// ///
appletGoods() async { appletGoods() async {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
minService = MinApiService( minService = MinApiService(Dio(),
Dio(),
context: context, context: context,
token: widget.minToken, token: widget.minToken,
tenant: widget.tenant, tenant: widget.tenant,
storeId: widget.arguments["id"], storeId: widget.arguments["id"],
showLoading: true showLoading: true);
);
BaseData<List<FindMiNiGroupList>> baseData = BaseData<List<FindMiNiGroupList>> baseData =
await minService.findMiNiGroupList({ await minService.findMiNiGroupList({
@ -83,10 +93,16 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
// refreshController.refreshCompleted(); // refreshController.refreshCompleted();
setState(() { setState(() {
appletProducts = baseData.data; appletProducts = baseData.data ?? [];
productListBeans.clear(); // productListBeans.clear();
if (appletProducts.length > 0) // if (appletProducts.length > 0)
productListBeans.addAll(appletProducts[isSelected].productList); // 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 { } else {
// refreshController.refreshFailed(); // refreshController.refreshFailed();
@ -110,74 +126,95 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
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: controller, // controller: controller,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.only(top: 0, bottom: 25), padding: EdgeInsets.only(top: 0, bottom: 25),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return orderItem(appletProducts[position], position); return GestureDetector(
onTap: () {
},
child: orderItem(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 ? 0 : productListBeans.length, itemCount: appletProducts == null ? 0 : appletProducts.length,
controller: controller,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
padding: EdgeInsets.zero, padding: EdgeInsets.only(top: 0, bottom: 25),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return rightOrderItem(position);
onTap: () {
if (widget.storeInfo.posType.code ==
"NORMALSTORE" &&
widget.storeInfo.storeName == "百年川椒(光谷店)"||widget.storeInfo.storeName == "百年川椒(汉街店)"||widget.storeInfo.storeName == "回乡农场火锅")
return;
else
goShopDetailsPage(position);
},
child: goodsItem(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{ goShopDetailsPage(ProductListBean e) async {
await Navigator.of(context).pushNamed('/router/shop_details_page',arguments: { await Navigator.of(context)
"id":productListBeans[position].id, .pushNamed('/router/shop_details_page', arguments: {
"storeId":productListBeans[position].storeId, "id": e.id,
"storeId": e.storeId,
}); });
widget.queryShoppingCart(); widget.queryShoppingCart();
} }
Widget orderItem(FindMiNiGroupList findMiNiGroupList, int index) { Widget orderItem(int index) {
int count = calculateItemCount(findMiNiGroupList); int count = calculateItemCount(appletProducts[index]);
return Container( return Container(
width: 100, width: 100,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
isSelected = index; // isSelected = index;
productListBeans.clear(); // productListBeans.clear();
productListBeans.addAll(findMiNiGroupList.productList); // productListBeans.addAll(appletProducts[index].productList);
controller.animateTo(appletProducts[index].goodsIndex,
duration: Duration(milliseconds: 300),
curve: Curves.ease);
}); });
}, },
child: Stack( child: Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
Container( Container(
color: isSelected != index ? Color(0xFFFAFAFA) : Colors.white, color: currentIndex != index ? Color(0xFFFAFAFA) : Colors.white,
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.all(15), padding: EdgeInsets.all(15),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
if (isSelected == index) if (currentIndex == index)
Container( Container(
width: 2, width: 2,
height: 17, height: 17,
@ -186,14 +223,15 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
), ),
Expanded( Expanded(
child: Text( child: Text(
findMiNiGroupList.groupName, appletProducts[index].groupName,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: isSelected != index color: currentIndex != index
? Color(0xFF202020) ? Color(0xFF4D4D4D)
: Color(0xFF000000), : Color(0xFF000000),
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.medium, fontWeight: currentIndex != index
? MyFontWeight.medium : MyFontWeight.semi_bold ,
), ),
), ),
flex: 1, flex: 1,
@ -223,6 +261,51 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
); );
} }
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) { int calculateItemCount(FindMiNiGroupList findMiNiGroupList) {
if (widget.shopCarGoods == null) return 0; if (widget.shopCarGoods == null) return 0;
int count = 0; int count = 0;
@ -236,12 +319,12 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
return count; return count;
} }
Widget goodsItem(position) { Widget goodsItem(ProductListBean e) {
ShoppingCartSkuItemListBean shoppingCartSkuItemListBean; ShoppingCartSkuItemListBean shoppingCartSkuItemListBean;
int count = 0; int count = 0;
if (widget.shopCarGoods != null) { if (widget.shopCarGoods != null) {
widget.shopCarGoods.shoppingCartSkuItemList.forEach((element) { widget.shopCarGoods.shoppingCartSkuItemList.forEach((element) {
if (productListBeans[position].id == element.productId) { if (e.id == element.productId) {
if (shoppingCartSkuItemListBean == null) { if (shoppingCartSkuItemListBean == null) {
shoppingCartSkuItemListBean = element; shoppingCartSkuItemListBean = element;
count = shoppingCartSkuItemListBean.buyNum; count = shoppingCartSkuItemListBean.buyNum;
@ -253,13 +336,12 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
} }
return ShopGoods( return ShopGoods(
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
widget.queryMiNiDetail(productListBeans[position].id, 1); widget.queryMiNiDetail(e.id, 1);
}, },
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
if (count > 0) if (count > 0) widget.queryMiNiDetail(e.id, -1);
widget.queryMiNiDetail(productListBeans[position].id, -1);
}, },
productListBean: productListBeans[position], productListBean: e,
count: count, count: count,
isShopCart: false, isShopCart: false,
queryMiNiDetail: widget.queryMiNiDetail, queryMiNiDetail: widget.queryMiNiDetail,

2
pubspec.yaml

@ -3,7 +3,7 @@ description: 一心回乡.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev 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: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save