hmxc
parent
e937316f52
commit
bd432292fb
After Width: | Height: | Size: 6.4 KiB |
After Width: | Height: | Size: 5.4 KiB |
@ -0,0 +1,80 @@
|
||||
class CategoryModel {
|
||||
int? id;
|
||||
String? name;
|
||||
List<CategoryList>? categoryList;
|
||||
|
||||
CategoryModel({this.id, this.name, this.categoryList});
|
||||
|
||||
CategoryModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
if (json['categoryList'] != null) {
|
||||
categoryList = [];
|
||||
json['categoryList'].forEach((v) {
|
||||
categoryList!.add(new CategoryList.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
if (this.categoryList != null) {
|
||||
data['categoryList'] = this.categoryList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class CategoryList {
|
||||
int? id;
|
||||
String? name;
|
||||
List<CategoryListSecond>? categoryListSecond;
|
||||
|
||||
CategoryList({this.id, this.name, this.categoryListSecond});
|
||||
|
||||
CategoryList.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
if (json['categoryList'] != null) {
|
||||
categoryListSecond = [];
|
||||
json['categoryList'].forEach((v) {
|
||||
categoryListSecond!.add(new CategoryListSecond.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
if (this.categoryListSecond != null) {
|
||||
data['categoryList'] =
|
||||
this.categoryListSecond!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class CategoryListSecond {
|
||||
int? id;
|
||||
String? name;
|
||||
|
||||
|
||||
CategoryListSecond({this.id, this.name,});
|
||||
|
||||
CategoryListSecond.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
class LogisticsModel {
|
||||
String? logisticsName;
|
||||
String? waybillCode;
|
||||
List<OperatorNodeList>? operatorNodeList;
|
||||
|
||||
LogisticsModel({this.logisticsName, this.waybillCode, this.operatorNodeList});
|
||||
|
||||
LogisticsModel.fromJson(Map<String, dynamic> json) {
|
||||
logisticsName = json['logistics_name'];
|
||||
waybillCode = json['waybill_code'];
|
||||
if (json['operator_node_list'] != null) {
|
||||
operatorNodeList = [];
|
||||
json['operator_node_list'].forEach((v) {
|
||||
operatorNodeList!.add(new OperatorNodeList.fromJson(v));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['logistics_name'] = this.logisticsName;
|
||||
data['waybill_code'] = this.waybillCode;
|
||||
if (this.operatorNodeList != null) {
|
||||
data['operator_node_list'] =
|
||||
this.operatorNodeList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class OperatorNodeList {
|
||||
String? scanState;
|
||||
String? systemOperator;
|
||||
int? msgTime;
|
||||
int? orderId;
|
||||
String? content;
|
||||
String? groupState;
|
||||
|
||||
OperatorNodeList(
|
||||
{this.scanState,
|
||||
this.systemOperator,
|
||||
this.msgTime,
|
||||
this.orderId,
|
||||
this.content,
|
||||
this.groupState});
|
||||
|
||||
OperatorNodeList.fromJson(Map<String, dynamic> json) {
|
||||
scanState = json['scan_state'];
|
||||
systemOperator = json['system_operator'];
|
||||
msgTime = json['msg_time'];
|
||||
orderId = json['order_id'];
|
||||
content = json['content'];
|
||||
groupState = json['group_state'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['scan_state'] = this.scanState;
|
||||
data['system_operator'] = this.systemOperator;
|
||||
data['msg_time'] = this.msgTime;
|
||||
data['order_id'] = this.orderId;
|
||||
data['content'] = this.content;
|
||||
data['group_state'] = this.groupState;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,126 @@
|
||||
class OrderListModel {
|
||||
int? id;
|
||||
String? code;
|
||||
int? tradeStatus;
|
||||
int? payType;
|
||||
double? payPrice;
|
||||
double? freightFee;
|
||||
int? jcookAddressId;
|
||||
String? receiverName;
|
||||
String? receiverTel;
|
||||
String? locationName;
|
||||
String? addressDetail;
|
||||
String? createDate;
|
||||
List<MyOrderListVoList>? myOrderListVoList;
|
||||
|
||||
OrderListModel(
|
||||
{this.id,
|
||||
this.code,
|
||||
this.tradeStatus,
|
||||
this.payType,
|
||||
this.payPrice,
|
||||
this.freightFee,
|
||||
this.receiverName,
|
||||
this.receiverTel,
|
||||
this.locationName,
|
||||
this.addressDetail,
|
||||
this.createDate,
|
||||
this.myOrderListVoList,this.jcookAddressId});
|
||||
|
||||
OrderListModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
code = json['code'];
|
||||
tradeStatus = json['tradeStatus'];
|
||||
payType = json['payType'];
|
||||
payPrice = json['payPrice'];
|
||||
freightFee = json['freightFee'];
|
||||
receiverName = json['receiverName'];
|
||||
receiverTel = json['receiverTel'];
|
||||
locationName = json['locationName'];
|
||||
addressDetail = json['addressDetail'];
|
||||
createDate = json['createDate'];
|
||||
jcookAddressId = json['jcookAddressId'];
|
||||
if (json['myOrderListVoList'] != null) {
|
||||
myOrderListVoList = [];
|
||||
json['myOrderListVoList'].forEach((v) {
|
||||
myOrderListVoList!.add(new MyOrderListVoList.fromJson(v));
|
||||
});
|
||||
}else{
|
||||
myOrderListVoList = [];
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['code'] = this.code;
|
||||
data['tradeStatus'] = this.tradeStatus;
|
||||
data['payType'] = this.payType;
|
||||
data['payPrice'] = this.payPrice;
|
||||
data['freightFee'] = this.freightFee;
|
||||
data['receiverName'] = this.receiverName;
|
||||
data['receiverTel'] = this.receiverTel;
|
||||
data['locationName'] = this.locationName;
|
||||
data['addressDetail'] = this.addressDetail;
|
||||
data['createDate'] = this.createDate;
|
||||
data['jcookAddressId'] = this.jcookAddressId;
|
||||
if (this.myOrderListVoList != null) {
|
||||
data['myOrderListVoList'] =
|
||||
this.myOrderListVoList!.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class MyOrderListVoList {
|
||||
int? id;
|
||||
int? jcookGoodsId;
|
||||
String? skuName;
|
||||
String? mainPhoto;
|
||||
double? sellPrice;
|
||||
String? unit;
|
||||
int? kind;
|
||||
double? weight;
|
||||
int? num;
|
||||
double? payPrice;
|
||||
|
||||
MyOrderListVoList(
|
||||
{this.id,
|
||||
this.jcookGoodsId,
|
||||
this.skuName,
|
||||
this.mainPhoto,
|
||||
this.sellPrice,
|
||||
this.unit,
|
||||
this.kind,
|
||||
this.weight,
|
||||
this.num,
|
||||
this.payPrice});
|
||||
|
||||
MyOrderListVoList.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
jcookGoodsId = json['jcookGoodsId'];
|
||||
skuName = json['skuName'];
|
||||
mainPhoto = json['mainPhoto'];
|
||||
sellPrice = json['sellPrice'];
|
||||
unit = json['unit'];
|
||||
kind = json['kind'];
|
||||
weight = json['weight'];
|
||||
num = json['num'];
|
||||
payPrice = json['payPrice'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['jcookGoodsId'] = this.jcookGoodsId;
|
||||
data['skuName'] = this.skuName;
|
||||
data['mainPhoto'] = this.mainPhoto;
|
||||
data['sellPrice'] = this.sellPrice;
|
||||
data['unit'] = this.unit;
|
||||
data['kind'] = this.kind;
|
||||
data['weight'] = this.weight;
|
||||
data['num'] = this.num;
|
||||
data['payPrice'] = this.payPrice;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
import 'package:aku_community/model/good/category_model.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:aku_community/models/market/market_category_model.dart';
|
||||
import 'package:aku_community/ui/market/category/category_sub_view.dart';
|
||||
import 'package:aku_community/ui/market/search/search_goods_page.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||
|
||||
import 'new_category_sub_view.dart';
|
||||
|
||||
class NewCategoryPage extends StatefulWidget {
|
||||
final List<CategoryModel> models;
|
||||
NewCategoryPage({Key? key, required this.models}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NewCategoryPageState createState() => _NewCategoryPageState();
|
||||
}
|
||||
|
||||
class _NewCategoryPageState extends State<NewCategoryPage>
|
||||
with TickerProviderStateMixin {
|
||||
int _index = 0;
|
||||
late TabController _tabController;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_tabController = TabController(length: widget.models.length, vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_tabController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '分类',
|
||||
// actions: [
|
||||
// IconButton(
|
||||
// icon: Icon(CupertinoIcons.search),
|
||||
// onPressed: () {
|
||||
// Get.to(() => SearchGoodsPage());
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
bgColor: Colors.white,
|
||||
appBarBottom: PreferredSize(
|
||||
child: Divider(height: 1),
|
||||
preferredSize: Size.fromHeight(1),
|
||||
),
|
||||
body: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 203.w,
|
||||
child: ListView.builder(
|
||||
physics: ClampingScrollPhysics(),
|
||||
itemBuilder: (context, index) {
|
||||
bool sameIndex = index == _index;
|
||||
final item = widget.models[index];
|
||||
return Stack(
|
||||
children: [
|
||||
MaterialButton(
|
||||
height: 100.w,
|
||||
minWidth: double.infinity,
|
||||
onPressed: () {
|
||||
_index = index;
|
||||
_tabController.animateTo(index);
|
||||
setState(() {});
|
||||
},
|
||||
child: Text(
|
||||
item.name??'',
|
||||
style: TextStyle(
|
||||
color: sameIndex ? kPrimaryColor : ktextPrimary,
|
||||
),
|
||||
),
|
||||
),
|
||||
AnimatedPositioned(
|
||||
left: sameIndex ? 0 : -8.w,
|
||||
top: sameIndex ? 20.w : 30.w,
|
||||
bottom: sameIndex ? 20.w : 30.w,
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOutCubic,
|
||||
child: Container(
|
||||
color: kPrimaryColor,
|
||||
width: 8.w,
|
||||
height: 40.w,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
itemCount: widget.models.length,
|
||||
),
|
||||
),
|
||||
VerticalDivider(
|
||||
color: Color(0xFFE8E8E8),
|
||||
width: 1,
|
||||
thickness: 1,
|
||||
),
|
||||
TabBarView(
|
||||
controller: _tabController,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
children:
|
||||
widget.models.map((e) => NewCategorySubView(model: e)).toList(),
|
||||
).expand(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
import 'package:aku_community/model/good/category_model.dart';
|
||||
import 'package:aku_community/ui/market/search/search_goods_page.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/model/common/img_model.dart';
|
||||
import 'package:aku_community/models/market/market_category_model.dart';
|
||||
import 'package:aku_community/ui/market/goods/goods_list_view.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
|
||||
class NewCategorySubCard extends StatelessWidget {
|
||||
final CategoryListSecond subModels;
|
||||
const NewCategorySubCard({
|
||||
Key? key,
|
||||
|
||||
required this.subModels,
|
||||
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialButton(
|
||||
child: Column(
|
||||
children: [
|
||||
Spacer(),
|
||||
FadeInImage.assetNetwork(
|
||||
image:'',
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
height: 75.w,
|
||||
width: 75.w,
|
||||
),
|
||||
12.hb,
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
width: 110.w,
|
||||
child: Text(
|
||||
subModels.name??'',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: Color(0xFF4A4B51),
|
||||
),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
onPressed: () async {
|
||||
Get.to(()=> SearchGoodsPage(search:subModels.name ,));
|
||||
// await Get.to(
|
||||
// () => GoodsListView(
|
||||
// model: model,
|
||||
// subModels: subModels,
|
||||
// selectSubModel: selectModel,
|
||||
// ),
|
||||
// );
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
import 'package:aku_community/model/good/category_model.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:aku_community/models/market/market_category_model.dart';
|
||||
import 'package:aku_community/ui/market/category/category_sub_view.dart';
|
||||
import 'package:aku_community/ui/market/search/search_goods_page.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
import 'package:aku_community/ui/market/category/category_sub_card.dart';
|
||||
|
||||
import 'new_category_sub_card.dart';
|
||||
|
||||
class NewCategorySubView extends StatefulWidget {
|
||||
final CategoryModel model;
|
||||
NewCategorySubView({Key? key, required this.model}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NewCategorySubViewState createState() => _NewCategorySubViewState();
|
||||
}
|
||||
|
||||
class _NewCategorySubViewState extends State<NewCategorySubView>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return ListView.builder(
|
||||
itemBuilder: (context, index) {
|
||||
return _SecondCard(
|
||||
widget.model.categoryList![index]
|
||||
);
|
||||
},
|
||||
itemCount: widget.model.categoryList!.length,
|
||||
);
|
||||
}
|
||||
|
||||
_SecondCard(CategoryList item){
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 20.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
20.wb,
|
||||
Text(
|
||||
item.name??'',
|
||||
style: TextStyle(
|
||||
fontSize: 28.sp,
|
||||
color: Color(0xFF333333),
|
||||
),
|
||||
),
|
||||
Spacer()
|
||||
],
|
||||
),
|
||||
GridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
),
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
return NewCategorySubCard(
|
||||
subModels: item.categoryListSecond![index],
|
||||
);
|
||||
},
|
||||
itemCount: item.categoryListSecond!.length,
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
@ -0,0 +1,268 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:aku_community/model/order/logistics_model.dart';
|
||||
import 'package:aku_community/model/order/order_list_model.dart';
|
||||
import 'package:aku_community/model/user/adress_model.dart';
|
||||
import 'package:aku_community/models/market/order/goods_home_model.dart';
|
||||
import 'package:aku_community/pages/tab_navigator.dart';
|
||||
import 'package:aku_community/utils/network/base_list_model.dart';
|
||||
import 'package:aku_community/utils/network/net_util.dart';
|
||||
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||
import 'package:aku_community/widget/buttons/end_button.dart';
|
||||
import 'package:aku_community/widget/buttons/line_button.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/model/common/img_model.dart';
|
||||
import 'package:aku_community/model/community/community_topic_model.dart';
|
||||
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
|
||||
import 'package:aku_community/ui/community/community_views/topic/topic_detail_page.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
import 'package:waterfall_flow/waterfall_flow.dart';
|
||||
|
||||
import '../market_home_goods_card.dart';
|
||||
|
||||
class LogisticsPage extends StatefulWidget {
|
||||
final List<LogisticsModel> models;
|
||||
final OrderListModel orderModel;
|
||||
final MyOrderListVoList goods;
|
||||
LogisticsPage({Key? key, required this.models, required this.goods, required this.orderModel}) : super(key: key);
|
||||
|
||||
@override
|
||||
_LogisticsPageState createState() => _LogisticsPageState();
|
||||
}
|
||||
|
||||
class _LogisticsPageState extends State<LogisticsPage> {
|
||||
List<OperatorNodeList> operatorNodeList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
operatorNodeList.addAll(widget.models[0].operatorNodeList!);
|
||||
operatorNodeList.addAll(widget.models[0].operatorNodeList!);
|
||||
operatorNodeList.addAll(widget.models[0].operatorNodeList!);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return BeeScaffold(
|
||||
title: '物流详情',
|
||||
body:ListView(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 22.w, right: 22.w, top: 20.w, bottom: 20.w),
|
||||
margin: EdgeInsets.only(left: 20.w,right: 20.w,top: 20.w),
|
||||
width: double.infinity,
|
||||
height: 180.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Container(
|
||||
width: 126.w,
|
||||
height: 126.w,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
),
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
image: widget.goods.mainPhoto ?? '',
|
||||
height: 126.w,
|
||||
width: 126.w,
|
||||
),
|
||||
),
|
||||
10.wb,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
'已发货'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
Container(
|
||||
width: 520.w,
|
||||
child: RichText(
|
||||
text: TextSpan(children: [
|
||||
TextSpan(
|
||||
text: widget.goods.skuName,
|
||||
style: TextStyle(fontSize: 28.sp, color: ktextPrimary)),
|
||||
]),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
'包裹离目的地越来越近了'.text.size(28.sp).color(ktextPrimary).make(),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
...widget.models.map((e) => _logisticsView(
|
||||
e
|
||||
),
|
||||
|
||||
)
|
||||
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
|
||||
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
_logisticsView(LogisticsModel model ){
|
||||
return
|
||||
Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 22.w, right: 22.w, bottom: 20.w,top: 20.w),
|
||||
margin: EdgeInsets.only(left: 20.w,right: 20.w,top: 20.w),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
color: Colors.white),
|
||||
alignment: Alignment.topCenter,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Container(
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
75.wb,
|
||||
(model.logisticsName??'未获取到快递公司').text.size(28.sp).color(ktextPrimary).make(),
|
||||
50.wb,
|
||||
(model.waybillCode??'未获取到快递单号').text.size(28.sp).color(ktextPrimary).make(),
|
||||
],
|
||||
),
|
||||
),
|
||||
20.hb,
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: Text('收',style: TextStyle(color: Color(0xFFBBBBBB),fontSize: 28.sp),),
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
width: 2.w, color:Color(0xFFBBBBBB)),
|
||||
borderRadius: BorderRadius.all(Radius.circular(28.w))
|
||||
),
|
||||
width: 56.w,
|
||||
height: 56.w,
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
20.wb,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 580.w,
|
||||
child: Text(
|
||||
widget.orderModel.locationName ?? '',
|
||||
style:
|
||||
TextStyle(fontSize: 28.sp, color: ktextPrimary),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
|
||||
5.hb,
|
||||
SizedBox(
|
||||
width: 580.w,
|
||||
child: Text(
|
||||
(widget.orderModel.addressDetail ?? ''),
|
||||
style:
|
||||
TextStyle(fontSize: 28.sp, color: ktextPrimary),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
|
||||
5.hb,
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(widget.orderModel.receiverName ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 28.sp, color: ktextPrimary)),
|
||||
30.wb,
|
||||
Text(widget.orderModel.receiverTel ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 28.sp, color: ktextPrimary)),
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
30.hb,
|
||||
if(model.operatorNodeList!=null)
|
||||
...model.operatorNodeList!.map((e) =>
|
||||
|
||||
Container(
|
||||
color: Colors.white,
|
||||
width: double.infinity,
|
||||
alignment: Alignment.centerLeft,
|
||||
margin: EdgeInsets.only(bottom: 30.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
|
||||
Image.asset(R.ASSETS_ICONS_ICON_MARKET_SUCCESS_PNG,width: 50.w,height: 50.w,),
|
||||
20.wb,
|
||||
Container(
|
||||
width: 500.w,
|
||||
child: RichText(
|
||||
text: TextSpan(children: [
|
||||
TextSpan(
|
||||
text: DateTime.fromMillisecondsSinceEpoch(int.parse(e.msgTime.toString()+'000')).toString().substring(0,19),
|
||||
style: TextStyle(fontSize: 28.sp, color: ktextPrimary)),
|
||||
WidgetSpan(
|
||||
child: SizedBox(width: 20.w,),
|
||||
),
|
||||
TextSpan(
|
||||
text: e.content,
|
||||
style: TextStyle(fontSize: 28.sp, color: ktextPrimary)),
|
||||
]),
|
||||
maxLines: 5,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
),
|
||||
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,684 @@
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/model/order/order_list_model.dart';
|
||||
import 'package:aku_community/pages/life_pay/pay_finish_page.dart';
|
||||
import 'package:aku_community/pages/life_pay/pay_util.dart';
|
||||
import 'package:aku_community/ui/market/search/settlementGoodsDTO.dart';
|
||||
import 'package:aku_community/utils/network/base_model.dart';
|
||||
import 'package:aku_community/utils/network/net_util.dart';
|
||||
import 'package:aku_community/widget/buttons/line_button.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
|
||||
import 'order_detail_page.dart';
|
||||
|
||||
class OrderCard extends StatefulWidget {
|
||||
final OrderListModel model;
|
||||
final VoidCallback callRefresh;
|
||||
|
||||
OrderCard({
|
||||
Key? key,
|
||||
required this.model,
|
||||
required this.callRefresh,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
_OrderCardState createState() => _OrderCardState();
|
||||
}
|
||||
|
||||
class _OrderCardState extends State<OrderCard> {
|
||||
List<SettlementGoodsDTO> _goodsList = [];
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
switch (widget.model.tradeStatus) {
|
||||
case 0:
|
||||
return _daifukuan();
|
||||
case 1:
|
||||
return _yiguanbi();
|
||||
case 2:
|
||||
return _daifahuo();
|
||||
case 3:
|
||||
return _yiguanbi();
|
||||
case 4:
|
||||
return _daishouhuo();
|
||||
case 5:
|
||||
return _yiwancheng();
|
||||
case 9:
|
||||
return _yiquxiao();
|
||||
default:
|
||||
return SizedBox();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.model.myOrderListVoList!.forEach((element) {
|
||||
_goodsList.add(SettlementGoodsDTO(jcookGoodsId: element.jcookGoodsId,num: element.num));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Future _pay() async {
|
||||
Function cancel = BotToast.showLoading();
|
||||
BaseModel baseModel = await NetUtil()
|
||||
.post(API.pay.jcookOrderCreateOrder, params: {
|
||||
"addressId":widget.model.jcookAddressId,
|
||||
"settlementGoodsDTOList": _goodsList.map((v) => v.toJson()).toList(),
|
||||
"payType": 1, //暂时写死 等待后续补充
|
||||
"payPrice": widget.model.payPrice
|
||||
});
|
||||
if (baseModel.status ?? false) {
|
||||
bool result = await PayUtil().callAliPay(
|
||||
baseModel.message!, API.pay.sharePayOrderCodeCheck);
|
||||
if (result) {
|
||||
Get.off(() => PayFinishPage());
|
||||
}
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
|
||||
|
||||
|
||||
Future _deleteOrder() async {
|
||||
bool? result = await Get.dialog(
|
||||
CupertinoAlertDialog(
|
||||
title: Text('提示'),
|
||||
content: Text('您确定要删除该订单吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('取消'),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('确定'),
|
||||
onPressed: () => Get.back(result: true),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if(result==true){
|
||||
|
||||
Function cancel = BotToast.showLoading();
|
||||
BaseModel baseModel = await NetUtil()
|
||||
.get(API.market.deleteOrder, params: {
|
||||
"orderId":widget.model.id,
|
||||
});
|
||||
if (baseModel.status ?? false) {
|
||||
BotToast.showText(text: '删除成功');
|
||||
widget.callRefresh();
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Future _cancelOrder() async {
|
||||
bool? result = await Get.dialog(
|
||||
CupertinoAlertDialog(
|
||||
title: Text('提示'),
|
||||
content: Text('您确定要取消该订单吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('取消'),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('确定'),
|
||||
onPressed: () => Get.back(result: true),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if(result==true){
|
||||
|
||||
Function cancel = BotToast.showLoading();
|
||||
BaseModel baseModel = await NetUtil()
|
||||
.get(API.market.cancelOrder, params: {
|
||||
"orderId":widget.model.id,
|
||||
'cancelReasonCode':4
|
||||
});
|
||||
if (baseModel.status ?? false) {
|
||||
BotToast.showText(text: '取消成功');
|
||||
widget.callRefresh();
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Future _confirmOrder() async {
|
||||
bool? result = await Get.dialog(
|
||||
CupertinoAlertDialog(
|
||||
title: Text('提示'),
|
||||
content: Text('确认收到货了吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('取消'),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('确定'),
|
||||
onPressed: () => Get.back(result: true),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (result == true) {
|
||||
Function cancel = BotToast.showLoading();
|
||||
BaseModel baseModel = await NetUtil().get(API.market.confirmOrder,
|
||||
params: {"orderId": widget.model.id,});
|
||||
if (baseModel.status ?? false) {
|
||||
BotToast.showText(text: '收货成功');
|
||||
Get.back();
|
||||
widget.callRefresh();
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
_yiquxiao() {
|
||||
return GestureDetector(
|
||||
onTap: (){
|
||||
Get.to(()=>OrderDetailPage(orderModel: widget.model,callRefresh: widget.callRefresh,));
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(24.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'订单信息'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
Spacer(),
|
||||
'订单已取消'.text.size(24.sp).color(ktextSubColor).make(),
|
||||
],
|
||||
),
|
||||
16.hb,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.w,
|
||||
color: Color(0xFFD9D9D9),
|
||||
),
|
||||
16.hb,
|
||||
...widget.model.myOrderListVoList!.map((e) => _goodCard(e)),
|
||||
20.hb,
|
||||
_priceView(),
|
||||
20.hb,
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
LineButton(
|
||||
onPressed: ()async {
|
||||
|
||||
_deleteOrder();
|
||||
|
||||
|
||||
},
|
||||
text: ('删除订单').text.size(28.sp).color(Color(0xFF666666)).make(),
|
||||
color: Color(0xFFBBBBBB),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_yiwancheng() {
|
||||
return GestureDetector(
|
||||
onTap: (){
|
||||
Get.to(()=>OrderDetailPage(orderModel: widget.model,callRefresh: widget.callRefresh,));
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(24.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'订单信息'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
Spacer(),
|
||||
'订单已完成'.text.size(24.sp).color(ktextSubColor).make(),
|
||||
],
|
||||
),
|
||||
16.hb,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.w,
|
||||
color: Color(0xFFD9D9D9),
|
||||
),
|
||||
16.hb,
|
||||
...widget.model.myOrderListVoList!.map((e) => _goodCard(e)),
|
||||
20.hb,
|
||||
_priceView(),
|
||||
20.hb,
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
// LineButton(
|
||||
// onPressed: () {
|
||||
//
|
||||
// },
|
||||
// text:
|
||||
// ('退款/售后').text.size(28.sp).color(Color(0xFFBBBBBB)).make(),
|
||||
// color: Color(0xFFBBBBBB),
|
||||
// ),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_daishouhuo() {
|
||||
return GestureDetector(
|
||||
onTap: (){
|
||||
Get.to(()=>OrderDetailPage(orderModel: widget.model,callRefresh: widget.callRefresh,));
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(24.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'订单信息'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
Spacer(),
|
||||
'订单待收货'.text.size(24.sp).color(ktextSubColor).make(),
|
||||
],
|
||||
),
|
||||
16.hb,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.w,
|
||||
color: Color(0xFFD9D9D9),
|
||||
),
|
||||
16.hb,
|
||||
...widget.model.myOrderListVoList!.map((e) => _goodCard(e)),
|
||||
20.hb,
|
||||
_priceView(),
|
||||
20.hb,
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
// LineButton(
|
||||
// onPressed: () {},
|
||||
// text: ('取消订单').text.size(28.sp).color(Color(0xFFBBBBBB)).make(),
|
||||
// color: Color(0xFFBBBBBB),
|
||||
// ),
|
||||
// 32.wb,
|
||||
LineButton(
|
||||
onPressed: () {
|
||||
_confirmOrder();
|
||||
},
|
||||
text: ('确认收货').text.size(28.sp).color(Color(0xFFE52E2E)).make(),
|
||||
color: Color(0xFFE52E2E),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_daifahuo() {
|
||||
return GestureDetector(
|
||||
onTap: (){
|
||||
Get.to(()=>OrderDetailPage(orderModel: widget.model,callRefresh: widget.callRefresh,));
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(24.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'订单信息'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
Spacer(),
|
||||
'订单待发货'.text.size(24.sp).color(ktextSubColor).make(),
|
||||
],
|
||||
),
|
||||
16.hb,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.w,
|
||||
color: Color(0xFFD9D9D9),
|
||||
),
|
||||
16.hb,
|
||||
...widget.model.myOrderListVoList!.map((e) => _goodCard(e)),
|
||||
20.hb,
|
||||
_priceView(),
|
||||
20.hb,
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
LineButton(
|
||||
onPressed: () {
|
||||
_cancelOrder();
|
||||
},
|
||||
text: ('取消订单').text.size(28.sp).color(Color(0xFF666666)).make(),
|
||||
color: Color(0xFFBBBBBB),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_yiguanbi() {
|
||||
return GestureDetector(
|
||||
onTap: (){
|
||||
Get.to(()=>OrderDetailPage(orderModel: widget.model,callRefresh: widget.callRefresh,));
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(24.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'订单信息'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
Spacer(),
|
||||
'订单已关闭'.text.size(24.sp).color(ktextSubColor).make(),
|
||||
],
|
||||
),
|
||||
16.hb,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.w,
|
||||
color: Color(0xFFD9D9D9),
|
||||
),
|
||||
16.hb,
|
||||
...widget.model.myOrderListVoList!.map((e) => _goodCard(e)),
|
||||
20.hb,
|
||||
_priceView(),
|
||||
20.hb,
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
LineButton(
|
||||
onPressed: () {
|
||||
_deleteOrder();
|
||||
},
|
||||
text: ('删除订单').text.size(28.sp).color(Color(0xFF666666)).make(),
|
||||
color: Color(0xFFBBBBBB),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_daifukuan() {
|
||||
return GestureDetector(
|
||||
onTap: (){
|
||||
Get.to(()=>OrderDetailPage(orderModel: widget.model,callRefresh: widget.callRefresh,));
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(24.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
'订单信息'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
Spacer(),
|
||||
'订单待付款'.text.size(24.sp).color(ktextSubColor).make(),
|
||||
],
|
||||
),
|
||||
16.hb,
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 1.w,
|
||||
color: Color(0xFFD9D9D9),
|
||||
),
|
||||
16.hb,
|
||||
...widget.model.myOrderListVoList!.map((e) => _goodCard(e)),
|
||||
20.hb,
|
||||
_priceView(),
|
||||
20.hb,
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
LineButton(
|
||||
onPressed: () {
|
||||
_cancelOrder();
|
||||
},
|
||||
text: ('取消订单').text.size(28.sp).color(Color(0xFF666666)).make(),
|
||||
color: Color(0xFFBBBBBB),
|
||||
width: 168.w,
|
||||
),
|
||||
32.wb,
|
||||
LineButton(
|
||||
onPressed: () async {
|
||||
_pay();
|
||||
},
|
||||
text: ('付款').text.size(28.sp).color(Color(0xFFE52E2E)).make(),
|
||||
color: Color(0xFFE52E2E),
|
||||
width: 168.w,
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _goodCard(MyOrderListVoList model) {
|
||||
var top = RichText(
|
||||
text: TextSpan(children: [
|
||||
WidgetSpan(
|
||||
child: _getKindWd(model.kind ?? 0),
|
||||
),
|
||||
TextSpan(
|
||||
text: model.skuName,
|
||||
style: TextStyle(fontSize: 28.sp, color: ktextPrimary)),
|
||||
]),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
var mid = Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.w), color: Color(0xFFF2F3F4)),
|
||||
child: '规格:${model.weight}kg/${model.unit}'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Color(0xFFBBBBBB))
|
||||
.make(),
|
||||
);
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
margin: EdgeInsets.only(bottom: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: 188.w,
|
||||
height: 188.w,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
),
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
image: model.mainPhoto ?? '',
|
||||
height: 188.w,
|
||||
width: 188.w,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
20.wb,
|
||||
Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: top,
|
||||
width: (model.payPrice ?? 0) > 9999 ? 300.w : 320.w,
|
||||
alignment: Alignment.topCenter,
|
||||
),
|
||||
|
||||
10.hb,
|
||||
mid,
|
||||
//Spacer(),
|
||||
|
||||
10.hb,
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
8.hb,
|
||||
'¥'
|
||||
.richText
|
||||
.withTextSpanChildren([
|
||||
(model.payPrice ?? 0)
|
||||
.toStringAsFixed(2)
|
||||
.textSpan
|
||||
.size(28.sp)
|
||||
.color(ktextPrimary)
|
||||
.make(),
|
||||
])
|
||||
.color(ktextPrimary)
|
||||
.size(28.sp)
|
||||
.make(),
|
||||
'x ${(model.num ?? 0)}'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Color(0xFFBBBBBB))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getKindWd(int kind) {
|
||||
switch (kind) {
|
||||
case 1:
|
||||
return Container(
|
||||
// width: 90.w,
|
||||
// height: 26.w,
|
||||
padding: EdgeInsets.symmetric(horizontal: 6.w, vertical: 2.w),
|
||||
margin: EdgeInsets.only(right: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.w),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: [Color(0xFFEC5329), Color(0xFFF58123)])),
|
||||
child: '京东自营'.text.size(18.sp).color(Colors.white).make());
|
||||
case 2:
|
||||
return Container(
|
||||
width: 90.w,
|
||||
height: 26.w,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: [Color(0xFFEC5329), Color(0xFFF58123)])),
|
||||
child: '京东POP'.text.size(18.sp).color(Colors.white).make());
|
||||
default:
|
||||
return SizedBox();
|
||||
}
|
||||
}
|
||||
|
||||
_priceView() {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
'商品金额:'.text.size(28.sp).color(Color(0xFF666666)).make(),
|
||||
'¥${((widget.model.payPrice ?? 0) - (widget.model.freightFee ?? 0)).toStringAsFixed(2)}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Color(0xFF666666))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
'运费:'.text.size(28.sp).color(Color(0xFF666666)).make(),
|
||||
'¥${((widget.model.freightFee ?? 0)).toStringAsFixed(2)}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Color(0xFF666666))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
'实付款:'.text.size(32.sp).color(Color(0xFF333333)).make(),
|
||||
'¥${((widget.model.payPrice ?? 0)).toStringAsFixed(2)}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Color(0xFFE52E2E))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,722 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:aku_community/const/resource.dart';
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/model/good/good_detail_model.dart';
|
||||
import 'package:aku_community/model/order/create_order_model.dart';
|
||||
import 'package:aku_community/model/order/logistics_model.dart';
|
||||
import 'package:aku_community/model/order/order_list_model.dart';
|
||||
import 'package:aku_community/model/user/adress_model.dart';
|
||||
import 'package:aku_community/models/market/shop_car/shop_car_list_model.dart';
|
||||
import 'package:aku_community/pages/life_pay/pay_finish_page.dart';
|
||||
import 'package:aku_community/pages/life_pay/pay_util.dart';
|
||||
import 'package:aku_community/pages/personal/address/address_list_page.dart';
|
||||
import 'package:aku_community/provider/app_provider.dart';
|
||||
import 'package:aku_community/ui/market/search/settlementGoodsDTO.dart';
|
||||
import 'package:aku_community/ui/market/shop_car/shop_car_func.dart';
|
||||
import 'package:aku_community/utils/network/base_model.dart';
|
||||
import 'package:aku_community/utils/network/net_util.dart';
|
||||
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||
import 'package:aku_community/widget/buttons/line_button.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
import 'package:aku_community/widget/buttons/end_button.dart';
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import 'logistics_page.dart';
|
||||
import 'order_page.dart';
|
||||
|
||||
class OrderDetailPage extends StatefulWidget {
|
||||
final OrderListModel orderModel;
|
||||
final VoidCallback callRefresh;
|
||||
|
||||
OrderDetailPage(
|
||||
{Key? key, required this.orderModel, required this.callRefresh})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_OrderDetailPageState createState() => _OrderDetailPageState();
|
||||
}
|
||||
|
||||
class _OrderDetailPageState extends State<OrderDetailPage> {
|
||||
List<SettlementGoodsDTO> _goodsList = [];
|
||||
|
||||
late Timer? timer;
|
||||
List<LogisticsModel> logisticsModels = [];
|
||||
|
||||
_checkTime() {
|
||||
if (DateTime.parse(widget.orderModel.createDate!)
|
||||
.add(Duration(minutes: 5))
|
||||
.difference(DateTime.now())
|
||||
.inSeconds <=
|
||||
0) {
|
||||
Get.back();
|
||||
BotToast.showText(text: '订单已过期,自动关闭');
|
||||
widget.callRefresh();
|
||||
} else {}
|
||||
}
|
||||
|
||||
Future _pay() async {
|
||||
Function cancel = BotToast.showLoading();
|
||||
BaseModel baseModel =
|
||||
await NetUtil().post(API.pay.jcookOrderCreateOrder, params: {
|
||||
"addressId": widget.orderModel.jcookAddressId,
|
||||
"settlementGoodsDTOList": _goodsList.map((v) => v.toJson()).toList(),
|
||||
"payType": 1, //暂时写死 等待后续补充
|
||||
"payPrice": widget.orderModel.payPrice
|
||||
});
|
||||
if (baseModel.status ?? false) {
|
||||
bool result = await PayUtil()
|
||||
.callAliPay(baseModel.message!, API.pay.jcookOrderCheckAlipay);
|
||||
if (result) {
|
||||
Get.off(() => OrderPage(initIndex: 2));
|
||||
}else{
|
||||
Get.off(() => OrderPage(initIndex: 1));
|
||||
}
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
|
||||
Future _deleteOrder() async {
|
||||
bool? result = await Get.dialog(
|
||||
CupertinoAlertDialog(
|
||||
title: Text('提示'),
|
||||
content: Text('您确定要删除该订单吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('取消'),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('确定'),
|
||||
onPressed: () => Get.back(result: true),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (result == true) {
|
||||
Function cancel = BotToast.showLoading();
|
||||
BaseModel baseModel =
|
||||
await NetUtil().get(API.market.deleteOrder, params: {
|
||||
"orderId": widget.orderModel.id,
|
||||
});
|
||||
if (baseModel.status ?? false) {
|
||||
BotToast.showText(text: '删除成功');
|
||||
Get.back();
|
||||
widget.callRefresh();
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Future _cancelOrder() async {
|
||||
bool? result = await Get.dialog(
|
||||
CupertinoAlertDialog(
|
||||
title: Text('提示'),
|
||||
content: Text('您确定要取消该订单吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('取消'),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('确定'),
|
||||
onPressed: () => Get.back(result: true),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (result == true) {
|
||||
Function cancel = BotToast.showLoading();
|
||||
BaseModel baseModel = await NetUtil().get(API.market.cancelOrder,
|
||||
params: {"orderId": widget.orderModel.id, 'cancelReasonCode': 4});
|
||||
if (baseModel.status ?? false) {
|
||||
BotToast.showText(text: '取消成功');
|
||||
Get.back();
|
||||
widget.callRefresh();
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Future _confirmOrder() async {
|
||||
bool? result = await Get.dialog(
|
||||
CupertinoAlertDialog(
|
||||
title: Text('提示'),
|
||||
content: Text('确认收到货了吗?'),
|
||||
actions: [
|
||||
CupertinoDialogAction(
|
||||
child: Text('取消'),
|
||||
onPressed: () => Get.back(),
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: Text('确定'),
|
||||
onPressed: () => Get.back(result: true),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
if (result == true) {
|
||||
Function cancel = BotToast.showLoading();
|
||||
BaseModel baseModel =
|
||||
await NetUtil().get(API.market.confirmOrder, params: {
|
||||
"orderId": widget.orderModel.id,
|
||||
});
|
||||
if (baseModel.status ?? false) {
|
||||
BotToast.showText(text: '收货成功');
|
||||
Get.back();
|
||||
widget.callRefresh();
|
||||
}
|
||||
cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
widget.orderModel.myOrderListVoList!.forEach((element) {
|
||||
_goodsList
|
||||
.add(SettlementGoodsDTO(jcookGoodsId: element.jcookGoodsId, num: element.num));
|
||||
});
|
||||
if (widget.orderModel.tradeStatus == 0) {
|
||||
timer = Timer.periodic(Duration(seconds: 1), (Timer t) => _checkTime());
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
if(timer!=null)
|
||||
timer!.cancel();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: widget.orderModel.tradeStatus == 0
|
||||
? '等待买家付款'
|
||||
: widget.orderModel.tradeStatus == 2
|
||||
? '等待卖家发货'
|
||||
: widget.orderModel.tradeStatus == 1 ||
|
||||
widget.orderModel.tradeStatus == 3
|
||||
? '订单已关闭'.text.size(32.sp).black.bold.make()
|
||||
: widget.orderModel.tradeStatus == 4
|
||||
? '等待买家收货'.text.size(32.sp).black.bold.make()
|
||||
: widget.orderModel.tradeStatus == 5
|
||||
? '交易成功'.text.size(32.sp).black.bold.make()
|
||||
: widget.orderModel.tradeStatus == 9
|
||||
? '订单已取消'.text.size(32.sp).black.bold.make()
|
||||
: '',
|
||||
titleSpacing: 0,
|
||||
body: ListView(
|
||||
children: [
|
||||
|
||||
widget.orderModel.tradeStatus == 0
|
||||
? _head()
|
||||
: widget.orderModel.tradeStatus == 2
|
||||
? _headDaifahuo(): widget.orderModel.tradeStatus == 4
|
||||
? _headDaishouhuo()
|
||||
: SizedBox(),
|
||||
20.hb,
|
||||
_address(context),
|
||||
20.hb,
|
||||
_goodsCard(),
|
||||
20.hb,
|
||||
_orderView(),
|
||||
20.hb,
|
||||
],
|
||||
),
|
||||
bottomNavi: Container(
|
||||
width: double.infinity,
|
||||
height: 120.w,
|
||||
color: Colors.white,
|
||||
child: _getBtn()
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_getBtn() {
|
||||
return Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
widget.orderModel.tradeStatus == 0 || widget.orderModel.tradeStatus == 2
|
||||
? LineButton(
|
||||
onPressed: () async {
|
||||
_cancelOrder();
|
||||
},
|
||||
width: 168.w,
|
||||
text: '取消订单'.text.size(32.sp).color(Color(0xFF666666)).make(),
|
||||
color: Color(0xFFBBBBBB),
|
||||
)
|
||||
: SizedBox(),
|
||||
widget.orderModel.tradeStatus == 1 ||
|
||||
widget.orderModel.tradeStatus == 3 ||
|
||||
widget.orderModel.tradeStatus == 5 ||
|
||||
widget.orderModel.tradeStatus == 9
|
||||
? LineButton(
|
||||
onPressed: () async {
|
||||
_deleteOrder();
|
||||
},
|
||||
width: 168.w,
|
||||
text: '删除订单'.text.size(32.sp).color(Color(0xFF666666)).make(),
|
||||
color: Color(0xFFBBBBBB),
|
||||
)
|
||||
: SizedBox(),
|
||||
widget.orderModel.tradeStatus == 0 || widget.orderModel.tradeStatus == 5
|
||||
? 32.wb
|
||||
: SizedBox(),
|
||||
widget.orderModel.tradeStatus == 0
|
||||
? LineButton(
|
||||
onPressed: () async {
|
||||
_pay();
|
||||
},
|
||||
width: 168.w,
|
||||
text: '付款'.text.size(32.sp).color(Color(0xFFE52E2E)).make(),
|
||||
color: Color(0xFFE52E2E),
|
||||
)
|
||||
: widget.orderModel.tradeStatus == 4
|
||||
? LineButton(
|
||||
onPressed: () async {
|
||||
_confirmOrder();
|
||||
},
|
||||
width: 168.w,
|
||||
text:
|
||||
'确认收货'.text.size(32.sp).color(Color(0xFFE52E2E)).make(),
|
||||
color: Color(0xFFE52E2E),
|
||||
)
|
||||
: SizedBox(),
|
||||
20.widthBox,
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
_goodsCard() {
|
||||
return Container(
|
||||
width: double.infinity,
|
||||
padding: EdgeInsets.all(24.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
...widget.orderModel.myOrderListVoList!.map((e) => _goodCard(e)),
|
||||
|
||||
_priceView(),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
_priceView() {
|
||||
return Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
'商品金额:'.text.size(28.sp).color(Color(0xFF666666)).make(),
|
||||
'¥${((widget.orderModel.payPrice ?? 0) - (widget.orderModel.freightFee ?? 0)).toStringAsFixed(2)}'
|
||||
.text.size(28.sp).color(Color(0xFF333333)).make(),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
8.hb,
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
'运费:'.text.size(28.sp).color(Color(0xFF666666)).make(),
|
||||
'¥${((widget.orderModel.freightFee ?? 0)).toStringAsFixed(2)}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Color(0xFF666666))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
8.hb,
|
||||
Row(
|
||||
children: [
|
||||
Spacer(),
|
||||
'实付款:'.text.size(32.sp).color(Color(0xFF333333)).bold.make(),
|
||||
'¥${((widget.orderModel.payPrice ?? 0)).toStringAsFixed(2)}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Color(0xFFE52E2E))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
16.hb,
|
||||
],
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
_address(BuildContext context) {
|
||||
return Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 16.w, right: 16.w, top: 16.w, bottom: 16.w),
|
||||
margin: EdgeInsets.symmetric(horizontal: 20.w),
|
||||
width: double.infinity,
|
||||
height: 182.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
color: Colors.white),
|
||||
alignment: Alignment.center,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(
|
||||
R.ASSETS_ICONS_ICON_GOOD_LOCATION_PNG,
|
||||
width: 60.w,
|
||||
height: 60.w,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 20.w, ),
|
||||
child: SizedBox(
|
||||
width: 518.w,
|
||||
child: Text(
|
||||
widget.orderModel.locationName ?? '',
|
||||
style:
|
||||
TextStyle(fontSize: 24.sp, color: ktextPrimary),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
5.hb,
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 20.w, ),
|
||||
child: SizedBox(
|
||||
width: 518.w,
|
||||
child: Text(
|
||||
(widget.orderModel.addressDetail ?? ''),
|
||||
style:
|
||||
TextStyle(fontSize: 32.sp, color: ktextPrimary),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
5.hb,
|
||||
Padding(
|
||||
padding:
|
||||
EdgeInsets.symmetric(horizontal: 20.w, ),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Text(widget.orderModel.receiverName ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: ktextPrimary)),
|
||||
30.wb,
|
||||
Text(widget.orderModel.receiverTel ?? '',
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp, color: ktextPrimary)),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Icon(
|
||||
CupertinoIcons.chevron_forward,
|
||||
size: 40.w,
|
||||
color: Color(0xFF999999),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_orderView() {
|
||||
return Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 16.w, right: 16.w, top: 20.w, bottom: 20.w),
|
||||
margin: EdgeInsets.symmetric(horizontal: 20.w),
|
||||
width: double.infinity,
|
||||
height: 200.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
color: Colors.white),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
'订单信息'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
20.hb,
|
||||
Text(
|
||||
'订单编号:${widget.orderModel.code}',
|
||||
style: TextStyle(fontSize: 28.sp, color: ktextPrimary),
|
||||
maxLines: 1,
|
||||
),
|
||||
10.hb,
|
||||
Text('创建时间:${widget.orderModel.createDate}',
|
||||
style: TextStyle(fontSize: 28.sp, color: ktextPrimary),
|
||||
maxLines: 1)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_head() {
|
||||
return Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 20.w, right: 16.w, top: 20.w, bottom: 20.w),
|
||||
margin: EdgeInsets.only(left: 20.w,right: 20.w,top: 20.w),
|
||||
width: double.infinity,
|
||||
height: 150.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
color: Colors.white),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
'待付款'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
20.hb,
|
||||
'${DateTime.parse(widget.orderModel.createDate!).add(Duration(minutes: 5)).toString().substring(0, 19)}后订单自动关闭'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(ktextPrimary)
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_headDaifahuo() {
|
||||
return Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 20.w, right: 16.w, top: 20.w, bottom: 20.w),
|
||||
margin: EdgeInsets.only(left: 20.w,right: 20.w,top: 20.w),
|
||||
width: double.infinity,
|
||||
height: 150.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
color: Colors.white),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
'买家已付款'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
20.hb,
|
||||
'等待卖家发货'.text.size(28.sp).color(ktextPrimary).make(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_headDaishouhuo() {
|
||||
return Container(
|
||||
padding:
|
||||
EdgeInsets.only(left: 22.w, right: 22.w, top: 20.w, bottom: 20.w),
|
||||
margin: EdgeInsets.only(left: 20.w,right: 20.w,top: 20.w),
|
||||
width: double.infinity,
|
||||
height: 150.w,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.w)),
|
||||
color: Colors.white),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Image.asset(R.ASSETS_ICONS_ICON_LOGISTICS_PNG,width: 56.w,height: 56.w,),
|
||||
20.wb,
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
'已发货'.text.size(32.sp).color(ktextPrimary).bold.make(),
|
||||
|
||||
'包裹正在等待揽收'.text.size(28.sp).color(ktextPrimary).make(),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
LineButton(
|
||||
onPressed: () async {
|
||||
BaseModel baseModel =
|
||||
await NetUtil().get(API.market.findLogistics, params: {
|
||||
"orderId": widget.orderModel.id,
|
||||
});
|
||||
if (baseModel.status == true && baseModel.data != null) {
|
||||
logisticsModels = (baseModel.data as List)
|
||||
.map((e) => LogisticsModel.fromJson(e))
|
||||
.toList();
|
||||
if(logisticsModels.isNotEmpty){
|
||||
Get.to(()=> LogisticsPage(models: logisticsModels,goods: widget.orderModel.myOrderListVoList!.first,orderModel:widget.orderModel));
|
||||
}else{
|
||||
BotToast.showText(text: '未获取到物流信息');
|
||||
}
|
||||
|
||||
}else{
|
||||
BotToast.showText(text: '未获取到物流信息');
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
text: '查看物流'.text.size(32.sp).color(Color(0xFFE52E2E)).make(),
|
||||
color: Color(0xFFE52E2E),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _goodCard(MyOrderListVoList model) {
|
||||
var top = RichText(
|
||||
text: TextSpan(children: [
|
||||
WidgetSpan(
|
||||
child: _getKindWd(model.kind ?? 0),
|
||||
),
|
||||
TextSpan(
|
||||
text: model.skuName,
|
||||
style: TextStyle(fontSize: 28.sp, color: ktextPrimary)),
|
||||
]),
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
var mid = Container(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.w), color: Color(0xFFF2F3F4)),
|
||||
child: '规格:${model.weight}kg/${model.unit}'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Color(0xFFBBBBBB))
|
||||
.make(),
|
||||
);
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
margin: EdgeInsets.only(bottom: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Stack(
|
||||
children: [
|
||||
Container(
|
||||
width: 188.w,
|
||||
height: 188.w,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(16.w),
|
||||
),
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
image: model.mainPhoto ?? '',
|
||||
height: 188.w,
|
||||
width: 188.w,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
20.wb,
|
||||
Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
child: top,
|
||||
width: (model.payPrice ?? 0) > 9999 ? 300.w : 320.w,
|
||||
alignment: Alignment.topCenter,
|
||||
),
|
||||
|
||||
10.hb,
|
||||
mid,
|
||||
//Spacer(),
|
||||
|
||||
10.hb,
|
||||
],
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Container(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
8.hb,
|
||||
'¥'
|
||||
.richText
|
||||
.withTextSpanChildren([
|
||||
(model.payPrice ?? 0)
|
||||
.toStringAsFixed(2)
|
||||
.textSpan
|
||||
.size(28.sp)
|
||||
.color(ktextPrimary)
|
||||
.make(),
|
||||
])
|
||||
.color(ktextPrimary)
|
||||
.size(28.sp)
|
||||
.make(),
|
||||
'x ${(model.num ?? 0)}'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Color(0xFFBBBBBB))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getKindWd(int kind) {
|
||||
switch (kind) {
|
||||
case 1:
|
||||
return Container(
|
||||
// width: 90.w,
|
||||
// height: 26.w,
|
||||
padding: EdgeInsets.symmetric(horizontal: 6.w, vertical: 2.w),
|
||||
margin: EdgeInsets.only(right: 10.w),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(4.w),
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: [Color(0xFFEC5329), Color(0xFFF58123)])),
|
||||
child: '京东自营'.text.size(18.sp).color(Colors.white).make());
|
||||
case 2:
|
||||
return Container(
|
||||
width: 90.w,
|
||||
height: 26.w,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: [Color(0xFFEC5329), Color(0xFFF58123)])),
|
||||
child: '京东POP'.text.size(18.sp).color(Colors.white).make());
|
||||
default:
|
||||
return SizedBox();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||
import 'package:aku_community/widget/tab_bar/bee_tab_bar.dart';
|
||||
import 'order_view.dart';
|
||||
|
||||
class OrderPage extends StatefulWidget {
|
||||
final int initIndex;
|
||||
OrderPage({Key? key, required this.initIndex}) : super(key: key);
|
||||
|
||||
@override
|
||||
_OrderPageState createState() => _OrderPageState();
|
||||
}
|
||||
|
||||
class _OrderPageState extends State<OrderPage>
|
||||
with TickerProviderStateMixin {
|
||||
late TabController _tabController;
|
||||
List<String> _tabs = [
|
||||
'全部',
|
||||
'待付款',
|
||||
'待发货',
|
||||
'待收货',
|
||||
'已完成'
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_tabController = TabController(
|
||||
length: _tabs.length,
|
||||
vsync: this,
|
||||
initialIndex: widget.initIndex,
|
||||
);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_tabController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
int? _transIndes(int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return null;
|
||||
case 1:
|
||||
return 0;
|
||||
case 2:
|
||||
return 2;
|
||||
case 3:
|
||||
return 4;
|
||||
case 4:
|
||||
return 5;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '我的订单',
|
||||
appBarBottom: PreferredSize(
|
||||
preferredSize: Size.fromHeight(60.w),
|
||||
child: BeeTabBar(
|
||||
scrollable: true, controller: _tabController, tabs: _tabs),
|
||||
),
|
||||
body: TabBarView(
|
||||
controller: _tabController,
|
||||
children: List.generate(
|
||||
_tabs.length,
|
||||
(index) => OrderView(
|
||||
index: _transIndes(index),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
import 'package:aku_community/model/order/order_list_model.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/constants/api.dart';
|
||||
import 'package:aku_community/models/market/order/my_order_list_model.dart';
|
||||
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
|
||||
import 'package:aku_community/ui/market/order/my_order_card.dart';
|
||||
|
||||
import 'order_card.dart';
|
||||
|
||||
class OrderView extends StatefulWidget {
|
||||
final int? index;
|
||||
OrderView({Key? key, required this.index}) : super(key: key);
|
||||
|
||||
@override
|
||||
_OrderViewState createState() => _OrderViewState();
|
||||
}
|
||||
|
||||
class _OrderViewState extends State<OrderView> {
|
||||
late EasyRefreshController _refreshController;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_refreshController = EasyRefreshController();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_refreshController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeListView(
|
||||
path: API.market.myOrder,
|
||||
controller: _refreshController,
|
||||
extraParams: {"tradeStatus": widget.index,'orderCode':null},
|
||||
convert: (models) {
|
||||
return models.tableList!
|
||||
.map((e) => OrderListModel.fromJson(e))
|
||||
.toList();
|
||||
},
|
||||
builder: (items) {
|
||||
return ListView.builder(
|
||||
padding: EdgeInsets.symmetric( horizontal: 20.w),
|
||||
itemBuilder: (context, index) {
|
||||
return Container(
|
||||
color: Colors.transparent,
|
||||
margin: EdgeInsets.only(top:20.w),
|
||||
child: OrderCard(
|
||||
model: items[index],
|
||||
callRefresh: () {
|
||||
_refreshController.callRefresh();
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
// separatorBuilder: (_, __) {
|
||||
// return 24.w.heightBox;
|
||||
// },
|
||||
itemCount: items.length);
|
||||
});
|
||||
}
|
||||
}
|
@ -0,0 +1,218 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:aku_community/base/base_style.dart';
|
||||
import 'package:aku_community/model/user/adress_model.dart';
|
||||
import 'package:aku_community/models/market/order/goods_home_model.dart';
|
||||
import 'package:aku_community/pages/tab_navigator.dart';
|
||||
import 'package:aku_community/utils/network/base_list_model.dart';
|
||||
import 'package:aku_community/utils/network/net_util.dart';
|
||||
import 'package:aku_community/widget/bee_scaffold.dart';
|
||||
import 'package:aku_community/widget/buttons/end_button.dart';
|
||||
import 'package:aku_community/widget/buttons/line_button.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
import 'package:aku_community/constants/api.dart';
|
||||
import 'package:aku_community/model/common/img_model.dart';
|
||||
import 'package:aku_community/model/community/community_topic_model.dart';
|
||||
import 'package:aku_community/pages/things_page/widget/bee_list_view.dart';
|
||||
import 'package:aku_community/ui/community/community_views/topic/topic_detail_page.dart';
|
||||
import 'package:aku_community/utils/headers.dart';
|
||||
import 'package:waterfall_flow/waterfall_flow.dart';
|
||||
|
||||
import '../market_home_goods_card.dart';
|
||||
|
||||
class MarketSuccessPage extends StatefulWidget {
|
||||
final int index;
|
||||
MarketSuccessPage({Key? key, required this.index}) : super(key: key);
|
||||
|
||||
@override
|
||||
_MarketSuccessPageState createState() => _MarketSuccessPageState();
|
||||
}
|
||||
|
||||
class _MarketSuccessPageState extends State<MarketSuccessPage>
|
||||
with AutomaticKeepAliveClientMixin {
|
||||
EasyRefreshController _refreshController = EasyRefreshController();
|
||||
bool _onload = true;
|
||||
List<GoodsHomeModel> _goodsHomeModelList = [];
|
||||
int _pageNum = 1;
|
||||
int _pageCount = 0;
|
||||
int _size = 10;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return BeeScaffold(
|
||||
title: '返回',
|
||||
body:Column(
|
||||
children: [
|
||||
|
||||
EasyRefresh(
|
||||
firstRefresh: true,
|
||||
header: MaterialHeader(),
|
||||
controller: _refreshController,
|
||||
onRefresh: () async {
|
||||
await updateMarketInfo();
|
||||
_onload =false;
|
||||
setState(() {});
|
||||
},
|
||||
child: _onload
|
||||
? SizedBox()
|
||||
: ListView(
|
||||
padding: EdgeInsets.all(20.w),
|
||||
children: [
|
||||
Container(
|
||||
child:Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
|
||||
Text(
|
||||
_getTitle(widget.index),
|
||||
style:TextStyle(fontSize: 32.sp,color: ktextPrimary),
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
50.hb,
|
||||
|
||||
Row(
|
||||
children: [
|
||||
LineButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pushAndRemoveUntil(MaterialPageRoute(builder: (context) =>
|
||||
TabNavigator(index: 1,)), (Route<dynamic> route) => false);
|
||||
},
|
||||
width: 168.w,
|
||||
text: '返回首页'.text.size(32.sp).color(Color(0xFFE52E2E)).make(),
|
||||
color: Color(0xFFE52E2E),
|
||||
),
|
||||
32.wb,
|
||||
EndButton(
|
||||
onPressed: () async {
|
||||
|
||||
},
|
||||
text: '查看详情'
|
||||
.text
|
||||
.size(32.sp)
|
||||
.color(Colors.white)
|
||||
.make()),
|
||||
],
|
||||
)
|
||||
],
|
||||
) ,
|
||||
),
|
||||
_buildSliverGrid(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
_buildSliverGrid() {
|
||||
return WaterfallFlow.builder(
|
||||
gridDelegate: SliverWaterfallFlowDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
mainAxisSpacing: 20.w,
|
||||
crossAxisSpacing: 20.w,
|
||||
),
|
||||
padding: EdgeInsets.all(32.w),
|
||||
itemBuilder: (context, index) {
|
||||
return MarketHomeGoodsCard(item: _goodsHomeModelList[index]);
|
||||
},
|
||||
itemCount: _goodsHomeModelList.length,
|
||||
|
||||
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
// crossAxisCount: 2,
|
||||
// mainAxisSpacing: 20.w,
|
||||
// crossAxisSpacing: 20.w,
|
||||
// childAspectRatio: 0.57,
|
||||
// ),
|
||||
|
||||
// ///子Item构建器
|
||||
// delegate: new SliverChildBuilderDelegate(
|
||||
// (BuildContext context, int index) {
|
||||
// ///每一个子Item的样式
|
||||
// return MarketHomeGoodsCard(item: _goodsHomeModelList[index]);
|
||||
// // return Container(
|
||||
// // width: 200.w,
|
||||
// // height: 200.w,
|
||||
// // color: Colors.blue,
|
||||
// // );
|
||||
// },
|
||||
//
|
||||
// ///子Item的个数
|
||||
// childCount: _goodsHomeModelList.length,
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
Future updateMarketInfo() async {
|
||||
_pageNum =1;
|
||||
BaseListModel baseListModel = await NetUtil().getList(
|
||||
API.market.findRecommendGoodsList,
|
||||
params: {
|
||||
'pageNum': _pageNum,
|
||||
'size': _size,
|
||||
'orderBySalesVolume': null,
|
||||
'orderByPrice': null,
|
||||
},
|
||||
);
|
||||
if (baseListModel.tableList!.isNotEmpty) {
|
||||
_goodsHomeModelList = (baseListModel.tableList as List)
|
||||
.map((e) => GoodsHomeModel.fromJson(e))
|
||||
.toList();
|
||||
}
|
||||
_pageCount = baseListModel.pageCount!;
|
||||
}
|
||||
|
||||
Future loadMarketInfo() async {
|
||||
BaseListModel baseListModel = await NetUtil().getList(
|
||||
API.market.findRecommendGoodsList,
|
||||
params: {
|
||||
'pageNum': _pageNum,
|
||||
'size': _size,
|
||||
'orderBySalesVolume': null,
|
||||
'orderByPrice': null,
|
||||
},
|
||||
);
|
||||
if (baseListModel.tableList!.isNotEmpty) {
|
||||
_goodsHomeModelList.addAll((baseListModel.tableList as List)
|
||||
.map((e) => GoodsHomeModel.fromJson(e))
|
||||
.toList());
|
||||
}
|
||||
_pageCount = baseListModel.pageCount!;
|
||||
}
|
||||
|
||||
_getTitle(int index){
|
||||
switch(index){
|
||||
case 1:
|
||||
return '支付成功';
|
||||
case 2:
|
||||
return '取消成功';
|
||||
case 3:
|
||||
return '收货成功';
|
||||
case 4:
|
||||
return '删除成功';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
}
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
|
||||
class LineButton extends StatelessWidget {
|
||||
final VoidCallback onPressed;
|
||||
final Widget text;
|
||||
final double? width;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
final Color? color;
|
||||
const LineButton(
|
||||
{Key? key,
|
||||
required this.onPressed,
|
||||
required this.text,
|
||||
this.width,
|
||||
this.padding,
|
||||
this.color})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return MaterialButton(
|
||||
elevation: 0,
|
||||
focusElevation: 0,
|
||||
highlightElevation: 0,
|
||||
disabledElevation: 0,
|
||||
disabledTextColor: Colors.white.withOpacity(0.3),
|
||||
minWidth: width ?? 168.w,
|
||||
height: 70.w,
|
||||
padding:
|
||||
padding ?? EdgeInsets.symmetric(horizontal: 20.w, vertical: 0.w),
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(34.w),
|
||||
side: BorderSide(color: color??Color(0xFFBBBBBB),width: 2.w)),
|
||||
onPressed: onPressed,
|
||||
child: text,
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue