Browse Source

Merge remote-tracking branch 'origin/new_revision_app' into new_revision_app

dart3_last
fmk 2 years ago
parent
commit
ec18602e1c
  1. 14
      lib/home/welfare_page.dart
  2. 2
      lib/retrofit/retrofit_api.dart
  3. 2
      lib/settlement/settlement.dart
  4. 2
      lib/settlement/settlement_view/activity_coupon_remarks.dart
  5. 8
      lib/view_widget/new_coupon_widget.dart
  6. 100
      lib/vip/vip_page.dart
  7. 8
      lib/vip/vip_view/vip_top.dart

14
lib/home/welfare_page.dart

@ -157,7 +157,7 @@ class _WelfarePage extends State<WelfarePage> {
appBar: MyAppBar( appBar: MyAppBar(
background: Colors.transparent, background: Colors.transparent,
leadingColor: Colors.white, leadingColor: Colors.white,
title: "福利中心", title: S.of(context).fulizhongxin,
titleColor: Colors.white, titleColor: Colors.white,
titleSize: 18.sp, titleSize: 18.sp,
brightness: Brightness.dark, brightness: Brightness.dark,
@ -520,7 +520,7 @@ class _WelfarePage extends State<WelfarePage> {
textBaseline: TextBaseline.alphabetic, textBaseline: TextBaseline.alphabetic,
children: [ children: [
Text( Text(
"¥", cop.limitAmount != "0.00"?"¥":"",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
@ -531,9 +531,9 @@ class _WelfarePage extends State<WelfarePage> {
height: 4.h, height: 4.h,
), ),
Text( Text(
coupon != null cop.limitAmount != "0.00"?(coupon != null
? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}" ? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}"
: "", : "") :"",
style: TextStyle( style: TextStyle(
fontSize: 24.sp, fontSize: 24.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -555,10 +555,10 @@ class _WelfarePage extends State<WelfarePage> {
textBaseline: TextBaseline.alphabetic, textBaseline: TextBaseline.alphabetic,
children: [ children: [
Text( Text(
coupon != null cop.discountPercent != 0 ? (coupon != null
? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.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,
@ -569,7 +569,7 @@ class _WelfarePage extends State<WelfarePage> {
height: 4.h, height: 4.h,
), ),
Text( Text(
"", cop.discountPercent != 0 ? "" :"",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,

2
lib/retrofit/retrofit_api.dart

@ -537,7 +537,7 @@ abstract class ApiService {
Future<BaseData<VipCardHome>> vipCardIndex(); Future<BaseData<VipCardHome>> vipCardIndex();
///VIP订阅/ ///VIP订阅/
@POST("/vipCard/orderVip/{id}") @POST("/vipCard/orderVip")
Future<BaseData<dynamic>> orderVip(@Body() Map<String, dynamic> param); Future<BaseData<dynamic>> orderVip(@Body() Map<String, dynamic> param);

2
lib/settlement/settlement.dart

@ -80,7 +80,7 @@ class _Settlement extends State<Settlement> {
int count1 = 0; int count1 = 0;
String productId; String productId;
bool orderButton = false; bool orderButton = false;
bool useVipPriceSelect = false; bool useVipPriceSelect = true;
@override @override
void initState() { void initState() {

2
lib/settlement/settlement_view/activity_coupon_remarks.dart

@ -43,7 +43,7 @@ class ActivityCouponRemarks extends StatefulWidget {
} }
class _ActivityCouponRemarks extends State<ActivityCouponRemarks> { class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
bool vipSelect = false; bool vipSelect = true;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {

8
lib/view_widget/new_coupon_widget.dart

@ -497,6 +497,7 @@ class NewCouponWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
if(coupon?.limitAmount != "0.00")
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.baseline, crossAxisAlignment: CrossAxisAlignment.baseline,
@ -532,16 +533,17 @@ class NewCouponWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
// if(coupon.discountPercent != 0)
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.baseline, crossAxisAlignment: CrossAxisAlignment.baseline,
textBaseline: TextBaseline.alphabetic, textBaseline: TextBaseline.alphabetic,
children: [ children: [
Text( Text(
coupon != null coupon.discountPercent != 0?( coupon != null
? "${(coupon.discountPercent / 10.0 >= 10) ? 10 : coupon.discountPercent / 10.0}" ?? ? "${(coupon.discountPercent / 10.0 >= 10) ? 10 : coupon.discountPercent / 10.0}" ??
"0" "0"
: "", : ""):"",
style: TextStyle( style: TextStyle(
fontSize: 37.sp, fontSize: 37.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -552,7 +554,7 @@ class NewCouponWidget extends StatelessWidget {
height: 4.h, height: 4.h,
), ),
Text( Text(
"", "${coupon.discountPercent != 0 ? "":""}",
style: TextStyle( style: TextStyle(
fontSize: 20.sp, fontSize: 20.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,

100
lib/vip/vip_page.dart

@ -44,32 +44,31 @@ class _VipPageState extends State<VipPage> with AutomaticKeepAliveClientMixin {
} }
queryVipHome() async { queryVipHome() async {
if (apiService == null) { try{
SharedPreferences value = await SharedPreferences.getInstance(); if (apiService == null) {
apiService = ApiService( SharedPreferences value = await SharedPreferences.getInstance();
Dio(), apiService = ApiService(
context: context, Dio(),
token: value.getString("token"), context: context,
showLoading: true token: value.getString("token"),
); showLoading: true
} );
BaseData<VipCardHome> baseData = }
await apiService.vipCardIndex().catchError((onError) { BaseData<VipCardHome> baseData =
_refreshController.refreshFailed();}); await apiService.vipCardIndex().catchError((onError) {
if (baseData != null && baseData.isSuccess) { _refreshController.refreshFailed();});
vipHome = baseData.data; if (baseData != null && baseData.isSuccess) {
_refreshController.refreshCompleted(); vipHome = baseData.data;
}else{ _refreshController.refreshCompleted();
_refreshController.refreshFailed(); }else{
SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center); _refreshController.refreshFailed();
SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center);
}
}finally{
setState((){});
} }
} }
_onRefresh() {
queryVipHome();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
@ -77,39 +76,32 @@ class _VipPageState extends State<VipPage> with AutomaticKeepAliveClientMixin {
backgroundColor: Color(0xFFF9FAF7), backgroundColor: Color(0xFFF9FAF7),
body: Container( body: Container(
padding: EdgeInsets.only(bottom: 76.h), padding: EdgeInsets.only(bottom: 76.h),
child: Container( child: SmartRefresher(
child: FutureBuilder( controller: _refreshController,
future:queryVipHome(), enablePullDown: true,
builder: (context, snapshot) { enablePullUp: false,
return SmartRefresher( header: MyHeader(),
controller: _refreshController, physics: BouncingScrollPhysics(),
enablePullDown: true, onRefresh: () {
enablePullUp: false, queryVipHome();
header: MyHeader(), },
physics: BouncingScrollPhysics(), child: SingleChildScrollView(
onRefresh: () { child: Container(
setState(() { child:Column(
_onRefresh(); mainAxisAlignment: MainAxisAlignment.start,
}); crossAxisAlignment: CrossAxisAlignment.start,
}, children: [
child: SingleChildScrollView( VipTop(vipHome,(){
child: Container( queryVipHome();
child:Column( }),
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VipTop(vipHome,_onRefresh()),
if(vipHome !=null) if(vipHome !=null)
VipGoodsDiscount(vipHome), VipGoodsDiscount(vipHome),
ExclusiveCoupon(), ExclusiveCoupon(),
], ],
), ),
), ),
),
);
},
), ),
), ),
), ),

8
lib/vip/vip_view/vip_top.dart

@ -20,9 +20,9 @@ import 'package:tobias/tobias.dart' as tobias;
class VipTop extends StatefulWidget { class VipTop extends StatefulWidget {
final VipCardHome vipCardHome; final VipCardHome vipCardHome;
final Function onRefresh; final Function queryVipHome;
VipTop(this.vipCardHome, this.onRefresh); VipTop(this.vipCardHome, this.queryVipHome);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -42,7 +42,7 @@ class _VipTop extends State<VipTop> {
payListen = weChatResponseEventHandler.listen((event) async { payListen = weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}"); print("payCallback: ${event.errCode}");
if (event.errCode == 0) { if (event.errCode == 0) {
widget.onRefresh(); widget.queryVipHome();
SmartDialog.showToast("支付成功", alignment: Alignment.center); SmartDialog.showToast("支付成功", alignment: Alignment.center);
} else { } else {
SmartDialog.showToast("支付失败", alignment: Alignment.center); SmartDialog.showToast("支付失败", alignment: Alignment.center);
@ -96,7 +96,7 @@ class _VipTop extends State<VipTop> {
tobias.aliPay(baseData.data["body"]).then((payRes) { tobias.aliPay(baseData.data["body"]).then((payRes) {
if (payRes['resultStatus'] == 9000 || if (payRes['resultStatus'] == 9000 ||
payRes['resultStatus'] == '9000') { payRes['resultStatus'] == '9000') {
widget.onRefresh(); widget.queryVipHome();
SmartDialog.showToast("支付成功", SmartDialog.showToast("支付成功",
alignment: Alignment.center); alignment: Alignment.center);
} else { } else {

Loading…
Cancel
Save