Browse Source

新版更改

zyh
w-R 3 years ago
parent
commit
d98dab82d0
  1. BIN
      assets/image/2x/calendar.webp
  2. BIN
      assets/image/2x/icon_mine_online_service.webp
  3. BIN
      assets/image/2x/vip_logo.webp
  4. BIN
      assets/image/3x/calendar.webp
  5. BIN
      assets/image/3x/icon_mine_online_service.webp
  6. BIN
      assets/image/3x/vip_logo.webp
  7. BIN
      assets/image/calendar.webp
  8. BIN
      assets/image/icon_mine_online_service.webp
  9. BIN
      assets/image/vip_logo.webp
  10. 9
      lib/home/welfare_page.dart
  11. 1
      lib/main.dart
  12. 4
      lib/mine/mine_greenery.dart
  13. 136
      lib/mine/mine_page.dart
  14. 88
      lib/mine/mine_view/calendar_page.dart
  15. 81
      lib/mine/mine_view/mine_calendar.dart
  16. 13
      lib/mine/mine_view/mine_item.dart
  17. 2
      lib/mine/mine_view/mine_order.dart
  18. 31
      lib/mine/mine_view/mine_view.dart
  19. 674
      lib/store/shop__details_page.dart
  20. 10
      lib/store/store_order.dart
  21. 17
      lib/store/store_view/store_order_list.dart
  22. 4
      lib/union/union_page.dart
  23. 193
      lib/view_widget/mine_vip_entry.dart
  24. 14
      pubspec.lock
  25. 2
      pubspec.yaml

BIN
assets/image/2x/calendar.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

BIN
assets/image/2x/icon_mine_online_service.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
assets/image/2x/vip_logo.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
assets/image/3x/calendar.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

BIN
assets/image/3x/icon_mine_online_service.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
assets/image/3x/vip_logo.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

BIN
assets/image/calendar.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
assets/image/icon_mine_online_service.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 926 B

BIN
assets/image/vip_logo.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 848 B

9
lib/home/welfare_page.dart

