Browse Source

首页,积分,我的成就,我的页面-其他,会员卡列表,店铺充值,订单列表,充值,门店列表,福利中心等板块,整体优化更改;

店铺充值:店铺充值列表,店铺充值接口都改为小程序接口;(支持微信支付宝)
新增店铺充值接口实体类;
dev
huixiang_app 1 year ago
parent
commit
b2d180cb0a
  1. 181
      lib/home/home_page.dart
  2. 774
      lib/home/welfare_page.dart
  3. 46
      lib/integral/integral_page.dart
  4. 56
      lib/integral/intergra_view/integral_task.dart
  5. 41
      lib/mine/mine_shop_page.dart
  6. 624
      lib/mine/mine_shop_recharge.dart
  7. 71
      lib/mine/mine_view/mine_item.dart
  8. 326
      lib/mine/mine_vip/mine_attainment_page.dart
  9. 906
      lib/mine/recharge_page.dart
  10. 354
      lib/order/order_history_page.dart
  11. 159
      lib/retrofit/data/member_recharge_list.dart
  12. 10
      lib/retrofit/min_api.dart
  13. 45
      lib/retrofit/min_api.g.dart
  14. 14
      lib/retrofit/retrofit_api.dart
  15. 4
      lib/retrofit/retrofit_api.g.dart
  16. 12
      lib/store/store_view/shop_goods.dart
  17. 65
      lib/union/union_list.dart
  18. 3
      lib/view_widget/my_appbar.dart
  19. 8
      lib/view_widget/recharge_details_dialog.dart

181
lib/home/home_page.dart

