| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081 |
- import 'dart:async';
- import 'dart:convert';
- import 'package:bbyyy/beans/template_bean_entity.dart';
- import 'package:bbyyy/https/url.dart';
- import 'package:bbyyy/my_tools/event_bus.dart';
- import 'package:bbyyy/my_tools/my_cookie.dart';
- import 'package:bbyyy/my_tools/my_tools.dart';
- import 'package:bbyyy/paegs/gang_page/gang_in_page/gang_in_page.dart';
- import 'package:bbyyy/paegs/login_page/login_page.dart';
- import 'package:bbyyy/paegs/root_page/root_page_view.dart';
- import 'package:bbyyy/paegs/welcome_page/welcome_page.dart';
- import 'package:flustars/flustars.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- import 'package:flutter_local_notifications/flutter_local_notifications.dart';
- import 'package:flutter_localizations/flutter_localizations.dart';
- import 'package:flutter_svg/flutter_svg.dart';
- import 'package:pull_to_refresh/pull_to_refresh.dart';
- import 'package:rxdart/rxdart.dart';
- import 'beans/my_shop_bean_entity.dart';
- import 'beans/new_order_bean_entity.dart';
- import 'beans/system_information_bean_entity.dart';
- import 'https/MyDio.dart';
- import 'my_tools/const.dart';
- import 'my_tools/dims.dart';
- import 'my_tools/easy_loading/easy_loading.dart';
- import 'my_tools/easy_loading/loading.dart';
- import 'my_tools/global.dart';
- import 'my_tools/my_colors.dart';
- import 'my_tools/my_views.dart';
- import 'my_tools/order.dart';
- final FlutterLocalNotificationsPlugin flutterLocalNotificationsPlugin =
- FlutterLocalNotificationsPlugin();
- final BehaviorSubject<ReceivedNotification> didReceiveLocalNotificationSubject =
- BehaviorSubject<ReceivedNotification>();
- final BehaviorSubject<String> selectNotificationSubject =
- BehaviorSubject<String>();
- class ReceivedNotification {
- ReceivedNotification({
- @required this.id,
- @required this.title,
- @required this.body,
- @required this.payload,
- });
- final int id;
- final String title;
- final String body;
- final String payload;
- }
- Future<void> main() async {
- WidgetsFlutterBinding.ensureInitialized();
- const AndroidInitializationSettings initializationSettingsAndroid =
- AndroidInitializationSettings('@mipmap/app_logo');
- /// Note: permissions aren't requested here just to demonstrate that can be
- /// done later
- final IOSInitializationSettings initializationSettingsIOS =
- IOSInitializationSettings(
- requestAlertPermission: true,
- requestBadgePermission: true,
- requestSoundPermission: true,
- onDidReceiveLocalNotification:
- (int id, String title, String body, String payload) async {
- didReceiveLocalNotificationSubject.add(ReceivedNotification(
- id: id, title: title, body: body, payload: payload));
- });
- const MacOSInitializationSettings initializationSettingsMacOS =
- MacOSInitializationSettings(
- requestAlertPermission: true,
- requestBadgePermission: true,
- requestSoundPermission: true);
- final InitializationSettings initializationSettings = InitializationSettings(
- android: initializationSettingsAndroid,
- iOS: initializationSettingsIOS,
- macOS: initializationSettingsMacOS);
- await flutterLocalNotificationsPlugin.initialize(initializationSettings,
- onSelectNotification: (String payload) async {
- if (payload != null) {
- if (payload == notifyTypeNewMsg) {
- RootPageView().bNIndex = 2;
- EventBus().emit('ChangePage');
- }
- debugPrint('notification payload: $payload');
- }
- selectNotificationSubject.add(payload);
- });
- runApp(MyApp());
- }
- class MyApp extends StatelessWidget with WidgetsBindingObserver {
- BuildContext buildContext;
- StateSetter ss;
- List<MyShopBeanDataData> shops = [];
- int shopIndex = 0;
- String clipboardT;
- int amountCompleted = 0;
- NewOrderBeanEntity newOrder;
- @override
- StatelessElement createElement() {
- // TODO: implement createElement
- WidgetsBinding.instance.addObserver(this);
- MyCookie().initP();
- EventBus().on('hasNewOrder', (arg) {
- newOrder = arg;
- displayPendingOrders();
- });
- EventBus().on('systemInformation', (arg) {
- if (arg is SystemInformationBeanEntity) {
- showSystemMessages(arg);
- }
- });
- EventBus().on('检查粘贴板', (arg) {
- Timer(Duration(seconds: 1), () {
- getClipboardData();
- });
- });
- return super.createElement();
- }
- @override
- Widget build(BuildContext context) {
- return RefreshConfiguration(
- child: MaterialApp(
- navigatorKey: navigatorKey,
- theme: ThemeData(fontFamily: 'PingFang'),
- debugShowCheckedModeBanner: false,
- home: WelcomePage(),
- routes: {
- '/loginPage': (context) => LoginPage(),
- },
- supportedLocales: [const Locale('zh', 'CH')],
- localizationsDelegates: [
- RefreshLocalizations.delegate,
- GlobalMaterialLocalizations.delegate,
- GlobalWidgetsLocalizations.delegate,
- const FallbackCupertinoLocalisationsDelegate(),
- ],
- builder: (BuildContext context, Widget child) {
- buildContext = context;
- return MediaQuery(
- data: MediaQuery.of(context)
- .copyWith(textScaleFactor: 1.0), //设置字体不随系统字体大小改变
- child: FlutterEasyLoading(
- child: child,
- ),
- );
- },
- ),
- hideFooterWhenNotFull: true,
- footerBuilder: () {
- return ClassicFooter(
- loadStyle: LoadStyle.ShowWhenLoading,
- );
- },
- );
- }
- @override
- void didChangeAppLifecycleState(AppLifecycleState state) {
- super.didChangeAppLifecycleState(state);
- if (state == AppLifecycleState.paused) {
- print('went to Background');
- }
- if (state == AppLifecycleState.resumed) {
- print('came back to Foreground');
- if (MyCookie().loginInformation != null) {
- Timer(Duration(seconds: 1), () {
- getClipboardData();
- });
- }
- }
- }
- //获取剪切板文字
- Future<void> getClipboardData() async {
- ClipboardData text = await Clipboard.getData(Clipboard.kTextPlain);
- print('Clipboard-----\n${text.text}');
- clipboardT = text.text;
- Clipboard.setData(ClipboardData(text: ''));
- getOnlineTemplate();
- }
- //获取线上模板
- void getOnlineTemplate() {
- MyDio().query({
- 'key': 'order_template',
- "dims": ["id", "sid", "template"],
- "filters": {}
- }, (response, hasError) {
- if (!hasError) {
- TemplateBeanEntity entity = TemplateBeanEntity()
- .fromJson(json.decode(response.data.toString()));
- checkOrder(entity.data);
- }
- }, (error) {});
- }
- //匹配模板去除不是自己的订单
- void checkOrder(List<TemplateBeanData> data) {
- w:
- for (int i = 0; i < data.length; i++) {
- try {
- var res = parseString2(
- data[i].template.replaceAll('\r', ''), '''$clipboardT''');
- if (res != null) {
- print(data[i].template);
- print(json.encode(res));
- var order = parse2(res);
- order.removeWhere((element) =>
- !element.seller.name
- .contains(MyCookie().loginInformation.data.extra.name) &&
- !MyCookie()
- .loginInformation
- .data
- .extra
- .name
- .contains(element.seller.name));
- if (order.length > 0) {
- getShop(order);
- }
- break w;
- }
- } catch (e) {}
- }
- }
- //订单视图
- items(List<OrderInfo2> order) {
- List<Widget> items = [];
- order.forEach((element) {
- items.add(Container(
- child: Column(
- children: [
- Row(
- children: [
- Container(
- margin: EdgeInsets.only(left: 8, right: 7),
- child: ClipRRect(
- child: MyViews().netImg(
- imgURL(MyCookie().loginInformation.data.extra.picture),
- 35,
- 35),
- borderRadius: BorderRadius.circular(17.5),
- ),
- ),
- Expanded(
- child: Container(
- height: 35,
- child: Column(
- children: [
- Text(
- '付款人:${element.payer.name}',
- style: TextStyle(
- color: MyColors.c333333,
- fontSize: 13,
- decoration: TextDecoration.none,
- ),
- ),
- Text(
- '订单时间:${element.time}',
- style: TextStyle(
- color: MyColors.c666666,
- fontSize: 10,
- decoration: TextDecoration.none,
- ),
- ),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- ),
- ),
- Container(
- margin: EdgeInsets.only(right: 10),
- child: Text(
- '¥${(element.payer.amount * element.factor).toStringAsFixed(2)}',
- style: TextStyle(
- color: MyColors.cFF4233,
- fontSize: 14,
- decoration: TextDecoration.none,
- ),
- ),
- ),
- ],
- crossAxisAlignment: CrossAxisAlignment.center,
- ),
- Container(
- height: 0.5,
- margin: EdgeInsets.only(right: 10, left: 50, top: 5),
- color: MyColors.cE7E7E7,
- )
- ],
- ),
- margin: EdgeInsets.only(top: 5),
- ));
- });
- return items;
- }
- //获取用户所在店铺
- void getShop(List<OrderInfo2> order) {
- shopIndex = 0;
- MyDio().query({
- "key": "shop_user",
- "filters": {
- "or": true,
- "conditions": [
- "role!=0",
- "user_uid==${MyCookie().getUID()}",
- "review_state==1"
- ],
- "filters": [
- {
- "conditions": ["role==0", "user_uid==${MyCookie().getUID()}"]
- }
- ]
- },
- "dims": shopUserDims,
- "paging": [1, 20000]
- }, (response, hasError) {
- if (!hasError) {
- MyShopBeanEntity entity =
- MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
- shops = entity.data.data;
- shops.removeWhere((element) => !element.privateShop);
- if (shops.length == 0) {
- showToast('你还没有添加任何货帮,暂时不能发送智能订单');
- } else {
- EasyLoading.instance
- ..contentPadding = EdgeInsets.symmetric(horizontal: 0, vertical: 12)
- ..alignment = Alignment.bottomCenter
- ..loadingStyle = EasyLoadingStyle.light
- ..contentMargin = EdgeInsets.fromLTRB(20, 20, 20, 65);
- EasyLoading.show(
- indicator: Material(
- color: Colors.white,
- child: StatefulBuilder(
- builder: (c, s) {
- ss = s;
- return Column(
- children: [
- Container(
- child: Stack(
- children: [
- Container(
- child: MyViews()
- .myText('智能订单', MyColors.c333333, 14),
- alignment: Alignment.center,
- height: 22,
- ),
- Positioned(
- right: 0,
- child: GestureDetector(
- onTap: () {
- EasyLoading.dismiss();
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- child: Icon(
- Icons.close,
- size: 20,
- color: Colors.white,
- ),
- decoration: BoxDecoration(
- color: MyColors.cB6B6B6,
- borderRadius: BorderRadius.circular(11)),
- height: 22,
- width: 22,
- ),
- ),
- )
- ],
- alignment: Alignment.center,
- ),
- height: 30,
- padding: EdgeInsets.symmetric(horizontal: 12),
- ),
- Container(
- height: 5,
- color: MyColors.cF7F7F7,
- margin: EdgeInsets.only(top: 10),
- ),
- Column(
- children: items(order),
- ),
- Container(
- height: 5,
- color: MyColors.cF7F7F7,
- margin: EdgeInsets.only(top: 10),
- ),
- Visibility(
- child: Column(
- children: [
- Container(
- child: MyViews()
- .myText('货帮选择', MyColors.c333333, 13),
- margin: EdgeInsets.only(left: 7, top: 11),
- ),
- Container(
- margin: EdgeInsets.symmetric(
- horizontal: 7, vertical: 10),
- height: (shops.length * 1.0 / 2).ceil() *
- (double.parse(
- '${MediaQuery.of(buildContext).size.width - 74}') /
- 2 /
- 3.8 +
- 10) -
- 10,
- child: GridView(
- gridDelegate:
- SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 2, //横轴三个子widget
- childAspectRatio: 3.8,
- crossAxisSpacing: 10,
- mainAxisSpacing: 8 //宽高比为1时,子widget
- ),
- children: shop(shops),
- padding: EdgeInsets.all(0),
- ),
- ),
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- visible: shops.length != 1,
- ),
- Container(
- height: 0.5,
- color: MyColors.cF7F7F7,
- margin: EdgeInsets.only(bottom: 10),
- ),
- Container(
- child: GestureDetector(
- onTap: () {
- EventBus().on('saveOrder', (arg) {
- amountCompleted++;
- if (amountCompleted == order.length) {
- amountCompleted = 0;
- EasyLoading.dismiss();
- showToast('发送成功');
- clipboardT = '';
- EventBus().off('saveOrder');
- }
- });
- order.forEach((element) {
- sendOrder(element);
- });
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- color: MyColors.cFF4233,
- borderRadius: BorderRadius.circular(20),
- ),
- height: 40,
- width: 150,
- child: MyViews().myText('发送订单', Colors.white, 14),
- alignment: Alignment.center,
- ),
- ),
- alignment: Alignment.center,
- )
- ],
- mainAxisAlignment: MainAxisAlignment.start,
- crossAxisAlignment: CrossAxisAlignment.start,
- );
- },
- ),
- ),
- );
- }
- }
- }, (error) {});
- }
- //店铺视图
- shop(List<MyShopBeanDataData> shops) {
- List<Widget> items = [];
- for (int i = 0; i < shops.length; i++) {
- items.add(GestureDetector(
- onTap: () {
- shopIndex = i;
- ss(() {});
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- child: Row(
- children: [
- Container(
- margin: EdgeInsets.only(right: 5),
- child: ClipRRect(
- child: MyViews().netImg(imgURL(shops[i].shopPic), 30, 30),
- borderRadius: BorderRadius.circular(15),
- ),
- ),
- Expanded(
- child: Column(
- children: [
- Text(
- shops[i].shopName,
- style: TextStyle(
- color: i == shopIndex
- ? MyColors.cFF4233
- : MyColors.c666666,
- fontSize: 12,
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- Text(
- 'ID:${shops[i].shopUid}',
- style: TextStyle(
- color: i == shopIndex
- ? MyColors.cFF4233
- : MyColors.c666666,
- fontSize: 10,
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- ),
- ],
- ),
- decoration: BoxDecoration(
- color: i == shopIndex ? MyColors.cFFECEB : MyColors.cEDEDED,
- borderRadius: BorderRadius.circular(4),
- ),
- constraints: BoxConstraints(maxWidth: 150),
- padding: EdgeInsets.symmetric(horizontal: 6, vertical: 6),
- ),
- ));
- }
- return items;
- }
- //发送订单
- void sendOrder(OrderInfo2 element) {
- MyDio().save({
- 'key': 'order',
- 'object': {
- 'uuid': generateMd5(reOS(clipboardT)),
- 'shop_uid': shops[shopIndex].shopUid,
- 'shop_pic': shops[shopIndex].shopPic,
- 'shop_name': shops[shopIndex].shopName,
- // 'seller_id': MyCookie().loginInformation.data.extra.id,
- 'seller_pic': MyCookie().loginInformation.data.extra.picture,
- 'seller_uid': MyCookie().getUID(),
- 'seller_name': MyCookie().loginInformation.data.extra.name,
- 'buyer_name': element.payer.name,
- 'type': orderTypeThirdPlatform,
- 'amount': NumUtil.multiply(element.payer.amount, element.factor)
- // 'amount':0.01
- }
- }, (response, hasError) {
- if (!hasError) {
- EventBus().emit('saveOrder');
- }
- }, (error) {});
- }
- //待支付订单视图
- void displayPendingOrders() {
- EasyLoading.instance
- ..contentPadding = EdgeInsets.symmetric(horizontal: 0, vertical: 12)
- ..alignment = Alignment.bottomCenter
- ..loadingStyle = EasyLoadingStyle.light
- ..contentMargin = EdgeInsets.fromLTRB(20, 20, 20, 65);
- EasyLoading.show(
- indicator: Material(
- color: Colors.white,
- child: Column(
- children: [
- Container(
- padding: EdgeInsets.symmetric(horizontal: 12),
- child: Row(
- children: [
- Container(
- margin: EdgeInsets.only(right: 7),
- child: ClipRRect(
- child: MyViews()
- .netImg(imgURL(newOrder.content.shopPic), 25, 25),
- borderRadius: BorderRadius.circular(12.5),
- ),
- ),
- MyViews().myText(
- '${newOrder.content.shopName}(${newOrder.content.shopUID})',
- MyColors.c333333,
- 14),
- ],
- ),
- ),
- Container(
- margin: EdgeInsets.only(top: 11, left: 12, right: 12, bottom: 11),
- height: 0.5,
- color: MyColors.cE7E7E7,
- ),
- Container(
- margin: EdgeInsets.symmetric(horizontal: 12),
- child: Row(
- children: [
- Container(
- child: SvgPicture.asset(
- 'images/svg/第三方.svg',
- height: 27,
- width: 27,
- ),
- margin: EdgeInsets.only(right: 8),
- height: 45,
- width: 45,
- decoration: BoxDecoration(
- border: Border.all(color: MyColors.cEBEBEB, width: 1)),
- alignment: Alignment.center,
- ),
- Expanded(
- child: Container(
- height: 45,
- child: Column(
- children: [
- MyViews().myText('第三方订单', MyColors.c333333, 13),
- Row(
- children: [
- MyViews().myText('¥${newOrder.content.amount}',
- MyColors.cFF4233, 12),
- MyViews().myText('x1', MyColors.c999999, 12),
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- ),
- ),
- ],
- ),
- ),
- Container(
- height: 0.5,
- color: MyColors.cE7E7E7,
- margin: EdgeInsets.symmetric(horizontal: 12, vertical: 11),
- ),
- Container(
- margin: EdgeInsets.symmetric(horizontal: 12),
- child: Row(
- children: [
- MyViews().myText('卖家信息:', MyColors.c333333, 13),
- Row(
- children: [
- Container(
- margin: EdgeInsets.only(right: 5),
- child: ClipRRect(
- child: MyViews().netImg(
- imgURL(newOrder.content.sellerPic), 23, 23),
- borderRadius: BorderRadius.circular(11.5),
- ),
- ),
- MyViews().myText(
- '${newOrder.content.sellerName}(${newOrder.content.sellerUID.toString().replaceRange(0, 4, '****')})',
- MyColors.c333333,
- 13),
- ],
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- Container(
- height: 0.5,
- color: MyColors.cE7E7E7,
- margin: EdgeInsets.symmetric(horizontal: 12, vertical: 11),
- ),
- Container(
- margin: EdgeInsets.symmetric(horizontal: 12),
- child: Row(
- children: [
- MyViews().myText('买家信息:', MyColors.c333333, 13),
- Row(
- children: [
- Container(
- margin: EdgeInsets.only(right: 5),
- child: ClipRRect(
- child: MyViews().netImg('path', 23, 23),
- borderRadius: BorderRadius.circular(11.5),
- ),
- ),
- MyViews().myText('${newOrder.content.buyerName}',
- MyColors.c333333, 13),
- ],
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- Container(
- height: 0.5,
- color: MyColors.cE7E7E7,
- margin: EdgeInsets.symmetric(horizontal: 12, vertical: 11),
- ),
- Container(
- margin: EdgeInsets.symmetric(horizontal: 12),
- child: Row(
- children: [
- MyViews().myText('下单时间:', MyColors.c333333, 13),
- MyViews().myText(
- '${newOrder.content.createTime}', MyColors.c333333, 13)
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- Container(
- height: 0.5,
- color: MyColors.cE7E7E7,
- margin: EdgeInsets.symmetric(horizontal: 12, vertical: 11),
- ),
- Container(
- margin: EdgeInsets.symmetric(horizontal: 20),
- child: Row(
- children: [
- Expanded(
- child: GestureDetector(
- onTap: () {
- EasyLoading.dismiss();
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(20),
- bottomLeft: Radius.circular(20),
- ),
- border: Border.all(
- color: MyColors.cFF4233, width: 1)),
- height: 40,
- child: MyViews().myText('与我无瓜', MyColors.cFF4233, 14),
- alignment: Alignment.center),
- ),
- ),
- Expanded(
- child: GestureDetector(
- onTap: () {
- if (newOrder.content.buyerName
- .contains(MyCookie().getName()) ||
- MyCookie()
- .getName()
- .contains(newOrder.content.buyerName)) {
- EasyLoading.dismiss();
- payTheOrder();
- // showDialog(
- // context: buildContext,
- // builder: (BuildContext context) {
- // return Center(
- // child: Container(
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius:
- // BorderRadius.all(Radius.circular(8))),
- // child: Column(
- // children: [
- // Expanded(
- // child: Center(
- // child: Padding(
- // padding: const EdgeInsets.only(
- // left: 15, right: 15),
- // child: Column(
- // children: [
- // Text(
- // '确认支付订单(${newOrder.content.uID})',
- // style: TextStyle(
- // color: MyColors.c333333,
- // fontSize: 16,
- // fontWeight:
- // FontWeight.normal,
- // decoration:
- // TextDecoration.none),
- // ),
- // Text(
- // '付款人:${newOrder.content.buyerName}',
- // style: TextStyle(
- // color: MyColors.c333333,
- // fontSize: 16,
- // fontWeight:
- // FontWeight.normal,
- // decoration:
- // TextDecoration.none),
- // ),
- // Text(
- // '收款人:${newOrder.content.sellerName}',
- // style: TextStyle(
- // color: MyColors.c333333,
- // fontSize: 16,
- // fontWeight:
- // FontWeight.normal,
- // decoration:
- // TextDecoration.none),
- // ),
- // ],
- // mainAxisAlignment:
- // MainAxisAlignment.center,
- // ),
- // ),
- // ),
- // ),
- // Container(
- // height: 0.5,
- // color: MyColors.cE7E7E7,
- // ),
- // Row(
- // children: [
- // Expanded(
- // child: GestureDetector(
- // onTap: () {
- // Navigator.pop(context);
- // },
- // behavior:
- // HitTestBehavior.translucent,
- // child: Container(
- // alignment: Alignment.center,
- // height: 55,
- // child: Text(
- // '取消',
- // style: TextStyle(
- // color: MyColors.c999999,
- // fontSize: 16,
- // fontWeight:
- // FontWeight.normal,
- // decoration:
- // TextDecoration.none),
- // ),
- // ),
- // )),
- // Container(
- // width: 0.5,
- // height: 55,
- // color: MyColors.cE7E7E7,
- // ),
- // Expanded(
- // child: GestureDetector(
- // onTap: () async {
- // Navigator.pop(context);
- // payTheOrder(context);
- // },
- // behavior:
- // HitTestBehavior.translucent,
- // child: Container(
- // alignment: Alignment.center,
- // height: 55,
- // child: Text(
- // '确定',
- // style: TextStyle(
- // color: MyColors.cFF4233,
- // fontSize: 16,
- // fontWeight:
- // FontWeight.normal,
- // decoration:
- // TextDecoration.none),
- // ),
- // ),
- // ),
- // ),
- // ],
- // )
- // ],
- // ),
- // height: 200,
- // margin: EdgeInsets.only(left: 48, right: 48),
- // ),
- // );
- // },
- // );
- } else {
- showToast('该订单与你无关');
- }
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.only(
- topRight: Radius.circular(20),
- bottomRight: Radius.circular(20),
- ),
- color: MyColors.cFF4233),
- height: 40,
- child: MyViews().myText('立即支付', Colors.white, 14),
- alignment: Alignment.center),
- ),
- )
- ],
- ),
- )
- ],
- ),
- ),
- );
- }
- void payTheOrder() {
- //获取店铺信息
- MyDio().query({
- "key": "shop_user",
- "filters": {
- "conditions": ["shop_uid==${newOrder.content.shopUID}"]
- },
- "dims": shopUserDims,
- "paging": [1, 1],
- "order_by": ["shop_name,DESC"]
- }, (response, hasError) {
- if (!hasError) {
- MyShopBeanEntity entity =
- MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
- navigatorKey.currentState.push(MaterialPageRoute(
- builder: (context) =>
- GangInPage(entity.data.data[0], newOrder.content)));
- }
- }, (error) {});
- // getUserWalletBalance((re, hE) {
- // if (!hE) {
- // UserBalanceEntity balance =
- // UserBalanceEntity().fromJson(json.decode(re.data.toString()));
- // if (balance.data >= newOrder.content.amount) {
- // payOrder(payWayWallet, newOrder.content.uID, (re, hE) {
- // if (!hE) {
- // showToast('支付成功');
- // EventBus().emit('payAnOrder');
- // }
- // }, (e) {}, context);
- // } else {
- // payOrder(payWayAliPay, newOrder.content.uID, (re, hE) {
- // if (!hE) {
- // PayByAlipayBeanEntity entity = PayByAlipayBeanEntity()
- // .fromJson(json.decode(re.data.toString()));
- // EventBus().on('alipayPaymentCallback', (arg) {
- // EventBus().off('alipayPaymentCallback');
- // EasyLoading.dismiss();
- // showToast('支付成功');
- // EventBus().emit('reNoPayOrder');
- // });
- // print(entity.data);
- // EasyLoading.instance
- // ..contentPadding =
- // EdgeInsets.symmetric(horizontal: 20, vertical: 12)
- // ..alignment = Alignment.center
- // ..contentMargin = EdgeInsets.all(20);
- // EasyLoading.show();
- // aliPay(entity.data).then((value) {
- // print(json.encode(value));
- // AlipayResultBeanEntity e = AlipayResultBeanEntity()
- // .fromJson(json.decode(json.encode(value)));
- // try {
- // int r = int.parse(e.resultStatus);
- // if (r == 9000) {
- // showToast('支付成功');
- // } else {
- // showToast(aliPayResultStatus(r));
- // resetOrder(newOrder.content.uID, context);
- // }
- // } catch (e) {
- // EasyLoading.dismiss();
- // }
- // });
- // // EventBus().emit('payAnOrder');
- // }
- // }, (e) {}, context);
- // // showToast('积分余额不足');
- // }
- // }
- // }, (e) {}, context);
- }
- void showSystemMessages(SystemInformationBeanEntity arg) {
- EasyLoading.instance
- ..contentPadding = EdgeInsets.symmetric(horizontal: 12, vertical: 12)
- ..alignment = Alignment.center
- ..loadingStyle = EasyLoadingStyle.custom
- ..backgroundColor = Colors.transparent
- ..indicatorColor = Colors.black
- ..progressColor = Colors.black
- ..maskColor = Colors.black
- ..textColor = Colors.black
- ..contentMargin = EdgeInsets.fromLTRB(20, 20, 20, 65);
- EasyLoading.show(
- indicator: Material(
- color: Colors.transparent,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(16),
- ),
- height: MediaQuery.of(buildContext).size.height - 200,
- padding: EdgeInsets.symmetric(horizontal: 8, vertical: 12),
- child: Column(
- children: [
- Expanded(child: Container()),
- Container(
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.circular(16),
- ),
- child: Column(
- children: [
- Container(
- child: Text(
- '系统消息',
- style: TextStyle(
- color: MyColors.c333333,
- fontSize: 14,
- fontWeight: FontWeight.bold),
- ),
- margin:
- EdgeInsets.symmetric(horizontal: 26, vertical: 15),
- ),
- Container(
- child: Text(
- arg.content.content,
- style: TextStyle(color: MyColors.c333333, fontSize: 14),
- ),
- margin: EdgeInsets.symmetric(horizontal: 26),
- alignment: Alignment.centerLeft,
- ),
- Container(
- height: 0.5,
- color: MyColors.cE7E7E7,
- margin: EdgeInsets.only(bottom: 12, top: 12),
- ),
- GestureDetector(
- onTap: () {
- EasyLoading.dismiss();
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- width: 150,
- margin: EdgeInsets.only(bottom: 14),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(20),
- border:
- Border.all(color: MyColors.cFF4233, width: 1.1),
- color: Colors.white),
- child: MyViews().myText('我知道了', MyColors.cFF4233, 14),
- height: 40,
- alignment: Alignment.center,
- ),
- )
- ],
- ),
- ),
- Expanded(child: Container()),
- ],
- ),
- alignment: Alignment.center,
- ),
- ),
- );
- }
- }
- class FallbackCupertinoLocalisationsDelegate
- extends LocalizationsDelegate<CupertinoLocalizations> {
- const FallbackCupertinoLocalisationsDelegate();
- @override
- bool isSupported(Locale locale) => true;
- @override
- Future<CupertinoLocalizations> load(Locale locale) =>
- DefaultCupertinoLocalizations.load(locale);
- @override
- bool shouldReload(FallbackCupertinoLocalisationsDelegate old) => false;
- }
|