@ -324,7 +324,7 @@ class _WelfarePage extends State<WelfarePage> {
} }
Widget weekList(List<Coupon> cops){ Widget weekList(List<Coupon> cops){
return Expanded(child: ListView.builder( return Expanded(child:(cops != null && cops.length > 0)?ListView.builder(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
itemCount: cops.length, itemCount: cops.length,
scrollDirection: Axis.vertical, scrollDirection: Axis.vertical,
@ -337,7 +337,12 @@ class _WelfarePage extends State<WelfarePage> {
child: weekCoupon(cops[position]), child: weekCoupon(cops[position]),
); );
}, },
)); ):NoDataView(
src: "assets/image/ka.webp",
isShowBtn: false,
text: S.of(context).haimeiyouyouhuiquankeyilingqu,
fontSize: 16.sp,
),);
} }
Widget weekCoupon(Coupon cop) { Widget weekCoupon(Coupon cop) {

1
lib/main.dart

@ -106,6 +106,7 @@ import 'mine/manage_address_page.dart';
import 'mine/mine_greenery.dart'; import 'mine/mine_greenery.dart';
import 'mine/mine_shop_details.dart'; import 'mine/mine_shop_details.dart';
import 'mine/mine_shop_page.dart'; import 'mine/mine_shop_page.dart';
import 'mine/mine_view/calendar_page.dart';
import 'mine/mine_view/community_follow.dart'; import 'mine/mine_view/community_follow.dart';
import 'mine/mine_vip/binding_assistant_card.dart'; import 'mine/mine_vip/binding_assistant_card.dart';
import 'mine/mine_vip/legal_right_details.dart'; import 'mine/mine_vip/legal_right_details.dart';

4
lib/mine/mine_greenery.dart

@ -437,9 +437,9 @@ class _MineGreenery extends State<MineGreenery> {
}, },
child:ClipRRect( child:ClipRRect(
child:Image.asset( child:Image.asset(
"assets/image/icon_story_td.webp", "assets/image/welfare_spread.webp",
width:double.infinity, width:double.infinity,
fit: BoxFit.cover, fit: BoxFit.fill,
height:80.h, height:80.h,
), ),
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),

136
lib/mine/mine_page.dart

@ -17,6 +17,7 @@ import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:huixiang/view_widget/mine_vip_entry.dart';
import 'package:huixiang/view_widget/mine_vip_view.dart'; import 'package:huixiang/view_widget/mine_vip_view.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';
@ -193,88 +194,87 @@ class MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin {
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
child: Stack( child: Stack(
alignment: Alignment.centerRight, // alignment: Alignment.centerRight,
children: [ children: [
Container(
height: 317,
decoration: BoxDecoration(
color: Color(0xFF32A060)
),
),
FutureBuilder( FutureBuilder(
future: queryUserInfo(), future: queryUserInfo(),
builder: (context, snapshot) { builder: (context, snapshot) {
return Column( return Column(
children: [ children: [
Container( Stack(
// decoration: BoxDecoration( children: [
// gradient: LinearGradient( Container(
// begin: Alignment.bottomLeft, child: Column(
// end: Alignment.topRight, children: [
// colors: [ ///
// Color(0xFFE5F7FF), MineView(
// Color(0xFFE8F5E9), userInfo,
// ], () {
// stops: [0.1, 0.8], _toUserInfo();
// ), },
// ), () {
decoration: BoxDecoration( toIntegralPage();
image: DecorationImage( },
fit: BoxFit.fill, (){
image: AssetImage("assets/image/mine_bg.webp"), setState(() {
), totalMsg =0;
), });
height: 375, },
child: Column( totalMsg,
children: [ infoNumber
/// ),
MineView(
userInfo, /// VIP等级信息
() { MineVipEntry(
_toUserInfo(); tag: "vip",
}, ranks: ranks,
() { userInfo: userInfo,
toIntegralPage(); rank: double.tryParse(
},
(){
setState(() {
totalMsg =0;
});
},
totalMsg
),
/// VIP等级信息
MineVipView(
tag: "vip",
ranks: ranks,
userInfo: userInfo,
rank: double.tryParse(
userInfo?.expendAmount ?? "0") userInfo?.expendAmount ?? "0")
.toInt(), .toInt(),
rankMax: rankMax:
userInfo?.memberRankVo?.nextOrigin ?? 0, userInfo?.memberRankVo?.nextOrigin ?? 0,
createTime: userInfo?.createTime ?? "", createTime: userInfo?.createTime ?? "",
),
],
), ),
),
Container(
margin: EdgeInsets.only(top: 255),
child: Column(
children: [
///
MineOrderView(),
///广
spreadImage(),
], /// item
), MineItem(),
),
///
attainment(),
///绿
MineCalendar()
],
),
)
],
)
// ///// // /////
// attention(), // attention(),
// //
// /// // ///
// WalletCoupon(), // WalletCoupon(),
///
MineOrderView(),
///广
spreadImage(),
/// item
MineItem(),
///
attainment(),
///绿
MineCalendar()
], ],
); );
}, },
@ -404,9 +404,9 @@ class MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin {
}, },
child:ClipRRect( child:ClipRRect(
child:Image.asset( child:Image.asset(
"assets/image/icon_story_td.webp", "assets/image/welfare_spread.webp",
width:double.infinity, width:double.infinity,
fit: BoxFit.cover, fit: BoxFit.fill,
height:80.h, height:80.h,
), ),
borderRadius: BorderRadius.circular(6.w), borderRadius: BorderRadius.circular(6.w),

88
lib/mine/mine_view/calendar_page.dart

@ -0,0 +1,88 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:table_calendar/table_calendar.dart';
class CalendarPage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _CalendarPage();
}
}
class _CalendarPage extends State<CalendarPage> with TickerProviderStateMixin {
AnimationController _animationController;
CalendarController _calendarController;
@override
void initState() {
super.initState();
_calendarController = CalendarController();
_animationController = AnimationController(
vsync: this,
duration: const Duration(milliseconds: 400),
);
_animationController.forward();
}
@override
void dispose() {
_animationController.dispose();
_calendarController.dispose();
super.dispose();
}
void _onDaySelected(DateTime day, List events, List holidays) {
print('CALLBACK: _onDaySelected');
}
void _onVisibleDaysChanged(DateTime first, DateTime last, CalendarFormat format) {
print('CALLBACK: _onVisibleDaysChanged');
}
void _onCalendarCreated(DateTime first, DateTime last, CalendarFormat format) {
print('CALLBACK: _onCalendarCreated');
}
@override
Widget build(BuildContext context) {
return Container(
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
_buildTableCalendar(),
],
),
);
}
Widget _buildTableCalendar() {
return TableCalendar(
calendarController: _calendarController,
startingDayOfWeek: StartingDayOfWeek.monday,
availableGestures: AvailableGestures.none,
headerStyle: HeaderStyle(
centerHeaderTitle: false,
leftChevronVisible: false,
rightChevronVisible: false,
formatButtonVisible: false,
),
calendarStyle: CalendarStyle(
outsideDaysVisible: false,
selectedColor: Color(0xFF32A060),
weekendStyle: TextStyle().copyWith(color: Color(0xFF333333)),
todayColor: Color(0xFFD5EBDE),
),
daysOfWeekStyle: DaysOfWeekStyle(
weekendStyle: TextStyle().copyWith(color: Color(0xFF4D4D4D)),
),
onDaySelected: _onDaySelected,
onVisibleDaysChanged: _onVisibleDaysChanged,
onCalendarCreated: _onCalendarCreated,
);
}
}

81
lib/mine/mine_view/mine_calendar.dart

@ -1,11 +1,8 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:url_launcher/url_launcher.dart'; import 'calendar_page.dart';
class MineCalendar extends StatefulWidget { class MineCalendar extends StatefulWidget {
@override @override
@ -18,10 +15,14 @@ class _MineCalendar extends State<MineCalendar> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: EdgeInsets.fromLTRB(16.w, 10.h, 16.w, 28.h), margin: EdgeInsets.fromLTRB(14.w, 20.h, 14.w, 30.h),
padding: EdgeInsets.only(top: 12.h,left: 12,right: 12), padding: EdgeInsets.only(top: 12.h,left: 12,),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, // color: Colors.white,
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage("assets/image/s_bg.webp"),
),
borderRadius: BorderRadius.circular(8), borderRadius: BorderRadius.circular(8),
boxShadow: [ boxShadow: [
BoxShadow( BoxShadow(
@ -32,37 +33,55 @@ class _MineCalendar extends State<MineCalendar> {
) )
], ],
), ),
child: Column( child: Stack(
crossAxisAlignment: CrossAxisAlignment.start, alignment: Alignment.bottomRight,
children: [ children: [
Row( Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Expanded(child: Text( GestureDetector(
"我的3月足迹日历", onTap: (){
style: TextStyle( Navigator.of(context).pushNamed('/router/mine_greenery');
color: Color(0xFF0D0D0D), },
fontWeight: MyFontWeight.semi_bold, child: Row(
fontSize: 15.sp, children: [
Expanded(child: Text(
"我的5月足迹日历",
style: TextStyle(
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.semi_bold,
fontSize: 15.sp,
),
),),
Text(
"查看绿叶",
style: TextStyle(
color: Color(0xFF000000),
fontWeight: MyFontWeight.regular,
fontSize: 15.sp,
),
),
Icon(
Icons.navigate_next,
size: 24,
color: Colors.black,
),
SizedBox(width:12,),
],
), ),
),),
Text(
"查看绿叶",
style: TextStyle(
color: Color(0xFF000000),
fontWeight: MyFontWeight.regular,
fontSize: 15.sp,
),
),
Icon(
Icons.navigate_next,
size: 24,
color: Colors.black,
), ),
SizedBox(height: 12,),
CalendarPage(),
], ],
), ),
SizedBox(height: 12,) Image.asset(
"assets/image/calendar.webp",
width:25,
height: 50,
fit: BoxFit.fill,
),
], ],
), )
); );
} }
} }

