Browse Source

开票历史页面ui绘制与交互,接口数据对接;

抬头信息页面ui绘制与交互,接口数据对接;
填写发票信息页面ui绘制与交互,接口数据对接;
我的页面新增发票助手;
订单列表因app订单原因,不单独显示开票选项;
开票管理接口数据对接,交互流程调试;
开票流程交互调试更改;
wr_2024_invoice
wurong 6 months ago
parent
commit
e23f632674
  1. BIN
      assets/image/2x/disenable_seletor_tow.webp
  2. BIN
      assets/image/2x/invoice_history.webp
  3. BIN
      assets/image/2x/invoice_title.webp
  4. BIN
      assets/image/2x/tip_info.webp
  5. BIN
      assets/image/2x/title_del.webp
  6. BIN
      assets/image/2x/title_info_edit.webp
  7. BIN
      assets/image/3x/disenable_seletor_tow.webp
  8. BIN
      assets/image/3x/invoice_history.webp
  9. BIN
      assets/image/3x/invoice_title.webp
  10. BIN
      assets/image/3x/tip_info.webp
  11. BIN
      assets/image/3x/title_del.webp
  12. BIN
      assets/image/3x/title_info_edit.webp
  13. BIN
      assets/image/disenable_seletor_tow.webp
  14. BIN
      assets/image/invoice_history.webp
  15. BIN
      assets/image/invoice_title.webp
  16. BIN
      assets/image/tip_info.webp
  17. BIN
      assets/image/title_del.webp
  18. BIN
      assets/image/title_info_edit.webp
  19. 2
      lib/home/home_page.dart
  20. 17
      lib/main.dart
  21. 12
      lib/mine/mine_view/mine_item.dart
  22. 899
      lib/order/invoices_manage/add_invoices_title.dart
  23. 594
      lib/order/invoices_manage/edit_invoices_info.dart
  24. 454
      lib/order/invoices_manage/invoices_history.dart
  25. 679
      lib/order/invoices_manage/invoices_manage_page.dart
  26. 571
      lib/order/invoices_manage/invoices_title_info.dart
  27. 2
      lib/order/order_history_page.dart
  28. 1212
      lib/retrofit/data/invoice_list.dart
  29. 385
      lib/retrofit/data/invoices_history_list.dart
  30. 286
      lib/retrofit/data/title_info_list.dart
  31. 32
      lib/retrofit/retrofit_api.dart
  32. 160
      lib/retrofit/retrofit_api.g.dart
  33. 28
      lib/utils/status_utils.dart

BIN
assets/image/2x/disenable_seletor_tow.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 320 B

BIN
assets/image/2x/invoice_history.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

After

Width:  |  Height:  |  Size: 486 B

BIN
assets/image/2x/invoice_title.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

After

Width:  |  Height:  |  Size: 388 B

BIN
assets/image/2x/tip_info.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 434 B

BIN
assets/image/2x/title_del.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B

BIN
assets/image/2x/title_info_edit.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 202 B

BIN
assets/image/3x/disenable_seletor_tow.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 478 B

BIN
assets/image/3x/invoice_history.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 636 B

BIN
assets/image/3x/invoice_title.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

After

Width:  |  Height:  |  Size: 450 B

BIN
assets/image/3x/tip_info.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

BIN
assets/image/3x/title_del.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

BIN
assets/image/3x/title_info_edit.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 250 B

BIN
assets/image/disenable_seletor_tow.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 196 B

BIN
assets/image/invoice_history.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

After

Width:  |  Height:  |  Size: 256 B

BIN
assets/image/invoice_title.webp

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 260 B

BIN
assets/image/tip_info.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

BIN
assets/image/title_del.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

BIN
assets/image/title_info_edit.webp

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 B

2
lib/home/home_page.dart

