Browse Source

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

抬头信息页面ui绘制与交互,接口数据对接;
填写发票信息页面ui绘制与交互,接口数据对接;
我的页面新增发票助手;
订单列表因app订单原因,不单独显示开票选项;
开票管理接口数据对接,交互流程调试;
开票流程交互调试更改;
新增发票详情页面;
pdf显示处理,新增依赖(flutter_pdfview);
新增发票详情接口;
dart3
wurong 5 months ago
parent
commit
bf023f794a
  1. 1198
      lib/data/invoice_list.dart
  2. 1472
      lib/data/invoices_detail_info.dart
  3. 385
      lib/data/invoices_history_list.dart
  4. 286
      lib/data/title_info_list.dart
  5. 2
      lib/login/login_page.dart
  6. 15
      lib/main.dart
  7. 11
      lib/mine/mine_view/mine_item.dart
  8. 781
      lib/order/invoices_manage/add_invoices_title.dart
  9. 599
      lib/order/invoices_manage/edit_invoices_info.dart
  10. 820
      lib/order/invoices_manage/invoices_detail_page.dart
  11. 462
      lib/order/invoices_manage/invoices_history.dart
  12. 678
      lib/order/invoices_manage/invoices_manage_page.dart
  13. 577
      lib/order/invoices_manage/invoices_title_info.dart
  14. 195
      lib/order/invoices_manage/pdf_screen.dart
  15. 37
      lib/retrofit/retrofit_api.dart
  16. 222
      lib/retrofit/retrofit_api.g.dart
  17. 53
      lib/utils/status_utils.dart
  18. 8
      pubspec.lock
  19. 2
      pubspec.yaml

1198
lib/data/invoice_list.dart

File diff suppressed because one or more lines are too long

1472
lib/data/invoices_detail_info.dart

File diff suppressed because one or more lines are too long

385
lib/data/invoices_history_list.dart

File diff suppressed because one or more lines are too long

286
lib/data/title_info_list.dart

@ -0,0 +1,286 @@
/// records : [{"id":"1820725763083599872","createTime":"2024-08-06 15:37:04","createUser":"1379254113602109440","updateTime":"2024-08-06 15:37:04","updateUser":"1379254113602109440","userId":"1379254113602109440","isDefault":1,"type":"PERSONAL","name":"哈哈","taxId":"","companyAddr":"","companyPhone":"","bank":"","bankNumber":"","isDelete":0},{"id":"1818128371540819968","createTime":"2024-07-30 11:35:58","createUser":"1379254113602109440","updateTime":"2024-07-30 11:35:58","updateUser":"1379254113602109440","userId":"1379254113602109440","isDefault":1,"type":"COMPANY","name":"彗星","taxId":"123568986457","companyAddr":"","companyPhone":"","bank":"","bankNumber":"","isDelete":0}]
/// total : "2"
/// 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 : "1820725763083599872"
/// createTime : "2024-08-06 15:37:04"
/// createUser : "1379254113602109440"
/// updateTime : "2024-08-06 15:37:04"
/// updateUser : "1379254113602109440"
/// userId : "1379254113602109440"
/// isDefault : 1
/// type : "PERSONAL"
/// name : "哈哈"
/// taxId : ""
/// companyAddr : ""
/// companyPhone : ""
/// bank : ""
/// bankNumber : ""
/// 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,
String? 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;
String? _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,
String? 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;
String? 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;
}
}

2
lib/login/login_page.dart

