Browse Source

购物车勾选;

zyh
w-R 3 years ago
parent
commit
4a7a130675
  1. 35
      lib/mine/mine_page.dart
  2. 5
      lib/mine/mine_view/mine_item.dart
  3. 1
      lib/retrofit/data/shoppingCart.dart
  4. 2
      lib/settlement/settlement_view/distribution.dart
  5. 15
      lib/store/shopping/activity_prefecture_details.dart
  6. 203
      lib/store/shopping/shopping_cart/cart_goods_list.dart
  7. 379
      lib/store/shopping/shopping_cart/shopping_cart_page.dart
  8. 155
      lib/store/shopping/shopping_goods_details.dart
  9. 41
      lib/store/shopping/shopping_home/search_page.dart
  10. 243
      lib/store/shopping/shopping_mall_home.dart
  11. 2
      lib/union/union_page.dart

35
lib/mine/mine_page.dart

@ -187,9 +187,6 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
},
),
/////
attention(),
/// VIP等级信息
MineVipView(
tag: "vip",
@ -199,10 +196,15 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
rankMax: userInfo?.memberRankVo?.nextOrigin??0,
createTime: userInfo?.createTime??"",
),
],
),
),
/////
attention(),
///
WalletCoupon(),
@ -300,7 +302,20 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
/////
Widget attention(){
return Container(
margin: EdgeInsets.only(left: 16,top: 10),
padding: EdgeInsets.only(bottom: 16,top: 16),
margin: EdgeInsets.only(left: 16,top:16,right: 16),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child:GestureDetector(
onTap:(){
Navigator.of(context).pushNamed(
@ -320,7 +335,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
);
},
child:
Row(
Column(
children: [
Text(
S.of(context).guanzhu,
@ -330,7 +345,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
fontWeight: MyFontWeight.regular,
),
),
SizedBox(width: 5,),
SizedBox(height: 5,),
Text(
infoNumber != null ?infoNumber.follow.toString() :"0",
style: TextStyle(
@ -350,7 +365,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
);
},
child:
Row(
Column(
children: [
Text(
S.of(context).fensi,
@ -360,7 +375,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
fontWeight: MyFontWeight.regular,
),
),
SizedBox(width: 5,),
SizedBox(height: 5,),
Text(
infoNumber != null ?infoNumber.fans.toString() :"0",
style: TextStyle(
@ -380,7 +395,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
);
},
child:
Row(
Column(
children: [
Text(
"成就",
@ -390,7 +405,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
fontWeight: MyFontWeight.regular,
),
),
SizedBox(width: 5,),
SizedBox(height: 5,),
Text(
infoNumber != null ?infoNumber.achievementNumber.toString() :"0",
style: TextStyle(

5
lib/mine/mine_view/mine_item.dart

@ -16,7 +16,7 @@ class _MineItem extends State<MineItem> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.fromLTRB(16.w, 10.h, 16.w, 28.h),
margin: EdgeInsets.fromLTRB(16.w, 10.h, 16.w, 6.h),
padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
decoration: BoxDecoration(
color: Colors.white,
@ -134,7 +134,8 @@ class _MineItem extends State<MineItem> {
SizedBox(height: 10.h,),
Row(
children: [
Expanded(child: InkWell(
Expanded(child:
InkWell(
onTap: () {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||

1
lib/retrofit/data/shoppingCart.dart

@ -18,7 +18,6 @@ class ShoppingCart {
int selectDiscount;
String storeName;
String tableId;
bool isSelect;
List<PromotionInfoListBean> promotionInfoList;
List<CouponListBean> couponList;

2
lib/settlement/settlement_view/distribution.dart

@ -86,7 +86,7 @@ class _DistributionMode extends State<DistributionMode> {
@override
Widget build(BuildContext context) {
return Container(
height: 143.h,
height: 147.h,
margin: EdgeInsets.only(
left: 16,
right: 16,

15
lib/store/shopping/activity_prefecture_details.dart

@ -77,8 +77,6 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
});
});
// testTime = "${DateTime.now().year}-${DateTime.now().month}-${DateTime.now().day} 08:00:20";
pageType = widget.arguments["type"];
storeId = widget.arguments["storeId"];
tenant = widget.arguments["tenant"];
@ -99,11 +97,10 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
showLoading: false,
);
apiService.minLogin(storeId).catchError((onError) {
debugPrint(onError);
debugPrint(onError.toString());
}).then((baseData) {
if (baseData != null && baseData.isSuccess) {
Map<String, dynamic> minStoreInfo = baseData.data;
minToken = minStoreInfo["token"];
minToken = baseData.data["token"];
queryStoreInfo();
SharedPreferences.getInstance().then(
(value) => {
@ -120,7 +117,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
storeId: storeId,
showLoading: false,
);
queryFindActListByType(pageType == "2" ?false:true);
queryStoreInfo();
EasyLoading.dismiss();
}
@ -562,7 +560,6 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
///
Widget seckilList() {
// var tStatus = timeFlag(actTimeList[actTimeListIndex].actTime.startHour);
return Container(
height: MediaQuery.of(context).size.height -
62.h -
@ -790,7 +787,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
color: Color(0xFFF5F5F5),
),
Container(
width: 100.w,
width:productList.sellCount == 0 ? 0 :(((productList?.sellCount ?? 0)/(productList?.productStock ?? 0)) * 180.w).toDouble(),
height: 8.h,
decoration: BoxDecoration(
gradient: LinearGradient(
@ -807,7 +804,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
width: 5,
),
Text(
"已售${productList.sellCount}",
"已售${productList.sellCount}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,

203
lib/store/shopping/shopping_cart/cart_goods_list.dart

@ -1,203 +0,0 @@
import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class CartGoodsList extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _CartGoodsList();
}
}
class _CartGoodsList extends State<CartGoodsList> {
RefreshController refreshController = RefreshController();
ApiService apiService;
int pageNum = 0;
@override
void initState() {
super.initState();
_onRefresh();
}
_onRefresh() async {
pageNum = 0;
setState(() {});
}
@override
Widget build(BuildContext context) {
return Container(
height: MediaQuery.of(context).size.height -
103.h -
MediaQuery.of(context).padding.top,
child: SmartRefresher(
controller: refreshController,
enablePullUp: false,
enablePullDown: true,
physics: BouncingScrollPhysics(),
header: MyHeader(),
onRefresh: () {
},
child: ListView.builder(
itemCount:6,
padding: EdgeInsets.only(
top: 8.h,
bottom: 84.h, /* + (375.h - 88.h) + 4.h*/
),
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
onTap: () {
},
child: cartGoodsItem(),
);
}),
),
);
}
Widget cartGoodsItem() {
return Container(
margin: EdgeInsets.all(16),
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
color: Colors.white,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
// ? "assets/image/icon_radio_selected.png" :
"assets/image/icon_radio_unselected.png",
width:16,
height:16,
),
SizedBox(width: 16.w),
// MImage(
// "assets/image/icon_story_td.png",
// isCircle: true,
// width:81,
// height:81,
// fit: BoxFit.cover,
// errorSrc: "assets/image/default_1.png",
// fadeSrc: "assets/image/default_1.png",
// ),
Image.asset(
"assets/image/icon_story_td.png",
width: 81,
height: 81,
fit: BoxFit.cover,
),
SizedBox(width: 10.w),
Expanded(child:
Container(
height:81.h,child:Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"[生态小农]山林放养鸡蛋30枚/盒",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
),
),
// SizedBox(height: 5.h),
Text(
"套盒装",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF727272),
),
),
// SizedBox(height: 5.h),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(child:Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
),
),
TextSpan(
text: "58.2",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
),
),
],
),
)),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,children: [
InkWell(
onTap: () {
setState(() {
});
},
child: Image.asset(
"assets/image/reduce.png",
width: 22,
height: 22,
),
),
Container(
width: 30,
alignment: Alignment.center,
child: Text(
"1",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
),
InkWell(
onTap: () {
},
child: Image.asset(
"assets/image/add.png",
width: 22,
height: 22,
),
),
],)
],
),
],
)),),
],
),
);
}
}

379
lib/store/shopping/shopping_cart/shopping_cart_page.dart

@ -1,7 +1,7 @@
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
@ -9,23 +9,22 @@ import 'package:huixiang/retrofit/data/shoppingCart.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/shopping/shopping_home/recommend_goods_list_view.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'cart_goods_list.dart';
class ShoppingCartPage extends StatefulWidget {
final String minToken;
final String storeId;
final String tenant;
final StoreInfo storeInfo;
ShoppingCartPage(this.minToken,this.storeId, this.tenant);
ShoppingCartPage(this.minToken,this.storeId, this.tenant,this.storeInfo);
@override
State<StatefulWidget> createState() {
return _ShoppingCartPage();
@ -36,7 +35,6 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
with AutomaticKeepAliveClientMixin {
ApiService apiService;
MinApiService minService;
// ShoppingCart shopCarGoods;
List<ShoppingCart> shopCarGoods = [];
String pName;
String pid;
@ -44,35 +42,62 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
String cid;
int tableId = 0;
bool topIndex = false;
bool isAllSelect = false;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) {
minService = MinApiService(
Dio(),
context: context,
token: widget.minToken,
tenant: widget.tenant,
storeId: widget.storeId,
showLoading: false,
);
queryShopCar();
});
}
///
clearShopCar() async {
BaseData<bool> baseData = await minService.clearShoppingCart();
if (baseData.isSuccess) {
shopCarGoods = null;
setState(() {});
queryShopCar();
}
}
///
///
toDownOrder() async {
// int num = count();
// if (num == 0) {
// SmartDialog.showToast("请先选择您要购买的商品!~");
// return;
// }
await Navigator.of(context).pushNamed(
'/router/settlement',
arguments: {
"storeInfo": widget.storeInfo,
"tableId": tableId,
// "parentCode": parentCode,
// "parentId": parentId,
"pName":pName,
"pid":pid,
"cName":cName,
"cid":cid,
"shoppingCart": shopCarGoods,
// "numberOfPeople": numberOfPeople,
},
);
queryShopCar();
}
///
queryShopCar() async {
if(widget.minToken == null)
return;
if(minService == null)
minService = MinApiService(
Dio(),
context: context,
token: widget.minToken,
tenant: widget.tenant,
storeId: widget.storeId,
showLoading: false,
);
BaseData<List<ShoppingCart>> baseData =
await minService.getShoppingCart(tableId).catchError((error) {
refreshController.refreshFailed();
@ -121,44 +146,22 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
// }
// }
/// key,UI
GlobalKey shopCartKey = GlobalKey();
///1
// Future<ShoppingCart> shopCartAdd(
// ShoppingCartSkuItemListBean cartSkuItem) async {
// Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
// cartSkuItem.buyNum += 1;
// shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
// BaseData<List<ShoppingCart>> baseDate =
// await minService.shoppingCartSingle(shopCarTemp);
// if (baseDate.isSuccess) {
// this.shopCarGoods = await queryShopCar();
// if (shopCartKey != null) {
// shopCartKey.currentState.setState(() {});
// }
// setState(() {});
// }
// return this.shopCarGoods;
// }
//
// ///1
// Future<ShoppingCart> shopCartReduce(
// ShoppingCartSkuItemListBean cartSkuItem) async {
// Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
// cartSkuItem.buyNum -= 1;
// shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
// BaseData<List<ShoppingCart>> baseDate =
// await minService.shoppingCartSingle(shopCarTemp);
// if (baseDate.isSuccess) {
// this.shopCarGoods = await queryShopCar();
// if (shopCartKey != null) {
// shopCartKey.currentState.setState(() {});
// }
// setState(() {});
// }
// return this.shopCarGoods;
// }
///
shopCartAdd(
ShoppingCartSkuItemListBean cartSkuItem,int count,int selected) async {
Map<String, dynamic> shopCarTemp = shopCarGoods[0].toJson();
cartSkuItem.buyNum += count;
cartSkuItem.selected = 0;
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) {
setState(() {
queryShopCar();
});
}
refreshController.refreshFailed();
}
final SwiperController controller = SwiperController();
@ -192,7 +195,7 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
child: Container(
alignment: Alignment.center,
margin: EdgeInsets.only(right: 12.w),
child: Text(topIndex ? "管理" :S.of(context).quxiao,
child: Text(!topIndex ? "管理" :S.of(context).quxiao,
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.semi_bold,
@ -212,17 +215,19 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: () {
setState(() {});
setState(() {
queryShopCar();
});
},
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: FutureBuilder(
// future: queryHome(),
// future: queryShopCar(),
builder: (context, snapshot) {
return Column(
children: [
///
CartGoodsList(),
cartGoodsList(),
],
);
},
@ -255,11 +260,22 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
GestureDetector(
onTap: (){
setState(() {
isAllSelect = !isAllSelect;
shopCarGoods[0].shoppingCartSkuItemList.forEach((element) {
element.selected = isAllSelect?1:0;
});
});
},
child:Image.asset(
isAllSelect ? "assets/image/icon_radio_selected.png" :
"assets/image/icon_radio_unselected.png",
width: 16,
height: 16,
),
),
SizedBox(width: 5.w),
Expanded(child: Text(
"全选",
@ -269,6 +285,9 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
color: Color(0xFFA29E9E),
),
),),
!topIndex ?
Row(
children: [
Text.rich(
TextSpan(
children: [
@ -281,7 +300,7 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
),
),
TextSpan(
text: "¥20.4",
text:((shopCarGoods?.length??0) > 0) ? (shopCarGoods[0]?.cartSum ?? "") : "",
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold,
@ -292,7 +311,11 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
],
),
),
Container(
GestureDetector(
onTap:(){
toDownOrder();
},
child:Container(
alignment: Alignment.center,
width: 70.w,
height: 32.h,
@ -317,33 +340,41 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
color: Colors.white,
),
),
),),
],
):
GestureDetector(
onTap: (){
clearShopCar();
},
child: Container(
alignment: Alignment.center,
width: 70.w,
height: 32.h,
margin: EdgeInsets.only(left:6.w),
decoration: BoxDecoration(
color: Color(0xFFFB312B),
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: Text(
"删除",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
color: Colors.white,
),
),
),
),
// Container(
// alignment: Alignment.center,
// width: 70.w,
// height: 32.h,
// margin: EdgeInsets.only(left:6.w),
// decoration: BoxDecoration(
// color: Color(0xFFFB312B),
// borderRadius: BorderRadius.circular(16),
// boxShadow: [
// BoxShadow(
// color: Colors.black.withAlpha(12),
// offset: Offset(0, 3),
// blurRadius: 14,
// spreadRadius: 0,
// ),
// ],
// ),
// child: Text(
// "删除",
// style: TextStyle(
// fontSize: 16.sp,
// fontWeight: MyFontWeight.regular,
// color: Colors.white,
// ),
// ),
// ),
],
),
),
@ -352,6 +383,174 @@ class _ShoppingCartPage extends State<ShoppingCartPage>
);
}
Widget cartGoodsList(){
return Container(
margin: EdgeInsets.only(bottom: 50.h),
child: ListView.builder(
itemCount:((shopCarGoods?.length ?? 0) > 0) ? (shopCarGoods[0]?.shoppingCartSkuItemList?.length ?? 0) : 0,
shrinkWrap: true,
padding: EdgeInsets.only(
top: 8.h,
bottom: 84.h, /* + (375.h - 88.h) + 4.h*/
),
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
onTap: () {
},
child: cartGoodsItem(position),
);
}),
);
}
Widget cartGoodsItem(index) {
return Container(
margin: EdgeInsets.all(16),
padding: EdgeInsets.all(16),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
color: Colors.white,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: (){
setState(() {
shopCarGoods[0].shoppingCartSkuItemList[index].selected = (shopCarGoods[0].shoppingCartSkuItemList[index].selected == 1) ? 1 : 0;
shopCartAdd(shopCarGoods[0].shoppingCartSkuItemList[index],0,shopCarGoods[0].shoppingCartSkuItemList[index].selected);
});
},
child:Image.asset(
(shopCarGoods[0].shoppingCartSkuItemList[index].selected==1) ? "assets/image/icon_radio_selected.png" :
"assets/image/icon_radio_unselected.png",
width:16,
height:16,
),
),
SizedBox(width: 16.w),
MImage(
shopCarGoods[0].shoppingCartSkuItemList[index]?.skuImg ?? "",
isCircle: true,
width:81,
height:81,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
SizedBox(width: 10.w),
Expanded(child:
Container(
height:81.h,child:Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
shopCarGoods[0].shoppingCartSkuItemList[index]?.productName ?? "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
),
),
// SizedBox(height: 5.h),
Text(
shopCarGoods[0].shoppingCartSkuItemList[index]?.skuName ?? "",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF727272),
),
),
// SizedBox(height: 5.h),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(child:Text.rich(
TextSpan(
children: [
TextSpan(
text: "",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
),
),
TextSpan(
text:shopCarGoods[0].shoppingCartSkuItemList[index]?.skuPrice ?? "",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
),
),
],
),
)),
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,children: [
InkWell(
onTap: () {
setState(() {
if(shopCarGoods[0].shoppingCartSkuItemList[index].buyNum > 1)
shopCartAdd(shopCarGoods[0].shoppingCartSkuItemList[index],-1,shopCarGoods[0].shoppingCartSkuItemList[index].selected);
});
},
child: Image.asset(
"assets/image/reduce.png",
width: 22,
height: 22,
),
),
Container(
width: 30,
alignment: Alignment.center,
child: Text(
shopCarGoods[0].shoppingCartSkuItemList[index]?.buyNum.toString() ?? 0,
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
),
InkWell(
onTap: () {
setState(() {
shopCartAdd(shopCarGoods[0].shoppingCartSkuItemList[index],1,shopCarGoods[0].shoppingCartSkuItemList[index].selected);
});
},
child: Image.asset(
"assets/image/add.png",
width: 22,
height: 22,
),
),
],)
],
),
],
)),),
],
),
);
}
@override
bool get wantKeepAlive => true;

