parent
ddc0dd448f
commit
b5f1320f84
@ -0,0 +1,214 @@
|
||||
import 'package:aku_new_community_manager/gen/assets.gen.dart';
|
||||
import 'package:aku_new_community_manager/new_ui/work_order/distributor/distributor_card.dart';
|
||||
import 'package:aku_new_community_manager/new_ui/work_order/distributor/distributor_detail_page.dart';
|
||||
import 'package:aku_new_community_manager/saas_models/work_order/work_order_list_model.dart';
|
||||
import 'package:aku_new_community_manager/style/app_style.dart';
|
||||
import 'package:aku_new_community_manager/ui/widgets/common/bee_hor_image_view.dart';
|
||||
import 'package:aku_new_community_manager/ui/widgets/common/car_bottom_button.dart';
|
||||
import 'package:aku_new_community_manager/utils/bee_date_util.dart';
|
||||
import 'package:common_utils/common_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
import '../work_order_func.dart';
|
||||
import '../work_order_map.dart';
|
||||
|
||||
class ReceiverCard extends StatelessWidget {
|
||||
final WorkOrderListModel model;
|
||||
final VoidCallback refresh;
|
||||
|
||||
const ReceiverCard({Key? key, required this.model, required this.refresh})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
top: 9.35.w,
|
||||
right: 0,
|
||||
child: Container(
|
||||
width: 160.w,
|
||||
height: 60.w,
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
begin: Alignment.bottomLeft,
|
||||
end: Alignment.topRight,
|
||||
colors: [
|
||||
Color(0xFFFAC058),
|
||||
Color(0xFFFFD589),
|
||||
]),
|
||||
color: kPrimaryColor,
|
||||
borderRadius:
|
||||
BorderRadius.only(topRight: Radius.circular(12.w)),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'${WorkOrderMap.orderStatus[model.status]}',
|
||||
style: TextStyle(
|
||||
fontSize: 26.sp,
|
||||
color: Colors.black,
|
||||
),
|
||||
),
|
||||
)),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(() => DistributorDetailPage(
|
||||
id: model.id,
|
||||
));
|
||||
},
|
||||
child: ClipPath(
|
||||
clipper: WorkOrderCardClip(),
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(24.w),
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(12.w),
|
||||
bottomLeft: Radius.circular(12.w),
|
||||
bottomRight: Radius.circular(12.w)),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 8.w, horizontal: 16.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFFFFBE6),
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
child: '${model.workOrderTypeName}'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Color(0xFFD48806))
|
||||
.make(),
|
||||
),
|
||||
],
|
||||
),
|
||||
16.w.heightBox,
|
||||
Row(
|
||||
children: [
|
||||
Assets.icons.alarmClock.image(width: 40.w, height: 40.w),
|
||||
24.w.widthBox,
|
||||
'${model.updateDate}'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
16.w.heightBox,
|
||||
Row(
|
||||
children: [
|
||||
Assets.icons.taskLocation
|
||||
.image(width: 40.w, height: 40.w),
|
||||
24.w.widthBox,
|
||||
'${model.reserveAddress}'
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
60.w.heightBox,
|
||||
'${model.content}'
|
||||
.text
|
||||
.size(28.sp)
|
||||
.color(Colors.black.withOpacity(0.65))
|
||||
.make(),
|
||||
24.w.heightBox,
|
||||
BeeHorImageView(
|
||||
maxCount: 4,
|
||||
imgs: model.imgList ?? [],
|
||||
imgWidth: 146.w,
|
||||
imgHeight: 146.w),
|
||||
24.w.heightBox,
|
||||
Row(
|
||||
children: [
|
||||
BeeDateUtil(DateUtil.getDateTime(model.createDate))
|
||||
.timeAgo
|
||||
.text
|
||||
.size(24.sp)
|
||||
.color(Colors.black.withOpacity(0.45))
|
||||
.make(),
|
||||
Spacer(),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget getCardBottomButton() {
|
||||
switch (model.status) {
|
||||
case 1:
|
||||
return CardBottomButton.yellow(
|
||||
text: '领取任务',
|
||||
onPressed: () async {
|
||||
var re = await WorkOrderFuc.receiveTask(model.id);
|
||||
if (re) {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
case 2:
|
||||
return CardBottomButton.yellow(
|
||||
text: '开始服务',
|
||||
onPressed: () async {
|
||||
var re = await WorkOrderFuc.startService(model.id);
|
||||
if (re) {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
case 3:
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
CardBottomButton.yellow(text: '提交报告', onPressed: () async {}),
|
||||
CardBottomButton.yellow(
|
||||
text: '完成工单',
|
||||
onPressed: () async {
|
||||
var re = await WorkOrderFuc.reminderProcessing(model.id);
|
||||
if (re) {
|
||||
refresh();
|
||||
}
|
||||
}),
|
||||
],
|
||||
);
|
||||
case 4:
|
||||
return CardBottomButton.yellow(
|
||||
text: '提醒确认',
|
||||
onPressed: () async {
|
||||
var re = await WorkOrderFuc.reminderConfirm(model.id);
|
||||
if (re) {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
case 5:
|
||||
return CardBottomButton.yellow(
|
||||
text: '提醒支付',
|
||||
onPressed: () async {
|
||||
var re = await WorkOrderFuc.reminderPay(model.id);
|
||||
if (re) {
|
||||
refresh();
|
||||
}
|
||||
});
|
||||
case 6:
|
||||
case 7:
|
||||
case 8:
|
||||
return CardBottomButton.yellow(text: '查看评价', onPressed: () {});
|
||||
case 9:
|
||||
case 10:
|
||||
default:
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,111 @@
|
||||
import 'package:aku_new_community_manager/const/saas_api.dart';
|
||||
import 'package:aku_new_community_manager/new_ui/work_order/distributor/distributor_card.dart';
|
||||
import 'package:aku_new_community_manager/saas_models/work_order/work_order_list_model.dart';
|
||||
import 'package:aku_new_community_manager/ui/widgets/common/aku_scaffold.dart';
|
||||
import 'package:aku_new_community_manager/ui/widgets/inner/aku_tab_bar.dart';
|
||||
import 'package:aku_new_community_manager/utils/network/net_util.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
class WorkOrderReceiverPage extends StatefulWidget {
|
||||
const WorkOrderReceiverPage({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_WorkOrderReceiverPageState createState() => _WorkOrderReceiverPageState();
|
||||
}
|
||||
|
||||
class _WorkOrderReceiverPageState extends State<WorkOrderReceiverPage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
List<String> _tabs = ['全部', '工单池', '已接单', '处理中', '待确认', '已完成', '已评价', '已取消'];
|
||||
late TabController _tabController;
|
||||
EasyRefreshController _refreshController = EasyRefreshController();
|
||||
int _page = 1;
|
||||
int _size = 10;
|
||||
List<WorkOrderListModel> _models = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_tabController = TabController(length: _tabs.length, vsync: this);
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_refreshController.dispose();
|
||||
_tabController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AkuScaffold(
|
||||
title: '工单管理',
|
||||
actions: [
|
||||
IconButton(
|
||||
onPressed: () {},
|
||||
icon: Icon(
|
||||
CupertinoIcons.plus_circle,
|
||||
size: 40.w,
|
||||
))
|
||||
],
|
||||
appBarBottom: PreferredSize(
|
||||
preferredSize: Size.fromHeight(88.w),
|
||||
child: AkuTabBar(
|
||||
tabs: _tabs,
|
||||
controller: _tabController,
|
||||
),
|
||||
),
|
||||
body: TabBarView(
|
||||
controller: _tabController,
|
||||
children:
|
||||
_tabs.mapIndexed((e, index) => _getOrderView(index)).toList()),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _getOrderView(int index) {
|
||||
return EasyRefresh(
|
||||
firstRefresh: true,
|
||||
header: MaterialHeader(),
|
||||
onRefresh: () async {
|
||||
_page = 1;
|
||||
var base = await NetUtil().getList(SAASAPI.workOrder.list, params: {
|
||||
'pageNum': _page,
|
||||
'size': _size,
|
||||
'status': index == 0 ? null : index + 1,
|
||||
});
|
||||
_models =
|
||||
base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList();
|
||||
setState(() {});
|
||||
},
|
||||
onLoad: () async {
|
||||
_page++;
|
||||
var base = await NetUtil().getList(SAASAPI.workOrder.list, params: {
|
||||
'pageNum': _page,
|
||||
'size': _size,
|
||||
'status': index == 0 ? null : index + 1,
|
||||
});
|
||||
if (_models.length < base.total) {
|
||||
_models.addAll(
|
||||
base.rows.map((e) => WorkOrderListModel.fromJson(e)).toList());
|
||||
setState(() {});
|
||||
} else {
|
||||
_refreshController.finishLoad();
|
||||
}
|
||||
},
|
||||
child: ListView.separated(
|
||||
padding: EdgeInsets.all(24.w),
|
||||
itemBuilder: (context, index) {
|
||||
return DistributorCard(
|
||||
model: _models[index],
|
||||
refresh: _refreshController.callRefresh,
|
||||
);
|
||||
},
|
||||
separatorBuilder: (context, index) {
|
||||
return 24.w.heightBox;
|
||||
},
|
||||
itemCount: _models.length));
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
import 'package:aku_new_community_manager/style/app_style.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BottomPluralButtonWidget extends StatelessWidget {
|
||||
const BottomPluralButtonWidget({
|
||||
Key? key,
|
||||
required this.onLeftTap,
|
||||
required this.onRightTap,
|
||||
required this.leftTitle,
|
||||
required this.rightTitle,
|
||||
this.padding = false,
|
||||
}) : super(key: key);
|
||||
final VoidCallback onLeftTap;
|
||||
final VoidCallback onRightTap;
|
||||
final String leftTitle;
|
||||
final String rightTitle;
|
||||
final bool padding;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: padding
|
||||
? EdgeInsets.only(
|
||||
left: 32.w,
|
||||
top: 32.w,
|
||||
bottom: 32.w + MediaQuery.of(context).padding.bottom,
|
||||
right: 32.w)
|
||||
: EdgeInsets.zero,
|
||||
color: padding ? Colors.white : Colors.transparent,
|
||||
child: Row(
|
||||
children: [
|
||||
MaterialButton(
|
||||
onPressed: onLeftTap,
|
||||
minWidth: 330.w,
|
||||
height: 80.w,
|
||||
elevation: 0,
|
||||
color: Colors.white,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40.w),
|
||||
side: BorderSide(color: Colors.black.withOpacity(0.25)),
|
||||
),
|
||||
child: Text(
|
||||
leftTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 28.sp, color: Colors.black.withOpacity(0.65)),
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
MaterialButton(
|
||||
onPressed: onRightTap,
|
||||
minWidth: 330.w,
|
||||
height: 80.w,
|
||||
elevation: 0,
|
||||
color: kPrimaryColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40.w),
|
||||
),
|
||||
child: Text(
|
||||
rightTitle,
|
||||
style: TextStyle(
|
||||
fontSize: 28.sp, color: Colors.black.withOpacity(0.85)),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue