wode_page.dart 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
  1. import 'dart:async';
  2. // import 'dart:html';
  3. import 'dart:io';
  4. import 'package:barcode_scan/barcode_scan.dart';
  5. import 'package:flustars/flustars.dart' as FlutterStars;
  6. import 'package:flutter/cupertino.dart';
  7. import 'package:flutter/material.dart';
  8. // import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
  9. import 'package:flutter/services.dart';
  10. import 'package:flutter_screenutil/flutter_screenutil.dart';
  11. import 'package:image_picker/image_picker.dart';
  12. import 'package:liftmanager/common/user_db.dart';
  13. import 'package:liftmanager/internal/account/model/user_info_entity.dart';
  14. import 'package:liftmanager/internal/account/provider/user_provider.dart';
  15. import 'package:liftmanager/internal/wode/page/reward_record_list.dart';
  16. import 'package:liftmanager/internal/wode/wode_router.dart';
  17. import 'package:liftmanager/net/api_service.dart';
  18. import 'package:liftmanager/res/colors.dart';
  19. import 'package:liftmanager/routers/fluro_navigator.dart';
  20. import 'package:liftmanager/utils/fast_notification.dart';
  21. import 'package:liftmanager/utils/toast.dart';
  22. import 'package:liftmanager/utils/utils.dart';
  23. import 'package:liftmanager/widgets/load_image.dart';
  24. import 'package:provider/provider.dart';
  25. class WodePage extends StatefulWidget {
  26. //1用户 2专家
  27. String type = "2";
  28. @override
  29. State<StatefulWidget> createState() {
  30. return WodePageState();
  31. }
  32. }
  33. class WodePageState extends State<WodePage> with AutomaticKeepAliveClientMixin {
  34. UserProvider provider = UserProvider();
  35. ///自己造数据
  36. ///vip
  37. // bool _isVip = true;
  38. //
  39. ///是否是专家
  40. bool _iszz = FlutterStars.SpUtil.getInt("expertFlag") == 1;
  41. @override
  42. void initState() {
  43. super.initState();
  44. upDataUserLogin();
  45. getUserInfo();
  46. getCoupon();
  47. getExpertOrderCont();
  48. FastNotification.addListener("initUserMoney", (initThisUserMoney) {
  49. if (mounted) {
  50. getCoupon();
  51. setState(() {});
  52. }
  53. });
  54. FastNotification.addListener("initUserInfomation",
  55. (initThisUserInfomation) {
  56. if (mounted) {
  57. getUserInfo();
  58. setState(() {});
  59. }
  60. });
  61. }
  62. String indexNow;
  63. final _cancelController = TextEditingController(text: "取消");
  64. Map<String, dynamic> detailOj = {
  65. "couponNum": 0,
  66. "balance": 0.0,
  67. "hongBaoNum": 0,
  68. "memberDays": "",
  69. };
  70. int isVip = 1;
  71. ///获取用户信息
  72. void getUserInfo() {
  73. ApiService(context: context).userInfo(
  74. onSuccess: (data) {
  75. setUser(data);
  76. // print(data.showWhichName);
  77. indexNow = data.showWhichName.toString();
  78. },
  79. onError: (code, msg) {},
  80. );
  81. }
  82. //更新用户信息
  83. Future upDataUserLogin() async {
  84. await NewApiService().upDataUserLogin(onSuccess: (res) {
  85. User().setCurrentUser(res, type: 'upDataAppMenus');
  86. _iszz = FlutterStars.SpUtil.getInt("expertFlag") == 1;
  87. String initThisUserMoney = randomInt(1111, 9999).toString() +
  88. DateTime.now().millisecondsSinceEpoch.toString();
  89. FastNotification.push("initUserMoney", initThisUserMoney);
  90. String initThisUserInfomation = randomInt(1111, 9999).toString() +
  91. DateTime.now().millisecondsSinceEpoch.toString();
  92. FastNotification.push("initUserInfomation", initThisUserInfomation);
  93. // setState(() {});
  94. }, onError: (code, msg) {
  95. toasts(msg);
  96. });
  97. }
  98. Map<String, dynamic> expertorderOj = {
  99. "totalMoney": 0,
  100. "askNum": 0,
  101. "outNum": 0,
  102. "dealingNum": 0
  103. };
  104. ///获取专家订单信息
  105. void getExpertOrderCont() {
  106. NewApiService().getExpertOrderCont(
  107. onSuccess: (data) {
  108. expertorderOj = data;
  109. print(data);
  110. setState(() {});
  111. // setUser(data);
  112. // print(data.showWhichName);
  113. // indexNow = data.showWhichName.toString();
  114. },
  115. onError: (code, msg) {},
  116. );
  117. }
  118. Future scan() async {
  119. try {
  120. // 此处为扫码结果,barcode为二维码的内容
  121. String barcode = await BarcodeScanner.scan();
  122. print(barcode);
  123. // http://lift.whlhcx.com/h5/index.html?page=/wode/vip&id=1288674418578472962
  124. // return;
  125. // print('扫码结果: ' + jsonDecode(barcode)["url"]);
  126. Uri u = Uri.parse(barcode);
  127. String id = u.queryParameters['id'];
  128. print('扫码结果: ' + id);
  129. // print('扫码结果: ' + jsonDecode(barcode)["userId"].toString());
  130. NewApiService().getUserRebates(id, onSuccess: (res) {
  131. toastsF(
  132. context, "你已成功接受${res != null ? res.toString() : ''}的邀请,立即成为会员!",
  133. timeInSecForIos: 3);
  134. // toasts("您已成为${res!=null?res.toString():''}的下级用户");
  135. NavigatorUtils.push(context, "${WodeRouter.vip}?id=");
  136. }, onError: (code, msg) {
  137. toasts(msg);
  138. });
  139. } on PlatformException catch (e) {
  140. if (e.code == BarcodeScanner.CameraAccessDenied) {
  141. // 未授予APP相机权限
  142. print('未授予APP相机权限');
  143. } else {
  144. // 扫码错误
  145. print('扫码错误: $e');
  146. }
  147. } on FormatException {
  148. // 进入扫码页面后未扫码就返回
  149. print('进入扫码页面后未扫码就返回');
  150. } catch (e) {
  151. // 扫码错误
  152. print('扫码错误: $e');
  153. }
  154. }
  155. // Future<void> scan() async {
  156. // String barcodeScanRes;
  157. // // Platform messages may fail, so we use a try/catch PlatformException.
  158. // try {
  159. // barcodeScanRes = await FlutterBarcodeScanner.scanBarcode(
  160. // "#ff6666", "取消", true, ScanMode.BARCODE);
  161. // print(123456);
  162. // print(barcodeScanRes);
  163. // Uri u = Uri.parse(barcodeScanRes);
  164. // String id = u.queryParameters['id'];
  165. // print("123456--" + id);
  166. // NewApiService().getUserRebates(id,
  167. // onSuccess: (res) {
  168. // toastsF(context,"你已成功接受${res!=null?res.toString():''}的邀请,立即成为会员!",timeInSecForIos:3);
  169. // // toasts("您已成为${res!=null?res.toString():''}的下级用户");
  170. // NavigatorUtils.push(context, "${WodeRouter.vip}?id=");
  171. // }, onError: (code, msg) {
  172. // toasts(msg);
  173. // });
  174. // } on PlatformException {
  175. // barcodeScanRes = 'Failed to get platform version.';
  176. // }
  177. // // If the widget was removed from the tree while the asynchronous platform
  178. // // message was in flight, we want to discard the reply rather than calling
  179. // // setState to update our non-existent appearance.
  180. // if (!mounted) return;
  181. // }
  182. Future getCoupon() async {
  183. await NewApiService().getUserCoupons(onSuccess: (res) {
  184. if (res != null) {
  185. detailOj["couponNum"] = res["couponNum"];
  186. detailOj["balance"] = res["balance"];
  187. detailOj["hongBaoNum"] = res["hongBaoNum"];
  188. detailOj["memberDays"] = res["memberDays"];
  189. isVip = res["isVip"];
  190. FlutterStars.SpUtil.putInt('isVip', isVip);
  191. setState(() {});
  192. print(6666544);
  193. }
  194. }, onError: (code, msg) {
  195. toasts(msg);
  196. });
  197. }
  198. void setUser(UserInfoEntity user) {
  199. provider.setUser(user);
  200. }
  201. ///选择图片
  202. void selectPicker() {
  203. showDialog(
  204. context: context,
  205. builder: (BuildContext context) {
  206. return SimpleDialog(
  207. title: Text("修改头像"),
  208. children: ["拍照", '从手机相册选择'].map((String value) {
  209. print("$value");
  210. return SimpleDialogOption(
  211. child: Text(
  212. "${value}",
  213. style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
  214. ),
  215. onPressed: () {
  216. _getImage(value == '拍照' ? 1 : 0);
  217. Navigator.of(context).pop();
  218. },
  219. );
  220. }).toList(),
  221. );
  222. },
  223. );
  224. }
  225. void _getImage(int key) async {
  226. try {
  227. var _imageFile = await ImagePicker.pickImage(
  228. source: key == 1 ? ImageSource.camera : ImageSource.gallery,
  229. maxWidth: 800,
  230. imageQuality: 95);
  231. if (_imageFile != null) {
  232. updateAvatar(_imageFile);
  233. setState(() {});
  234. }
  235. } catch (e) {
  236. toasts("没有权限,无法打开相册!");
  237. }
  238. }
  239. void updateAvatar(File imageFile) {
  240. List<File> list = [imageFile];
  241. ApiService(context: context).uploadMore(list, onSuccess: (imgs) {
  242. ApiService(context: context).modifyAvatar(imgs[0], onSuccess: (res) {
  243. if (res != null) {
  244. getUserInfo();
  245. }
  246. }, onError: (code, msg) {
  247. toasts(msg);
  248. });
  249. });
  250. }
  251. void _updateUserInfo(value) {
  252. ApiService(context: context).modifyName(value, onSuccess: (res) {
  253. if (res != null) {
  254. getUserInfo();
  255. }
  256. }, onError: (code, msg) {
  257. toasts(msg);
  258. });
  259. }
  260. @override
  261. void dispose() {
  262. // provider.dispose();
  263. super.dispose();
  264. }
  265. static const OrderTypeList = [
  266. {
  267. "title": "待付款",
  268. "img": "wode/order_1",
  269. },
  270. {
  271. "title": "待确认",
  272. "img": "wode/order_3",
  273. },
  274. {
  275. "title": "待评价",
  276. "img": "wode/order_2",
  277. },
  278. {
  279. "title": "申诉",
  280. "img": "wode/order_4",
  281. },
  282. ];
  283. @override
  284. Widget build(BuildContext context) {
  285. return
  286. // Center(child:new Text("个人中心"));
  287. ChangeNotifierProvider<UserProvider>(
  288. create: (_) => provider,
  289. child: Scaffold(
  290. body: Consumer<UserProvider>(
  291. builder: (_, provider, __) {
  292. return Container(
  293. color: Colours.grey_app_bg,
  294. child: Column(
  295. children: [
  296. _headWidget(),
  297. Expanded(
  298. child: RefreshIndicator(
  299. onRefresh: () async {
  300. setState(() {
  301. getUserInfo();
  302. getCoupon();
  303. getExpertOrderCont();
  304. upDataUserLogin();
  305. });
  306. },
  307. child: ListView(
  308. padding: EdgeInsets.only(top: 0),
  309. children: <Widget>[
  310. _iszz ? _myJieDan() : Container(),
  311. _myOrder(context),
  312. _applications(),
  313. ],
  314. ),
  315. ),
  316. ),
  317. ],
  318. ));
  319. },
  320. ),
  321. ),
  322. );
  323. }
  324. _headWidget() {
  325. MediaQueryData mq = MediaQuery.of(context);
  326. return ClipPath(
  327. clipper: BottomClipper(clipheight: 15), //路
  328. child: Stack(
  329. children: [
  330. Positioned(
  331. left: 0,
  332. right: -40,
  333. child: Container(
  334. // color: Colors.red,
  335. height: 225 + mq.padding.top,
  336. width: double.infinity,
  337. child: LoadAssetImage(
  338. "wode_head_bg",
  339. fit: BoxFit.cover,
  340. // key: const Key('add'),
  341. // color: Colors.white,
  342. ),
  343. ),
  344. ),
  345. Container(
  346. margin: EdgeInsets.only(
  347. right: ScreenUtil().setWidth(8), top: mq.padding.top),
  348. height: 210,
  349. child: Column(
  350. children: <Widget>[
  351. Container(
  352. height: 60,
  353. // color: Colors.,
  354. child: Stack(
  355. children: [
  356. Container(
  357. width: double.infinity,
  358. alignment: Alignment.center,
  359. child: Text(
  360. '个人中心',
  361. style: TextStyle(
  362. color: Colors.white,
  363. fontWeight: FontWeight.w400,
  364. fontSize: 16),
  365. ),
  366. ),
  367. Positioned(
  368. top: 0,
  369. right: -10,
  370. child: Container(
  371. height: 60,
  372. // alignment: Alignm,
  373. child: IconButton(
  374. onPressed: () {
  375. NavigatorUtils.push(context,
  376. "${WodeRouter.settingPage}?indexNow=$indexNow");
  377. },
  378. icon: LoadAssetImage(
  379. "icon_setting",
  380. key: const Key('add'),
  381. width: 24,
  382. height: 24,
  383. color: Colors.white,
  384. ),
  385. ),
  386. ))
  387. ],
  388. ),
  389. ),
  390. Row(
  391. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  392. crossAxisAlignment: CrossAxisAlignment.center,
  393. children: <Widget>[
  394. GestureDetector(
  395. onTap: () {
  396. NavigatorUtils.push(context, WodeRouter.personalPage);
  397. },
  398. child: Container(
  399. padding: EdgeInsets.only(
  400. left: 10,
  401. // top: ScreenUtil().setHeight(5),
  402. // bottom: ScreenUtil().setWidth(25),
  403. ),
  404. child: Row(
  405. children: <Widget>[
  406. Container(
  407. padding: EdgeInsets.only(
  408. right: 10,
  409. ),
  410. child:
  411. // CircleAvatar(
  412. // radius: 24,
  413. // backgroundColor: Colors.transparent,
  414. // backgroundImage:
  415. // ImageUtils.getImageProvider(
  416. // provider.user?.avatarUrl),
  417. // ),
  418. ClipRRect(
  419. borderRadius: BorderRadius.circular(
  420. ScreenUtil().setWidth(35)),
  421. child: Container(
  422. child: LoadNetworkImage(
  423. provider.user?.avatarUrl,
  424. // fit: BoxFit.fitWidth,
  425. width: ScreenUtil().setWidth(70),
  426. height: ScreenUtil().setWidth(70),
  427. ),
  428. ))),
  429. Column(
  430. mainAxisAlignment: MainAxisAlignment.start,
  431. crossAxisAlignment: CrossAxisAlignment.start,
  432. children: <Widget>[
  433. Row(
  434. children: [
  435. Container(
  436. child: Text(
  437. provider.user?.showWhichName == 1
  438. ? (provider.user?.nickName ?? "")
  439. : (provider.user?.userName ?? ""),
  440. textAlign: TextAlign.left,
  441. style: TextStyle(
  442. fontSize: ScreenUtil().setSp(16),
  443. color: Color(0xffffffff),
  444. ),
  445. ),
  446. ),
  447. // img_vip_icon
  448. // provider.us
  449. LoadAssetImage(
  450. isVip == 2
  451. ? 'img_vip_icon'
  452. : 'img_novip_icon',
  453. height: 17,
  454. width: 20,
  455. fit: BoxFit.fill,
  456. // alignment: Alignment.centerLeft,
  457. ),
  458. ],
  459. ),
  460. SizedBox(height: 3),
  461. Row(
  462. children: <Widget>[
  463. Stack(
  464. children: [
  465. Container(
  466. child: LoadAssetImage(
  467. // image: AssetImage(i['img']),
  468. _iszz
  469. ? 'img_user_expert'
  470. : 'img_user_ordinary',
  471. height: 20,
  472. width: 65,
  473. fit: BoxFit.fill,
  474. // alignment: Alignment.centerLeft,
  475. ),
  476. ),
  477. Container(
  478. height: 20,
  479. // width: ScreenUtil()certificateStatus
  480. // .setWidth(65),
  481. alignment: Alignment.centerLeft,
  482. margin: EdgeInsets.only(left: 20),
  483. child: Text(
  484. _iszz
  485. ? '${provider.user?.userLevelName} Lv${FlutterStars.SpUtil.getInt("expertLevel")}'
  486. : '${provider.user?.userLevelName}',
  487. style: TextStyle(
  488. color: Colors.white,
  489. fontSize: 10),
  490. ),
  491. )
  492. ],
  493. ),
  494. // GestureDetector(
  495. // onTap: () {
  496. // // print(provider.user.userLevel);
  497. // NavigatorUtils.push(context,
  498. // "${WodeRouter.vip}?id=");
  499. // },
  500. // child: Container(
  501. // padding: EdgeInsets.only(
  502. // left: 6,
  503. // right: 6,
  504. // top: 2,
  505. // bottom: 2,
  506. // ),
  507. // decoration: BoxDecoration(
  508. // borderRadius:
  509. // BorderRadius.circular(
  510. // 10.0),
  511. // color: Colors.white,
  512. // ),
  513. // child: Row(
  514. // children: <Widget>[
  515. // Container(
  516. // child: LoadAssetImage(
  517. // // image: AssetImage(i['img']),
  518. // 'wode/zuan',
  519. // height: ScreenUtil()
  520. // .setWidth(11),
  521. // width: ScreenUtil()
  522. // .setWidth(12),
  523. // fit: BoxFit.cover,
  524. // // alignment: Alignment.centerLeft,
  525. // ),
  526. // ),
  527. // SizedBox(width: 3),
  528. // Text(
  529. // provider.user?.userLevelName !=
  530. // null &&
  531. // provider.user
  532. // ?.userLevelName !=
  533. // ''
  534. // ? provider.user
  535. // ?.userLevelName
  536. // : "成为会员",
  537. // textAlign:
  538. // TextAlign.left,
  539. // style: TextStyle(
  540. // fontSize:
  541. // ScreenUtil()
  542. // .setSp(11),
  543. // color: Color(
  544. // 0xff0288FF),
  545. // ),
  546. // ),
  547. // ],
  548. // ),
  549. // ),
  550. // ),
  551. // SizedBox(
  552. // width: 10,
  553. // ),
  554. // Container(
  555. // child: Text(
  556. // detailOj["memberDays"] ??
  557. // "",
  558. // textAlign: TextAlign.left,
  559. // style: TextStyle(
  560. // fontSize: ScreenUtil()
  561. // .setSp(14),
  562. // color: Color(0xffffffff),
  563. // ),
  564. // ),
  565. // )
  566. ],
  567. )
  568. ],
  569. ),
  570. ],
  571. ),
  572. ),
  573. ),
  574. InkWell(
  575. onTap: () {
  576. NavigatorUtils.push(context, WodeRouter.walletPage);
  577. },
  578. child: Column(
  579. crossAxisAlignment: CrossAxisAlignment.end,
  580. // mainAxisAlignment: MainAxisAlignment.end,
  581. children: [
  582. Container(
  583. // alignment: Alignment.centerRight,
  584. child: Text(
  585. detailOj["balance"] != null
  586. ? detailOj["balance"].toString()
  587. : "0.0",
  588. style: TextStyle(
  589. color: Colors.white,
  590. fontSize: ScreenUtil().setSp(18)),
  591. ),
  592. ),
  593. Row(
  594. children: [
  595. Text(
  596. '账户余额',
  597. style: TextStyle(
  598. color: Colors.white,
  599. fontSize: ScreenUtil().setSp(12)),
  600. ),
  601. Icon(
  602. Icons.arrow_forward_ios,
  603. size: 10,
  604. color: Colors.white,
  605. )
  606. ],
  607. )
  608. ],
  609. ),
  610. )
  611. ],
  612. ),
  613. ],
  614. ),
  615. ),
  616. Positioned(
  617. bottom: 5,
  618. left: 10,
  619. right: 10,
  620. child: InkWell(
  621. onTap: () {
  622. NavigatorUtils.push(context, "${WodeRouter.vip}?id=");
  623. },
  624. child: Container(
  625. height: 45,
  626. child: LoadAssetImage(
  627. "img_vip_tip",
  628. fit: BoxFit.fill,
  629. // key: const Key('add'),
  630. // color: Colors.white,
  631. ),
  632. ),
  633. ))
  634. ],
  635. ));
  636. }
  637. _myJieDan() {
  638. // widget a = Row(children: [],);
  639. return TitleCard(
  640. title: '我的接单',
  641. rightText: '查看全部接单',
  642. onTapRight: () {
  643. NavigatorUtils.push(
  644. context, "${WodeRouter.orderPageMaster}?checkType=0");
  645. },
  646. body: Container(
  647. child: Row(
  648. mainAxisAlignment: MainAxisAlignment.spaceAround,
  649. // crossAxisAlignment: CrossAxisAlignment.center
  650. // crossAxisAlignment: co,
  651. children: [
  652. SizedBox(
  653. width: ScreenUtil().setWidth(5),
  654. ),
  655. Container(
  656. padding: EdgeInsets.only(top: 15),
  657. child: Column(
  658. // crossAxisAlignment: CrossAxisAlignment.center,
  659. children: [
  660. Text(
  661. expertorderOj['totalMoney'].toString(),
  662. style: TextStyle(
  663. color: Colours.dark_text_gray, fontSize: 17),
  664. ),
  665. SizedBox(
  666. height: 5,
  667. ),
  668. Text(
  669. '总收益',
  670. style: TextStyle(
  671. color: Colours.dark_text_gray, fontSize: 13),
  672. ),
  673. ],
  674. ),
  675. ),
  676. SizedBox(
  677. width: ScreenUtil().setWidth(30),
  678. ),
  679. Container(
  680. padding: EdgeInsets.only(top: 15),
  681. child: Column(
  682. // crossAxisAlignment: CrossAxisAlignment.center,
  683. children: [
  684. Text(
  685. expertorderOj['askNum'].toString(),
  686. style: TextStyle(
  687. color: Colours.dark_text_gray, fontSize: 17),
  688. ),
  689. SizedBox(
  690. height: 5,
  691. ),
  692. Text(
  693. '问诊单数',
  694. style: TextStyle(
  695. color: Colours.dark_text_gray, fontSize: 13),
  696. ),
  697. ],
  698. ),
  699. ),
  700. SizedBox(
  701. width: ScreenUtil().setWidth(30),
  702. ),
  703. Container(
  704. padding: EdgeInsets.only(top: 15),
  705. child: Column(
  706. // crossAxisAlignment: CrossAxisAlignment.center,
  707. children: [
  708. Text(
  709. expertorderOj['outNum'].toString(),
  710. style: TextStyle(
  711. color: Colours.dark_text_gray, fontSize: 17),
  712. ),
  713. SizedBox(
  714. height: 5,
  715. ),
  716. Text(
  717. '出诊单数',
  718. style: TextStyle(
  719. color: Colours.dark_text_gray, fontSize: 13),
  720. ),
  721. ],
  722. ),
  723. ),
  724. Container(
  725. margin: EdgeInsets.only(top: 15, left: 10),
  726. // color: Colors.red,
  727. height: 30,
  728. width: 5,
  729. child: LoadAssetImage(
  730. "icon_line",
  731. fit: BoxFit.cover,
  732. // key: const Key('add'),
  733. // color: Colors.white,
  734. ),
  735. ),
  736. // Icon(icon)
  737. SizedBox(
  738. height: 5,
  739. ),
  740. InkWell(
  741. onTap: () {
  742. NavigatorUtils.push(
  743. context, "${WodeRouter.orderPageMaster}?checkType=0");
  744. },
  745. child: Container(
  746. margin: EdgeInsets.only(top: 10),
  747. // height: 100,
  748. child: Stack(
  749. children: [
  750. Column(
  751. // crossAxisAlignment: CrossAxisAlignment.center,
  752. children: [
  753. SizedBox(
  754. height: 5,
  755. ),
  756. Icon(
  757. const IconData(0xe61f, fontFamily: "Iconfont"),
  758. ),
  759. SizedBox(
  760. height: 1,
  761. ),
  762. Text(
  763. '待处理',
  764. style: TextStyle(
  765. color: Colours.dark_text_gray, fontSize: 13),
  766. ),
  767. ],
  768. ),
  769. Positioned(
  770. top: 0,
  771. right: 0,
  772. child: Container(
  773. height: 16,
  774. width: 16,
  775. alignment: Alignment.center,
  776. decoration: BoxDecoration(
  777. //背景
  778. color: Colors.white,
  779. //设置四周圆角 角度
  780. borderRadius:
  781. BorderRadius.all(Radius.circular(10.0)),
  782. //设置四周边框
  783. border: Border.all(width: 1, color: Colors.red),
  784. ),
  785. child: Text(expertorderOj['dealingNum'].toString(),
  786. style:
  787. TextStyle(fontSize: 9, color: Colors.red)),
  788. )),
  789. ],
  790. ),
  791. ),
  792. ),
  793. SizedBox(
  794. width: ScreenUtil().setWidth(5),
  795. ),
  796. ],
  797. ),
  798. ));
  799. }
  800. _myOrder(context) {
  801. List<Widget> brandList(context) => OrderTypeList.asMap().keys.map(
  802. (item) {
  803. double width = MediaQuery.of(context).size.width;
  804. return Container(
  805. padding: EdgeInsets.only(top: 15),
  806. child: _iconItem(
  807. size: 30,
  808. title: OrderTypeList[item]["title"],
  809. icon: OrderTypeList[item]['img'],
  810. ontap: () {
  811. int nums = item + 1;
  812. String index = nums.toString();
  813. NavigatorUtils.push(
  814. context, "${WodeRouter.orderPage}?checkType=$index");
  815. },
  816. ),
  817. );
  818. // InkWell(
  819. // onTap: () {
  820. // int nums = item + 1;
  821. // String index = nums.toString();
  822. // NavigatorUtils.push(
  823. // context, "${WodeRouter.orderPage}?checkType=$index");
  824. // },
  825. // child: Container(
  826. // padding: EdgeInsets.only(top: 15),
  827. // child: Column(
  828. // // crossAxisAlignment: CrossAxisAlignment.center,
  829. // children: [
  830. // Container(
  831. // // height: 70,
  832. // // color: Colors.red,
  833. // child: LoadAssetImage(
  834. // // image: AssetImage(i['img']),
  835. // OrderTypeList[item]['img'],
  836. // width: ScreenUtil().setWidth(24),
  837. // height: ScreenUtil().setWidth(24),
  838. // // alignment: Alignment.centerLeft,
  839. // ),
  840. // ),
  841. // SizedBox(height: ScreenUtil().setWidth(10)),
  842. // Container(
  843. // child: Text(
  844. // OrderTypeList[item]["title"],
  845. // style: TextStyle(
  846. // color: Colours.dark_text_gray,
  847. // fontSize: ScreenUtil().setSp(13)),
  848. // textAlign: TextAlign.start,
  849. // ),
  850. // ),
  851. // ],
  852. // ),
  853. // ),
  854. // );
  855. // Container(
  856. // // color:Colors.yellow,
  857. // width: width / 4,
  858. // child: FlatButton(
  859. // padding: EdgeInsets.all(0),
  860. // highlightColor: Colors.white,
  861. // splashColor: Colors.white,
  862. // child: Container(
  863. // // width: 90,
  864. // height: ScreenUtil().setWidth(80),
  865. // // color: Colors.red,
  866. // padding: EdgeInsets.only(
  867. // left: ScreenUtil().setWidth(10),
  868. // right: ScreenUtil().setWidth(10),
  869. // top: ScreenUtil().setWidth(10)),
  870. // child: Column(
  871. // mainAxisAlignment: MainAxisAlignment.start,
  872. // children: <Widget>[
  873. // Container(
  874. // // height: 70,
  875. // // color: Colors.red,
  876. // child: LoadAssetImage(
  877. // // image: AssetImage(i['img']),
  878. // initList[item]['img'],
  879. // width: ScreenUtil().setWidth(50),
  880. // height: ScreenUtil().setWidth(30),
  881. // // alignment: Alignment.centerLeft,
  882. // ),
  883. // ),
  884. // SizedBox(height: ScreenUtil().setWidth(10)),
  885. // Container(
  886. // child: Text(
  887. // initList[item]["title"],
  888. // style: TextStyle(
  889. // color: Colours.red,
  890. // fontSize: ScreenUtil().setSp(15)),
  891. // textAlign: TextAlign.start,
  892. // ),
  893. // ),
  894. // ]),
  895. // ),
  896. // onPressed: () {
  897. // int nums = item + 1;
  898. // String index = nums.toString();
  899. // NavigatorUtils.push(
  900. // context, "${WodeRouter.orderPage}?checkType=$index");
  901. // },
  902. // ),
  903. // );
  904. },
  905. ).toList();
  906. return TitleCard(
  907. title: '我的订单',
  908. height: 140,
  909. rightText: '查看全部订单',
  910. onTapRight: () {
  911. NavigatorUtils.push(context, "${WodeRouter.orderPage}?checkType=0");
  912. },
  913. body: Container(
  914. child: Row(
  915. mainAxisAlignment: MainAxisAlignment.spaceAround,
  916. // crossAxisAlignment: CrossAxisAlignment.center
  917. // crossAxisAlignment: co,
  918. children: brandList(context))));
  919. }
  920. _iconItem({String title, double size = 24, String icon, Function ontap}) {
  921. return InkWell(
  922. onTap: ontap,
  923. child: Container(
  924. // padding: EdgeInsets.only(top: 15),
  925. child: Column(
  926. // crossAxisAlignment: CrossAxisAlignment.center,
  927. children: [
  928. Container(
  929. // height: 70,
  930. // color: Colors.red,
  931. child: LoadAssetImage(
  932. // image: AssetImage(i['img']),
  933. icon,
  934. width: ScreenUtil().setWidth(size),
  935. height: ScreenUtil().setWidth(size),
  936. // alignment: Alignment.centerLeft,
  937. ),
  938. ),
  939. SizedBox(height: ScreenUtil().setWidth(10)),
  940. Container(
  941. child: Text(
  942. title,
  943. style: TextStyle(
  944. color: Colours.dark_text_gray,
  945. fontSize: ScreenUtil().setSp(13)),
  946. textAlign: TextAlign.start,
  947. ),
  948. ),
  949. ],
  950. ),
  951. ),
  952. );
  953. }
  954. _applications() {
  955. double itemSize = 38;
  956. return TitleCard(
  957. title: '我的服务',
  958. // rightText: '查看全部接单',
  959. height: _iszz ? 330 : 260,
  960. // onTapRight: () {},
  961. body: Container(
  962. child: GridView.count(
  963. physics: const NeverScrollableScrollPhysics(),
  964. padding: EdgeInsets.only(top: 20),
  965. // 内边距
  966. scrollDirection: Axis.vertical,
  967. childAspectRatio: 1.1,
  968. // 滚动方向
  969. crossAxisSpacing: 10,
  970. // 列间距
  971. crossAxisCount: 4,
  972. // 每行的个数(Axis.vertic == 横向三个, Axis.horizontal == 竖方向三个)
  973. mainAxisSpacing: 10,
  974. children: [
  975. _iconItem(
  976. title: "打赏记录",
  977. icon: "wode/dashang",
  978. size: itemSize,
  979. ontap: () {
  980. Navigator.of(context).push(MaterialPageRoute(
  981. builder: (context) => RewardRecordList()));
  982. // Navigator.push(context, route)
  983. // // RewardRecordList();
  984. // NavigatorUtils.push(context, WodeRouter.collectPage);
  985. },
  986. ),
  987. _iconItem(
  988. title: "收藏",
  989. icon: "wode/shoucang",
  990. size: itemSize,
  991. ontap: () {
  992. NavigatorUtils.push(context, WodeRouter.collectPage);
  993. },
  994. ),
  995. _iconItem(
  996. title: "我的视频",
  997. icon: "wode/shipin",
  998. size: itemSize,
  999. ontap: () {
  1000. NavigatorUtils.push(context, WodeRouter.myVideo);
  1001. },
  1002. ),
  1003. _iconItem(
  1004. title: "发票中心",
  1005. icon: "wode/piao",
  1006. size: itemSize,
  1007. ontap: () {
  1008. NavigatorUtils.push(context, WodeRouter.piaoCenter);
  1009. },
  1010. ),
  1011. _iconItem(
  1012. title: "优惠券",
  1013. icon: "wode/youhuiquan",
  1014. size: itemSize,
  1015. ontap: () {
  1016. NavigatorUtils.push(context, WodeRouter.couponPage);
  1017. },
  1018. ),
  1019. _iconItem(
  1020. title: "红包",
  1021. icon: "wode/hongbao",
  1022. size: itemSize,
  1023. ontap: () {
  1024. NavigatorUtils.push(context, WodeRouter.redbaoPage);
  1025. },
  1026. ),
  1027. _iconItem(
  1028. title: "我的消息",
  1029. icon: "wode/xiaoxi",
  1030. size: itemSize,
  1031. ontap: () {
  1032. NavigatorUtils.push(context, WodeRouter.noticeList);
  1033. },
  1034. ),
  1035. _iconItem(
  1036. title: "扫一扫",
  1037. icon: "wode/qr",
  1038. size: itemSize,
  1039. ontap: () {
  1040. scan();
  1041. },
  1042. ),
  1043. _iszz
  1044. ? _iconItem(
  1045. title: "专家处罚",
  1046. icon: "wode/wr",
  1047. size: itemSize,
  1048. ontap: () {
  1049. NavigatorUtils.push(context, WodeRouter.errorRecordList);
  1050. },
  1051. )
  1052. : Container(),
  1053. ],
  1054. )));
  1055. }
  1056. @override
  1057. bool get wantKeepAlive => true;
  1058. }
  1059. class TitleCard extends StatelessWidget {
  1060. String title;
  1061. String rightText;
  1062. Function onTapRight;
  1063. double height;
  1064. Widget body;
  1065. TitleCard(
  1066. {this.title,
  1067. this.rightText,
  1068. this.onTapRight,
  1069. this.body,
  1070. this.height = 120});
  1071. @override
  1072. Widget build(BuildContext context) {
  1073. return Container(
  1074. margin: EdgeInsets.only(left: 10, right: 10, bottom: 5),
  1075. decoration: new BoxDecoration(
  1076. color: Colors.white,
  1077. //设置四周圆角 角度
  1078. borderRadius: BorderRadius.all(Radius.circular(6.0)),
  1079. ),
  1080. padding: EdgeInsets.only(left: 10, right: 10, top: 15, bottom: 15),
  1081. height: height,
  1082. // width: ScreenUtil().setWidth(355),
  1083. child: Column(
  1084. children: [
  1085. Row(
  1086. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  1087. children: [
  1088. Text(title,
  1089. style: TextStyle(
  1090. color: Colours.tip_text_black,
  1091. fontSize: 15,
  1092. fontWeight: FontWeight.bold)),
  1093. rightText != null
  1094. ? InkWell(
  1095. onTap: onTapRight,
  1096. child: Row(
  1097. children: [
  1098. Text(rightText,
  1099. style: TextStyle(
  1100. color: Colours.dark_text_gray, fontSize: 13)),
  1101. Icon(
  1102. Icons.arrow_forward_ios,
  1103. color: Colours.dark_text_gray,
  1104. size: 15,
  1105. )
  1106. ],
  1107. ),
  1108. )
  1109. : Container()
  1110. ],
  1111. ),
  1112. // SizedBox(
  1113. // height: 15,
  1114. // ),
  1115. Expanded(child: body),
  1116. // body
  1117. ],
  1118. ),
  1119. );
  1120. }
  1121. }
  1122. class OrderType extends StatelessWidget {
  1123. OrderType({Key key, this.initList}) : super(key: key);
  1124. List<dynamic> initList;
  1125. List<Widget> brandList(context) => initList.asMap().keys.map(
  1126. (item) {
  1127. double width = MediaQuery.of(context).size.width;
  1128. return Container(
  1129. // color:Colors.yellow,
  1130. width: width / 4,
  1131. child: FlatButton(
  1132. padding: EdgeInsets.all(0),
  1133. highlightColor: Colors.white,
  1134. splashColor: Colors.white,
  1135. child: Container(
  1136. // width: 90,
  1137. height: ScreenUtil().setWidth(80),
  1138. // color: Colors.red,
  1139. padding: EdgeInsets.only(
  1140. left: ScreenUtil().setWidth(10),
  1141. right: ScreenUtil().setWidth(10),
  1142. top: ScreenUtil().setWidth(10)),
  1143. child: Column(
  1144. mainAxisAlignment: MainAxisAlignment.start,
  1145. children: <Widget>[
  1146. Container(
  1147. // height: 70,
  1148. // color: Colors.red,
  1149. child: LoadAssetImage(
  1150. // image: AssetImage(i['img']),
  1151. initList[item]['img'],
  1152. width: ScreenUtil().setWidth(50),
  1153. height: ScreenUtil().setWidth(30),
  1154. // alignment: Alignment.centerLeft,
  1155. ),
  1156. ),
  1157. SizedBox(height: ScreenUtil().setWidth(10)),
  1158. Container(
  1159. child: Text(
  1160. initList[item]["title"],
  1161. style: TextStyle(
  1162. color: Colours.red,
  1163. fontSize: ScreenUtil().setSp(15)),
  1164. textAlign: TextAlign.start,
  1165. ),
  1166. ),
  1167. ]),
  1168. ),
  1169. onPressed: () {
  1170. int nums = item + 1;
  1171. String index = nums.toString();
  1172. NavigatorUtils.push(
  1173. context, "${WodeRouter.orderPage}?checkType=$index");
  1174. },
  1175. ),
  1176. );
  1177. },
  1178. ).toList();
  1179. @override
  1180. Widget build(BuildContext context) {
  1181. return Container(
  1182. padding: EdgeInsets.only(top: ScreenUtil().setWidth(5)),
  1183. child: Wrap(
  1184. // spacing: 26,
  1185. alignment: WrapAlignment.spaceBetween,
  1186. crossAxisAlignment: WrapCrossAlignment.center,
  1187. children: brandList(context),
  1188. ),
  1189. );
  1190. }
  1191. }