main.dart 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358
  1. import 'dart:async';
  2. import 'dart:convert';
  3. import 'dart:io';
  4. import 'package:amap_flutter_location/amap_flutter_location.dart';
  5. import 'package:bbyyy/beans/access_bean_entity.dart';
  6. import 'package:bbyyy/beans/template_bean_entity.dart';
  7. import 'package:bbyyy/beans/w_x_bean_entity.dart';
  8. import 'package:bbyyy/https/url.dart';
  9. import 'package:bbyyy/my_tools/event_bus.dart';
  10. import 'package:bbyyy/my_tools/my_cookie.dart';
  11. import 'package:bbyyy/my_tools/my_tools.dart';
  12. import 'package:bbyyy/my_tools/order_processing/order_processing.dart';
  13. import 'package:bbyyy/paegs/login_page/login_page.dart';
  14. import 'package:bbyyy/paegs/pay_page/order_information_page.dart';
  15. import 'package:bbyyy/paegs/root_page/root_page.dart';
  16. import 'package:bbyyy/paegs/root_page/root_page_view.dart';
  17. import 'package:bbyyy/paegs/welcome_page/welcome_page.dart';
  18. import 'package:dio/dio.dart';
  19. import 'package:flustars/flustars.dart';
  20. import 'package:flutter/cupertino.dart';
  21. import 'package:flutter/material.dart';
  22. import 'package:flutter/services.dart';
  23. import 'package:flutter_local_notifications/flutter_local_notifications.dart';
  24. import 'package:flutter_localizations/flutter_localizations.dart';
  25. import 'package:flutter_svg/flutter_svg.dart';
  26. import 'package:fluwx/fluwx.dart';
  27. import 'package:pull_to_refresh/pull_to_refresh.dart';
  28. import 'package:rxdart/rxdart.dart';
  29. import 'beans/app_store_review_bean_entity.dart';
  30. import 'beans/coupon_bean_entity.dart';
  31. import 'beans/my_shop_bean_entity.dart';
  32. import 'beans/new_order_bean_entity.dart';
  33. import 'beans/smart_order_bean_entity.dart';
  34. import 'beans/system_information_bean_entity.dart';
  35. import 'https/MyDio.dart';
  36. import 'https/my_request.dart';
  37. import 'my_tools/const.dart';
  38. import 'my_tools/dims.dart';
  39. import 'my_tools/easy_loading/easy_loading.dart';
  40. import 'my_tools/easy_loading/loading.dart';
  41. import 'my_tools/global.dart';
  42. import 'my_tools/my_colors.dart';
  43. import 'my_tools/my_views.dart';
  44. import 'my_tools/order.dart';
  45. import 'my_tools/pop_up_queue.dart';
  46. final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
  47. FlutterLocalNotificationsPlugin();
  48. final BehaviorSubject<ReceivedNotification> didReceiveLocalNotificationSubject =
  49. BehaviorSubject<ReceivedNotification>();
  50. final BehaviorSubject<String> selectNotificationSubject =
  51. BehaviorSubject<String>();
  52. class ReceivedNotification {
  53. ReceivedNotification({
  54. @required this.id,
  55. @required this.title,
  56. @required this.body,
  57. @required this.payload,
  58. });
  59. final int id;
  60. final String title;
  61. final String body;
  62. final String payload;
  63. }
  64. Future<void> main() async {
  65. AMapFlutterLocation.setApiKey("156e225e52517b76ac2222f035a9ce3e", "548414a843a2ec9c383e34341b8c84df");
  66. WidgetsFlutterBinding.ensureInitialized();
  67. const AndroidInitializationSettings initializationSettingsAndroid =
  68. AndroidInitializationSettings('@mipmap/app_logo');
  69. /// Note: permissions aren't requested here just to demonstrate that can be
  70. /// done later
  71. final IOSInitializationSettings initializationSettingsIOS =
  72. IOSInitializationSettings(
  73. requestAlertPermission: true,
  74. requestBadgePermission: true,
  75. requestSoundPermission: true,
  76. onDidReceiveLocalNotification:
  77. (int id, String title, String body, String payload) async {
  78. didReceiveLocalNotificationSubject.add(ReceivedNotification(
  79. id: id, title: title, body: body, payload: payload));
  80. });
  81. const MacOSInitializationSettings initializationSettingsMacOS =
  82. MacOSInitializationSettings(
  83. requestAlertPermission: true,
  84. requestBadgePermission: true,
  85. requestSoundPermission: true);
  86. final InitializationSettings initializationSettings = InitializationSettings(
  87. android: initializationSettingsAndroid,
  88. iOS: initializationSettingsIOS,
  89. macOS: initializationSettingsMacOS);
  90. await flutterLocalNotificationsPlugin.initialize(initializationSettings,
  91. onSelectNotification: (String payload) async {
  92. if (payload != null) {
  93. if (payload == notifyTypeNewMsg) {
  94. RootPageView().bNIndex = 2;
  95. EventBus().emit('ChangePage');
  96. }
  97. debugPrint('notification payload: $payload');
  98. }
  99. selectNotificationSubject.add(payload);
  100. });
  101. runApp(MyApp());
  102. }
  103. class MyApp extends StatelessWidget with WidgetsBindingObserver {
  104. BuildContext buildContext;
  105. StateSetter ss;
  106. List<MyShopBeanDataData> shops = [];
  107. int shopIndex = 0;
  108. String clipboardT;
  109. int amountCompleted = 0;
  110. NewOrderBeanEntity newOrder;
  111. @override
  112. StatelessElement createElement() {
  113. // TODO: implement createElement
  114. WidgetsBinding.instance.addObserver(this);
  115. MyCookie().initP();
  116. _initFluwx();
  117. EventBus().on('hasNewOrder', (arg) {
  118. newOrder = arg;
  119. displayPendingOrders();
  120. });
  121. EventBus().on('systemInformation', (arg) {
  122. if (arg is SystemInformationBeanEntity) {
  123. showSystemMessages(arg);
  124. }
  125. });
  126. EventBus().on('检查粘贴板', (arg) {
  127. Timer(Duration(seconds: 1), () {
  128. getClipboardData();
  129. checkUnpaidThirdPartyOrders();
  130. });
  131. });
  132. EventBus().on('hasCoupon', (arg) {
  133. if (arg is CouponBeanDataData) {
  134. couponBulletBox(arg);
  135. }
  136. });
  137. EventBus().on('packageInfo', (arg) {
  138. isItUnderReview();
  139. });
  140. return super.createElement();
  141. }
  142. @override
  143. Widget build(BuildContext context) {
  144. SystemChrome.setPreferredOrientations([
  145. DeviceOrientation.portraitUp, //只能纵向
  146. DeviceOrientation.portraitDown, //只能纵向
  147. ]);
  148. return RefreshConfiguration(
  149. child: MaterialApp(
  150. navigatorKey: navigatorKey,
  151. theme: ThemeData(fontFamily: 'PingFang'),
  152. debugShowCheckedModeBanner: false,
  153. home: WelcomePage(),
  154. routes: {
  155. '/loginPage': (context) => LoginPage(),
  156. '/rootPage': (context) => RootPage(),
  157. },
  158. supportedLocales: [const Locale('zh', 'CH')],
  159. localizationsDelegates: [
  160. RefreshLocalizations.delegate,
  161. GlobalMaterialLocalizations.delegate,
  162. GlobalWidgetsLocalizations.delegate,
  163. const FallbackCupertinoLocalisationsDelegate(),
  164. ],
  165. builder: (BuildContext context, Widget child) {
  166. buildContext = context;
  167. return MediaQuery(
  168. data: MediaQuery.of(context)
  169. .copyWith(textScaleFactor: 1.0), //设置字体不随系统字体大小改变
  170. child: FlutterEasyLoading(
  171. child: child,
  172. ),
  173. );
  174. },
  175. ),
  176. hideFooterWhenNotFull: true,
  177. footerBuilder: () {
  178. return ClassicFooter(
  179. loadStyle: LoadStyle.ShowWhenLoading,
  180. );
  181. },
  182. );
  183. }
  184. @override
  185. void didChangeAppLifecycleState(AppLifecycleState state) {
  186. super.didChangeAppLifecycleState(state);
  187. if (state == AppLifecycleState.paused) {
  188. print('went to Background');
  189. }
  190. if (state == AppLifecycleState.resumed) {
  191. print('came back to Foreground');
  192. if (MyCookie().loginInformation != null) {
  193. Timer(Duration(seconds: 1), () {
  194. getClipboardData();
  195. });
  196. }
  197. checkUnpaidThirdPartyOrders();
  198. }
  199. }
  200. //获取剪切板文字
  201. Future<void> getClipboardData() async {
  202. PopUpQueue().onShow = true;
  203. ClipboardData text = await Clipboard.getData(Clipboard.kTextPlain);
  204. try {
  205. print('Clipboard-----\n${text.text}');
  206. clipboardT = text.text;
  207. // Clipboard.setData(ClipboardData(text: ''));
  208. OrderProcessing().queryOrderTemplate(clipboardT,buildContext);
  209. // getOnlineTemplate();
  210. } catch (e) {
  211. PopUpQueue().onShow = false;
  212. PopUpQueue().showNext();
  213. }
  214. }
  215. //获取线上模板
  216. void getOnlineTemplate() {
  217. MyDio().query({
  218. 'key': 'order_template',
  219. "dims":orderTemplateDims,
  220. "filters": {}
  221. }, (response, hasError) {
  222. if (!hasError) {
  223. TemplateBeanEntity entity = TemplateBeanEntity()
  224. .fromJson(json.decode(response.data.toString()));
  225. checkOrder(entity.data);
  226. } else {
  227. PopUpQueue().onShow = false;
  228. PopUpQueue().showNext();
  229. }
  230. }, (error) {
  231. PopUpQueue().onShow = false;
  232. PopUpQueue().showNext();
  233. });
  234. }
  235. var orderHash;
  236. //最大金额赢家数量 0---发送订单的人不是最大赢家 1---发订单的人是最大赢家 2---发订单的人是最大赢家且有两个一样的金额
  237. int commissionPayerNum = -1;
  238. //匹配模板去除不是自己的订单
  239. void checkOrder(List<TemplateBeanData> data) {
  240. commissionPayerNum = -1;
  241. bool hasMatch = false;
  242. w:
  243. for (int i = 0; i < data.length; i++) {
  244. try {
  245. var res = parseString2(
  246. data[i].template.replaceAll('\r', ''), '''$clipboardT''');
  247. if (res != null) {
  248. print('-----------data[i].template-----------');
  249. print(data[i].template);
  250. print('json.encode(res) =============\n${json.encode(res)}');
  251. var order = parse2(res);
  252. print('order.toString()=============\n${order.toString()}');
  253. var maxAmount = 0.0;
  254. int maxAmountNum = 0;
  255. List<String> maxAmountOwner = [];
  256. res.forEach((key, value) {
  257. if (key.contains('amount')) {
  258. try {
  259. if (double.parse(value) > maxAmount) {
  260. maxAmount = double.parse(value);
  261. maxAmountNum = 1;
  262. maxAmountOwner.clear();
  263. maxAmountOwner.add(res[key.replaceAll('amount', 'person')]);
  264. } else if (double.parse(value) == maxAmount) {
  265. maxAmountNum++;
  266. maxAmountOwner.add(res[key.replaceAll('amount', 'person')]);
  267. }
  268. } catch (e) {}
  269. }
  270. });
  271. if(maxAmountOwner.isNotEmpty){
  272. maxAmountOwner.forEach((element) {
  273. if(MyCookie().getName().contains(element)||element.contains(MyCookie().getName())){
  274. commissionPayerNum = maxAmountNum;
  275. }
  276. });
  277. }
  278. print('maxAmount============\n$maxAmount\n==============');
  279. print('maxAmountNum==============\n$maxAmountNum\n==============');
  280. print('maxAmountOwner==============\n${maxAmountOwner.toString()}\n==============');
  281. print('commissionPayerNum================ \n$commissionPayerNum\n==============');
  282. order.removeWhere((element) =>
  283. !element.seller.name
  284. .contains(MyCookie().loginInformation.data.extra.name) &&
  285. !MyCookie()
  286. .loginInformation
  287. .data
  288. .extra
  289. .name
  290. .contains(element.seller.name));
  291. if (order.length > 0) {
  292. hasMatch = true;
  293. orderHash = computeOrderHash(res);
  294. getShop(order);
  295. }
  296. break w;
  297. }
  298. } catch (e) {}
  299. }
  300. if (!hasMatch) {
  301. PopUpQueue().onShow = false;
  302. PopUpQueue().showNext();
  303. }
  304. }
  305. //订单视图
  306. items(List<OrderInfo2> order) {
  307. List<Widget> items = [];
  308. order.forEach((element) {
  309. items.add(Container(
  310. child: Column(
  311. children: [
  312. Row(
  313. children: [
  314. Container(
  315. margin: EdgeInsets.only(left: 8, right: 7),
  316. child: ClipRRect(
  317. child: MyViews().netImg(
  318. imgURL(MyCookie().loginInformation.data.extra.picture),
  319. 35,
  320. 35),
  321. borderRadius: BorderRadius.circular(17.5),
  322. ),
  323. ),
  324. Expanded(
  325. child: Container(
  326. height: 35,
  327. child: Column(
  328. children: [
  329. Text(
  330. '付款人:${element.payer.name}',
  331. style: TextStyle(
  332. color: MyColors.c333333,
  333. fontSize: 13,
  334. decoration: TextDecoration.none,
  335. ),
  336. ),
  337. Text(
  338. '订单时间:${element.time}',
  339. style: TextStyle(
  340. color: MyColors.c666666,
  341. fontSize: 10,
  342. decoration: TextDecoration.none,
  343. ),
  344. ),
  345. ],
  346. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  347. crossAxisAlignment: CrossAxisAlignment.start,
  348. ),
  349. ),
  350. ),
  351. Container(
  352. margin: EdgeInsets.only(right: 10),
  353. child: Text(
  354. '¥${(element.payer.amount * element.factor).toStringAsFixed(2)}',
  355. style: TextStyle(
  356. color: MyColors.cFF4233,
  357. fontSize: 14,
  358. decoration: TextDecoration.none,
  359. ),
  360. ),
  361. ),
  362. ],
  363. crossAxisAlignment: CrossAxisAlignment.center,
  364. ),
  365. Container(
  366. height: 0.5,
  367. margin: EdgeInsets.only(right: 10, left: 50, top: 5),
  368. color: MyColors.cE7E7E7,
  369. )
  370. ],
  371. ),
  372. margin: EdgeInsets.only(top: 5),
  373. ));
  374. });
  375. return items;
  376. }
  377. bool saving = false;
  378. //获取用户所在店铺
  379. void getShop(List<OrderInfo2> order) {
  380. shopIndex = 0;
  381. MyDio().query({
  382. "key": "shop_user",
  383. "filters": {
  384. "or": true,
  385. "conditions": [
  386. "role!=0",
  387. "user_uid==${MyCookie().getUID()}",
  388. "review_state==1"
  389. ],
  390. "filters": [
  391. {
  392. "conditions": ["role==0", "user_uid==${MyCookie().getUID()}"]
  393. }
  394. ]
  395. },
  396. "dims": shopUserDims,
  397. "paging": [1, 20000]
  398. }, (response, hasError) {
  399. if (!hasError) {
  400. MyShopBeanEntity entity =
  401. MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
  402. shops = entity.data.data;
  403. shops.removeWhere((element) => !element.privateShop);
  404. if (shops.length == 0) {
  405. showToast('你还没有添加任何货帮,暂时不能发送智能订单');
  406. PopUpQueue().onShow = false;
  407. PopUpQueue().showNext();
  408. } else {
  409. EasyLoading.instance
  410. ..contentPadding = EdgeInsets.symmetric(horizontal: 0, vertical: 12)
  411. ..alignment = Alignment.bottomCenter
  412. ..loadingStyle = EasyLoadingStyle.light
  413. ..contentMargin = EdgeInsets.fromLTRB(20, 20, 20, 65);
  414. EasyLoading.show(
  415. indicator: Material(
  416. color: Colors.white,
  417. child: StatefulBuilder(
  418. builder: (c, s) {
  419. ss = s;
  420. return Column(
  421. children: [
  422. Container(
  423. child: Stack(
  424. children: [
  425. Container(
  426. child: MyViews()
  427. .myText('智能订单', MyColors.c333333, 14),
  428. alignment: Alignment.center,
  429. height: 22,
  430. ),
  431. Positioned(
  432. right: 0,
  433. child: GestureDetector(
  434. onTap: () {
  435. PopUpQueue().onShow = false;
  436. PopUpQueue().showNext();
  437. },
  438. behavior: HitTestBehavior.translucent,
  439. child: Container(
  440. child: Icon(
  441. Icons.close,
  442. size: 20,
  443. color: Colors.white,
  444. ),
  445. decoration: BoxDecoration(
  446. color: MyColors.cB6B6B6,
  447. borderRadius: BorderRadius.circular(11)),
  448. height: 22,
  449. width: 22,
  450. ),
  451. ),
  452. )
  453. ],
  454. alignment: Alignment.center,
  455. ),
  456. height: 30,
  457. padding: EdgeInsets.symmetric(horizontal: 12),
  458. ),
  459. Container(
  460. height: 5,
  461. color: MyColors.cF7F7F7,
  462. margin: EdgeInsets.only(top: 10),
  463. ),
  464. Column(
  465. children: items(order),
  466. ),
  467. Container(
  468. height: 5,
  469. color: MyColors.cF7F7F7,
  470. margin: EdgeInsets.only(top: 10),
  471. ),
  472. Visibility(
  473. child: Column(
  474. children: [
  475. Container(
  476. child: MyViews()
  477. .myText('货帮选择', MyColors.c333333, 13),
  478. margin: EdgeInsets.only(left: 7, top: 11),
  479. ),
  480. Container(
  481. margin: EdgeInsets.symmetric(
  482. horizontal: 7, vertical: 10),
  483. height: (shops.length * 1.0 / 2).ceil() *
  484. (double.parse(
  485. '${MediaQuery.of(buildContext).size.width - 74}') /
  486. 2 /
  487. 3.8 +
  488. 10) -
  489. 10,
  490. child: GridView(
  491. gridDelegate:
  492. SliverGridDelegateWithFixedCrossAxisCount(
  493. crossAxisCount: 2, //横轴三个子widget
  494. childAspectRatio: 3.8,
  495. crossAxisSpacing: 10,
  496. mainAxisSpacing: 8 //宽高比为1时,子widget
  497. ),
  498. children: shop(shops),
  499. padding: EdgeInsets.all(0),
  500. ),
  501. ),
  502. ],
  503. crossAxisAlignment: CrossAxisAlignment.start,
  504. ),
  505. visible: shops.length != 1,
  506. ),
  507. Container(
  508. height: 0.5,
  509. color: MyColors.cF7F7F7,
  510. margin: EdgeInsets.only(bottom: 10),
  511. ),
  512. Container(
  513. child: GestureDetector(
  514. onTap: () {
  515. if (saving) {
  516. return;
  517. } else {
  518. saving = true;
  519. EventBus().on('saveOrder', (arg) {
  520. amountCompleted++;
  521. if (amountCompleted == order.length) {
  522. amountCompleted = 0;
  523. EasyLoading.dismiss();
  524. showToast('发送成功');
  525. clipboardT = '';
  526. saving = false;
  527. EventBus().off('saveOrder');
  528. PopUpQueue().onShow = false;
  529. PopUpQueue().showNext();
  530. }
  531. });
  532. order.forEach((element) {
  533. sendOrder(element);
  534. });
  535. }
  536. },
  537. behavior: HitTestBehavior.translucent,
  538. child: Container(
  539. decoration: BoxDecoration(
  540. color: MyColors.cFF4233,
  541. borderRadius: BorderRadius.circular(20),
  542. ),
  543. height: 40,
  544. width: 150,
  545. child: MyViews().myText('发送订单', Colors.white, 14),
  546. alignment: Alignment.center,
  547. ),
  548. ),
  549. alignment: Alignment.center,
  550. )
  551. ],
  552. mainAxisAlignment: MainAxisAlignment.start,
  553. crossAxisAlignment: CrossAxisAlignment.start,
  554. );
  555. },
  556. ),
  557. ),
  558. );
  559. }
  560. } else {
  561. PopUpQueue().onShow = false;
  562. PopUpQueue().showNext();
  563. }
  564. }, (error) {
  565. PopUpQueue().onShow = false;
  566. PopUpQueue().showNext();
  567. });
  568. }
  569. //店铺视图
  570. shop(List<MyShopBeanDataData> shops) {
  571. List<Widget> items = [];
  572. for (int i = 0; i < shops.length; i++) {
  573. items.add(GestureDetector(
  574. onTap: () {
  575. shopIndex = i;
  576. ss(() {});
  577. },
  578. behavior: HitTestBehavior.translucent,
  579. child: Container(
  580. child: Row(
  581. children: [
  582. Container(
  583. margin: EdgeInsets.only(right: 5),
  584. child: ClipRRect(
  585. child: MyViews().netImg(imgURL(shops[i].shopPic), 30, 30),
  586. borderRadius: BorderRadius.circular(15),
  587. ),
  588. ),
  589. Expanded(
  590. child: Column(
  591. children: [
  592. Text(
  593. shops[i].shopName,
  594. style: TextStyle(
  595. color: i == shopIndex
  596. ? MyColors.cFF4233
  597. : MyColors.c666666,
  598. fontSize: 12,
  599. ),
  600. maxLines: 1,
  601. overflow: TextOverflow.ellipsis,
  602. softWrap: true,
  603. ),
  604. Text(
  605. 'ID:${shops[i].shopUid}',
  606. style: TextStyle(
  607. color: i == shopIndex
  608. ? MyColors.cFF4233
  609. : MyColors.c666666,
  610. fontSize: 10,
  611. ),
  612. maxLines: 1,
  613. overflow: TextOverflow.ellipsis,
  614. softWrap: true,
  615. ),
  616. ],
  617. crossAxisAlignment: CrossAxisAlignment.start,
  618. ),
  619. ),
  620. ],
  621. ),
  622. decoration: BoxDecoration(
  623. color: i == shopIndex ? MyColors.cFFECEB : MyColors.cEDEDED,
  624. borderRadius: BorderRadius.circular(4),
  625. ),
  626. constraints: BoxConstraints(maxWidth: 150),
  627. padding: EdgeInsets.symmetric(horizontal: 6, vertical: 6),
  628. ),
  629. ));
  630. }
  631. return items;
  632. }
  633. //发送订单
  634. void sendOrder(OrderInfo2 element) {
  635. MyDio().save({
  636. 'key': 'order',
  637. 'object': {
  638. 'uuid': orderHash,
  639. 'shop_uid': shops[shopIndex].shopUid,
  640. 'shop_pic': shops[shopIndex].shopPic,
  641. 'shop_name': shops[shopIndex].shopName,
  642. 'seller_pic': MyCookie().loginInformation.data.extra.picture,
  643. 'seller_uid': MyCookie().getUID(),
  644. 'seller_name': MyCookie().loginInformation.data.extra.name,
  645. 'buyer_name': element.payer.name,
  646. 'type': orderTypeThirdPlatform,
  647. 'amount': NumUtil.multiply(element.payer.amount, element.factor),
  648. 'commission_payer_num': commissionPayerNum
  649. }
  650. }, (response, hasError) {
  651. if (!hasError) {
  652. EventBus().emit('saveOrder');
  653. }
  654. }, (error) {});
  655. }
  656. //待支付订单视图
  657. void displayPendingOrders() {
  658. EasyLoading.instance
  659. ..contentPadding = EdgeInsets.symmetric(horizontal: 0, vertical: 12)
  660. ..alignment = Alignment.bottomCenter
  661. ..loadingStyle = EasyLoadingStyle.light
  662. ..contentMargin = EdgeInsets.fromLTRB(20, 20, 20, 65);
  663. EasyLoading.show(
  664. indicator: Material(
  665. color: Colors.white,
  666. child: Column(
  667. children: [
  668. Container(
  669. padding: EdgeInsets.symmetric(horizontal: 12),
  670. child: Row(
  671. children: [
  672. Container(
  673. margin: EdgeInsets.only(right: 7),
  674. child: ClipRRect(
  675. child: MyViews()
  676. .netImg(imgURL(newOrder.content.shopPic), 25, 25),
  677. borderRadius: BorderRadius.circular(12.5),
  678. ),
  679. ),
  680. MyViews().myText(
  681. '${newOrder.content.shopName}(${newOrder.content.shopUID})',
  682. MyColors.c333333,
  683. 14),
  684. ],
  685. ),
  686. ),
  687. Container(
  688. margin: EdgeInsets.only(top: 11, left: 12, right: 12, bottom: 11),
  689. height: 0.5,
  690. color: MyColors.cE7E7E7,
  691. ),
  692. Container(
  693. margin: EdgeInsets.symmetric(horizontal: 12),
  694. child: Row(
  695. children: [
  696. Container(
  697. child: SvgPicture.asset(
  698. newOrder.content.buyerPic == null
  699. ? 'images/svg/第三方.svg'
  700. : 'images/svg/线下付款.svg',
  701. height: 27,
  702. width: 27,
  703. ),
  704. margin: EdgeInsets.only(right: 8),
  705. height: 45,
  706. width: 45,
  707. decoration: BoxDecoration(
  708. border: Border.all(color: MyColors.cEBEBEB, width: 1)),
  709. alignment: Alignment.center,
  710. ),
  711. Expanded(
  712. child: Container(
  713. height: 45,
  714. child: Column(
  715. children: [
  716. MyViews().myText(
  717. newOrder.content.buyerPic == null
  718. ? '第三方订单'
  719. : '线下付款',
  720. MyColors.c333333,
  721. 13),
  722. Row(
  723. children: [
  724. MyViews().myText('¥${newOrder.content.amount}',
  725. MyColors.cFF4233, 12),
  726. MyViews().myText('x1', MyColors.c999999, 12),
  727. ],
  728. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  729. )
  730. ],
  731. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  732. crossAxisAlignment: CrossAxisAlignment.start,
  733. ),
  734. ),
  735. ),
  736. ],
  737. ),
  738. ),
  739. Container(
  740. height: 0.5,
  741. color: MyColors.cE7E7E7,
  742. margin: EdgeInsets.symmetric(horizontal: 12, vertical: 11),
  743. ),
  744. Container(
  745. margin: EdgeInsets.symmetric(horizontal: 12),
  746. child: Row(
  747. children: [
  748. MyViews().myText('卖家信息:', MyColors.c333333, 13),
  749. Row(
  750. children: [
  751. Container(
  752. margin: EdgeInsets.only(right: 5),
  753. child: ClipRRect(
  754. child: MyViews().netImg(
  755. imgURL(newOrder.content.sellerPic), 23, 23),
  756. borderRadius: BorderRadius.circular(11.5),
  757. ),
  758. ),
  759. MyViews().myText(
  760. '${newOrder.content.sellerName}(${hideUID(newOrder.content.sellerUID.toString())})',
  761. MyColors.c333333,
  762. 13),
  763. ],
  764. )
  765. ],
  766. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  767. ),
  768. ),
  769. Container(
  770. height: 0.5,
  771. color: MyColors.cE7E7E7,
  772. margin: EdgeInsets.symmetric(horizontal: 12, vertical: 11),
  773. ),
  774. Container(
  775. margin: EdgeInsets.symmetric(horizontal: 12),
  776. child: Row(
  777. children: [
  778. MyViews().myText('买家信息:', MyColors.c333333, 13),
  779. Row(
  780. children: [
  781. Container(
  782. margin: EdgeInsets.only(right: 5),
  783. child: ClipRRect(
  784. child: MyViews().netImg(
  785. newOrder.content.buyerPic == null
  786. ? ''
  787. : imgURL(newOrder.content.buyerPic),
  788. 23,
  789. 23),
  790. borderRadius: BorderRadius.circular(11.5),
  791. ),
  792. ),
  793. MyViews().myText(
  794. '${newOrder.content.buyerName} ${newOrder.content.buyerUID != null && newOrder.content.buyerUID.toString().length > 0 ? '(${newOrder.content.buyerUID})' : ''}',
  795. MyColors.c333333,
  796. 13),
  797. ],
  798. )
  799. ],
  800. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  801. ),
  802. ),
  803. Container(
  804. height: 0.5,
  805. color: MyColors.cE7E7E7,
  806. margin: EdgeInsets.symmetric(horizontal: 12, vertical: 11),
  807. ),
  808. Container(
  809. margin: EdgeInsets.symmetric(horizontal: 12),
  810. child: Row(
  811. children: [
  812. MyViews().myText('下单时间:', MyColors.c333333, 13),
  813. MyViews().myText(
  814. '${newOrder.content.createTime}', MyColors.c333333, 13)
  815. ],
  816. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  817. ),
  818. ),
  819. Container(
  820. height: 0.5,
  821. color: MyColors.cE7E7E7,
  822. margin: EdgeInsets.symmetric(horizontal: 12, vertical: 11),
  823. ),
  824. Container(
  825. margin: EdgeInsets.symmetric(horizontal: 20),
  826. child: Row(
  827. children: [
  828. Expanded(
  829. child: GestureDetector(
  830. onTap: () {
  831. PopUpQueue().onShow = false;
  832. PopUpQueue().showNext();
  833. },
  834. behavior: HitTestBehavior.translucent,
  835. child: Container(
  836. decoration: BoxDecoration(
  837. borderRadius: BorderRadius.only(
  838. topLeft: Radius.circular(20),
  839. bottomLeft: Radius.circular(20),
  840. ),
  841. border: Border.all(
  842. color: MyColors.cFF4233, width: 1)),
  843. height: 40,
  844. child: MyViews().myText('与我无瓜', MyColors.cFF4233, 14),
  845. alignment: Alignment.center),
  846. ),
  847. ),
  848. Expanded(
  849. child: GestureDetector(
  850. onTap: () {
  851. if (newOrder.content.buyerName
  852. .contains(MyCookie().getName()) ||
  853. MyCookie()
  854. .getName()
  855. .contains(newOrder.content.buyerName)) {
  856. EasyLoading.dismiss();
  857. payTheOrder();
  858. } else {
  859. showToast('该订单与你无关');
  860. PopUpQueue().onShow = false;
  861. PopUpQueue().showNext();
  862. }
  863. },
  864. behavior: HitTestBehavior.translucent,
  865. child: Container(
  866. decoration: BoxDecoration(
  867. borderRadius: BorderRadius.only(
  868. topRight: Radius.circular(20),
  869. bottomRight: Radius.circular(20),
  870. ),
  871. color: MyColors.cFF4233),
  872. height: 40,
  873. child: MyViews().myText('去支付', Colors.white, 14),
  874. alignment: Alignment.center),
  875. ),
  876. )
  877. ],
  878. ),
  879. )
  880. ],
  881. ),
  882. ),
  883. );
  884. }
  885. void payTheOrder() {
  886. //获取店铺信息
  887. MyDio().query({
  888. "key": "shop_user",
  889. "filters": {
  890. "conditions": ["shop_uid==${newOrder.content.shopUID}"]
  891. },
  892. "dims": shopUserDims,
  893. "paging": [1, 1],
  894. "order_by": ["shop_name,DESC"]
  895. }, (response, hasError) {
  896. if (!hasError) {
  897. MyShopBeanEntity entity =
  898. MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
  899. SmartOrderBeanDataData data = SmartOrderBeanDataData();
  900. data.sellerUid = newOrder.content.sellerUID;
  901. data.sellerName = newOrder.content.sellerName;
  902. data.sellerPic = newOrder.content.sellerPic;
  903. data.buyerUid = 0;
  904. data.buyerName = newOrder.content.buyerName;
  905. data.buyerPic = '';
  906. data.amount = newOrder.content.amount;
  907. data.uid = newOrder.content.uID;
  908. navigatorKey.currentState
  909. .push(MaterialPageRoute(
  910. builder: (context) => OrderInformationPage(
  911. false,
  912. orderType: orderTypeThirdPlatform,
  913. amount: newOrder.content.amount,
  914. uid: newOrder.content.uID,
  915. buyerUid: MyCookie().getUID(),
  916. buyerName: newOrder.content.buyerName,
  917. buyerPic: MyCookie().getPic(),
  918. commodityCount: 1,
  919. commodityTitle: '第三方订单',
  920. commodityCover: '',
  921. sellName: newOrder.content.sellerName,
  922. sellPic: newOrder.content.sellerPic,
  923. sellUid: newOrder.content.sellerUID,
  924. )))
  925. .then((value) {
  926. PopUpQueue().onShow = false;
  927. PopUpQueue().showNext();
  928. });
  929. // navigatorKey.currentState.push(MaterialPageRoute(
  930. // builder: (context) =>
  931. // GangInPage(entity.data.data[0], newOrder.content)));
  932. }
  933. }, (error) {});
  934. // getUserWalletBalance((re, hE) {
  935. // if (!hE) {
  936. // UserBalanceEntity balance =
  937. // UserBalanceEntity().fromJson(json.decode(re.data.toString()));
  938. // if (balance.data >= newOrder.content.amount) {
  939. // payOrder(payWayWallet, newOrder.content.uID, (re, hE) {
  940. // if (!hE) {
  941. // showToast('支付成功');
  942. // EventBus().emit('payAnOrder');
  943. // }
  944. // }, (e) {}, context);
  945. // } else {
  946. // payOrder(payWayAliPay, newOrder.content.uID, (re, hE) {
  947. // if (!hE) {
  948. // PayByAlipayBeanEntity entity = PayByAlipayBeanEntity()
  949. // .fromJson(json.decode(re.data.toString()));
  950. // EventBus().on('alipayPaymentCallback', (arg) {
  951. // EventBus().off('alipayPaymentCallback');
  952. // EasyLoading.dismiss();
  953. // showToast('支付成功');
  954. // EventBus().emit('reNoPayOrder');
  955. // });
  956. // print(entity.data);
  957. // EasyLoading.instance
  958. // ..contentPadding =
  959. // EdgeInsets.symmetric(horizontal: 20, vertical: 12)
  960. // ..alignment = Alignment.center
  961. // ..contentMargin = EdgeInsets.all(20);
  962. // EasyLoading.show();
  963. // aliPay(entity.data).then((value) {
  964. // print(json.encode(value));
  965. // AlipayResultBeanEntity e = AlipayResultBeanEntity()
  966. // .fromJson(json.decode(json.encode(value)));
  967. // try {
  968. // int r = int.parse(e.resultStatus);
  969. // if (r == 9000) {
  970. // showToast('支付成功');
  971. // } else {
  972. // showToast(aliPayResultStatus(r));
  973. // resetOrder(newOrder.content.uID, context);
  974. // }
  975. // } catch (e) {
  976. // EasyLoading.dismiss();
  977. // }
  978. // });
  979. // // EventBus().emit('payAnOrder');
  980. // }
  981. // }, (e) {}, context);
  982. // // showToast('积分余额不足');
  983. // }
  984. // }
  985. // }, (e) {}, context);
  986. }
  987. void showSystemMessages(SystemInformationBeanEntity arg) {
  988. EasyLoading.instance
  989. ..contentPadding = EdgeInsets.symmetric(horizontal: 12, vertical: 12)
  990. ..alignment = Alignment.center
  991. ..loadingStyle = EasyLoadingStyle.custom
  992. ..backgroundColor = Colors.transparent
  993. ..indicatorColor = Colors.black
  994. ..progressColor = Colors.black
  995. ..maskColor = Colors.black
  996. ..textColor = Colors.black
  997. ..contentMargin = EdgeInsets.fromLTRB(20, 20, 20, 65);
  998. EasyLoading.show(
  999. indicator: Material(
  1000. color: Colors.transparent,
  1001. child: Container(
  1002. decoration: BoxDecoration(
  1003. borderRadius: BorderRadius.circular(16),
  1004. ),
  1005. height: MediaQuery.of(buildContext).size.height - 200,
  1006. padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
  1007. child: Column(
  1008. children: [
  1009. Expanded(child: Container()),
  1010. Container(
  1011. decoration: BoxDecoration(
  1012. color: Colors.white,
  1013. borderRadius: BorderRadius.circular(16),
  1014. ),
  1015. child: Column(
  1016. children: [
  1017. Container(
  1018. child: Text(
  1019. '系统消息',
  1020. style: TextStyle(
  1021. color: MyColors.c333333,
  1022. fontSize: 14,
  1023. fontWeight: FontWeight.bold),
  1024. ),
  1025. margin:
  1026. EdgeInsets.symmetric(horizontal: 26, vertical: 15),
  1027. ),
  1028. Container(
  1029. child: Text(
  1030. arg.content.content,
  1031. style: TextStyle(color: MyColors.c333333, fontSize: 14),
  1032. ),
  1033. margin: EdgeInsets.symmetric(horizontal: 26),
  1034. alignment: Alignment.centerLeft,
  1035. ),
  1036. Container(
  1037. height: 0.5,
  1038. color: MyColors.cE7E7E7,
  1039. margin: EdgeInsets.only(bottom: 12, top: 12),
  1040. ),
  1041. GestureDetector(
  1042. onTap: () {
  1043. PopUpQueue().onShow = false;
  1044. PopUpQueue().showNext();
  1045. },
  1046. behavior: HitTestBehavior.translucent,
  1047. child: Container(
  1048. width: 150,
  1049. margin: EdgeInsets.only(bottom: 14),
  1050. decoration: BoxDecoration(
  1051. borderRadius: BorderRadius.circular(20),
  1052. border:
  1053. Border.all(color: MyColors.cFF4233, width: 1.1),
  1054. color: Colors.white),
  1055. child: MyViews().myText('我知道了', MyColors.cFF4233, 14),
  1056. height: 40,
  1057. alignment: Alignment.center,
  1058. ),
  1059. )
  1060. ],
  1061. ),
  1062. ),
  1063. Expanded(child: Container()),
  1064. ],
  1065. ),
  1066. alignment: Alignment.center,
  1067. ),
  1068. ),
  1069. );
  1070. }
  1071. //优惠券弹框
  1072. void couponBulletBox(CouponBeanDataData data) {
  1073. EasyLoading.instance
  1074. ..contentPadding = EdgeInsets.symmetric(horizontal: 12, vertical: 12)
  1075. ..alignment = Alignment.center
  1076. ..loadingStyle = EasyLoadingStyle.custom
  1077. ..backgroundColor = Colors.transparent
  1078. ..indicatorColor = Colors.black
  1079. ..progressColor = Colors.black
  1080. ..maskColor = Colors.black
  1081. ..textColor = Colors.black
  1082. ..contentMargin = EdgeInsets.fromLTRB(20, 20, 20, 65);
  1083. EasyLoading.show(
  1084. indicator: Material(
  1085. color: Colors.transparent,
  1086. child: Stack(
  1087. children: [
  1088. Image.asset(
  1089. 'images/优惠券.png',
  1090. height: 640,
  1091. width: double.infinity,
  1092. ),
  1093. Container(
  1094. height: 640,
  1095. margin: EdgeInsets.only(top: 24),
  1096. child: Column(
  1097. children: [
  1098. Container(
  1099. margin: EdgeInsets.only(bottom: 5),
  1100. child: Text(
  1101. '抢红包啦',
  1102. style: TextStyle(
  1103. color: Colors.white,
  1104. fontSize: 24,
  1105. fontWeight: FontWeight.bold,
  1106. shadows: [
  1107. Shadow(
  1108. offset: Offset(1.0, 1.0),
  1109. blurRadius: 3.0,
  1110. color: MyColors.cDC1717,
  1111. )
  1112. ]),
  1113. ),
  1114. ),
  1115. Container(
  1116. decoration: BoxDecoration(
  1117. color: Colors.white,
  1118. borderRadius: BorderRadius.circular(8),
  1119. ),
  1120. height: 107,
  1121. width: double.infinity,
  1122. margin: EdgeInsets.symmetric(horizontal: 25, vertical: 27),
  1123. child: Column(
  1124. children: [
  1125. Text(
  1126. '平台红包大放送!',
  1127. style: TextStyle(
  1128. color: MyColors.c333333,
  1129. fontSize: 16,
  1130. fontWeight: FontWeight.bold),
  1131. ),
  1132. Text(
  1133. '立即去抢最高${data.max}元消费红包',
  1134. style: TextStyle(
  1135. color: MyColors.cFF4233,
  1136. fontSize: 14,
  1137. fontWeight: FontWeight.bold),
  1138. ),
  1139. Text(
  1140. '活动时间${data.distributeFromDate}至${data.distributeEndDate}',
  1141. style: TextStyle(
  1142. color: MyColors.c666666,
  1143. fontSize: 11,
  1144. fontWeight: FontWeight.bold),
  1145. ),
  1146. ],
  1147. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  1148. crossAxisAlignment: CrossAxisAlignment.start,
  1149. ),
  1150. padding: EdgeInsets.symmetric(horizontal: 26),
  1151. ),
  1152. Container(
  1153. margin: EdgeInsets.symmetric(horizontal: 25),
  1154. child: Row(
  1155. children: [
  1156. Expanded(
  1157. child: GestureDetector(
  1158. onTap: () {
  1159. EasyLoading.dismiss();
  1160. },
  1161. behavior: HitTestBehavior.translucent,
  1162. child: Container(
  1163. height: 34,
  1164. decoration: BoxDecoration(
  1165. borderRadius: BorderRadius.only(
  1166. topLeft: Radius.circular(17),
  1167. bottomLeft: Radius.circular(17),
  1168. ),
  1169. border: Border.all(
  1170. color: MyColors.cFFB455, width: 1),
  1171. color: Colors.white),
  1172. child: Text(
  1173. '我已参与',
  1174. style: TextStyle(
  1175. color: MyColors.cFFB455,
  1176. fontSize: 14,
  1177. ),
  1178. ),
  1179. alignment: Alignment.center,
  1180. ),
  1181. ),
  1182. ),
  1183. Expanded(
  1184. child: GestureDetector(
  1185. onTap: () {
  1186. grabACoupon(data.id);
  1187. },
  1188. behavior: HitTestBehavior.translucent,
  1189. child: Container(
  1190. height: 34,
  1191. decoration: BoxDecoration(
  1192. borderRadius: BorderRadius.only(
  1193. topRight: Radius.circular(17),
  1194. bottomRight: Radius.circular(17),
  1195. ),
  1196. color: MyColors.cFFB455),
  1197. child: Text(
  1198. '立即去抢',
  1199. style: TextStyle(
  1200. color: Colors.white,
  1201. fontSize: 14,
  1202. ),
  1203. ),
  1204. alignment: Alignment.center,
  1205. ),
  1206. ),
  1207. ),
  1208. ],
  1209. ),
  1210. )
  1211. ],
  1212. mainAxisAlignment: MainAxisAlignment.center,
  1213. ),
  1214. alignment: Alignment.center,
  1215. )
  1216. ],
  1217. ),
  1218. ),
  1219. );
  1220. }
  1221. _initFluwx() async {
  1222. await registerWxApi(
  1223. appId: AppID,
  1224. doOnAndroid: true,
  1225. doOnIOS: true,
  1226. universalLink: "https://oms.kunyueyun.com/");
  1227. var result = await isWeChatInstalled;
  1228. print("is installed $result");
  1229. weChatResponseEventHandler.listen((res) {
  1230. if (res is WeChatPaymentResponse) {
  1231. // do something here
  1232. print('res.type----${res.type}');
  1233. print('res.extData----${res.extData}');
  1234. print('res.errCode----${res.errCode}');
  1235. print('res.errStr----${res.errStr}');
  1236. print('res.isSuccessful----${res.isSuccessful}');
  1237. EventBus().emit('WeChatPaymentResponse', res.isSuccessful);
  1238. }
  1239. if (res is WeChatAuthResponse) {
  1240. print('res.type----${res.type}');
  1241. print('res.country----${res.country}');
  1242. print('res.lang----${res.lang}');
  1243. print('res.code----${res.code}');
  1244. print('res.state----${res.state}');
  1245. print(
  1246. 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=$AppID&secret=$AppSecret&code=${res.code}&grant_type=authorization_code');
  1247. Dio()
  1248. .get(
  1249. 'https://api.weixin.qq.com/sns/oauth2/access_token?appid=$AppID&secret=$AppSecret&code=${res.code}&grant_type=authorization_code')
  1250. .then((value) {
  1251. print(value);
  1252. getWeChatInfo(value);
  1253. });
  1254. }
  1255. });
  1256. }
  1257. //获取微信用户信息
  1258. void getWeChatInfo(Response value) {
  1259. AccessBeanEntity accessBeanEntity =
  1260. AccessBeanEntity().fromJson(json.decode(value.toString()));
  1261. Dio()
  1262. .get(
  1263. 'https://api.weixin.qq.com/sns/userinfo?access_token=${accessBeanEntity.accessToken}&openid=${accessBeanEntity.openid}')
  1264. .then((value) {
  1265. print(value);
  1266. try {
  1267. WXBeanEntity entity =
  1268. WXBeanEntity().fromJson(json.decode(value.toString()));
  1269. saveWXInfo(entity);
  1270. } catch (e) {}
  1271. });
  1272. }
  1273. void saveWXInfo(WXBeanEntity entity) {
  1274. MyDio().update({
  1275. "key": "user",
  1276. "values": {
  1277. "id": MyCookie().loginInformation.data.extra.id,
  1278. "wx_picture": entity.headimgurl,
  1279. "wx_name": entity.nickname,
  1280. "wx_openid": entity.openid
  1281. }
  1282. }, (response, hasError) {
  1283. if (!hasError) {
  1284. MyCookie().userBean.wxOpenid = entity.openid;
  1285. MyCookie().userBean.wxName = entity.nickname;
  1286. MyCookie().userBean.wxPicture = entity.headimgurl;
  1287. EventBus().emit('bindToWeChat');
  1288. }
  1289. }, (error) {});
  1290. }
  1291. void isItUnderReview() {
  1292. MyDio().post('/model/appStoreReview', {
  1293. 'version':MyCookie().packageInfo.version
  1294. }, (response, hasError) {
  1295. if(!hasError){
  1296. AppStoreReviewBeanEntity e = AppStoreReviewBeanEntity().fromJson(json.decode(response.data.toString()));
  1297. print(e.data);
  1298. if(e.data&&Platform.isIOS){
  1299. MyCookie().underReview = true;
  1300. }else{
  1301. MyCookie().underReview = false;
  1302. }
  1303. EventBus().emit('appStoreReview');
  1304. }
  1305. }, (error) { });
  1306. }
  1307. }
  1308. class FallbackCupertinoLocalisationsDelegate
  1309. extends LocalizationsDelegate<CupertinoLocalizations> {
  1310. const FallbackCupertinoLocalisationsDelegate();
  1311. @override
  1312. bool isSupported(Locale locale) => true;
  1313. @override
  1314. Future<CupertinoLocalizations> load(Locale locale) =>
  1315. DefaultCupertinoLocalizations.load(locale);
  1316. @override
  1317. bool shouldReload(FallbackCupertinoLocalisationsDelegate old) => false;
  1318. }