@ -582,7 +582,7 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
),
autoplay: true,
duration: 1000,
autoplayDelay: 2000,
autoplayDelay: 100000,
physics: BouncingScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(

17
lib/main.dart

@ -169,6 +169,12 @@ import 'mine/personal_page.dart';
import 'order/exchange_write_off_page.dart';
import 'mine/release_page.dart';
import 'mine/roll_center_page.dart';
import 'order/invoices_manage/add_invoices_title.dart';
import 'order/invoices_manage/edit_invoices_info.dart';
import 'order/invoices_manage/invoices_history.dart';
import 'order/invoices_manage/invoices_manage_page.dart';
import 'order/invoices_manage/invoices_title_info.dart';
void main() async {
if (Platform.isAndroid) {
@ -577,4 +583,15 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
ServicePurchaseRecord(arguments:arguments),
'/router/set_goods_specs_value': (context, {arguments}) =>
SetGoodsSpecsValue(arguments:arguments),
'/router/invoices_manage_page': (context, {arguments}) =>
InvoicesManagePage(),
'/router/invoices_title_info': (context, {arguments}) =>
InvoicesTitleInfo(arguments:arguments),
'/router/add_invoices_title': (context, {arguments}) =>
AddInvoicesTitle(arguments:arguments),
'/router/invoices_history': (context, {arguments}) =>
InvoicesHistory(),
'/router/edit_invoices_info': (context, {arguments}) =>
EditInvoicesInfo(arguments:arguments),
};

12
lib/mine/mine_view/mine_item.dart

@ -351,9 +351,17 @@ class _MineItem extends State<MineItem> {
),
),
///
///
Expanded(
child: Container(),
child: InkWell(
onTap: () {
Navigator.of(context).pushNamed('/router/invoices_manage_page');
},
child: mineItem(
S.of(context).fapiaozhushou,
"assets/image/bill_gl.webp",
),
),
),
Expanded(
child: Container(),

899
lib/order/invoices_manage/add_invoices_title.dart

@ -3,130 +3,849 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:intl/intl.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../retrofit/data/title_info_list.dart';
import '../../generated/l10n.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/retrofit_api.dart';
import '../../utils/flutter_utils.dart';
import '../../utils/font_weight.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/border_text.dart';
import '../../view_widget/my_appbar.dart';
import '../../view_widget/my_footer.dart';
import '../../view_widget/no_data_view.dart';
class InvoicesManagePage extends StatefulWidget {
class AddInvoicesTitle extends StatefulWidget {
final Map<String, dynamic> arguments;
AddInvoicesTitle({this.arguments});
@override
State<StatefulWidget> createState() {
return _InvoicesManagePage();
return _AddInvoicesTitle();
}
}
class _InvoicesManagePage extends State<InvoicesManagePage> {
class _AddInvoicesTitle extends State<AddInvoicesTitle> {
bool isKeyBoardShow = false;
FocusNode _focusNode = FocusNode();
final TextEditingController editNameController = TextEditingController();
final TextEditingController editDutyCodeController = TextEditingController();
final TextEditingController editAddressController = TextEditingController();
final TextEditingController editPhoneController = TextEditingController();
final TextEditingController editBankController = TextEditingController();
final TextEditingController editAccountController = TextEditingController();
int titleType;
ApiService apiService;
String userId;
String titleName;
Records records;
@override
void initState() {
super.initState();
// _onRefresh();
titleName = widget?.arguments["titleName"] ??"";
records = widget.arguments["records"];
titleType = ((widget.arguments["titleType"] == 1) ? 1 : 0) ?? 0;
WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {
print("object: ${MediaQuery.of(context).viewInsets.bottom}");
if (MediaQuery.of(context).viewInsets.bottom == 0) {
if (isKeyBoardShow) {
isKeyBoardShow = false;
//
FocusScope.of(context).requestFocus(FocusNode());
}
} else {
isKeyBoardShow = true;
}
});
});
}
///
@override
void dispose() {
_focusNode.unfocus();
super.dispose();
}
///
addInvoiceHeaders() async {
try {
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
userId = value.getString('userId');
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData baseData = await apiService.invoiceHeader({
"bank": editBankController.text == "" ? (records?.bank??"") : editBankController.text, //
"bankNumber": editAccountController.text == "" ? (records?.bankNumber??"") : editAccountController.text, //
"companyAddr":editAddressController.text == "" ? (records?.companyAddr??"") : editAddressController.text, //
"companyPhone":editPhoneController.text == "" ? (records?.companyPhone??"") : editPhoneController.text, //
"id": "", //id
"isDefault": 1, //
"isDelete": 0, //
"name": editNameController.text == "" ? (records?.name??"") : editNameController.text, //
"taxId": editDutyCodeController.text == "" ? (records?.taxId??"") : editDutyCodeController.text, //
"type": titleType == 0 ? "PERSONAL" : "COMPANY", //
"userId": userId, //ID
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
});
if (baseData != null && baseData.isSuccess) {
Navigator.of(context).pop();
Future.delayed(Duration(milliseconds: 500), () {
SmartDialog.showToast("添加抬头信息成功", alignment: Alignment.center);
});
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} finally {
EasyLoading.dismiss();
}
}
///
editInvoiceHeaders() async {
try {
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
userId = value.getString('userId');
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData baseData = await apiService.invoiceHeaders({
"bank": editBankController.text == "" ? (records?.bank??"") : editBankController.text, //
"bankNumber": editAccountController.text == "" ? (records?.bankNumber??"") : editAccountController.text, //
"companyAddr":editAddressController.text == "" ? (records?.companyAddr??"") : editAddressController.text, //
"companyPhone":editPhoneController.text == "" ? (records?.companyPhone??"") : editPhoneController.text, //
"id": records?.id ?? "", //id
"isDefault": 1, //
"isDelete": 0, //
"name": editNameController.text == "" ? (records?.name??"") : editNameController.text, //
"taxId": editDutyCodeController.text == "" ? (records?.taxId??"") : editDutyCodeController.text, //
"type": titleType == 0 ? "PERSONAL" : "COMPANY", //
"userId": userId, //ID
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);});
if (baseData != null && baseData.isSuccess) {
Navigator.of(context).pop(1);
Future.delayed(Duration(milliseconds: 500), () {
SmartDialog.showToast("编辑抬头信息成功", alignment: Alignment.center);
});
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} finally {
EasyLoading.dismiss();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: MyAppBar(
title: "添加抬头",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
),
body:
// networkStatus == -1 ? noNetwork() :
Column(
crossAxisAlignment: CrossAxisAlignment.start,
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
FocusScope.of(context).unfocus();
},
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: MyAppBar(
title: titleName??"",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
),
body: Container(
color: Colors.white,
margin: EdgeInsets.only(top: 12.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"请填写抬头信息:",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
Expanded(
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 17.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.symmetric(vertical: 16.h),
child: Text(
"请填写抬头信息",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 16.sp,
fontWeight: MyFontWeight.bold,
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(right: 13.w),
child: Text(
"抬头类型",
style: TextStyle(
color: Color(0xFF353535),
fontSize: 16.sp,
fontWeight: MyFontWeight.bold,
),
),
),
Padding(
padding: EdgeInsets.only(right: 8.w),
child: InkWell(
child: BorderText(
text: "个人",
textColor: titleType == 0
? Color(0xff32A060)
: Color(0xff181818),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
borderColor: titleType == 0
? Color(0xff32A060)
: Color(0xffE6E6E6),
radius: 2,
padding: EdgeInsets.symmetric(
vertical: 6.h, horizontal: 13.w),
borderWidth: 1,
),
onTap: () {
setState(() {
titleType = 0;
});
},
),
),
InkWell(
child: BorderText(
text: "单位",
textColor: titleType == 1
? Color(0xff32A060)
: Color(0xff181818),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
borderColor: titleType == 1
? Color(0xff32A060)
: Color(0xffE6E6E6),
radius: 2,
padding: EdgeInsets.symmetric(
vertical: 6.h, horizontal: 13.w),
borderWidth: 1,
),
onTap: () {
setState(() {
titleType = 1;
});
},
)
],
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
),
Row(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "*",
style: TextStyle(
color: Color(0xFFBC161C),
fontSize: 14.sp,
fontWeight: FontWeight.w500,
),
),
TextSpan(
text: "名称 ",
style: TextStyle(
color: Color(0xFF353535),
fontSize: 14.sp,
fontWeight: FontWeight.w800,
),
),
],
),
),
Expanded(
child: TextField(
controller: editNameController,
decoration: InputDecoration(
hintText: records?.name ?? (titleType == 0
? "建议填写个人姓名(必填)"
: "单位名称(必填)"),
hintStyle: TextStyle(
color: ((records?.name??"") == "") ? Color(0xFFACACAC) : Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
border: InputBorder.none,
contentPadding: EdgeInsets.only(left: 16.w),
),
style: TextStyle(
color:Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
),
)
],
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
),
if (titleType == 1)
Column(
children: [
Row(
children: [
Text.rich(
TextSpan(
children: [
TextSpan(
text: "*",
style: TextStyle(
color: Color(0xFFBC161C),
fontSize: 14.sp,
fontWeight: FontWeight.w500,
),
),
TextSpan(
text: "税号 ",
style: TextStyle(
color: Color(0xFF353535),
fontSize: 14.sp,
fontWeight: FontWeight.w800,
),
),
],
),
),
Expanded(
child: TextField(
controller: editDutyCodeController,
decoration: InputDecoration(
hintText: records?.taxId ?? "纳税人识别号(必填)",
hintStyle: TextStyle(
color: ((records?.taxId??"") == "") ? Color(0xFFACACAC) : Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
border: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 16.w),
),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
),
)
],
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
),
Row(
children: [
Text(
"单位地址",
style: TextStyle(
color: Color(0xFF353535),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
),
Expanded(
child: TextField(
controller: editAddressController,
decoration: InputDecoration(
hintText: records?.companyAddr ?? "请输入单位地址",
hintStyle: TextStyle(
color: ((records?.companyAddr??"") == "") ? Color(0xFFACACAC) : Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
border: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 16.w),
),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
),
)
],
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
),
Row(
children: [
Text(
"单位电话",
style: TextStyle(
color: Color(0xFF353535),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
),
Expanded(
child: TextField(
controller: editPhoneController,
decoration: InputDecoration(
hintText: records?.companyPhone ?? "请输入单位电话",
hintStyle: TextStyle(
color: ((records?.companyPhone??"") == "") ? Color(0xFFACACAC) : Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
border: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 16.w),
),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
),
)
],
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
),
Row(
children: [
Text(
"开户银行",
style: TextStyle(
color: Color(0xFF353535),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
),
Expanded(
child: TextField(
controller: editBankController,
decoration: InputDecoration(
hintText: records?.bank ?? "请输入开户银行",
hintStyle: TextStyle(
color: ((records?.bank??"") == "") ? Color(0xFFACACAC) : Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
border: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 16.w),
),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
),
)
],
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
),
Row(
children: [
Text(
"开户账号",
style: TextStyle(
color: Color(0xFF353535),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
),
Expanded(
child: TextField(
controller: editAccountController,
decoration: InputDecoration(
hintText: records?.bankNumber ?? "请输入开户账号",
hintStyle: TextStyle(
color: ((records?.bankNumber??"") == "") ? Color(0xFFACACAC) : Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
border: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 16.w),
),
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
),
)
],
),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
),
],
)
],
),
),
)
)),
GestureDetector(
onTap: () {
if (editNameController.text == "" && ((records?.name ??"") == "")) {
SmartDialog.showToast("请输入名称",
alignment: Alignment.center);
return;
} else if (titleType == 1 &&
editDutyCodeController.text == ""&& ((records?.taxId ??"") == "")) {
SmartDialog.showToast("请输入税号",
alignment: Alignment.center);
return;
} else {
if(titleName == "编辑抬头"){
editInvoiceHeaders();
}else{
addInvoiceHeaders();
}
}
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 20.h),
color: Color(0xff32A060),
width: double.infinity,
alignment: Alignment.center,
child: Text(
S.of(context).baocun,
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
),
),
],
),
);
),
));
}
Widget invoicesOrderItemSm() {
return Container(
padding: EdgeInsets.only(top: 12, bottom: 12, left: 16),
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
Widget addInvoiceTitleSm() {
return Column(
children: [
Expanded(
child: Container(
margin: EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 149,
height: 20,
padding: EdgeInsets.only(top: 12, bottom: 12, left: 16),
margin: EdgeInsets.only(top: 12.h),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 162,
height: 22,
),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 12),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 59,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 8.h),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 54,
height: 28,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 8.h),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 54,
height: 28,
),
),
]),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 8.h, bottom: 16.h),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 61,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 8.h),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 134,
height: 20,
),
),
]),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 12.h, bottom: 16.h),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 61,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 8.h),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 134,
height: 20,
),
),
]),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 12.h, bottom: 16.h),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 61,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 8.h),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 134,
height: 20,
),
),
]),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 12.h, bottom: 16.h),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 61,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 8.h),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 134,
height: 20,
),
),
]),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 12.h, bottom: 16.h),
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 61,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 8.h),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 134,
height: 20,
),
),
]),
Container(
width: double.infinity,
height: 1.h,
color: Color(0xffF4F4F4),
margin: EdgeInsets.only(top: 12.h, bottom: 16.h),
),
],
))),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: double.infinity,
height: 54,
),
Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 42,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 60,
height: 20,
),
),
],
)
],
),
),
],
);
}
}

594
lib/order/invoices_manage/edit_invoices_info.dart

