Browse Source

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

店铺充值:店铺充值列表,店铺充值接口都改为小程序接口;(支持微信支付宝)
新增店铺充值接口实体类;
dev
huixiang_app 1 year ago
parent
commit
b2d180cb0a
  1. 133
      lib/home/home_page.dart
  2. 246
      lib/home/welfare_page.dart
  3. 40
      lib/integral/integral_page.dart
  4. 16
      lib/integral/intergra_view/integral_task.dart
  5. 25
      lib/mine/mine_shop_page.dart
  6. 368
      lib/mine/mine_shop_recharge.dart
  7. 71
      lib/mine/mine_view/mine_item.dart
  8. 32
      lib/mine/mine_vip/mine_attainment_page.dart
  9. 156
      lib/mine/recharge_page.dart
  10. 348
      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. 10
      lib/store/store_view/shop_goods.dart
  17. 17
      lib/union/union_list.dart
  18. 3
      lib/view_widget/my_appbar.dart
  19. 8
      lib/view_widget/recharge_details_dialog.dart

133
lib/home/home_page.dart

@ -40,6 +40,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/user_info.dart';
import '../utils/flutter_utils.dart';
import '../view_widget/channel_dialog.dart';
import '../view_widget/custom_image.dart';
import 'home_view/happy_help_farmers.dart';
@ -76,6 +77,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
List<Goods> goods = [];
List<GoodsCategory> gooodsCategorys = [];
List<BannerData> bannerData = [];
List<BannerData> activityBannerData = [];
List<Brand> brandData = [];
List<Article> articles = [];
Founder founder;
@ -87,6 +89,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
UserInfo userInfo;
dynamic mRaiseMoney = 0; //
int _loadCount = 0;
DioErrorType dioErrorType;
@override
void initState() {
@ -160,7 +163,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
try {
BaseData<PageInfo<BannerData>> baseData = await apiService.queryBanner({
"model": {"type": "HOME_PAGE"},
}).catchError((onError) {});
}).catchError((onError) {
dioErrorType = onError.type;
});
if (baseData != null && baseData.isSuccess) {
bannerData = baseData.data.records;
// 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() {
_loadCount += 1;
if (_loadCount == 6) {
if (_loadCount == 7) {
_loadCount = 0;
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(() {});
}
}
@ -334,8 +359,10 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
token: value.getString("token"),
);
}
dioErrorType = null;
if (isFirstIn) queryActivity();
queryBanner();
queryActivityBanner();
queryRecommendRank();
queryGoodsCategory();
queryPointsProductList(true);
@ -627,8 +654,10 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
Widget spread() {
return Container(
width: double.infinity,
// margin: EdgeInsets.symmetric(horizontal:14.w),
height: 85.h,
child: Swiper(
child: bannerData != null && bannerData.isNotEmpty
? Swiper(
pagination: SwiperPagination(
alignment: Alignment.bottomCenter,
margin: EdgeInsets.only(top: 5.h),
@ -644,33 +673,99 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
duration: 1000,
autoplayDelay: 2000,
itemBuilder: (context, position) {
return GestureDetector(
return InkWell(
onTap: () {
if (position == 0) {
Navigator.of(context).pushNamed('/router/invite_friends');
} else if (position == 1) {
Navigator.of(context).pushNamed('/router/trading_card_page');
}
spreadBannerClick(activityBannerData[position]);
},
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),
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: 2,
itemCount: activityBannerData.length,
)
: Image.asset(
"assets/image/default_2_1.webp",
fit: BoxFit.cover,
),
);
}
/// 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 = [
"assets/image/welfare_spread.webp",
"assets/image/welfare_yz.webp",

246
lib/home/welfare_page.dart

@ -46,26 +46,16 @@ class _WelfarePage extends State<WelfarePage> {
int type = 1;
int couponIndex = 0;
int swiperIndex = 0;
int _loadCount = 0;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(), context: context, token: value.getString("token")),
_onRefresh(),
});
_onRefresh();
}
queryGoods() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
try {
var param = {
"categoryId": categoryId ?? "",
"orderDesc": orderDesc,
@ -81,27 +71,16 @@ class _WelfarePage extends State<WelfarePage> {
});
EasyLoading.dismiss();
if (pageGoods != null && pageGoods.isSuccess) {
setState(() {
goods.clear();
goods.addAll(pageGoods.data.list);
});
refreshController.refreshCompleted();
refreshController.loadComplete();
} else {
refreshController.loadFailed();
refreshController.refreshFailed();
}
} finally {
addLoadCount();
}
}
queryCoupon() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
try{
BaseData<PageInfo<Coupon>> baseData = await apiService.queryCoupon({
"centre": true,
"pageNum": 1,
@ -111,8 +90,6 @@ class _WelfarePage extends State<WelfarePage> {
}).catchError((onError) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
alignment: Alignment.center);
refreshController.refreshFailed();
refreshController.loadFailed();
});
coupons.clear();
coupon.clear();
@ -120,26 +97,40 @@ class _WelfarePage extends State<WelfarePage> {
coupons.addAll(baseData.data.list);
for (var i = 0; i < coupons.length ~/ 3 + 1; i++) {
List<Coupon> con = [];
con = coupons.skip(i*3).take((i*3<coupons.length)?3:(coupons.length - (i*3))).toList();
con = coupons
.skip(i * 3)
.take((i * 3 < coupons.length) ? 3 : (coupons.length - (i * 3)))
.toList();
coupon.add(con);
}
if (coupon.length > 0 && coupon[coupon.length - 1].isEmpty)
coupon.removeAt(coupon.length - 1);
refreshController.refreshCompleted();
refreshController.loadComplete();
setState(() {});
} else {
refreshController.refreshFailed();
refreshController.loadFailed();
}}finally{
addLoadCount();
}
}
_onRefresh(){
_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"));
}
queryGoods();
queryCoupon();
}
addLoadCount() {
_loadCount += 1;
if (_loadCount == 2) {
_loadCount = 0;
EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted();
if (mounted) setState(() {});
}
}
@override
Widget build(BuildContext context) {
@ -157,7 +148,10 @@ class _WelfarePage extends State<WelfarePage> {
width: double.infinity,
height: 236.h,
),
Expanded(child: Container(color: Colors.white,))
Expanded(
child: Container(
color: Colors.white,
))
],
),
Scaffold(
@ -180,18 +174,15 @@ class _WelfarePage extends State<WelfarePage> {
return MyFooter(mode);
},
),
onRefresh:(){
setState(() {
_onRefresh();
});
},
onRefresh:_onRefresh,
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
topRight: Radius.circular(6),),
topRight: Radius.circular(6),
),
color: Colors.white,
boxShadow: [
BoxShadow(
@ -216,9 +207,7 @@ class _WelfarePage extends State<WelfarePage> {
padding: EdgeInsets.only(left: 14, right: 14),
child: Column(
children: [
inviteFriends(),
benefitExchange(),
],
),
@ -242,7 +231,8 @@ class _WelfarePage extends State<WelfarePage> {
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
topRight: Radius.circular(6),),
topRight: Radius.circular(6),
),
color: Colors.white,
boxShadow: [
BoxShadow(
@ -259,8 +249,7 @@ class _WelfarePage extends State<WelfarePage> {
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 17.w, vertical: 16.h),
child:
Row(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@ -282,13 +271,14 @@ class _WelfarePage extends State<WelfarePage> {
),
],
)),
coupon.length == 0?
NoDataView(
coupon.length == 0
? NoDataView(
src: "assets/image/ka.webp",
isShowBtn: false,
text: S.of(context).haimeiyouyouhuiquankeyilingqu,
fontSize: 16.sp,
): AspectRatio(
)
: AspectRatio(
aspectRatio: 1.10,
child: Swiper(
onIndexChanged: (it) {
@ -322,19 +312,19 @@ class _WelfarePage extends State<WelfarePage> {
),
)
],
)
);
));
}
Widget weekList(List<Coupon> cops) {
return Expanded(
child:(cops == null && cops.length == 0)?
NoDataView(
child: (cops == null && cops.length == 0)
? NoDataView(
src: "assets/image/ka.webp",
isShowBtn: false,
text: S.of(context).haimeiyouyouhuiquankeyilingqu,
fontSize: 16.sp,
):ListView.builder(
)
: ListView.builder(
padding: EdgeInsets.zero,
itemCount: cops.length,
scrollDirection: Axis.vertical,
@ -342,12 +332,12 @@ class _WelfarePage extends State<WelfarePage> {
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
onTap: () {},
child: weekCoupon(cops[position]),
);
},
),);
),
);
}
///
@ -367,7 +357,8 @@ class _WelfarePage extends State<WelfarePage> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(child: Container(
Expanded(
child: Container(
margin: EdgeInsets.only(top: 12, bottom: 12),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@ -383,31 +374,37 @@ class _WelfarePage extends State<WelfarePage> {
color: Color(0xFF0D0D0D),
),
),
SizedBox(height: 12,),
(cop.status == 0)?
Text(
SizedBox(
height: 12,
),
(cop.status == 0)
? Text(
"发放时间: ${cop?.publishStartTime ?? ""}",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
color: cop.status == 3
? Color(0xFFB3B3B3)
: Color(0xFF4D4D4D),
),
):Text(
)
: Text(
"有效期至 ${cop?.useEndTime ?? ""}",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
color: cop.status == 3
? Color(0xFFB3B3B3)
: Color(0xFF4D4D4D),
),
)
],
),
)),
Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.end,
@ -441,7 +438,8 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color:
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
SizedBox(
@ -456,16 +454,15 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.semi_bold,
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color:
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
),
Text(
S.of(context).manyuankeyong(coupon != null
? ("${cop.fullAmount}" ?? "0")
.toString()
: ""),
S.of(context).manyuankeyong(
coupon != null ? ("${cop.fullAmount}" ?? "0").toString() : ""),
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
@ -489,7 +486,8 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 22.sp,
fontWeight: MyFontWeight.semi_bold,
color:cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color:
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@ -520,7 +518,8 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color:
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@ -551,20 +550,24 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color:
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
SizedBox(
height: 4.h,
),
Text(
cop.limitAmount != "0.00"?(coupon != null
cop.limitAmount != "0.00"
? (coupon != null
? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}"
: "") :"",
: "")
: "",
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.bold,
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color:
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@ -582,14 +585,17 @@ class _WelfarePage extends State<WelfarePage> {
textBaseline: TextBaseline.alphabetic,
children: [
Text(
cop.discountPercent != 0 ? (coupon != null
cop.discountPercent != 0
? (coupon != null
? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.discountPercent / 10.0}" ??
"0"
: ""):"",
: "")
: "",
style: TextStyle(
fontSize: 30.sp,
fontWeight: MyFontWeight.semi_bold,
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color:
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
SizedBox(
@ -600,7 +606,8 @@ class _WelfarePage extends State<WelfarePage> {
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
color:
cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@ -642,9 +649,8 @@ class _WelfarePage extends State<WelfarePage> {
child: InkWell(
onTap: () {
if (cop.bizType == 5 || cop.bizType == 3) {
Navigator.of(context).pushNamed(
'/router/write_off_page',
arguments: {
Navigator.of(context)
.pushNamed('/router/write_off_page', arguments: {
"couponId": cop.id,
"coupon": jsonEncode(cop.toJson()),
});
@ -723,7 +729,9 @@ class _WelfarePage extends State<WelfarePage> {
color: Color(0xFF0D0D0D),
),
),
SizedBox(height: 12,),
SizedBox(
height: 12,
),
GestureDetector(
onTap: () {
Navigator.of(context).pushNamed('/router/invite_friends');
@ -760,15 +768,16 @@ class _WelfarePage extends State<WelfarePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(child:
Text(
Expanded(
child: Text(
S.of(context).fuliduihuan,
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.bold,
color: Color(0xFF0D0D0D),
),
),),
),
),
Text(
S.of(context).gengduo,
style: TextStyle(
@ -785,8 +794,11 @@ class _WelfarePage extends State<WelfarePage> {
],
),
),
SizedBox(height: 12,),
(goods == null || goods.length == 0)? NoDataView(
SizedBox(
height: 12,
),
(goods == null || goods.length == 0)
? NoDataView(
src: "assets/image/xiao_fei.webp",
isShowBtn: false,
text: "暂无商品可兑换",
@ -811,8 +823,8 @@ class _WelfarePage extends State<WelfarePage> {
//Widget之间间距
mainAxisSpacing: 16.w,
//Widget宽高比例 0.59
childAspectRatio:
200 / (285 / 2 + (285 / 2) * AppUtils.textScale(context)),
childAspectRatio: 200 /
(285 / 2 + (285 / 2) * AppUtils.textScale(context)),
),
itemBuilder: (context, index) {
return GestureDetector(
@ -871,10 +883,8 @@ class _WelfarePage extends State<WelfarePage> {
margin: EdgeInsets.only(
right: 12.w,
top: 10.h,
),padding: EdgeInsets.only(
bottom: 8,
left: 8
),
padding: EdgeInsets.only(bottom: 8, left: 8),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
@ -913,14 +923,20 @@ class _WelfarePage extends State<WelfarePage> {
}
String pointPrice(Goods goodsPrice) {
if(goodsPrice == null)
return "";
if (goodsPrice == null) return "";
if (goodsPrice?.oneBean != null && goodsPrice?.oneBean != "0") {
return "${goodsPrice?.oneBean}印章";
} else if (goodsPrice?.onePrice != null && goodsPrice?.onePrice != "0") {
return S.of(context).jifen_(goodsPrice?.onePrice);
}else if((goodsPrice?.onePrice == null || goodsPrice?.onePrice == "0") && ((goodsPrice?.price != null && goodsPrice?.price != "0") || (goodsPrice?.money != null && goodsPrice?.money != "0.00"))){
return (goodsPrice?.price== "0"|| goodsPrice?.price == null ? "" : S.of(context).jifen_(goodsPrice?.price)) + (goodsPrice?.money== "0"|| goodsPrice?.money == null ? "" : " + ${AppUtils.calculateDouble(double.tryParse(goodsPrice?.money) ?? 0)}");
} else if ((goodsPrice?.onePrice == null || goodsPrice?.onePrice == "0") &&
((goodsPrice?.price != null && goodsPrice?.price != "0") ||
(goodsPrice?.money != null && goodsPrice?.money != "0.00"))) {
return (goodsPrice?.price == "0" || goodsPrice?.price == null
? ""
: S.of(context).jifen_(goodsPrice?.price)) +
(goodsPrice?.money == "0" || goodsPrice?.money == null
? ""
: " + ${AppUtils.calculateDouble(double.tryParse(goodsPrice?.money) ?? 0)}");
} else if (goodsPrice.oneMoney != null && goodsPrice.oneMoney != "0.00") {
return "${AppUtils.calculateDouble(double.tryParse(goodsPrice.oneMoney) ?? 0)}";
}
@ -929,7 +945,9 @@ class _WelfarePage extends State<WelfarePage> {
///
Widget activityTask() {
return Container(
margin: EdgeInsets.only(bottom:20.h,),
margin: EdgeInsets.only(
bottom: 20.h,
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -956,7 +974,9 @@ class _WelfarePage extends State<WelfarePage> {
),
],
),
SizedBox(height: 12.h,),
SizedBox(
height: 12.h,
),
ListView.builder(
padding: EdgeInsets.zero,
itemCount: 6,
@ -965,8 +985,7 @@ class _WelfarePage extends State<WelfarePage> {
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
},
onTap: () {},
child: taskItem(),
);
},
@ -998,7 +1017,8 @@ class _WelfarePage extends State<WelfarePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(child:Column(
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@ -1017,7 +1037,8 @@ class _WelfarePage extends State<WelfarePage> {
fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D),
),
), Text(
),
Text(
"购买任意3杯新品",
style: TextStyle(
fontSize: 10.sp,
@ -1026,7 +1047,8 @@ class _WelfarePage extends State<WelfarePage> {
),
),
],
),),
),
),
Container(
width: 55.w,
height: 21.h,
@ -1037,7 +1059,8 @@ class _WelfarePage extends State<WelfarePage> {
colors: [
Color(0xFFFF2700),
Color(0xFFFF4F00),
],),
],
),
// border: Border.all(color: Colors.white,width: 0.5),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(3),
@ -1056,5 +1079,4 @@ class _WelfarePage extends State<WelfarePage> {
),
);
}
}

40
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:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../utils/flutter_utils.dart';
import 'intergra_view/integral_task.dart';
class IntegralPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _IntegralPage();
@ -51,8 +51,12 @@ class _IntegralPage extends State<IntegralPage> {
);
userInfo = UserInfo.fromJson(jsonDecode(value.getString("user")));
BaseData<List<Rank>> rankData = await apiService.rankList()
.catchError((onError) {});
BaseData<List<Rank>> rankData =
await apiService.rankList().catchError((onError) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
alignment: Alignment.center);
refreshController.refreshFailed();
});
if (rankData != null && rankData.isSuccess) {
ranks.clear();
ranks.addAll(rankData.data);
@ -112,7 +116,9 @@ class _IntegralPage extends State<IntegralPage> {
Scaffold(
backgroundColor: Colors.transparent,
appBar: MyAppBar(
exit: (){Navigator.of(context).pop(signInfo.todayHasSignin ?? false);},
exit: () {
Navigator.of(context).pop(signInfo?.todayHasSignin ?? false);
},
background: Colors.transparent,
leadingColor: Colors.white,
title: "",
@ -124,7 +130,9 @@ class _IntegralPage extends State<IntegralPage> {
margin: EdgeInsets.only(right: 16.w),
child: GestureDetector(
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(
S.of(context).mingxi,
@ -141,7 +149,7 @@ class _IntegralPage extends State<IntegralPage> {
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
header: MyHeader(color: Colors.white,),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
@ -163,9 +171,19 @@ class _IntegralPage extends State<IntegralPage> {
return Column(
children: [
/// VIP等级显示
IntegralVip(rankLevel, signInfo, userInfo,"${ (signInfo?.signInList?.length ) ?? "0"}",
((signInfo?.rewardList != null && signInfo.rewardList.length > (signInfo?.signInList?.length ?? 0)) ?
signInfo.rewardList[signInfo?.signInList?.length ?? 0]:0).toString()),
IntegralVip(
rankLevel,
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),
@ -191,7 +209,9 @@ class _IntegralPage extends State<IntegralPage> {
SmartDialog.showToast("今日已签到了", alignment: Alignment.center);
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) {});
if (baseData != null && baseData.isSuccess) {
setState(() {});

16
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:huixiang/view_widget/round_button.dart';
import '../../view_widget/no_data_view.dart';
class IntegralTask extends StatefulWidget {
final SignInfo signInfo;
@ -57,7 +59,10 @@ class _IntegralTask extends State<IntegralTask> {
),
Expanded(
child: Container(
child: ListView.builder(
child: (widget.signInfo != null &&
widget.signInfo.taskList != null &&
widget.signInfo.taskList.length > 0)
? ListView.builder(
padding: EdgeInsets.only(left: 10.w, top: 20.h),
physics: BouncingScrollPhysics(),
// loop: false,
@ -78,7 +83,14 @@ class _IntegralTask extends State<IntegralTask> {
widget.signInfo.taskList != null &&
widget.signInfo.taskList.length > 0)
? widget.signInfo.taskList.length
: 0),
: 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,
)

25
lib/mine/mine_shop_page.dart

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

368
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:flutter/material.dart';
import 'package:flutter_bmflocation/flutter_bmflocation.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/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/retrofit_api.dart';
import 'package:huixiang/store/scan.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/my_appbar.dart';
import 'package:huixiang/view_widget/my_footer.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../retrofit/data/member_recharge_list.dart';
import '../retrofit/data/rechargeActLists.dart';
import '../retrofit/data/wx_pay.dart';
import '../retrofit/min_api.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/recharge_details_dialog.dart';
import 'package:tobias/tobias.dart' as tobias;
class MineShopRecharge extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -40,44 +43,181 @@ class MineShopRecharge extends StatefulWidget {
class _MineShopRecharge extends State<MineShopRecharge> {
ApiService apiService;
MinApiService minService;
VipCard vipCard;
RechargeActLists rechargeActLists;
List<MemberRechargeList> memberRechargeList = [];
int selectIndex = 0;
double discount = 100;
var checkIndex = 2;
dynamic payListen;
int _loadCount = 0;
String tenant;
String storeId;
String minToken;
final RefreshController refreshController = RefreshController();
@override
void dispose() {
super.dispose();
refreshController.dispose();
if (payListen != null) payListen.cancel();
}
@override
void 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 {
SharedPreferences value = await SharedPreferences.getInstance();
if (apiService == null)
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
vipDetail({bool isSingle = true}) async {
try {
BaseData<VipCard> baseData = await apiService.vipDetail({
"id": widget.arguments["id"],
"latitude": "$latitude",
"longitude": "$longitude",
"latitude": "",
"longitude": "",
}).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
vipCard = baseData.data;
refreshController.loadComplete();
} else {
refreshController.loadFailed();
}
print("object:object");
} 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 (checkIndex == 2) {
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 {
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(() {});
}
}
@override
@ -90,20 +230,30 @@ class _MineShopRecharge extends State<MineShopRecharge> {
brightness: Brightness.dark,
leadingColor: Colors.black,
),
body:
Column(
body: SmartRefresher(
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
controller: refreshController,
onRefresh: _onRefresh,
physics: BouncingScrollPhysics(),
child: Column(
children: [
shopRechargeCard(),
// NoDataView(
// src: "assets/image/xiao_fei.webp",
// isShowBtn: false,
// text: "当前店铺暂无充值套餐~",
// fontSize: 16.sp,
// margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w),
// ),
Expanded(child:ListView.builder(
(memberRechargeList != null &&
(memberRechargeList?.length ?? 0) > 0)
? Expanded(
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: 6,
itemCount: (memberRechargeList != null &&
(memberRechargeList?.length ?? 0) > 0)
? memberRechargeList.length
: 0,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
@ -114,9 +264,20 @@ class _MineShopRecharge extends State<MineShopRecharge> {
selectIndex = position;
});
},
child: rechargeItem(position));
child: rechargeItem(
memberRechargeList[position], position));
},
)),
))
: NoDataView(
src: "assets/image/xiao_fei.webp",
isShowBtn: false,
text: "当前店铺暂无充值套餐~",
fontSize: 16.sp,
margin:
EdgeInsets.only(top: 90.h, left: 60.w, right: 60.w),
),
if (memberRechargeList != null &&
(memberRechargeList?.length ?? 0) > 0)
Container(
width: double.infinity,
margin: EdgeInsets.only(left: 16, right: 16),
@ -125,8 +286,7 @@ class _MineShopRecharge extends State<MineShopRecharge> {
bottom: 24.h,
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
@ -148,13 +308,10 @@ class _MineShopRecharge extends State<MineShopRecharge> {
});
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
"assets/image/icon_we_chat.webp"),
Image.asset("assets/image/icon_we_chat.webp"),
Expanded(
flex: 1,
child: Padding(
@ -181,13 +338,10 @@ class _MineShopRecharge extends State<MineShopRecharge> {
});
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
"assets/image/icon_alipay.webp"),
Image.asset("assets/image/icon_alipay.webp"),
Expanded(
flex: 1,
child: Padding(
@ -208,10 +362,14 @@ class _MineShopRecharge extends State<MineShopRecharge> {
],
),
),
if (memberRechargeList != null &&
(memberRechargeList?.length ?? 0) > 0)
Align(
alignment: Alignment.bottomCenter,
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
shopRecharge();
},
child: Container(
height: 56.h,
@ -236,7 +394,7 @@ class _MineShopRecharge extends State<MineShopRecharge> {
)
],
),
);
));
}
///
@ -257,14 +415,14 @@ class _MineShopRecharge extends State<MineShopRecharge> {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed(
'/router/mine_shop_details',
Navigator.of(context).pushNamed('/router/mine_shop_details',
arguments: {"id": widget.arguments["id"]});
},
child: Container(
width: double.infinity,
// 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(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
@ -357,7 +515,8 @@ class _MineShopRecharge extends State<MineShopRecharge> {
fontFamily: 'JDZhengHT',
fontWeight: MyFontWeight.medium,
),
),),
),
),
Text(
"适用门店",
style: TextStyle(
@ -366,7 +525,9 @@ class _MineShopRecharge extends State<MineShopRecharge> {
fontWeight: MyFontWeight.regular,
),
),
SizedBox(width: 2,),
SizedBox(
width: 2,
),
Image.asset(
"assets/image/icon_right_z.webp",
width: 16,
@ -385,7 +546,7 @@ class _MineShopRecharge extends State<MineShopRecharge> {
}
///item
Widget rechargeItem(index) {
Widget rechargeItem(MemberRechargeList memberRechargeList, index) {
return Container(
width: double.infinity,
height: 69.h,
@ -396,8 +557,7 @@ class _MineShopRecharge extends State<MineShopRecharge> {
selectIndex == index ? Color(0xFF32A060) : Color(0xFFFAFAFA),
width: selectIndex == index ? 1 : 0,
),
color:
selectIndex == index ? Color(0XFFF0FAF4) : Colors.white),
color: selectIndex == index ? Color(0XFFF0FAF4) : Colors.white),
margin: EdgeInsets.only(bottom: 14.h, left: 14.w, right: 14.w),
padding: EdgeInsets.only(left: 16),
child: Flex(
@ -419,7 +579,7 @@ class _MineShopRecharge extends State<MineShopRecharge> {
),
TextSpan(
text:
"555",
"${AppUtils.calculateDouble(double.tryParse(memberRechargeList.rechargeMoney) ?? 0)}",
style: TextStyle(
fontSize: 18.sp,
fontFamily: 'JDZhengHT',
@ -457,7 +617,7 @@ class _MineShopRecharge extends State<MineShopRecharge> {
),
TextSpan(
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(
fontSize: 18.sp,
fontFamily: 'JDZhengHT',
@ -474,7 +634,8 @@ class _MineShopRecharge extends State<MineShopRecharge> {
GestureDetector(
onTap: () {
setState(() {
if (selectIndex == index) showRecharge(index);
if (selectIndex == index)
showRecharge(memberRechargeList, index);
});
},
child: Row(
@ -521,12 +682,93 @@ class _MineShopRecharge extends State<MineShopRecharge> {
}
///
showRecharge(index) {
showRecharge(MemberRechargeList memberRechargeList, index) {
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
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,),
if(isShowMore)
// if(isShowMore)
Row(
children: [
///
@ -314,9 +314,9 @@ class _MineItem extends State<MineItem> {
// ),),
],
),
if(isShowMore)
// if(isShowMore)
SizedBox(height: 12.h,),
if(isShowMore)
// if(isShowMore)
Row(
children: [
////
@ -345,38 +345,39 @@ class _MineItem extends State<MineItem> {
Expanded(child:Container(),),
],
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
isShowMore = !isShowMore;
});
},
child: Container(
margin: EdgeInsets.symmetric(vertical: 10),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
children: [
Text(
(isShowMore != null && !isShowMore)?S.of(context).zhankai: S.of(context).shouqi,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF32A060),
),
),
Icon(
(isShowMore != null && !isShowMore)
? Icons.keyboard_arrow_down
: Icons.keyboard_arrow_up,
color: Color(0xFF32A060),
size: 18,
),
],
),),
)
///
// GestureDetector(
// behavior: HitTestBehavior.opaque,
// onTap: () {
// setState(() {
// isShowMore = !isShowMore;
// });
// },
// child: Container(
// margin: EdgeInsets.symmetric(vertical: 10),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// crossAxisAlignment: CrossAxisAlignment.center,
// mainAxisSize: MainAxisSize.max,
// children: [
// Text(
// (isShowMore != null && !isShowMore)?S.of(context).zhankai: S.of(context).shouqi,
// style: TextStyle(
// fontSize: 12.sp,
// fontWeight: MyFontWeight.regular,
// color: Color(0xFF32A060),
// ),
// ),
// Icon(
// (isShowMore != null && !isShowMore)
// ? Icons.keyboard_arrow_down
// : Icons.keyboard_arrow_up,
// color: Color(0xFF32A060),
// size: 18,
// ),
// ],
// ),),
// )
],
),
);

32
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:shared_preferences/shared_preferences.dart';
import '../../view_widget/no_data_view.dart';
class MineAttainmentPage extends StatefulWidget {
final Map<String, dynamic> arguments;
@ -41,7 +43,6 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
SocialInfo infoNumber;
final RefreshController refreshController = RefreshController();
@override
void dispose() {
super.dispose();
@ -165,8 +166,7 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
},
physics: BouncingScrollPhysics(),
child: Container(
child:
SingleChildScrollView(
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Column(
children: [
@ -191,8 +191,8 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
),
SizedBox(height: 28),
Container(
margin:
EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8),
margin: EdgeInsets.only(
left: 16, right: 16, top: 26, bottom: 8),
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Colors.white,
@ -228,7 +228,9 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
color: Color(0xFF353535)),
),
Text(
infoNumber != null ? infoNumber.achievementNumber.toString() :"0",
infoNumber != null
? infoNumber.achievementNumber.toString()
: "0",
style: TextStyle(
fontWeight: MyFontWeight.medium,
fontSize: 14,
@ -252,13 +254,15 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
),
),
),
),),
),
),
);
}
///
Widget attainmentBadge() {
return GridView.builder(
return (vipBadgesList != null && (vipBadgesList?.length ?? 0) > 0)
? GridView.builder(
itemCount: vipBadgesList == null ? 0 : vipBadgesList.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
@ -284,7 +288,15 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
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) {
@ -396,7 +408,9 @@ class _MineAttainmentPage extends State<MineAttainmentPage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:
achievementDetail[checkPosition].rewardList != null
? achievementDetail[checkPosition].rewardList.map((e) {
? achievementDetail[checkPosition]
.rewardList
.map((e) {
return Text(
rewardStr(e),
style: TextStyle(

156
lib/mine/recharge_page.dart

@ -19,9 +19,14 @@ import 'package:huixiang/utils/min.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/recharge_details_dialog.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tobias/tobias.dart' as tobias;
import '../view_widget/classic_header.dart';
import '../view_widget/my_footer.dart';
import '../view_widget/no_data_view.dart';
class RechargePage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
@ -43,19 +48,13 @@ class _RechargePage extends State<RechargePage> {
RechargeActLists rechargeActLists;
int selectStoreIndex = 0;
String recommendName;
final RefreshController refreshController = RefreshController();
int _loadCount = 0;
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) {
apiService = ApiService(Dio(),
context: context, token: value.getString("token"), pay: true);
queryBenefitList();
queryRuleDetails();
queryRechargeActList();
queryUserBalance();
});
_onRefresh();
payListen = weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
if (event.errCode == 0) {
@ -77,10 +76,10 @@ class _RechargePage extends State<RechargePage> {
///
queryBenefitList() async {
try {
BaseData<List<VipBenefitList>> baseData =
await apiService.benefitList().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
vipBenefitList.clear();
vipBenefitList.addAll(baseData.data);
vipBenefitList.forEach((element) {
@ -90,51 +89,77 @@ class _RechargePage extends State<RechargePage> {
discount = double.parse(element.config);
}
});
});
}
EasyLoading.dismiss();
} finally {
addLoadCount();
}
}
queryUserBalance() async {
try {
BaseData<UserInfo> baseData =
await apiService.queryInfo().catchError((onError) {});
await apiService.queryInfo().catchError((onError) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
alignment: Alignment.center);
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (baseData != null && baseData.isSuccess) {
userInfo = baseData.data;
mBalance = userInfo?.money ?? "0";
if (mounted) setState(() {});
}
} finally {
addLoadCount();
}
}
//////
queryRuleDetails() async {
try {
BaseData<VipRuleDetails> baseData =
await apiService.vipBenefit().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
vipRuleDetails = baseData.data;
});
}
EasyLoading.dismiss();
} finally {
addLoadCount();
}
}
///
queryRechargeActList() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
try {
BaseData<RechargeActLists> baseData =
await apiService.rechargeActList().catchError((onError) {});
await apiService.rechargeActList("admin").catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
rechargeActLists = baseData.data;
});
}
} finally {
addLoadCount();
}
}
_onRefresh() async {
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
SharedPreferences value = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(Dio(),
context: context, token: value.getString("token"), pay: true);
queryBenefitList();
queryRuleDetails();
queryRechargeActList();
queryUserBalance();
}
addLoadCount() {
_loadCount += 1;
if (_loadCount == 4) {
_loadCount = 0;
EasyLoading.dismiss();
if (refreshController.isRefresh) refreshController.refreshCompleted();
if (mounted) setState(() {});
}
}
@override
@ -149,6 +174,18 @@ class _RechargePage extends State<RechargePage> {
),
body: Container(
color: Color(0xFFFFFFFF),
child: SmartRefresher(
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
controller: refreshController,
onRefresh: _onRefresh,
physics: BouncingScrollPhysics(),
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
@ -202,8 +239,7 @@ class _RechargePage extends State<RechargePage> {
fontSize: 15.sp,
color: Color(0xFF181818),
fontFamily: 'JDZhengHT',
fontWeight:
MyFontWeight.semi_bold),
fontWeight: MyFontWeight.semi_bold),
)),
Text.rich(
TextSpan(children: [
@ -213,16 +249,14 @@ class _RechargePage extends State<RechargePage> {
fontSize: 26.sp,
fontFamily: 'JDZhengHT',
color: Color(0xFF181818),
fontWeight:
MyFontWeight.semi_bold),
fontWeight: MyFontWeight.semi_bold),
),
TextSpan(
text: "",
style: TextStyle(
fontSize: 15.sp,
color: Color(0xFF181818),
fontWeight:
MyFontWeight.semi_bold),
fontWeight: MyFontWeight.semi_bold),
),
]),
),
@ -255,6 +289,8 @@ class _RechargePage extends State<RechargePage> {
// ),
],
)),
if (rechargeActLists != null &&
(rechargeActLists?.preferentialList?.length ?? 0) > 0)
Container(
width: double.infinity,
margin: EdgeInsets.only(left: 16, right: 16),
@ -267,8 +303,7 @@ class _RechargePage extends State<RechargePage> {
// borderRadius: BorderRadius.circular(4),
// ),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceAround,
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
@ -290,13 +325,10 @@ class _RechargePage extends State<RechargePage> {
});
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
"assets/image/icon_we_chat.webp"),
Image.asset("assets/image/icon_we_chat.webp"),
Expanded(
flex: 1,
child: Padding(
@ -323,13 +355,10 @@ class _RechargePage extends State<RechargePage> {
});
},
child: Row(
mainAxisAlignment:
MainAxisAlignment.start,
crossAxisAlignment:
CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset(
"assets/image/icon_alipay.webp"),
Image.asset("assets/image/icon_alipay.webp"),
Expanded(
flex: 1,
child: Padding(
@ -382,7 +411,9 @@ class _RechargePage extends State<RechargePage> {
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: (recommendName != null) ?Color(0xFF32A060):Color(0xFF868686),
color: (recommendName != null)
? Color(0xFF32A060)
: Color(0xFF868686),
),
)),
Icon(
@ -392,6 +423,8 @@ class _RechargePage extends State<RechargePage> {
],
)),
),
if (rechargeActLists != null &&
(rechargeActLists?.preferentialList?.length ?? 0) > 0)
Align(
alignment: Alignment.bottomCenter,
child: GestureDetector(
@ -418,7 +451,6 @@ class _RechargePage extends State<RechargePage> {
),
),
),
// Container(
// height: 56.h,
// color: Colors.white,
@ -522,16 +554,21 @@ class _RechargePage extends State<RechargePage> {
),
),
),
),
)),
);
}
var checkIndex = 2;
Widget rechargeList() {
return ListView.builder(
return (rechargeActLists != null &&
(rechargeActLists?.preferentialList?.length ?? 0) > 0)
? ListView.builder(
padding: EdgeInsets.zero,
itemCount: (rechargeActLists != null && (rechargeActLists?.preferentialList?.length ?? 0) > 0) ? rechargeActLists.preferentialList.length : 0,
itemCount: (rechargeActLists != null &&
(rechargeActLists?.preferentialList?.length ?? 0) > 0)
? rechargeActLists.preferentialList.length
: 0,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
@ -542,8 +579,16 @@ class _RechargePage extends State<RechargePage> {
selectIndex = position;
});
},
child: rechargeItem(rechargeActLists.preferentialList[position], position));
child: rechargeItem(
rechargeActLists.preferentialList[position], position));
},
)
: NoDataView(
src: "assets/image/xiao_fei.webp",
isShowBtn: false,
text: "暂无充值套餐~",
fontSize: 16.sp,
margin: EdgeInsets.only(top: 90.h, left: 60.w, right: 60.w),
);
}
@ -797,7 +842,8 @@ class _RechargePage extends State<RechargePage> {
),
);
});
},);
},
);
}
Widget recommendStoreItem(index) {

348
lib/order/order_history_page.dart

@ -1,5 +1,6 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.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/order/order_utils.dart';
@ -133,57 +134,29 @@ class OrderHistoryList extends StatefulWidget {
class _OrderHistoryList extends State<OrderHistoryList>
with AutomaticKeepAliveClientMixin {
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;
ApiService apiService;
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() {
current = 1;
queryOrder();
}
List<OrderInfo> orderInfos = [];
queryOrder() async {
BaseData<PageInfo<OrderInfo>> baseData = await apiService.orderList({
"current": current,
@ -214,24 +187,173 @@ class _OrderHistoryList extends State<OrderHistoryList>
}
setState(() {});
} else {
SmartDialog.showToast(baseData?.msg ?? "",alignment: Alignment.center);
if((baseData?.msg ?? "") != "")
SmartDialog.showToast(baseData.msg,alignment: Alignment.center);
refreshController.refreshFailed();
refreshController.loadFailed();
}
}
@override
void initState() {
super.initState();
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,
));
}
});
}
SharedPreferences.getInstance().then((value) => {
queryDetails(id) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(Dio(),
showLoading: true,
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,
token: value.getString("token")),
queryOrder(),
queryUserBalance(),
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) {
@ -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) {
if (orderInfo == null) return "";
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/home_recommend_list.dart';
import 'data/launch_join_act.dart';
import 'data/member_recharge_list.dart';
import 'data/miNiDetail.dart';
import 'data/settleOrderInfo.dart';
import 'data/shoppingCart.dart';
@ -243,4 +244,13 @@ abstract class MinApiService {
@POST("promotion/useMemberCoupon")
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;
}
@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/material.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/retrofit/data/activity.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/coupon.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/view_widget/login_tips_dialog.dart';
import 'package:retrofit/retrofit.dart';
import '../utils/flutter_utils.dart';
import 'data/achievement_detail_list.dart';
import 'data/activity_pos.dart';
import 'data/address.dart';
@ -50,7 +47,6 @@ import 'data/msg_stats.dart';
import 'data/page.dart';
import 'data/rank.dart';
import 'data/rechargeActLists.dart';
import 'data/recharge_list.dart';
import 'data/second_card_list.dart';
import 'data/sign_info.dart';
import 'data/social_info.dart';
@ -89,6 +85,8 @@ abstract class ApiService {
if (pay) {
headers["Environment"] = "app";
}
if (kReleaseMode)
baseUrl = serviceBaseUrl;
if (isIp) baseUrl = ipBaseUrl;
dio.options = BaseOptions(
connectTimeout: 60000,
@ -150,10 +148,6 @@ abstract class ApiService {
debugPrint("\n");
}),
);
if (kReleaseMode) {
baseUrl = serviceBaseUrl;
}
return _ApiService(dio, baseUrl: baseUrl);
}
@ -230,8 +224,8 @@ abstract class ApiService {
Future<BaseData<dynamic>> recharge(@Body() Map<String, dynamic> param);
///
@GET("/wallet/rechargeActList")
Future<BaseData<RechargeActLists>> rechargeActList();
@GET("/wallet/rechargeActList?tenantCode={tenantCode}")
Future<BaseData<RechargeActLists>> rechargeActList(@Path("tenantCode") String tenantCode);
///
@GET("/coupon/receive?couponId={couponId}")

4
lib/retrofit/retrofit_api.g.dart

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

10
lib/store/store_view/shop_goods.dart

@ -497,6 +497,7 @@ class _ShopGoods extends State<ShopGoods> {
SizedBox(
height: 4.h,
),
///VIP价格
// if (widget.productListBean.vipPrice != null)
// 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
Uri uri = Uri.parse(result);
String tableId = uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"];
String tenantCode = uri.queryParameters["tenantCode"] ?? uri.queryParameters["tenant_code"];
String shopId = uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"];
String tableId =
uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"];
String tenantCode = uri.queryParameters["tenantCode"] ??
uri.queryParameters["tenant_code"];
String shopId =
uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"];
if (tableId != null &&
tableId != "" &&
tenantCode != null &&

17
lib/union/union_list.dart

@ -75,11 +75,14 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
_refreshController.refreshFailed();
});
if (baseData != null && baseData.isSuccess) {
storeList = baseData.data;
}
_refreshController.refreshCompleted();
} else {
_refreshController.refreshFailed();
}
EasyLoading.dismiss();
setState(() {});
}
@ -305,7 +308,10 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
height: 100.h,
child: ListView.builder(
padding: EdgeInsets.zero,
itemCount: (storeList[position].productShow?.length ??0) > 3 ?3:storeList[position].productShow?.length ?? 0,
itemCount:
(storeList[position].productShow?.length ?? 0) > 3
? 3
: storeList[position].productShow?.length ?? 0,
scrollDirection: Axis.horizontal,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
@ -352,7 +358,6 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
.toList();
}
///
Widget unionGoodsItem(ProductShow productShow) {
return Container(
width: 74.w,
@ -369,7 +374,8 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
Padding(padding:EdgeInsets.only(top: 8.h),
Padding(
padding: EdgeInsets.only(top: 8.h),
child: Text(
productShow?.productName ?? "",
overflow: TextOverflow.ellipsis,
@ -378,7 +384,8 @@ class _UnionList extends State<UnionList> with AutomaticKeepAliveClientMixin {
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(
alignment: Alignment.centerRight,
margin: EdgeInsets.only(left: 12,),
padding: EdgeInsets.all(6),
padding: EdgeInsets.only(top: 6.h,bottom: 6.h,left:20.w,right:6.w),
child: Icon(
Icons.arrow_back_ios,
color: leadingColor,

8
lib/view_widget/recharge_details_dialog.dart

@ -1,15 +1,7 @@
import 'package:flutter/material.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:huixiang/store/scan.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';

Loading…
Cancel
Save