对接 订单详情

修改 商城首页为瀑布流
hmxc
张萌 3 years ago
parent d49a8bcc0c
commit 9f25d105c6

@ -356,6 +356,9 @@ class _Market {
///app ///app
String get goodsEvaluation => '/user/shop/evaluation'; String get goodsEvaluation => '/user/shop/evaluation';
///appid
String get orderDetail => '/user/shop/findOrderDetailByOrderId';
} }
class _Upload { class _Upload {

@ -0,0 +1,145 @@
import 'package:equatable/equatable.dart';
import 'package:json_annotation/json_annotation.dart';
import 'package:aku_community/model/common/img_model.dart';
part 'order_detail_model.g.dart';
@JsonSerializable()
class OrderDetailModel extends Equatable {
final int id;
final String code;
final int goodsId;
final String goodsName;
final int? backType;
final List<ImgModel> goodsImgList;
final num? sellingPrice;
final num? markingPrice;
@JsonKey(name: 'num')
final int count;
final int? supplierId;
final String? supplierName;
final String? levelOneCategory;
final String? levelTwoCategory;
final int? status;
final String? sendDate;
final String? sendDetail;
final String? arrivalDate;
final String? receivingDate;
final String? backDate;
final String? backReason;
final String? score;
final String? evaluationDate;
final String? evaluationReason;
final String? arrivalTime;
final String? createDate;
OrderDetailModel({
required this.id,
required this.code,
required this.goodsId,
required this.goodsName,
this.backType,
required this.goodsImgList,
this.sellingPrice,
this.markingPrice,
required this.count,
this.supplierId,
this.supplierName,
this.levelOneCategory,
this.levelTwoCategory,
this.status,
this.sendDate,
this.sendDetail,
this.arrivalDate,
this.receivingDate,
this.backDate,
this.backReason,
this.score,
this.evaluationDate,
this.evaluationReason,
this.arrivalTime,
this.createDate,
});
factory OrderDetailModel.fromJson(Map<String, dynamic> json) =>
_$OrderDetailModelFromJson(json);
String get statusString {
switch (this.status) {
case 1:
return '待发货';
case 2:
return '已发货';
case 3:
return '已到货';
case 4:
return '已收货';
case 5:
return '未知';
case 6:
return '已评价';
case 8:
return '申请退换';
case 9:
return '申请通过';
case 10:
return '申请驳回';
default:
return '未知';
}
}
String get statusTime {
switch (this.status) {
case 1:
return this.createDate!;
case 2:
return this.sendDate!;
case 3:
return this.arrivalDate!;
case 4:
return this.receivingDate!;
case 6:
return this.evaluationDate!;
case 8:
return this.backDate!;
case 9:
return this.backDate!;
case 10:
return this.backDate!;
default:
return '未知';
}
}
@override
List<Object?> get props {
return [
id,
code,
goodsId,
goodsName,
backType,
goodsImgList,
sellingPrice,
markingPrice,
count,
supplierId,
supplierName,
levelOneCategory,
levelTwoCategory,
status,
sendDate,
sendDetail,
arrivalDate,
receivingDate,
backDate,
backReason,
score,
evaluationDate,
evaluationReason,
arrivalTime,
createDate,
];
}
}

@ -0,0 +1,39 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'order_detail_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
OrderDetailModel _$OrderDetailModelFromJson(Map<String, dynamic> json) {
return OrderDetailModel(
id: json['id'] as int,
code: json['code'] as String,
goodsId: json['goodsId'] as int,
goodsName: json['goodsName'] as String,
backType: json['backType'] as int?,
goodsImgList: (json['goodsImgList'] as List<dynamic>)
.map((e) => ImgModel.fromJson(e as Map<String, dynamic>))
.toList(),
sellingPrice: json['sellingPrice'] as num?,
markingPrice: json['markingPrice'] as num?,
count: json['num'] as int,
supplierId: json['supplierId'] as int?,
supplierName: json['supplierName'] as String?,
levelOneCategory: json['levelOneCategory'] as String?,
levelTwoCategory: json['levelTwoCategory'] as String?,
status: json['status'] as int?,
sendDate: json['sendDate'] as String?,
sendDetail: json['sendDetail'] as String?,
arrivalDate: json['arrivalDate'] as String?,
receivingDate: json['receivingDate'] as String?,
backDate: json['backDate'] as String?,
backReason: json['backReason'] as String?,
score: json['score'] as String?,
evaluationDate: json['evaluationDate'] as String?,
evaluationReason: json['evaluationReason'] as String?,
arrivalTime: json['arrivalTime'] as String?,
createDate: json['createDate'] as String?,
);
}

@ -93,7 +93,9 @@ class _GoodsDetailPageState extends State<GoodsDetailPage> {
_goodsModel = GoodsDetailModel.fail(); _goodsModel = GoodsDetailModel.fail();
BotToast.showText(text: baseModel.message ?? '未知错误'); BotToast.showText(text: baseModel.message ?? '未知错误');
} }
baseModel = await NetUtil().get(API.market.suppliyerHotTop); baseModel = await NetUtil().get(API.market.suppliyerHotTop, params: {
"supplierId": _goodsModel.supplierId,
});
if (baseModel.status == true && baseModel.data != null) { if (baseModel.status == true && baseModel.data != null) {
_topGoods = (baseModel.data as List) _topGoods = (baseModel.data as List)
.map((e) => GoodsItem.fromJson(e)) .map((e) => GoodsItem.fromJson(e))

@ -41,6 +41,7 @@ class _MarketPageState extends State<MarketPage>
late EasyRefreshController _refreshController; late EasyRefreshController _refreshController;
int _pageNum = 1; int _pageNum = 1;
int _size = 4; int _size = 4;
int _pageCount=0;
Future updateMarketInfo() async { Future updateMarketInfo() async {
BaseListModel baseListModel = BaseListModel baseListModel =
@ -53,7 +54,7 @@ class _MarketPageState extends State<MarketPage>
.map((e) => GoodsItem.fromJson(e)) .map((e) => GoodsItem.fromJson(e))
.toList(); .toList();
} }
return baseListModel.pageCount; _pageCount= baseListModel.pageCount!;
} }
Future loadMarketInfo() async { Future loadMarketInfo() async {
@ -67,17 +68,17 @@ class _MarketPageState extends State<MarketPage>
.map((e) => GoodsItem.fromJson(e)) .map((e) => GoodsItem.fromJson(e))
.toList()); .toList());
} }
return baseListModel.pageCount; _pageCount= baseListModel.pageCount!;
} }
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_refreshController = EasyRefreshController(); _refreshController = EasyRefreshController();
DisplayCategoryModel.top8.then((value) { Future.delayed(Duration(milliseconds: 0), () async {
setState(() { _marketModels = await DisplayCategoryModel.top8;
_marketModels = value; await updateMarketInfo();
}); setState(() {});
}); });
} }
@ -257,21 +258,21 @@ class _MarketPageState extends State<MarketPage>
]; ];
}, },
body: EasyRefresh( body: EasyRefresh(
firstRefresh: true, firstRefresh: false,
enableControlFinishLoad: true, enableControlFinishLoad: false,
header: MaterialHeader(), header: MaterialHeader(),
footer: MaterialFooter(), footer: MaterialFooter(),
controller: _refreshController, controller: _refreshController,
onRefresh: () async { onRefresh: () async {
_pageNum = 1; _pageNum = 1;
updateMarketInfo(); await updateMarketInfo();
setState(() {}); setState(() {});
}, },
onLoad: () async { onLoad: () async {
_pageNum++; _pageNum++;
int _pageCount = await loadMarketInfo(); await loadMarketInfo();
if (_pageCount !=_pageNum) { if (_pageCount <= _pageNum) {
_refreshController.finishLoad(); _refreshController.finishLoad(noMore: true);
} }
setState(() {}); setState(() {});
}, },

@ -1,7 +1,9 @@
import 'package:aku_community/models/market/order/order_detail_model.dart';
import 'package:flutter/cupertino.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_easyrefresh/easy_refresh.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:waterfall_flow/waterfall_flow.dart'; import 'package:waterfall_flow/waterfall_flow.dart';
@ -29,6 +31,7 @@ class MyOrderDetailPage extends StatefulWidget {
class _MyOrderDetailPageState extends State<MyOrderDetailPage> { class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
late EasyRefreshController _refreshController; late EasyRefreshController _refreshController;
late List<GoodsItem> _topGoods; late List<GoodsItem> _topGoods;
late OrderDetailModel _detailModel;
bool _onload = true; bool _onload = true;
@override @override
void initState() { void initState() {
@ -50,7 +53,8 @@ class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
firstRefresh: true, firstRefresh: true,
header: MaterialHeader(), header: MaterialHeader(),
onRefresh: () async { onRefresh: () async {
_topGoods = await MyOrderFunc.getHotTops(); _detailModel = await MyOrderFunc.getOrderDetail(widget.model.id);
_topGoods = await MyOrderFunc.getHotTops(_detailModel.supplierId!);
_onload = false; _onload = false;
setState(() {}); setState(() {});
}, },
@ -108,8 +112,7 @@ class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
], ],
), ),
20.w.heightBox, 20.w.heightBox,
'2020-05-14 14:22:11' _detailModel.statusTime.text
.text
.size(28.sp) .size(28.sp)
.bold .bold
.color(ktextPrimary.withOpacity(0.8)) .color(ktextPrimary.withOpacity(0.8))
@ -170,6 +173,23 @@ class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
], ],
), ),
20.w.heightBox, 20.w.heightBox,
RatingBar.builder(
initialRating: double.parse(_detailModel.score!),
minRating: 0,
direction: Axis.horizontal,
allowHalfRating: true,
itemCount: 5,
// itemPadding: EdgeInsets.symmetric(horizontal: 16.w),
itemBuilder: (context, _) => Icon(
Icons.star_border_rounded,
color: kPrimaryColor,
),
itemSize: 64.w,
onRatingUpdate: (rating) {},
glow: false,
),
20.w.heightBox,
text.text.size(28.sp).color(ktextSubColor).make(), text.text.size(28.sp).color(ktextSubColor).make(),
20.w.heightBox, 20.w.heightBox,
date.text date.text
@ -226,6 +246,15 @@ class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
...widget.model.arrivalDate == null ...widget.model.arrivalDate == null
? [] ? []
: [_rowTile('到货时间', widget.model.arrivalDateString)], : [_rowTile('到货时间', widget.model.arrivalDateString)],
...widget.model.receivingDate == null
? []
: [_rowTile('收货时间', widget.model.receiveDateString)],
..._detailModel.sendDetail == null
? []
: [_rowTile('发货详情', _detailModel.sendDetail!)],
..._detailModel.arrivalTime == null
? []
: [_rowTile('到货说明', _detailModel.arrivalTime!)],
].sepWidget( ].sepWidget(
separate: 20.w.heightBox, separate: 20.w.heightBox,
) )

