From 97048cb27c5772d505927dbc539a22bdfae40fdb Mon Sep 17 00:00:00 2001 From: fmk Date: Mon, 27 Sep 2021 11:59:44 +0800 Subject: [PATCH] safety --- lib/main.dart | 2 + lib/retrofit/data/base_data.g.dart | 37 + lib/retrofit/data/page.g.dart | 41 + lib/retrofit/retrofit_api.g.dart | 1208 ++++++++++++++++++++++++ lib/store/store_order.dart | 221 +++++ lib/store/store_view/store_info.dart | 166 ++++ lib/union/union_details_page.dart | 2 +- lib/union/union_page.dart | 57 +- lib/union/union_view/union_coupon.dart | 191 ++-- 9 files changed, 1811 insertions(+), 114 deletions(-) create mode 100644 lib/retrofit/data/base_data.g.dart create mode 100644 lib/retrofit/data/page.g.dart create mode 100644 lib/retrofit/retrofit_api.g.dart create mode 100644 lib/store/store_order.dart create mode 100644 lib/store/store_view/store_info.dart diff --git a/lib/main.dart b/lib/main.dart index af44729f..d7c916c2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -52,6 +52,7 @@ import 'package:huixiang/setting/help_feedback_page.dart'; import 'package:huixiang/setting/permission_setting_page.dart'; import 'package:huixiang/setting/setting_page.dart'; import 'package:huixiang/setting/treaty_page.dart'; +import 'package:huixiang/store/store_order.dart'; import 'package:huixiang/union/location_map_page.dart'; import 'package:huixiang/web/web_page.dart'; @@ -277,6 +278,7 @@ Map routers = { '/router/location_map': (context, {arguments}) => LocationMap(arguments: arguments), '/router/qr_scan': (context, {arguments}) => QrCodeScanPage(), '/router/qr_share': (context, {arguments}) => QrSharePage(), + '/router/store_order': (context, {arguments}) => StoreOrderPage(arguments: arguments), // '/router/hot_article_details_page': (context, {arguments}) => HotArticleDetailsPage(), // '/router/ui_test': (context, {arguments}) => UITest(), }; diff --git a/lib/retrofit/data/base_data.g.dart b/lib/retrofit/data/base_data.g.dart new file mode 100644 index 00000000..3a4ba372 --- /dev/null +++ b/lib/retrofit/data/base_data.g.dart @@ -0,0 +1,37 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'base_data.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +BaseData _$BaseDataFromJson( + Map json, + T Function(Object json) fromJsonT, +) { + return BaseData() + ..code = json['code'] as int + ..data = fromJsonT(json['data']) + ..extra = json['extra'] + ..isError = json['isError'] as bool + ..isSuccess = json['isSuccess'] as bool + ..msg = json['msg'] as String + ..path = json['path'] as String + ..timestamp = json['timestamp'] as String; +} + +Map _$BaseDataToJson( + BaseData instance, + Object Function(T value) toJsonT, +) => + { + 'code': instance.code, + 'data': toJsonT(instance.data), + 'extra': instance.extra, + 'isError': instance.isError, + 'isSuccess': instance.isSuccess, + 'msg': instance.msg, + 'path': instance.path, + 'timestamp': instance.timestamp, + }; diff --git a/lib/retrofit/data/page.g.dart b/lib/retrofit/data/page.g.dart new file mode 100644 index 00000000..e40a14ae --- /dev/null +++ b/lib/retrofit/data/page.g.dart @@ -0,0 +1,41 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'page.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +PageInfo _$PageInfoFromJson( + Map json, + D Function(Object json) fromJsonD, +) { + return PageInfo() + ..pageNum = json['pageNum'] as int + ..current = json['current'] + ..pageSize = json['pageSize'] as int + ..size = json['size'] + ..pages = json['pages'] + ..hasPreviousPage = json['hasPreviousPage'] as bool + ..hasNextPage = json['hasNextPage'] as bool + ..total = json['total'] as String + ..list = (json['list'] as List)?.map(fromJsonD)?.toList() + ..records = (json['records'] as List)?.map(fromJsonD)?.toList(); +} + +Map _$PageInfoToJson( + PageInfo instance, + Object Function(D value) toJsonD, +) => + { + 'pageNum': instance.pageNum, + 'current': instance.current, + 'pageSize': instance.pageSize, + 'size': instance.size, + 'pages': instance.pages, + 'hasPreviousPage': instance.hasPreviousPage, + 'hasNextPage': instance.hasNextPage, + 'total': instance.total, + 'list': instance.list?.map(toJsonD)?.toList(), + 'records': instance.records?.map(toJsonD)?.toList(), + }; diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart new file mode 100644 index 00000000..f75cf97d --- /dev/null +++ b/lib/retrofit/retrofit_api.g.dart @@ -0,0 +1,1208 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'retrofit_api.dart'; + +// ************************************************************************** +// RetrofitGenerator +// ************************************************************************** + +class _ApiService implements ApiService { + _ApiService(this._dio, {this.baseUrl}) { + ArgumentError.checkNotNull(_dio, '_dio'); + baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/'; + } + + final Dio _dio; + + String baseUrl; + + @override + Future> upload(data, folderId) async { + ArgumentError.checkNotNull(data, 'data'); + ArgumentError.checkNotNull(folderId, 'folderId'); + const _extra = {}; + final queryParameters = {}; + final _data = FormData(); + _data.files.add(MapEntry( + 'file', + MultipartFile.fromFileSync(data.path, + filename: data.path.split(Platform.pathSeparator).last))); + if (folderId != null) { + _data.fields.add(MapEntry('folderId', folderId.toString())); + } + final _result = await _dio.request>('/file/upload', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => UploadResult.fromJson(json), + ); + return value; + } + + @override + Future searchPoi(lat, lng, keywords, size, page) async { + ArgumentError.checkNotNull(lat, 'lat'); + ArgumentError.checkNotNull(lng, 'lng'); + ArgumentError.checkNotNull(keywords, 'keywords'); + ArgumentError.checkNotNull(size, 'size'); + ArgumentError.checkNotNull(page, 'page'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request( + 'https://restapi.amap.com/v3/place/around?key=542b46afa8e4b88fe1eb3c4d0ba0872f&location=$lat,$lng&keywords=$keywords&offset={size}&page={page}&extensions=all', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = _result.data; + return value; + } + + @override + Future> memberLogin(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/auth/platform/memberLogin', + 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> sendVerify(mobile) async { + ArgumentError.checkNotNull(mobile, 'mobile'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/auth/sendVerify/$mobile', + 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; + } + + @override + Future>> creditGoods(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/creditGoods/list', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => Goods.fromJson(json), + ), + ); + return value; + } + + @override + Future>> goodsCategory(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/creditGoodsCategory/page', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => GoodsCategory.fromJson(json), + ), + ); + return value; + } + + @override + Future> creditGoodsById(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/creditGoods/$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => Goods.fromJson(json), + ); + return value; + } + + @override + Future> queryInfo() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/member/info', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => UserInfo.fromJson(json), + ); + return value; + } + + @override + Future> editInfo(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/member/editMemberInfo', + 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> signInInfo() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/member/signInInfo', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => SignInfo.fromJson(json), + ); + return value; + } + + @override + Future> signIn() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/member/signIn', + 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; + } + + @override + Future> recharge(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/wallet/recharge', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => WxPay.fromJson(json), + ); + return value; + } + + @override + Future> receiveCoupon(couponId) async { + ArgumentError.checkNotNull(couponId, 'couponId'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/coupon/receive?couponId=$couponId', + 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; + } + + @override + Future>> creditOrderList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/creditOrder/list', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => ExchangeOrder.fromJson(json), + ), + ); + return value; + } + + @override + Future> creditOrder(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/creditOrder/create', + 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> addAddress(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/address/add', + 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> deleteAddress(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/address/delete', + 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> queryAddress(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/address/detail/$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; + } + + @override + Future>> queryMemberAddress() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/address/queryMemberAddress', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map
((i) => Address.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> updateAddress(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/address/update', + 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>> queryCoupon(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/coupon/centreList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => Coupon.fromJson(json), + ), + ); + return value; + } + + @override + Future>> queryCard(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/coupon/packageList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => Coupon.fromJson(json), + ), + ); + return value; + } + + @override + Future>> queryStore(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/store/list', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map((i) => Store.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future>> informationList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/information/list', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => Activity.fromJson(json), + ), + ); + return value; + } + + @override + Future> informationInfo(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/information/$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData
.fromJson( + _result.data, + (json) => Article.fromJson(json), + ); + return value; + } + + @override + Future> activityInfo(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/information/$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => Activity.fromJson(json), + ); + return value; + } + + @override + Future> creditOrderReceive(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/creditOrder/receive/$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; + } + + @override + Future> queryHome() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/home/home', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => BrandData.fromJson(json), + ); + return value; + } + + @override + Future> queryStoreInfo(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/store/$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; + } + + @override + Future>> queryArticle(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/information/list', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo
.fromJson( + json, + (json) => Article.fromJson(json), + ), + ); + return value; + } + + @override + Future>> queryBanner(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/banner/page', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => BannerData.fromJson(json), + ), + ); + return value; + } + + @override + Future> queryHomeBrand() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/home/brand', + 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; + } + + @override + Future> minLogin(storeId) async { + ArgumentError.checkNotNull(storeId, 'storeId'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/auth/mini/login/$storeId', + 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; + } + + @override + Future>> queryBillInfo(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/member/listBill', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => UserBill.fromJson(json), + ), + ); + return value; + } + + @override + Future>> rankList() async { + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/member/rankList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map((i) => Rank.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future>> orderList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/order/list', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => OrderInfo.fromJson(json), + ), + ); + return value; + } + + @override + Future> orderDetail(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/order/orderDetail?id=$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => OrderInfo.fromJson(json), + ); + return value; + } + + @override + Future> continuePay(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/order/continuePay', + 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> receiveToCard(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/creditOrder/receive/$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; + } + + @override + Future>> vipList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/member/vipList', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => (json as List) + .map((i) => VipCard.fromJson(i as Map)) + .toList()); + return value; + } + + @override + Future> vipDetail(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/member/vipDetail', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => VipCard.fromJson(json), + ); + return value; + } + + @override + Future>> msgList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/app-msg/list', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => Message.fromJson(json), + ), + ); + return value; + } + + @override + Future> queryMsg(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>('/app-msg/$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; + } + + @override + Future> informationLikes(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/information/likes/$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; + } + + @override + Future> memberComment(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>('/memberComment', + 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>> memberCommentList(param) async { + ArgumentError.checkNotNull(param, 'param'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(param ?? {}); + final _result = await _dio.request>( + '/memberComment/list', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData>.fromJson( + _result.data, + (json) => PageInfo.fromJson( + json, + (json) => MemberCommentList.fromJson(json), + ), + ); + return value; + } + + @override + Future> commentLike(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/memberComment/likes/$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; + } + + @override + Future> delComment(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/memberComment/delete/$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; + } + + @override + Future> shippingTrace(shipperCode, logisticCode) async { + ArgumentError.checkNotNull(shipperCode, 'shipperCode'); + ArgumentError.checkNotNull(logisticCode, 'logisticCode'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/order/getShippingTrace/$shipperCode/$logisticCode', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => Logistics.fromJson(json), + ); + return value; + } + + @override + Future> report(map) async { + ArgumentError.checkNotNull(map, 'map'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(map ?? {}); + final _result = await _dio.request>('/other/report', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as bool, + ); + return value; + } + + @override + Future> orderCancel(id) async { + ArgumentError.checkNotNull(id, 'id'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + final _result = await _dio.request>( + '/order/orderCancel?id=$id', + queryParameters: queryParameters, + options: RequestOptions( + method: 'GET', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as bool, + ); + return value; + } + + @override + Future> settlement(map) async { + ArgumentError.checkNotNull(map, 'map'); + const _extra = {}; + final queryParameters = {}; + final _data = {}; + _data.addAll(map ?? {}); + final _result = await _dio.request>( + '/order/settlement', + queryParameters: queryParameters, + options: RequestOptions( + method: 'POST', + headers: {}, + extra: _extra, + baseUrl: baseUrl), + data: _data); + final value = BaseData.fromJson( + _result.data, + (json) => json as String, + ); + return value; + } +} diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart new file mode 100644 index 00000000..45c9d7bb --- /dev/null +++ b/lib/store/store_order.dart @@ -0,0 +1,221 @@ +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/store_info.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/store/store_view/store_info.dart'; +import 'package:huixiang/union/union_view/union_coupon.dart'; +import 'package:huixiang/union/union_view/vip.dart'; +import 'package:huixiang/view_widget/classic_header.dart'; +import 'package:huixiang/view_widget/my_tab.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +class StoreOrderPage extends StatefulWidget { + final Map arguments; + + StoreOrderPage({this.arguments}); + + @override + State createState() { + return _StoreOrderPage(); + } +} + +class _StoreOrderPage extends State + with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { + TabController tabcontroller; + ApiService apiService; + StoreInfo storeInfo; + RefreshController refreshController; + + @override + void initState() { + super.initState(); + + refreshController = RefreshController(initialRefresh: false); + + queryStoreInfo(); + + } + + 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(); + }); + if (baseData != null && baseData.isSuccess) { + refreshController.refreshCompleted(); + storeInfo = StoreInfo.fromJson(baseData.data); + if (mounted) { + setState(() {}); + } + } else { + refreshController.refreshFailed(); + } + } + + @override + Widget build(BuildContext context) { + return Column( + children: [ + Expanded( + child: DefaultTabController( + length: 2, + child: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + setState(() {}); + }, + child: NestedScrollView( + headerSliverBuilder: + (BuildContext context, bool innerBoxIsScrolled) { + return [ + SliverOverlapAbsorber( + handle: NestedScrollView.sliverOverlapAbsorberHandleFor( + context), + sliver: SliverAppBar( + title: Text(""), + expandedHeight: 365.h, + floating: false, + snap: false, + pinned: true, + flexibleSpace: FlexibleSpaceBar( + background: Stack( + children: [ + Positioned( + child: Column( + children: [ + Image.asset( + "assets/image/share_image_bg.png", + fit: BoxFit.cover, + width: MediaQuery.of(context).size.width, + height: 180.h, + ), + Expanded( + child: Container( + color: Colors.transparent, + ), + flex: 1, + ), + ], + ), + top: 0, + bottom: 0, + left: 0, + right: 0, + ), + Positioned( + child: Container( + child: Column( + children: [ + ///门店信息 + StoreInfoView(), + + ///门店对应优惠券 + if (storeInfo != null && storeInfo.couponVOList != null) + UnionCoupon( + storeInfo, + (a) {}, + coupon: true, + ), + + ///门店对应VIP信息 + Vip(storeInfo, () {}, false), + ], + ), + ), + top: 110.h, + bottom: 0, + left: 0, + right: 0, + ), + ], + ), + collapseMode: CollapseMode.pin, + ), + backgroundColor: Color(0xFFFAFAFA), + centerTitle: false, + elevation: 0, + bottom: PreferredSize( + preferredSize: Size( + MediaQuery.of(context).size.width, + 38.h, + ), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 10.w), + width: MediaQuery.of(context).size.width, + child: TabBar( + controller: tabcontroller = TabController( + length: 2, + vsync: this, + ), + 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: "点单"), + MyTab(text: "星店活动"), + ], + ), + ), + ), + ), + ), + ]; + }, + body: TabBarView( + physics: BouncingScrollPhysics(), + children: [ + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width, + ), + Container( + width: MediaQuery.of(context).size.width, + height: MediaQuery.of(context).size.width, + ) + ], + controller: tabcontroller, + ), + ), + ), + ), + ), + Container( + height: 50.h, + color: Colors.blue, + ), + ], + ); + } + + @override + bool get wantKeepAlive => true; +} diff --git a/lib/store/store_view/store_info.dart b/lib/store/store_view/store_info.dart new file mode 100644 index 00000000..298e61b0 --- /dev/null +++ b/lib/store/store_view/store_info.dart @@ -0,0 +1,166 @@ +import 'package:flutter/material.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/utils/flutter_utils.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:huixiang/view_widget/round_button.dart'; + +class StoreInfoView extends StatefulWidget { + @override + State createState() { + return _StoreInfoView(); + } +} + +class _StoreInfoView extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only( + left: 16.w, + right: 16.w, + top: 5.h, + bottom: 6.h, + ), + height: 138.h, + padding: EdgeInsets.all(12.w), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(8.w), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(25), + offset: Offset(0, 3), + blurRadius: 3, + spreadRadius: 0, + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Row( + children: [ + Expanded( + child: Column( + children: [ + Container( + alignment: Alignment.centerLeft, + child: Text( + "百年川椒", + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 18.sp, + color: Colors.black, + fontWeight: MyFontWeight.medium, + ), + ), + ), + Row( + children: [ + Text( + S.of(context).ren("1"), + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.sp, + fontWeight: MyFontWeight.medium, + color: Color(0xFF353535), + ), + ), + SizedBox( + width: 20.w, + ), + ]..addAll(itemServer("11,22")), + ), + Text( + "地址:武昌区楚河汉界第一街区万达总部国际C座对面", + maxLines: 2, + textAlign: TextAlign.justify, + style: TextStyle( + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ], + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + ), + ), + Image.asset( + "assets/image/icon_vip_name.png", + width: 70.w, + height: 70.w, + ) + ], + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + ), + flex: 1, + ), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + child: Text( + S.of(context).yingyeshijian("10:00-22:00"), + style: TextStyle( + color: Color(0xFF353535), + fontWeight: MyFontWeight.regular, + fontSize: 12.sp, + ), + ), + ), + SizedBox( + width: 16.w, + ), + InkWell( + onTap: () {}, + child: Image.asset( + "assets/image/icon_union_location.png", + width: 24.w, + height: 24.h, + ), + ), + SizedBox( + width: 16.w, + ), + InkWell( + onTap: () {}, + child: Image.asset( + "assets/image/icon_union_call.png", + width: 24, + height: 24, + ), + ), + ], + ), + ], + ), + ); + } + + List itemServer(String businessService) { + if (businessService == null || businessService == "") return []; + var list = businessService.split(","); + return list + .map((e) => Container( + margin: EdgeInsets.only(right: 8.w), + child: RoundButton( + height: 14.h * AppUtils.textScale(context), + text: "$e", + backgroup: Color(0xFFFF7A1A), + padding: EdgeInsets.only( + left: 2.w, + right: 2.w, + ), + fontSize: 10.sp, + textColor: Colors.white, + ), + )) + .toList(); + } +} diff --git a/lib/union/union_details_page.dart b/lib/union/union_details_page.dart index d5d025d3..f527aeb7 100644 --- a/lib/union/union_details_page.dart +++ b/lib/union/union_details_page.dart @@ -306,7 +306,7 @@ class _UnionDetailsPage extends State { } else { print("print 下载失败"); } - Future.delayed(Duration(seconds: 1), () { + Future.delayed(Duration(seconds: 1), (){ EasyLoading.dismiss(); }); } diff --git a/lib/union/union_page.dart b/lib/union/union_page.dart index 612fb5ad..d3677008 100644 --- a/lib/union/union_page.dart +++ b/lib/union/union_page.dart @@ -35,8 +35,8 @@ class UnionPage extends StatefulWidget { class _UnionPage extends State with AutomaticKeepAliveClientMixin, WidgetsBindingObserver { - - final RefreshController refreshController = RefreshController(initialRefresh: false); + final RefreshController refreshController = + RefreshController(initialRefresh: false); ApiService apiService; bool isKeyBoardShow = false; BMFCoordinate latLng; @@ -45,11 +45,11 @@ class _UnionPage extends State void dispose() { super.dispose(); WidgetsBinding.instance.removeObserver(this); - if (Location.getInstance() != null && Location.getInstance().aMapFlutterLocation != null) + if (Location.getInstance() != null && + Location.getInstance().aMapFlutterLocation != null) Location.getInstance().aMapFlutterLocation.stopLocation(); - if (refreshController != null) - refreshController.dispose(); + if (refreshController != null) refreshController.dispose(); } @override @@ -89,8 +89,10 @@ class _UnionPage extends State startLocation() async { EasyLoading.show(status: S.current.zhengzaijiazai); - Location.getInstance().aMapFlutterLocation - .onResultCallback().listen((event) { + Location.getInstance() + .aMapFlutterLocation + .onResultCallback() + .listen((event) { if (event != null && event["latitude"] != null && event["longitude"] != null) { @@ -102,17 +104,15 @@ class _UnionPage extends State latLng = BMFCoordinate(event["latitude"], event["longitude"]); } BMFCalculateUtils.coordConvert( - coordinate: latLng, - fromType: BMF_COORD_TYPE.BD09LL, - toType: BMF_COORD_TYPE.COMMON) + coordinate: latLng, + fromType: BMF_COORD_TYPE.BD09LL, + toType: BMF_COORD_TYPE.COMMON) .then((value) { this.latLng = value; saveLatLng( value, event["province"], event["city"], event["district"]); - print( - "union: Location result ${value.latitude} " - "${value.longitude}", - ); + print("union: Location result ${value.latitude} " + "${value.longitude}"); Location.getInstance().stopLocation(); queryStore( "${value.latitude}", @@ -153,13 +153,16 @@ class _UnionPage extends State getLatLng() async { SharedPreferences.getInstance().then( (value) => { - apiService = ApiService(Dio(), context: context, - token: value.getString('token'), showLoading: false), + apiService = ApiService(Dio(), + context: context, + token: value.getString('token'), + showLoading: false), if (value.containsKey("latitude") && value.containsKey("longitude") && value.containsKey("province") && value.containsKey("city") && - value.containsKey("district")) { + value.containsKey("district")) + { latLng = BMFCoordinate(double.tryParse(value.getString("latitude")), double.tryParse(value.getString("longitude"))), queryStore( @@ -266,12 +269,20 @@ class _UnionPage extends State itemBuilder: (context, position) { return GestureDetector( onTap: () { + // Navigator.of(context).pushNamed( + // '/router/union_detail_page', + // arguments: { + // "id": storeList[position].id, + // "storeName": storeList[position].storeName + // }); + Navigator.of(context).pushNamed( - '/router/union_detail_page', - arguments: { - "id": storeList[position].id, - "storeName": storeList[position].storeName - }); + '/router/store_order', + arguments: { + "id": storeList[position].id, + "storeName": storeList[position].storeName + }, + ); }, child: buildStoreItem(storeList[position], position), ); @@ -301,7 +312,7 @@ class _UnionPage extends State offset: Offset(0, 3), blurRadius: 14, spreadRadius: 0, - ) + ), ], ), child: TextField( diff --git a/lib/union/union_view/union_coupon.dart b/lib/union/union_view/union_coupon.dart index 4bb696ff..3b5f5b31 100644 --- a/lib/union/union_view/union_coupon.dart +++ b/lib/union/union_view/union_coupon.dart @@ -1,7 +1,3 @@ - - - - import 'package:flutter/material.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/store_info.dart'; @@ -12,57 +8,62 @@ import 'package:huixiang/view_widget/round_button.dart'; import 'package:huixiang/view_widget/separator.dart'; class UnionCoupon extends StatefulWidget { - final StoreInfo storeInfo; + final bool coupon; final Function(String id) receiveCoupon; - UnionCoupon(this.storeInfo, this.receiveCoupon); + + UnionCoupon(this.storeInfo, this.receiveCoupon, {this.coupon = false}); @override State createState() { return _UnionCoupon(); } - } class _UnionCoupon extends State { @override Widget build(BuildContext context) { - return Column( - children: [ - Container( - margin: EdgeInsets.only(top: 10.h, bottom: 10.h), - child: ItemTitle( - text: S.of(context).youhuiquan, - imgPath: "assets/image/icon_union_coupons.png", - ), - ), - (widget.storeInfo != null && widget.storeInfo.couponVOList != null) - ? buildCoupon() - : Container( - width: double.infinity, - height: 50.h, - alignment: Alignment.center, - child: Text( - S.of(context).zanwuyouhuiquankelingqu, - style: TextStyle( - fontSize: 14.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFFA0A0A0), - ), - ), - ), - ], - ); + return (widget.coupon != null && + widget.coupon && + (widget.storeInfo != null && widget.storeInfo.couponVOList != null)) + ? buildCoupon() + : Column( + children: [ + Container( + margin: EdgeInsets.only(top: 10.h, bottom: 10.h), + child: ItemTitle( + text: S.of(context).youhuiquan, + imgPath: "assets/image/icon_union_coupons.png", + ), + ), + (widget.storeInfo != null && + widget.storeInfo.couponVOList != null) + ? buildCoupon() + : Container( + width: double.infinity, + height: 50.h, + alignment: Alignment.center, + child: Text( + S.of(context).zanwuyouhuiquankelingqu, + style: TextStyle( + fontSize: 14.sp, + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFFA0A0A0), + ), + ), + ), + ], + ); } - Widget buildCoupon() { return Container( height: 109.h, child: ListView.builder( - itemCount: (widget.storeInfo != null && widget.storeInfo.couponVOList != null) - ? widget.storeInfo.couponVOList.length - : 0, + itemCount: + (widget.storeInfo != null && widget.storeInfo.couponVOList != null) + ? widget.storeInfo.couponVOList.length + : 0, physics: BouncingScrollPhysics(parent: PageScrollPhysics()), scrollDirection: Axis.horizontal, itemBuilder: (context, position) { @@ -95,10 +96,10 @@ class _UnionCoupon extends State { child: Text.rich(TextSpan(children: [ TextSpan( text: (widget.storeInfo != null && - widget.storeInfo.couponVOList != null && - widget.storeInfo - .couponVOList[position].bizType == - 1) + widget.storeInfo.couponVOList != null && + widget.storeInfo.couponVOList[position] + .bizType == + 1) ? "¥" : "", style: TextStyle( @@ -109,18 +110,21 @@ class _UnionCoupon extends State { ), TextSpan( text: (widget.storeInfo != null && - widget.storeInfo.couponVOList != null && - widget.storeInfo - .couponVOList[position].bizType == - 1) + widget.storeInfo.couponVOList != null && + widget.storeInfo.couponVOList[position] + .bizType == + 1) ? "${double.tryParse(widget.storeInfo.couponVOList[position].discountAmount).toInt()}" : (widget.storeInfo != null && - widget.storeInfo.couponVOList != null && - widget.storeInfo.couponVOList[position] - .bizType == - 5) - ? S.of(context).duihuanquan - : "${widget.storeInfo.couponVOList[position].discountPercent ~/ 10}折", + widget.storeInfo.couponVOList != + null && + widget + .storeInfo + .couponVOList[position] + .bizType == + 5) + ? S.of(context).duihuanquan + : "${widget.storeInfo.couponVOList[position].discountPercent ~/ 10}折", style: TextStyle( fontSize: 36.sp, color: Color(0xFFFF7A1A), @@ -155,9 +159,9 @@ class _UnionCoupon extends State { children: [ Text( (widget.storeInfo != null && - widget.storeInfo.couponVOList != null) - ? widget.storeInfo - .couponVOList[position].couponName + widget.storeInfo.couponVOList != null) + ? widget.storeInfo.couponVOList[position] + .couponName : "", maxLines: 1, overflow: TextOverflow.ellipsis, @@ -169,22 +173,25 @@ class _UnionCoupon extends State { ), Text( (widget.storeInfo != null && - widget.storeInfo.couponVOList != null) + widget.storeInfo.couponVOList != null) ? (widget.storeInfo.couponVOList[position] - .bizType == - 1 - ? S.of(context).manlijiandaijinquan( - double.tryParse(widget.storeInfo - .couponVOList[position] - .fullAmount) - .toInt(), - double.tryParse(widget.storeInfo - .couponVOList[position] - .discountAmount) - .toInt()) - : S.of(context).quanchangzhe(widget.storeInfo - .couponVOList[position] - .discountPercent)) + .bizType == + 1 + ? S.of(context).manlijiandaijinquan( + double.tryParse(widget + .storeInfo + .couponVOList[position] + .fullAmount) + .toInt(), + double.tryParse(widget + .storeInfo + .couponVOList[position] + .discountAmount) + .toInt()) + : S.of(context).quanchangzhe(widget + .storeInfo + .couponVOList[position] + .discountPercent)) : "", overflow: TextOverflow.ellipsis, style: TextStyle( @@ -195,17 +202,19 @@ class _UnionCoupon extends State { ), Text( S.of(context).youxiaoqizhi( - (widget.storeInfo != null && - widget.storeInfo.couponVOList != - null && - // widget.storeInfo.couponVOList[position].useStartTime != null && - widget.storeInfo.couponVOList[position] - .useEndTime != - null) - // ? "${widget.storeInfo.couponVOList[position].useStartTime.replaceAll("-", ".").split(" ")[0]}-${widget.storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" - ? "${widget.storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" - : "", - ), + (widget.storeInfo != null && + widget.storeInfo.couponVOList != + null && + // widget.storeInfo.couponVOList[position].useStartTime != null && + widget + .storeInfo + .couponVOList[position] + .useEndTime != + null) + // ? "${widget.storeInfo.couponVOList[position].useStartTime.replaceAll("-", ".").split(" ")[0]}-${widget.storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" + ? "${widget.storeInfo.couponVOList[position].useEndTime.replaceAll("-", ".").split(" ")[0]}" + : "", + ), overflow: TextOverflow.ellipsis, maxLines: 1, style: TextStyle( @@ -221,7 +230,9 @@ class _UnionCoupon extends State { onTap: () { if (widget.storeInfo != null && widget.storeInfo.couponVOList != null && - widget.storeInfo.couponVOList[position].status == 0) { + widget.storeInfo.couponVOList[position] + .status == + 0) { widget.receiveCoupon( widget.storeInfo.couponVOList[position].id); } @@ -230,16 +241,18 @@ class _UnionCoupon extends State { height: 25.h, child: RoundButton( text: (widget.storeInfo != null && - widget.storeInfo.couponVOList != null && - widget.storeInfo.couponVOList[position].status > - 0) + widget.storeInfo.couponVOList != null && + widget.storeInfo.couponVOList[position] + .status > + 0) ? S.of(context).yilingqu : S.of(context).lingqu, textColor: Colors.white, backgroup: (widget.storeInfo != null && - widget.storeInfo.couponVOList != null && - widget.storeInfo.couponVOList[position].status > - 0) + widget.storeInfo.couponVOList != null && + widget.storeInfo.couponVOList[position] + .status > + 0) ? Colors.grey : Color(0xFF32A060), padding: EdgeInsets.symmetric( @@ -259,6 +272,4 @@ class _UnionCoupon extends State { ), ); } - - -} \ No newline at end of file +}