diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 6fb622f8..58c79909 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -51,8 +51,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { @override void dispose() { super.dispose(); - if (_refreshController != null) - _refreshController.dispose(); + if (_refreshController != null) _refreshController.dispose(); } @override @@ -62,12 +61,10 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { eventBus.on().listen((event) { print("EventType: ${event.type}"); if (event.type < 3) { - if (mounted) - setState(() {}); + if (mounted) setState(() {}); } if (event.type == 3) { - if (mounted) - setState(() {}); + if (mounted) setState(() {}); } }); } @@ -81,8 +78,12 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { value.getString('user') != "") { userInfo = UserInfo.fromJson(jsonDecode(value.getString('user'))); } - apiService = ApiService(Dio(), - context: context, token: value.getString('token'), showLoading: false); + apiService = ApiService( + Dio(), + context: context, + token: value.getString('token'), + showLoading: false, + ); BaseData> rankData = await apiService.rankList().catchError((onError) { @@ -208,7 +209,6 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ); } - ///横向的提示 Widget buildNotice() { return Container( @@ -283,11 +283,11 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { } ///关注度/粉丝/发布 - Widget attention(){ + Widget attention() { return Container( - margin: EdgeInsets.only(left: 16,right: 17,top: 10), - child:GestureDetector( - onTap:(){ + margin: EdgeInsets.only(left: 16, right: 17, top: 10), + child: GestureDetector( + onTap: () { Navigator.of(context).pushNamed( '/router/communityFollow', arguments: {}, diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index 9a2acd07..403d40f6 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -1,21 +1,28 @@ import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:fluwx/fluwx.dart'; import 'package:huixiang/generated/l10n.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_info.dart'; +import 'package:huixiang/order/order_view/order_pay_selected.dart'; import 'package:huixiang/order/order_view/order_status.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/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/my_appbar.dart'; import 'package:shared_preferences/shared_preferences.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'order_utils.dart'; + class OrderDetailPage extends StatefulWidget { final arguments; @@ -41,22 +48,20 @@ class _OrderDetailPage extends State { context: context, token: value.getString("token"), ); - minLogin(); queryDetails(); }); } /// 小程序登录 minLogin() async { - apiService - .minLogin(widget.arguments["id"]) - .catchError((onError) {}) + apiService.minLogin(orderInfo.storeId) + .catchError((onError) {debugPrint(onError);}) .then((baseData) { if (baseData != null && baseData.isSuccess) { Map minStoreInfo = baseData.data; String minToken = minStoreInfo["token"]; - String tenant = widget.arguments["tenant"]; - String storeId = widget.arguments["id"]; + String tenant = orderInfo.tenantCode; + String storeId = orderInfo.storeId; SharedPreferences.getInstance().then( (value) => { value.setString('minToken', minToken), @@ -82,8 +87,6 @@ class _OrderDetailPage extends State { int isTakeOut = 0; int refundStatus = 0; - // String storeType = "NORMALSTORE"; //NORMALSTORE FASTSTORE RETAILSTORE - queryDetails() async { BaseData baseData = await apiService .orderDetail(widget.arguments["id"]) @@ -101,6 +104,8 @@ class _OrderDetailPage extends State { print("order orderStatus: $orderStatus"); print("order sendStatus: $sendStatus"); print("order isTakeOut: $isTakeOut"); + + minLogin(); if (mounted) setState(() { statusTitle(); @@ -162,7 +167,7 @@ class _OrderDetailPage extends State { refundStatus, title, center, - carryOnPay, + paySelected, _orderCancel, orderInfo, ), @@ -194,34 +199,17 @@ class _OrderDetailPage extends State { String title = ""; String center = ""; - carryOnPay() { - 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 = 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; - - - + paySelected() async { + var payChannel = await showModalBottomSheet( + context: context, + backgroundColor: Colors.transparent, + builder: (context) { + return OrderPaySelected(); + }, + ); + if (payChannel != null && payChannel > 0) { + OrderUtils.carryOnPay(payChannel, minService, orderInfo, queryDetails); + } } statusTitle() { diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index a57f32aa..3c221b8a 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -2,11 +2,14 @@ import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.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/order_info.dart'; import 'package:huixiang/retrofit/data/order_product_vo.dart'; import 'package:huixiang/retrofit/data/page.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/utils/status_utils.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'; class OrderHistoryPage extends StatefulWidget { - final Map arguments; OrderHistoryPage({this.arguments}); @@ -41,7 +43,8 @@ class _OrderHistoryPage extends State void didChangeDependencies() { super.didChangeDependencies(); if (tabController == null) - tabController = TabController(initialIndex: widget.arguments["status"], length: 4, vsync: this); + tabController = TabController( + initialIndex: widget.arguments["status"], length: 4, vsync: this); _pages = [ OrderHistoryList(0), @@ -226,7 +229,7 @@ class _OrderHistoryList extends State offset: Offset(0, 1), blurRadius: 12, spreadRadius: 0, - ) + ), ], ), child: Column( @@ -455,26 +458,7 @@ class _OrderHistoryList extends State } else if (type == 2) { orderCancel(orderInfo.id); } else if (type == 3) { - SmartDialog.show( - 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); + minLogin(orderInfo); } else if (type == 4) { Navigator.of(context).pushNamed( '/router/logistics_information_page', @@ -500,12 +484,53 @@ class _OrderHistoryList extends State ); } - toPay(Map param) async { - apiService.settlement(param).catchError((error) { - + minLogin(OrderInfo orderInfo) { + apiService.minLogin(orderInfo.storeId).catchError((onError) { + debugPrint(onError); + }).then((baseData) { + if (baseData != null && baseData.isSuccess) { + Map 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 { BaseData baseData = await apiService.orderCancel(orderId); if (baseData != null && baseData.isSuccess) { @@ -515,8 +540,10 @@ class _OrderHistoryList extends State } aginOrder(storeId) { - Navigator.of(context) - .pushNamed('/router/union_detail_page', arguments: {"id": storeId}); + Navigator.of(context).pushNamed( + '/router/union_detail_page', + arguments: {"id": storeId}, + ); } String totalPrice(orderInfo) { diff --git a/lib/order/order_utils.dart b/lib/order/order_utils.dart new file mode 100644 index 00000000..1b9a73e4 --- /dev/null +++ b/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 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(); + } + } + } + + + +} \ No newline at end of file diff --git a/lib/order/order_view/order_address.dart b/lib/order/order_view/order_address.dart index ac601059..f1928911 100644 --- a/lib/order/order_view/order_address.dart +++ b/lib/order/order_view/order_address.dart @@ -19,7 +19,7 @@ class OrderAddress extends StatefulWidget { final String title; final String center; final Function orderCancel; - final Function carryOnPay; + final Function() carryOnPay; final OrderInfo orderInfo; OrderAddress( diff --git a/lib/order/order_view/order_pay_selected.dart b/lib/order/order_view/order_pay_selected.dart new file mode 100644 index 00000000..adaa02e5 --- /dev/null +++ b/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 createState() { + return _OrderPaySelected(); + } + +} + +class _OrderPaySelected extends State { + @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, + ), + ); + } + + +} \ No newline at end of file diff --git a/lib/qr/qr_code_scan.dart b/lib/qr/qr_code_scan.dart index 529d84e0..8561242d 100644 --- a/lib/qr/qr_code_scan.dart +++ b/lib/qr/qr_code_scan.dart @@ -1,10 +1,10 @@ +import 'dart:ui'; + import 'package:flutter/material.dart'; -import 'package:flutter_qr_reader/flutter_qr_reader.dart'; -import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:flutter_scankit/scan_kit_widget.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/view_widget/my_appbar.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:permission_handler/permission_handler.dart'; @@ -16,18 +16,14 @@ class QrCodeScanPage extends StatefulWidget { } class _QrCodeScanPage extends State { - GlobalKey<_QrCodeScanPage> qrViewKey = GlobalKey(); - QrReaderViewController viewController; + ScanKitController _controller; + final screenWidth = window.physicalSize.width; + final screenHeight = window.physicalSize.height; @override void initState() { super.initState(); - - readerHeight = 812; - Future.delayed(Duration(seconds: 1), () { - buildReaderView(); - }); } @override @@ -37,20 +33,24 @@ class _QrCodeScanPage extends State { child: Stack( children: [ Positioned( - child: qrReaderView != null - ? Column( - children: [ - Expanded( - child: qrReaderView, - flex: readerHeight.toInt(), - ), - // Expanded(child: qrReaderView, flex: readerHeight,), - ], - ) - : Container( - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, + child: Column( + children: [ + Expanded( + child: ScanKitWidget( + callback: (controller) { + _controller = controller; + controller.onResult.listen((result) { + debugPrint("scanning result:$result"); + Navigator.of(context).pop(result); + }); + }, + continuouslyScan: false, + boundingBox: Rect.fromLTRB(0, 0, screenWidth, screenHeight), ), + flex: 1, + ), + ], + ), top: 0, bottom: 0, left: 0, @@ -68,12 +68,12 @@ class _QrCodeScanPage extends State { margin: EdgeInsets.only(right: 16.w), child: GestureDetector( onTap: () { - openStorage(); + _controller.pickPhoto(); }, child: Text( S.of(context).xiangce, style: TextStyle( - color: Colors.white, + color: Colors.black, fontSize: 18.sp, fontWeight: FontWeight.bold, ), @@ -91,80 +91,11 @@ class _QrCodeScanPage extends State { ); } - 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 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) { - 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 void dispose() { - if (this.viewController != null) { - this.viewController.stopCamera(); - } + // if (this._controller != null) { + // this._controller.dispose(); + // } super.dispose(); } } diff --git a/lib/retrofit/data/order_info.dart b/lib/retrofit/data/order_info.dart index 12628ffe..6b7eff3c 100644 --- a/lib/retrofit/data/order_info.dart +++ b/lib/retrofit/data/order_info.dart @@ -64,185 +64,66 @@ import 'package:huixiang/retrofit/data/shoppingCart.dart'; /// productList : [{"id":"1408358257390518272","createTime":"2021-06-25 17:35:49","createUser":"1404743858104827904","updateTime":"2021-06-25 17:35:49","updateUser":"1404743858104827904","tenantCode":null,"storeId":"1344490596986781696","orderId":"1408358257373741056","productId":"1404742074535772160","productName":"商品1","skuId":"1404744485652398080","skuNameStr":"中","skuImg":"","buyNum":2,"refundNum":0,"weight":0,"applyPrice":"0.00","sellPrice":"10.00","postPay":"0.00","isDelete":0,"discountAmount":"2.20","discountPercent":11,"status":true,"batch":1}] class OrderInfo { - String _id; - String _createTime; - String _createUser; - String _updateTime; - String _updateUser; - String _tenantCode; - String _storeId; - String _storeName; - String _tableId; - String _mid; - String _parentId; - String _parentCode; - String _orderCode; - String _orderType; - String _dayFlowCode; - int _orderStatus; - int _sendStatus; - int _payStatus; - String _memberAccount; - String _logisticsId; - String _shipperCode; - String _logisticsName; - String _logisticsNum; - dynamic _logisticsCase; - int _refundStatus; - AddressExt _addressExt; - String _postFee; - String _orderSum; - String _paySum; - String _paySumSub; - String _accountPay; - String _couponSubPrice; - String _customPrice; - String _removeDecimal; - bool _isSubscribe; - dynamic _subcribeTime; - dynamic _sendTime; - dynamic _confirmTime; - dynamic _returnMoneyTime; - String _notes; - dynamic _prepayId; - String _payTime; - int _payChannel; - String _payNum; - String _promotionId; - String _couponId; - int _isDelete; - int _isTakeOut; - int _batch; - String _orderDiscountPrice; - String _dishesDiscountPrice; - String _orderPercentPrice; - String _finalPayPrice; - String _activityNoPrice; - String _activityDiscountPrice; - String _totalDiscountPrice; - int _orderSource; - StoreVO _storeVO; - OrderDetail _orderDetail; - List _productList; - - String get id => _id; - - String get createTime => _createTime; - - String get createUser => _createUser; - - String get updateTime => _updateTime; - - String get updateUser => _updateUser; - - String get tenantCode => _tenantCode; - - String get storeId => _storeId; - - String get storeName => _storeName; - - String get tableId => _tableId; - - String get mid => _mid; - - String get parentId => _parentId; - - String get parentCode => _parentCode; - - String get orderCode => _orderCode; - String get orderType => _orderType; - - String get dayFlowCode => _dayFlowCode; - - int get orderStatus => _orderStatus; - - int get sendStatus => _sendStatus; - - int get payStatus => _payStatus; - - String get memberAccount => _memberAccount; - - String get logisticsId => _logisticsId; - - String get shipperCode => _shipperCode; - - String get logisticsName => _logisticsName; - - String get logisticsNum => _logisticsNum; - - dynamic get logisticsCase => _logisticsCase; - - int get refundStatus => _refundStatus; - - AddressExt get addressExt => _addressExt; - - String get postFee => _postFee; - - String get orderSum => _orderSum; - - String get paySum => _paySum; - - String get paySumSub => _paySumSub; - - String get accountPay => _accountPay; - - String get couponSubPrice => _couponSubPrice; - - String get customPrice => _customPrice; - - String get removeDecimal => _removeDecimal; - - bool get isSubscribe => _isSubscribe; - - dynamic get subcribeTime => _subcribeTime; - - dynamic get sendTime => _sendTime; - - dynamic get confirmTime => _confirmTime; - - dynamic get returnMoneyTime => _returnMoneyTime; - - String get notes => _notes; - - dynamic get prepayId => _prepayId; - - String get payTime => _payTime; - - int get payChannel => _payChannel; - - String get payNum => _payNum; - - String get promotionId => _promotionId; - - String get couponId => _couponId; - - int get isDelete => _isDelete; - - int get isTakeOut => _isTakeOut; - - int get batch => _batch; - - String get orderDiscountPrice => _orderDiscountPrice; - - String get dishesDiscountPrice => _dishesDiscountPrice; - - String get orderPercentPrice => _orderPercentPrice; - - String get finalPayPrice => _finalPayPrice; - - String get activityNoPrice => _activityNoPrice; - - String get activityDiscountPrice => _activityDiscountPrice; - - String get totalDiscountPrice => _totalDiscountPrice; - - int get orderSource => _orderSource; - - StoreVO get storeVO => _storeVO; - - OrderDetail get orderDetail => _orderDetail; - - List get productList => _productList; + String id; + String createTime; + String createUser; + String updateTime; + String updateUser; + String tenantCode; + String storeId; + String storeName; + String tableId; + String mid; + String parentId; + String parentCode; + String orderCode; + int orderType; + String dayFlowCode; + int orderStatus; + int sendStatus; + int payStatus; + String memberAccount; + String logisticsId; + String shipperCode; + String logisticsName; + String logisticsNum; + dynamic logisticsCase; + int refundStatus; + AddressExt addressExt; + String postFee; + String orderSum; + String paySum; + String paySumSub; + String accountPay; + String couponSubPrice; + String customPrice; + String removeDecimal; + bool isSubscribe; + dynamic subcribeTime; + dynamic sendTime; + dynamic confirmTime; + dynamic returnMoneyTime; + String notes; + dynamic prepayId; + String payTime; + int payChannel; + String payNum; + String promotionId; + String couponId; + int isDelete; + int isTakeOut; + int batch; + String orderDiscountPrice; + String dishesDiscountPrice; + String orderPercentPrice; + String finalPayPrice; + String activityNoPrice; + String activityDiscountPrice; + String totalDiscountPrice; + int orderSource; + StoreVO storeVO; + OrderDetail orderDetail; + List productList; OrderInfo( {String id, @@ -258,6 +139,7 @@ class OrderInfo { String parentId, String parentCode, String orderCode, + int orderType, String dayFlowCode, int orderStatus, int sendStatus, @@ -304,345 +186,242 @@ class OrderInfo { StoreVO storeVO, OrderDetail orderDetail, List< OrderProductVOList> productList}) { - _id = id; - _createTime = createTime; - _createUser = createUser; - _updateTime = updateTime; - _updateUser = updateUser; - _tenantCode = tenantCode; - _storeId = storeId; - _storeName = storeName; - _tableId = tableId; - _mid = mid; - _parentId = parentId; - _parentCode = parentCode; - _orderCode = orderCode; - _orderType = orderType; - _dayFlowCode = dayFlowCode; - _orderStatus = orderStatus; - _sendStatus = sendStatus; - _payStatus = payStatus; - _memberAccount = memberAccount; - _logisticsId = logisticsId; - _shipperCode = shipperCode; - _logisticsName = logisticsName; - _logisticsNum = logisticsNum; - _logisticsCase = logisticsCase; - _refundStatus = refundStatus; - _addressExt = addressExt; - _postFee = postFee; - _orderSum = orderSum; - _paySum = paySum; - _paySumSub = paySumSub; - _accountPay = accountPay; - _couponSubPrice = couponSubPrice; - _customPrice = customPrice; - _removeDecimal = removeDecimal; - _isSubscribe = isSubscribe; - _subcribeTime = subcribeTime; - _sendTime = sendTime; - _confirmTime = confirmTime; - _returnMoneyTime = returnMoneyTime; - _notes = notes; - _prepayId = prepayId; - _payTime = payTime; - _payChannel = payChannel; - _payNum = payNum; - _promotionId = promotionId; - _couponId = couponId; - _isDelete = isDelete; - _isTakeOut = isTakeOut; - _batch = batch; - _orderDiscountPrice = orderDiscountPrice; - _dishesDiscountPrice = dishesDiscountPrice; - _orderPercentPrice = orderPercentPrice; - _finalPayPrice = finalPayPrice; - _activityNoPrice = activityNoPrice; - _activityDiscountPrice = activityDiscountPrice; - _totalDiscountPrice = totalDiscountPrice; - _orderSource = orderSource; - _storeVO = storeVO; - _orderDetail = orderDetail; - _productList = productList; + this.id = id; + this.createTime = createTime; + this.createUser = createUser; + this.updateTime = updateTime; + this.updateUser = updateUser; + this.tenantCode = tenantCode; + this.storeId = storeId; + this.storeName = storeName; + this.tableId = tableId; + this.mid = mid; + this.parentId = parentId; + this.parentCode = parentCode; + this.orderCode = orderCode; + this.orderType = orderType; + this.dayFlowCode = dayFlowCode; + this.orderStatus = orderStatus; + this.sendStatus = sendStatus; + this.payStatus = payStatus; + this.memberAccount = memberAccount; + this.logisticsId = logisticsId; + this.shipperCode = shipperCode; + this.logisticsName = logisticsName; + this.logisticsNum = logisticsNum; + this.logisticsCase = logisticsCase; + this.refundStatus = refundStatus; + this.addressExt = addressExt; + this.postFee = postFee; + this.orderSum = orderSum; + this.paySum = paySum; + this.paySumSub = paySumSub; + this.accountPay = accountPay; + this.couponSubPrice = couponSubPrice; + this.customPrice = customPrice; + this.removeDecimal = removeDecimal; + this.isSubscribe = isSubscribe; + this.subcribeTime = subcribeTime; + this.sendTime = sendTime; + this.confirmTime = confirmTime; + this.returnMoneyTime = returnMoneyTime; + this.notes = notes; + this.prepayId = prepayId; + this.payTime = payTime; + this.payChannel = payChannel; + this.payNum = payNum; + this.promotionId = promotionId; + this.couponId = couponId; + this.isDelete = isDelete; + this.isTakeOut = isTakeOut; + this.batch = batch; + this.orderDiscountPrice = orderDiscountPrice; + this.dishesDiscountPrice = dishesDiscountPrice; + this.orderPercentPrice = orderPercentPrice; + this.finalPayPrice = finalPayPrice; + this.activityNoPrice = activityNoPrice; + this.activityDiscountPrice = activityDiscountPrice; + this.totalDiscountPrice = totalDiscountPrice; + this.orderSource = orderSource; + this.storeVO = storeVO; + this.orderDetail = orderDetail; + this.productList = productList; } OrderInfo.fromJson(dynamic json) { - _id = json["id"]; - _createTime = json["createTime"]; - _createUser = json["createUser"]; - _updateTime = json["updateTime"]; - _updateUser = json["updateUser"]; - _tenantCode = json["tenantCode"]; - _storeId = json["storeId"]; - _storeName = json["storeName"]; - _tableId = json["tableId"]; - _mid = json["mid"]; - _parentId = json["parentId"]; - _parentCode = json["parentCode"]; - _orderCode = json["orderCode"]; - _orderType = json["orderType"]; - _dayFlowCode = json["dayFlowCode"]; - _orderStatus = json["orderStatus"]; - _sendStatus = json["sendStatus"]; - _payStatus = json["payStatus"]; - _memberAccount = json["memberAccount"]; - _logisticsId = json["logisticsId"]; - _shipperCode = json["shipperCode"]; - _logisticsName = json["logisticsName"]; - _logisticsNum = json["logisticsNum"]; - _logisticsCase = json["logisticsCase"]; - _refundStatus = json["refundStatus"]; - _addressExt = json["addressExt"] != null + this.id = json["id"]; + this.createTime = json["createTime"]; + this.createUser = json["createUser"]; + this.updateTime = json["updateTime"]; + this.updateUser = json["updateUser"]; + this.tenantCode = json["tenantCode"]; + this.storeId = json["storeId"]; + this.storeName = json["storeName"]; + this.tableId = json["tableId"]; + this.mid = json["mid"]; + this.parentId = json["parentId"]; + this.parentCode = json["parentCode"]; + this.orderCode = json["orderCode"]; + this.orderType = json["orderType"]; + this.dayFlowCode = json["dayFlowCode"]; + this.orderStatus = json["orderStatus"]; + this.sendStatus = json["sendStatus"]; + this.payStatus = json["payStatus"]; + this.memberAccount = json["memberAccount"]; + this.logisticsId = json["logisticsId"]; + this.shipperCode = json["shipperCode"]; + this.logisticsName = json["logisticsName"]; + this.logisticsNum = json["logisticsNum"]; + this.logisticsCase = json["logisticsCase"]; + this.refundStatus = json["refundStatus"]; + this.addressExt = json["addressExt"] != null ? AddressExt.fromJson(json["addressExt"]) : null; - _postFee = json["postFee"]; - _orderSum = json["orderSum"]; - _paySum = json["paySum"]; - _paySumSub = json["paySumSub"]; - _accountPay = json["accountPay"]; - _couponSubPrice = json["couponSubPrice"]; - _customPrice = json["customPrice"]; - _removeDecimal = json["removeDecimal"]; - _isSubscribe = json["isSubscribe"]; - _subcribeTime = json["subcribeTime"]; - _sendTime = json["sendTime"]; - _confirmTime = json["confirmTime"]; - _returnMoneyTime = json["returnMoneyTime"]; - _notes = json["notes"]; - _prepayId = json["prepayId"]; - _payTime = json["payTime"]; - _payChannel = json["payChannel"]; - _payNum = json["payNum"]; - _promotionId = json["promotionId"]; - _couponId = json["couponId"]; - _isDelete = json["isDelete"]; - _isTakeOut = json["isTakeOut"]; - _batch = json["batch"]; - _orderDiscountPrice = json["orderDiscountPrice"]; - _dishesDiscountPrice = json["dishesDiscountPrice"]; - _orderPercentPrice = json["orderPercentPrice"]; - _finalPayPrice = json["finalPayPrice"]; - _activityNoPrice = json["activityNoPrice"]; - _activityDiscountPrice = json["activityDiscountPrice"]; - _totalDiscountPrice = json["totalDiscountPrice"]; - _orderSource = json["orderSource"]; - _storeVO = + this.postFee = json["postFee"]; + this.orderSum = json["orderSum"]; + this.paySum = json["paySum"]; + this.paySumSub = json["paySumSub"]; + this.accountPay = json["accountPay"]; + this.couponSubPrice = json["couponSubPrice"]; + this.customPrice = json["customPrice"]; + this.removeDecimal = json["removeDecimal"]; + this.isSubscribe = json["isSubscribe"]; + this.subcribeTime = json["subcribeTime"]; + this.sendTime = json["sendTime"]; + this.confirmTime = json["confirmTime"]; + this.returnMoneyTime = json["returnMoneyTime"]; + this.notes = json["notes"]; + this.prepayId = json["prepayId"]; + this.payTime = json["payTime"]; + this.payChannel = json["payChannel"]; + this.payNum = json["payNum"]; + this.promotionId = json["promotionId"]; + this.couponId = json["couponId"]; + this.isDelete = json["isDelete"]; + this.isTakeOut = json["isTakeOut"]; + this.batch = json["batch"]; + this.orderDiscountPrice = json["orderDiscountPrice"]; + this.dishesDiscountPrice = json["dishesDiscountPrice"]; + this.orderPercentPrice = json["orderPercentPrice"]; + this.finalPayPrice = json["finalPayPrice"]; + this.activityNoPrice = json["activityNoPrice"]; + this.activityDiscountPrice = json["activityDiscountPrice"]; + this.totalDiscountPrice = json["totalDiscountPrice"]; + this.orderSource = json["orderSource"]; + this.storeVO = json["storeVO"] != null ? StoreVO.fromJson(json["storeVO"]) : null; - _orderDetail = json["orderDetail"] != null + this.orderDetail = json["orderDetail"] != null ? OrderDetail.fromJson(json["orderDetail"]) : null; if (json["productList"] != null) { - _productList = []; + this.productList = []; json["productList"].forEach((v) { - _productList.add( OrderProductVOList.fromJson(v)); + this.productList.add( OrderProductVOList.fromJson(v)); }); } } Map toJson() { var map = {}; - map["id"] = _id; - map["createTime"] = _createTime; - map["createUser"] = _createUser; - map["updateTime"] = _updateTime; - map["updateUser"] = _updateUser; - map["tenantCode"] = _tenantCode; - map["storeId"] = _storeId; - map["storeName"] = _storeName; - map["tableId"] = _tableId; - map["mid"] = _mid; - map["parentId"] = _parentId; - map["parentCode"] = _parentCode; - map["orderCode"] = _orderCode; - map["orderType"] = _orderType; - map["dayFlowCode"] = _dayFlowCode; - map["orderStatus"] = _orderStatus; - map["sendStatus"] = _sendStatus; - map["payStatus"] = _payStatus; - map["memberAccount"] = _memberAccount; - map["logisticsId"] = _logisticsId; - map["shipperCode"] = _shipperCode; - map["logisticsName"] = _logisticsName; - map["logisticsNum"] = _logisticsNum; - map["logisticsCase"] = _logisticsCase; - map["refundStatus"] = _refundStatus; - if (_addressExt != null) { - map["addressExt"] = _addressExt.toJson(); + map["id"] = this.id; + map["createTime"] = this.createTime; + map["createUser"] = this.createUser; + map["updateTime"] = this.updateTime; + map["updateUser"] = this.updateUser; + map["tenantCode"] = this.tenantCode; + map["storeId"] = this.storeId; + map["storeName"] = this.storeName; + map["tableId"] = this.tableId; + map["mid"] = this.mid; + map["parentId"] = this.parentId; + map["parentCode"] = this.parentCode; + map["orderCode"] = this.orderCode; + map["orderType"] = this.orderType; + map["dayFlowCode"] = this.dayFlowCode; + map["orderStatus"] = this.orderStatus; + map["sendStatus"] = this.sendStatus; + map["payStatus"] = this.payStatus; + map["memberAccount"] = this.memberAccount; + map["logisticsId"] = this.logisticsId; + map["shipperCode"] = this.shipperCode; + map["logisticsName"] = this.logisticsName; + map["logisticsNum"] = this.logisticsNum; + map["logisticsCase"] = this.logisticsCase; + map["refundStatus"] = this.refundStatus; + if (this.addressExt != null) { + map["addressExt"] = this.addressExt.toJson(); } - map["postFee"] = _postFee; - map["orderSum"] = _orderSum; - map["paySum"] = _paySum; - map["paySumSub"] = _paySumSub; - map["accountPay"] = _accountPay; - map["couponSubPrice"] = _couponSubPrice; - map["customPrice"] = _customPrice; - map["removeDecimal"] = _removeDecimal; - map["isSubscribe"] = _isSubscribe; - map["subcribeTime"] = _subcribeTime; - map["sendTime"] = _sendTime; - map["confirmTime"] = _confirmTime; - map["returnMoneyTime"] = _returnMoneyTime; - map["notes"] = _notes; - map["prepayId"] = _prepayId; - map["payTime"] = _payTime; - map["payChannel"] = _payChannel; - map["payNum"] = _payNum; - map["promotionId"] = _promotionId; - map["couponId"] = _couponId; - map["isDelete"] = _isDelete; - map["isTakeOut"] = _isTakeOut; - map["batch"] = _batch; - map["orderDiscountPrice"] = _orderDiscountPrice; - map["dishesDiscountPrice"] = _dishesDiscountPrice; - map["orderPercentPrice"] = _orderPercentPrice; - map["finalPayPrice"] = _finalPayPrice; - map["activityNoPrice"] = _activityNoPrice; - map["activityDiscountPrice"] = _activityDiscountPrice; - map["totalDiscountPrice"] = _totalDiscountPrice; - map["orderSource"] = _orderSource; - if (_storeVO != null) { - map["storeVO"] = _storeVO.toJson(); + map["postFee"] = this.postFee; + map["orderSum"] = this.orderSum; + map["paySum"] = this.paySum; + map["paySumSub"] = this.paySumSub; + map["accountPay"] = this.accountPay; + map["couponSubPrice"] = this.couponSubPrice; + map["customPrice"] = this.customPrice; + map["removeDecimal"] = this.removeDecimal; + map["isSubscribe"] = this.isSubscribe; + map["subcribeTime"] = this.subcribeTime; + map["sendTime"] = this.sendTime; + map["confirmTime"] = this.confirmTime; + map["returnMoneyTime"] = this.returnMoneyTime; + map["notes"] = this.notes; + map["prepayId"] = this.prepayId; + map["payTime"] = this.payTime; + map["payChannel"] = this.payChannel; + map["payNum"] = this.payNum; + map["promotionId"] = this.promotionId; + map["couponId"] = this.couponId; + map["isDelete"] = this.isDelete; + map["isTakeOut"] = this.isTakeOut; + map["batch"] = this.batch; + map["orderDiscountPrice"] = this.orderDiscountPrice; + map["dishesDiscountPrice"] = this.dishesDiscountPrice; + map["orderPercentPrice"] = this.orderPercentPrice; + map["finalPayPrice"] = this.finalPayPrice; + map["activityNoPrice"] = this.activityNoPrice; + map["activityDiscountPrice"] = this.activityDiscountPrice; + map["totalDiscountPrice"] = this.totalDiscountPrice; + map["orderSource"] = this.orderSource; + if (this.storeVO != null) { + map["storeVO"] = this.storeVO.toJson(); } - if (_orderDetail != null) { - map["orderDetail"] = _orderDetail.toJson(); + if (this.orderDetail != null) { + map["orderDetail"] = this.orderDetail.toJson(); } - if (_productList != null) { - map["productList"] = _productList.map((v) => v.toJson()).toList(); + if (this.productList != null) { + map["productList"] = this.productList.map((v) => v.toJson()).toList(); } return map; } } -/// id : "1408358257390518272" -/// createTime : "2021-06-25 17:35:49" -/// createUser : "1404743858104827904" -/// updateTime : "2021-06-25 17:35:49" -/// updateUser : "1404743858104827904" -/// tenantCode : null -/// storeId : "1344490596986781696" -/// orderId : "1408358257373741056" -/// productId : "1404742074535772160" -/// productName : "商品1" -/// skuId : "1404744485652398080" -/// skuNameStr : "中" -/// skuImg : "" -/// buyNum : 2 -/// refundNum : 0 -/// weight : 0 -/// applyPrice : "0.00" -/// sellPrice : "10.00" -/// postPay : "0.00" -/// isDelete : 0 -/// discountAmount : "2.20" -/// discountPercent : 11 -/// status : true -/// batch : 1 - - -/// orderProductList : [{"id":"1408358257390518272","platterList":null,"tenantCode":"1177","storeId":"1344490596986781696","orderId":"1408358257373741056","productId":"1404742074535772160","productName":"商品1","skuId":"1404744485652398080","skuNameStr":"中","skuImg":"","buyNum":2,"refundNum":0,"weight":0,"applyPrice":"0.00","sellPrice":"10.00","postPay":"0.00","isDelete":0,"discountAmount":"2.20","discountPercent":100}] -/// discountName : null -/// discountMoney : null -/// discountNumber : null -/// activityName : null -/// couponDTO : null -/// orderSumPrice : "20.00" -/// paySumPrice : "17.80" -/// activityNoPrice : "0.00" -/// activityPrice : "0.00" -/// dishesList : [] -/// customPrice : "0.00" -/// nextPerson : "占永辉" -/// isTakeOut : 0 -/// memberRec : null -/// isSubscribe : null -/// subcribeTime : null -/// postFee : "0.00" -/// shipperCode : "" -/// logisticsName : "" -/// logisticsNum : "" -/// orderNum : 0 -/// productNum : 0 -/// mins : 1 -/// predictTime : null - class OrderDetail { - List< OrderProductVOList> _orderProductList; - dynamic _discountName; - dynamic _discountMoney; - dynamic _discountNumber; - dynamic _activityName; - CouponDTO _couponDTO; - String _orderSumPrice; - String _paySumPrice; - String _activityNoPrice; - String _activityPrice; - String _promotionName; - List _dishesList; - String _customPrice; - String _nextPerson; - int _isTakeOut; - dynamic _memberRec; - dynamic _isSubscribe; - dynamic _subcribeTime; - String _postFee; - String _shipperCode; - String _logisticsName; - String _logisticsNum; - int _orderNum; - int _productNum; - int _mins; - dynamic _predictTime; - - List< OrderProductVOList> get orderProductList => _orderProductList; - - dynamic get discountName => _discountName; - - dynamic get discountMoney => _discountMoney; - - dynamic get discountNumber => _discountNumber; - - dynamic get activityName => _activityName; - - CouponDTO get couponDTO => _couponDTO; - - String get orderSumPrice => _orderSumPrice; - - String get paySumPrice => _paySumPrice; - - String get activityNoPrice => _activityNoPrice; - - String get activityPrice => _activityPrice; - String get promotionName => _promotionName; - - List get dishesList => _dishesList; - - String get customPrice => _customPrice; - - String get nextPerson => _nextPerson; - - int get isTakeOut => _isTakeOut; - - dynamic get memberRec => _memberRec; - - dynamic get isSubscribe => _isSubscribe; - - dynamic get subcribeTime => _subcribeTime; - - String get postFee => _postFee; - - String get shipperCode => _shipperCode; - - String get logisticsName => _logisticsName; - - String get logisticsNum => _logisticsNum; - - int get orderNum => _orderNum; - - int get productNum => _productNum; - - int get mins => _mins; - - dynamic get predictTime => _predictTime; + List< OrderProductVOList> orderProductList; + dynamic discountName; + dynamic discountMoney; + dynamic discountNumber; + dynamic activityName; + CouponDTO couponDTO; + String orderSumPrice; + String paySumPrice; + String activityNoPrice; + String activityPrice; + String promotionName; + List dishesList; + String customPrice; + String nextPerson; + int isTakeOut; + dynamic memberRec; + dynamic isSubscribe; + dynamic subcribeTime; + String postFee; + String shipperCode; + String logisticsName; + String logisticsNum; + int orderNum; + int productNum; + int mins; + dynamic predictTime; OrderDetail( {List< OrderProductVOList> orderProductList, @@ -671,235 +450,141 @@ class OrderDetail { int productNum, int mins, dynamic predictTime}) { - _orderProductList = orderProductList; - _discountName = discountName; - _discountMoney = discountMoney; - _discountNumber = discountNumber; - _activityName = activityName; - _couponDTO = couponDTO; - _orderSumPrice = orderSumPrice; - _paySumPrice = paySumPrice; - _activityNoPrice = activityNoPrice; - _activityPrice = activityPrice; - _promotionName = promotionName; - _dishesList = dishesList; - _customPrice = customPrice; - _nextPerson = nextPerson; - _isTakeOut = isTakeOut; - _memberRec = memberRec; - _isSubscribe = isSubscribe; - _subcribeTime = subcribeTime; - _postFee = postFee; - _shipperCode = shipperCode; - _logisticsName = logisticsName; - _logisticsNum = logisticsNum; - _orderNum = orderNum; - _productNum = productNum; - _mins = mins; - _predictTime = predictTime; + this.orderProductList = orderProductList; + this.discountName = discountName; + this.discountMoney = discountMoney; + this.discountNumber = discountNumber; + this.activityName = activityName; + this.couponDTO = couponDTO; + this.orderSumPrice = orderSumPrice; + this.paySumPrice = paySumPrice; + this.activityNoPrice = activityNoPrice; + this.activityPrice = activityPrice; + this.promotionName = promotionName; + this.dishesList = dishesList; + this.customPrice = customPrice; + this.nextPerson = nextPerson; + this.isTakeOut = isTakeOut; + this.memberRec = memberRec; + this.isSubscribe = isSubscribe; + this.subcribeTime = subcribeTime; + this.postFee = postFee; + this.shipperCode = shipperCode; + this.logisticsName = logisticsName; + this.logisticsNum = logisticsNum; + this.orderNum = orderNum; + this.productNum = productNum; + this.mins = mins; + this.predictTime = predictTime; } OrderDetail.fromJson(dynamic json) { if (json["orderProductList"] != null) { - _orderProductList = []; + this.orderProductList = []; json["orderProductList"].forEach((v) { - _orderProductList.add( OrderProductVOList.fromJson(v)); + this.orderProductList.add( OrderProductVOList.fromJson(v)); }); } - _discountName = json["discountName"]; - _discountMoney = json["discountMoney"]; - _discountNumber = json["discountNumber"]; - _activityName = json["activityName"]; - _couponDTO = json["couponDTO"] != null ? CouponDTO.fromJson(json["couponDTO"]) : null; - _orderSumPrice = json["orderSumPrice"]; - _paySumPrice = json["paySumPrice"]; - _activityNoPrice = json["activityNoPrice"]; - _activityPrice = json["activityPrice"]; - _promotionName = json["promotionName"]; + this.discountName = json["discountName"]; + this.discountMoney = json["discountMoney"]; + this.discountNumber = json["discountNumber"]; + this.activityName = json["activityName"]; + this.couponDTO = json["couponDTO"] != null ? CouponDTO.fromJson(json["couponDTO"]) : null; + this.orderSumPrice = json["orderSumPrice"]; + this.paySumPrice = json["paySumPrice"]; + this.activityNoPrice = json["activityNoPrice"]; + this.activityPrice = json["activityPrice"]; + this.promotionName = json["promotionName"]; if (json["dishesList"] != null) { - _dishesList = []; + this.dishesList = []; json["dishesList"].forEach((v) { - _dishesList.add(v); + this.dishesList.add(v); }); } - _customPrice = json["customPrice"]; - _nextPerson = json["nextPerson"]; - _isTakeOut = json["isTakeOut"]; - _memberRec = json["memberRec"]; - _isSubscribe = json["isSubscribe"]; - _subcribeTime = json["subcribeTime"]; - _postFee = json["postFee"]; - _shipperCode = json["shipperCode"]; - _logisticsName = json["logisticsName"]; - _logisticsNum = json["logisticsNum"]; - _orderNum = json["orderNum"]; - _productNum = json["productNum"]; - _mins = json["mins"]; - _predictTime = json["predictTime"]; + this.customPrice = json["customPrice"]; + this.nextPerson = json["nextPerson"]; + this.isTakeOut = json["isTakeOut"]; + this.memberRec = json["memberRec"]; + this.isSubscribe = json["isSubscribe"]; + this.subcribeTime = json["subcribeTime"]; + this.postFee = json["postFee"]; + this.shipperCode = json["shipperCode"]; + this.logisticsName = json["logisticsName"]; + this.logisticsNum = json["logisticsNum"]; + this.orderNum = json["orderNum"]; + this.productNum = json["productNum"]; + this.mins = json["mins"]; + this.predictTime = json["predictTime"]; } Map toJson() { var map = {}; - if (_orderProductList != null) { + if (this.orderProductList != null) { map["orderProductList"] = - _orderProductList.map((v) => v.toJson()).toList(); + this.orderProductList.map((v) => v.toJson()).toList(); } - map["discountName"] = _discountName; - map["discountMoney"] = _discountMoney; - map["discountNumber"] = _discountNumber; - map["activityName"] = _activityName; - map["couponDTO"] = _couponDTO; - map["orderSumPrice"] = _orderSumPrice; - map["paySumPrice"] = _paySumPrice; - map["activityNoPrice"] = _activityNoPrice; - map["activityPrice"] = _activityPrice; - if (_dishesList != null) { - map["dishesList"] = _dishesList.map((v) => v.toJson()).toList(); + map["discountName"] = this.discountName; + map["discountMoney"] = this.discountMoney; + map["discountNumber"] = this.discountNumber; + map["activityName"] = this.activityName; + map["couponDTO"] = this.couponDTO; + map["orderSumPrice"] = this.orderSumPrice; + map["paySumPrice"] = this.paySumPrice; + map["activityNoPrice"] = this.activityNoPrice; + map["activityPrice"] = this.activityPrice; + if (this.dishesList != null) { + map["dishesList"] = this.dishesList.map((v) => v.toJson()).toList(); } - map["customPrice"] = _customPrice; - map["nextPerson"] = _nextPerson; - map["isTakeOut"] = _isTakeOut; - map["memberRec"] = _memberRec; - map["isSubscribe"] = _isSubscribe; - map["subcribeTime"] = _subcribeTime; - map["postFee"] = _postFee; - map["shipperCode"] = _shipperCode; - map["logisticsName"] = _logisticsName; - map["logisticsNum"] = _logisticsNum; - map["orderNum"] = _orderNum; - map["productNum"] = _productNum; - map["mins"] = _mins; - map["predictTime"] = _predictTime; + map["customPrice"] = this.customPrice; + map["nextPerson"] = this.nextPerson; + map["isTakeOut"] = this.isTakeOut; + map["memberRec"] = this.memberRec; + map["isSubscribe"] = this.isSubscribe; + map["subcribeTime"] = this.subcribeTime; + map["postFee"] = this.postFee; + map["shipperCode"] = this.shipperCode; + map["logisticsName"] = this.logisticsName; + map["logisticsNum"] = this.logisticsNum; + map["orderNum"] = this.orderNum; + map["productNum"] = this.productNum; + map["mins"] = this.mins; + map["predictTime"] = this.predictTime; return map; } } -/// id : "1344490596986781696" -/// storeName : "小小店" -/// nickName : "" -/// businessService : "WIFI,免费停车" -/// businessType : "测试" -/// logo : "" -/// openStartTime : "08:25:43" -/// openEndTime : "23:25:43" -/// shipAddress : "汉街总部国际" -/// remark : null -/// mobile : "13554204268" -/// refundAddress : null -/// refundTel : null -/// refundContact : null -/// isAutoSendRefundAddress : 1 -/// soldNum : null -/// storeTemplateConfig : null -/// storeTable : null -/// threshold : null -/// freePostAge : null -/// logisticsThreshold : null -/// logisticsFreePostAge : null -/// longitude : "114.3442250000" -/// latitude : "30.5541770000" -/// deliveryDistance : null -/// couponVO : null -/// posType : {"desc":"零售商店","code":"RETAILSTORE"} -/// banners : null -/// tips : null -/// storeBrandImg : null -/// defaultPostAge : null - class StoreVO { - String _id; - String _storeName; - String _nickName; - String _businessService; - String _businessType; - String _logo; - String _openStartTime; - String _openEndTime; - String _shipAddress; - dynamic _remark; - String _mobile; - dynamic _refundAddress; - dynamic _refundTel; - dynamic _refundContact; - int _isAutoSendRefundAddress; - dynamic _soldNum; - dynamic _storeTemplateConfig; - dynamic _storeTable; - dynamic _threshold; - dynamic _freePostAge; - dynamic _logisticsThreshold; - dynamic _logisticsFreePostAge; - String _longitude; - String _latitude; - dynamic _deliveryDistance; - dynamic _couponVO; - PosType _posType; - dynamic _banners; - dynamic _tips; - dynamic _storeBrandImg; - dynamic _defaultPostAge; - - String get id => _id; - - String get storeName => _storeName; - - String get nickName => _nickName; - - String get businessService => _businessService; - - String get businessType => _businessType; - - String get logo => _logo; - - String get openStartTime => _openStartTime; - - String get openEndTime => _openEndTime; - - String get shipAddress => _shipAddress; - - dynamic get remark => _remark; - - String get mobile => _mobile; - - dynamic get refundAddress => _refundAddress; - - dynamic get refundTel => _refundTel; - - dynamic get refundContact => _refundContact; - - int get isAutoSendRefundAddress => _isAutoSendRefundAddress; - - dynamic get soldNum => _soldNum; - - dynamic get storeTemplateConfig => _storeTemplateConfig; - - dynamic get storeTable => _storeTable; - - dynamic get threshold => _threshold; - - dynamic get freePostAge => _freePostAge; - - dynamic get logisticsThreshold => _logisticsThreshold; - - dynamic get logisticsFreePostAge => _logisticsFreePostAge; - - String get longitude => _longitude; - - String get latitude => _latitude; - - dynamic get deliveryDistance => _deliveryDistance; - - dynamic get couponVO => _couponVO; - - PosType get posType => _posType; - - dynamic get banners => _banners; - - dynamic get tips => _tips; - - dynamic get storeBrandImg => _storeBrandImg; - - dynamic get defaultPostAge => _defaultPostAge; + String id; + String storeName; + String nickName; + String businessService; + String businessType; + String logo; + String openStartTime; + String openEndTime; + String shipAddress; + dynamic remark; + String mobile; + dynamic refundAddress; + dynamic refundTel; + dynamic refundContact; + int isAutoSendRefundAddress; + dynamic soldNum; + dynamic storeTemplateConfig; + dynamic storeTable; + dynamic threshold; + dynamic freePostAge; + dynamic logisticsThreshold; + dynamic logisticsFreePostAge; + String longitude; + String latitude; + dynamic deliveryDistance; + dynamic couponVO; + PosType posType; + dynamic banners; + dynamic tips; + dynamic storeBrandImg; + dynamic defaultPostAge; StoreVO( {String id, @@ -933,109 +618,109 @@ class StoreVO { dynamic tips, dynamic storeBrandImg, dynamic defaultPostAge}) { - _id = id; - _storeName = storeName; - _nickName = nickName; - _businessService = businessService; - _businessType = businessType; - _logo = logo; - _openStartTime = openStartTime; - _openEndTime = openEndTime; - _shipAddress = shipAddress; - _remark = remark; - _mobile = mobile; - _refundAddress = refundAddress; - _refundTel = refundTel; - _refundContact = refundContact; - _isAutoSendRefundAddress = isAutoSendRefundAddress; - _soldNum = soldNum; - _storeTemplateConfig = storeTemplateConfig; - _storeTable = storeTable; - _threshold = threshold; - _freePostAge = freePostAge; - _logisticsThreshold = logisticsThreshold; - _logisticsFreePostAge = logisticsFreePostAge; - _longitude = longitude; - _latitude = latitude; - _deliveryDistance = deliveryDistance; - _couponVO = couponVO; - _posType = posType; - _banners = banners; - _tips = tips; - _storeBrandImg = storeBrandImg; - _defaultPostAge = defaultPostAge; + this.id = id; + this.storeName = storeName; + this.nickName = nickName; + this.businessService = businessService; + this.businessType = businessType; + this.logo = logo; + this.openStartTime = openStartTime; + this.openEndTime = openEndTime; + this.shipAddress = shipAddress; + this.remark = remark; + this.mobile = mobile; + this.refundAddress = refundAddress; + this.refundTel = refundTel; + this.refundContact = refundContact; + this.isAutoSendRefundAddress = isAutoSendRefundAddress; + this.soldNum = soldNum; + this.storeTemplateConfig = storeTemplateConfig; + this.storeTable = storeTable; + this.threshold = threshold; + this.freePostAge = freePostAge; + this.logisticsThreshold = logisticsThreshold; + this.logisticsFreePostAge = logisticsFreePostAge; + this.longitude = longitude; + this.latitude = latitude; + this.deliveryDistance = deliveryDistance; + this.couponVO = couponVO; + this.posType = posType; + this.banners = banners; + this.tips = tips; + this.storeBrandImg = storeBrandImg; + this.defaultPostAge = defaultPostAge; } StoreVO.fromJson(dynamic json) { - _id = json["id"]; - _storeName = json["storeName"]; - _nickName = json["nickName"]; - _businessService = json["businessService"]; - _businessType = json["businessType"]; - _logo = json["logo"]; - _openStartTime = json["openStartTime"]; - _openEndTime = json["openEndTime"]; - _shipAddress = json["shipAddress"]; - _remark = json["remark"]; - _mobile = json["mobile"]; - _refundAddress = json["refundAddress"]; - _refundTel = json["refundTel"]; - _refundContact = json["refundContact"]; - _isAutoSendRefundAddress = json["isAutoSendRefundAddress"]; - _soldNum = json["soldNum"]; - _storeTemplateConfig = json["storeTemplateConfig"]; - _storeTable = json["storeTable"]; - _threshold = json["threshold"]; - _freePostAge = json["freePostAge"]; - _logisticsThreshold = json["logisticsThreshold"]; - _logisticsFreePostAge = json["logisticsFreePostAge"]; - _longitude = json["longitude"]; - _latitude = json["latitude"]; - _deliveryDistance = json["deliveryDistance"]; - _couponVO = json["couponVO"]; - _posType = + this.id = json["id"]; + this.storeName = json["storeName"]; + this.nickName = json["nickName"]; + this.businessService = json["businessService"]; + this.businessType = json["businessType"]; + this.logo = json["logo"]; + this.openStartTime = json["openStartTime"]; + this.openEndTime = json["openEndTime"]; + this.shipAddress = json["shipAddress"]; + this.remark = json["remark"]; + this.mobile = json["mobile"]; + this.refundAddress = json["refundAddress"]; + this.refundTel = json["refundTel"]; + this.refundContact = json["refundContact"]; + this.isAutoSendRefundAddress = json["isAutoSendRefundAddress"]; + this.soldNum = json["soldNum"]; + this.storeTemplateConfig = json["storeTemplateConfig"]; + this.storeTable = json["storeTable"]; + this.threshold = json["threshold"]; + this.freePostAge = json["freePostAge"]; + this.logisticsThreshold = json["logisticsThreshold"]; + this.logisticsFreePostAge = json["logisticsFreePostAge"]; + this.longitude = json["longitude"]; + this.latitude = json["latitude"]; + this.deliveryDistance = json["deliveryDistance"]; + this.couponVO = json["couponVO"]; + this.posType = json["posType"] != null ? PosType.fromJson(json["posType"]) : null; - _banners = json["banners"]; - _tips = json["tips"]; - _storeBrandImg = json["storeBrandImg"]; - _defaultPostAge = json["defaultPostAge"]; + this.banners = json["banners"]; + this.tips = json["tips"]; + this.storeBrandImg = json["storeBrandImg"]; + this.defaultPostAge = json["defaultPostAge"]; } Map toJson() { var map = {}; - map["id"] = _id; - map["storeName"] = _storeName; - map["nickName"] = _nickName; - map["businessService"] = _businessService; - map["businessType"] = _businessType; - map["logo"] = _logo; - map["openStartTime"] = _openStartTime; - map["openEndTime"] = _openEndTime; - map["shipAddress"] = _shipAddress; - map["remark"] = _remark; - map["mobile"] = _mobile; - map["refundAddress"] = _refundAddress; - map["refundTel"] = _refundTel; - map["refundContact"] = _refundContact; - map["isAutoSendRefundAddress"] = _isAutoSendRefundAddress; - map["soldNum"] = _soldNum; - map["storeTemplateConfig"] = _storeTemplateConfig; - map["storeTable"] = _storeTable; - map["threshold"] = _threshold; - map["freePostAge"] = _freePostAge; - map["logisticsThreshold"] = _logisticsThreshold; - map["logisticsFreePostAge"] = _logisticsFreePostAge; - map["longitude"] = _longitude; - map["latitude"] = _latitude; - map["deliveryDistance"] = _deliveryDistance; - map["couponVO"] = _couponVO; - if (_posType != null) { - map["posType"] = _posType.toJson(); + map["id"] = this.id; + map["storeName"] = this.storeName; + map["nickName"] = this.nickName; + map["businessService"] = this.businessService; + map["businessType"] = this.businessType; + map["logo"] = this.logo; + map["openStartTime"] = this.openStartTime; + map["openEndTime"] = this.openEndTime; + map["shipAddress"] = this.shipAddress; + map["remark"] = this.remark; + map["mobile"] = this.mobile; + map["refundAddress"] = this.refundAddress; + map["refundTel"] = this.refundTel; + map["refundContact"] = this.refundContact; + map["isAutoSendRefundAddress"] = this.isAutoSendRefundAddress; + map["soldNum"] = this.soldNum; + map["storeTemplateConfig"] = this.storeTemplateConfig; + map["storeTable"] = this.storeTable; + map["threshold"] = this.threshold; + map["freePostAge"] = this.freePostAge; + map["logisticsThreshold"] = this.logisticsThreshold; + map["logisticsFreePostAge"] = this.logisticsFreePostAge; + map["longitude"] = this.longitude; + map["latitude"] = this.latitude; + map["deliveryDistance"] = this.deliveryDistance; + map["couponVO"] = this.couponVO; + if (this.posType != null) { + map["posType"] = this.posType.toJson(); } - map["banners"] = _banners; - map["tips"] = _tips; - map["storeBrandImg"] = _storeBrandImg; - map["defaultPostAge"] = _defaultPostAge; + map["banners"] = this.banners; + map["tips"] = this.tips; + map["storeBrandImg"] = this.storeBrandImg; + map["defaultPostAge"] = this.defaultPostAge; return map; } } @@ -1044,27 +729,23 @@ class StoreVO { /// code : "RETAILSTORE" class PosType { - String _desc; - String _code; - - String get desc => _desc; - - String get code => _code; + String desc; + String code; PosType({String desc, String code}) { - _desc = desc; - _code = code; + this.desc = desc; + this.code = code; } PosType.fromJson(dynamic json) { - _desc = json["desc"]; - _code = json["code"]; + this.desc = json["desc"]; + this.code = json["code"]; } Map toJson() { var map = {}; - map["desc"] = _desc; - map["code"] = _code; + map["desc"] = this.desc; + map["code"] = this.code; return map; } } @@ -1085,48 +766,20 @@ class PosType { /// latitude : "30.554177" class AddressExt { - dynamic _addressId; - dynamic _country; - dynamic _countryId; - String _province; - dynamic _provinceId; - String _city; - dynamic _cityId; - String _district; - dynamic _districtId; - String _address; - dynamic _recName; - dynamic _recMobile; - String _longitude; - String _latitude; - - dynamic get addressId => _addressId; - - dynamic get country => _country; - - dynamic get countryId => _countryId; - - String get province => _province; - - dynamic get provinceId => _provinceId; - - String get city => _city; - - dynamic get cityId => _cityId; - - String get district => _district; - - dynamic get districtId => _districtId; - - String get address => _address; - - dynamic get recName => _recName; - - dynamic get recMobile => _recMobile; - - String get longitude => _longitude; - - String get latitude => _latitude; + dynamic addressId; + dynamic country; + dynamic countryId; + String province; + dynamic provinceId; + String city; + dynamic cityId; + String district; + dynamic districtId; + String address; + dynamic recName; + dynamic recMobile; + String longitude; + String latitude; AddressExt( {dynamic addressId, @@ -1143,55 +796,55 @@ class AddressExt { dynamic recMobile, String longitude, String latitude}) { - _addressId = addressId; - _country = country; - _countryId = countryId; - _province = province; - _provinceId = provinceId; - _city = city; - _cityId = cityId; - _district = district; - _districtId = districtId; - _address = address; - _recName = recName; - _recMobile = recMobile; - _longitude = longitude; - _latitude = latitude; + this.addressId = addressId; + this.country = country; + this.countryId = countryId; + this.province = province; + this.provinceId = provinceId; + this.city = city; + this.cityId = cityId; + this.district = district; + this.districtId = districtId; + this.address = address; + this.recName = recName; + this.recMobile = recMobile; + this.longitude = longitude; + this.latitude = latitude; } AddressExt.fromJson(dynamic json) { - _addressId = json["addressId"]; - _country = json["country"]; - _countryId = json["countryId"]; - _province = json["province"]; - _provinceId = json["provinceId"]; - _city = json["city"]; - _cityId = json["cityId"]; - _district = json["district"]; - _districtId = json["districtId"]; - _address = json["address"]; - _recName = json["recName"]; - _recMobile = json["recMobile"]; - _longitude = json["longitude"]; - _latitude = json["latitude"]; + this.addressId = json["addressId"]; + this.country = json["country"]; + this.countryId = json["countryId"]; + this.province = json["province"]; + this.provinceId = json["provinceId"]; + this.city = json["city"]; + this.cityId = json["cityId"]; + this.district = json["district"]; + this.districtId = json["districtId"]; + this.address = json["address"]; + this.recName = json["recName"]; + this.recMobile = json["recMobile"]; + this.longitude = json["longitude"]; + this.latitude = json["latitude"]; } Map toJson() { var map = {}; - map["addressId"] = _addressId; - map["country"] = _country; - map["countryId"] = _countryId; - map["province"] = _province; - map["provinceId"] = _provinceId; - map["city"] = _city; - map["cityId"] = _cityId; - map["district"] = _district; - map["districtId"] = _districtId; - map["address"] = _address; - map["recName"] = _recName; - map["recMobile"] = _recMobile; - map["longitude"] = _longitude; - map["latitude"] = _latitude; + map["addressId"] = this.addressId; + map["country"] = this.country; + map["countryId"] = this.countryId; + map["province"] = this.province; + map["provinceId"] = this.provinceId; + map["city"] = this.city; + map["cityId"] = this.cityId; + map["district"] = this.district; + map["districtId"] = this.districtId; + map["address"] = this.address; + map["recName"] = this.recName; + map["recMobile"] = this.recMobile; + map["longitude"] = this.longitude; + map["latitude"] = this.latitude; return map; } } diff --git a/lib/retrofit/data/order_product_vo.dart b/lib/retrofit/data/order_product_vo.dart index 5b150446..b3e62d5b 100644 --- a/lib/retrofit/data/order_product_vo.dart +++ b/lib/retrofit/data/order_product_vo.dart @@ -1,193 +1,113 @@ - class OrderProductVOList { OrderProductVOList({ ActInfo actInfo, AdditionalComment additionalComment, int buyNum, - int canApplyIntervention, + String canApplyIntervention, Comment comment, - int commentStatus, - int discountAmount, - int id, - int productId, + String commentStatus, + String discountAmount, + String id, + String productId, String productName, String returnCode, - int returnStatus, - int returnType, - int sellPrice, + String returnStatus, + String returnType, + String sellPrice, String skuId, String skuImg, - String skuNameStr,}){ - _actInfo = actInfo; - _additionalComment = additionalComment; - _buyNum = buyNum; - _canApplyIntervention = canApplyIntervention; - _comment = comment; - _commentStatus = commentStatus; - _discountAmount = discountAmount; - _id = id; - _productId = productId; - _productName = productName; - _returnCode = returnCode; - _returnStatus = returnStatus; - _returnType = returnType; - _sellPrice = sellPrice; - _skuId = skuId; - _skuImg = skuImg; - _skuNameStr = skuNameStr; + String skuNameStr, + }) { + this.actInfo = actInfo; + this.additionalComment = additionalComment; + this.buyNum = buyNum; + this.canApplyIntervention = canApplyIntervention; + this.comment = comment; + this.commentStatus = commentStatus; + this.discountAmount = discountAmount; + this.id = id; + this.productId = productId; + this.productName = productName; + this.returnCode = returnCode; + this.returnStatus = returnStatus; + this.returnType = returnType; + this.sellPrice = sellPrice; + this.skuId = skuId; + this.skuImg = skuImg; + this.skuNameStr = skuNameStr; } OrderProductVOList.fromJson(dynamic json) { - _actInfo = json['actInfo'] != null ? ActInfo.fromJson(json['actInfo']) : null; - _additionalComment = json['additionalComment'] != null ? AdditionalComment.fromJson(json['additionalComment']) : null; - _buyNum = json['buyNum']; - _canApplyIntervention = json['canApplyIntervention']; - _comment = json['comment'] != null ? Comment.fromJson(json['comment']) : null; - _commentStatus = json['commentStatus']; - _discountAmount = json['discountAmount']; - _id = json['id']; - _productId = json['productId']; - _productName = json['productName']; - _returnCode = json['returnCode']; - _returnStatus = json['returnStatus']; - _returnType = json['returnType']; - _sellPrice = json['sellPrice']; - _skuId = json['skuId']; - _skuImg = json['skuImg']; - _skuNameStr = json['skuNameStr']; - } - ActInfo _actInfo; - AdditionalComment _additionalComment; - int _buyNum; - int _canApplyIntervention; - Comment _comment; - int _commentStatus; - int _discountAmount; - int _id; - int _productId; - String _productName; - String _returnCode; - int _returnStatus; - int _returnType; - int _sellPrice; - String _skuId; - String _skuImg; - String _skuNameStr; - - ActInfo get actInfo => _actInfo; - AdditionalComment get additionalComment => _additionalComment; - int get buyNum => _buyNum; - int get canApplyIntervention => _canApplyIntervention; - 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; + this.actInfo = + json['actInfo'] != null ? ActInfo.fromJson(json['actInfo']) : null; + this.additionalComment = json['additionalComment'] != null + ? AdditionalComment.fromJson(json['additionalComment']) + : null; + this.buyNum = json['buyNum']; + this.canApplyIntervention = json['canApplyIntervention']; + this.comment = + json['comment'] != null ? Comment.fromJson(json['comment']) : null; + this.commentStatus = json['commentStatus']; + this.discountAmount = json['discountAmount']; + this.id = json['id']; + this.productId = json['productId']; + this.productName = json['productName']; + this.returnCode = json['returnCode']; + this.returnStatus = json['returnStatus']; + this.returnType = json['returnType']; + this.sellPrice = json['sellPrice']; + this.skuId = json['skuId']; + this.skuImg = json['skuImg']; + this.skuNameStr = json['skuNameStr']; + } + + ActInfo actInfo; + AdditionalComment additionalComment; + int buyNum; + String canApplyIntervention; + Comment comment; + String commentStatus; + String discountAmount; + String id; + String productId; + String productName; + String returnCode; + String returnStatus; + String returnType; + String sellPrice; + String skuId; + String skuImg; + String skuNameStr; - set actInfo(ActInfo value) { - _actInfo = value; - } - Map toJson() { final map = {}; - if (_actInfo != null) { - map['actInfo'] = _actInfo.toJson(); + if (this.actInfo != null) { + map['actInfo'] = this.actInfo.toJson(); } - if (_additionalComment != null) { - map['additionalComment'] = _additionalComment.toJson(); + if (this.additionalComment != null) { + map['additionalComment'] = this.additionalComment.toJson(); } - map['buyNum'] = _buyNum; - map['canApplyIntervention'] = _canApplyIntervention; - if (_comment != null) { - map['comment'] = _comment.toJson(); + map['buyNum'] = this.buyNum; + map['canApplyIntervention'] = this.canApplyIntervention; + if (this.comment != null) { + map['comment'] = this.comment.toJson(); } - map['commentStatus'] = _commentStatus; - map['discountAmount'] = _discountAmount; - map['id'] = _id; - map['productId'] = _productId; - map['productName'] = _productName; - map['returnCode'] = _returnCode; - map['returnStatus'] = _returnStatus; - map['returnType'] = _returnType; - map['sellPrice'] = _sellPrice; - map['skuId'] = _skuId; - map['skuImg'] = _skuImg; - map['skuNameStr'] = _skuNameStr; + map['commentStatus'] = this.commentStatus; + map['discountAmount'] = this.discountAmount; + map['id'] = this.id; + map['productId'] = this.productId; + map['productName'] = this.productName; + map['returnCode'] = this.returnCode; + map['returnStatus'] = this.returnStatus; + map['returnType'] = this.returnType; + map['sellPrice'] = this.sellPrice; + map['skuId'] = this.skuId; + map['skuImg'] = this.skuImg; + map['skuNameStr'] = this.skuNameStr; 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 @@ -201,97 +121,58 @@ class OrderProductVOList { class ActInfo { ActInfo({ - int couponDiscountAmount, + String couponDiscountAmount, int couponDiscountRate, - int couponId, + String couponId, int couponType, - int discountAmount, + String discountAmount, int discountRate, - int promotionId, - int promotionType,}){ - _couponDiscountAmount = couponDiscountAmount; - _couponDiscountRate = couponDiscountRate; - _couponId = couponId; - _couponType = couponType; - _discountAmount = discountAmount; - _discountRate = discountRate; - _promotionId = promotionId; - _promotionType = promotionType; + String promotionId, + int promotionType, + }) { + this.couponDiscountAmount = couponDiscountAmount; + this.couponDiscountRate = couponDiscountRate; + this.couponId = couponId; + this.couponType = couponType; + this.discountAmount = discountAmount; + this.discountRate = discountRate; + this.promotionId = promotionId; + this.promotionType = promotionType; } ActInfo.fromJson(dynamic json) { - _couponDiscountAmount = json['couponDiscountAmount']; - _couponDiscountRate = json['couponDiscountRate']; - _couponId = json['couponId']; - _couponType = json['couponType']; - _discountAmount = json['discountAmount']; - _discountRate = json['discountRate']; - _promotionId = json['promotionId']; - _promotionType = json['promotionType']; - } - int _couponDiscountAmount; - int _couponDiscountRate; - int _couponId; - int _couponType; - int _discountAmount; - int _discountRate; - int _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; - } + this.couponDiscountAmount = json['couponDiscountAmount']; + this.couponDiscountRate = json['couponDiscountRate']; + this.couponId = json['couponId']; + this.couponType = json['couponType']; + this.discountAmount = json['discountAmount']; + this.discountRate = json['discountRate']; + this.promotionId = json['promotionId']; + this.promotionType = json['promotionType']; + } + + String couponDiscountAmount; + int couponDiscountRate; + String couponId; + int couponType; + String discountAmount; + int discountRate; + String promotionId; + int promotionType; Map toJson() { final map = {}; - map['couponDiscountAmount'] = _couponDiscountAmount; - map['couponDiscountRate'] = _couponDiscountRate; - map['couponId'] = _couponId; - map['couponType'] = _couponType; - map['discountAmount'] = _discountAmount; - map['discountRate'] = _discountRate; - map['promotionId'] = _promotionId; - map['promotionType'] = _promotionType; + map['couponDiscountAmount'] = this.couponDiscountAmount; + map['couponDiscountRate'] = this.couponDiscountRate; + map['couponId'] = this.couponId; + map['couponType'] = this.couponType; + map['discountAmount'] = this.discountAmount; + map['discountRate'] = this.discountRate; + map['promotionId'] = this.promotionId; + map['promotionType'] = this.promotionType; 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 { @@ -313,180 +194,91 @@ class AdditionalComment { int productId, bool sensitiveFlag, int serviceStar, - int storeId,}){ - _bizType = bizType; - _commentImgs = commentImgs; - _commentImgsFlag = commentImgsFlag; - _commentStar = commentStar; - _commentText = commentText; - _descStar = descStar; - _hideFlag = hideFlag; - _id = id; - _isDelete = isDelete; - _likeNum = likeNum; - _logisticsStar = logisticsStar; - _mid = mid; - _orderProductId = orderProductId; - _parentId = parentId; - _productId = productId; - _sensitiveFlag = sensitiveFlag; - _serviceStar = serviceStar; - _storeId = storeId; + int storeId, + }) { + this.bizType = bizType; + this.commentImgs = commentImgs; + this.commentImgsFlag = commentImgsFlag; + this.commentStar = commentStar; + this.commentText = commentText; + this.descStar = descStar; + this.hideFlag = hideFlag; + this.id = id; + this.isDelete = isDelete; + this.likeNum = likeNum; + this.logisticsStar = logisticsStar; + this.mid = mid; + this.orderProductId = orderProductId; + this.parentId = parentId; + this.productId = productId; + this.sensitiveFlag = sensitiveFlag; + this.serviceStar = serviceStar; + this.storeId = storeId; } AdditionalComment.fromJson(dynamic json) { - _bizType = json['bizType']; - _commentImgs = json['commentImgs']; - _commentImgsFlag = json['commentImgsFlag']; - _commentStar = json['commentStar']; - _commentText = json['commentText']; - _descStar = json['descStar']; - _hideFlag = json['hideFlag']; - _id = json['id']; - _isDelete = json['isDelete']; - _likeNum = json['likeNum']; - _logisticsStar = json['logisticsStar']; - _mid = json['mid']; - _orderProductId = json['orderProductId']; - _parentId = json['parentId']; - _productId = json['productId']; - _sensitiveFlag = json['sensitiveFlag']; - _serviceStar = json['serviceStar']; - _storeId = json['storeId']; - } - int _bizType; - String _commentImgs; - bool _commentImgsFlag; - int _commentStar; - String _commentText; - int _descStar; - bool _hideFlag; - int _id; - bool _isDelete; - int _likeNum; - int _logisticsStar; - int _mid; - int _orderProductId; - int _parentId; - int _productId; - bool _sensitiveFlag; - 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; - } + this.bizType = json['bizType']; + this.commentImgs = json['commentImgs']; + this.commentImgsFlag = json['commentImgsFlag']; + this.commentStar = json['commentStar']; + this.commentText = json['commentText']; + this.descStar = json['descStar']; + this.hideFlag = json['hideFlag']; + this.id = json['id']; + this.isDelete = json['isDelete']; + this.likeNum = json['likeNum']; + this.logisticsStar = json['logisticsStar']; + this.mid = json['mid']; + this.orderProductId = json['orderProductId']; + this.parentId = json['parentId']; + this.productId = json['productId']; + this.sensitiveFlag = json['sensitiveFlag']; + this.serviceStar = json['serviceStar']; + this.storeId = json['storeId']; + } + + int bizType; + String commentImgs; + bool commentImgsFlag; + int commentStar; + String commentText; + int descStar; + bool hideFlag; + int id; + bool isDelete; + int likeNum; + int logisticsStar; + int mid; + int orderProductId; + int parentId; + int productId; + bool sensitiveFlag; + int serviceStar; + int storeId; Map toJson() { final map = {}; - map['bizType'] = _bizType; - map['commentImgs'] = _commentImgs; - map['commentImgsFlag'] = _commentImgsFlag; - map['commentStar'] = _commentStar; - map['commentText'] = _commentText; - map['descStar'] = _descStar; - map['hideFlag'] = _hideFlag; - map['id'] = _id; - map['isDelete'] = _isDelete; - map['likeNum'] = _likeNum; - map['logisticsStar'] = _logisticsStar; - map['mid'] = _mid; - map['orderProductId'] = _orderProductId; - map['parentId'] = _parentId; - map['productId'] = _productId; - map['sensitiveFlag'] = _sensitiveFlag; - map['serviceStar'] = _serviceStar; - map['storeId'] = _storeId; + map['bizType'] = this.bizType; + map['commentImgs'] = this.commentImgs; + map['commentImgsFlag'] = this.commentImgsFlag; + map['commentStar'] = this.commentStar; + map['commentText'] = this.commentText; + map['descStar'] = this.descStar; + map['hideFlag'] = this.hideFlag; + map['id'] = this.id; + map['isDelete'] = this.isDelete; + map['likeNum'] = this.likeNum; + map['logisticsStar'] = this.logisticsStar; + map['mid'] = this.mid; + map['orderProductId'] = this.orderProductId; + map['parentId'] = this.parentId; + map['productId'] = this.productId; + map['sensitiveFlag'] = this.sensitiveFlag; + map['serviceStar'] = this.serviceStar; + map['storeId'] = this.storeId; 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 { @@ -508,178 +300,89 @@ class Comment { int productId, bool sensitiveFlag, int serviceStar, - int storeId,}){ - _bizType = bizType; - _commentImgs = commentImgs; - _commentImgsFlag = commentImgsFlag; - _commentStar = commentStar; - _commentText = commentText; - _descStar = descStar; - _hideFlag = hideFlag; - _id = id; - _isDelete = isDelete; - _likeNum = likeNum; - _logisticsStar = logisticsStar; - _mid = mid; - _orderProductId = orderProductId; - _parentId = parentId; - _productId = productId; - _sensitiveFlag = sensitiveFlag; - _serviceStar = serviceStar; - _storeId = storeId; + int storeId, + }) { + this.bizType = bizType; + this.commentImgs = commentImgs; + this.commentImgsFlag = commentImgsFlag; + this.commentStar = commentStar; + this.commentText = commentText; + this.descStar = descStar; + this.hideFlag = hideFlag; + this.id = id; + this.isDelete = isDelete; + this.likeNum = likeNum; + this.logisticsStar = logisticsStar; + this.mid = mid; + this.orderProductId = orderProductId; + this.parentId = parentId; + this.productId = productId; + this.sensitiveFlag = sensitiveFlag; + this.serviceStar = serviceStar; + this.storeId = storeId; } Comment.fromJson(dynamic json) { - _bizType = json['bizType']; - _commentImgs = json['commentImgs']; - _commentImgsFlag = json['commentImgsFlag']; - _commentStar = json['commentStar']; - _commentText = json['commentText']; - _descStar = json['descStar']; - _hideFlag = json['hideFlag']; - _id = json['id']; - _isDelete = json['isDelete']; - _likeNum = json['likeNum']; - _logisticsStar = json['logisticsStar']; - _mid = json['mid']; - _orderProductId = json['orderProductId']; - _parentId = json['parentId']; - _productId = json['productId']; - _sensitiveFlag = json['sensitiveFlag']; - _serviceStar = json['serviceStar']; - _storeId = json['storeId']; - } - int _bizType; - String _commentImgs; - bool _commentImgsFlag; - int _commentStar; - String _commentText; - int _descStar; - bool _hideFlag; - int _id; - bool _isDelete; - int _likeNum; - int _logisticsStar; - int _mid; - int _orderProductId; - int _parentId; - int _productId; - bool _sensitiveFlag; - 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; - } + this.bizType = json['bizType']; + this.commentImgs = json['commentImgs']; + this.commentImgsFlag = json['commentImgsFlag']; + this.commentStar = json['commentStar']; + this.commentText = json['commentText']; + this.descStar = json['descStar']; + this.hideFlag = json['hideFlag']; + this.id = json['id']; + this.isDelete = json['isDelete']; + this.likeNum = json['likeNum']; + this.logisticsStar = json['logisticsStar']; + this.mid = json['mid']; + this.orderProductId = json['orderProductId']; + this.parentId = json['parentId']; + this.productId = json['productId']; + this.sensitiveFlag = json['sensitiveFlag']; + this.serviceStar = json['serviceStar']; + this.storeId = json['storeId']; + } + + int bizType; + String commentImgs; + bool commentImgsFlag; + int commentStar; + String commentText; + int descStar; + bool hideFlag; + int id; + bool isDelete; + int likeNum; + int logisticsStar; + int mid; + int orderProductId; + int parentId; + int productId; + bool sensitiveFlag; + int serviceStar; + int storeId; Map toJson() { final map = {}; - map['bizType'] = _bizType; - map['commentImgs'] = _commentImgs; - map['commentImgsFlag'] = _commentImgsFlag; - map['commentStar'] = _commentStar; - map['commentText'] = _commentText; - map['descStar'] = _descStar; - map['hideFlag'] = _hideFlag; - map['id'] = _id; - map['isDelete'] = _isDelete; - map['likeNum'] = _likeNum; - map['logisticsStar'] = _logisticsStar; - map['mid'] = _mid; - map['orderProductId'] = _orderProductId; - map['parentId'] = _parentId; - map['productId'] = _productId; - map['sensitiveFlag'] = _sensitiveFlag; - map['serviceStar'] = _serviceStar; - map['storeId'] = _storeId; + map['bizType'] = this.bizType; + map['commentImgs'] = this.commentImgs; + map['commentImgsFlag'] = this.commentImgsFlag; + map['commentStar'] = this.commentStar; + map['commentText'] = this.commentText; + map['descStar'] = this.descStar; + map['hideFlag'] = this.hideFlag; + map['id'] = this.id; + map['isDelete'] = this.isDelete; + map['likeNum'] = this.likeNum; + map['logisticsStar'] = this.logisticsStar; + map['mid'] = this.mid; + map['orderProductId'] = this.orderProductId; + map['parentId'] = this.parentId; + map['productId'] = this.productId; + map['sensitiveFlag'] = this.sensitiveFlag; + map['serviceStar'] = this.serviceStar; + map['storeId'] = this.storeId; 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; - } } diff --git a/lib/retrofit/data/store_info.dart b/lib/retrofit/data/store_info.dart index 67a8fc96..2f6010a3 100644 --- a/lib/retrofit/data/store_info.dart +++ b/lib/retrofit/data/store_info.dart @@ -38,6 +38,7 @@ class StoreInfo { String remark; String shipAddress; String storeName; + StoreTable storeTable; String tenantCode; String updateTime; String updateUser; @@ -94,6 +95,7 @@ class StoreInfo { ..remark = json['remark'] as String ..shipAddress = json['shipAddress'] as String ..storeName = json['storeName'] as String + ..storeTable = json['storeTable'] != null ? StoreTable.fromJson(json['storeTable']) : null ..tenantCode = json['tenantCode'] as String ..updateTime = json['updateTime'] as String ..updateUser = json['updateUser'] as String @@ -138,6 +140,7 @@ class StoreInfo { 'remark': this.remark, 'shipAddress': this.shipAddress, 'storeName': this.storeName, + 'storeTable': this.storeTable.toJson(), 'tenantCode': this.tenantCode, 'updateTime': this.updateTime, '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 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 toJson() => { + "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, + }; + +} + diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 0bee7037..015efc27 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -182,4 +182,12 @@ abstract class MinApiService { @POST("order/settlement") Future settlementApi(@Body() Map param); + ///查询店铺商家详情 + @POST("store/getStore") + Future queryStoreInfo1(@Body() Map param); + + // 父订单信息 + @GET("order/getParentInfo?tableId={tableId}") + Future getParentInfo(@Path("tableId") String tableId); + } diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index f233b182..b98fa96b 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -291,4 +291,48 @@ class _MinApiService implements MinApiService { ); return value; } + + @override + Future> queryStoreInfo1(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/store/getStore', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } + + @override + Future> getParentInfo(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/order/getParentInfo/$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as dynamic, + ); + return value; + } } diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index 73e259b0..60f94b5a 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -266,13 +266,11 @@ abstract class ApiService { ///分页查看资讯列表 @POST("/information/list") - Future>> queryArticle( - @Body() Map param); + Future>> queryArticle(@Body() Map param); ///banner查询 @POST("/banner/page") - Future>> queryBanner( - @Body() Map param); + Future>> queryBanner(@Body() Map param); ///品牌信息 @GET("/home/brand") @@ -357,7 +355,7 @@ abstract class ApiService { Future> report(@Body() Map map); ///取消订单 - @GET("/order/orderCancel?id={id}") + @GET("/order/cancel/{id}") Future> orderCancel(@Path("id") String id); ///继续付款? diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 9fc29cfd..cd2ce872 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -1168,7 +1168,7 @@ class _ApiService implements ApiService { final queryParameters = {}; final _data = {}; final _result = await _dio.request>( - '/order/orderCancel?id=$id', + '/order/cancel/$id', queryParameters: queryParameters, options: RequestOptions( method: 'GET', diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index efaf677f..fb460c2e 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -87,7 +87,7 @@ class _Settlement extends State { "memberCouponId": memberCouponId, "orderId": orderId, "promotionId": promotionId - }).catchError((error){}); + }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { setState(() { settleOrderInfo = baseData.data; @@ -143,10 +143,10 @@ class _Settlement extends State { ///小程序下单 queryPlaceOrderFirst() async { - - for(int i = 0; i < shopCarGoods.shoppingCartSkuItemList.length; i ++) { + for (int i = 0; i < shopCarGoods.shoppingCartSkuItemList.length; i++) { settleOrderInfo.orderProductList.forEach((element1) { - if (shopCarGoods.shoppingCartSkuItemList[i].productId == element1.productId) { + if (shopCarGoods.shoppingCartSkuItemList[i].productId == + element1.productId) { shopCarGoods.shoppingCartSkuItemList[i].skuId = element1.skuId; } }); @@ -164,20 +164,27 @@ class _Settlement extends State { placeOrderFirst.orderType = "0"; placeOrderFirst.orderTypeId = 0; placeOrderFirst.parentCode = ""; // 火锅加菜 - placeOrderFirst.parentId = "0"; // 火锅加菜 + placeOrderFirst.parentId = "0"; // 火锅加菜 placeOrderFirst.payChannel = payChannel; placeOrderFirst.promotionInfoDTO = PromotionInfoDTOBean(); - placeOrderFirst.promotionInfoDTO.promotionId = promotion != null ? promotion.id : ""; - placeOrderFirst.promotionInfoDTO.couponId = couponListBean != null ? couponListBean.id : ""; - placeOrderFirst.recMobile = (mobile == null || mobile == "") ? mobile : storeInfo.headMobile; - placeOrderFirst.shoppingCartSkuItemList = shopCarGoods.shoppingCartSkuItemList; + placeOrderFirst.promotionInfoDTO.promotionId = + promotion != null ? promotion.id : ""; + placeOrderFirst.promotionInfoDTO.couponId = + couponListBean != null ? couponListBean.id : ""; + placeOrderFirst.recMobile = + (mobile == null || mobile == "") ? mobile : storeInfo.headMobile; + placeOrderFirst.shoppingCartSkuItemList = + shopCarGoods.shoppingCartSkuItemList; placeOrderFirst.skuItemDTOList = []; placeOrderFirst.source = 1; placeOrderFirst.storeId = storeInfo.id; placeOrderFirst.subcribeTime = null; placeOrderFirst.tableId = tableId; - BaseData baseData = await minService.placeOrderFirst(placeOrderFirst.toJson()) - .catchError((error) {}); + BaseData baseData = await minService + .placeOrderFirst(placeOrderFirst.toJson()) + .catchError((error) { + print("error: $error"); + }); if (baseData != null && baseData.isSuccess) { querySettlement(placeOrderFirst, baseData.data); } @@ -194,28 +201,34 @@ class _Settlement extends State { // 故而在此初始化一下 await Min.initialize(); } - BaseData baseData = await minService.settlementWx(placeOrderFirst.toJson()).catchError((error) {}); + BaseData 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/"); + 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); + 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}"); toOrderDetails(placeOrderFirst.id); }); } } else { - BaseData baseData = await minService.settlementApi(placeOrderFirst.toJson()).catchError((error) {}); + BaseData baseData = await minService + .settlementApi(placeOrderFirst.toJson()) + .catchError((error) {}); if (baseData != null && baseData.isSuccess) { toOrderDetails(placeOrderFirst.id); } @@ -223,12 +236,9 @@ class _Settlement extends State { } toOrderDetails(String orderId) { - //1451130052983914496 - //202110211815390002 Navigator.of(context).popAndPushNamed('/router/order_details', arguments: { "id": orderId, }); - } @override @@ -421,11 +431,12 @@ class _Settlement extends State { this.promotion = pro; this.couponListBean = null; queryOrderInfo( - address != null ? address.id : null, - selectedBtn, - couponListBean != null ? couponListBean.id : null, - 0, - promotion != null ? promotion.id : null); + address != null ? address.id : null, + selectedBtn, + couponListBean != null ? couponListBean.id : null, + 0, + promotion != null ? promotion.id : null, + ); } } } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index c058f887..45348499 100644 --- a/lib/store/store_order.dart +++ b/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/min_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/shop_car.dart'; import 'package:huixiang/store/store_view/store_activity.dart'; @@ -48,43 +49,51 @@ class _StoreOrderPage extends State MinApiService minService; StoreInfo storeInfo; List activitys; - RefreshController refreshController; StoreOrderListPage storeOrderListPage; ScrollController controller = ScrollController(); ShoppingCart shopCarGoods; + int tableId = 0; + String tenant = ""; + String storeId = ""; + int numberOfPeople = 0; @override void 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) tabcontroller = TabController( length: 2, vsync: this, ); - minLogin(); - queryStoreInfo(); + SharedPreferences.getInstance().then((value) { + minLogin(value); + }); } /// 小程序登录 - minLogin() async { - final SharedPreferences value = await SharedPreferences.getInstance(); + minLogin(SharedPreferences shared) async { apiService = ApiService( Dio(), context: context, - token: value.getString('token'), + token: shared.getString('token'), ); - apiService - .minLogin(widget.arguments["id"]) - .catchError((onError) {}) - .then((baseData) { + queryStoreInfo(); + apiService.minLogin(storeId).catchError((onError) { + debugPrint(onError); + }).then((baseData) { if (baseData != null && baseData.isSuccess) { Map minStoreInfo = baseData.data; String minToken = minStoreInfo["token"]; - String tenant = widget.arguments["tenant"]; - String storeId = widget.arguments["id"]; SharedPreferences.getInstance().then( (value) => { value.setString('minToken', minToken), @@ -103,25 +112,48 @@ class _StoreOrderPage extends State this.shopCarGoods = value; 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 { - final SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService( - Dio(), - context: context, - token: value.getString('token'), - ); - BaseData baseData = await apiService - .queryStoreInfo(widget.arguments["id"]) - .catchError((error) { - // refreshController.refreshFailed(); + BaseData baseData = + await apiService.queryStoreInfo(storeId).catchError((error) { + debugPrint(error); }); if (baseData != null && baseData.isSuccess) { - // refreshController.refreshCompleted(); storeInfo = StoreInfo.fromJson(baseData.data); activitys = storeInfo.informationVOPageVO.list .map((e) => Activity.fromJson(e)) @@ -143,178 +175,168 @@ class _StoreOrderPage extends State bottom: 54.h, child: DefaultTabController( length: 2, - child: SmartRefresher( - controller: refreshController = - RefreshController(initialRefresh: false), - enablePullDown: true, - enablePullUp: false, - header: MyHeader(), + child: NestedScrollView( + controller: controller, + dragStartBehavior: DragStartBehavior.start, physics: BouncingScrollPhysics(), - onRefresh: () { - queryStoreInfo(); - }, - child: NestedScrollView( - controller: controller, - dragStartBehavior: DragStartBehavior.start, - headerSliverBuilder: - (BuildContext context, bool innerBoxIsScrolled) { - return [ - SliverOverlapAbsorber( - handle: NestedScrollView.sliverOverlapAbsorberHandleFor( - context), - sliver: SliverAppBar( - expandedHeight: (storeInfo != null && - storeInfo.couponVOList != null) - ? 470.h - : 365.h, - floating: false, - snap: false, - pinned: true, - stretch: false, - brightness: Brightness.light, - leading: GestureDetector( - onTap: () { - Navigator.of(context).pop(); - }, - child: Container( - alignment: Alignment.centerRight, - margin: EdgeInsets.only(left: 10), - padding: EdgeInsets.all(6), - child: Icon( - Icons.arrow_back_ios, - color: Colors.black, - size: 24, - ), + headerSliverBuilder: + (BuildContext context, bool innerBoxIsScrolled) { + return [ + SliverOverlapAbsorber( + handle: NestedScrollView.sliverOverlapAbsorberHandleFor( + context), + sliver: SliverAppBar( + expandedHeight: + (storeInfo != null && storeInfo.couponVOList != null) + ? 470.h + : 365.h, + floating: false, + snap: false, + pinned: true, + stretch: false, + brightness: Brightness.light, + leading: GestureDetector( + onTap: () { + Navigator.of(context).pop(); + }, + child: Container( + alignment: Alignment.centerRight, + margin: EdgeInsets.only(left: 10), + padding: EdgeInsets.all(6), + child: Icon( + Icons.arrow_back_ios, + color: Colors.black, + size: 24, ), ), - flexibleSpace: FlexibleSpaceBar( - title: Title( - controller, - storeInfo != null ? storeInfo.storeName : '', - ), - collapseMode: CollapseMode.pin, - stretchModes: [ - StretchMode.zoomBackground, - StretchMode.fadeTitle, - StretchMode.blurBackground, - ], - background: Stack( - children: [ - Positioned( + ), + flexibleSpace: FlexibleSpaceBar( + title: Title( + controller, + storeInfo != null ? storeInfo.storeName : '', + ), + collapseMode: CollapseMode.pin, + stretchModes: [ + StretchMode.zoomBackground, + StretchMode.fadeTitle, + StretchMode.blurBackground, + ], + background: Stack( + 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( children: [ - buildSwiper(), - Expanded( - child: Container( - color: Colors.transparent, + ///门店信息 + StoreInfoView(storeInfo), + + ///门店对应优惠券 + 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( - child: Container( - child: Column( - children: [ - ///门店信息 - 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, - ), - ], - ), + top: 110.h, + bottom: 0, + left: 0, + right: 0, + ), + ], ), - backgroundColor: Color(0x33FAFAFA), - centerTitle: false, - elevation: 0, - bottom: PreferredSize( - preferredSize: Size( - MediaQuery.of(context).size.width, - 38, - ), - child: Container( - padding: EdgeInsets.symmetric(horizontal: 10.w), - width: MediaQuery.of(context).size.width, - child: TabBar( - controller: tabcontroller, - automaticIndicatorColorAdjustment: true, - isScrollable: true, - indicatorWeight: 1, - indicatorColor: Color(0xFFFAFAFA), - labelPadding: EdgeInsets.only( - left: 8.w, - right: 8.w, - ), - indicatorSize: TabBarIndicatorSize.label, - unselectedLabelStyle: TextStyle( - fontSize: 15.sp, - fontWeight: FontWeight.w400, - ), - labelStyle: TextStyle( - color: Colors.black, - fontSize: 18.sp, - fontWeight: FontWeight.bold, - ), - labelColor: Colors.black, - tabs: [ - MyTab(text: S.of(context).diancan), - MyTab(text: S.of(context).xindianhuodong), - ], + ), + backgroundColor: Color(0x33FAFAFA), + centerTitle: false, + elevation: 0, + bottom: PreferredSize( + preferredSize: Size( + MediaQuery.of(context).size.width, + 38, + ), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 10.w), + width: MediaQuery.of(context).size.width, + child: TabBar( + controller: tabcontroller, + automaticIndicatorColorAdjustment: true, + isScrollable: true, + indicatorWeight: 1, + indicatorColor: Color(0xFFFAFAFA), + labelPadding: EdgeInsets.only( + left: 8.w, + right: 8.w, + ), + indicatorSize: TabBarIndicatorSize.label, + unselectedLabelStyle: TextStyle( + fontSize: 15.sp, + fontWeight: FontWeight.w400, + ), + labelStyle: TextStyle( + color: Colors.black, + fontSize: 18.sp, + fontWeight: FontWeight.bold, ), + labelColor: Colors.black, + tabs: [ + MyTab(text: S.of(context).diancan), + MyTab(text: S.of(context).xindianhuodong), + ], ), ), ), ), - ]; - }, - body: TabBarView( - physics: BouncingScrollPhysics(), - children: [ - StoreOrderListPage( - widget.arguments, - activitys, - storeInfo, - shopCarGoods, - controller, - _queryMiNiDetail, - ), + ), + ]; + }, + body: TabBarView( + physics: BouncingScrollPhysics(), + children: [ + StoreOrderListPage( + widget.arguments, + activitys, + storeInfo, + shopCarGoods, + controller, + _queryMiNiDetail, + ), - ///星店活动, - StoreActivity( - widget.arguments, - activitys, - ), - ], - controller: tabcontroller, - ), + ///星店活动, + StoreActivity( + widget.arguments, + activitys, + ), + ], + controller: tabcontroller, ), ), ), @@ -424,6 +446,21 @@ class _StoreOrderPage extends State ); } + 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() { if (shopCarGoods == null || @@ -555,7 +592,8 @@ class _StoreOrderPage extends State ///添加购物车 Future _addShopCar(MiNiDetail miNiDetail, selectSkus, int count) async { - ProductSkuVOListBean productSku = miNiDetail.productSkuVOList.firstWhere((element) { + ProductSkuVOListBean productSku = + miNiDetail.productSkuVOList.firstWhere((element) { bool gg = true; selectSkus.forEach((element1) { if (element.skuNameStr.indexOf(element1) < 0) { @@ -567,13 +605,18 @@ class _StoreOrderPage extends State }); if (productSku == null) return; String skuId = productSku.id; - String skuValue = selectSkus.toString().replaceAll("[", "").replaceAll("]", "").replaceAll(",", ""); + String skuValue = selectSkus + .toString() + .replaceAll("[", "") + .replaceAll("]", "") + .replaceAll(",", ""); if (miNiDetail != null) { BaseData> baseDate = await minService.addShoppingCart({ "storeId": storeInfo.id, "storeName": storeInfo.storeName ?? "", - "tableId": 0, + "numberOfPeople": numberOfPeople, + "tableId": tableId, "shoppingCartSkuItemList": [ { "buyNum": count, @@ -584,7 +627,7 @@ class _StoreOrderPage extends State "storeId": storeInfo.id, "skuPrice": productSku.applyPrice, "skuStock": productSku.skuStock, - "tableId": 0, + "tableId": tableId, }, ], }); @@ -599,7 +642,8 @@ class _StoreOrderPage extends State ///查询购物车 Future queryShopCar() async { - BaseData> baseDate = await minService.getShoppingCart(0); + BaseData> baseDate = + await minService.getShoppingCart(tableId); if (baseDate != null && baseDate.isSuccess && baseDate.data != null && @@ -615,7 +659,8 @@ class _StoreOrderPage extends State Map shopCarTemp = shopCarGoods.toJson(); cartSkuItem.buyNum += 1; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; - BaseData> baseDate = await minService.shoppingCartSingle(shopCarTemp); + BaseData> baseDate = + await minService.shoppingCartSingle(shopCarTemp); if (baseDate.isSuccess) { queryShopCar().then((value) { this.shopCarGoods = value; @@ -632,7 +677,8 @@ class _StoreOrderPage extends State Map shopCarTemp = shopCarGoods.toJson(); cartSkuItem.buyNum -= 1; shopCarTemp["shoppingCartSkuItemList"] = [cartSkuItem.toJson()]; - BaseData> baseDate = await minService.shoppingCartSingle(shopCarTemp); + BaseData> baseDate = + await minService.shoppingCartSingle(shopCarTemp); if (baseDate.isSuccess) { queryShopCar().then((value) { this.shopCarGoods = value; @@ -646,7 +692,8 @@ class _StoreOrderPage extends State ///商品➕1 add(MiNiDetail miNiDetail, selectSkus) async { - ProductSkuVOListBean productSku = miNiDetail.productSkuVOList.firstWhere((element) { + ProductSkuVOListBean productSku = + miNiDetail.productSkuVOList.firstWhere((element) { return skuY(element, selectSkus); }); @@ -656,20 +703,24 @@ class _StoreOrderPage extends State await _addShopCar(miNiDetail, selectSkus, 2); return; } - int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.id); + int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList + .indexWhere((element) => skuId == element.id); Map shopCarTemp = shopCarGoods.toJson(); - shopCarGoods.tableId = "0"; + shopCarGoods.tableId = "$tableId"; if (shopSkuIndex >= 0) { 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()]; } else { await _addShopCar(miNiDetail, selectSkus, 2); return; } - BaseData> baseDate = await minService.shoppingCartSingle(shopCarTemp); + BaseData> baseDate = + await minService.shoppingCartSingle(shopCarTemp); if (baseDate.isSuccess) { queryShopCar().then((value) { this.shopCarGoods = value; @@ -680,7 +731,8 @@ class _StoreOrderPage extends State ///商品➖1 reduce(MiNiDetail miNiDetail, selectSkus) async { - ProductSkuVOListBean productSku = miNiDetail.productSkuVOList.firstWhere((element) { + ProductSkuVOListBean productSku = + miNiDetail.productSkuVOList.firstWhere((element) { return skuY(element, selectSkus); }); @@ -690,8 +742,11 @@ class _StoreOrderPage extends State await _addShopCar(miNiDetail, selectSkus, 2); return; } - ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods.shoppingCartSkuItemList.firstWhere((element) => skuId == element.skuId); - int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList.indexWhere((element) => skuId == element.skuId); + ShoppingCartSkuItemListBean shopSkuItem = shopCarGoods + .shoppingCartSkuItemList + .firstWhere((element) => skuId == element.skuId); + int shopSkuIndex = shopCarGoods.shoppingCartSkuItemList + .indexWhere((element) => skuId == element.skuId); if (shopSkuItem != null) { if (shopSkuItem.buyNum > 1) { @@ -701,13 +756,16 @@ class _StoreOrderPage extends State await _addShopCar(miNiDetail, selectSkus, 2); return; } - shopCarGoods.tableId = "0"; + shopCarGoods.tableId = "$tableId"; Map 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()]; - BaseData> baseDate = await minService.shoppingCartSingle(shopCarTemp); + BaseData> baseDate = + await minService.shoppingCartSingle(shopCarTemp); if (baseDate.isSuccess) { queryShopCar().then((value) { this.shopCarGoods = value; @@ -726,7 +784,6 @@ class _StoreOrderPage extends State }); return gg; } - } class Title extends StatefulWidget { diff --git a/lib/store/store_view/people_num.dart b/lib/store/store_view/people_num.dart new file mode 100644 index 00000000..cc59b318 --- /dev/null +++ b/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 createState() { + return _PeopleNumView(); + } +} + +class _PeopleNumView extends State { + 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); + }, + ), + ], + ), + ), + ], + ), + ], + ); + } +} diff --git a/lib/store/store_view/store_activity.dart b/lib/store/store_view/store_activity.dart index 1c2d26e5..7c385d3e 100644 --- a/lib/store/store_view/store_activity.dart +++ b/lib/store/store_view/store_activity.dart @@ -22,11 +22,20 @@ class _StoreActivity extends State { @override Widget build(BuildContext context) { return (widget.activitys == null || widget.activitys.length == 0) - ? NoDataView( - isShowBtn: false, - text: "还没有活动~", - fontSize: 16.sp, - margin: EdgeInsets.only(top: 180.h), + ? Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.height - (kToolbarHeight + 38 + 54.h), + margin: EdgeInsets.only( + top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight), + ), + color: Colors.white, + child: NoDataView( + isShowBtn: false, + text: "还没有活动~", + iconWidth: 220, + iconHeight: 140, + fontSize: 16.sp, + ), ) : Container( width: MediaQuery.of(context).size.width, @@ -51,7 +60,7 @@ class _StoreActivity extends State { '/router/web_page', arguments: { "activityId": widget.activitys[position].id, - "source": widget.arguments["id"] + "source": widget.arguments["id"], }, ); } diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index 83817f88..99dc71ff 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/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/utils/font_weight.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:pull_to_refresh/pull_to_refresh.dart'; import 'package:shared_preferences/shared_preferences.dart'; class StoreOrderListPage extends StatefulWidget { @@ -23,12 +25,13 @@ class StoreOrderListPage extends StatefulWidget { ShoppingCart shopCarGoods; StoreOrderListPage( - this.arguments, - this.activitys, - this.storeInfo, - this.shopCarGoods, - this.controller, - this.queryMiNiDetail,); + this.arguments, + this.activitys, + this.storeInfo, + this.shopCarGoods, + this.controller, + this.queryMiNiDetail, + ); @override State createState() { @@ -64,22 +67,26 @@ class _StoreOrderListPage extends State { ); BaseData> baseData = - await minService.findMiNiGroupList( - { - "id": widget.arguments["id"], - }, - ); + await minService.findMiNiGroupList({ + "id": widget.arguments["id"], + }).catchError((error) { + refreshController.refreshFailed(); + }); if (baseData != null && baseData.isSuccess) { + refreshController.refreshCompleted(); setState(() { appletProducts = baseData.data; - // widget.productListResult(appletProducts); productListBeans.clear(); if (appletProducts.length > 0) - productListBeans.addAll(appletProducts[0].productList); + productListBeans.addAll(appletProducts[isSelected].productList); }); + } else { + refreshController.refreshFailed(); } } + RefreshController refreshController; + @override Widget build(BuildContext context) { return Container( @@ -88,34 +95,51 @@ class _StoreOrderListPage extends State { margin: EdgeInsets.only( top: (MediaQuery.of(context).padding.top + 38 + kToolbarHeight), ), - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - mainAxisSize: MainAxisSize.max, - children: [ - Container( - width: 100.w, - child: ListView.builder( - itemCount: appletProducts == null ? 0 : appletProducts.length, - controller: controller1, - physics: BouncingScrollPhysics(), - 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(), - padding: EdgeInsets.zero, - itemBuilder: (context, position) { - return goodsItem(position); - }, - ), + child: SmartRefresher( + controller: refreshController = + RefreshController(initialRefresh: false), + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + appletGoods(); + }, + child: SingleChildScrollView( + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: [ + Container( + width: 100.w, + child: ListView.builder( + itemCount: appletProducts == null ? 0 : appletProducts.length, + controller: controller1, + physics: BouncingScrollPhysics(), + shrinkWrap: true, + 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 { (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { widget.queryMiNiDetail(productListBeans[position].id); }, - (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { - widget.queryMiNiDetail(productListBeans[position].id); + (ShoppingCartSkuItemListBean shoppingCartSkuItemListBean) { + widget.queryMiNiDetail(productListBeans[position].id); }, productListBean: productListBeans[position], count: count, diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 66e40ad3..7762ab6e 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -12,6 +12,7 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/main.dart'; import 'package:huixiang/retrofit/data/base_data.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/utils/event_type.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/item_title.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:shared_preferences/shared_preferences.dart'; import 'package:flutter/rendering.dart'; @@ -263,21 +266,26 @@ class _UnionPage extends State }, child: ListView.builder( itemCount: storeList == null ? 0 : storeList.length, - // padding: EdgeInsets.only(top: 8.h, bottom: 84.h + (375.h - 88.h) + 4.h), 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(), itemBuilder: (context, position) { return GestureDetector( onTap: () { - Navigator.of(context).pushNamed( - '/router/store_order', - arguments: { - "id": storeList[position].id, - "tenant": storeList[position].tenantCode, - "storeName": storeList[position].storeName - }, - ); + if(storeList[position].posType.code == "NORMALSTORE") { + toScan(storeList[position]); + } else { + Navigator.of(context).pushNamed( + '/router/store_order', + arguments: { + "id": storeList[position].id, + "tenant": storeList[position].tenantCode, + "storeName": storeList[position].storeName + }, + ); + } }, child: buildStoreItem(storeList[position], position), ); @@ -293,6 +301,58 @@ class _UnionPage extends State _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() { return Container( height: 36.h, diff --git a/lib/view_widget/no_data_view.dart b/lib/view_widget/no_data_view.dart index 03a40908..28a5ddce 100644 --- a/lib/view_widget/no_data_view.dart +++ b/lib/view_widget/no_data_view.dart @@ -6,13 +6,18 @@ class NoDataView extends StatelessWidget { final bool isShowBtn; final String text; final double fontSize; + final double iconWidth; + final double iconHeight; final EdgeInsets margin; - NoDataView( - {this.isShowBtn = true, - this.text, - this.fontSize, - this.margin = const EdgeInsets.only(top: 30)}); + NoDataView({ + this.isShowBtn = true, + this.text, + this.fontSize, + this.iconWidth = 270, + this.iconHeight = 180, + this.margin = const EdgeInsets.only(top: 30), + }); @override Widget build(BuildContext context) { @@ -21,7 +26,11 @@ class NoDataView extends StatelessWidget { alignment: Alignment.center, child: Column( children: [ - Image(image: AssetImage("assets/image/icon_empty.png")), + Image( + image: AssetImage("assets/image/icon_empty.png"), + width: iconWidth, + height: iconHeight, + ), SizedBox( height: 35.h, ), @@ -46,7 +55,7 @@ class NoDataView extends StatelessWidget { backgroup: Color(0xFF32A060), radius: 4, ), - ) + ), ], ), ); diff --git a/pubspec.lock b/pubspec.lock index aee75a6d..0f090c29 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -375,13 +375,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "1.0.11" - flutter_qr_reader: + flutter_scankit: dependency: "direct main" description: - name: flutter_qr_reader + name: flutter_scankit url: "https://pub.flutter-io.cn" source: hosted - version: "1.0.5" + version: "1.2.0" flutter_screenutil: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index cb37c7c2..e657ae81 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -54,7 +54,7 @@ dependencies: flutter_smart_dialog: ^2.1.6 barcode_widget: ^2.0.1 - flutter_qr_reader: ^1.0.5 +# flutter_qr_reader: ^1.0.5 qr_flutter: ^4.0.0 url_launcher: ^5.0.0 @@ -64,6 +64,8 @@ dependencies: #多图, 裁剪 image_pickers: ^2.0.0 + flutter_scankit: ^1.2.0 + # 数量,视频时长 # images_picker: ^1.2.4