Browse Source

砍价支付更改

zyh
w-R 3 years ago
parent
commit
1a91322ef1
  1. 2
      lib/settlement/settlement.dart
  2. 6
      lib/store/shopping/shopping_goods_details.dart
  3. 38
      lib/store/shopping/shopping_home/bargain_details.dart
  4. 222
      lib/store/shopping/shopping_home/group_details.dart
  5. 10
      lib/store/shopping/shopping_home/group_page_details.dart

2
lib/settlement/settlement.dart

@ -335,7 +335,7 @@ class _Settlement extends State<Settlement> {
baseData?.isSuccess ?? false
? SmartDialog.showToast("下单失败:订单实付金额不能为0",
alignment: Alignment.center)
: SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
: SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center);
}
} else {
///

6
lib/store/shopping/shopping_goods_details.dart

@ -497,7 +497,10 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
"actProductId":actProductId,
"actProductSkuId":skuId1,
},
);
).then((value) {
_onRefresh();
setState(() {});
});
}
///
@ -507,7 +510,6 @@ class _ShoppingGoodsDetails extends State<ShoppingGoodsDetails> {
"actRecordId": launchJoinAct.actRecordId,
"limitNumber":limitNumber,
"storeInfo":storeInfo,
"skuId":skuId1
});
}

38
lib/store/shopping/shopping_home/bargain_details.dart