@ -0,0 +1,594 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../generated/l10n.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/user_info.dart';
import '../../retrofit/retrofit_api.dart';
import '../../utils/flutter_utils.dart';
import '../../utils/font_weight.dart';
import '../../view_widget/my_appbar.dart';
class EditInvoicesInfo extends StatefulWidget {
final Map<String, dynamic> arguments;
EditInvoicesInfo({this.arguments});
@override
State<StatefulWidget> createState() {
return _EditInvoicesInfo();
}
}
class _EditInvoicesInfo extends State<EditInvoicesInfo> {
bool isKeyBoardShow = false;
FocusNode _focusNode = FocusNode();
String selectPrice;
String headerId = "";
String phone = "";
String name = "";
ApiService apiService;
Map invoicesInfo;
String mobile;
final TextEditingController editPhoneController = TextEditingController();
List<dynamic> ids;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
setState(() {
print("object: ${MediaQuery.of(context).viewInsets.bottom}");
if (MediaQuery.of(context).viewInsets.bottom == 0) {
if (isKeyBoardShow) {
isKeyBoardShow = false;
//
FocusScope.of(context).requestFocus(FocusNode());
}
} else {
isKeyBoardShow = true;
}
});
});
SharedPreferences.getInstance().then((value) => {
apiService = ApiService(Dio(),
context: context, token: value.getString('token'),),
setState(() {
mobile = value.getString('mobile');
})
});
selectPrice = widget?.arguments["selectPrice"] ?? "";
ids = widget?.arguments["ids"] ?? [];
}
///
@override
void dispose() {
super.dispose();
_focusNode.unfocus();
}
///
submitInvoiceReview() async {
try {
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
BaseData baseData = await apiService.invoiceSubmit({
"headerId": headerId, //id
"isDelete": 0,
"money": selectPrice, //
"orderIds": ids, //id数组
"ossId": 0,
"phone": phone, //
"reason": "",
"reviewerBy": 0,
"reviewerTime": "",
"state": 0,
"type": 1,
"receivingPhone": editPhoneController.text == "" ? mobile :editPhoneController.text, //
}).catchError((error) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
alignment: Alignment.center);
});
if (baseData != null && baseData.isSuccess) {
Navigator.of(context).pop(1);
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} finally {
EasyLoading.dismiss();
}
}
@override
Widget build(BuildContext context) {
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
FocusScope.of(context).unfocus();
},
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: MyAppBar(
title: "填写发票信息",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
),
body: // networkStatus == -1 ? noNetwork() :
Container(
margin: EdgeInsets.only(top: 12.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: SingleChildScrollView(
physics: BouncingScrollPhysics(),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 17.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
///
// Container(
// padding: EdgeInsets.only(
// top: 12.h, bottom: 12.h, left: 12.w, right: 10.w),
// margin: EdgeInsets.only(bottom: 12.h),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(6),
// boxShadow: [
// BoxShadow(
// color: Color(0x0F06152E),
// offset: Offset(0, 2),
// blurRadius: 4,
// spreadRadius: 0,
// )
// ],
// ),
// child: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Padding(
// padding: EdgeInsets.only(top: 5.h),
// child: Image.asset(
// "assets/image/tip_info.webp",
// width: 17.h,
// height: 17.h,
// fit: BoxFit.fill,
// ),
// ),
// Padding(
// padding: EdgeInsets.only(left: 5.w),
// child: Text(
// "失败原因:已经开具过纸质发票,不能重复开具\n电子发票",
// style: TextStyle(
// letterSpacing: 0.5,
// height: 1.5,
// color: Color(0xFF32A060),
// fontSize: 14.sp,
// fontWeight: MyFontWeight.regular,
// ),
// ),
// )
// ],
// ),
// ),
Container(
padding:
EdgeInsets.only(top: 16.h, bottom: 16.h, left: 18.w),
margin: EdgeInsets.symmetric(vertical: 12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(6),
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"发票抬头",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 15.sp,
fontWeight: MyFontWeight.bold,
),
),
Padding(
padding: EdgeInsets.only(top: 16.h, bottom: 18.h),
child: Row(
children: [
Padding(
padding: EdgeInsets.only(right: 31.w),
child: Text(
"发票类型",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
Text(
"电子发票",
style: TextStyle(
color: Color(0xFF32A060),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
),
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
Navigator.of(context)
.pushNamed('/router/invoices_title_info',arguments:{
"enterType":0,
})
.then((value) {
if(value != null){
invoicesInfo = value;
headerId = (value as Map)['id'];
phone = (value as Map)['phone'];
name = (value as Map)['name'];
setState(() {});
}
});
},
child: Row(
children: [
Padding(
padding: EdgeInsets.only(right: 31.w),
child: Text(
"发票抬头",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
Expanded(
child: Text(
name == "" ? "请选择" : name,
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
Padding(
padding: EdgeInsets.only(right: 21.w),
child: Icon(Icons.arrow_forward_ios,
color: Color(0xFF181818),
size: 14.sp))
],
))
],
),
),
Container(
padding: EdgeInsets.symmetric(
vertical: 16.h, horizontal: 17.w),
margin: EdgeInsets.symmetric(vertical: 12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(6),
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Text(
"开票金额",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
Padding(
padding: EdgeInsets.only(right: 6.w),
child: Text(
"可开票金额",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
),
Text(
"${selectPrice ?? "0"}",
style: TextStyle(
color: Color(0xFF32A060),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)
],
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 17.w),
margin: EdgeInsets.symmetric(vertical: 12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(6),
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"发票接收",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
Expanded(
child: TextField(
controller: editPhoneController,
decoration: InputDecoration(
hintText: mobile,
hintStyle: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
hintTextDirection: TextDirection.rtl,
border: InputBorder.none,
contentPadding:
EdgeInsets.only(left: 16.w),
),
textAlign: TextAlign.right,
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular),
),
),
],
),
),
],
),
),
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap:(){
if(name == ""){
SmartDialog.showToast("请选择发票抬头",
alignment: Alignment.center);
}else{
submitInvoiceReview();
}
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 20.h),
color: Color(0xff32A060),
width: double.infinity,
alignment: Alignment.center,
child: Text(
"确认提交",
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
),
),
],
),
),
));
}
Widget editInvoicesInfoSm() {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.only(top: 16.h, bottom: 16.h, left: 18.w),
margin: EdgeInsets.symmetric(vertical: 12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(6),
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 62,
height: 20,
),
),
Padding(
padding: EdgeInsets.only(top: 16.h, bottom: 18.h),
child: Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 31.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 58,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 58,
height: 20,
),
),
],
),
),
Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 31.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 58,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 140,
height: 20,
),
),
Spacer(),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 21.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 14,
height: 14),
),
],
)
],
),
),
Container(
padding: EdgeInsets.symmetric(vertical: 16.h, horizontal: 17.w),
margin: EdgeInsets.symmetric(vertical: 12.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(6),
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 58,
height: 20,
),
),
Spacer(),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 6.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 70,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 31,
height: 20,
),
),
],
),
),
],
);
}
}

454
lib/order/invoices_manage/invoices_history.dart

