Quellcode durchsuchen

0514 订单搜索结果页面部分上传

tags/0.0.17
23028876916@qq.com vor 3 Jahren
Ursprung
Commit
462fd61c2a
3 geänderte Dateien mit 565 neuen und 0 gelöschten Zeilen
  1. +31
    -0
      lib/pages/order_found_page/order_found_result/order_found_result_bloc.dart
  2. +104
    -0
      lib/pages/order_found_page/order_found_result/order_found_result_model.dart
  3. +430
    -0
      lib/pages/order_found_page/order_found_result/order_found_result_page.dart

+ 31
- 0
lib/pages/order_found_page/order_found_result/order_found_result_bloc.dart Datei anzeigen

@@ -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 Datei anzeigen

@@ -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;
}
}

+ 430
- 0
lib/pages/order_found_page/order_found_result/order_found_result_page.dart Datei anzeigen

@@ -0,0 +1,430 @@
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_comm/zhiying_comm.dart';

class OrderFoundResultPage extends StatefulWidget {
@override
_OrderFoundResultPageState createState() => _OrderFoundResultPageState();
}

class _OrderFoundResultPageState extends State<OrderFoundResultPage> {
OrderFoundResultBloc _bloc;
bool hasData = true;

@override
void initState() {
// TODO: implement initState
super.initState();
_bloc = OrderFoundResultBloc();
_bloc.getData();
}

retrieveOrderClick() {
print("是我的,找回该订单点击");
Map<String, dynamic> params = {};
params['oid'] = "";
NetUtil.request('/api/v1/order/find',
method: NetMethod.POST, params: params, onSuccess: (data) {});
}

continueToQuery() {
print("继续查询点击");
Navigator.pop(context);
}

//复制订单号
copyOrderCode() {
ClipboardData data = new ClipboardData(text: "复制的内容");
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),
),
Text(
"已结算",
style: TextStyle(
fontSize: 12,
color: HexColor.fromHex("#FF999999"),
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(
"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fg.search.alicdn.com%2Fimg%2Fbao%2Fuploaded%2Fi4%2Fi2%2F2012325070%2FO1CN01LQlnX41nK6dBt4ILq_%21%212012325070.jpg&refer=http%3A%2F%2Fg.search.alicdn.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=jpeg?sec=1623381327&t=ee9bbd715990660f92747f181a0c3858"),
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(
"京东",
style: TextStyle(fontSize: 10, color: Colors.white),
),
),
Expanded(
child: Text(
"桶装水抽水器饮水机泵器动桶装水抽水器饮水机泵器动",
style: TextStyle(
fontSize: 13,
color: HexColor.fromHex("#FF333333"),
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
)
],
),
Row(
children: [
Text(
"订单编号:15487945211587",
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(
"下单时间:2020-06-18 17:11:15",
style: TextStyle(
fontSize: 10,
color: HexColor.fromHex("#FF999999"),
),
),
Text(
"完成时间:2020-06-18 17:11:15",
style: TextStyle(
fontSize: 10,
color: HexColor.fromHex("#FF999999"),
),
),
Row(
children: [
Expanded(
child: Text(
"订单金额:¥ 199",
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: [
Image.network(
"https://alipic.lanhuapp.com/SketchPng9ae52da74764fe05917a1d5a4a8d5eb94a9013106c4412056afa00340164bde5",
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(
"未查询到该订单可能原因",
style: TextStyle(
fontSize: 15,
color: HexColor.fromHex("#FF333333"),
fontWeight: FontWeight.bold),
)
],
),
),
Container(
alignment: Alignment.topLeft,
margin: EdgeInsets.only(top: 8),
child: Text(
"1.订单有延迟,建议下单后15分钟再查询\n"
"2.非您购买或推广的订单"
"
3.不是通过本APP下的订单
"
"4.创建订单超过40分钟付款,次日才能同步",
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),
),
),
),
],
);
}
}

Laden…
Abbrechen
Speichern