@ -64,7 +64,7 @@ class _BargainDetails extends State<BargainDetails> {
actRecordId = widget.arguments["actRecordId"];
limitNumber = widget.arguments["limitNumber"];
storeInfo = widget.arguments["storeInfo"];
skuId = widget.arguments["skuId"];
// skuId = widget.arguments["skuId"];
startCountdownTimer();
SharedPreferences.getInstance().then((value) {
String minToken = value.getString("minToken");
@ -128,47 +128,21 @@ class _BargainDetails extends State<BargainDetails> {
}
}
///
queryLaunchAct() async {
BaseData baseData = await minService.launchAct({
"actProductId": activityActRecordDetails.actRecord.actProductId,
"actRecordId": 0,
"actTemplateId": activityActRecordDetails.actRecord.actTemplateId,
"actTimeId": activityActRecordDetails.actRecord.actTimeId,
"addressId":"",
"isDirectBuy":true,
"getType": 1,
"productId":activityActRecordDetails.actProduct.productId,
"skuId": skuId,
"skuPrice": activityActRecordDetails.actProduct.promotionPrice,
"templateType": 3
}).catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
setState(() {
launchJoinAct = baseData.data;
toOrder();
refreshController.refreshCompleted();
});
} else {
refreshController.refreshFailed();
}
}
///
toOrder() async {
await Navigator.of(context).pushNamed(
'/router/settlement',
arguments: {
"storeInfo": storeInfo,
"pageType": 3,
"pageType": "3",
"isDirectBuy":true,
"productId": activityActRecordDetails.actProduct.productId,
"skuId":skuId,
"buyNum": 1,
"skuValue1":activityActRecordDetails.skuName,
"orderId":launchJoinAct.orderId
"orderId":launchJoinAct.orderId,
"actProductId":activityActRecordDetails.actProduct.id,
"actProductSkuId":activityActRecordDetails.actProduct.skuJson,
},
);
}
@ -566,7 +540,7 @@ class _BargainDetails extends State<BargainDetails> {
(activityActRecordDetails?.actRecord?.joinNum ?? 0))
GestureDetector(
onTap: (){
queryLaunchAct();
toOrder();
},
child: Container(
alignment: Alignment.center,

222
lib/store/shopping/shopping_home/group_details.dart

@ -50,7 +50,6 @@ class _GroupDetails extends State<GroupDetails> {
if (_timer != null) {
_timer.cancel();
}
}
@override
@ -83,7 +82,8 @@ class _GroupDetails extends State<GroupDetails> {
if (isDispose) return;
setState(() {
var tempDateTime =
DateTime.parse(activityActRecordDetails?.actRecord?.endTime).difference(DateTime.now());
DateTime.parse(activityActRecordDetails?.actRecord?.endTime)
.difference(DateTime.now());
if (tempDateTime.inSeconds < 0) {
tempDay = 0;
tempHour = 0;
@ -102,9 +102,8 @@ class _GroupDetails extends State<GroupDetails> {
///
queryShowOneAct(actRecordId) async {
BaseData<ActivityActRecordDetails> baseData = await minService
.showOneAct(actRecordId)
.catchError((error) {
BaseData<ActivityActRecordDetails> baseData =
await minService.showOneAct(actRecordId).catchError((error) {
refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
@ -274,7 +273,7 @@ class _GroupDetails extends State<GroupDetails> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if(tempDay != 0)
if (tempDay != 0)
Row(
children: [
InkWell(
@ -285,7 +284,13 @@ class _GroupDetails extends State<GroupDetails> {
alignment: Alignment.center,
decoration: BoxDecoration(
// color: Color(0xFFD2D2D2),
color: (((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) || tempDay == 0) ? Color(0xFFD2D2D2):Color(0xFFF8961E),
color: (((activityActRecordDetails
?.actRecord?.joinNum ??
0) ==
0) ||
tempDay == 0)
? Color(0xFFD2D2D2)
: Color(0xFFF8961E),
borderRadius: BorderRadius.circular(4)),
child: Text(
tempDay.toString(),
@ -305,7 +310,14 @@ class _GroupDetails extends State<GroupDetails> {
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
// color: Color(0xFFD2D2D2),
color: (activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0 ? Color(0xFFD2D2D2):Color(0xFFF8961E),
color:
(activityActRecordDetails?.actRecord?.joinNum ??
0) ==
activityActRecordDetails
?.successNumber ??
0
? Color(0xFFD2D2D2)
: Color(0xFFF8961E),
),
)),
],
@ -318,8 +330,16 @@ class _GroupDetails extends State<GroupDetails> {
alignment: Alignment.center,
decoration: BoxDecoration(
// color: Color(0xFFD2D2D2),
color: (((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0))
? Color(0xFFD2D2D2):Color(0xFFF8961E),
color: (((activityActRecordDetails?.actRecord?.joinNum ??
0) ==
activityActRecordDetails?.successNumber ??
0) ||
(tempDay == 0 &&
tempHour == 0 &&
tempM == 0 &&
tempS == 0))
? Color(0xFFD2D2D2)
: Color(0xFFF8961E),
borderRadius: BorderRadius.circular(4)),
child: Text(
tempHour.toString(),
@ -339,7 +359,16 @@ class _GroupDetails extends State<GroupDetails> {
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
// color: Color(0xFFD2D2D2),
color: (((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E),
color: (((activityActRecordDetails?.actRecord?.joinNum ??
0) ==
activityActRecordDetails?.successNumber ??
0) ||
(tempDay == 0 &&
tempHour == 0 &&
tempM == 0 &&
tempS == 0))
? Color(0xFFD2D2D2)
: Color(0xFFF8961E),
),
)),
InkWell(
@ -350,7 +379,16 @@ class _GroupDetails extends State<GroupDetails> {
alignment: Alignment.center,
decoration: BoxDecoration(
// color: Color(0xFFD2D2D2),
color:(((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E),
color: (((activityActRecordDetails?.actRecord?.joinNum ??
0) ==
activityActRecordDetails?.successNumber ??
0) ||
(tempDay == 0 &&
tempHour == 0 &&
tempM == 0 &&
tempS == 0))
? Color(0xFFD2D2D2)
: Color(0xFFF8961E),
borderRadius: BorderRadius.circular(4)),
child: Text(
tempM.toString(),
@ -370,7 +408,16 @@ class _GroupDetails extends State<GroupDetails> {
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
// color: Color(0xFFD2D2D2),
color:(((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E),
color: (((activityActRecordDetails?.actRecord?.joinNum ??
0) ==
activityActRecordDetails?.successNumber ??
0) ||
(tempDay == 0 &&
tempHour == 0 &&
tempM == 0 &&
tempS == 0))
? Color(0xFFD2D2D2)
: Color(0xFFF8961E),
),
)),
InkWell(
@ -381,7 +428,16 @@ class _GroupDetails extends State<GroupDetails> {
alignment: Alignment.center,
decoration: BoxDecoration(
// color: Color(0xFFD2D2D2),
color:(((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0) ||(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)) ? Color(0xFFD2D2D2):Color(0xFFF8961E),
color: (((activityActRecordDetails?.actRecord?.joinNum ??
0) ==
activityActRecordDetails?.successNumber ??
0) ||
(tempDay == 0 &&
tempHour == 0 &&
tempM == 0 &&
tempS == 0))
? Color(0xFFD2D2D2)
: Color(0xFFF8961E),
borderRadius: BorderRadius.circular(4)),
child: Text(
tempS.toString(),
@ -398,7 +454,9 @@ class _GroupDetails extends State<GroupDetails> {
SizedBox(
height: 24,
),
if((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0)
if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) ==
activityActRecordDetails?.successNumber ??
0)
Text(
"恭喜您拼团成功",
style: TextStyle(
@ -407,7 +465,12 @@ class _GroupDetails extends State<GroupDetails> {
color: Colors.black,
),
),
if((activityActRecordDetails?.actRecord?.joinNum ?? 0) < (activityActRecordDetails?.successNumber ?? 0) && tempDay != 0 && tempHour!=0 && tempM !=0 && tempS !=0)
if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) <
(activityActRecordDetails?.successNumber ?? 0) &&
tempDay != 0 &&
tempHour != 0 &&
tempM != 0 &&
tempS != 0)
Text.rich(
TextSpan(
children: [
@ -420,7 +483,9 @@ class _GroupDetails extends State<GroupDetails> {
),
),
TextSpan(
text:((activityActRecordDetails?.successNumber ?? 0) - (activityActRecordDetails?.actRecord?.joinNum ?? 0)).toString(),
text: ((activityActRecordDetails?.successNumber ?? 0) -
(activityActRecordDetails?.actRecord?.joinNum ?? 0))
.toString(),
style: TextStyle(
fontSize: 18.sp,
fontWeight: MyFontWeight.semi_bold,
@ -438,7 +503,12 @@ class _GroupDetails extends State<GroupDetails> {
],
),
),
if(tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0)
if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) !=
(activityActRecordDetails?.successNumber ?? 0) &&
tempDay == 0 &&
tempHour == 0 &&
tempM == 0 &&
tempS == 0)
Text(
"很遗憾,拼团失败",
style: TextStyle(
@ -453,13 +523,13 @@ class _GroupDetails extends State<GroupDetails> {
Container(
alignment: Alignment.center,
width: double.infinity,
height:80.h,
height: 80.h,
child: ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.zero,
scrollDirection: Axis.horizontal,
physics: BouncingScrollPhysics(),
itemCount:(activityActRecordDetails?.successNumber ?? 0),
itemCount: (activityActRecordDetails?.successNumber ?? 0),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {},
@ -469,18 +539,21 @@ class _GroupDetails extends State<GroupDetails> {
),
),
SizedBox(
height:54.h,
height: 54.h,
),
if((activityActRecordDetails?.actRecord?.joinNum ?? 0) == 0)
if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) ==
activityActRecordDetails?.successNumber ??
0)
InkWell(
onTap: () {
setState(() {
Navigator.of(context)
.pushNamed('/router/order_details', arguments: {
"id": activityActRecordDetails.actRecordJoinList[0].orderId
});
},
child:Container(
width:double.infinity,
height:54.h,
child: Container(
width: double.infinity,
height: 54.h,
margin: EdgeInsets.only(bottom: 28),
alignment: Alignment.center,
decoration: BoxDecoration(
@ -495,15 +568,15 @@ class _GroupDetails extends State<GroupDetails> {
),
)),
),
if((activityActRecordDetails?.actRecord?.joinNum ?? 0) < (activityActRecordDetails?.successNumber ?? 0) || tempDay != 0 && tempHour!=0 && tempM != 0 && tempS != 0)
if ((activityActRecordDetails?.actRecord?.joinNum ?? 0) <
(activityActRecordDetails?.successNumber ?? 0))
InkWell(
onTap: () {
setState(() {
});
setState(() {});
},
child:Container(
width:double.infinity,
height:54.h,
child: Container(
width: double.infinity,
height: 54.h,
margin: EdgeInsets.only(bottom: 28),
alignment: Alignment.center,
decoration: BoxDecoration(
@ -515,12 +588,12 @@ class _GroupDetails extends State<GroupDetails> {
children: [
Image.asset(
"assets/image/wx.png",
width:24,
height:24,
width: 24,
height: 24,
fit: BoxFit.cover,
),
SizedBox(
width:8,
width: 8,
),
Text(
"邀请微信好友一起拼团",
@ -533,15 +606,16 @@ class _GroupDetails extends State<GroupDetails> {
],
)),
),
if((tempDay == 0 && tempHour==0 && tempM ==0 && tempS ==0) && ((activityActRecordDetails?.actRecord?.joinNum ?? 0) < (activityActRecordDetails?.successNumber ?? 0)))
if ((tempDay == 0 && tempHour == 0 && tempM == 0 && tempS == 0) &&
((activityActRecordDetails?.actRecord?.joinNum ?? 0) <
(activityActRecordDetails?.successNumber ?? 0)))
InkWell(
onTap: () {
setState(() {
});
setState(() {});
},
child:Container(
width:double.infinity,
height:54.h,
child: Container(
width: double.infinity,
height: 54.h,
margin: EdgeInsets.only(bottom: 28),
alignment: Alignment.center,
decoration: BoxDecoration(
@ -563,17 +637,17 @@ class _GroupDetails extends State<GroupDetails> {
Widget groupItem(position) {
return Container(
margin: EdgeInsets.only(right:25),
child:Row(
margin: EdgeInsets.only(right: 25),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
if(position < (activityActRecordDetails?.actRecord?.joinNum ?? 0))
if (position < (activityActRecordDetails?.actRecord?.joinNum ?? 0))
Stack(
children: [
Container(
width:70,
height:70,
width: 70,
height: 70,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(60),
@ -583,48 +657,50 @@ class _GroupDetails extends State<GroupDetails> {
// style: BorderStyle.solid,
),
),
child:MImage(
activityActRecordDetails.actRecordJoinList[position]?.memberAvatar ?? "",
width:60,
height:60,
child: MImage(
activityActRecordDetails
.actRecordJoinList[position]?.memberAvatar ??
"",
width: 60,
height: 60,
fit: BoxFit.cover,
isCircle: true,
errorSrc: "assets/image/default_1.png",
fadeSrc: "assets/image/default_1.png",
),
),
activityActRecordDetails.actRecordJoinList[position].isLeader ?
Align(
activityActRecordDetails.actRecordJoinList[position].isLeader
? Align(
alignment: Alignment.bottomCenter,
child:Container(
child: Container(
width: 60.w,
child: Container(
width: 34.w,
height:14.h,
height: 14.h,
alignment: Alignment.center,
margin: EdgeInsets.only(left:10,right:10),
margin: EdgeInsets.only(left: 10, right: 10),
decoration: BoxDecoration(
color: Color(0xFFF8961E),
borderRadius: BorderRadius.circular(7)),
child: Text(
"团长",
style: TextStyle(
fontSize:8.sp,
fontSize: 8.sp,
fontWeight: MyFontWeight.light,
color: Colors.white,
),
)),
),
):Container(),
)
: Container(),
],
),
if(position >= (activityActRecordDetails?.actRecord?.joinNum ?? 0))
if (position >= (activityActRecordDetails?.actRecord?.joinNum ?? 0))
Container(
width: 60,
height: 67,
margin: EdgeInsets.only(left:20),
child:Image.asset(
margin: EdgeInsets.only(left: 20),
child: Image.asset(
"assets/image/pin_t.png",
width: 60.w,
height: 60.h,
@ -632,8 +708,7 @@ class _GroupDetails extends State<GroupDetails> {
),
),
],
)
);
));
}
///
@ -651,7 +726,8 @@ class _GroupDetails extends State<GroupDetails> {
)
],
color: Colors.white),
margin: EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h,bottom:40.h),
margin:
EdgeInsets.only(left: 16.w, right: 16.w, top: 24.h, bottom: 40.h),
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
@ -683,7 +759,7 @@ class _GroupDetails extends State<GroupDetails> {
fit: BoxFit.cover,
),
Container(
width:45,
width: 45,
child: Flex(
children: List.generate(8, (_) {
return SizedBox(
@ -727,14 +803,15 @@ class _GroupDetails extends State<GroupDetails> {
],
),
Container(
width:35,
width: 35,
child: Flex(
children: List.generate(0, (_) {
return SizedBox(
width: 3,
height: 1,
child: DecoratedBox(
decoration: BoxDecoration(color: Colors.white),
decoration:
BoxDecoration(color: Colors.white),
),
);
}),
@ -810,7 +887,8 @@ class _GroupDetails extends State<GroupDetails> {
width: 3,
height: 1,
child: DecoratedBox(
decoration: BoxDecoration(color: Colors.white),
decoration:
BoxDecoration(color: Colors.white),
),
);
}),
@ -886,7 +964,8 @@ class _GroupDetails extends State<GroupDetails> {
width: 3,
height: 1,
child: DecoratedBox(
decoration: BoxDecoration(color: Colors.white),
decoration:
BoxDecoration(color: Colors.white),
),
);
}),
@ -928,7 +1007,6 @@ class _GroupDetails extends State<GroupDetails> {
],
),
],
)
);
));
}
}

10
lib/store/shopping/shopping_home/group_page_details.dart

@ -8,6 +8,7 @@ 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:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/no_data_view.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -137,7 +138,14 @@ class _GroupPageDetails extends State<GroupPageDetails> {
62.h -
MediaQuery.of(context).padding.top,
padding: EdgeInsets.fromLTRB(16.w, 16.h, 16.w, 16.h),
child: ListView.builder(
child: (actRecordAndJoinlDTOList == null || actRecordAndJoinlDTOList?.length == 0)
? NoDataView(
src:"assets/image/ding_dan.png",
isShowBtn: false,
text:"目前暂无参团列表,可下单发起拼团哦~",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w),
):ListView.builder(
padding: EdgeInsets.zero,
itemCount: actRecordAndJoinlDTOList?.length ?? 0,
scrollDirection: Axis.vertical,

Loading…
Cancel
Save