Browse Source

safety

master
fmk 3 years ago
parent
commit
b5839dd08a
  1. 26
      lib/mine/mine_page.dart
  2. 62
      lib/order/order_detail_page.dart
  3. 83
      lib/order/order_history_page.dart
  4. 84
      lib/order/order_utils.dart
  5. 2
      lib/order/order_view/order_address.dart
  6. 147
      lib/order/order_view/order_pay_selected.dart
  7. 125
      lib/qr/qr_code_scan.dart
  8. 1431
      lib/retrofit/data/order_info.dart
  9. 855
      lib/retrofit/data/order_product_vo.dart
  10. 49
      lib/retrofit/data/store_info.dart
  11. 8
      lib/retrofit/min_api.dart
  12. 44
      lib/retrofit/min_api.g.dart
  13. 8
      lib/retrofit/retrofit_api.dart
  14. 2
      lib/retrofit/retrofit_api.g.dart
  15. 73
      lib/settlement/settlement.dart
  16. 453
      lib/store/store_order.dart
  17. 139
      lib/store/store_view/people_num.dart
  18. 21
      lib/store/store_view/store_activity.dart
  19. 108
      lib/store/store_view/store_order_list.dart
  20. 80
      lib/union/union_page.dart
  21. 23
      lib/view_widget/no_data_view.dart
  22. 6
      pubspec.lock
  23. 4
      pubspec.yaml

26
lib/mine/mine_page.dart

