“yanghuaxuan” преди 3 години
родител
ревизия
5e1bb71a91
променени са 5 файла, в които са добавени 599 реда и са изтрити 2 реда
  1. +8
    -0
      example/android/app/src/main/java/cn/zhios/zhiying_base_widget_example/MainActivity.java
  2. +31
    -0
      lib/pages/order_found_page/order_found_result/order_found_result_bloc.dart
  3. +104
    -0
      lib/pages/order_found_page/order_found_result/order_found_result_model.dart
  4. +454
    -0
      lib/pages/order_found_page/order_found_result/order_found_result_page.dart
  5. +2
    -2
      pubspec.yaml

+ 8
- 0
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


+ 31
- 0
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<OrderFoundResultModel> 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
}
}

+ 104
- 0
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<String, dynamic> 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<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
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;
}
}

+ 454
- 0
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<OrderFoundResultPage> {
// 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<String, dynamic> 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),
),
),
),
],
);
}
}

+ 2
- 2
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


Зареждане…
Отказ
Запис