营收和订单联调

This commit is contained in:
cuiyouliang 2025-09-11 16:42:35 +08:00
parent d61b852883
commit 3c62495efb
9 changed files with 1121 additions and 485 deletions

BIN
assets/images/income_bg.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 178 KiB

View File

@ -27,4 +27,13 @@ class ShopApi {
// //
static const String cancelGoodsOrder= '/app/order/cancel'; static const String cancelGoodsOrder= '/app/order/cancel';
// app端我的订单
static const String myOrderList= '/oms/order/list';
//
static const String revenueInfo= '/app/merchant/account/statistic';
//
static const String revenueList= '/app/merchant/account/bill/page';
} }

View File

@ -0,0 +1,219 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:get/get.dart';
class AllFunctionsPage extends StatefulWidget {
const AllFunctionsPage({super.key});
@override
State<AllFunctionsPage> createState() => _AllFunctionsPageState();
}
class _AllFunctionsPageState extends State<AllFunctionsPage> {
// - ID
final List<Map<String, dynamic>> functionList = [
{
'title': '主页展示',
'items': [
{'id': 'home_order', 'icon': 'assets/images/ico_order.png', 'label': '订单'},
{'id': 'home_balance', 'icon': 'assets/images/ico_dhx.png', 'label': '余额logout'},
{'id': 'home_withdraw', 'icon': 'assets/images/ico_sh.png', 'label': '提现vloger'},
{'id': 'home_promo', 'icon': 'assets/images/ico_tgm.png', 'label': '推广码'},
]
},
{
'title': '更多功能',
'items': [
{'id': 'more_seller_order', 'icon': 'assets/images/ico_order.png', 'label': '商家订单'},
{'id': 'more_seller_income', 'icon': 'assets/images/ico_sh.png', 'label': '商家营收'},
]
},
];
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFF0F0F0F),
appBar: AppBar(
backgroundColor: const Color(0xFF1A1A1A),
elevation: 0,
centerTitle: true,
title: const Text(
'全部功能',
style: TextStyle(
color: Colors.white,
fontSize: 14,
fontWeight: FontWeight.w600,
),
),
leading: IconButton(
icon: const Icon(Icons.arrow_back, color: Colors.white),
onPressed: () => Navigator.pop(context),
),
),
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color(0xFF1A1A1A),
Color(0xFF0F0F0F),
],
),
),
child: ListView.builder(
padding: const EdgeInsets.symmetric(vertical: 12),
itemCount: functionList.length,
itemBuilder: (context, sectionIndex) {
final section = functionList[sectionIndex];
return _buildSection(section);
},
),
),
);
}
Widget _buildSection(Map<String, dynamic> section) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
//
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
child: Text(
section['title'],
style: const TextStyle(
fontSize: 12,
fontWeight: FontWeight.w600,
color: Colors.white70,
),
),
),
//
GridView.builder(
physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true,
padding: const EdgeInsets.symmetric(horizontal: 16),
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 4,
crossAxisSpacing: 12,
mainAxisSpacing: 16,
childAspectRatio: 0.85,
),
itemCount: (section['items'] as List).length,
itemBuilder: (context, index) {
final item = (section['items'] as List)[index];
return _buildFunctionItem(item);
},
),
// 线 - section时显示
if (functionList.indexOf(section) != functionList.length - 1)
Container(
height: 2,
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 20),
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color.fromRGBO(128, 128, 128, 0.3),
Color.fromRGBO(158, 158, 158, 0.1),
Color.fromRGBO(128, 128, 128, 0.3),
],
),
),
),
],
);
}
Widget _buildFunctionItem(Map<String, dynamic> item) {
return GestureDetector(
onTap: () {
_handleFunctionTap(item['id']);
},
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: 36,
height: 36,
child: Center(
child: Image.asset(
item['icon'],
width: 26,
height: 26,
color: Colors.white,
),
),
),
const SizedBox(height: 4),
//
Padding(
padding: const EdgeInsets.symmetric(horizontal: 1),
child: Text(
item['label'],
style: const TextStyle(
fontSize: 11,
color: Colors.white70,
fontWeight: FontWeight.w500,
),
textAlign: TextAlign.center,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
],
),
);
}
void _handleFunctionTap(String functionId) {
switch (functionId) {
case 'home_order':
Get.toNamed('/sellerOrder');
break;
case 'home_balance':
showLogoutDialog(context);
break;
case 'home_withdraw':
Get.toNamed('/vloger');
break;
case 'home_promo':
break;
case 'more_seller_order':
break;
case 'more_seller_income':
Get.toNamed('/merchant/income');
break;
}
}
// 退
void showLogoutDialog(BuildContext context) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: const Text('确认退出当前账号吗?', style: TextStyle(fontSize: 16.0)),
backgroundColor: Colors.white,
surfaceTintColor: Colors.white,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15.0)),
elevation: 2.0,
actionsPadding: const EdgeInsets.all(15.0),
actions: [
TextButton(
onPressed: () {
Get.back();
},
child: const Text('取消', style: TextStyle(color: Colors.black54)),
),
TextButton(onPressed: ()=>{}, child: const Text('退出登录', style: TextStyle(color: Colors.red))),
],
);
},
);
}
}

