|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
import 'package:flutter/services.dart'; |
|
|
|
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
|
|
|
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; |
|
|
|
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; |
|
|
|
import 'package:flutter_baidu_mapapi_utils/flutter_baidu_mapapi_utils.dart'; |
|
|
|
|
|
|
|
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
|
|
|
import 'package:fluwx/fluwx.dart'; |
|
|
|
import 'package:fluwx/fluwx.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/generated/l10n.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/address.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/address.dart'; |
|
|
@ -12,8 +13,6 @@ import 'package:huixiang/retrofit/data/down_order.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/min_order_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/min_order_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/placeOrderFirst.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/placeOrderFirst.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/settleOrderInfo.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/settlement_bean.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/data/shoppingCart.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/retrofit/data/store_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/store_info.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/wx_pay.dart'; |
|
|
|
import 'package:huixiang/retrofit/data/wx_pay.dart'; |
|
|
|
import 'package:huixiang/retrofit/min_api.dart'; |
|
|
|
import 'package:huixiang/retrofit/min_api.dart'; |
|
|
@ -28,6 +27,7 @@ import 'package:huixiang/utils/font_weight.dart'; |
|
|
|
import 'package:huixiang/utils/min.dart'; |
|
|
|
import 'package:huixiang/utils/min.dart'; |
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart'; |
|
|
|
import 'package:huixiang/view_widget/my_appbar.dart'; |
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
import 'package:huixiang/view_widget/round_button.dart'; |
|
|
|
|
|
|
|
import 'package:huixiang/view_widget/tips_dialog.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
|
|
|
|
|
|
|
@ -56,6 +56,7 @@ class _Settlement extends State<Settlement> { |
|
|
|
String parentId = ""; |
|
|
|
String parentId = ""; |
|
|
|
int payChannel = 4; |
|
|
|
int payChannel = 4; |
|
|
|
int tableId = 0; |
|
|
|
int tableId = 0; |
|
|
|
|
|
|
|
int numberOfPeople = 0; |
|
|
|
|
|
|
|
|
|
|
|
Address address; |
|
|
|
Address address; |
|
|
|
CouponListBean couponListBean; |
|
|
|
CouponListBean couponListBean; |
|
|
@ -71,6 +72,7 @@ class _Settlement extends State<Settlement> { |
|
|
|
parentCode = widget.arguments["parentCode"] ?? ""; |
|
|
|
parentCode = widget.arguments["parentCode"] ?? ""; |
|
|
|
parentId = widget.arguments["parentId"] ?? ""; |
|
|
|
parentId = widget.arguments["parentId"] ?? ""; |
|
|
|
storeInfo = widget.arguments["storeInfo"]; |
|
|
|
storeInfo = widget.arguments["storeInfo"]; |
|
|
|
|
|
|
|
numberOfPeople = widget.arguments["numberOfPeople"] ?? 0; |
|
|
|
|
|
|
|
|
|
|
|
if (tableId == 0) { |
|
|
|
if (tableId == 0) { |
|
|
|
placeOrder = true; |
|
|
|
placeOrder = true; |
|
|
@ -111,6 +113,7 @@ class _Settlement extends State<Settlement> { |
|
|
|
settleOrderInfo = baseData.data; |
|
|
|
settleOrderInfo = baseData.data; |
|
|
|
if (settleOrderInfo.orderProductList == null || |
|
|
|
if (settleOrderInfo.orderProductList == null || |
|
|
|
settleOrderInfo.orderProductList.length == 0) { |
|
|
|
settleOrderInfo.orderProductList.length == 0) { |
|
|
|
|
|
|
|
placeOrder = true; |
|
|
|
queryOrderDetails(parentId); |
|
|
|
queryOrderDetails(parentId); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
@ -119,6 +122,7 @@ class _Settlement extends State<Settlement> { |
|
|
|
|
|
|
|
|
|
|
|
///查看订单详情 |
|
|
|
///查看订单详情 |
|
|
|
queryOrderDetails(id) async { |
|
|
|
queryOrderDetails(id) async { |
|
|
|
|
|
|
|
print("ididididididid: $id"); |
|
|
|
BaseData<MinOrderInfo> baseData = await minService.getOrderDetails({ |
|
|
|
BaseData<MinOrderInfo> baseData = await minService.getOrderDetails({ |
|
|
|
"id": id, |
|
|
|
"id": id, |
|
|
|
}).catchError((error) {}); |
|
|
|
}).catchError((error) {}); |
|
|
@ -196,7 +200,7 @@ class _Settlement extends State<Settlement> { |
|
|
|
placeOrderFirst.isSubscribe = false; |
|
|
|
placeOrderFirst.isSubscribe = false; |
|
|
|
placeOrderFirst.isTakeOut = selectedBtn; |
|
|
|
placeOrderFirst.isTakeOut = selectedBtn; |
|
|
|
placeOrderFirst.notes = remakers; |
|
|
|
placeOrderFirst.notes = remakers; |
|
|
|
placeOrderFirst.numberOfPeople = "0"; |
|
|
|
placeOrderFirst.numberOfPeople = "$numberOfPeople"; |
|
|
|
placeOrderFirst.orderSource = 2; |
|
|
|
placeOrderFirst.orderSource = 2; |
|
|
|
placeOrderFirst.orderType = "0"; |
|
|
|
placeOrderFirst.orderType = "0"; |
|
|
|
placeOrderFirst.orderTypeId = 0; |
|
|
|
placeOrderFirst.orderTypeId = 0; |
|
|
@ -232,23 +236,32 @@ class _Settlement extends State<Settlement> { |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
///火锅店下单, 等待结算 |
|
|
|
///火锅店下单, 等待结算 |
|
|
|
BaseData<DownOrder> baseData; |
|
|
|
BaseData<DownOrder> baseData; |
|
|
|
if (parentId == "") { |
|
|
|
if (parentId == "") { // 下单 |
|
|
|
|
|
|
|
if (placeOrder) { // 结算 |
|
|
|
|
|
|
|
querySettlement(); |
|
|
|
|
|
|
|
} else { // 下单 |
|
|
|
baseData = await minService |
|
|
|
baseData = await minService |
|
|
|
.placeOrderFirst(placeOrderFirst.toJson()) |
|
|
|
.placeOrderFirst(placeOrderFirst.toJson()) |
|
|
|
.catchError((error) { |
|
|
|
.catchError((error) { |
|
|
|
print("error: $error"); |
|
|
|
print("error: $error"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
|
|
|
|
if (placeOrder) { // 结算 |
|
|
|
|
|
|
|
querySettlement(); |
|
|
|
|
|
|
|
} else { //加菜 |
|
|
|
baseData = await minService |
|
|
|
baseData = await minService |
|
|
|
.addOrder(placeOrderFirst.toJson()) |
|
|
|
.addOrder(placeOrderFirst.toJson()) |
|
|
|
.catchError((error) { |
|
|
|
.catchError((error) { |
|
|
|
print("error: $error"); |
|
|
|
print("error: $error"); |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
placeOrder = true; |
|
|
|
placeOrder = true; |
|
|
|
this.downOrder = baseData.data; |
|
|
|
this.downOrder = baseData.data; |
|
|
|
queryOrderDetails(parentId); |
|
|
|
queryOrderDetails( |
|
|
|
|
|
|
|
(parentId == null || parentId == "") ? baseData.data.id : parentId); |
|
|
|
setState(() {}); |
|
|
|
setState(() {}); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -257,7 +270,7 @@ class _Settlement extends State<Settlement> { |
|
|
|
///结算 |
|
|
|
///结算 |
|
|
|
querySettlement() async { |
|
|
|
querySettlement() async { |
|
|
|
placeOrderFirst.id = parentId != "" ? parentId : downOrder.id; |
|
|
|
placeOrderFirst.id = parentId != "" ? parentId : downOrder.id; |
|
|
|
placeOrderFirst.orderProductVOList = downOrder.orderProductVOList; |
|
|
|
placeOrderFirst.orderProductVOList = downOrder == null ? minOrderInfo.orderProductVOList : downOrder.orderProductVOList; |
|
|
|
if (placeOrderFirst.payChannel == 1) { |
|
|
|
if (placeOrderFirst.payChannel == 1) { |
|
|
|
if (!(await Min.isInitialize())) { |
|
|
|
if (!(await Min.isInitialize())) { |
|
|
|
// 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, |
|
|
|
// 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, |
|
|
@ -295,6 +308,8 @@ class _Settlement extends State<Settlement> { |
|
|
|
.catchError((error) {}); |
|
|
|
.catchError((error) {}); |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
toOrderDetails(placeOrderFirst.id); |
|
|
|
toOrderDetails(placeOrderFirst.id); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
SmartDialog.show(widget: Tips((){}, text: "${baseData.msg}",)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -377,7 +392,7 @@ class _Settlement extends State<Settlement> { |
|
|
|
couponCount(), |
|
|
|
couponCount(), |
|
|
|
), |
|
|
|
), |
|
|
|
|
|
|
|
|
|
|
|
///支付方式 |
|
|
|
if (placeOrder) ///支付方式 |
|
|
|
PayMethod(payChannelCheck), |
|
|
|
PayMethod(payChannelCheck), |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|