Browse Source

新版福利中心更改

zyh
w-R 3 years ago
parent
commit
cd5903ae8e
  1. 645
      lib/home/welfare_page.dart
  2. 2
      lib/mine/mine_vip/mine_attainment_page.dart
  3. 977
      lib/store/shop__details_page.dart
  4. 391
      lib/view_widget/new_coupon_widget.dart
  5. 28
      lib/view_widget/receive_success.dart

645
lib/home/welfare_page.dart

@ -33,15 +33,13 @@ class WelfarePage extends StatefulWidget {
class _WelfarePage extends State<WelfarePage> {
ApiService apiService;
final RefreshController refreshController = RefreshController();
final ScrollController scrollController = ScrollController();
List<Goods> goods = [];
List<Coupon> coupons = [];
// List<Coupon> coupon;
List<List<Coupon>> coupon=[];
String categoryId;
bool orderDesc = true;
int orderType = 1;
int pageNum = 1;
int type = 1;
@override
void initState() {
@ -52,20 +50,23 @@ class _WelfarePage extends State<WelfarePage> {
queryCoupon(),
});
for(var i = 0;i < coupons.length~/3+1;i++){
List<Coupon> con = [];
con = coupons.skip(i*3).take((i*3<coupons.length)?3:(coupons.length - (i*3))).toList();
coupon.add(con);
}
}
queryGoods() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
var param = {
"categoryId": categoryId ?? "",
"orderDesc": orderDesc,
"orderType": orderType,
"pageNum": pageNum,
"pageSize": 10,
"pageNum": 1,
"pageSize": 100,
"state": 1
};
BaseData<PageInfo<Goods>> pageGoods =
@ -76,18 +77,11 @@ class _WelfarePage extends State<WelfarePage> {
EasyLoading.dismiss();
if (pageGoods != null && pageGoods.isSuccess) {
setState(() {
if (pageNum == 1) {
goods.clear();
}
goods.addAll(pageGoods.data.list);
});
refreshController.refreshCompleted();
refreshController.loadComplete();
if (pageGoods.data.pageNum == pageGoods.data.pages) {
refreshController.loadNoData();
} else {
pageNum += 1;
}
} else {
refreshController.loadFailed();
refreshController.refreshFailed();
@ -95,26 +89,35 @@ class _WelfarePage extends State<WelfarePage> {
}
queryCoupon() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<PageInfo<Coupon>> baseData = await apiService.queryCoupon({
"centre": true,
"pageNum": pageNum,
"pageSize": 10,
"pageNum": 1,
"pageSize": 100,
"searchKey": "",
"state": 0
}).catchError((onError) {
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (pageNum == 1) coupons.clear();
coupons.clear();
coupon.clear();
if (baseData != null && baseData.isSuccess) {
coupons.addAll(baseData.data.list);
for(var i = 0;i < coupons.length~/3+1;i++){
List<Coupon> con = [];
con = coupons.skip(i*3).take((i*3<coupons.length)?3:(coupons.length - (i*3))).toList();
coupon.add(con);
}
refreshController.refreshCompleted();
refreshController.loadComplete();
if (baseData.data.pageNum == baseData.data.pages) {
refreshController.loadNoData();
} else {
pageNum += 1;
}
setState(() {});
} else {
refreshController.refreshFailed();
@ -123,6 +126,12 @@ class _WelfarePage extends State<WelfarePage> {
}
_onRefresh(){
queryGoods();
// queryCoupon();
}
@override
Widget build(BuildContext context) {
return Stack(
@ -159,18 +168,16 @@ class _WelfarePage extends State<WelfarePage> {
),
onRefresh:(){
setState(() {
_onRefresh();
});
},
physics: BouncingScrollPhysics(),
scrollController: scrollController,
scrollController: ScrollController(),
child: Container(
margin: EdgeInsets.only(top: 45.h,left: 14,right: 14),
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: FutureBuilder(
// future: querySignInfo(),
builder: (context, snap) {
return Column(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -184,8 +191,6 @@ class _WelfarePage extends State<WelfarePage> {
// activityTask(),
],
);
},
),
),
),
@ -246,10 +251,11 @@ class _WelfarePage extends State<WelfarePage> {
],
)),
AspectRatio(
aspectRatio: 1.22,
aspectRatio: 1.10,
child: Swiper(
viewportFraction: 0.9,
scale: 0.7,
key: UniqueKey(),
pagination: SwiperPagination(
alignment: Alignment.bottomCenter,
builder: DotSwiperPaginationBuilder(
@ -265,14 +271,13 @@ class _WelfarePage extends State<WelfarePage> {
return Column(
children: [
Container(
child: weekList1(),
child: weekList(coupon[position]),
// weekList(testList2[position]),
),
],
);
},
itemCount:coupon.length,
// testList2.length,
),
)
],
@ -318,14 +323,10 @@ class _WelfarePage extends State<WelfarePage> {
);
}
List<String> testList = ["1","2","3","4","5","6","7","8","9","10","11"];
List<List<String>> testList2 = [];
Widget weekList(List<String> list){
Widget weekList(List<Coupon> cops){
return Expanded(child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: list.length,
itemCount: cops.length,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
@ -333,294 +334,113 @@ class _WelfarePage extends State<WelfarePage> {
return GestureDetector(
onTap: () {
},
child: weekItem(list[position]),
child: weekCoupon(cops[position]),
);
},
));
}
Widget weekItem(String cnt) {
Widget weekCoupon(Coupon cop) {
return Container(
height: 95.h,
width: double.infinity,
height:110.h,
margin: EdgeInsets.only(bottom:10),
padding:EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/image/week_coupons.webp"),
),
),
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 12.h),
margin: EdgeInsets.only(bottom:10),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child:
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
Expanded(child: Container(
margin: EdgeInsets.only(top: 12,bottom: 12),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child:
Text(
cnt,
// "新人满减30元",
cop != null ? cop.couponName ?? "" : "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF353535),
),
),
SizedBox(height:4.h,),
Text(
"有效期至2022-09-10 12:00:00",
style: TextStyle(
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D),
),
),
SizedBox(height:5.h,),
Row(
children: [
Text(
"使用详情",
style: TextStyle(
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D),
),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF4D4D4D),
size: 20,
)
],
),
],
)),
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "¥",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
),
),
TextSpan(
text: "30",
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
),
),
],
),
),
Expanded(child:
(cop.useStartTime == null &&
cop.useEndTime == null)?
Text(
"满30.1可用",
S.of(context).quantian,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF32A060),
color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
),
),
SizedBox(height: 8,),
Container(
width: 50.w,
height: 19.h,
decoration: BoxDecoration(
color: Color(0xFF32A060),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child:Text(
"领取",
):Text(
"有效期至 ${cop?.useEndTime ?? ""}",
maxLines:1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFFFFFFF),
),
),
)
],
color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
),
],
),
);
}
)),
GestureDetector(
onTap: (){
// showDeleteDialog();
Widget weekList1(){
return Expanded(child: (coupons != null && coupons.length > 0)
? ListView.builder(
itemBuilder: (context, position) {
return GestureDetector(
child: NewCouponWidget(
coupons[position],
(type) {
if (type == 1) {
receiveCoupon(coupons[position].id);
} else {
if (coupons[position].bizType == 5 || coupons[position].bizType == 3) {
Navigator.of(context).pushNamed(
'/router/write_off_page',
arguments: {
"couponId": coupons[position].id,
"coupon": coupons[position].toJson()
});
} else {
showStoreSelector(coupons[position].storeList);
}
}
},
() {
setState((){
coupons[position].isEx = !coupons[position].isEx;
});
},
type: 1,
),
);
},
itemCount: (coupons != null && coupons.length > 0) ? coupons.length : 0,
)
: NoDataView(
src: "assets/image/ka.webp",
isShowBtn: false,
text: S.of(context).haimeiyouyouhuiquankeyilingqu,
fontSize: 16.sp,
));
}
Widget weekItem1() {
return Container(
width:double.infinity,
height:110.h,
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/image/week_coupons.webp"),
),
),
padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 12.h),
margin: EdgeInsets.only(bottom:10),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(child:
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"新人满减30元",
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF353535),
),
),
SizedBox(height:4.h,),
Text(
"有效期至2022-09-10 12:00:00",
style: TextStyle(
fontSize: 11.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D),
),
),
SizedBox(height:5.h,),
Row(
children: [
Text(
"使用详情",
style: TextStyle(
fontSize: 11.sp,
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D),
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xFF4D4D4D),
),
),
Icon(
Icons.keyboard_arrow_right,
color: Color(0xFF4D4D4D),
color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
size: 20,
)
],
),
)
],
),
)),
Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "¥",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
),
),
TextSpan(
text: "30",
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF32A060),
),
),
],
),
),
Text(
"满30.1可用",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF32A060),
),
),
SizedBox(height: 8,),
Expanded(child: Container(
child:weekWidget(cop),
)),
Container(
width: 50.w,
height: 19.h,
decoration: BoxDecoration(
color: Color(0xFF32A060),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child:Text(
"领取",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFFFFFFF),
),
),
margin: EdgeInsets.only(bottom: 12),
child: weekBtn(cop),
)
],
),
)
],
),
);
}
Widget weekWidget(Coupon coupon) {
if (coupon.bizType == 1) {
Widget weekWidget(Coupon cop) {
if (cop.bizType == 1) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@ -635,7 +455,7 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
SizedBox(
@ -643,47 +463,47 @@ class _WelfarePage extends State<WelfarePage> {
),
Text(
coupon != null
? double.tryParse("${coupon.discountAmount}" ?? "0")
? double.tryParse("${cop.discountAmount}" ?? "0")
.toInt()
.toString()
: "",
style: TextStyle(
fontSize: 26.sp,
fontSize: 24.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
),
Text(
S.of(context).manyuankeyong(coupon != null
? ("${coupon.fullAmount}" ?? "0")
? ("${cop.fullAmount}" ?? "0")
.toString()
: ""),
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
);
} else if (coupon.bizType == 3) {
} else if (cop.bizType == 3) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
padding: EdgeInsets.only(bottom:10,top: 7),
// padding: EdgeInsets.only(bottom:10,top: 7),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
S.of(context).duihuanquan,
style: TextStyle(
fontSize: 26.sp,
fontSize: 22.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color:cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
@ -694,12 +514,12 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
);
} else if (coupon.bizType == 5) {
} else if (cop.bizType == 5) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@ -714,7 +534,7 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
@ -725,7 +545,7 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
@ -742,13 +562,13 @@ class _WelfarePage extends State<WelfarePage> {
children: [
Text(
coupon != null
? "${(coupon.discountPercent / 10.0 >= 10) ? 10 : coupon.discountPercent / 10.0}" ??
? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.discountPercent / 10.0}" ??
"0"
: "",
style: TextStyle(
fontSize: 30.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
SizedBox(
@ -759,7 +579,7 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
@ -769,144 +589,101 @@ class _WelfarePage extends State<WelfarePage> {
}
}
// Widget weekBtn(Coupon coupon) {
// if (type == 1) {
// if (coupon != null && coupon.status == 0) {
// return Align(
// alignment: Alignment.centerRight,
// child: InkWell(
// onTap: () {
// callback(type);
// },
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(3),
// color: Color(0xFF32A060),
// ),
// child: Text(
// S.of(context).lingqu,
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),
// ),
// ),
// );
// } else {
// return Align(
// alignment: Alignment.centerRight,
// child: Container(
// padding: EdgeInsets.symmetric(horizontal:8,vertical: 2),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(3),
// color: Colors.grey,
// ),
// child: Text(
// S.of(context).yilingqu,
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),
// ),
// );
// }
// } else {
// if (coupon != null && coupon.status == 1) {
// return Align(
// alignment: Alignment.centerRight,
// child: InkWell(
// onTap: () {
// callback(type);
// },
// child: Container(
// // width: 56.w,
Widget weekBtn(Coupon cop) {
if(cop.status == 0)
return Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {
setState(() {
receiveCoupon(cop.id);
});
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Color(0xFF32A060),
),
child: Text(
S.of(context).lingqu,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
),
);
if(cop.status == 1)
return Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {
if (cop.bizType == 5 || cop.bizType == 3) {
Navigator.of(context).pushNamed(
'/router/write_off_page',
arguments: {
"couponId": cop.id,
"coupon": cop.toJson()
});
} else {
showStoreSelector(cop.storeList);
}
},
child: Container(
// height: 19.h,
// // padding: EdgeInsets.symmetric(horizontal:8,vertical: 2),
// decoration: BoxDecoration(
// color: Color(0xFF32A060),
// borderRadius: BorderRadius.circular(3),
// ),
// alignment: Alignment.center,
// child:Text(
// S.of(context).qushiyong,
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Color(0xFFFFFFFF),
// ),
// ),
// ),
// // Container(
// // padding: EdgeInsets.fromLTRB(16.w, 2.h, 16.w, 2.h),
// // decoration: BoxDecoration(
// // borderRadius: BorderRadius.circular(10.5),
// // color: Color(0xFF32A060),
// // ),
// // child: Text(
// // (coupon.bizType == 5 || coupon.bizType == 3)
// // ? S.of(context).quhexiao
// // : S.of(context).qushiyong,
// // style: TextStyle(
// // fontSize: 12.sp,
// // fontWeight: MyFontWeight.medium,
// // color: Colors.white,
// // ),
// // ),
// // ),
// ),
// );
// } else if (coupon != null && coupon.status == 2) {
// return Align(
// alignment: Alignment.centerRight,
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(3),
// // border: Border.all(
// // width: 1, color: Color(0xFFA0A0A0), style: BorderStyle.solid)
// color: Color(0xFFA0A0A0),
// ),
// child: Text(
// S.of(context).yishiyong,
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),
// ),
// );
// } else {
// return Align(
// alignment: Alignment.centerRight,
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
// // decoration: BoxDecoration(
// // borderRadius: BorderRadius.circular(10.5),
// // // border: Border.all(
// // // width: 1, color: Color(0xFFA0A0A0), style: BorderStyle.solid)
// // color: Color(0xFFA0A0A0),
// // ),
// child: Text(
// S.of(context).yishixiao,
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.semi_bold,
// color: Color(0xFFB3B3B3),
// ),
// ),
// ),
// );
// }
// }
// }
padding: EdgeInsets.symmetric(horizontal:8,vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
border: Border.all(
width: 1, color: Color(0xFF32A060), style: BorderStyle.solid),
color: Colors.transparent,
),
alignment: Alignment.center,
child:Text(
S.of(context).qushiyong,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF32A060),
),
),
),
),
);
}
receiveCoupon(couponId) async {
BaseData baseData = await apiService.receiveCoupon(couponId);
if (baseData != null && baseData.isSuccess) {
queryCoupon();
showAlertDialog();
}
}
showStoreSelector(storeList) {
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return SelectorStoreWidget(storeList);
},
);
}
showAlertDialog() {
//
showDialog(
context: context,
builder: (BuildContext context) {
return ReceiveSuccess();
},
);
}
///
Widget inviteFriends() {
@ -1236,32 +1013,4 @@ class _WelfarePage extends State<WelfarePage> {
);
}
receiveCoupon(couponId) async {
BaseData baseData = await apiService.receiveCoupon(couponId);
if (baseData != null && baseData.isSuccess) {
queryCoupon();
showAlertDialog();
}
}
showStoreSelector(storeList) {
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return SelectorStoreWidget(storeList);
},
);
}
showAlertDialog() {
//
showDialog(
context: context,
builder: (BuildContext context) {
return ReceiveSuccess();
},
);
}
}