View File

@ -846,7 +846,9 @@ class MyPageState extends State<MyPage> with SingleTickerProviderStateMixin {
], ],
), ),
), ),
onTap: () {}, onTap: () {
Get.toNamed('/functions');
},
), ),
Padding( Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),

View File

@ -0,0 +1,465 @@
import 'package:flutter/material.dart';
import 'package:loopin/api/shop_api.dart';
import 'package:loopin/service/http.dart';
import '../../../behavior/custom_scroll_behavior.dart';
class SellerRevenue extends StatefulWidget {
const SellerRevenue({super.key});
@override
State<SellerRevenue> createState() => _SellerRevenueState();
}
class _SellerRevenueState extends State<SellerRevenue> {
//
int pageNum = 1;
final int pageSize = 10;
bool isLoadingMore = false;
bool isRefreshing = false;
List<Map<String, dynamic>> revenueList = [];
int totalRecords = 0; //
//
double totalRevenue = 1000.00;
double pendingCount = 17;
double settledCount = 30;
late ScrollController scrollController = ScrollController();
@override
void initState() {
super.initState();
//
scrollController.addListener(_scrollListener);
//
getRevenueInfo();
//
getRevenueList(false);
}
@override
void dispose() {
scrollController.removeListener(_scrollListener);
scrollController.dispose();
super.dispose();
}
//
void _scrollListener() {
if (scrollController.position.pixels >=
scrollController.position.maxScrollExtent - 50 && //
!isLoadingMore &&
!isRefreshing &&
revenueList.isNotEmpty &&
revenueList.length < totalRecords) { //
getRevenueList(true);
}
}
//
void getRevenueInfo() async {
try {
final res = await Http.post(ShopApi.revenueList, data: {});
if (res['code'] == 200 && res['data'] != null) {
final data = res['data'];
totalRevenue = data['moneyIn'] ?? 0.00;
pendingCount = data['credited']?? 0.00;
settledCount = data['pending'] ?? 0.00;
}
} catch (e) {
print('获取营收摘要: $e');
}
}
//
void getRevenueList(bool loadMore) async {
if (isLoadingMore || isRefreshing) return;
setState(() {
if (!loadMore) {
pageNum = 1; //
isRefreshing = true;
revenueList = [];
totalRecords = 0; //
} else {
isLoadingMore = true;
}
});
try {
final res = await Http.post(ShopApi.revenueList, data: {
'current': pageNum, //
'size': pageSize,
});
if (res['code'] == 200 && res['data'] != null) {
final data = res['data'];
final List<Map<String, dynamic>> newRevenues = List<Map<String, dynamic>>.from(data['records'] ?? []);
final int total = data['total'];
debugPrint(data.toString(), wrapWidth: 1024);
setState(() {
if (loadMore) {
revenueList.addAll(newRevenues);
} else {
revenueList = newRevenues;
}
totalRecords = total;
if (newRevenues.isNotEmpty && revenueList.length < total) {
pageNum++; //
isLoadingMore = false; //
} else {
isLoadingMore = false; //
}
isRefreshing = false;
});
}
} catch (e) {
print('获取营收列表失败: $e');
setState(() {
isLoadingMore = false;
isRefreshing = false;
});
}
}
//
void _refreshData() {
setState(() {
pageNum = 1;
isLoadingMore = false;
totalRecords = 0;
});
getRevenueList(false);
}
//
Widget _buildRevenueItem(Map<String, dynamic> revenue) {
return Container(
margin: EdgeInsets.only(bottom: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
//
Expanded(
flex: 1,
child: Text(
revenue['changeDesc']??'未知',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w500,
color: Colors.black,
),
overflow: TextOverflow.ellipsis,
),
),
//
Expanded(
flex: 1,
child: Text(
'${revenue['changeType'] == '1' ? '+' : '-'}${revenue['changeAmount']}',
style: TextStyle(
fontSize: 14,
color: revenue['changeType'] == '1' ? Colors.red : Colors.green,
),
overflow: TextOverflow.ellipsis,
textAlign: TextAlign.center,
),
),
//
Expanded(
flex: 1,
child: Text(
revenue['createTime'] ?? '日期',
style: TextStyle(
fontSize: 12,
color: Colors.black,
),
textAlign: TextAlign.right,
),
),
],
),
);
}
//
Widget _buildRevenuePanel() {
return Container(
margin: EdgeInsets.symmetric(horizontal: 12.0),
padding: EdgeInsets.all(20),
decoration: BoxDecoration(
color: Color(0xFF4477FC),
borderRadius: BorderRadius.circular(6),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(15),
blurRadius: 10,
offset: Offset(0, 2),
),
],
),
child: Column(
children: [
//
Text(
'总入账',
style: TextStyle(
fontSize: 14,
color: Colors.white,
),
),
SizedBox(height: 8),
Text(
'¥$totalRevenue',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
SizedBox(height: 20),
//
Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Column(
children: [
Text(
'待入账',
style: TextStyle(
fontSize: 14,
color: Colors.white,
),
),
SizedBox(height: 4),
Text(
'$pendingCount',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
],
),
Container(
width: 1,
height: 30,
color: Colors.white,
),
Column(
children: [
Text(
'已入账',
style: TextStyle(
fontSize: 14,
color: Colors.white,
),
),
SizedBox(height: 4),
Text(
'$settledCount',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white,
),
),
],
),
],
),
],
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor:Color(0xFFF8F8F8),
body: Stack(
children: [
// -
Positioned.fill(
child: Image.asset(
'assets/images/income_bg.png',
fit: BoxFit.contain,
alignment: Alignment.topCenter,
),
),
//
Column(
children: [
// AppBar区域
Container(
height: kToolbarHeight + MediaQuery.of(context).padding.top,
child: AppBar(
title: Text(
'商家营收',
style: TextStyle(
fontSize: 18,
color: Colors.white,
),
),
centerTitle: true,
backgroundColor: Colors.transparent,
elevation: 0,
iconTheme: IconThemeData(color: Colors.white),
),
),
//
SizedBox(height: 10),
_buildRevenuePanel(),
SizedBox(height: 10),
//
Expanded(
child: Container(
color: Colors.white,
margin: EdgeInsets.symmetric(horizontal: 12.0),
child: Column(
children: [
//
Container(
padding: EdgeInsets.only(
left: 12.0,
right: 12.0,
top: 10.0,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(
flex: 1,
child: Text(
'来源',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
),
Expanded(
flex: 1,
child: Text(
'流水明细',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
textAlign: TextAlign.center,
),
),
Expanded(
flex: 1,
child: Text(
'流水日期',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black,
),
textAlign: TextAlign.right,
),
),
],
),
),
SizedBox(height: 10),
//
Expanded(
child: Container(
margin: EdgeInsets.symmetric(horizontal: 12.0),
child: RefreshIndicator(
onRefresh: () async {
_refreshData();
},
child: ScrollConfiguration(
behavior: CustomScrollBehavior().copyWith(scrollbars: false),
child: revenueList.isEmpty && !isRefreshing
? emptyTip()
: Container(
child: ListView.builder(
padding: EdgeInsets.zero,
controller: scrollController,
physics: AlwaysScrollableScrollPhysics(),
itemCount: revenueList.length + (isLoadingMore ? 1 : 0),
itemBuilder: (context, index) {
if (index == revenueList.length) {
return _buildLoadMoreIndicator();
}
return _buildRevenueItem(revenueList[index]);
},
),
),
),
),
),
),
],
),
),
),
],
),
],
),
);
}
//
Widget _buildLoadMoreIndicator() {
return Padding(
padding: EdgeInsets.symmetric(vertical: 15.0),
child: Center(
child: isLoadingMore
? Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(strokeWidth: 2),
),
SizedBox(width: 10),
Text('加载中...', style: TextStyle(color: Colors.grey)),
],
)
: revenueList.length >= totalRecords
? Text('没有更多数据了', style: TextStyle(color: Colors.grey))
: SizedBox(), //
),
);
}
Widget emptyTip() {
return Container(
width: double.infinity,
padding: EdgeInsets.all(12.0),
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/images/empty.png',
width: 100.0,
errorBuilder: (context, error, stackTrace) {
return Icon(Icons.receipt_long, size: 60, color: Colors.grey);
},
),
SizedBox(height: 10),
Text(
'还没有营收记录~',
style: TextStyle(color: Colors.grey, fontSize: 12.0),
)
],
),
);
}
}

