添加商品详情页

hmxc
张萌 4 years ago
parent d814615f64
commit 0f2c878bdf

@ -53,12 +53,18 @@ class MyOrderListModel extends Equatable {
case 2: case 2:
return '已发货'; return '已发货';
case 3: case 3:
return ''; return '';
case 4: case 4:
return '申请退换'; return '已收';
case 5: case 5:
return '申请通过'; return '未知';
case 6: case 6:
return '已评价';
case 8:
return '申请退换';
case 9:
return '申请通过';
case 10:
return '申请驳回'; return '申请驳回';
default: default:
return '未知'; return '未知';
@ -74,11 +80,15 @@ class MyOrderListModel extends Equatable {
case 3: case 3:
return Color(0xFF999999); return Color(0xFF999999);
case 4: case 4:
return Color(0xFFFB4702);
case 5:
return Color(0xFF999999); return Color(0xFF999999);
case 6: case 6:
return Color(0xFF999999); return Color(0xFF999999);
case 8:
return Color(0xFFFB4702);
case 9:
return Color(0xFF3F8FFE);
case 10:
return Color(0xFFE60E0E);
default: default:
return Colors.black; return Colors.black;
} }

@ -2,6 +2,8 @@ import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart'; import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/models/market/order/my_order_list_model.dart'; import 'package:aku_community/models/market/order/my_order_list_model.dart';
import 'package:aku_community/ui/market/order/my_order_detail_page.dart';
import 'package:aku_community/ui/market/order/my_order_evaluation_page.dart';
import 'package:aku_community/ui/market/order/my_order_func.dart'; import 'package:aku_community/ui/market/order/my_order_func.dart';
import 'package:aku_community/ui/market/order/my_order_refund_page.dart'; import 'package:aku_community/ui/market/order/my_order_refund_page.dart';
import 'package:aku_community/widget/buttons/card_bottom_button.dart'; import 'package:aku_community/widget/buttons/card_bottom_button.dart';
@ -27,7 +29,9 @@ class _MyOrderCardState extends State<MyOrderCard> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onTap: () {}, onTap: () {
Get.to(() => MyOrderDetailPage(model: widget.model,));
},
child: Container( child: Container(
width: double.infinity, width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
@ -69,6 +73,7 @@ class _MyOrderCardState extends State<MyOrderCard> {
image: image:
API.image(ImgModel.first(widget.model.goodsImgList))), API.image(ImgModel.first(widget.model.goodsImgList))),
), ),
24.w.widthBox,
SizedBox( SizedBox(
height: 160.w, height: 160.w,
child: Column( child: Column(
@ -172,6 +177,7 @@ class _MyOrderCardState extends State<MyOrderCard> {
CardBottomButton.white( CardBottomButton.white(
text: '评价商品', text: '评价商品',
onPressed: () async { onPressed: () async {
await Get.to(() => MyOrderEvaluationPage(model: widget.model));
widget.callRefresh(); widget.callRefresh();
}), }),
CardBottomButton.white( CardBottomButton.white(

@ -1,19 +1,338 @@
import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/models/market/order/my_order_list_model.dart';
import 'package:aku_community/ui/market/goods/goods_card.dart';
import 'package:aku_community/ui/market/order/my_order_func.dart';
import 'package:aku_community/widget/bee_divider.dart';
import 'package:aku_community/widget/bee_scaffold.dart'; import 'package:aku_community/widget/bee_scaffold.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/const/resource.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
import 'package:aku_community/extensions/widget_list_ext.dart';
class MyOrderDetailPage extends StatefulWidget { class MyOrderDetailPage extends StatefulWidget {
MyOrderDetailPage({Key? key}) : super(key: key); final MyOrderListModel model;
MyOrderDetailPage({Key? key, required this.model}) : super(key: key);
@override @override
_MyOrderDetailPageState createState() => _MyOrderDetailPageState(); _MyOrderDetailPageState createState() => _MyOrderDetailPageState();
} }
class _MyOrderDetailPageState extends State<MyOrderDetailPage> { class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
late EasyRefreshController _refreshController;
late List<GoodsItem> _topGoods;
bool _onload = true;
@override
void initState() {
super.initState();
_refreshController = EasyRefreshController();
}
@override
void dispose() {
_refreshController.dispose();
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
title: '订单详情', title: '订单详情',
body: ListView(), body: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
_topGoods = await MyOrderFunc.getHotTops();
_onload = false;
setState(() {
});
},
child: _onload
? Container()
: ListView(
padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w),
children: [
_statusInfo(),
_goodsInfoWidget(),
_orderInfo(),
_extraWidget(_topGoods),
].sepWidget(
separate: 24.w.heightBox,
),
),
),
);
}
Widget _statusInfo() {
return Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
width: 32.w,
height: 32.w,
decoration: BoxDecoration(
color: Color(0xFFFB4702).withOpacity(0.2),
borderRadius: BorderRadius.circular(16.w),
),
child: Icon(
_icondata,
size: 32.w,
color: Color(0xFFFB4702),
),
),
20.w.widthBox,
widget.model.statusString.text
.size(32.sp)
.bold
.color(ktextPrimary)
.make(),
],
),
20.w.heightBox,
'2020-05-14 14:22:11'
.text
.size(28.sp)
.bold
.color(ktextPrimary.withOpacity(0.8))
.make()
],
),
);
}
Widget _extraInfo(String reason, String text) {
return Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
child: Column(
children: [
Row(
children: [
reason.text.size(32.sp).bold.color(ktextPrimary).make(),
],
),
20.w.heightBox,
text.text.size(28.sp).color(ktextSubColor).make(),
20.w.heightBox,
'2020-05-14 14:22:11'
.text
.size(28.sp)
.bold
.color(ktextPrimary.withOpacity(0.8))
.make()
],
),
);
}
IconData get _icondata {
switch (widget.model.status) {
case 1:
case 2:
return CupertinoIcons.stopwatch;
case 3:
case 4:
case 6:
return CupertinoIcons.checkmark_alt;
case 8:
return CupertinoIcons.stopwatch;
case 9:
return CupertinoIcons.checkmark_alt;
case 10:
return CupertinoIcons.multiply;
default:
return CupertinoIcons.multiply_circle;
}
}
Widget _orderInfo() {
return Container(
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w),
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
child: Column(
children: [
Row(
children: [
'订单信息'.text.size(32.sp).bold.color(ktextPrimary).make(),
],
),
24.w.heightBox,
...[
_rowTile('订单编号', widget.model.code),
_rowTile('预约时间', ''),
_rowTile('交易时间', ''),
].sepWidget(
separate: 20.w.heightBox,
)
],
),
);
}
Widget _rowTile(
String title,
String content,
) {
return Row(
children: [
// (160 + 24).w.widthBox,
title.text.size(24.sp).color(ktextSubColor).make(),
Spacer(),
content.text.size(24.sp).color(ktextPrimary).make(),
],
);
}
Widget _goodsInfoWidget() {
return Container(
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(8.w)),
padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
widget.model.goodsName.text
.size(32.sp)
.bold
.color(ktextPrimary)
.make(),
Spacer(),
// widget.model.statusString.text
// .size(30.sp)
// .bold
// .color(widget.model.statusColor)
// .make(),
],
),
16.w.heightBox,
BeeDivider.horizontal(),
24.w.heightBox,
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(8.w),
clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork(
width: 160.w,
height: 160.w,
fit: BoxFit.cover,
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
image:
API.image(ImgModel.first(widget.model.goodsImgList))),
),
24.w.widthBox,
SizedBox(
height: 160.w,
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
widget.model.goodsName.text
.size(28.sp)
.color(ktextPrimary)
.maxLines(2)
.overflow(TextOverflow.ellipsis)
.bold
.make(),
Spacer(),
'¥${widget.model.sellingPrice}'
.text
.size(28.sp)
.bold
.color(Color(0xFFE60E0E))
.make(),
],
),
Spacer(),
Row(
children: [
('${widget.model.levelOneCategory}|${widget.model.levelTwoCategory}')
.text
.size(24.sp)
.color(ktextSubColor)
.make()
],
),
// 12.w.heightBox,
// Row(
// children: [
// ('${widget.model.levelTwoCategory}')
// .text
// .size(24.sp)
// .color(ktextSubColor)
// .make()
// ],
// ),
],
),
).expand()
],
),
],
),
);
}
Widget _extraWidget(List<GoodsItem> models) {
return Container(
decoration: BoxDecoration(color: Colors.white),
width: double.infinity,
padding: EdgeInsets.symmetric(vertical: 32.w, horizontal: 32.w),
child: Column(
children: [
Row(
children: [
'其他(${models.length}'
.text
.size(24.sp)
.color(ktextPrimary)
.bold
.make(),
],
),
24.w.heightBox,
SizedBox(
height: 1000.w,
child: WaterfallFlow.count(
crossAxisCount: 2,
mainAxisSpacing: 20.w,
crossAxisSpacing: 24.w,
physics: NeverScrollableScrollPhysics(),
children: List.generate(
models.length,
(index) => GoodsCard(
item: models[index],
border: true,
),
),
),
),
],
),
); );
} }
} }