2
lib/mine/mine_vip/mine_attainment_page.dart

@ -39,7 +39,6 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
List<AchievementDetailList> achievementDetail = [];
int checkPosition = 0;
SocialInfo infoNumber;
final ScrollController scrollController = ScrollController();
final RefreshController refreshController = RefreshController();
@ -165,7 +164,6 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
});
},
physics: BouncingScrollPhysics(),
scrollController: scrollController,
child: Container(
child:
SingleChildScrollView(

977
lib/store/shop__details_page.dart

File diff suppressed because it is too large Load Diff

391
lib/view_widget/new_coupon_widget.dart

@ -16,7 +16,7 @@ class NewCouponWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return homeCoupon(context);
return buildCoupon(context);
}
@ -378,395 +378,6 @@ class NewCouponWidget extends StatelessWidget {
);
}
///ui
Widget homeCoupon(BuildContext context) {
return Container(
height: 110.h,
width: double.infinity,
margin: EdgeInsets.fromLTRB(14.w, 6.h, 14.w, 6.h),
padding:EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/image/week_coupons.webp"),
),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: Container(
margin: EdgeInsets.only(top: 12,bottom: 12),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child:
Text(
coupon != null ? coupon.couponName ?? "" : "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF353535),
),
)),
Expanded(child:
(coupon.useStartTime == null &&
coupon.useEndTime == null)?
Text(
S.of(context).quantian,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
),
):Text(
"有效期至 ${coupon?.useEndTime ?? ""}",
maxLines:1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
),
)),
GestureDetector(
onTap: (){
// showDeleteDialog();
},
child: Row(
children: [
Text(
"使用详情",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xFF4D4D4D),
),
),
Icon(
Icons.keyboard_arrow_right,
color: coupon.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
size: 20,
)
],
),
)
],
),
)),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(child: Container(
child:homeWidget(context),
)),
Container(
margin: EdgeInsets.only(bottom: 12),
child: homeBtn(context),
)
],
)
],
),
);
}
Widget homeWidget(BuildContext context) {
if (coupon.bizType == 1) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Text(
"¥",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
SizedBox(
height: 4.h,
),
Text(
coupon != null
? double.tryParse("${coupon.discountAmount}" ?? "0")
.toInt()
.toString()
: "",
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
),
Text(
S.of(context).manyuankeyong(coupon != null
? ("${coupon.fullAmount}" ?? "0")
.toString()
: ""),
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
);
} else if (coupon.bizType == 3) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
padding: EdgeInsets.only(bottom:10,top: 7),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
S.of(context).duihuanquan,
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
),
),
Text(
S.of(context).xianshangshiyong,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
);
} else if (coupon.bizType == 5) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
padding: EdgeInsets.only(bottom:10,top: 7),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
S.of(context).duihuanquan,
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
),
),
Text(
S.of(context).xianxiashiyong,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
);
} else {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic,
children: [
Text(
coupon != null
? "${(coupon.discountPercent / 10.0 >= 10) ? 10 : coupon.discountPercent / 10.0}" ??
"0"
: "",
style: TextStyle(
fontSize: 30.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
SizedBox(
height: 4.h,
),
Text(
"",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: coupon.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
),
),
],
),
],
);
}
}
Widget homeBtn(context) {
if (type == 1) {
if (coupon != null && coupon.status == 0) {
return Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {
callback(type);
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Color(0xFF32A060),
),
child: Text(
S.of(context).lingqu,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
),
);
} else {
return Align(
alignment: Alignment.centerRight,
child: Container(
padding: EdgeInsets.symmetric(horizontal:8,vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
color: Colors.grey,
),
child: Text(
S.of(context).yilingqu,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
);
}
} else {
if (coupon != null && coupon.status == 1) {
return Align(
alignment: Alignment.centerRight,
child: InkWell(
onTap: () {
callback(type);
},
child: Container(
// width: 56.w,
height: 19.h,
// padding: EdgeInsets.symmetric(horizontal:8,vertical: 2),
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child:Text(
S.of(context).qushiyong,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFFFFFFFF),
),
),
),
// Container(
// padding: EdgeInsets.fromLTRB(16.w, 2.h, 16.w, 2.h),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10.5),
// color: Color(0xFF32A060),
// ),
// child: Text(
// (coupon.bizType == 5 || coupon.bizType == 3)
// ? S.of(context).quhexiao
// : S.of(context).qushiyong,
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.medium,
// color: Colors.white,
// ),
// ),
// ),
),
);
} else if (coupon != null && coupon.status == 2) {
return Align(
alignment: Alignment.centerRight,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(3),
// border: Border.all(
// width: 1, color: Color(0xFFA0A0A0), style: BorderStyle.solid)
color: Color(0xFFA0A0A0),
),
child: Text(
S.of(context).yishiyong,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
),
),
),
);
} else {
return Align(
alignment: Alignment.centerRight,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 14,vertical: 2),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(10.5),
// // border: Border.all(
// // width: 1, color: Color(0xFFA0A0A0), style: BorderStyle.solid)
// color: Color(0xFFA0A0A0),
// ),
child: Text(
S.of(context).yishixiao,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFB3B3B3),
),
),
),
);
}
}
}
Widget priceWidget(BuildContext context) {
if (coupon.bizType == 1) {
return Column(

28
lib/view_widget/receive_success.dart

@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/view_widget/round_button.dart';
@ -31,7 +30,9 @@ class ReceiveSuccess extends StatelessWidget {
Padding(
padding: EdgeInsets.only(top: 50.h, bottom: 19.h),
child: Text(
S.of(context).lingquchenggong,
S
.of(context)
.lingquchenggong,
style: TextStyle(
color: Color(0xff353535),
fontSize: 16.sp,
@ -49,9 +50,18 @@ class ReceiveSuccess extends StatelessWidget {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"${S.of(context).main_menu4}-",
style: TextStyle(
color: Color(0xff353535),
fontSize: 14.sp,
),
),
GestureDetector(
child: Text(
S.of(context).kaquan,
"${S
.of(context)
.youhuiquan}",
style: TextStyle(
color: Color(0xFFFF7A1A),
fontSize: 14.sp,
@ -59,12 +69,13 @@ class ReceiveSuccess extends StatelessWidget {
),
),
onTap: () {
Navigator.of(context)
.pushNamed('/router/mine_card');
Navigator.of(context).pushNamed('/router/coupon_page');
},
),
Text(
S.of(context).zhongchakan,
S
.of(context)
.zhongchakan,
style: TextStyle(
color: Color(0xff353535),
fontSize: 14.sp,
@ -77,7 +88,9 @@ class ReceiveSuccess extends StatelessWidget {
child: RoundButton(
width: 130.w,
height: 34.h,
text: S.of(context).queren,
text: S
.of(context)
.queren,
textColor: Colors.white,
fontSize: 12.sp,
callback: () {
@ -108,5 +121,4 @@ class ReceiveSuccess extends StatelessWidget {
}
}
Loading…
Cancel
Save