@ -224,7 +224,7 @@ class _MyLoginPageState extends State<LoginPage> with TickerProviderStateMixin {
client?.sendVerify(
{"areaCode": areaCode, "mobile": mobile, "verification": ""})
.then((value) => {
if (value?.isSuccess ?? false)
if (value.isSuccess ?? false)
{_sendCodeStatus = 1, countdown()}
else
{

15
lib/main.dart

@ -130,6 +130,11 @@ 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_detail_page.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) {
@ -535,4 +540,14 @@ Map<String, WidgetBuilder> routers = <String, WidgetBuilder>{
UnionSelectCity(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),
'/router/invoices_detail_page': (context, {arguments}) =>
InvoicesDetailPage(arguments:arguments),
};

11
lib/mine/mine_view/mine_item.dart

@ -305,8 +305,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(),

781
lib/order/invoices_manage/add_invoices_title.dart

@ -3,70 +3,584 @@ 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 '../../data/base_data.dart';
import '../../data/title_info_list.dart';
import '../../generated/l10n.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?.isSuccess ?? false) {
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?.isSuccess ?? false) {
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(
return GestureDetector(
behavior: HitTestBehavior.translucent,
onTap: () {
FocusScope.of(context).unfocus();
},
child: Scaffold(
resizeToAvoidBottomInset: false,
appBar: MyAppBar(
title: "添加抬头",
title: titleName??"",
titleColor: Colors.black,
background: Colors.white,
leadingColor: Colors.black,
),
body:
// networkStatus == -1 ? noNetwork() :
Column(
body: Container(
color: Colors.white,
margin: EdgeInsets.only(top: 12.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"请填写抬头信息:",
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: 12.sp,
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(
margin: EdgeInsets.only(bottom:25.h,left:20.w,right: 20.w),
padding: EdgeInsets.symmetric(vertical:16.h),
width: double.infinity,
decoration: BoxDecoration(
color: Color(0xff32A060),
borderRadius: BorderRadius.circular(
45
),
),
alignment: Alignment.center,
child: Text(
S.of(context).baocun,
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
),
),
],
),
),
));
}
Widget invoicesOrderItemSm() {
return Container(
Widget addInvoiceTitleSm() {
return Column(
children: [
Expanded(
child: Container(
padding: EdgeInsets.only(top: 12, bottom: 12, left: 16),
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 6),
margin: EdgeInsets.only(top: 12.h),
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
@ -77,7 +591,6 @@ class _InvoicesManagePage extends State<InvoicesManagePage> {
spreadRadius: 0,
)
],
borderRadius: BorderRadius.circular(8),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
@ -91,11 +604,61 @@ class _InvoicesManagePage extends State<InvoicesManagePage> {
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 149,
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),
@ -106,7 +669,7 @@ class _InvoicesManagePage extends State<InvoicesManagePage> {
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 42,
width: 61,
height: 20,
),
),
@ -114,19 +677,181 @@ class _InvoicesManagePage extends State<InvoicesManagePage> {
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
margin: EdgeInsets.only(right: 8.h),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 60,
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,
),
),
],
);
}
}

599
lib/order/invoices_manage/edit_invoices_info.dart

@ -0,0 +1,599 @@
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 '../../data/base_data.dart';
import '../../generated/l10n.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?.isSuccess ?? false) {
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 as Map?;
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:16.h),
margin: EdgeInsets.only(bottom:25.h,left:20.w,right: 20.w),
decoration: BoxDecoration(
color: Color(0xff32A060),
borderRadius: BorderRadius.circular(
45
),
),
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,
),
),
],
),
),
],
);
}
}

820
lib/order/invoices_manage/invoices_detail_page.dart

