对接:app 包裹代收:确认领取

hmxc
张萌 4 years ago
parent 29b762e56a
commit 0ebddab6a0

@ -218,6 +218,9 @@ class _Manager {
///app ///app
String get expressPackageList => '/user/packageCollection/list'; String get expressPackageList => '/user/packageCollection/list';
///app
String get packageConfirm => '/user/packageCollection/confirmCollection';
} }
class _Community { class _Community {

@ -1,4 +1,8 @@
import 'package:aku_community/constants/api.dart';
import 'package:aku_community/models/express_package/express_package_list_model.dart'; import 'package:aku_community/models/express_package/express_package_list_model.dart';
import 'package:aku_community/utils/network/base_model.dart';
import 'package:aku_community/utils/network/net_util.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -12,7 +16,12 @@ import 'package:aku_community/widget/bee_divider.dart';
class ExpressPackageCard extends StatefulWidget { class ExpressPackageCard extends StatefulWidget {
final int index; final int index;
final ExpressPackageListModel model; final ExpressPackageListModel model;
ExpressPackageCard({Key? key, required this.index, required this.model}) final VoidCallback callFresh;
ExpressPackageCard(
{Key? key,
required this.index,
required this.model,
required this.callFresh})
: super(key: key); : super(key: key);
@override @override
@ -72,8 +81,7 @@ class _ExpressPackageCardState extends State<ExpressPackageCard> {
_rowTile( _rowTile(
R.ASSETS_ICONS_APPOINTMENT_DATE_PNG, R.ASSETS_ICONS_APPOINTMENT_DATE_PNG,
'送达时间', '送达时间',
widget.model.createDateString widget.model.createDateString.text
.text
.size(24.sp) .size(24.sp)
.color(ktextSubColor) .color(ktextSubColor)
.make()), .make()),
@ -97,8 +105,13 @@ class _ExpressPackageCardState extends State<ExpressPackageCard> {
hoverElevation: 0, hoverElevation: 0,
disabledElevation: 0, disabledElevation: 0,
highlightElevation: 0, highlightElevation: 0,
onPressed: () { onPressed: () async {
bool confirm = false;
confirm =
await _cofirmReceivePackage(widget.model.id);
if (confirm) {
widget.callFresh();
}
}, },
child: '确认领取' child: '确认领取'
.text .text
@ -115,6 +128,19 @@ class _ExpressPackageCardState extends State<ExpressPackageCard> {
); );
} }
Future _cofirmReceivePackage(int id) async {
BaseModel baseModel = await NetUtil().get(
API.manager.packageConfirm,
params: {
"packageCollectionId": id,
},
);
if (baseModel.status ?? false) {
BotToast.showText(text: baseModel.message ?? '未知错误');
}
return baseModel.status;
}
Widget _rowTile(String assetPath, String titile, Widget content) { Widget _rowTile(String assetPath, String titile, Widget content) {
return Row( return Row(
children: [ children: [

@ -48,7 +48,13 @@ class _ExpressPackageViewState extends State<ExpressPackageView> {
return ListView.separated( return ListView.separated(
padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 32.w), padding: EdgeInsets.symmetric(vertical: 16.w, horizontal: 32.w),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return ExpressPackageCard(index: widget.index,model: items[index],); return ExpressPackageCard(
index: widget.index,
model: items[index],
callFresh: () {
_refreshController.callRefresh();
},
);
}, },
separatorBuilder: (_, __) { separatorBuilder: (_, __) {
return 16.w.heightBox; return 16.w.heightBox;

Loading…
Cancel
Save