From 5f1d428ada8503e9e19abd37fde45b432bc37a5e Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Wed, 6 Apr 2022 13:44:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=A2=E5=8D=95=E6=9B=B4=E6=96=B01?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/retrofit/min_api.dart | 10 +++++----- lib/retrofit/min_api.g.dart | 8 ++++---- lib/retrofit/retrofit_api.dart | 8 ++++---- lib/retrofit/retrofit_api.g.dart | 2 +- lib/settlement/settlement.dart | 15 ++++++++------- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 8fa0eb72..022e7de7 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -21,8 +21,8 @@ import 'data/shoppingCart.dart'; part 'min_api.g.dart'; -const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 -const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 +// const base_url = "https://pos.api.lotus-wallet.com/app/"; ///正式 +// const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 // const base_url = "http://user.prod.kunqi.lotus-wallet.com/app/"; ///222 @@ -32,8 +32,8 @@ const baseUrl = "https://pos.api.lotus-wallet.com/app/"; ///正式 // const baseUrl = "http://192.168.10.236:8765/app/";///费韬 -// const base_url = "http://192.168.10.139:8765/app/";///詹云久 -// const baseUrl = "http://192.168.10.139:8765/app/";///詹云久 +const base_url = "http://192.168.10.104:8765/app/";///詹云久 +const baseUrl = "http://192.168.10.104:8765/app/";///詹云久 // const base_url = "http://192.168.10.37:8766/app/"; @@ -183,7 +183,7 @@ abstract class MinApiService { ///小程序下单 @POST("order/placeOrderFirst") - Future> placeOrderFirst(@Body() Map param); + Future> placeOrderFirst(@Body() Map param); ///小程序下单加菜 @POST("order/addOrder") diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart index 02d9988a..b88b200f 100644 --- a/lib/retrofit/min_api.g.dart +++ b/lib/retrofit/min_api.g.dart @@ -9,7 +9,7 @@ part of 'min_api.dart'; class _MinApiService implements MinApiService { _MinApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'https://pos.api.lotus-wallet.com/app/'; + baseUrl ??= 'http://192.168.10.104:8765/app/'; } final Dio _dio; @@ -269,7 +269,7 @@ class _MinApiService implements MinApiService { } @override - Future> placeOrderFirst(param) async { + Future> placeOrderFirst(param) async { ArgumentError.checkNotNull(param, 'param'); const _extra = {}; final queryParameters = {}; @@ -284,9 +284,9 @@ class _MinApiService implements MinApiService { extra: _extra, baseUrl: baseUrl), data: _data); - final value = BaseData.fromJson( + final value = BaseData.fromJson( _result.data, - (json) => DownOrder.fromJson(json), + (json) => json, ); return value; } diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index cc7de47f..0b352fab 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -58,8 +58,8 @@ import 'data/vip_rule_details.dart'; part 'retrofit_api.g.dart'; -const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 -const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const base_url = "https://pos.platform.lotus-wallet.com/app/"; ///正式 +// const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const base_url = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 // const baseUrl = "http://platform.prod.kunqi.lotus-wallet.com/app/"; ///222 @@ -71,8 +71,8 @@ const baseUrl = "https://pos.platform.lotus-wallet.com/app/"; ///正式 // const baseUrl = "http://192.168.10.37:8766/app/"; -// const base_url = "http://192.168.10.139:8766/app/";///詹云久 -// const baseUrl = "http://192.168.10.139:8766/app/";///詹云久 +const base_url = "http://192.168.10.104:8766/app/";///詹云久 +const baseUrl = "http://192.168.10.104:8766/app/";///詹云久 @RestApi(baseUrl: baseUrl) abstract class ApiService { diff --git a/lib/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 35c2bbd6..5cfa3725 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -9,7 +9,7 @@ part of 'retrofit_api.dart'; class _ApiService implements ApiService { _ApiService(this._dio, {this.baseUrl}) { ArgumentError.checkNotNull(_dio, '_dio'); - baseUrl ??= 'https://pos.platform.lotus-wallet.com/app/'; + baseUrl ??= 'http://192.168.10.104:8766/app/'; } final Dio _dio; diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index c3ebabf6..6bd2185e 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -274,23 +274,21 @@ class _Settlement extends State { if (tableId == 0) { ///正常的商店下单 - BaseData baseData = await minService + BaseData baseData = await minService .placeOrderFirst(placeOrderFirst.toJson()) .catchError((error) { print("error: $error"); }); if (baseData != null && baseData.isSuccess) { placeOrder = true; - this.downOrder = baseData.data; + this.downOrder = DownOrder.fromJson(baseData.data); querySettlement(); } else { - baseData?.isSuccess ?? false ? - SmartDialog.showToast("下单失败:订单实付金额不能为0", alignment: Alignment.center) : - SmartDialog.showToast(baseData.msg, alignment: Alignment.center); + SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); } } else { ///火锅店下单, 等待结算 - BaseData baseData; + BaseData baseData; if (parentId == "") { // 下单 if (placeOrder) { @@ -319,11 +317,14 @@ class _Settlement extends State { } if (baseData != null && baseData.isSuccess) { placeOrder = true; - this.downOrder = baseData.data; + this.downOrder = DownOrder.fromJson(baseData.data); queryOrderDetails( (parentId == null || parentId == "") ? baseData.data.id : parentId); setState(() {}); } + else { + SmartDialog.showToast(baseData?.msg, alignment: Alignment.center); + } } }