Browse Source

火锅店增加优惠券;

部分控件修改;
zyh
w-R 3 years ago
parent
commit
7c3246598e
  1. 14
      lib/community/community_page.dart
  2. 4
      lib/community/community_view/class_title_tab.dart
  3. 14
      lib/community/order_page.dart
  4. 6
      lib/home/points_mall_view/points_goods_title.dart
  5. 5
      lib/home/welfare_exchange.dart
  6. 87
      lib/integral/integral_detailed_page.dart
  7. 2
      lib/main.dart
  8. 6
      lib/mine/fans_page.dart
  9. 5
      lib/mine/follow_page.dart
  10. 5
      lib/mine/mine_card_page.dart
  11. 31
      lib/mine/mine_view/community_follow.dart
  12. 4
      lib/mine/mine_view/mine_view.dart
  13. 5
      lib/order/bargain_group_order.dart
  14. 15
      lib/order/exchange_history_page.dart
  15. 9
      lib/order/order_history_page.dart
  16. 7
      lib/retrofit/data/min_order_info.dart
  17. 10
      lib/retrofit/min_api.dart
  18. 47
      lib/retrofit/min_api.g.dart
  19. 6
      lib/setting/setting_page.dart
  20. 132
      lib/settlement/settlement.dart
  21. 14
      lib/settlement/settlement_view/activity_coupon_remarks.dart
  22. 45
      lib/settlement/settlement_view/settlement_coupon.dart
  23. 4
      lib/settlement/settlement_view/settlement_order_commodity.dart
  24. 4
      lib/store/shopping/shopping_home/shopping_title_tab.dart
  25. 9
      lib/store/store_order.dart
  26. 191
      lib/union/union_page.dart
  27. 2
      pubspec.yaml

14
lib/community/community_page.dart

@ -17,7 +17,7 @@ class CommunityPage extends StatefulWidget {
} }
class _CommunityPage extends State<CommunityPage> class _CommunityPage extends State<CommunityPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
TabController tabcontroller; TabController tabcontroller;
CommunityChildPage guanzhu,tuijian ; CommunityChildPage guanzhu,tuijian ;
@ -83,7 +83,12 @@ class _CommunityPage extends State<CommunityPage>
MediaQuery.of(context).size.width - 60.w, MediaQuery.of(context).size.width - 60.w,
38.h, 38.h,
), ),
child: TabBar( child: Theme(
data: ThemeData(
splashColor: Colors.transparent, //
highlightColor: Colors.transparent, //
),
child: TabBar(
controller: tabcontroller, controller: tabcontroller,
automaticIndicatorColorAdjustment: true, automaticIndicatorColorAdjustment: true,
isScrollable: true, isScrollable: true,
@ -102,7 +107,7 @@ class _CommunityPage extends State<CommunityPage>
), ),
labelColor: Colors.black, labelColor: Colors.black,
tabs: lables.map((e) => MyTab(text: e)).toList(), tabs: lables.map((e) => MyTab(text: e)).toList(),
), )),
), ),
// onTap: () { // onTap: () {
// _toRelease(); // _toRelease();
@ -148,4 +153,7 @@ class _CommunityPage extends State<CommunityPage>
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

4
lib/community/community_view/class_title_tab.dart

@ -19,7 +19,7 @@ class ClassTitleTab extends StatefulWidget {
} }
class _ClassTitleTab extends State<ClassTitleTab> class _ClassTitleTab extends State<ClassTitleTab>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
TabController tabController; TabController tabController;
@override @override
@ -68,4 +68,6 @@ class _ClassTitleTab extends State<ClassTitleTab>
); );
} }
@override
bool get wantKeepAlive => true;
} }

14
lib/community/order_page.dart

@ -16,7 +16,7 @@ class OrderPage extends StatefulWidget {
} }
class _OrderPage extends State<OrderPage> class _OrderPage extends State<OrderPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
TabController tabcontroller; TabController tabcontroller;
List<String> lables = [ List<String> lables = [
@ -42,7 +42,12 @@ class _OrderPage extends State<OrderPage>
appBar: MyAppBar( appBar: MyAppBar(
title: "", title: "",
leading: false, leading: false,
bottom: TabBar( bottom: Theme(
data: ThemeData(
splashColor: Colors.transparent, //
highlightColor: Colors.transparent, //
),
child: TabBar(
// isScrollable: true, // // isScrollable: true, //
indicatorColor: Color(0xff39B54A), indicatorColor: Color(0xff39B54A),
labelColor: Colors.black, labelColor: Colors.black,
@ -65,7 +70,7 @@ class _OrderPage extends State<OrderPage>
MyTab(text: S.of(context).weiwancheng), MyTab(text: S.of(context).weiwancheng),
MyTab(text: S.of(context).yiwancheng), MyTab(text: S.of(context).yiwancheng),
], ],
), )),
), ),
body: TabBarView( body: TabBarView(
children: [OrderHistoryList(0),OrderHistoryList(1),OrderHistoryList(2),OrderHistoryList(3), ], children: [OrderHistoryList(0),OrderHistoryList(1),OrderHistoryList(2),OrderHistoryList(3), ],
@ -73,4 +78,7 @@ class _OrderPage extends State<OrderPage>
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

6
lib/home/points_mall_view/points_goods_title.dart

@ -23,7 +23,8 @@ class PointsGoodsTitle extends StatefulWidget {
} }
} }
class _PointsGoodsTitle extends State<PointsGoodsTitle> { class _PointsGoodsTitle extends State<PointsGoodsTitle>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin{
var _itemText = S.current.morenpaixu; var _itemText = S.current.morenpaixu;
List<String> sortString = [ List<String> sortString = [
S.current.morenpaixu, S.current.morenpaixu,
@ -162,4 +163,7 @@ class _PointsGoodsTitle extends State<PointsGoodsTitle> {
_itemText = item; _itemText = item;
}); });
} }
@override
bool get wantKeepAlive => true;
} }

5
lib/home/welfare_exchange.dart