13
lib/mine/mine_view/mine_item.dart

@ -18,7 +18,7 @@ class _MineItem extends State<MineItem> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: EdgeInsets.fromLTRB(16.w, 10.h, 16.w, 27.h), margin: EdgeInsets.fromLTRB(16.w, 20.h, 16.w, 30.h),
// padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h), // padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,
@ -284,7 +284,16 @@ class _MineItem extends State<MineItem> {
"assets/image/fan_kui.webp", "assets/image/fan_kui.webp",
), ),
),), ),),
Expanded(child:Container(),), ///
Expanded(child: InkWell(
onTap: () {
showCallMobile();
},
child: mineItem(
"联系客服",
"assets/image/icon_mine_online_service.webp",
),
),),
Expanded(child:Container(),), Expanded(child:Container(),),
Expanded(child:Container(),), Expanded(child:Container(),),
], ],

2
lib/mine/mine_view/mine_order.dart

@ -16,7 +16,7 @@ class _MineOrderView extends State<MineOrderView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
margin: EdgeInsets.only(left:16.w, bottom:20.h, right:16.w,), margin: EdgeInsets.only(left:14, bottom:30, right:14),
padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h), padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Colors.white, color: Colors.white,

31
lib/mine/mine_view/mine_view.dart

@ -9,6 +9,7 @@ import 'package:flutter_svg/svg.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/msg_stats.dart'; import 'package:huixiang/retrofit/data/msg_stats.dart';
import 'package:huixiang/retrofit/data/social_info.dart';
import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
@ -28,8 +29,9 @@ class MineView extends StatefulWidget {
final GestureTapCallback toIntegralPage; final GestureTapCallback toIntegralPage;
final Function messageZero; final Function messageZero;
final int totalMsg; final int totalMsg;
final SocialInfo infoNumber;
MineView(this.userInfo, this.toUserInfo, this.toIntegralPage,this.messageZero,this.totalMsg); MineView(this.userInfo, this.toUserInfo, this.toIntegralPage,this.messageZero,this.totalMsg,this.infoNumber);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -65,7 +67,7 @@ class _MineView extends State<MineView> {
return Column( return Column(
children: [ children: [
Container( Container(
margin: EdgeInsets.only(top: 20.w), margin: EdgeInsets.only(top: 28.w),
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
@ -88,6 +90,7 @@ class _MineView extends State<MineView> {
"assets/image/icon_notices.webp", "assets/image/icon_notices.webp",
width:32.w, width:32.w,
height: 32.h, height: 32.h,
color: Colors.white,
), ),
if(widget.totalMsg != 0) if(widget.totalMsg != 0)
Container( Container(
@ -130,6 +133,7 @@ class _MineView extends State<MineView> {
"assets/image/icon_scan_qr_code.webp", "assets/image/icon_scan_qr_code.webp",
width:32.w, width:32.w,
height: 32.h, height: 32.h,
color: Colors.white,
), ),
), ),
), ),
@ -144,6 +148,7 @@ class _MineView extends State<MineView> {
"assets/image/icon_mine_setting.webp", "assets/image/icon_mine_setting.webp",
width: 32.w, width: 32.w,
height: 32.h, height: 32.h,
color: Colors.white,
), ),
), ),
), ),
@ -229,7 +234,7 @@ class _MineView extends State<MineView> {
print("---" + widget.userInfo.toString()); print("---" + widget.userInfo.toString());
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.symmetric(horizontal: 16.w), margin: EdgeInsets.only(left: 16.w),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
@ -243,8 +248,8 @@ class _MineView extends State<MineView> {
MImage( MImage(
widget.userInfo == null ? "" : widget.userInfo.headimg, widget.userInfo == null ? "" : widget.userInfo.headimg,
isCircle: true, isCircle: true,
width: 50, width: 58,
height: 50, height: 58,
fit: BoxFit.cover, fit: BoxFit.cover,
errorSrc: "assets/image/default_user.webp", errorSrc: "assets/image/default_user.webp",
fadeSrc: "assets/image/default_user.webp", fadeSrc: "assets/image/default_user.webp",
@ -279,7 +284,7 @@ class _MineView extends State<MineView> {
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
color: Color(0xFF353535), color: Color(0xFFFFFFFF),
), ),
), ),
onTap: widget.toUserInfo, onTap: widget.toUserInfo,
@ -299,7 +304,7 @@ class _MineView extends State<MineView> {
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Color(0xFF353535), color: Color(0xFFFFFFFF),
), ),
), ),
), ),
@ -317,31 +322,31 @@ class _MineView extends State<MineView> {
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFF2F2F2F), color: Color(0xFFFFFFFF),
), ),
) )
: Row( : Row(
children: [ children: [
Text( Text(
"${S.of(context).guanzhu} 0", "${S.of(context).guanzhu} ${widget?.infoNumber?.follow.toString() ?? "0"}",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D), color: Color(0xFFFFFFFF),
), ),
), ),
Container( Container(
width: 1.w, width: 1.w,
height: 12.h, height: 12.h,
margin: EdgeInsets.symmetric(horizontal: 3.w), margin: EdgeInsets.symmetric(horizontal: 3.w),
color: Color(0xFF4D4D4D), color: Color(0xFFFFFFFF),
), ),
Text( Text(
"${S.of(context).fensi} 0", "${S.of(context).fensi} ${widget?.infoNumber?.fans.toString() ?? "0"}",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
color: Color(0xFF4D4D4D), color: Color(0xFFFFFFFF),
), ),
), ),
], ],

