12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664 |
- import 'dart:async';
- import 'dart:io';
- import 'package:amap_location_flutter_plugin/amap_location_flutter_plugin.dart';
- import 'package:chewie/chewie.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:image_picker/image_picker.dart';
- import 'package:liftmanager/internal/account/provider/user_provider.dart';
- import 'package:liftmanager/internal/bbs/bbs_router.dart';
- import 'package:liftmanager/internal/bbs/model/liftcase_model.dart';
- import 'package:liftmanager/internal/wode/order_const.dart';
- import 'package:liftmanager/internal/wode/page/order_master/check.dart';
- import 'package:liftmanager/internal/wode/wode_router.dart';
- import 'package:liftmanager/net/api_service.dart';
- import 'package:liftmanager/res/colors.dart';
- import 'package:liftmanager/routers/fluro_navigator.dart';
- import 'package:liftmanager/utils/fast_notification.dart';
- import 'package:liftmanager/utils/oss_upload.dart';
- import 'package:liftmanager/utils/theme_utils.dart';
- import 'package:liftmanager/utils/time_format.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/utils/utils.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- import 'package:liftmanager/widgets/bbs_content.dart';
- import 'package:liftmanager/widgets/load_image.dart';
- import 'package:liftmanager/widgets/selected_video_change.dart';
- import 'package:orientation/orientation.dart';
- import 'package:permission_handler/permission_handler.dart';
- import 'package:provider/provider.dart';
- import 'package:video_player/video_player.dart';
- class OrderDetailMaster extends StatefulWidget {
- OrderDetailMaster(this.id);
- final String id;
- @override
- State<StatefulWidget> createState() {
- return OrderDetailMasterState();
- }
- }
- class OrderDetailMasterState extends State<OrderDetailMaster>
- with AutomaticKeepAliveClientMixin {
- UserProvider provider = UserProvider();
- bool _hasData = false;
- LiftCasesDetailModel detailObj;
- double totalPay;
- String videoUrl;
- String str;
- String imagesUrl;
- double percent = 0.0;
- var latitude;
- var longitude;
- String address;
- Map<String, Object> _locationResult;
- StreamSubscription<Map<String, Object>> _locationListener;
- AmapLocationFlutterPlugin _locationPlugin = new AmapLocationFlutterPlugin();
- getBrandDetail() {
- // showLoading(context);
- NewApiService().getLiftcaseDetail(widget.id, onSuccess: (res) {
- detailObj = res;
- print("获取详情成功");
- if (_controllerBefore == null && detailObj.beforeRepair != null) {
- _controllerBefore?.pause();
- _controllerBefore?.dispose();
- _controllerBefore = VideoPlayerController.network(
- Utils.getImagePath(detailObj.beforeRepair));
- }
- if (_controllerAfter == null && detailObj.afterRepair != null) {
- _controllerAfter?.pause();
- _controllerAfter?.dispose();
- _controllerAfter = VideoPlayerController.network(
- Utils.getImagePath(detailObj.afterRepair));
- }
- double serviceCost =
- detailObj.serviceCost != null ? detailObj.serviceCost : 0.0;
- double travelCost =
- detailObj.travelCost != null ? detailObj.travelCost : 0.0;
- double couponDeduction =
- detailObj.couponDeduction != null ? detailObj.couponDeduction : 0.0;
- double redEnvelopeDeduction = detailObj.redEnvelopeDeduction != null
- ? detailObj.redEnvelopeDeduction
- : 0.0;
- totalPay =
- (serviceCost + travelCost) - (couponDeduction + redEnvelopeDeduction);
- if (totalPay < 0) {
- totalPay = 0.0;
- }
- _hasData = true;
- // dismissLoading(context);
- setState(() {});
- }, onError: (code, msg) {
- // dismissLoading(context);
- toasts(msg);
- });
- }
- VideoPlayerController _controllerBefore;
- VideoPlayerController _controllerAfter;
- // 确认完成
- void _confirmComplete() {
- showLoading(context);
- NewApiService().chargeMakeSureCase({
- "id": widget.id,
- }, onSuccess: (res) {
- toasts("确认完成");
- getBrandDetail();
- dismissLoading(context);
- setState(() {});
- }, onError: (code, msg) {
- dismissLoading(context);
- toasts(msg);
- });
- }
- @override
- void initState() {
- if (this.mounted) {
- getBrandDetail();
- }
- super.initState();
- // _locationListener = _locationPlugin
- // .onLocationChanged()
- // .listen((Map<String, Object> result) {
- // setState(() {
- // _locationPlugin.stopLocation();
- // _locationResult = result;
- // // address latitude longitude
- // _locationResult.forEach((key, value) {
- // if (key == 'address') {
- // address = '$value';
- // setState(() {});
- // } else if (key == 'latitude') {
- // latitude = double.parse('$value');
- // setState(() {});
- // } else if (key == 'longitude') {
- // longitude = double.parse('$value');
- // setState(() {});
- // }
- // print(111);
- // print('key:$key :');
- // print('value:$value :');
- // });
- // });
- // });
- // getLocation();
- }
- @override
- void dispose() {
- _controller?.pause();
- _controller?.dispose();
- _chewieController?.dispose();
- if (detailObj.beforeRepair != null) {
- _controllerBefore?.pause();
- _controllerBefore?.dispose();
- }
- if (detailObj.afterRepair != null) {
- _controllerAfter?.pause();
- _controllerAfter?.dispose();
- }
- // SystemChrome.setPreferredOrientations([
- // DeviceOrientation.portraitUp,
- // ]);
- OrientationPlugin.forceOrientation(DeviceOrientation.portraitUp);
- // provider.dispose();
- super.dispose();
- }
- getHeight(detailObj) {
- bool isHeight = false;
- if ((OrderConstant.isShow(
- detailObj.statuz, detailObj.dataTable, 'showExpertQuoteButton')) ||
- (OrderConstant.isShow(detailObj.statuz, detailObj.dataTable,
- 'showExpertPunchButton') &&
- detailObj.arrivedFlag == 0) ||
- (OrderConstant.isShow(detailObj.statuz, detailObj.dataTable,
- 'showExpertConfirmOrderButton',
- arrivedFlag: detailObj.arrivedFlag)) ||
- (OrderConstant.isShow(detailObj.statuz, detailObj.dataTable,
- 'showExpertArchiveButton'))) {
- isHeight = true;
- }
- return isHeight;
- }
- @override
- Widget build(BuildContext context) {
- double width = MediaQuery.of(context).size.width;
- double height = MediaQuery.of(context).size.height;
- if (width > height) {
- // SystemChrome.setPreferredOrientations([
- // DeviceOrientation.portraitUp,
- // ]);
- OrientationPlugin.forceOrientation(DeviceOrientation.portraitUp);
- }
- return ChangeNotifierProvider<UserProvider>(
- create: (_) => provider,
- child: Scaffold(
- appBar: MyAppBar(
- centerTitle: "订单详情",
- ),
- body: _hasData
- ? Consumer<UserProvider>(
- builder: (_, provider, __) {
- return SafeArea(
- child: Stack(
- children: <Widget>[
- ListView(
- padding: EdgeInsets.all(0.0),
- children: <Widget>[
- _orderTypeHead(),
- _lineSpase(),
- _orderUserDetail(),
- isShowMoneyDetail() ? _lineSpase() : Container(),
- isShowMoneyDetail()
- ? _orderMoneyDetail()
- : Container(),
- _lineSpase(),
- _orderTime(),
- _lineSpase(),
- OrderConstant.isShow(
- detailObj.statuz,
- detailObj.dataTable,
- 'showExpertPunchButton') &&
- detailObj.arrivedFlag == 0
- ? _uploadLiveVideo()
- : Container(),
- OrderConstant.isShow(
- detailObj.statuz,
- detailObj.dataTable,
- 'showExpertConfirmOrderButton',
- arrivedFlag: detailObj.arrivedFlag) &&
- detailObj.dataTable == 2
- ? _uploadLiveVideo()
- : Container(),
- (detailObj.dataTable == 1 &&
- detailObj.arrivedFlag == 5 &&
- detailObj.examineFlag == '2')
- ? _boHuiTip()
- : Container(),
- isShowOrderLive()
- ? _orderLiveVideo()
- : Container(),
- SizedBox(height: 80),
- ]),
- Positioned(
- bottom: 0,
- left: 0,
- child: Container(
- width: width,
- height: !getHeight(detailObj) ? 0 : 60,
- padding: EdgeInsets.only(
- // right: ScreenUtil().setWidth(15),
- // left: ScreenUtil().setWidth(15),
- top: 7.5,
- bottom: 7.5,
- ),
- decoration: BoxDecoration(
- border: Border(
- top: BorderSide(
- width: 0.5, color: Color(0xffeeeeee)),
- ),
- color:
- ThemeUtils.getDialogTextFieldColor(context),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.end,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- OrderConstant.isShow(
- detailObj.statuz,
- detailObj.dataTable,
- 'showExpertQuoteButton')
- ? BottomBtn(
- title: detailObj.statuz == 1
- ? "立即报价"
- : "修改报价",
- fun: () {
- if (_controllerBefore != null) {
- _controllerBefore?.pause();
- }
- if (_controllerAfter != null) {
- _controllerAfter?.pause();
- }
- NavigatorUtils.push(context,
- "${WodeRouter.baoPrice}?id=${detailObj.id}&travelCost=${detailObj.travelCost != null ? detailObj.travelCost.toString() : ''}&serviceCost=${detailObj.serviceCost != null ? detailObj.serviceCost.toString() : ''}");
- },
- )
- : Container(child: null),
- // detailObj.statuz == 3 || detailObj.statuz == 6
- // ? BottomBtn(
- // title: "上传视频",
- // fun: () {
- // // NavigatorUtils.push(context,WodeRouter.representations);
- // },
- // )
- // : Container(child: null),
- OrderConstant.isShow(
- detailObj.statuz,
- detailObj.dataTable,
- 'showExpertPunchButton') &&
- detailObj.arrivedFlag == 0
- ? BottomBtn(
- title: "立即打卡",
- fun: () {
- punchin();
- // if (_controllerBefore != null) {
- // _controllerBefore.pause();
- // }
- // if (_controllerAfter != null) {
- // _controllerAfter.pause();
- // }
- // NavigatorUtils.push(context,
- // "${WodeRouter.punchin}?id=${detailObj.id}");
- },
- )
- : Container(child: null),
- OrderConstant.isShow(
- detailObj.statuz,
- detailObj.dataTable,
- 'showExpertConfirmOrderButton',
- arrivedFlag: detailObj.arrivedFlag)
- ? BottomBtn(
- title: "确认完成",
- fun: () {
- if (detailObj.dataTable == 1) {
- _confirmComplete();
- } else {
- submitApply();
- // punchin();
- // if (_controllerBefore != null) {
- // _controllerBefore.pause();
- // }
- // if (_controllerAfter != null) {
- // _controllerAfter.pause();
- // }
- // NavigatorUtils.push(context,
- // "${WodeRouter.confirmOrder}?id=${detailObj.id}");
- }
- },
- )
- : Container(child: null),
- OrderConstant.isShow(
- detailObj.statuz,
- detailObj.dataTable,
- 'showExpertArchiveButton',
- examineFlag: detailObj
- .questionBankEntity?.examineFlag)
- ? BottomBtn(
- title: detailObj.questionBankEntity
- ?.examineFlag ==
- 2
- ? '重新提交'
- : "立即归档",
- fun: () {
- if (_controllerBefore != null) {
- _controllerBefore.pause();
- }
- if (_controllerAfter != null) {
- _controllerAfter.pause();
- }
- NavigatorUtils.push(context,
- "${WodeRouter.archive}?id=${detailObj.id}");
- },
- )
- : Container(child: null),
- ],
- ),
- ),
- )
- ],
- ),
- );
- },
- )
- : Center(
- child: Text("正在加载..."),
- ),
- ),
- );
- }
- _lineSpase() {
- return Container(
- color: ThemeUtils.getDialogTextFieldColor(context),
- height: ScreenUtil().setWidth(5),
- );
- }
- _orderTypeHead() {
- return Container(
- // decoration: BoxDecoration(
- // gradient: const LinearGradient(
- // colors: [Color(0xFF00D9FF), Color(0xFF0287FF)],
- // ),
- // ),
- padding: EdgeInsets.only(
- top: ScreenUtil().setWidth(10), left: ScreenUtil().setWidth(10)),
- height: ScreenUtil().setWidth(90),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Row(
- // crossAxisAlignment: CrossAxisAlignment.start,
- // mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Icon(
- // : 0xe604,
- OrderConstant.getIconFontCode(
- detailObj.statuz, detailObj.dataTable),
- size: 20.0,
- color: Color(0xff333333),
- ),
- SizedBox(
- width: 5,
- ),
- Text(
- OrderConstant.getStatusName(
- detailObj.statuz, detailObj.dataTable,
- arrivedFlag: detailObj.arrivedFlag,
- userType: 'Expert',
- examineFlag: detailObj.questionBankEntity?.examineFlag),
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Colours.text,
- ),
- ),
- Expanded(child: Container()),
- Text(
- '订单号:',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Colours.text,
- ),
- ),
- Text(
- '${detailObj.orderNo ?? '无'}',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(14),
- color: Colours.text_gray,
- ),
- ),
- //
- SizedBox(
- width: 10,
- )
- ],
- ),
- Container(
- margin: EdgeInsets.only(left: 25, top: 10),
- child: Text(
- // '',
- OrderConstant.getdetailStatusName(
- detailObj.statuz, detailObj.dataTable,
- arrivedFlag: detailObj.arrivedFlag, userType: 'Expert'),
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(13),
- color: Colours.dark_text_gray,
- ),
- ),
- )
- ],
- ),
- );
- }
- _orderUserDetail() {
- return Container(
- // height: 20,
- padding: EdgeInsets.only(
- bottom: ScreenUtil().setWidth(20), top: ScreenUtil().setWidth(10)),
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Expanded(
- child: GestureDetector(
- onTap: () {
- if (_controllerBefore != null) {
- _controllerBefore?.pause();
- }
- if (_controllerAfter != null) {
- _controllerAfter?.pause();
- }
- NavigatorUtils.push(context,
- "${BbsRouter.recommendAsk}?id=${detailObj.id}&type=3");
- },
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- SizedBox(
- width: 10,
- ),
- ClipRRect(
- borderRadius: BorderRadius.circular(20),
- child: LoadNetworkImage(
- detailObj.avatarUrl,
- width: ScreenUtil().setWidth(43),
- height: ScreenUtil().setWidth(43),
- // alignment: Alignment.centerLeft,
- ),
- // Container(
- // margin: EdgeInsets.only(
- // left: ScreenUtil().setWidth(15),
- // right: ScreenUtil().setWidth(10),
- // // top: ScreenUtil().setWidth(5)
- // ),
- // decoration: BoxDecoration(
- // borderRadius: BorderRadius.circular(
- // ScreenUtil().setWidth(22)),
- // ),
- // child: LoadNetworkImage(
- // detailObj.avatarUrl,
- // width: ScreenUtil().setWidth(43),
- // height: ScreenUtil().setWidth(43),
- // // alignment: Alignment.centerLeft,
- // ),
- // ),
- ),
- SizedBox(
- width: 10,
- ),
- Expanded(
- child: Container(
- padding:
- EdgeInsets.only(right: ScreenUtil().setWidth(15)),
- child: Column(
- children: <Widget>[
- Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.start,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- detailObj.name ?? '',
- style: TextStyle(
- fontSize: ScreenUtil().setSp(17),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- decoration: BoxDecoration(
- //背景
- color: detailObj.dataTable == 1
- ? Colours.blue_app_main
- : Color(0xffFDAF2C),
- //设置四周圆角 角度
- borderRadius: BorderRadius.all(
- Radius.circular(4.0)),
- ),
- margin: EdgeInsets.only(left: 5),
- padding: EdgeInsets.only(
- left: 5, right: 5, top: 2, bottom: 2),
- child: Text(
- detailObj.dataTable == 1
- ? '问诊服务'
- : '出诊服务',
- style: TextStyle(
- color: Colors.white,
- fontSize: ScreenUtil().setSp(14),
- ),
- textAlign: TextAlign.start,
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- Container(
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Text(
- detailObj.createTime != null
- ? DateUtils.instance.getFormartData(
- timeSamp: detailObj.createTime,
- format: "MM月dd日")
- : '',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- Container(
- padding: EdgeInsets.only(left: 5),
- child: Text(
- detailObj.brandName ?? '',
- style: TextStyle(
- color: Colours.blue_app_main,
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- )
- ],
- ),
- ],
- ),
- ),
- detailObj.dataTable != 1
- ? Container(
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.spaceBetween,
- children: <Widget>[
- Row(
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: <Widget>[
- Container(
- // padding: EdgeInsets.only(left: 5),
- child: Text(
- '出诊时间:',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize:
- ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- ),
- Text(
- detailObj.arrivedTime != null
- ? DateUtils.instance
- .getFormartData(
- timeSamp: detailObj
- .arrivedTime,
- format: "MM月dd日 HH:mm")
- : '',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- ],
- ),
- ],
- ),
- )
- : Container(),
- detailObj.dataTable != 1
- ? Container(
- // margin: EdgeInsets.only(top: 6),
- child: Row(
- children: <Widget>[
- Container(
- // padding: EdgeInsets.only(left: 5),
- child: Text(
- '出诊地点:',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- ),
- Container(
- width: ScreenUtil().setWidth(230),
- child: Text(
- '${detailObj.address ?? ''}',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(13),
- // color: Color(0xff666666),
- // fontSize: ScreenUtil().setSp(15),
- ),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- ],
- ),
- )
- : Container(),
- Container(
- // margin: EdgeInsets.only(top: 6),
- child: Row(
- children: <Widget>[
- Container(
- // padding: EdgeInsets.only(left: 5),
- child: Text(
- '问题描述:',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- ),
- Container(
- width: ScreenUtil().setWidth(230),
- child: Text(
- '${detailObj.expression ?? ''}',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(13),
- // color: Color(0xff666666),
- // fontSize: ScreenUtil().setSp(15),
- ),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- ],
- ),
- ),
- Container(
- // margin: EdgeInsets.only(top: 6),
- child: Row(
- children: <Widget>[
- Container(
- // padding: EdgeInsets.only(left: 5),
- child: Text(
- '出厂日期:',
- style: TextStyle(
- color: Color(0xff999999),
- fontSize: ScreenUtil().setSp(13),
- ),
- textAlign: TextAlign.start,
- ),
- ),
- Container(
- width: ScreenUtil().setWidth(230),
- child: Text(
- '${detailObj.productionDate ?? ''}',
- style: TextStyle(
- color: Color(0xff666666),
- fontSize: ScreenUtil().setSp(13),
- // color: Color(0xff666666),
- // fontSize: ScreenUtil().setSp(15),
- ),
- textAlign: TextAlign.start,
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- ),
- ),
- ],
- ),
- ),
- // Container(
- // child: Row(
- // mainAxisAlignment:
- // MainAxisAlignment.start,
- // children: <Widget>[
- // Row(
- // crossAxisAlignment:
- // CrossAxisAlignment
- // .center,
- // children: <Widget>[
- // Text(
- // detailObj.createTime !=
- // null
- // ? DateUtils
- // .instance
- // .getFormartData(
- // timeSamp:
- // detailObj
- // .createTime,
- // format:
- // "MM月dd日",
- // )
- // : '',
- // style: TextStyle(
- // color: Color(
- // 0xff999999),
- // fontSize:
- // ScreenUtil()
- // .setSp(
- // 13),
- // ),
- // textAlign:
- // TextAlign.left,
- // ),
- // Container(
- // padding:
- // EdgeInsets.only(
- // left: 5),
- // child: Text(
- // detailObj
- // .brandName ??
- // '',
- // style: TextStyle(
- // color: Color(
- // 0xff999999),
- // fontSize:
- // ScreenUtil()
- // .setSp(
- // 13),
- // ),
- // textAlign:
- // TextAlign
- // .left,
- // ),
- // )
- // ],
- // ),
- // ],
- // ),
- // ),
- // Row(
- // mainAxisAlignment:
- // MainAxisAlignment.start,
- // children: <Widget>[
- // Container(
- // width: 260,
- // child: Text(
- // detailObj.expression ??
- // '',
- // style: TextStyle(
- // color:
- // Color(0xff0288FF),
- // fontSize: ScreenUtil()
- // .setSp(15),
- // ),
- // textAlign:
- // TextAlign.left,
- // maxLines: 1,
- // overflow: TextOverflow
- // .ellipsis,
- // ),
- // ),
- // ],
- // ),
- ],
- ),
- ),
- )
- ],
- ),
- ),
- ),
- ],
- ),
- );
- }
- _orderMoneyDetail() {
- return Column(
- children: [
- detailObj.dataTable == 2
- ? Heng(
- left: "差旅费",
- right: detailObj.travelCost != null
- ? "¥" + detailObj.travelCost.toString()
- : '¥0',
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- )
- : Container(),
- Heng(
- left: "技术服务费",
- right: detailObj.serviceCost != null
- ? "¥" + detailObj.serviceCost.toString()
- : '¥0',
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- ),
- Heng(
- left: "优惠券抵扣",
- right: detailObj.couponDeduction != null
- ? "-¥" + detailObj.couponDeduction.toString()
- : '-¥0',
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- ),
- Heng(
- left: "红包抵扣",
- right: detailObj.redEnvelopeDeduction != null
- ? "-¥" + detailObj.redEnvelopeDeduction.toString()
- : '-¥0',
- leftColor: 0xff333333,
- rightColor: 0xff333333,
- ),
- Heng(
- left: "实付款",
- right: detailObj.payCost != null && getPayCost()
- ? "¥" + detailObj.payCost.toString()
- : '¥' + totalPay.toStringAsFixed(2).toString(),
- leftColor: 0xff333333,
- rightColor: 0xffFD0808,
- ),
- ],
- );
- }
- _orderTime() {
- return Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(10),
- bottom: ScreenUtil().setWidth(10)),
- child: Row(
- children: <Widget>[
- Text(
- '下单时间:',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff333333),
- ),
- ),
- Text(
- detailObj.createTime != null
- ? DateUtils.instance.getFormartData(
- timeSamp: detailObj.createTime,
- format: "yyyy-MM-dd HH:mm:ss")
- : '',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(13),
- color: Color(0xff999999),
- ),
- ),
- ],
- ),
- );
- }
- ///现场视频维修前维修后
- _orderLiveVideo() {
- double width = MediaQuery.of(context).size.width;
- return Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Container(
- width: width,
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(10),
- bottom: ScreenUtil().setWidth(10)),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(width: .5, color: Color(0xfff5f5f5)),
- ),
- ),
- child: Text(
- '现场情况(维修前)',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 17,
- color: Color(0xff333333),
- ),
- ),
- ),
- detailObj.beforeRepair != null
- ? Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(15)),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(5),
- child: new Chewie(
- controller: ChewieController(
- videoPlayerController:
- // VideoPlayerController.network(
- // Utils.getImagePath(detailObj.beforeRepair)
- // // imgFontUrl + detailObj.url
- // )
- _controllerBefore,
- aspectRatio: 3 / 2,
- autoPlay: false,
- looping: true,
- showControls: true,
- deviceOrientationsAfterFullScreen: [
- DeviceOrientation.portraitUp,
- ],
- // 占位图
- // placeholder: Image.network(
- // imgFontUrl+detailObj.cover,
- // fit: BoxFit.contain,
- // ),
- // 是否在 UI 构建的时候就加载视频
- autoInitialize: true,
- // 拖动条样式颜色
- materialProgressColors: new ChewieProgressColors(
- playedColor: Colors.red,
- handleColor: Colors.blue,
- backgroundColor: Colors.grey,
- bufferedColor: Colors.lightGreen,
- ),
- ),
- ),
- ))
- : Container(
- padding: EdgeInsets.only(left: 15),
- child: Text("暂无"),
- ),
- Container(
- width: width,
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(10),
- bottom: ScreenUtil().setWidth(10)),
- decoration: BoxDecoration(
- border: Border(
- bottom: BorderSide(width: .5, color: Color(0xfff5f5f5)),
- ),
- ),
- child: Text(
- '现场情况(维修后)',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 17,
- color: Color(0xff333333),
- ),
- ),
- ),
- detailObj.afterRepair != null
- ? Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(15)),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(5),
- child: new Chewie(
- controller: ChewieController(
- videoPlayerController:
- // VideoPlayerController.network(
- // Utils.getImagePath(detailObj.afterRepair)
- // // imgFontUrl + detailObj.url
- // )
- _controllerAfter,
- aspectRatio: 3 / 2,
- autoPlay: false,
- looping: true,
- showControls: true,
- deviceOrientationsAfterFullScreen: [
- DeviceOrientation.portraitUp,
- ],
- // 占位图
- // placeholder: Image.network(
- // imgFontUrl+detailObj.cover,
- // fit: BoxFit.contain,
- // ),
- // 是否在 UI 构建的时候就加载视频
- autoInitialize: true,
- // 拖动条样式颜色
- materialProgressColors: new ChewieProgressColors(
- playedColor: Colors.red,
- handleColor: Colors.blue,
- backgroundColor: Colors.grey,
- bufferedColor: Colors.lightGreen,
- ),
- ),
- ),
- ))
- : Container(
- padding: EdgeInsets.only(left: 15),
- child: Text("暂无"),
- ),
- ],
- );
- }
- _boHuiTip() {
- double width = MediaQuery.of(context).size.width;
- return Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(10),
- bottom: ScreenUtil().setWidth(10)),
- child: Column(
- children: <Widget>[
- detailObj.questionBankEntity != null
- ? Row(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: <Widget>[
- Text(
- '驳回原因:',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(13),
- color: Color(0xff666666),
- ),
- ),
- Container(
- width: width * 0.75,
- child: Text(
- detailObj.questionBankEntity?.notExamineReason ?? "",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(13),
- color: Color(0xff666666),
- ),
- ),
- )
- ],
- )
- : Container(
- child: null,
- ),
- ],
- ),
- );
- }
- _uploadLiveVideo() {
- return Column(
- children: [
- detailObj.arrivedFlag != 1
- ? Row(
- children: [
- Container(
- height: 11,
- width: 2,
- color: Colours.blue_app_main,
- ),
- SizedBox(
- width: 13,
- ),
- Text('打卡信息')
- ],
- )
- : Container(),
- detailObj.arrivedFlag != 1
- ? Container(
- height: 40,
- child: InkWell(
- onTap: () {
- Navigator.of(context).push(MaterialPageRoute(
- builder: (context) => ExpertCheckPage(
- backFun: (lat, lon, add) {
- latitude = lat;
- longitude = lon;
- address = add;
- print(address);
- setState(() {});
- },
- )));
- },
- child: Row(
- children: [
- SizedBox(
- width: 15,
- ),
- Icon(
- const IconData(0xe638, fontFamily: "Iconfont"),
- size: 17.0,
- color: Colours.blue_app_main,
- ),
- Text(
- '${address ?? '点击查看位置'}',
- style: TextStyle(color: Colours.blue_app_main),
- ),
- Expanded(child: Container()),
- Icon(
- Icons.arrow_forward_ios,
- size: 12,
- color: Color(0xff999999),
- ),
- SizedBox(
- width: 15,
- ),
- ],
- ),
- ),
- )
- : Container(),
- Row(
- children: [
- Container(
- height: 11,
- width: 2,
- color: Colours.blue_app_main,
- ),
- SizedBox(
- width: 13,
- ),
- Text(detailObj.arrivedFlag != 1 ? '现场情况(维修前)' : '现场情况(维修后)')
- ],
- ),
- Container(
- // color: ThemeUtils.getDialogTextFieldColor(context),
- // color: Colors.red,
- child: GridView.builder(
- shrinkWrap: true,
- padding: const EdgeInsets.fromLTRB(8.0, 0, 8.0, 12.0),
- physics: NeverScrollableScrollPhysics(),
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 1, childAspectRatio: 1.5),
- itemCount: 1,
- itemBuilder: (_, index) {
- return Stack(
- children: <Widget>[
- Center(
- child: SelectedVideo(
- image: videoUrl,
- index: index,
- videoPlay: videoPlay(),
- onTap: () {
- if (videoUrl == null) {
- selectPicker();
- }
- },
- ),
- ),
- videoUrl != null
- ? Positioned(
- top: 0,
- right: 0,
- child: GestureDetector(
- onTap: () {
- setState(() {
- videoUrl = null;
- str = null;
- _controller.pause();
- // player.reset();
- });
- },
- child: Icon(
- const IconData(0xe651, fontFamily: "Iconfont"),
- size: 24.0,
- color: Color(0xff999999),
- ),
- ),
- )
- : Container(
- child: null,
- )
- ],
- );
- },
- ),
- )
- ],
- );
- }
- _orderSSInfo() {
- return Container(
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(10),
- bottom: ScreenUtil().setWidth(10)),
- child: Column(
- children: <Widget>[
- Row(
- children: <Widget>[
- Text(
- '申诉内容:',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff333333),
- ),
- ),
- Text(
- detailObj.liftCaseAppealEntity != null &&
- detailObj.liftCaseAppealEntity.content != null
- ? detailObj.liftCaseAppealEntity.content
- : '',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff999999),
- ),
- ),
- ],
- ),
- Row(
- children: <Widget>[
- Text(
- '申诉时间:',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff333333),
- ),
- ),
- Text(
- detailObj.liftCaseAppealEntity != null &&
- detailObj.liftCaseAppealEntity.createTime != null
- ? DateUtils.instance.getFormartData(
- timeSamp: detailObj.liftCaseAppealEntity.createTime,
- format: "yyyy-MM-dd HH:mm:ss")
- : '',
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff999999),
- ),
- ),
- ],
- ),
- ],
- ),
- );
- }
- VideoPlayerController _controller;
- VideoPlayerController _controllerFile;
- ChewieController _chewieController;
- ///选择图片
- void selectPicker() {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return SimpleDialog(
- title: Text("选择方式"),
- children: ["拍照", '从手机相册选择'].map((String value) {
- print("$value");
- return SimpleDialogOption(
- child: Text(
- "${value}",
- style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
- ),
- onPressed: () {
- _getImage(value == '拍照' ? 1 : 0);
- Navigator.of(context).pop();
- },
- );
- }).toList(),
- );
- },
- );
- }
- void _getImage(int key) async {
- print(key);
- print(333);
- try {
- await ImagePicker.pickVideo(
- source: key == 1 ? ImageSource.camera : ImageSource.gallery,
- ).then((File f) async {
- if (f != null) {
- _controllerFile = VideoPlayerController.file(f);
- _controllerFile.initialize().then((val) {
- _controllerFile.setLooping(true);
- int seconds = _controllerFile.value.duration.inSeconds;
- print("视频时长:$seconds");
- int fileSize = f.lengthSync(); //单位B
- print("视频大小:${fileSize}");
- print("视频大小:${f.path}");
- if (seconds <= 300) {
- _uploadImage(f.path);
- // upLoadFileOnce(_imageFile.path);
- // setState(() {});
- } else {
- toasts("视频时长不能大于5分钟!");
- }
- }).catchError((error) {
- print(error);
- print("error");
- toasts("上传失败,不支持此格式");
- });
- }
- });
- } catch (e) {
- toasts("没有权限,无法打开相册!");
- }
- }
- upLoadFileOnce(path) {
- showLoading(context, "正在上传...");
- NewApiService().upload(path, onSuccess: (res) {
- dismissLoading(context);
- setState(() {
- videoUrl = res.pathUrl;
- imagesUrl = res.coverUrl;
- });
- }, onError: (code, msg) {
- dismissLoading(context);
- toasts(msg);
- });
- }
- void _uploadImage(filePath) async {
- showPercent(context, () {
- dismissLoading(context);
- toasts("上传失败");
- }, () {
- if (videoUrl == null && str != null) {
- setState(() {
- videoUrl = str;
- settingVideoVC();
- print("videoUrl:" + videoUrl);
- dismissLoading(context);
- toasts("上传成功");
- });
- }
- });
- String uploadName = OssUtil.instance.getImageUploadName(filePath);
- await NewApiService.uploadImage(context, uploadName, filePath).then((data) {
- if (data.statusCode == 200) {
- str = NewApiUrl.URL_UPLOAD_IMAGE_OSS + "/" + uploadName;
- print("str:" + str);
- print(videoUrl);
- if (str != null) {
- Map obj = {"uploadName": uploadName, "success": true};
- FastNotification.push("percent", obj);
- }
- } else {
- Map obj = {"uploadName": uploadName, "success": false};
- FastNotification.push("percent", obj);
- }
- }).catchError((data) {
- Map obj = {"uploadName": uploadName, "success": false};
- FastNotification.push("percent", obj);
- });
- }
- settingVideoVC() {
- _controller?.pause();
- _controller?.dispose();
- _chewieController?.dispose();
- _controller = VideoPlayerController.network(Utils.getImagePath(videoUrl)
- // imgFontUrl + detailObj.url
- );
- _chewieController = ChewieController(
- videoPlayerController:
- // VideoPlayerController.network(
- // imgFontUrl + detailObj.url
- // ),
- _controller,
- aspectRatio: 3 / 2,
- autoPlay: false,
- looping: true,
- showControls: true,
- deviceOrientationsAfterFullScreen: [
- DeviceOrientation.portraitUp,
- ],
- // 占位图
- // placeholder: Image.network(
- // imgFontUrl+detailObj.cover,
- // fit: BoxFit.contain,
- // ),
- // 是否在 UI 构建的时候就加载视频
- autoInitialize: true,
- // 拖动条样式颜色
- materialProgressColors: new ChewieProgressColors(
- playedColor: Colors.red,
- handleColor: Colors.blue,
- backgroundColor: Colors.grey,
- bufferedColor: Colors.lightGreen,
- ),
- );
- }
- Widget videoPlay() {
- if (_controller == null) return Container();
- double width = MediaQuery.of(context).size.width;
- return Container(
- width: width,
- height: width * 2 / 3,
- padding: EdgeInsets.only(
- left: ScreenUtil().setWidth(15),
- right: ScreenUtil().setWidth(15),
- top: ScreenUtil().setWidth(15)),
- child: ClipRRect(
- borderRadius: BorderRadius.circular(5),
- child: new Chewie(controller: _chewieController),
- ));
- }
- // 获取定位权限
- Future<bool> requestPermission() async {
- final permissions = await PermissionHandler()
- .requestPermissions([PermissionGroup.location]);
- if (permissions[PermissionGroup.location] == PermissionStatus.granted) {
- return true;
- } else {
- toasts('需要定位权限!');
- return false;
- }
- }
- // 获取位置信息
- Future<void> punchin() async {
- ///开始定位之前设置定位参数
- if (longitude == null) {
- toasts("请选择打卡地点");
- return;
- }
- if (longitude != null && latitude != null) {
- if (videoUrl == null || videoUrl == '') {
- toasts("请上传视频");
- return;
- }
- showLoading(context);
- NewApiService().chargeToClock({
- "id": detailObj.id,
- "lng": longitude,
- "lat": latitude,
- "beforeRepair": videoUrl,
- }, onSuccess: (res) {
- dismissLoading(context);
- toasts("确认打卡成功");
- if (_controller != null) {
- _controller.pause();
- }
- getBrandDetail();
- // NavigatorUtils.push(
- // context, "${WodeRouter.orderPageMaster}?checkType=0");
- setState(() {});
- }, onError: (code, msg) {
- dismissLoading(context);
- toasts(msg);
- });
- }
- }
- ///确认完成
- submitApply() {
- if (videoUrl == null || videoUrl == '') {
- toasts("请上传视频");
- return;
- }
- showLoading(context);
- NewApiService().chargeMakeSureCase({
- "id": widget.id,
- "afterRepair": videoUrl,
- }, onSuccess: (res) {
- dismissLoading(context);
- toasts("确认完成");
- if (_controller != null) {
- _controller.pause();
- }
- NavigatorUtils.push(context, "${WodeRouter.orderPageMaster}?checkType=0");
- setState(() {});
- }, onError: (code, msg) {
- dismissLoading(context);
- toasts(msg);
- });
- }
- getPayCost() {
- bool isPay = true;
- if ((detailObj.dataTable == 1 && detailObj.statuz == 0) ||
- (detailObj.dataTable == 2 && detailObj.statuz == 2)) {
- isPay = false;
- }
- return isPay;
- }
- isShowMoneyDetail() {
- bool show = true;
- if (detailObj.dataTable == 2) {
- switch (detailObj.statuz) {
- case 0:
- case 1:
- show = false;
- break;
- default:
- }
- }
- // if ((detailObj.dataTable == 2 && (detailObj.statuz == 2)) ||
- // (detailObj.dataTable == 2 && detailObj.statuz == 2)) {
- // show = false;
- // }
- return show;
- }
- isShowOrderLive() {
- bool show = false;
- if (detailObj.dataTable == 2) {
- show = true;
- switch (detailObj.statuz) {
- case 0:
- case 1:
- case 2:
- case 3:
- {
- if (detailObj.arrivedFlag == 2) {
- show = true;
- } else {
- show = false;
- }
- }
- break;
- default:
- }
- }
- return show;
- }
- @override
- bool get wantKeepAlive => true;
- }
- class BottomBtn extends StatelessWidget {
- BottomBtn({Key key, this.title, this.fun}) : super(key: key);
- Function fun;
- String title;
- @override
- Widget build(BuildContext context) {
- return Expanded(
- // margin: EdgeInsets.only(left: 10),
- child: GestureDetector(
- onTap: () {
- fun();
- },
- child: Container(
- child: Container(
- margin: EdgeInsets.only(left: 15, right: 15),
- // // height:22,
- // padding: EdgeInsets.only(
- // left: ScreenUtil().setWidth(20),
- // right: ScreenUtil().setWidth(20),
- // ),
- decoration: BoxDecoration(
- border: Border.all(width: 1, color: Color(0xff1B87F6)),
- borderRadius: BorderRadius.circular(23),
- color: Colours.blue_app_main),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- Text(
- title,
- textAlign: TextAlign.center,
- style: TextStyle(
- fontSize: ScreenUtil().setSp(15),
- color: Colors.white,
- ),
- ),
- ],
- ),
- ),
- ),
- ),
- );
- }
- }
|