@ -51,8 +51,7 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
if (_refreshController != null) if (_refreshController != null) _refreshController.dispose();
_refreshController.dispose();
} }
@override @override
@ -62,12 +61,10 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
eventBus.on<EventType>().listen((event) { eventBus.on<EventType>().listen((event) {
print("EventType: ${event.type}"); print("EventType: ${event.type}");
if (event.type < 3) { if (event.type < 3) {
if (mounted) if (mounted) setState(() {});
setState(() {});
} }
if (event.type == 3) { if (event.type == 3) {
if (mounted) if (mounted) setState(() {});
setState(() {});
} }
}); });
} }
@ -81,8 +78,12 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
value.getString('user') != "") { value.getString('user') != "") {
userInfo = UserInfo.fromJson(jsonDecode(value.getString('user'))); userInfo = UserInfo.fromJson(jsonDecode(value.getString('user')));
} }
apiService = ApiService(Dio(), apiService = ApiService(
context: context, token: value.getString('token'), showLoading: false); Dio(),
context: context,
token: value.getString('token'),
showLoading: false,
);
BaseData<List<Rank>> rankData = BaseData<List<Rank>> rankData =
await apiService.rankList().catchError((onError) { await apiService.rankList().catchError((onError) {
@ -208,7 +209,6 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
); );
} }
/// ///
Widget buildNotice() { Widget buildNotice() {
return Container( return Container(
@ -283,11 +283,11 @@ class _MinePage extends State<MinePage> with AutomaticKeepAliveClientMixin {
} }
///// /////
Widget attention(){ Widget attention() {
return Container( return Container(
margin: EdgeInsets.only(left: 16,right: 17,top: 10), margin: EdgeInsets.only(left: 16, right: 17, top: 10),
child:GestureDetector( child: GestureDetector(
onTap:(){ onTap: () {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/communityFollow', '/router/communityFollow',
arguments: {}, arguments: {},

62
lib/order/order_detail_page.dart

@ -1,21 +1,28 @@
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/order/order_view/order_address.dart'; import 'package:huixiang/order/order_view/order_address.dart';
import 'package:huixiang/order/order_view/order_commodity.dart'; import 'package:huixiang/order/order_view/order_commodity.dart';
import 'package:huixiang/order/order_view/order_info.dart'; import 'package:huixiang/order/order_view/order_info.dart';
import 'package:huixiang/order/order_view/order_pay_selected.dart';
import 'package:huixiang/order/order_view/order_status.dart'; import 'package:huixiang/order/order_view/order_status.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/retrofit/data/placeOrderFirst.dart'; import 'package:huixiang/retrofit/data/placeOrderFirst.dart';
import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/settlement/settlement_view/pay_method.dart';
import 'package:huixiang/utils/min.dart';
import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'order_utils.dart';
class OrderDetailPage extends StatefulWidget { class OrderDetailPage extends StatefulWidget {
final arguments; final arguments;
@ -41,22 +48,20 @@ class _OrderDetailPage extends State<OrderDetailPage> {
context: context, context: context,
token: value.getString("token"), token: value.getString("token"),
); );
minLogin();
queryDetails(); queryDetails();
}); });
} }
/// ///
minLogin() async { minLogin() async {
apiService apiService.minLogin(orderInfo.storeId)
.minLogin(widget.arguments["id"]) .catchError((onError) {debugPrint(onError);})
.catchError((onError) {})
.then((baseData) { .then((baseData) {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
Map<String, dynamic> minStoreInfo = baseData.data; Map<String, dynamic> minStoreInfo = baseData.data;
String minToken = minStoreInfo["token"]; String minToken = minStoreInfo["token"];
String tenant = widget.arguments["tenant"]; String tenant = orderInfo.tenantCode;
String storeId = widget.arguments["id"]; String storeId = orderInfo.storeId;
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => { (value) => {
value.setString('minToken', minToken), value.setString('minToken', minToken),
@ -82,8 +87,6 @@ class _OrderDetailPage extends State<OrderDetailPage> {
int isTakeOut = 0; int isTakeOut = 0;
int refundStatus = 0; int refundStatus = 0;
// String storeType = "NORMALSTORE"; //NORMALSTORE FASTSTORE RETAILSTORE
queryDetails() async { queryDetails() async {
BaseData<OrderInfo> baseData = await apiService BaseData<OrderInfo> baseData = await apiService
.orderDetail(widget.arguments["id"]) .orderDetail(widget.arguments["id"])
@ -101,6 +104,8 @@ class _OrderDetailPage extends State<OrderDetailPage> {
print("order orderStatus: $orderStatus"); print("order orderStatus: $orderStatus");
print("order sendStatus: $sendStatus"); print("order sendStatus: $sendStatus");
print("order isTakeOut: $isTakeOut"); print("order isTakeOut: $isTakeOut");
minLogin();
if (mounted) if (mounted)
setState(() { setState(() {
statusTitle(); statusTitle();
@ -162,7 +167,7 @@ class _OrderDetailPage extends State<OrderDetailPage> {
refundStatus, refundStatus,
title, title,
center, center,
carryOnPay, paySelected,
_orderCancel, _orderCancel,
orderInfo, orderInfo,
), ),
@ -194,34 +199,17 @@ class _OrderDetailPage extends State<OrderDetailPage> {
String title = ""; String title = "";
String center = ""; String center = "";
carryOnPay() { paySelected() async {
PlaceOrderFirst placeOrderFirst = PlaceOrderFirst(); var payChannel = await showModalBottomSheet(
placeOrderFirst.addressId = orderInfo.addressExt.addressId; context: context,
placeOrderFirst.isSubscribe = orderInfo.isSubscribe; backgroundColor: Colors.transparent,
placeOrderFirst.isTakeOut = orderInfo.isTakeOut; builder: (context) {
placeOrderFirst.notes = orderInfo.notes; return OrderPaySelected();
placeOrderFirst.id = orderInfo.id; },
placeOrderFirst.orderProductVOList = orderInfo.orderDetail.orderProductList; );
placeOrderFirst.numberOfPeople = "0"; if (payChannel != null && payChannel > 0) {
placeOrderFirst.orderSource = orderInfo.orderSource; OrderUtils.carryOnPay(payChannel, minService, orderInfo, queryDetails);
placeOrderFirst.orderType = orderInfo.orderType; }
placeOrderFirst.orderTypeId = 0;
placeOrderFirst.parentCode = orderInfo.parentCode; //
placeOrderFirst.parentId = orderInfo.parentId; //
placeOrderFirst.payChannel = orderInfo.payChannel;
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
placeOrderFirst.promotionInfoDTO.promotionId = orderInfo.promotionId;
placeOrderFirst.promotionInfoDTO.couponId = orderInfo.couponId;
placeOrderFirst.recMobile = "";
placeOrderFirst.shoppingCartSkuItemList = [];
placeOrderFirst.skuItemDTOList = [];
placeOrderFirst.source = 1;
placeOrderFirst.storeId = orderInfo.storeId;
placeOrderFirst.subcribeTime = null;
placeOrderFirst.tableId = orderInfo.tableId;
} }
statusTitle() { statusTitle() {

83
lib/order/order_history_page.dart

@ -2,11 +2,14 @@ import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.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/order/order_utils.dart';
import 'package:huixiang/order/order_view/order_pay_selected.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/retrofit/data/order_product_vo.dart'; import 'package:huixiang/retrofit/data/order_product_vo.dart';
import 'package:huixiang/retrofit/data/page.dart'; import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/data/product.dart'; import 'package:huixiang/retrofit/data/product.dart';
import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/status_utils.dart'; import 'package:huixiang/utils/status_utils.dart';
import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/classic_header.dart';
@ -21,7 +24,6 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
class OrderHistoryPage extends StatefulWidget { class OrderHistoryPage extends StatefulWidget {
final Map arguments; final Map arguments;
OrderHistoryPage({this.arguments}); OrderHistoryPage({this.arguments});
@ -41,7 +43,8 @@ class _OrderHistoryPage extends State<OrderHistoryPage>
void didChangeDependencies() { void didChangeDependencies() {
super.didChangeDependencies(); super.didChangeDependencies();
if (tabController == null) if (tabController == null)
tabController = TabController(initialIndex: widget.arguments["status"], length: 4, vsync: this); tabController = TabController(
initialIndex: widget.arguments["status"], length: 4, vsync: this);
_pages = [ _pages = [
OrderHistoryList(0), OrderHistoryList(0),
@ -226,7 +229,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
offset: Offset(0, 1), offset: Offset(0, 1),
blurRadius: 12, blurRadius: 12,
spreadRadius: 0, spreadRadius: 0,
) ),
], ],
), ),
child: Column( child: Column(
@ -455,26 +458,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
} else if (type == 2) { } else if (type == 2) {
orderCancel(orderInfo.id); orderCancel(orderInfo.id);
} else if (type == 3) { } else if (type == 3) {
SmartDialog.show( minLogin(orderInfo);
widget: Tips(
() {
SmartDialog.dismiss();
},
text: "暂不支持此功能",
));
orderInfo.tenantCode;
orderInfo.id;
///
// Map param = {
// "id": orderInfo.id,
// "orderProductVOList": orderInfo
// .orderDetail.orderProductList
// .map((e) => e.toJson())
// .toList(),
// "payChannel": 1,
// "orderType": 0
// };
// toPay(param);
} else if (type == 4) { } else if (type == 4) {
Navigator.of(context).pushNamed( Navigator.of(context).pushNamed(
'/router/logistics_information_page', '/router/logistics_information_page',
@ -500,12 +484,53 @@ class _OrderHistoryList extends State<OrderHistoryList>
); );
} }
toPay(Map param) async { minLogin(OrderInfo orderInfo) {
apiService.settlement(param).catchError((error) { apiService.minLogin(orderInfo.storeId).catchError((onError) {
debugPrint(onError);
}).then((baseData) {
if (baseData != null && baseData.isSuccess) {
Map<String, dynamic> minStoreInfo = baseData.data;
String minToken = minStoreInfo["token"];
String tenant = orderInfo.tenantCode;
String storeId = orderInfo.storeId;
SharedPreferences.getInstance().then(
(value) => {
value.setString('minToken', minToken),
value.setString('tenant', tenant),
value.setString('storeId', storeId),
},
);
paySelected(
orderInfo,
MinApiService(
Dio(),
context: context,
token: minToken,
tenant: tenant,
storeId: storeId,
));
}
}); });
} }
paySelected(OrderInfo orderInfo, MinApiService minService) async {
var payChannel = await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return OrderPaySelected();
},
);
if (payChannel != null && payChannel > 0) {
OrderUtils.carryOnPay(payChannel, minService, orderInfo, () {
SmartDialog.showToast("订单支付成功");
Future.delayed(Duration(seconds: 1), () {
_onRefresh();
});
});
}
}
orderCancel(String orderId) async { orderCancel(String orderId) async {
BaseData baseData = await apiService.orderCancel(orderId); BaseData baseData = await apiService.orderCancel(orderId);
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
@ -515,8 +540,10 @@ class _OrderHistoryList extends State<OrderHistoryList>
} }
aginOrder(storeId) { aginOrder(storeId) {
Navigator.of(context) Navigator.of(context).pushNamed(
.pushNamed('/router/union_detail_page', arguments: {"id": storeId}); '/router/union_detail_page',
arguments: {"id": storeId},
);
} }
String totalPrice(orderInfo) { String totalPrice(orderInfo) {

84
lib/order/order_utils.dart

@ -0,0 +1,84 @@
import 'package:fluwx/fluwx.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/order_info.dart';
import 'package:huixiang/retrofit/data/placeOrderFirst.dart';
import 'package:huixiang/retrofit/data/wx_pay.dart';
import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/utils/min.dart';
class OrderUtils {
static carryOnPay(payChannel, MinApiService minService, OrderInfo orderInfo, Function queryDetails) async {
PlaceOrderFirst placeOrderFirst = PlaceOrderFirst();
placeOrderFirst.addressId = orderInfo.addressExt.addressId;
placeOrderFirst.isSubscribe = orderInfo.isSubscribe;
placeOrderFirst.isTakeOut = orderInfo.isTakeOut;
placeOrderFirst.notes = orderInfo.notes;
placeOrderFirst.id = orderInfo.id;
placeOrderFirst.orderProductVOList = orderInfo.orderDetail.orderProductList;
placeOrderFirst.numberOfPeople = "0";
placeOrderFirst.orderSource = orderInfo.orderSource;
placeOrderFirst.orderType = "${orderInfo.orderType}";
placeOrderFirst.orderTypeId = 0;
placeOrderFirst.parentCode = orderInfo.parentCode; //
placeOrderFirst.parentId = orderInfo.parentId; //
placeOrderFirst.payChannel = payChannel;
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
placeOrderFirst.promotionInfoDTO.promotionId = orderInfo.promotionId;
placeOrderFirst.promotionInfoDTO.couponId = orderInfo.couponId;
placeOrderFirst.recMobile = "";
placeOrderFirst.shoppingCartSkuItemList = [];
placeOrderFirst.skuItemDTOList = [];
placeOrderFirst.source = 1;
placeOrderFirst.storeId = orderInfo.storeId;
placeOrderFirst.subcribeTime = null;
placeOrderFirst.tableId = orderInfo.tableId;
if (placeOrderFirst.payChannel == 1) {
if (!(await Min.isInitialize())) {
// app的充值支付使用同一个WXPayEntryActivity回调
// getPackage空指针
//
await Min.initialize();
}
BaseData<WxPay> baseData = await minService
.settlementWx(placeOrderFirst.toJson())
.catchError((error) {});
if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data;
await registerWxApi(
appId: wxPay.appId,
doOnAndroid: true,
universalLink: "https://hx.lotus-wallet.com/app/",
);
payWithWeChat(
appId: wxPay.appId,
partnerId: wxPay.partnerId,
prepayId: wxPay.prepayId,
packageValue: wxPay.packageValue,
nonceStr: wxPay.nonceStr,
timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign,
);
weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
queryDetails();
});
}
} else {
BaseData baseData = await minService
.settlementApi(placeOrderFirst.toJson())
.catchError((error) {});
if (baseData != null && baseData.isSuccess) {
queryDetails();
}
}
}
}

2
lib/order/order_view/order_address.dart

@ -19,7 +19,7 @@ class OrderAddress extends StatefulWidget {
final String title; final String title;
final String center; final String center;
final Function orderCancel; final Function orderCancel;
final Function carryOnPay; final Function() carryOnPay;
final OrderInfo orderInfo; final OrderInfo orderInfo;
OrderAddress( OrderAddress(

147
lib/order/order_view/order_pay_selected.dart

@ -0,0 +1,147 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';
class OrderPaySelected extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _OrderPaySelected();
}
}
class _OrderPaySelected extends State<OrderPaySelected> {
@override
Widget build(BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return Container(
width: double.infinity,
height: 200,
padding: EdgeInsets.only(
left: 16.w,
right: 16.w,
top: 20.h,
bottom: 20.h,
),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
color: Color(0x000000).withAlpha(25),
offset: Offset(0, 1),
blurRadius: 12.0,
),
],
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(bottom: 16.h),
child: Text(
S.of(context).zhifufangshi,
style: TextStyle(
fontSize: 16.sp,
color: Colors.black,
fontWeight: MyFontWeight.regular,
),
),
),
GestureDetector(
onTap: () {
Navigator.of(context).pop(4);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).pingtaiyue,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
fontWeight: MyFontWeight.semi_bold,),
),
checkView(1),
],
),
),
SizedBox(
height: 10,
),
GestureDetector(
onTap: () {
Navigator.of(context).pop(3);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).dianpuyue,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
fontWeight: MyFontWeight.semi_bold,
),
),
checkView(2),
],
),
),
SizedBox(
height: 10,
),
GestureDetector(
onTap: () {
Navigator.of(context).pop(1);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Image.asset("assets/image/icon_we_chat.png"),
Padding(
padding: EdgeInsets.only(left: 8.w),
child: Text(
S.of(context).weixinzhifu,
style: TextStyle(
fontSize: 14.sp,
color: Color(0xff353535),
fontWeight: MyFontWeight.semi_bold,
),
),
),
checkView(3),
],
),
),
],
),
);
},
);
}
Widget checkView(var index) {
return Container(
padding: EdgeInsets.only(left: 16.w),
alignment: Alignment.center,
child: Image.asset(
/*checkIndex != index
? */"assets/image/icon_radio_unselected.png",
// : "assets/image/icon_radio_selected.png",
width: 15.w,
height: 15.h,
),
);
}
}

125
lib/qr/qr_code_scan.dart

@ -1,10 +1,10 @@
import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_qr_reader/flutter_qr_reader.dart'; import 'package:flutter_scankit/scan_kit_widget.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/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/tips_dialog.dart';
import 'package:image_pickers/image_pickers.dart'; import 'package:image_pickers/image_pickers.dart';
import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler/permission_handler.dart';
@ -16,18 +16,14 @@ class QrCodeScanPage extends StatefulWidget {
} }
class _QrCodeScanPage extends State<QrCodeScanPage> { class _QrCodeScanPage extends State<QrCodeScanPage> {
GlobalKey<_QrCodeScanPage> qrViewKey = GlobalKey();
QrReaderViewController viewController; ScanKitController _controller;
final screenWidth = window.physicalSize.width;
final screenHeight = window.physicalSize.height;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
readerHeight = 812;
Future.delayed(Duration(seconds: 1), () {
buildReaderView();
});
} }
@override @override
@ -37,20 +33,24 @@ class _QrCodeScanPage extends State<QrCodeScanPage> {
child: Stack( child: Stack(
children: [ children: [
Positioned( Positioned(
child: qrReaderView != null child: Column(
? Column( children: [
children: [ Expanded(
Expanded( child: ScanKitWidget(
child: qrReaderView, callback: (controller) {
flex: readerHeight.toInt(), _controller = controller;
), controller.onResult.listen((result) {
// Expanded(child: qrReaderView, flex: readerHeight,), debugPrint("scanning result:$result");
], Navigator.of(context).pop(result);
) });
: Container( },
width: MediaQuery.of(context).size.width, continuouslyScan: false,
height: MediaQuery.of(context).size.height, boundingBox: Rect.fromLTRB(0, 0, screenWidth, screenHeight),
), ),
flex: 1,
),
],
),
top: 0, top: 0,
bottom: 0, bottom: 0,
left: 0, left: 0,
@ -68,12 +68,12 @@ class _QrCodeScanPage extends State<QrCodeScanPage> {
margin: EdgeInsets.only(right: 16.w), margin: EdgeInsets.only(right: 16.w),
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
openStorage(); _controller.pickPhoto();
}, },
child: Text( child: Text(
S.of(context).xiangce, S.of(context).xiangce,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.black,
fontSize: 18.sp, fontSize: 18.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
@ -91,80 +91,11 @@ class _QrCodeScanPage extends State<QrCodeScanPage> {
); );
} }
QrReaderView qrReaderView;
double readerHeight;
buildReaderView() async {
double screenWidth = MediaQuery.of(context).size.width;
readerHeight = 1920.0 / 1080.0 * screenWidth;
print("object: $readerHeight");
qrReaderView = await QrReaderView(
key: qrViewKey,
callback: onScan,
width: MediaQuery.of(context).size.width,
height: readerHeight,
);
setState(() {});
}
///
openStorage() async {
if (await Permission.storage.isGranted) {
List<Media> medias = await ImagePickers.pickerPaths(
galleryMode: GalleryMode.image,
selectCount: 1,
showGif: true,
showCamera: false,
compressSize: 500,
uiConfig: UIConfig(
uiThemeColor: Color(0xFFFFFFFF),
),
cropConfig: CropConfig(
enableCrop: true,
width: 200,
height: 200,
),
);
if (medias == null || medias.length == 0) return;
String filePath = medias[0].path;
final String data = await FlutterQrReader.imgScan(filePath);
showData(data);
} else {
await Permission.storage.request();
openStorage();
}
}
void _startCameraResult(String data, List<Offset> offset) {
showData(data);
this.viewController.stopCamera();
}
Future onScan(QrReaderViewController viewController) async {
this.viewController = viewController;
await this.viewController.startCamera(_startCameraResult);
}
showData(String data) {
SmartDialog.show(
widget: Tips(
() {},
text: "$data",
),
onDismiss: () {
Future.delayed(Duration(seconds: 1), () {
this.viewController.startCamera(_startCameraResult);
});
},
);
}
@override @override
void dispose() { void dispose() {
if (this.viewController != null) { // if (this._controller != null) {
this.viewController.stopCamera(); // this._controller.dispose();
} // }
super.dispose(); super.dispose();
} }
} }

1431
lib/retrofit/data/order_info.dart

File diff suppressed because it is too large Load Diff

855
lib/retrofit/data/order_product_vo.dart

@ -1,193 +1,113 @@
class OrderProductVOList { class OrderProductVOList {
OrderProductVOList({ OrderProductVOList({
ActInfo actInfo, ActInfo actInfo,
AdditionalComment additionalComment, AdditionalComment additionalComment,
int buyNum, int buyNum,
int canApplyIntervention, String canApplyIntervention,
Comment comment, Comment comment,
int commentStatus, String commentStatus,
int discountAmount, String discountAmount,
int id, String id,
int productId, String productId,
String productName, String productName,
String returnCode, String returnCode,
int returnStatus, String returnStatus,
int returnType, String returnType,
int sellPrice, String sellPrice,
String skuId, String skuId,
String skuImg, String skuImg,
String skuNameStr,}){ String skuNameStr,
_actInfo = actInfo; }) {
_additionalComment = additionalComment; this.actInfo = actInfo;
_buyNum = buyNum; this.additionalComment = additionalComment;
_canApplyIntervention = canApplyIntervention; this.buyNum = buyNum;
_comment = comment; this.canApplyIntervention = canApplyIntervention;
_commentStatus = commentStatus; this.comment = comment;
_discountAmount = discountAmount; this.commentStatus = commentStatus;
_id = id; this.discountAmount = discountAmount;
_productId = productId; this.id = id;
_productName = productName; this.productId = productId;
_returnCode = returnCode; this.productName = productName;
_returnStatus = returnStatus; this.returnCode = returnCode;
_returnType = returnType; this.returnStatus = returnStatus;
_sellPrice = sellPrice; this.returnType = returnType;
_skuId = skuId; this.sellPrice = sellPrice;
_skuImg = skuImg; this.skuId = skuId;
_skuNameStr = skuNameStr; this.skuImg = skuImg;
this.skuNameStr = skuNameStr;
} }
OrderProductVOList.fromJson(dynamic json) { OrderProductVOList.fromJson(dynamic json) {
_actInfo = json['actInfo'] != null ? ActInfo.fromJson(json['actInfo']) : null; this.actInfo =
_additionalComment = json['additionalComment'] != null ? AdditionalComment.fromJson(json['additionalComment']) : null; json['actInfo'] != null ? ActInfo.fromJson(json['actInfo']) : null;
_buyNum = json['buyNum']; this.additionalComment = json['additionalComment'] != null
_canApplyIntervention = json['canApplyIntervention']; ? AdditionalComment.fromJson(json['additionalComment'])
_comment = json['comment'] != null ? Comment.fromJson(json['comment']) : null; : null;
_commentStatus = json['commentStatus']; this.buyNum = json['buyNum'];
_discountAmount = json['discountAmount']; this.canApplyIntervention = json['canApplyIntervention'];
_id = json['id']; this.comment =
_productId = json['productId']; json['comment'] != null ? Comment.fromJson(json['comment']) : null;
_productName = json['productName']; this.commentStatus = json['commentStatus'];
_returnCode = json['returnCode']; this.discountAmount = json['discountAmount'];
_returnStatus = json['returnStatus']; this.id = json['id'];
_returnType = json['returnType']; this.productId = json['productId'];
_sellPrice = json['sellPrice']; this.productName = json['productName'];
_skuId = json['skuId']; this.returnCode = json['returnCode'];
_skuImg = json['skuImg']; this.returnStatus = json['returnStatus'];
_skuNameStr = json['skuNameStr']; this.returnType = json['returnType'];
} this.sellPrice = json['sellPrice'];
ActInfo _actInfo; this.skuId = json['skuId'];
AdditionalComment _additionalComment; this.skuImg = json['skuImg'];
int _buyNum; this.skuNameStr = json['skuNameStr'];
int _canApplyIntervention; }
Comment _comment;
int _commentStatus; ActInfo actInfo;
int _discountAmount; AdditionalComment additionalComment;
int _id; int buyNum;
int _productId; String canApplyIntervention;
String _productName; Comment comment;
String _returnCode; String commentStatus;
int _returnStatus; String discountAmount;
int _returnType; String id;
int _sellPrice; String productId;
String _skuId; String productName;
String _skuImg; String returnCode;
String _skuNameStr; String returnStatus;
String returnType;
ActInfo get actInfo => _actInfo; String sellPrice;
AdditionalComment get additionalComment => _additionalComment; String skuId;
int get buyNum => _buyNum; String skuImg;
int get canApplyIntervention => _canApplyIntervention; String skuNameStr;
Comment get comment => _comment;
int get commentStatus => _commentStatus;
int get discountAmount => _discountAmount;
int get id => _id;
int get productId => _productId;
String get productName => _productName;
String get returnCode => _returnCode;
int get returnStatus => _returnStatus;
int get returnType => _returnType;
int get sellPrice => _sellPrice;
String get skuId => _skuId;
String get skuImg => _skuImg;
String get skuNameStr => _skuNameStr;
set actInfo(ActInfo value) {
_actInfo = value;
}
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};
if (_actInfo != null) { if (this.actInfo != null) {
map['actInfo'] = _actInfo.toJson(); map['actInfo'] = this.actInfo.toJson();
} }
if (_additionalComment != null) { if (this.additionalComment != null) {
map['additionalComment'] = _additionalComment.toJson(); map['additionalComment'] = this.additionalComment.toJson();
} }
map['buyNum'] = _buyNum; map['buyNum'] = this.buyNum;
map['canApplyIntervention'] = _canApplyIntervention; map['canApplyIntervention'] = this.canApplyIntervention;
if (_comment != null) { if (this.comment != null) {
map['comment'] = _comment.toJson(); map['comment'] = this.comment.toJson();
} }
map['commentStatus'] = _commentStatus; map['commentStatus'] = this.commentStatus;
map['discountAmount'] = _discountAmount; map['discountAmount'] = this.discountAmount;
map['id'] = _id; map['id'] = this.id;
map['productId'] = _productId; map['productId'] = this.productId;
map['productName'] = _productName; map['productName'] = this.productName;
map['returnCode'] = _returnCode; map['returnCode'] = this.returnCode;
map['returnStatus'] = _returnStatus; map['returnStatus'] = this.returnStatus;
map['returnType'] = _returnType; map['returnType'] = this.returnType;
map['sellPrice'] = _sellPrice; map['sellPrice'] = this.sellPrice;
map['skuId'] = _skuId; map['skuId'] = this.skuId;
map['skuImg'] = _skuImg; map['skuImg'] = this.skuImg;
map['skuNameStr'] = _skuNameStr; map['skuNameStr'] = this.skuNameStr;
return map; return map;
} }
set additionalComment(AdditionalComment value) {
_additionalComment = value;
}
set buyNum(int value) {
_buyNum = value;
}
set canApplyIntervention(int value) {
_canApplyIntervention = value;
}
set comment(Comment value) {
_comment = value;
}
set commentStatus(int value) {
_commentStatus = value;
}
set discountAmount(int value) {
_discountAmount = value;
}
set id(int value) {
_id = value;
}
set productId(int value) {
_productId = value;
}
set productName(String value) {
_productName = value;
}
set returnCode(String value) {
_returnCode = value;
}
set returnStatus(int value) {
_returnStatus = value;
}
set returnType(int value) {
_returnType = value;
}
set sellPrice(int value) {
_sellPrice = value;
}
set skuId(String value) {
_skuId = value;
}
set skuImg(String value) {
_skuImg = value;
}
set skuNameStr(String value) {
_skuNameStr = value;
}
} }
/// couponDiscountAmount : 0 /// couponDiscountAmount : 0
@ -201,97 +121,58 @@ class OrderProductVOList {
class ActInfo { class ActInfo {
ActInfo({ ActInfo({
int couponDiscountAmount, String couponDiscountAmount,
int couponDiscountRate, int couponDiscountRate,
int couponId, String couponId,
int couponType, int couponType,
int discountAmount, String discountAmount,
int discountRate, int discountRate,
int promotionId, String promotionId,
int promotionType,}){ int promotionType,
_couponDiscountAmount = couponDiscountAmount; }) {
_couponDiscountRate = couponDiscountRate; this.couponDiscountAmount = couponDiscountAmount;
_couponId = couponId; this.couponDiscountRate = couponDiscountRate;
_couponType = couponType; this.couponId = couponId;
_discountAmount = discountAmount; this.couponType = couponType;
_discountRate = discountRate; this.discountAmount = discountAmount;
_promotionId = promotionId; this.discountRate = discountRate;
_promotionType = promotionType; this.promotionId = promotionId;
this.promotionType = promotionType;
} }
ActInfo.fromJson(dynamic json) { ActInfo.fromJson(dynamic json) {
_couponDiscountAmount = json['couponDiscountAmount']; this.couponDiscountAmount = json['couponDiscountAmount'];
_couponDiscountRate = json['couponDiscountRate']; this.couponDiscountRate = json['couponDiscountRate'];
_couponId = json['couponId']; this.couponId = json['couponId'];
_couponType = json['couponType']; this.couponType = json['couponType'];
_discountAmount = json['discountAmount']; this.discountAmount = json['discountAmount'];
_discountRate = json['discountRate']; this.discountRate = json['discountRate'];
_promotionId = json['promotionId']; this.promotionId = json['promotionId'];
_promotionType = json['promotionType']; this.promotionType = json['promotionType'];
} }
int _couponDiscountAmount;
int _couponDiscountRate; String couponDiscountAmount;
int _couponId; int couponDiscountRate;
int _couponType; String couponId;
int _discountAmount; int couponType;
int _discountRate; String discountAmount;
int _promotionId; int discountRate;
int _promotionType; String promotionId;
int promotionType;
int get couponDiscountAmount => _couponDiscountAmount;
int get couponDiscountRate => _couponDiscountRate;
int get couponId => _couponId;
int get couponType => _couponType;
int get discountAmount => _discountAmount;
int get discountRate => _discountRate;
int get promotionId => _promotionId;
int get promotionType => _promotionType;
set couponDiscountAmount(int value) {
_couponDiscountAmount = value;
}
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};
map['couponDiscountAmount'] = _couponDiscountAmount; map['couponDiscountAmount'] = this.couponDiscountAmount;
map['couponDiscountRate'] = _couponDiscountRate; map['couponDiscountRate'] = this.couponDiscountRate;
map['couponId'] = _couponId; map['couponId'] = this.couponId;
map['couponType'] = _couponType; map['couponType'] = this.couponType;
map['discountAmount'] = _discountAmount; map['discountAmount'] = this.discountAmount;
map['discountRate'] = _discountRate; map['discountRate'] = this.discountRate;
map['promotionId'] = _promotionId; map['promotionId'] = this.promotionId;
map['promotionType'] = _promotionType; map['promotionType'] = this.promotionType;
return map; return map;
} }
set couponDiscountRate(int value) {
_couponDiscountRate = value;
}
set couponId(int value) {
_couponId = value;
}
set couponType(int value) {
_couponType = value;
}
set discountAmount(int value) {
_discountAmount = value;
}
set discountRate(int value) {
_discountRate = value;
}
set promotionId(int value) {
_promotionId = value;
}
set promotionType(int value) {
_promotionType = value;
}
} }
class AdditionalComment { class AdditionalComment {
@ -313,180 +194,91 @@ class AdditionalComment {
int productId, int productId,
bool sensitiveFlag, bool sensitiveFlag,
int serviceStar, int serviceStar,
int storeId,}){ int storeId,
_bizType = bizType; }) {
_commentImgs = commentImgs; this.bizType = bizType;
_commentImgsFlag = commentImgsFlag; this.commentImgs = commentImgs;
_commentStar = commentStar; this.commentImgsFlag = commentImgsFlag;
_commentText = commentText; this.commentStar = commentStar;
_descStar = descStar; this.commentText = commentText;
_hideFlag = hideFlag; this.descStar = descStar;
_id = id; this.hideFlag = hideFlag;
_isDelete = isDelete; this.id = id;
_likeNum = likeNum; this.isDelete = isDelete;
_logisticsStar = logisticsStar; this.likeNum = likeNum;
_mid = mid; this.logisticsStar = logisticsStar;
_orderProductId = orderProductId; this.mid = mid;
_parentId = parentId; this.orderProductId = orderProductId;
_productId = productId; this.parentId = parentId;
_sensitiveFlag = sensitiveFlag; this.productId = productId;
_serviceStar = serviceStar; this.sensitiveFlag = sensitiveFlag;
_storeId = storeId; this.serviceStar = serviceStar;
this.storeId = storeId;
} }
AdditionalComment.fromJson(dynamic json) { AdditionalComment.fromJson(dynamic json) {
_bizType = json['bizType']; this.bizType = json['bizType'];
_commentImgs = json['commentImgs']; this.commentImgs = json['commentImgs'];
_commentImgsFlag = json['commentImgsFlag']; this.commentImgsFlag = json['commentImgsFlag'];
_commentStar = json['commentStar']; this.commentStar = json['commentStar'];
_commentText = json['commentText']; this.commentText = json['commentText'];
_descStar = json['descStar']; this.descStar = json['descStar'];
_hideFlag = json['hideFlag']; this.hideFlag = json['hideFlag'];
_id = json['id']; this.id = json['id'];
_isDelete = json['isDelete']; this.isDelete = json['isDelete'];
_likeNum = json['likeNum']; this.likeNum = json['likeNum'];
_logisticsStar = json['logisticsStar']; this.logisticsStar = json['logisticsStar'];
_mid = json['mid']; this.mid = json['mid'];
_orderProductId = json['orderProductId']; this.orderProductId = json['orderProductId'];
_parentId = json['parentId']; this.parentId = json['parentId'];
_productId = json['productId']; this.productId = json['productId'];
_sensitiveFlag = json['sensitiveFlag']; this.sensitiveFlag = json['sensitiveFlag'];
_serviceStar = json['serviceStar']; this.serviceStar = json['serviceStar'];
_storeId = json['storeId']; this.storeId = json['storeId'];
} }
int _bizType;
String _commentImgs; int bizType;
bool _commentImgsFlag; String commentImgs;
int _commentStar; bool commentImgsFlag;
String _commentText; int commentStar;
int _descStar; String commentText;
bool _hideFlag; int descStar;
int _id; bool hideFlag;
bool _isDelete; int id;
int _likeNum; bool isDelete;
int _logisticsStar; int likeNum;
int _mid; int logisticsStar;
int _orderProductId; int mid;
int _parentId; int orderProductId;
int _productId; int parentId;
bool _sensitiveFlag; int productId;
int _serviceStar; bool sensitiveFlag;
int _storeId; int serviceStar;
int storeId;
int get bizType => _bizType;
String get commentImgs => _commentImgs;
bool get commentImgsFlag => _commentImgsFlag;
int get commentStar => _commentStar;
String get commentText => _commentText;
int get descStar => _descStar;
bool get hideFlag => _hideFlag;
int get id => _id;
bool get isDelete => _isDelete;
int get likeNum => _likeNum;
int get logisticsStar => _logisticsStar;
int get mid => _mid;
int get orderProductId => _orderProductId;
int get parentId => _parentId;
int get productId => _productId;
bool get sensitiveFlag => _sensitiveFlag;
int get serviceStar => _serviceStar;
int get storeId => _storeId;
set bizType(int value) {
_bizType = value;
}
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};
map['bizType'] = _bizType; map['bizType'] = this.bizType;
map['commentImgs'] = _commentImgs; map['commentImgs'] = this.commentImgs;
map['commentImgsFlag'] = _commentImgsFlag; map['commentImgsFlag'] = this.commentImgsFlag;
map['commentStar'] = _commentStar; map['commentStar'] = this.commentStar;
map['commentText'] = _commentText; map['commentText'] = this.commentText;
map['descStar'] = _descStar; map['descStar'] = this.descStar;
map['hideFlag'] = _hideFlag; map['hideFlag'] = this.hideFlag;
map['id'] = _id; map['id'] = this.id;
map['isDelete'] = _isDelete; map['isDelete'] = this.isDelete;
map['likeNum'] = _likeNum; map['likeNum'] = this.likeNum;
map['logisticsStar'] = _logisticsStar; map['logisticsStar'] = this.logisticsStar;
map['mid'] = _mid; map['mid'] = this.mid;
map['orderProductId'] = _orderProductId; map['orderProductId'] = this.orderProductId;
map['parentId'] = _parentId; map['parentId'] = this.parentId;
map['productId'] = _productId; map['productId'] = this.productId;
map['sensitiveFlag'] = _sensitiveFlag; map['sensitiveFlag'] = this.sensitiveFlag;
map['serviceStar'] = _serviceStar; map['serviceStar'] = this.serviceStar;
map['storeId'] = _storeId; map['storeId'] = this.storeId;
return map; return map;
} }
set commentImgs(String value) {
_commentImgs = value;
}
set commentImgsFlag(bool value) {
_commentImgsFlag = value;
}
set commentStar(int value) {
_commentStar = value;
}
set commentText(String value) {
_commentText = value;
}
set descStar(int value) {
_descStar = value;
}
set hideFlag(bool value) {
_hideFlag = value;
}
set id(int value) {
_id = value;
}
set isDelete(bool value) {
_isDelete = value;
}
set likeNum(int value) {
_likeNum = value;
}
set logisticsStar(int value) {
_logisticsStar = value;
}
set mid(int value) {
_mid = value;
}
set orderProductId(int value) {
_orderProductId = value;
}
set parentId(int value) {
_parentId = value;
}
set productId(int value) {
_productId = value;
}
set sensitiveFlag(bool value) {
_sensitiveFlag = value;
}
set serviceStar(int value) {
_serviceStar = value;
}
set storeId(int value) {
_storeId = value;
}
} }
class Comment { class Comment {
@ -508,178 +300,89 @@ class Comment {
int productId, int productId,
bool sensitiveFlag, bool sensitiveFlag,
int serviceStar, int serviceStar,
int storeId,}){ int storeId,
_bizType = bizType; }) {
_commentImgs = commentImgs; this.bizType = bizType;
_commentImgsFlag = commentImgsFlag; this.commentImgs = commentImgs;
_commentStar = commentStar; this.commentImgsFlag = commentImgsFlag;
_commentText = commentText; this.commentStar = commentStar;
_descStar = descStar; this.commentText = commentText;
_hideFlag = hideFlag; this.descStar = descStar;
_id = id; this.hideFlag = hideFlag;
_isDelete = isDelete; this.id = id;
_likeNum = likeNum; this.isDelete = isDelete;
_logisticsStar = logisticsStar; this.likeNum = likeNum;
_mid = mid; this.logisticsStar = logisticsStar;
_orderProductId = orderProductId; this.mid = mid;
_parentId = parentId; this.orderProductId = orderProductId;
_productId = productId; this.parentId = parentId;
_sensitiveFlag = sensitiveFlag; this.productId = productId;
_serviceStar = serviceStar; this.sensitiveFlag = sensitiveFlag;
_storeId = storeId; this.serviceStar = serviceStar;
this.storeId = storeId;
} }
Comment.fromJson(dynamic json) { Comment.fromJson(dynamic json) {
_bizType = json['bizType']; this.bizType = json['bizType'];
_commentImgs = json['commentImgs']; this.commentImgs = json['commentImgs'];
_commentImgsFlag = json['commentImgsFlag']; this.commentImgsFlag = json['commentImgsFlag'];
_commentStar = json['commentStar']; this.commentStar = json['commentStar'];
_commentText = json['commentText']; this.commentText = json['commentText'];
_descStar = json['descStar']; this.descStar = json['descStar'];
_hideFlag = json['hideFlag']; this.hideFlag = json['hideFlag'];
_id = json['id']; this.id = json['id'];
_isDelete = json['isDelete']; this.isDelete = json['isDelete'];
_likeNum = json['likeNum']; this.likeNum = json['likeNum'];
_logisticsStar = json['logisticsStar']; this.logisticsStar = json['logisticsStar'];
_mid = json['mid']; this.mid = json['mid'];
_orderProductId = json['orderProductId']; this.orderProductId = json['orderProductId'];
_parentId = json['parentId']; this.parentId = json['parentId'];
_productId = json['productId']; this.productId = json['productId'];
_sensitiveFlag = json['sensitiveFlag']; this.sensitiveFlag = json['sensitiveFlag'];
_serviceStar = json['serviceStar']; this.serviceStar = json['serviceStar'];
_storeId = json['storeId']; this.storeId = json['storeId'];
} }
int _bizType;
String _commentImgs; int bizType;
bool _commentImgsFlag; String commentImgs;
int _commentStar; bool commentImgsFlag;
String _commentText; int commentStar;
int _descStar; String commentText;
bool _hideFlag; int descStar;
int _id; bool hideFlag;
bool _isDelete; int id;
int _likeNum; bool isDelete;
int _logisticsStar; int likeNum;
int _mid; int logisticsStar;
int _orderProductId; int mid;
int _parentId; int orderProductId;
int _productId; int parentId;
bool _sensitiveFlag; int productId;
int _serviceStar; bool sensitiveFlag;
int _storeId; int serviceStar;
int storeId;
int get bizType => _bizType;
String get commentImgs => _commentImgs;
bool get commentImgsFlag => _commentImgsFlag;
int get commentStar => _commentStar;
String get commentText => _commentText;
int get descStar => _descStar;
bool get hideFlag => _hideFlag;
int get id => _id;
bool get isDelete => _isDelete;
int get likeNum => _likeNum;
int get logisticsStar => _logisticsStar;
int get mid => _mid;
int get orderProductId => _orderProductId;
int get parentId => _parentId;
int get productId => _productId;
bool get sensitiveFlag => _sensitiveFlag;
int get serviceStar => _serviceStar;
int get storeId => _storeId;
set bizType(int value) {
_bizType = value;
}
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final map = <String, dynamic>{}; final map = <String, dynamic>{};
map['bizType'] = _bizType; map['bizType'] = this.bizType;
map['commentImgs'] = _commentImgs; map['commentImgs'] = this.commentImgs;
map['commentImgsFlag'] = _commentImgsFlag; map['commentImgsFlag'] = this.commentImgsFlag;
map['commentStar'] = _commentStar; map['commentStar'] = this.commentStar;
map['commentText'] = _commentText; map['commentText'] = this.commentText;
map['descStar'] = _descStar; map['descStar'] = this.descStar;
map['hideFlag'] = _hideFlag; map['hideFlag'] = this.hideFlag;
map['id'] = _id; map['id'] = this.id;
map['isDelete'] = _isDelete; map['isDelete'] = this.isDelete;
map['likeNum'] = _likeNum; map['likeNum'] = this.likeNum;
map['logisticsStar'] = _logisticsStar; map['logisticsStar'] = this.logisticsStar;
map['mid'] = _mid; map['mid'] = this.mid;
map['orderProductId'] = _orderProductId; map['orderProductId'] = this.orderProductId;
map['parentId'] = _parentId; map['parentId'] = this.parentId;
map['productId'] = _productId; map['productId'] = this.productId;
map['sensitiveFlag'] = _sensitiveFlag; map['sensitiveFlag'] = this.sensitiveFlag;
map['serviceStar'] = _serviceStar; map['serviceStar'] = this.serviceStar;
map['storeId'] = _storeId; map['storeId'] = this.storeId;
return map; return map;
} }
set commentImgs(String value) {
_commentImgs = value;
}
set commentImgsFlag(bool value) {
_commentImgsFlag = value;
}
set commentStar(int value) {
_commentStar = value;
}
set commentText(String value) {
_commentText = value;
}
set descStar(int value) {
_descStar = value;
}
set hideFlag(bool value) {
_hideFlag = value;
}
set id(int value) {
_id = value;
}
set isDelete(bool value) {
_isDelete = value;
}
set likeNum(int value) {
_likeNum = value;
}
set logisticsStar(int value) {
_logisticsStar = value;
}
set mid(int value) {
_mid = value;
}
set orderProductId(int value) {
_orderProductId = value;
}
set parentId(int value) {
_parentId = value;
}
set productId(int value) {
_productId = value;
}
set sensitiveFlag(bool value) {
_sensitiveFlag = value;
}
set serviceStar(int value) {
_serviceStar = value;
}
set storeId(int value) {
_storeId = value;
}
} }