@ -0,0 +1,820 @@
import 'dart:async';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/order/invoices_manage/pdf_screen.dart';
import 'package:path_provider/path_provider.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../community/photo_view_gallery_screen.dart';
import '../../data/base_data.dart';
import '../../data/invoices_detail_info.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';
class InvoicesDetailPage extends StatefulWidget {
final Map<String, dynamic>? arguments;
InvoicesDetailPage({this.arguments});
@override
State<StatefulWidget> createState() {
return _InvoicesDetailPage();
}
}
class _InvoicesDetailPage extends State<InvoicesDetailPage> {
ApiService? apiService;
InvoicesDetailInfo? invoicesDetailInfo;
String remotePDFpath = "";
String networkError = "";
int networkStatus = 0;
final RefreshController refreshController = RefreshController();
@override
void initState() {
super.initState();
SharedPreferences.getInstance().then((value) => {
apiService = ApiService(
Dio(),
context: context,
token: value.getString('token'),
),
queryInvoices("1797587255380934656"),
});
}
///
@override
void dispose() {
super.dispose();
refreshController.dispose();
}
///
queryInvoices(id) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<InvoicesDetailInfo>? baseData =
await apiService?.invoiceDetail(id).catchError((error) {
networkError = AppUtils.dioErrorTypeToString(error.type);
networkStatus = -1;
setState(() {});
refreshController.refreshFailed();
refreshController.loadFailed();
});
if (baseData?.isSuccess ?? false) {
invoicesDetailInfo = baseData?.data;
createFileOfPdfUrl().then((f) {
setState(() {
remotePDFpath = f.path;
});
});
refreshController.refreshCompleted();
networkStatus = 1;
setState(() {});
} else {
refreshController.refreshFailed();
refreshController.loadFailed();
SmartDialog.showToast("${baseData?.msg}", alignment: Alignment.center);
}
}
/// PDF
Future<File> createFileOfPdfUrl() async {
Completer<File> completer = Completer();
print("Start download file from internet!");
try {
final url = invoicesDetailInfo?.ossUrl ?? "";
final filename = url.substring(url.lastIndexOf("/") + 1);
var request = await HttpClient().getUrl(Uri.parse(url));
var response = await request.close();
var bytes = await consolidateHttpClientResponseBytes(response);
var dir = await getApplicationDocumentsDirectory();
print("Download files");
print("${dir.path}/$filename");
File file = File("${dir.path}/$filename");
await file.writeAsBytes(bytes, flush: true);
completer.complete(file);
} catch (e) {
throw Exception('Error parsing asset file!');
}
return completer.future;
}
@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()
: (networkStatus == 0
? invoicesSm()
: SmartRefresher(
controller: refreshController,
enablePullDown: true,
header: MyHeader(),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
onRefresh: () {
queryInvoices(widget.arguments?["id"] ?? "");
},
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
margin: EdgeInsets.only(top: 12.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 17.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: EdgeInsets.symmetric(
vertical: 16.h, horizontal: 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: [
Expanded(
child: Text(
"发票状态",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
Text(
invoicesState(
invoicesDetailInfo?.state ??
""),
style: TextStyle(
color: Color(0xFF32A060),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: 18.h),
child: Row(
children: [
Expanded(
child: Text(
"发票抬头",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
Expanded(
child: Text(
invoicesDetailInfo
?.invoiceHeaderName ??
"",
maxLines: 1,
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.end,
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: 18.h),
child: Row(
children: [
Expanded(
child: Text(
"申请时间",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
Text(
invoicesDetailInfo?.reviewerTime ??
"",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
),
),
Row(
children: [
Expanded(
child: Text(
"开票金额",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
)),
Text(
invoicesDetailInfo?.money ?? "",
style: TextStyle(
color: Color(0xFF1A1A1A),
fontSize: 14.sp,
fontWeight: MyFontWeight.regular,
),
),
],
)
],
),
),
GestureDetector(
onTap: () {
if ((invoicesDetailInfo?.ossUrl ?? "")
.endsWith("pdf")) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PDFScreen(
path: remotePDFpath,
inlet: 0,
),
),
);
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PhotoViewGalleryScreen(
images: [
invoicesDetailInfo?.ossUrl ?? ""
], //list
index: 0, //index
),
));
}
},
child: 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(
"1张发票,含${invoicesDetailInfo?.orderList?.length ?? 0}个订单",
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,
),
),
),
Icon(Icons.arrow_forward_ios,
color: Color(0xFF181818), size: 14.sp)
],
),
),
),
],
),
)),
Row(
children: [
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if ((invoicesDetailInfo?.ossUrl ?? "")
.endsWith("pdf")) {
showPdfAlertDialog();
} else {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
PhotoViewGalleryScreen(
images: [
invoicesDetailInfo?.ossUrl ?? ""
], //list
index: 0, //index
),
));
}
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 16.h),
margin: EdgeInsets.only(
bottom: 34.h, right: 9.5.w, left: 14.w),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(45),
border: Border.all(
color: Color(0xff32A060),
width: 1.w,
),
),
width: double.infinity,
alignment: Alignment.center,
child: Text(
"查看电子发票",
style: TextStyle(
color: Color(0xff32A060),
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
),
)),
Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
launchBrowser();
},
child: Container(
padding: EdgeInsets.symmetric(vertical: 16.h),
margin: EdgeInsets.only(
bottom: 34.h, left: 9.5.w, right: 14.w),
decoration: BoxDecoration(
color: Color(0xff32A060),
borderRadius: BorderRadius.circular(45),
),
width: double.infinity,
alignment: Alignment.center,
child: Text(
"下载电子发票",
style: TextStyle(
color: Colors.white,
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
),
),
),
)),
],
)
],
),
),
)),
);
}
///
String invoicesState(state) {
if (state == "UN_AUDIT") {
return "待审核";
} else if (state == "AUDIT_PASS") {
return "开票成功";
} else if (state == "AUDIT_VOID") {
return "已作废";
} else if (state == "AUDIT_FAIL") {
return "开票失败";
} else {
return "";
}
}
///
showPdfAlertDialog() {
//
showDialog(
context: context,
builder: (BuildContext context) {
return PDFScreen(path: remotePDFpath, inlet: 1);
},
);
}
///
launchBrowser() async {
String url = invoicesDetailInfo?.ossUrl ?? "";
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
Widget invoicesSm() {
return Container(
margin: EdgeInsets.only(top: 12.h),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 17.w),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding:
EdgeInsets.symmetric(vertical: 16.h, horizontal: 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(
margin: EdgeInsets.only(right: 10),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 90.w,
height: 20.h,
),
),
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: 10),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 58.w,
height: 20.h,
),
),
Spacer(),
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: 58.w,
height: 20.h,
),
),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: 18.h),
child: 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: 58.w,
height: 20.h,
),
),
Spacer(),
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: 58.w,
height: 20.h,
),
),
],
),
),
Padding(
padding: EdgeInsets.only(bottom: 18.h),
child: 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: 58.w,
height: 20.h,
),
),
Spacer(),
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: 58.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: 58.w,
height: 20.h,
),
),
Spacer(),
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: 58.w,
height: 20.h,
),
),
],
)
],
),
),
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(
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: 124.w,
height: 20.h,
),
),
Spacer(),
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: 28.w,
height: 20.h,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(2),
),
width: 18.w,
height: 20.h,
),
),
],
),
),
],
),
)),
Row(
children: [
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
// padding: EdgeInsets.symmetric(vertical: 16.h),
margin:
EdgeInsets.only(bottom: 34.h, right: 9.5.w, left: 14.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(45),
),
width: 164.w,
height: 48.h,
),
),
Shimmer.fromColors(
baseColor: Color(0XFFD8D8D8),
highlightColor: Color(0XFFD8D8D8),
child: Container(
// padding: EdgeInsets.symmetric(vertical: 16.h),
margin:
EdgeInsets.only(bottom: 34.h, right: 9.5.w, left: 14.w),
decoration: BoxDecoration(
color: Color(0XFFD8D8D8),
borderRadius: BorderRadius.circular(45),
),
width: 164.w,
height: 48.h,
),
),
],
),
],
),
);
}
Widget noNetwork() {
return Container(
width: double.infinity,
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: () {
queryInvoices(widget.arguments?["id"] ?? "");
},
child: Container(
decoration: BoxDecoration(
color: Color(0xff32A060),
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),
)),
)
],
),
);
}
}

