Browse Source

火锅店增加优惠券;

部分控件修改;
zyh
w-R 3 years ago
parent
commit
7c3246598e
  1. 12
      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. 23
      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. 29
      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. 13
      lib/order/exchange_history_page.dart
  15. 7
      lib/order/order_history_page.dart
  16. 5
      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. 88
      lib/settlement/settlement.dart
  21. 14
      lib/settlement/settlement_view/activity_coupon_remarks.dart
  22. 23
      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. 7
      lib/store/store_order.dart
  26. 105
      lib/union/union_page.dart
  27. 2
      pubspec.yaml

12
lib/community/community_page.dart

@ -17,7 +17,7 @@ class CommunityPage extends StatefulWidget {
}
class _CommunityPage extends State<CommunityPage>
with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
TabController tabcontroller;
CommunityChildPage guanzhu,tuijian ;
@ -83,6 +83,11 @@ class _CommunityPage extends State<CommunityPage>
MediaQuery.of(context).size.width - 60.w,
38.h,
),
child: Theme(
data: ThemeData(
splashColor: Colors.transparent, //
highlightColor: Colors.transparent, //
),
child: TabBar(
controller: tabcontroller,
automaticIndicatorColorAdjustment: true,
@ -102,7 +107,7 @@ class _CommunityPage extends State<CommunityPage>
),
labelColor: Colors.black,
tabs: lables.map((e) => MyTab(text: e)).toList(),
),
)),
),
// onTap: () {
// _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>
with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
TabController tabController;
@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>
with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
TabController tabcontroller;
List<String> lables = [
@ -42,7 +42,12 @@ class _OrderPage extends State<OrderPage>
appBar: MyAppBar(
title: "",
leading: false,
bottom: TabBar(
bottom: Theme(
data: ThemeData(
splashColor: Colors.transparent, //
highlightColor: Colors.transparent, //
),
child: TabBar(
// isScrollable: true, //
indicatorColor: Color(0xff39B54A),
labelColor: Colors.black,
@ -65,7 +70,7 @@ class _OrderPage extends State<OrderPage>
MyTab(text: S.of(context).weiwancheng),
MyTab(text: S.of(context).yiwancheng),
],
),
)),
),
body: TabBarView(
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;
List<String> sortString = [
S.current.morenpaixu,
@ -162,4 +163,7 @@ class _PointsGoodsTitle extends State<PointsGoodsTitle> {
_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;
final ScrollController scrollController = ScrollController();
final RefreshController refreshController = RefreshController();
@ -582,4 +582,7 @@ class _WelfareExchange extends State<WelfareExchange> {
return "${AppUtils.calculateDouble(double.tryParse(goods.oneMoney) ?? 0)}";
}
}
@override
bool get wantKeepAlive => true;
}

23
lib/integral/integral_detailed_page.dart

@ -25,7 +25,7 @@ class IntegralDetailedPage extends StatefulWidget {
}
class _IntegralDetailedPage extends State<IntegralDetailedPage>
with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
List<Widget> _tabs;
TabController tabController;
@ -64,7 +64,8 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
void initState() {
super.initState();
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'))),
queryDetail("bill_cate_point_get"),
});
@ -182,20 +183,25 @@ class _IntegralDetailedPage extends State<IntegralDetailedPage>
expandedHeight: 228,
bottom: PreferredSize(
preferredSize: Size(double.infinity, 38),
child: Theme(
data: ThemeData(
splashColor: Colors.transparent, //
highlightColor: Colors.transparent, //
),
child: TabBar(
tabs: _tabs,
controller: tabController,
isScrollable: false,
indicatorSize: TabBarIndicatorSize.label,
labelColor: Colors.white,
labelStyle:
TextStyle(fontSize: 16.sp, fontWeight: MyFontWeight.medium),
unselectedLabelStyle:
TextStyle(fontSize: 16.sp,fontWeight: MyFontWeight.medium),
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();
Locale locale;
if (sharedPreferences.containsKey("language") &&
sharedPreferences.getString("language") == "zh") {
sharedPreferences.getString("language") == "tw") {
locale = Locale.fromSubtags(languageCode: 'zh', countryCode: 'TW');
} else {
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;
int pageNum = 1;
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;
ApiService apiService;
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>
with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
@override
Widget build(BuildContext context) {
return DefaultTabController(
@ -57,4 +57,7 @@ class _MineCardPage extends State<MineCardPage>
),
);
}
@override
bool get wantKeepAlive => true;
}

29
lib/mine/mine_view/community_follow.dart

@ -21,7 +21,7 @@ class CommunityFollow extends StatefulWidget {
}
class _CommunityFollow extends State<CommunityFollow>
with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin {
ApiService apiService;
SocialInfo infoNumber;
@ -34,12 +34,8 @@ class _CommunityFollow extends State<CommunityFollow>
///(//)
querySocialInfo() async {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
showLoading: true
);
apiService = ApiService(Dio(),
context: context, token: value.getString("token"), showLoading: true);
BaseData<SocialInfo> baseData =
await apiService.socialInfo().catchError((onError) {});
@ -51,7 +47,6 @@ class _CommunityFollow extends State<CommunityFollow>
EasyLoading.dismiss();
}
@override
Widget build(BuildContext context) {
return DefaultTabController(
@ -81,15 +76,27 @@ class _CommunityFollow extends State<CommunityFollow>
indicatorSize: TabBarIndicatorSize.label,
//
tabs: <Widget>[
MyTab(text:"关注${infoNumber?.follow??"0"}",),
MyTab(text: "粉丝${infoNumber?.fans??"0"}"),
MyTab(
text: "关注${infoNumber?.follow ?? "0"}",
),
MyTab(text: "粉丝${infoNumber?.fans ?? "0"}"),
],
),
),
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(
children: [
Text(
"${S.of(context).guanzhu} ${widget?.infoNumber?.follow.toString() ?? "0"}",
"${S.of(context).guanzhu} ${widget?.infoNumber?.follow ?? "0"}",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
@ -342,7 +342,7 @@ class _MineView extends State<MineView> {
color: Color(0xFFFFFFFF),
),
Text(
"${S.of(context).fensi} ${widget?.infoNumber?.fans.toString() ?? "0"}",
"${S.of(context).fensi} ${widget?.infoNumber?.fans ?? "0"}",
style: TextStyle(
fontSize: 12.sp,
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;
List<ActivityOrderList> activityOrderList = [];
RefreshController _refreshController = RefreshController(initialRefresh: false);
@ -473,4 +473,7 @@ class _ExchangeHistoryList extends State<ExchangeHistoryList> {
),
);
}
@override
bool get wantKeepAlive => true;
}

13
lib/order/exchange_history_page.dart

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

7
lib/order/order_history_page.dart

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

5
lib/retrofit/data/min_order_info.dart

@ -50,6 +50,7 @@ class MinOrderInfo {
dynamic payNum,
String promotionId,
String couponId,
String couponName,
int isDelete,
int isTakeOut,
int batch,
@ -131,6 +132,7 @@ class MinOrderInfo {
this.payNum = payNum;
this.promotionId = promotionId;
this.couponId = couponId;
this.couponName = couponName;
this.isDelete = isDelete;
this.isTakeOut = isTakeOut;
this.batch = batch;
@ -215,6 +217,7 @@ class MinOrderInfo {
this.payNum = json['payNum'];
this.promotionId = json['promotionId'];
this.couponId = json['couponId'];
this.couponName = json['couponName'];
this.isDelete = json['isDelete'];
this.isTakeOut = json['isTakeOut'];
this.batch = json['batch'];
@ -302,6 +305,7 @@ class MinOrderInfo {
dynamic payNum;
String promotionId;
String couponId;
String couponName;
int isDelete;
int isTakeOut;
int batch;
@ -386,6 +390,7 @@ class MinOrderInfo {
map['payNum'] = this.payNum;
map['promotionId'] = this.promotionId;
map['couponId'] = this.couponId;
map['couponName'] = this.couponName;
map['isDelete'] = this.isDelete;
map['isTakeOut'] = this.isTakeOut;
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/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/address.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/wx_pay.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
@ -247,4 +245,12 @@ abstract class MinApiService {
@GET("actTemplate/showOneAct?actRecordId={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);
final value = BaseData<SettleOrderInfo>.fromJson(
_result.data,
(json) => SettleOrderInfo.fromJson(json),
(json) => json == "" ? null :SettleOrderInfo.fromJson(json),
);
return value;
}
@ -605,4 +605,49 @@ class _MinApiService implements MinApiService {
);
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(
S.of(context).yuyan,
locale == "zh"
? S.of(context).zhongwenjianti
: S.of(context).fantizhongwen),
locale == "tw"
? S.of(context).fantizhongwen
: S.of(context).zhongwenjianti),
),
GestureDetector(
child: settingSingleItem(S.of(context).quanxian),

88
lib/settlement/settlement.dart

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

14
lib/settlement/settlement_view/activity_coupon_remarks.dart

@ -1,5 +1,6 @@
import 'package:flutter/material.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/store_info.dart';
import 'package:huixiang/utils/font_weight.dart';
@ -13,6 +14,7 @@ class ActivityCouponRemarks extends StatefulWidget {
final String coupons;
final String promotions;
final SettleOrderInfo settleOrderInfo;
final MinOrderInfo minOrderInfo;
final int couponCount;
final bool placeOrder;
final String remark;
@ -22,6 +24,7 @@ class ActivityCouponRemarks extends StatefulWidget {
this.couponCart,
this.activityCart,
this.settleOrderInfo,
this.minOrderInfo,
this.coupons,
this.promotions,
this.couponCount,
@ -136,11 +139,11 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
],
),
),
if (widget.placeOrder && widget.tableId <=0)
if (widget.placeOrder)
SizedBox(
height: 13,
),
if (widget.placeOrder && widget.tableId <=0)
if (widget.placeOrder)
InkWell(
onTap: () {
widget.couponCart();
@ -242,6 +245,13 @@ class _ActivityCouponRemarks extends State<ActivityCouponRemarks> {
String coupon = "";
if (widget.coupons == null || widget.coupons == "") {
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 ||
widget.settleOrderInfo.couponList == null) {
coupon = "暂无可选优惠券";

23
lib/settlement/settlement_view/settlement_coupon.dart

@ -1,4 +1,5 @@
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/store_info.dart';
import 'package:huixiang/settlement/settlement_view/coupon.dart';
@ -7,11 +8,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class SettlementCoupon extends StatefulWidget {
final StoreInfo storeInfo;
final MinOrderInfo minOrderInfo;
final int tableId;
final SettleOrderInfo settleOrderInfo;
final CouponListBean couponBean;
SettlementCoupon(
this.settleOrderInfo,
this.minOrderInfo,
this.tableId,
this.storeInfo, {
this.couponBean,
});
@ -33,6 +38,20 @@ class _SettlementCoupon extends State<SettlementCoupon> {
couponCan.clear();
couponNo.clear();
if(widget.tableId > 0){
if (widget.minOrderInfo != null &&
widget.minOrderInfo.orderInfoVo.couponList != null &&
widget.minOrderInfo.orderInfoVo.couponList.length > 0) {
widget.minOrderInfo.orderInfoVo.couponList.forEach((element) {
if (element["usable"]) {
couponCan.add(CouponListBean.fromJson(element));
} else {
couponNo.add(CouponListBean.fromJson(element));
}
});
setState(() {});
}
}else{
if (widget.settleOrderInfo != null &&
widget.settleOrderInfo.couponList != null &&
widget.settleOrderInfo.couponList.length > 0) {
@ -47,6 +66,10 @@ class _SettlementCoupon extends State<SettlementCoupon> {
}
}
}
@override
Widget build(BuildContext context) {
return StatefulBuilder(

4
lib/settlement/settlement_view/settlement_order_commodity.dart

@ -398,7 +398,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
String discountPrice(){
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){
return "0";
}else {
@ -409,7 +409,7 @@ class _SettlementOrderCommodity extends State<SettlementOrderCommodity> {
String totalPrice() {
if (widget.minOrderInfo != null &&
widget.minOrderInfo.orderProductVOList != null) {
return "${widget.minOrderInfo.orderSumPrice}";
return "${widget.minOrderInfo.finalPayPrice}";
}
if (widget.settleOrderInfo.orderProductList == null) return "";
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>
with SingleTickerProviderStateMixin {
with SingleTickerProviderStateMixin,AutomaticKeepAliveClientMixin {
TabController tabController;
@override
@ -62,4 +62,6 @@ class _ClassTitleTab extends State<ShoppingTitleTab>
);
}
@override
bool get wantKeepAlive => true;
}

7
lib/store/store_order.dart

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

105
lib/union/union_page.dart

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

2
pubspec.yaml

@ -3,7 +3,7 @@ description: 一心回乡.
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:
sdk: ">=2.7.0 <3.0.0"

Loading…
Cancel
Save