From 3f62f6550b517fb78b0d9d261e63fa200970dbe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=A0=E6=96=87=E8=BD=A9?= <12812285557@qq.com> Date: Fri, 9 Jul 2021 10:47:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../user/functions/user_benefit_func.dart | 338 +++++++++--------- lib/pages/user/user_benefit_shop_page.dart | 93 +++-- 2 files changed, 213 insertions(+), 218 deletions(-) diff --git a/lib/pages/user/functions/user_benefit_func.dart b/lib/pages/user/functions/user_benefit_func.dart index 8239b69..6adcf90 100644 --- a/lib/pages/user/functions/user_benefit_func.dart +++ b/lib/pages/user/functions/user_benefit_func.dart @@ -31,203 +31,203 @@ class UserBenefitFunc { if (result.data['data'] != null) { return UserIncomeModel.fromJson(result.data['data']); } + } } - //未到账收益 - static Future notReceicedIncome( - String date_str, int type) async { - ResultData result = await HttpManager.post( - APIV2.userAPI.notReceivedDetail, {'date_str': date_str, 'type': type}); + //未到账收益 + static Future notReceicedIncome(String date_str, int type) async { + ResultData result = await HttpManager.post( + APIV2.userAPI.notReceivedDetail, + {'date_str': date_str, 'type': type}); - if (result.data != null) { - if (result.data['data'] != null) { - return UserIncomeModel.fromJson(result.data['data']); + if (result.data != null) { + if (result.data['data'] != null) { + return UserIncomeModel.fromJson(result.data['data']); + } } } - } - //团队未到账补贴 - static Future teamNotReceicedIncome(int level) async { - ResultData result = await HttpManager.post( - APIV2.userAPI.groupNotReceivedDetail, {'level': level}); + //团队未到账补贴 + static Future teamNotReceicedIncome(int level) async { + ResultData result = await HttpManager.post( + APIV2.userAPI.groupNotReceivedDetail, {'level': level}); - if (result.data != null) { - if (result.data['data'] != null) { - return UserIncomeModel.fromJson(result.data['data']); + if (result.data != null) { + if (result.data['data'] != null) { + return UserIncomeModel.fromJson(result.data['data']); + } } } - } - //团队未到账补贴 + //团队未到账补贴 static Future teamReceicedIncome(int year) async { - ResultData result = await HttpManager.post( - APIV2.userAPI.groupReceivedDetail, {'year': year}); + ResultData result = await HttpManager.post( + APIV2.userAPI.groupReceivedDetail, {'year': year}); - if (result.data != null) { - if (result.data['data'] != null) { - return UserIncomeModel.fromJson(result.data['data']); + if (result.data != null) { + if (result.data['data'] != null) { + return UserIncomeModel.fromJson(result.data['data']); + } } } - } - static Future update() async { - ResultData result = await HttpManager.post(APIV2.userAPI.userBenefit, {}); - return UserBenefitModel.fromJson(result.data); - } + static Future update() async { + ResultData result = await HttpManager.post(APIV2.userAPI.userBenefit, {}); + return UserBenefitModel.fromJson(result.data); + } static Future accmulate() async { - ResultData result = await HttpManager.post(APIV2.userAPI.accumulate, {}); - return UserAccumulateModel.fromJson(result.data); - } - - static Future> monthIncome({int year}) async { - ResultData result = await HttpManager.post( - APIV2.userAPI.monthIncome, - {'year': year}, - ); - return (result.data['data'] as List) - .map((e) => UserMonthIncomeModel.fromJson(e)) - .toList(); - } - - static Future subInfo(UserBenefitPageType type) async { - String path = ''; - switch (type) { - case UserBenefitPageType.SELF: - path = APIV2.userAPI.selfIncome; - break; - case UserBenefitPageType.GUIDE: - path = APIV2.userAPI.guideIncome; - break; - case UserBenefitPageType.TEAM: - path = APIV2.userAPI.teamIncome; - break; - case UserBenefitPageType.RECOMMEND: - path = APIV2.userAPI.recommandIncome; - break; - case UserBenefitPageType.PLATFORM: - path = APIV2.userAPI.platformIncome; - break; + ResultData result = await HttpManager.post(APIV2.userAPI.accumulate, {}); + return UserAccumulateModel.fromJson(result.data); } - ResultData result = await HttpManager.post(path, {}); - return UserBenefitSubModel.fromJson(result.data, type); - } - static Future> monthDetail( - DateTime date) async { - ResultData result = await HttpManager.post( - APIV2.userAPI.monthDetail, - {'month': DateUtil.formatDate(date, format: 'yyyy-MM')}, - ); - if (result.data['data'] == null) - return []; - else + static Future> monthIncome({int year}) async { + ResultData result = await HttpManager.post( + APIV2.userAPI.monthIncome, + {'year': year}, + ); return (result.data['data'] as List) - .map((e) => UserBenefitMonthDetailModel.fromJson(e)) + .map((e) => UserMonthIncomeModel.fromJson(e)) .toList(); - } + } - static Future extraDetail({ - UserBenefitPageType type, - DateTime date, - }) async { - String path = ''; - switch (type) { - case UserBenefitPageType.TEAM: - path = APIV2.userAPI.groupDetail; - break; - case UserBenefitPageType.RECOMMEND: - path = APIV2.userAPI.recommendDetail; - break; - case UserBenefitPageType.PLATFORM: - path = APIV2.userAPI.platformDetail; - break; - default: - break; + static Future subInfo(UserBenefitPageType type) async { + String path = ''; + switch (type) { + case UserBenefitPageType.SELF: + path = APIV2.userAPI.selfIncome; + break; + case UserBenefitPageType.GUIDE: + path = APIV2.userAPI.guideIncome; + break; + case UserBenefitPageType.TEAM: + path = APIV2.userAPI.teamIncome; + break; + case UserBenefitPageType.RECOMMEND: + path = APIV2.userAPI.recommandIncome; + break; + case UserBenefitPageType.PLATFORM: + path = APIV2.userAPI.platformIncome; + break; + } + ResultData result = await HttpManager.post(path, {}); + return UserBenefitSubModel.fromJson(result.data, type); } - ResultData result = await HttpManager.post( - path, - {'month': DateUtil.formatDate(date, format: 'yyyy-MM')}, - ); - return UserBenefitExtraDetailModel.fromJson(result.data); - } - static Future getCommonModel( - BenefitDateType type, - DateTime date, - ) async { - String path = ''; - Map params = {}; - switch (type) { - case BenefitDateType.DAY: - path = APIV2.benefitAPI.dayIncome; - params.putIfAbsent( - 'day', - () => DateUtil.formatDate(date, format: 'yyyy-MM-dd'), - ); - break; - case BenefitDateType.MONTH: - path = APIV2.benefitAPI.monthIncome; - params.putIfAbsent( - 'month', - () => DateUtil.formatDate(date, format: 'yyyy-MM'), - ); - break; + static Future> monthDetail(DateTime date) async { + ResultData result = await HttpManager.post( + APIV2.userAPI.monthDetail, + {'month': DateUtil.formatDate(date, format: 'yyyy-MM')}, + ); + if (result.data['data'] == null) + return []; + else + return (result.data['data'] as List) + .map((e) => UserBenefitMonthDetailModel.fromJson(e)) + .toList(); } - ResultData result = await HttpManager.post(path, params); - return UserBenefitCommonModel.fromJson(result.data['data']); - } + static Future extraDetail({ + UserBenefitPageType type, + DateTime date, + }) async { + String path = ''; + switch (type) { + case UserBenefitPageType.TEAM: + path = APIV2.userAPI.groupDetail; + break; + case UserBenefitPageType.RECOMMEND: + path = APIV2.userAPI.recommendDetail; + break; + case UserBenefitPageType.PLATFORM: + path = APIV2.userAPI.platformDetail; + break; + default: + break; + } + ResultData result = await HttpManager.post( + path, + {'month': DateUtil.formatDate(date, format: 'yyyy-MM')}, + ); + return UserBenefitExtraDetailModel.fromJson(result.data); + } - static Future getBenefitDayExpect( - DateTime date) async { - String path = ''; - Map params = {}; - path = APIV2.benefitAPI.dayExpect; - params.putIfAbsent( - 'day', - () => DateUtil.formatDate(date, format: 'yyyy-MM-dd'), - ); - ResultData result = await HttpManager.post(path, params); - return UserBenefitDayExpectModel.fromJson(result.data['data']); - } + static Future getCommonModel( + BenefitDateType type, + DateTime date, + ) async { + String path = ''; + Map params = {}; + switch (type) { + case BenefitDateType.DAY: + path = APIV2.benefitAPI.dayIncome; + params.putIfAbsent( + 'day', + () => DateUtil.formatDate(date, format: 'yyyy-MM-dd'), + ); + break; + case BenefitDateType.MONTH: + path = APIV2.benefitAPI.monthIncome; + params.putIfAbsent( + 'month', + () => DateUtil.formatDate(date, format: 'yyyy-MM'), + ); + break; + } - static Future getBenefitMonthExpect( - DateTime date) async { - String path = ''; - Map params = {}; - path = APIV2.benefitAPI.monthExpect; - params.putIfAbsent( - 'month', - () => DateUtil.formatDate(date, format: 'yyyy-MM'), - ); - ResultData result = await HttpManager.post(path, params); - return UserBenefitMonthExpectModel.fromJson(result.data['data']); - } + ResultData result = await HttpManager.post(path, params); + return UserBenefitCommonModel.fromJson(result.data['data']); + } + + static Future getBenefitDayExpect(DateTime date) async { + String path = ''; + Map params = {}; + path = APIV2.benefitAPI.dayExpect; + params.putIfAbsent( + 'day', + () => DateUtil.formatDate(date, format: 'yyyy-MM-dd'), + ); + ResultData result = await HttpManager.post(path, params); + return UserBenefitDayExpectModel.fromJson(result.data['data']); + } - static Future getBenefitExpectExtra( - BenefitDateType type, - DateTime date, - ) async { - String path = ''; - Map params = {}; - switch (type) { - case BenefitDateType.DAY: - path = APIV2.benefitAPI.dayExpectExtra; - params.putIfAbsent( - 'day', - () => DateUtil.formatDate(date, format: 'yyyy-MM-dd'), - ); - break; - case BenefitDateType.MONTH: - path = APIV2.benefitAPI.monthExpectExtra; - params.putIfAbsent( - 'month', - () => DateUtil.formatDate(date, format: 'yyyy-MM'), - ); - break; + static Future getBenefitMonthExpect( + DateTime date) async { + String path = ''; + Map params = {}; + path = APIV2.benefitAPI.monthExpect; + params.putIfAbsent( + 'month', + () => DateUtil.formatDate(date, format: 'yyyy-MM'), + ); + ResultData result = await HttpManager.post(path, params); + return UserBenefitMonthExpectModel.fromJson(result.data['data']); + } + + static Future getBenefitExpectExtra( + BenefitDateType type, + DateTime date, + ) async { + String path = ''; + Map params = {}; + switch (type) { + case BenefitDateType.DAY: + path = APIV2.benefitAPI.dayExpectExtra; + params.putIfAbsent( + 'day', + () => DateUtil.formatDate(date, format: 'yyyy-MM-dd'), + ); + break; + case BenefitDateType.MONTH: + path = APIV2.benefitAPI.monthExpectExtra; + params.putIfAbsent( + 'month', + () => DateUtil.formatDate(date, format: 'yyyy-MM'), + ); + break; + } + ResultData result = await HttpManager.post(path, params); + return UserBenefitExpectExtraModel.fromJson(result.data['data']); } - ResultData result = await HttpManager.post(path, params); - return UserBenefitExpectExtraModel.fromJson(result.data['data']); } -} + diff --git a/lib/pages/user/user_benefit_shop_page.dart b/lib/pages/user/user_benefit_shop_page.dart index 5a0eb2c..218b748 100644 --- a/lib/pages/user/user_benefit_shop_page.dart +++ b/lib/pages/user/user_benefit_shop_page.dart @@ -310,62 +310,57 @@ class _UserBenefitShopPageState extends State { // setState(() {}); // _refreshController.refreshCompleted(); //}, - body: ListView( + body: ListView( children: [ - Stack( - children: [ - Positioned( - left: 0, - right: 0, - top: 0, - child: CustomPaint(painter: RoundBackgroundPainter()), - ), - _buildCard(), - ], - ), + Stack(children: [ + Positioned( + left: 0, + right: 0, + top: 0, + child: CustomPaint(painter: RoundBackgroundPainter()), + ), + ]), + 10.hb, Row( children: [ 10.wb, - MaterialButton( - shape: StadiumBorder(), - elevation: 0, - color: Colors.white, - onPressed: () { - showTimePickerBottomSheet( - submit: (time, type) { - Navigator.maybePop(context); - _date = time; - _refreshController.requestRefresh(); - setState(() {}); - }, - timePickerTypes: [ - BottomTimePickerType.BottomTimePickerMonth - ]); - }, - height: 31.rw, - child: Row( - children: [ - DateUtil.formatDate(_date, format: 'yyyy-MM') - .text - .black - .size(14.rsp) - .make(), - Icon( - Icons.arrow_drop_down, - color: Colors.black87, - ), - ], - ), - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - ), - Spacer(), - - 15.wb, + // MaterialButton( + // shape: StadiumBorder(), + // elevation: 0, + // color: Colors.white, + // onPressed: () { + // showTimePickerBottomSheet( + // submit: (time, type) { + // Navigator.maybePop(context); + // _date = time; + // _refreshController.requestRefresh(); + // setState(() {}); + // }, + // timePickerTypes: [ + // BottomTimePickerType.BottomTimePickerMonth + // ]); + // }, + // height: 31.rw, + // child: Row( + // children: [ + // DateUtil.formatDate(_date, format: 'yyyy-MM') + // .text + // .black + // .size(14.rsp) + // .make(), + // Icon( + // Icons.arrow_drop_down, + // color: Colors.black87, + // ), + // ], + // ), + // materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + // ), ], ), - + _buildCard(), ], - ), + //_buildGroupItems(), ), ),