From 1bee1eda6073d1100e7b83278fd39bd92dc875c8 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Tue, 12 Oct 2021 17:01:43 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/retrofit/data/miNiDetail.dart | 22 ++++++------ lib/retrofit/data/shoppingCart.dart | 10 +++--- lib/retrofit/min_api.dart | 3 +- lib/store/store_order.dart | 41 +++++++++++++--------- lib/store/store_view/store_order_list.dart | 4 +-- 5 files changed, 45 insertions(+), 35 deletions(-) diff --git a/lib/retrofit/data/miNiDetail.dart b/lib/retrofit/data/miNiDetail.dart index adcf5c44..f0a985b4 100644 --- a/lib/retrofit/data/miNiDetail.dart +++ b/lib/retrofit/data/miNiDetail.dart @@ -83,7 +83,7 @@ class MiNiDetail { dynamic namePinyin; dynamic nameInitials; - static MiNiDetail fromMap(Map map) { + static MiNiDetail fromJon(Map map) { if (map == null) return null; MiNiDetail miNiDetailBean = MiNiDetail(); miNiDetailBean.id = map['id']; @@ -118,12 +118,12 @@ class MiNiDetail { miNiDetailBean.imgs = List()..addAll( (map['imgs'] as List ?? []).map((o) => o.toString()) ); - miNiDetailBean.storeDTO = StoreDTOBean.fromMap(map['storeDTO']); + miNiDetailBean.storeDTO = StoreDTOBean.fromJon(map['storeDTO']); miNiDetailBean.attrList = List()..addAll( - (map['attrList'] as List ?? []).map((o) => AttrListBean.fromMap(o)) + (map['attrList'] as List ?? []).map((o) => AttrListBean.fromJon(o)) ); miNiDetailBean.productSkuVOList = List()..addAll( - (map['productSkuVOList'] as List ?? []).map((o) => ProductSkuVOListBean.fromMap(o)) + (map['productSkuVOList'] as List ?? []).map((o) => ProductSkuVOListBean.fromJon(o)) ); miNiDetailBean.shipAddress = map['shipAddress']; miNiDetailBean.buyCount = map['buyCount']; @@ -232,7 +232,7 @@ class ProductSkuVOListBean { List skuAttrList; dynamic setMealDTOList; - static ProductSkuVOListBean fromMap(Map map) { + static ProductSkuVOListBean fromJon(Map map) { if (map == null) return null; ProductSkuVOListBean productSkuVOListBean = ProductSkuVOListBean(); productSkuVOListBean.id = map['id']; @@ -258,7 +258,7 @@ class ProductSkuVOListBean { productSkuVOListBean.version = map['version']; productSkuVOListBean.skuAttrCodeDTOList = map['skuAttrCodeDTOList']; productSkuVOListBean.skuAttrList = List()..addAll( - (map['skuAttrList'] as List ?? []).map((o) => SkuAttrListBean.fromMap(o)) + (map['skuAttrList'] as List ?? []).map((o) => SkuAttrListBean.fromJon(o)) ); productSkuVOListBean.setMealDTOList = map['setMealDTOList']; return productSkuVOListBean; @@ -315,7 +315,7 @@ class SkuAttrListBean { dynamic sortOrder; int isDelete; - static SkuAttrListBean fromMap(Map map) { + static SkuAttrListBean fromJon(Map map) { if (map == null) return null; SkuAttrListBean skuAttrListBean = SkuAttrListBean(); skuAttrListBean.id = map['id']; @@ -364,7 +364,7 @@ class AttrListBean { String id; List attrValueList; - static AttrListBean fromMap(Map map) { + static AttrListBean fromJon(Map map) { if (map == null) return null; AttrListBean attrListBean = AttrListBean(); attrListBean.productId = map['productId']; @@ -375,7 +375,7 @@ class AttrListBean { attrListBean.attrCode = map['attrCode']; attrListBean.id = map['id']; attrListBean.attrValueList = List()..addAll( - (map['attrValueList'] as List ?? []).map((o) => AttrValueListBean.fromMap(o)) + (map['attrValueList'] as List ?? []).map((o) => AttrValueListBean.fromJon(o)) ); return attrListBean; } @@ -410,7 +410,7 @@ class AttrValueListBean { dynamic attrValueCode; bool isSelected; - static AttrValueListBean fromMap(Map map) { + static AttrValueListBean fromJon(Map map) { if (map == null) return null; AttrValueListBean attrValueListBean = AttrValueListBean(); attrValueListBean.id = map['id']; @@ -449,7 +449,7 @@ class StoreDTOBean { int productCount; int soldNum; - static StoreDTOBean fromMap(Map map) { + static StoreDTOBean fromJon(Map map) { if (map == null) return null; StoreDTOBean storeDTOBean = StoreDTOBean(); storeDTOBean.id = map['id']; diff --git a/lib/retrofit/data/shoppingCart.dart b/lib/retrofit/data/shoppingCart.dart index 365ae6d7..c6a85668 100644 --- a/lib/retrofit/data/shoppingCart.dart +++ b/lib/retrofit/data/shoppingCart.dart @@ -15,14 +15,14 @@ class ShoppingCart { String storeName; int tableId; - static ShoppingCart fromMap(Map map) { + static ShoppingCart fromJon(Map map) { if (map == null) return null; ShoppingCart shoppingCartBean = ShoppingCart(); shoppingCartBean.cartSum = map['cartSum']; shoppingCartBean.numberOfPeople = map['numberOfPeople']; shoppingCartBean.selected = map['selected']; shoppingCartBean.shoppingCartSkuItemList = List()..addAll( - (map['shoppingCartSkuItemList'] as List ?? []).map((o) => ShoppingCartSkuItemListBean.fromMap(o)) + (map['shoppingCartSkuItemList'] as List ?? []).map((o) => ShoppingCartSkuItemListBean.fromJon(o)) ); shoppingCartBean.storeId = map['storeId']; shoppingCartBean.storeName = map['storeName']; @@ -72,7 +72,7 @@ class ShoppingCartSkuItemListBean { int storeId; int tableId; - static ShoppingCartSkuItemListBean fromMap(Map map) { + static ShoppingCartSkuItemListBean fromJon(Map map) { if (map == null) return null; ShoppingCartSkuItemListBean shoppingCartSkuItemListBean = ShoppingCartSkuItemListBean(); shoppingCartSkuItemListBean.buyNum = map['buyNum']; @@ -80,7 +80,7 @@ class ShoppingCartSkuItemListBean { shoppingCartSkuItemListBean.groupId = map['groupId']; shoppingCartSkuItemListBean.id = map['id']; shoppingCartSkuItemListBean.platterList = List()..addAll( - (map['platterList'] as List ?? []).map((o) => PlatterListBean.fromMap(o)) + (map['platterList'] as List ?? []).map((o) => PlatterListBean.fromJon(o)) ); shoppingCartSkuItemListBean.productId = map['productId']; shoppingCartSkuItemListBean.productName = map['productName']; @@ -125,7 +125,7 @@ class PlatterListBean { bool required; int skuId; - static PlatterListBean fromMap(Map map) { + static PlatterListBean fromJon(Map map) { if (map == null) return null; PlatterListBean platterListBean = PlatterListBean(); platterListBean.deleted = map['deleted']; diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 70dbf976..5d1111f5 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -13,6 +13,7 @@ import 'package:retrofit/retrofit.dart'; import 'data/findMiNiGroupList.dart'; import 'data/miNiDetail.dart'; +import 'data/shoppingCart.dart'; part 'min_api.g.dart'; // const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 @@ -124,7 +125,7 @@ abstract class MinApiService { ///添加购物车 @POST("shoppingcart") - Future> shoppingCart( + Future> shoppingCart( @Body() Map param,Map header); diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 01e4c72e..7389c35b 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -7,7 +7,6 @@ import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/activity.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/findMiNiGroupList.dart'; import 'package:huixiang/retrofit/data/order_info.dart'; import 'package:huixiang/retrofit/data/store_info.dart'; import 'package:huixiang/retrofit/min_api.dart'; @@ -508,7 +507,7 @@ class _StoreOrderPage extends State ), ), Text( - "¥19.00", + "¥" + allPrice.toString(), style: TextStyle( fontSize: 20.sp, fontWeight: MyFontWeight.medium, @@ -516,17 +515,25 @@ class _StoreOrderPage extends State ), ), Spacer(), - RoundButton( - width: 103.w, - height: 54.h, - text: S.current.jiesuan, - textColor: Colors.white, - fontWeight: MyFontWeight.regular, - backgroup: Color(0xFF32A060), - radius: 0, - fontSize: 16.sp, - padding: EdgeInsets.symmetric(vertical: 5.h), - ) + GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/settlement', + arguments: {}, + ); + }, + child: RoundButton( + width: 103.w, + height: 54.h, + text: S.current.jiesuan, + textColor: Colors.white, + fontWeight: MyFontWeight.regular, + backgroup: Color(0xFF32A060), + radius: 0, + fontSize: 16.sp, + padding: EdgeInsets.symmetric(vertical: 5.h), + ), + ), ], ), ), @@ -548,7 +555,7 @@ class _StoreOrderPage extends State child: RoundButton( width: 17, height: 17, - text: "1", + text:allCount.toString(), textColor: Colors.white, fontWeight: MyFontWeight.regular, backgroup: Color(0xFF32A060), @@ -577,11 +584,13 @@ class _StoreOrderPage extends State padding: EdgeInsets.only(bottom: 10), child: Row( children: [ - Image.asset( - "assets/image/default_1.png", + MImage( + "", width: 60, height: 60, fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", ), SizedBox(width: 10), Expanded( diff --git a/lib/store/store_view/store_order_list.dart b/lib/store/store_view/store_order_list.dart index 94c70f0b..33f63733 100644 --- a/lib/store/store_view/store_order_list.dart +++ b/lib/store/store_view/store_order_list.dart @@ -261,7 +261,7 @@ class _StoreOrderListPage extends State { ), ), Text( - productListBeans[position].price, + productListBeans[position].applyPrice, style: TextStyle( color: Color(0xFFFF7A1A), fontSize: 11.sp, @@ -282,7 +282,7 @@ class _StoreOrderListPage extends State { ), SizedBox(width: 10), Text( - productListBeans[position].applyPrice, + productListBeans[position].price, style: TextStyle( color: Color(0xFFA29E9E), fontSize: 10.sp, From 60b7e388b2730b498b6b0c390b32adbd5b5fe5a0 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Tue, 12 Oct 2021 17:03:38 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/retrofit/min_api.g.dart | 69 ------------------------------------- 1 file changed, 69 deletions(-) delete mode 100644 lib/retrofit/min_api.g.dart diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart deleted file mode 100644 index 2dcec64f..00000000 --- a/lib/retrofit/min_api.g.dart +++ /dev/null @@ -1,69 +0,0 @@ -// GENERATED CODE - DO NOT MODIFY BY HAND - -part of 'min_api.dart'; - -// ************************************************************************** -// RetrofitGenerator -// ************************************************************************** - -class _MinApiService implements MinApiService { - _MinApiService(this._dio, {this.baseUrl}) { - ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'http://192.168.10.236:8765/app/'; - } - - final Dio _dio; - - String baseUrl; - - @override - Future>> findMiNiGroupList( - param, header) async { - ArgumentError.checkNotNull(param, 'param'); - ArgumentError.checkNotNull(header, 'header'); - const _extra = {}; - final queryParameters = {}; - final _data = {}; - _data.addAll(param ?? {}); - final _header= {}; - _header.addAll(header ?? {}); - final _result = await _dio.request>( - 'product/findMiNiGroupList', - queryParameters: queryParameters, - options: RequestOptions( - method: 'POST', - headers: _header, - extra: _extra, - baseUrl: baseUrl), - data: _data); - final value = BaseData>.fromJson( - _result.data, - (json) => (json as List) - .map( - (i) => FindMiNiGroupList.fromJson(i as Map)) - .toList()); - return value; - } - - @override - Future> miNiDetail(id) async { - ArgumentError.checkNotNull(id, 'id'); - const _extra = {}; - final queryParameters = {}; - final _data = {}; - final _result = await _dio.request>( - '/product/queryMiNiProductDetail?id=$id', - queryParameters: queryParameters, - options: RequestOptions( - method: 'GET', - headers: {}, - extra: _extra, - baseUrl: baseUrl), - data: _data); - final value = BaseData.fromJson( - _result.data, - (json) => MiNiDetail.fromMap(json), - ); - return value; - } -}