提交 5d50372a authored 作者: maodou's avatar maodou

Merge remote-tracking branch 'origin/test' into test

......@@ -140,6 +140,9 @@ class BookPayController extends GetxController {
if (useCouponModel.couponId !=0){
finalPrice = finalPrice - Decimal.parse(useCouponModel.reducedPrice??'0.00');
}
if(finalPrice.toDouble() < 0){
finalPrice = Decimal.zero;
}
update();
}
......@@ -182,11 +185,13 @@ class BookPayController extends GetxController {
}
}
final result = await ShopAPI.createOrder(
bookIdsList:jsonEncode(bookIdsList) ,
totalPrice: finalPrice.toString(),
couponRecId: useCouponModel.couponRecId.toString(),
integral: creditPointModel.deductibleIntegral.toString(),
integral: useCreditPoint?creditPointModel.deductibleIntegral.toString():'0',
type: payModel.type.toString()
);
payOrderModel = result;
......@@ -217,6 +222,10 @@ class BookPayController extends GetxController {
}
String orderNumber = payOrderModel.ordersnum.toString();
//TODO: 拿到订单编号进行后续操作
Toast.show('订单支付完成');
if(context.mounted){
context.pop(true);
}
}
......@@ -231,6 +240,9 @@ class BookPayController extends GetxController {
requestOrderStatus();
} else {
Toast.show(payResult['memo'].toString());
if(context.mounted){
context.pop(true);
}
}
});
}
......@@ -253,6 +265,9 @@ class BookPayController extends GetxController {
}
else{
Toast.show('${response.errStr}');
if(context.mounted){
context.pop(true);
}
}
});
}
......
......@@ -15,7 +15,12 @@ class _BookPayPageState extends State<BookPayPage> {
@override
Widget build(BuildContext context) {
return GetBuilder<BookPayController>(
return WillPopScope(
onWillPop: () async {
context.pop(true);
return false;
},
child: GetBuilder<BookPayController>(
init: BookPayController(buy: widget.buy,context: context),
builder: (controller) => Stack(
children: [
......@@ -139,6 +144,7 @@ class _BookPayPageState extends State<BookPayPage> {
):const SizedBox()
],
)
),
);
}
......
......@@ -54,7 +54,7 @@ class BuildCounter extends StatelessWidget {
if (controller.num > 0){
final result = await context.pushNamed(Routes.bookPay,extra: controller.buy);
if (result == true) {
controller.getCart();
controller.onRefresh();
}
}
},
......
......@@ -84,7 +84,7 @@ class _ReadPageState extends State<ReadPage> {
},
onConsoleMessage: (controller, consoleMessage) {
// 接收从 WebView 发送的消息
print("Received message from WebView: ${consoleMessage.message}");
Console.log("Received message from WebView-----------------------------: ${consoleMessage.message}");
},
onLoadStop: (controller, url) {
// flutter 主动给 js 传参数
......@@ -94,6 +94,7 @@ class _ReadPageState extends State<ReadPage> {
'token':UserStore.to.token
};
String str = '${readController.bookId},${readController.chapterId},${UserStore.to.token}';
Console.log('传给前端的参数--------------------------------$str');
controller.evaluateJavascript(source: 'callbackInFlutterComponent("$str");');
// 添加单击事件
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论