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. 192
      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(
orderStatus,
isTakeOut,
@ -181,9 +182,11 @@ class _OrderDetailPage extends State<OrderDetailPage> {
),
///
if(orderInfo != null)
OrderCommodity(orderInfo),
///
if(orderInfo != null)
OrderInfoView(orderInfo, isTakeOut),
Container(

2
lib/retrofit/data/findMiNiGroupList.dart

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

2
lib/settlement/settlement.dart

@ -453,7 +453,7 @@ class _Settlement extends State<Settlement> {
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 : "";

14
lib/store/store_order.dart

@ -207,7 +207,17 @@ class _StoreOrderPage extends State<StoreOrderPage>
@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<StoreOrderPage>
),
),
],
));
)));
}
///

5
lib/store/store_view/shop_goods.dart

@ -41,7 +41,7 @@ class _ShopGoods extends State<ShopGoods> {
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<ShopGoods> {
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<ShopGoods> {
),
Text(
"${AppUtils.calculateDouble(double.tryParse(widget.isShopCart ? widget.shoppingCartSkuItemListBean.skuPrice : widget.productListBean.applyPrice) ?? 0)}",
// "¥191.00",
style: TextStyle(
color: Color(0xFFA29E9E),
fontSize: 12.sp,

192
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<StoreOrderListPage> {
int isSelected = 0;
int tempClickIndex = 0;
// int tempClickIndex = 0;
ApiService apiService;
MinApiService minService;
List<FindMiNiGroupList> appletProducts;
List<ProductListBean> 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<List<FindMiNiGroupList>> baseData =
await minService.findMiNiGroupList({
@ -83,10 +93,16 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
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<StoreOrderListPage> {
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<StoreOrderListPage> {
),
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<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) {
if (widget.shopCarGoods == null) return 0;
int count = 0;
@ -236,12 +319,12 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
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<StoreOrderListPage> {
}
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,

2
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"

Loading…
Cancel
Save