hmxc
章文轩 3 years ago
parent e937316f52
commit bd432292fb

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

@ -362,6 +362,10 @@ class R {
static const String ASSETS_ICONS_ICON_GOOD_MY_PNG = static const String ASSETS_ICONS_ICON_GOOD_MY_PNG =
'assets/icons/icon_good_my.png'; 'assets/icons/icon_good_my.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_logistics.png)
static const String ASSETS_ICONS_ICON_LOGISTICS_PNG =
'assets/icons/icon_logistics.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_main_all.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/icon_main_all.png)
static const String ASSETS_ICONS_ICON_MAIN_ALL_PNG = static const String ASSETS_ICONS_ICON_MAIN_ALL_PNG =
'assets/icons/icon_main_all.png'; 'assets/icons/icon_main_all.png';
@ -406,6 +410,10 @@ class R {
static const String ASSETS_ICONS_ICON_MAIN_SUBSCRIBE_PNG = static const String ASSETS_ICONS_ICON_MAIN_SUBSCRIBE_PNG =
'assets/icons/icon_main_subscribe.png'; 'assets/icons/icon_main_subscribe.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_market_success.png)
static const String ASSETS_ICONS_ICON_MARKET_SUCCESS_PNG =
'assets/icons/icon_market_success.png';
/// ![preview](file:///Users/datang/aku_community/assets/icons/icon_more.png) /// ![preview](file:///Users/datang/aku_community/assets/icons/icon_more.png)
static const String ASSETS_ICONS_ICON_MORE_PNG = 'assets/icons/icon_more.png'; static const String ASSETS_ICONS_ICON_MORE_PNG = 'assets/icons/icon_more.png';

@ -536,6 +536,22 @@ class _Market {
///jcook ///jcook
String get shopCarSettlement => '/user/jcookShoppingCat/settlement'; String get shopCarSettlement => '/user/jcookShoppingCat/settlement';
///jcook
String get cancelOrder => '/user/jcookOrder/cancel';
///jcook
String get deleteOrder => '/user/jcookOrder/appDelete';
///jcook
String get findLogistics => '/user/jcookOrder/findLogistics';
///jcook
String get confirmOrder => '/user/jcookOrder/confirm';
} }
class _Upload { class _Upload {

@ -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;
}
}

@ -1,9 +1,13 @@
import 'package:aku_community/ui/market/shop_car/shop_car_func.dart';
class GoodDetailModel { class GoodDetailModel {
int? id; int? id;
List<GoodsDetailImageVos>? goodsDetailImageVos; List<GoodsDetailImageVos>? goodsDetailImageVos;
double? sellPrice; double? sellPrice;
double? discountPrice; double? discountPrice;
String? skuName; String? skuName;
int? status;
int? shopStatus;
int? sellNum; int? sellNum;
int? kind; int? kind;
String? defaultLocation; String? defaultLocation;
@ -11,25 +15,31 @@ class GoodDetailModel {
int? stockStatus; int? stockStatus;
List<GoodsDetailSpecificationVoList>? goodsDetailSpecificationVoList; List<GoodsDetailSpecificationVoList>? goodsDetailSpecificationVoList;
int? isCollection; int? isCollection;
String? unit;
double? weight;
factory GoodDetailModel.fail() => GoodDetailModel(goodsDetailImageVos: [],sellPrice: 0,discountPrice: 0,skuName: '',
sellNum: 0,kind: 0,defaultLocation: '',defaultAddressDetail: '',stockStatus: 0,goodsDetailSpecificationVoList: [],isCollection: 0,unit:'',weight: 0
);
GoodStatus get goodStatus => ShopCarFunc.getGoodsStatus(status??1, shopStatus??1);
GoodDetailModel( GoodDetailModel(
{ {this.id,
this.id,
this.goodsDetailImageVos, this.goodsDetailImageVos,
this.sellPrice, this.sellPrice,
this.discountPrice, this.discountPrice,
this.skuName, this.skuName,
this.status,
this.shopStatus,
this.sellNum, this.sellNum,
this.kind, this.kind,
this.defaultLocation, this.defaultLocation,
this.defaultAddressDetail, this.defaultAddressDetail,
this.stockStatus, this.stockStatus,
this.goodsDetailSpecificationVoList, this.goodsDetailSpecificationVoList,
this.isCollection}); this.isCollection,
this.unit,
factory GoodDetailModel.fail() => GoodDetailModel(id:null,goodsDetailImageVos: [],sellPrice: 0,discountPrice: 0,skuName: '', this.weight});
sellNum: 0,kind: 0,defaultLocation: '',defaultAddressDetail: '',stockStatus: 0,goodsDetailSpecificationVoList: [],isCollection: 0
);
GoodDetailModel.fromJson(Map<String, dynamic> json) { GoodDetailModel.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
@ -38,27 +48,28 @@ class GoodDetailModel {
json['goodsDetailImageVos'].forEach((v) { json['goodsDetailImageVos'].forEach((v) {
goodsDetailImageVos!.add(new GoodsDetailImageVos.fromJson(v)); goodsDetailImageVos!.add(new GoodsDetailImageVos.fromJson(v));
}); });
} else }
goodsDetailImageVos = [];
sellPrice = json['sellPrice']; sellPrice = json['sellPrice'];
discountPrice = json['discountPrice']; discountPrice = json['discountPrice'];
skuName = json['skuName']; skuName = json['skuName'];
status = json['status'];
shopStatus = json['shopStatus'];
sellNum = json['sellNum']; sellNum = json['sellNum'];
kind = json['kind']; kind = json['kind'];
defaultLocation = json['defaultLocation']; defaultLocation = json['defaultLocation'];
defaultAddressDetail = json['defaultAddressDetail']; defaultAddressDetail = json['defaultAddressDetail'];
stockStatus = json['stockStatus']; stockStatus = json['stockStatus'];
if (json['goodsDetailSpecificationVoList'] != null) { if (json['goodsDetailSpecificationVoList'] != null) {
goodsDetailSpecificationVoList = []; goodsDetailSpecificationVoList =
[];
json['goodsDetailSpecificationVoList'].forEach((v) { json['goodsDetailSpecificationVoList'].forEach((v) {
goodsDetailSpecificationVoList!.add(new GoodsDetailSpecificationVoList.fromJson(v)); goodsDetailSpecificationVoList!
.add(new GoodsDetailSpecificationVoList.fromJson(v));
}); });
} else }
goodsDetailSpecificationVoList = [];
isCollection = json['isCollection']; isCollection = json['isCollection'];
unit = json['unit'];
weight = json['weight'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -71,6 +82,8 @@ class GoodDetailModel {
data['sellPrice'] = this.sellPrice; data['sellPrice'] = this.sellPrice;
data['discountPrice'] = this.discountPrice; data['discountPrice'] = this.discountPrice;
data['skuName'] = this.skuName; data['skuName'] = this.skuName;
data['status'] = this.status;
data['shopStatus'] = this.shopStatus;
data['sellNum'] = this.sellNum; data['sellNum'] = this.sellNum;
data['kind'] = this.kind; data['kind'] = this.kind;
data['defaultLocation'] = this.defaultLocation; data['defaultLocation'] = this.defaultLocation;
@ -81,6 +94,8 @@ class GoodDetailModel {
this.goodsDetailSpecificationVoList!.map((v) => v.toJson()).toList(); this.goodsDetailSpecificationVoList!.map((v) => v.toJson()).toList();
} }
data['isCollection'] = this.isCollection; data['isCollection'] = this.isCollection;
data['unit'] = this.unit;
data['weight'] = this.weight;
return data; return data;
} }
} }
@ -122,15 +137,12 @@ class GoodsDetailSpecificationVoList {
GoodsDetailSpecificationVoList.fromJson(Map<String, dynamic> json) { GoodsDetailSpecificationVoList.fromJson(Map<String, dynamic> json) {
groupName = json['groupName']; groupName = json['groupName'];
if (json['attribute'] != null) { if (json['attribute'] != null) {
attribute = []; attribute = [];
json['attribute'].forEach((v) { json['attribute'].forEach((v) {
attribute!.add(new Attribute.fromJson(v)); attribute!.add(new Attribute.fromJson(v));
}); });
} else }
attribute = [];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {

@ -75,6 +75,7 @@ class MyShoppingCartVoList {
int? shopStatus; int? shopStatus;
double? sellPrice; double? sellPrice;
double? discountPrice; double? discountPrice;
int? stockStatus;
String? unit; String? unit;
int? kind; int? kind;
double? weight; double? weight;
@ -91,7 +92,7 @@ class MyShoppingCartVoList {
this.unit, this.unit,
this.kind, this.kind,
this.weight, this.weight,
this.num}); this.num,this.stockStatus});
MyShoppingCartVoList.fromJson(Map<String, dynamic> json) { MyShoppingCartVoList.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
@ -101,6 +102,7 @@ class MyShoppingCartVoList {
shopStatus = json['shopStatus']; shopStatus = json['shopStatus'];
sellPrice = json['sellPrice']; sellPrice = json['sellPrice'];
discountPrice = json['discountPrice']; discountPrice = json['discountPrice'];
stockStatus = json['stockStatus'];
unit = json['unit']; unit = json['unit'];
kind = json['kind']; kind = json['kind'];
weight = json['weight']; weight = json['weight'];
@ -116,6 +118,7 @@ class MyShoppingCartVoList {
data['shopStatus'] = this.shopStatus; data['shopStatus'] = this.shopStatus;
data['sellPrice'] = this.sellPrice; data['sellPrice'] = this.sellPrice;
data['discountPrice'] = this.discountPrice; data['discountPrice'] = this.discountPrice;
data['stockStatus'] = this.stockStatus;
data['unit'] = this.unit; data['unit'] = this.unit;
data['kind'] = this.kind; data['kind'] = this.kind;
data['weight'] = this.weight; data['weight'] = this.weight;

@ -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;
}
}

@ -10,11 +10,13 @@
import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/model/user/adress_model.dart'; import 'package:aku_community/model/user/adress_model.dart';
import 'package:aku_community/pages/personal/user_func.dart'; import 'package:aku_community/pages/personal/user_func.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'address/new_address_page.dart'; import 'address/new_address_page.dart';
@ -36,6 +38,7 @@ this.refreshController, required this.canBack})
class _MyAddressItemState extends State<MyAddressItem> { class _MyAddressItemState extends State<MyAddressItem> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final appProvider = Provider.of<AppProvider>(context);
return GestureDetector( return GestureDetector(
onTap: widget.canBack? (){ onTap: widget.canBack? (){
Get.back(result: widget.addressModel); Get.back(result: widget.addressModel);
@ -59,7 +62,10 @@ class _MyAddressItemState extends State<MyAddressItem> {
onTap: () async{ onTap: () async{
bool? result = await Userfunc.setIsDefaultAddress(widget.addressModel.id!); bool? result = await Userfunc.setIsDefaultAddress(widget.addressModel.id!);
if(result!=null){ if(result!=null){
if(result) widget.refreshController!.callRefresh(); if(result) {
await appProvider.getMyAddress();
widget.refreshController!.callRefresh();
}
} }
}, },
child: Container( child: Container(

@ -7,10 +7,10 @@ import 'package:aku_community/pages/setting_page/settings_page.dart';
import 'package:aku_community/pages/sign/sign_in_page.dart'; import 'package:aku_community/pages/sign/sign_in_page.dart';
import 'package:aku_community/painters/user_bottom_bar_painter.dart'; import 'package:aku_community/painters/user_bottom_bar_painter.dart';
import 'package:aku_community/provider/user_provider.dart'; import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/ui/market/order/order_page.dart';
import 'package:aku_community/ui/profile/car/car_manage_page.dart'; import 'package:aku_community/ui/profile/car/car_manage_page.dart';
import 'package:aku_community/ui/profile/car_parking/car_parking_page.dart'; import 'package:aku_community/ui/profile/car_parking/car_parking_page.dart';
import 'package:aku_community/ui/profile/house/house_owners_page.dart'; import 'package:aku_community/ui/profile/house/house_owners_page.dart';
import 'package:aku_community/ui/profile/order/order_page.dart';
import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/others/user_tool.dart'; import 'package:aku_community/widget/others/user_tool.dart';
import 'package:aku_community/widget/views/application_view.dart'; import 'package:aku_community/widget/views/application_view.dart';
@ -205,57 +205,7 @@ class _PersonalIndexState extends State<PersonalIndex>
Widget build(BuildContext context) { Widget build(BuildContext context) {
final double _statusHeight = MediaQuery.of(context).padding.top; final double _statusHeight = MediaQuery.of(context).padding.top;
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
// var orderWidget = SliverToBoxAdapter(
// child: Container(
// decoration: BoxDecoration(
// color: Color(0xffffffff),
// borderRadius: BorderRadius.all(Radius.circular(8)),
// boxShadow: <BoxShadow>[
// BoxShadow(
// color: Colors.grey.withOpacity(0.1),
// offset: Offset(1, 1),
// ),
// ],
// ),
// margin: EdgeInsets.all(20.w),
// padding: EdgeInsets.all(12.w),
// child:
// Column(
// mainAxisSize: MainAxisSize.min,
// children: [
// _containerBar('我的订单'),
// GridView(
// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 5,
// ),
// shrinkWrap: true,
// children: [
// _orderButton(
// name: '待付款',
// path: R.ASSETS_ICONS_USER_ICON_DFK_PNG,
// index: 1,
// ),
// _orderButton(
// name: '待收货',
// path: R.ASSETS_ICONS_USER_ICON_DSH_PNG,
// index: 2,
// ),
// _orderButton(
// name: '待评价',
// path: R.ASSETS_ICONS_USER_ICON_DPJ_PNG,
// index: 3,
// ),
// _orderButton(
// name: '售后',
// path: R.ASSETS_ICONS_USER_ICON_SH_PNG,
// index: 4,
// ),
// ],
// ),
// ],
// ),
// )
// );
return Scaffold( return Scaffold(
body: EasyRefresh( body: EasyRefresh(
@ -540,7 +490,9 @@ class _PersonalIndexState extends State<PersonalIndex>
Column( Column(
//mainAxisAlignment: MainAxisAlignment.center, //mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
_homeTitle('我的订单', () {}, '查看全部'), _homeTitle('我的订单', () {
Get.to(() => OrderPage(initIndex: 0));
}, '查看全部'),
50.hb, 50.hb,
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -553,17 +505,17 @@ class _PersonalIndexState extends State<PersonalIndex>
index: 1, index: 1,
), ),
_orderButton( _orderButton(
name: '', name: '',
path: R.ASSETS_ICONS_USER_ICON_DSH_PNG, path: R.ASSETS_ICONS_USER_ICON_DSH_PNG,
index: 2, index: 2,
), ),
_orderButton( _orderButton(
name: '评价', name: '收货',
path: R.ASSETS_ICONS_USER_ICON_DPJ_PNG, path: R.ASSETS_ICONS_USER_ICON_DPJ_PNG,
index: 3, index: 3,
), ),
_orderButton( _orderButton(
name: '售后', name: '已完成',
path: R.ASSETS_ICONS_USER_ICON_SH_PNG, path: R.ASSETS_ICONS_USER_ICON_SH_PNG,
index: 4, index: 4,
), ),

@ -11,7 +11,6 @@ import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/provider/user_provider.dart'; import 'package:aku_community/provider/user_provider.dart';
import 'package:aku_community/ui/profile/house/add_house_page.dart'; import 'package:aku_community/ui/profile/house/add_house_page.dart';
import 'package:aku_community/ui/profile/house/house_owners_page.dart'; import 'package:aku_community/ui/profile/house/house_owners_page.dart';
import 'package:aku_community/ui/profile/order/order_page.dart';
import 'package:aku_community/ui/search/bee_search.dart'; import 'package:aku_community/ui/search/bee_search.dart';
import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/utils/login_util.dart'; import 'package:aku_community/utils/login_util.dart';
@ -419,72 +418,10 @@ class _PropertyPageState extends State<PropertyPage>
); );
} }
Widget _orderButton({
required String name,
required String path,
required int index,
}) {
return MaterialButton(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(path, height: 50.w, width: 50.w),
10.hb,
Text(
name,
style: TextStyle(
color: Color(0xFF333333),
fontSize: 22.sp,
),
),
],
),
onPressed: () {
Get.to(() => OrderPage(initIndex: index));
},
);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final double _statusHeight = MediaQuery.of(context).padding.top; final double _statusHeight = MediaQuery.of(context).padding.top;
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
var orderWidget = SliverToBoxAdapter(
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
_containerBar('我的订单'),
GridView(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 5,
),
shrinkWrap: true,
children: [
_orderButton(
name: '待付款',
path: R.ASSETS_ICONS_USER_ICON_DFK_PNG,
index: 1,
),
_orderButton(
name: '待收货',
path: R.ASSETS_ICONS_USER_ICON_DSH_PNG,
index: 2,
),
_orderButton(
name: '待评价',
path: R.ASSETS_ICONS_USER_ICON_DPJ_PNG,
index: 3,
),
_orderButton(
name: '售后',
path: R.ASSETS_ICONS_USER_ICON_SH_PNG,
index: 4,
),
],
),
],
),
);
return Scaffold( return Scaffold(
body: EasyRefresh( body: EasyRefresh(
header: MaterialHeader(), header: MaterialHeader(),

@ -25,8 +25,9 @@ import 'personal/personal_page.dart';
import 'property/property_index.dart'; import 'property/property_index.dart';
class TabNavigator extends StatefulWidget { class TabNavigator extends StatefulWidget {
final int? index;
const TabNavigator({ const TabNavigator({
Key? key, Key? key, this.index,
}) : super(key: key); }) : super(key: key);
@override @override
@ -71,7 +72,7 @@ class _TabNavigatorState extends State<TabNavigator>
PersonalIndex() PersonalIndex()
]; ];
_tabController = TabController(length: _pages.length, vsync: this); _tabController = TabController(length: _pages.length, vsync: this,initialIndex: widget.index??0);
} }

@ -4,6 +4,7 @@ import 'package:aku_community/model/community/board_model.dart';
import 'package:aku_community/model/community/community_topic_model.dart'; import 'package:aku_community/model/community/community_topic_model.dart';
import 'package:aku_community/model/community/hot_news_model.dart'; import 'package:aku_community/model/community/hot_news_model.dart';
import 'package:aku_community/model/community/swiper_model.dart'; import 'package:aku_community/model/community/swiper_model.dart';
import 'package:aku_community/model/good/category_model.dart';
import 'package:aku_community/models/market/goods_classification.dart'; import 'package:aku_community/models/market/goods_classification.dart';
import 'package:aku_community/models/market/goods_popular_model.dart'; import 'package:aku_community/models/market/goods_popular_model.dart';
import 'package:aku_community/models/market/order/goods_home_model.dart'; import 'package:aku_community/models/market/order/goods_home_model.dart';
@ -117,6 +118,21 @@ class CommunityFunc {
} }
///
static Future<List<CategoryModel>> getCategory() async {
BaseModel model = await NetUtil().get(
API.market.findAllCategoryInfo,
);
if (model.data!.length == 0) return [];
else{
return (model.data as List)
.map((e) => CategoryModel.fromJson(e))
.toList();
}
}
static Future<ActivityItemModel?> activity() async { static Future<ActivityItemModel?> activity() async {
BaseListModel model = await NetUtil().getList( BaseListModel model = await NetUtil().getList(

@ -440,6 +440,7 @@ class _ChatCardState extends State<ChatCard> {
: SizedBox(), : SizedBox(),
Spacer(), Spacer(),
_buildMoreButton(), _buildMoreButton(),
20.wb,
], ],
), ),
// _renderLikeAndComment(), // _renderLikeAndComment(),

@ -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;
}

@ -4,12 +4,14 @@ import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/constants/api.dart'; import 'package:aku_community/constants/api.dart';
import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/model/common/img_model.dart';
import 'package:aku_community/model/community/swiper_model.dart'; import 'package:aku_community/model/community/swiper_model.dart';
import 'package:aku_community/model/good/category_model.dart';
import 'package:aku_community/models/market/goods_classification.dart'; import 'package:aku_community/models/market/goods_classification.dart';
import 'package:aku_community/models/market/goods_popular_model.dart'; import 'package:aku_community/models/market/goods_popular_model.dart';
import 'package:aku_community/models/market/order/goods_home_model.dart'; import 'package:aku_community/models/market/order/goods_home_model.dart';
import 'package:aku_community/provider/app_provider.dart'; import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/community/community_func.dart'; import 'package:aku_community/ui/community/community_func.dart';
import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart'; import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart';
import 'package:aku_community/ui/market/search/good_detail_page.dart';
import 'package:aku_community/ui/market/search/search_goods_page.dart'; import 'package:aku_community/ui/market/search/search_goods_page.dart';
import 'package:aku_community/ui/market/shop_car/shop_car_page.dart'; import 'package:aku_community/ui/market/shop_car/shop_car_page.dart';
import 'package:aku_community/ui/market/widget/animated_home_background.dart'; import 'package:aku_community/ui/market/widget/animated_home_background.dart';
@ -18,6 +20,7 @@ import 'package:aku_community/utils/network/base_list_model.dart';
import 'package:aku_community/utils/network/net_util.dart'; import 'package:aku_community/utils/network/net_util.dart';
import 'package:aku_community/widget/home/home_sliver_app_bar.dart'; import 'package:aku_community/widget/home/home_sliver_app_bar.dart';
import 'package:aku_community/widget/others/rectIndicator.dart'; import 'package:aku_community/widget/others/rectIndicator.dart';
import 'package:bot_toast/bot_toast.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';
@ -26,9 +29,12 @@ import 'package:flutter_swiper_null_safety/flutter_swiper_null_safety.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'category/new_category_page.dart';
import 'market_home_goods_card.dart'; import 'market_home_goods_card.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'order/order_page.dart';
class MarketPage extends StatefulWidget { class MarketPage extends StatefulWidget {
MarketPage({Key? key}) : super(key: key); MarketPage({Key? key}) : super(key: key);
@ -58,6 +64,8 @@ class _MarketPageState extends State<MarketPage>
List<SwiperModel> _swiperModels = []; List<SwiperModel> _swiperModels = [];
List<CategoryModel> _categoryModels = [];
OrderType _orderType = OrderType.NORMAL; OrderType _orderType = OrderType.NORMAL;
String priceIcon = R.ASSETS_ICONS_ICON_PRICE_NORMAL_PNG; String priceIcon = R.ASSETS_ICONS_ICON_PRICE_NORMAL_PNG;
@ -173,12 +181,14 @@ class _MarketPageState extends State<MarketPage>
_total = await CommunityFunc.getSkuTotal(); _total = await CommunityFunc.getSkuTotal();
_brandTotal = await CommunityFunc.getSettledBrandsNum(); _brandTotal = await CommunityFunc.getSettledBrandsNum();
_categoryModels = await CommunityFunc.getCategory();
var list = await CommunityFunc.getGoodsClassificationList(0); //0 var list = await CommunityFunc.getGoodsClassificationList(0); //0
_goodsClassificationList.replaceRange(0, list.length, list); _goodsClassificationList.replaceRange(0, list.length, list);
//_goodsPopularModelList = await CommunityFunc.getGoodsPopularModel(6); _goodsPopularModelList = await CommunityFunc.getGoodsPopularModel(6);
setState(() {}); setState(() {});
} }
@ -368,7 +378,7 @@ class _MarketPageState extends State<MarketPage>
padding: EdgeInsets.only(left: 32.w, right: 32.w), padding: EdgeInsets.only(left: 32.w, right: 32.w),
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
//Get.to(() => BeeSearch()); Get.to(() => OrderPage(initIndex: 0,));
}, },
child: Image.asset(R.ASSETS_ICONS_SHOP_ORDER_PNG, child: Image.asset(R.ASSETS_ICONS_SHOP_ORDER_PNG,
height: 40.w, width: 40.w), height: 40.w, width: 40.w),
@ -721,6 +731,9 @@ class _MarketPageState extends State<MarketPage>
_buildAllTile() { _buildAllTile() {
return GestureDetector( return GestureDetector(
onTap: () async{
Get.to(() => NewCategoryPage(models: _categoryModels));
},
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
@ -818,7 +831,13 @@ class _MarketPageState extends State<MarketPage>
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Container( GestureDetector(
onTap:(){
Get.to(
() => GoodDetailPage(goodId: _goodsPopularModelList[index].id!),
);
},
child: Container(
width: 96.w, width: 96.w,
height: 96.w, height: 96.w,
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
@ -833,6 +852,7 @@ class _MarketPageState extends State<MarketPage>
}, },
), ),
), ),
),
], ],
); );
}, },

@ -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,
),
),
],
),
)
),
],
)
);
}
}