@ -31,7 +31,7 @@ class WelfareExchange extends StatefulWidget {
} }
} }
class _WelfareExchange extends State<WelfareExchange> { class _WelfareExchange extends State<WelfareExchange> with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin{
ApiService apiService; ApiService apiService;
final ScrollController scrollController = ScrollController(); final ScrollController scrollController = ScrollController();
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
@ -582,4 +582,7 @@ class _WelfareExchange extends State<WelfareExchange> {
return "${AppUtils.calculateDouble(double.tryParse(goods.oneMoney) ?? 0)}"; return "${AppUtils.calculateDouble(double.tryParse(goods.oneMoney) ?? 0)}";
} }
} }
@override
bool get wantKeepAlive => true;
} }

87
lib/integral/integral_detailed_page.dart

@ -25,7 +25,7 @@ class IntegralDetailedPage extends StatefulWidget {
} }
class _IntegralDetailedPage extends State<IntegralDetailedPage> class _IntegralDetailedPage extends State<IntegralDetailedPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
List<Widget> _tabs; List<Widget> _tabs;
TabController tabController; TabController tabController;
@ -64,7 +64,8 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
void initState() { void initState() {
super.initState(); super.initState();
SharedPreferences.getInstance().then((value) => { SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(), context: context, token: value.getString("token")), apiService = ApiService(Dio(),
context: context, token: value.getString("token")),
userInfo = UserInfo.fromJson(jsonDecode(value.getString('user'))), userInfo = UserInfo.fromJson(jsonDecode(value.getString('user'))),
queryDetail("bill_cate_point_get"), queryDetail("bill_cate_point_get"),
}); });
@ -155,47 +156,52 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
leadingWidth: 56, leadingWidth: 56,
flexibleSpace: FlexibleSpaceBar( flexibleSpace: FlexibleSpaceBar(
background: Container( background: Container(
alignment: Alignment.center, alignment: Alignment.center,
margin: EdgeInsets.only(top: 56.h), margin: EdgeInsets.only(top: 56.h),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text( Text(
userInfo != null ? userInfo.points : "0", userInfo != null ? userInfo.points : "0",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontWeight: MyFontWeight.medium, fontWeight: MyFontWeight.medium,
fontSize: 48.sp), fontSize: 48.sp),
), ),
Text( Text(
S.of(context).wodejifenzhi, S.of(context).wodejifenzhi,
style: TextStyle( style: TextStyle(
color: Color(0xFFF2F2F2), color: Color(0xFFF2F2F2),
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular), fontWeight: MyFontWeight.regular),
), ),
], ],
),
), ),
), ),
),
expandedHeight: 228, expandedHeight: 228,
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: Size(double.infinity, 38), preferredSize: Size(double.infinity, 38),
child: TabBar( child: Theme(
tabs: _tabs, data: ThemeData(
controller: tabController, splashColor: Colors.transparent, //
isScrollable: false, highlightColor: Colors.transparent, //
indicatorSize: TabBarIndicatorSize.label, ),
labelColor: Colors.white, child: TabBar(
labelStyle: tabs: _tabs,
TextStyle(fontSize: 16.sp, fontWeight: MyFontWeight.medium), controller: tabController,
unselectedLabelStyle: isScrollable: false,
TextStyle(fontSize: 16.sp,fontWeight: MyFontWeight.medium), indicatorSize: TabBarIndicatorSize.label,
indicatorColor: Colors.white, labelColor: Colors.white,
unselectedLabelColor: Color(0xFFE6E6E6), labelStyle: TextStyle(
), fontSize: 16.sp, fontWeight: MyFontWeight.medium),
), unselectedLabelStyle: TextStyle(
fontSize: 16.sp, fontWeight: MyFontWeight.medium),
indicatorColor: Colors.white,
unselectedLabelColor: Color(0xFFE6E6E6),
),
)),
), ),
]; ];
}, },
@ -289,4 +295,7 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

2
lib/main.dart

