export xlsx
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:logistics_tools/utils/request.dart';
|
||||
|
||||
class Logistics extends StatefulWidget {
|
||||
const Logistics({super.key});
|
||||
@ -9,6 +11,30 @@ class Logistics extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _LogisticsState extends State<Logistics> {
|
||||
List<dynamic> goodsList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
}
|
||||
|
||||
Future<Response> fetchGoodsList(BuildContext context) async {
|
||||
String? orderNumber =
|
||||
GoRouterState.of(context).uri.queryParameters["orderNumber"];
|
||||
String? orderPayWay =
|
||||
GoRouterState.of(context).uri.queryParameters["orderPayWay"];
|
||||
print(orderPayWay);
|
||||
if (orderNumber?.isEmpty ?? true) {
|
||||
context.pop();
|
||||
}
|
||||
Response response = await dio.get(
|
||||
"https://www.sanpinhuicai.com/wisdommining/api/order/goodsOfOrder",
|
||||
queryParameters: {"orderNumber": orderNumber});
|
||||
goodsList = response.data["value"];
|
||||
return response;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@ -16,27 +42,68 @@ class _LogisticsState extends State<Logistics> {
|
||||
title: const Text("填写物流信息"),
|
||||
),
|
||||
body: Container(
|
||||
padding: const EdgeInsets.all(40),
|
||||
width: double.infinity,
|
||||
child: Card(
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8))),
|
||||
child: SizedBox(
|
||||
height: 50,
|
||||
width: 120,
|
||||
padding: const EdgeInsets.all(40),
|
||||
width: double.infinity,
|
||||
child: FutureBuilder(
|
||||
future: fetchGoodsList(context),
|
||||
builder:
|
||||
(BuildContext context, AsyncSnapshot<Response> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return Card(
|
||||
color: Colors.white,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: ListView.builder(
|
||||
itemCount: goodsList.length,
|
||||
itemBuilder: (context, index) {
|
||||
final goods = goodsList[index];
|
||||
return ListTile(
|
||||
trailing: IconButton(
|
||||
icon: const Icon(Icons.add),
|
||||
onPressed: () {},
|
||||
),
|
||||
leading: Image.network(
|
||||
goods["goodsPhoto"],
|
||||
width: 100,
|
||||
height: 100,
|
||||
),
|
||||
title: Text(
|
||||
"${goods["goodsName"]} - ${goods?["wisdGoodsSpec"]?["specName"] ?? ''}"),
|
||||
subtitle:
|
||||
Text("数量 : ${goods?["goodsNum"]}"),
|
||||
);
|
||||
})),
|
||||
const Expanded(flex: 1, child: Placeholder())
|
||||
/*
|
||||
GridView.builder(
|
||||
gridDelegate:
|
||||
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 5,
|
||||
childAspectRatio: 1.0),
|
||||
itemCount: goodsList.length,
|
||||
itemBuilder: (context, index) {
|
||||
return Icon(Icons.add);
|
||||
}),
|
||||
*/
|
||||
],
|
||||
)),
|
||||
);
|
||||
} else if (snapshot.hasError) {
|
||||
return const Center(
|
||||
child: Icon(
|
||||
Icons.error_outline,
|
||||
color: Colors.red,
|
||||
size: 60,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
));
|
||||
);
|
||||
} else {
|
||||
return const Center(child: CircularProgressIndicator());
|
||||
}
|
||||
},
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user