@ -54,7 +54,7 @@ class MyOrderFunc {
return (baseModel.data as List) return (baseModel.data as List)
.map((e) => GoodsItem.fromJson(e)) .map((e) => GoodsItem.fromJson(e))
.toList(); .toList();
} }else
return []; return [];
} }

@ -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);
});
}
}

@ -246,12 +246,16 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
}, },
child: Container( child: Container(
color: Colors.white, color: Colors.white,
child: Row( child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
16.wb, 16.wb,
'送至'.text.color(Color(0xFFBBBBBB)).size(28.sp).make(), '送至'.text.color(Color(0xFFBBBBBB)).size(28.sp).make(),
Image.asset(R.ASSETS_ICONS_SHOP_LOCATION_PNG,width: 48.w,height: 48.w,), 20.wb,
Image.asset(R.ASSETS_ICONS_ICON_GOOD_LOCATION_PNG,width: 30.w,height: 30.w,),
Container( Container(
width: 430.w, width: 430.w,
@ -274,9 +278,20 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
16.wb, 16.wb,
], ],
), ),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
120.wb,
_goodDetail!.stockStatus==1?'有货'.text.color(Color(0xFFE52E2E)).size(28.sp).make()
:'无货'.text.color(Color(0xFFE52E2E)).size(28.sp).make(),
],
),
],
),
), ),
), ),
52.hb, 20.hb,
GestureDetector( GestureDetector(
onTap: (){ onTap: (){
showModalBottomSheet( showModalBottomSheet(
@ -517,7 +532,11 @@ class _GoodDetailPageState extends State<GoodDetailPage> {
), ),
GestureDetector( GestureDetector(
onTap: (){ onTap: (){
if(_goodDetail!.stockStatus==0){
BotToast.showText(text: '商品库存不足');
}else{
Get.to(()=>SubmitOrderNormalPage(goodModel: _goodDetail!,)); Get.to(()=>SubmitOrderNormalPage(goodModel: _goodDetail!,));
}
}, },
child: Container( child: Container(
width: 230.w, width: 230.w,

@ -39,7 +39,8 @@ enum OrderType {
} }
class SearchGoodsPage extends StatefulWidget { class SearchGoodsPage extends StatefulWidget {
SearchGoodsPage({Key? key}) : super(key: key); final String? search;
SearchGoodsPage({Key? key, this.search}) : super(key: key);
@override @override
SearchGoodsPageState createState() => SearchGoodsPageState(); SearchGoodsPageState createState() => SearchGoodsPageState();
@ -69,6 +70,11 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if(widget.search!=null){
_startSearch = true;
_searchText = widget.search??'';
_editingController.text = widget.search??'';
}
getSearchListFromSharedPreferences(); getSearchListFromSharedPreferences();
} }
@ -192,22 +198,7 @@ class SearchGoodsPageState extends State<SearchGoodsPage> {
); );
return return
BeeScaffold( BeeScaffold(
// fab: FloatingActionButton(
// backgroundColor: Colors.transparent,
// foregroundColor: Colors.transparent,
// elevation: 0,
// highlightElevation: 0,
// shape: new ,
// onPressed: () {
// },
// child: Column(
// children: [
// Image.asset(R.ASSETS_ICONS_COLLECT_PNG,width: 84.w,height: 84.w,),
// 24.hb,
// Image.asset(R.ASSETS_ICONS_ICON_TOTOP_PNG,width: 84.w,height: 84.w,),
// ],
// ),
// ),
titleSpacing: 0, titleSpacing: 0,
bgColor: Color(0xFFF9F9F9), bgColor: Color(0xFFF9F9F9),
bodyColor: Color(0xFFF9F9F9), bodyColor: Color(0xFFF9F9F9),

@ -8,6 +8,7 @@ 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/life_pay/pay_util.dart';
import 'package:aku_community/pages/personal/address/address_list_page.dart'; import 'package:aku_community/pages/personal/address/address_list_page.dart';
import 'package:aku_community/provider/app_provider.dart'; import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/market/order/order_page.dart';
import 'package:aku_community/ui/market/search/settlementGoodsDTO.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/ui/market/shop_car/shop_car_func.dart';
import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/base_model.dart';
@ -40,6 +41,7 @@ class _SubmitOrderPageState extends State<SubmitOrderPage> {
AddressModel? _addressModel; AddressModel? _addressModel;
CreateOrderModel? _createOrderModel; CreateOrderModel? _createOrderModel;
double _allPrice = 0; double _allPrice = 0;
bool haveStock = true;
@override @override
void initState() { void initState() {
@ -109,7 +111,7 @@ class _SubmitOrderPageState extends State<SubmitOrderPage> {
20.hb, 20.hb,
_address(context), _address(context),
20.hb, 20.hb,
...widget.models.mapIndexed((currentValue, index) => _goodCard(currentValue,index)), ...widget.models.mapIndexed((currentValue, index) => _goodCard(currentValue,index,_createOrderModel)),
20.hb, 20.hb,
_priceView(), _priceView(),
20.hb, 20.hb,
@ -130,6 +132,11 @@ class _SubmitOrderPageState extends State<SubmitOrderPage> {
onPressed: () async { onPressed: () async {
if(_addressModel==null){ if(_addressModel==null){
BotToast.showText(text: '请先选择地址'); BotToast.showText(text: '请先选择地址');
return;
}
if(!haveStock){
BotToast.showText(text: '下单失败,订单内有商品无库存');
return;
} }
Function cancel = BotToast.showLoading(); Function cancel = BotToast.showLoading();
BaseModel baseModel = BaseModel baseModel =
@ -141,9 +148,12 @@ class _SubmitOrderPageState extends State<SubmitOrderPage> {
}); });
if (baseModel.status ?? false) { if (baseModel.status ?? false) {
bool result = await PayUtil() bool result = await PayUtil()
.callAliPay(baseModel.message!, API.pay.sharePayOrderCodeCheck); .callAliPay(baseModel.message!, API.pay.jcookOrderCheckAlipay);
if (result) { if (result) {
Get.off(() => PayFinishPage()); Get.off(() => OrderPage(initIndex: 2));
}else{
///
Get.off(() => OrderPage(initIndex: 1));
} }
} }
cancel(); cancel();
@ -407,7 +417,15 @@ class _SubmitOrderPageState extends State<SubmitOrderPage> {
} }
Widget _goodCard(ShopCarListModel model, int index) { Widget _goodCard(ShopCarListModel model, int index,CreateOrderModel? createOrderModel) {
bool haveGoods = true;
if(createOrderModel!=null){
if(createOrderModel.myShoppingCartVoList![index].stockStatus==0){
haveGoods = false;
haveStock = false;
}
}
var top = RichText( var top = RichText(
text: TextSpan(children: [ text: TextSpan(children: [
WidgetSpan( WidgetSpan(
@ -442,7 +460,13 @@ class _SubmitOrderPageState extends State<SubmitOrderPage> {
.color(Color(0xFF333333)) .color(Color(0xFF333333))
.make(), .make(),
Spacer(), Spacer(),
_getBottomSuffix(model.goodStatus, model.id!, index) haveGoods?
_getBottomSuffix(model.goodStatus, model.id!, index):
'该规格商品无库存'
.text
.size(24.sp)
.color(Color(0xFFF58123))
.make(),
], ],
), ),
48.hb, 48.hb,

@ -9,6 +9,7 @@ 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/life_pay/pay_util.dart';
import 'package:aku_community/pages/personal/address/address_list_page.dart'; import 'package:aku_community/pages/personal/address/address_list_page.dart';
import 'package:aku_community/provider/app_provider.dart'; import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/market/order/order_page.dart';
import 'package:aku_community/ui/market/search/settlementGoodsDTO.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/ui/market/shop_car/shop_car_func.dart';
import 'package:aku_community/utils/network/base_model.dart'; import 'package:aku_community/utils/network/base_model.dart';
@ -126,9 +127,12 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
}); });
if (baseModel.status ?? false) { if (baseModel.status ?? false) {
bool result = await PayUtil().callAliPay( bool result = await PayUtil().callAliPay(
baseModel.message!, API.pay.sharePayOrderCodeCheck); baseModel.message!, API.pay.jcookOrderCheckAlipay);
if (result) { if (result) {
Get.off(() => PayFinishPage()); Get.off(() => OrderPage(initIndex: 2));
}else{
///
Get.off(() => OrderPage(initIndex: 1));
} }
} }
cancel(); cancel();
@ -183,7 +187,7 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
children: [ children: [
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 20.w, vertical: 6.w), horizontal: 20.w, vertical: 4.w),
child: SizedBox( child: SizedBox(
width: 518.w, width: 518.w,
child: Text( child: Text(
@ -197,7 +201,7 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
), ),
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 20.w, vertical: 6.w), horizontal: 20.w, vertical: 4.w),
child: SizedBox( child: SizedBox(
width: 518.w, width: 518.w,
child: Text( child: Text(
@ -211,7 +215,7 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
), ),
Padding( Padding(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: 20.w, vertical: 6.w), horizontal: 20.w, vertical: 4.w),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[ children: <Widget>[
@ -380,7 +384,11 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 10.w), padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 10.w),
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4.w), color: Color(0xFFF2F3F4)), borderRadius: BorderRadius.circular(4.w), color: Color(0xFFF2F3F4)),
child: '规格:'.text.size(24.sp).color(Color(0xFFBBBBBB)).make(), child: '规格:${model.weight}kg/${model.unit}'
.text
.size(24.sp)
.color(Color(0xFFBBBBBB))
.make(),
); );
var bottom = Column( var bottom = Column(
children: [ children: [
@ -461,7 +469,7 @@ class _SubmitOrderNormalPageState extends State<SubmitOrderNormalPage> {
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.w), borderRadius: BorderRadius.circular(16.w),
), ),
child: _getGoodsStatusImg(GoodStatus.unSell) ?? child: _getGoodsStatusImg(model.goodStatus) ??
SizedBox())) SizedBox()))
], ],
), ),

@ -19,7 +19,6 @@ import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
import 'package:aku_community/utils/headers.dart'; import 'package:aku_community/utils/headers.dart';
class ShopCarPage extends StatefulWidget { class ShopCarPage extends StatefulWidget {
const ShopCarPage({Key? key}) : super(key: key); const ShopCarPage({Key? key}) : super(key: key);
@ -33,6 +32,7 @@ class _ShopCarPageState extends State<ShopCarPage> {
List<ShopCarListModel> _models = []; List<ShopCarListModel> _models = [];
List<ShopCarListModel> _chooseModels = []; List<ShopCarListModel> _chooseModels = [];
EasyRefreshController _refreshController = EasyRefreshController(); EasyRefreshController _refreshController = EasyRefreshController();
bool _first = true;
//model //model
List<int> _selectIndex = []; List<int> _selectIndex = [];
@ -51,8 +51,6 @@ class _ShopCarPageState extends State<ShopCarPage> {
return num; return num;
} }
@override @override
void dispose() { void dispose() {
_controllers.forEach((element) { _controllers.forEach((element) {
@ -71,18 +69,11 @@ class _ShopCarPageState extends State<ShopCarPage> {
TextButton( TextButton(
onPressed: () { onPressed: () {
_editStatus = !_editStatus; _editStatus = !_editStatus;
setState(() { setState(() {});
});
}, },
child: (_editStatus ? '完成' : '管理') child:
.text (_editStatus ? '完成' : '管理').text.size(32.sp).black.bold.make())
.size(32.sp)
.black
.bold
.make())
], ],
body: SafeArea( body: SafeArea(
child: Column( child: Column(
children: [ children: [
@ -106,15 +97,26 @@ class _ShopCarPageState extends State<ShopCarPage> {
_models = (base.data as List) _models = (base.data as List)
.map((e) => ShopCarListModel.fromJson(e)) .map((e) => ShopCarListModel.fromJson(e))
.toList(); .toList();
_controllers.forEach((element) { // _controllers.forEach((element) {
element.dispose(); // element.dispose();
}); // });
_controllers.clear(); // _controllers.clear();
if (_first) {
_models.forEach((element) { _models.forEach((element) {
_controllers.add( _controllers.add(TextEditingController(
TextEditingController(text: element.num.toString())); text: element.num.toString()));
});
_first = false;
} else {
if (_models.length > _controllers.length) {
for (int i = _controllers.length - 1;
i < _models.length;
i++) {
_controllers.add(TextEditingController(
text: _models[i].num.toString()));
}
}
} }
);
} }
print(_models.length); print(_models.length);
if (mounted) { if (mounted) {
@ -223,13 +225,14 @@ class _ShopCarPageState extends State<ShopCarPage> {
if (_chooseModels.isEmpty) { if (_chooseModels.isEmpty) {
BotToast.showText(text: '请先选择商品'); BotToast.showText(text: '请先选择商品');
} else } else
Get.to(()=>SubmitOrderPage(models: _chooseModels,)); Get.to(() => SubmitOrderPage(
models: _chooseModels,
));
} }
Future _delete() async { Future _delete() async {
if (_selectIndex.isNotEmpty) { if (_selectIndex.isNotEmpty) {
bool? result = bool? result = await Get.dialog(CupertinoAlertDialog(
await Get.dialog(CupertinoAlertDialog(
title: '您确定要删除该商品吗?'.text.isIntrinsic.size(30.sp).make(), title: '您确定要删除该商品吗?'.text.isIntrinsic.size(30.sp).make(),
actions: [ actions: [
CupertinoDialogAction( CupertinoDialogAction(
@ -237,11 +240,7 @@ class _ShopCarPageState extends State<ShopCarPage> {
onPressed: () => Get.back(), onPressed: () => Get.back(),
), ),
CupertinoDialogAction( CupertinoDialogAction(
child: '确定' child: '确定'.text.color(Colors.orange).isIntrinsic.make(),
.text
.color(Colors.orange)
.isIntrinsic
.make(),
onPressed: () => Get.back(result: true), onPressed: () => Get.back(result: true),
), ),
], ],
@ -261,12 +260,11 @@ class _ShopCarPageState extends State<ShopCarPage> {
_refreshController.callRefresh(); _refreshController.callRefresh();
} }
} }
}; }
;
} else { } else {
BotToast.showText(text: '请先选择商品'); BotToast.showText(text: '请先选择商品');
} }
} }
Widget _goodCard(ShopCarListModel model, int index) { Widget _goodCard(ShopCarListModel model, int index) {
@ -340,7 +338,34 @@ class _ShopCarPageState extends State<ShopCarPage> {
} }
setState(() {}); setState(() {});
}, },
child:
model.goodStatus==GoodStatus.unSell?
Container(
color: Colors.transparent,
height: double.infinity,
child: Container( child: Container(
padding: EdgeInsets.symmetric(horizontal: 16.w),
height: double.infinity,
alignment: Alignment.center,
child:Container(
height: 40.w,
width: 40.w,
decoration: BoxDecoration(
color:Color(0xFFBBBBBB),
borderRadius: BorderRadius.circular(20.w),
),
alignment: Alignment.center,
child: Container(
color: Color(0xFFEEEEEE),
width: 26.w,
height: 8.w,
)
),
),
):
Container(
color: Colors.transparent, color: Colors.transparent,
height: double.infinity, height: double.infinity,
child: Container( child: Container(
@ -390,9 +415,9 @@ class _ShopCarPageState extends State<ShopCarPage> {
width: 220.w, width: 220.w,
), ),
), ),
Positioned(child: _getGoodsStatusImg(GoodStatus.onSell)??SizedBox()) Positioned(
child: _getGoodsStatusImg(model.goodStatus) ?? SizedBox())
], ],
), ),
16.widthBox, 16.widthBox,
Column( Column(
@ -479,6 +504,9 @@ class _ShopCarPageState extends State<ShopCarPage> {
children: [ children: [
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
if(_controllers[index].text.isEmpty){
_controllers[index].text = '1';
}
int num = int.parse(_controllers[index].text); int num = int.parse(_controllers[index].text);
if (num > 1) { if (num > 1) {
var result = await changeNum(id, num - 1); var result = await changeNum(id, num - 1);
@ -504,14 +532,19 @@ class _ShopCarPageState extends State<ShopCarPage> {
color: Color(0xFFF2F2F2), color: Color(0xFFF2F2F2),
borderRadius: BorderRadius.circular(4.w)), borderRadius: BorderRadius.circular(4.w)),
child: TextField( child: TextField(
readOnly: true, //readOnly: true,
inputFormatters: [FilteringTextInputFormatter.digitsOnly], inputFormatters: [FilteringTextInputFormatter.digitsOnly],
onChanged: (text) async { onChanged: (text) async {
var result = await changeNum(id, int.parse(text)); if(text.isNotEmpty){
if(int.parse(text)>10){
_controllers[index].text = '10';
}
var result = await changeNum(id, int.parse(_controllers[index].text));
if (!result) { if (!result) {
// _controllers[index].text= // _controllers[index].text=
} }
}
setState(() {}); setState(() {});
}, },
@ -526,7 +559,11 @@ class _ShopCarPageState extends State<ShopCarPage> {
), ),
GestureDetector( GestureDetector(
onTap: () async { onTap: () async {
if(_controllers[index].text.isEmpty){
_controllers[index].text = '0';
}
int num = int.parse(_controllers[index].text); int num = int.parse(_controllers[index].text);
if (num < 10) { if (num < 10) {
var result = await changeNum( var result = await changeNum(
id, int.parse(_controllers[index].text) + 1); id, int.parse(_controllers[index].text) + 1);
@ -535,9 +572,9 @@ class _ShopCarPageState extends State<ShopCarPage> {
(int.parse(_controllers[index].text) + 1).toString(); (int.parse(_controllers[index].text) + 1).toString();
} }
setState(() {}); setState(() {});
}else{
BotToast.showText(text: '一次最多购买10个商品');
} }
}, },
child: Padding( child: Padding(
padding: EdgeInsets.only(left: 12.w), padding: EdgeInsets.only(left: 12.w),
@ -581,4 +618,42 @@ class _ShopCarPageState extends State<ShopCarPage> {
cancel(); cancel();
return base.status ?? false; return base.status ?? false;
} }
Future _changeNum() async {
if (_selectIndex.isNotEmpty) {
bool? result = await Get.dialog(CupertinoAlertDialog(
title: '您确定要删除该商品吗?'.text.isIntrinsic.size(30.sp).make(),
actions: [
CupertinoDialogAction(
child: '取消'.text.black.isIntrinsic.make(),
onPressed: () => Get.back(),
),
CupertinoDialogAction(
child: '确定'.text.color(Colors.orange).isIntrinsic.make(),
onPressed: () => Get.back(result: true),
),
],
));
if (result == true) {
BaseModel model = await NetUtil().post(
API.market.shopCarDelete,
params: {
'jcookGoodsIds': _selectIndex.map((e) => _models[e].id).toList()
},
showMessage: true,
);
if (model.status != null) {
if (model.status!) {
_selectIndex.clear();
_refreshController.callRefresh();
}
}
}
;
} else {
BotToast.showText(text: '请先选择商品');
}
}
} }

@ -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,
);
}
}

@ -2,7 +2,7 @@ name: aku_community
description: A new Flutter project. description: A new Flutter project.
publish_to: "none" publish_to: "none"
version: 1.8.4-dev+48 version: 1.8.5-dev+48
environment: environment:
sdk: ">=2.12.0 <3.0.0" sdk: ">=2.12.0 <3.0.0"

Loading…
Cancel
Save