From 4f54f0dee7e682ca0538919de80872adee29a6fc Mon Sep 17 00:00:00 2001 From: cuiyouliang <799699717@qq.com> Date: Wed, 3 Sep 2025 10:39:38 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E6=94=AF=E4=BB=98=E8=81=94=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/pages/order/detail.dart | 35 ++++++++++++++++++++++------------- lib/service/http_config.dart | 1 + lib/utils/index.dart | 8 ++++++++ lib/utils/wxsdk.dart | 2 +- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/lib/pages/order/detail.dart b/lib/pages/order/detail.dart index 9972d8e..7fb7df0 100644 --- a/lib/pages/order/detail.dart +++ b/lib/pages/order/detail.dart @@ -1,5 +1,4 @@ library; - import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:loopin/service/http.dart'; @@ -7,6 +6,7 @@ import 'package:loopin/api/shop_api.dart'; import 'package:shirne_dialog/shirne_dialog.dart'; import 'package:timer_count_down/timer_count_down.dart'; import 'package:loopin/utils/wxsdk.dart'; +import 'package:loopin/utils/index.dart'; import '../../behavior/custom_scroll_behavior.dart'; @@ -155,7 +155,7 @@ class _OrderDetailState extends State with SingleTickerProviderStat children: [ Row( children: [ - Wrap( +/* Wrap( crossAxisAlignment: WrapCrossAlignment.center, spacing: 5.0, children: [ @@ -165,14 +165,15 @@ class _OrderDetailState extends State with SingleTickerProviderStat width: 25.0, ), ), - Text('老白干自营旗舰店'), + Text('${orderGoodsInfo['contactUserName']}'), + //contactUserName Icon( Icons.arrow_forward_ios_rounded, color: Colors.grey, size: 12.0, ), ], - ), + ),*/ Spacer(), Text( '待付款', @@ -184,8 +185,13 @@ class _OrderDetailState extends State with SingleTickerProviderStat crossAxisAlignment: CrossAxisAlignment.start, spacing: 10.0, children: [ + /* SvgPicture.asset( + 'assets/images/svg/kefu.svg', + height: 36.0, + width: 36.0, + )*/ Image.network( - 'https://img13.360buyimg.com/n1/jfs/t1/263909/5/4187/123220/676eb220F3e481086/0cee829b1894fc4c.jpg', + '${orderGoodsInfo['productInfo'][0]['pic']}', width: 80.0, ), Expanded( @@ -193,20 +199,21 @@ class _OrderDetailState extends State with SingleTickerProviderStat crossAxisAlignment: CrossAxisAlignment.start, spacing: 5.0, children: [ + // Text('${orderGoodsInfo['contactUserName']}'), Text( - '茅台(MOUTAI)飞天 53度 酱香型白酒 500ml*2 海外版送礼袋年货送礼', + '${orderGoodsInfo['productInfo'][0]['productName']}', maxLines: 2, overflow: TextOverflow.ellipsis, ), Row( children: [ Text( - '¥3800', + '¥${orderGoodsInfo['productInfo'][0]['salePrice']}', style: TextStyle(color: Colors.red), ), Spacer(), Text( - 'x10', + 'x1', style: TextStyle(color: Colors.grey), ), ], @@ -263,7 +270,7 @@ class _OrderDetailState extends State with SingleTickerProviderStat style: TextStyle(color: Colors.grey), ), Spacer(), - Text('20250125k8ffk23j4j4318', style: TextStyle(fontSize: 12.0)), + Text(orderGoodsInfo['orderId'], style: TextStyle(fontSize: 12.0)), ], ), Row( @@ -273,7 +280,7 @@ class _OrderDetailState extends State with SingleTickerProviderStat style: TextStyle(color: Colors.grey), ), Spacer(), - Text('2025-01-25 17:00:28', style: TextStyle(fontSize: 12.0)), + Text(orderGoodsInfo['createTime'], style: TextStyle(fontSize: 12.0)), ], ), Row( @@ -283,7 +290,9 @@ class _OrderDetailState extends State with SingleTickerProviderStat style: TextStyle(color: Colors.grey), ), Spacer(), - Text('10', style: TextStyle(fontSize: 12.0)), + // 添加空值安全检查 + Text((orderGoodsInfo['productInfo'][0]['buyNum'] ?? 0).toString(), + style: TextStyle(fontSize: 12.0)), ], ), Row( @@ -293,7 +302,7 @@ class _OrderDetailState extends State with SingleTickerProviderStat style: TextStyle(color: Colors.grey), ), Spacer(), - Text('¥3800', style: TextStyle(fontSize: 12.0)), + Text('¥${orderGoodsInfo['totalAmount']??'0.00'}', style: TextStyle(fontSize: 12.0)), ], ), Row( @@ -303,7 +312,7 @@ class _OrderDetailState extends State with SingleTickerProviderStat style: TextStyle(color: Colors.grey), ), Spacer(), - Text('¥38000', style: TextStyle(fontSize: 12.0)), + Text('¥${orderGoodsInfo['payAmount']??'0.00'}', style: TextStyle(fontSize: 12.0)), ], ), ], diff --git a/lib/service/http_config.dart b/lib/service/http_config.dart index 5183c0f..896ae88 100644 --- a/lib/service/http_config.dart +++ b/lib/service/http_config.dart @@ -23,6 +23,7 @@ class HttpConfig { onRequest: (options, handler) { // Token String? token = box.read('token'); + print('Bearer $token'); if (token != null) { options.headers['Authorization'] = 'Bearer $token'; } diff --git a/lib/utils/index.dart b/lib/utils/index.dart index 45fdcdd..de800eb 100644 --- a/lib/utils/index.dart +++ b/lib/utils/index.dart @@ -208,4 +208,12 @@ class Utils { } return count.toString(); } + // 分转换为元 + static String fenToYuanSimple(dynamic fen) { + if (fen == null) { + return '0.00'; + } + + return (double.parse(fen) / 100).toStringAsFixed(2); + } } diff --git a/lib/utils/wxsdk.dart b/lib/utils/wxsdk.dart index cdb8ea6..0b8f7c7 100644 --- a/lib/utils/wxsdk.dart +++ b/lib/utils/wxsdk.dart @@ -137,7 +137,7 @@ class Wxsdk { var miniProgram = MiniProgram( username: "gh_2ffaecc5508e", // 小程序原始ID path: "/pages/index/index?id=$orderId", // 打开时带的路径参数 - miniProgramType: WXMiniProgramType.test, + miniProgramType: WXMiniProgramType.preview, ); Fluwx().open(target: miniProgram); }