main.dart 50 KB

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