|
|
@ -29,7 +29,7 @@ import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
import 'package:url_launcher/url_launcher.dart'; |
|
|
|
import 'package:url_launcher/url_launcher.dart'; |
|
|
|
|
|
|
|
|
|
|
|
class UnionDetailsPage extends StatefulWidget { |
|
|
|
class UnionDetailsPage extends StatefulWidget { |
|
|
|
final Map<String, dynamic> arguments; |
|
|
|
final Map<String, dynamic>? arguments; |
|
|
|
|
|
|
|
|
|
|
|
UnionDetailsPage({this.arguments}); |
|
|
|
UnionDetailsPage({this.arguments}); |
|
|
|
|
|
|
|
|
|
|
@ -40,7 +40,7 @@ class UnionDetailsPage extends StatefulWidget { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
ApiService apiService; |
|
|
|
late ApiService apiService; |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
void dispose() { |
|
|
@ -59,18 +59,18 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
StoreInfo storeInfo; |
|
|
|
StoreInfo? storeInfo; |
|
|
|
List<Activity> activitys; |
|
|
|
List<Activity>? activitys; |
|
|
|
|
|
|
|
|
|
|
|
queryStoreInfo() async { |
|
|
|
queryStoreInfo() async { |
|
|
|
BaseData baseData = await apiService.queryStoreInfo(widget.arguments["id"]) |
|
|
|
BaseData baseData = await apiService.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)) |
|
|
|
.toList(); |
|
|
|
.toList(); |
|
|
|
if (mounted) setState(() {}); |
|
|
|
if (mounted) setState(() {}); |
|
|
@ -86,7 +86,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
return Scaffold( |
|
|
|
return Scaffold( |
|
|
|
appBar: MyAppBar( |
|
|
|
appBar: MyAppBar( |
|
|
|
background: Color(0xFFF7F7F7), |
|
|
|
background: Color(0xFFF7F7F7), |
|
|
|
title: storeInfo == null ? "" : storeInfo.storeName, |
|
|
|
title: storeInfo == null ? "" : storeInfo!.storeName, |
|
|
|
titleColor: Colors.black87, |
|
|
|
titleColor: Colors.black87, |
|
|
|
titleSize: 18.sp, |
|
|
|
titleSize: 18.sp, |
|
|
|
leadingColor: Colors.black, |
|
|
|
leadingColor: Colors.black, |
|
|
@ -149,7 +149,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
storeInfo != null |
|
|
|
storeInfo != null |
|
|
|
? storeInfo.storeName |
|
|
|
? storeInfo!.storeName! |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16.sp, |
|
|
|
fontSize: 16.sp, |
|
|
@ -163,8 +163,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
child: Text( |
|
|
|
child: Text( |
|
|
|
S.of(context).ren( |
|
|
|
S.of(context).ren( |
|
|
|
storeInfo != null |
|
|
|
storeInfo != null |
|
|
|
? storeInfo |
|
|
|
? storeInfo! |
|
|
|
.perCapitaConsumption |
|
|
|
.perCapitaConsumption! |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
), |
|
|
|
), |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
@ -179,7 +179,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
storeInfo != null |
|
|
|
storeInfo != null |
|
|
|
? storeInfo.address |
|
|
|
? storeInfo!.address! |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
maxLines: 2, |
|
|
|
maxLines: 2, |
|
|
|
textAlign: TextAlign.justify, |
|
|
|
textAlign: TextAlign.justify, |
|
|
@ -192,7 +192,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
Row( |
|
|
|
Row( |
|
|
|
children: itemServer( |
|
|
|
children: itemServer( |
|
|
|
storeInfo != null |
|
|
|
storeInfo != null |
|
|
|
? storeInfo.businessService |
|
|
|
? storeInfo!.businessService! |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
@ -205,12 +205,12 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
S.of(context).yingyeshijian(storeInfo == |
|
|
|
S.of(context).yingyeshijian(storeInfo == |
|
|
|
null |
|
|
|
null |
|
|
|
? "" |
|
|
|
? "" |
|
|
|
: (storeInfo.openStartTime == |
|
|
|
: (storeInfo!.openStartTime == |
|
|
|
null && |
|
|
|
null && |
|
|
|
storeInfo.openEndTime == |
|
|
|
storeInfo!.openEndTime == |
|
|
|
null) |
|
|
|
null) |
|
|
|
? S.of(context).quantian |
|
|
|
? S.of(context).quantian |
|
|
|
: "${storeInfo.openStartTime.substring(0, storeInfo.openStartTime.lastIndexOf(":"))} - ${storeInfo.openEndTime.substring(0, storeInfo.openEndTime.lastIndexOf(":"))}"), |
|
|
|
: "${storeInfo!.openStartTime!.substring(0, storeInfo!.openStartTime!.lastIndexOf(":"))} - ${storeInfo!.openEndTime!.substring(0, storeInfo!.openEndTime!.lastIndexOf(":"))}"), |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
color: Color(0xFF353535), |
|
|
|
color: Color(0xFF353535), |
|
|
|
fontWeight: FontWeight.w400, |
|
|
|
fontWeight: FontWeight.w400, |
|
|
@ -223,18 +223,18 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
InkWell( |
|
|
|
InkWell( |
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
|
if (storeInfo == null || |
|
|
|
if (storeInfo == null || |
|
|
|
storeInfo.latitude == null || |
|
|
|
storeInfo!.latitude == null || |
|
|
|
storeInfo.longitude == null || |
|
|
|
storeInfo!.longitude == null || |
|
|
|
storeInfo.latitude == "" || |
|
|
|
storeInfo!.latitude == "" || |
|
|
|
storeInfo.longitude == "") |
|
|
|
storeInfo!.longitude == "") |
|
|
|
return; |
|
|
|
return; |
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
'/router/location_map', |
|
|
|
'/router/location_map', |
|
|
|
arguments: { |
|
|
|
arguments: { |
|
|
|
"lat": storeInfo.latitude, |
|
|
|
"lat": storeInfo!.latitude, |
|
|
|
"lng": storeInfo.longitude, |
|
|
|
"lng": storeInfo!.longitude, |
|
|
|
"storeName": |
|
|
|
"storeName": |
|
|
|
storeInfo.storeName, |
|
|
|
storeInfo!.storeName, |
|
|
|
}); |
|
|
|
}); |
|
|
|
}, |
|
|
|
}, |
|
|
|
child: Image.asset( |
|
|
|
child: Image.asset( |
|
|
@ -276,7 +276,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
imgPath: "assets/image/icon_union_coupons.png", |
|
|
|
imgPath: "assets/image/icon_union_coupons.png", |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
(storeInfo != null && storeInfo.couponVOList != null) |
|
|
|
(storeInfo != null && storeInfo!.couponVOList != null) |
|
|
|
? buildCoupon() |
|
|
|
? buildCoupon() |
|
|
|
: Container( |
|
|
|
: Container( |
|
|
|
width: double.infinity, |
|
|
|
width: double.infinity, |
|
|
@ -298,7 +298,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
imgPath: "assets/image/icon_union_start_store.png", |
|
|
|
imgPath: "assets/image/icon_union_start_store.png", |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
(activitys != null && activitys.length > 0) |
|
|
|
(activitys != null && activitys!.length > 0) |
|
|
|
? Container( |
|
|
|
? Container( |
|
|
|
margin: EdgeInsets.only(bottom: 30.h), |
|
|
|
margin: EdgeInsets.only(bottom: 30.h), |
|
|
|
child: AspectRatio( |
|
|
|
child: AspectRatio( |
|
|
@ -357,14 +357,14 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
|
|
|
|
|
|
|
|
bool isEnable() { |
|
|
|
bool isEnable() { |
|
|
|
if (storeInfo == null) return false; |
|
|
|
if (storeInfo == null) return false; |
|
|
|
if (storeInfo.mini == null) return false; |
|
|
|
if (storeInfo!.mini == null) return false; |
|
|
|
String miniAppId = storeInfo.mini.miniAppId; |
|
|
|
String miniAppId = storeInfo!.mini!.miniAppId!; |
|
|
|
if (miniAppId == null || |
|
|
|
if (miniAppId == null || |
|
|
|
miniAppId == "" || |
|
|
|
miniAppId == "" || |
|
|
|
storeInfo.mini.miniVersion == null || |
|
|
|
storeInfo!.mini!.miniVersion! == null || |
|
|
|
storeInfo.mini.miniVersion == "" || |
|
|
|
storeInfo!.mini!.miniVersion! == "" || |
|
|
|
storeInfo.mini.miniDownloadUrl == null || |
|
|
|
storeInfo!.mini!.miniDownloadUrl! == null || |
|
|
|
storeInfo.mini.miniDownloadUrl == "") { |
|
|
|
storeInfo!.mini!.miniDownloadUrl! == "") { |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return true; |
|
|
|
return true; |
|
|
@ -374,7 +374,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
Widget buildVip() { |
|
|
|
Widget buildVip() { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
margin: EdgeInsets.symmetric( |
|
|
|
margin: EdgeInsets.symmetric( |
|
|
|
vertical: (storeInfo != null && storeInfo.isVip) ? 12.h : 20.h, |
|
|
|
vertical: (storeInfo != null && storeInfo!.isVip!) ? 12.h : 20.h, |
|
|
|
horizontal: 16.w), |
|
|
|
horizontal: 16.w), |
|
|
|
padding: EdgeInsets.all(16), |
|
|
|
padding: EdgeInsets.all(16), |
|
|
|
decoration: BoxDecoration( |
|
|
|
decoration: BoxDecoration( |
|
|
@ -383,7 +383,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
image: AssetImage("assets/image/icon_vip_bg.png"), |
|
|
|
image: AssetImage("assets/image/icon_vip_bg.png"), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
child: (storeInfo != null && storeInfo.isVip) |
|
|
|
child: (storeInfo != null && storeInfo!.isVip!) |
|
|
|
? Column( |
|
|
|
? Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
mainAxisSize: MainAxisSize.max, |
|
|
|
mainAxisSize: MainAxisSize.max, |
|
|
@ -409,7 +409,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
width: 8.w, |
|
|
|
width: 8.w, |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
"¥${(storeInfo != null && storeInfo.memberSource != null) ? storeInfo.memberSource.balance : ""}", |
|
|
|
"¥${(storeInfo != null && storeInfo!.memberSource != null) ? storeInfo!.memberSource!.balance! : ""}", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
@ -440,8 +440,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
width: 8.w, |
|
|
|
width: 8.w, |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
(storeInfo != null && storeInfo.memberSource != null) |
|
|
|
(storeInfo != null && storeInfo!.memberSource != null) |
|
|
|
? "${storeInfo.memberSource.integral}" |
|
|
|
? "${storeInfo!.memberSource!.integral!}" |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
@ -519,8 +519,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
return Container( |
|
|
|
return Container( |
|
|
|
height: 109.h, |
|
|
|
height: 109.h, |
|
|
|
child: ListView.builder( |
|
|
|
child: ListView.builder( |
|
|
|
itemCount: (storeInfo != null && storeInfo.couponVOList != null) |
|
|
|
itemCount: (storeInfo != null && storeInfo!.couponVOList != null) |
|
|
|
? storeInfo.couponVOList.length |
|
|
|
? storeInfo!.couponVOList!.length |
|
|
|
: 0, |
|
|
|
: 0, |
|
|
|
physics: BouncingScrollPhysics(parent: PageScrollPhysics()), |
|
|
|
physics: BouncingScrollPhysics(parent: PageScrollPhysics()), |
|
|
|
scrollDirection: Axis.horizontal, |
|
|
|
scrollDirection: Axis.horizontal, |
|
|
@ -554,9 +554,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
child: Text.rich(TextSpan(children: [ |
|
|
|
child: Text.rich(TextSpan(children: [ |
|
|
|
TextSpan( |
|
|
|
TextSpan( |
|
|
|
text: (storeInfo != null && |
|
|
|
text: (storeInfo != null && |
|
|
|
storeInfo.couponVOList != null && |
|
|
|
storeInfo!.couponVOList != null && |
|
|
|
storeInfo |
|
|
|
storeInfo!.couponVOList![position]!.bizType! == |
|
|
|
.couponVOList[position].bizType == |
|
|
|
|
|
|
|
1) |
|
|
|
1) |
|
|
|
? "¥" |
|
|
|
? "¥" |
|
|
|
: "", |
|
|
|
: "", |
|
|
@ -568,18 +567,17 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
TextSpan( |
|
|
|
TextSpan( |
|
|
|
text: (storeInfo != null && |
|
|
|
text: (storeInfo != null && |
|
|
|
storeInfo.couponVOList != null && |
|
|
|
storeInfo!.couponVOList != null && |
|
|
|
storeInfo |
|
|
|
storeInfo! |
|
|
|
.couponVOList[position].bizType == |
|
|
|
.couponVOList![position]!.bizType! == |
|
|
|
1) |
|
|
|
1) |
|
|
|
? "${double.tryParse(storeInfo.couponVOList[position].discountAmount).toInt()}" |
|
|
|
? "${double.tryParse(storeInfo!.couponVOList![position]!.discountAmount!)!.toInt()}" |
|
|
|
: (storeInfo != null && |
|
|
|
: (storeInfo != null && |
|
|
|
storeInfo.couponVOList != null && |
|
|
|
storeInfo!.couponVOList != null && |
|
|
|
storeInfo.couponVOList[position] |
|
|
|
storeInfo!.couponVOList![position]!.bizType == |
|
|
|
.bizType == |
|
|
|
|
|
|
|
5) |
|
|
|
5) |
|
|
|
? S.of(context).duihuanquan |
|
|
|
? S.of(context).duihuanquan |
|
|
|
: "${storeInfo.couponVOList[position].discountPercent / 10}折", |
|
|
|
: "${storeInfo!.couponVOList![position]!.discountPercent! / 10}折", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 36.sp, |
|
|
|
fontSize: 36.sp, |
|
|
|
color: Color(0xFFFF7A1A), |
|
|
|
color: Color(0xFFFF7A1A), |
|
|
@ -614,9 +612,9 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
(storeInfo != null && |
|
|
|
(storeInfo != null && |
|
|
|
storeInfo.couponVOList != null) |
|
|
|
storeInfo!.couponVOList != null) |
|
|
|
? storeInfo |
|
|
|
? storeInfo! |
|
|
|
.couponVOList[position].couponName |
|
|
|
.couponVOList![position]!.couponName! |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
maxLines: 1, |
|
|
|
maxLines: 1, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
@ -628,22 +626,22 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
(storeInfo != null && |
|
|
|
(storeInfo != null && |
|
|
|
storeInfo.couponVOList != null) |
|
|
|
storeInfo!.couponVOList != null) |
|
|
|
? (storeInfo.couponVOList[position] |
|
|
|
? (storeInfo!.couponVOList![position]! |
|
|
|
.bizType == |
|
|
|
.bizType == |
|
|
|
1 |
|
|
|
1 |
|
|
|
? S.of(context).manlijiandaijinquan( |
|
|
|
? S.of(context).manlijiandaijinquan( |
|
|
|
double.tryParse(storeInfo |
|
|
|
double.tryParse(storeInfo! |
|
|
|
.couponVOList[position] |
|
|
|
.couponVOList![position]! |
|
|
|
.fullAmount) |
|
|
|
.fullAmount!)! |
|
|
|
.toInt(), |
|
|
|
.toInt(), |
|
|
|
double.tryParse(storeInfo |
|
|
|
double.tryParse(storeInfo! |
|
|
|
.couponVOList[position] |
|
|
|
.couponVOList![position]! |
|
|
|
.discountAmount) |
|
|
|
.discountAmount!)! |
|
|
|
.toInt()) |
|
|
|
.toInt()) |
|
|
|
: S.of(context).quanchangzhe(storeInfo |
|
|
|
: S.of(context).quanchangzhe(storeInfo! |
|
|
|
.couponVOList[position] |
|
|
|
.couponVOList![position]! |
|
|
|
.discountPercent)) |
|
|
|
.discountPercent!)) |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
// (storeInfo != null && storeInfo.couponVOList != null) ? storeInfo.couponVOList[position].couponImg : "", |
|
|
|
// (storeInfo != null && storeInfo.couponVOList != null) ? storeInfo.couponVOList[position].couponImg : "", |
|
|
|
// S.of(context).manlijiandaijinquan(30, 5), |
|
|
|
// S.of(context).manlijiandaijinquan(30, 5), |
|
|
@ -657,15 +655,15 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
S.of(context).youxiaoqizhi( |
|
|
|
S.of(context).youxiaoqizhi( |
|
|
|
(storeInfo != null && |
|
|
|
(storeInfo != null && |
|
|
|
storeInfo.couponVOList != |
|
|
|
storeInfo!.couponVOList != |
|
|
|
null && |
|
|
|
null && |
|
|
|
storeInfo.couponVOList[position] |
|
|
|
storeInfo!.couponVOList![position]! |
|
|
|
.useStartTime != |
|
|
|
.useStartTime != |
|
|
|
null && |
|
|
|
null && |
|
|
|
storeInfo.couponVOList[position] |
|
|
|
storeInfo!.couponVOList![position]! |
|
|
|
.useEndTime != |
|
|
|
.useEndTime != |
|
|
|
null) |
|
|
|
null) |
|
|
|
? "${storeInfo.couponVOList[position].useStartTime.replaceAll("-", ".").split(" ")[0]}-${storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" |
|
|
|
? "${storeInfo!.couponVOList![position]!.useStartTime!.replaceAll("-", ".").split(" ")[0]}-${storeInfo!.couponVOList![position]!.useEndTime!.replaceAll("-", ".").split(" ")[0]}" |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
), |
|
|
|
), |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
@ -682,25 +680,25 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
InkWell( |
|
|
|
InkWell( |
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
|
if (storeInfo != null && |
|
|
|
if (storeInfo != null && |
|
|
|
storeInfo.couponVOList != null && |
|
|
|
storeInfo!.couponVOList != null && |
|
|
|
storeInfo.couponVOList[position].status == 0) { |
|
|
|
storeInfo!.couponVOList![position]!.status == 0) { |
|
|
|
receiveCoupon( |
|
|
|
receiveCoupon( |
|
|
|
storeInfo.couponVOList[position].id); |
|
|
|
storeInfo!.couponVOList![position]!.id); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
child: Container( |
|
|
|
height: 25.h, |
|
|
|
height: 25.h, |
|
|
|
child: RoundButton( |
|
|
|
child: RoundButton( |
|
|
|
text: (storeInfo != null && |
|
|
|
text: (storeInfo != null && |
|
|
|
storeInfo.couponVOList != null && |
|
|
|
storeInfo!.couponVOList != null && |
|
|
|
storeInfo.couponVOList[position].status > |
|
|
|
storeInfo!.couponVOList![position]!.status! > |
|
|
|
0) |
|
|
|
0) |
|
|
|
? S.of(context).yilingqu |
|
|
|
? S.of(context).yilingqu |
|
|
|
: S.of(context).lingqu, |
|
|
|
: S.of(context).lingqu, |
|
|
|
textColor: Colors.white, |
|
|
|
textColor: Colors.white, |
|
|
|
backgroup: (storeInfo != null && |
|
|
|
backgroup: (storeInfo != null && |
|
|
|
storeInfo.couponVOList != null && |
|
|
|
storeInfo!.couponVOList != null && |
|
|
|
storeInfo.couponVOList[position].status > |
|
|
|
storeInfo!.couponVOList![position]!.status! > |
|
|
|
0) |
|
|
|
0) |
|
|
|
? Colors.grey |
|
|
|
? Colors.grey |
|
|
|
: Color(0xFF32A060), |
|
|
|
: Color(0xFF32A060), |
|
|
@ -724,7 +722,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
///领取优惠券 |
|
|
|
///领取优惠券 |
|
|
|
receiveCoupon(couponId) async { |
|
|
|
receiveCoupon(couponId) async { |
|
|
|
BaseData baseData = await apiService.receiveCoupon(couponId); |
|
|
|
BaseData baseData = await apiService.receiveCoupon(couponId); |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
if (baseData != null && baseData.isSuccess!) { |
|
|
|
queryStoreInfo(); |
|
|
|
queryStoreInfo(); |
|
|
|
showAlertDialog(); |
|
|
|
showAlertDialog(); |
|
|
|
} |
|
|
|
} |
|
|
@ -743,8 +741,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
|
|
|
|
|
|
|
|
///领取VIP |
|
|
|
///领取VIP |
|
|
|
receiveVip() async { |
|
|
|
receiveVip() async { |
|
|
|
BaseData baseData = await apiService.minLogin(storeInfo.id); |
|
|
|
BaseData baseData = await apiService.minLogin(storeInfo!.id!); |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
if (baseData != null && baseData.isSuccess!) { |
|
|
|
SmartDialog.showToast(S.of(context).lingquchenggong, |
|
|
|
SmartDialog.showToast(S.of(context).lingquchenggong, |
|
|
|
alignment: Alignment.center); |
|
|
|
alignment: Alignment.center); |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
@ -761,14 +759,14 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
itemBuilder: (context, position) { |
|
|
|
itemBuilder: (context, position) { |
|
|
|
return InkWell( |
|
|
|
return InkWell( |
|
|
|
onTap: () { |
|
|
|
onTap: () { |
|
|
|
if (widget.arguments["source"] != null && |
|
|
|
if (widget.arguments!["source"] != null && |
|
|
|
widget.arguments["source"] == activitys[position].id) { |
|
|
|
widget.arguments!["source"] == activitys![position].id) { |
|
|
|
Navigator.of(context).pop(); |
|
|
|
Navigator.of(context).pop(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
Navigator.of(context).pushNamed('/router/store_detail_page', |
|
|
|
Navigator.of(context).pushNamed('/router/store_detail_page', |
|
|
|
arguments: { |
|
|
|
arguments: { |
|
|
|
"activityId": activitys[position].id, |
|
|
|
"activityId": activitys![position].id, |
|
|
|
"source": widget.arguments["id"] |
|
|
|
"source": widget.arguments!["id"] |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
@ -795,8 +793,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
mainAxisSize: MainAxisSize.max, |
|
|
|
mainAxisSize: MainAxisSize.max, |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
MImage( |
|
|
|
MImage( |
|
|
|
(activitys != null && activitys.length > position) |
|
|
|
(activitys != null && activitys!.length > position) |
|
|
|
? activitys[position].coverImg |
|
|
|
? activitys![position].coverImg! |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
aspectRatio: 2.2, |
|
|
|
aspectRatio: 2.2, |
|
|
|
radius: BorderRadius.only( |
|
|
|
radius: BorderRadius.only( |
|
|
@ -815,8 +813,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
children: [ |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
(activitys != null && |
|
|
|
(activitys != null && |
|
|
|
activitys.length > position) |
|
|
|
activitys!.length > position) |
|
|
|
? activitys[position].storeName |
|
|
|
? activitys![position].storeName! |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 14.sp, |
|
|
|
fontSize: 14.sp, |
|
|
@ -829,8 +827,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
Text( |
|
|
|
(activitys != null && |
|
|
|
(activitys != null && |
|
|
|
activitys.length > position) |
|
|
|
activitys!.length > position) |
|
|
|
? activitys[position].mainTitle |
|
|
|
? activitys![position].mainTitle! |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.sp, |
|
|
|
fontSize: 12.sp, |
|
|
@ -860,8 +858,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
child: Text( |
|
|
|
child: Text( |
|
|
|
(activitys != null && activitys.length > position) |
|
|
|
(activitys != null && activitys!.length > position) |
|
|
|
? activitys[position].startTime.split(" ")[0] |
|
|
|
? activitys![position].startTime!.split(" ")[0] |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
style: TextStyle( |
|
|
|
style: TextStyle( |
|
|
|
fontWeight: FontWeight.bold, |
|
|
|
fontWeight: FontWeight.bold, |
|
|
@ -877,7 +875,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
itemCount: |
|
|
|
itemCount: |
|
|
|
(activitys != null && activitys.length > 0) ? activitys.length : 0, |
|
|
|
(activitys != null && activitys!.length > 0) ? activitys!.length : 0, |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@ -900,9 +898,9 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
margin: EdgeInsets.only(left: 10.w, right: 10.w), |
|
|
|
margin: EdgeInsets.only(left: 10.w, right: 10.w), |
|
|
|
child: MImage( |
|
|
|
child: MImage( |
|
|
|
(storeInfo != null && |
|
|
|
(storeInfo != null && |
|
|
|
storeInfo.bannerList != null && |
|
|
|
storeInfo!.bannerList != null && |
|
|
|
position < storeInfo.bannerList.length) |
|
|
|
position < storeInfo!.bannerList!.length) |
|
|
|
? storeInfo.bannerList[position].imgUrl |
|
|
|
? storeInfo!.bannerList![position]!.imgUrl! |
|
|
|
: "", |
|
|
|
: "", |
|
|
|
fit: BoxFit.cover, |
|
|
|
fit: BoxFit.cover, |
|
|
|
radius: BorderRadius.circular(4), |
|
|
|
radius: BorderRadius.circular(4), |
|
|
@ -911,8 +909,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
); |
|
|
|
}, |
|
|
|
}, |
|
|
|
itemCount: (storeInfo != null && storeInfo.bannerList != null) |
|
|
|
itemCount: (storeInfo != null && storeInfo!.bannerList != null) |
|
|
|
? storeInfo.bannerList.length |
|
|
|
? storeInfo!.bannerList!.length |
|
|
|
: 1), |
|
|
|
: 1), |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
@ -931,7 +929,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
// "position":"30.554638,114.34394500000002", |
|
|
|
// "position":"30.554638,114.34394500000002", |
|
|
|
// "token":"Bearer eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJNSU5JIiwibmFtZSI6IiIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0MTI2ODc1MjI0NTgyMzg5NzYiLCJhY2NvdW50IjoiIiwiZXhwIjoxNjI2Nzk1Nzc0LCJuYmYiOjE2MjY3NjY5NzR9.cggcx_vqTozKS-z9uygjV4uA2yHQ4eWssMAngd2c-i0"} |
|
|
|
// "token":"Bearer eyJ0eXAiOiJKc29uV2ViVG9rZW4iLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX3R5cGUiOiJNSU5JIiwibmFtZSI6IiIsInRva2VuX3R5cGUiOiJ0b2tlbiIsInVzZXJpZCI6IjE0MTI2ODc1MjI0NTgyMzg5NzYiLCJhY2NvdW50IjoiIiwiZXhwIjoxNjI2Nzk1Nzc0LCJuYmYiOjE2MjY3NjY5NzR9.cggcx_vqTozKS-z9uygjV4uA2yHQ4eWssMAngd2c-i0"} |
|
|
|
printMin() async { |
|
|
|
printMin() async { |
|
|
|
String miniAppId = storeInfo.mini.miniAppId; |
|
|
|
String miniAppId = storeInfo!.mini!.miniAppId!; |
|
|
|
print("print isExistsApp: ${await Min.isExistsApp(miniAppId)}"); |
|
|
|
print("print isExistsApp: ${await Min.isExistsApp(miniAppId)}"); |
|
|
|
print("print getAppBasePath: ${await Min.getAppBasePath(miniAppId)}"); |
|
|
|
print("print getAppBasePath: ${await Min.getAppBasePath(miniAppId)}"); |
|
|
|
print("print currentPageUrl: ${await Min.currentPageUrl()}"); |
|
|
|
print("print currentPageUrl: ${await Min.currentPageUrl()}"); |
|
|
@ -946,8 +944,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
alignment: Alignment.center); |
|
|
|
alignment: Alignment.center); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
BaseData baseData = await apiService.minLogin(storeInfo.id); |
|
|
|
BaseData baseData = await apiService.minLogin(storeInfo!.id!); |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
if (baseData != null && baseData.isSuccess!) { |
|
|
|
UserEntity userEntity = UserEntity.fromJson(baseData.data); |
|
|
|
UserEntity userEntity = UserEntity.fromJson(baseData.data); |
|
|
|
startMin(userEntity.token, userEntity.userId); |
|
|
|
startMin(userEntity.token, userEntity.userId); |
|
|
|
} |
|
|
|
} |
|
|
@ -955,12 +953,12 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
|
|
|
|
|
|
|
|
startMin(token, userId) async { |
|
|
|
startMin(token, userId) async { |
|
|
|
if (storeInfo == null) return; |
|
|
|
if (storeInfo == null) return; |
|
|
|
if (storeInfo.mini == null) return; |
|
|
|
if (storeInfo!.mini == null) return; |
|
|
|
if (!(await Min.isInitialize())) { |
|
|
|
if (!(await Min.isInitialize())) { |
|
|
|
await Min.initialize(); |
|
|
|
await Min.initialize(); |
|
|
|
} |
|
|
|
} |
|
|
|
printMin(); |
|
|
|
printMin(); |
|
|
|
String miniAppId = storeInfo.mini.miniAppId; |
|
|
|
String miniAppId = storeInfo!.mini!.miniAppId!; |
|
|
|
String filePath = ""; |
|
|
|
String filePath = ""; |
|
|
|
if (Platform.isAndroid) { |
|
|
|
if (Platform.isAndroid) { |
|
|
|
filePath = (await getExternalStorageDirectory()).path; |
|
|
|
filePath = (await getExternalStorageDirectory()).path; |
|
|
@ -973,8 +971,8 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
await downloadWgt(miniAppId, filePath); |
|
|
|
await downloadWgt(miniAppId, filePath); |
|
|
|
await Min.reloadWgt(miniAppId, filePath); |
|
|
|
await Min.reloadWgt(miniAppId, filePath); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
String version = await Min.getAppVersionInfo(storeInfo.mini.miniAppId); |
|
|
|
String version = await Min.getAppVersionInfo(storeInfo!.mini!.miniAppId!); |
|
|
|
if (version != storeInfo.mini.miniVersion) { |
|
|
|
if (version != storeInfo!.mini!.miniVersion!) { |
|
|
|
await downloadWgt(miniAppId, filePath); |
|
|
|
await downloadWgt(miniAppId, filePath); |
|
|
|
await Min.reloadWgt(miniAppId, filePath); |
|
|
|
await Min.reloadWgt(miniAppId, filePath); |
|
|
|
} |
|
|
|
} |
|
|
@ -988,17 +986,17 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
// socketUrl : 'wss://pos.api.lotus-wallet.com:10015/cart', //线上 |
|
|
|
// socketUrl : 'wss://pos.api.lotus-wallet.com:10015/cart', //线上 |
|
|
|
|
|
|
|
|
|
|
|
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); |
|
|
|
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); |
|
|
|
String nickname = sharedPreferences.getString("nick"); |
|
|
|
String? nickname = sharedPreferences.getString("nick"); |
|
|
|
String mobile = sharedPreferences.getString("mobile"); |
|
|
|
String? mobile = sharedPreferences.getString("mobile"); |
|
|
|
String user = sharedPreferences.getString('user'); |
|
|
|
String? user = sharedPreferences.getString('user'); |
|
|
|
String latitude = sharedPreferences.getString("latitude"); |
|
|
|
String? latitude = sharedPreferences.getString("latitude"); |
|
|
|
String longitude = sharedPreferences.getString("longitude"); |
|
|
|
String? longitude = sharedPreferences.getString("longitude"); |
|
|
|
print(user); |
|
|
|
print(user); |
|
|
|
UserInfo userInfo = UserInfo.fromJson(jsonDecode(user)); |
|
|
|
UserInfo userInfo = UserInfo.fromJson(jsonDecode(user!)); |
|
|
|
Min.startMin(miniAppId, { |
|
|
|
Min.startMin(miniAppId, { |
|
|
|
"token": "Bearer $token", |
|
|
|
"token": "Bearer $token", |
|
|
|
"shopId": widget.arguments["id"], |
|
|
|
"shopId": widget.arguments!["id"], |
|
|
|
"tenantCode": storeInfo.tenantCode, |
|
|
|
"tenantCode": storeInfo!.tenantCode ?? "", |
|
|
|
if (latitude != null && longitude != null) |
|
|
|
if (latitude != null && longitude != null) |
|
|
|
"position": "$latitude,$longitude", |
|
|
|
"position": "$latitude,$longitude", |
|
|
|
"baseURL": "https://pos.api.lotus-wallet.com/app/", |
|
|
|
"baseURL": "https://pos.api.lotus-wallet.com/app/", |
|
|
@ -1014,7 +1012,7 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Function state; |
|
|
|
Function? state; |
|
|
|
double progressValue = 0; |
|
|
|
double progressValue = 0; |
|
|
|
String downText = "正在下载中..."; |
|
|
|
String downText = "正在下载中..."; |
|
|
|
|
|
|
|
|
|
|
@ -1067,11 +1065,11 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
Response response = await Dio() |
|
|
|
Response response = await Dio() |
|
|
|
.download(storeInfo.mini.miniDownloadUrl, savePath, |
|
|
|
.download(storeInfo!.mini!.miniDownloadUrl, savePath, |
|
|
|
onReceiveProgress: (progress, max) { |
|
|
|
onReceiveProgress: (progress, max) { |
|
|
|
progressValue = progress.toDouble() / max.toDouble(); |
|
|
|
progressValue = progress.toDouble() / max.toDouble(); |
|
|
|
// print("print progressValue: $progressValue"); |
|
|
|
// print("print progressValue: $progressValue"); |
|
|
|
state(() {}); |
|
|
|
state!(() {}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (response.statusCode == 200) { |
|
|
|
if (response.statusCode == 200) { |
|
|
|
downText = "下载完成"; |
|
|
|
downText = "下载完成"; |
|
|
@ -1079,11 +1077,11 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
value.setStringList( |
|
|
|
value.setStringList( |
|
|
|
"miniAppid", |
|
|
|
"miniAppid", |
|
|
|
(value.getStringList("miniAppid") != null |
|
|
|
(value.getStringList("miniAppid") != null |
|
|
|
? value.getStringList("miniAppid") |
|
|
|
? value.getStringList("miniAppid")! |
|
|
|
: []) |
|
|
|
: []) |
|
|
|
..add(appid)); |
|
|
|
..add(appid)); |
|
|
|
}); |
|
|
|
}); |
|
|
|
state(() {}); |
|
|
|
state!(() {}); |
|
|
|
Future.delayed(Duration(seconds: 1), () { |
|
|
|
Future.delayed(Duration(seconds: 1), () { |
|
|
|
if (Navigator.canPop(context)) { |
|
|
|
if (Navigator.canPop(context)) { |
|
|
|
Navigator.of(context).pop(); |
|
|
|
Navigator.of(context).pop(); |
|
|
@ -1123,12 +1121,12 @@ class _UnionDetailsPage extends State<UnionDetailsPage> { |
|
|
|
title: Text(S.of(context).bodadianhua), |
|
|
|
title: Text(S.of(context).bodadianhua), |
|
|
|
actions: [ |
|
|
|
actions: [ |
|
|
|
if (storeInfo != null && |
|
|
|
if (storeInfo != null && |
|
|
|
storeInfo.headMobile != null && |
|
|
|
storeInfo!.headMobile != null && |
|
|
|
storeInfo.headMobile != "") |
|
|
|
storeInfo!.headMobile != "") |
|
|
|
CupertinoActionSheetAction( |
|
|
|
CupertinoActionSheetAction( |
|
|
|
child: Text(storeInfo.headMobile), |
|
|
|
child: Text(storeInfo!.headMobile!), |
|
|
|
onPressed: () { |
|
|
|
onPressed: () { |
|
|
|
callMobile(storeInfo.headMobile); |
|
|
|
callMobile(storeInfo!.headMobile); |
|
|
|
Navigator.of(context).pop(); |
|
|
|
Navigator.of(context).pop(); |
|
|
|
}, |
|
|
|
}, |
|
|
|
isDefaultAction: true, |
|
|
|
isDefaultAction: true, |
|
|
|