462
lib/order/invoices_manage/invoices_history.dart

@ -0,0 +1,462 @@
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:huixiang/data/invoices_history_list.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:shimmer/shimmer.dart';
import '../../data/base_data.dart';
import '../../generated/l10n.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?.isSuccess ?? false) {
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];
}
});
if(_map.isNotEmpty)
_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/ding_dan.webp",
isShowBtn: false,
text: "暂无开票记录",
fontSize: 16,
margin: EdgeInsets.only(top: 120,left: 20,right: 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: () {
// if(records[position].state == "AUDIT_PASS")
Navigator.of(context)
.pushNamed('/router/invoices_detail_page',arguments: {
"id":records[position].id ?? ""
});
},
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 "开票失败";
}else {
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(
width: double.infinity,
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(0xff32A060),
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),
)),
)
],
),
);
}
}

678
lib/order/invoices_manage/invoices_manage_page.dart

@ -0,0 +1,678 @@
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 '../../data/base_data.dart';
import '../../data/invoice_list.dart';
import '../../generated/l10n.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?.isSuccess ?? false) {
records.addAll(baseData?.data?.records ?? []);
baseData?.data?.records?.forEach((element) {
if ((double.tryParse(element.payedPrice ?? "")??0) > 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) > 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) > 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) =>
((double.tryParse(previousValue.toString()) ?? 0.0) + (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(0xff32A060),
borderRadius: BorderRadius.circular(15),
),
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 3),
child: Text(
"重试",
style: TextStyle(
fontSize: 14,
color: Colors.white,
fontWeight: MyFontWeight.regular,
),
),
),
),
],
),
);
}
}

