|
|
|
@ -5,6 +5,7 @@ import 'package:dio/dio.dart';
|
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
|
|
|
|
import 'package:flutter_html/flutter_html.dart'; |
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
|
import 'package:flutter_swiper/flutter_swiper.dart'; |
|
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
@ -75,6 +76,8 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
Timer _timer; |
|
|
|
|
String testTime = "2021-12-30 10:00:00"; |
|
|
|
|
LaunchJoinAct launchJoinAct; |
|
|
|
|
int bargainType = 0; |
|
|
|
|
String indexP; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
void dispose() { |
|
|
|
@ -150,11 +153,12 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
|
|
|
|
|
///会员信息 |
|
|
|
|
queryMemberInfo() async { |
|
|
|
|
BaseData baseData = await minService.memberInfo() |
|
|
|
|
.catchError((error){debugPrint(error);}); |
|
|
|
|
BaseData baseData = await minService.memberInfo().catchError((error) { |
|
|
|
|
debugPrint(error); |
|
|
|
|
}); |
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
SharedPreferences.getInstance().then( |
|
|
|
|
(value) => { |
|
|
|
|
(value) => { |
|
|
|
|
value.setString('minMember', jsonEncode(baseData.data)), |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
@ -197,8 +201,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
miNiDetail = baseData.data; |
|
|
|
|
if (pageType != null) |
|
|
|
|
queryViewProduct(actProductId, pageType); |
|
|
|
|
if (pageType != null) queryViewProduct(actProductId, pageType); |
|
|
|
|
}); |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
} else { |
|
|
|
@ -254,16 +257,19 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
showLoading: false, |
|
|
|
|
); |
|
|
|
|
BaseData baseData = await minService.launchAct({ |
|
|
|
|
"actProductId": pageType == null ? miNiDetail.productSkuVOList[0].id : activityDetails.actProduct.id, |
|
|
|
|
"actProductId": pageType == null |
|
|
|
|
? miNiDetail.productSkuVOList[0].id |
|
|
|
|
: activityDetails.actProduct.id, |
|
|
|
|
"actRecordId": 0, |
|
|
|
|
"actTemplateId": activityDetails.actProduct.templateId, |
|
|
|
|
"actTimeId": activityDetails.actProduct.timeId, |
|
|
|
|
"addressId":"", |
|
|
|
|
"isDirectBuy":pageType == "3" ? false : true, |
|
|
|
|
"addressId": "", |
|
|
|
|
"isDirectBuy": (bargainType == 1 || bargainType == 2) ? false : true, |
|
|
|
|
"getType": 1, |
|
|
|
|
"productId": pageType == null ? productId :activityDetails.actProduct.productId, |
|
|
|
|
"productId": |
|
|
|
|
pageType == null ? productId : activityDetails.actProduct.productId, |
|
|
|
|
"skuId": skuId1, |
|
|
|
|
"skuPrice":skuPrice1, |
|
|
|
|
"skuPrice": skuPrice1, |
|
|
|
|
"templateType": pageType |
|
|
|
|
}).catchError((error) { |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
@ -271,14 +277,16 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
setState(() { |
|
|
|
|
launchJoinAct = baseData.data; |
|
|
|
|
if(pageType == "3"){ |
|
|
|
|
if (bargainType == 1) { |
|
|
|
|
toBargain(); |
|
|
|
|
}else{ |
|
|
|
|
} else { |
|
|
|
|
toOrder(); |
|
|
|
|
} |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
}); |
|
|
|
|
} else { |
|
|
|
|
if((activityDetails?.actProduct?.productStock ?? 0) == 0) |
|
|
|
|
SmartDialog.showToast("活动商品售罄",alignment: Alignment.center); |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -286,16 +294,19 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
///参与活动 |
|
|
|
|
queryJoinAct() async { |
|
|
|
|
BaseData baseData = await minService.joinAct({ |
|
|
|
|
"actProductId": pageType == null ? miNiDetail.productSkuVOList[0].id : activityDetails.actProduct.id, |
|
|
|
|
"actRecordId": launchJoinAct.actRecordId, |
|
|
|
|
"actProductId": pageType == null |
|
|
|
|
? miNiDetail.productSkuVOList[0].id |
|
|
|
|
: activityDetails.actProduct.id, |
|
|
|
|
"actRecordId": indexP, |
|
|
|
|
"actTemplateId": activityDetails.actProduct.templateId, |
|
|
|
|
"actTimeId": activityDetails.actProduct.timeId, |
|
|
|
|
"addressId":"", |
|
|
|
|
"isDirectBuy":pageType == "3" ? false : true, |
|
|
|
|
"addressId": "", |
|
|
|
|
"isDirectBuy": pageType == "3" ? false : true, |
|
|
|
|
"getType": 1, |
|
|
|
|
"productId": pageType == null ? productId :activityDetails.actProduct.productId, |
|
|
|
|
"productId": |
|
|
|
|
pageType == null ? productId : activityDetails.actProduct.productId, |
|
|
|
|
"skuId": skuId1, |
|
|
|
|
"skuPrice":skuPrice1, |
|
|
|
|
"skuPrice": skuPrice1, |
|
|
|
|
"templateType": pageType, |
|
|
|
|
}).catchError((error) { |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
@ -305,6 +316,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
toOrder(); |
|
|
|
|
refreshController.refreshCompleted(); |
|
|
|
|
} else { |
|
|
|
|
SmartDialog.showToast(baseData.msg,alignment: Alignment.center); |
|
|
|
|
refreshController.refreshFailed(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -367,7 +379,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
setState(() { |
|
|
|
|
skuId1 = skuId; |
|
|
|
|
skuValue1 = skuValue; |
|
|
|
|
skuPrice1 =skuPrice; |
|
|
|
|
skuPrice1 = skuPrice; |
|
|
|
|
count1 = count; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -488,14 +500,16 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
arguments: { |
|
|
|
|
"storeInfo": storeInfo, |
|
|
|
|
"pageType": pageType, |
|
|
|
|
"isDirectBuy":true, |
|
|
|
|
"productId": (pageType!=null) ? activityDetails.actProduct.productId : miNiDetail.id, |
|
|
|
|
"skuId":skuId1, |
|
|
|
|
"isDirectBuy": true, |
|
|
|
|
"productId": (pageType != null) |
|
|
|
|
? activityDetails.actProduct.productId |
|
|
|
|
: miNiDetail.id, |
|
|
|
|
"skuId": skuId1, |
|
|
|
|
"buyNum": count1, |
|
|
|
|
"skuValue1":skuValue1, |
|
|
|
|
"orderId":launchJoinAct.orderId, |
|
|
|
|
"actProductId":actProductId, |
|
|
|
|
"actProductSkuId":skuId1, |
|
|
|
|
"skuValue1": skuValue1, |
|
|
|
|
"orderId": launchJoinAct.orderId, |
|
|
|
|
"actProductId": actProductId, |
|
|
|
|
"actProductSkuId": skuId1, |
|
|
|
|
}, |
|
|
|
|
).then((value) { |
|
|
|
|
_onRefresh(); |
|
|
|
@ -506,14 +520,13 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
///去砍价详情页面 |
|
|
|
|
toBargain() async { |
|
|
|
|
await Navigator.of(context) |
|
|
|
|
.pushNamed('/router/bargain_details',arguments: { |
|
|
|
|
.pushNamed('/router/bargain_details', arguments: { |
|
|
|
|
"actRecordId": launchJoinAct.actRecordId, |
|
|
|
|
"limitNumber":limitNumber, |
|
|
|
|
"storeInfo":storeInfo, |
|
|
|
|
"limitNumber": limitNumber, |
|
|
|
|
"storeInfo": storeInfo, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
Widget build(BuildContext context) { |
|
|
|
|
return Stack( |
|
|
|
@ -582,20 +595,20 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
// Container( |
|
|
|
|
// color: Colors.white, |
|
|
|
|
// margin: EdgeInsets.only(bottom: 72.h), |
|
|
|
|
// child: Html( |
|
|
|
|
// data: miNiDetail?.detail ?? "", |
|
|
|
|
// customImageRenders: { |
|
|
|
|
// networkSourceMatcher(): networkImageRender( |
|
|
|
|
// loadingWidget: () { |
|
|
|
|
// return Container(); |
|
|
|
|
// }, |
|
|
|
|
// ), |
|
|
|
|
// }, |
|
|
|
|
// ), |
|
|
|
|
// ), |
|
|
|
|
Container( |
|
|
|
|
color: Colors.white, |
|
|
|
|
margin: EdgeInsets.only(bottom: 72.h), |
|
|
|
|
child: Html( |
|
|
|
|
data: pageType != null ? (activityDetails?.actProduct?.detail ?? "") : (miNiDetail?.detail ?? ""), |
|
|
|
|
customImageRenders: { |
|
|
|
|
networkSourceMatcher(): networkImageRender( |
|
|
|
|
loadingWidget: () { |
|
|
|
|
return Container(); |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
}, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
@ -904,7 +917,12 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
children: [ |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
toDownOrder(); |
|
|
|
|
bargainType = 0; |
|
|
|
|
if (count1 == 0) { |
|
|
|
|
SmartDialog.showToast("请先选择您要购买的商品!~"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
queryLaunchAct(); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.center, |
|
|
|
@ -960,6 +978,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
bargainType = 1; |
|
|
|
|
if (count1 == 0) { |
|
|
|
|
SmartDialog.showToast("请先选择您要购买的商品!~"); |
|
|
|
|
return; |
|
|
|
@ -997,7 +1016,8 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
TextSpan( |
|
|
|
|
text: activityDetails?.actProduct?.promotionPrice ?? |
|
|
|
|
text: activityDetails |
|
|
|
|
?.actProduct?.promotionPrice ?? |
|
|
|
|
"", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
@ -1090,6 +1110,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
bargainType = 2; |
|
|
|
|
if (count1 == 0) { |
|
|
|
|
SmartDialog.showToast("请先选择您要购买的商品!~"); |
|
|
|
|
return; |
|
|
|
@ -1183,13 +1204,21 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
height: 50.h, |
|
|
|
|
padding: EdgeInsets.only(left: 16.w), |
|
|
|
|
// decoration: BoxDecoration( |
|
|
|
|
// // image: DecorationImage( |
|
|
|
|
// // fit: BoxFit.fill, |
|
|
|
|
// // image: NetworkImage(bannerImg), |
|
|
|
|
// // ), |
|
|
|
|
// color: Colors.green, |
|
|
|
|
// ), |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
// image: DecorationImage( |
|
|
|
|
// fit: BoxFit.fill, |
|
|
|
|
// image: NetworkImage(bannerImg), |
|
|
|
|
// ), |
|
|
|
|
color: Colors.green, |
|
|
|
|
), |
|
|
|
|
gradient: LinearGradient( |
|
|
|
|
begin: Alignment.centerLeft, |
|
|
|
|
end: Alignment.centerRight, |
|
|
|
|
colors: [ |
|
|
|
|
Color(0xFF32A057), |
|
|
|
|
Color(0xFF61CE6B) |
|
|
|
|
])), |
|
|
|
|
child: Row( |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
@ -1245,36 +1274,78 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
) |
|
|
|
|
: Row( |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
margin: EdgeInsets.only(right: 2), |
|
|
|
|
padding: EdgeInsets.only(left: 2, right: 2), |
|
|
|
|
height: 15.h, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(2), |
|
|
|
|
color: Color(0xFFFFFFFF), |
|
|
|
|
), |
|
|
|
|
child: Text( |
|
|
|
|
"${limitNumber ?? 0}人团", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 9.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: Color(0xFF45B35F), |
|
|
|
|
: (pageType == "1" |
|
|
|
|
? Row( |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
margin: EdgeInsets.only(right: 2), |
|
|
|
|
padding: EdgeInsets.only(left: 2, right: 2), |
|
|
|
|
height: 15.h, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: BorderRadius.circular(2), |
|
|
|
|
color: Color(0xFFFFFFFF), |
|
|
|
|
), |
|
|
|
|
child: Text( |
|
|
|
|
"${limitNumber ?? 0}人团", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 9.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: Color(0xFF45B35F), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"已团${(activityDetails?.actProduct?.sellCount ?? 0)}件", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
Text( |
|
|
|
|
"已团${(activityDetails?.actProduct?.sellCount ?? 0)}件", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
: (pageType == "3" |
|
|
|
|
? Row( |
|
|
|
|
children: [ |
|
|
|
|
Container( |
|
|
|
|
margin: EdgeInsets.only(right: 2), |
|
|
|
|
padding: |
|
|
|
|
EdgeInsets.only(left: 2, right: 2), |
|
|
|
|
height: 15.h, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
|
borderRadius: |
|
|
|
|
BorderRadius.circular(2), |
|
|
|
|
color: Color(0xFFFFFFFF), |
|
|
|
|
), |
|
|
|
|
child: Text( |
|
|
|
|
"最高可砍${double.parse(activityDetails?.actProduct?.productPrice ?? "0") - double.parse(activityDetails?.actProduct?.promotionPrice ?? "0")}元", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 9.sp, |
|
|
|
|
fontWeight: MyFontWeight.semi_bold, |
|
|
|
|
color: Color(0xFF45B35F), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
"已砍${(activityDetails?.actProduct?.sellCount ?? 0)}件", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
fontSize: 11.sp, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
: Text( |
|
|
|
|
"已秒${activityDetails?.actProduct?.sellCount ?? 0}件", |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontWeight: MyFontWeight.medium, |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
color: Colors.white, |
|
|
|
|
), |
|
|
|
|
))) |
|
|
|
|
], |
|
|
|
|
) |
|
|
|
|
], |
|
|
|
@ -1303,8 +1374,8 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
Container( |
|
|
|
|
margin: EdgeInsets.only(top: 8, right: 8), |
|
|
|
|
padding: EdgeInsets.only(left: 2, right: 2), |
|
|
|
|
margin: EdgeInsets.only(right: 8), |
|
|
|
|
padding: EdgeInsets.only(left:3, right:3), |
|
|
|
|
height: 17.h, |
|
|
|
|
alignment: Alignment.center, |
|
|
|
|
decoration: BoxDecoration( |
|
|
|
@ -1314,7 +1385,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
child: Text( |
|
|
|
|
pageType == null |
|
|
|
|
? (miNiDetail?.supplierName ?? "") |
|
|
|
|
: ("没字段"), |
|
|
|
|
: (activityDetails?.actProduct?.supplierName ?? ""), |
|
|
|
|
style: TextStyle( |
|
|
|
|
fontSize: 10.sp, |
|
|
|
|
fontWeight: MyFontWeight.regular, |
|
|
|
@ -1328,7 +1399,7 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
height: 8.h, |
|
|
|
|
), |
|
|
|
|
Text( |
|
|
|
|
pageType == null ? (miNiDetail?.shortName ?? "") : ("没字段"), |
|
|
|
|
pageType == null ? (miNiDetail?.shortName ?? "") : (activityDetails?.actProduct?.shortName ?? ""), |
|
|
|
|
maxLines: 2, |
|
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
|
style: TextStyle( |
|
|
|
@ -1573,12 +1644,11 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
setState(() { |
|
|
|
|
Navigator.of(context).pushNamed( |
|
|
|
|
'/router/group_page_details', |
|
|
|
|
arguments: { |
|
|
|
|
"actRecordAndJoinlDTOList": json |
|
|
|
|
.encode(activityDetails.actRecordAndJoinlDTOList), |
|
|
|
|
}); |
|
|
|
|
Navigator.of(context) |
|
|
|
|
.pushNamed('/router/group_page_details', arguments: { |
|
|
|
|
"actRecordAndJoinlDTOList": |
|
|
|
|
json.encode(activityDetails.actRecordAndJoinlDTOList), |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
child: Row( |
|
|
|
@ -1709,10 +1779,11 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
|
|
|
|
|
), |
|
|
|
|
GestureDetector( |
|
|
|
|
onTap: () { |
|
|
|
|
indexP = actRecordAndJoinlDTOList.actRecord.id; |
|
|
|
|
if (count1 == 0) { |
|
|
|
|
SmartDialog.showToast("请先选择您要购买的商品!~"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
SmartDialog.showToast("请先选择您要购买的商品!~"); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
queryJoinAct(); |
|
|
|
|
}, |
|
|
|
|
child: Container( |
|
|
|
|