View File

View File

@ -3,6 +3,8 @@ library;
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:loopin/api/shop_api.dart';
import 'package:loopin/service/http.dart';
import '../../behavior/custom_scroll_behavior.dart'; import '../../behavior/custom_scroll_behavior.dart';
@ -15,47 +17,379 @@ class Seller extends StatefulWidget {
class _SellerState extends State<Seller> with SingleTickerProviderStateMixin { class _SellerState extends State<Seller> with SingleTickerProviderStateMixin {
GlobalKey<ScaffoldState> scaffoldKey = GlobalKey(); GlobalKey<ScaffoldState> scaffoldKey = GlobalKey();
//
int pageNum = 1;
final int pageSize = 10;
bool isLoadingMore = false;
bool isRefreshing = false;
List<Map<String, dynamic>> pageOrderList = [];
List tabList = [ List tabList = [
{'name': "全部"}, {'id': 0, 'name': "全部"}, // 0
{'name': "已退款", 'badge': 1}, {'id': 4, 'name': "已退款", 'badge': 1}, // 4退
{'name': "待核销", 'badge': 1}, {'id': 2, 'name': "待核销", 'badge': 1}, // 2
{'name': "已完成"}, {'id': 3, 'name': "已完成"}, // 3
{'name': "取消"} {'id': 5, 'name': "取消"} // 5
]; ];
late ScrollController scrollController = ScrollController(); late ScrollController scrollController = ScrollController();
late TabController tabController = TabController(initialIndex: 0, length: tabList.length, vsync: this); late TabController tabController = TabController(initialIndex: 0, length: tabList.length, vsync: this);
Widget emptyTip() {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
spacing: 5.0,
children: [
Image.asset(
'assets/images/empty.png',
width: 100.0,
),
Text(
'还没有相关订单~',
style: TextStyle(color: Colors.grey, fontSize: 12.0),
)
],
);
}
@override @override
void initState() { void initState() {
super.initState(); super.initState();
//
scrollController.addListener(_scrollListener);
// tab切换事件
tabController.addListener(_tabChanged);
//
getOrderList(false);
} }
@override @override
void dispose() { void dispose() {
scrollController.removeListener(_scrollListener);
scrollController.dispose(); scrollController.dispose();
tabController.removeListener(_tabChanged);
tabController.dispose(); tabController.dispose();
super.dispose(); super.dispose();
} }
//
void _scrollListener() {
if (scrollController.position.pixels == scrollController.position.maxScrollExtent && !isLoadingMore) {
getOrderList(true);
}
}
// Tab切换监听
void _tabChanged() {
if (tabController.indexIsChanging) {
// tab时重新加载数据
getOrderList(false);
}
}
//
void getOrderList(bool loadMore) async {
if (isLoadingMore || isRefreshing) return;
setState(() {
if (!loadMore) {
pageNum = 1; //
isRefreshing = true;
pageOrderList = [];
} else {
isLoadingMore = true;
}
});
try {
final currentTab = tabList[tabController.index];
final status = currentTab['id'];
final res = await Http.post(ShopApi.myOrderList, data: {
'current': pageNum, //
'size': pageSize,
// 'orderStatus': status == 0 ? '' : status.toString(), // 0
});
if (res['code'] == 200 && res['data'] != null) {
final data = res['data'];
final List<Map<String, dynamic>> newOrders = List<Map<String, dynamic>>.from(data['records'] ?? []);
final int total = data['total'] ?? 0;
final int currentPage = data['current'] ?? 1;
final int pages = data['pages'] ?? 1;
setState(() {
if (loadMore) {
pageOrderList.addAll(newOrders);
} else {
pageOrderList = newOrders;
}
//
if (newOrders.isNotEmpty && currentPage < pages) {
pageNum = currentPage + 1; //
isLoadingMore = true;
} else {
isLoadingMore = false; //
}
});
}
} catch (e) {
print('获取订单列表失败: $e');
setState(() {
isLoadingMore = false;
});
} finally {
setState(() {
isRefreshing = false;
});
}
}
//
void _refreshData() {
setState(() {
pageNum = 1;
isLoadingMore = false;
});
getOrderList(false);
}
// Widget
Widget _buildOrderItem(Map<String, dynamic> order) {
return GestureDetector(
child: Container(
margin: EdgeInsets.only(bottom: 10.0),
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(15.0),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0.0, 1.0),
blurRadius: 1.0,
spreadRadius: 0.0,
),
],
),
child: Column(
children: [
Row(
children: [
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 5.0,
children: [
ClipOval(
child: Image.asset(
'assets/images/avatar/img11.jpg',
width: 25.0,
),
),
Text(order['shopName'] ?? '商家名称'),
Icon(
Icons.arrow_forward_ios_rounded,
color: Colors.grey,
size: 12.0,
),
],
),
Spacer(),
Text(
_getStatusText(order['status']),
style: TextStyle(color: _getStatusColor(order['status'])),
)
],
),
SizedBox(height: 10),
//
if (order['items'] != null && order['items'].isNotEmpty)
...order['items'].map<Widget>((item) => Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: 80.0,
height: 80.0,
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(4.0),
),
child: item['image'] != null && item['image'].isNotEmpty
? Image.network(
item['image'],
width: 80.0,
height: 80.0,
fit: BoxFit.cover,
)
: Icon(
Icons.shopping_bag_outlined,
size: 40.0,
color: Colors.grey[400],
),
),
SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item['productName'] ?? '商品名称',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 14),
),
SizedBox(height: 5),
Row(
children: [
Text(
'¥${item['price'] ?? '0'}',
style: TextStyle(color: Colors.red, fontSize: 16),
),
Spacer(),
Text(
'x${item['quantity'] ?? '1'}',
style: TextStyle(color: Colors.grey),
),
],
),
],
),
)
],
)).toList(),
SizedBox(height: 10),
//
Container(
padding: EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: Colors.grey[50],
borderRadius: BorderRadius.circular(5.0),
),
child: Row(
children: [
Spacer(),
Text.rich(
TextSpan(children: [
TextSpan(text: '实付款: '),
TextSpan(
text: '¥${order['totalAmount'] ?? '0'}',
style: TextStyle(color: Colors.red, fontSize: 16),
),
]),
),
],
),
),
SizedBox(height: 10),
//
_buildActionButtons(order['status']),
],
),
),
onTap: () {
Get.toNamed('/order/detail', arguments: {'orderId': order['id']});
},
);
}
//
String _getStatusText(dynamic status) {
//
int statusCode = status is String ? int.tryParse(status) ?? 0 : (status is int ? status : 0);
switch (statusCode) {
case 1:
return '待付款';
case 2:
return '待核销';
case 3:
return '已完成';
case 4:
return '已退款';
case 5:
return '已取消';
default:
return '未知状态';
}
}
//
Color _getStatusColor(dynamic status) {
int statusCode = status is String ? int.tryParse(status) ?? 0 : (status is int ? status : 0);
switch (statusCode) {
case 1:
return Colors.orange;
case 2:
return Colors.blue;
case 3:
return Colors.green;
case 4:
return Colors.red;
case 5:
return Colors.grey;
default:
return Colors.black;
}
}
//
Widget _buildActionButtons(dynamic status) {
//
int statusCode = status is String ? int.tryParse(status) ?? 0 : (status is int ? status : 0);
switch (statusCode) {
case 1: //
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () => _cancelOrder(),
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('取消订单'),
),
SizedBox(width: 10),
ElevatedButton(
onPressed: () => _payOrder(),
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(Color(0xff07c160)),
foregroundColor: WidgetStateProperty.all(Colors.white),
),
child: Text('去支付'),
),
],
);
case 2: //
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () => _contactCustomerService(),
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(Color(0xFFFCBE13)),
foregroundColor: WidgetStateProperty.all(Colors.white),
),
child: Text('联系客服'),
),
],
);
case 3: //
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () => _deleteOrder(),
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('删除订单'),
),
],
);
default:
return SizedBox.shrink();
}
}
//
void _cancelOrder() {
//
}
void _payOrder() {
//
}
void _contactCustomerService() {
//
}
void _deleteOrder() {
//
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
@ -111,478 +445,79 @@ class _SellerState extends State<Seller> with SingleTickerProviderStateMixin {
]), ]),
), ),
), ),
body: ScrollConfiguration( body: TabBarView(
controller: tabController,
children: List.generate(tabList.length, (index) {
return RefreshIndicator(
onRefresh: () async {
_refreshData();
},
child: ScrollConfiguration(
behavior: CustomScrollBehavior().copyWith(scrollbars: false), behavior: CustomScrollBehavior().copyWith(scrollbars: false),
child: Container( child: Container(
color: Colors.grey[50], color: Colors.grey[50],
child: TabBarView( child: pageOrderList.isEmpty && !isRefreshing
controller: tabController, ? emptyTip()
children: [ : ListView.builder(
ListView(
controller: scrollController, controller: scrollController,
physics: BouncingScrollPhysics(), physics: AlwaysScrollableScrollPhysics(),
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
children: [ itemCount: pageOrderList.length + (isLoadingMore ? 1 : 0),
GestureDetector( itemBuilder: (context, index) {
child: Container( if (index == pageOrderList.length) {
margin: EdgeInsets.only(bottom: 10.0), return _buildLoadMoreIndicator();
padding: EdgeInsets.all(10.0), }
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15.0), boxShadow: [ return _buildOrderItem(pageOrderList[index]);
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0.0, 1.0),
blurRadius: 1.0,
spreadRadius: 0.0,
),
]),
child: Column(
spacing: 10.0,
children: [
Row(
children: [
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 5.0,
children: [
ClipOval(
child: Image.asset(
'assets/images/avatar/img11.jpg',
width: 25.0,
),
),
Text('人人乐超市'),
Icon(
Icons.arrow_forward_ios_rounded,
color: Colors.grey,
size: 12.0,
),
],
),
Spacer(),
Text(
'待付款',
style: TextStyle(color: Colors.red),
)
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 10.0,
children: [
Image.network(
'https://img13.360buyimg.com/n1/jfs/t1/263909/5/4187/123220/676eb220F3e481086/0cee829b1894fc4c.jpg',
width: 80.0,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 5.0,
children: [
Text(
'茅台MOUTAI飞天 53度 酱香型白酒 500ml*2 海外版送礼袋年货送礼',
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Row(
children: [
Text(
'¥3800',
style: TextStyle(color: Colors.red),
),
Spacer(),
Text(
'x10',
style: TextStyle(color: Colors.grey),
),
],
),
],
),
)
],
),
//
Container(
padding: EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: Colors.grey[50],
borderRadius: BorderRadius.circular(5.0),
),
child: Row(
children: [
Spacer(),
Text.rich(
TextSpan(children: [
TextSpan(text: '实付款: '),
TextSpan(
text: '¥38000',
style: TextStyle(color: Colors.red),
),
]),
),
],
),
),
//
Row(
spacing: 10.0,
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () {},
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('取消订单'),
),
ElevatedButton(
onPressed: () {},
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(Color(0xff07c160)), foregroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('去支付'),
),
],
),
Row(
spacing: 10.0,
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () {},
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(Color(0xFF10B9FC)), foregroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('评价'),
),
],
),
Row(
spacing: 10.0,
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () {},
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('申请退款'),
),
ElevatedButton(
onPressed: () {},
style: ButtonStyle(
backgroundColor: WidgetStateProperty.all(Color(0xFFFCBE13)), foregroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('联系客服'),
),
],
),
Row(
spacing: 10.0,
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () {},
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('删除'),
),
],
),
],
),
),
onTap: () {
Get.toNamed('/order/detail');
}, },
), ),
),
),
);
}),
),
);
}
//
Widget _buildLoadMoreIndicator() {
return Padding(
padding: EdgeInsets.symmetric(vertical: 15.0),
child: Center(
child: isLoadingMore
? Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(strokeWidth: 2),
),
SizedBox(width: 10),
Text('加载中...', style: TextStyle(color: Colors.grey)),
], ],
)
: Text('没有更多数据了', style: TextStyle(color: Colors.grey)),
), ),
emptyTip(), );
hexiao(), }
finish(),
emptyTip(), Widget emptyTip() {
emptyTip(), return Container(
width: double.infinity, //
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/images/empty.png',
width: 100.0,
),
SizedBox(height: 10),
Text(
'还没有相关订单~',
style: TextStyle(color: Colors.grey, fontSize: 12.0),
)
], ],
), ),
),
),
); );
} }
} }
Widget finish() {
return ListView(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.all(10.0),
children: [
GestureDetector(
child: Container(
margin: EdgeInsets.only(bottom: 10.0),
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15.0), boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0.0, 1.0),
blurRadius: 1.0,
spreadRadius: 0.0,
),
]),
child: Column(
spacing: 10.0,
children: [
Row(
children: [
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 5.0,
children: [
ClipOval(
child: Image.asset(
'assets/images/avatar/img12.jpg',
width: 25.0,
),
),
Text('人人乐超市'),
Icon(
Icons.arrow_forward_ios_rounded,
color: Colors.grey,
size: 12.0,
),
],
),
Spacer(),
Text(
'已完成',
style: TextStyle(color: Colors.red),
)
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 10.0,
children: [
Image.network(
'https://img13.360buyimg.com/n1/jfs/t1/263909/5/4187/123220/676eb220F3e481086/0cee829b1894fc4c.jpg',
width: 80.0,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 5.0,
children: [
Text(
'茅台MOUTAI飞天 53度 酱香型白酒 500ml 海外版送礼袋年货送礼',
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Row(
children: [
Text(
'¥1900',
style: TextStyle(color: Colors.red),
),
],
),
],
),
)
],
),
//
Container(
padding: EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(5.0),
),
child: Row(
children: [
Spacer(),
Text.rich(
TextSpan(children: [
TextSpan(text: '实付款: '),
TextSpan(
text: '¥1880',
style: TextStyle(color: Colors.red),
),
]),
),
],
),
),
],
),
),
onTap: () {
Get.toNamed('/order/detail');
},
),
],
);
}
Widget hexiao() {
return ListView(
physics: BouncingScrollPhysics(),
padding: EdgeInsets.all(10.0),
children: [
GestureDetector(
child: Container(
margin: EdgeInsets.only(bottom: 10.0),
padding: EdgeInsets.all(10.0),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(15.0), boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(10),
offset: Offset(0.0, 1.0),
blurRadius: 1.0,
spreadRadius: 0.0,
),
]),
child: Column(
spacing: 10.0,
children: [
Row(
children: [
Wrap(
crossAxisAlignment: WrapCrossAlignment.center,
spacing: 5.0,
children: [
ClipOval(
child: Image.asset(
'assets/images/avatar/img11.jpg',
width: 25.0,
),
),
Text('老白干自营旗舰店'),
Icon(
Icons.arrow_forward_ios_rounded,
color: Colors.grey,
size: 12.0,
),
],
),
Spacer(),
Text(
'待付款',
style: TextStyle(color: Colors.red),
)
],
),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 10.0,
children: [
Image.network(
'https://img13.360buyimg.com/n1/jfs/t1/263909/5/4187/123220/676eb220F3e481086/0cee829b1894fc4c.jpg',
width: 80.0,
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
spacing: 5.0,
children: [
Text(
'茅台MOUTAI飞天 53度 酱香型白酒 500ml*2 海外版送礼袋年货送礼',
maxLines: 2,
overflow: TextOverflow.ellipsis,
),
Row(
children: [
Text(
'¥3800',
style: TextStyle(color: Colors.red),
),
Spacer(),
Text(
'x10',
style: TextStyle(color: Colors.grey),
),
],
),
],
),
)
],
),
//
Container(
padding: EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: Colors.grey[50],
borderRadius: BorderRadius.circular(5.0),
),
child: Row(
children: [
Spacer(),
Text.rich(
TextSpan(children: [
TextSpan(text: '实付款: '),
TextSpan(
text: '¥38000',
style: TextStyle(color: Colors.red),
),
]),
),
],
),
),
//
Row(
spacing: 10.0,
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () {},
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('取消订单'),
),
ElevatedButton(
onPressed: () {},
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Color(0xff07c160)), foregroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('去支付'),
),
],
),
Row(
spacing: 10.0,
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () {},
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Color(0xFF10B9FC)), foregroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('评价'),
),
],
),
Row(
spacing: 10.0,
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () {},
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('申请退款'),
),
ElevatedButton(
onPressed: () {},
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Color(0xFFFCBE13)), foregroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('联系客服'),
),
],
),
Row(
spacing: 10.0,
mainAxisAlignment: MainAxisAlignment.end,
children: [
ElevatedButton(
onPressed: () {},
style: ButtonStyle(backgroundColor: WidgetStateProperty.all(Colors.white)),
child: Text('删除'),
),
],
),
],
),
),
onTap: () {
Get.toNamed('/order/detail');
},
),
],
);
}

