|
|
|
@ -12,6 +12,7 @@ import 'package:huixiang/retrofit/data/store_info.dart';
|
|
|
|
|
import 'package:huixiang/retrofit/min_api.dart'; |
|
|
|
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
|
|
|
import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/classic_header.dart'; |
|
|
|
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
@ -21,6 +22,7 @@ class ActivityPrefectureDetails extends StatefulWidget {
|
|
|
|
|
final Map<String, dynamic> arguments; |
|
|
|
|
|
|
|
|
|
ActivityPrefectureDetails({this.arguments}); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
State<StatefulWidget> createState() { |
|
|
|
|
return _ActivityPrefectureDetails(); |
|
|
|
@ -117,8 +119,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
storeId: storeId, |
|
|
|
|
showLoading: false, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
queryStoreInfo(); |
|
|
|
|
queryFindActListByType(pageType == "2" ? false : true); |
|
|
|
|
|
|
|
|
|
EasyLoading.dismiss(); |
|
|
|
|
} |
|
|
|
@ -127,8 +128,9 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
|
|
|
|
|
/// 查询店铺信息 |
|
|
|
|
queryStoreInfo() async { |
|
|
|
|
BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) { |
|
|
|
|
debugPrint(error); |
|
|
|
|
BaseData baseData = |
|
|
|
|
await apiService.queryStoreInfo(storeId).catchError((error) { |
|
|
|
|
debugPrint(error.toString()); |
|
|
|
|
}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
storeInfo = StoreInfo.fromJson(baseData.data); |
|
|
|
@ -144,8 +146,9 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
|
|
|
|
|
///秒杀/砍价/拼团列表 |
|
|
|
|
queryFindActListByType(allDay) async { |
|
|
|
|
BaseData<ActivityAreaList> baseData = |
|
|
|
|
await minService.findActListByType(allDay,pageType).catchError((error) { |
|
|
|
|
BaseData<ActivityAreaList> baseData = await minService |
|
|
|
|
.findActListByType(allDay, pageType) |
|
|
|
|
.catchError((error) { |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
}); |
|
|
|
|
setState(() { |
|
|
|
@ -175,14 +178,13 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
|
|
|
|
|
///限天秒杀时间 |
|
|
|
|
startCountdownTimer() { |
|
|
|
|
if(_timer != null) |
|
|
|
|
return; |
|
|
|
|
if (_timer != null) return; |
|
|
|
|
const oneSec = const Duration(seconds: 1); |
|
|
|
|
var callback = ((timer) { |
|
|
|
|
if(isDispose) |
|
|
|
|
return; |
|
|
|
|
if (isDispose) return; |
|
|
|
|
setState(() { |
|
|
|
|
var tempDateTime = DateTime.parse(actTemplate.endTime).difference(DateTime.now()); |
|
|
|
|
var tempDateTime = |
|
|
|
|
DateTime.parse(actTemplate.endTime).difference(DateTime.now()); |
|
|
|
|
if (tempDateTime.inSeconds < 0) { |
|
|
|
|
tempDay = 0; |
|
|
|
|
tempHour = 0; |
|
|
|
@ -201,7 +203,19 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return SingleChildScrollView( |
|
|
|
|
return Container( |
|
|
|
|
child: SmartRefresher( |
|
|
|
|
controller: refreshController, |
|
|
|
|
enablePullDown: true, |
|
|
|
|
enablePullUp: false, |
|
|
|
|
header: MyHeader(), |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
onRefresh: () { |
|
|
|
|
setState(() { |
|
|
|
|
queryFindActListByType(pageType == "2" ? false : true); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child:SingleChildScrollView( |
|
|
|
|
physics: BouncingScrollPhysics(), |
|
|
|
|
controller: _scrollController, |
|
|
|
|
child: Column( |
|
|
|
@ -212,6 +226,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
seckilList(), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -233,7 +249,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
swiper(), |
|
|
|
|
pageType == "2"?(seckillIndex == 0 |
|
|
|
|
pageType == "2" |
|
|
|
|
? (seckillIndex == 0 |
|
|
|
|
? Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
@ -264,10 +281,13 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
setState(() { |
|
|
|
|
actTimeListIndex = position; |
|
|
|
|
productList.clear(); |
|
|
|
|
productList.addAll(actTimeList[actTimeListIndex].productList); |
|
|
|
|
productList.addAll( |
|
|
|
|
actTimeList[actTimeListIndex] |
|
|
|
|
.productList); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: timeItem(actTimeList[position], position), |
|
|
|
|
child: |
|
|
|
|
timeItem(actTimeList[position], position), |
|
|
|
|
); |
|
|
|
|
}, |
|
|
|
|
)), |
|
|
|
@ -408,7 +428,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
) |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
)) :Container(), |
|
|
|
|
)) |
|
|
|
|
: Container(), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
@ -422,7 +443,10 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
child: Stack( |
|
|
|
|
children: [ |
|
|
|
|
Positioned( |
|
|
|
|
top: 0,left: 0,right: 0,bottom: 0, |
|
|
|
|
top: 0, |
|
|
|
|
left: 0, |
|
|
|
|
right: 0, |
|
|
|
|
bottom: 0, |
|
|
|
|
child: MImage( |
|
|
|
|
actTemplate?.coverImg ?? "", |
|
|
|
|
width: double.infinity, |
|
|
|
@ -445,8 +469,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
pageType == "2" ? |
|
|
|
|
Align( |
|
|
|
|
pageType == "2" |
|
|
|
|
? Align( |
|
|
|
|
alignment: Alignment.topCenter, |
|
|
|
|
child: Container( |
|
|
|
|
margin: EdgeInsets.only(top: 52), |
|
|
|
@ -551,7 +575,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
) : Container(), |
|
|
|
|
) |
|
|
|
|
: Container(), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -566,8 +591,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
MediaQuery.of(context).padding.top, |
|
|
|
|
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h), |
|
|
|
|
color: Colors.white, |
|
|
|
|
child: productList.length == 0 ? |
|
|
|
|
Container( |
|
|
|
|
child: productList.length == 0 |
|
|
|
|
? Container( |
|
|
|
|
width: double.infinity, |
|
|
|
|
alignment: Alignment.topCenter, |
|
|
|
|
child: Text( |
|
|
|
@ -578,7 +603,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
color: Colors.black, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
):ListView.builder( |
|
|
|
|
) |
|
|
|
|
: ListView.builder( |
|
|
|
|
padding: EdgeInsets.zero, |
|
|
|
|
itemCount: productList?.length ?? 0, |
|
|
|
|
scrollDirection: Axis.vertical, |
|
|
|
@ -606,8 +632,7 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
int timeFlag(String time) { |
|
|
|
|
if(time == null) |
|
|
|
|
return 0; |
|
|
|
|
if (time == null) return 0; |
|
|
|
|
var now = DateTime.now().hour; |
|
|
|
|
var tHour = int.tryParse(time.substring(0, 2)); |
|
|
|
|
if (now < tHour) |
|
|
|
@ -787,7 +812,13 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
color: Color(0xFFF5F5F5), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
width:productList.sellCount == 0 ? 0 :(((productList?.sellCount ?? 0)/(productList?.productStock ?? 0)) * 180.w).toDouble(), |
|
|
|
|
width: productList.sellCount == null |
|
|
|
|
? 0 |
|
|
|
|
: (((productList?.sellCount ?? 0) / |
|
|
|
|
(productList?.productStock ?? |
|
|
|
|
0)) * |
|
|
|
|
180.w) |
|
|
|
|
.toDouble(), |
|
|
|
|
height: 8.h, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
gradient: LinearGradient( |
|
|
|
@ -849,7 +880,9 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 14.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: pageType == "3" ?Color(0xFF9476F7) : Color(0xFFFB2E2C), |
|
|
|
|
color: pageType == "3" |
|
|
|
|
? Color(0xFF9476F7) |
|
|
|
|
: Color(0xFFFB2E2C), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
@ -857,7 +890,9 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 18.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color:pageType == "3" ?Color(0xFF9476F7) : Color(0xFFFB2E2C), |
|
|
|
|
color: pageType == "3" |
|
|
|
|
? Color(0xFF9476F7) |
|
|
|
|
: Color(0xFFFB2E2C), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
@ -876,8 +911,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
if (pageType == "2") |
|
|
|
|
(seckillIndex == 0 ? |
|
|
|
|
(tStatus == 0 |
|
|
|
|
(seckillIndex == 0 |
|
|
|
|
? (tStatus == 0 |
|
|
|
|
? Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
width: 60.w, |
|
|
|
@ -953,7 +988,8 @@ class _ActivityPrefectureDetails extends State<ActivityPrefectureDetails> {
|
|
|
|
|
color: Color(0xFFADADAD), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
))) : Container( |
|
|
|
|
))) |
|
|
|
|
: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
width: 60.w, |
|
|
|
|
height: 24.h, |
|
|
|
|