Browse Source

Merge branch 'master' into dev

# Conflicts:
#	lib/union/union_view/union_coupon.dart
master
w-R 3 years ago
parent
commit
ac96c74f00
  1. 2
      lib/main.dart
  2. 3
      lib/retrofit/data/store_info.dart
  3. 244
      lib/store/store_order.dart
  4. 166
      lib/store/store_view/store_info.dart
  5. 2
      lib/union/union_details_page.dart
  6. 57
      lib/union/union_page.dart
  7. 8
      lib/union/union_view/store_info.dart
  8. 191
      lib/union/union_view/union_coupon.dart

2
lib/main.dart

@ -52,6 +52,7 @@ import 'package:huixiang/setting/help_feedback_page.dart';
import 'package:huixiang/setting/permission_setting_page.dart'; import 'package:huixiang/setting/permission_setting_page.dart';
import 'package:huixiang/setting/setting_page.dart'; import 'package:huixiang/setting/setting_page.dart';
import 'package:huixiang/setting/treaty_page.dart'; import 'package:huixiang/setting/treaty_page.dart';
import 'package:huixiang/store/store_order.dart';
import 'package:huixiang/union/location_map_page.dart'; import 'package:huixiang/union/location_map_page.dart';
import 'package:huixiang/web/web_page.dart'; import 'package:huixiang/web/web_page.dart';
@ -277,6 +278,7 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
'/router/location_map': (context, {arguments}) => LocationMap(arguments: arguments), '/router/location_map': (context, {arguments}) => LocationMap(arguments: arguments),
'/router/qr_scan': (context, {arguments}) => QrCodeScanPage(), '/router/qr_scan': (context, {arguments}) => QrCodeScanPage(),
'/router/qr_share': (context, {arguments}) => QrSharePage(), '/router/qr_share': (context, {arguments}) => QrSharePage(),
'/router/store_order': (context, {arguments}) => StoreOrderPage(arguments: arguments),
// '/router/hot_article_details_page': (context, {arguments}) => HotArticleDetailsPage(), // '/router/hot_article_details_page': (context, {arguments}) => HotArticleDetailsPage(),
// '/router/ui_test': (context, {arguments}) => UITest(), // '/router/ui_test': (context, {arguments}) => UITest(),
}; };

3
lib/retrofit/data/store_info.dart

