| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100 |
- import 'dart:convert';
- import 'dart:math';
- 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/smart_order_bean_entity.dart';
- import 'package:bbyyy/beans/store_bean_entity.dart';
- import 'package:bbyyy/https/MyDio.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/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/paegs/pay_page/pay_page.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: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(),
- Container(
- color: Colors.white,
- child: 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
- ? SingleChildScrollView(child: 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
- ? SingleChildScrollView(child: 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
- ? SingleChildScrollView(child: 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 SingleChildScrollView(child: 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);
- MyTools().toPage(context,
- PayPage(widget.order.uID, false, widget.order.amount), (then) {});
- // 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) {});
- }
- }
|