Browse Source

safety

master
fmk 3 years ago
parent
commit
8cd428fd63
  1. 92
      lib/store/store_order.dart
  2. 76
      lib/store/store_view/store_order_list.dart
  3. 338
      lib/union/union_view/store_info.dart

92
lib/store/store_order.dart

@ -3,9 +3,11 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.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/base_data.dart';
import 'package:huixiang/retrofit/data/findMiNiGroupList.dart';
import 'package:huixiang/retrofit/data/order_info.dart'; 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/data/user_entity.dart'; import 'package:huixiang/retrofit/data/user_entity.dart';
@ -26,12 +28,8 @@ import 'package:shared_preferences/shared_preferences.dart';
class StoreOrderPage extends StatefulWidget { class StoreOrderPage extends StatefulWidget {
final Map arguments; final Map arguments;
final List<Activity> activitys;
final StoreInfo storeInfo;
final List<ProductList> productList;
StoreOrderPage({this.arguments});
StoreOrderPage({this.arguments, this.activitys, this.storeInfo,this.productList});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -40,11 +38,12 @@ class StoreOrderPage extends StatefulWidget {
} }
class _StoreOrderPage extends State<StoreOrderPage> class _StoreOrderPage extends State<StoreOrderPage>
with TickerProviderStateMixin /*, AutomaticKeepAliveClientMixin */ { with TickerProviderStateMixin, AutomaticKeepAliveClientMixin {
TabController tabcontroller; TabController tabcontroller;
ApiService apiService; ApiService apiService;
MinApiService minService; MinApiService minService;
StoreInfo storeInfo; StoreInfo storeInfo;
List<Activity> activitys;
RefreshController refreshController; RefreshController refreshController;
List<Widget> _widgetOptions; List<Widget> _widgetOptions;
@ -62,12 +61,16 @@ class _StoreOrderPage extends State<StoreOrderPage>
_widgetOptions = [ _widgetOptions = [
StoreOrderListPage( StoreOrderListPage(
widget.arguments, widget.activitys, storeInfo, controller), widget.arguments,
activitys,
storeInfo,
controller,
),
///, ///,
StoreActivity( StoreActivity(
widget.arguments, widget.arguments,
widget.activitys, activitys,
), ),
]; ];
@ -82,7 +85,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
context: context, context: context,
token: value.getString('token'), token: value.getString('token'),
); );
BaseData baseData = await apiService BaseData baseData = await apiService
.queryStoreInfo(widget.arguments["id"]) .queryStoreInfo(widget.arguments["id"])
.catchError((error) { .catchError((error) {
@ -91,6 +93,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
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
.map((e) => Activity.fromJson(e))
.toList();
if (mounted) { if (mounted) {
setState(() {}); setState(() {});
} }
@ -127,7 +132,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
(BuildContext context, bool innerBoxIsScrolled) { (BuildContext context, bool innerBoxIsScrolled) {
return [ return [
SliverOverlapAbsorber( SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context),
sliver: SliverAppBar( sliver: SliverAppBar(
expandedHeight: (storeInfo != null && expandedHeight: (storeInfo != null &&
storeInfo.couponVOList != null) storeInfo.couponVOList != null)
@ -168,12 +174,13 @@ class _StoreOrderPage extends State<StoreOrderPage>
Positioned( Positioned(
child: Column( child: Column(
children: [ children: [
Image.asset( // Image.asset(
"assets/image/share_image_bg.png", // "assets/image/share_image_bg.png",
fit: BoxFit.cover, // fit: BoxFit.cover,
width: MediaQuery.of(context).size.width, // width: MediaQuery.of(context).size.width,
height: 180.h, // height: 180.h,
), // ),
buildSwiper(),
Expanded( Expanded(
child: Container( child: Container(
color: Colors.transparent, color: Colors.transparent,
@ -360,6 +367,45 @@ class _StoreOrderPage extends State<StoreOrderPage>
); );
} }
Widget buildSwiper() {
return Container(
width: double.infinity,
height: 180.h,
child: Swiper(
pagination: SwiperPagination(
alignment: Alignment.bottomCenter,
builder: DotSwiperPaginationBuilder(
size: 8.w,
activeSize: 8.w,
space: 5.w,
activeColor: Colors.white,
color: Colors.white.withAlpha(76),
),
),
itemBuilder: (context, position) {
return Container(
margin: EdgeInsets.only(left: 10.w, right: 10.w),
child: MImage(
(storeInfo != null &&
storeInfo.bannerList != null &&
position < storeInfo.bannerList.length)
? storeInfo.bannerList[position].imgUrl
: "",
fit: BoxFit.cover,
radius: BorderRadius.circular(4),
errorSrc: "assets/image/default_2_1.png",
fadeSrc: "assets/image/default_2_1.png",
),
);
},
itemCount: (storeInfo != null && storeInfo.bannerList != null)
? storeInfo.bannerList.length
: 1),
);
}
List<ProductList> productLists = [];
/// ///
showShoppingCart() { showShoppingCart() {
showModalBottomSheet( showModalBottomSheet(
@ -420,14 +466,13 @@ class _StoreOrderPage extends State<StoreOrderPage>
right: 16, right: 16,
), ),
child: ListView.builder( child: ListView.builder(
itemCount: widget.productList == null ? 0 : widget.productList.length, itemCount: productLists == null ? 0 : productLists.length,
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
// return shoppGoodsItem(); // return shoppGoodsItem();
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {},
}, child: shoppGoodsItem(productLists[position], position),
child: shoppGoodsItem(widget.productList[position], position),
); );
}, },
), ),
@ -638,8 +683,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
); );
} }
// @override @override
// bool get wantKeepAlive => true; bool get wantKeepAlive => true;
} }
class Title extends StatefulWidget { class Title extends StatefulWidget {
@ -669,7 +714,8 @@ class _Title extends State<Title> {
if (alphaProgress <= 1) { if (alphaProgress <= 1) {
alphatemp = 1; alphatemp = 1;
} else if (alphaProgress <= alphaHeight) { } else if (alphaProgress <= alphaHeight) {
alphatemp = (((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0; alphatemp =
(((alphaHeight - alphaProgress) / alphaHeight) > 0.5) ? 1 : 0;
} else { } else {
alphatemp = 0; alphatemp = 0;
} }

76
lib/store/store_view/store_order_list.dart

@ -25,7 +25,11 @@ class StoreOrderListPage extends StatefulWidget {
final ScrollController controller; final ScrollController controller;
StoreOrderListPage( StoreOrderListPage(
this.arguments, this.activitys, this.storeInfo, this.controller); this.arguments,
this.activitys,
this.storeInfo,
this.controller,
);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -76,16 +80,18 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
context: context, context: context,
token: value.getString('token'), token: value.getString('token'),
); );
apiService.minLogin(widget.arguments["id"]) apiService
.catchError((onError){}).then((baseData) { .minLogin(widget.arguments["id"])
.catchError((onError) {})
.then((baseData) {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
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) => {
value.setString('minToken', minToken), value.setString('minToken', minToken),
value.setString('tenant', tenant), value.setString('tenant', tenant),
}); });
minService = MinApiService( minService = MinApiService(
Dio(), Dio(),
context: context, context: context,
@ -98,17 +104,14 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
} }
/// ///
appletGoods() async{ appletGoods() async {
BaseData<List<FindMiNiGroupList>> baseData = await minService.findMiNiGroupList({ BaseData<List<FindMiNiGroupList>> baseData = await minService
"id":widget.arguments["id"] .findMiNiGroupList({"id": widget.arguments["id"]},
},{ {"store_id": widget.arguments["id"], "tenant": "1175"});
"store_id":widget.arguments["id"],
"tenant":"1175"
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
appletProducts = baseData.data; appletProducts = baseData.data;
if(appletProducts.length > 0) if (appletProducts.length > 0)
productListBeans = appletProducts[0].productList; productListBeans = appletProducts[0].productList;
}); });
} }
@ -119,7 +122,8 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
return Container( return Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h), 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( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
@ -131,7 +135,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
controller: controller1, controller: controller1,
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemBuilder: (context, position) { itemBuilder: (context, position) {
return orderItem(appletProducts[position],position); return orderItem(appletProducts[position], position);
}, },
), ),
), ),
@ -154,14 +158,14 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
ScrollController controller1 = ScrollController(); ScrollController controller1 = ScrollController();
ScrollController controller2 = ScrollController(); ScrollController controller2 = ScrollController();
Widget orderItem(FindMiNiGroupList findMiNiGroupList,int index) { Widget orderItem(FindMiNiGroupList findMiNiGroupList, int index) {
return Container( return Container(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
GestureDetector( GestureDetector(
onTap:() { onTap: () {
setState(() { setState(() {
isSelected = index; isSelected = index;
productListBeans = findMiNiGroupList.productList; productListBeans = findMiNiGroupList.productList;
@ -189,17 +193,17 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
); );
} }
Widget goodsItem(ProductListBean productListBean,position) { Widget goodsItem(ProductListBean productListBean, position) {
return Container( return Container(
color: Colors.white, 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( child: Row(
children: [ children: [
SizedBox(width: 12.w), SizedBox(width: 12.w),
MImage( MImage(
productListBean != null ? productListBean.imgPath : "", productListBean != null ? productListBean.imgPath : "",
width: 70, width: 70,
height:70, height: 70,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_1.png", errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png", fadeSrc: "assets/image/default_1.png",
@ -220,17 +224,18 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
SizedBox(height: 2), SizedBox(height: 2),
Row( Row(
children: [ children: [
Expanded(child: Text( Expanded(
productListBean.shortName, child: Text(
overflow: TextOverflow.ellipsis, productListBean.shortName,
maxLines: 2, overflow: TextOverflow.ellipsis,
style: TextStyle( maxLines: 2,
color: Color(0xFF4C4C4C), style: TextStyle(
fontSize: 10.sp, color: Color(0xFF4C4C4C),
fontWeight: MyFontWeight.regular, fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
),
), ),
), ), ),
SizedBox(width: 10), SizedBox(width: 10),
], ],
), ),
@ -272,7 +277,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
), ),
SizedBox(width: 10), SizedBox(width: 10),
Text( Text(
productListBean.price, productListBean.price,
style: TextStyle( style: TextStyle(
color: Color(0xFFA29E9E), color: Color(0xFFA29E9E),
fontSize: 10.sp, fontSize: 10.sp,
@ -339,6 +344,10 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
); );
} }
List<ProductListBean> shopCarList() {
return productListBeans;
}
/// ///
showStoreSelector() { showStoreSelector() {
showModalBottomSheet( showModalBottomSheet(
@ -591,5 +600,4 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
), ),
); );
} }
} }

338
lib/union/union_view/store_info.dart

@ -177,175 +177,175 @@ class _StoreInfos extends State<StoreInfos> {
], ],
), ),
); );
return AspectRatio( // return AspectRatio(
aspectRatio: 1, // aspectRatio: 1,
child: Container( // child: Container(
margin: EdgeInsets.fromLTRB(16, 20, 16, 8), // margin: EdgeInsets.fromLTRB(16, 20, 16, 8),
padding: EdgeInsets.fromLTRB(10, 20, 10, 14), // padding: EdgeInsets.fromLTRB(10, 20, 10, 14),
decoration: BoxDecoration( // decoration: BoxDecoration(
color: Colors.white, // color: Colors.white,
borderRadius: BorderRadius.circular(8), // borderRadius: BorderRadius.circular(8),
boxShadow: [ // boxShadow: [
BoxShadow( // BoxShadow(
color: Colors.black.withAlpha(25), // color: Colors.black.withAlpha(25),
offset: Offset(0, 1), // offset: Offset(0, 1),
blurRadius: 12, // blurRadius: 12,
spreadRadius: 0, // spreadRadius: 0,
), // ),
], // ],
), // ),
child: Column( // child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, // mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start, // crossAxisAlignment: CrossAxisAlignment.start,
children: [ // children: [
AspectRatio( // AspectRatio(
aspectRatio: 1.8, // aspectRatio: 1.8,
child: buildSwiper(), // child: buildSwiper(),
), // ),
Expanded( // Expanded(
child: Container( // child: Container(
margin: EdgeInsets.only( // margin: EdgeInsets.only(
left: 10.w, // left: 10.w,
right: 10.w, // right: 10.w,
top: 16.h, // top: 16.h,
), // ),
child: Column( // child: Column(
mainAxisAlignment: // mainAxisAlignment:
MainAxisAlignment.spaceBetween, // MainAxisAlignment.spaceBetween,
crossAxisAlignment: // crossAxisAlignment:
CrossAxisAlignment.start, // CrossAxisAlignment.start,
children: [ // children: [
Row( // Row(
children: [ // children: [
Expanded( // Expanded(
child: Container( // child: Container(
alignment: // alignment:
Alignment.centerLeft, // Alignment.centerLeft,
child: Text( // child: Text(
widget.storeInfo != null // widget.storeInfo != null
? widget.storeInfo.storeName // ? widget.storeInfo.storeName
: "", // : "",
overflow: TextOverflow.ellipsis, // overflow: TextOverflow.ellipsis,
style: TextStyle( // style: TextStyle(
fontSize: 16.sp, // fontSize: 16.sp,
color: Colors.black, // color: Colors.black,
fontWeight: MyFontWeight.medium, // fontWeight: MyFontWeight.medium,
), // ),
), // ),
), // ),
), // ),
Text( // Text(
S.of(context).ren( // S.of(context).ren(
widget.storeInfo != null // widget.storeInfo != null
? widget.storeInfo // ? widget.storeInfo
.perCapitaConsumption // .perCapitaConsumption
: "", // : "",
), // ),
overflow: TextOverflow.ellipsis, // overflow: TextOverflow.ellipsis,
style: TextStyle( // style: TextStyle(
fontSize: 14.sp, // fontSize: 14.sp,
fontWeight: MyFontWeight.regular, // fontWeight: MyFontWeight.regular,
color: Color(0xFF353535), // color: Color(0xFF353535),
), // ),
), // ),
], // ],
), // ),
Text( // Text(
widget.storeInfo != null // widget.storeInfo != null
? widget.storeInfo.address // ? widget.storeInfo.address
: "", // : "",
maxLines: 2, // maxLines: 2,
textAlign: TextAlign.justify, // textAlign: TextAlign.justify,
style: TextStyle( // style: TextStyle(
color: Color(0xFF353535), // color: Color(0xFF353535),
fontWeight: MyFontWeight.regular, // fontWeight: MyFontWeight.regular,
fontSize: 12.sp, // fontSize: 12.sp,
), // ),
), // ),
Row( // Row(
children: itemServer( // children: itemServer(
widget.storeInfo != null // widget.storeInfo != null
? widget.storeInfo.businessService // ? widget.storeInfo.businessService
: "", // : "",
), // ),
), // ),
Row( // Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, // mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end, // crossAxisAlignment: CrossAxisAlignment.end,
children: [ // children: [
Expanded( // Expanded(
child: Text( // child: Text(
S.of(context).yingyeshijian(widget.storeInfo == // S.of(context).yingyeshijian(widget.storeInfo ==
null // null
? "" // ? ""
: (widget.storeInfo.openStartTime == // : (widget.storeInfo.openStartTime ==
null && // null &&
widget.storeInfo // widget.storeInfo
.openEndTime == // .openEndTime ==
null) // null)
? S.of(context).quantian // ? S.of(context).quantian
: "${widget.storeInfo.openStartTime.substring(0, widget.storeInfo.openStartTime.lastIndexOf(":"))} " // : "${widget.storeInfo.openStartTime.substring(0, widget.storeInfo.openStartTime.lastIndexOf(":"))} "
"- ${widget.storeInfo.openEndTime.substring(0, widget.storeInfo.openEndTime.lastIndexOf(":"))}"), // "- ${widget.storeInfo.openEndTime.substring(0, widget.storeInfo.openEndTime.lastIndexOf(":"))}"),
style: TextStyle( // style: TextStyle(
color: Color(0xFF353535), // color: Color(0xFF353535),
fontWeight: MyFontWeight.regular, // fontWeight: MyFontWeight.regular,
fontSize: 12.sp, // fontSize: 12.sp,
), // ),
), // ),
), // ),
SizedBox( // SizedBox(
width: 16.w, // width: 16.w,
), // ),
InkWell( // InkWell(
onTap: () { // onTap: () {
if (widget.storeInfo == null || // if (widget.storeInfo == null ||
widget.storeInfo.latitude == // widget.storeInfo.latitude ==
null || // null ||
widget.storeInfo.longitude == // widget.storeInfo.longitude ==
null || // null ||
widget.storeInfo.latitude == "" || // widget.storeInfo.latitude == "" ||
widget.storeInfo.longitude == "") // widget.storeInfo.longitude == "")
return; // return;
Navigator.of(context).pushNamed( // Navigator.of(context).pushNamed(
'/router/location_map', // '/router/location_map',
arguments: { // arguments: {
"lat": widget.storeInfo.latitude, // "lat": widget.storeInfo.latitude,
"lng": // "lng":
widget.storeInfo.longitude, // widget.storeInfo.longitude,
"storeName": // "storeName":
widget.storeInfo.storeName, // widget.storeInfo.storeName,
}); // });
}, // },
child: Image.asset( // child: Image.asset(
"assets/image/icon_union_location.png", // "assets/image/icon_union_location.png",
width: 24.w, // width: 24.w,
height: 24.h, // height: 24.h,
), // ),
), // ),
SizedBox( // SizedBox(
width: 16.w, // width: 16.w,
), // ),
InkWell( // InkWell(
onTap: () { // onTap: () {
showCallMobile(); // showCallMobile();
}, // },
child: Image.asset( // child: Image.asset(
"assets/image/icon_union_call.png", // "assets/image/icon_union_call.png",
width: 24, // width: 24,
height: 24, // height: 24,
), // ),
), // ),
], // ],
), // ),
], // ],
), // ),
), // ),
flex: 1, // flex: 1,
), // ),
], // ],
), // ),
), // ),
); // );
} }
Widget buildSwiper() { Widget buildSwiper() {

Loading…
Cancel
Save