@ -40,6 +40,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/user_info.dart'; import '../retrofit/data/user_info.dart';
import '../utils/flutter_utils.dart';
import '../view_widget/channel_dialog.dart'; import '../view_widget/channel_dialog.dart';
import '../view_widget/custom_image.dart'; import '../view_widget/custom_image.dart';
import 'home_view/happy_help_farmers.dart'; import 'home_view/happy_help_farmers.dart';
@ -76,6 +77,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
List<Goods> goods = []; List<Goods> goods = [];
List<GoodsCategory> gooodsCategorys = []; List<GoodsCategory> gooodsCategorys = [];
List<BannerData> bannerData = []; List<BannerData> bannerData = [];
List<BannerData> activityBannerData = [];
List<Brand> brandData = []; List<Brand> brandData = [];
List<Article> articles = []; List<Article> articles = [];
Founder founder; Founder founder;
@ -87,6 +89,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
UserInfo userInfo; UserInfo userInfo;
dynamic mRaiseMoney = 0; // dynamic mRaiseMoney = 0; //
int _loadCount = 0; int _loadCount = 0;
DioErrorType dioErrorType;
@override @override
void initState() { void initState() {
@ -160,7 +163,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
try { try {
BaseData<PageInfo<BannerData>> baseData = await apiService.queryBanner({ BaseData<PageInfo<BannerData>> baseData = await apiService.queryBanner({
"model": {"type": "HOME_PAGE"}, "model": {"type": "HOME_PAGE"},
}).catchError((onError) {}); }).catchError((onError) {
dioErrorType = onError.type;
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
bannerData = baseData.data.records; bannerData = baseData.data.records;
// if (bannerData.length > 0) swiperController.move(0, animation: false); // if (bannerData.length > 0) swiperController.move(0, animation: false);
@ -170,12 +175,32 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
} }
} }
///banner
queryActivityBanner() async {
try {
BaseData<PageInfo<BannerData>> baseData = await apiService.queryBanner({
"model": {"type": "HOME_STORE_PAGE"},
}).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
activityBannerData = baseData.data.records;
}
} finally {
addLoadCount();
}
}
addLoadCount() { addLoadCount() {
_loadCount += 1; _loadCount += 1;
if (_loadCount == 6) { if (_loadCount == 7) {
_loadCount = 0; _loadCount = 0;
EasyLoading.dismiss(); EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted(); if (dioErrorType == null)
refreshController.refreshCompleted();
else {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(dioErrorType),
alignment: Alignment.center);
refreshController.refreshFailed();
}
if (mounted) setState(() {}); if (mounted) setState(() {});
} }
} }
@ -240,11 +265,11 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
goods = pageGoods.data.list; goods = pageGoods.data.list;
} }
} finally { } finally {
if(isRefresh) if (isRefresh)
addLoadCount(); addLoadCount();
else { else {
EasyLoading.dismiss(); EasyLoading.dismiss();
setState((){}); setState(() {});
} }
} }
} }
@ -334,8 +359,10 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
token: value.getString("token"), token: value.getString("token"),
); );
} }
dioErrorType = null;
if (isFirstIn) queryActivity(); if (isFirstIn) queryActivity();
queryBanner(); queryBanner();
queryActivityBanner();
queryRecommendRank(); queryRecommendRank();
queryGoodsCategory(); queryGoodsCategory();
queryPointsProductList(true); queryPointsProductList(true);
@ -627,50 +654,118 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
Widget spread() { Widget spread() {
return Container( return Container(
width: double.infinity, width: double.infinity,
// margin: EdgeInsets.symmetric(horizontal:14.w),
height: 85.h, height: 85.h,
child: Swiper( child: bannerData != null && bannerData.isNotEmpty
pagination: SwiperPagination( ? Swiper(
alignment: Alignment.bottomCenter, pagination: SwiperPagination(
margin: EdgeInsets.only(top: 5.h), alignment: Alignment.bottomCenter,
builder: DotSwiperPaginationBuilder( margin: EdgeInsets.only(top: 5.h),
size: 8.w, builder: DotSwiperPaginationBuilder(
activeSize: 8.w, size: 8.w,
space: 5.w, activeSize: 8.w,
activeColor: Colors.white, space: 5.w,
color: Colors.white.withAlpha(76), activeColor: Colors.white,
), color: Colors.white.withAlpha(76),
),
autoplay: true,
duration: 1000,
autoplayDelay: 2000,
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
if (position == 0) {
Navigator.of(context).pushNamed('/router/invite_friends');
} else if (position == 1) {
Navigator.of(context).pushNamed('/router/trading_card_page');
}
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 14.w),
child: ClipRRect(
child: Image.asset(
spreadItem[position],
width: double.infinity,
fit: BoxFit.fill,
height: double.infinity,
), ),
borderRadius: BorderRadius.circular(6.w),
), ),
autoplay: true,
duration: 1000,
autoplayDelay: 2000,
itemBuilder: (context, position) {
return InkWell(
onTap: () {
spreadBannerClick(activityBannerData[position]);
},
child: Container(
margin: EdgeInsets.symmetric(horizontal: 14.w),
child: MImage(
activityBannerData[position].imgUrl,
fit: BoxFit.cover,
radius: BorderRadius.circular(6),
errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp",
),
),
);
// GestureDetector(
// onTap: () {
// if (position == 0) {
// Navigator.of(context).pushNamed('/router/invite_friends');
// } else if (position == 1) {
// Navigator.of(context).pushNamed('/router/trading_card_page');
// }
// },
// child: Container(
// margin: EdgeInsets.symmetric(horizontal: 14.w),
// child: ClipRRect(
// child: Image.asset(
// spreadItem[position],
// width: double.infinity,
// fit: BoxFit.fill,
// height: double.infinity,
// ),
// borderRadius: BorderRadius.circular(6.w),
// ),
// ),
// );
},
itemCount: activityBannerData.length,
)
: Image.asset(
"assets/image/default_2_1.webp",
fit: BoxFit.cover,
), ),
);
},
itemCount: 2,
),
); );
} }
/// contentType 0123,4:,5:7
spreadBannerClick(BannerData activityBannerData) async {
switch (activityBannerData.contentType) {
case 1:
Navigator.of(context).pushNamed('/router/integral_store_page',
arguments: {"goodsId": activityBannerData.content});
break;
case 2:
Navigator.of(context).pushNamed('/router/web_page', arguments: {
"activityId": activityBannerData.content,
});
break;
case 3:
Navigator.of(context).pushNamed('/router/web_page', arguments: {
"articleId": activityBannerData.content,
});
break;
case 4:
String router = activityBannerData.content;
// String router = "/router/store_order?{\"id\":\"1512378184161558528\",\"tenant\":\"1188\",\"storeName\":\"农场煮意\"}";
if (router.contains("?")) {
String params = router.substring(router.indexOf("?") + 1);
Map map = jsonDecode(params);
Navigator.of(context).pushNamed(
router.substring(0, router.indexOf("?")),
arguments: map);
} else {
Navigator.of(context).pushNamed(router);
}
break;
case 5:
Navigator.of(context).pushNamed('/router/class_details', arguments: {
"id": activityBannerData.content,
});
break;
case 7:
String params = activityBannerData.content
.substring(activityBannerData.content.indexOf("?") + 1);
Map map = jsonDecode(params);
Navigator.of(context).pushNamed(
activityBannerData.content
.substring(0, activityBannerData.content.indexOf("?")),
arguments: map);
break;
}
}
final List<String> spreadItem = [ final List<String> spreadItem = [
"assets/image/welfare_spread.webp", "assets/image/welfare_spread.webp",
"assets/image/welfare_yz.webp", "assets/image/welfare_yz.webp",

774
lib/home/welfare_page.dart

File diff suppressed because it is too large Load Diff

46
lib/integral/integral_page.dart

@ -19,10 +19,10 @@ import 'package:huixiang/view_widget/sign_in_widget.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../utils/flutter_utils.dart';
import 'intergra_view/integral_task.dart'; import 'intergra_view/integral_task.dart';
class IntegralPage extends StatefulWidget { class IntegralPage extends StatefulWidget {
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _IntegralPage(); return _IntegralPage();
@ -51,13 +51,17 @@ class _IntegralPage extends State<IntegralPage> {
); );
userInfo = UserInfo.fromJson(jsonDecode(value.getString("user"))); userInfo = UserInfo.fromJson(jsonDecode(value.getString("user")));
BaseData<List<Rank>> rankData = await apiService.rankList() BaseData<List<Rank>> rankData =
.catchError((onError) {}); await apiService.rankList().catchError((onError) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
alignment: Alignment.center);
refreshController.refreshFailed();
});
if (rankData != null && rankData.isSuccess) { if (rankData != null && rankData.isSuccess) {
ranks.clear(); ranks.clear();
ranks.addAll(rankData.data); ranks.addAll(rankData.data);
refreshController.refreshCompleted(); refreshController.refreshCompleted();
}else { } else {
refreshController.refreshFailed(); refreshController.refreshFailed();
} }
@ -112,7 +116,9 @@ class _IntegralPage extends State<IntegralPage> {
Scaffold( Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
appBar: MyAppBar( appBar: MyAppBar(
exit: (){Navigator.of(context).pop(signInfo.todayHasSignin ?? false);}, exit: () {
Navigator.of(context).pop(signInfo?.todayHasSignin ?? false);
},
background: Colors.transparent, background: Colors.transparent,
leadingColor: Colors.white, leadingColor: Colors.white,
title: "", title: "",
@ -124,7 +130,9 @@ class _IntegralPage extends State<IntegralPage> {
margin: EdgeInsets.only(right: 16.w), margin: EdgeInsets.only(right: 16.w),
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed('/router/integral_detailed_page',arguments:{"titleType":2}); Navigator.of(context).pushNamed(
'/router/integral_detailed_page',
arguments: {"titleType": 2});
}, },
child: Text( child: Text(
S.of(context).mingxi, S.of(context).mingxi,
@ -137,17 +145,17 @@ class _IntegralPage extends State<IntegralPage> {
), ),
), ),
), ),
body:SmartRefresher( body: SmartRefresher(
controller: refreshController, controller: refreshController,
enablePullDown: true, enablePullDown: true,
enablePullUp: false, enablePullUp: false,
header: MyHeader(), header: MyHeader(color: Colors.white,),
footer: CustomFooter( footer: CustomFooter(
builder: (context, mode) { builder: (context, mode) {
return MyFooter(mode); return MyFooter(mode);
}, },
), ),
onRefresh:(){ onRefresh: () {
setState(() { setState(() {
querySignInfo(); querySignInfo();
}); });
@ -163,9 +171,19 @@ class _IntegralPage extends State<IntegralPage> {
return Column( return Column(
children: [ children: [
/// VIP等级显示 /// VIP等级显示
IntegralVip(rankLevel, signInfo, userInfo,"${ (signInfo?.signInList?.length ) ?? "0"}", IntegralVip(
((signInfo?.rewardList != null && signInfo.rewardList.length > (signInfo?.signInList?.length ?? 0)) ? rankLevel,
signInfo.rewardList[signInfo?.signInList?.length ?? 0]:0).toString()), signInfo,
userInfo,
"${(signInfo?.signInList?.length) ?? "0"}",
((signInfo?.rewardList != null &&
signInfo.rewardList.length >
(signInfo?.signInList?.length ??
0))
? signInfo.rewardList[
signInfo?.signInList?.length ?? 0]
: 0)
.toString()),
/// ///
InForPoints(signInfo, _signIn), InForPoints(signInfo, _signIn),
@ -191,7 +209,9 @@ class _IntegralPage extends State<IntegralPage> {
SmartDialog.showToast("今日已签到了", alignment: Alignment.center); SmartDialog.showToast("今日已签到了", alignment: Alignment.center);
return; return;
} }
EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black); EasyLoading.show(
status: S.of(context).zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
BaseData baseData = await apiService.signIn().catchError((onError) {}); BaseData baseData = await apiService.signIn().catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() {}); setState(() {});

56
lib/integral/intergra_view/integral_task.dart

@ -6,6 +6,8 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import '../../view_widget/no_data_view.dart';
class IntegralTask extends StatefulWidget { class IntegralTask extends StatefulWidget {
final SignInfo signInfo; final SignInfo signInfo;
@ -57,28 +59,38 @@ class _IntegralTask extends State<IntegralTask> {
), ),
Expanded( Expanded(
child: Container( child: Container(
child: ListView.builder( child: (widget.signInfo != null &&
padding: EdgeInsets.only(left: 10.w, top: 20.h), widget.signInfo.taskList != null &&
physics: BouncingScrollPhysics(), widget.signInfo.taskList.length > 0)
// loop: false, ? ListView.builder(
// pagination: SwiperPagination( padding: EdgeInsets.only(left: 10.w, top: 20.h),
// alignment: Alignment.bottomCenter, physics: BouncingScrollPhysics(),
// builder: DotSwiperPaginationBuilder( // loop: false,
// size: 8, // pagination: SwiperPagination(
// activeSize: 8, // alignment: Alignment.bottomCenter,
// space: 5, // builder: DotSwiperPaginationBuilder(
// activeColor: Colors.black, // size: 8,
// color: Colors.black.withAlpha(76), // activeSize: 8,
// ), // space: 5,
// ), // activeColor: Colors.black,
itemBuilder: (context, position) { // color: Colors.black.withAlpha(76),
return taskItem(widget.signInfo.taskList[position]); // ),
}, // ),
itemCount: (widget.signInfo != null && itemBuilder: (context, position) {
widget.signInfo.taskList != null && return taskItem(widget.signInfo.taskList[position]);
widget.signInfo.taskList.length > 0) },
? widget.signInfo.taskList.length itemCount: (widget.signInfo != null &&
: 0), widget.signInfo.taskList != null &&
widget.signInfo.taskList.length > 0)
? widget.signInfo.taskList.length
: 0)
: NoDataView(
src: "assets/image/xiao_fei.webp",
isShowBtn: false,
text: "暂无任务可做~",
fontSize: 16.sp,
margin: EdgeInsets.only(left: 60.w, right: 60.w),
),
), ),
flex: 1, flex: 1,
) )

41
lib/mine/mine_shop_page.dart

@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/data/page.dart';
@ -85,19 +86,25 @@ class _MineShopPage extends State<MineShopPage> with WidgetsBindingObserver{
super.dispose(); super.dispose();
} }
queryVipCard() async { queryVipCard({bool showLoading = true}) async {
BaseData<List<VipCard>> baseData = try{
await apiService.vipList({}).catchError((error) { if(showLoading)EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
refreshController.refreshFailed(); BaseData<List<VipCard>> baseData =
}); await apiService.vipList({
if (baseData != null && baseData.isSuccess) { "keywords":editingController.text,
coupons.clear(); }).catchError((error) {
coupons.addAll(baseData.data); refreshController.refreshFailed();
setState(() {
refreshController.refreshCompleted();
}); });
} else { if (baseData != null && baseData.isSuccess) {
refreshController.refreshFailed(); coupons.clear();
coupons.addAll(baseData.data);
refreshController.refreshCompleted();
} else {
refreshController.refreshFailed();
}
}finally{
EasyLoading.dismiss();
setState(() {});
} }
} }
@ -109,6 +116,7 @@ class _MineShopPage extends State<MineShopPage> with WidgetsBindingObserver{
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
}, },
child: Scaffold( child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: MyAppBar( appBar: MyAppBar(
title: "店铺充值", title: "店铺充值",
titleColor: Colors.black, titleColor: Colors.black,
@ -142,7 +150,13 @@ class _MineShopPage extends State<MineShopPage> with WidgetsBindingObserver{
onTap: () { onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/mine_shop_recharge', '/router/mine_shop_recharge',
arguments: {"id": coupons[position].id}); arguments: {
"id": coupons[position].id,
"tenantCode":coupons[position].tenantCode,
"storeId":coupons[position].storeList[0].id
}).then((value) {
queryVipCard(showLoading: false);
});
}, },
child: shopItem(coupons[position]), child: shopItem(coupons[position]),
); );
@ -184,6 +198,7 @@ class _MineShopPage extends State<MineShopPage> with WidgetsBindingObserver{
textInputAction: TextInputAction.search, textInputAction: TextInputAction.search,
onEditingComplete: () { onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
queryVipCard();
}, },
controller: editingController, controller: editingController,
cursorHeight: 25.h, cursorHeight: 25.h,

624
lib/mine/mine_shop_recharge.dart

@ -1,31 +1,34 @@
import 'package:barcode_widget/barcode_widget.dart'; import 'dart:io';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/data/product.dart';
import 'package:huixiang/retrofit/data/user_bill.dart';
import 'package:huixiang/retrofit/data/vip_card.dart'; import 'package:huixiang/retrofit/data/vip_card.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/scan.dart'; import 'package:huixiang/store/scan.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/location.dart';
import 'package:huixiang/utils/painter_bg.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart'; import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../retrofit/data/member_recharge_list.dart';
import '../retrofit/data/rechargeActLists.dart'; import '../retrofit/data/rechargeActLists.dart';
import '../retrofit/data/wx_pay.dart';
import '../retrofit/min_api.dart';
import '../utils/flutter_utils.dart'; import '../utils/flutter_utils.dart';
import '../utils/min.dart';
import '../view_widget/classic_header.dart';
import '../view_widget/my_footer.dart';
import '../view_widget/no_data_view.dart'; import '../view_widget/no_data_view.dart';
import '../view_widget/recharge_details_dialog.dart'; import '../view_widget/recharge_details_dialog.dart';
import 'package:tobias/tobias.dart' as tobias;
class MineShopRecharge extends StatefulWidget { class MineShopRecharge extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
@ -40,203 +43,358 @@ class MineShopRecharge extends StatefulWidget {
class _MineShopRecharge extends State<MineShopRecharge> { class _MineShopRecharge extends State<MineShopRecharge> {
ApiService apiService; ApiService apiService;
MinApiService minService;
VipCard vipCard; VipCard vipCard;
RechargeActLists rechargeActLists; List<MemberRechargeList> memberRechargeList = [];
int selectIndex = 0; int selectIndex = 0;
double discount = 100; double discount = 100;
var checkIndex = 2; var checkIndex = 2;
dynamic payListen;
int _loadCount = 0;
String tenant;
String storeId;
String minToken;
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
refreshController.dispose(); refreshController.dispose();
if (payListen != null) payListen.cancel();
} }
@override @override
void initState() { void initState() {
super.initState(); super.initState();
vipDetail("", ""); storeId = widget.arguments["storeId"];
tenant = widget.arguments["tenantCode"];
_onRefresh();
payListen = weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
if (event.errCode == 0) {
SmartDialog.showToast("充值成功", alignment: Alignment.center);
} else {
SmartDialog.showToast("充值失败", alignment: Alignment.center);
}
vipDetail();
});
} }
/// ///
vipDetail(latitude, longitude) async { vipDetail({bool isSingle = true}) async {
SharedPreferences value = await SharedPreferences.getInstance(); try {
if (apiService == null) BaseData<VipCard> baseData = await apiService.vipDetail({
apiService = "id": widget.arguments["id"],
ApiService(Dio(), context: context, token: value.getString("token")); "latitude": "",
BaseData<VipCard> baseData = await apiService.vipDetail({ "longitude": "",
"id": widget.arguments["id"], }).catchError((onError) {});
"latitude": "$latitude", if (baseData != null && baseData.isSuccess) {
"longitude": "$longitude", vipCard = baseData.data;
}).catchError((onError) {}); }
} finally {
if(isSingle)
setState((){});
else
addLoadCount();
}
}
///
minLogin() async {
try {
var baseData = await apiService.minLogin(storeId).catchError((onError) {
debugPrint(onError.toString());
});
if (baseData != null && baseData.isSuccess) {
minToken = baseData.data["token"];
SharedPreferences.getInstance().then(
(value) => {
value.setString('minToken', minToken),
value.setString('tenant', tenant),
value.setString('storeId', storeId),
},
);
minService = MinApiService(
Dio(),
context: context,
token: minToken,
tenant: tenant,
storeId: storeId,
);
}
} finally {}
}
///
queryRechargeActList() async {
try {
BaseData<List<MemberRechargeList>> baseData =
await minService.memberRechargeList().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
memberRechargeList = baseData.data;
}
} finally {
addLoadCount();
}
}
///
shopRecharge() async {
if (minService == null) await minLogin();
BaseData<dynamic> baseData = await minService.memberRecharge({
"money": 0,
"rechargeId": memberRechargeList[selectIndex].id,
"type": checkIndex == 2 ? "wechat" : "alipay",
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
vipCard = baseData.data; if (checkIndex == 2) {
refreshController.loadComplete(); if (Platform.isAndroid) {
if (!(await Min.isInitialize())) {
// app的充值支付使用同一个WXPayEntryActivity回调
// getPackage空指针
//
await Min.initialize();
}
}
WxPay wxPay = WxPay.fromJson(baseData.data);
await registerWxApi(
appId: wxPay.appId,
doOnAndroid: true,
universalLink: "https://hx.lotus-wallet.com/app/",
);
payWithWeChat(
appId: wxPay.appId,
partnerId: wxPay.partnerId,
prepayId: wxPay.prepayId,
packageValue: wxPay.packageValue,
nonceStr: wxPay.nonceStr,
timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign,
);
} else {
tobias.isAliPayInstalled().then((value) => {
//
if (!value)
{SmartDialog.showToast("请安装支付宝", alignment: Alignment.center)}
else
{
tobias.aliPay(baseData.data["body"]).then((payRes) {
if (payRes['resultStatus'] == 9000 ||
payRes['resultStatus'] == '9000') {
SmartDialog.showToast("充值成功",
alignment: Alignment.center);
} else {
SmartDialog.showToast(payRes['memo'],
alignment: Alignment.center);
}
vipDetail();
})
}
});
}
} else { } else {
refreshController.loadFailed(); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
_onRefresh() async {
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
}
if (minService == null) await minLogin();
vipDetail(isSingle: false);
queryRechargeActList();
}
addLoadCount() {
_loadCount += 1;
if (_loadCount == 2) {
_loadCount = 0;
EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted();
if (mounted) setState(() {});
} }
print("object:object");
setState(() {});
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: MyAppBar( appBar: MyAppBar(
title: "店铺充值", title: "店铺充值",
titleColor: Colors.black, titleColor: Colors.black,
background: Colors.white, background: Colors.white,
brightness: Brightness.dark, brightness: Brightness.dark,
leadingColor: Colors.black, leadingColor: Colors.black,
), ),
body: body: SmartRefresher(
Column( enablePullDown: true,
children: [ enablePullUp: false,
shopRechargeCard(), header: MyHeader(),
// NoDataView( footer: CustomFooter(
// src: "assets/image/xiao_fei.webp", builder: (context, mode) {
// isShowBtn: false, return MyFooter(mode);
// text: "当前店铺暂无充值套餐~", },
// fontSize: 16.sp, ),
// margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w), controller: refreshController,
// ), onRefresh: _onRefresh,
Expanded(child:ListView.builder( physics: BouncingScrollPhysics(),
padding: EdgeInsets.zero, child: Column(
itemCount: 6, children: [
scrollDirection: Axis.vertical, shopRechargeCard(),
shrinkWrap: true, (memberRechargeList != null &&
physics: BouncingScrollPhysics(), (memberRechargeList?.length ?? 0) > 0)
itemBuilder: (context, position) { ? Expanded(
return GestureDetector( child: ListView.builder(
onTap: () { padding: EdgeInsets.zero,
setState(() { itemCount: (memberRechargeList != null &&
selectIndex = position; (memberRechargeList?.length ?? 0) > 0)
}); ? memberRechargeList.length
}, : 0,
child: rechargeItem(position)); scrollDirection: Axis.vertical,
}, shrinkWrap: true,
)), physics: BouncingScrollPhysics(),
Container( itemBuilder: (context, position) {
width: double.infinity, return GestureDetector(
margin: EdgeInsets.only(left: 16, right: 16), onTap: () {
padding: EdgeInsets.only( setState(() {
top: 20.h, selectIndex = position;
bottom: 24.h, });
), },
child: Column( child: rechargeItem(
mainAxisAlignment: memberRechargeList[position], position));
MainAxisAlignment.spaceAround, },
crossAxisAlignment: CrossAxisAlignment.start, ))
children: [ : NoDataView(
Padding( src: "assets/image/xiao_fei.webp",
padding: EdgeInsets.only(bottom: 16.h), isShowBtn: false,
child: Text( text: "当前店铺暂无充值套餐~",
S.of(context).zhifufangshi, fontSize: 16.sp,
style: TextStyle( margin:
fontSize: 16.sp, EdgeInsets.only(top: 90.h, left: 60.w, right: 60.w),
color: Colors.black,
fontWeight: FontWeight.bold,
),
), ),
if (memberRechargeList != null &&
(memberRechargeList?.length ?? 0) > 0)
Container(
width: double.infinity,
margin: EdgeInsets.only(left: 16, right: 16),
padding: EdgeInsets.only(
top: 20.h,
bottom: 24.h,
), ),
GestureDetector( child: Column(
behavior: HitTestBehavior.opaque, mainAxisAlignment: MainAxisAlignment.spaceAround,
onTap: () { crossAxisAlignment: CrossAxisAlignment.start,
setState(() { children: [
checkIndex = 2; Padding(
}); padding: EdgeInsets.only(bottom: 16.h),
}, child: Text(
child: Row( S.of(context).zhifufangshi,
mainAxisAlignment: style: TextStyle(
MainAxisAlignment.start, fontSize: 16.sp,
crossAxisAlignment: color: Colors.black,
CrossAxisAlignment.start, fontWeight: FontWeight.bold,
children: [ ),
Image.asset( ),
"assets/image/icon_we_chat.webp"), ),
Expanded( GestureDetector(
flex: 1, behavior: HitTestBehavior.opaque,
child: Padding( onTap: () {
padding: EdgeInsets.only(left: 8.w), setState(() {
child: Text( checkIndex = 2;
S.of(context).weixinzhifu, });
style: TextStyle( },
fontSize: 14.sp, child: Row(
color: Color(0xff353535), mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset("assets/image/icon_we_chat.webp"),
Expanded(
flex: 1,
child: Padding(
padding: EdgeInsets.only(left: 8.w),
child: Text(
S.of(context).weixinzhifu,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
),
),
), ),
), ),
), checkView(2),
],
), ),
checkView(2), ),
], SizedBox(height: 10.h),
), GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
checkIndex = 3;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset("assets/image/icon_alipay.webp"),
Expanded(
flex: 1,
child: Padding(
padding: EdgeInsets.only(left: 8.w),
child: Text(
S.of(context).zhifubao,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
),
),
),
),
checkView(3),
],
),
),
],
), ),
SizedBox(height: 10.h), ),
GestureDetector( if (memberRechargeList != null &&
(memberRechargeList?.length ?? 0) > 0)
Align(
alignment: Alignment.bottomCenter,
child: GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: () { onTap: () {
setState(() { shopRecharge();
checkIndex = 3;
});
}, },
child: Row( child: Container(
mainAxisAlignment: height: 56.h,
MainAxisAlignment.start, width: double.infinity,
crossAxisAlignment: alignment: Alignment.center,
CrossAxisAlignment.start, decoration: BoxDecoration(
children: [ color: Color(0xFF32A060),
Image.asset( borderRadius: BorderRadius.circular(27),
"assets/image/icon_alipay.webp"), ),
Expanded( margin: EdgeInsets.only(
flex: 1, top: 12.h, left: 16.w, right: 16.w, bottom: 21.h),
child: Padding( child: Text(
padding: EdgeInsets.only(left: 8.w), S.of(context).querenchongzhi,
child: Text( style: TextStyle(
S.of(context).zhifubao, fontSize: 16.sp,
style: TextStyle( fontWeight: MyFontWeight.medium,
fontSize: 14.sp, color: Colors.white,
color: Color(0xff353535),
),
),
),
), ),
checkView(3), ),
],
),
),
],
),
),
Align(
alignment: Alignment.bottomCenter,
child: GestureDetector(
onTap: () {
},
child: Container(
height: 56.h,
width: double.infinity,
alignment: Alignment.center,
decoration: BoxDecoration(
color: Color(0xFF32A060),
borderRadius: BorderRadius.circular(27),
),
margin: EdgeInsets.only(
top: 12.h, left: 16.w, right: 16.w, bottom: 21.h),
child: Text(
S.of(context).querenchongzhi,
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: Colors.white,
), ),
), ),
), )
), ],
) ),
], ));
),
);
} }
/// ///
@ -256,15 +414,15 @@ class _MineShopRecharge extends State<MineShopRecharge> {
Widget shopRechargeCard() { Widget shopRechargeCard() {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
onTap: (){ onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed('/router/mine_shop_details',
'/router/mine_shop_details',
arguments: {"id": widget.arguments["id"]}); arguments: {"id": widget.arguments["id"]});
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
// height:140.h, // height:140.h,
margin: EdgeInsets.only(bottom: 24.h, top: 14.h, left: 14.w, right: 14.w), margin:
EdgeInsets.only(bottom: 24.h, top: 14.h, left: 14.w, right: 14.w),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -350,14 +508,15 @@ class _MineShopRecharge extends State<MineShopRecharge> {
children: [ children: [
Expanded( Expanded(
child: Text( child: Text(
"${vipCard != null ? vipCard.balance : ""}", "${vipCard != null ? vipCard.balance : ""}",
style: TextStyle( style: TextStyle(
color: Color(0xFF262626), color: Color(0xFF262626),
fontSize: 24.sp, fontSize: 24.sp,
fontFamily: 'JDZhengHT', fontFamily: 'JDZhengHT',
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
),
), ),
),), ),
Text( Text(
"适用门店", "适用门店",
style: TextStyle( style: TextStyle(
@ -366,7 +525,9 @@ class _MineShopRecharge extends State<MineShopRecharge> {
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
), ),
), ),
SizedBox(width: 2,), SizedBox(
width: 2,
),
Image.asset( Image.asset(
"assets/image/icon_right_z.webp", "assets/image/icon_right_z.webp",
width: 16, width: 16,
@ -385,7 +546,7 @@ class _MineShopRecharge extends State<MineShopRecharge> {
} }
///item ///item
Widget rechargeItem(index) { Widget rechargeItem(MemberRechargeList memberRechargeList, index) {
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 69.h, height: 69.h,
@ -393,12 +554,11 @@ class _MineShopRecharge extends State<MineShopRecharge> {
borderRadius: BorderRadius.circular(4), borderRadius: BorderRadius.circular(4),
border: Border.all( border: Border.all(
color: color:
selectIndex == index ? Color(0xFF32A060) : Color(0xFFFAFAFA), selectIndex == index ? Color(0xFF32A060) : Color(0xFFFAFAFA),
width: selectIndex == index ? 1 : 0, width: selectIndex == index ? 1 : 0,
), ),
color: color: selectIndex == index ? Color(0XFFF0FAF4) : Colors.white),
selectIndex == index ? Color(0XFFF0FAF4) : Colors.white), margin: EdgeInsets.only(bottom: 14.h, left: 14.w, right: 14.w),
margin: EdgeInsets.only(bottom: 14.h,left: 14.w,right: 14.w),
padding: EdgeInsets.only(left: 16), padding: EdgeInsets.only(left: 16),
child: Flex( child: Flex(
direction: Axis.horizontal, direction: Axis.horizontal,
@ -419,7 +579,7 @@ class _MineShopRecharge extends State<MineShopRecharge> {
), ),
TextSpan( TextSpan(
text: text:
"555", "${AppUtils.calculateDouble(double.tryParse(memberRechargeList.rechargeMoney) ?? 0)}",
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
fontFamily: 'JDZhengHT', fontFamily: 'JDZhengHT',
@ -435,7 +595,7 @@ class _MineShopRecharge extends State<MineShopRecharge> {
width: 1.w, width: 1.w,
height: 37.h, height: 37.h,
color: color:
selectIndex == index ? Color(0xFF32A060) : Color(0xFF979797), selectIndex == index ? Color(0xFF32A060) : Color(0xFF979797),
margin: EdgeInsets.only(right: 16.w, left: 12), margin: EdgeInsets.only(right: 16.w, left: 12),
), ),
Expanded( Expanded(
@ -457,7 +617,7 @@ class _MineShopRecharge extends State<MineShopRecharge> {
), ),
TextSpan( TextSpan(
text: text:
"526", "${AppUtils.calculateDouble((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) + (double.tryParse(memberRechargeList.giftdMoney) ?? 0) + ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) - ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) * (discount / 100))))}",
style: TextStyle( style: TextStyle(
fontSize: 18.sp, fontSize: 18.sp,
fontFamily: 'JDZhengHT', fontFamily: 'JDZhengHT',
@ -474,7 +634,8 @@ class _MineShopRecharge extends State<MineShopRecharge> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
if (selectIndex == index) showRecharge(index); if (selectIndex == index)
showRecharge(memberRechargeList, index);
}); });
}, },
child: Row( child: Row(
@ -521,12 +682,93 @@ class _MineShopRecharge extends State<MineShopRecharge> {
} }
/// ///
showRecharge(index) { showRecharge(MemberRechargeList memberRechargeList, index) {
showModalBottomSheet( showModalBottomSheet(
context: context, context: context,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) { builder: (context) {
return RechargeWidget(rechargeActLists.preferentialList[index]); return Container(
padding: EdgeInsets.only(top: 12),
decoration: new BoxDecoration(
color: Colors.white,
borderRadius: new BorderRadius.only(
topLeft: const Radius.circular(25.0),
topRight: const Radius.circular(25.0))),
child: Container(
height: 355,
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: Container(
margin: EdgeInsets.symmetric(vertical: 12.h),
alignment: Alignment.center,
child: Text(
"充值说明",
style: TextStyle(
fontWeight: MyFontWeight.bold,
fontSize: 15.sp,
color: Color(0xFF353535),
),
),
)),
GestureDetector(
onTap: () {
setState(() {
Navigator.of(context).pop();
});
},
child: Icon(
Icons.clear,
color: Colors.black,
size: 18,
),
),
SizedBox(width: 14),
],
),
SizedBox(
height: 12.h,
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xFFF2F2F2),
margin: EdgeInsets.only(bottom: 13.h),
),
Padding(
padding: EdgeInsets.only(left: 14),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Expanded(
child: Container(
color: Colors.white,
child: Html(
data: memberRechargeList?.remark ?? "",
customImageRenders: {
networkSourceMatcher():
networkImageRender(
loadingWidget: () {
return Container();
},
),
},
),
),
)
],
),
)
],
),
)));
}); });
} }

71
lib/mine/mine_view/mine_item.dart

@ -224,7 +224,7 @@ class _MineItem extends State<MineItem> {
], ],
), ),
SizedBox(height: 12.h,), SizedBox(height: 12.h,),
if(isShowMore) // if(isShowMore)
Row( Row(
children: [ children: [
/// ///
@ -314,9 +314,9 @@ class _MineItem extends State<MineItem> {
// ),), // ),),
], ],
), ),
if(isShowMore) // if(isShowMore)
SizedBox(height: 12.h,), SizedBox(height: 12.h,),
if(isShowMore) // if(isShowMore)
Row( Row(
children: [ children: [
//// ////
@ -345,38 +345,39 @@ class _MineItem extends State<MineItem> {
Expanded(child:Container(),), Expanded(child:Container(),),
], ],
), ),
GestureDetector( ///
behavior: HitTestBehavior.opaque, // GestureDetector(
onTap: () { // behavior: HitTestBehavior.opaque,
setState(() { // onTap: () {
isShowMore = !isShowMore; // setState(() {
}); // isShowMore = !isShowMore;
}, // });
child: Container( // },
margin: EdgeInsets.symmetric(vertical: 10), // child: Container(
child: Row( // margin: EdgeInsets.symmetric(vertical: 10),
mainAxisAlignment: MainAxisAlignment.center, // child: Row(
crossAxisAlignment: CrossAxisAlignment.center, // mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max, // crossAxisAlignment: CrossAxisAlignment.center,
children: [ // mainAxisSize: MainAxisSize.max,
Text( // children: [
(isShowMore != null && !isShowMore)?S.of(context).zhankai: S.of(context).shouqi, // Text(
style: TextStyle( // (isShowMore != null && !isShowMore)?S.of(context).zhankai: S.of(context).shouqi,
fontSize: 12.sp, // style: TextStyle(
fontWeight: MyFontWeight.regular, // fontSize: 12.sp,
color: Color(0xFF32A060), // fontWeight: MyFontWeight.regular,
), // color: Color(0xFF32A060),
), // ),
Icon( // ),
(isShowMore != null && !isShowMore) // Icon(
? Icons.keyboard_arrow_down // (isShowMore != null && !isShowMore)
: Icons.keyboard_arrow_up, // ? Icons.keyboard_arrow_down
color: Color(0xFF32A060), // : Icons.keyboard_arrow_up,
size: 18, // color: Color(0xFF32A060),
), // size: 18,
], // ),
),), // ],
) // ),),
// )
], ],
), ),
); );