674
lib/store/shop__details_page.dart

@ -5,13 +5,14 @@ import 'package:flutter_html/flutter_html.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:flutter_swiper/flutter_swiper.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/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/miNiDetail.dart'; import 'package:huixiang/retrofit/data/miNiDetail.dart';
import 'package:huixiang/retrofit/data/shoppingCart.dart'; import 'package:huixiang/retrofit/data/shoppingCart.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/store_view/product_sku.dart'; import 'package:huixiang/store/store_view/people_num.dart';
import 'package:huixiang/store/store_view/shop_car.dart'; import 'package:huixiang/store/store_view/shop_car.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
@ -50,13 +51,18 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
String cName; String cName;
String cid; String cid;
List<String> selectSkus = []; List<String> selectSkus = [];
List<Activity> activitys;
int counts = 1; int counts = 1;
String selectedPrice = ""; String selectedPrice = "";
String storeId;
String parentId;
int numberOfPeople = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
id = widget.arguments["id"]; id = widget.arguments["id"];
storeId = widget.arguments["storeId"];
SharedPreferences.getInstance().then((value) { SharedPreferences.getInstance().then((value) {
String minToken = value.getString("minToken"); String minToken = value.getString("minToken");
String tenant = value.getString("tenant"); String tenant = value.getString("tenant");
@ -68,8 +74,13 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
storeId: storeId, storeId: storeId,
showLoading: true); showLoading: true);
queryMiNiDetail(id); queryMiNiDetail(id);
queryShopCar().then((value) {
this.shopCarGoods = value;
setState(() {});
});
}); });
queryStoreInfo();
buildCount();
} }
/// ///
@ -81,6 +92,9 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
miNiDetail = baseData.data; miNiDetail = baseData.data;
miNiDetail.attrList.forEach((element) {
selectSkus.add(element.attrValueList[0].attrValue);
});
}); });
refreshController.refreshCompleted(); refreshController.refreshCompleted();
} else { } else {
@ -92,6 +106,162 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
queryMiNiDetail(id); queryMiNiDetail(id);
} }
///
queryStoreInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
BaseData baseData = await apiService.queryStoreInfo(storeId).catchError((error) {
debugPrint(error);
});
if (baseData != null && baseData.isSuccess) {
storeInfo = StoreInfo.fromJson(baseData.data);
activitys = storeInfo.informationVOPageVO.list
.map((e) => Activity.fromJson(e))
.toList();
if (mounted) {
setState(() {});
}
}
EasyLoading.dismiss();
}
///
getParentInfo() async {
BaseData baseData = await minService.getParentInfo("$tableId")
.catchError((error) {debugPrint(error);});
if (baseData != null && baseData.isSuccess) {
if (baseData.data != null) {
parentId = baseData.data["id"];
parentCode = baseData.data["parentCode"];
} else {
///TODO:
queryStoreInfo1();
}
}
}
///
showPeopleNum(String tableName) async {
var people = await showDialog(
context: context,
barrierDismissible: false,
builder: (context) {
return PeopleNumView(tableName);
},
);
if (people != null && people > 0) {
setState(() {
this.numberOfPeople = people;
});
} else {
Navigator.of(context).pop();
}
}
///
queryStoreInfo1() async {
BaseData baseData = await minService.queryStoreInfo1({
"getCoupon": true,
"storeId": storeId,
"tableId": tableId,
}).catchError((error) {
debugPrint(error);
});
if (baseData != null && baseData.isSuccess) {
StoreInfo storeInfo = StoreInfo.fromJson(baseData.data);
if (storeInfo.storeTable != null) {
showPeopleNum(storeInfo.storeTable.tableName);
}
}
}
///
int count() {
if (shopCarGoods == null ||
shopCarGoods.shoppingCartSkuItemList == null ||
shopCarGoods.shoppingCartSkuItemList.length == 0) return 0;
int count = 0;
shopCarGoods.shoppingCartSkuItemList.forEach((element) {
count += element.buyNum;
});
return count;
}
///
toDownOrder() async {
int num = count();
if (parentId == null || parentId == "") {
if (num == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;
}
}
await Navigator.of(context).pushNamed(
'/router/settlement',
arguments: {
"storeInfo": storeInfo,
"tableId": tableId,
"parentCode": parentCode,
"parentId": parentId,
// "pName": pName,
"pid": pid,
// "cName": cName,
"cid": cid,
"shoppingCart": shopCarGoods,
"numberOfPeople": numberOfPeople,
},
);
if (tableId > 0) {
getParentInfo();
}
queryShopCar().then((value) {
this.shopCarGoods = value;
setState(() {});
});
}
/// key,UI
GlobalKey shopCartKey = GlobalKey();
///
showShoppingCart() {
queryShopCar().then((value) {
this.shopCarGoods = value;
dialogShowing = true;
SmartDialog.show(
widget: ShopCar(
shopCartKey,
this.shopCarGoods,
clearShopCar,
toDownOrder,
shopCartAdd,
shopCartReduce,
),
onDismiss: () {
dialogShowing = false;
},
alignmentTemp: Alignment.bottomCenter,
);
});
}
///
clearShopCar() async {
BaseData<bool> baseData = await minService.clearShoppingCart();
if (baseData.isSuccess) {
shopCarGoods = null;
setState(() {});
}
}
/// ///
_queryMiNiDetail(String id, int count) async { _queryMiNiDetail(String id, int count) async {
EasyLoading.show(status: S.current.zhengzaijiazai); EasyLoading.show(status: S.current.zhengzaijiazai);
@ -116,24 +286,9 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (miNiDetail.attrList != null && if (miNiDetail.attrList != null &&
miNiDetail.attrList.length == 1 && miNiDetail.attrList.length == 1 &&
miNiDetail.attrList[0].attrValueList.length == 1) { miNiDetail.attrList[0].attrValueList.length == 1) {
_addShopCar(miNiDetail, [], count); _addShopCar(miNiDetail, [], counts);
} else { } else {
EasyLoading.dismiss(); showSpanDialog();
dialogShowing = true;
SmartDialog.show(
widget: ProductSku(
miNiDetail,
shopCarGoods,
id,
_addShopCar,
add,
reduce,
),
onDismiss: () {
dialogShowing = false;
},
alignmentTemp: Alignment.bottomCenter,
);
} }
} }
@ -166,7 +321,9 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart({ BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart({
"storeId": storeInfo.id, "storeId": storeInfo.id,
"storeName": storeInfo.storeName ?? "", "storeName": storeInfo.storeName ?? "",
"parentId": miNiDetail.id, "numberOfPeople": numberOfPeople,
"tableId": tableId,
"parentId": parentId,
"parentCode": parentCode, "parentCode": parentCode,
"shoppingCartSkuItemList": [ "shoppingCartSkuItemList": [
{ {
@ -178,6 +335,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
"storeId": storeInfo.id, "storeId": storeInfo.id,
"skuPrice": productSku.skuPrice, "skuPrice": productSku.skuPrice,
"skuStock": productSku.skuStock, "skuStock": productSku.skuStock,
"tableId": tableId,
}, },
], ],
}); });
@ -188,91 +346,18 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
setState(() {}); setState(() {});
}); });
} }
} else {
} SmartDialog.showToast(baseDate?.msg, alignment: Alignment.center);
/// key,UI
GlobalKey shopCartKey = GlobalKey();
///
showShoppingCart() {
queryShopCar().then((value) {
this.shopCarGoods = value;
dialogShowing = true;
SmartDialog.show(
widget: ShopCar(
shopCartKey,
this.shopCarGoods,
clearShopCar,
toDownOrder,
shopCartAdd,
shopCartReduce,
),
onDismiss: () {
dialogShowing = false;
},
alignmentTemp: Alignment.bottomCenter,
);
});
}
///
int count() {
if (shopCarGoods == null ||
shopCarGoods.shoppingCartSkuItemList == null ||
shopCarGoods.shoppingCartSkuItemList.length == 0) return 0;
int count = 0;
shopCarGoods.shoppingCartSkuItemList.forEach((element) {
count += element.buyNum;
});
return count;
}
///
toDownOrder() async {
int num = count();
if (miNiDetail.id == null || miNiDetail.id == "") {
if (num == 0) {
SmartDialog.showToast("请先选择您要购买的商品!~");
return;
} }
} }
await Navigator.of(context).pushNamed(
'/router/settlement',
arguments: {
"storeInfo": storeInfo,
"parentCode": parentCode,
"parentId": miNiDetail.id,
// "pName": pName,
// "pid": pid,
// "cName": cName,
// "cid": cid,
"shoppingCart": shopCarGoods,
},
);
queryShopCar().then((value) {
this.shopCarGoods = value;
setState(() {});
});
}
///
clearShopCar() async {
BaseData<bool> baseData = await minService.clearShoppingCart();
if (baseData.isSuccess) {
shopCarGoods = null;
setState(() {});
}
} }
/// ///
Future<ShoppingCart> queryShopCar() async { Future<ShoppingCart> queryShopCar() async {
// pName = ""; // pName = ""; //
// pid = ""; // pid = ""; //
// cName = ""; // cName = ""; //
// cid = ""; // cid = ""; //
BaseData<List<ShoppingCart>> baseDate = BaseData<List<ShoppingCart>> baseDate =
await minService.getShoppingCart(tableId); await minService.getShoppingCart(tableId);
if (baseDate != null && if (baseDate != null &&
@ -282,14 +367,14 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (baseDate.data[0].selectDiscount == 1) { if (baseDate.data[0].selectDiscount == 1) {
baseDate.data[0].couponList.forEach((element) { baseDate.data[0].couponList.forEach((element) {
if (element.isMaxCoupon) { if (element.isMaxCoupon) {
cName = element.promotionName; // cName = element.promotionName;
cid = element.id; cid = element.id;
} }
}); });
} else if (baseDate.data[0].selectDiscount == 2) { } else if (baseDate.data[0].selectDiscount == 2) {
baseDate.data[0].promotionInfoList.forEach((element) { baseDate.data[0].promotionInfoList.forEach((element) {
if (element.isMaxPromotion) { if (element.isMaxPromotion) {
pName = element.name; // pName = element.name;
pid = element.id; pid = element.id;
} }
}); });
@ -528,12 +613,8 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
), ),
flex: 1, flex: 1,
), ),
// if(count() != 0) if(count() != 0)
Positioned( Stack(
bottom: 0,
left: 0,
right: 0,
child: Stack(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
children: [ children: [
Container( Container(
@ -621,7 +702,6 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
), ),
], ],
), ),
),
], ],
), ),
), ),
@ -680,7 +760,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
)), )),
GestureDetector( GestureDetector(
onTap: () { onTap: () {
showDeleteDialog(); _queryMiNiDetail(id,counts);
}, },
child: Container( child: Container(
width: 92.w, width: 92.w,
@ -750,7 +830,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
Widget swiper() { Widget swiper() {
return Container( return Container(
child: AspectRatio( child: AspectRatio(
aspectRatio: 1.3698, aspectRatio: 375/375,
child: Stack( child: Stack(
children: [ children: [
Swiper( Swiper(
@ -767,7 +847,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
itemBuilder: (context, position) { itemBuilder: (context, position) {
return MImage( return MImage(
miNiDetail?.imgs != null ? miNiDetail.imgs[position]:"", miNiDetail?.imgs != null ? miNiDetail.imgs[position]:"",
fit: BoxFit.cover, fit: BoxFit.fill,
radius: BorderRadius.zero, radius: BorderRadius.zero,
errorSrc: "assets/image/default_2_1.webp", errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp", fadeSrc: "assets/image/default_2_1.webp",
@ -796,196 +876,218 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
} }
/// ///
showDeleteDialog() { showSpanDialog() {
showDialog( showDialog(
context: context, context: context,
builder: (context) { builder: (context) {
return AlertDialog( return StatefulBuilder(builder: (
content: Container( context,
width: MediaQuery.of(context).size.width - 84, state,
height: 500.h, )
child: Column( {
mainAxisAlignment: MainAxisAlignment.start, return AlertDialog(
crossAxisAlignment: CrossAxisAlignment.start, content: Container(
children: [ width: MediaQuery
Row( .of(context)
mainAxisAlignment: MainAxisAlignment.start, .size
crossAxisAlignment: CrossAxisAlignment.start, .width - 84,
children: [ height: 500.h,
ClipRRect( child: Column(
child: MImage( mainAxisAlignment: MainAxisAlignment.start,
miNiDetail.imgs[0], crossAxisAlignment: CrossAxisAlignment.start,
fit: BoxFit.cover, children: [
width: 70, Row(
height: 70, mainAxisAlignment: MainAxisAlignment.start,
errorSrc: "assets/image/default_2_1.webp", crossAxisAlignment: CrossAxisAlignment.start,
fadeSrc: "assets/image/default_2_1.webp", children: [
ClipRRect(
child: MImage(
miNiDetail.imgs[0],
fit: BoxFit.cover,
width: 70,
height: 70,
errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp",
),
borderRadius: BorderRadius.circular(4),
), ),
borderRadius: BorderRadius.circular(4), SizedBox(
), width: 10.w,
),
Expanded(
child: Container(
height: 70,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment
.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
miNiDetail?.productName ?? "",
style: TextStyle(
fontSize: 13.sp,
fontWeight: FontWeight.bold,
color: Color(0xFF000000),
),
),
GestureDetector(
onTap: () {
Navigator.of(context).pop();
},
child: Image.asset(
"assets/image/cancel.webp",
fit: BoxFit.cover,
height: 24,
width: 24,
),
),
],
),
Text(
"${miNiDetail?.price ?? ""}",
style: TextStyle(
fontSize: 12.sp,
fontWeight: FontWeight.bold,
color: Color(0xFFF65720),
),
),
],
),
)),
],
),
if (miNiDetail.attrList != null &&
miNiDetail.attrList.length > 0)
SizedBox( SizedBox(
width: 10.w, height: 10,
), ),
if (miNiDetail.attrList != null &&
miNiDetail.attrList.length > 0)
Expanded( Expanded(
child: Container( child: ListView.builder(
height: 70, itemCount: miNiDetail.attrList.length,
child: Column( scrollDirection: Axis.vertical,
mainAxisAlignment: MainAxisAlignment.spaceBetween, physics: BouncingScrollPhysics(),
crossAxisAlignment: CrossAxisAlignment.start, padding: EdgeInsets.zero,
itemBuilder: (context, position) {
return attrItem(
(attrValue) {
state(() {
// if(selectSkus.length > position)
selectSkus[position] = attrValue;
buildCount();
});
},
miNiDetail.attrList[position],
position,
);
},
),
),
SizedBox(
height: 24,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"数量",
style: TextStyle(
color: Color(0xFFB3B3B3),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(height: 10,),
Row(
children: [ children: [
Row( InkWell(
mainAxisAlignment: MainAxisAlignment.spaceBetween, onTap: () {
crossAxisAlignment: CrossAxisAlignment.center, state(() {
children: [ if (counts > 1)
Text( setState(() {
miNiDetail?.productName ?? "", counts -= 1;
style: TextStyle( });
fontSize: 13.sp, reduce(miNiDetail, selectSkus);
fontWeight: FontWeight.bold, });
color: Color(0xFF000000), },
), child: Icon(
), Icons.remove,
GestureDetector( color: Color(0xFF32A060),
onTap: (){ size: 24,
Navigator.of(context).pop(); )
}, // Image.asset(
child: Image.asset( // "assets/image/reduce.webp",
"assets/image/cancel.webp", // width: 22,
fit: BoxFit.cover, // height: 22,
height: 24, // ),
width: 24,
),
),
],
), ),
Text( Padding(
"${miNiDetail?.price ?? ""}", padding: EdgeInsets.only(left: 8, right: 8),
style: TextStyle( child: Text(
fontSize: 12.sp, "$counts",
fontWeight: FontWeight.bold, style: TextStyle(
color: Color(0xFFF65720), color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
), ),
), ),
InkWell(
onTap: () {
state(() {
counts += 1;
add(miNiDetail, selectSkus);
});
},
child: Icon(
Icons.add,
color: Color(0xFF32A060),
size: 24,
)
),
], ],
)
],
),
SizedBox(
height: 24,
),
GestureDetector(
onTap: () {
state(() {
_addShopCar(miNiDetail, selectSkus, counts);
Navigator.of(context).pop();
});
},
child: Container(
width: double.infinity,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Color(0xFF32A060),
), ),
)), padding: EdgeInsets.symmetric(vertical: 6),
], child: Text(
), "加入购物车",
// if (miNiDetail.attrList != null && miNiDetail.attrList.length > 0) style: TextStyle(
// SizedBox( fontSize: 15.sp,
// height:10, fontWeight: MyFontWeight.bold,
// ), color: Color(0xFFFFFFFF),
// if (miNiDetail.attrList != null && miNiDetail.attrList.length > 0)
// Expanded(
// child: ListView.builder(
// itemCount: miNiDetail.attrList.length,
// scrollDirection: Axis.vertical,
// physics: BouncingScrollPhysics(),
// padding: EdgeInsets.zero,
// itemBuilder: (context, position) {
// return attrItem(
// (attrValue) {
// setState(() {
// selectSkus[position] = attrValue;
// buildCount();
// });
// },
// miNiDetail.attrList[position],
// position,
// );
// },
// ),
// ),
SizedBox(
height: 24,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
"数量",
style: TextStyle(
color: Color(0xFFB3B3B3),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(height: 10,),
Row(
children: [
InkWell(
onTap: () {
if (counts > 1)
setState(() {
counts -= 1;
});
reduce(miNiDetail, selectSkus);
},
child: Icon(
Icons.remove,
color: Color(0xFF32A060),
size: 24,
)
// Image.asset(
// "assets/image/reduce.webp",
// width: 22,
// height: 22,
// ),
), ),
Padding( ),
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(
// "$count",
"0",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
),
InkWell(
onTap: () {
setState(() {
counts += 1;
});
add(miNiDetail, selectSkus);
},
child:Icon(
Icons.add,
color: Color(0xFF32A060),
size: 24,
)
),
],
)
],
),
SizedBox(
height: 24,
),
Container(
width: double.infinity,
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
color: Color(0xFF32A060),
),
padding: EdgeInsets.symmetric(vertical: 6),
child: Text(
"加入购物车",
style: TextStyle(
fontSize: 15.sp,
fontWeight: MyFontWeight.bold,
color: Color(0xFFFFFFFF),
), ),
), )
) ],
], ),
), ),
), );
); });
}, },
); );
} }
@ -1026,7 +1128,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
}, },
child:sweetnessItem( child:sweetnessItem(
tag.attrValue, tag.attrValue,
(tag.attrValue == selectSkus[position]) ?? false, (selectSkus.length > position && tag.attrValue == selectSkus[position]),
)); ));
}).toList()); }).toList());
} }

