diff --git a/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java b/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java index 6f2cd4f..c2adee2 100644 --- a/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java +++ b/example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java @@ -161,6 +161,14 @@ public class MainActivity extends FlutterActivity implements ZhiyingFlutterCommN map.put("domain", "http://inapi.izhyin.cn/");//"http://120.76.175.204:8989");http://47.114.51.254:80 http://inapi.izhyin.cn/ map.put("master_id", "123456"); map.put("secret_key", "123456"); +// map.put("domain", "http://inapi.izhyin.cn/");//"http://120.76.175.204:8989");http://47.114.51.254:80 http://inapi.izhyin.cn/ +// map.put("master_id", "22255132"); +// map.put("secret_key", "123456"); + + ///正式 +// map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn84198689 +// map.put("master_id", "99813608"); +// map.put("secret_key", "123456"); ///正式 // map.put("domain", "http://api.zhios.cn/");//45678910,api.zhios.cn84198689 diff --git a/lib/pages/order_found_page/order_found_result/order_found_result_bloc.dart b/lib/pages/order_found_page/order_found_result/order_found_result_bloc.dart new file mode 100644 index 0000000..db622c8 --- /dev/null +++ b/lib/pages/order_found_page/order_found_result/order_found_result_bloc.dart @@ -0,0 +1,31 @@ +import 'dart:async'; + +import 'package:zhiying_comm/util/base_bloc.dart'; + +import 'order_found_result_model.dart'; + +class OrderFoundResultBloc + extends BlocBase +{ + StreamController streamController = StreamController(); + + OrderFoundResultModel orderFoundResultModel; + + Stream get outData { + return streamController.stream; + } + + //获取页面数据 + getData() { + // NetUtil.request("", method: NetMethod.POST, onSuccess: (data) { + // }); + orderFoundResultModel = OrderFoundResultModel(); + streamController.add(orderFoundResultModel); + } + + @override + void dispose() { + streamController.close(); + // TODO: implement dispose + } +} diff --git a/lib/pages/order_found_page/order_found_result/order_found_result_model.dart b/lib/pages/order_found_page/order_found_result/order_found_result_model.dart new file mode 100644 index 0000000..cdc1f1b --- /dev/null +++ b/lib/pages/order_found_page/order_found_result/order_found_result_model.dart @@ -0,0 +1,104 @@ +class OrderFoundResultModel { + int uid; + String nickname; + bool hidOrder; + String ordId; + String providerOid; + String itemId; + int itemNum; + String itemTitle; + String itemPrice; + String provider; + String paidPrice; + int orderType; + int priceType; + String priceName; + String userCommission; + String userCommissionRate; + String reason; + int state; + String createAt; + String updateAt; + String confirmAt; + String settleAt; + String thumbnail; + + OrderFoundResultModel( + {this.uid, + this.nickname, + this.hidOrder, + this.ordId, + this.providerOid, + this.itemId, + this.itemNum, + this.itemTitle, + this.itemPrice, + this.provider, + this.paidPrice, + this.orderType, + this.priceType, + this.priceName, + this.userCommission, + this.userCommissionRate, + this.reason, + this.state, + this.createAt, + this.updateAt, + this.confirmAt, + this.settleAt, + this.thumbnail}); + + OrderFoundResultModel.fromJson(Map json) { + uid = json['uid']; + nickname = json['nickname']; + hidOrder = json['hid_order']; + ordId = json['ord_id']; + providerOid = json['provider_oid']; + itemId = json['item_id']; + itemNum = json['item_num']; + itemTitle = json['item_title']; + itemPrice = json['item_price']; + provider = json['provider']; + paidPrice = json['paid_price']; + orderType = json['order_type']; + priceType = json['price_type']; + priceName = json['price_name']; + userCommission = json['user_commission']; + userCommissionRate = json['user_commission_rate']; + reason = json['reason']; + state = json['state']; + createAt = json['create_at']; + updateAt = json['update_at']; + confirmAt = json['confirm_at']; + settleAt = json['settle_at']; + thumbnail = json['thumbnail']; + } + + Map toJson() { + final Map data = new Map(); + data['uid'] = this.uid; + data['nickname'] = this.nickname; + data['hid_order'] = this.hidOrder; + data['ord_id'] = this.ordId; + data['provider_oid'] = this.providerOid; + data['item_id'] = this.itemId; + data['item_num'] = this.itemNum; + data['item_title'] = this.itemTitle; + data['item_price'] = this.itemPrice; + data['provider'] = this.provider; + data['paid_price'] = this.paidPrice; + data['order_type'] = this.orderType; + data['price_type'] = this.priceType; + data['price_name'] = this.priceName; + data['user_commission'] = this.userCommission; + data['user_commission_rate'] = this.userCommissionRate; + data['reason'] = this.reason; + data['state'] = this.state; + data['create_at'] = this.createAt; + data['update_at'] = this.updateAt; + data['confirm_at'] = this.confirmAt; + data['settle_at'] = this.settleAt; + data['thumbnail'] = this.thumbnail; + return data; + } +} \ No newline at end of file diff --git a/lib/pages/order_found_page/order_found_result/order_found_result_page.dart b/lib/pages/order_found_page/order_found_result/order_found_result_page.dart new file mode 100644 index 0000000..bb40e22 --- /dev/null +++ b/lib/pages/order_found_page/order_found_result/order_found_result_page.dart @@ -0,0 +1,454 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/gestures.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:zhiying_base_widget/pages/order_found_page/order_found_result/order_found_result_bloc.dart'; +import 'package:zhiying_base_widget/pages/order_found_page/order_found_result/order_found_result_model.dart'; + +import 'package:zhiying_comm/zhiying_comm.dart'; + +class OrderFoundResultPage extends StatefulWidget { + //有数据的model + final OrderFoundResultModel orderFoundResultModel; + + //没有订单数据的空页面的title + final String emptyOrderTitle; + + //没有订单数据的空页面的内容 + final String emptyOrderContent; + + //没有订单数据的空页面的图片 + final String emptyOrderPic; + + const OrderFoundResultPage( + {Key key, + this.orderFoundResultModel, + this.emptyOrderTitle, + this.emptyOrderContent, + this.emptyOrderPic}) + : super(key: key); + + @override + _OrderFoundResultPageState createState() => _OrderFoundResultPageState(); +} + +class _OrderFoundResultPageState extends State { + // OrderFoundResultBloc _bloc; + bool hasData = true; + + OrderFoundResultModel model; + + String emptyOrderTitle; + String emptyOrderContent; + String emptyOrderPic; + + @override + void initState() { + // TODO: implement initState + super.initState(); + model = widget.orderFoundResultModel; + if (!EmptyUtil.isEmpty(model)) { + hasData = true; + } else { + hasData = false; + } + emptyOrderTitle = widget.emptyOrderTitle; + emptyOrderContent = widget.emptyOrderContent; + emptyOrderPic = widget.emptyOrderPic; + // _bloc = OrderFoundResultBloc(); + // _bloc.getData(); + } + + retrieveOrderClick() { + print("是我的,找回该订单点击"); + Map params = {}; + params['oid'] = model?.ordId; + NetUtil.request('/api/v1/order/find', + method: NetMethod.POST, params: params, onSuccess: (data) {}); + } + + continueToQuery() { + print("继续查询点击"); + Navigator.pop(context); + } + + //复制订单号 + copyOrderCode() { + ClipboardData data = new ClipboardData(text: model?.ordId); + Clipboard.setData(data); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 0, + brightness: Brightness.light, + backgroundColor: Colors.white, + title: Text( + "订单查询", + style: TextStyle( + fontSize: 16, + color: HexColor.fromHex("#FF333333"), + fontWeight: FontWeight.w600), + ), + centerTitle: true, + leading: Navigator.canPop(context) + ? IconButton( + icon: Icon( + Icons.arrow_back_ios, + size: 18, + color: HexColor.fromHex("#FF444444"), + ), + onPressed: () { + Navigator.pop(context); + }) + : Container(), + ), + body: Container( + child: hasData ? hasOrderView() : emptyView(), + ), + ); + } + + //有订单数据的页面 + hasOrderView() { + return Column( + children: [ + Expanded( + child: Column( + children: [ + orderTip(), //提示文字 + orderMsg(), //订单数据 + ], + )), + //继续查询按钮 + GestureDetector( + onTap: () { + continueToQuery(); + }, + behavior: HitTestBehavior.opaque, + child: Container( + padding: EdgeInsets.all(12), + child: Text( + "不是我的,继续查询", + style: TextStyle(fontSize: 14, color: HexColor.fromHex("#FF999999")), + ), + ), + ), + //找回订单按钮 + GestureDetector( + onTap: () { + retrieveOrderClick(); + }, + behavior: HitTestBehavior.opaque, + child: Container( + height: 50, + width: double.infinity, + margin: EdgeInsets.only(left: 24, right: 24, bottom: 24), + decoration: + BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.red), + alignment: Alignment.center, + child: Text( + "是我的,找回该订单", + style: TextStyle(fontSize: 14, color: Colors.white), + ), + ), + ), + ], + ); + } + + //提示文字 + orderTip() { + return Container( + margin: EdgeInsets.only(top: 15, left: 12), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + width: 4, + height: 15, + decoration: + BoxDecoration(borderRadius: BorderRadius.circular(2), color: Colors.red), + ), + Text( + "是否为这笔订单?", + style: TextStyle( + fontSize: 15, + color: HexColor.fromHex("#FF333333"), + fontWeight: FontWeight.bold), + ) + ], + ), + ); + } + + //订单数据 + orderMsg() { + return Container( + height: 150, + margin: EdgeInsets.only(top: 10, left: 12, right: 12), + padding: EdgeInsets.only(top: 10, left: 10, right: 10), + decoration: + BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Column( + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "自购订单", + style: TextStyle( + fontSize: 12, + color: HexColor.fromHex("#FF333333"), + fontWeight: FontWeight.w600), + ), + ], + ), + Container( + child: Row( + children: [ + Container( + margin: EdgeInsets.only(top: 10, bottom: 10), + width: 97, + height: 97, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(7.5), + image: DecorationImage( + image: NetworkImage(model?.thumbnail ?? ""), fit: BoxFit.fill)), + ), + Expanded( + child: Container( + margin: EdgeInsets.only(left: 10), + height: 100, + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Container( + margin: EdgeInsets.only(right: 4), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2.5), + color: Colors.red), + padding: EdgeInsets.only(left: 10, right: 10), + child: Text( + model?.provider, + style: TextStyle(fontSize: 10, color: Colors.white), + ), + ), + Expanded( + child: Text( + model?.itemTitle, + style: TextStyle( + fontSize: 13, + color: HexColor.fromHex("#FF333333"), + ), + maxLines: 1, + overflow: TextOverflow.ellipsis, + ), + ) + ], + ), + Row( + children: [ + Text( + "订单编号:${model?.ordId}", + style: TextStyle( + fontSize: 10, + color: HexColor.fromHex("#FF999999"), + ), + ), + GestureDetector( + onTap: () { + copyOrderCode(); + }, + behavior: HitTestBehavior.opaque, + child: Container( + width: 40, + margin: EdgeInsets.only(left: 4), + decoration: BoxDecoration( + border: new Border.all( + color: HexColor.fromHex("#FFD6D6D6"), width: 0.5), + borderRadius: BorderRadius.circular(2.5), + color: HexColor.fromHex("#FFF5F5F5")), + alignment: Alignment.center, + child: Text( + "复制", + style: TextStyle( + fontSize: 9, color: HexColor.fromHex("#FF999999")), + ), + ), + ) + ], + ), + Text( + "下单时间:${model?.createAt}", + style: TextStyle( + fontSize: 10, + color: HexColor.fromHex("#FF999999"), + ), + ), + Text( + "完成时间:${model?.updateAt}", + style: TextStyle( + fontSize: 10, + color: HexColor.fromHex("#FF999999"), + ), + ), + Row( + children: [ + Expanded( + child: Text( + "订单金额:¥ ${model?.paidPrice}", + style: TextStyle( + fontSize: 10, + color: HexColor.fromHex("#FF333333"), + ), + ), + ), + // RichText( + // text: TextSpan(children: [ + // TextSpan( + // text: "收益:¥ ", + // style: TextStyle( + // fontSize: 11, + // color: Colors.red, + // fontWeight: FontWeight.w600)), + // TextSpan( + // text: "10.19", + // style: TextStyle( + // fontSize: 18, + // color: Colors.red, + // fontWeight: FontWeight.w600)) + // ]), + // ) + ], + ), + ], + ), + ), + ), + ], + ), + ), + // Container( + // padding: EdgeInsets.only(left: 6), + // height: 25, + // alignment: Alignment.centerLeft, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.circular(2.5), + // color: HexColor.fromHex("#FFF9F9F9")), + // child: RichText( + // text: TextSpan(children: [ + // TextSpan( + // text: "补贴于", + // style: TextStyle( + // fontSize: 10, color: HexColor.fromHex("#FF666666"))), + // TextSpan( + // text: "2020年07月23日", + // style: TextStyle( + // fontSize: 10, color: HexColor.fromHex("#FFFF4242"))), + // TextSpan( + // text: "到账,注意查收", + // style: TextStyle( + // fontSize: 10, color: HexColor.fromHex("#FF666666"))) + // ]), + // ), + // ) + ], + ), + ); + } + + //没有订单数据的空页面 + emptyView() { + return Column( + children: [ + Expanded( + child: Column( + children: [ + Container( + width: double.infinity, + margin: EdgeInsets.only(top: 8, left: 12, right: 12), + padding: EdgeInsets.only(bottom: 16, left: 12, right: 12, top: 28), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), color: Colors.white), + child: Column( + children: [ + CachedNetworkImage( + imageUrl: emptyOrderPic ?? "", + width: 152, + fit: BoxFit.fitWidth, + ), + Container( + margin: EdgeInsets.only(top: 16), + child: Text( + "未查询到该订单", + style: + TextStyle(fontSize: 15, color: HexColor.fromHex("#FF999999")), + ), + ), + Container( + margin: EdgeInsets.only(top: 24), + color: HexColor.fromHex("#FFF9F9F9"), + ), + Container( + margin: EdgeInsets.only(top: 16), + child: Row( + children: [ + Container( + margin: EdgeInsets.only(right: 5), + width: 4, + height: 15, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), color: Colors.red), + ), + Text( + emptyOrderTitle ?? "", + style: TextStyle( + fontSize: 15, + color: HexColor.fromHex("#FF333333"), + fontWeight: FontWeight.bold), + ) + ], + ), + ), + Container( + alignment: Alignment.topLeft, + margin: EdgeInsets.only(top: 8), + child: Text( + emptyOrderContent ?? "", + style: + TextStyle(fontSize: 12, color: HexColor.fromHex("#FF999999")), + ), + ) + ], + ), + ), + ], + )), + GestureDetector( + onTap: () { + continueToQuery(); + }, + behavior: HitTestBehavior.opaque, + child: Container( + height: 50, + width: double.infinity, + margin: EdgeInsets.only(left: 24, right: 24, bottom: 24), + decoration: + BoxDecoration(borderRadius: BorderRadius.circular(12), color: Colors.red), + alignment: Alignment.center, + child: Text( + "重新查询", + style: TextStyle(fontSize: 14, color: Colors.white), + ), + ), + ), + ], + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 8ff9ac7..f465504 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -39,8 +39,8 @@ dependencies: # image_gallery_saver: ^1.6.0 permission_handler: git: - ref: 0.0.2 url: http://192.168.0.138:3000/FnuoOS_Flutter_Components/permission_handler.git + ref: 0.0.2 more_picture_share: git: @@ -63,8 +63,8 @@ dependencies: zhiying_flutter_webview: git: - ref: 0.0.4 url: http://192.168.0.138:3000/FnuoOS_ZhiYing/zhiying_flutter_webview.git + ref: 0.0.4 # 特效底部 # convex_bottom_bar: ^2.7.1+2