@ -132,7 +132,7 @@ void main() async {
SharedPreferences sharedPreferences = await SharedPreferences.getInstance(); SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
Locale locale; Locale locale;
if (sharedPreferences.containsKey("language") && if (sharedPreferences.containsKey("language") &&
sharedPreferences.getString("language") == "zh") { sharedPreferences.getString("language") == "tw") {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW'); locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW');
} else { } else {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH'); locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'CH');

6
lib/mine/fans_page.dart

@ -29,7 +29,8 @@ class FansPage extends StatefulWidget {
} }
} }
class _FansPage extends State<FansPage> { class _FansPage extends State<FansPage>
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
RefreshController _refreshController; RefreshController _refreshController;
int pageNum = 1; int pageNum = 1;
List<ListData> list = []; List<ListData> list = [];
@ -208,4 +209,7 @@ class _FansPage extends State<FansPage> {
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

5
lib/mine/follow_page.dart

@ -30,7 +30,7 @@ class FollowPage extends StatefulWidget {
} }
} }
class _FollowPage extends State<FollowPage> { class _FollowPage extends State<FollowPage> with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin{
RefreshController _refreshController; RefreshController _refreshController;
ApiService apiService; ApiService apiService;
int pageNum = 1; int pageNum = 1;
@ -201,4 +201,7 @@ class _FollowPage extends State<FollowPage> {
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

5
lib/mine/mine_card_page.dart

@ -16,7 +16,7 @@ class MineCardPage extends StatefulWidget {
} }
class _MineCardPage extends State<MineCardPage> class _MineCardPage extends State<MineCardPage>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DefaultTabController( return DefaultTabController(
@ -57,4 +57,7 @@ class _MineCardPage extends State<MineCardPage>
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

31
lib/mine/mine_view/community_follow.dart

@ -21,7 +21,7 @@ class CommunityFollow extends StatefulWidget {
} }
class _CommunityFollow extends State<CommunityFollow> class _CommunityFollow extends State<CommunityFollow>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
ApiService apiService; ApiService apiService;
SocialInfo infoNumber; SocialInfo infoNumber;
@ -34,15 +34,11 @@ class _CommunityFollow extends State<CommunityFollow>
///(//) ///(//)
querySocialInfo() async { querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(Dio(),
Dio(), context: context, token: value.getString("token"), showLoading: true);
context: context,
token: value.getString("token"),
showLoading: true
);
BaseData<SocialInfo> baseData = BaseData<SocialInfo> baseData =
await apiService.socialInfo().catchError((onError) {}); await apiService.socialInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
infoNumber = baseData.data; infoNumber = baseData.data;
@ -51,7 +47,6 @@ class _CommunityFollow extends State<CommunityFollow>
EasyLoading.dismiss(); EasyLoading.dismiss();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return DefaultTabController( return DefaultTabController(
@ -81,15 +76,27 @@ class _CommunityFollow extends State<CommunityFollow>
indicatorSize: TabBarIndicatorSize.label, indicatorSize: TabBarIndicatorSize.label,
// //
tabs: <Widget>[ tabs: <Widget>[
MyTab(text:"关注${infoNumber?.follow??"0"}",), MyTab(
MyTab(text: "粉丝${infoNumber?.fans??"0"}"), text: "关注${infoNumber?.follow ?? "0"}",
),
MyTab(text: "粉丝${infoNumber?.fans ?? "0"}"),
], ],
), ),
), ),
body: TabBarView( body: TabBarView(
children: [FollowPage((){querySocialInfo();}),FansPage((){querySocialInfo();})], children: [
FollowPage(() {
querySocialInfo();
}),
FansPage(() {
querySocialInfo();
})
],
), ),
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

4
lib/mine/mine_view/mine_view.dart

@ -328,7 +328,7 @@ class _MineView extends State<MineView> {
: Row( : Row(
children: [ children: [
Text( Text(
"${S.of(context).guanzhu} ${widget?.infoNumber?.follow.toString() ?? "0"}", "${S.of(context).guanzhu} ${widget?.infoNumber?.follow ?? "0"}",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,
@ -342,7 +342,7 @@ class _MineView extends State<MineView> {
color: Color(0xFFFFFFFF), color: Color(0xFFFFFFFF),
), ),
Text( Text(
"${S.of(context).fensi} ${widget?.infoNumber?.fans.toString() ?? "0"}", "${S.of(context).fensi} ${widget?.infoNumber?.fans ?? "0"}",
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: MyFontWeight.regular, fontWeight: MyFontWeight.regular,

5
lib/order/bargain_group_order.dart

@ -125,7 +125,7 @@ class ExchangeHistoryList extends StatefulWidget {
} }
} }
class _ExchangeHistoryList extends State<ExchangeHistoryList> { class _ExchangeHistoryList extends State<ExchangeHistoryList> with AutomaticKeepAliveClientMixin{
MinApiService minService; MinApiService minService;
List<ActivityOrderList> activityOrderList = []; List<ActivityOrderList> activityOrderList = [];
RefreshController _refreshController = RefreshController(initialRefresh: false); RefreshController _refreshController = RefreshController(initialRefresh: false);
@ -473,4 +473,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
), ),
); );
} }
@override
bool get wantKeepAlive => true;
} }

15
lib/order/exchange_history_page.dart

@ -78,7 +78,12 @@ class _ExchangeHistoryPage extends State<ExchangeHistoryPage>
toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top, toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top,
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: Size(double.infinity, 38.h), preferredSize: Size(double.infinity, 38.h),
child: TabBar( child: Theme(
data: ThemeData(
splashColor: Colors.transparent, //
highlightColor: Colors.transparent, //
),
child: TabBar(
controller: tabcontroller, controller: tabcontroller,
indicatorWeight: 2, indicatorWeight: 2,
indicatorColor: Color(0xFF39B54A), indicatorColor: Color(0xFF39B54A),
@ -94,7 +99,7 @@ class _ExchangeHistoryPage extends State<ExchangeHistoryPage>
fontWeight: MyFontWeight.semi_bold), fontWeight: MyFontWeight.semi_bold),
labelColor: Colors.black, labelColor: Colors.black,
tabs: tabs, tabs: tabs,
), )),
), ),
), ),
body: TabBarView( body: TabBarView(
@ -117,7 +122,8 @@ class ExchangeHistoryList extends StatefulWidget {
} }
} }
class _ExchangeHistoryList extends State<ExchangeHistoryList> { class _ExchangeHistoryList extends State<ExchangeHistoryList>
with AutomaticKeepAliveClientMixin{
ApiService apiService; ApiService apiService;
RefreshController _refreshController = RefreshController _refreshController =
@ -563,4 +569,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
// ); // );
} }
} }
@override
bool get wantKeepAlive => true;
} }

9
lib/order/order_history_page.dart

