Browse Source

safety

master
fmk 3 years ago
parent
commit
8016424596
  1. 2
      lib/retrofit/min_api.dart
  2. 545
      lib/store/store_order.dart
  3. 293
      lib/store/store_view/product_sku.dart
  4. 179
      lib/store/store_view/shop_car.dart
  5. 138
      lib/store/store_view/shop_goods.dart
  6. 308
      lib/store/store_view/store_order_list.dart
  7. 4
      lib/union/union_details_page.dart

2
lib/retrofit/min_api.dart

@ -115,7 +115,7 @@ abstract class MinApiService {
/// ///
@POST("product/findMiNiGroupList") @POST("product/findMiNiGroupList")
Future<BaseData<List<FindMiNiGroupList>>> findMiNiGroupList( Future<BaseData<List<FindMiNiGroupList>>> findMiNiGroupList(
@Body() Map<String, dynamic> param,Map<String, dynamic> header); @Body() Map<String, dynamic> param);

545
lib/store/store_order.dart

@ -12,6 +12,8 @@ import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/store_view/shop_car.dart';
import 'package:huixiang/store/store_view/shop_goods.dart';
import 'package:huixiang/store/store_view/store_activity.dart'; import 'package:huixiang/store/store_view/store_activity.dart';
import 'package:huixiang/store/store_view/store_info.dart'; import 'package:huixiang/store/store_view/store_info.dart';
import 'package:huixiang/store/store_view/store_order_list.dart'; import 'package:huixiang/store/store_view/store_order_list.dart';
@ -43,7 +45,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
MinApiService minService; MinApiService minService;
StoreInfo storeInfo; StoreInfo storeInfo;
List<Activity> activitys; List<Activity> activitys;
RefreshController refreshController; // RefreshController refreshController;
List<Widget> _widgetOptions; List<Widget> _widgetOptions;
ScrollController controller = ScrollController(); ScrollController controller = ScrollController();
@ -66,7 +68,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
controller, controller,
), ),
///, ///,
StoreActivity( StoreActivity(
widget.arguments, widget.arguments,
@ -88,10 +89,10 @@ class _StoreOrderPage extends State<StoreOrderPage>
BaseData baseData = await apiService BaseData baseData = await apiService
.queryStoreInfo(widget.arguments["id"]) .queryStoreInfo(widget.arguments["id"])
.catchError((error) { .catchError((error) {
refreshController.refreshFailed(); // refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
refreshController.refreshCompleted(); // refreshController.refreshCompleted();
storeInfo = StoreInfo.fromJson(baseData.data); storeInfo = StoreInfo.fromJson(baseData.data);
activitys = storeInfo.informationVOPageVO.list activitys = storeInfo.informationVOPageVO.list
.map((e) => Activity.fromJson(e)) .map((e) => Activity.fromJson(e))
@ -99,8 +100,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
if (mounted) { if (mounted) {
setState(() {}); setState(() {});
} }
} else {
refreshController.refreshFailed();
} }
} }
@ -115,162 +114,147 @@ class _StoreOrderPage extends State<StoreOrderPage>
bottom: 54.h, bottom: 54.h,
child: DefaultTabController( child: DefaultTabController(
length: 2, length: 2,
child: SmartRefresher( child: NestedScrollView(
controller: refreshController = RefreshController(initialRefresh: false), controller: controller,
enablePullDown: true, // physics: BouncingScrollPhysics(),
enablePullUp: false, dragStartBehavior: DragStartBehavior.start,
header: MyHeader(), headerSliverBuilder:
physics: BouncingScrollPhysics(), (BuildContext context, bool innerBoxIsScrolled) {
onRefresh: () { return [
queryStoreInfo(); SliverOverlapAbsorber(
}, handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
child: NestedScrollView( context),
controller: controller, sliver: SliverAppBar(
dragStartBehavior: DragStartBehavior.start, expandedHeight:
headerSliverBuilder: (storeInfo != null && storeInfo.couponVOList != null)
(BuildContext context, bool innerBoxIsScrolled) { ? 425.h : 365.h,
return [ floating: false,
SliverOverlapAbsorber( snap: false,
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), pinned: true,
sliver: SliverAppBar( stretch: false,
expandedHeight: (storeInfo != null && leading: GestureDetector(
storeInfo.couponVOList != null) onTap: () {
? 425.h Navigator.of(context).pop();
: 365.h, },
floating: false, child: Container(
snap: false, alignment: Alignment.centerRight,
pinned: true, margin: EdgeInsets.only(left: 10),
stretch: false, padding: EdgeInsets.all(6),
leading: GestureDetector( child: Icon(
onTap: () { Icons.arrow_back_ios,
Navigator.of(context).pop(); color: Colors.black,
}, size: 24,
child: Container(
alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 10),
padding: EdgeInsets.all(6),
child: Icon(
Icons.arrow_back_ios,
color: Colors.black,
size: 24,
),
), ),
), ),
flexibleSpace: FlexibleSpaceBar( ),
title: Title( flexibleSpace: FlexibleSpaceBar(
controller, title: Title(
storeInfo != null ? storeInfo.storeName : '', controller,
), storeInfo != null ? storeInfo.storeName : '',
collapseMode: CollapseMode.pin, ),
stretchModes: [ collapseMode: CollapseMode.pin,
StretchMode.zoomBackground, stretchModes: [
StretchMode.fadeTitle, StretchMode.zoomBackground,
StretchMode.blurBackground, StretchMode.fadeTitle,
], StretchMode.blurBackground,
background: Stack( ],
children: [ background: Stack(
Positioned( children: [
child: Column( Positioned(
children: [ child: Column(
// Image.asset( children: [
// "assets/image/share_image_bg.png", buildSwiper(),
// fit: BoxFit.cover, Expanded(
// width: MediaQuery.of(context).size.width, child: Container(
// height: 180.h, color: Colors.transparent,
// ),
buildSwiper(),
Expanded(
child: Container(
color: Colors.transparent,
),
flex: 1,
), ),
], flex: 1,
), ),
top: 0, ],
bottom: 0,
left: 0,
right: 0,
), ),
Positioned( top: 0,
child: Container( bottom: 0,
child: Column( left: 0,
children: [ right: 0,
/// ),
StoreInfoView(storeInfo), Positioned(
child: Container(
/// child: Column(
if (storeInfo != null && children: [
storeInfo.couponVOList != null) ///
UnionCoupon( StoreInfoView(storeInfo),
storeInfo,
(a) {},
coupon: true,
),
SizedBox( ///
height: 8, if (storeInfo != null &&
storeInfo.couponVOList != null)
UnionCoupon(
storeInfo,
(a) {},
coupon: true,
), ),
///VIP信息 SizedBox(
Vip(storeInfo, () {}, false), height: 8,
], ),
),
///VIP信息
Vip(storeInfo, () {}, false),
],
), ),
top: 110.h,
bottom: 0,
left: 0,
right: 0,
), ),
], top: 110.h,
), bottom: 0,
left: 0,
right: 0,
),
],
), ),
backgroundColor: Color(0x33FAFAFA), ),
centerTitle: false, backgroundColor: Color(0x33FAFAFA),
elevation: 0, centerTitle: false,
bottom: PreferredSize( elevation: 0,
preferredSize: Size( bottom: PreferredSize(
MediaQuery.of(context).size.width, preferredSize: Size(
38, MediaQuery.of(context).size.width,
), 38,
child: Container( ),
padding: EdgeInsets.symmetric(horizontal: 10.w), child: Container(
width: MediaQuery.of(context).size.width, padding: EdgeInsets.symmetric(horizontal: 10.w),
child: TabBar( width: MediaQuery.of(context).size.width,
controller: tabcontroller, child: TabBar(
automaticIndicatorColorAdjustment: true, controller: tabcontroller,
isScrollable: true, automaticIndicatorColorAdjustment: true,
indicatorWeight: 1, isScrollable: true,
indicatorColor: Color(0xFFFAFAFA), indicatorWeight: 1,
labelPadding: indicatorColor: Color(0xFFFAFAFA),
EdgeInsets.only(left: 8.w, right: 8.w), labelPadding:
indicatorSize: TabBarIndicatorSize.label, EdgeInsets.only(left: 8.w, right: 8.w),
unselectedLabelStyle: TextStyle( indicatorSize: TabBarIndicatorSize.label,
fontSize: 15.sp, unselectedLabelStyle: TextStyle(
fontWeight: FontWeight.w400, fontSize: 15.sp,
), fontWeight: FontWeight.w400,
labelStyle: TextStyle( ),
color: Colors.black, labelStyle: TextStyle(
fontSize: 18.sp, color: Colors.black,
fontWeight: FontWeight.bold, fontSize: 18.sp,
), fontWeight: FontWeight.bold,
labelColor: Colors.black,
tabs: [
MyTab(text: S.current.diancan),
MyTab(text: S.current.xindianhuodong),
],
), ),
labelColor: Colors.black,
tabs: [
MyTab(text: S.current.diancan),
MyTab(text: S.current.xindianhuodong),
],
), ),
), ),
), ),
), ),
]; ),
}, ];
body: TabBarView( },
physics: BouncingScrollPhysics(), body: TabBarView(
children: _widgetOptions, physics: BouncingScrollPhysics(),
controller: tabcontroller, children: _widgetOptions,
), controller: tabcontroller,
), ),
), ),
), ),
@ -410,274 +394,14 @@ class _StoreOrderPage extends State<StoreOrderPage>
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) { builder: (context) {
return StatefulBuilder(builder: (context1, state) { return StatefulBuilder(builder: (context1, state) {
return Container( return ShopCar(productLists);
alignment: Alignment.topCenter,
width: double.infinity,
height: MediaQuery.of(context).size.height / 2,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(
top: 16,
left: 16,
right: 16,
bottom: 8,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"已选商品",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/delete.png",
width: 22,
height: 22,
),
),
],
),
),
Expanded(
child: Container(
padding: EdgeInsets.only(
top: 8,
left: 16,
right: 16,
),
child: ListView.builder(
itemCount: productLists == null ? 0 : productLists.length,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
// return shoppGoodsItem();
return GestureDetector(
onTap: () {},
child: shoppGoodsItem(productLists[position], position),
);
},
),
),
),
Stack(
alignment: Alignment.bottomLeft,
children: [
Container(
height: 54.h,
decoration: BoxDecoration(
color: Color(0xFFFAFAFA),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(8),
offset: Offset(0, -1),
blurRadius: 3,
spreadRadius: 0,
),
],
),
child: Row(
children: [
Spacer(),
Text(
S.of(context).heji,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
Text(
"¥19.00",
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
Spacer(),
RoundButton(
width: 103.w,
height: 54.h,
text: S.current.jiesuan,
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060),
radius: 0,
fontSize: 16.sp,
padding: EdgeInsets.symmetric(vertical: 5.h),
)
],
),
),
Stack(
children: [
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Image.asset(
"assets/image/shopp.png",
width: 88,
height: 88,
),
),
Positioned(
right: 15,
top: 14,
child: RoundButton(
width: 17,
height: 17,
text: "1",
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060),
fontSize: 12.sp,
radius: 100,
callback: () {
Navigator.of(context)
.pushNamed('/router/test_page');
},
),
),
],
),
],
),
],
),
);
}); });
}, },
); );
} }
Widget shoppGoodsItem(ProductList pro, position) { Widget shoppGoodsItem(ProductList pro, position) {
return Container( return ShopGoods(pro, position);
padding: EdgeInsets.only(bottom: 10),
child: Row(
children: [
Image.asset(
"assets/image/default_1.png",
width: 60,
height: 60,
fit: BoxFit.cover,
),
SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"手工啵啵奶茶",
style: TextStyle(
color: Colors.black,
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(height: 2),
Row(
children: [
Text(
"无香精",
style: TextStyle(
color: Color(0xFF4C4C4C),
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(width: 10),
Text(
"无香精",
style: TextStyle(
color: Color(0xFF4C4C4C),
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
),
)
],
),
SizedBox(height: 6),
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
"会员价",
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 13.sp,
fontWeight: MyFontWeight.medium,
),
),
Text(
"¥19.00",
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
)
],
),
],
),
Spacer(),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/reduce.png",
width: 22,
height: 22,
),
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
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,
),
),
],
),
],
),
flex: 1,
),
],
),
);
} }
@override @override
@ -711,8 +435,7 @@ class _Title extends State<Title> {
if (alphaProgress <= 1) { if (alphaProgress <= 1) {
alphatemp = 1; alphatemp = 1;
} else if (alphaProgress <= alphaHeight) { } else if (alphaProgress <= alphaHeight) {
alphatemp = alphatemp = (((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0;
(((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0;
} else { } else {
alphatemp = 0; alphatemp = 0;
} }

293
lib/store/store_view/product_sku.dart

@ -0,0 +1,293 @@
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/store/store_view/store_order_list.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/round_button.dart';
class ProductSku extends StatefulWidget {
final ProductListBean productListBean;
ProductSku(this.productListBean);
@override
State<StatefulWidget> createState() {
return _ProductSku();
}
}
class _ProductSku extends State<ProductSku> {
List<testModel> temperatureStoreList = [
testModel("正常冰"),
testModel("少冰"),
testModel("多冰"),
testModel("去冰")
];
List<testModel> sweetnessStoreList = [testModel("正常糖"), testModel("5分糖")];
int isChoice = 0;
int tempClickIndex = 0;
@override
Widget build(BuildContext context) {
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(
widget.productListBean.imgPath,
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(
widget.productListBean.productName,
style: TextStyle(
color: Colors.black,
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
Padding(
padding: EdgeInsets.only(top: 4, bottom: 7),
child: Text(
"已选:正常冰",
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(
widget.productListBean.applyPrice,
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,
),
Text(
"温度",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(
height: 15,
),
sweetnessStore(
() {
setState(() {
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(
() {
setState(() {
for (var i = 0; i < sweetnessStoreList.length; i++) {
if (tempClickIndex == i)
sweetnessStoreList[i].isSelected = true;
else
sweetnessStoreList[i].isSelected = false;
}
});
},
sweetnessStoreList,
),
SizedBox(
height: 24,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Text(
"数量",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/reduce.png",
width: 22,
height: 22,
),
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(
widget.productListBean.buyNum.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/add.png",
width: 22,
height: 22,
),
),
],
),
SizedBox(
height: 24,
),
GestureDetector(
onTap: () {},
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),
),
),
],
),
);
}
Widget sweetnessStore(Function fc, List<testModel> 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: (context, index) {
return GestureDetector(
onTap: () {
tempClickIndex = index;
fc();
},
child: sweetnessItem(arrays[index].name, arrays[index].isSelected),
);
},
);
}
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,
),
],
),
);
}
}

179
lib/store/store_view/shop_car.dart

@ -0,0 +1,179 @@
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/store/store_view/shop_goods.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ShopCar extends StatefulWidget {
final List<ProductList> productLists;
ShopCar(this.productLists);
@override
State<StatefulWidget> createState() {
return _ShopCar();
}
}
class _ShopCar extends State<ShopCar> {
@override
Widget build(BuildContext context) {
return Container(
alignment: Alignment.topCenter,
width: double.infinity,
height: MediaQuery.of(context).size.height / 2,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(8),
topRight: Radius.circular(8),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(
top: 16,
left: 16,
right: 16,
bottom: 8,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"已选商品",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/delete.png",
width: 22,
height: 22,
),
),
],
),
),
Expanded(
child: Container(
padding: EdgeInsets.only(
top: 8,
left: 16,
right: 16,
),
child: ListView.builder(
itemCount: widget.productLists == null ? 0 : widget.productLists.length,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
// return shoppGoodsItem();
return GestureDetector(
onTap: () {},
child: ShopGoods(widget.productLists[position], position),
);
},
),
),
),
Stack(
alignment: Alignment.bottomLeft,
children: [
Container(
height: 54.h,
decoration: BoxDecoration(
color: Color(0xFFFAFAFA),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(8),
offset: Offset(0, -1),
blurRadius: 3,
spreadRadius: 0,
),
],
),
child: Row(
children: [
Spacer(),
Text(
S.of(context).heji,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Colors.black,
),
),
Text(
"¥19.00",
style: TextStyle(
fontSize: 20.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF32A060),
),
),
Spacer(),
RoundButton(
width: 103.w,
height: 54.h,
text: S.current.jiesuan,
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060),
radius: 0,
fontSize: 16.sp,
padding: EdgeInsets.symmetric(vertical: 5.h),
),
],
),
),
Stack(
children: [
InkWell(
onTap: () {
Navigator.of(context).pop();
},
child: Image.asset(
"assets/image/shopp.png",
width: 88,
height: 88,
),
),
Positioned(
right: 15,
top: 14,
child: RoundButton(
width: 17,
height: 17,
text: "1",
textColor: Colors.white,
fontWeight: MyFontWeight.regular,
backgroup: Color(0xFF32A060),
fontSize: 12.sp,
radius: 100,
callback: () {
Navigator.of(context)
.pushNamed('/router/test_page');
},
),
),
],
),
],
),
],
),
);
}
}