@ -0,0 +1,454 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:intl/intl.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../generated/l10n.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/invoices_history_list.dart';
import '../../retrofit/retrofit_api.dart';
import '../../utils/flutter_utils.dart';
import '../../utils/font_weight.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_appbar.dart';
import '../../view_widget/my_footer.dart';
import '../../view_widget/no_data_view.dart';
class InvoicesHistory extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _InvoicesHistory();
}
}
class _InvoicesHistory extends State<InvoicesHistory> {
final RefreshController refreshController = RefreshController();
ApiService apiService;
String networkError = "";
int networkStatus = 0;
List<Records> records = [];
int _current = 1;
Map<String,List<Records>> _map = {};
String _timeList;
@override
void initState() {
super.initState();
_onRefresh();
}
///
@override
void dispose() {
super.dispose();
refreshController.dispose();
}
///
queryInvoiceList() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(Dio(),
context: context,
token: value.getString("token"),
showLoading: false);
}
BaseData<InvoicesHistoryList> baseData = await apiService.invoicePage({
"current": _current,
"size": 10,
"searchKey": "",
}).catchError((error) {
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
setState(() {});
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
records.addAll(baseData?.data?.records ?? []);
(baseData?.data?.records ?? []).forEach((element) {
if(_map.containsKey((element.reviewerTime ?? element.createTime).toString().substring(0,7))){
_map[(element.reviewerTime ?? element.createTime).toString().substring(0,7)].add(element);
}else{
_map[(element.reviewerTime ?? element.createTime).toString().substring(0,7)] = [element];
}
});
_timeList = _map.keys.toList().first;
if ((baseData?.data?.records ?? []).isEmpty ||
records.length.toString() == baseData.data.total)
refreshController.loadNoData();
else
refreshController.loadComplete();
networkStatus = 1;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
_onRefresh({bool isShowLoad = true}) async {
if (isShowLoad)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
await queryInvoiceList();
EasyLoading.dismiss();
if (!mounted) return;
if (refreshController.isRefresh) refreshController.refreshCompleted();
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: MyAppBar(
title: "开票历史",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
),
body:
networkStatus == -1 ? noNetwork() :
Container(
child: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: records.length == 0 ? false : true,
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
_current = 1;
records.clear();
_onRefresh(isShowLoad: false);
},
onLoading: () {
_current++;
_onRefresh(isShowLoad: false);
},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
child: networkStatus == 0
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(bottom: 16.h,top: 16.h,left: 17.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 70.w,
height: 20.h,
),
),
Expanded(child: ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: invoicesHistoryListSm(),
);
},
)),
],
)
:
((records == null || records.length == 0)
? NoDataView(
src: "assets/image/bs_no data_logo.webp",
isShowBtn: false,
text: "暂无商品分类",
fontSize: 16,
margin: EdgeInsets.all(20),
)
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: EdgeInsets.only(top: 16.h, bottom: 16.h, left: 17.w),
child: Text(
_timeList.toString(),
style: TextStyle(
color: Color(0xff1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
Expanded(child: ListView.builder(
itemCount: records?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: invoicesHistoryList(records[position]),
);
},
))
],
)),),
),
),
);
}
Widget invoicesHistoryList(Records records) {
return Container(
padding: EdgeInsets.symmetric(vertical: 14.h, horizontal: 12.w),
margin: EdgeInsets.only(left: 12.w, right: 12.w, bottom: 12.h),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
child: Column(
children: [
Padding(
padding: EdgeInsets.only(bottom: 25.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Text(
records?.invoiceHeaderName ?? "",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
)),
Text(
invoicesStatus(records?.state ?? ""),
style: TextStyle(
color: Color(0xff32A060),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)
],
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(right: 16.w),
child: Text(
"¥${records?.money ?? ""}",
style: TextStyle(
color: Color(0xff32A060),
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
)),
Expanded(
child: Text(
"电子普票",
style: TextStyle(
color: Color(0xff32A060),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
Text(
records?.reviewerTime ?? records?.createTime ?? "",
style: TextStyle(
color: Color(0xff4D4D4D),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)
],
)
],
),
);
}
///
String invoicesStatus(state) {
if (state == "UN_AUDIT") {
return "待审核";
} else if (state =="AUDIT_PASS") {
return "开票成功";
} else if (state =="AUDIT_VOID") {
return "已作废";
}else if (state =="AUDIT_FAIL") {
return "开票失败";
}
}
Widget invoicesHistoryListSm() {
return Container(
padding: EdgeInsets.symmetric(vertical: 14.h, horizontal: 12.w),
margin: EdgeInsets.symmetric(horizontal: 14.w, vertical: 12.h),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
child: Column(
children: [
Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 24),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 180.w,
height: 20.h,
),
),
Spacer(),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 25),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 42.w,
height: 20.h,
),
),
],
),
SizedBox(
height: 25.h,
),
Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 20),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 47.w,
height: 20.h,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 56.w,
height: 20.h,
),
),
Spacer(),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 25),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 80.w,
height: 20.h,
),
),
],
),
],
),
);
}
Widget noNetwork() {
return Container(
margin: EdgeInsets.only(top: 120.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
// "无法连接到网络",
networkError.substring(0, networkError.indexOf(",")),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
}

679
lib/order/invoices_manage/invoices_manage_page.dart

@ -0,0 +1,679 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../generated/l10n.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/invoice_list.dart';
import '../../retrofit/retrofit_api.dart';
import '../../utils/flutter_utils.dart';
import '../../utils/font_weight.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_appbar.dart';
import '../../view_widget/my_footer.dart';
import '../../view_widget/no_data_view.dart';
import '../../view_widget/settlement_tips_dialog.dart';
class InvoicesManagePage extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return _InvoicesManagePage();
}
}
class _InvoicesManagePage extends State<InvoicesManagePage> {
final RefreshController refreshController = RefreshController();
ApiService apiService;
String networkError = "";
int networkStatus = 0;
int _pageNum = 1;
var allCheckIndex = false;
List<Records> records = [];
List<Records> unRecords = [];
@override
void initState() {
super.initState();
_onRefresh();
}
///
@override
void dispose() {
super.dispose();
refreshController.dispose();
}
///
queryInvoiceList() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(Dio(),
context: context,
token: value.getString("token"),
showLoading: false);
}
BaseData<InvoiceList> baseData = await apiService.invoiceOrderList({
"current": _pageNum,
"size": 10,
"searchKey": "",
}).catchError((error) {
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
setState(() {});
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
records.addAll(baseData?.data?.records ?? []);
baseData.data.records.forEach((element) {
if (double.tryParse(element?.payedPrice ?? "") > 0)
unRecords.add(element);
});
if ((baseData?.data?.records ?? []).isEmpty ||
records.length.toString() == baseData.data.total)
refreshController.loadNoData();
else
refreshController.loadComplete();
networkStatus = 1;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
_onRefresh({bool isShowLoad = true}) async {
if (isShowLoad)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
await queryInvoiceList();
EasyLoading.dismiss();
if (!mounted) return;
if (refreshController.isRefresh) refreshController.refreshCompleted();
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: MyAppBar(
title: "发票管理",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
),
body: networkStatus == -1
? noNetwork()
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
color: Colors.white,
padding: EdgeInsets.only(top: 15.h, bottom: 10.h),
margin: EdgeInsets.only(bottom: 12.h),
child: Row(
children: [
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
Navigator.of(context)
.pushNamed('/router/invoices_title_info',arguments:{
"enterType":1,
});
},
child: Column(
children: [
Image.asset(
"assets/image/invoice_title.webp",
width: 26.h,
height: 26.h,
fit: BoxFit.fitWidth,
),
Padding(
padding: EdgeInsets.only(top: 7.6.h),
child: Text(
"抬头管理",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: FontWeight.bold,
),
),
)
],
),
)),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
Navigator.of(context)
.pushNamed('/router/invoices_history');
},
child: Column(
children: [
Image.asset(
"assets/image/invoice_history.webp",
width: 26.h,
height: 26.h,
fit: BoxFit.fitWidth,
),
Padding(
padding: EdgeInsets.only(top: 7.6.h),
child: Text(
"开票历史",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: FontWeight.bold,
),
),
)
],
))),
],
),
),
Padding(
padding: EdgeInsets.only(left: 14.w, bottom: 6.h),
child: Text(
"可开票订单",
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.left,
),
),
Expanded(
child: Container(
child: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp:records.length == 0 ? false :true,
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
_pageNum = 1;
records.clear();
unRecords.clear();
_onRefresh(isShowLoad: false);
},
onLoading: () {
_pageNum++;
_onRefresh(isShowLoad: false);
},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
child: networkStatus == 0
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: invoicesOrderItemSm(),
);
},
)
: ((records == null || records.length == 0)
? NoDataView(
src: "assets/image/ding_dan.webp",
isShowBtn: false,
text: "暂无可开票的订单",
fontSize: 16,
margin: EdgeInsets.only(top: 120,left: 20,right: 20),
)
: ListView.builder(
itemCount: records?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
setState(() {
records[position].isSelect =
!records[position].isSelect;
});
},
child:
invoicesOrderItem(records[position]),
);
},
)),
),
),
)),
if (records != null && records.length > 0)
Container(
decoration: BoxDecoration(
color: Colors.white,
),
width: double.infinity,
padding: EdgeInsets.only(
top: 16.h, bottom: 45.h, left: 14.w, right: 17.w),
child: Column(
children: [
Padding(
padding: EdgeInsets.only(bottom: 10.h),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.only(right: 6.w),
child: Text(
"已选${selectNum()}个订单合计:",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
),
Expanded(
child: Text(
"${selectPrice()}",
style: TextStyle(
color: Color(0xFF32A060),
fontSize: 20.sp,
fontWeight: MyFontWeight.medium,
),
)),
Text(
"开票金额以实际发票为准",
style: TextStyle(
color: Color(0xFF727272),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
],
)),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
GestureDetector(
onTap: () {
records.forEach((element) {
element.isSelect = !allCheckIndex;
});
allCheckIndex = !allCheckIndex;
setState(() {});
},
child: Container(
padding: EdgeInsets.only(right: 8.w),
child: Image.asset(
allCheckIndex
? "assets/image/icon_radio_selected.webp"
: "assets/image/icon_radio_unselected.webp",
width: 16.w,
height: 16.h,
)),
),
Expanded(
child: GestureDetector(
onTap: () {
records.forEach((element) {
element.isSelect = !allCheckIndex;
});
allCheckIndex = !allCheckIndex;
setState(() {});
},
child: Text(
"全选",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
)),
GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
List<dynamic> ids = [];
records.forEach((element) {
if (element.isSelect) ids.add(element.id);
});
if((double.tryParse(selectNum()) > 0))
Navigator.of(context)
.pushNamed('/router/edit_invoices_info',arguments:{
"selectPrice": selectPrice(),
"ids":ids ?? []
}).then((value) async{
if(value ==1){
_pageNum = 1;
records.clear();
unRecords.clear();
await _onRefresh();
Future.delayed(Duration(milliseconds: 500), () {
SmartDialog.show(
widget: SettlementTips(
() {},
text: "已成功提交发票信息",
),
);
});
}
});
},
child: Container(
decoration: BoxDecoration(
color: (double.tryParse(selectNum()) > 0)
? Color(0xFF32A060)
: Color(0xFFd6d6d6),
borderRadius: BorderRadius.circular(4),
),
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
horizontal: 23.w, vertical: 8.h),
child: Text(
"去开票",
style: TextStyle(
color: Colors.white,
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
),
)
],
),
],
),
)
],
),
);
}
///
String selectNum() {
return unRecords.where((element) => element.isSelect).length.toString();
}
///
String selectPrice() {
return unRecords
.where((element) => element.isSelect)
.fold(
0.0,
(previousValue, element) =>
previousValue + double.tryParse(element.payedPrice ?? "0") ??
0.0)
.toStringAsFixed(2);
}
///list
Widget invoicesOrderItem(Records records) {
return Container(
padding: EdgeInsets.only(top: 12.h, bottom: 12.h, right: 20.w),
margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 6.h),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
((double.tryParse(records?.payedPrice ?? "0") ?? 0) > 0)
? GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
setState(() {
records.isSelect = !records.isSelect;
});
},
child: Container(
padding: EdgeInsets.only(
right: 15.w, left: 12.w, top: 5.h, bottom: 5.h),
alignment: Alignment.center,
child: Image.asset(
(records?.isSelect ?? false)
? "assets/image/icon_radio_selected.webp"
: "assets/image/icon_radio_unselected.webp",
width: 15.w,
height: 15.h,
),
),
)
: Container(
padding: EdgeInsets.only(
right: 15.w, left: 12.w, top: 5.h, bottom: 5.h),
alignment: Alignment.center,
child: Image.asset(
"assets/image/disenable_seletor_tow.webp",
width: 15.w,
height: 15.h,
)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
records?.storeName ?? "",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
color: Color(0xFF0D0D0D),
),
),
Padding(
padding: EdgeInsets.only(top: 8.h, bottom: 14.h),
child: Text(
"订单编号:${records?.id ?? ""}",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.medium,
color: Color(0xFF353535),
),
)),
Text(
"下单时间: ${records?.createTime ?? ""}",
style: TextStyle(
fontSize: 10.sp,
fontWeight: MyFontWeight.regular,
color: Color(0xFF0D0D0D),
),
),
],
)),
Text.rich(
TextSpan(
children: [
TextSpan(
text: records?.finalPayPrice ?? "0.00",
style: TextStyle(
color: Color(0xFF000000),
fontSize: 16.sp,
fontWeight: MyFontWeight.bold,
),
),
TextSpan(
text: "",
style: TextStyle(
color: Color(0xFF4D4D4D),
fontSize: 14.sp,
fontWeight: MyFontWeight.medium,
),
),
],
),
),
],
),
);
}
Widget invoicesOrderItemSm() {
return Container(
padding: EdgeInsets.only(top: 12, bottom: 12, left: 16),
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 13.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 16,
height: 16,
),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 180,
height: 20,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(top: 8.h, bottom: 14.h),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 182,
height: 17,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 170,
height: 14,
),
)
],
)),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 13.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 49,
height: 20,
),
),
],
),
);
}
Widget noNetwork() {
return Container(
color: Colors.white,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
networkError.substring(0, networkError.indexOf(",")),
style: TextStyle(
fontSize: 14,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold,
),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular,
),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 3),
child: Text(
"重试",
style: TextStyle(
fontSize: 14,
color: Colors.white,
fontWeight: MyFontWeight.regular,
),
),
),
),
],
),
);
}
}

