| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074 |
- 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
- ..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) {});
- }
- }
|