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