155
lib/store/shopping/shopping_goods_details.dart

@ -22,7 +22,10 @@ import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/store_view/product_sku.dart';
import 'package:huixiang/store/store_view/store_order_list.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:url_launcher/url_launcher.dart';
@ -31,6 +34,7 @@ class ShoppingGoodsDetails extends StatefulWidget {
final Map<String, dynamic> arguments;
ShoppingGoodsDetails({this.arguments});
@override
State<StatefulWidget> createState() {
return _ShoppingGoodsDetails();
@ -38,6 +42,8 @@ class ShoppingGoodsDetails extends StatefulWidget {
}
class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
final RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController();
ApiService apiService;
MinApiService minService;
String tenant;
@ -64,15 +70,9 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
tenant = widget.arguments["tenant"];
id = widget.arguments["id"];
debugPrint("store_param tenant:$tenant storeId:$storeId");
SharedPreferences.getInstance().then((value) {
minService = MinApiService(
Dio(),
context: context,
token: minToken,
tenant: tenant,
storeId: storeId,
showLoading: false,
);
minLogin(value);
queryStoreInfo();
queryMiNiDetail(id);
@ -89,11 +89,10 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
showLoading: false,
);
apiService.minLogin(storeId).catchError((onError) {
debugPrint(onError);
debugPrint(onError.toString());
}).then((baseData) {
if (baseData != null && baseData.isSuccess) {
Map<String, dynamic> minStoreInfo = baseData.data;
minToken = minStoreInfo["token"];
minToken = baseData.data["token"];
queryStoreInfo();
SharedPreferences.getInstance().then(
(value) => {
@ -110,6 +109,9 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
storeId: storeId,
showLoading: false,
);
queryStoreInfo();
EasyLoading.dismiss();
}
});
@ -117,8 +119,9 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
///
queryStoreInfo() async {
BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) {
debugPrint(error);
BaseData baseData =
await apiService.queryStoreInfo(storeId).catchError((error) {
debugPrint(error.toString());
});
if (baseData != null && baseData.isSuccess) {
storeInfo = StoreInfo.fromJson(baseData.data);
@ -134,19 +137,32 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
///
queryMiNiDetail(id) async {
EasyLoading.show(status: S.current.zhengzaijiazai);
BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
if (minService == null)
minService = MinApiService(
Dio(),
context: context,
token: minToken,
tenant: tenant,
storeId: storeId,
showLoading: false,
);
BaseData<MiNiDetail> baseData =
await minService.miNiDetail(id).catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
miNiDetail = baseData.data;
refreshController.refreshCompleted();
} else {
refreshController.refreshFailed();
}
EasyLoading.dismiss();
}
///
showStoreSelector(MiNiDetail miNiDetail, String id,int count) async {
if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1
&& miNiDetail.attrList[0].attrValueList.length == 1) {
showStoreSelector(MiNiDetail miNiDetail, String id, int count) async {
if (miNiDetail.attrList != null &&
miNiDetail.attrList.length == 1 &&
miNiDetail.attrList[0].attrValueList.length == 1) {
_addShopCar(miNiDetail, [], count);
} else {
EasyLoading.dismiss();
@ -171,7 +187,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
///
Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async {
if (selectSkus!= null && selectSkus.length == 0) {
if (selectSkus != null && selectSkus.length == 0) {
productSku = miNiDetail.productSkuVOList.first;
} else {
productSku = miNiDetail.productSkuVOList.firstWhere((element) {
@ -200,18 +216,15 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
}
///1
add(MiNiDetail miNiDetail, selectSkus) async {
add(MiNiDetail miNiDetail, selectSkus) async {}
}
///1
reduce(MiNiDetail miNiDetail, selectSkus) async {
}
reduce(MiNiDetail miNiDetail, selectSkus) async {}
///
addShoppingCar() async {
BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart({
"storeId":storeId,
"storeId": storeId,
"storeName": storeInfo?.storeName ?? "",
"numberOfPeople": numberOfPeople,
"tableId": tableId,
@ -220,11 +233,11 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
"shoppingCartSkuItemList": [
{
"buyNum": count1,
"id":skuId1,
"id": skuId1,
"productId": miNiDetail.id,
"productName": miNiDetail.productName,
"skuName": skuValue1,
"storeId":storeId,
"storeId": storeId,
"skuPrice": productSku.skuPrice,
"skuStock": productSku.skuStock,
"tableId": tableId,
@ -237,7 +250,6 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
}
}
@override
Widget build(BuildContext context) {
return Stack(
@ -247,6 +259,24 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
child: Column(
children: [
Expanded(
child: Container(
child: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: true,
header: MyHeader(),
physics: BouncingScrollPhysics(),
scrollController: scrollController,
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
setState(() {
queryMiNiDetail(id);
});
},
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
@ -290,9 +320,9 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
Container(
color: Colors.white,
margin: EdgeInsets.only(bottom:72.h),
margin: EdgeInsets.only(bottom: 72.h),
child: Html(
data:miNiDetail?.detail ?? "",
data: miNiDetail?.detail ?? "",
customImageRenders: {
networkSourceMatcher(): networkImageRender(
loadingWidget: () {
@ -305,6 +335,8 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
],
),
),
),
),
flex: 1,
),
],
@ -313,7 +345,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
Align(
alignment: Alignment.bottomCenter,
child: Container(
height:80.h,
height: 80.h,
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
@ -334,11 +366,11 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
children: [
GestureDetector(
onTap: () {
setState(() {
Navigator.of(context)
.pushNamed('/router/shopping_mall_home', arguments: {
"type": 1,
});
"id": storeId,
"tenant": tenant
});
},
child: Column(
@ -402,16 +434,16 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
child: Row(
children: [
GestureDetector(
onTap: (){
setState(() {
onTap: () {
if (productSku == null)
SmartDialog.showToast("请选择規格!", alignment: Alignment.center);
addShoppingCar();
});
},
child:Container(
child: Container(
alignment: Alignment.center,
width: 120.w,
height:37.h,
margin: EdgeInsets.only(left:6.w),
height: 37.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
border: Border.all(
@ -431,14 +463,14 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
),
GestureDetector(
onTap: (){
onTap: () {
// toDownOrder();
},
child: Container(
alignment: Alignment.center,
width: 120.w,
height:37.h,
margin: EdgeInsets.only(left:6.w),
height: 37.h,
margin: EdgeInsets.only(left: 6.w),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(16),
@ -459,8 +491,8 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
color: Colors.white,
),
),
)
),
)),
///
// GestureDetector(
// onTap: (){
@ -794,7 +826,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
),
TextSpan(
text:miNiDetail?.price ?? "",
text: miNiDetail?.price ?? "",
style: TextStyle(
fontSize: 28.sp,
fontWeight: MyFontWeight.semi_bold,
@ -911,17 +943,14 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
),
itemBuilder: (context, position) {
return
miNiDetail == null
?
Container()
return miNiDetail == null
? Container()
: Image.network(
miNiDetail.imgs.elementAt(position),
fit: BoxFit.cover,
)
;
);
},
itemCount:miNiDetail?.imgs?.length ?? 0,
itemCount: miNiDetail?.imgs?.length ?? 0,
),
GestureDetector(
onTap: () {
@ -1019,7 +1048,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
Expanded(
child: Text(
( skuValue1 ?? "请选择規格") + (count1 > 0 ? "x${count1}" : ""),
(skuValue1 ?? "请选择規格") + (count1 > 0 ? "x${count1}" : ""),
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle(
@ -1032,7 +1061,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
GestureDetector(
onTap: () {
setState(() {
showStoreSelector(miNiDetail, id,1);
showStoreSelector(miNiDetail, id, 1);
});
},
child: Icon(
@ -1121,9 +1150,10 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
),
),
GestureDetector(
onTap: (){
onTap: () {
setState(() {
Navigator.of(context).popAndPushNamed('/router/group_page_details');
Navigator.of(context)
.popAndPushNamed('/router/group_page_details');
});
},
child: Text(
@ -1577,7 +1607,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
}
///
showCallMobile() {
showCallMobile() {
showCupertinoModalPopup(
context: context,
builder: (context) {
@ -1606,15 +1636,14 @@ showCallMobile() {
),
);
});
}
}
callMobile(mobile) async {
callMobile(mobile) async {
String url = "tel:$mobile";
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
}
}

41
lib/store/shopping/shopping_home/search_page.dart

@ -11,6 +11,7 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -81,8 +82,8 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
editingController.text =widget.arguments["searchKey"];
});
appletGoods(widget.arguments["searchKey"]);
}
getHistorySearch();
}
///
@ -101,6 +102,8 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
///
setHistorySearch(String text)async{
if(text == null || text.trim() == "")
return;
SharedPreferences value = await SharedPreferences.getInstance();
var str = value.getString("historySearch");
if(str == null )
@ -125,6 +128,9 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
///
appletGoods(String text) async {
if(editingController.text.trim() == ""){
return;
}
if(minService == null)
minService = MinApiService(
Dio(),
@ -160,6 +166,11 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
});
}
_onRefresh(){
appletGoods(editingController.text);
refreshController.refreshCompleted();
}
@override
Widget build(BuildContext context) {
return Stack(
@ -341,16 +352,21 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
child: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
enablePullUp: true,
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: () {
setState(() {});
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),onRefresh: () {
setState(() {
_onRefresh();
});
},
child: SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
child: FutureBuilder(
// future: queryHome(),
builder: (context, snapshot) {
return Column(
children: [
@ -411,6 +427,12 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
setState(() {
if(hotSearch[index] != null){
editingController.text =hotSearch[index];
appletGoods(hotSearch[index]);
}
});
},
child: hotSearchItem(hotSearch[index]),
);
@ -501,7 +523,14 @@ class _SearchPage extends State<SearchPage> with AutomaticKeepAliveClientMixin,
),
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {},
onTap: () {
setState(() {
if(historySearch[index] != null){
editingController.text =historySearch[index];
appletGoods(historySearch[index]);
}
});
},
child: historySearchItem(historySearch[index]),
);
},

243
lib/store/shopping/shopping_mall_home.dart

@ -32,7 +32,6 @@ class _ShoppingMallHome extends State<ShoppingMallHome>
int choiceIndex = 0;
String storeId = "";
String tenant = "";
///token
String minToken;
StoreInfo storeInfo;
@ -64,11 +63,12 @@ class _ShoppingMallHome extends State<ShoppingMallHome>
showLoading: false,
);
apiService.minLogin(storeId).catchError((onError) {
debugPrint(onError);
debugPrint(onError.toString());
}).then((baseData) {
if (baseData != null && baseData.isSuccess) {
Map<String, dynamic> minStoreInfo = baseData.data;
minToken = minStoreInfo["token"];
setState(() {
minToken = baseData.data["token"];
});
queryStoreInfo();
SharedPreferences.getInstance().then(
(value) => {
@ -86,14 +86,6 @@ class _ShoppingMallHome extends State<ShoppingMallHome>
showLoading: false,
);
// queryShopCar().then((value) {
// this.shopCarGoods = value;
// setState(() {});
// });
// if (tableId > 0) {
// getParentInfo();
// }
EasyLoading.dismiss();
}
});
@ -103,7 +95,7 @@ class _ShoppingMallHome extends State<ShoppingMallHome>
queryStoreInfo() async {
BaseData baseData =
await apiService.queryStoreInfo(storeId).catchError((error) {
debugPrint(error);
debugPrint(error.toString());
});
if (baseData != null && baseData.isSuccess) {
storeInfo = StoreInfo.fromJson(baseData.data);
@ -117,226 +109,6 @@ class _ShoppingMallHome extends State<ShoppingMallHome>
EasyLoading.dismiss();
}
// ///
// _queryMiNiDetail(String id,int count) async {
// EasyLoading.show(status: S.current.zhengzaijiazai);
// BaseData<MiNiDetail> baseData = await minService.miNiDetail(id);
// if (baseData != null && baseData.isSuccess) {
// showStoreSelector(baseData.data, id,count);
// }
// }
//
// ///
// showStoreSelector(MiNiDetail miNiDetail, String id,int count) async {
// if (miNiDetail.attrList != null && miNiDetail.attrList.length == 1
// && miNiDetail.attrList[0].attrValueList.length == 1) {
// _addShopCar(miNiDetail, [], count);
// } else {
// EasyLoading.dismiss();
// dialogShowing = true;
// SmartDialog.show(
// widget: ProductSku(
// miNiDetail,
// shopCarGoods,
// id,
// _addShopCar,
// add,
// reduce,
// ),
// onDismiss: () {
// dialogShowing = false;
// },
// alignmentTemp: Alignment.bottomCenter,
// );
// }
// }
//
// ///
// Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async {
// 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) {
// gg = false;
// return gg;
// }
// });
// return gg;
// });
// }
// if (productSku == null) return;
// String skuId = productSku.id;
// String skuValue = selectSkus
// .toString()
// .replaceAll("[", "")
// .replaceAll("]", "")
// .replaceAll(",", "");
//
// if (miNiDetail != null) {
// BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart({
// "storeId": storeInfo.id,
// "storeName": storeInfo.storeName ?? "",
// "numberOfPeople": numberOfPeople,
// "tableId": tableId,
// "parentId": parentId,
// "parentCode": parentCode,
// "shoppingCartSkuItemList": [
// {
// "buyNum": count,
// "id": skuId,
// "productId": miNiDetail.id,
// "productName": miNiDetail.productName,
// "skuName": skuValue,
// "storeId": storeInfo.id,
// "skuPrice": productSku.skuPrice,
// "skuStock": productSku.skuStock,
// "tableId": tableId,
// },
// ],
// });
// EasyLoading.dismiss();
// if (baseDate != null && baseDate.isSuccess) {
// queryShopCar().then((value) {
// this.shopCarGoods = value;
// setState(() {});
// });
// }
// }
// }
//
// ///1
// add(MiNiDetail miNiDetail, selectSkus) async {
// ProductSkuVOListBean productSku =
// miNiDetail.productSkuVOList.firstWhere((element) {
// return skuY(element, selectSkus);
// });
//
// if (productSku == null) return;
// String skuId = productSku.id;
// if (shopCarGoods == null) {
// await _addShopCar(miNiDetail, selectSkus, 2);
// return;
// }
// int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
// .indexWhere((element) => skuId == element.id);
// Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
// shopCarGoods.tableId = "$tableId";
//
// if (shopSkuIndex >= 0) {
// shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum += 1;
// ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods
// .shoppingCartSkuItemList
// .firstWhere((element) => skuId == element.id);
// shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
// } else {
// await _addShopCar(miNiDetail, selectSkus, 2);
// return;
// }
//
// BaseData<List<ShoppingCart>> baseDate =
// await minService.shoppingCartSingle(shopCarTemp);
// if (baseDate.isSuccess) {
// queryShopCar().then((value) {
// this.shopCarGoods = value;
// setState(() {});
// });
// }
// }
//
// ///1
// reduce(MiNiDetail miNiDetail, selectSkus) async {
// ProductSkuVOListBean productSku =
// miNiDetail.productSkuVOList.firstWhere((element) {
// return skuY(element, selectSkus);
// });
//
// if (productSku == null) return;
// String skuId = productSku.id;
// if (shopCarGoods == null) {
// await _addShopCar(miNiDetail, selectSkus, 2);
// return;
// }
// ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods
// .shoppingCartSkuItemList
// .firstWhere((element) => skuId == element.skuId);
// int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
// .indexWhere((element) => skuId == element.skuId);
//
// if (shopSkuItem != null) {
// if (shopSkuItem.buyNum > 1) {
// shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum -= 1;
// }
// } else {
// await _addShopCar(miNiDetail, selectSkus, 2);
// return;
// }
// shopCarGoods.tableId = "$tableId";
//
// Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
// ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods
// .shoppingCartSkuItemList
// .firstWhere((element) => skuId == element.id);
// shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
//
// BaseData<List<ShoppingCart>> baseDate =
// await minService.shoppingCartSingle(shopCarTemp);
// if (baseDate.isSuccess) {
// queryShopCar().then((value) {
// this.shopCarGoods = value;
// setState(() {});
// });
// }
// }
//
// bool skuY(ProductSkuVOListBean productSku, selectSkus) {
// bool gg = true;
// selectSkus.forEach((element1) {
// if (productSku.skuNameStr.indexOf(element1) < 0) {
// gg = false;
// return gg;
// }
// });
// return gg;
// }
// ///
// Future<ShoppingCart> queryShopCar() async {
// pName="";//
// pid="";//
// cName="";//
// cid="";//
// BaseData<List<ShoppingCart>> baseDate =
// await minService.getShoppingCart(tableId);
// if (baseDate != null &&
// baseDate.isSuccess &&
// baseDate.data != null &&
// baseDate.data.length > 0) {
// if( baseDate.data[0].selectDiscount ==1){
// baseDate.data[0].couponList.forEach((element) {
// if(element.isMaxCoupon){
// cName = element.promotionName;
// cid = element.id;
// }
// });
// }else if(baseDate.data[0].selectDiscount==2){
// baseDate.data[0].promotionInfoList.forEach((element) {
// if(element.isMaxPromotion){
// pName=element.name;
// pid=element.id;
// }
// });
// }
// return baseDate.data[0];
// } else {
// return null;
// }
// }
@override
Widget build(BuildContext context) {
super.build(context);
@ -360,17 +132,18 @@ class _ShoppingMallHome extends State<ShoppingMallHome>
]),
),
),
if (choiceIndex == 0)
if (minToken != null && choiceIndex == 0)
ShoppingHomePage(
minToken,
storeInfo,
storeId,
tenant,
),
if (choiceIndex == 1) ShoppingCartPage(
if (minToken != null && choiceIndex == 1) ShoppingCartPage(
minToken,
storeId,
tenant,
storeInfo,
),
Align(
alignment: Alignment.bottomCenter,

2
lib/union/union_page.dart

@ -257,7 +257,7 @@ class _UnionPage extends State<UnionPage>
'/router/shopping_mall_home',
arguments: {
"type":0,
"id": storeName.id,
"id":storeName.id,
"tenant": storeName.tenantCode,
"storeName":storeName.storeName
},

Loading…
Cancel
Save