571
lib/order/invoices_manage/invoices_title_info.dart

@ -0,0 +1,571 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../generated/l10n.dart';
import '../../retrofit/data/base_data.dart';
import '../../retrofit/data/title_info_list.dart';
import '../../retrofit/retrofit_api.dart';
import '../../utils/flutter_utils.dart';
import '../../utils/font_weight.dart';
import '../../view_widget/border_text.dart';
import '../../view_widget/classic_header.dart';
import '../../view_widget/my_appbar.dart';
import '../../view_widget/my_footer.dart';
import '../../view_widget/no_data_view.dart';
import '../../view_widget/round_button.dart';
class InvoicesTitleInfo extends StatefulWidget {
final Map<String, dynamic> arguments;
InvoicesTitleInfo({this.arguments});
@override
State<StatefulWidget> createState() {
return _InvoicesTitleInfo();
}
}
class _InvoicesTitleInfo extends State<InvoicesTitleInfo> {
final RefreshController refreshController = RefreshController();
String networkError = "";
int networkStatus = 0;
ApiService apiService;
List<Records> records = [];
int _current = 1;
@override
void initState() {
super.initState();
_onRefresh();
}
///
@override
void dispose() {
super.dispose();
refreshController.dispose();
}
_onRefresh({bool isShowLoad = true}) async {
if (isShowLoad)
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
await queryInvoiceHeadersList();
EasyLoading.dismiss();
if (!mounted) return;
if (refreshController.isRefresh) refreshController.refreshCompleted();
setState(() {});
}
///
queryInvoiceHeadersList() async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<TitleInfoList> baseData = await apiService.invoiceHeaderList({
"current": _current,
"map": {},
"model": {},
"order": "descending",
"size": 50,
"sort": "id"
}).catchError((error) {
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
setState(() {});
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (!mounted) return;
if (baseData != null && baseData.isSuccess) {
records.addAll(baseData?.data?.records ?? []);
if ((baseData?.data?.records ?? []).isEmpty ||
records.length.toString() == baseData.data.total)
refreshController.loadNoData();
else
refreshController.loadComplete();
networkStatus = 1;
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
}
///
delTitleInfo(ids) async {
try {
EasyLoading.show(
status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black);
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData baseData = await apiService.delInvoiceHeader(ids).catchError((error) {
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
setState(() {});
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (baseData != null && baseData.isSuccess) {
await editOnRefresh();
Future.delayed(Duration(milliseconds: 500), () {
SmartDialog.showToast("删除信息成功", alignment: Alignment.center);
});
} else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
}
} finally {
EasyLoading.dismiss();
}
}
editOnRefresh() {
_current = 1;
records.clear();
_onRefresh(isShowLoad: false);
}
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: MyAppBar(
title: "抬头管理",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
),
body: networkStatus == -1
? noNetwork()
: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Container(
child: SmartRefresher(
controller: refreshController,
enablePullDown: true,
// enablePullUp: records.length == 0 ? false : true,
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
_current = 1;
records.clear();
_onRefresh(isShowLoad: false);
},
onLoading: () {
_current++;
_onRefresh(isShowLoad: false);
},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
margin: EdgeInsets.only(bottom: 20.h),
child: networkStatus == 0
? ListView.builder(
itemCount: 10,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {},
child: titleInfoListSm(),
);
},
)
: ((records == null || records.length == 0)
? NoDataView(
src: "assets/image/guan_zhu.webp",
isShowBtn: false,
text: "暂无抬头信息",
fontSize: 16,
margin: EdgeInsets.only(top:120),
)
: ListView.builder(
itemCount: records?.length ?? 0,
physics: BouncingScrollPhysics(),
shrinkWrap: true,
itemBuilder: (context, position) {
return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if(widget.arguments["enterType"] == 0){
Navigator.of(context).pop({
"id":records[position]?.id ?? "",
"phone":records[position]?.companyPhone ?? "",
"name":records[position]?.name ?? ""
});
}},
child: titleInfoList(records[position]),
);
},
))),
),
)),
if (networkStatus == 1)
GestureDetector(
onTap: () {
Navigator.of(context)
.pushNamed('/router/add_invoices_title',arguments:{
"titleName":"添加抬头",
}).then((value) {
_current = 1;
records.clear();
_onRefresh(isShowLoad: false);
});
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 20.h),
color: Color(0xff32A060),
width: double.infinity,
alignment: Alignment.center,
child: Text(
"添加抬头",
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
),
),
],
),
);
}
Widget titleInfoList(Records records) {
return Container(
padding: EdgeInsets.only(
top: ((records?.type ?? "") == "PERSONAL") ? 30.h : 14.h,
bottom: ((records?.type ?? "") == "PERSONAL") ? 30.h : 14.h,
left: 12.w),
margin: EdgeInsets.only(top: 12.h, bottom: 4.h, right: 14.w, left: 14.w),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
records?.name ?? "",
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Colors.black,
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
),
if ((records?.type ?? "") == "COMPANY")
Padding(
padding: EdgeInsets.only(top: 20.h),
child: Text(
"税号:${records?.taxId ?? ""}",
style: TextStyle(
color: Color(0xff353535),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
],
)),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
Navigator.of(context).pushNamed('/router/add_invoices_title',arguments: {
"titleName":"编辑抬头",
"titleType":records.type == "COMPANY" ? 1:0,
"records":records,
}).then((value){
if(value == 1)
editOnRefresh();
});
},
child: Padding(
padding: EdgeInsets.only(left:30.w,right: 12.w),
child: Image.asset(
"assets/image/title_info_edit.webp",
width: 16.h,
height: 16.h,
fit: BoxFit.fitWidth,
))),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
showTitleInfoDialog(records?.id ?? "");
},
child: Padding(
padding: EdgeInsets.only(left: 12.w, right: 31.w),
child: Image.asset(
"assets/image/title_del.webp",
width: 15.h,
height: 16.h,
fit: BoxFit.fitWidth,
)),
),
],
),
);
}
Widget titleInfoListSm() {
return Container(
padding: EdgeInsets.only(top: 12, bottom: 12, left: 16),
margin: EdgeInsets.symmetric(horizontal: 14, vertical: 6),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Color(0x0F06152E),
offset: Offset(0, 2),
blurRadius: 4,
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
child: Row(
children: [
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(bottom: 16),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 180.w,
height: 20.h,
),
),
Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 40.w,
height: 20.h,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 120,
height: 20,
),
),
],
),
],
)),
Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 24),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 16.w,
height: 16.h,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 25),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 16,
height: 16,
),
),
],
),
],
),
);
}
Widget noNetwork() {
return Container(
width: double.infinity,
margin: EdgeInsets.only(top: 120.h),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
// "无法连接到网络",
networkError.substring(0, networkError.indexOf(",")),
style: TextStyle(
fontSize: 14.sp,
color: Color(0xFF0D0D0D),
fontWeight: MyFontWeight.bold),
),
Padding(
padding: EdgeInsets.symmetric(vertical: 10.h),
child: Text(
"请检查网络设置或稍后重试",
style: TextStyle(
fontSize: 12.sp,
color: Color(0xFF7A797F),
fontWeight: MyFontWeight.regular),
),
),
GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
_onRefresh();
},
child: Container(
decoration: BoxDecoration(
color: Color(0xFF30415B),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 3.h),
child: Text(
"重试",
style: TextStyle(
fontSize: 14.sp,
color: Colors.white,
fontWeight: MyFontWeight.regular),
)),
)
],
),
);
}
//
showTitleInfoDialog(id) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
height: 139,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"确认要删除这条数据吗?",
style: TextStyle(
color: Colors.black,
fontSize: 16,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(height: 35),
Row(
children: [
Expanded(
child: InkWell(
child: BorderText(
text: S.of(context).quxiao,
textColor: Color(0xff32A060),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
borderColor: Color(0xff32A060),
radius: 4,
padding: EdgeInsets.all(12),
borderWidth: 1,
),
onTap: () {
Navigator.of(context).pop();
},
),
flex: 1,
),
SizedBox(
width: 16.w,
),
Expanded(
child: InkWell(
child: RoundButton(
text: S.of(context).shanchu,
textColor: Colors.white,
radius: 4,
padding: EdgeInsets.all(12),
backgroup: Color(0xff32A060),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
onTap: () {
delTitleInfo(id);
Navigator.of(context).pop();
},
),
flex: 1,
),
],
)
],
),
),
);
},
);
}
}