@ -17,6 +17,7 @@ class StoreInfo {
DeliveryInfo deliveryInfo; DeliveryInfo deliveryInfo;
String district; String district;
String headMobile; String headMobile;
String tel;
String headName; String headName;
String id; String id;
num isAutoSendRefundAddress; num isAutoSendRefundAddress;
@ -67,6 +68,7 @@ class StoreInfo {
: DeliveryInfo.fromJson(json['deliveryInfo'] as Map<String, dynamic>) : DeliveryInfo.fromJson(json['deliveryInfo'] as Map<String, dynamic>)
..district = json['district'] as String ..district = json['district'] as String
..headMobile = json['headMobile'] as String ..headMobile = json['headMobile'] as String
..tel = json['tel'] as String
..headName = json['headName'] as String ..headName = json['headName'] as String
..id = json['id'] as String ..id = json['id'] as String
..isVip = json['isVip'] ..isVip = json['isVip']
@ -115,6 +117,7 @@ class StoreInfo {
'deliveryInfo': this.deliveryInfo.toJson(), 'deliveryInfo': this.deliveryInfo.toJson(),
'district': this.district, 'district': this.district,
'headMobile': this.headMobile, 'headMobile': this.headMobile,
'tel': this.tel,
'headName': this.headName, 'headName': this.headName,
'id': this.id, 'id': this.id,
'isAutoSendRefundAddress': this.isAutoSendRefundAddress, 'isAutoSendRefundAddress': this.isAutoSendRefundAddress,

244
lib/store/store_order.dart

@ -0,0 +1,244 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/store_view/store_info.dart';
import 'package:huixiang/union/union_view/union_coupon.dart';
import 'package:huixiang/union/union_view/vip.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/my_tab.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
class StoreOrderPage extends StatefulWidget {
final Map arguments;
StoreOrderPage({this.arguments});
@override
State<StatefulWidget> createState() {
return _StoreOrderPage();
}
}
class _StoreOrderPage extends State<StoreOrderPage>
with TickerProviderStateMixin/*, AutomaticKeepAliveClientMixin */{
TabController tabcontroller;
ApiService apiService;
StoreInfo storeInfo;
RefreshController refreshController;
@override
void initState() {
super.initState();
queryStoreInfo();
}
queryStoreInfo() async {
final SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString('token'),
);
BaseData baseData = await apiService
.queryStoreInfo(widget.arguments["id"])
.catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
refreshController.refreshCompleted();
storeInfo = StoreInfo.fromJson(baseData.data);
if (mounted) {
setState(() {});
}
} else {
refreshController.refreshFailed();
}
}
@override
Widget build(BuildContext context) {
return Column(
children: [
Expanded(
child: DefaultTabController(
length: 2,
child: SmartRefresher(
controller: refreshController =
RefreshController(initialRefresh: false),
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(),
onRefresh: () {
queryStoreInfo();
},
child: NestedScrollView(
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return [
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
context),
sliver: SliverAppBar(
title: Text(
"百年川椒",
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.bold,
fontSize: 18.sp,
),
),
expandedHeight: (storeInfo != null && storeInfo.couponVOList != null) ? 425.h : 365.h,
floating: false,
snap: false,
leading: GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
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,
),
),
),
pinned: true,
flexibleSpace: FlexibleSpaceBar(
background: Stack(
children: [
Positioned(
child: Column(
children: [
Image.asset(
"assets/image/share_image_bg.png",
fit: BoxFit.cover,
width: MediaQuery.of(context).size.width,
height: 180.h,
),
Expanded(
child: Container(
color: Colors.transparent,
),
flex: 1,
),
],
),
top: 0,
bottom: 0,
left: 0,
right: 0,
),
Positioned(
child: Container(
child: Column(
children: [
///
StoreInfoView(),
///
if (storeInfo != null && storeInfo.couponVOList != null)
UnionCoupon(
storeInfo,
(a) {},
coupon: true,
),
///VIP信息
Vip(storeInfo, () {}, false),
],
),
),
top: 110.h,
bottom: 0,
left: 0,
right: 0,
),
],
),
collapseMode: CollapseMode.pin,
),
backgroundColor: Color(0xFFFAFAFA),
centerTitle: false,
elevation: 0,
bottom: PreferredSize(
preferredSize: Size(
MediaQuery.of(context).size.width,
38.h,
),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 10.w),
width: MediaQuery.of(context).size.width,
child: TabBar(
controller: tabcontroller = TabController(
length: 2,
vsync: this,
),
automaticIndicatorColorAdjustment: true,
isScrollable: true,
indicatorWeight: 1,
indicatorColor: Color(0xFFFAFAFA),
labelPadding: EdgeInsets.only(left: 8.w, right: 8.w),
indicatorSize: TabBarIndicatorSize.label,
unselectedLabelStyle: TextStyle(
fontSize: 15.sp,
fontWeight: FontWeight.w400,
),
labelStyle: TextStyle(
color: Colors.black,
fontSize: 18.sp,
fontWeight: FontWeight.bold,
),
labelColor: Colors.black,
tabs: [
MyTab(text: "点单"),
MyTab(text: "星店活动"),
],
),
),
),
),
),
];
},
body: TabBarView(
physics: BouncingScrollPhysics(),
children: [
Container(
color: Colors.white,
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width,
),
Container(
color: Colors.white,
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.width,
)
],
controller: tabcontroller,
),
),
),
),
),
Container(
height: 50.h,
color: Colors.blue,
),
],
);
}
// @override
// bool get wantKeepAlive => true;
}

166
lib/store/store_view/store_info.dart

