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. 60
      lib/mine/mine_page.dart
  14. 88
      lib/mine/mine_view/calendar_page.dart
  15. 41
      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. 396
      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){
return Expanded(child: ListView.builder(
return Expanded(child:(cops != null && cops.length > 0)?ListView.builder(
padding: EdgeInsets.zero,
itemCount: cops.length,
scrollDirection: Axis.vertical,
@ -337,7 +337,12 @@ class _WelfarePage extends State<WelfarePage> {
child: weekCoupon(cops[position]),
);
},
));
):NoDataView(
src: "assets/image/ka.webp",
isShowBtn: false,
text: S.of(context).haimeiyouyouhuiquankeyilingqu,
fontSize: 16.sp,
),);
}
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_shop_details.dart';
import 'mine/mine_shop_page.dart';
import 'mine/mine_view/calendar_page.dart';
import 'mine/mine_view/community_follow.dart';
import 'mine/mine_vip/binding_assistant_card.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:Image.asset(
"assets/image/icon_story_td.webp",
"assets/image/welfare_spread.webp",
width:double.infinity,
fit: BoxFit.cover,
fit: BoxFit.fill,
height:80.h,
),
borderRadius: BorderRadius.circular(6),

60
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/view_widget/classic_header.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:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
@ -193,32 +194,22 @@ class MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin {
child: SingleChildScrollView(
child: Container(
child: Stack(
alignment: Alignment.centerRight,
// alignment: Alignment.centerRight,
children: [
Container(
height: 317,
decoration: BoxDecoration(
color: Color(0xFF32A060)
),
),
FutureBuilder(
future: queryUserInfo(),
builder: (context, snapshot) {
return Column(
children: [
Stack(
children: [
Container(
// decoration: BoxDecoration(
// gradient: LinearGradient(
// begin: Alignment.bottomLeft,
// end: Alignment.topRight,
// colors: [
// Color(0xFFE5F7FF),
// Color(0xFFE8F5E9),
// ],
// stops: [0.1, 0.8],
// ),
// ),
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
image: AssetImage("assets/image/mine_bg.webp"),
),
),
height: 375,
child: Column(
children: [
///
@ -235,11 +226,12 @@ class MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin {
totalMsg =0;
});
},
totalMsg
totalMsg,
infoNumber
),
/// VIP等级信息
MineVipView(
MineVipEntry(
tag: "vip",
ranks: ranks,
userInfo: userInfo,
@ -254,13 +246,10 @@ class MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin {
],
),
),
// /////
// attention(),
//
// ///
// WalletCoupon(),
Container(
margin: EdgeInsets.only(top: 255),
child: Column(
children: [
///
MineOrderView(),
@ -276,6 +265,17 @@ class MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin {
///绿
MineCalendar()
],
),
)
],
)
// /////
// attention(),
//
// ///
// WalletCoupon(),
],
);
},
),
@ -404,9 +404,9 @@ class MinePageState extends State<MinePage> with AutomaticKeepAliveClientMixin {
},
child:ClipRRect(
child:Image.asset(
"assets/image/icon_story_td.webp",
"assets/image/welfare_spread.webp",
width:double.infinity,
fit: BoxFit.cover,
fit: BoxFit.fill,
height:80.h,
),
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,
);
}
}

41
lib/mine/mine_view/mine_calendar.dart

@ -1,11 +1,8 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.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:url_launcher/url_launcher.dart';
import 'calendar_page.dart';
class MineCalendar extends StatefulWidget {
@override
@ -18,10 +15,14 @@ class _MineCalendar extends State<MineCalendar> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.fromLTRB(16.w, 10.h, 16.w, 28.h),
padding: EdgeInsets.only(top: 12.h,left: 12,right: 12),
margin: EdgeInsets.fromLTRB(14.w, 20.h, 14.w, 30.h),
padding: EdgeInsets.only(top: 12.h,left: 12,),
decoration: BoxDecoration(
color: Colors.white,
// color: Colors.white,
image: DecorationImage(
fit: BoxFit.cover,
image: AssetImage("assets/image/s_bg.webp"),
),
borderRadius: BorderRadius.circular(8),
boxShadow: [
BoxShadow(
@ -32,13 +33,20 @@ class _MineCalendar extends State<MineCalendar> {
)
],
),
child: Column(
child: Stack(
alignment: Alignment.bottomRight,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
GestureDetector(
onTap: (){
Navigator.of(context).pushNamed('/router/mine_greenery');
},
child: Row(
children: [
Expanded(child: Text(
"我的3月足迹日历",
"我的5月足迹日历",
style: TextStyle(
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.semi_bold,
@ -58,11 +66,22 @@ class _MineCalendar extends State<MineCalendar> {
size: 24,
color: Colors.black,
),
SizedBox(width:12,),
],
),
SizedBox(height: 12,)
),
SizedBox(height: 12,),
CalendarPage(),
],
),
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
Widget build(BuildContext context) {
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),
decoration: BoxDecoration(
color: Colors.white,
@ -284,7 +284,16 @@ class _MineItem extends State<MineItem> {
"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(),),
],

2
lib/mine/mine_view/mine_order.dart

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

396
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_swiper/flutter_swiper.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/miNiDetail.dart';
import 'package:huixiang/retrofit/data/shoppingCart.dart';
import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_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/utils/font_weight.dart';
import 'package:huixiang/view_widget/classic_header.dart';
@ -50,13 +51,18 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
String cName;
String cid;
List<String> selectSkus = [];
List<Activity> activitys;
int counts = 1;
String selectedPrice = "";
String storeId;
String parentId;
int numberOfPeople = 0;
@override
void initState() {
super.initState();
id = widget.arguments["id"];
storeId = widget.arguments["storeId"];
SharedPreferences.getInstance().then((value) {
String minToken = value.getString("minToken");
String tenant = value.getString("tenant");
@ -68,8 +74,13 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
storeId: storeId,
showLoading: true);
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) {
setState(() {
miNiDetail = baseData.data;
miNiDetail.attrList.forEach((element) {
selectSkus.add(element.attrValueList[0].attrValue);
});
});
refreshController.refreshCompleted();
} else {
@ -92,6 +106,162 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
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 {
EasyLoading.show(status: S.current.zhengzaijiazai);
@ -116,24 +286,9 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (miNiDetail.attrList != null &&
miNiDetail.attrList.length == 1 &&
miNiDetail.attrList[0].attrValueList.length == 1) {
_addShopCar(miNiDetail, [], count);
_addShopCar(miNiDetail, [], counts);
} else {
EasyLoading.dismiss();
dialogShowing = true;
SmartDialog.show(
widget: ProductSku(
miNiDetail,
shopCarGoods,
id,
_addShopCar,
add,
reduce,
),
onDismiss: () {
dialogShowing = false;
},
alignmentTemp: Alignment.bottomCenter,
);
showSpanDialog();
}
}
@ -166,7 +321,9 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart({
"storeId": storeInfo.id,
"storeName": storeInfo.storeName ?? "",
"parentId": miNiDetail.id,
"numberOfPeople": numberOfPeople,
"tableId": tableId,
"parentId": parentId,
"parentCode": parentCode,
"shoppingCartSkuItemList": [
{
@ -178,6 +335,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
"storeId": storeInfo.id,
"skuPrice": productSku.skuPrice,
"skuStock": productSku.skuStock,
"tableId": tableId,
},
],
});
@ -188,91 +346,18 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
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 {
// pName = ""; //
// pid = ""; //
// cName = ""; //
// cid = ""; //
pName = ""; //
pid = ""; //
cName = ""; //
cid = ""; //
BaseData<List<ShoppingCart>> baseDate =
await minService.getShoppingCart(tableId);
if (baseDate != null &&
@ -282,14 +367,14 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
if (baseDate.data[0].selectDiscount == 1) {
baseDate.data[0].couponList.forEach((element) {
if (element.isMaxCoupon) {
cName = element.promotionName;
// cName = element.promotionName;
cid = element.id;
}
});
} else if (baseDate.data[0].selectDiscount == 2) {
baseDate.data[0].promotionInfoList.forEach((element) {
if (element.isMaxPromotion) {
pName = element.name;
// pName = element.name;
pid = element.id;
}
});
@ -528,12 +613,8 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
),
flex: 1,
),
// if(count() != 0)
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Stack(
if(count() != 0)
Stack(
alignment: Alignment.bottomLeft,
children: [
Container(
@ -621,7 +702,6 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
),
],
),
),
],
),
),
@ -680,7 +760,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
)),
GestureDetector(
onTap: () {
showDeleteDialog();
_queryMiNiDetail(id,counts);
},
child: Container(
width: 92.w,
@ -750,7 +830,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
Widget swiper() {
return Container(
child: AspectRatio(
aspectRatio: 1.3698,
aspectRatio: 375/375,
child: Stack(
children: [
Swiper(
@ -767,7 +847,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
itemBuilder: (context, position) {
return MImage(
miNiDetail?.imgs != null ? miNiDetail.imgs[position]:"",
fit: BoxFit.cover,
fit: BoxFit.fill,
radius: BorderRadius.zero,
errorSrc: "assets/image/default_2_1.webp",
fadeSrc: "assets/image/default_2_1.webp",
@ -796,13 +876,21 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
}
///
showDeleteDialog() {
showSpanDialog() {
showDialog(
context: context,
builder: (context) {
return StatefulBuilder(builder: (
context,
state,
)
{
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
width: MediaQuery
.of(context)
.size
.width - 84,
height: 500.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
@ -834,7 +922,8 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
mainAxisAlignment: MainAxisAlignment
.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
@ -846,7 +935,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
),
),
GestureDetector(
onTap: (){
onTap: () {
Navigator.of(context).pop();
},
child: Image.asset(
@ -871,31 +960,34 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
)),
],
),
// if (miNiDetail.attrList != null && miNiDetail.attrList.length > 0)
// SizedBox(
// height:10,
// ),
// 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,
// );
// },
// ),
// ),
if (miNiDetail.attrList != null &&
miNiDetail.attrList.length > 0)
SizedBox(
height: 10,
),
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) {
state(() {
// if(selectSkus.length > position)
selectSkus[position] = attrValue;
buildCount();
});
},
miNiDetail.attrList[position],
position,
);
},
),
),
SizedBox(
height: 24,
),
@ -916,11 +1008,13 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
children: [
InkWell(
onTap: () {
state(() {
if (counts > 1)
setState(() {
counts -= 1;
});
reduce(miNiDetail, selectSkus);
});
},
child: Icon(
Icons.remove,
@ -936,8 +1030,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
Padding(
padding: EdgeInsets.only(left: 8, right: 8),
child: Text(
// "$count",
"0",
"$counts",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
@ -947,12 +1040,12 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
),
InkWell(
onTap: () {
setState(() {
state(() {
counts += 1;
});
add(miNiDetail, selectSkus);
});
},
child:Icon(
child: Icon(
Icons.add,
color: Color(0xFF32A060),
size: 24,
@ -965,7 +1058,14 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
SizedBox(
height: 24,
),
Container(
GestureDetector(
onTap: () {
state(() {
_addShopCar(miNiDetail, selectSkus, counts);
Navigator.of(context).pop();
});
},
child: Container(
width: double.infinity,
alignment: Alignment.center,
decoration: BoxDecoration(
@ -981,11 +1081,13 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
color: Color(0xFFFFFFFF),
),
),
),
)
],
),
),
);
});
},
);
}
@ -1026,7 +1128,7 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
},
child:sweetnessItem(
tag.attrValue,
(tag.attrValue == selectSkus[position]) ?? false,
(selectSkus.length > position && tag.attrValue == selectSkus[position]),
));
}).toList());
}

10
lib/store/store_order.dart

@ -340,7 +340,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
],
),
),
top:226.h,
top:233.h,
bottom: 0,
left: 0,
right: 0,
@ -407,6 +407,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
minToken,
tenant,
_queryMiNiDetail,
(){
queryShopCar().then((value) {
this.shopCarGoods = value;
setState(() {});
});
}
),
///,
@ -619,7 +625,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
Widget buildSwiper() {
return Container(
width: double.infinity,
height: 230.h,
height: 235.h,
child: Swiper(
pagination: SwiperPagination(
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 tenant;
final Function(String id, int count) queryMiNiDetail;
final Function queryShoppingCart;
ShoppingCart shopCarGoods;
@ -34,6 +36,7 @@ class StoreOrderListPage extends StatefulWidget {
this.minToken,
this.tenant,
this.queryMiNiDetail,
this.queryShoppingCart,
);
@override
@ -126,11 +129,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
setState(() {
Navigator.of(context).pushNamed('/router/shop_details_page',arguments: {
"id":productListBeans[position].id,
});
});
goShopDetailsPage(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) {
int count = calculateItemCount(findMiNiGroupList);
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:huixiang/generated/l10n.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/store.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/classic_header.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_tab.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"
source: hosted
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:
dependency: transitive
description: flutter
@ -677,6 +684,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
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:
dependency: transitive
description:

2
pubspec.yaml

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

Loading…
Cancel
Save