2
lib/order/order_history_page.dart

@ -196,6 +196,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
} else {
if((baseData?.msg ?? "") != "")
SmartDialog.showToast(baseData.msg,alignment: Alignment.center);
networkStatus = 2;
refreshController.refreshFailed();
refreshController.loadFailed();
}}finally{
@ -632,6 +633,7 @@ class _OrderHistoryList extends State<OrderHistoryList>
? StatusUtils.statusBtn(
context,
orderInfo.payStatus,
orderInfo.payChannel,
orderInfo.orderStatus,
orderInfo.isTakeOut,
orderInfo.sendStatus,

1212
lib/retrofit/data/invoice_list.dart

File diff suppressed because one or more lines are too long

385
lib/retrofit/data/invoices_history_list.dart

@ -0,0 +1,385 @@
/// records : [{"id":"1816408165248401408","createTime":"2024-07-25 17:40:28","createUser":"1379254113602109440","updateTime":"2024-07-25 17:40:28","updateUser":"1379254113602109440","phone":"","receivingPhone":"13052919193","mid":"1379254113602109440","orderIds":["1816397314357460992","1816396872328151040","1815299099583315968","1808758418991742976","1739531721478504448","1739529082455982080","1739528149030404096","1721749099142709248","1721748992578027520","1721748249640960000","1708069378165047296","1708069229195952128"],"money":"4.00","type":"ELECTRONIC","headerId":"1816011766241427456","state":"UN_AUDIT","reviewerTime":null,"reviewerBy":"0","ossUrl":null,"reason":"","isDelete":0,"invoiceHeaderName":"u我i","invoiceHeaderCode":"1233456","orderList":null,"headertype":null,"companyAddr":null,"companyPhone":null,"bank":null,"bankNumber":null},{"id":"1816394976490160128","createTime":"2024-07-25 16:48:04","createUser":"1379254113602109440","updateTime":"2024-07-25 16:48:04","updateUser":"1379254113602109440","phone":"","receivingPhone":"13052919193","mid":"1379254113602109440","orderIds":["1808763201462992896"],"money":"0.01","type":"ELECTRONIC","headerId":"1816011766241427456","state":"UN_AUDIT","reviewerTime":null,"reviewerBy":"0","ossUrl":null,"reason":"","isDelete":0,"invoiceHeaderName":"u我i","invoiceHeaderCode":"1233456","orderList":null,"headertype":null,"companyAddr":null,"companyPhone":null,"bank":null,"bankNumber":null},{"id":"1816394876095299584","createTime":"2024-07-25 16:47:40","createUser":"1379254113602109440","updateTime":"2024-07-25 16:47:40","updateUser":"1379254113602109440","phone":"","receivingPhone":"131789456123","mid":"1379254113602109440","orderIds":["1808763658105257984"],"money":"0.01","type":"ELECTRONIC","headerId":"1816011766241427456","state":"UN_AUDIT","reviewerTime":null,"reviewerBy":"0","ossUrl":null,"reason":"","isDelete":0,"invoiceHeaderName":"u我i","invoiceHeaderCode":"1233456","orderList":null,"headertype":null,"companyAddr":null,"companyPhone":null,"bank":null,"bankNumber":null},{"id":"1816393433175031808","createTime":"2024-07-25 16:41:56","createUser":"1379254113602109440","updateTime":"2024-07-25 16:41:56","updateUser":"1379254113602109440","phone":"","receivingPhone":"13052919193","mid":"1379254113602109440","orderIds":["1810210939736162304"],"money":"0.01","type":"ELECTRONIC","headerId":"1816011766241427456","state":"UN_AUDIT","reviewerTime":null,"reviewerBy":"0","ossUrl":null,"reason":"","isDelete":0,"invoiceHeaderName":"u我i","invoiceHeaderCode":"1233456","orderList":null,"headertype":null,"companyAddr":null,"companyPhone":null,"bank":null,"bankNumber":null}]
/// total : "4"
/// size : "10"
/// current : "1"
/// orders : [{"column":"id","asc":false}]
/// hitCount : false
/// searchCount : true
/// pages : "1"
class InvoicesHistoryList {
InvoicesHistoryList({
List<Records> records,
String total,
String size,
String current,
List<Orders> orders,
bool hitCount,
bool searchCount,
String pages,}){
_records = records;
_total = total;
_size = size;
_current = current;
_orders = orders;
_hitCount = hitCount;
_searchCount = searchCount;
_pages = pages;
}
InvoicesHistoryList.fromJson(dynamic json) {
if (json['records'] != null) {
_records = [];
json['records'].forEach((v) {
_records.add(Records.fromJson(v));
});
}
_total = json['total'];
_size = json['size'];
_current = json['current'];
if (json['orders'] != null) {
_orders = [];
json['orders'].forEach((v) {
_orders.add(Orders.fromJson(v));
});
}
_hitCount = json['hitCount'];
_searchCount = json['searchCount'];
_pages = json['pages'];
}
List<Records> _records;
String _total;
String _size;
String _current;
List<Orders> _orders;
bool _hitCount;
bool _searchCount;
String _pages;
InvoicesHistoryList copyWith({ List<Records> records,
String total,
String size,
String current,
List<Orders> orders,
bool hitCount,
bool searchCount,
String pages,
}) => InvoicesHistoryList( records: records ?? _records,
total: total ?? _total,
size: size ?? _size,
current: current ?? _current,
orders: orders ?? _orders,
hitCount: hitCount ?? _hitCount,
searchCount: searchCount ?? _searchCount,
pages: pages ?? _pages,
);
List<Records> get records => _records;
String get total => _total;
String get size => _size;
String get current => _current;
List<Orders> get orders => _orders;
bool get hitCount => _hitCount;
bool get searchCount => _searchCount;
String get pages => _pages;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
if (_records != null) {
map['records'] = _records.map((v) => v.toJson()).toList();
}
map['total'] = _total;
map['size'] = _size;
map['current'] = _current;
if (_orders != null) {
map['orders'] = _orders.map((v) => v.toJson()).toList();
}
map['hitCount'] = _hitCount;
map['searchCount'] = _searchCount;
map['pages'] = _pages;
return map;
}
}
/// column : "id"
/// asc : false
class Orders {
Orders({
String column,
bool asc,}){
_column = column;
_asc = asc;
}
Orders.fromJson(dynamic json) {
_column = json['column'];
_asc = json['asc'];
}
String _column;
bool _asc;
Orders copyWith({ String column,
bool asc,
}) => Orders( column: column ?? _column,
asc: asc ?? _asc,
);
String get column => _column;
bool get asc => _asc;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['column'] = _column;
map['asc'] = _asc;
return map;
}
}
/// id : "1816408165248401408"
/// createTime : "2024-07-25 17:40:28"
/// createUser : "1379254113602109440"
/// updateTime : "2024-07-25 17:40:28"
/// updateUser : "1379254113602109440"
/// phone : ""
/// receivingPhone : "13052919193"
/// mid : "1379254113602109440"
/// orderIds : ["1816397314357460992","1816396872328151040","1815299099583315968","1808758418991742976","1739531721478504448","1739529082455982080","1739528149030404096","1721749099142709248","1721748992578027520","1721748249640960000","1708069378165047296","1708069229195952128"]
/// money : "4.00"
/// type : "ELECTRONIC"
/// headerId : "1816011766241427456"
/// state : "UN_AUDIT"
/// reviewerTime : null
/// reviewerBy : "0"
/// ossUrl : null
/// reason : ""
/// isDelete : 0
/// invoiceHeaderName : "u我i"
/// invoiceHeaderCode : "1233456"
/// orderList : null
/// headertype : null
/// companyAddr : null
/// companyPhone : null
/// bank : null
/// bankNumber : null
class Records {
Records({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String phone,
String receivingPhone,
String mid,
List<String> orderIds,
String money,
String type,
String headerId,
String state,
dynamic reviewerTime,
String reviewerBy,
dynamic ossUrl,
String reason,
num isDelete,
String invoiceHeaderName,
String invoiceHeaderCode,
dynamic orderList,
dynamic headertype,
dynamic companyAddr,
dynamic companyPhone,
dynamic bank,
dynamic bankNumber,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_phone = phone;
_receivingPhone = receivingPhone;
_mid = mid;
_orderIds = orderIds;
_money = money;
_type = type;
_headerId = headerId;
_state = state;
_reviewerTime = reviewerTime;
_reviewerBy = reviewerBy;
_ossUrl = ossUrl;
_reason = reason;
_isDelete = isDelete;
_invoiceHeaderName = invoiceHeaderName;
_invoiceHeaderCode = invoiceHeaderCode;
_orderList = orderList;
_headertype = headertype;
_companyAddr = companyAddr;
_companyPhone = companyPhone;
_bank = bank;
_bankNumber = bankNumber;
}
Records.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_phone = json['phone'];
_receivingPhone = json['receivingPhone'];
_mid = json['mid'];
_orderIds = json['orderIds'] != null ? json['orderIds'].cast<String>() : [];
_money = json['money'];
_type = json['type'];
_headerId = json['headerId'];
_state = json['state'];
_reviewerTime = json['reviewerTime'];
_reviewerBy = json['reviewerBy'];
_ossUrl = json['ossUrl'];
_reason = json['reason'];
_isDelete = json['isDelete'];
_invoiceHeaderName = json['invoiceHeaderName'];
_invoiceHeaderCode = json['invoiceHeaderCode'];
_orderList = json['orderList'];
_headertype = json['headertype'];
_companyAddr = json['companyAddr'];
_companyPhone = json['companyPhone'];
_bank = json['bank'];
_bankNumber = json['bankNumber'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _phone;
String _receivingPhone;
String _mid;
List<String> _orderIds;
String _money;
String _type;
String _headerId;
String _state;
dynamic _reviewerTime;
String _reviewerBy;
dynamic _ossUrl;
String _reason;
num _isDelete;
String _invoiceHeaderName;
String _invoiceHeaderCode;
dynamic _orderList;
dynamic _headertype;
dynamic _companyAddr;
dynamic _companyPhone;
dynamic _bank;
dynamic _bankNumber;
Records copyWith({ String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String phone,
String receivingPhone,
String mid,
List<String> orderIds,
String money,
String type,
String headerId,
String state,
dynamic reviewerTime,
String reviewerBy,
dynamic ossUrl,
String reason,
num isDelete,
String invoiceHeaderName,
String invoiceHeaderCode,
dynamic orderList,
dynamic headertype,
dynamic companyAddr,
dynamic companyPhone,
dynamic bank,
dynamic bankNumber,
}) => Records( id: id ?? _id,
createTime: createTime ?? _createTime,
createUser: createUser ?? _createUser,
updateTime: updateTime ?? _updateTime,
updateUser: updateUser ?? _updateUser,
phone: phone ?? _phone,
receivingPhone: receivingPhone ?? _receivingPhone,
mid: mid ?? _mid,
orderIds: orderIds ?? _orderIds,
money: money ?? _money,
type: type ?? _type,
headerId: headerId ?? _headerId,
state: state ?? _state,
reviewerTime: reviewerTime ?? _reviewerTime,
reviewerBy: reviewerBy ?? _reviewerBy,
ossUrl: ossUrl ?? _ossUrl,
reason: reason ?? _reason,
isDelete: isDelete ?? _isDelete,
invoiceHeaderName: invoiceHeaderName ?? _invoiceHeaderName,
invoiceHeaderCode: invoiceHeaderCode ?? _invoiceHeaderCode,
orderList: orderList ?? _orderList,
headertype: headertype ?? _headertype,
companyAddr: companyAddr ?? _companyAddr,
companyPhone: companyPhone ?? _companyPhone,
bank: bank ?? _bank,
bankNumber: bankNumber ?? _bankNumber,
);
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get phone => _phone;
String get receivingPhone => _receivingPhone;
String get mid => _mid;
List<String> get orderIds => _orderIds;
String get money => _money;
String get type => _type;
String get headerId => _headerId;
String get state => _state;
dynamic get reviewerTime => _reviewerTime;
String get reviewerBy => _reviewerBy;
dynamic get ossUrl => _ossUrl;
String get reason => _reason;
num get isDelete => _isDelete;
String get invoiceHeaderName => _invoiceHeaderName;
String get invoiceHeaderCode => _invoiceHeaderCode;
dynamic get orderList => _orderList;
dynamic get headertype => _headertype;
dynamic get companyAddr => _companyAddr;
dynamic get companyPhone => _companyPhone;
dynamic get bank => _bank;
dynamic get bankNumber => _bankNumber;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['phone'] = _phone;
map['receivingPhone'] = _receivingPhone;
map['mid'] = _mid;
map['orderIds'] = _orderIds;
map['money'] = _money;
map['type'] = _type;
map['headerId'] = _headerId;
map['state'] = _state;
map['reviewerTime'] = _reviewerTime;
map['reviewerBy'] = _reviewerBy;
map['ossUrl'] = _ossUrl;
map['reason'] = _reason;
map['isDelete'] = _isDelete;
map['invoiceHeaderName'] = _invoiceHeaderName;
map['invoiceHeaderCode'] = _invoiceHeaderCode;
map['orderList'] = _orderList;
map['headertype'] = _headertype;
map['companyAddr'] = _companyAddr;
map['companyPhone'] = _companyPhone;
map['bank'] = _bank;
map['bankNumber'] = _bankNumber;
return map;
}
}

286
lib/retrofit/data/title_info_list.dart

@ -0,0 +1,286 @@
/// records : [{"id":"1815947305409314816","createTime":"2024-07-24 11:09:11","createUser":"1379254113602109440","updateTime":"2024-07-24 11:09:11","updateUser":"1379254113602109440","userId":"1379254113602109440","isDefault":1,"type":"PERSONAL","name":"回乡信息","taxId":"202407027106","companyAddr":"中海中心","companyPhone":null,"bank":"中国银行","bankNumber":"4123456789987456123","isDelete":0}]
/// total : "1"
/// size : "50"
/// current : "1"
/// orders : [{"column":"id","asc":false}]
/// hitCount : false
/// searchCount : true
/// pages : "1"
class TitleInfoList {
TitleInfoList({
List<Records> records,
String total,
String size,
String current,
List<Orders> orders,
bool hitCount,
bool searchCount,
String pages,}){
_records = records;
_total = total;
_size = size;
_current = current;
_orders = orders;
_hitCount = hitCount;
_searchCount = searchCount;
_pages = pages;
}
TitleInfoList.fromJson(dynamic json) {
if (json['records'] != null) {
_records = [];
json['records'].forEach((v) {
_records.add(Records.fromJson(v));
});
}
_total = json['total'];
_size = json['size'];
_current = json['current'];
if (json['orders'] != null) {
_orders = [];
json['orders'].forEach((v) {
_orders.add(Orders.fromJson(v));
});
}
_hitCount = json['hitCount'];
_searchCount = json['searchCount'];
_pages = json['pages'];
}
List<Records> _records;
String _total;
String _size;
String _current;
List<Orders> _orders;
bool _hitCount;
bool _searchCount;
String _pages;
TitleInfoList copyWith({ List<Records> records,
String total,
String size,
String current,
List<Orders> orders,
bool hitCount,
bool searchCount,
String pages,
}) => TitleInfoList( records: records ?? _records,
total: total ?? _total,
size: size ?? _size,
current: current ?? _current,
orders: orders ?? _orders,
hitCount: hitCount ?? _hitCount,
searchCount: searchCount ?? _searchCount,
pages: pages ?? _pages,
);
List<Records> get records => _records;
String get total => _total;
String get size => _size;
String get current => _current;
List<Orders> get orders => _orders;
bool get hitCount => _hitCount;
bool get searchCount => _searchCount;
String get pages => _pages;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
if (_records != null) {
map['records'] = _records.map((v) => v.toJson()).toList();
}
map['total'] = _total;
map['size'] = _size;
map['current'] = _current;
if (_orders != null) {
map['orders'] = _orders.map((v) => v.toJson()).toList();
}
map['hitCount'] = _hitCount;
map['searchCount'] = _searchCount;
map['pages'] = _pages;
return map;
}
}
/// column : "id"
/// asc : false
class Orders {
Orders({
String column,
bool asc,}){
_column = column;
_asc = asc;
}
Orders.fromJson(dynamic json) {
_column = json['column'];
_asc = json['asc'];
}
String _column;
bool _asc;
Orders copyWith({ String column,
bool asc,
}) => Orders( column: column ?? _column,
asc: asc ?? _asc,
);
String get column => _column;
bool get asc => _asc;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['column'] = _column;
map['asc'] = _asc;
return map;
}
}
/// id : "1815947305409314816"
/// createTime : "2024-07-24 11:09:11"
/// createUser : "1379254113602109440"
/// updateTime : "2024-07-24 11:09:11"
/// updateUser : "1379254113602109440"
/// userId : "1379254113602109440"
/// isDefault : 1
/// type : "PERSONAL"
/// name : "回乡信息"
/// taxId : "202407027106"
/// companyAddr : "中海中心"
/// companyPhone : null
/// bank : "中国银行"
/// bankNumber : "4123456789987456123"
/// isDelete : 0
class Records {
Records({
String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String userId,
num isDefault,
String type,
String name,
String taxId,
String companyAddr,
dynamic companyPhone,
String bank,
String bankNumber,
num isDelete,}){
_id = id;
_createTime = createTime;
_createUser = createUser;
_updateTime = updateTime;
_updateUser = updateUser;
_userId = userId;
_isDefault = isDefault;
_type = type;
_name = name;
_taxId = taxId;
_companyAddr = companyAddr;
_companyPhone = companyPhone;
_bank = bank;
_bankNumber = bankNumber;
_isDelete = isDelete;
}
Records.fromJson(dynamic json) {
_id = json['id'];
_createTime = json['createTime'];
_createUser = json['createUser'];
_updateTime = json['updateTime'];
_updateUser = json['updateUser'];
_userId = json['userId'];
_isDefault = json['isDefault'];
_type = json['type'];
_name = json['name'];
_taxId = json['taxId'];
_companyAddr = json['companyAddr'];
_companyPhone = json['companyPhone'];
_bank = json['bank'];
_bankNumber = json['bankNumber'];
_isDelete = json['isDelete'];
}
String _id;
String _createTime;
String _createUser;
String _updateTime;
String _updateUser;
String _userId;
num _isDefault;
String _type;
String _name;
String _taxId;
String _companyAddr;
dynamic _companyPhone;
String _bank;
String _bankNumber;
num _isDelete;
Records copyWith({ String id,
String createTime,
String createUser,
String updateTime,
String updateUser,
String userId,
num isDefault,
String type,
String name,
String taxId,
String companyAddr,
dynamic companyPhone,
String bank,
String bankNumber,
num isDelete,
}) => Records( id: id ?? _id,
createTime: createTime ?? _createTime,
createUser: createUser ?? _createUser,
updateTime: updateTime ?? _updateTime,
updateUser: updateUser ?? _updateUser,
userId: userId ?? _userId,
isDefault: isDefault ?? _isDefault,
type: type ?? _type,
name: name ?? _name,
taxId: taxId ?? _taxId,
companyAddr: companyAddr ?? _companyAddr,
companyPhone: companyPhone ?? _companyPhone,
bank: bank ?? _bank,
bankNumber: bankNumber ?? _bankNumber,
isDelete: isDelete ?? _isDelete,
);
String get id => _id;
String get createTime => _createTime;
String get createUser => _createUser;
String get updateTime => _updateTime;
String get updateUser => _updateUser;
String get userId => _userId;
num get isDefault => _isDefault;
String get type => _type;
String get name => _name;
String get taxId => _taxId;
String get companyAddr => _companyAddr;
dynamic get companyPhone => _companyPhone;
String get bank => _bank;
String get bankNumber => _bankNumber;
num get isDelete => _isDelete;
Map<String, dynamic> toJson() {
final map = <String, dynamic>{};
map['id'] = _id;
map['createTime'] = _createTime;
map['createUser'] = _createUser;
map['updateTime'] = _updateTime;
map['updateUser'] = _updateUser;
map['userId'] = _userId;
map['isDefault'] = _isDefault;
map['type'] = _type;
map['name'] = _name;
map['taxId'] = _taxId;
map['companyAddr'] = _companyAddr;
map['companyPhone'] = _companyPhone;
map['bank'] = _bank;
map['bankNumber'] = _bankNumber;
map['isDelete'] = _isDelete;
return map;
}
}

