From 25e2d920b7b11359527b63cff35bfe2632f5f115 Mon Sep 17 00:00:00 2001 From: w-R <953969641@qq.com> Date: Fri, 18 Feb 2022 17:43:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A0=8D=E4=BB=B7=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/order/bargain_group_order.dart | 2 +- .../shopping_home/bargain_details.dart | 71 +++++++++---------- 2 files changed, 35 insertions(+), 38 deletions(-) diff --git a/lib/order/bargain_group_order.dart b/lib/order/bargain_group_order.dart index 4270e097..3bb78a5d 100644 --- a/lib/order/bargain_group_order.dart +++ b/lib/order/bargain_group_order.dart @@ -450,7 +450,7 @@ class _ExchangeHistoryList extends State { }); }else{ Navigator.of(context) - .popAndPushNamed('/router/bargain_details',arguments: { + .pushNamed('/router/bargain_details',arguments: { "actRecordId": activityOrderList.actRecordId, "limitNumber":activityOrderList.successNumber, }); diff --git a/lib/store/shopping/shopping_home/bargain_details.dart b/lib/store/shopping/shopping_home/bargain_details.dart index 33ce1141..d64f28e5 100644 --- a/lib/store/shopping/shopping_home/bargain_details.dart +++ b/lib/store/shopping/shopping_home/bargain_details.dart @@ -7,7 +7,6 @@ import 'package:flutter_swiper/flutter_swiper.dart'; import 'package:huixiang/retrofit/data/activity_actRecord_details.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/min_api.dart'; -import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/classic_header.dart'; import 'package:huixiang/view_widget/custom_image.dart'; @@ -232,9 +231,7 @@ class _BargainDetails extends State { ), ), Text( - (activityActRecordDetails?.skuName != "") - ? (activityActRecordDetails?.skuName ?? "") - : "x1", + (activityActRecordDetails?.skuName ?? "x1"), style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.regular, @@ -797,7 +794,7 @@ class _BargainDetails extends State { ), ), Text( - "3分钟前", + handleDate(activityActRecordDetails.actRecordJoinList[index].createTime), style: TextStyle( fontSize: 10.sp, fontWeight: MyFontWeight.regular, @@ -842,36 +839,36 @@ class _BargainDetails extends State { )); } - // static handleDate(String oldTime) { - // String nowTime = - // new DateTime.now().toString().split('.')[0].replaceAll('-', '/'); - // - // int nowyear = int.parse(nowTime.split(" ")[0].split('/')[0]); - // int nowmonth = int.parse(nowTime.split(" ")[0].split('/')[1]); - // int nowday = int.parse(nowTime.split(" ")[0].split('/')[2]); - // int nowhour = int.parse(nowTime.split(" ")[1].split(':')[0]); - // int nowmin = int.parse(nowTime.split(" ")[1].split(':')[1]); - // - // int oldyear = int.parse(oldTime.split(" ")[0].split('/')[0]); - // int oldmonth = int.parse(oldTime.split(" ")[0].split('/')[1]); - // int oldday = int.parse(oldTime.split(" ")[0].split('/')[2]); - // int oldhour = int.parse(oldTime.split(" ")[1].split(':')[0]); - // int oldmin = int.parse(oldTime.split(" ")[1].split(':')[1]); - // - // var now = new DateTime(nowyear, nowmonth, nowday, nowhour, nowmin); - // var old = new DateTime(oldyear, oldmonth, oldday, oldhour, oldmin); - // var difference = now.difference(old); - // - // if (difference.inDays > 1) { - // return (difference.inDays).toString() + '天前'; - // } else if (difference.inDays == 1) { - // return '昨天'.toString(); - // } else if (difference.inHours >= 1 && difference.inHours < 24) { - // return (difference.inHours).toString() + '小时前'; - // } else if (difference.inMinutes > 5 && difference.inMinutes < 60) { - // return (difference.inMinutes).toString() + '分钟前'; - // } else if (difference.inMinutes <= 5) { - // return '刚刚'; - // } - // } + static handleDate(String oldTime) { + String nowTime = + new DateTime.now().toString().split('.')[0]; + + int nowyear = int.parse(nowTime.split(" ")[0].split('-')[0]); + int nowmonth = int.parse(nowTime.split(" ")[0].split('-')[1]); + int nowday = int.parse(nowTime.split(" ")[0].split('-')[2]); + int nowhour = int.parse(nowTime.split(" ")[1].split(':')[0]); + int nowmin = int.parse(nowTime.split(" ")[1].split(':')[1]); + + int oldyear = int.parse(oldTime.split(" ")[0].split('-')[0]); + int oldmonth = int.parse(oldTime.split(" ")[0].split('-')[1]); + int oldday = int.parse(oldTime.split(" ")[0].split('-')[2]); + int oldhour = int.parse(oldTime.split(" ")[1].split(':')[0]); + int oldmin = int.parse(oldTime.split(" ")[1].split(':')[1]); + + var now = new DateTime(nowyear, nowmonth, nowday, nowhour, nowmin); + var old = new DateTime(oldyear, oldmonth, oldday, oldhour, oldmin); + var difference = now.difference(old); + + if (difference.inDays > 1) { + return (difference.inDays).toString() + '天前'; + } else if (difference.inDays == 1) { + return '昨天'.toString(); + } else if (difference.inHours >= 1 && difference.inHours < 24) { + return (difference.inHours).toString() + '小时前'; + } else if (difference.inMinutes > 5 && difference.inMinutes < 60) { + return (difference.inMinutes).toString() + '分钟前'; + } else if (difference.inMinutes <= 5) { + return '刚刚'; + } + } }