@ -1,5 +1,6 @@
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/models/market/goods_item.dart';
import 'package:aku_community/models/market/order/order_detail_model.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';
@ -39,8 +40,11 @@ class MyOrderFunc {
} }
/// ///
static Future<List<GoodsItem>> getHotTops() async { static Future<List<GoodsItem>> getHotTops(int supplierId) async {
BaseModel baseModel = await NetUtil().get(API.market.suppliyerHotTop); BaseModel baseModel =
await NetUtil().get(API.market.suppliyerHotTop, params: {
"supplierId": supplierId,
});
if (baseModel.status == true && baseModel.data != null) { if (baseModel.status == true && baseModel.data != null) {
return (baseModel.data as List) return (baseModel.data as List)
.map((e) => GoodsItem.fromJson(e)) .map((e) => GoodsItem.fromJson(e))
@ -48,4 +52,13 @@ class MyOrderFunc {
} }
return []; return [];
} }
///
static Future getOrderDetail(int goodsAppointmentId) async {
BaseModel baseModel = await NetUtil().get(API.market.orderDetail,
params: {"goodsAppointmentId": goodsAppointmentId});
if (baseModel.status! && baseModel.data != null) {
return OrderDetailModel.fromJson(baseModel.data);
}
}
} }

Loading…
Cancel
Save