49
lib/retrofit/data/store_info.dart

@ -38,6 +38,7 @@ class StoreInfo {
String remark; String remark;
String shipAddress; String shipAddress;
String storeName; String storeName;
StoreTable storeTable;
String tenantCode; String tenantCode;
String updateTime; String updateTime;
String updateUser; String updateUser;
@ -94,6 +95,7 @@ class StoreInfo {
..remark = json['remark'] as String ..remark = json['remark'] as String
..shipAddress = json['shipAddress'] as String ..shipAddress = json['shipAddress'] as String
..storeName = json['storeName'] as String ..storeName = json['storeName'] as String
..storeTable = json['storeTable'] != null ? StoreTable.fromJson(json['storeTable']) : null
..tenantCode = json['tenantCode'] as String ..tenantCode = json['tenantCode'] as String
..updateTime = json['updateTime'] as String ..updateTime = json['updateTime'] as String
..updateUser = json['updateUser'] as String ..updateUser = json['updateUser'] as String
@ -138,6 +140,7 @@ class StoreInfo {
'remark': this.remark, 'remark': this.remark,
'shipAddress': this.shipAddress, 'shipAddress': this.shipAddress,
'storeName': this.storeName, 'storeName': this.storeName,
'storeTable': this.storeTable.toJson(),
'tenantCode': this.tenantCode, 'tenantCode': this.tenantCode,
'updateTime': this.updateTime, 'updateTime': this.updateTime,
'updateUser': this.updateUser, 'updateUser': this.updateUser,
@ -151,3 +154,49 @@ class StoreInfo {
}; };
} }
class StoreTable {
StoreTable();
String areaId;
String id;
int isDelete;
int numberOfPeople;
String remark;
String storeId;
int tableCapacity;
String tableName;
int tableSort;
int tableType;
String tenantCode;
factory StoreTable.fromJson(Map<String, dynamic> json) => StoreTable()
..areaId = json["areaId"]
..id = json["id"]
..isDelete = json["isDelete"]
..numberOfPeople = json["numberOfPeople"]
..remark = json["remark"]
..storeId = json["storeId"]
..tableCapacity = json["tableCapacity"]
..tableName = json["tableName"]
..tableSort = json["tableSort"]
..tableType = json["tableType"]
..tenantCode = json["tenantCode"];
Map<String, dynamic> toJson() => <String, dynamic>{
"areaId": this.areaId,
"id": this.id,
"isDelete": this.isDelete,
"numberOfPeople": this.numberOfPeople,
"remark": this.remark,
"storeId": this.storeId,
"tableCapacity": this.tableCapacity,
"tableName": this.tableName,
"tableSort": this.tableSort,
"tableType": this.tableType,
"tenantCode": this.tenantCode,
};
}