577
lib/order/invoices_manage/invoices_title_info.dart

@ -0,0 +1,577 @@
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 '../../data/base_data.dart';
import '../../data/title_info_list.dart';
import '../../generated/l10n.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?.isSuccess ?? false) {
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?.isSuccess ??false) {
await editOnRefresh();
Future.delayed(Duration(milliseconds: 500), () {
SmartDialog.showToast("删除信息成功", alignment: Alignment.center);
});
networkStatus = 1;
} 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:16.h),
margin: EdgeInsets.only(bottom:25.h,left:20.w,right: 20.w),
decoration: BoxDecoration(
color: Color(0xff32A060),
borderRadius: BorderRadius.circular(
45
),
),
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,
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(0xff32A060),
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,
),
],
)
],
),
),
);
},
);
}
}

195
lib/order/invoices_manage/pdf_screen.dart

@ -0,0 +1,195 @@
import 'dart:async';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_pdfview/flutter_pdfview.dart';
class PDFScreen extends StatefulWidget {
final String? path;
final int? inlet;
PDFScreen({Key? key,this.path,this.inlet}) : super(key: key);
_PDFScreenState createState() => _PDFScreenState();
}
class _PDFScreenState extends State<PDFScreen> with WidgetsBindingObserver {
final Completer<PDFViewController> _controller =
Completer<PDFViewController>();
int pages = 0;
int currentPage = 0;
int pageTotal = 0;
bool isReady = false;
String errorMessage = '';
@override
Widget build(BuildContext context) {
return widget.inlet == 1
? Material(
type: MaterialType.transparency,
child: Stack(
children: <Widget>[
Center(
child: Container(
height: 250,
decoration: BoxDecoration(
color: Colors.white,
),
child: PDFView(
filePath: widget.path,
enableSwipe: true,
swipeHorizontal: true,
autoSpacing: false,
pageFling: true,
pageSnap: true,
defaultPage: currentPage,
fitPolicy: FitPolicy.BOTH,
preventLinkNavigation: false,
// if set to true the link is handled in flutter
onRender: (_pages) {
setState(() {
pages = _pages ?? 0;
isReady = true;
});
},
onError: (error) {
setState(() {
errorMessage = error.toString();
});
print(error.toString());
},
onPageError: (page, error) {
setState(() {
errorMessage = '$page: ${error.toString()}';
});
print('$page: ${error.toString()}');
},
onViewCreated: (PDFViewController pdfViewController) {
_controller.complete(pdfViewController);
},
onLinkHandler: (String? uri) {
print('goto uri: $uri');
},
onPageChanged: (int? page, int? total) {
if ((total??0) > 0) {
print('page change: $page/$total');
setState(() {
currentPage = page ?? 0;
pageTotal = total ??0;
});
} else {
pageTotal = 1;
}
},
),
),
),
errorMessage.isEmpty
? !isReady
? Center(
child: CircularProgressIndicator(),
)
: Container()
: Center(
child: Text(errorMessage),
),
//pdfindex显示
Positioned(
width: MediaQuery.of(context).size.width,
bottom: 45,
child: Center(
child: Text("${currentPage + 1}/${(pageTotal > 0)?pageTotal:1}",
style: TextStyle(color: Colors.white, fontSize: 16)),
),
),
],
),
)
: Scaffold(
body: Stack(
children: <Widget>[
PDFView(
filePath: widget.path,
enableSwipe: true,
swipeHorizontal: true,
autoSpacing: false,
pageFling: true,
pageSnap: true,
defaultPage: currentPage,
fitPolicy: FitPolicy.BOTH,
preventLinkNavigation: false,
// if set to true the link is handled in flutter
onRender: (_pages) {
setState(() {
pages = _pages ?? 0;
isReady = true;
});
},
onError: (error) {
setState(() {
errorMessage = error.toString();
});
print(error.toString());
},
onPageError: (page, error) {
setState(() {
errorMessage = '$page: ${error.toString()}';
});
print('$page: ${error.toString()}');
},
onViewCreated: (PDFViewController pdfViewController) {
_controller.complete(pdfViewController);
},
onLinkHandler: (String? uri) {
print('goto uri: $uri');
},
onPageChanged: (int? page, int? total) {
if ((total ?? 0) > 0) {
print('page change: $page/$total');
setState(() {
currentPage = page ??0;
pageTotal = total ??0;
});
} else {
pageTotal = 1;
}
},
),
errorMessage.isEmpty
? !isReady
? Center(
child: CircularProgressIndicator(),
)
: Container()
: Center(
child: Text(errorMessage),
),
//pdfindex显示
Positioned(
bottom: 45,
width: MediaQuery.of(context).size.width,
child: Center(
child: Text("${currentPage + 1}/${(pageTotal > 0)?pageTotal:1}",
style: TextStyle(color: Colors.black, fontSize: 16)),
),
),
Positioned(
//
right: 10,
top: MediaQuery.of(context).padding.top,
child: IconButton(
icon: Icon(
Icons.close,
size: 30,
color: Colors.black,
),
onPressed: () {
Navigator.of(context).pop();
},
),
),
],
),
);
}
}

