|
|
|
@ -35,6 +35,7 @@ class StoreOrderListPage extends StatefulWidget {
|
|
|
|
|
class _StoreOrderListPage extends State<StoreOrderListPage> { |
|
|
|
|
|
|
|
|
|
int isSelected = 0; |
|
|
|
|
int tempClickIndex = 0; |
|
|
|
|
ApiService apiService; |
|
|
|
|
MinApiService minService; |
|
|
|
|
List<FindMiNiGroupList> appletProducts; |
|
|
|
@ -403,288 +404,13 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
|
|
|
|
|
|
|
|
|
|
///选规格弹窗 |
|
|
|
|
showStoreSelector(MiNiDetail miNiDetail) { |
|
|
|
|
String selectSku = ""; |
|
|
|
|
int selectCount = 1; |
|
|
|
|
showModalBottomSheet( |
|
|
|
|
context: context, |
|
|
|
|
backgroundColor: Colors.transparent, |
|
|
|
|
builder: (context) { |
|
|
|
|
return StatefulBuilder(builder: (context1, state) { |
|
|
|
|
return Container( |
|
|
|
|
alignment: Alignment.topCenter, |
|
|
|
|
padding: EdgeInsets.only(top: 16, left: 16, right: 16), |
|
|
|
|
width: double.infinity, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
color: Color(0xFFFAFAFA), |
|
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
|
topLeft: Radius.circular(8), |
|
|
|
|
topRight: Radius.circular(8), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
child: Column( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
MImage( |
|
|
|
|
miNiDetail.imgs[0], |
|
|
|
|
width: 70, |
|
|
|
|
height: 70, |
|
|
|
|
fit: BoxFit.cover, |
|
|
|
|
errorSrc: "assets/image/default_1.png", |
|
|
|
|
fadeSrc: "assets/image/default_1.png", |
|
|
|
|
), |
|
|
|
|
SizedBox(width: 10), |
|
|
|
|
Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
miNiDetail.productName, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(top: 4, bottom: 7), |
|
|
|
|
child: Text( |
|
|
|
|
"已选:" + selectSku, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFF727272), |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Text( |
|
|
|
|
S.of(context).huiyuanjia, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFFFF7A1A), |
|
|
|
|
fontSize: 13.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
miNiDetail.price, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Color(0xFFFF7A1A), |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Spacer(), |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
}, |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/icon_order_cancel.png", |
|
|
|
|
width: 22, |
|
|
|
|
height: 22, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 23, |
|
|
|
|
), |
|
|
|
|
Expanded( |
|
|
|
|
child: ListView.builder( |
|
|
|
|
itemCount: miNiDetail.attrList.length, |
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
itemBuilder: (context, position) { |
|
|
|
|
return attrItem(() { |
|
|
|
|
state(() { |
|
|
|
|
for (var i = 0; |
|
|
|
|
i < |
|
|
|
|
miNiDetail |
|
|
|
|
.attrList[position].attrValueList.length; |
|
|
|
|
i++) { |
|
|
|
|
if (tempClickIndex == i) |
|
|
|
|
miNiDetail.attrList[position].attrValueList[i] |
|
|
|
|
.isSelected = true; |
|
|
|
|
else |
|
|
|
|
miNiDetail.attrList[position].attrValueList[i] |
|
|
|
|
.isSelected = false; |
|
|
|
|
} |
|
|
|
|
selectSku = ""; |
|
|
|
|
miNiDetail.attrList.forEach((e0) { |
|
|
|
|
e0.attrValueList.forEach((e1) { |
|
|
|
|
if (e1.isSelected ?? false) |
|
|
|
|
selectSku += e1.attrValue + " "; |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, miNiDetail.attrList[position]); |
|
|
|
|
}, |
|
|
|
|
)), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 24, |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
|
children: [ |
|
|
|
|
Expanded( |
|
|
|
|
child: Text( |
|
|
|
|
"数量", |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
state(() { |
|
|
|
|
if (selectCount > 1) selectCount--; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/reduce.png", |
|
|
|
|
width: 22, |
|
|
|
|
height: 22, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(left: 8, right: 8), |
|
|
|
|
child: Text( |
|
|
|
|
selectCount.toString(), |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
InkWell( |
|
|
|
|
onTap: () { |
|
|
|
|
state(() { |
|
|
|
|
selectCount++; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Image.asset( |
|
|
|
|
"assets/image/add.png", |
|
|
|
|
width: 22, |
|
|
|
|
height: 22, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 24, |
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
bool flag = false; |
|
|
|
|
miNiDetail.productSkuVOList.forEach((element) { |
|
|
|
|
if (selectSku.trim() == element.skuNameStr) { |
|
|
|
|
Navigator.of(context).pop(); |
|
|
|
|
flag = true; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
if (!flag) |
|
|
|
|
SmartDialog.showToast("请选择規格!", |
|
|
|
|
alignment: Alignment.center); |
|
|
|
|
}, |
|
|
|
|
child: RoundButton( |
|
|
|
|
width: double.infinity, |
|
|
|
|
height: 54.h, |
|
|
|
|
text: "加入购物车", |
|
|
|
|
textColor: Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
radius: 27, |
|
|
|
|
backgroup: Color(0xFF32A060), |
|
|
|
|
fontSize: 16.sp, |
|
|
|
|
// padding: EdgeInsets.symmetric(vertical: 5.h), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
SizedBox( |
|
|
|
|
height: 21.h, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}); |
|
|
|
|
return ProductSku(miNiDetail); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget attrItem(Function fc, AttrListBean attrListBean) { |
|
|
|
|
return Column( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
Padding( |
|
|
|
|
padding: EdgeInsets.only(top: 24, bottom: 16), |
|
|
|
|
child: Text( |
|
|
|
|
attrListBean.attrName, |
|
|
|
|
style: TextStyle( |
|
|
|
|
color: Colors.black, |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
), |
|
|
|
|
)), |
|
|
|
|
sweetnessStore(fc, attrListBean.attrValueList), |
|
|
|
|
], |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget sweetnessStore(Function fc, List<AttrValueListBean> arrays) { |
|
|
|
|
return GridView.builder( |
|
|
|
|
itemCount: arrays.length, |
|
|
|
|
shrinkWrap: true, |
|
|
|
|
physics: NeverScrollableScrollPhysics(), |
|
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
|
|
|
|
//一行的Widget数量 |
|
|
|
|
crossAxisCount: 4, |
|
|
|
|
//水平子Widget之间间距 |
|
|
|
|
crossAxisSpacing: 6.w, |
|
|
|
|
//垂直子Widget之间间距 |
|
|
|
|
mainAxisSpacing: 12.w, |
|
|
|
|
//垂直单个子Widget之间间距 |
|
|
|
|
childAspectRatio: 3 / 1), |
|
|
|
|
itemBuilder: (contetx, index) { |
|
|
|
|
return GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
tempClickIndex = index; |
|
|
|
|
fc(); |
|
|
|
|
}, |
|
|
|
|
child: sweetnessItem( |
|
|
|
|
arrays[index].attrValue, arrays[index].isSelected ?? false), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Widget sweetnessItem(String name, bool isCheck) { |
|
|
|
|
return Container( |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
|
children: [ |
|
|
|
|
RoundButton( |
|
|
|
|
width: 68.w, |
|
|
|
|
height: 29.h, |
|
|
|
|
text: name, |
|
|
|
|
textColor: !isCheck ? Color(0xFF727272) : Colors.white, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
|
radius: 4, |
|
|
|
|
backgroup: !isCheck ? Color(0xFFE5E5E5) : Color(0xFF32A060), |
|
|
|
|
fontSize: 12.sp, |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|