138
lib/store/store_view/shop_goods.dart

@ -0,0 +1,138 @@
import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ShopGoods extends StatefulWidget {
final ProductList pro;
final int position;
ShopGoods(this.pro, this.position);
@override
State<StatefulWidget> createState() {
return _ShopGoods();
}
}
class _ShopGoods extends State<ShopGoods> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(bottom: 10),
child: Row(
children: [
Image.asset(
"assets/image/default_1.png",
width: 60,
height: 60,
fit: BoxFit.cover,
),
SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"手工啵啵奶茶",
style: TextStyle(
color: Colors.black,
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
),
),
SizedBox(height: 2),
Row(
children: [
Text(
"无香精",
style: TextStyle(
color: Color(0xFF4C4C4C),
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(width: 10),
Text(
"无香精",
style: TextStyle(
color: Color(0xFF4C4C4C),
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
),
)
],
),
SizedBox(height: 6),
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
"会员价",
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 13.sp,
fontWeight: MyFontWeight.medium,
),
),
Text(
"¥19.00",
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
)
],
),
],
),
Spacer(),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/reduce.png",
width: 22,
height: 22,
),
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
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,
),
),
],
),
],
),
flex: 1,
),
],
),
);
}
}

308
lib/store/store_view/store_order_list.dart

@ -7,6 +7,7 @@ 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/min_api.dart'; import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/store_view/product_sku.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';
@ -43,16 +44,8 @@ class testModel {
} }
class _StoreOrderListPage extends State<StoreOrderListPage> { class _StoreOrderListPage extends State<StoreOrderListPage> {
List<testModel> temperatureStoreList = [
testModel("正常冰"),
testModel("少冰"),
testModel("多冰"),
testModel("去冰")
];
List<testModel> sweetnessStoreList = [testModel("正常糖"), testModel("5分糖")];
int isSelected = 0; int isSelected = 0;
int isChoice = 0;
int tempClickIndex = 0;
ApiService apiService; ApiService apiService;
MinApiService minService; MinApiService minService;
List<FindMiNiGroupList> appletProducts; List<FindMiNiGroupList> appletProducts;
@ -83,10 +76,12 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
Map<String, dynamic> minStoreInfo = baseData.data; Map<String, dynamic> minStoreInfo = baseData.data;
String minToken = minStoreInfo["token"]; String minToken = minStoreInfo["token"];
String tenant = widget.arguments["tenant"]; String tenant = widget.arguments["tenant"];
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then(
value.setString('minToken', minToken), (value) => {
value.setString('tenant', tenant), value.setString('minToken', minToken),
}); value.setString('tenant', tenant),
},
);
minService = MinApiService( minService = MinApiService(
Dio(), Dio(),
context: context, context: context,
@ -101,12 +96,11 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
/// ///
appletGoods() async { appletGoods() async {
BaseData<List<FindMiNiGroupList>> baseData = BaseData<List<FindMiNiGroupList>> baseData =
await minService.findMiNiGroupList({ await minService.findMiNiGroupList(
"id": widget.arguments["id"] {
}, { "id": widget.arguments["id"],
"store_id": widget.arguments["id"], },
"tenant": widget.arguments["tenant"], );
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
appletProducts = baseData.data; appletProducts = baseData.data;
@ -133,6 +127,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
child: ListView.builder( child: ListView.builder(
itemCount: appletProducts == null ? 0 : appletProducts.length, itemCount: appletProducts == null ? 0 : appletProducts.length,
controller: controller1, controller: controller1,
physics: BouncingScrollPhysics(),
padding: EdgeInsets.only(top: 0, bottom: 25), padding: EdgeInsets.only(top: 0, bottom: 25),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return orderItem(appletProducts[position], position); return orderItem(appletProducts[position], position);
@ -143,7 +138,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
width: MediaQuery.of(context).size.width - 100.w, width: MediaQuery.of(context).size.width - 100.w,
child: ListView.builder( child: ListView.builder(
itemCount: productListBeans == null ? 0 : productListBeans.length, itemCount: productListBeans == null ? 0 : productListBeans.length,
// controller: widget.controller, physics: BouncingScrollPhysics(),
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return goodsItem(productListBeans[position], position); return goodsItem(productListBeans[position], position);
@ -208,10 +203,12 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
errorSrc: "assets/image/default_1.png", errorSrc: "assets/image/default_1.png",
fadeSrc: "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, productListBean.productName,
@ -221,7 +218,9 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
), ),
), ),
SizedBox(height: 2), SizedBox(
height: 2,
),
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -236,10 +235,14 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
), ),
), ),
), ),
SizedBox(width: 10), SizedBox(
width: 10,
),
], ],
), ),
SizedBox(height: 7), SizedBox(
height: 7,
),
Row( Row(
children: [ children: [
Column( Column(
@ -255,8 +258,11 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
), ),
), ),
SizedBox(
width: 4,
),
Text( Text(
productListBean.price, "¥${productListBean.price}",
style: TextStyle( style: TextStyle(
color: Color(0xFFFF7A1A), color: Color(0xFFFF7A1A),
fontSize: 11.sp, fontSize: 11.sp,
@ -275,9 +281,11 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
), ),
), ),
SizedBox(width: 10), SizedBox(
width: 4,
),
Text( Text(
productListBean.applyPrice, "¥${productListBean.applyPrice}",
style: TextStyle( style: TextStyle(
color: Color(0xFFA29E9E), color: Color(0xFFA29E9E),
fontSize: 10.sp, fontSize: 10.sp,
@ -355,252 +363,10 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) { builder: (context) {
return StatefulBuilder(builder: (context1, state) { return StatefulBuilder(builder: (context1, state) {
return Container( return ProductSku(productListBean);
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(
productListBean.imgPath,
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(
productListBean.productName,
style: TextStyle(
color: Colors.black,
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
Padding(
padding: EdgeInsets.only(top: 4, bottom: 7),
child: Text(
"已选:正常冰",
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(
productListBean.applyPrice,
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,
),
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(() {
state(() {
for (var i = 0; i < sweetnessStoreList.length; i++) {
if (tempClickIndex == i)
sweetnessStoreList[i].isSelected = true;
else
sweetnessStoreList[i].isSelected = false;
}
});
}, sweetnessStoreList),
SizedBox(
height: 24,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Text(
"数量",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/reduce.png",
width: 22,
height: 22,
),
),
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(
productListBean.buyNum.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/add.png",
width: 22,
height: 22,
),
),
],
),
SizedBox(
height: 24,
),
GestureDetector(
onTap: (){},
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),
),
),
],
),
);
}); });
}, },
); );
} }
Widget sweetnessStore(Function fc, List<testModel> 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].name, arrays[index].isSelected),
);
},
);
}
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,
),
],
),
);
}
} }

4
lib/union/union_details_page.dart

@ -204,10 +204,10 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
printMin() async { printMin() async {
String miniAppId = storeInfo.mini.miniAppId; String miniAppId = storeInfo.mini.miniAppId;
debugPrint("print isExistsApp: ${await Min.isExistsApp(miniAppId)}"); debugPrint("print isExistsApp: ${await Min.isExistsApp(miniAppId)}");
debugPrint("print getAppBasePath: ${await Min.getAppBasePath(miniAppId)}"); debugPrint("print getAppBasePath: ${await Min.getAppBasePath(miniAppId)}");
debugPrint("print currentPageUrl: ${await Min.currentPageUrl()}"); debugPrint("print currentPageUrl: ${await Min.currentPageUrl()}");
debugPrint("print runingAppid: ${await Min.runingAppid()}"); debugPrint("print runingAppid: ${await Min.runingAppid()}");
} }
_loginMin() async { _loginMin() async {

Loading…
Cancel
Save