326
lib/mine/mine_vip/mine_attainment_page.dart

@ -20,6 +20,8 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../../view_widget/no_data_view.dart';
class MineAttainmentPage extends StatefulWidget { class MineAttainmentPage extends StatefulWidget {
final Map<String, dynamic> arguments; final Map<String, dynamic> arguments;
@ -41,7 +43,6 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
SocialInfo infoNumber; SocialInfo infoNumber;
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
@ -115,7 +116,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
); );
BaseData<SocialInfo> baseData = BaseData<SocialInfo> baseData =
await apiService.socialInfo().catchError((onError) {}); await apiService.socialInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
infoNumber = baseData.data; infoNumber = baseData.data;
@ -125,7 +126,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
_onRefresh(){ _onRefresh() {
queryAttainmentBadges(); queryAttainmentBadges();
querySocialInfo(); querySocialInfo();
} }
@ -140,151 +141,162 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
), ),
), ),
child: Scaffold( child: Scaffold(
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
appBar: MyAppBar( appBar: MyAppBar(
title:S.of(context).wodechengjiu, title: S.of(context).wodechengjiu,
titleColor: Colors.black, titleColor: Colors.black,
titleSize: 18.sp, titleSize: 18.sp,
background: Colors.transparent, background: Colors.transparent,
leadingColor: Colors.black, leadingColor: Colors.black,
), ),
body: SmartRefresher( body: SmartRefresher(
controller: refreshController, controller: refreshController,
enablePullDown: true, enablePullDown: true,
enablePullUp: false, enablePullUp: false,
header: MyHeader(), header: MyHeader(),
footer: CustomFooter( footer: CustomFooter(
builder: (context, mode) { builder: (context, mode) {
return MyFooter(mode); return MyFooter(mode);
},
),
onRefresh:(){
setState(() {
_onRefresh();
});
}, },
physics: BouncingScrollPhysics(), ),
child: Container( onRefresh: () {
child: setState(() {
SingleChildScrollView( _onRefresh();
physics: BouncingScrollPhysics(), });
child: Column( },
children: [ physics: BouncingScrollPhysics(),
SizedBox(height: 24), child: Container(
MImage( child: SingleChildScrollView(
userInfo?.headimg ?? "", physics: BouncingScrollPhysics(),
isCircle: true, child: Column(
width: 58, children: [
height: 58, SizedBox(height: 24),
fit: BoxFit.cover, MImage(
errorSrc: "assets/image/default_user.webp", userInfo?.headimg ?? "",
fadeSrc: "assets/image/default_user.webp", isCircle: true,
width: 58,
height: 58,
fit: BoxFit.cover,
errorSrc: "assets/image/default_user.webp",
fadeSrc: "assets/image/default_user.webp",
),
SizedBox(height: 8),
Text(
userInfo?.nickname ?? S.of(context).denglu,
style: TextStyle(
fontSize: 16.sp,
fontWeight: FontWeight.bold,
color: Color(0xFF353535),
), ),
SizedBox(height: 8), ),
Text( SizedBox(height: 28),
userInfo?.nickname ?? S.of(context).denglu, Container(
style: TextStyle( margin: EdgeInsets.only(
fontSize: 16.sp, left: 16, right: 16, top: 26, bottom: 8),
fontWeight: FontWeight.bold, padding: EdgeInsets.all(20),
color: Color(0xFF353535), decoration: BoxDecoration(
), color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.all(Radius.circular(8)),
), ),
SizedBox(height: 28), child: Column(
Container( mainAxisAlignment: MainAxisAlignment.spaceAround,
margin: crossAxisAlignment: CrossAxisAlignment.start,
EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8), children: [
padding: EdgeInsets.all(20), Row(
decoration: BoxDecoration( children: [
color: Colors.white, Text(
boxShadow: [ S.of(context).chengjiuhuizhang,
BoxShadow( style: TextStyle(
color: Colors.black.withAlpha(12), fontWeight: MyFontWeight.medium,
offset: Offset(0, 3), fontSize: 14.sp,
blurRadius: 14, color: Color(0xFF353535)),
spreadRadius: 0, ),
) SizedBox(width: 4),
], Text(
borderRadius: BorderRadius.all(Radius.circular(8)), "(",
), style: TextStyle(
child: Column( fontWeight: MyFontWeight.medium,
mainAxisAlignment: MainAxisAlignment.spaceAround, fontSize: 14,
crossAxisAlignment: CrossAxisAlignment.start, color: Color(0xFF353535)),
children: [ ),
Row( Text(
children: [ infoNumber != null
Text( ? infoNumber.achievementNumber.toString()
S.of(context).chengjiuhuizhang, : "0",
style: TextStyle( style: TextStyle(
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
fontSize: 14.sp, fontSize: 14,
color: Color(0xFF353535)), color: Color(0xFF32A060)),
), ),
SizedBox(width: 4), Text(
Text( "/${vipBadgesList.length})",
"(", style: TextStyle(
style: TextStyle( fontWeight: MyFontWeight.medium,
fontWeight: MyFontWeight.medium, fontSize: 14,
fontSize: 14, color: Color(0xFF353535)),
color: Color(0xFF353535)), ),
), ],
Text( ),
infoNumber != null ? infoNumber.achievementNumber.toString() :"0", SizedBox(height: 12),
style: TextStyle( attainmentBadge(),
fontWeight: MyFontWeight.medium, ],
fontSize: 14,
color: Color(0xFF32A060)),
),
Text(
"/${vipBadgesList.length})",
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14,
color: Color(0xFF353535)),
),
],
),
SizedBox(height: 12),
attainmentBadge(),
],
),
), ),
], ),
), ],
), ),
), ),
),), ),
),
),
); );
} }
/// ///
Widget attainmentBadge() { Widget attainmentBadge() {
return GridView.builder( return (vipBadgesList != null && (vipBadgesList?.length ?? 0) > 0)
itemCount: vipBadgesList == null ? 0 : vipBadgesList.length, ? GridView.builder(
shrinkWrap: true, itemCount: vipBadgesList == null ? 0 : vipBadgesList.length,
physics: NeverScrollableScrollPhysics(), shrinkWrap: true,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( physics: NeverScrollableScrollPhysics(),
//Widget数量 gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3, //Widget数量
//Widget之间间距 crossAxisCount: 3,
crossAxisSpacing: 13, //Widget之间间距
//Widget之间间距 crossAxisSpacing: 13,
mainAxisSpacing: 12, //Widget之间间距
//Widget宽高比例 mainAxisSpacing: 12,
childAspectRatio: AppUtils.textScale(context) > 1 //Widget宽高比例
? (1 - ((AppUtils.textScale(context) - 1))) childAspectRatio: AppUtils.textScale(context) > 1
: 0.85, ? (1 - ((AppUtils.textScale(context) - 1)))
), : 0.85,
itemBuilder: (context, index) { ),
return GestureDetector( itemBuilder: (context, index) {
onTap: () { return GestureDetector(
setState(() { onTap: () {
queryAchievementDetail(index); setState(() {
}); queryAchievementDetail(index);
}, });
child: badgeItem(vipBadgesList[index]), },
); child: badgeItem(vipBadgesList[index]),
}, );
); },
)
: NoDataView(
src: "assets/image/xiao_fei.webp",
isShowBtn: false,
text: "当前暂无成就徽章~",
fontSize: 16.sp,
margin: EdgeInsets.only(left: 60.w, right: 60.w),
);
;
} }
Widget badgeItem(VipBadgesList vipBadgesList) { Widget badgeItem(VipBadgesList vipBadgesList) {
@ -358,7 +370,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
), ),
SizedBox(height: 10), SizedBox(height: 10),
Text( Text(
"${vipBadgesList.length >index ?vipBadgesList[index].name :""}${achievementDetail.length > checkPosition ?achievementDetail[checkPosition].name:""}徽章", "${vipBadgesList.length > index ? vipBadgesList[index].name : ""}${achievementDetail.length > checkPosition ? achievementDetail[checkPosition].name : ""}徽章",
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold, fontWeight: MyFontWeight.semi_bold,
@ -369,7 +381,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
height: 6.h, height: 6.h,
), ),
Text( Text(
"${vipBadgesList.length >index ? vipBadgesList[index].name :""} ${AppUtils.calculateDouble(double.tryParse(achievementDetail.length > checkPosition ?achievementDetail[checkPosition].lessScore :"") ?? 0)} 即可升级", "${vipBadgesList.length > index ? vipBadgesList[index].name : ""} ${AppUtils.calculateDouble(double.tryParse(achievementDetail.length > checkPosition ? achievementDetail[checkPosition].lessScore : "") ?? 0)} 即可升级",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -392,27 +404,29 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
), ),
SizedBox(width: 8), SizedBox(width: 8),
Column( Column(
crossAxisAlignment:CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: children:
achievementDetail[checkPosition].rewardList != null achievementDetail[checkPosition].rewardList != null
? achievementDetail[checkPosition].rewardList.map((e) { ? achievementDetail[checkPosition]
return Text( .rewardList
rewardStr(e), .map((e) {
style: TextStyle( return Text(
fontWeight: MyFontWeight.regular, rewardStr(e),
fontSize: 12.sp, style: TextStyle(
color: Color(0xFF515151)), fontWeight: MyFontWeight.regular,
); fontSize: 12.sp,
}).toList() color: Color(0xFF515151)),
: [], );
}).toList()
: [],
), ),
], ],
), ),
Expanded( Expanded(
child: Container( child: Container(
height: double.maxFinite, height: double.maxFinite,
margin: EdgeInsets.only(top:14), margin: EdgeInsets.only(top: 14),
child: ListView.builder( child: ListView.builder(
shrinkWrap: true, shrinkWrap: true,
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
@ -443,12 +457,12 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
); );
} }
String rewardStr(RewardList rewardList){ String rewardStr(RewardList rewardList) {
if(rewardList.rewardType == 1) if (rewardList.rewardType == 1)
return "积分:${rewardList.refId}"; return "积分:${rewardList.refId}";
else if(rewardList.rewardType == 2) else if (rewardList.rewardType == 2)
return "平台余额:${rewardList.refId}"; return "平台余额:${rewardList.refId}";
else if(rewardList.rewardType == 3) else if (rewardList.rewardType == 3)
return "平台兑换券:${rewardList.couponName}"; return "平台兑换券:${rewardList.couponName}";
return ""; return "";
} }

906
lib/mine/recharge_page.dart

File diff suppressed because it is too large Load Diff

354
lib/order/order_history_page.dart

@ -1,5 +1,6 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/order/order_utils.dart'; import 'package:huixiang/order/order_utils.dart';
@ -133,57 +134,29 @@ class OrderHistoryList extends StatefulWidget {
class _OrderHistoryList extends State<OrderHistoryList> class _OrderHistoryList extends State<OrderHistoryList>
with AutomaticKeepAliveClientMixin { with AutomaticKeepAliveClientMixin {
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
@override
Widget build(BuildContext context) {
super.build(context);
return SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: true,
physics: BouncingScrollPhysics(),
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: _onRefresh,
onLoading: queryOrder,
child: (orderInfos != null && orderInfos.length > 0)
? ListView.builder(
itemCount: orderInfos != null ? orderInfos.length : 0,
itemBuilder: (context, position) {
return InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/order_details',
arguments: {"id": orderInfos[position].id,"jumpState":2});
},
child: orderItem(orderInfos[position]),
);
})
: NoDataView(
src: "assets/image/ding_dan.webp",
isShowBtn: false,
text: "目前暂无订单,快去下一单吧~",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120),
),
);
}
bool isRemake = true; bool isRemake = true;
ApiService apiService; ApiService apiService;
int current = 1; int current = 1;
List<OrderInfo> orderInfos = [];
UserInfo userInfo;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(),
showLoading: true,
context: context,
token: value.getString("token")),
queryOrder(),
queryUserBalance(),
});
}
_onRefresh() { _onRefresh() {
current = 1; current = 1;
queryOrder(); queryOrder();
} }
List<OrderInfo> orderInfos = [];
queryOrder() async { queryOrder() async {
BaseData<PageInfo<OrderInfo>> baseData = await apiService.orderList({ BaseData<PageInfo<OrderInfo>> baseData = await apiService.orderList({
"current": current, "current": current,
@ -214,24 +187,173 @@ class _OrderHistoryList extends State<OrderHistoryList>
} }
setState(() {}); setState(() {});
} else { } else {
SmartDialog.showToast(baseData?.msg ?? "",alignment: Alignment.center); if((baseData?.msg ?? "") != "")
SmartDialog.showToast(baseData.msg,alignment: Alignment.center);
refreshController.refreshFailed(); refreshController.refreshFailed();
refreshController.loadFailed(); refreshController.loadFailed();
} }
} }
@override minLogin(OrderInfo orderInfo) {
void initState() { apiService.minLogin(orderInfo.storeId).catchError((onError) {
super.initState(); debugPrint(onError);
}).then((baseData) {
SharedPreferences.getInstance().then((value) => { if (baseData != null && baseData.isSuccess) {
apiService = ApiService(Dio(), Map<String, dynamic> minStoreInfo = baseData.data;
showLoading: true, String minToken = minStoreInfo["token"];
String tenant = orderInfo.tenantCode;
String storeId = orderInfo.storeId;
SharedPreferences.getInstance().then(
(value) => {
value.setString('minToken', minToken),
value.setString('tenant', tenant),
value.setString('storeId', storeId),
},
);
paySelected(
orderInfo,
MinApiService(
Dio(),
context: context, context: context,
token: value.getString("token")), token: minToken,
queryOrder(), tenant: tenant,
queryUserBalance(), storeId: storeId,
}); ));
}
});
}
queryDetails(id) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(Dio(),
context: context, token: value.getString("token"), showLoading: true);
}
BaseData<OrderInfo> baseData =
await apiService.orderDetail(id).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
return baseData.data;
}
}
queryUserBalance() async {
BaseData<UserInfo> baseData =
await apiService.queryInfo().catchError((onError) {
});
if (baseData != null && baseData.isSuccess) {
userInfo = baseData.data;
if (mounted) setState(() {});
}else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
paySelected(OrderInfo orderInfo, MinApiService minService) async {
var payChannel = await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return OrderPaySelected(userInfo);
},
);
if (payChannel != null && payChannel > 0) {
orderInfo = await queryDetails(orderInfo.id);
OrderUtils.carryOnPay(
payChannel,
minService,
orderInfo,
(BaseData baseData) {
SmartDialog.showToast(
baseData?.msg == "ok" ? "订单支付成功" : baseData?.msg,
alignment: Alignment.center);
Future.delayed(Duration(seconds: 3), () {
_onRefresh();
});
},
);
}
}
payResult(BaseData baseData) {}
orderCancel(String orderId) async {
BaseData baseData =
await apiService.orderCancel(orderId).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("订单取消成功");
_onRefresh();
}else{
if(baseData.msg != null)
SmartDialog.showToast(baseData.msg,alignment: Alignment.center);
}
}
aginOrder(OrderInfo orderInfo) {
// Navigator.of(context).pushNamed(
// '/router/union_detail_page',
// arguments: {"id": storeId},
// );
// String storeId = (orderInfo != null &&
// orderInfo.storeVO != null)
// ? (orderInfo.storeVO.id ?? "")
// : "";
if (orderInfo.storeVO.posType.code == "NORMALSTORE") {
Scan.toScan(
context,
orderInfo.storeVO.id,
orderInfo.tenantCode,
orderInfo.storeVO.storeName,
);
} else {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": orderInfo.storeVO.id,
"tenant": orderInfo.tenantCode,
"storeName": orderInfo.storeVO.storeName
},
);
}
}
@override
Widget build(BuildContext context) {
super.build(context);
return SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: true,
physics: BouncingScrollPhysics(),
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: _onRefresh,
onLoading: queryOrder,
child: (orderInfos != null && orderInfos.length > 0)
? ListView.builder(
itemCount: orderInfos != null ? orderInfos.length : 0,
itemBuilder: (context, position) {
return InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/order_details',
arguments: {"id": orderInfos[position].id,"jumpState":2});
},
child: orderItem(orderInfos[position]),
);
})
: NoDataView(
src: "assets/image/ding_dan.webp",
isShowBtn: false,
text: "目前暂无订单,快去下一单吧~",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 120),
),
);
} }
String orderAllGoods(OrderInfo orderInfo) { String orderAllGoods(OrderInfo orderInfo) {
@ -536,130 +658,6 @@ class _OrderHistoryList extends State<OrderHistoryList>
); );
} }
minLogin(OrderInfo orderInfo) {
apiService.minLogin(orderInfo.storeId).catchError((onError) {
debugPrint(onError);
}).then((baseData) {
if (baseData != null && baseData.isSuccess) {
Map<String, dynamic> minStoreInfo = baseData.data;
String minToken = minStoreInfo["token"];
String tenant = orderInfo.tenantCode;
String storeId = orderInfo.storeId;
SharedPreferences.getInstance().then(
(value) => {
value.setString('minToken', minToken),
value.setString('tenant', tenant),
value.setString('storeId', storeId),
},
);
paySelected(
orderInfo,
MinApiService(
Dio(),
context: context,
token: minToken,
tenant: tenant,
storeId: storeId,
));
}
});
}
queryDetails(id) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(Dio(),
context: context, token: value.getString("token"), showLoading: true);
}
BaseData<OrderInfo> baseData =
await apiService.orderDetail(id).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
return baseData.data;
}
}
UserInfo userInfo;
queryUserBalance() async {
BaseData<UserInfo> baseData =
await apiService.queryInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
userInfo = baseData.data;
if (mounted) setState(() {});
}else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
paySelected(OrderInfo orderInfo, MinApiService minService) async {
var payChannel = await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return OrderPaySelected(userInfo);
},
);
if (payChannel != null && payChannel > 0) {
orderInfo = await queryDetails(orderInfo.id);
OrderUtils.carryOnPay(
payChannel,
minService,
orderInfo,
(BaseData baseData) {
SmartDialog.showToast(
baseData?.msg == "ok" ? "订单支付成功" : baseData?.msg,
alignment: Alignment.center);
Future.delayed(Duration(seconds: 3), () {
_onRefresh();
});
},
);
}
}
payResult(BaseData baseData) {}
orderCancel(String orderId) async {
BaseData baseData =
await apiService.orderCancel(orderId).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("订单取消成功");
_onRefresh();
}else{
if(baseData.msg != null)
SmartDialog.showToast(baseData.msg,alignment: Alignment.center);
}
}
aginOrder(OrderInfo orderInfo) {
// Navigator.of(context).pushNamed(
// '/router/union_detail_page',
// arguments: {"id": storeId},
// );
// String storeId = (orderInfo != null &&
// orderInfo.storeVO != null)
// ? (orderInfo.storeVO.id ?? "")
// : "";
if (orderInfo.storeVO.posType.code == "NORMALSTORE") {
Scan.toScan(
context,
orderInfo.storeVO.id,
orderInfo.tenantCode,
orderInfo.storeVO.storeName,
);
} else {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": orderInfo.storeVO.id,
"tenant": orderInfo.tenantCode,
"storeName": orderInfo.storeVO.storeName
},
);
}
}
String totalPrice(orderInfo) { String totalPrice(orderInfo) {
if (orderInfo == null) return ""; if (orderInfo == null) return "";
double totalPrice = (double.tryParse(orderInfo.orderSum) + double totalPrice = (double.tryParse(orderInfo.orderSum) +

159
lib/retrofit/data/member_recharge_list.dart

@ -0,0 +1,159 @@
/// id : "1681490552371019776"
/// rechargeMoney : "100.00"
/// giftdMoney : "10.00"
/// limitNum : 0
/// gitfdCouponId : null
/// startDate : null
/// endDate : null
/// startTime : null
/// endTime : null
/// tenantCode : "1175"
/// createTime : "2023-07-21 09:22:53"
/// isDeleted : 0
/// rechargeType : 0
/// remark : "充值100.00 赠送10.00"
/// sortValue : 0
/// useNum : 0
class MemberRechargeList {
MemberRechargeList({
String id,
String rechargeMoney,
String giftdMoney,
num limitNum,
dynamic gitfdCouponId,
dynamic startDate,
dynamic endDate,
dynamic startTime,
dynamic endTime,
String tenantCode,
String createTime,
num isDeleted,
num rechargeType,
String remark,
num sortValue,
num useNum,}){
_id = id;
_rechargeMoney = rechargeMoney;
_giftdMoney = giftdMoney;
_limitNum = limitNum;
_gitfdCouponId = gitfdCouponId;
_startDate = startDate;
_endDate = endDate;
_startTime = startTime;
_endTime = endTime;
_tenantCode = tenantCode;
_createTime = createTime;
_isDeleted = isDeleted;
_rechargeType = rechargeType;
_remark = remark;
_sortValue = sortValue;
_useNum = useNum;
}
MemberRechargeList.fromJson(dynamic json) {
_id = json['id'];
_rechargeMoney = json['rechargeMoney'];
_giftdMoney = json['giftdMoney'];
_limitNum = json['limitNum'];
_gitfdCouponId = json['gitfdCouponId'];
_startDate = json['startDate'];
_endDate = json['endDate'];
_startTime = json['startTime'];
_endTime = json['endTime'];
_tenantCode = json['tenantCode'];
_createTime = json['createTime'];
_isDeleted = json['isDeleted'];
_rechargeType = json['rechargeType'];
_remark = json['remark'];
_sortValue = json['sortValue'];
_useNum = json['useNum'];
}
String _id;
String _rechargeMoney;
String _giftdMoney;
num _limitNum;
dynamic _gitfdCouponId;
dynamic _startDate;
dynamic _endDate;
dynamic _startTime;
dynamic _endTime;
String _tenantCode;
String _createTime;
num _isDeleted;
num _rechargeType;
String _remark;
num _sortValue;
num _useNum;
MemberRechargeList copyWith({ String id,
String rechargeMoney,
String giftdMoney,
num limitNum,
dynamic gitfdCouponId,
dynamic startDate,
dynamic endDate,
dynamic startTime,
dynamic endTime,
String tenantCode,
String createTime,
num isDeleted,
num rechargeType,
String remark,
num sortValue,
num useNum,
}) => MemberRechargeList( id: id ?? _id,
rechargeMoney: rechargeMoney ?? _rechargeMoney,
giftdMoney: giftdMoney ?? _giftdMoney,
limitNum: limitNum ?? _limitNum,
gitfdCouponId: gitfdCouponId ?? _gitfdCouponId,
startDate: startDate ?? _startDate,
endDate: endDate ?? _endDate,
startTime: startTime ?? _startTime,
endTime: endTime ?? _endTime,
tenantCode: tenantCode ?? _tenantCode,
createTime: createTime ?? _createTime,
isDeleted: isDeleted ?? _isDeleted,
rechargeType: rechargeType ?? _rechargeType,
remark: remark ?? _remark,
sortValue: sortValue ?? _sortValue,
useNum: useNum ?? _useNum,
);
String get id => _id;
String get rechargeMoney => _rechargeMoney;
String get giftdMoney => _giftdMoney;
num get limitNum => _limitNum;
dynamic get gitfdCouponId => _gitfdCouponId;
dynamic get startDate => _startDate;
dynamic get endDate => _endDate;
dynamic get startTime => _startTime;
dynamic get endTime => _endTime;
String get tenantCode => _tenantCode;
String get createTime => _createTime;
num get isDeleted => _isDeleted;
num get rechargeType => _rechargeType;
String get remark => _remark;
num get sortValue => _sortValue;
num get useNum => _useNum;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['rechargeMoney'] = _rechargeMoney;
map['giftdMoney'] = _giftdMoney;
map['limitNum'] = _limitNum;
map['gitfdCouponId'] = _gitfdCouponId;
map['startDate'] = _startDate;
map['endDate'] = _endDate;
map['startTime'] = _startTime;
map['endTime'] = _endTime;
map['tenantCode'] = _tenantCode;
map['createTime'] = _createTime;
map['isDeleted'] = _isDeleted;
map['rechargeType'] = _rechargeType;
map['remark'] = _remark;
map['sortValue'] = _sortValue;
map['useNum'] = _useNum;
return map;
}
}

10
lib/retrofit/min_api.dart

@ -19,6 +19,7 @@ import 'data/activity_order_list.dart';
import 'data/findMiNiGroupList.dart'; import 'data/findMiNiGroupList.dart';
import 'data/home_recommend_list.dart'; import 'data/home_recommend_list.dart';
import 'data/launch_join_act.dart'; import 'data/launch_join_act.dart';
import 'data/member_recharge_list.dart';
import 'data/miNiDetail.dart'; import 'data/miNiDetail.dart';
import 'data/settleOrderInfo.dart'; import 'data/settleOrderInfo.dart';
import 'data/shoppingCart.dart'; import 'data/shoppingCart.dart';
@ -243,4 +244,13 @@ abstract class MinApiService {
@POST("promotion/useMemberCoupon") @POST("promotion/useMemberCoupon")
Future<BaseData> useMemberCoupon(@Body() Map<String, dynamic> param); Future<BaseData> useMemberCoupon(@Body() Map<String, dynamic> param);
///
@POST("/member/recharge")
Future<BaseData<dynamic>> memberRecharge(@Body() Map<String, dynamic> param);
///
@GET("/store/getRechargePreferential")
Future<BaseData<List<MemberRechargeList>>> memberRechargeList();
} }

45
lib/retrofit/min_api.g.dart

@ -651,4 +651,49 @@ class _MinApiService implements MinApiService {
); );
return value; return value;
} }
@override
Future<BaseData<dynamic>> memberRecharge(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>('//member/recharge',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json as dynamic,
);
return value;
}
@override
Future<BaseData<List<MemberRechargeList>>> memberRechargeList() async {
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/store/getRechargePreferential',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<List<MemberRechargeList>>.fromJson(
_result.data,
(json) => (json as List<dynamic>)
.map<MemberRechargeList>(
(i) => MemberRechargeList.fromJson(i as Map<String, dynamic>))
.toList());
return value;
}
} }

