Browse Source

新版福利中心更改

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

723
lib/home/welfare_page.dart

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

985
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 @override
Widget build(BuildContext context) { 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) { Widget priceWidget(BuildContext context) {
if (coupon.bizType == 1) { if (coupon.bizType == 1) {
return Column( return Column(

32
lib/view_widget/receive_success.dart

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