37
lib/retrofit/retrofit_api.dart

@ -62,6 +62,11 @@ import 'package:huixiang/view_widget/login_tips_dialog.dart';
import 'package:retrofit/retrofit.dart';
import 'package:huixiang/login/captcha/click_word_captcha.dart';
import '../data/invoice_list.dart';
import '../data/invoices_detail_info.dart';
import '../data/invoices_history_list.dart';
import '../data/title_info_list.dart';
part 'retrofit_api.g.dart';
const localBaseUrl = "http://192.168.10.54:8766/app/";///
@ -603,4 +608,36 @@ 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);
///
@GET("invoice/detail{id}")
Future<BaseData<InvoicesDetailInfo>> invoiceDetail(@Path("id") String id);
}

222
lib/retrofit/retrofit_api.g.dart

@ -2808,6 +2808,228 @@ class _ApiService implements ApiService {
return value;
}
@override
Future<BaseData<InvoiceList>> invoiceOrderList(Map<String, dynamic> param) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param);
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<BaseData<InvoiceList>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'order/invoiceOrderList',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final value = BaseData<InvoiceList>.fromJson(_result.data!);
return value;
}
@override
Future<BaseData<dynamic>> invoiceHeader(Map<String, dynamic> param) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param);
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<BaseData<dynamic>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'invoiceHeader',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final value = BaseData<dynamic>.fromJson(_result.data!);
return value;
}
@override
Future<BaseData<dynamic>> invoiceHeaders(Map<String, dynamic> param) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param);
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<BaseData<dynamic>>(Options(
method: 'PUT',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'invoiceHeader',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final value = BaseData<dynamic>.fromJson(_result.data!);
return value;
}
@override
Future<BaseData<TitleInfoList>> invoiceHeaderList(Map<String, dynamic> param) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param);
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<BaseData<TitleInfoList>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'invoiceHeader/page',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final value = BaseData<TitleInfoList>.fromJson(_result.data!);
return value;
}
@override
Future<BaseData<dynamic>> delInvoiceHeader(String ids) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<BaseData<dynamic>>(Options(
method: 'DELETE',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'invoiceHeader?ids[]=$ids',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final value = BaseData<dynamic>.fromJson(_result.data!);
return value;
}
@override
Future<BaseData<dynamic>> invoiceSubmit(Map<String, dynamic> param) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param);
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<BaseData<dynamic>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'invoice',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final value = BaseData<dynamic>.fromJson(_result.data!);
return value;
}
@override
Future<BaseData<InvoicesHistoryList>> invoicePage(Map<String, dynamic> param) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
final _data = <String, dynamic>{};
_data.addAll(param);
final _result = await _dio
.fetch<Map<String, dynamic>>(_setStreamType<BaseData<InvoicesHistoryList>>(Options(
method: 'POST',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'invoiceHeader/page',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final value = BaseData<InvoicesHistoryList>.fromJson(_result.data!);
return value;
}
@override
Future<BaseData<InvoicesDetailInfo>> invoiceDetail(String id) async {
final _extra = <String, dynamic>{};
final queryParameters = <String, dynamic>{};
final _headers = <String, dynamic>{};
const Map<String, dynamic>? _data = null;
final _result = await _dio.fetch<Map<String, dynamic>>(
_setStreamType<BaseData<VipCardHome>>(Options(
method: 'GET',
headers: _headers,
extra: _extra,
)
.compose(
_dio.options,
'invoice/detail${id}',
queryParameters: queryParameters,
data: _data,
)
.copyWith(
baseUrl: _combineBaseUrls(
_dio.options.baseUrl,
baseUrl,
))));
final value = BaseData<InvoicesDetailInfo>.fromJson(_result.data!);
return value;
}
RequestOptions _setStreamType<T>(RequestOptions requestOptions) {
if (T != dynamic &&
!(requestOptions.responseType == ResponseType.bytes ||

53
lib/utils/status_utils.dart

@ -259,32 +259,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,
),
),
),
),
///
// 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,
// ),
// ),
// ),
// ),
];
}
}

8
pubspec.lock

@ -427,6 +427,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_pdfview:
dependency: "direct main"
description:
name: flutter_pdfview
sha256: a9055bf920c7095bf08c2781db431ba23577aa5da5a056a7152dc89a18fbec6f
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.2"
flutter_screenutil:
dependency: "direct main"
description:

2
pubspec.yaml

@ -60,6 +60,8 @@ dependencies:
geolocator: ^7.0.0
# location: ^3.2.4
flutter_pdfview: ^1.3.2
dio: ^5.4.1
rxdart: ^0.27.07
retrofit: ^4.1.0

Loading…
Cancel
Save