10
lib/store/store_order.dart

@ -340,7 +340,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
], ],
), ),
), ),
top:226.h, top:233.h,
bottom: 0, bottom: 0,
left: 0, left: 0,
right: 0, right: 0,
@ -407,6 +407,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
minToken, minToken,
tenant, tenant,
_queryMiNiDetail, _queryMiNiDetail,
(){
queryShopCar().then((value) {
this.shopCarGoods = value;
setState(() {});
});
}
), ),
///, ///,
@ -619,7 +625,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
Widget buildSwiper() { Widget buildSwiper() {
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 230.h, height: 235.h,
child: Swiper( child: Swiper(
pagination: SwiperPagination( pagination: SwiperPagination(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,

17
lib/store/store_view/store_order_list.dart

@ -22,6 +22,8 @@ class StoreOrderListPage extends StatefulWidget {
final String minToken; final String minToken;
final String tenant; final String tenant;
final Function(String id, int count) queryMiNiDetail; final Function(String id, int count) queryMiNiDetail;
final Function queryShoppingCart;
ShoppingCart shopCarGoods; ShoppingCart shopCarGoods;
@ -34,6 +36,7 @@ class StoreOrderListPage extends StatefulWidget {
this.minToken, this.minToken,
this.tenant, this.tenant,
this.queryMiNiDetail, this.queryMiNiDetail,
this.queryShoppingCart,
); );
@override @override
@ -126,11 +129,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
setState(() { goShopDetailsPage(position);
Navigator.of(context).pushNamed('/router/shop_details_page',arguments: {
"id":productListBeans[position].id,
});
});
}, },
child: goodsItem(position), child: goodsItem(position),
); );
@ -142,6 +141,14 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
); );
} }
goShopDetailsPage(position) async{
await Navigator.of(context).pushNamed('/router/shop_details_page',arguments: {
"id":productListBeans[position].id,
"storeId":productListBeans[position].storeId,
});
widget. queryShoppingCart();
}
Widget orderItem(FindMiNiGroupList findMiNiGroupList, int index) { Widget orderItem(FindMiNiGroupList findMiNiGroupList, int index) {
int count = calculateItemCount(findMiNiGroupList); int count = calculateItemCount(findMiNiGroupList);
return Container( return Container(

4
lib/union/union_page.dart

@ -9,8 +9,6 @@ import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/main.dart'; import 'package:huixiang/main.dart';
import 'package:huixiang/mine/coupons_page.dart';
import 'package:huixiang/mine/vip_card_page.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/data/store.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
@ -20,8 +18,6 @@ import 'package:huixiang/utils/location.dart';
import 'package:huixiang/view_widget/border_text.dart'; import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/classic_header.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/icon_text.dart';
import 'package:huixiang/view_widget/item_title.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/my_tab.dart'; import 'package:huixiang/view_widget/my_tab.dart';
import 'package:huixiang/view_widget/request_permission.dart'; import 'package:huixiang/view_widget/request_permission.dart';

193
lib/view_widget/mine_vip_entry.dart

@ -0,0 +1,193 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/retrofit/data/rank.dart';
import 'package:huixiang/retrofit/data/user_info.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:shared_preferences/shared_preferences.dart';
class MineVipEntry extends StatelessWidget {
int vipLevel;
int curLevel;
final int rankMax;
final int rank;
final String createTime;
final String tag;
final double padding;
final UserInfo userInfo;
final List<Rank> ranks;
MineVipEntry(
{this.vipLevel = 1,
this.ranks,
this.tag,
this.userInfo,
this.padding = 16,
this.curLevel = 1,
this.rankMax = 0,
this.rank = 0,
this.createTime = ""});
String topLeft = "";
String levelText = "普通用户";
@override
Widget build(BuildContext context) {
if (userInfo != null &&
userInfo.memberRankVo != null &&
ranks != null &&
ranks.length > 0) {
curLevel = (ranks.indexWhere((element) => element.id == userInfo.memberRankVo.id) + 1);
vipLevel = curLevel;
}
if (curLevel == vipLevel) {
topLeft = S.of(context).dangqiandengji;
} else if (vipLevel < curLevel) {
topLeft = S.of(context).shangyidengji;
} else {
topLeft = S.of(context).zanweikaitong;
}
switch (vipLevel) {
case 1:
{
levelText = "${S.of(context).yinkahuiyuan}";
break;
}
case 2:
{
levelText = "${S.of(context).jinkahuiyuan}";
break;
}
case 3:
{
levelText = "${S.of(context).gongchuanghuiyuan}";
break;
}
}
Widget widget = Container(
width: double.infinity,
padding: EdgeInsets.only(top: 12.h, bottom: 25.h, left: 12, right: 12),
// margin: EdgeInsets.symmetric(horizontal: 14),
margin: EdgeInsets.only(top: 15,left: 14,right: 14),
decoration: BoxDecoration(
color: Color(0xFF3D3D5D),
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
topRight: Radius.circular(6),
),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
)
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Image.asset(
"assets/image/vip_logo.webp",
width: 24,
height: 24,
),
SizedBox(
width: 4,
),
Expanded(
child: Text(
levelText,
style: TextStyle(
fontSize: 16,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFFFFEAD2)),
)),
Container(
padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h),
decoration: BoxDecoration(
color: Color(0xFFFFECD2),
borderRadius: BorderRadius.circular(10),
),
child: Text(
S.of(context).chakanquanyi,
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
color: Color(0xFF92755D),
),
),
)
],
),
SizedBox(
height: 14,
),
Container(
height: 8.h,
child: ClipRRect(
borderRadius: BorderRadius.circular(6.5),
child: LinearProgressIndicator(
value: rankMax > (rank ?? 0)
? ((vipLevel < curLevel)
? rankMax / rankMax
: (rank ?? 0) / rankMax)
: 0,
backgroundColor: Color(0xFF222233),
color: Color(0xFFFFECD2),
),
),
),
SizedBox(
height: 8,
),
Text(
rank > rankMax
? S.of(context).dangqiandengji
: "消费金额¥${rank.toStringAsFixed(2).toString()}${S.of(context).xiayidengji}还需¥${(rankMax - (rank ?? 0)).toStringAsFixed(2)}",
style: TextStyle(
color: Color(0xFFFFEAD2),
fontWeight: MyFontWeight.regular,
fontSize: 14.sp,
),
)
],
));
return GestureDetector(
onTap: () {
if (userInfo != null) {
SharedPreferences.getInstance().then((value) {
if (value.getString("token") == null ||
value.getString("token") == "") {
LoginTipsDialog().show(context);
return;
}
// Navigator.of(context)
// .pushNamed('/router/mine_vip_level_page', arguments: {
// "rankLevel": curLevel,
// "createTime": (userInfo != null) ? "${userInfo.createTime}" : "",
// "points": (userInfo != null) ? int.tryParse(userInfo.points) : 0,
// });
Navigator.of(context)
.pushNamed('/router/mine_vip_core', arguments: {
"rankLevel": curLevel,
"userInfo": userInfo.masterCardRankName,
"createTime": (userInfo != null) ? "${userInfo.createTime}" : "",
"expendAmount":
double.tryParse(userInfo?.expendAmount ?? "0").toInt(),
});
});
}
},
child: widget,
);
}
}

14
pubspec.lock

@ -644,6 +644,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.3.2" version: "1.3.2"
simple_gesture_detector:
dependency: transitive
description:
name: simple_gesture_detector
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.6"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -677,6 +684,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.0" version: "1.1.0"
table_calendar:
dependency: "direct main"
description:
name: table_calendar
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.3.3"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:

2
pubspec.yaml

@ -91,6 +91,8 @@ dependencies:
ai_decimal_accuracy: ^1.1.0 ai_decimal_accuracy: ^1.1.0
table_calendar: ^2.3.3

Loading…
Cancel
Save