| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075 |
- import 'dart:convert';
- import 'dart:math';
- import 'package:bbyyy/beans/alipay_result_bean_entity.dart';
- import 'package:bbyyy/beans/goods_bean_entity.dart';
- import 'package:bbyyy/beans/my_shop_bean_entity.dart';
- import 'package:bbyyy/beans/new_order_bean_entity.dart';
- import 'package:bbyyy/beans/pay_by_alipay_bean_entity.dart';
- import 'package:bbyyy/beans/smart_order_bean_entity.dart';
- import 'package:bbyyy/beans/store_bean_entity.dart';
- import 'package:bbyyy/beans/user_balance_entity.dart';
- import 'package:bbyyy/https/MyDio.dart';
- import 'package:bbyyy/https/my_request.dart';
- import 'package:bbyyy/https/url.dart';
- import 'package:bbyyy/my_tools/const.dart';
- import 'package:bbyyy/my_tools/dims.dart';
- import 'package:bbyyy/my_tools/easy_loading/easy_loading.dart';
- import 'package:bbyyy/my_tools/event_bus.dart';
- import 'package:bbyyy/my_tools/my_colors.dart';
- import 'package:bbyyy/my_tools/my_cookie.dart';
- import 'package:bbyyy/my_tools/my_tools.dart';
- import 'package:bbyyy/my_tools/my_views.dart';
- import 'package:bbyyy/paegs/chat_page/chat_page.dart';
- import 'package:bbyyy/paegs/gang_page/gang_in_page/pay_to_the_helper_page/pay_to_the_helper_page.dart';
- import 'package:bbyyy/pay/pay_tools.dart';
- import 'package:flutter/cupertino.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_slidable/flutter_slidable.dart';
- import 'package:flutter_svg/svg.dart';
- import 'package:pull_to_refresh/pull_to_refresh.dart';
- import 'package:tobias/tobias.dart';
- import 'package:url_launcher/url_launcher.dart';
- import 'gang_information_page/gang_information_page.dart';
- class GangInPage extends StatefulWidget {
- MyShopBeanDataData data;
- NewOrderBeanContent order;
- GangInPage(this.data, this.order);
- @override
- _GangInPageState createState() => _GangInPageState();
- }
- class _GangInPageState extends State<GangInPage> {
- int selectedIndex = 0;
- RefreshController controller = RefreshController(initialRefresh: true);
- int page = 1;
- _GangInPageState();
- List<GoodsBeanDataData> goods = [];
- List<SmartOrderBeanDataData> orders = [];
- @override
- void initState() {
- // TODO: implement initState
- super.initState();
- EventBus().on('payAnOrder', (arg) {
- controller.requestRefresh();
- });
- EventBus().on('reNoPayOrder', (arg) {
- controller.requestRefresh();
- });
- Future.delayed(Duration.zero, () {
- if (widget.order != null) {
- setState(() {
- selectedIndex = 2;
- payTheOrder();
- });
- }
- });
- if (widget.data.ownerUid == MyCookie().getUID()) {
- selectedIndex = 1;
- }
- queryStoreInformation();
- }
- @override
- void dispose() {
- // TODO: implement dispose
- super.dispose();
- EventBus().off('payAnOrder');
- EventBus().off('reNoPayOrder');
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- body: Column(
- children: [
- MyViews().myAppBar(widget.data.shopName, context, [
- Visibility(
- visible: widget.data.ownerUid == MyCookie().getUID(),
- child: IconButton(
- icon: Icon(Icons.more_horiz),
- onPressed: () {
- MyTools().toPage(context, GangInformationPage(widget.data),
- (then) {
- if (then == '删除货帮') {
- Navigator.pop(context, '删除货帮');
- }
- });
- }),
- )
- ]),
- Container(
- color: MyColors.cF7F7F7,
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(4), color: Colors.white),
- margin: EdgeInsets.all(10),
- child: Column(
- children: [
- GestureDetector(
- onTap: () {
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return Material(
- color: Colors.black12,
- child: Center(
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(16),
- color: Colors.white,
- ),
- height: 510,
- margin: EdgeInsets.symmetric(horizontal: 28),
- padding: EdgeInsets.symmetric(
- horizontal: 14, vertical: 15),
- child: Column(
- children: [
- Container(
- height:
- MediaQuery.of(context).size.width -
- 71,
- width: MediaQuery.of(context).size.width -
- 56,
- child: Stack(
- children: [
- ClipRRect(
- child: MyViews().netImg(
- imgURL(widget.data.shopPic),
- MediaQuery.of(context)
- .size
- .width -
- 84,
- MediaQuery.of(context)
- .size
- .width -
- 84),
- borderRadius:
- BorderRadius.circular(4),
- ),
- Positioned(
- right: 0,
- top: 0,
- child: IconButton(
- icon: Icon(
- Icons.cancel,
- color: MyColors.cC9C9C9,
- size: 24,
- ),
- onPressed: () {
- Navigator.pop(context);
- }),
- ),
- ],
- ),
- ),
- Row(
- children: [
- SvgPicture.asset(
- 'images/svg/店铺.svg',
- height: 21,
- width: 21,
- ),
- Container(
- width: 6,
- ),
- Expanded(
- child: Text(
- widget.data.shopName,
- style: TextStyle(
- color: MyColors.c333333,
- fontSize: 16),
- ))
- ],
- ),
- Container(height: 10,),
- Text(
- store == null
- ? '店铺介绍:暂无'
- : '店铺介绍:${store.introduction}',
- style: TextStyle(
- color: MyColors.c333333,
- fontSize: 12,
- ),
- maxLines: 3,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ), Container(height: 10,),
- Row(
- children: [
- SvgPicture.asset(
- 'images/svg/地址.svg',
- color: MyColors.c666666,
- height: 12,
- width: 12,
- ),
- Container(
- width: 5,
- ),
- Expanded(
- child: Text(
- store == null
- ? '暂无'
- : store.address,
- style: TextStyle(
- color: MyColors.c666666,
- fontSize: 11),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- ),
- ],
- ), Container(height: 10,),
- GestureDetector(
- onTap: (){
- launch('tel:${store.mobile}');
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- color: MyColors.cFF4233,
- borderRadius: BorderRadius.circular(20),
- ),
- height: 40,
- child: Row(children: [
- SvgPicture.asset('images/svg/电话.svg',color: Colors.white,height: 24,width: 24,),
- Container(width: 4,),
- Text(store==null?'':store.mobile,style: TextStyle(color: Colors.white,fontSize: 15),),
- ],mainAxisAlignment: MainAxisAlignment.center,),
- alignment: Alignment.center,
- ),
- )
- ],
- mainAxisAlignment:
- MainAxisAlignment.spaceAround,
- crossAxisAlignment: CrossAxisAlignment.start,
- ),
- ),
- ),
- );
- },
- );
- },
- behavior: HitTestBehavior.translucent,
- child: Row(
- children: [
- Container(
- margin: EdgeInsets.only(
- right: 10, top: 6, left: 6, bottom: 6),
- child: ClipRRect(
- child: MyViews()
- .netImg(imgURL(widget.data.shopPic), 65, 65),
- borderRadius: BorderRadius.circular(4),
- ),
- ),
- Expanded(
- child: Container(
- height: 65,
- margin: EdgeInsets.only(right: 6),
- child: Column(
- children: [
- Text(
- widget.data.shopName,
- style: TextStyle(
- color: MyColors.c333333, fontSize: 13),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- Row(
- children: [
- Expanded(
- child: Text(
- store == null
- ? '店铺介绍:无'
- : '店铺介绍:${store.introduction}',
- style: TextStyle(
- color: MyColors.c666666,
- fontSize: 11),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- ),
- SvgPicture.asset(
- 'images/svg/箭头.svg',
- color: MyColors.c666666,
- height: 10,
- width: 10,
- )
- ],
- crossAxisAlignment: CrossAxisAlignment.center,
- ),
- Row(
- children: [
- SvgPicture.asset(
- 'images/svg/地址.svg',
- color: MyColors.c666666,
- height: 12,
- width: 12,
- ),
- Container(
- width: 5,
- ),
- Expanded(
- child: Text(
- store == null ? '暂无' : store.address,
- style: TextStyle(
- color: MyColors.c666666,
- fontSize: 11),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- softWrap: true,
- ),
- ),
- ],
- ),
- ],
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- ),
- )
- ],
- ),
- ),
- Container(
- height: 0.5,
- color: MyColors.cE7E7E7,
- ),
- Container(
- margin: EdgeInsets.all(6),
- child: Row(
- children: [
- Row(
- children: [
- SvgPicture.asset(
- 'images/svg/电话.svg',
- height: 18,
- width: 18,
- ),
- Container(
- width: 5,
- ),
- Text(
- store == null ? '暂无' : store.mobile,
- style: TextStyle(
- color: MyColors.cFF4233, fontSize: 12),
- ),
- ],
- ),
- GestureDetector(
- onTap: () {
- launch('tel:${store.mobile}');
- },
- behavior: HitTestBehavior.translucent,
- child: Container(
- decoration: BoxDecoration(
- color: MyColors.cFF4233,
- borderRadius: BorderRadius.circular(10),
- ),
- height: 20,
- width: 50,
- child: MyViews().myText('点击拨打', Colors.white, 9),
- alignment: Alignment.center,
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- ),
- )
- ],
- ),
- ),
- ),
- Visibility(
- visible: widget.data.privateShop ||
- widget.data.ownerUid == MyCookie().getUID(),
- child: Container(
- height: 40,
- color: Colors.white,
- child: Row(
- children: [
- GestureDetector(
- onTap: () {
- setState(() {
- selectedIndex = 0;
- controller.requestRefresh();
- });
- },
- behavior: HitTestBehavior.translucent,
- child: Padding(
- padding: EdgeInsets.only(left: 10, right: 10),
- child: Column(
- children: [
- Text(
- '货帮商品',
- style: TextStyle(
- color: selectedIndex == 0
- ? MyColors.cFF4233
- : MyColors.c666666,
- fontSize: 15),
- ),
- Container(
- height: 10,
- child: Visibility(
- child: SvgPicture.asset('images/svg/tab.svg'),
- visible: selectedIndex == 0,
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.end,
- ),
- ),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- selectedIndex = 1;
- controller.requestRefresh();
- });
- },
- behavior: HitTestBehavior.translucent,
- child: Padding(
- padding: EdgeInsets.only(left: 10, right: 10),
- child: Column(
- children: [
- Text(
- widget.data.ownerUid == MyCookie().getUID()
- ? '未付订单'
- : '未收订单',
- style: TextStyle(
- color: selectedIndex == 1
- ? MyColors.cFF4233
- : MyColors.c666666,
- fontSize: 15),
- ),
- Container(
- height: 10,
- child: Visibility(
- child: SvgPicture.asset('images/svg/tab.svg'),
- visible: selectedIndex == 1,
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.end,
- ),
- ),
- ),
- GestureDetector(
- onTap: () {
- setState(() {
- selectedIndex = 2;
- controller.requestRefresh();
- });
- },
- behavior: HitTestBehavior.translucent,
- child: Padding(
- padding: EdgeInsets.only(left: 10, right: 10),
- child: Column(
- children: [
- Text(
- widget.data.ownerUid == MyCookie().getUID()
- ? '已付订单'
- : '未付订单',
- style: TextStyle(
- color: selectedIndex == 2
- ? MyColors.cFF4233
- : MyColors.c666666,
- fontSize: 15),
- ),
- Container(
- height: 10,
- child: Visibility(
- child: SvgPicture.asset('images/svg/tab.svg'),
- visible: selectedIndex == 2,
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.end,
- ),
- ),
- )
- ],
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- ),
- ),
- ),
- body(),
- SafeArea(
- top: false,
- child: Container(
- padding: EdgeInsets.symmetric(horizontal: 37),
- color: Colors.white,
- width: double.infinity,
- height: 60,
- child: Row(
- children: [
- Expanded(
- child: GestureDetector(
- onTap: () {
- queryShopMembers();
- },
- 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: () {
- MyTools().toPage(context,
- PayToTheHelperPage(widget.data), (then) {});
- },
- 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),
- ),
- )
- ],
- ),
- ),
- )
- ],
- ),
- );
- }
- body() {
- if (selectedIndex == 0) {
- return Expanded(
- child: SmartRefresher(
- controller: controller,
- onRefresh: onRefresh,
- onLoading: onLoading,
- enablePullDown: true,
- enablePullUp: true,
- child: goods.length == 0
- ? noData()
- : GridView.builder(
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- crossAxisCount: 2, //每行三列
- childAspectRatio: 164 / 261, //显示区域宽高相等
- mainAxisSpacing: 8,
- crossAxisSpacing: 8),
- itemCount: goods.length,
- padding:
- EdgeInsets.only(left: 14, right: 14, top: 14, bottom: 65),
- itemBuilder: (context, index) {
- return MyViews().getGoodsItem(goods[index], context);
- }),
- ),
- );
- } else if (selectedIndex == 1) {
- return Expanded(
- child: SmartRefresher(
- controller: controller,
- onRefresh: onRefresh,
- onLoading: onLoading,
- enablePullDown: true,
- enablePullUp: true,
- child: orders.length == 0
- ? noData()
- : ListView.builder(
- itemBuilder: (c, index) {
- return Slidable(
- child: MyViews().getNoPayGoodsItem(
- orders[index], context, widget.data.ownerUid),
- actionPane: SlidableDrawerActionPane(),
- enabled: widget.data.ownerUid == MyCookie().getUID(),
- actionExtentRatio: 0.25,
- secondaryActions: <Widget>[
- SlideAction(
- child: Container(
- child: Container(
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(30),
- color: MyColors.cFF4233,
- ),
- height: 60,
- width: 60,
- child: SvgPicture.asset(
- 'images/svg/del.svg',
- height: 40,
- width: 40,
- ),
- alignment: Alignment.center,
- ),
- ),
- onTap: () {
- showSimpleDialog(
- '将删除订单(${orders[index].uid})', context, () {
- Navigator.pop(context);
- deleteOrder(orders[index]);
- });
- },
- )
- ],
- );
- },
- itemCount: orders.length,
- padding: EdgeInsets.only(left: 10, right: 10, top: 10),
- ),
- ),
- );
- } else if (selectedIndex == 2) {
- return Expanded(
- child: SmartRefresher(
- controller: controller,
- onRefresh: onRefresh,
- onLoading: onLoading,
- enablePullDown: true,
- enablePullUp: true,
- child: orders.length == 0
- ? noData()
- : ListView.builder(
- itemBuilder: (c, index) {
- return MyViews().getNoPayGoodsItem(
- orders[index], context, widget.data.ownerUid);
- },
- itemCount: orders.length,
- padding: EdgeInsets.only(left: 10, right: 10, top: 10),
- ),
- ),
- );
- } else {
- return noData();
- }
- }
- void onRefresh() {
- page = 1;
- if (selectedIndex == 0) {
- queryProducts();
- } else if (selectedIndex == 1) {
- unreceivedOrder();
- } else {
- unpaidOrder();
- }
- }
- void onLoading() {
- page++;
- if (selectedIndex == 0) {
- queryProducts();
- } else if (selectedIndex == 1) {
- unreceivedOrder();
- } else {
- unpaidOrder();
- }
- }
- //查询商品
- void queryProducts() {
- MyDio().query({
- "key": "commodity",
- "filters": {
- "conditions": ["shop_uid == ${widget.data.shopUid}", "on_sale == true"]
- },
- "dims": commodityDims,
- "paging": [page, 20]
- }, (response, hasError) {
- if (!hasError) {
- GoodsBeanEntity entity =
- GoodsBeanEntity().fromJson(json.decode(response.data.toString()));
- if (page == 1) {
- goods.clear();
- }
- goods.addAll(entity.data.data);
- }
- setState(() {
- endRe(controller);
- });
- }, (error) {
- setState(() {
- endRe(controller);
- });
- });
- }
- //查询未收订单
- void unreceivedOrder() {
- var conditions = [];
- if (widget.data.ownerUid == MyCookie().getUID()) {
- conditions.add('state == $orderStateUnpaid');
- conditions.add('shop_uid == ${widget.data.shopUid}');
- } else {
- conditions.add('state == $orderStateUnpaid');
- conditions.add('shop_uid == ${widget.data.shopUid}');
- conditions.add('seller_uid == ${MyCookie().getUID()}');
- }
- MyDio().query({
- "key": "order",
- "filters": {"conditions": conditions},
- "dims": orderDims,
- "paging": [page, 20],
- "order_by": ["create_time,DESC"]
- }, (response, hasError) {
- if (!hasError) {
- SmartOrderBeanEntity entity = SmartOrderBeanEntity()
- .fromJson(json.decode(response.data.toString()));
- if (page == 1) {
- orders.clear();
- }
- orders.addAll(entity.data.data);
- setState(() {});
- }
- endRe(controller);
- }, (error) {});
- }
- //查询未付订单
- void unpaidOrder() {
- var conditions = [];
- if (widget.data.ownerUid == MyCookie().getUID()) {
- conditions.add('state == $orderStatePaid');
- conditions.add('shop_uid == ${widget.data.shopUid}');
- } else {
- conditions.add('state == $orderStateUnpaid');
- conditions.add('shop_uid == ${widget.data.shopUid}');
- conditions.add('buyer_name LIKE ${MyCookie().getName()}');
- }
- MyDio().query({
- "key": "order",
- "filters": {"conditions": conditions},
- "dims": orderDims,
- "paging": [page, 20],
- "order_by": ["create_time,DESC"]
- }, (response, hasError) {
- if (!hasError) {
- SmartOrderBeanEntity entity = SmartOrderBeanEntity()
- .fromJson(json.decode(response.data.toString()));
- if (page == 1) {
- orders.clear();
- }
- orders.addAll(entity.data.data);
- setState(() {});
- }
- endRe(controller);
- }, (error) {});
- }
- payTheOrder() {
- SmartOrderBeanDataData data = SmartOrderBeanDataData();
- data.sellerUid = widget.order.sellerUID;
- data.sellerName = widget.order.sellerName;
- data.sellerPic = widget.order.sellerPic;
- data.buyerUid = 0;
- data.buyerName = widget.order.buyerName;
- data.buyerPic = '';
- data.amount = widget.order.amount;
- data.uid = widget.order.uID;
- showPayDialog(data, context, () {
- Navigator.pop(context);
- getUserWalletBalance((re, hE) {
- if (!hE) {
- UserBalanceEntity balance =
- UserBalanceEntity().fromJson(json.decode(re.data.toString()));
- if (balance.data >= widget.order.amount) {
- payOrder(payWayWallet, widget.order.uID, (re, hE) {
- if (!hE) {
- showToast('支付成功');
- EventBus().emit('payAnOrder');
- }
- }, (e) {}, context);
- } else {
- payOrder(payWayAliPay, widget.order.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
- ..loadingStyle = EasyLoadingStyle.light
- ..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(widget.order.uID);
- }
- } catch (e) {
- EasyLoading.dismiss();
- }
- });
- // EventBus().emit('payAnOrder');
- }
- }, (e) {}, context);
- // showToast('积分余额不足');
- }
- }
- }, (e) {}, context);
- });
- // showDialog(
- // context: context,
- // 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(
- // '确认支付订单(${widget.order.uID})',
- // style: TextStyle(
- // color: MyColors.c333333,
- // fontSize: 16,
- // fontWeight: FontWeight.normal,
- // decoration: TextDecoration.none),
- // ),
- // Text(
- // '付款人:${widget.order.buyerName}',
- // style: TextStyle(
- // color: MyColors.c333333,
- // fontSize: 16,
- // fontWeight: FontWeight.normal,
- // decoration: TextDecoration.none),
- // ),
- // Text(
- // '收款人:${widget.order.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);
- // getUserWalletBalance((re, hE) {
- // if (!hE) {
- // UserBalanceEntity balance = UserBalanceEntity()
- // .fromJson(json.decode(re.data.toString()));
- // if (balance.data >= widget.order.amount) {
- // payOrder(payWayWallet, widget.order.uID,
- // (re, hE) {
- // if (!hE) {
- // showToast('支付成功');
- // EventBus().emit('payAnOrder');
- // }
- // }, (e) {}, context);
- // } else {
- // payOrder(payWayAliPay, widget.order.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(widget.order.uID);
- // }
- // } catch (e) {
- // EasyLoading.dismiss();
- // }
- // });
- // // EventBus().emit('payAnOrder');
- // }
- // }, (e) {}, context);
- // // showToast('积分余额不足');
- // }
- // }
- // }, (e) {}, 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),
- // ),
- // );
- // },
- // );
- }
- List<MyShopBeanDataData> member = [];
- List<MyShopBeanDataData> helper = [];
- queryShopMembers() {
- MyDio().query({
- "key": "shop_user",
- "filters": {
- "conditions": ["shop_uid==${widget.data.shopUid}", "review_state==1"]
- },
- "dims": shopUserDims,
- "paging": [1, 2000]
- }, (response, hasError) {
- if (!hasError) {
- MyShopBeanEntity entity =
- MyShopBeanEntity().fromJson(json.decode(response.data.toString()));
- member = entity.data.data;
- helper.clear();
- member.forEach((element) {
- if (element.role == shopUserStaff) {
- helper.add(element);
- }
- });
- MyShopBeanDataData chatWith;
- if (helper.length == 0) {
- chatWith = member[
- member.indexWhere((element) => element.role == shopUserOwner)];
- } else {
- chatWith = helper[Random().nextInt(helper.length)];
- }
- MyTools().toPage(context, ChatPage(chatWith, null), (then) {});
- }
- }, (error) {});
- }
- void deleteOrder(SmartOrderBeanDataData order) {
- MyDio().del({
- 'key': 'order',
- 'ids': [order.id]
- }, (response, hasError) {
- if (!hasError) {
- orders.remove(order);
- setState(() {});
- }
- }, (error) {});
- }
- StoreBeanDataData store;
- queryStoreInformation() {
- MyDio().query({
- "key": "shop",
- "filters": {
- "conditions": ["uid == ${widget.data.shopUid}"]
- },
- "dims": shopDims,
- "paging": [1, 5]
- }, (response, hasError) {
- if (!hasError) {
- StoreBeanEntity entity =
- StoreBeanEntity().fromJson(json.decode(response.data.toString()));
- store = entity.data.data[0];
- setState(() {});
- }
- endRe(controller);
- }, (error) {});
- }
- }
|