|
|
@ -117,9 +117,15 @@ class _Settlement extends State<Settlement> { |
|
|
|
actProductSkuId ?? "", |
|
|
|
actProductSkuId ?? "", |
|
|
|
); |
|
|
|
); |
|
|
|
} else |
|
|
|
} else |
|
|
|
queryOrderInfo(null, selectedBtn, null, 0, null, |
|
|
|
queryOrderInfo( |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
selectedBtn, |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
0, |
|
|
|
|
|
|
|
null, |
|
|
|
actProductId ?? "", |
|
|
|
actProductId ?? "", |
|
|
|
actProductSkuId ?? "",); |
|
|
|
actProductSkuId ?? "", |
|
|
|
|
|
|
|
); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
weChatResponseEventHandler.listen((event) async { |
|
|
|
weChatResponseEventHandler.listen((event) async { |
|
|
@ -180,9 +186,15 @@ class _Settlement extends State<Settlement> { |
|
|
|
this.selectedBtn = selectedBtn; |
|
|
|
this.selectedBtn = selectedBtn; |
|
|
|
}); |
|
|
|
}); |
|
|
|
if (address != null) { |
|
|
|
if (address != null) { |
|
|
|
queryOrderInfo(address.id, selectedBtn, null, 0, null, |
|
|
|
queryOrderInfo( |
|
|
|
|
|
|
|
address.id, |
|
|
|
|
|
|
|
selectedBtn, |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
0, |
|
|
|
|
|
|
|
null, |
|
|
|
actProductId ?? "", |
|
|
|
actProductId ?? "", |
|
|
|
actProductSkuId ?? "",); |
|
|
|
actProductSkuId ?? "", |
|
|
|
|
|
|
|
); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
BaseData<List<Address>> baseDate = |
|
|
|
BaseData<List<Address>> baseDate = |
|
|
@ -226,9 +238,15 @@ class _Settlement extends State<Settlement> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
queryOrderInfo(address.id, selectedBtn, null, 0, null, |
|
|
|
queryOrderInfo( |
|
|
|
|
|
|
|
address.id, |
|
|
|
|
|
|
|
selectedBtn, |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
0, |
|
|
|
|
|
|
|
null, |
|
|
|
actProductId ?? "", |
|
|
|
actProductId ?? "", |
|
|
|
actProductSkuId ?? "",); |
|
|
|
actProductSkuId ?? "", |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -244,9 +262,15 @@ class _Settlement extends State<Settlement> { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
queryOrderInfo(address.id, selectedBtn, null, 0, null, |
|
|
|
queryOrderInfo( |
|
|
|
|
|
|
|
address.id, |
|
|
|
|
|
|
|
selectedBtn, |
|
|
|
|
|
|
|
null, |
|
|
|
|
|
|
|
0, |
|
|
|
|
|
|
|
null, |
|
|
|
actProductId ?? "", |
|
|
|
actProductId ?? "", |
|
|
|
actProductSkuId ?? "",); |
|
|
|
actProductSkuId ?? "", |
|
|
|
|
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -306,11 +330,12 @@ class _Settlement extends State<Settlement> { |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
placeOrder = true; |
|
|
|
placeOrder = true; |
|
|
|
this.downOrder = baseData.data; |
|
|
|
this.downOrder = baseData.data; |
|
|
|
querySettlement(); |
|
|
|
pageType != null ? activityPay() : querySettlement(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
baseData?.isSuccess ?? false ? |
|
|
|
baseData?.isSuccess ?? false |
|
|
|
SmartDialog.showToast("下单失败:订单实付金额不能为0", alignment: Alignment.center) : |
|
|
|
? SmartDialog.showToast("下单失败:订单实付金额不能为0", |
|
|
|
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
|
|
|
alignment: Alignment.center) |
|
|
|
|
|
|
|
: SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
///火锅店下单, 等待结算 |
|
|
|
///火锅店下单, 等待结算 |
|
|
@ -408,6 +433,68 @@ class _Settlement extends State<Settlement> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
///活动结算 |
|
|
|
|
|
|
|
activityPay() async { |
|
|
|
|
|
|
|
placeOrderFirst.id = widget.arguments["orderId"] != "" |
|
|
|
|
|
|
|
? widget.arguments["orderId"] |
|
|
|
|
|
|
|
: downOrder.id; |
|
|
|
|
|
|
|
placeOrderFirst.orderProductVOList = downOrder == null |
|
|
|
|
|
|
|
? minOrderInfo.orderProductVOList |
|
|
|
|
|
|
|
: downOrder.orderProductVOList; |
|
|
|
|
|
|
|
if (placeOrderFirst.payChannel == 1) { |
|
|
|
|
|
|
|
if (Platform.isAndroid) { |
|
|
|
|
|
|
|
if (!(await Min.isInitialize())) { |
|
|
|
|
|
|
|
// 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调, |
|
|
|
|
|
|
|
// 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针, |
|
|
|
|
|
|
|
// 故而在此初始化一下 |
|
|
|
|
|
|
|
await Min.initialize(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
BaseData<WxPay> baseData = await minService |
|
|
|
|
|
|
|
.actPay({ |
|
|
|
|
|
|
|
"orderId": widget.arguments["orderId"], |
|
|
|
|
|
|
|
"payChannel":placeOrderFirst.payChannel |
|
|
|
|
|
|
|
}).catchError((error) { |
|
|
|
|
|
|
|
print(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, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
BaseData baseData = await minService.actPay({ |
|
|
|
|
|
|
|
"orderId": widget.arguments["orderId"], |
|
|
|
|
|
|
|
"payChannel":placeOrderFirst.payChannel |
|
|
|
|
|
|
|
}).catchError((error) { |
|
|
|
|
|
|
|
print(error); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (baseData != null && baseData.isSuccess) { |
|
|
|
|
|
|
|
toOrderDetails(placeOrderFirst.id); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
SmartDialog.show( |
|
|
|
|
|
|
|
widget: Tips( |
|
|
|
|
|
|
|
() { |
|
|
|
|
|
|
|
toOrderDetails(placeOrderFirst.id); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
text: "${baseData.msg}", |
|
|
|
|
|
|
|
)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
toOrderDetails(String orderId) { |
|
|
|
toOrderDetails(String orderId) { |
|
|
|
Navigator.of(context).popAndPushNamed( |
|
|
|
Navigator.of(context).popAndPushNamed( |
|
|
|
'/router/order_details', |
|
|
|
'/router/order_details', |
|
|
@ -460,10 +547,15 @@ class _Settlement extends State<Settlement> { |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
|
this.selectedBtn = 0; |
|
|
|
this.selectedBtn = 0; |
|
|
|
}); |
|
|
|
}); |
|
|
|
queryOrderInfo(addressId, isTake, |
|
|
|
queryOrderInfo( |
|
|
|
memberCouponId, orderId, promotionId, |
|
|
|
addressId, |
|
|
|
|
|
|
|
isTake, |
|
|
|
|
|
|
|
memberCouponId, |
|
|
|
|
|
|
|
orderId, |
|
|
|
|
|
|
|
promotionId, |
|
|
|
actProductId ?? "", |
|
|
|
actProductId ?? "", |
|
|
|
actProductSkuId ?? "",); |
|
|
|
actProductSkuId ?? "", |
|
|
|
|
|
|
|
); |
|
|
|
}, queryAddress, storeInfo, address, |
|
|
|
}, queryAddress, storeInfo, address, |
|
|
|
selectedAddress, pageType), |
|
|
|
selectedAddress, pageType), |
|
|
|
|
|
|
|
|
|
|
|