123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559 |
- import 'dart:async';
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- // import 'package:liftmanager/internal/wode/model/order_model.dart';
- import 'package:liftmanager/internal/bbs/model/liftcase_model.dart';
- import 'package:liftmanager/internal/search/presenter/base_list_provider.dart';
- import 'package:liftmanager/internal/wode/order_const.dart';
- import 'package:liftmanager/internal/wode/presenter/order_master_list_presenter.dart';
- import 'package:liftmanager/internal/wode/wode_router.dart';
- import 'package:liftmanager/mvp/base_page_state.dart';
- import 'package:liftmanager/res/colors.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/utils/time_format.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:liftmanager/widgets/my_refresh_list.dart';
- import 'package:liftmanager/widgets/state_layout.dart';
- import 'package:provider/provider.dart';
- class OrderPageMaster extends StatefulWidget {
- OrderPageMaster(this.checkType);
- String checkType;
- int tabCheckIndex = 0;
- @override
- // State<StatefulWidget> createState() {
- // return OrderPageMasterState();
- // }
- OrderPageMasterState createState() => OrderPageMasterState();
- }
- class OrderPageMasterState
- extends BasePageState<OrderPageMaster, OrderListPresenterSeconds> {
- BaseListProvider<LiftCasesDetailModel> provider =
- BaseListProvider<LiftCasesDetailModel>();
- int _page = 1;
- ScrollController _scrollController = new ScrollController();
- @override
- void dispose() {
- _scrollController.dispose();
- super.dispose();
- }
- @override
- void initState() {
- if (widget.checkType.isNotEmpty && widget.checkType != null) {
- widget.tabCheckIndex = int.parse(widget.checkType);
- }
- provider.setStateTypeNotNotify(StateType.loading);
- super.initState();
- _onRefresh();
- }
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- return WillPopScope(
- // ignore: missing_return
- onWillPop: () {
- Navigator.popUntil(context, ModalRoute.withName('/home'));
- },
- child: ChangeNotifierProvider<BaseListProvider<LiftCasesDetailModel>>(
- create: (_) => provider,
- child: Scaffold(
- appBar: MyAppBar(
- centerTitle: "专家订单",
- isFun: true,
- fun: () {
- Navigator.popUntil(context, ModalRoute.withName('/home'));
- },
- actions: <Widget>[],
- ),
- body: Container(
- child: Stack(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(top: ScreenUtil().setWidth(44)),
- child: Column(
- children: <Widget>[
- Expanded(
- flex: 1,
- child:
- Consumer<BaseListProvider<LiftCasesDetailModel>>(
- builder: (_, provider, __) {
- return MyListView(
- key: Key('order_list'),
- itemCount: provider.list.length,
- stateType: provider.stateType,
- onRefresh: _onRefresh,
- loadMore: _loadMore,
- hasMore: provider.hasMore,
- itemBuilder: (_, index) {
- return OrderListItemWidget(
- data: provider.list[index],
- );
- },
- );
- },
- ),
- )
- ],
- ),
- ),
- Positioned(
- child: Container(
- padding: EdgeInsets.only(bottom: 5),
- // color:Color(0xffFAF7FA),
- decoration: BoxDecoration(
- border: Border(
- bottom:
- BorderSide(width: 0.5, color: Color(0xffeeeeee)),
- ),
- // color: Color(0xff9FD1FE),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children:
- OrderConstant.expertOrderType.asMap().keys.map((i) {
- return TabThis(
- item: OrderConstant.expertOrderType[i]['name'],
- tabIndex: i,
- checkIndex: widget.tabCheckIndex,
- fun: (index) {
- setState(() {
- widget.tabCheckIndex = index;
- provider.list.clear();
- _onRefresh();
- });
- });
- }).toList(),
- ),
- ),
- ),
- ],
- ),
- ),
- ),
- ));
- }
- Future _onRefresh() async {
- _page = 1;
- await presenter.getOrderList(
- _page, OrderConstant.expertOrderType[widget.tabCheckIndex]['value']);
- }
- Future _loadMore() async {
- _page++;
- await presenter.getOrderList(
- _page, OrderConstant.expertOrderType[widget.tabCheckIndex]['value']);
- }
- @override
- OrderListPresenterSeconds createPresenter() {
- // TODO: implement createPresenter
- // throw UnimplementedError();
- return OrderListPresenterSeconds();
- }
- }
- class TabThis extends StatelessWidget {
- TabThis({Key key, this.item, this.tabIndex, this.fun, this.checkIndex})
- : super(key: key);
- String item;
- int tabIndex;
- int checkIndex;
- Function fun;
- @override
- Widget build(BuildContext context) {
- return Container(
- padding: EdgeInsets.only(top: ScreenUtil().setWidth(10)),
- child: Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- GestureDetector(
- onTap: () {
- fun(tabIndex);
- },
- child: Container(
- padding: EdgeInsets.only(bottom: 6),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(
- width: 2,
- color: checkIndex == tabIndex
- ? Color(0xff02A0FD)
- : Colors.transparent),
- ),
- // color: Color(0xff9FD1FE),
- ),
- child: Text(
- item,
- style: TextStyle(
- color: checkIndex == tabIndex
- ? Color(0xff02A0FD)
- : Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.center,
- ),
- ),
- )
- ],
- ),
- ),
- );
- }
- }
- class OrderListItemWidget extends StatelessWidget {
- OrderListItemWidget({Key key, this.data}) : super(key: key);
- LiftCasesDetailModel data;
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- return IntrinsicWidth(
- child: Container(
- padding: EdgeInsets.only(top: ScreenUtil().setWidth(10)),
- width: width,
- // height: 100,
- child: GestureDetector(
- onTap: () {
- NavigatorUtils.push(
- context, "${WodeRouter.orderDetailMaster}?id=${data.id}");
- },
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- // mainAxisSize: MainAxisSize.min,
- children: <Widget>[
- Container(
- margin: EdgeInsets.only(
- left: ScreenUtil().setWidth(10),
- right: ScreenUtil().setWidth(10),
- top: ScreenUtil().setWidth(5),
- ),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(
- ScreenUtil().setWidth(22),
- ),
- ),
- child: LoadNetworkImage(
- data.avatarUrl,
- width: ScreenUtil().setWidth(43),
- height: ScreenUtil().setWidth(43),
- // alignment: Alignment.centerLeft,
- ),
- ),
- Expanded(
- child: Container(
- padding: EdgeInsets.only(
- right: ScreenUtil().setWidth(15),
- ),
- child: Column(
- children: <Widget>[
- Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- data.name ?? '',
- style: TextStyle(
- fontSize: ScreenUtil().setSp(17),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- decoration: BoxDecoration(
- //背景
- color: data.dataTable == 1
- ? Colours.blue_app_main
- : Color(0xffFDAF2C),
- //设置四周圆角 角度
- borderRadius:
- BorderRadius.all(Radius.circular(4.0)),
- ),
- padding: EdgeInsets.only(
- left: 5, right: 5, top: 0, bottom: 0),
- child: Text(
- data.dataTable == 1 ? '问诊服务' : '出诊服务',
- style: TextStyle(
- color: Colors.white,
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- ),
- )
- ],
- ),
- Container(
- child: Text(
- OrderConstant.getStatusName(
- data.statuz, data.dataTable,
- arrivedFlag: data.arrivedFlag,
- examineFlag: data.examineFlag != null
- ? int.parse(data.examineFlag)
- : null,
- userType: 'EXPERT'),
- style: TextStyle(
- color: data.dataTable != 1
- ? Color(0xffF84203)
- : Color(0xff0288FF),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.end,
- ),
- )
- ]),
- ),
- Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- data.createTime != null
- ? DateUtils.instance.getFormartData(
- timeSamp: data.createTime,
- format: "MM-dd")
- : '',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- padding: EdgeInsets.only(left: 5),
- child: Text(
- data.brandName ?? '',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- )
- ],
- ),
- ]),
- ),
- data.dataTable == 1
- ? Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- '问题描述:',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- width: 200,
- padding: EdgeInsets.only(left: 5),
- child: Text(
- data.expression ?? '',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- )
- ],
- ),
- ],
- ),
- )
- : Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- '出诊时间:',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- padding: EdgeInsets.only(left: 5),
- child: Text(
- data.arrivedTime != null
- ? DateUtils.instance.getFormartData(
- timeSamp: data.arrivedTime,
- format: "MM-dd HH:mm")
- : '',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- ),
- )
- ],
- ),
- ],
- ),
- ),
- data.dataTable == 1
- ? Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- '已尝试方法:',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- width: 200,
- padding: EdgeInsets.only(left: 5),
- child: Text(
- data.usedMethods ?? '',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- )
- ],
- ),
- ],
- ),
- )
- : Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- '出诊地点:',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- width: 200,
- padding: EdgeInsets.only(left: 5),
- child: Text(
- data.address ?? '',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- )
- ],
- ),
- ],
- ),
- ),
- data.dataTable == 2
- ? Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- '问题描述:',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- width: 200,
- padding: EdgeInsets.only(left: 5),
- child: Text(
- data.expression ?? '',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- )
- ],
- ),
- ],
- ),
- )
- : Container(),
- Container(
- margin: EdgeInsets.only(top: 6),
- child: Row(
- children: <Widget>[
- Container(
- padding: EdgeInsets.only(right: 5),
- child: Text(
- data.totalCost != null
- ? "¥${data.totalCost.toString()}"
- : '',
- style: TextStyle(
- color: Color(0xffFD0808),
- fontSize: ScreenUtil().setSp(15),
- ),
- textAlign: TextAlign.start,
- ),
- ),
- ],
- ),
- )
- ],
- ),
- ),
- ),
- ],
- ),
- ),
- ));
- }
- }
|