From a96f7beb874f6acbd0064b42e03a8a1086a9c2d3 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 15 Jun 2021 16:09:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=95=86=E5=93=81=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E5=8F=AF=E8=83=BD=E4=BC=9A=E5=88=B7=E6=96=B0=E4=B8=8D?= =?UTF-8?q?=E5=87=BA=E6=9D=A5=E7=9A=84=E9=97=AE=E9=A2=98=20=E5=95=86?= =?UTF-8?q?=E5=93=81=E6=95=B0=E9=87=8F=E9=BB=98=E8=AE=A4=E4=B8=BA1=20?= =?UTF-8?q?=E5=95=86=E5=93=81=E8=AE=A2=E5=8D=95=E6=8E=A5=E5=85=A5=E6=94=AF?= =?UTF-8?q?=E4=BB=98=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 12 ++++++++ lib/models/market/goods_detail_model.dart | 2 +- lib/models/market/goods_detail_model.g.dart | 2 +- lib/pages/life_pay/life_pay_page.dart | 2 ++ lib/ui/market/goods/goods_detail_page.dart | 6 ++-- .../market/goods/goods_order_detail_page.dart | 30 +++++++++++++------ 6 files changed, 40 insertions(+), 14 deletions(-) diff --git a/lib/constants/api.dart b/lib/constants/api.dart index d3b0defd..98c035fd 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -427,4 +427,16 @@ class _Pay { ///日常缴费 查询支付宝订单状态 String get dailPayMentCheck => '/user/alipay/dailyPaymentCheckAlipay'; + + ///支付宝支付:app 商城购物完成订单支付宝支付(生成 APP 支付订单信息) + String get shoppingAlipay => '/user/alipay/shoppingAlipay'; + + ///支付宝支付:商城购物 向支付宝发起订单查询请求 + String get shoppingCheck => '/user/alipay/shoppingCheckAlipay'; + + ///支付宝支付:app 报事报修完成订单支付宝支付 + String get reportRepairAlipay => '/user/alipay/reportRepairAlipay'; + + ///支付宝支付:报事报修 向支付宝发起订单查询请求 + String get reportReapirCheck => '/user/alipay/reportRepairCheckAlipay'; } diff --git a/lib/models/market/goods_detail_model.dart b/lib/models/market/goods_detail_model.dart index 0f41e71c..76df08ce 100644 --- a/lib/models/market/goods_detail_model.dart +++ b/lib/models/market/goods_detail_model.dart @@ -15,7 +15,7 @@ class GoodsDetailModel extends Equatable { final String categoryName; final int subscribeNum; final String detail; - final String arrivalTime; + final String? arrivalTime; final List goodsImgList; final int supplierId; final String supplierName; diff --git a/lib/models/market/goods_detail_model.g.dart b/lib/models/market/goods_detail_model.g.dart index 32309c5f..25df0a79 100644 --- a/lib/models/market/goods_detail_model.g.dart +++ b/lib/models/market/goods_detail_model.g.dart @@ -16,7 +16,7 @@ GoodsDetailModel _$GoodsDetailModelFromJson(Map json) { json['categoryName'] as String, json['subscribeNum'] as int, json['detail'] as String, - json['arrivalTime'] as String, + json['arrivalTime'] as String?, (json['goodsImgList'] as List) .map((e) => ImgModel.fromJson(e as Map)) .toList(), diff --git a/lib/pages/life_pay/life_pay_page.dart b/lib/pages/life_pay/life_pay_page.dart index 905a5754..e9ce4ca8 100644 --- a/lib/pages/life_pay/life_pay_page.dart +++ b/lib/pages/life_pay/life_pay_page.dart @@ -337,6 +337,8 @@ class _LifePayPageState extends State { ), ), ], + + //TODO:重构listview; body: BeeListView( path: API.manager.dailyPaymentList, controller: _controller, diff --git a/lib/ui/market/goods/goods_detail_page.dart b/lib/ui/market/goods/goods_detail_page.dart index 70919a29..c7c33400 100644 --- a/lib/ui/market/goods/goods_detail_page.dart +++ b/lib/ui/market/goods/goods_detail_page.dart @@ -126,8 +126,8 @@ class _GoodsDetailPageState extends State { .size(40.sp) .bold .color(ktextPrimary) - .make(), - Spacer(), + .make() + .expand(), '¥${_goodsModel.sellingPrice}' .text .size(36.sp) @@ -233,7 +233,7 @@ class _GoodsDetailPageState extends State { color: kPrimaryColor, height: 80.w, onPressed: () async { - Get.to(GoodsOrderDetailPage( + Get.off(GoodsOrderDetailPage( model: _goodsModel, name: _nameController.text, phone: _phoneController.text)); diff --git a/lib/ui/market/goods/goods_order_detail_page.dart b/lib/ui/market/goods/goods_order_detail_page.dart index 7b4d7f0f..f947c8f5 100644 --- a/lib/ui/market/goods/goods_order_detail_page.dart +++ b/lib/ui/market/goods/goods_order_detail_page.dart @@ -3,6 +3,7 @@ import 'package:aku_community/constants/api.dart'; import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/models/market/goods_detail_model.dart'; import 'package:aku_community/pages/life_pay/pay_finish_page.dart'; +import 'package:aku_community/pages/life_pay/pay_util.dart'; import 'package:aku_community/ui/profile/house/house_owners_page.dart'; import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/net_util.dart'; @@ -36,7 +37,7 @@ class _GoodsOrderDetailPageState extends State { bool _onload = true; ///商品数量 - int _num = 0; + int _num = 1; @override void initState() { super.initState(); @@ -83,19 +84,28 @@ class _GoodsOrderDetailPageState extends State { onPressed: () async { final cancel = BotToast.showLoading(); BaseModel baseModel = await NetUtil().post( - API.market.appointment, + API.pay.shoppingAlipay, params: { 'goodsId': widget.model.id, 'userName': widget.name, 'userTel': widget.phone, 'num': _num, + 'payType': 1, + 'payPrice': widget.model.sellingPrice, }, showMessage: false, ); - cancel(); - if (baseModel.status == true) { - Get.off(() => PayFinishPage()); + if ((baseModel.status ?? false) && + !baseModel.message.isEmptyOrNull) { + bool result = await PayUtil() + .callAliPay(baseModel.message!, API.pay.shoppingCheck); + if (result) { + Get.off(PayFinishPage()); + } + } else { + BotToast.showText(text: '未能生成订单'); } + cancel(); }, child: '立即支付'.text.size(32.sp).color(ktextPrimary).bold.make()), ); @@ -178,7 +188,7 @@ class _GoodsOrderDetailPageState extends State { child: Column( children: [ Row( - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, children: [ widget.model.title.text .size(28.sp) @@ -186,8 +196,10 @@ class _GoodsOrderDetailPageState extends State { .maxLines(2) .overflow(TextOverflow.ellipsis) .bold - .make(), - Spacer(), + .maxLines(2) + .ellipsis + .make() + .expand(), '¥${widget.model.sellingPrice}' .text .size(28.sp) @@ -239,7 +251,7 @@ class _GoodsOrderDetailPageState extends State { ], ), _rowTile('配送方式', '商家配送'), - _rowTile('订单备注', widget.model.arrivalTime), + _rowTile('订单备注', widget.model.arrivalTime ?? ''), ].sepWidget( separate: 20.w.heightBox, ),