@ -69,7 +69,12 @@ class _OrderHistoryPage extends State<OrderHistoryPage>
toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top, toolbarHeight: kToolbarHeight + MediaQuery.of(context).padding.top,
bottom: PreferredSize( bottom: PreferredSize(
preferredSize: Size(double.infinity, 38.h), preferredSize: Size(double.infinity, 38.h),
child: TabBar( child: Theme(
data: ThemeData(
splashColor: Colors.transparent, //
highlightColor: Colors.transparent, //
),
child: TabBar(
controller: tabController, controller: tabController,
isScrollable: false, isScrollable: false,
indicatorWeight: 2.w, indicatorWeight: 2.w,
@ -100,7 +105,7 @@ class _OrderHistoryPage extends State<OrderHistoryPage>
text: S.of(context).yiwancheng, text: S.of(context).yiwancheng,
) )
], ],
), )),
), ),
), ),
body: TabBarView( body: TabBarView(

7
lib/retrofit/data/min_order_info.dart

@ -49,7 +49,8 @@ class MinOrderInfo {
int payChannel, int payChannel,
dynamic payNum, dynamic payNum,
String promotionId, String promotionId,
String couponId, String couponId,
String couponName,
int isDelete, int isDelete,
int isTakeOut, int isTakeOut,
int batch, int batch,
@ -131,6 +132,7 @@ class MinOrderInfo {
this.payNum = payNum; this.payNum = payNum;
this.promotionId = promotionId; this.promotionId = promotionId;
this.couponId = couponId; this.couponId = couponId;
this.couponName = couponName;
this.isDelete = isDelete; this.isDelete = isDelete;
this.isTakeOut = isTakeOut; this.isTakeOut = isTakeOut;
this.batch = batch; this.batch = batch;
@ -215,6 +217,7 @@ class MinOrderInfo {
this.payNum = json['payNum']; this.payNum = json['payNum'];
this.promotionId = json['promotionId']; this.promotionId = json['promotionId'];
this.couponId = json['couponId']; this.couponId = json['couponId'];
this.couponName = json['couponName'];
this.isDelete = json['isDelete']; this.isDelete = json['isDelete'];
this.isTakeOut = json['isTakeOut']; this.isTakeOut = json['isTakeOut'];
this.batch = json['batch']; this.batch = json['batch'];
@ -302,6 +305,7 @@ class MinOrderInfo {
dynamic payNum; dynamic payNum;
String promotionId; String promotionId;
String couponId; String couponId;
String couponName;
int isDelete; int isDelete;
int isTakeOut; int isTakeOut;
int batch; int batch;
@ -386,6 +390,7 @@ class MinOrderInfo {
map['payNum'] = this.payNum; map['payNum'] = this.payNum;
map['promotionId'] = this.promotionId; map['promotionId'] = this.promotionId;
map['couponId'] = this.couponId; map['couponId'] = this.couponId;
map['couponName'] = this.couponName;
map['isDelete'] = this.isDelete; map['isDelete'] = this.isDelete;
map['isTakeOut'] = this.isTakeOut; map['isTakeOut'] = this.isTakeOut;
map['batch'] = this.batch; map['batch'] = this.batch;

10
lib/retrofit/min_api.dart

@ -4,11 +4,9 @@ import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/address.dart'; import 'package:huixiang/retrofit/data/address.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/down_order.dart';
import 'package:huixiang/retrofit/data/min_order_info.dart'; import 'package:huixiang/retrofit/data/min_order_info.dart';
import 'package:huixiang/retrofit/data/wx_pay.dart'; import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart'; import 'package:huixiang/view_widget/login_tips_dialog.dart';
@ -247,4 +245,12 @@ abstract class MinApiService {
@GET("actTemplate/showOneAct?actRecordId={actRecordId}") @GET("actTemplate/showOneAct?actRecordId={actRecordId}")
Future<BaseData<ActivityActRecordDetails>> showOneAct(@Path("actRecordId") String actRecordId); Future<BaseData<ActivityActRecordDetails>> showOneAct(@Path("actRecordId") String actRecordId);
///
@GET("promotion/cancelMemberCoupon?orderId={orderId}")
Future<BaseData> cancelMemberCoupon(@Path("orderId") String orderId);
/// 使
@POST("promotion/useMemberCoupon")
Future<BaseData> useMemberCoupon(@Body() Map<String, dynamic> param);
} }

47
lib/retrofit/min_api.g.dart

@ -218,7 +218,7 @@ class _MinApiService implements MinApiService {
data: _data); data: _data);
final value = BaseData<SettleOrderInfo>.fromJson( final value = BaseData<SettleOrderInfo>.fromJson(
_result.data, _result.data,
(json) => SettleOrderInfo.fromJson(json), (json) => json == "" ? null :SettleOrderInfo.fromJson(json),
); );
return value; return value;
} }
@ -605,4 +605,49 @@ class _MinApiService implements MinApiService {
); );
return value; return value;
} }
@override
Future<BaseData<dynamic>> cancelMemberCoupon(orderId) async {
ArgumentError.checkNotNull(orderId, 'orderId');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'promotion/cancelMemberCoupon?orderId=$orderId',
queryParameters: queryParameters,
options: RequestOptions(
method: 'GET',
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<dynamic>> useMemberCoupon(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>>(
'promotion/useMemberCoupon',
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;
}
} }

6
lib/setting/setting_page.dart

@ -144,9 +144,9 @@ class _SettingPage extends State<SettingPage> {
}, },
child: settingItem( child: settingItem(
S.of(context).yuyan, S.of(context).yuyan,
locale == "zh" locale == "tw"
? S.of(context).zhongwenjianti ? S.of(context).fantizhongwen
: S.of(context).fantizhongwen), : S.of(context).zhongwenjianti),
), ),
GestureDetector( GestureDetector(
child: settingSingleItem(S.of(context).quanxian), child: settingSingleItem(S.of(context).quanxian),

132
lib/settlement/settlement.dart

@ -164,8 +164,18 @@ class _Settlement extends State<Settlement> {
} }
/// ///
queryOrderInfo(addressId, isTake, memberCouponId, orderId, promotionId, queryOrderInfo(
productSkuId, actProductId, actProductSkuId, buyNum, payChannel,tableId) async { addressId,
isTake,
memberCouponId,
orderId,
promotionId,
productSkuId,
actProductId,
actProductSkuId,
buyNum,
payChannel,
tableId) async {
BaseData<SettleOrderInfo> baseData = await minService.getOrderInfo({ BaseData<SettleOrderInfo> baseData = await minService.getOrderInfo({
"addressId": addressId, "addressId": addressId,
"isTake": isTake, "isTake": isTake,
@ -177,7 +187,7 @@ class _Settlement extends State<Settlement> {
"actProductSkuId": actProductSkuId, "actProductSkuId": actProductSkuId,
"buyNum": buyNum, "buyNum": buyNum,
"payChannel": payChannel, "payChannel": payChannel,
"tableId":tableId "tableId": tableId
}).catchError((error) {}); }).catchError((error) {});
this.promotion = null; this.promotion = null;
promotions = ""; promotions = "";
@ -186,17 +196,17 @@ class _Settlement extends State<Settlement> {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
settleOrderInfo = baseData.data; settleOrderInfo = baseData.data;
if((settleOrderInfo?.promotionId??"")!=""){ if ((settleOrderInfo?.promotionId ?? "") != "") {
settleOrderInfo.promotionInfoList.forEach((element) { settleOrderInfo.promotionInfoList.forEach((element) {
if(element.id == settleOrderInfo.promotionId){ if (element.id == settleOrderInfo.promotionId) {
this.promotion = element; this.promotion = element;
promotions = promotion?.name ?? ""; promotions = promotion?.name ?? "";
} }
}); });
} }
if((settleOrderInfo?.memberCouponId??"")!=""){ if ((settleOrderInfo?.memberCouponId ?? "") != "") {
settleOrderInfo.couponList.forEach((element) { settleOrderInfo.couponList.forEach((element) {
if(element.id == settleOrderInfo.memberCouponId){ if (element.id == settleOrderInfo.memberCouponId) {
this.couponListBean = element; this.couponListBean = element;
coupons = couponListBean?.promotionName ?? ""; coupons = couponListBean?.promotionName ?? "";
} }
@ -209,21 +219,50 @@ class _Settlement extends State<Settlement> {
pageType != null ? widget.arguments["orderId"] : parentId); pageType != null ? widget.arguments["orderId"] : parentId);
} }
}); });
} else {
SmartDialog.showToast(baseData?.msg ?? "", alignment: Alignment.center);
} }
} }
/// ///
queryOrderDetails(id) async { queryOrderDetails(id) async {
BaseData<MinOrderInfo> baseData = await minService.getOrderDetails({ BaseData<MinOrderInfo> baseData = await minService.getOrderDetails({
"id": pageType != null ? widget.arguments["orderId"] : id??parentId, "id": pageType != null ? widget.arguments["orderId"] : id ?? parentId,
}).catchError((error) {}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
minOrderInfo = baseData.data; minOrderInfo = baseData.data;
}); coupons = minOrderInfo?.couponName ?? "";
} else { });
SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center); } else {
} SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center);
}
}
///
queryCancelMemberCoupon(orderId) async {
BaseData baseData =
await minService.cancelMemberCoupon(orderId).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
queryOrderDetails(parentId);
// SmartDialog.showToast(baseData.data, alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center);
}
}
///使
queryUseMemberCoupon(memberCouponId) async {
BaseData baseData = await minService.useMemberCoupon({
"memberCouponId": memberCouponId,
"orderId": parentId,
"phone": minOrderInfo.orderInfoVo.memberVO.phone
}).catchError((error) {});
if (baseData != null && baseData.isSuccess) {
queryOrderDetails(parentId);
} else {
SmartDialog.showToast(baseData.msg ?? "", alignment: Alignment.center);
}
} }
queryAddress(int selectedBtn) async { queryAddress(int selectedBtn) async {
@ -438,7 +477,6 @@ class _Settlement extends State<Settlement> {
.catchError((error) { .catchError((error) {
print("error: $error"); print("error: $error");
}); });
// orderButton =false;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
placeOrder = true; placeOrder = true;
this.downOrder = DownOrder.fromJson(baseData.data); this.downOrder = DownOrder.fromJson(baseData.data);
@ -470,11 +508,11 @@ class _Settlement extends State<Settlement> {
}); });
} }
} }
orderButton =false; orderButton = false;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
placeOrder = true; placeOrder = true;
this.downOrder = DownOrder.fromJson(baseData.data); this.downOrder = DownOrder.fromJson(baseData.data);
parentId = this.downOrder.id??this.downOrder.parentId; parentId = this.downOrder.id ?? this.downOrder.parentId;
queryOrderDetails(parentId); queryOrderDetails(parentId);
setState(() {}); setState(() {});
} else { } else {
@ -503,7 +541,7 @@ class _Settlement extends State<Settlement> {
.catchError((error) { .catchError((error) {
print(error); print(error);
}); });
orderButton =false; orderButton = false;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data; WxPay wxPay = baseData.data;
await registerWxApi( await registerWxApi(
@ -527,7 +565,7 @@ class _Settlement extends State<Settlement> {
.catchError((error) { .catchError((error) {
print(error); print(error);
}); });
orderButton =false; orderButton = false;
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast(baseData.data, alignment: Alignment.center); SmartDialog.showToast(baseData.data, alignment: Alignment.center);
toOrderDetails(placeOrderFirst.id); toOrderDetails(placeOrderFirst.id);
@ -704,6 +742,7 @@ class _Settlement extends State<Settlement> {
couponCart, couponCart,
activityCart, activityCart,
settleOrderInfo, settleOrderInfo,
minOrderInfo,
coupons, coupons,
promotions, promotions,
couponCount(), couponCount(),
@ -760,7 +799,7 @@ class _Settlement extends State<Settlement> {
), ),
Text( Text(
(minOrderInfo != null (minOrderInfo != null
? "${minOrderInfo.orderSumPrice}" ? "${minOrderInfo.finalPayPrice}"
: "${settleOrderInfo == null ? "0" : settleOrderInfo.price}"), : "${settleOrderInfo == null ? "0" : settleOrderInfo.price}"),
style: TextStyle( style: TextStyle(
fontSize: 20.sp, fontSize: 20.sp,
@ -786,11 +825,11 @@ class _Settlement extends State<Settlement> {
vertical: 5.h, vertical: 5.h,
), ),
callback: () { callback: () {
if(orderButton){ if (orderButton) {
SmartDialog.showToast("订单正在提交中...",alignment: Alignment.center); SmartDialog.showToast("订单正在提交中...",
alignment: Alignment.center);
return; return;
} } else
else
orderButton = true; orderButton = true;
pageType != null pageType != null
? bargainOrderId != null ? bargainOrderId != null
@ -857,7 +896,8 @@ class _Settlement extends State<Settlement> {
context: context, context: context,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
builder: (context) { builder: (context) {
return SettlementCoupon(settleOrderInfo, storeInfo, return SettlementCoupon(
settleOrderInfo, minOrderInfo, tableId, storeInfo,
couponBean: couponListBean); couponBean: couponListBean);
}, },
); );
@ -866,6 +906,12 @@ class _Settlement extends State<Settlement> {
// coupons = couponListBean?.promotionName ?? ""; // coupons = couponListBean?.promotionName ?? "";
// promotions = ""; // promotions = "";
// this.promotion = null; // this.promotion = null;
if (tableId > 0) {
if(couponBean == null)
queryCancelMemberCoupon(parentId);
if (couponBean.id != null)
queryUseMemberCoupon(couponBean.id);
} else {
queryOrderInfo( queryOrderInfo(
address?.id, address?.id,
selectedBtn, selectedBtn,
@ -878,6 +924,8 @@ class _Settlement extends State<Settlement> {
count1, count1,
payChannel, payChannel,
tableId); tableId);
}
// } // }
} }
@ -896,18 +944,18 @@ class _Settlement extends State<Settlement> {
// promotions = promotion?.name ?? ""; // promotions = promotion?.name ?? "";
// coupons = ""; // coupons = "";
// this.couponListBean = null; // this.couponListBean = null;
queryOrderInfo( queryOrderInfo(
address?.id, address?.id,
selectedBtn, selectedBtn,
null, null,
0, 0,
promotion != null ? pro.id : (productId ?? null), promotion != null ? pro.id : (productId ?? null),
productSkuId ?? "", productSkuId ?? "",
actProductId ?? "", actProductId ?? "",
actProductSkuId ?? "", actProductSkuId ?? "",
count1, count1,
payChannel, payChannel,
tableId); tableId);
} }
// } // }
} }

14
lib/settlement/settlement_view/activity_coupon_remarks.dart

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/min_order_info.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
@ -13,6 +14,7 @@ class ActivityCouponRemarks extends StatefulWidget {
final String coupons; final String coupons;
final String promotions; final String promotions;
final SettleOrderInfo settleOrderInfo; final SettleOrderInfo settleOrderInfo;
final MinOrderInfo minOrderInfo;
final int couponCount; final int couponCount;
final bool placeOrder; final bool placeOrder;
final String remark; final String remark;
@ -22,6 +24,7 @@ class ActivityCouponRemarks extends StatefulWidget {
this.couponCart, this.couponCart,
this.activityCart, this.activityCart,
this.settleOrderInfo, this.settleOrderInfo,
this.minOrderInfo,
this.coupons, this.coupons,
this.promotions, this.promotions,
this.couponCount, this.couponCount,
@ -136,11 +139,11 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
], ],
), ),
), ),
if (widget.placeOrder && widget.tableId <=0) if (widget.placeOrder)
SizedBox( SizedBox(
height: 13, height: 13,
), ),
if (widget.placeOrder && widget.tableId <=0) if (widget.placeOrder)
InkWell( InkWell(
onTap: () { onTap: () {
widget.couponCart(); widget.couponCart();
@ -242,6 +245,13 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
String coupon = ""; String coupon = "";
if (widget.coupons == null || widget.coupons == "") { if (widget.coupons == null || widget.coupons == "") {
coupon = "未选择任何优惠券"; coupon = "未选择任何优惠券";
if(widget.placeOrder)
if(widget.minOrderInfo == null ||
widget.minOrderInfo.orderInfoVo.couponList == null)
{coupon = "暂无可选优惠券";}
else if(widget.promotions != null && widget.promotions != ""){
coupon = "优惠券与活动不可同享";
}
if (widget.settleOrderInfo == null || if (widget.settleOrderInfo == null ||
widget.settleOrderInfo.couponList == null) { widget.settleOrderInfo.couponList == null) {
coupon = "暂无可选优惠券"; coupon = "暂无可选优惠券";

45
lib/settlement/settlement_view/settlement_coupon.dart

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:huixiang/retrofit/data/min_order_info.dart';
import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; import 'package:huixiang/retrofit/data/settleOrderInfo.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/settlement/settlement_view/coupon.dart'; import 'package:huixiang/settlement/settlement_view/coupon.dart';
@ -7,11 +8,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class SettlementCoupon extends StatefulWidget { class SettlementCoupon extends StatefulWidget {
final StoreInfo storeInfo; final StoreInfo storeInfo;
final MinOrderInfo minOrderInfo;
final int tableId;
final SettleOrderInfo settleOrderInfo; final SettleOrderInfo settleOrderInfo;
final CouponListBean couponBean; final CouponListBean couponBean;
SettlementCoupon( SettlementCoupon(
this.settleOrderInfo, this.settleOrderInfo,
this.minOrderInfo,
this.tableId,
this.storeInfo, { this.storeInfo, {
this.couponBean, this.couponBean,
}); });
@ -33,18 +38,36 @@ class _SettlementCoupon extends State<SettlementCoupon> {
couponCan.clear(); couponCan.clear();
couponNo.clear(); couponNo.clear();
if (widget.settleOrderInfo != null && if(widget.tableId > 0){
widget.settleOrderInfo.couponList != null && if (widget.minOrderInfo != null &&
widget.settleOrderInfo.couponList.length > 0) { widget.minOrderInfo.orderInfoVo.couponList != null &&
widget.settleOrderInfo.couponList.forEach((element) { widget.minOrderInfo.orderInfoVo.couponList.length > 0) {
if (element.usable) { widget.minOrderInfo.orderInfoVo.couponList.forEach((element) {
couponCan.add(element); if (element["usable"]) {
} else { couponCan.add(CouponListBean.fromJson(element));
couponNo.add(element); } else {
} couponNo.add(CouponListBean.fromJson(element));
}); }
setState(() {}); });
setState(() {});
}
}else{
if (widget.settleOrderInfo != null &&
widget.settleOrderInfo.couponList != null &&
widget.settleOrderInfo.couponList.length > 0) {
widget.settleOrderInfo.couponList.forEach((element) {
if (element.usable) {
couponCan.add(element);
} else {
couponNo.add(element);
}
});
setState(() {});
}
} }
} }
@override @override

4
lib/settlement/settlement_view/settlement_order_commodity.dart

@ -398,7 +398,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
String discountPrice(){ String discountPrice(){
if(widget.minOrderInfo != null){ if(widget.minOrderInfo != null){
return AppUtils.calculateDouble(double.tryParse(widget.minOrderInfo?.discountAmount ?? "0") + double.tryParse(widget.settleOrderInfo?.benefitDiscountAmount ?? "0")); return AppUtils.calculateDouble(double.tryParse(widget.minOrderInfo?.couponSubPrice ?? "0") + double.tryParse(widget.settleOrderInfo?.benefitDiscountAmount ?? "0"));
}else if(widget.tableId < 0){ }else if(widget.tableId < 0){
return "0"; return "0";
}else { }else {
@ -409,7 +409,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
String totalPrice() { String totalPrice() {
if (widget.minOrderInfo != null && if (widget.minOrderInfo != null &&
widget.minOrderInfo.orderProductVOList != null) { widget.minOrderInfo.orderProductVOList != null) {
return "${widget.minOrderInfo.orderSumPrice}"; return "${widget.minOrderInfo.finalPayPrice}";
} }
if (widget.settleOrderInfo.orderProductList == null) return ""; if (widget.settleOrderInfo.orderProductList == null) return "";
return "${widget.settleOrderInfo.price}"; return "${widget.settleOrderInfo.price}";

4
lib/store/shopping/shopping_home/shopping_title_tab.dart

@ -17,7 +17,7 @@ class ShoppingTitleTab extends StatefulWidget {
} }
class _ClassTitleTab extends State<ShoppingTitleTab> class _ClassTitleTab extends State<ShoppingTitleTab>
with SingleTickerProviderStateMixin { with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
TabController tabController; TabController tabController;
@override @override
@ -62,4 +62,6 @@ class _ClassTitleTab extends State<ShoppingTitleTab>
); );
} }
@override
bool get wantKeepAlive => true;
} }

9
lib/store/store_order.dart

@ -372,7 +372,12 @@ class _StoreOrderPage extends State<StoreOrderPage>
padding: padding:
EdgeInsets.symmetric(horizontal: 10.w), EdgeInsets.symmetric(horizontal: 10.w),
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
child: TabBar( child: Theme(
data: ThemeData(
splashColor: Colors.transparent, //
highlightColor: Colors.transparent, //
),
child: TabBar(
controller: tabcontroller, controller: tabcontroller,
automaticIndicatorColorAdjustment: true, automaticIndicatorColorAdjustment: true,
isScrollable: true, isScrollable: true,
@ -397,7 +402,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
MyTab(text: S.of(context).diandan), MyTab(text: S.of(context).diandan),
// MyTab(text: ""), // MyTab(text: ""),
], ],
), )),
), ),
), ),
), ),

191
lib/union/union_page.dart

@ -32,7 +32,8 @@ import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
class UnionPage extends StatefulWidget { class UnionPage extends StatefulWidget {
final int initialIndex; final int initialIndex;
UnionPage(Key key,this.initialIndex): super(key: key);
UnionPage(Key key, this.initialIndex) : super(key: key);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -57,7 +58,7 @@ class UnionPageState extends State<UnionPage>
bool isKeyBoardShow = false; bool isKeyBoardShow = false;
BMFCoordinate latLng; BMFCoordinate latLng;
jumpIndex(jpIndex){ jumpIndex(jpIndex) {
tabController.index = jpIndex; tabController.index = jpIndex;
} }
@ -98,7 +99,8 @@ class UnionPageState extends State<UnionPage>
void initState() { void initState() {
super.initState(); super.initState();
if (tabController == null) if (tabController == null)
tabController = TabController(length: 4, vsync: this,initialIndex: widget.initialIndex); tabController = TabController(
length: 4, vsync: this, initialIndex: widget.initialIndex);
// tabController?.addListener(() { // tabController?.addListener(() {
// startLocation(); // startLocation();
// }); // });
@ -114,18 +116,20 @@ class UnionPageState extends State<UnionPage>
startLocation(false); startLocation(false);
} }
RefreshController tabRefresh(){ RefreshController tabRefresh() {
RefreshController tempRef; RefreshController tempRef;
if (tabController.index == 0) tempRef = refreshController; if (tabController.index == 0)
else if (tabController.index == 1) tempRef = refreshController1; tempRef = refreshController;
else if (tabController.index == 2) tempRef = refreshController2; else if (tabController.index == 1)
tempRef = refreshController1;
else if (tabController.index == 2)
tempRef = refreshController2;
else if (tabController.index == 3) tempRef = refreshController3; else if (tabController.index == 3) tempRef = refreshController3;
return tempRef; return tempRef;
} }
startLocation(bool isOnRefresh) async { startLocation(bool isOnRefresh) async {
if(!isOnRefresh) if (!isOnRefresh) EasyLoading.show(status: S.current.zhengzaijiazai);
EasyLoading.show(status: S.current.zhengzaijiazai);
Location.getInstance() Location.getInstance()
.aMapFlutterLocation .aMapFlutterLocation
.onResultCallback() .onResultCallback()
@ -141,9 +145,9 @@ class UnionPageState extends State<UnionPage>
latLng = BMFCoordinate(event["latitude"], event["longitude"]); latLng = BMFCoordinate(event["latitude"], event["longitude"]);
} }
BMFCalculateUtils.coordConvert( BMFCalculateUtils.coordConvert(
coordinate: latLng, coordinate: latLng,
fromType: BMF_COORD_TYPE.BD09LL, fromType: BMF_COORD_TYPE.BD09LL,
toType: BMF_COORD_TYPE.COMMON) toType: BMF_COORD_TYPE.COMMON)
.then((value) { .then((value) {
this.latLng = value; this.latLng = value;
saveLatLng( saveLatLng(
@ -157,21 +161,20 @@ class UnionPageState extends State<UnionPage>
event["province"], event["province"],
event["city"], event["city"],
event["district"], event["district"],
editingController.text,-1); editingController.text,
-1);
if (_mapController != null) if (_mapController != null)
_mapController.updateMapOptions(BMFMapOptions( _mapController.updateMapOptions(BMFMapOptions(
center: value, center: value,
zoomLevel: 15, zoomLevel: 15,
)); ));
}); });
} } else {
else {
getLatLng(); getLatLng();
// EasyLoading.dismiss(); // EasyLoading.dismiss();
} }
}); });
Location.getInstance().prepareLoc(); Location.getInstance().prepareLoc();
Location.getInstance().startLocation(context).then((value) { Location.getInstance().startLocation(context).then((value) {
if (!value) { if (!value) {
@ -211,7 +214,8 @@ class UnionPageState extends State<UnionPage>
value.getString("province"), value.getString("province"),
value.getString("city"), value.getString("city"),
value.getString("district"), value.getString("district"),
editingController.text,-1), editingController.text,
-1),
setState(() { setState(() {
if (_mapController != null) { if (_mapController != null) {
_mapController.updateMapOptions(BMFMapOptions( _mapController.updateMapOptions(BMFMapOptions(
@ -223,7 +227,7 @@ class UnionPageState extends State<UnionPage>
} }
else else
{ {
queryStore("", "", "", "", "", editingController.text,-1), queryStore("", "", "", "", "", editingController.text, -1),
} }
}, },
); );
@ -234,7 +238,8 @@ class UnionPageState extends State<UnionPage>
List<Store> storeList2; List<Store> storeList2;
List<Store> storeList3; List<Store> storeList3;
queryStore(latitude, longitude, province, city, district, searchKey,int index) async { queryStore(latitude, longitude, province, city, district, searchKey,
int index) async {
if (apiService == null) { if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance(); SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(
@ -254,31 +259,38 @@ class UnionPageState extends State<UnionPage>
? "" ? ""
: ((tabController.index == 1 && index == -1) || index == 1 : ((tabController.index == 1 && index == -1) || index == 1
? "EATSTORE" ? "EATSTORE"
: ((tabController.index == 2 && index == -1) || index == 2 ? "DRINKSTORE" : "HAPPYSTORE")), : ((tabController.index == 2 && index == -1) || index == 2
? "DRINKSTORE"
: "HAPPYSTORE")),
}).catchError((error) { }).catchError((error) {
if(index == -1) if (index == -1) tabRefresh().refreshFailed();
tabRefresh().refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
if(index == -1 && storeList == null){ if (index == -1 && storeList == null) {
if (tabController.index != 0) if (tabController.index != 0)
queryStore(latitude, longitude, province, city, district, searchKey,0); queryStore(
latitude, longitude, province, city, district, searchKey, 0);
if (tabController.index != 1) if (tabController.index != 1)
queryStore(latitude, longitude, province, city, district, searchKey,1); queryStore(
latitude, longitude, province, city, district, searchKey, 1);
if (tabController.index != 2) if (tabController.index != 2)
queryStore(latitude, longitude, province, city, district, searchKey,2); queryStore(
latitude, longitude, province, city, district, searchKey, 2);
if (tabController.index != 3) if (tabController.index != 3)
queryStore(latitude, longitude, province, city, district, searchKey,3); queryStore(
latitude, longitude, province, city, district, searchKey, 3);
} }
if ((tabController.index == 0 && index == -1) || index == 0) storeList = baseData.data; if ((tabController.index == 0 && index == -1) || index == 0)
else if ((tabController.index == 1 && index == -1) || index == 1) storeList1 = baseData.data; storeList = baseData.data;
else if ((tabController.index == 2 && index == -1) || index == 2) storeList2 = baseData.data; else if ((tabController.index == 1 && index == -1) || index == 1)
else if ((tabController.index == 3 && index == -1) || index == 3) storeList3 = baseData.data; storeList1 = baseData.data;
if(index == -1) else if ((tabController.index == 2 && index == -1) || index == 2)
tabRefresh().refreshCompleted(); storeList2 = baseData.data;
else if ((tabController.index == 3 && index == -1) || index == 3)
storeList3 = baseData.data;
if (index == -1) tabRefresh().refreshCompleted();
} else { } else {
if(index == -1) if (index == -1) tabRefresh().refreshFailed();
tabRefresh().refreshFailed();
} }
EasyLoading.dismiss(); EasyLoading.dismiss();
setState(() {}); setState(() {});
@ -291,54 +303,67 @@ class UnionPageState extends State<UnionPage>
super.build(context); super.build(context);
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.translucent, behavior: HitTestBehavior.translucent,
onTap: (){ onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); FocusScope.of(context).requestFocus(FocusNode());
}, },
child:Scaffold( child: Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: MyAppBar( appBar: MyAppBar(
title: "", title: "",
leading: false, leading: false,
brightness: Brightness.light, brightness: Brightness.light,
titleChild: PreferredSize( titleChild: PreferredSize(
preferredSize: Size(double.infinity, 38.h), preferredSize: Size(double.infinity, 38.h),
child: TabBar( child: Theme(
controller: tabController, data: ThemeData(
isScrollable: true, splashColor: Colors.transparent, //
// highlightColor: Colors.transparent, //
indicatorColor: Color(0xff39B54A), ),
labelColor: Colors.black, child: TabBar(
labelStyle: TextStyle( controller: tabController,
fontSize: 18.sp, isScrollable: true,
fontWeight: FontWeight.bold, //
), indicatorColor: Color(0xff39B54A),
unselectedLabelStyle: TextStyle( labelColor: Colors.black,
fontSize: 15.sp, labelStyle: TextStyle(
fontWeight: FontWeight.normal, fontSize: 18.sp,
), fontWeight: FontWeight.bold,
// controller: tabController, ),
// unselectedLabelStyle: TextStyle(
unselectedLabelColor: Color(0xffA29E9E), fontSize: 15.sp,
indicatorSize: TabBarIndicatorSize.label, fontWeight: FontWeight.normal,
// ),
tabs: <Widget>[ // controller: tabController,
MyTab(text: S.of(context).quanbu), //
MyTab(text: ""), unselectedLabelColor: Color(0xffA29E9E),
MyTab(text: ""), indicatorSize: TabBarIndicatorSize.label,
MyTab(text: ""), //
], tabs: <Widget>[
), MyTab(text: S.of(context).quanbu),
)), MyTab(text: ""),
body: TabBarView( MyTab(text: ""),
controller: tabController, MyTab(text: ""),
children: [ ],
UnionList(refreshController, storeList,(){startLocation(true);}), )),
UnionList(refreshController1, storeList1,(){startLocation(true);}), )),
UnionList(refreshController2, storeList2,(){startLocation(true);}), body: TabBarView(
UnionList(refreshController3, storeList3,(){startLocation(true);}), controller: tabController,
], children: [
), UnionList(refreshController, storeList, () {
)); startLocation(true);
}),
UnionList(refreshController1, storeList1, () {
startLocation(true);
}),
UnionList(refreshController2, storeList2, () {
startLocation(true);
}),
UnionList(refreshController3, storeList3, () {
startLocation(true);
}),
],
),
));
// GestureDetector( // GestureDetector(
// onTap: () { // onTap: () {
// FocusScope.of(context).requestFocus(FocusNode()); // FocusScope.of(context).requestFocus(FocusNode());

2
pubspec.yaml

@ -3,7 +3,7 @@ description: 一心回乡.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 2.0.24+12 version: 2.0.25+13
environment: environment:
sdk: ">=2.7.0 <3.0.0" sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save