|
|
@ -1,12 +1,22 @@ |
|
|
|
|
|
|
|
import 'package:dio/dio.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/activity.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/findMiNiGroupList.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/store_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/store_info.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/data/user_entity.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/min_api.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class StoreOrderListPage extends StatefulWidget { |
|
|
|
class StoreOrderListPage extends StatefulWidget { |
|
|
|
final Map arguments; |
|
|
|
final Map arguments; |
|
|
@ -44,14 +54,63 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
int isSelected = 0; |
|
|
|
int isSelected = 0; |
|
|
|
int isChoice = 0; |
|
|
|
int isChoice = 0; |
|
|
|
int tempClickIndex = 0; |
|
|
|
int tempClickIndex = 0; |
|
|
|
|
|
|
|
ApiService apiService; |
|
|
|
|
|
|
|
MinApiService minService; |
|
|
|
|
|
|
|
List<FindMiNiGroupList> appletProducts; |
|
|
|
|
|
|
|
List<ProductListBean> productListBeans; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
void initState() { |
|
|
|
super.initState(); |
|
|
|
super.initState(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
minLogin(); |
|
|
|
|
|
|
|
|
|
|
|
widget.controller.addListener(() {}); |
|
|
|
widget.controller.addListener(() {}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// 小程序登录 |
|
|
|
|
|
|
|
minLogin() async { |
|
|
|
|
|
|
|
final SharedPreferences value = await SharedPreferences.getInstance(); |
|
|
|
|
|
|
|
apiService = ApiService( |
|
|
|
|
|
|
|
Dio(), |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
token: value.getString('token'), |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
apiService.minLogin(widget.arguments["id"]) |
|
|
|
|
|
|
|
.catchError((onError){}).then((baseData) { |
|
|
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
|
|
|
UserEntity userEntity = UserEntity.fromJson(baseData.data); |
|
|
|
|
|
|
|
String minToken = userEntity.token; |
|
|
|
|
|
|
|
SharedPreferences.getInstance().then((value) => { |
|
|
|
|
|
|
|
value.setString('minToken', minToken), |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
minService = MinApiService( |
|
|
|
|
|
|
|
Dio(), |
|
|
|
|
|
|
|
context: context, |
|
|
|
|
|
|
|
token: minToken, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
appletGoods(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///小程序查询分组及商品列表 |
|
|
|
|
|
|
|
appletGoods() async{ |
|
|
|
|
|
|
|
BaseData<List<FindMiNiGroupList>> baseData = await minService.findMiNiGroupList({ |
|
|
|
|
|
|
|
"id":widget.arguments["id"] |
|
|
|
|
|
|
|
},{ |
|
|
|
|
|
|
|
"store_id":widget.arguments["id"], |
|
|
|
|
|
|
|
"tenant":"1175" |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
|
|
|
setState(() { |
|
|
|
|
|
|
|
appletProducts = baseData.data; |
|
|
|
|
|
|
|
if(appletProducts.length > 0) |
|
|
|
|
|
|
|
productListBeans = appletProducts[0].productList; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
@ -65,22 +124,20 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
width: 100.w, |
|
|
|
width: 100.w, |
|
|
|
height: MediaQuery.of(context).size.height, |
|
|
|
height: MediaQuery.of(context).size.height, |
|
|
|
child: ListView.builder( |
|
|
|
child: ListView.builder( |
|
|
|
itemCount: 28, |
|
|
|
itemCount: appletProducts == null ? 0 : appletProducts.length, |
|
|
|
padding: EdgeInsets.only(top: 25, bottom: 50), |
|
|
|
|
|
|
|
controller: widget.controller, |
|
|
|
controller: widget.controller, |
|
|
|
itemBuilder: (context, position) { |
|
|
|
itemBuilder: (context, position) { |
|
|
|
return orderItem(position); |
|
|
|
return orderItem(appletProducts[position],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: 15, |
|
|
|
itemCount: productListBeans == null ? 0 : productListBeans.length, |
|
|
|
padding: EdgeInsets.only(top: 25, bottom: 50), |
|
|
|
|
|
|
|
// controller: widget.controller, |
|
|
|
// controller: widget.controller, |
|
|
|
itemBuilder: (context, position) { |
|
|
|
itemBuilder: (context, position) { |
|
|
|
return goodsItem(); |
|
|
|
return goodsItem(productListBeans[position], position); |
|
|
|
}, |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -92,8 +149,9 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
ScrollController controller1 = ScrollController(); |
|
|
|
ScrollController controller1 = ScrollController(); |
|
|
|
ScrollController controller2 = ScrollController(); |
|
|
|
ScrollController controller2 = ScrollController(); |
|
|
|
|
|
|
|
|
|
|
|
Widget orderItem(int index) { |
|
|
|
Widget orderItem(FindMiNiGroupList findMiNiGroupList,int index) { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
|
|
|
|
padding: EdgeInsets.only(top:100.h), |
|
|
|
child: Column( |
|
|
|
child: Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
@ -102,6 +160,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
onTap:() { |
|
|
|
onTap:() { |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
|
isSelected = index; |
|
|
|
isSelected = index; |
|
|
|
|
|
|
|
productListBeans = findMiNiGroupList.productList; |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
child: Container( |
|
|
@ -109,7 +168,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
alignment: Alignment.center, |
|
|
|
alignment: Alignment.center, |
|
|
|
padding: EdgeInsets.all(15), |
|
|
|
padding: EdgeInsets.all(15), |
|
|
|
child: Text( |
|
|
|
child: Text( |
|
|
|
"人气推荐", |
|
|
|
findMiNiGroupList.groupName, |
|
|
|
textAlign: TextAlign.center, |
|
|
|
textAlign: TextAlign.center, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: isSelected != index |
|
|
|
color: isSelected != index |
|
|
@ -126,26 +185,28 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Widget goodsItem() { |
|
|
|
Widget goodsItem(ProductListBean productListBean,position) { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
color: Colors.white, |
|
|
|
color: Colors.white, |
|
|
|
padding: EdgeInsets.only(right: 16.w, bottom: 10, top: 10), |
|
|
|
padding: EdgeInsets.only(right: 16.w, bottom: 10.h,top:10.h), |
|
|
|
child: Row( |
|
|
|
child: Row( |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
SizedBox(width: 12.w), |
|
|
|
SizedBox(width: 12.w), |
|
|
|
Image.asset( |
|
|
|
MImage( |
|
|
|
"assets/image/default_1.png", |
|
|
|
productListBean != null ? productListBean.imgPath : "", |
|
|
|
width: 70, |
|
|
|
width: 70, |
|
|
|
height:70, |
|
|
|
height:70, |
|
|
|
fit: BoxFit.cover, |
|
|
|
fit: BoxFit.cover, |
|
|
|
|
|
|
|
errorSrc: "assets/image/default_1.png", |
|
|
|
|
|
|
|
fadeSrc: "assets/image/default_1.png", |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(width: 10), |
|
|
|
SizedBox(width: 10), |
|
|
|
Expanded( |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"手工啵啵奶茶", |
|
|
|
productListBean.productName, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: Colors.black, |
|
|
|
color: Colors.black, |
|
|
|
fontSize: 13.sp, |
|
|
|
fontSize: 13.sp, |
|
|
@ -155,23 +216,18 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
SizedBox(height: 2), |
|
|
|
SizedBox(height: 2), |
|
|
|
Row( |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
Expanded(child: Text( |
|
|
|
"无香精", |
|
|
|
productListBean.shortName, |
|
|
|
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
|
|
|
maxLines: 2, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: Color(0xFF4C4C4C), |
|
|
|
color: Color(0xFF4C4C4C), |
|
|
|
fontSize: 10.sp, |
|
|
|
fontSize: 10.sp, |
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), ), |
|
|
|
|
|
|
|
|
|
|
|
SizedBox(width: 10), |
|
|
|
SizedBox(width: 10), |
|
|
|
Text( |
|
|
|
|
|
|
|
"无香精", |
|
|
|
|
|
|
|
style: TextStyle( |
|
|
|
|
|
|
|
color: Color(0xFF4C4C4C), |
|
|
|
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
|
|
|
), |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: 7), |
|
|
|
SizedBox(height: 7), |
|
|
@ -183,7 +239,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
Row( |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"会员价", |
|
|
|
S.of(context).huiyuanjia, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: Color(0xFFFF7A1A), |
|
|
|
color: Color(0xFFFF7A1A), |
|
|
|
fontSize: 10.sp, |
|
|
|
fontSize: 10.sp, |
|
|
@ -191,7 +247,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"¥19.00", |
|
|
|
productListBean.applyPrice, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: Color(0xFFFF7A1A), |
|
|
|
color: Color(0xFFFF7A1A), |
|
|
|
fontSize: 11.sp, |
|
|
|
fontSize: 11.sp, |
|
|
@ -203,7 +259,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
Row( |
|
|
|
Row( |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"原价", |
|
|
|
S.of(context).yuanjia, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
fontSize: 9.sp, |
|
|
|
fontSize: 9.sp, |
|
|
@ -212,7 +268,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(width: 10), |
|
|
|
SizedBox(width: 10), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"¥19.00", |
|
|
|
productListBean.price, |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
color: Color(0xFFA29E9E), |
|
|
|
fontSize: 10.sp, |
|
|
|
fontSize: 10.sp, |
|
|
@ -231,7 +287,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
}, |
|
|
|
}, |
|
|
|
child: RoundButton( |
|
|
|
child: RoundButton( |
|
|
|
width: 49.w, |
|
|
|
width: 49.w, |
|
|
|
text: "选规格", |
|
|
|
text: S.of(context).xuanguige, |
|
|
|
textColor: Colors.white, |
|
|
|
textColor: Colors.white, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
radius: 11, |
|
|
|
radius: 11, |
|
|
|