8
lib/retrofit/min_api.dart

@ -182,4 +182,12 @@ abstract class MinApiService {
@POST("order/settlement") @POST("order/settlement")
Future<BaseData> settlementApi(@Body() Map<String, dynamic> param); Future<BaseData> settlementApi(@Body() Map<String, dynamic> param);
///
@POST("store/getStore")
Future<BaseData> queryStoreInfo1(@Body() Map<String, dynamic> param);
//
@GET("order/getParentInfo?tableId={tableId}")
Future<BaseData> getParentInfo(@Path("tableId") String tableId);
} }

44
lib/retrofit/min_api.g.dart

@ -291,4 +291,48 @@ class _MinApiService implements MinApiService {
); );
return value; return value;
} }
@override
Future<BaseData<dynamic>> queryStoreInfo1(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>>('/store/getStore',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json as dynamic,
);
return value;
}
@override
Future<BaseData<dynamic>> getParentInfo(id) async {
ArgumentError.checkNotNull(id, 'id');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'/order/getParentInfo/$id',
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;
}
} }

8
lib/retrofit/retrofit_api.dart

@ -266,13 +266,11 @@ abstract class ApiService {
/// ///
@POST("/information/list") @POST("/information/list")
Future<BaseData<PageInfo<Article>>> queryArticle( Future<BaseData<PageInfo<Article>>> queryArticle(@Body() Map<String, dynamic> param);
@Body() Map<String, dynamic> param);
///banner查询 ///banner查询
@POST("/banner/page") @POST("/banner/page")
Future<BaseData<PageInfo<BannerData>>> queryBanner( Future<BaseData<PageInfo<BannerData>>> queryBanner(@Body() Map<String, dynamic> param);
@Body() Map<String, dynamic> param);
/// ///
@GET("/home/brand") @GET("/home/brand")
@ -357,7 +355,7 @@ abstract class ApiService {
Future<BaseData<bool>> report(@Body() Map<String, String> map); Future<BaseData<bool>> report(@Body() Map<String, String> map);
/// ///
@GET("/order/orderCancel?id={id}") @GET("/order/cancel/{id}")
Future<BaseData<bool>> orderCancel(@Path("id") String id); Future<BaseData<bool>> orderCancel(@Path("id") String id);
/// ///

2
lib/retrofit/retrofit_api.g.dart

@ -1168,7 +1168,7 @@ class _ApiService implements ApiService {
final queryParameters = <String, dynamic>{}; final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{}; final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>( final _result = await _dio.request<Map<String, dynamic>>(
'/order/orderCancel?id=$id', '/order/cancel/$id',
queryParameters: queryParameters, queryParameters: queryParameters,
options: RequestOptions( options: RequestOptions(
method: 'GET', method: 'GET',

73
lib/settlement/settlement.dart

@ -87,7 +87,7 @@ class _Settlement extends State<Settlement> {
"memberCouponId": memberCouponId, "memberCouponId": memberCouponId,
"orderId": orderId, "orderId": orderId,
"promotionId": promotionId "promotionId": promotionId
}).catchError((error){}); }).catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
setState(() { setState(() {
settleOrderInfo = baseData.data; settleOrderInfo = baseData.data;
@ -143,10 +143,10 @@ class _Settlement extends State<Settlement> {
/// ///
queryPlaceOrderFirst() async { queryPlaceOrderFirst() async {
for (int i = 0; i < shopCarGoods.shoppingCartSkuItemList.length; i++) {
for(int i = 0; i < shopCarGoods.shoppingCartSkuItemList.length; i ++) {
settleOrderInfo.orderProductList.forEach((element1) { settleOrderInfo.orderProductList.forEach((element1) {
if (shopCarGoods.shoppingCartSkuItemList[i].productId == element1.productId) { if (shopCarGoods.shoppingCartSkuItemList[i].productId ==
element1.productId) {
shopCarGoods.shoppingCartSkuItemList[i].skuId = element1.skuId; shopCarGoods.shoppingCartSkuItemList[i].skuId = element1.skuId;
} }
}); });
@ -164,20 +164,27 @@ class _Settlement extends State<Settlement> {
placeOrderFirst.orderType = "0"; placeOrderFirst.orderType = "0";
placeOrderFirst.orderTypeId = 0; placeOrderFirst.orderTypeId = 0;
placeOrderFirst.parentCode = ""; // placeOrderFirst.parentCode = ""; //
placeOrderFirst.parentId = "0"; // placeOrderFirst.parentId = "0"; //
placeOrderFirst.payChannel = payChannel; placeOrderFirst.payChannel = payChannel;
placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean();
placeOrderFirst.promotionInfoDTO.promotionId = promotion != null ? promotion.id : ""; placeOrderFirst.promotionInfoDTO.promotionId =
placeOrderFirst.promotionInfoDTO.couponId = couponListBean != null ? couponListBean.id : ""; promotion != null ? promotion.id : "";
placeOrderFirst.recMobile = (mobile == null || mobile == "") ? mobile : storeInfo.headMobile; placeOrderFirst.promotionInfoDTO.couponId =
placeOrderFirst.shoppingCartSkuItemList = shopCarGoods.shoppingCartSkuItemList; couponListBean != null ? couponListBean.id : "";
placeOrderFirst.recMobile =
(mobile == null || mobile == "") ? mobile : storeInfo.headMobile;
placeOrderFirst.shoppingCartSkuItemList =
shopCarGoods.shoppingCartSkuItemList;
placeOrderFirst.skuItemDTOList = []; placeOrderFirst.skuItemDTOList = [];
placeOrderFirst.source = 1; placeOrderFirst.source = 1;
placeOrderFirst.storeId = storeInfo.id; placeOrderFirst.storeId = storeInfo.id;
placeOrderFirst.subcribeTime = null; placeOrderFirst.subcribeTime = null;
placeOrderFirst.tableId = tableId; placeOrderFirst.tableId = tableId;
BaseData<DownOrder> baseData = await minService.placeOrderFirst(placeOrderFirst.toJson()) BaseData<DownOrder> baseData = await minService
.catchError((error) {}); .placeOrderFirst(placeOrderFirst.toJson())
.catchError((error) {
print("error: $error");
});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
querySettlement(placeOrderFirst, baseData.data); querySettlement(placeOrderFirst, baseData.data);
} }
@ -194,28 +201,34 @@ class _Settlement extends State<Settlement> {
// //
await Min.initialize(); await Min.initialize();
} }
BaseData<WxPay> baseData = await minService.settlementWx(placeOrderFirst.toJson()).catchError((error) {}); BaseData<WxPay> baseData = await minService
.settlementWx(placeOrderFirst.toJson())
.catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
WxPay wxPay = baseData.data; WxPay wxPay = baseData.data;
await registerWxApi( await registerWxApi(
appId: wxPay.appId, appId: wxPay.appId,
doOnAndroid: true, doOnAndroid: true,
universalLink: "https://hx.lotus-wallet.com/app/"); universalLink: "https://hx.lotus-wallet.com/app/",
);
payWithWeChat( payWithWeChat(
appId: wxPay.appId, appId: wxPay.appId,
partnerId: wxPay.partnerId, partnerId: wxPay.partnerId,
prepayId: wxPay.prepayId, prepayId: wxPay.prepayId,
packageValue: wxPay.packageValue, packageValue: wxPay.packageValue,
nonceStr: wxPay.nonceStr, nonceStr: wxPay.nonceStr,
timeStamp: int.tryParse(wxPay.timeStamp), timeStamp: int.tryParse(wxPay.timeStamp),
sign: wxPay.sign); sign: wxPay.sign,
);
weChatResponseEventHandler.listen((event) async { weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}"); print("payCallback: ${event.errCode}");
toOrderDetails(placeOrderFirst.id); toOrderDetails(placeOrderFirst.id);
}); });
} }
} else { } else {
BaseData baseData = await minService.settlementApi(placeOrderFirst.toJson()).catchError((error) {}); BaseData baseData = await minService
.settlementApi(placeOrderFirst.toJson())
.catchError((error) {});
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
toOrderDetails(placeOrderFirst.id); toOrderDetails(placeOrderFirst.id);
} }
@ -223,12 +236,9 @@ class _Settlement extends State<Settlement> {
} }
toOrderDetails(String orderId) { toOrderDetails(String orderId) {
//1451130052983914496
//202110211815390002
Navigator.of(context).popAndPushNamed('/router/order_details', arguments: { Navigator.of(context).popAndPushNamed('/router/order_details', arguments: {
"id": orderId, "id": orderId,
}); });
} }
@override @override
@ -421,11 +431,12 @@ class _Settlement extends State<Settlement> {
this.promotion = pro; this.promotion = pro;
this.couponListBean = null; this.couponListBean = null;
queryOrderInfo( queryOrderInfo(
address != null ? address.id : null, address != null ? address.id : null,
selectedBtn, selectedBtn,
couponListBean != null ? couponListBean.id : null, couponListBean != null ? couponListBean.id : null,
0, 0,
promotion != null ? promotion.id : null); promotion != null ? promotion.id : null,
);
} }
} }
} }