@ -0,0 +1,166 @@
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/flutter_utils.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/round_button.dart';
class StoreInfoView extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _StoreInfoView();
}
}
class _StoreInfoView extends State<StoreInfoView> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(
left: 16.w,
right: 16.w,
top: 5.h,
bottom: 6.h,
),
height: 138.h,
padding: EdgeInsets.all(12.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8.w),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(25),
offset: Offset(0, 3),
blurRadius: 3,
spreadRadius: 0,
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Row(
children: [
Expanded(
child: Column(
children: [
Container(
alignment: Alignment.centerLeft,
child: Text(
"百年川椒",
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 18.sp,
color: Colors.black,
fontWeight: MyFontWeight.medium,
),
),
),
Row(
children: [
Text(
S.of(context).ren("1"),
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
),
),
SizedBox(
width: 20.w,
),
]..addAll(itemServer("11,22")),
),
Text(
"地址:武昌区楚河汉界第一街区万达总部国际C座对面",
maxLines: 2,
textAlign: TextAlign.justify,
style: TextStyle(
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
],
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
),
),
Image.asset(
"assets/image/icon_vip_name.png",
width: 70.w,
height: 70.w,
)
],
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
),
flex: 1,
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: Text(
S.of(context).yingyeshijian("10:00-22:00"),
style: TextStyle(
color: Color(0xFF353535),
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
),
),
),
SizedBox(
width: 16.w,
),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/icon_union_location.png",
width: 24.w,
height: 24.h,
),
),
SizedBox(
width: 16.w,
),
InkWell(
onTap: () {},
child: Image.asset(
"assets/image/icon_union_call.png",
width: 24,
height: 24,
),
),
],
),
],
),
);
}
List<Widget> itemServer(String businessService) {
if (businessService == null || businessService == "") return [];
var list = businessService.split(",");
return list
.map((e) => Container(
margin: EdgeInsets.only(right: 8.w),
child: RoundButton(
height: 14.h * AppUtils.textScale(context),
text: "$e",
backgroup: Color(0xFFFF7A1A),
padding: EdgeInsets.only(
left: 2.w,
right: 2.w,
),
fontSize: 10.sp,
textColor: Colors.white,
),
))
.toList();
}
}

2
lib/union/union_details_page.dart

@ -339,7 +339,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> {
} else { } else {
print("print 下载失败"); print("print 下载失败");
} }
Future.delayed(Duration(seconds: 1), () { Future.delayed(Duration(seconds: 1), (){
EasyLoading.dismiss(); EasyLoading.dismiss();
}); });
} }

57
lib/union/union_page.dart

