对接 订单详情

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

@ -356,6 +356,9 @@ class _Market {
///app
String get goodsEvaluation => '/user/shop/evaluation';
///appid
String get orderDetail => '/user/shop/findOrderDetailByOrderId';
}
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();
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) {
_topGoods = (baseModel.data as List)
.map((e) => GoodsItem.fromJson(e))
@ -178,7 +180,7 @@ class _GoodsDetailPageState extends State<GoodsDetailPage> {
onPressed: () {
if (!UserTool.userProvider.isLogin) {
BotToast.showText(text: '请先登录!');
Get.offAll(()=>SignInPage());
Get.offAll(() => SignInPage());
return;
}
Get.bottomSheet(Material(

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

@ -1,7 +1,9 @@
import 'package:aku_community/models/market/order/order_detail_model.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.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:velocity_x/velocity_x.dart';
import 'package:waterfall_flow/waterfall_flow.dart';
@ -29,6 +31,7 @@ class MyOrderDetailPage extends StatefulWidget {
class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
late EasyRefreshController _refreshController;
late List<GoodsItem> _topGoods;
late OrderDetailModel _detailModel;
bool _onload = true;
@override
void initState() {
@ -50,7 +53,8 @@ class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
firstRefresh: true,
header: MaterialHeader(),
onRefresh: () async {
_topGoods = await MyOrderFunc.getHotTops();
_detailModel = await MyOrderFunc.getOrderDetail(widget.model.id);
_topGoods = await MyOrderFunc.getHotTops(_detailModel.supplierId!);
_onload = false;
setState(() {});
},
@ -108,8 +112,7 @@ class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
],
),
20.w.heightBox,
'2020-05-14 14:22:11'
.text
_detailModel.statusTime.text
.size(28.sp)
.bold
.color(ktextPrimary.withOpacity(0.8))
@ -170,6 +173,23 @@ class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
],
),
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(),
20.w.heightBox,
date.text
@ -226,6 +246,15 @@ class _MyOrderDetailPageState extends State<MyOrderDetailPage> {
...widget.model.arrivalDate == null
? []
: [_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(
separate: 20.w.heightBox,
)

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