453
lib/store/store_order.dart

@ -14,6 +14,7 @@ import 'package:huixiang/retrofit/data/shoppingCart.dart';
import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart';
import 'package:huixiang/retrofit/min_api.dart'; import 'package:huixiang/retrofit/min_api.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/store_view/people_num.dart';
import 'package:huixiang/store/store_view/product_sku.dart'; import 'package:huixiang/store/store_view/product_sku.dart';
import 'package:huixiang/store/store_view/shop_car.dart'; import 'package:huixiang/store/store_view/shop_car.dart';
import 'package:huixiang/store/store_view/store_activity.dart'; import 'package:huixiang/store/store_view/store_activity.dart';
@ -48,43 +49,51 @@ class _StoreOrderPage extends State<StoreOrderPage>
MinApiService minService; MinApiService minService;
StoreInfo storeInfo; StoreInfo storeInfo;
List<Activity> activitys; List<Activity> activitys;
RefreshController refreshController;
StoreOrderListPage storeOrderListPage; StoreOrderListPage storeOrderListPage;
ScrollController controller = ScrollController(); ScrollController controller = ScrollController();
ShoppingCart shopCarGoods; ShoppingCart shopCarGoods;
int tableId = 0;
String tenant = "";
String storeId = "";
int numberOfPeople = 0;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
tableId = widget.arguments["tableId"];
tenant = widget.arguments["tenant"];
storeId = widget.arguments["id"];
debugPrint(
"store_param tableId:$tableId tenant:$tenant storeId:$storeId");
if (tabcontroller == null) if (tabcontroller == null)
tabcontroller = TabController( tabcontroller = TabController(
length: 2, length: 2,
vsync: this, vsync: this,
); );
minLogin(); SharedPreferences.getInstance().then((value) {
queryStoreInfo(); minLogin(value);
});
} }
/// ///
minLogin() async { minLogin(SharedPreferences shared) async {
final SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(
Dio(), Dio(),
context: context, context: context,
token: value.getString('token'), token: shared.getString('token'),
); );
apiService queryStoreInfo();
.minLogin(widget.arguments["id"]) apiService.minLogin(storeId).catchError((onError) {
.catchError((onError) {}) debugPrint(onError);
.then((baseData) { }).then((baseData) {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
Map<String, dynamic> minStoreInfo = baseData.data; Map<String, dynamic> minStoreInfo = baseData.data;
String minToken = minStoreInfo["token"]; String minToken = minStoreInfo["token"];
String tenant = widget.arguments["tenant"];
String storeId = widget.arguments["id"];
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => { (value) => {
value.setString('minToken', minToken), value.setString('minToken', minToken),
@ -103,25 +112,48 @@ class _StoreOrderPage extends State<StoreOrderPage>
this.shopCarGoods = value; this.shopCarGoods = value;
setState(() {}); setState(() {});
}); });
if (tableId > 0) {
queryStoreInfo1();
}
} }
}); });
} }
///
getParentInfo() async {
BaseData baseData =
await minService.getParentInfo("$tableId").catchError((error) {
debugPrint(error);
});
if (baseData != null && baseData.isSuccess) {
}
}
///
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);
}
}
}
/// ///
queryStoreInfo() async { queryStoreInfo() async {
final SharedPreferences value = await SharedPreferences.getInstance(); BaseData baseData =
apiService = ApiService( await apiService.queryStoreInfo(storeId).catchError((error) {
Dio(), debugPrint(error);
context: context,
token: value.getString('token'),
);
BaseData baseData = await apiService
.queryStoreInfo(widget.arguments["id"])
.catchError((error) {
// refreshController.refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
// refreshController.refreshCompleted();
storeInfo = StoreInfo.fromJson(baseData.data); storeInfo = StoreInfo.fromJson(baseData.data);
activitys = storeInfo.informationVOPageVO.list activitys = storeInfo.informationVOPageVO.list
.map((e) => Activity.fromJson(e)) .map((e) => Activity.fromJson(e))
@ -143,178 +175,168 @@ class _StoreOrderPage extends State<StoreOrderPage>
bottom: 54.h, bottom: 54.h,
child: DefaultTabController( child: DefaultTabController(
length: 2, length: 2,
child: SmartRefresher( child: NestedScrollView(
controller: refreshController = controller: controller,
RefreshController(initialRefresh: false), dragStartBehavior: DragStartBehavior.start,
enablePullDown: true,
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
onRefresh: () { headerSliverBuilder:
queryStoreInfo(); (BuildContext context, bool innerBoxIsScrolled) {
}, return [
child: NestedScrollView( SliverOverlapAbsorber(
controller: controller, handle: NestedScrollView.sliverOverlapAbsorberHandleFor(
dragStartBehavior: DragStartBehavior.start, context),
headerSliverBuilder: sliver: SliverAppBar(
(BuildContext context, bool innerBoxIsScrolled) { expandedHeight:
return [ (storeInfo != null && storeInfo.couponVOList != null)
SliverOverlapAbsorber( ? 470.h
handle: NestedScrollView.sliverOverlapAbsorberHandleFor( : 365.h,
context), floating: false,
sliver: SliverAppBar( snap: false,
expandedHeight: (storeInfo != null && pinned: true,
storeInfo.couponVOList != null) stretch: false,
? 470.h brightness: Brightness.light,
: 365.h, leading: GestureDetector(
floating: false, onTap: () {
snap: false, Navigator.of(context).pop();
pinned: true, },
stretch: false, child: Container(
brightness: Brightness.light, alignment: Alignment.centerRight,
leading: GestureDetector( margin: EdgeInsets.only(left: 10),
onTap: () { padding: EdgeInsets.all(6),
Navigator.of(context).pop(); child: Icon(
}, Icons.arrow_back_ios,
child: Container( color: Colors.black,
alignment: Alignment.centerRight, size: 24,
margin: EdgeInsets.only(left: 10),
padding: EdgeInsets.all(6),
child: Icon(
Icons.arrow_back_ios,
color: Colors.black,
size: 24,
),
), ),
), ),
flexibleSpace: FlexibleSpaceBar( ),
title: Title( flexibleSpace: FlexibleSpaceBar(
controller, title: Title(
storeInfo != null ? storeInfo.storeName : '', controller,
), storeInfo != null ? storeInfo.storeName : '',
collapseMode: CollapseMode.pin, ),
stretchModes: [ collapseMode: CollapseMode.pin,
StretchMode.zoomBackground, stretchModes: [
StretchMode.fadeTitle, StretchMode.zoomBackground,
StretchMode.blurBackground, StretchMode.fadeTitle,
], StretchMode.blurBackground,
background: Stack( ],
children: [ background: Stack(
Positioned( children: [
Positioned(
child: Column(
children: [
buildSwiper(),
Expanded(
child: Container(
color: Colors.transparent,
),
flex: 1,
),
],
),
top: 0,
bottom: 0,
left: 0,
right: 0,
),
Positioned(
child: Container(
child: Column( child: Column(
children: [ children: [
buildSwiper(), ///
Expanded( StoreInfoView(storeInfo),
child: Container(
color: Colors.transparent, ///
if (storeInfo != null &&
storeInfo.couponVOList != null)
UnionCoupon(
storeInfo,
_receiveCoupon,
coupon: true,
), ),
flex: 1,
), if (storeInfo == null ||
storeInfo.couponVOList == null)
SizedBox(
height: 8,
),
///VIP信息
Vip(storeInfo, () {}, false),
], ],
), ),
top: 0,
bottom: 0,
left: 0,
right: 0,
), ),
Positioned( top: 110.h,
child: Container( bottom: 0,
child: Column( left: 0,
children: [ right: 0,
/// ),
StoreInfoView(storeInfo), ],
///
if (storeInfo != null &&
storeInfo.couponVOList != null)
UnionCoupon(
storeInfo,
_receiveCoupon,
coupon: true,
),
if (storeInfo == null ||
storeInfo.couponVOList == null)
SizedBox(
height: 8,
),
///VIP信息
Vip(storeInfo, () {}, false),
],
),
),
top: 110.h,
bottom: 0,
left: 0,
right: 0,
),
],
),
), ),
backgroundColor: Color(0x33FAFAFA), ),
centerTitle: false, backgroundColor: Color(0x33FAFAFA),
elevation: 0, centerTitle: false,
bottom: PreferredSize( elevation: 0,
preferredSize: Size( bottom: PreferredSize(
MediaQuery.of(context).size.width, preferredSize: Size(
38, MediaQuery.of(context).size.width,
), 38,
child: Container( ),
padding: EdgeInsets.symmetric(horizontal: 10.w), child: Container(
width: MediaQuery.of(context).size.width, padding: EdgeInsets.symmetric(horizontal: 10.w),
child: TabBar( width: MediaQuery.of(context).size.width,
controller: tabcontroller, child: TabBar(
automaticIndicatorColorAdjustment: true, controller: tabcontroller,
isScrollable: true, automaticIndicatorColorAdjustment: true,
indicatorWeight: 1, isScrollable: true,
indicatorColor: Color(0xFFFAFAFA), indicatorWeight: 1,
labelPadding: EdgeInsets.only( indicatorColor: Color(0xFFFAFAFA),
left: 8.w, labelPadding: EdgeInsets.only(
right: 8.w, left: 8.w,
), right: 8.w,
indicatorSize: TabBarIndicatorSize.label, ),
unselectedLabelStyle: TextStyle( indicatorSize: TabBarIndicatorSize.label,
fontSize: 15.sp, unselectedLabelStyle: TextStyle(
fontWeight: FontWeight.w400, fontSize: 15.sp,
), fontWeight: FontWeight.w400,
labelStyle: TextStyle( ),
color: Colors.black, labelStyle: TextStyle(
fontSize: 18.sp, color: Colors.black,
fontWeight: FontWeight.bold, fontSize: 18.sp,
), fontWeight: FontWeight.bold,
labelColor: Colors.black,
tabs: [
MyTab(text: S.of(context).diancan),
MyTab(text: S.of(context).xindianhuodong),
],
), ),
labelColor: Colors.black,
tabs: [
MyTab(text: S.of(context).diancan),
MyTab(text: S.of(context).xindianhuodong),
],
), ),
), ),
), ),
), ),
]; ),
}, ];
body: TabBarView( },
physics: BouncingScrollPhysics(), body: TabBarView(
children: [ physics: BouncingScrollPhysics(),
StoreOrderListPage( children: [
widget.arguments, StoreOrderListPage(
activitys, widget.arguments,
storeInfo, activitys,
shopCarGoods, storeInfo,
controller, shopCarGoods,
_queryMiNiDetail, controller,
), _queryMiNiDetail,
),
///, ///,
StoreActivity( StoreActivity(
widget.arguments, widget.arguments,
activitys, activitys,
), ),
], ],
controller: tabcontroller, controller: tabcontroller,
),
), ),
), ),
), ),
@ -424,6 +446,21 @@ class _StoreOrderPage extends State<StoreOrderPage>
); );
} }
showPeopleNum(String tableName) async {
var people = await showDialog(
context: context,
builder: (context) {
return PeopleNumView(tableName);
},
);
if (people != null && people > 0) {
setState(() {
this.numberOfPeople = people;
});
}
}
/// ///
int count() { int count() {
if (shopCarGoods == null || if (shopCarGoods == null ||
@ -555,7 +592,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async { Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async {
ProductSkuVOListBean productSku = miNiDetail.productSkuVOList.firstWhere((element) { ProductSkuVOListBean productSku =
miNiDetail.productSkuVOList.firstWhere((element) {
bool gg = true; bool gg = true;
selectSkus.forEach((element1) { selectSkus.forEach((element1) {
if (element.skuNameStr.indexOf(element1) < 0) { if (element.skuNameStr.indexOf(element1) < 0) {
@ -567,13 +605,18 @@ class _StoreOrderPage extends State<StoreOrderPage>
}); });
if (productSku == null) return; if (productSku == null) return;
String skuId = productSku.id; String skuId = productSku.id;
String skuValue = selectSkus.toString().replaceAll("[", "").replaceAll("]", "").replaceAll(",", ""); String skuValue = selectSkus
.toString()
.replaceAll("[", "")
.replaceAll("]", "")
.replaceAll(",", "");
if (miNiDetail != null) { if (miNiDetail != null) {
BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart({ BaseData<List<ShoppingCart>> baseDate = await minService.addShoppingCart({
"storeId": storeInfo.id, "storeId": storeInfo.id,
"storeName": storeInfo.storeName ?? "", "storeName": storeInfo.storeName ?? "",
"tableId": 0, "numberOfPeople": numberOfPeople,
"tableId": tableId,
"shoppingCartSkuItemList": [ "shoppingCartSkuItemList": [
{ {
"buyNum": count, "buyNum": count,
@ -584,7 +627,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
"storeId": storeInfo.id, "storeId": storeInfo.id,
"skuPrice": productSku.applyPrice, "skuPrice": productSku.applyPrice,
"skuStock": productSku.skuStock, "skuStock": productSku.skuStock,
"tableId": 0, "tableId": tableId,
}, },
], ],
}); });
@ -599,7 +642,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
/// ///
Future<ShoppingCart> queryShopCar() async { Future<ShoppingCart> queryShopCar() async {
BaseData<List<ShoppingCart>> baseDate = await minService.getShoppingCart(0); BaseData<List<ShoppingCart>> baseDate =
await minService.getShoppingCart(tableId);
if (baseDate != null && if (baseDate != null &&
baseDate.isSuccess && baseDate.isSuccess &&
baseDate.data != null && baseDate.data != null &&
@ -615,7 +659,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson(); Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
cartSkuItem.buyNum += 1; cartSkuItem.buyNum += 1;
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate = await minService.shoppingCartSingle(shopCarTemp); BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) { if (baseDate.isSuccess) {
queryShopCar().then((value) { queryShopCar().then((value) {
this.shopCarGoods = value; this.shopCarGoods = value;
@ -632,7 +677,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson(); Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
cartSkuItem.buyNum -= 1; cartSkuItem.buyNum -= 1;
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate = await minService.shoppingCartSingle(shopCarTemp); BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) { if (baseDate.isSuccess) {
queryShopCar().then((value) { queryShopCar().then((value) {
this.shopCarGoods = value; this.shopCarGoods = value;
@ -646,7 +692,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
///1 ///1
add(MiNiDetail miNiDetail, selectSkus) async { add(MiNiDetail miNiDetail, selectSkus) async {
ProductSkuVOListBean productSku = miNiDetail.productSkuVOList.firstWhere((element) { ProductSkuVOListBean productSku =
miNiDetail.productSkuVOList.firstWhere((element) {
return skuY(element, selectSkus); return skuY(element, selectSkus);
}); });
@ -656,20 +703,24 @@ class _StoreOrderPage extends State<StoreOrderPage>
await _addShopCar(miNiDetail, selectSkus, 2); await _addShopCar(miNiDetail, selectSkus, 2);
return; return;
} }
int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.id); int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
.indexWhere((element) => skuId == element.id);
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson(); Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
shopCarGoods.tableId = "0"; shopCarGoods.tableId = "$tableId";
if (shopSkuIndex >= 0) { if (shopSkuIndex >= 0) {
shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum += 1; shopCarGoods.shoppingCartSkuItemList[shopSkuIndex].buyNum += 1;
ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods.shoppingCartSkuItemList.firstWhere((element) => skuId == element.id); ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods
.shoppingCartSkuItemList
.firstWhere((element) => skuId == element.id);
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
} else { } else {
await _addShopCar(miNiDetail, selectSkus, 2); await _addShopCar(miNiDetail, selectSkus, 2);
return; return;
} }
BaseData<List<ShoppingCart>> baseDate = await minService.shoppingCartSingle(shopCarTemp); BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) { if (baseDate.isSuccess) {
queryShopCar().then((value) { queryShopCar().then((value) {
this.shopCarGoods = value; this.shopCarGoods = value;
@ -680,7 +731,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
///1 ///1
reduce(MiNiDetail miNiDetail, selectSkus) async { reduce(MiNiDetail miNiDetail, selectSkus) async {
ProductSkuVOListBean productSku = miNiDetail.productSkuVOList.firstWhere((element) { ProductSkuVOListBean productSku =
miNiDetail.productSkuVOList.firstWhere((element) {
return skuY(element, selectSkus); return skuY(element, selectSkus);
}); });
@ -690,8 +742,11 @@ class _StoreOrderPage extends State<StoreOrderPage>
await _addShopCar(miNiDetail, selectSkus, 2); await _addShopCar(miNiDetail, selectSkus, 2);
return; return;
} }
ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods.shoppingCartSkuItemList.firstWhere((element) => skuId == element.skuId); ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods
int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.skuId); .shoppingCartSkuItemList
.firstWhere((element) => skuId == element.skuId);
int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList
.indexWhere((element) => skuId == element.skuId);
if (shopSkuItem != null) { if (shopSkuItem != null) {
if (shopSkuItem.buyNum > 1) { if (shopSkuItem.buyNum > 1) {
@ -701,13 +756,16 @@ class _StoreOrderPage extends State<StoreOrderPage>
await _addShopCar(miNiDetail, selectSkus, 2); await _addShopCar(miNiDetail, selectSkus, 2);
return; return;
} }
shopCarGoods.tableId = "0"; shopCarGoods.tableId = "$tableId";
Map<String, dynamic> shopCarTemp = shopCarGoods.toJson(); Map<String, dynamic> shopCarTemp = shopCarGoods.toJson();
ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods.shoppingCartSkuItemList.firstWhere((element) => skuId == element.id); ShoppingCartSkuItemListBean cartSkuItem = shopCarGoods
.shoppingCartSkuItemList
.firstWhere((element) => skuId == element.id);
shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()];
BaseData<List<ShoppingCart>> baseDate = await minService.shoppingCartSingle(shopCarTemp); BaseData<List<ShoppingCart>> baseDate =
await minService.shoppingCartSingle(shopCarTemp);
if (baseDate.isSuccess) { if (baseDate.isSuccess) {
queryShopCar().then((value) { queryShopCar().then((value) {
this.shopCarGoods = value; this.shopCarGoods = value;
@ -726,7 +784,6 @@ class _StoreOrderPage extends State<StoreOrderPage>
}); });
return gg; return gg;
} }
} }
class Title extends StatefulWidget { class Title extends StatefulWidget {

139
lib/store/store_view/people_num.dart

@ -0,0 +1,139 @@
import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/round_button.dart';
class PeopleNumView extends StatefulWidget {
final String tableName;
// final Function(int peopleNum) callback;
PeopleNumView(this.tableName);
@override
State<StatefulWidget> createState() {
return _PeopleNumView();
}
}
class _PeopleNumView extends State<PeopleNumView> {
int peopleNum = 1;
@override
Widget build(BuildContext context) {
return SimpleDialog(
titlePadding: EdgeInsets.all(10),
backgroundColor: Colors.transparent,
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6),
),
children: [
Stack(
alignment: Alignment.bottomCenter,
children: [
Container(
width: 295,
height: 247,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
),
padding: EdgeInsets.symmetric(vertical: 20, horizontal: 20),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"桌位:${widget.tableName}",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF171717),
),
),
Text(
"请选择用餐人数:$peopleNum人",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF171717),
),
),
SizedBox(
height: 10,
),
Container(
child: GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 5,
crossAxisSpacing: 24,
mainAxisSpacing: 18,
childAspectRatio: 1,
),
shrinkWrap: true,
itemCount: 10,
padding: EdgeInsets.zero,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
onTap: () {
setState(() {
peopleNum = position + 1;
});
},
child: Container(
decoration: BoxDecoration(
color: peopleNum == (position + 1)
? Color(0xFF32A060)
: Colors.transparent,
border: Border.all(
color: Color(0xFF32A060),
width: 1,
),
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
child: Text(
"${position + 1}",
style: TextStyle(
color: peopleNum == (position + 1)
? Colors.white
: Color(0xFF32A060),
fontWeight: MyFontWeight.regular,
fontSize: 16.sp,
),
),
),
);
},
),
),
SizedBox(
height: 10,
),
RoundButton(
text: "确定",
width: 130.w,
height: 34.h,
textColor: Colors.white,
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
backgroup: Color(0xFF32A060),
radius: 4.w,
callback: () {
// widget.callback(peopleNum);
// SmartDialog.dismiss();
Navigator.of(context).pop(peopleNum);
},
),
],
),
),
],
),
],
);
}
}

21
lib/store/store_view/store_activity.dart

@ -22,11 +22,20 @@ class _StoreActivity extends State<StoreActivity> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return (widget.activitys == null || widget.activitys.length == 0) return (widget.activitys == null || widget.activitys.length == 0)
? NoDataView( ? Container(
isShowBtn: false, width: MediaQuery.of(context).size.width,
text: "还没有活动~", height: MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h),
fontSize: 16.sp, margin: EdgeInsets.only(
margin: EdgeInsets.only(top: 180.h), top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight),
),
color: Colors.white,
child: NoDataView(
isShowBtn: false,
text: "还没有活动~",
iconWidth: 220,
iconHeight: 140,
fontSize: 16.sp,
),
) )
: Container( : Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
@ -51,7 +60,7 @@ class _StoreActivity extends State<StoreActivity> {
'/router/web_page', '/router/web_page',
arguments: { arguments: {
"activityId": widget.activitys[position].id, "activityId": widget.activitys[position].id,
"source": widget.arguments["id"] "source": widget.arguments["id"],
}, },
); );
} }

108
lib/store/store_view/store_order_list.dart

@ -11,7 +11,9 @@ import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/store/store_view/shop_goods.dart'; import 'package:huixiang/store/store_view/shop_goods.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/round_button.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class StoreOrderListPage extends StatefulWidget { class StoreOrderListPage extends StatefulWidget {
@ -23,12 +25,13 @@ class StoreOrderListPage extends StatefulWidget {
ShoppingCart shopCarGoods; ShoppingCart shopCarGoods;
StoreOrderListPage( StoreOrderListPage(
this.arguments, this.arguments,
this.activitys, this.activitys,
this.storeInfo, this.storeInfo,
this.shopCarGoods, this.shopCarGoods,
this.controller, this.controller,
this.queryMiNiDetail,); this.queryMiNiDetail,
);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
@ -64,22 +67,26 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
); );
BaseData<List<FindMiNiGroupList>> baseData = BaseData<List<FindMiNiGroupList>> baseData =
await minService.findMiNiGroupList( await minService.findMiNiGroupList({
{ "id": widget.arguments["id"],
"id": widget.arguments["id"], }).catchError((error) {
}, refreshController.refreshFailed();
); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
refreshController.refreshCompleted();
setState(() { setState(() {
appletProducts = baseData.data; appletProducts = baseData.data;
// widget.productListResult(appletProducts);
productListBeans.clear(); productListBeans.clear();
if (appletProducts.length > 0) if (appletProducts.length > 0)
productListBeans.addAll(appletProducts[0].productList); productListBeans.addAll(appletProducts[isSelected].productList);
}); });
} else {
refreshController.refreshFailed();
} }
} }
RefreshController refreshController;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return Container(
@ -88,34 +95,51 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight), top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight),
), ),
child: Row( child: SmartRefresher(
mainAxisAlignment: MainAxisAlignment.start, controller: refreshController =
mainAxisSize: MainAxisSize.max, RefreshController(initialRefresh: false),
children: [ enablePullDown: true,
Container( enablePullUp: false,
width: 100.w, header: MyHeader(),
child: ListView.builder( physics: BouncingScrollPhysics(),
itemCount: appletProducts == null ? 0 : appletProducts.length, onRefresh: () {
controller: controller1, appletGoods();
physics: BouncingScrollPhysics(), },
padding: EdgeInsets.only(top: 0, bottom: 25), child: SingleChildScrollView(
itemBuilder: (context, position) { child: Row(
return orderItem(appletProducts[position], position); mainAxisAlignment: MainAxisAlignment.start,
}, crossAxisAlignment: CrossAxisAlignment.start,
), mainAxisSize: MainAxisSize.max,
), children: [
Container( Container(
width: MediaQuery.of(context).size.width - 100.w, width: 100.w,
child: ListView.builder( child: ListView.builder(
itemCount: productListBeans == null ? 0 : productListBeans.length, itemCount: appletProducts == null ? 0 : appletProducts.length,
physics: BouncingScrollPhysics(), controller: controller1,
padding: EdgeInsets.zero, physics: BouncingScrollPhysics(),
itemBuilder: (context, position) { shrinkWrap: true,
return goodsItem(position); padding: EdgeInsets.only(top: 0, bottom: 25),
}, itemBuilder: (context, position) {
), return orderItem(appletProducts[position], position);
},
),
),
Container(
width: MediaQuery.of(context).size.width - 100.w,
child: ListView.builder(
itemCount:
productListBeans == null ? 0 : productListBeans.length,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
padding: EdgeInsets.zero,
itemBuilder: (context, position) {
return goodsItem(position);
},
),
),
],
), ),
], ),
), ),
); );
} }
@ -228,8 +252,8 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
widget.queryMiNiDetail(productListBeans[position].id); widget.queryMiNiDetail(productListBeans[position].id);
}, },
(ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) {
widget.queryMiNiDetail(productListBeans[position].id); widget.queryMiNiDetail(productListBeans[position].id);
}, },
productListBean: productListBeans[position], productListBean: productListBeans[position],
count: count, count: count,

80
lib/union/union_page.dart

@ -12,6 +12,7 @@ import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/main.dart'; import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/data/store.dart';
import 'package:huixiang/retrofit/data/store_type.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/location.dart'; import 'package:huixiang/utils/location.dart';
@ -20,6 +21,8 @@ import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/icon_text.dart'; import 'package:huixiang/view_widget/icon_text.dart';
import 'package:huixiang/view_widget/item_title.dart'; import 'package:huixiang/view_widget/item_title.dart';
import 'package:huixiang/view_widget/my_appbar.dart'; import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/request_permission.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
@ -263,21 +266,26 @@ class _UnionPage extends State<UnionPage>
}, },
child: ListView.builder( child: ListView.builder(
itemCount: storeList == null ? 0 : storeList.length, itemCount: storeList == null ? 0 : storeList.length,
// padding: EdgeInsets.only(top: 8.h, bottom: 84.h + (375.h - 88.h) + 4.h),
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 8.h, bottom: 84.h /* + (375.h - 88.h) + 4.h*/), top: 8.h,
bottom: 84.h, /* + (375.h - 88.h) + 4.h*/
),
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) { itemBuilder: (context, position) {
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Navigator.of(context).pushNamed( if(storeList[position].posType.code == "NORMALSTORE") {
'/router/store_order', toScan(storeList[position]);
arguments: { } else {
"id": storeList[position].id, Navigator.of(context).pushNamed(
"tenant": storeList[position].tenantCode, '/router/store_order',
"storeName": storeList[position].storeName arguments: {
}, "id": storeList[position].id,
); "tenant": storeList[position].tenantCode,
"storeName": storeList[position].storeName
},
);
}
}, },
child: buildStoreItem(storeList[position], position), child: buildStoreItem(storeList[position], position),
); );
@ -293,6 +301,58 @@ class _UnionPage extends State<UnionPage>
_mapController = controller; _mapController = controller;
} }
toScan(Store store) async {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": store.id,
"tenant": store.tenantCode,
"storeName": store.storeName,
"tableId": 1315903669597634560,
},
);
// if (await Permission.camera.isPermanentlyDenied) {
// showCupertinoDialog(
// context: context,
// builder: (context) {
// return RequestPermission(
// "assets/image/icon_camera_permission_tips.png",
// S.of(context).ninxiangjiquanxianweikaiqi,
// S.of(context).weilekaipaizhaoxuanzhetouxiang,
// S.of(context).kaiqiquanxian,
// (result) async {
// if (result) {
// await openAppSettings();
// }
// },
// heightRatioWithWidth: 0.82,
// );
// });
// } else if (await Permission.camera.isGranted) {
// var result = await Navigator.of(context).pushNamed('/router/qr_scan');
//
// if (result != null && result != "") {
// Uri uri = Uri.parse(result);
// String table = uri.queryParameters["tableId"];
// if (table != null && table != "") {
// int tableId = int.tryParse(table);
// Navigator.of(context).pushNamed(
// '/router/store_order',
// arguments: {
// "id": store.id,
// "tenant": store.tenantCode,
// "storeName": store.storeName,
// "tableId": tableId,
// },
// );
// }
// }
// } else {
// await Permission.camera.request();
// }
}
Widget buildSearchItem() { Widget buildSearchItem() {
return Container( return Container(
height: 36.h, height: 36.h,

23
lib/view_widget/no_data_view.dart

@ -6,13 +6,18 @@ class NoDataView extends StatelessWidget {
final bool isShowBtn; final bool isShowBtn;
final String text; final String text;
final double fontSize; final double fontSize;
final double iconWidth;
final double iconHeight;
final EdgeInsets margin; final EdgeInsets margin;
NoDataView( NoDataView({
{this.isShowBtn = true, this.isShowBtn = true,
this.text, this.text,
this.fontSize, this.fontSize,
this.margin = const EdgeInsets.only(top: 30)}); this.iconWidth = 270,
this.iconHeight = 180,
this.margin = const EdgeInsets.only(top: 30),
});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -21,7 +26,11 @@ class NoDataView extends StatelessWidget {
alignment: Alignment.center, alignment: Alignment.center,
child: Column( child: Column(
children: [ children: [
Image(image: AssetImage("assets/image/icon_empty.png")), Image(
image: AssetImage("assets/image/icon_empty.png"),
width: iconWidth,
height: iconHeight,
),
SizedBox( SizedBox(
height: 35.h, height: 35.h,
), ),
@ -46,7 +55,7 @@ class NoDataView extends StatelessWidget {
backgroup: Color(0xFF32A060), backgroup: Color(0xFF32A060),
radius: 4, radius: 4,
), ),
) ),
], ],
), ),
); );

6
pubspec.lock

@ -375,13 +375,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.11" version: "1.0.11"
flutter_qr_reader: flutter_scankit:
dependency: "direct main" dependency: "direct main"
description: description:
name: flutter_qr_reader name: flutter_scankit
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.5" version: "1.2.0"
flutter_screenutil: flutter_screenutil:
dependency: "direct main" dependency: "direct main"
description: description:

4
pubspec.yaml

@ -54,7 +54,7 @@ dependencies:
flutter_smart_dialog: ^2.1.6 flutter_smart_dialog: ^2.1.6
barcode_widget: ^2.0.1 barcode_widget: ^2.0.1
flutter_qr_reader: ^1.0.5 # flutter_qr_reader: ^1.0.5
qr_flutter: ^4.0.0 qr_flutter: ^4.0.0
url_launcher: ^5.0.0 url_launcher: ^5.0.0
@ -64,6 +64,8 @@ dependencies:
#多图, 裁剪 #多图, 裁剪
image_pickers: ^2.0.0 image_pickers: ^2.0.0
flutter_scankit: ^1.2.0
# 数量,视频时长 # 数量,视频时长
# images_picker: ^1.2.4 # images_picker: ^1.2.4

Loading…
Cancel
Save