Browse Source

订单列表返回状态更改;

核销页面优化
wr_2023_business
wurong 1 year ago
parent
commit
76f61e2525
  1. 46
      lib/business_system/order/order_list.dart
  2. 104
      lib/business_system/order/order_write_off.dart

46
lib/business_system/order/order_list.dart

@ -43,7 +43,6 @@ class _OrderList extends State<OrderList> {
List<AdminOrderDtoList> adminOrderDTOList = [];
int _pageIndex = 1;
bool _shimmer = true;
int index = 0;
@override
void dispose() {
@ -84,7 +83,7 @@ class _OrderList extends State<OrderList> {
await businessService.findAdminOrderList({
"orderCode": "",
"keywordType": 1,
"keyword": widget?.keyword ?? queryId ?? "",
"keyword": widget.keyword == "" ? (queryId ?? "") : widget.keyword,
"orderStatus": "",
"startTime": widget.time
.replaceAll("", "-")
@ -97,7 +96,7 @@ class _OrderList extends State<OrderList> {
.replaceAll("", "")
.substring(widget.time.length >= 21 ? 22 : 0,
widget.time.length >= 21 ? 41 : 0),
"pageIndex": _pageIndex,
"pageIndex": (widget.keyword != "" || queryId != null) ? 1 : _pageIndex,
"pageSize": 10,
"refundStatus": widget.status == 3 ? "1" : "",
"payStatus": widget.status == 1 ? "0" : (widget.status == 2 ? "1" : ""),
@ -111,21 +110,20 @@ class _OrderList extends State<OrderList> {
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
if (queryId == null){
if (queryId == null) {
adminOrderDTOList.addAll(baseData?.data?.adminOrderDTOList ?? []);
if ((baseData?.data?.adminOrderDTOList ?? []).isEmpty ||
adminOrderDTOList.length == baseData.data.total)
_refreshController.loadNoData();
else
_refreshController.loadComplete();
} else if (adminOrderDTOList != null)
for (int i = 0; i < adminOrderDTOList.length; i++) {
if (adminOrderDTOList[i].orderCode == queryId) {
adminOrderDTOList[i] = baseData?.data?.adminOrderDTOList?.first;
break;
}
else
adminOrderDTOList.forEach((element) {
if (element.id == queryId) {
adminOrderDTOList[index] = element;
return;
}
});
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
@ -272,13 +270,8 @@ class _OrderList extends State<OrderList> {
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
index = position;
},
child: orderGoodsList(
adminOrderDtoList.orderProductList[position]),
);
return orderGoodsList(
adminOrderDtoList.orderProductList[position]);
},
),
),
@ -342,8 +335,10 @@ class _OrderList extends State<OrderList> {
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
if (adminOrderDtoList.ticketStatus != null && adminOrderDtoList.refundStatus == 0)
GestureDetector(behavior: HitTestBehavior.opaque,
if (adminOrderDtoList.ticketStatus != null &&
adminOrderDtoList.refundStatus == 0)
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context)
.pushNamed('/router/order_write_off', arguments: {
@ -352,12 +347,7 @@ class _OrderList extends State<OrderList> {
"userName": adminOrderDtoList?.name ?? "",
"ticketStatus": adminOrderDtoList?.ticketStatus,
}).then((value) async {
// if (value == 1) {
// _pageIndex = 1;
// adminOrderDTOList.clear();
// _onRefresh(isShowLoad: false);
queryOrderList(queryId: adminOrderDtoList.id);
// }
queryOrderList(queryId: adminOrderDtoList.orderCode);
});
},
child: Container(
@ -394,10 +384,8 @@ class _OrderList extends State<OrderList> {
"storeId": widget.storeId ?? "",
}).then((value) {
if (value == 1) {
// _pageIndex = 1;
// adminOrderDTOList.clear();
// _onRefresh(isShowLoad: false);
queryOrderList(queryId: adminOrderDtoList.id);
queryOrderList(
queryId: adminOrderDtoList.orderCode);
}
});
},

104
lib/business_system/order/order_write_off.dart

@ -33,7 +33,6 @@ class _OrderWriteOff extends State<OrderWriteOff> {
List<business.Tickets> tickets;
TicketDetails ticketDetails;
business.AdminOrderDtoList adminOrderDTOList;
int nameIndex = 0;
BusinessApiService businessService;
@override
@ -50,7 +49,8 @@ class _OrderWriteOff extends State<OrderWriteOff> {
severalWiped(ticketWipedBatch) async {
try {
EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
if (businessService == null) {
businessService = BusinessApiService(Dio(),
context: context,
@ -62,7 +62,7 @@ class _OrderWriteOff extends State<OrderWriteOff> {
.wipedBatchs(jsonEncode(ticketWipedBatch).replaceAll("\\\"", "\""))
.catchError((error) {});
if (baseData != null && baseData.isSuccess) {
Navigator.of(context).pop(1);
Navigator.of(context).pop();
SmartDialog.showToast("核销成功", alignment: Alignment.center);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
@ -110,11 +110,13 @@ class _OrderWriteOff extends State<OrderWriteOff> {
writeOffInfo(),
GestureDetector(
onTap: () {
if (tickets != null ? (widget.arguments["ticketStatus"] == false) : (ticketDetails.state == 9)) {
if (tickets != null
? (widget.arguments["ticketStatus"] == false)
: (ticketDetails.state == 9)) {
return;
} else {
List<dynamic> ticketWipedBatch = [];
if(widget.arguments["tickets"] != null){
if (widget.arguments["tickets"] != null) {
tickets.forEach((element) {
List<dynamic> skuTickets = [];
element.ticketItemList.forEach((ele) {
@ -140,7 +142,7 @@ class _OrderWriteOff extends State<OrderWriteOff> {
});
}
});
}else{
} else {
List<dynamic> skuTickets = [];
ticketDetails.ticketItemList.forEach((element) {
if (element.isSelect) {
@ -177,14 +179,22 @@ class _OrderWriteOff extends State<OrderWriteOff> {
child: Container(
width: double.infinity,
alignment: Alignment.center,
margin: EdgeInsets.only(bottom: 55.h, top: (tickets != null ? tickets.length : ticketDetails.ticketItemList.length) <= 2 ? 125.h : 0),
margin: EdgeInsets.only(
bottom: 55.h,
top: (tickets != null
? tickets.length
: ticketDetails.ticketItemList.length) <=
1
? 125.h
: 10.h),
padding: EdgeInsets.symmetric(vertical: 16.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(27),
color: (tickets != null ? (widget.arguments["ticketStatus"] == true) : (ticketDetails.state != 9))
color: (tickets != null
? (widget.arguments["ticketStatus"] == true)
: (ticketDetails.state != 9))
? Color(0xFF30415B)
:
Color(0xFFABACAB)),
: Color(0xFFABACAB)),
child: Text(
"确认核销",
style: TextStyle(
@ -243,8 +253,13 @@ class _OrderWriteOff extends State<OrderWriteOff> {
SizedBox(
height: 12.h,
),
basicInfoItem("用户名称::", widget?.arguments["userName"] ?? ticketDetails?.userName ?? "" ),
basicInfoItem("订单编号::", widget?.arguments["orderCode"] ?? (ticketDetails.code.replaceAll("T","")) ?? ""),
basicInfoItem("用户名称::",
widget?.arguments["userName"] ?? ticketDetails?.userName ?? ""),
basicInfoItem(
"订单编号::",
widget?.arguments["orderCode"] ??
(ticketDetails.code.replaceAll("T", "")) ??
""),
],
),
);
@ -322,19 +337,16 @@ class _OrderWriteOff extends State<OrderWriteOff> {
),
ListView.builder(
padding: EdgeInsets.zero,
itemCount: tickets != null ?(tickets?.length ?? 0):(ticketDetails?.ticketItemList?.length ?? 0),
itemCount: tickets != null
? (tickets?.length ?? 0)
: (ticketDetails?.ticketItemList?.length ?? 0),
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
onTap: () {
setState(() {
nameIndex = position;
});
},
child: tickets != null ? writeOffInfoItem(tickets[position]):scanCodeInfoItem(ticketDetails.ticketItemList[position]),
);
return tickets != null
? writeOffInfoItem(tickets[position])
: scanCodeInfoItem(ticketDetails.ticketItemList[position]);
},
)
// ListView.builder(
@ -435,7 +447,7 @@ class _OrderWriteOff extends State<OrderWriteOff> {
}
///
Widget scanCodeInfoItem(TicketItemList ticketItemList){
Widget scanCodeInfoItem(TicketItemList ticketItemList) {
return Container(
width: double.infinity,
child: Column(
@ -444,28 +456,38 @@ class _OrderWriteOff extends State<OrderWriteOff> {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Text(
Expanded(
child: Text(
ticketItemList?.name ?? "",
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 14.sp,
color: ticketItemList.state == 1?Color(0xFF0D0D0D):Color(0xFFABACAB),
color: ticketItemList.state == 1
? Color(0xFF0D0D0D)
: Color(0xFFABACAB),
),
)),
Expanded(child: Column(
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Padding(padding: EdgeInsets.only(right:10.w),
Padding(
padding: EdgeInsets.only(right: 10.w),
child: Text(
(ticketItemList.state == 1)?"待核销":"已核销",
(ticketItemList.state == 1) ? "待核销" : "已核销",
style: TextStyle(
fontWeight: MyFontWeight.semi_bold,
fontSize: 12.sp,
color: (ticketItemList.state == 1)?Color(0xFF30415B):Color(0xFFACACAC),
color: (ticketItemList.state == 1)
? Color(0xFF30415B)
: Color(0xFFACACAC),
),
),
),
),),
SizedBox(height:25.h,),
if(ticketItemList.state == 1)
SizedBox(
height: 25.h,
),
if (ticketItemList.state == 1)
Checkbox(
value: ticketItemList.isSelect,
onChanged: (a) {
@ -477,17 +499,17 @@ class _OrderWriteOff extends State<OrderWriteOff> {
borderRadius: BorderRadius.circular(2.0),
),
checkColor: Color(0xFFFFFFFF),
fillColor:MaterialStateProperty.all(Color(0xFF30415B)),
fillColor: MaterialStateProperty.all(Color(0xFF30415B)),
),
],
))
],
),
if(ticketItemList.state != 1)
if (ticketItemList.state != 1)
Align(
alignment: Alignment.centerRight,
child:Container(
margin: EdgeInsets.only(right:10.w),
child: Container(
margin: EdgeInsets.only(right: 10.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(
@ -502,10 +524,10 @@ class _OrderWriteOff extends State<OrderWriteOff> {
Icons.check,
color: Color(0xFFCFCFCF),
size: 14.w,
)
),),
)),
),
Container(
margin: EdgeInsets.only(bottom:11.h,top: 13.h),
margin: EdgeInsets.only(bottom: 11.h, top: 13.h),
width: double.infinity,
height: 1.h,
color: Color(0xFFEBECEF),
@ -528,10 +550,12 @@ class _OrderWriteOff extends State<OrderWriteOff> {
style: TextStyle(
fontWeight: MyFontWeight.regular,
fontSize: 12.sp,
color: Color(0xFF0D0D0D),
color: ticketItemList.state == 1
? Color(0xFF0D0D0D)
: Color(0xFFABACAB),
),
)),
(tickets[nameIndex].state == 7 || tickets[nameIndex].state == 8)
(ticketItemList.state == 7 || ticketItemList.state == 8)
? (ticketItemList.state != 9
? Container(
margin: EdgeInsets.symmetric(vertical: 20.h),

Loading…
Cancel
Save