32
lib/retrofit/retrofit_api.dart

@ -19,7 +19,6 @@ import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:retrofit/retrofit.dart';
import '../login/captcha/click_word_captcha.dart';
import '../utils/flutter_utils.dart';
import 'data/achievement_detail_list.dart';
import 'data/activity_pos.dart';
import 'data/address.dart';
@ -41,6 +40,8 @@ import 'data/headlines_list.dart';
import 'data/headlines_list_details.dart';
import 'data/home_rank.dart';
import 'data/invitation_list.dart';
import 'data/invoice_list.dart';
import 'data/invoices_history_list.dart';
import 'data/ip_data.dart';
import 'data/logistics.dart';
import 'data/member_Infor.dart';
@ -54,6 +55,7 @@ import 'data/second_card_list.dart';
import 'data/sign_info.dart';
import 'data/social_info.dart';
import 'data/store.dart';
import 'data/title_info_list.dart';
import 'data/upload_result.dart';
import 'data/user_bill.dart';
import 'data/user_info.dart';
@ -611,4 +613,32 @@ abstract class ApiService {
///APP门店推广渠道
@GET("/ipJson.jsp")
Future<IpData> getIpInfo();
///
@POST("order/invoiceOrderList")
Future<BaseData<InvoiceList>> invoiceOrderList(@Body() Map<String, dynamic> param);
///
@POST("invoiceHeader")
Future<BaseData> invoiceHeader(@Body() Map<String, dynamic> param);
///
@PUT("invoiceHeader")
Future<BaseData> invoiceHeaders(@Body() Map<String, dynamic> param);
///
@POST("invoiceHeader/page")
Future<BaseData<TitleInfoList>> invoiceHeaderList(@Body() Map<String, dynamic> param);
///
@DELETE("invoiceHeader?ids[]={ids}")
Future<BaseData> delInvoiceHeader(@Path("ids") String ids);
///
@POST("invoice")
Future<BaseData> invoiceSubmit(@Body() Map<String, dynamic> param);
///
@POST("invoice/page")
Future<BaseData<InvoicesHistoryList>> invoicePage(@Body() Map<String, dynamic> param);
}