@ -69,17 +69,17 @@ class _MyOrderEvaluationPageState extends State<MyOrderEvaluationPage> {
children: [ children: [
Row( Row(
children: [ children: [
widget.model.goodsName.text '商品信息'.text
.size(32.sp) .size(32.sp)
.bold .bold
.color(ktextPrimary) .color(ktextPrimary)
.make(), .make(),
Spacer(), Spacer(),
widget.model.statusString.text // widget.model.statusString.text
.size(30.sp) // .size(30.sp)
.bold // .bold
.color(widget.model.statusColor) // .color(widget.model.statusColor)
.make(), // .make(),
], ],
), ),
16.w.heightBox, 16.w.heightBox,
@ -99,6 +99,7 @@ class _MyOrderEvaluationPageState extends State<MyOrderEvaluationPage> {
image: image:
API.image(ImgModel.first(widget.model.goodsImgList))), API.image(ImgModel.first(widget.model.goodsImgList))),
), ),
24.w.widthBox,
SizedBox( SizedBox(
height: 160.w, height: 160.w,
child: Column( child: Column(

@ -1,4 +1,5 @@
import 'package:aku_community/constants/api.dart'; import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/market/goods_item.dart';
import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/utils/network/net_util.dart';
@ -33,4 +34,15 @@ class MyOrderFunc {
}, },
showMessage: true); showMessage: true);
} }
///
static Future<List<GoodsItem>> getHotTops() async {
BaseModel baseModel = await NetUtil().get(API.market.hotTop);
if (baseModel.status == true && baseModel.data != null) {
return (baseModel.data as List)
.map((e) => GoodsItem.fromJson(e))
.toList();
}
return [];
}
} }

@ -69,17 +69,17 @@ class _MyOrderRefundPageState extends State<MyOrderRefundPage> {
children: [ children: [
Row( Row(
children: [ children: [
widget.model.goodsName.text '商品信息'.text
.size(32.sp) .size(32.sp)
.bold .bold
.color(ktextPrimary) .color(ktextPrimary)
.make(), .make(),
Spacer(), Spacer(),
widget.model.statusString.text // widget.model.statusString.text
.size(30.sp) // .size(30.sp)
.bold // .bold
.color(widget.model.statusColor) // .color(widget.model.statusColor)
.make(), // .make(),
], ],
), ),
16.w.heightBox, 16.w.heightBox,
@ -99,6 +99,7 @@ class _MyOrderRefundPageState extends State<MyOrderRefundPage> {
image: image:
API.image(ImgModel.first(widget.model.goodsImgList))), API.image(ImgModel.first(widget.model.goodsImgList))),
), ),
24.w.widthBox,
SizedBox( SizedBox(
height: 160.w, height: 160.w,
child: Column( child: Column(

Loading…
Cancel
Save