View File

@ -20,6 +20,9 @@ import 'package:loopin/pages/my/nick_name.dart';
import 'package:loopin/pages/my/setting.dart'; import 'package:loopin/pages/my/setting.dart';
import 'package:loopin/pages/my/user_info.dart'; import 'package:loopin/pages/my/user_info.dart';
import 'package:loopin/pages/my/vloger.dart'; import 'package:loopin/pages/my/vloger.dart';
import 'package:loopin/pages/my/all_function.dart';
import 'package:loopin/pages/my/merchant/income.dart';
import 'package:loopin/pages/my/merchant/order.dart';
import 'package:loopin/pages/order/seller.dart'; import 'package:loopin/pages/order/seller.dart';
import 'package:loopin/pages/search/index.dart'; import 'package:loopin/pages/search/index.dart';
import 'package:loopin/pages/search/search-result.dart'; import 'package:loopin/pages/search/search-result.dart';
@ -53,6 +56,9 @@ final Map<String, Widget> routes = {
'/search-result': const SearchResultPage(), '/search-result': const SearchResultPage(),
//settins //settins
'/setting': const Setting(), '/setting': const Setting(),
'/functions': const AllFunctionsPage(),
'/merchant/income': const SellerRevenue(),
//'/merchant/order': const SellerRevenue(),
'/userInfo': const UserInfo(), '/userInfo': const UserInfo(),
'/notifications': const Setting(), '/notifications': const Setting(),
'/privacy': const Setting(), '/privacy': const Setting(),