@ -34,8 +34,8 @@ class UnionPage extends StatefulWidget {
class _UnionPage extends State<UnionPage> class _UnionPage extends State<UnionPage>
with AutomaticKeepAliveClientMixin, WidgetsBindingObserver { with AutomaticKeepAliveClientMixin, WidgetsBindingObserver {
final RefreshController refreshController =
final RefreshController refreshController = RefreshController(initialRefresh: false); RefreshController(initialRefresh: false);
ApiService apiService; ApiService apiService;
bool isKeyBoardShow = false; bool isKeyBoardShow = false;
BMFCoordinate latLng; BMFCoordinate latLng;
@ -44,11 +44,11 @@ class _UnionPage extends State<UnionPage>
void dispose() { void dispose() {
super.dispose(); super.dispose();
WidgetsBinding.instance.removeObserver(this); WidgetsBinding.instance.removeObserver(this);
if (Location.getInstance() != null && Location.getInstance().aMapFlutterLocation != null) if (Location.getInstance() != null &&
Location.getInstance().aMapFlutterLocation != null)
Location.getInstance().aMapFlutterLocation.stopLocation(); Location.getInstance().aMapFlutterLocation.stopLocation();
if (refreshController != null) if (refreshController != null) refreshController.dispose();
refreshController.dispose();
} }
@override @override
@ -88,8 +88,10 @@ class _UnionPage extends State<UnionPage>
startLocation() async { startLocation() async {
EasyLoading.show(status: S.current.zhengzaijiazai); EasyLoading.show(status: S.current.zhengzaijiazai);
Location.getInstance().aMapFlutterLocation Location.getInstance()
.onResultCallback().listen((event) { .aMapFlutterLocation
.onResultCallback()
.listen((event) {
if (event != null && if (event != null &&
event["latitude"] != null && event["latitude"] != null &&
event["longitude"] != null) { event["longitude"] != null) {
@ -101,17 +103,15 @@ class _UnionPage extends State<UnionPage>
latLng = BMFCoordinate(event["latitude"], event["longitude"]); latLng = BMFCoordinate(event["latitude"], event["longitude"]);
} }
BMFCalculateUtils.coordConvert( BMFCalculateUtils.coordConvert(
coordinate: latLng, coordinate: latLng,
fromType: BMF_COORD_TYPE.BD09LL, fromType: BMF_COORD_TYPE.BD09LL,
toType: BMF_COORD_TYPE.COMMON) toType: BMF_COORD_TYPE.COMMON)
.then((value) { .then((value) {
this.latLng = value; this.latLng = value;
saveLatLng( saveLatLng(
value, event["province"], event["city"], event["district"]); value, event["province"], event["city"], event["district"]);
print( print("union: Location result ${value.latitude} "
"union: Location result ${value.latitude} " "${value.longitude}");
"${value.longitude}",
);
Location.getInstance().stopLocation(); Location.getInstance().stopLocation();
queryStore( queryStore(
"${value.latitude}", "${value.latitude}",
@ -152,13 +152,16 @@ class _UnionPage extends State<UnionPage>
getLatLng() async { getLatLng() async {
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => { (value) => {
apiService = ApiService(Dio(), context: context, apiService = ApiService(Dio(),
token: value.getString('token'), showLoading: false), context: context,
token: value.getString('token'),
showLoading: false),
if (value.containsKey("latitude") && if (value.containsKey("latitude") &&
value.containsKey("longitude") && value.containsKey("longitude") &&
value.containsKey("province") && value.containsKey("province") &&
value.containsKey("city") && value.containsKey("city") &&
value.containsKey("district")) { value.containsKey("district"))
{
latLng = BMFCoordinate(double.tryParse(value.getString("latitude")), latLng = BMFCoordinate(double.tryParse(value.getString("latitude")),
double.tryParse(value.getString("longitude"))), double.tryParse(value.getString("longitude"))),
queryStore( queryStore(
@ -265,12 +268,20 @@ class _UnionPage extends State<UnionPage>
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
// Navigator.of(context).pushNamed(
// '/router/union_detail_page',
// arguments: {
// "id": storeList[position].id,
// "storeName": storeList[position].storeName
// });
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/union_detail_page', '/router/store_order',
arguments: { arguments: {
"id": storeList[position].id, "id": storeList[position].id,
"storeName": storeList[position].storeName "storeName": storeList[position].storeName
}); },
);
}, },
child: buildStoreItem(storeList[position], position), child: buildStoreItem(storeList[position], position),
); );
@ -300,7 +311,7 @@ class _UnionPage extends State<UnionPage>
offset: Offset(0, 3), offset: Offset(0, 3),
blurRadius: 14, blurRadius: 14,
spreadRadius: 0, spreadRadius: 0,
) ),
], ],
), ),
child: TextField( child: TextField(

8
lib/union/union_view/store_info.dart

@ -413,12 +413,12 @@ class _StoreInfos extends State<StoreInfos> {
title: Text(S.of(context).bodadianhua), title: Text(S.of(context).bodadianhua),
actions: [ actions: [
if (widget.storeInfo != null && if (widget.storeInfo != null &&
widget.storeInfo.headMobile != null && widget.storeInfo.tel != null &&
widget.storeInfo.headMobile != "") widget.storeInfo.tel != "")
CupertinoActionSheetAction( CupertinoActionSheetAction(
child: Text(widget.storeInfo.headMobile), child: Text(widget.storeInfo.tel),
onPressed: () { onPressed: () {
callMobile(widget.storeInfo.headMobile); callMobile(widget.storeInfo.tel);
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },
isDefaultAction: true, isDefaultAction: true,

191
lib/union/union_view/union_coupon.dart

@ -1,7 +1,3 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
@ -12,57 +8,62 @@ import 'package:huixiang/view_widget/round_button.dart';
import 'package:huixiang/view_widget/separator.dart'; import 'package:huixiang/view_widget/separator.dart';
class UnionCoupon extends StatefulWidget { class UnionCoupon extends StatefulWidget {
final StoreInfo storeInfo; final StoreInfo storeInfo;
final bool coupon;
final Function(String id) receiveCoupon; final Function(String id) receiveCoupon;
UnionCoupon(this.storeInfo, this.receiveCoupon);
UnionCoupon(this.storeInfo, this.receiveCoupon, {this.coupon = false});
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _UnionCoupon(); return _UnionCoupon();
} }
} }
class _UnionCoupon extends State<UnionCoupon> { class _UnionCoupon extends State<UnionCoupon> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Column( return (widget.coupon != null &&
children: [ widget.coupon &&
// Container( (widget.storeInfo != null && widget.storeInfo.couponVOList != null))
// margin: EdgeInsets.only(top: 10.h, bottom: 10.h), ? buildCoupon()
// child: ItemTitle( : Column(
// text: S.of(context).youhuiquan, children: [
// imgPath: "assets/image/icon_union_coupons.png", Container(
// ), margin: EdgeInsets.only(top: 10.h, bottom: 10.h),
// ), child: ItemTitle(
(widget.storeInfo != null && widget.storeInfo.couponVOList != null) text: S.of(context).youhuiquan,
? buildCoupon() imgPath: "assets/image/icon_union_coupons.png",
: Container( ),
width: double.infinity, ),
height: 0.h, (widget.storeInfo != null &&
alignment: Alignment.center, widget.storeInfo.couponVOList != null)
// child: Text( ? buildCoupon()
// S.of(context).zanwuyouhuiquankelingqu, : Container(
// style: TextStyle( width: double.infinity,
// fontSize: 14.sp, height: 50.h,
// fontWeight: MyFontWeight.semi_bold, alignment: Alignment.center,
// color: Color(0xFFA0A0A0), child: Text(
// ), S.of(context).zanwuyouhuiquankelingqu,
// ), style: TextStyle(
), fontSize: 14.sp,
], fontWeight: MyFontWeight.semi_bold,
); color: Color(0xFFA0A0A0),
),
),
),
],
);
} }
Widget buildCoupon() { Widget buildCoupon() {
return Container( return Container(
height: 109.h, height: 109.h,
child: ListView.builder( child: ListView.builder(
itemCount: (widget.storeInfo != null && widget.storeInfo.couponVOList != null) itemCount:
? widget.storeInfo.couponVOList.length (widget.storeInfo != null && widget.storeInfo.couponVOList != null)
: 0, ? widget.storeInfo.couponVOList.length
: 0,
physics: BouncingScrollPhysics(parent: PageScrollPhysics()), physics: BouncingScrollPhysics(parent: PageScrollPhysics()),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
itemBuilder: (context, position) { itemBuilder: (context, position) {
@ -95,10 +96,10 @@ class _UnionCoupon extends State<UnionCoupon> {
child: Text.rich(TextSpan(children: [ child: Text.rich(TextSpan(children: [
TextSpan( TextSpan(
text: (widget.storeInfo != null && text: (widget.storeInfo != null &&
widget.storeInfo.couponVOList != null && widget.storeInfo.couponVOList != null &&
widget.storeInfo widget.storeInfo.couponVOList[position]
.couponVOList[position].bizType == .bizType ==
1) 1)
? "¥" ? "¥"
: "", : "",
style: TextStyle( style: TextStyle(
@ -109,18 +110,21 @@ class _UnionCoupon extends State<UnionCoupon> {
), ),
TextSpan( TextSpan(
text: (widget.storeInfo != null && text: (widget.storeInfo != null &&
widget.storeInfo.couponVOList != null && widget.storeInfo.couponVOList != null &&
widget.storeInfo widget.storeInfo.couponVOList[position]
.couponVOList[position].bizType == .bizType ==
1) 1)
? "${double.tryParse(widget.storeInfo.couponVOList[position].discountAmount).toInt()}" ? "${double.tryParse(widget.storeInfo.couponVOList[position].discountAmount).toInt()}"
: (widget.storeInfo != null && : (widget.storeInfo != null &&
widget.storeInfo.couponVOList != null && widget.storeInfo.couponVOList !=
widget.storeInfo.couponVOList[position] null &&
.bizType == widget
5) .storeInfo
? S.of(context).duihuanquan .couponVOList[position]
: "${widget.storeInfo.couponVOList[position].discountPercent ~/ 10}", .bizType ==
5)
? S.of(context).duihuanquan
: "${widget.storeInfo.couponVOList[position].discountPercent ~/ 10}",
style: TextStyle( style: TextStyle(
fontSize: 36.sp, fontSize: 36.sp,
color: Color(0xFFFF7A1A), color: Color(0xFFFF7A1A),
@ -155,9 +159,9 @@ class _UnionCoupon extends State<UnionCoupon> {
children: [ children: [
Text( Text(
(widget.storeInfo != null && (widget.storeInfo != null &&
widget.storeInfo.couponVOList != null) widget.storeInfo.couponVOList != null)
? widget.storeInfo ? widget.storeInfo.couponVOList[position]
.couponVOList[position].couponName .couponName
: "", : "",
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@ -169,22 +173,25 @@ class _UnionCoupon extends State<UnionCoupon> {
), ),
Text( Text(
(widget.storeInfo != null && (widget.storeInfo != null &&
widget.storeInfo.couponVOList != null) widget.storeInfo.couponVOList != null)
? (widget.storeInfo.couponVOList[position] ? (widget.storeInfo.couponVOList[position]
.bizType == .bizType ==
1 1
? S.of(context).manlijiandaijinquan( ? S.of(context).manlijiandaijinquan(
double.tryParse(widget.storeInfo double.tryParse(widget
.couponVOList[position] .storeInfo
.fullAmount) .couponVOList[position]
.toInt(), .fullAmount)
double.tryParse(widget.storeInfo .toInt(),
.couponVOList[position] double.tryParse(widget
.discountAmount) .storeInfo
.toInt()) .couponVOList[position]
: S.of(context).quanchangzhe(widget.storeInfo .discountAmount)
.couponVOList[position] .toInt())
.discountPercent)) : S.of(context).quanchangzhe(widget
.storeInfo
.couponVOList[position]
.discountPercent))
: "", : "",
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle( style: TextStyle(
@ -195,17 +202,19 @@ class _UnionCoupon extends State<UnionCoupon> {
), ),
Text( Text(
S.of(context).youxiaoqizhi( S.of(context).youxiaoqizhi(
(widget.storeInfo != null && (widget.storeInfo != null &&
widget.storeInfo.couponVOList != widget.storeInfo.couponVOList !=
null && null &&
// widget.storeInfo.couponVOList[position].useStartTime != null && // widget.storeInfo.couponVOList[position].useStartTime != null &&
widget.storeInfo.couponVOList[position] widget
.useEndTime != .storeInfo
null) .couponVOList[position]
// ? "${widget.storeInfo.couponVOList[position].useStartTime.replaceAll("-", ".").split(" ")[0]}-${widget.storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" .useEndTime !=
? "${widget.storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" null)
: "", // ? "${widget.storeInfo.couponVOList[position].useStartTime.replaceAll("-", ".").split(" ")[0]}-${widget.storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}"
), ? "${widget.storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}"
: "",
),
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
@ -221,7 +230,9 @@ class _UnionCoupon extends State<UnionCoupon> {
onTap: () { onTap: () {
if (widget.storeInfo != null && if (widget.storeInfo != null &&
widget.storeInfo.couponVOList != null && widget.storeInfo.couponVOList != null &&
widget.storeInfo.couponVOList[position].status == 0) { widget.storeInfo.couponVOList[position]
.status ==
0) {
widget.receiveCoupon( widget.receiveCoupon(
widget.storeInfo.couponVOList[position].id); widget.storeInfo.couponVOList[position].id);
} }
@ -230,16 +241,18 @@ class _UnionCoupon extends State<UnionCoupon> {
height: 25.h, height: 25.h,
child: RoundButton( child: RoundButton(
text: (widget.storeInfo != null && text: (widget.storeInfo != null &&
widget.storeInfo.couponVOList != null && widget.storeInfo.couponVOList != null &&
widget.storeInfo.couponVOList[position].status > widget.storeInfo.couponVOList[position]
0) .status >
0)
? S.of(context).yilingqu ? S.of(context).yilingqu
: S.of(context).lingqu, : S.of(context).lingqu,
textColor: Colors.white, textColor: Colors.white,
backgroup: (widget.storeInfo != null && backgroup: (widget.storeInfo != null &&
widget.storeInfo.couponVOList != null && widget.storeInfo.couponVOList != null &&
widget.storeInfo.couponVOList[position].status > widget.storeInfo.couponVOList[position]
0) .status >
0)
? Colors.grey ? Colors.grey
: Color(0xFF32A060), : Color(0xFF32A060),
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
@ -259,6 +272,4 @@ class _UnionCoupon extends State<UnionCoupon> {
), ),
); );
} }
}
}

Loading…
Cancel
Save