14
lib/retrofit/retrofit_api.dart

@ -6,7 +6,6 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/activity.dart'; import 'package:huixiang/retrofit/data/activity.dart';
import 'package:huixiang/retrofit/data/article.dart'; import 'package:huixiang/retrofit/data/article.dart';
@ -14,12 +13,10 @@ import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/comunity_comment.dart'; import 'package:huixiang/retrofit/data/comunity_comment.dart';
import 'package:huixiang/retrofit/data/coupon.dart'; import 'package:huixiang/retrofit/data/coupon.dart';
import 'package:huixiang/retrofit/data/farmers_list.dart'; import 'package:huixiang/retrofit/data/farmers_list.dart';
import 'package:huixiang/retrofit/data/login_info.dart';
import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:retrofit/retrofit.dart'; import 'package:retrofit/retrofit.dart';
import '../utils/flutter_utils.dart';
import 'data/achievement_detail_list.dart'; import 'data/achievement_detail_list.dart';
import 'data/activity_pos.dart'; import 'data/activity_pos.dart';
import 'data/address.dart'; import 'data/address.dart';
@ -50,7 +47,6 @@ import 'data/msg_stats.dart';
import 'data/page.dart'; import 'data/page.dart';
import 'data/rank.dart'; import 'data/rank.dart';
import 'data/rechargeActLists.dart'; import 'data/rechargeActLists.dart';
import 'data/recharge_list.dart';
import 'data/second_card_list.dart'; import 'data/second_card_list.dart';
import 'data/sign_info.dart'; import 'data/sign_info.dart';
import 'data/social_info.dart'; import 'data/social_info.dart';
@ -89,6 +85,8 @@ abstract class ApiService {
if (pay) { if (pay) {
headers["Environment"] = "app"; headers["Environment"] = "app";
} }
if (kReleaseMode)
baseUrl = serviceBaseUrl;
if (isIp) baseUrl = ipBaseUrl; if (isIp) baseUrl = ipBaseUrl;
dio.options = BaseOptions( dio.options = BaseOptions(
connectTimeout: 60000, connectTimeout: 60000,
@ -150,10 +148,6 @@ abstract class ApiService {
debugPrint("\n"); debugPrint("\n");
}), }),
); );
if (kReleaseMode) {
baseUrl = serviceBaseUrl;
}
return _ApiService(dio, baseUrl: baseUrl); return _ApiService(dio, baseUrl: baseUrl);
} }
@ -230,8 +224,8 @@ abstract class ApiService {
Future<BaseData<dynamic>> recharge(@Body() Map<String, dynamic> param); Future<BaseData<dynamic>> recharge(@Body() Map<String, dynamic> param);
/// ///
@GET("/wallet/rechargeActList") @GET("/wallet/rechargeActList?tenantCode={tenantCode}")
Future<BaseData<RechargeActLists>> rechargeActList(); Future<BaseData<RechargeActLists>> rechargeActList(@Path("tenantCode") String tenantCode);
/// ///
@GET("/coupon/receive?couponId={couponId}") @GET("/coupon/receive?couponId={couponId}")

4
lib/retrofit/retrofit_api.g.dart

@ -322,12 +322,12 @@ class _ApiService implements ApiService {
} }
@override @override
Future<BaseData<RechargeActLists>> rechargeActList() async { Future<BaseData<RechargeActLists>> rechargeActList(tenantCode) async {
const _extra = <String, dynamic>{}; const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{}; final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{}; final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>( final _result = await _dio.request<Map<String, dynamic>>(
'/wallet/rechargeActList', '/wallet/rechargeActList?tenantCode=$tenantCode',
queryParameters: queryParameters, queryParameters: queryParameters,
options: RequestOptions( options: RequestOptions(
method: 'GET', method: 'GET',

12
lib/store/store_view/shop_goods.dart

@ -359,7 +359,7 @@ class _ShopGoods extends State<ShopGoods> {
// SmartDialog.showToast("库存不足", // SmartDialog.showToast("库存不足",
// alignment: Alignment.center); // alignment: Alignment.center);
// } else // } else
if (_jumpType == -1) if (_jumpType == -1)
queryMiNiDetail(widget.productListBean.id); queryMiNiDetail(widget.productListBean.id);
else if (_jumpType == 0) else if (_jumpType == 0)
widget.add(widget.shoppingCartSkuItemListBean); widget.add(widget.shoppingCartSkuItemListBean);
@ -497,6 +497,7 @@ class _ShopGoods extends State<ShopGoods> {
SizedBox( SizedBox(
height: 4.h, height: 4.h,
), ),
///VIP价格 ///VIP价格
// if (widget.productListBean.vipPrice != null) // if (widget.productListBean.vipPrice != null)
// Row( // Row(
@ -645,9 +646,12 @@ class _ShopGoods extends State<ShopGoods> {
// //
// http://miniscan.lotus-wallet.com/placeorder?tenant_code=1194&table_id=1669609340031467520&store_id=1637659387134738432 // http://miniscan.lotus-wallet.com/placeorder?tenant_code=1194&table_id=1669609340031467520&store_id=1637659387134738432
Uri uri = Uri.parse(result); Uri uri = Uri.parse(result);
String tableId = uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"]; String tableId =
String tenantCode = uri.queryParameters["tenantCode"] ?? uri.queryParameters["tenant_code"]; uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"];
String shopId = uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"]; String tenantCode = uri.queryParameters["tenantCode"] ??
uri.queryParameters["tenant_code"];
String shopId =
uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"];
if (tableId != null && if (tableId != null &&
tableId != "" && tableId != "" &&
tenantCode != null && tenantCode != null &&

65
lib/union/union_list.dart

@ -75,11 +75,14 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
}).catchError((error) { }).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center); alignment: Alignment.center);
_refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
storeList = baseData.data; storeList = baseData.data;
_refreshController.refreshCompleted();
} else {
_refreshController.refreshFailed();
} }
_refreshController.refreshCompleted();
EasyLoading.dismiss(); EasyLoading.dismiss();
setState(() {}); setState(() {});
} }
@ -299,25 +302,28 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
children: []..addAll( children: []..addAll(
itemServer(store != null ? store.businessService : "")), itemServer(store != null ? store.businessService : "")),
), ),
SizedBox(height: store.businessService == ""?40.h:23.h), SizedBox(height: store.businessService == "" ? 40.h : 23.h),
if(storeList[position].productShow != null) if (storeList[position].productShow != null)
Container( Container(
height: 100.h, height: 100.h,
child: ListView.builder( child: ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: (storeList[position].productShow?.length ??0) > 3 ?3:storeList[position].productShow?.length ?? 0, itemCount:
scrollDirection: Axis.horizontal, (storeList[position].productShow?.length ?? 0) > 3
shrinkWrap: true, ? 3
physics: NeverScrollableScrollPhysics(), : storeList[position].productShow?.length ?? 0,
itemBuilder: (context, index) { scrollDirection: Axis.horizontal,
return GestureDetector( shrinkWrap: true,
onTap: () {}, physics: NeverScrollableScrollPhysics(),
child: unionGoodsItem( itemBuilder: (context, index) {
storeList[position].productShow[index]), return GestureDetector(
); onTap: () {},
}, child: unionGoodsItem(
storeList[position].productShow[index]),
);
},
),
), ),
),
], ],
)) ))
], ],
@ -352,7 +358,6 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
.toList(); .toList();
} }
///
Widget unionGoodsItem(ProductShow productShow) { Widget unionGoodsItem(ProductShow productShow) {
return Container( return Container(
width: 74.w, width: 74.w,
@ -369,16 +374,18 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
errorSrc: "assets/image/default_1.webp", errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp", fadeSrc: "assets/image/default_1.webp",
), ),
Padding(padding:EdgeInsets.only(top: 8.h), Padding(
child: Text( padding: EdgeInsets.only(top: 8.h),
productShow?.productName ?? "", child: Text(
overflow: TextOverflow.ellipsis, productShow?.productName ?? "",
style: TextStyle( overflow: TextOverflow.ellipsis,
color: Color(0xFFA29E9E), style: TextStyle(
fontSize: 12.sp, color: Color(0xFFA29E9E),
fontWeight: MyFontWeight.regular, fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
), ),
),), ),
], ],
), ),
); );

3
lib/view_widget/my_appbar.dart

@ -70,8 +70,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
}, },
child: Container( child: Container(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 12,), padding: EdgeInsets.only(top: 6.h,bottom: 6.h,left:20.w,right:6.w),
padding: EdgeInsets.all(6),
child: Icon( child: Icon(
Icons.arrow_back_ios, Icons.arrow_back_ios,
color: leadingColor, color: leadingColor,

8
lib/view_widget/recharge_details_dialog.dart

@ -1,15 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/flutter_html.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/coupon.dart';
import 'package:huixiang/retrofit/data/recharge_list.dart';
import 'package:huixiang/retrofit/data/store.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/store/scan.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/round_button.dart';
import '../retrofit/data/rechargeActLists.dart'; import '../retrofit/data/rechargeActLists.dart';

Loading…
Cancel
Save