main.dart 50 KB

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