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