pull/1/head
章文轩 3 years ago
commit 844c9e27b2

@ -1,13 +1,12 @@
import 'dart:convert'; import 'dart:convert';
import 'package:aku_new_community/models/pay/pay_model.dart';
import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:dio/dio.dart';
import 'package:power_logger/power_logger.dart'; import 'package:power_logger/power_logger.dart';
import 'package:tobias/tobias.dart'; import 'package:tobias/tobias.dart';
import 'package:aku_new_community/models/pay/pay_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
enum PAYTYPE { enum PAYTYPE {
/// ///
ALI, ALI,
@ -79,23 +78,22 @@ class PayUtil {
Future<bool> _confirmPayResult(String path, String code) async { Future<bool> _confirmPayResult(String path, String code) async {
try { try {
int status = 0; late BaseModel base;
for (var i = 0; i < 3; i++) { for (var i = 0; i < 3; i++) {
await Future.delayed(Duration(milliseconds: 1000), () async { await Future.delayed(Duration(milliseconds: 1000), () async {
Response response = await NetUtil().dio!.get(path, queryParameters: { base = await NetUtil().get(path, params: {
"code": code, "code": code,
}); });
status = response.data['status'] as int;
}); });
if (status == 2) { if (base.success) {
break; break;
} }
} }
if (status == 2) { if (base.success) {
BotToast.showText(text: '交易成功'); BotToast.showText(text: '交易成功');
return true; return true;
} else { } else {
BotToast.showText(text: '交易失败 错误码${status}'); BotToast.showText(text: '交易失败');
return false; return false;
} }
} catch (e) { } catch (e) {

@ -1,5 +1,4 @@
import 'package:aku_new_community/base/base_style.dart'; import 'package:aku_new_community/base/base_style.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/constants/saas_api.dart'; import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/model/order/order_list_model.dart'; import 'package:aku_new_community/model/order/order_list_model.dart';
import 'package:aku_new_community/pages/life_pay/pay_finish_page.dart'; import 'package:aku_new_community/pages/life_pay/pay_finish_page.dart';
@ -10,6 +9,7 @@ import 'package:aku_new_community/utils/headers.dart';
import 'package:aku_new_community/utils/network/base_model.dart'; import 'package:aku_new_community/utils/network/base_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart'; import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/buttons/line_button.dart'; import 'package:aku_new_community/widget/buttons/line_button.dart';
import 'package:aku_new_community/widget/others/user_tool.dart';
import 'package:bot_toast/bot_toast.dart'; import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -70,15 +70,18 @@ class _OrderCardState extends State<OrderCard> {
Future _pay() async { Future _pay() async {
Function cancel = BotToast.showLoading(); Function cancel = BotToast.showLoading();
BaseModel baseModel = BaseModel baseModel =
await NetUtil().post(API.pay.jcookOrderCreateOrder, params: { await NetUtil().post(SAASAPI.pay.createGoodsOrder, params: {
"addressId": widget.model.appGoodsAddressId, "addressId": widget.model.appGoodsAddressId,
"settlementGoodsDTOList": _goodsList.map((v) => v.toJson()).toList(), "settlementGoodsDTOList": _goodsList.map((v) => v.toJson()).toList(),
"payType": 1, // "payType": 1, //
"payPrice": widget.model.payPrice "payPrice": widget.model.payPrice,
"residentId": UserTool.userProvider.userInfoModel!.id,
"payname": UserTool.userProvider.userInfoModel!.name,
"payTel": UserTool.userProvider.userInfoModel!.tel,
}); });
if (baseModel.success) { if (baseModel.success) {
bool result = await PayUtil() bool result = await PayUtil()
.callAliPay(baseModel.msg, API.pay.sharePayOrderCodeCheck); .callAliPay(baseModel.msg, SAASAPI.pay.jcookOrderCheckAlipay);
if (result) { if (result) {
Get.off(() => PayFinishPage()); Get.off(() => PayFinishPage());
} }

Loading…
Cancel
Save