|
|
|
@ -8,11 +8,13 @@ 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/miNiDetail.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/min.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
@ -25,7 +27,11 @@ class StoreOrderListPage extends StatefulWidget {
|
|
|
|
|
final ScrollController controller; |
|
|
|
|
|
|
|
|
|
StoreOrderListPage( |
|
|
|
|
this.arguments, this.activitys, this.storeInfo, this.controller); |
|
|
|
|
this.arguments, |
|
|
|
|
this.activitys, |
|
|
|
|
this.storeInfo, |
|
|
|
|
this.controller, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
State<StatefulWidget> createState() { |
|
|
|
@ -33,24 +39,7 @@ class StoreOrderListPage extends StatefulWidget {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class testModel { |
|
|
|
|
String name; |
|
|
|
|
bool isSelected; |
|
|
|
|
|
|
|
|
|
testModel(String name) { |
|
|
|
|
this.name = name; |
|
|
|
|
this.isSelected = false; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
|
List<testModel> temperatureStoreList = [ |
|
|
|
|
testModel("正常冰"), |
|
|
|
|
testModel("少冰"), |
|
|
|
|
testModel("多冰"), |
|
|
|
|
testModel("去冰") |
|
|
|
|
]; |
|
|
|
|
List<testModel> sweetnessStoreList = [testModel("正常糖"), testModel("5分糖")]; |
|
|
|
|
int isSelected = 0; |
|
|
|
|
int isChoice = 0; |
|
|
|
|
int tempClickIndex = 0; |
|
|
|
@ -76,8 +65,10 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
context: context, |
|
|
|
|
token: value.getString('token'), |
|
|
|
|
); |
|
|
|
|
apiService.minLogin(widget.arguments["id"]) |
|
|
|
|
.catchError((onError){}).then((baseData) { |
|
|
|
|
apiService |
|
|
|
|
.minLogin(widget.arguments["id"]) |
|
|
|
|
.catchError((onError) {}) |
|
|
|
|
.then((baseData) { |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
Map<String, dynamic> minStoreInfo = baseData.data; |
|
|
|
|
String minToken = minStoreInfo["token"]; |
|
|
|
@ -93,33 +84,42 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
// tenant: tenant, |
|
|
|
|
); |
|
|
|
|
appletGoods(); |
|
|
|
|
// queryMiNiDetail(widget.arguments["id"]); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///小程序查询分组及商品列表 |
|
|
|
|
appletGoods() async{ |
|
|
|
|
BaseData<List<FindMiNiGroupList>> baseData = await minService.findMiNiGroupList({ |
|
|
|
|
"id":widget.arguments["id"] |
|
|
|
|
},{ |
|
|
|
|
"store_id":widget.arguments["id"], |
|
|
|
|
"tenant":"1175" |
|
|
|
|
}); |
|
|
|
|
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) |
|
|
|
|
if (appletProducts.length > 0) |
|
|
|
|
productListBeans = appletProducts[0].productList; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///选规格 |
|
|
|
|
queryMiNiDetail(String id) async { |
|
|
|
|
BaseData<MiNiDetail> baseData = await minService.miNiDetail(id); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
showStoreSelector(baseData.data); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return Container( |
|
|
|
|
width: MediaQuery.of(context).size.width, |
|
|
|
|
height: MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h), |
|
|
|
|
margin: EdgeInsets.only(top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight)), |
|
|
|
|
margin: EdgeInsets.only( |
|
|
|
|
top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight)), |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
mainAxisSize: MainAxisSize.max, |
|
|
|
@ -131,7 +131,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
controller: controller1, |
|
|
|
|
padding: EdgeInsets.zero, |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return orderItem(appletProducts[position],position); |
|
|
|
|
return orderItem(appletProducts[position], position); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -154,14 +154,14 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
ScrollController controller1 = ScrollController(); |
|
|
|
|
ScrollController controller2 = ScrollController(); |
|
|
|
|
|
|
|
|
|
Widget orderItem(FindMiNiGroupList findMiNiGroupList,int index) { |
|
|
|
|
Widget orderItem(FindMiNiGroupList findMiNiGroupList, int index) { |
|
|
|
|
return Container( |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap:() { |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
isSelected = index; |
|
|
|
|
productListBeans = findMiNiGroupList.productList; |
|
|
|
@ -189,17 +189,19 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget goodsItem(ProductListBean productListBean,position) { |
|
|
|
|
Widget goodsItem(ProductListBean productListBean, position) { |
|
|
|
|
return Container( |
|
|
|
|
color: Colors.white, |
|
|
|
|
padding: EdgeInsets.only(right: 16.w, bottom: 10.h,top:10.h), |
|
|
|
|
padding: EdgeInsets.only(right: 16.w, bottom: 10.h, top: 10.h), |
|
|
|
|
child: Row( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
SizedBox(width: 12.w), |
|
|
|
|
MImage( |
|
|
|
|
productListBean != null ? productListBean.imgPath : "", |
|
|
|
|
width: 70, |
|
|
|
|
height:70, |
|
|
|
|
height: 70, |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
errorSrc: "assets/image/default_1.png", |
|
|
|
|
fadeSrc: "assets/image/default_1.png", |
|
|
|
@ -207,7 +209,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
SizedBox(width: 10), |
|
|
|
|
Expanded( |
|
|
|
|
child: Column( |
|
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
productListBean.productName, |
|
|
|
@ -220,7 +222,8 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
SizedBox(height: 2), |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Expanded(child: Text( |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
productListBean.shortName, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
maxLines: 2, |
|
|
|
@ -229,8 +232,8 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
), ), |
|
|
|
|
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox(width: 10), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
@ -287,7 +290,8 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
true |
|
|
|
|
? GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
showStoreSelector(productListBean); |
|
|
|
|
// showStoreSelector(productListBean); |
|
|
|
|
queryMiNiDetail(productListBean.id); |
|
|
|
|
}, |
|
|
|
|
child: RoundButton( |
|
|
|
|
width: 49.w, |
|
|
|
@ -339,8 +343,12 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
List<ProductListBean> shopCarList() { |
|
|
|
|
return productListBeans; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
///选规格弹窗 |
|
|
|
|
showStoreSelector(ProductListBean productListBean) { |
|
|
|
|
showStoreSelector(MiNiDetail miNiDetail) { |
|
|
|
|
showModalBottomSheet( |
|
|
|
|
context: context, |
|
|
|
|
backgroundColor: Colors.transparent, |
|
|
|
@ -366,7 +374,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
MImage( |
|
|
|
|
productListBean.imgPath, |
|
|
|
|
miNiDetail.imgs[0], |
|
|
|
|
width: 70, |
|
|
|
|
height: 70, |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
@ -378,7 +386,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
productListBean.productName, |
|
|
|
|
miNiDetail.productName, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
@ -407,7 +415,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
productListBean.applyPrice, |
|
|
|
|
miNiDetail.price, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFFFF7A1A), |
|
|
|
|
fontSize: 14.sp, |
|
|
|
@ -434,51 +442,23 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
SizedBox( |
|
|
|
|
height: 23, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"温度", |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 15, |
|
|
|
|
), |
|
|
|
|
sweetnessStore(() { |
|
|
|
|
state(() { |
|
|
|
|
for (var i = 0; i < temperatureStoreList.length; i++) { |
|
|
|
|
if (tempClickIndex == i) |
|
|
|
|
temperatureStoreList[i].isSelected = true; |
|
|
|
|
else |
|
|
|
|
temperatureStoreList[i].isSelected = false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, temperatureStoreList), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 24, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"甜度", |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 15, |
|
|
|
|
), |
|
|
|
|
sweetnessStore(() { |
|
|
|
|
Expanded(child: ListView.builder( |
|
|
|
|
itemCount: miNiDetail.attrList.length, |
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return attrItem(() { |
|
|
|
|
state(() { |
|
|
|
|
for (var i = 0; i < sweetnessStoreList.length; i++) { |
|
|
|
|
for (var i = 0; i < miNiDetail.attrList[position].attrValueList.length; i++) { |
|
|
|
|
if (tempClickIndex == i) |
|
|
|
|
sweetnessStoreList[i].isSelected = true; |
|
|
|
|
miNiDetail.attrList[position].attrValueList[i].isSelected = true; |
|
|
|
|
else |
|
|
|
|
sweetnessStoreList[i].isSelected = false; |
|
|
|
|
miNiDetail.attrList[position].attrValueList[i].isSelected = false; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
}, sweetnessStoreList), |
|
|
|
|
}, miNiDetail.attrList[position]); |
|
|
|
|
}, |
|
|
|
|
)), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 24, |
|
|
|
|
), |
|
|
|
@ -505,7 +485,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 8, right: 8), |
|
|
|
|
child: Text( |
|
|
|
|
productListBean.buyNum.toString(), |
|
|
|
|
"1", |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
@ -548,7 +528,27 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget sweetnessStore(Function fc, List<testModel> arrays) { |
|
|
|
|
Widget attrItem(Function fc,AttrListBean attrListBean){ |
|
|
|
|
return Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
attrListBean.attrName, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 15, |
|
|
|
|
), |
|
|
|
|
sweetnessStore(fc, attrListBean.attrValueList), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget sweetnessStore(Function fc, List<AttrValueListBean> arrays) { |
|
|
|
|
return GridView.builder( |
|
|
|
|
itemCount: arrays.length, |
|
|
|
|
shrinkWrap: true, |
|
|
|
@ -568,7 +568,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
tempClickIndex = index; |
|
|
|
|
fc(); |
|
|
|
|
}, |
|
|
|
|
child: sweetnessItem(arrays[index].name, arrays[index].isSelected), |
|
|
|
|
child: sweetnessItem(arrays[index].attrValue, arrays[index].isSelected??false), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|