160
lib/retrofit/retrofit_api.g.dart

@ -2302,4 +2302,164 @@ class _ApiService implements ApiService {
.toList());
return value;
}
@override
Future<BaseData<InvoiceList>> invoiceOrderList(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'order/invoiceOrderList',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<InvoiceList>.fromJson(
_result.data,
(json) => (json ?? "") == "" ? null : InvoiceList.fromJson(json),
);
return value;
}
@override
Future<BaseData> invoiceHeader(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'invoiceHeader',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@override
Future<BaseData> invoiceHeaders(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'invoiceHeader',
queryParameters: queryParameters,
options: RequestOptions(
method: 'PUT',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@override
Future<BaseData<TitleInfoList>> invoiceHeaderList(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'invoiceHeader/page',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<TitleInfoList>.fromJson(
_result.data,
(json) => (json ?? "") == "" ? null : TitleInfoList.fromJson(json),
);
return value;
}
@override
Future<BaseData<dynamic>> delInvoiceHeader(ids) async {
ArgumentError.checkNotNull(ids, 'ids');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
final _result = await _dio.request<Map<String, dynamic>>(
'invoiceHeader?ids[]=$ids',
queryParameters: queryParameters,
options: RequestOptions(
method: 'DELETE',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<dynamic>.fromJson(
_result.data,
(json) => json as dynamic,
);
return value;
}
@override
Future<BaseData> invoiceSubmit(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'invoice',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData.fromJson(
_result.data,
(json) => (json ?? "") == "" ? null : json,
);
return value;
}
@override
Future<BaseData<InvoicesHistoryList>> invoicePage(param) async {
ArgumentError.checkNotNull(param, 'param');
const _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param ?? <String, dynamic>{});
final _result = await _dio.request<Map<String, dynamic>>(
'invoice/page',
queryParameters: queryParameters,
options: RequestOptions(
method: 'POST',
headers: <String, dynamic>{},
extra: _extra,
baseUrl: baseUrl),
data: _data);
final value = BaseData<InvoicesHistoryList>.fromJson(
_result.data,
(json) => (json ?? "") == "" ? null : InvoicesHistoryList.fromJson(json),
);
return value;
}
}

28
lib/utils/status_utils.dart

@ -89,6 +89,7 @@ class StatusUtils {
static List<Widget> statusBtn(
context,
payStatus,
payChannel,
orderStatus,
isTakeOut,
sendStatus,
@ -260,6 +261,33 @@ class StatusUtils {
SizedBox(
width: 10.w,
),
//
// if(payChannel == 0 || payChannel == 1 || payChannel == 2)
// Container(
// width: 72.w,
// height: 24.h,
// child: TextButton(
// onPressed: () {
// Navigator.of(context).pushNamed('/router/invoices_manage_page');
// },
// style: ButtonStyle(
// padding: MaterialStateProperty.all(EdgeInsets.zero),
// side: MaterialStateProperty.all(
// BorderSide(
// color: Color(0xff32A060),
// width: 0.5,
// ),
// ),
// ),
// child: Text(
// "开发票",
// style: TextStyle(
// color: Color(0xff32A060),
// fontSize: 12.sp,
// ),
// ),
// ),
// ),
];
}
}

Loading…
Cancel
Save