From bd432292fbaa3cc8e7481b8e99f95a672a567605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=AB=A0=E6=96=87=E8=BD=A9?= <12812285557@qq.com> Date: Tue, 30 Nov 2021 22:46:28 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=9C=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/icons/icon_logistics.png | Bin 0 -> 6579 bytes assets/icons/icon_market_success.png | Bin 0 -> 5538 bytes lib/const/resource.dart | 8 + lib/constants/api.dart | 16 + lib/model/good/category_model.dart | 80 ++ lib/model/good/good_detail_model.dart | 54 +- lib/model/order/create_order_model.dart | 5 +- lib/model/order/logistics_model.dart | 66 ++ lib/model/order/order_list_model.dart | 126 +++ lib/pages/personal/item_my_address.dart | 8 +- lib/pages/personal/personal_page.dart | 64 +- lib/pages/property/property_page.dart | 63 -- lib/pages/tab_navigator.dart | 5 +- lib/ui/community/community_func.dart | 16 + .../community_views/widgets/chat_card.dart | 1 + lib/ui/market/category/new_category_page.dart | 116 +++ .../category/new_category_sub_card.dart | 63 ++ .../category/new_category_sub_view.dart | 79 ++ lib/ui/market/market_page.dart | 50 +- lib/ui/market/order/logistics_page.dart | 268 +++++++ lib/ui/market/order/my_order_func.dart | 2 +- lib/ui/market/order/order_card.dart | 684 +++++++++++++++++ lib/ui/market/order/order_detail_page.dart | 722 ++++++++++++++++++ lib/ui/market/order/order_page.dart | 80 ++ lib/ui/market/order/order_view.dart | 69 ++ lib/ui/market/search/good_detail_page.dart | 69 +- lib/ui/market/search/search_goods_page.dart | 25 +- lib/ui/market/search/submit_order_page.dart | 34 +- .../search/submit_order_page_normal.dart | 22 +- lib/ui/market/shop_car/shop_car_page.dart | 245 +++--- lib/ui/market/widget/market_success_page.dart | 218 ++++++ lib/widget/buttons/line_button.dart | 38 + pubspec.yaml | 2 +- 33 files changed, 2998 insertions(+), 300 deletions(-) create mode 100644 assets/icons/icon_logistics.png create mode 100644 assets/icons/icon_market_success.png create mode 100644 lib/model/good/category_model.dart create mode 100644 lib/model/order/logistics_model.dart create mode 100644 lib/model/order/order_list_model.dart create mode 100644 lib/ui/market/category/new_category_page.dart create mode 100644 lib/ui/market/category/new_category_sub_card.dart create mode 100644 lib/ui/market/category/new_category_sub_view.dart create mode 100644 lib/ui/market/order/logistics_page.dart create mode 100644 lib/ui/market/order/order_card.dart create mode 100644 lib/ui/market/order/order_detail_page.dart create mode 100644 lib/ui/market/order/order_page.dart create mode 100644 lib/ui/market/order/order_view.dart create mode 100644 lib/ui/market/widget/market_success_page.dart create mode 100644 lib/widget/buttons/line_button.dart diff --git a/assets/icons/icon_logistics.png b/assets/icons/icon_logistics.png new file mode 100644 index 0000000000000000000000000000000000000000..1118cea07e1db0c5c13e7d1278844fc08d89d283 GIT binary patch literal 6579 zcmXw8c{o&m)V~ZfjA86s7)vokQAoBKV~I+Qt(0ProlwaVV}^!NwnC9GLuDwUY?WoI zA^TFc>>~S?b?oo_-uHR`xcB?q=icwlauH+gDE8i%5{p9 z`{+?;=v|QD6xy7?!R5-nNT5{s)q%^)rAL09n-}W!3D+shMKZ1!O{(Qz$rMFcs1y|1 z_7oM`T3fUaP7gg;G6<$&zZXFzmaab-hU%be!yiOGh}>FANjVLiv~@Z>9{K6639h`T zWZ%fA+&^LC)$*BVYy8i{kE`_!UbXjUUa>b=Z1K&iea+wUPG(uKg?H3tKFBF!<7s8< z{Sg~?y;-%7S9hCVk`74i0?fLM)8TGhC3n__i5tE0k)QsW>|SpXIgEZr^DmcpV((@I zNFk0FaS@D1{)$fCY>4$x9(rzX5h7}w%3aFkBFA7q?wtwW+O9w{M3%#UaF6PHSUJp2 zeu=GH^SUwQ{#K#nYnW!q$j=!kkGS&ZnF55^aQL@pp zJThu~eWJVL2F!$3{nb-E^8uI5GzTuS zJmDy56$p!To%$*yPG(zIt6Y_Z0@mQL-|J1Uuusjn30EY@f`t3s*SWSZ=id1xPQ1+T z%tlQTd2W{rLn_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!P`}s$c&;H+R!uNk?6D$TVg|TtiuYnW|&R@REn!*4U Mrk6~LF}SGz0a&;#IsgCw literal 0 HcmV?d00001 diff --git a/assets/icons/icon_market_success.png b/assets/icons/icon_market_success.png new file mode 100644 index 0000000000000000000000000000000000000000..ab97e1944b12f4a440b35d1d45076202125ec42b GIT binary patch literal 5538 zcmWkyc{r5c7k|evV;PNYY+)u#)-08^GGmY>$y&-bwk#3KzD!<>kfNwW7@<&hm2bq* zSjxWd6C$$I*mr*O`{UmG+~sr6IrsUTbMCzfW~K(5?858-0B{-^>RB*azyB9j7^7~P z+PK1KAonc{@IYyo$R7Ye*%|5SScQzO*x&Kv8-9MhK(4{=s1th}6?(0E0Wx!n7R@So zih>b~qx1NJDF8^h$b38X4AWA6x zURO@D7NRY9&!}s3ul@|Q18bVg0w<7V{@Sy{8Zpy@r4B?C)yrMEx^Febak{R1Sj(5> zWq%|3W9j|eTfw}JOGQZv>q)K0T}o>&<3_z$;7_zeO;@TPw*nZ-YUE!glFcC zvSpe2kcLYGm|;Hvm_rNZ3u`fdacQhvJLfEZfHxJ_xPL?&XiP{0i%1v}YF zr8cIT2`MOJ#xw`OKq@XLnKm)__d}l|QNeW-2B{OE)JCtf$kph(B>Qu2jV;_A|Jr7H zk_j+(g`YrVUqvKDa-*Pwz}h`dD~m!Rr`01t3;4?_@s{R%vxLZNZe&|#WRoN0K?4)? z&yid;G*_&s zPx&@mtv+3RQy5Tzetx8oFMIxtEmVph&xtrEo0cee3#yxf&pkeOSK>uMVmevD`L!Hy zK?wGY&$wR(!bLnf0YUE0H`cyhTJPR`eHld)xXcpLBxY;oc{RCj(obv)? znC|1notKBVM%cY?#l1@ei{#QgC0@k)FvC=8G^|N-fjuQoWWIFLx*w1-C$gB{erfUb zQjzd~ANK!HeGM{~-GMp?!0iO&ajNMF8QRoXB0k2enB`_twauiQJvaxP$Zzn2o5?5@ z@sMhy>lo`*c^!zPf~y{)6ifrpM$K7tuwdqE;7s>x&UuVeeUoMAVYlp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LtN>qKLah z=IdZw!s*H>_-V{@8rzxQU2Bj2TckL5YAXCry~!bOF)yU_A=o-@STl1cuG~mSp_{*ja&8QD cVX}|m;OJ_*!GfGJ '/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 { diff --git a/lib/model/good/category_model.dart b/lib/model/good/category_model.dart new file mode 100644 index 00000000..bd18d2a1 --- /dev/null +++ b/lib/model/good/category_model.dart @@ -0,0 +1,80 @@ +class CategoryModel { + int? id; + String? name; + List? categoryList; + + CategoryModel({this.id, this.name, this.categoryList}); + + CategoryModel.fromJson(Map json) { + id = json['id']; + name = json['name']; + if (json['categoryList'] != null) { + categoryList = []; + json['categoryList'].forEach((v) { + categoryList!.add(new CategoryList.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + 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; + + CategoryList({this.id, this.name, this.categoryListSecond}); + + CategoryList.fromJson(Map json) { + id = json['id']; + name = json['name']; + if (json['categoryList'] != null) { + categoryListSecond = []; + json['categoryList'].forEach((v) { + categoryListSecond!.add(new CategoryListSecond.fromJson(v)); + }); + } + } + + Map toJson() { + final Map data = new Map(); + 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 json) { + id = json['id']; + name = json['name']; + + } + + Map toJson() { + final Map data = new Map(); + data['id'] = this.id; + data['name'] = this.name; + + return data; + } +} \ No newline at end of file diff --git a/lib/model/good/good_detail_model.dart b/lib/model/good/good_detail_model.dart index 75d2ff12..596ebd0d 100644 --- a/lib/model/good/good_detail_model.dart +++ b/lib/model/good/good_detail_model.dart @@ -1,9 +1,13 @@ +import 'package:aku_community/ui/market/shop_car/shop_car_func.dart'; + class GoodDetailModel { int? id; List? goodsDetailImageVos; double? sellPrice; double? discountPrice; String? skuName; + int? status; + int? shopStatus; int? sellNum; int? kind; String? defaultLocation; @@ -11,54 +15,61 @@ class GoodDetailModel { int? stockStatus; List? goodsDetailSpecificationVoList; 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( - { - this.id, + {this.id, this.goodsDetailImageVos, this.sellPrice, this.discountPrice, this.skuName, + this.status, + this.shopStatus, this.sellNum, this.kind, this.defaultLocation, this.defaultAddressDetail, this.stockStatus, this.goodsDetailSpecificationVoList, - this.isCollection}); - - factory GoodDetailModel.fail() => GoodDetailModel(id:null,goodsDetailImageVos: [],sellPrice: 0,discountPrice: 0,skuName: '', - sellNum: 0,kind: 0,defaultLocation: '',defaultAddressDetail: '',stockStatus: 0,goodsDetailSpecificationVoList: [],isCollection: 0 - ); + this.isCollection, + this.unit, + this.weight}); GoodDetailModel.fromJson(Map json) { id = json['id']; if (json['goodsDetailImageVos'] != null) { - goodsDetailImageVos = []; + goodsDetailImageVos =[]; json['goodsDetailImageVos'].forEach((v) { goodsDetailImageVos!.add(new GoodsDetailImageVos.fromJson(v)); }); - } else - goodsDetailImageVos = []; - + } sellPrice = json['sellPrice']; discountPrice = json['discountPrice']; skuName = json['skuName']; + status = json['status']; + shopStatus = json['shopStatus']; sellNum = json['sellNum']; kind = json['kind']; defaultLocation = json['defaultLocation']; defaultAddressDetail = json['defaultAddressDetail']; stockStatus = json['stockStatus']; - if (json['goodsDetailSpecificationVoList'] != null) { - goodsDetailSpecificationVoList = []; + goodsDetailSpecificationVoList = + []; json['goodsDetailSpecificationVoList'].forEach((v) { - goodsDetailSpecificationVoList!.add(new GoodsDetailSpecificationVoList.fromJson(v)); + goodsDetailSpecificationVoList! + .add(new GoodsDetailSpecificationVoList.fromJson(v)); }); - } else - goodsDetailSpecificationVoList = []; - + } isCollection = json['isCollection']; + unit = json['unit']; + weight = json['weight']; } Map toJson() { @@ -71,6 +82,8 @@ class GoodDetailModel { data['sellPrice'] = this.sellPrice; data['discountPrice'] = this.discountPrice; data['skuName'] = this.skuName; + data['status'] = this.status; + data['shopStatus'] = this.shopStatus; data['sellNum'] = this.sellNum; data['kind'] = this.kind; data['defaultLocation'] = this.defaultLocation; @@ -81,6 +94,8 @@ class GoodDetailModel { this.goodsDetailSpecificationVoList!.map((v) => v.toJson()).toList(); } data['isCollection'] = this.isCollection; + data['unit'] = this.unit; + data['weight'] = this.weight; return data; } } @@ -122,15 +137,12 @@ class GoodsDetailSpecificationVoList { GoodsDetailSpecificationVoList.fromJson(Map json) { groupName = json['groupName']; - if (json['attribute'] != null) { attribute = []; json['attribute'].forEach((v) { attribute!.add(new Attribute.fromJson(v)); }); - } else - attribute = []; - + } } Map toJson() { diff --git a/lib/model/order/create_order_model.dart b/lib/model/order/create_order_model.dart index e4124be4..f39c1c41 100644 --- a/lib/model/order/create_order_model.dart +++ b/lib/model/order/create_order_model.dart @@ -75,6 +75,7 @@ class MyShoppingCartVoList { int? shopStatus; double? sellPrice; double? discountPrice; + int? stockStatus; String? unit; int? kind; double? weight; @@ -91,7 +92,7 @@ class MyShoppingCartVoList { this.unit, this.kind, this.weight, - this.num}); + this.num,this.stockStatus}); MyShoppingCartVoList.fromJson(Map json) { id = json['id']; @@ -101,6 +102,7 @@ class MyShoppingCartVoList { shopStatus = json['shopStatus']; sellPrice = json['sellPrice']; discountPrice = json['discountPrice']; + stockStatus = json['stockStatus']; unit = json['unit']; kind = json['kind']; weight = json['weight']; @@ -116,6 +118,7 @@ class MyShoppingCartVoList { data['shopStatus'] = this.shopStatus; data['sellPrice'] = this.sellPrice; data['discountPrice'] = this.discountPrice; + data['stockStatus'] = this.stockStatus; data['unit'] = this.unit; data['kind'] = this.kind; data['weight'] = this.weight; diff --git a/lib/model/order/logistics_model.dart b/lib/model/order/logistics_model.dart new file mode 100644 index 00000000..bc56a84e --- /dev/null +++ b/lib/model/order/logistics_model.dart @@ -0,0 +1,66 @@ +class LogisticsModel { + String? logisticsName; + String? waybillCode; + List? operatorNodeList; + + LogisticsModel({this.logisticsName, this.waybillCode, this.operatorNodeList}); + + LogisticsModel.fromJson(Map 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 toJson() { + final Map data = new Map(); + 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 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 toJson() { + final Map data = new Map(); + 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; + } +} \ No newline at end of file diff --git a/lib/model/order/order_list_model.dart b/lib/model/order/order_list_model.dart new file mode 100644 index 00000000..71f1bfa4 --- /dev/null +++ b/lib/model/order/order_list_model.dart @@ -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; + + 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 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 toJson() { + final Map data = new Map(); + 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 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 toJson() { + final Map data = new Map(); + 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; + } +} \ No newline at end of file diff --git a/lib/pages/personal/item_my_address.dart b/lib/pages/personal/item_my_address.dart index 456248d9..3375c484 100644 --- a/lib/pages/personal/item_my_address.dart +++ b/lib/pages/personal/item_my_address.dart @@ -10,11 +10,13 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/model/user/adress_model.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/material.dart'; import 'package:aku_community/utils/headers.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:get/get.dart'; +import 'package:provider/provider.dart'; import 'address/new_address_page.dart'; @@ -36,6 +38,7 @@ this.refreshController, required this.canBack}) class _MyAddressItemState extends State { @override Widget build(BuildContext context) { + final appProvider = Provider.of(context); return GestureDetector( onTap: widget.canBack? (){ Get.back(result: widget.addressModel); @@ -59,7 +62,10 @@ class _MyAddressItemState extends State { onTap: () async{ bool? result = await Userfunc.setIsDefaultAddress(widget.addressModel.id!); if(result!=null){ - if(result) widget.refreshController!.callRefresh(); + if(result) { + await appProvider.getMyAddress(); + widget.refreshController!.callRefresh(); + } } }, child: Container( diff --git a/lib/pages/personal/personal_page.dart b/lib/pages/personal/personal_page.dart index 73f7673c..7848b710 100644 --- a/lib/pages/personal/personal_page.dart +++ b/lib/pages/personal/personal_page.dart @@ -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/painters/user_bottom_bar_painter.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_parking/car_parking_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/widget/others/user_tool.dart'; import 'package:aku_community/widget/views/application_view.dart'; @@ -205,57 +205,7 @@ class _PersonalIndexState extends State Widget build(BuildContext context) { final double _statusHeight = MediaQuery.of(context).padding.top; final userProvider = Provider.of(context); - // var orderWidget = SliverToBoxAdapter( - // child: Container( - // decoration: BoxDecoration( - // color: Color(0xffffffff), - // borderRadius: BorderRadius.all(Radius.circular(8)), - // 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( body: EasyRefresh( @@ -540,7 +490,9 @@ class _PersonalIndexState extends State Column( //mainAxisAlignment: MainAxisAlignment.center, children: [ - _homeTitle('我的订单', () {}, '查看全部'), + _homeTitle('我的订单', () { + Get.to(() => OrderPage(initIndex: 0)); + }, '查看全部'), 50.hb, Row( mainAxisAlignment: MainAxisAlignment.center, @@ -553,17 +505,17 @@ class _PersonalIndexState extends State index: 1, ), _orderButton( - name: '待收货', + name: '待发货', path: R.ASSETS_ICONS_USER_ICON_DSH_PNG, index: 2, ), _orderButton( - name: '待评价', + name: '待收货', path: R.ASSETS_ICONS_USER_ICON_DPJ_PNG, index: 3, ), _orderButton( - name: '售后', + name: '已完成', path: R.ASSETS_ICONS_USER_ICON_SH_PNG, index: 4, ), diff --git a/lib/pages/property/property_page.dart b/lib/pages/property/property_page.dart index 329f56ed..8f71234f 100644 --- a/lib/pages/property/property_page.dart +++ b/lib/pages/property/property_page.dart @@ -11,7 +11,6 @@ import 'package:aku_community/provider/app_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/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/utils/headers.dart'; import 'package:aku_community/utils/login_util.dart'; @@ -419,72 +418,10 @@ class _PropertyPageState extends State ); } - 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 Widget build(BuildContext context) { final double _statusHeight = MediaQuery.of(context).padding.top; final userProvider = Provider.of(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( body: EasyRefresh( header: MaterialHeader(), diff --git a/lib/pages/tab_navigator.dart b/lib/pages/tab_navigator.dart index 62886ff1..b19fea72 100644 --- a/lib/pages/tab_navigator.dart +++ b/lib/pages/tab_navigator.dart @@ -25,8 +25,9 @@ import 'personal/personal_page.dart'; import 'property/property_index.dart'; class TabNavigator extends StatefulWidget { + final int? index; const TabNavigator({ - Key? key, + Key? key, this.index, }) : super(key: key); @override @@ -71,7 +72,7 @@ class _TabNavigatorState extends State PersonalIndex() ]; - _tabController = TabController(length: _pages.length, vsync: this); + _tabController = TabController(length: _pages.length, vsync: this,initialIndex: widget.index??0); } diff --git a/lib/ui/community/community_func.dart b/lib/ui/community/community_func.dart index 01b0edbd..28f0cfe8 100644 --- a/lib/ui/community/community_func.dart +++ b/lib/ui/community/community_func.dart @@ -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/hot_news_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_popular_model.dart'; import 'package:aku_community/models/market/order/goods_home_model.dart'; @@ -117,6 +118,21 @@ class CommunityFunc { } + ///获取所有商品的分类 + static Future> 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 activity() async { BaseListModel model = await NetUtil().getList( diff --git a/lib/ui/community/community_views/widgets/chat_card.dart b/lib/ui/community/community_views/widgets/chat_card.dart index 1ad4a469..63eb30ca 100644 --- a/lib/ui/community/community_views/widgets/chat_card.dart +++ b/lib/ui/community/community_views/widgets/chat_card.dart @@ -440,6 +440,7 @@ class _ChatCardState extends State { : SizedBox(), Spacer(), _buildMoreButton(), + 20.wb, ], ), // _renderLikeAndComment(), diff --git a/lib/ui/market/category/new_category_page.dart b/lib/ui/market/category/new_category_page.dart new file mode 100644 index 00000000..d3e72519 --- /dev/null +++ b/lib/ui/market/category/new_category_page.dart @@ -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 models; + NewCategoryPage({Key? key, required this.models}) : super(key: key); + + @override + _NewCategoryPageState createState() => _NewCategoryPageState(); +} + +class _NewCategoryPageState extends State + 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(), + ], + ), + ); + } +} diff --git a/lib/ui/market/category/new_category_sub_card.dart b/lib/ui/market/category/new_category_sub_card.dart new file mode 100644 index 00000000..4af7255e --- /dev/null +++ b/lib/ui/market/category/new_category_sub_card.dart @@ -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, + // ), + // ); + }, + ); + } +} diff --git a/lib/ui/market/category/new_category_sub_view.dart b/lib/ui/market/category/new_category_sub_view.dart new file mode 100644 index 00000000..169ea0b1 --- /dev/null +++ b/lib/ui/market/category/new_category_sub_view.dart @@ -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 + 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; +} diff --git a/lib/ui/market/market_page.dart b/lib/ui/market/market_page.dart index c502072d..2f4bdec2 100644 --- a/lib/ui/market/market_page.dart +++ b/lib/ui/market/market_page.dart @@ -4,12 +4,14 @@ import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/constants/api.dart'; import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/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_popular_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/ui/community/community_func.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/shop_car/shop_car_page.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/widget/home/home_sliver_app_bar.dart'; import 'package:aku_community/widget/others/rectIndicator.dart'; +import 'package:bot_toast/bot_toast.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.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:provider/provider.dart'; +import 'category/new_category_page.dart'; import 'market_home_goods_card.dart'; import 'package:velocity_x/velocity_x.dart'; +import 'order/order_page.dart'; + class MarketPage extends StatefulWidget { MarketPage({Key? key}) : super(key: key); @@ -58,6 +64,8 @@ class _MarketPageState extends State List _swiperModels = []; + List _categoryModels = []; + OrderType _orderType = OrderType.NORMAL; String priceIcon = R.ASSETS_ICONS_ICON_PRICE_NORMAL_PNG; @@ -173,12 +181,14 @@ class _MarketPageState extends State _total = await CommunityFunc.getSkuTotal(); _brandTotal = await CommunityFunc.getSettledBrandsNum(); + _categoryModels = await CommunityFunc.getCategory(); + var list = await CommunityFunc.getGoodsClassificationList(0); //0获取根目录下的分类 _goodsClassificationList.replaceRange(0, list.length, list); - //_goodsPopularModelList = await CommunityFunc.getGoodsPopularModel(6); + _goodsPopularModelList = await CommunityFunc.getGoodsPopularModel(6); setState(() {}); } @@ -368,7 +378,7 @@ class _MarketPageState extends State padding: EdgeInsets.only(left: 32.w, right: 32.w), child: GestureDetector( onTap: () { - //Get.to(() => BeeSearch()); 订单 + Get.to(() => OrderPage(initIndex: 0,)); }, child: Image.asset(R.ASSETS_ICONS_SHOP_ORDER_PNG, height: 40.w, width: 40.w), @@ -721,6 +731,9 @@ class _MarketPageState extends State _buildAllTile() { return GestureDetector( + onTap: () async{ + Get.to(() => NewCategoryPage(models: _categoryModels)); + }, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -818,19 +831,26 @@ class _MarketPageState extends State return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ - Container( - width: 96.w, - height: 96.w, - child: FadeInImage.assetNetwork( - placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, - image: _goodsPopularModelList[index].mainPhoto ?? '', - imageErrorBuilder: (context, error, stackTrace) { - return Image.asset( - R.ASSETS_IMAGES_PLACEHOLDER_WEBP, - height: 96.w, - width: 96.w, - ); - }, + GestureDetector( + onTap:(){ + Get.to( + () => GoodDetailPage(goodId: _goodsPopularModelList[index].id!), + ); + }, + child: Container( + width: 96.w, + height: 96.w, + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + image: _goodsPopularModelList[index].mainPhoto ?? '', + imageErrorBuilder: (context, error, stackTrace) { + return Image.asset( + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + height: 96.w, + width: 96.w, + ); + }, + ), ), ), ], diff --git a/lib/ui/market/order/logistics_page.dart b/lib/ui/market/order/logistics_page.dart new file mode 100644 index 00000000..b6d2a6f0 --- /dev/null +++ b/lib/ui/market/order/logistics_page.dart @@ -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 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 { + List 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: [ + 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, + ), + ), + ], + ), + ) + + + ), + + ], + ) + ); + + + } + + +} diff --git a/lib/ui/market/order/my_order_func.dart b/lib/ui/market/order/my_order_func.dart index 302c2038..cb47bff4 100644 --- a/lib/ui/market/order/my_order_func.dart +++ b/lib/ui/market/order/my_order_func.dart @@ -54,7 +54,7 @@ class MyOrderFunc { return (baseModel.data as List) .map((e) => GoodsItem.fromJson(e)) .toList(); - } + }else return []; } diff --git a/lib/ui/market/order/order_card.dart b/lib/ui/market/order/order_card.dart new file mode 100644 index 00000000..d8098b2c --- /dev/null +++ b/lib/ui/market/order/order_card.dart @@ -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 { + List _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(), + ], + ), + ], + ); + } +} diff --git a/lib/ui/market/order/order_detail_page.dart b/lib/ui/market/order/order_detail_page.dart new file mode 100644 index 00000000..c721942b --- /dev/null +++ b/lib/ui/market/order/order_detail_page.dart @@ -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 { + List _goodsList = []; + + late Timer? timer; + List 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: [ + 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(); + } + } +} diff --git a/lib/ui/market/order/order_page.dart b/lib/ui/market/order/order_page.dart new file mode 100644 index 00000000..24218a36 --- /dev/null +++ b/lib/ui/market/order/order_page.dart @@ -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 + with TickerProviderStateMixin { + late TabController _tabController; + List _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), + ), + ), + ), + ); + } +} diff --git a/lib/ui/market/order/order_view.dart b/lib/ui/market/order/order_view.dart new file mode 100644 index 00000000..352759ad --- /dev/null +++ b/lib/ui/market/order/order_view.dart @@ -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 { + 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); + }); + } +} diff --git a/lib/ui/market/search/good_detail_page.dart b/lib/ui/market/search/good_detail_page.dart index 02e3e085..931e900e 100644 --- a/lib/ui/market/search/good_detail_page.dart +++ b/lib/ui/market/search/good_detail_page.dart @@ -246,37 +246,52 @@ class _GoodDetailPageState extends State { }, child: Container( color: Colors.white, - child: Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - 16.wb, - '送至'.text.color(Color(0xFFBBBBBB)).size(28.sp).make(), - Image.asset(R.ASSETS_ICONS_SHOP_LOCATION_PNG,width: 48.w,height: 48.w,), - - Container( - width: 430.w, - child: Text( - _addressModel==null?'请先选择地址':(_addressModel!.locationName??'') - +(_addressModel!.addressDetail??''), - style: TextStyle(fontSize: 24.sp,color: ktextPrimary), - maxLines: 1, - overflow: TextOverflow.ellipsis, - ), - ), + child: Column( - Spacer(), - Icon( - CupertinoIcons.chevron_forward, - size: 32.w, - color: Color(0xFF999999), + children: [ + Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + 16.wb, + '送至'.text.color(Color(0xFFBBBBBB)).size(28.sp).make(), + 20.wb, + Image.asset(R.ASSETS_ICONS_ICON_GOOD_LOCATION_PNG,width: 30.w,height: 30.w,), + + Container( + width: 430.w, + child: Text( + _addressModel==null?'请先选择地址':(_addressModel!.locationName??'') + +(_addressModel!.addressDetail??''), + style: TextStyle(fontSize: 24.sp,color: ktextPrimary), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ), + + Spacer(), + Icon( + CupertinoIcons.chevron_forward, + size: 32.w, + color: Color(0xFF999999), + ), + + 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(), + ], ), - - 16.wb, ], ), ), ), - 52.hb, + 20.hb, + GestureDetector( onTap: (){ showModalBottomSheet( @@ -517,7 +532,11 @@ class _GoodDetailPageState extends State { ), GestureDetector( onTap: (){ + if(_goodDetail!.stockStatus==0){ + BotToast.showText(text: '商品库存不足'); + }else{ Get.to(()=>SubmitOrderNormalPage(goodModel: _goodDetail!,)); + } }, child: Container( width: 230.w, diff --git a/lib/ui/market/search/search_goods_page.dart b/lib/ui/market/search/search_goods_page.dart index d802a02f..8f756961 100644 --- a/lib/ui/market/search/search_goods_page.dart +++ b/lib/ui/market/search/search_goods_page.dart @@ -39,7 +39,8 @@ enum OrderType { } class SearchGoodsPage extends StatefulWidget { - SearchGoodsPage({Key? key}) : super(key: key); + final String? search; + SearchGoodsPage({Key? key, this.search}) : super(key: key); @override SearchGoodsPageState createState() => SearchGoodsPageState(); @@ -69,6 +70,11 @@ class SearchGoodsPageState extends State { @override void initState() { super.initState(); + if(widget.search!=null){ + _startSearch = true; + _searchText = widget.search??''; + _editingController.text = widget.search??''; + } getSearchListFromSharedPreferences(); } @@ -192,22 +198,7 @@ class SearchGoodsPageState extends State { ); return 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, bgColor: Color(0xFFF9F9F9), bodyColor: Color(0xFFF9F9F9), diff --git a/lib/ui/market/search/submit_order_page.dart b/lib/ui/market/search/submit_order_page.dart index 7b143984..58ee053d 100644 --- a/lib/ui/market/search/submit_order_page.dart +++ b/lib/ui/market/search/submit_order_page.dart @@ -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/personal/address/address_list_page.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/shop_car/shop_car_func.dart'; import 'package:aku_community/utils/network/base_model.dart'; @@ -40,6 +41,7 @@ class _SubmitOrderPageState extends State { AddressModel? _addressModel; CreateOrderModel? _createOrderModel; double _allPrice = 0; + bool haveStock = true; @override void initState() { @@ -109,7 +111,7 @@ class _SubmitOrderPageState extends State { 20.hb, _address(context), 20.hb, - ...widget.models.mapIndexed((currentValue, index) => _goodCard(currentValue,index)), + ...widget.models.mapIndexed((currentValue, index) => _goodCard(currentValue,index,_createOrderModel)), 20.hb, _priceView(), 20.hb, @@ -130,6 +132,11 @@ class _SubmitOrderPageState extends State { onPressed: () async { if(_addressModel==null){ BotToast.showText(text: '请先选择地址'); + return; + } + if(!haveStock){ + BotToast.showText(text: '下单失败,订单内有商品无库存'); + return; } Function cancel = BotToast.showLoading(); BaseModel baseModel = @@ -141,9 +148,12 @@ class _SubmitOrderPageState extends State { }); if (baseModel.status ?? false) { bool result = await PayUtil() - .callAliPay(baseModel.message!, API.pay.sharePayOrderCodeCheck); + .callAliPay(baseModel.message!, API.pay.jcookOrderCheckAlipay); if (result) { - Get.off(() => PayFinishPage()); + Get.off(() => OrderPage(initIndex: 2)); + }else{ + ///跳到待付款页面 + Get.off(() => OrderPage(initIndex: 1)); } } cancel(); @@ -407,7 +417,15 @@ class _SubmitOrderPageState extends State { } - 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( text: TextSpan(children: [ WidgetSpan( @@ -442,7 +460,13 @@ class _SubmitOrderPageState extends State { .color(Color(0xFF333333)) .make(), Spacer(), - _getBottomSuffix(model.goodStatus, model.id!, index) + haveGoods? + _getBottomSuffix(model.goodStatus, model.id!, index): + '该规格商品无库存' + .text + .size(24.sp) + .color(Color(0xFFF58123)) + .make(), ], ), 48.hb, diff --git a/lib/ui/market/search/submit_order_page_normal.dart b/lib/ui/market/search/submit_order_page_normal.dart index 29e7e51b..9d035383 100644 --- a/lib/ui/market/search/submit_order_page_normal.dart +++ b/lib/ui/market/search/submit_order_page_normal.dart @@ -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/personal/address/address_list_page.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/shop_car/shop_car_func.dart'; import 'package:aku_community/utils/network/base_model.dart'; @@ -126,9 +127,12 @@ class _SubmitOrderNormalPageState extends State { }); if (baseModel.status ?? false) { bool result = await PayUtil().callAliPay( - baseModel.message!, API.pay.sharePayOrderCodeCheck); + baseModel.message!, API.pay.jcookOrderCheckAlipay); if (result) { - Get.off(() => PayFinishPage()); + Get.off(() => OrderPage(initIndex: 2)); + }else{ + ///跳到待付款页面 + Get.off(() => OrderPage(initIndex: 1)); } } cancel(); @@ -183,7 +187,7 @@ class _SubmitOrderNormalPageState extends State { children: [ Padding( padding: EdgeInsets.symmetric( - horizontal: 20.w, vertical: 6.w), + horizontal: 20.w, vertical: 4.w), child: SizedBox( width: 518.w, child: Text( @@ -197,7 +201,7 @@ class _SubmitOrderNormalPageState extends State { ), Padding( padding: EdgeInsets.symmetric( - horizontal: 20.w, vertical: 6.w), + horizontal: 20.w, vertical: 4.w), child: SizedBox( width: 518.w, child: Text( @@ -211,7 +215,7 @@ class _SubmitOrderNormalPageState extends State { ), Padding( padding: EdgeInsets.symmetric( - horizontal: 20.w, vertical: 6.w), + horizontal: 20.w, vertical: 4.w), child: Row( crossAxisAlignment: CrossAxisAlignment.end, children: [ @@ -380,7 +384,11 @@ class _SubmitOrderNormalPageState extends State { padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 10.w), decoration: BoxDecoration( 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( children: [ @@ -461,7 +469,7 @@ class _SubmitOrderNormalPageState extends State { decoration: BoxDecoration( borderRadius: BorderRadius.circular(16.w), ), - child: _getGoodsStatusImg(GoodStatus.unSell) ?? + child: _getGoodsStatusImg(model.goodStatus) ?? SizedBox())) ], ), diff --git a/lib/ui/market/shop_car/shop_car_page.dart b/lib/ui/market/shop_car/shop_car_page.dart index 86d14fc0..16a035e6 100644 --- a/lib/ui/market/shop_car/shop_car_page.dart +++ b/lib/ui/market/shop_car/shop_car_page.dart @@ -19,7 +19,6 @@ import 'package:get/get.dart'; import 'package:velocity_x/velocity_x.dart'; import 'package:aku_community/utils/headers.dart'; - class ShopCarPage extends StatefulWidget { const ShopCarPage({Key? key}) : super(key: key); @@ -32,7 +31,8 @@ class _ShopCarPageState extends State { List _controllers = []; List _models = []; List _chooseModels = []; - EasyRefreshController _refreshController=EasyRefreshController(); + EasyRefreshController _refreshController = EasyRefreshController(); + bool _first = true; //选中的model下表 List _selectIndex = []; @@ -42,17 +42,15 @@ class _ShopCarPageState extends State { double get total { var num = 0.0; - if(_selectIndex.isEmpty) return 0.0; + if (_selectIndex.isEmpty) return 0.0; _selectIndex.forEach((element) { - double sellPrice = _models[element].sellPrice??0; - int number = _models[element].num??0; - num += (sellPrice * number) ; + double sellPrice = _models[element].sellPrice ?? 0; + int number = _models[element].num ?? 0; + num += (sellPrice * number); }); return num; } - - @override void dispose() { _controllers.forEach((element) { @@ -66,23 +64,16 @@ class _ShopCarPageState extends State { Widget build(BuildContext context) { return BeeScaffold( title: '购物车'.text.size(32.sp).black.bold.make(), - titleSpacing: 0, + titleSpacing: 0, actions: [ TextButton( onPressed: () { _editStatus = !_editStatus; - setState(() { - - }); + setState(() {}); }, - child: (_editStatus ? '完成' : '管理') - .text - .size(32.sp) - .black - .bold - .make()) + child: + (_editStatus ? '完成' : '管理').text.size(32.sp).black.bold.make()) ], - body: SafeArea( child: Column( children: [ @@ -106,15 +97,26 @@ class _ShopCarPageState extends State { _models = (base.data as List) .map((e) => ShopCarListModel.fromJson(e)) .toList(); - _controllers.forEach((element) { - element.dispose(); - }); - _controllers.clear(); - _models.forEach((element) { - _controllers.add( - TextEditingController(text: element.num.toString())); + // _controllers.forEach((element) { + // element.dispose(); + // }); + // _controllers.clear(); + if (_first) { + _models.forEach((element) { + _controllers.add(TextEditingController( + 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); if (mounted) { @@ -206,7 +208,7 @@ class _ShopCarPageState extends State { ), 20.widthBox, EndButton( - onPressed: _editStatus ? _delete: _settleEnd, + onPressed: _editStatus ? _delete : _settleEnd, text: (_editStatus ? '删除' : '结算') .text .size(32.sp) @@ -220,60 +222,56 @@ class _ShopCarPageState extends State { } Future _settleEnd() async { - if(_chooseModels.isEmpty){ + if (_chooseModels.isEmpty) { BotToast.showText(text: '请先选择商品'); - }else - Get.to(()=>SubmitOrderPage(models: _chooseModels,)); + } else + Get.to(() => SubmitOrderPage( + models: _chooseModels, + )); } Future _delete() 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 (_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: '请先选择商品'); + 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: '请先选择商品'); + } } Widget _goodCard(ShopCarListModel model, int index) { var top = RichText( text: TextSpan(children: [ WidgetSpan( - child: _getKindWd(model.kind??0), + child: _getKindWd(model.kind ?? 0), ), TextSpan( text: model.skuName, @@ -292,13 +290,13 @@ class _ShopCarPageState extends State { .color(Color(0xFFBBBBBB)) .make(), ); - double sellPrice = model.sellPrice??0; + double sellPrice = model.sellPrice ?? 0; var bottom = Row( children: [ '¥' .richText .withTextSpanChildren([ - sellPrice + sellPrice .toInt() .toString() .textSpan @@ -321,7 +319,7 @@ class _ShopCarPageState extends State { return Container( alignment: Alignment.center, height: 260.w, - margin: EdgeInsets.only(left: 20.w,right: 20.w,bottom: 20.w), + margin: EdgeInsets.only(left: 20.w, right: 20.w, bottom: 20.w), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(16.w), @@ -340,7 +338,34 @@ class _ShopCarPageState extends State { } setState(() {}); }, - child: Container( + child: + model.goodStatus==GoodStatus.unSell? + Container( + color: Colors.transparent, + height: double.infinity, + 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, height: double.infinity, child: Container( @@ -385,14 +410,14 @@ class _ShopCarPageState extends State { ), child: FadeInImage.assetNetwork( placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, - image: model.mainPhoto??'', + image: model.mainPhoto ?? '', height: 220.w, width: 220.w, ), ), - Positioned(child: _getGoodsStatusImg(GoodStatus.onSell)??SizedBox()) + Positioned( + child: _getGoodsStatusImg(model.goodStatus) ?? SizedBox()) ], - ), 16.widthBox, Column( @@ -479,8 +504,11 @@ class _ShopCarPageState extends State { children: [ GestureDetector( onTap: () async { + if(_controllers[index].text.isEmpty){ + _controllers[index].text = '1'; + } int num = int.parse(_controllers[index].text); - if(num>1){ + if (num > 1) { var result = await changeNum(id, num - 1); if (result) { _controllers[index].text = (num - 1).toString(); @@ -504,13 +532,18 @@ class _ShopCarPageState extends State { color: Color(0xFFF2F2F2), borderRadius: BorderRadius.circular(4.w)), child: TextField( - readOnly: true, + //readOnly: true, inputFormatters: [FilteringTextInputFormatter.digitsOnly], onChanged: (text) async { - var result = await changeNum(id, int.parse(text)); - if (!result) { - // _controllers[index].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) { + // _controllers[index].text= + } } setState(() {}); @@ -526,8 +559,12 @@ class _ShopCarPageState extends State { ), GestureDetector( onTap: () async { + if(_controllers[index].text.isEmpty){ + _controllers[index].text = '0'; + } int num = int.parse(_controllers[index].text); - if(num<10){ + + if (num < 10) { var result = await changeNum( id, int.parse(_controllers[index].text) + 1); if (result) { @@ -535,9 +572,9 @@ class _ShopCarPageState extends State { (int.parse(_controllers[index].text) + 1).toString(); } setState(() {}); + }else{ + BotToast.showText(text: '一次最多购买10个商品'); } - - }, child: Padding( padding: EdgeInsets.only(left: 12.w), @@ -581,4 +618,42 @@ class _ShopCarPageState extends State { cancel(); 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: '请先选择商品'); + } + } } diff --git a/lib/ui/market/widget/market_success_page.dart b/lib/ui/market/widget/market_success_page.dart new file mode 100644 index 00000000..1f7c246b --- /dev/null +++ b/lib/ui/market/widget/market_success_page.dart @@ -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 + with AutomaticKeepAliveClientMixin { + EasyRefreshController _refreshController = EasyRefreshController(); + bool _onload = true; + List _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 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; +} diff --git a/lib/widget/buttons/line_button.dart b/lib/widget/buttons/line_button.dart new file mode 100644 index 00000000..9996e429 --- /dev/null +++ b/lib/widget/buttons/line_button.dart @@ -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, + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index ac79709d..9d3cd1dd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: aku_community description: A new Flutter project. publish_to: "none" -version: 1.8.4-dev+48 +version: 1.8.5-dev+48 environment: sdk: ">=2.12.0 <3.0.0"