@@ -620,7 +620,7 @@ | |||||
"languageVersion": "2.8" | "languageVersion": "2.8" | ||||
} | } | ||||
], | ], | ||||
"generated": "2020-10-22T02:18:13.447793Z", | |||||
"generated": "2020-10-23T06:24:35.938865Z", | |||||
"generator": "pub", | "generator": "pub", | ||||
"generatorVersion": "2.8.2" | "generatorVersion": "2.8.2" | ||||
} | } |
@@ -19,9 +19,10 @@ class OrderContentBloc extends BlocBase { | |||||
_ordersController = null; | _ordersController = null; | ||||
} | } | ||||
void loadData(OrderFilterModel filter) { | |||||
void loadData(String state, OrderFilterModel filter) { | |||||
Map<String, dynamic> params = filter.toJson(); | Map<String, dynamic> params = filter.toJson(); | ||||
params.removeWhere((key, value) => value == null || value == ''); | params.removeWhere((key, value) => value == null || value == ''); | ||||
params['state'] = state; | |||||
NetUtil.request('/api/v1/order', method: NetMethod.POST, params: params, | NetUtil.request('/api/v1/order', method: NetMethod.POST, params: params, | ||||
onCache: (data) { | onCache: (data) { | ||||
_loadData(data); | _loadData(data); | ||||
@@ -33,15 +34,15 @@ class OrderContentBloc extends BlocBase { | |||||
void _loadData(dynamic data) { | void _loadData(dynamic data) { | ||||
List list = data ?? []; | List list = data ?? []; | ||||
OrderModel model = OrderModel(); | |||||
model.itemId = '6918577752399759376'; | |||||
model.imgUrl = | |||||
'https://t7.baidu.com/it/u=3616242789,1098670747&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg?sec=1603444938&t=04aeb23595ac79d419be19ab92bea668'; | |||||
model.title = '乐町百褶半身裙秋冬女2019新款复古麻花半身裙甜美百褶半身裙'; | |||||
model.price = '108'; | |||||
model.commission = '0'; | |||||
model.commissionRate = '9.2'; | |||||
_orders.add(model); | |||||
// OrderModel model = OrderModel(); | |||||
// model.itemId = '6918577752399759376'; | |||||
// model.imgUrl = | |||||
// 'https://t7.baidu.com/it/u=3616242789,1098670747&fm=79&app=86&size=h300&n=0&g=4n&f=jpeg?sec=1603444938&t=04aeb23595ac79d419be19ab92bea668'; | |||||
// model.title = '乐町百褶半身裙秋冬女2019新款复古麻花半身裙甜美百褶半身裙'; | |||||
// model.price = '108'; | |||||
// model.commission = '0'; | |||||
// model.commissionRate = '9.2'; | |||||
// _orders.add(model); | |||||
_orders.addAll(list.map((item) { | _orders.addAll(list.map((item) { | ||||
return OrderModel.fromJson(Map<String, dynamic>.from(item)); | return OrderModel.fromJson(Map<String, dynamic>.from(item)); | ||||
@@ -0,0 +1,50 @@ | |||||
import 'dart:async'; | |||||
import 'dart:convert' as convert; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_style_model.dart'; | |||||
import 'package:zhiying_comm/util/base_bloc.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
class OrderPageBloc extends BlocBase { | |||||
OrderPageStyleModel _style; | |||||
StreamController<OrderPageStyleModel> _styleController = | |||||
StreamController<OrderPageStyleModel>(); | |||||
Stream<OrderPageStyleModel> get outData => _styleController.stream; | |||||
@override | |||||
void dispose() { | |||||
_styleController.close(); | |||||
_styleController = null; | |||||
} | |||||
void loadData(String skipIdentifier) async { | |||||
NetUtil.request('/api/v1/mod/${skipIdentifier.toString()}', | |||||
method: NetMethod.GET, onCache: (data) { | |||||
_loadData(data); | |||||
}, onSuccess: (data) { | |||||
_loadData(data); | |||||
}); | |||||
} | |||||
void _loadData(dynamic data) { | |||||
try { | |||||
Map<String, dynamic> json = Map<String, dynamic>.from(data); | |||||
if (json == null || json.length == 0) { | |||||
return; | |||||
} | |||||
List mods = json['mod_list']; | |||||
if (mods.first != null) { | |||||
json = Map<String, dynamic>.from(mods.first); | |||||
String d = json['data']; | |||||
Map<String, dynamic> da = | |||||
Map<String, dynamic>.from(convert.jsonDecode(d)); | |||||
_style = OrderPageStyleModel.fromJson(da); | |||||
_styleController.add(_style); | |||||
} | |||||
} catch (err) { | |||||
Logger.error(err); | |||||
} | |||||
} | |||||
} |
@@ -1,6 +1,5 @@ | |||||
// 订单筛选条件 | // 订单筛选条件 | ||||
class OrderFilterModel { | class OrderFilterModel { | ||||
String state; | |||||
String keyword; | String keyword; | ||||
String startTime; | String startTime; | ||||
String endTime; | String endTime; | ||||
@@ -10,8 +9,7 @@ class OrderFilterModel { | |||||
String pageSize; | String pageSize; | ||||
OrderFilterModel( | OrderFilterModel( | ||||
{this.state, | |||||
this.keyword, | |||||
{this.keyword, | |||||
this.startTime, | this.startTime, | ||||
this.endTime, | this.endTime, | ||||
this.type, | this.type, | ||||
@@ -20,7 +18,6 @@ class OrderFilterModel { | |||||
this.pageSize}); | this.pageSize}); | ||||
OrderFilterModel.fromJson(Map<String, dynamic> json) { | OrderFilterModel.fromJson(Map<String, dynamic> json) { | ||||
state = json['state']; | |||||
keyword = json['keyword']; | keyword = json['keyword']; | ||||
startTime = json['start_time']; | startTime = json['start_time']; | ||||
endTime = json['end_time']; | endTime = json['end_time']; | ||||
@@ -32,7 +29,6 @@ class OrderFilterModel { | |||||
Map<String, dynamic> toJson() { | Map<String, dynamic> toJson() { | ||||
final Map<String, dynamic> data = new Map<String, dynamic>(); | final Map<String, dynamic> data = new Map<String, dynamic>(); | ||||
data['state'] = this.state; | |||||
data['keyword'] = this.keyword; | data['keyword'] = this.keyword; | ||||
data['start_time'] = this.startTime; | data['start_time'] = this.startTime; | ||||
data['end_time'] = this.endTime; | data['end_time'] = this.endTime; | ||||
@@ -1,36 +1,100 @@ | |||||
class OrderModel { | class OrderModel { | ||||
int uid; | |||||
String nickname; | |||||
bool hidOrder; | |||||
String ordId; | |||||
String providerOid; | |||||
String itemId; | String itemId; | ||||
String title; | |||||
String price; | |||||
String commission; | |||||
String commissionRate; | |||||
String imgUrl; | |||||
int itemNum; | |||||
String itemTitle; | |||||
String itemPrice; | |||||
String provider; | |||||
String paidPrice; | |||||
int orderType; | |||||
String userCommission; | |||||
String userCommissionRate; | |||||
String reason; | |||||
int state; | |||||
String createAt; | |||||
String updateAt; | |||||
String confirmAt; | |||||
String settleAt; | |||||
String thumbnail; | |||||
Map<String, dynamic> data; // 保存原始数据 | |||||
OrderModel( | |||||
{this.itemId, | |||||
this.title, | |||||
this.price, | |||||
this.commission, | |||||
this.commissionRate, | |||||
this.imgUrl}); | |||||
OrderModel({ | |||||
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.userCommission, | |||||
this.userCommissionRate, | |||||
this.reason, | |||||
this.state, | |||||
this.createAt, | |||||
this.updateAt, | |||||
this.confirmAt, | |||||
this.settleAt, | |||||
this.thumbnail, | |||||
this.data, | |||||
}); | |||||
OrderModel.fromJson(Map<String, dynamic> json) { | OrderModel.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']; | itemId = json['item_id']; | ||||
title = json['title']; | |||||
price = json['price']; | |||||
commission = json['commission']; | |||||
commissionRate = json['commission_rate']; | |||||
imgUrl = json['img_url']; | |||||
itemNum = json['item_num']; | |||||
itemTitle = json['item_title']; | |||||
itemPrice = json['item_price']; | |||||
provider = json['provider']; | |||||
paidPrice = json['paid_price']; | |||||
orderType = json['order_type']; | |||||
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']; | |||||
data = json; | |||||
} | } | ||||
Map<String, dynamic> toJson() { | Map<String, dynamic> toJson() { | ||||
final Map<String, dynamic> data = new Map<String, dynamic>(); | 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_id'] = this.itemId; | ||||
data['title'] = this.title; | |||||
data['price'] = this.price; | |||||
data['commission'] = this.commission; | |||||
data['commission_rate'] = this.commissionRate; | |||||
data['img_url'] = this.imgUrl; | |||||
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['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; | return data; | ||||
} | } | ||||
} | } |
@@ -0,0 +1,157 @@ | |||||
class OrderPageItemStyleModel { | |||||
String textCopy; | |||||
String textOrderNo; | |||||
String textOrderTime; | |||||
String textFinishTime; | |||||
String colorProviderFont; | |||||
String colorProviderBg; | |||||
String colorOrderTypeFont; | |||||
String colorOrderStateFont; | |||||
String colorTitle; | |||||
String colorFont; | |||||
String colorCopyBg; | |||||
String colorTipsBg; | |||||
String colorAmountFont; | |||||
String colorIncomeFont; | |||||
String skipIdentifier; | |||||
List<OrderStateModel> orderState; | |||||
List<OrderTypeModel> orderType; | |||||
OrderPageItemStyleModel( | |||||
{this.textCopy, | |||||
this.textOrderNo, | |||||
this.textOrderTime, | |||||
this.textFinishTime, | |||||
this.colorProviderFont, | |||||
this.colorProviderBg, | |||||
this.colorOrderTypeFont, | |||||
this.colorOrderStateFont, | |||||
this.colorTitle, | |||||
this.colorFont, | |||||
this.colorCopyBg, | |||||
this.colorTipsBg, | |||||
this.colorAmountFont, | |||||
this.colorIncomeFont, | |||||
this.skipIdentifier, | |||||
this.orderState, | |||||
this.orderType}); | |||||
OrderPageItemStyleModel.fromJson(Map<String, dynamic> json) { | |||||
textCopy = json['text_copy']; | |||||
textOrderNo = json['text_order_no']; | |||||
textOrderTime = json['text_order_time']; | |||||
textFinishTime = json['text_finish_time']; | |||||
colorProviderFont = json['color_provider_font']; | |||||
colorProviderBg = json['color_provider_bg']; | |||||
colorOrderTypeFont = json['color_order_type_font']; | |||||
colorOrderStateFont = json['color_order_state_font']; | |||||
colorTitle = json['color_title']; | |||||
colorFont = json['color_font']; | |||||
colorCopyBg = json['color_copy_bg']; | |||||
colorTipsBg = json['color_tips_bg']; | |||||
colorAmountFont = json['color_amount_font']; | |||||
colorIncomeFont = json['color_income_font']; | |||||
skipIdentifier = json['skip_identifier']; | |||||
if (json['order_state'] != null) { | |||||
orderState = new List<OrderStateModel>(); | |||||
json['order_state'].forEach((v) { | |||||
orderState.add(new OrderStateModel.fromJson(v)); | |||||
}); | |||||
} | |||||
if (json['order_type'] != null) { | |||||
orderType = new List<OrderTypeModel>(); | |||||
json['order_type'].forEach((v) { | |||||
orderType.add(new OrderTypeModel.fromJson(v)); | |||||
}); | |||||
} | |||||
} | |||||
Map<String, dynamic> toJson() { | |||||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||||
data['text_copy'] = this.textCopy; | |||||
data['text_order_no'] = this.textOrderNo; | |||||
data['text_order_time'] = this.textOrderTime; | |||||
data['text_finish_time'] = this.textFinishTime; | |||||
data['color_provider_font'] = this.colorProviderFont; | |||||
data['color_provider_bg'] = this.colorProviderBg; | |||||
data['color_order_type_font'] = this.colorOrderTypeFont; | |||||
data['color_order_state_font'] = this.colorOrderStateFont; | |||||
data['color_title'] = this.colorTitle; | |||||
data['color_font'] = this.colorFont; | |||||
data['color_copy_bg'] = this.colorCopyBg; | |||||
data['color_tips_bg'] = this.colorTipsBg; | |||||
data['color_amount_font'] = this.colorAmountFont; | |||||
data['color_income_font'] = this.colorIncomeFont; | |||||
data['skip_identifier'] = this.skipIdentifier; | |||||
if (this.orderState != null) { | |||||
data['order_state'] = this.orderState.map((v) => v.toJson()).toList(); | |||||
} | |||||
if (this.orderType != null) { | |||||
data['order_type'] = this.orderType.map((v) => v.toJson()).toList(); | |||||
} | |||||
return data; | |||||
} | |||||
} | |||||
class OrderStateModel { | |||||
String name; | |||||
String type; | |||||
String tips; | |||||
String tipsReplaceKey; | |||||
String tipsReplaceColor; | |||||
String amountText; | |||||
String incomeText; | |||||
OrderStateModel( | |||||
{this.name, | |||||
this.type, | |||||
this.tips, | |||||
this.tipsReplaceKey, | |||||
this.tipsReplaceColor, | |||||
this.amountText, | |||||
this.incomeText}); | |||||
OrderStateModel.fromJson(Map<String, dynamic> json) { | |||||
name = json['name']; | |||||
type = json['type']; | |||||
tips = json['tips']; | |||||
tipsReplaceKey = json['tips_replace_key']; | |||||
tipsReplaceColor = json['tips_replace_color']; | |||||
amountText = json['amount_text']; | |||||
incomeText = json['income_text']; | |||||
} | |||||
Map<String, dynamic> toJson() { | |||||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||||
data['name'] = this.name; | |||||
data['type'] = this.type; | |||||
data['tips'] = this.tips; | |||||
data['tips_replace_key'] = this.tipsReplaceKey; | |||||
data['tips_replace_color'] = this.tipsReplaceColor; | |||||
data['amount_text'] = this.amountText; | |||||
data['income_text'] = this.incomeText; | |||||
return data; | |||||
} | |||||
} | |||||
class OrderTypeModel { | |||||
String name; | |||||
String type; | |||||
String replaceKey; | |||||
OrderTypeModel({this.name, this.type, this.replaceKey}); | |||||
OrderTypeModel.fromJson(Map<String, dynamic> json) { | |||||
name = json['name']; | |||||
type = json['type']; | |||||
replaceKey = json['replace_key']; | |||||
} | |||||
Map<String, dynamic> toJson() { | |||||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||||
data['name'] = this.name; | |||||
data['type'] = this.type; | |||||
data['replace_key'] = this.replaceKey; | |||||
return data; | |||||
} | |||||
} |
@@ -0,0 +1,176 @@ | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_item_style_model.dart'; | |||||
class OrderPageStyleModel { | |||||
String appBarName; | |||||
String appBarNameColor; | |||||
String appBarBgImg; | |||||
String appBarBgColor; | |||||
String appBgColor; | |||||
String appActivateColor; | |||||
String searchBarLeftIcon; | |||||
String searchBarRightIcon; | |||||
String searchBarPlaceholder; | |||||
String searchBarHideTextColor; | |||||
String searchBarBgColor; | |||||
String searchBarBtnText; | |||||
String searchBarBtnTextColor; | |||||
String searchBarBtnBgColor; | |||||
String searchBtnReset; | |||||
String searchBtnOk; | |||||
String noticeSecurityIcon; | |||||
String noticeSecurityTitle; | |||||
String noticeSecuritySkipTitle; | |||||
String noticeSecuritySkipColor; | |||||
String noticeSecuritySkipIdentifier; | |||||
OrderPageFilterStyleModel filter; | |||||
OrderPageItemStyleModel list; | |||||
OrderPageStyleModel( | |||||
{this.appBarName, | |||||
this.appBarNameColor, | |||||
this.appBarBgImg, | |||||
this.appBarBgColor, | |||||
this.appBgColor, | |||||
this.appActivateColor, | |||||
this.searchBarLeftIcon, | |||||
this.searchBarRightIcon, | |||||
this.searchBarPlaceholder, | |||||
this.searchBarHideTextColor, | |||||
this.searchBarBgColor, | |||||
this.searchBarBtnText, | |||||
this.searchBarBtnTextColor, | |||||
this.searchBarBtnBgColor, | |||||
this.searchBtnReset, | |||||
this.searchBtnOk, | |||||
this.noticeSecurityIcon, | |||||
this.noticeSecurityTitle, | |||||
this.noticeSecuritySkipTitle, | |||||
this.noticeSecuritySkipColor, | |||||
this.noticeSecuritySkipIdentifier, | |||||
this.filter, | |||||
this.list}); | |||||
OrderPageStyleModel.fromJson(Map<String, dynamic> json) { | |||||
appBarName = json['app_bar_name']; | |||||
appBarNameColor = json['app_bar_name_color']; | |||||
appBarBgImg = json['app_bar_bg_img']; | |||||
appBarBgColor = json['app_bar_bg_color']; | |||||
appBgColor = json['app_bg_color']; | |||||
appActivateColor = json['app_activate_color']; | |||||
searchBarLeftIcon = json['search_bar_left_icon']; | |||||
searchBarRightIcon = json['search_bar_right_icon']; | |||||
searchBarPlaceholder = json['search_bar_placeholder']; | |||||
searchBarHideTextColor = json['search_bar_hide_text_color']; | |||||
searchBarBgColor = json['search_bar_bg_color']; | |||||
searchBarBtnText = json['search_bar_btn_text']; | |||||
searchBarBtnTextColor = json['search_bar_btn_text_color']; | |||||
searchBarBtnBgColor = json['search_bar_btn_bg_color']; | |||||
searchBtnReset = json['search_btn_reset']; | |||||
searchBtnOk = json['search_btn_ok']; | |||||
noticeSecurityIcon = json['notice_security_icon']; | |||||
noticeSecurityTitle = json['notice_security_title']; | |||||
noticeSecuritySkipTitle = json['notice_security_skip_title']; | |||||
noticeSecuritySkipColor = json['notice_security_skip_color']; | |||||
noticeSecuritySkipIdentifier = json['notice_security_skip_identifier']; | |||||
filter = json['filter'] != null | |||||
? new OrderPageFilterStyleModel.fromJson(json['filter']) | |||||
: null; | |||||
list = json['list'] != null | |||||
? OrderPageItemStyleModel.fromJson(json['list']) | |||||
: null; | |||||
} | |||||
Map<String, dynamic> toJson() { | |||||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||||
data['app_bar_name'] = this.appBarName; | |||||
data['app_bar_name_color'] = this.appBarNameColor; | |||||
data['app_bar_bg_img'] = this.appBarBgImg; | |||||
data['app_bar_bg_color'] = this.appBarBgColor; | |||||
data['app_bg_color'] = this.appBgColor; | |||||
data['app_activate_color'] = this.appActivateColor; | |||||
data['search_bar_left_icon'] = this.searchBarLeftIcon; | |||||
data['search_bar_right_icon'] = this.searchBarRightIcon; | |||||
data['search_bar_placeholder'] = this.searchBarPlaceholder; | |||||
data['search_bar_hide_text_color'] = this.searchBarHideTextColor; | |||||
data['search_bar_bg_color'] = this.searchBarBgColor; | |||||
data['search_bar_btn_text'] = this.searchBarBtnText; | |||||
data['search_bar_btn_text_color'] = this.searchBarBtnTextColor; | |||||
data['search_bar_btn_bg_color'] = this.searchBarBtnBgColor; | |||||
data['search_btn_reset'] = this.searchBtnReset; | |||||
data['search_btn_ok'] = this.searchBtnOk; | |||||
data['notice_security_icon'] = this.noticeSecurityIcon; | |||||
data['notice_security_title'] = this.noticeSecurityTitle; | |||||
data['notice_security_skip_title'] = this.noticeSecuritySkipTitle; | |||||
data['notice_security_skip_color'] = this.noticeSecuritySkipColor; | |||||
data['notice_security_skip_identifier'] = this.noticeSecuritySkipIdentifier; | |||||
if (this.filter != null) { | |||||
data['filter'] = this.filter.toJson(); | |||||
} | |||||
if (this.list != null) { | |||||
data['list'] = this.list.toJson(); | |||||
} | |||||
return data; | |||||
} | |||||
} | |||||
class OrderPageFilterStyleModel { | |||||
String icon; | |||||
List<OrderTypeModel> orderState; | |||||
String providerTitle; | |||||
List<OrderTypeModel> providerType; | |||||
String orderTitle; | |||||
List<OrderTypeModel> orderType; | |||||
String orderTimeTitle; | |||||
OrderPageFilterStyleModel( | |||||
{this.icon, | |||||
this.orderState, | |||||
this.providerTitle, | |||||
this.providerType, | |||||
this.orderTitle, | |||||
this.orderType, | |||||
this.orderTimeTitle}); | |||||
OrderPageFilterStyleModel.fromJson(Map<String, dynamic> json) { | |||||
icon = json['icon']; | |||||
if (json['order_state'] != null) { | |||||
orderState = new List<OrderTypeModel>(); | |||||
json['order_state'].forEach((v) { | |||||
orderState.add(new OrderTypeModel.fromJson(v)); | |||||
}); | |||||
} | |||||
providerTitle = json['provider_title']; | |||||
if (json['provider_type'] != null) { | |||||
providerType = new List<OrderTypeModel>(); | |||||
json['provider_type'].forEach((v) { | |||||
providerType.add(new OrderTypeModel.fromJson(v)); | |||||
}); | |||||
} | |||||
orderTitle = json['order_title']; | |||||
if (json['order_type'] != null) { | |||||
orderType = new List<OrderTypeModel>(); | |||||
json['order_type'].forEach((v) { | |||||
orderType.add(new OrderTypeModel.fromJson(v)); | |||||
}); | |||||
} | |||||
orderTimeTitle = json['order_time_title']; | |||||
} | |||||
Map<String, dynamic> toJson() { | |||||
final Map<String, dynamic> data = new Map<String, dynamic>(); | |||||
data['icon'] = this.icon; | |||||
if (this.orderState != null) { | |||||
data['order_state'] = this.orderState.map((v) => v.toJson()).toList(); | |||||
} | |||||
data['provider_title'] = this.providerTitle; | |||||
if (this.providerType != null) { | |||||
data['provider_type'] = this.providerType.map((v) => v.toJson()).toList(); | |||||
} | |||||
data['order_title'] = this.orderTitle; | |||||
if (this.orderType != null) { | |||||
data['order_type'] = this.orderType.map((v) => v.toJson()).toList(); | |||||
} | |||||
data['order_time_title'] = this.orderTimeTitle; | |||||
return data; | |||||
} | |||||
} |
@@ -2,14 +2,18 @@ import 'package:flutter/material.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/bloc/order_content_bloc.dart'; | import 'package:zhiying_base_widget/pages/orders_page/bloc/order_content_bloc.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_filter_model.dart'; | import 'package:zhiying_base_widget/pages/orders_page/models/order_filter_model.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_model.dart'; | import 'package:zhiying_base_widget/pages/orders_page/models/order_model.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_style_model.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/views/order_item_widget.dart'; | import 'package:zhiying_base_widget/pages/orders_page/views/order_item_widget.dart'; | ||||
import 'package:zhiying_base_widget/widgets/empty/empty_widget.dart'; | import 'package:zhiying_base_widget/widgets/empty/empty_widget.dart'; | ||||
import 'package:zhiying_comm/util/base_bloc.dart'; | import 'package:zhiying_comm/util/base_bloc.dart'; | ||||
class OrderContentPage extends StatefulWidget { | class OrderContentPage extends StatefulWidget { | ||||
final String state; // 订单状态 | |||||
final OrderPageStyleModel style; | |||||
final OrderFilterModel filter; | final OrderFilterModel filter; | ||||
const OrderContentPage({Key key, this.filter}) : super(key: key); | |||||
const OrderContentPage(this.state, {Key key, this.filter, this.style}) | |||||
: super(key: key); | |||||
@override | @override | ||||
_OrderContentPageState createState() => _OrderContentPageState(); | _OrderContentPageState createState() => _OrderContentPageState(); | ||||
@@ -20,15 +24,18 @@ class _OrderContentPageState extends State<OrderContentPage> { | |||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return BlocProvider<OrderContentBloc>( | return BlocProvider<OrderContentBloc>( | ||||
bloc: OrderContentBloc(), | bloc: OrderContentBloc(), | ||||
child: OrderContentContainer(widget.filter), | |||||
child: OrderContentContainer(widget.state, widget.filter, widget.style), | |||||
); | ); | ||||
} | } | ||||
} | } | ||||
class OrderContentContainer extends StatefulWidget { | class OrderContentContainer extends StatefulWidget { | ||||
final String state; // 订单状态 | |||||
final OrderFilterModel filter; | final OrderFilterModel filter; | ||||
final OrderPageStyleModel style; | |||||
const OrderContentContainer(this.filter, {Key key}) : super(key: key); | |||||
const OrderContentContainer(this.state, this.filter, this.style, {Key key}) | |||||
: super(key: key); | |||||
@override | @override | ||||
_OrderContentContainerState createState() => _OrderContentContainerState(); | _OrderContentContainerState createState() => _OrderContentContainerState(); | ||||
@@ -40,7 +47,7 @@ class _OrderContentContainerState extends State<OrderContentContainer> { | |||||
@override | @override | ||||
void initState() { | void initState() { | ||||
_bloc = BlocProvider.of(context); | _bloc = BlocProvider.of(context); | ||||
_bloc.loadData(widget.filter); | |||||
_bloc.loadData(widget.state, widget.filter); | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
@@ -65,7 +72,10 @@ class _OrderContentContainerState extends State<OrderContentContainer> { | |||||
return ListView.builder( | return ListView.builder( | ||||
itemCount: orders.length, | itemCount: orders.length, | ||||
itemBuilder: (context, index) { | itemBuilder: (context, index) { | ||||
return OrderItemWidget(orders[index]); | |||||
return OrderItemWidget( | |||||
orders[index], | |||||
widget.style, | |||||
); | |||||
}); | }); | ||||
}); | }); | ||||
} | } | ||||
@@ -1,11 +1,15 @@ | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/bloc/order_page_bloc.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_filter_model.dart'; | import 'package:zhiying_base_widget/pages/orders_page/models/order_filter_model.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_item_style_model.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_style_model.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/order_content_page.dart'; | import 'package:zhiying_base_widget/pages/orders_page/order_content_page.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/order_search_page.dart'; | import 'package:zhiying_base_widget/pages/orders_page/order_search_page.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/views/order_filter.dart'; | import 'package:zhiying_base_widget/pages/orders_page/views/order_filter.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/views/order_serch_widget.dart'; | import 'package:zhiying_base_widget/pages/orders_page/views/order_serch_widget.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/views/order_tabbar_widget.dart'; | import 'package:zhiying_base_widget/pages/orders_page/views/order_tabbar_widget.dart'; | ||||
import 'package:zhiying_comm/util/base_bloc.dart'; | |||||
// 订单页面 | // 订单页面 | ||||
class OrdersPage extends StatefulWidget { | class OrdersPage extends StatefulWidget { | ||||
@@ -27,8 +31,10 @@ class _OrdersPageState extends State<OrdersPage> { | |||||
backgroundColor: Color(0xfff9f9f9), | backgroundColor: Color(0xfff9f9f9), | ||||
appBar: _createNav(), | appBar: _createNav(), | ||||
body: SafeArea( | body: SafeArea( | ||||
child: _OrdersContainer(), | |||||
), | |||||
child: BlocProvider<OrderPageBloc>( | |||||
bloc: OrderPageBloc(), | |||||
child: _OrdersContainer(widget.data), | |||||
)), | |||||
); | ); | ||||
} | } | ||||
@@ -70,6 +76,10 @@ class _OrdersPageState extends State<OrdersPage> { | |||||
} | } | ||||
class _OrdersContainer extends StatefulWidget { | class _OrdersContainer extends StatefulWidget { | ||||
final Map<String, dynamic> data; | |||||
const _OrdersContainer(this.data, {Key key}) : super(key: key); | |||||
@override | @override | ||||
_OrdersContainerState createState() => _OrdersContainerState(); | _OrdersContainerState createState() => _OrdersContainerState(); | ||||
} | } | ||||
@@ -78,90 +88,92 @@ class _OrdersContainerState extends State<_OrdersContainer> | |||||
with TickerProviderStateMixin { | with TickerProviderStateMixin { | ||||
TabController _tabController; | TabController _tabController; | ||||
GlobalKey _tabKey = GlobalKey(); | GlobalKey _tabKey = GlobalKey(); | ||||
OrderPageBloc _bloc; | |||||
final OrderFilterModel _filter = OrderFilterModel(); | final OrderFilterModel _filter = OrderFilterModel(); | ||||
bool _isFilterShow = false; | bool _isFilterShow = false; | ||||
List<String> _titles = [ | |||||
'全部', | |||||
'已付款', | |||||
'已结算', | |||||
'已失效', | |||||
'全部', | |||||
'已付款', | |||||
]; | |||||
List<String> _titles = []; | |||||
List<Widget> _contents = []; | List<Widget> _contents = []; | ||||
@override | @override | ||||
void initState() { | void initState() { | ||||
_tabController = TabController(length: 6, vsync: this); | |||||
_contents = [ | |||||
OrderContentPage( | |||||
filter: _filter, | |||||
), | |||||
OrderContentPage( | |||||
filter: _filter, | |||||
), | |||||
OrderContentPage( | |||||
filter: _filter, | |||||
), | |||||
OrderContentPage( | |||||
filter: _filter, | |||||
), | |||||
OrderContentPage( | |||||
filter: _filter, | |||||
), | |||||
OrderContentPage( | |||||
filter: _filter, | |||||
), | |||||
]; | |||||
_bloc = BlocProvider.of<OrderPageBloc>(context); | |||||
if (widget.data.containsKey('skip_identifier')) { | |||||
_bloc.loadData(widget.data['skip_identifier']); | |||||
} | |||||
super.initState(); | super.initState(); | ||||
} | } | ||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return Column( | |||||
children: <Widget>[ | |||||
GestureDetector( | |||||
child: OrderSearchWidget(), | |||||
onTap: () { | |||||
Navigator.of(context) | |||||
.push(CupertinoPageRoute(builder: (BuildContext context) { | |||||
return OrderSearchPage(); | |||||
})); | |||||
}, | |||||
), | |||||
OrderTabbarWidget( | |||||
_tabController, | |||||
_titles, | |||||
key: _tabKey, | |||||
onMoreClick: () { | |||||
setState(() { | |||||
_isFilterShow = !_isFilterShow; | |||||
}); | |||||
}, | |||||
), | |||||
Expanded( | |||||
child: Stack( | |||||
return StreamBuilder<OrderPageStyleModel>( | |||||
stream: _bloc.outData, | |||||
builder: (BuildContext context, AsyncSnapshot snapshot) { | |||||
OrderPageStyleModel model = snapshot.data; | |||||
if (model == null) { | |||||
return Container(); | |||||
} | |||||
List<OrderTypeModel> type = model.filter.orderState; | |||||
_tabController = | |||||
TabController(length: type?.length ?? 0, vsync: this); | |||||
_titles = List.generate(type?.length, (index) => type[index].name); | |||||
_contents = List.generate( | |||||
type?.length ?? 0, | |||||
(index) => OrderContentPage( | |||||
type[index].type, | |||||
style: model, | |||||
filter: _filter, | |||||
), | |||||
); | |||||
return Column( | |||||
children: <Widget>[ | children: <Widget>[ | ||||
TabBarView( | |||||
children: _contents, | |||||
controller: _tabController, | |||||
GestureDetector( | |||||
child: OrderSearchWidget(model), | |||||
onTap: () { | |||||
Navigator.of(context) | |||||
.push(CupertinoPageRoute(builder: (BuildContext context) { | |||||
return OrderSearchPage(); | |||||
})); | |||||
}, | |||||
), | ), | ||||
Visibility( | |||||
visible: _isFilterShow, | |||||
child: OrderFilterWidget( | |||||
onDismiss: () { | |||||
setState(() { | |||||
_isFilterShow = false; | |||||
}); | |||||
}, | |||||
OrderTabbarWidget( | |||||
model, | |||||
_tabController, | |||||
_titles, | |||||
key: _tabKey, | |||||
onMoreClick: () { | |||||
setState(() { | |||||
_isFilterShow = !_isFilterShow; | |||||
}); | |||||
}, | |||||
), | |||||
Expanded( | |||||
child: Stack( | |||||
children: <Widget>[ | |||||
TabBarView( | |||||
children: _contents, | |||||
controller: _tabController, | |||||
), | |||||
Visibility( | |||||
visible: _isFilterShow, | |||||
child: OrderFilterWidget( | |||||
model, | |||||
_filter, | |||||
onDismiss: () { | |||||
setState(() { | |||||
_isFilterShow = false; | |||||
}); | |||||
}, | |||||
), | |||||
) | |||||
], | |||||
), | ), | ||||
) | ) | ||||
], | ], | ||||
), | |||||
) | |||||
], | |||||
); | |||||
); | |||||
}); | |||||
} | } | ||||
} | } |
@@ -1,16 +1,56 @@ | |||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:intl/intl.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_filter_model.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_item_style_model.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_style_model.dart'; | |||||
import 'package:zhiying_base_widget/widgets/others/action_date_alert/action_date_alert.dart'; | import 'package:zhiying_base_widget/widgets/others/action_date_alert/action_date_alert.dart'; | ||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
class OrderFilterWidget extends StatefulWidget { | class OrderFilterWidget extends StatefulWidget { | ||||
final OrderPageStyleModel style; | |||||
final OrderFilterModel filterModel; | |||||
final VoidCallback onDismiss; | final VoidCallback onDismiss; | ||||
const OrderFilterWidget({Key key, this.onDismiss}) : super(key: key); | |||||
const OrderFilterWidget(this.style, this.filterModel, | |||||
{Key key, this.onDismiss}) | |||||
: super(key: key); | |||||
@override | @override | ||||
_OrderFilterWidgetState createState() => _OrderFilterWidgetState(); | _OrderFilterWidgetState createState() => _OrderFilterWidgetState(); | ||||
} | } | ||||
class _OrderFilterWidgetState extends State<OrderFilterWidget> { | class _OrderFilterWidgetState extends State<OrderFilterWidget> { | ||||
int _currentProvider = 0; //订单来源 | |||||
int _currentType = 0; // 订单类型 | |||||
int _startTime = 0; // 起始时间 | |||||
int _endTime = 0; // 结束时间 | |||||
@override | |||||
void initState() { | |||||
if (widget?.filterModel?.provider != null && | |||||
widget.filterModel.provider != '') { | |||||
List<OrderTypeModel> list = widget?.style?.filter?.providerType; | |||||
for (int index = 0; index < list.length; index++) { | |||||
if (list[index].type == widget.filterModel.provider) { | |||||
_currentProvider = index; | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
if (widget?.filterModel?.type != null && widget.filterModel.type != '') { | |||||
List<OrderTypeModel> list = widget?.style?.filter?.orderType; | |||||
for (int index = 0; index < list.length; index++) { | |||||
if (list[index].type == widget.filterModel.type) { | |||||
_currentType = index; | |||||
break; | |||||
} | |||||
} | |||||
} | |||||
super.initState(); | |||||
} | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return GestureDetector( | return GestureDetector( | ||||
@@ -24,11 +64,11 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
child: Column( | child: Column( | ||||
mainAxisAlignment: MainAxisAlignment.start, | mainAxisAlignment: MainAxisAlignment.start, | ||||
children: <Widget>[ | children: <Widget>[ | ||||
_creteTitle('订单来源'), | |||||
_createTags(), | |||||
_creteTitle('订单类型'), | |||||
_createTags(), | |||||
_creteTitle('订单时间'), | |||||
_creteTitle(widget?.style?.filter?.providerTitle ?? ''), | |||||
_createSources(), | |||||
_creteTitle(widget?.style?.filter?.orderTitle ?? ''), | |||||
_createType(), | |||||
_creteTitle(widget?.style?.filter?.orderTimeTitle ?? ''), | |||||
_creteTime(), | _creteTime(), | ||||
Container( | Container( | ||||
width: double.infinity, | width: double.infinity, | ||||
@@ -58,7 +98,7 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
); | ); | ||||
} | } | ||||
Widget _createTags() { | |||||
Widget _createSources() { | |||||
return Container( | return Container( | ||||
width: double.infinity, | width: double.infinity, | ||||
padding: | padding: | ||||
@@ -68,22 +108,65 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
crossAxisAlignment: WrapCrossAlignment.start, | crossAxisAlignment: WrapCrossAlignment.start, | ||||
spacing: 20, | spacing: 20, | ||||
runSpacing: 10, | runSpacing: 10, | ||||
children: List.generate(10, (index) { | |||||
return Container( | |||||
padding: EdgeInsets.only(left: 12, right: 12, top: 6, bottom: 6), | |||||
decoration: BoxDecoration( | |||||
color: Color(0xfff1f1f1), | |||||
borderRadius: BorderRadius.circular(5)), | |||||
child: Text( | |||||
'全部', | |||||
style: TextStyle(fontSize: 12, color: Color(0xff999999)), | |||||
), | |||||
children: List.generate( | |||||
widget?.style?.filter?.providerType?.length ?? 0, (index) { | |||||
return GestureDetector( | |||||
onTap: () { | |||||
setState(() { | |||||
_currentProvider = index; | |||||
}); | |||||
}, | |||||
child: _createTag( | |||||
widget.style.filter.providerType[index].name ?? '', | |||||
index == _currentProvider), | |||||
); | |||||
}).toList(), | |||||
), | |||||
); | |||||
} | |||||
Widget _createType() { | |||||
return Container( | |||||
width: double.infinity, | |||||
padding: | |||||
const EdgeInsets.only(left: 12.5, right: 12.5, bottom: 5, top: 5), | |||||
color: Colors.white, | |||||
child: Wrap( | |||||
crossAxisAlignment: WrapCrossAlignment.start, | |||||
spacing: 20, | |||||
runSpacing: 10, | |||||
children: List.generate(widget?.style?.filter?.orderType?.length ?? 0, | |||||
(index) { | |||||
return GestureDetector( | |||||
onTap: () { | |||||
setState(() { | |||||
_currentType = index; | |||||
}); | |||||
}, | |||||
child: _createTag(widget.style.filter.orderType[index].name ?? '', | |||||
_currentType == index), | |||||
); | ); | ||||
}).toList(), | }).toList(), | ||||
), | ), | ||||
); | ); | ||||
} | } | ||||
Widget _createTag(String title, bool isSelected) { | |||||
return Container( | |||||
padding: EdgeInsets.only(left: 12, right: 12, top: 6, bottom: 6), | |||||
decoration: BoxDecoration( | |||||
color: isSelected | |||||
? HexColor.fromHex(widget?.style?.appActivateColor ?? '#ff4242') | |||||
: Color(0xfff1f1f1), | |||||
borderRadius: BorderRadius.circular(5)), | |||||
child: Text( | |||||
title ?? '', | |||||
style: TextStyle( | |||||
fontSize: 12, color: isSelected ? Colors.white : Color(0xff999999)), | |||||
), | |||||
); | |||||
} | |||||
Widget _createButtons() { | Widget _createButtons() { | ||||
return Container( | return Container( | ||||
height: 54, | height: 54, | ||||
@@ -131,6 +214,18 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
} | } | ||||
Widget _creteTime() { | Widget _creteTime() { | ||||
var formatter = new DateFormat('yyyy-MM-dd'); | |||||
String starTime = | |||||
formatter.format(DateTime.fromMillisecondsSinceEpoch(_startTime)); | |||||
if (_startTime == 0) { | |||||
starTime = '不限'; | |||||
} | |||||
String endTime = formatter.format(DateTime(_endTime)); | |||||
if (_endTime == 0) { | |||||
endTime = '不限'; | |||||
} | |||||
return Container( | return Container( | ||||
color: Colors.white, | color: Colors.white, | ||||
padding: EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 20), | padding: EdgeInsets.only(left: 12, right: 12, top: 4, bottom: 20), | ||||
@@ -146,7 +241,7 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
borderRadius: BorderRadius.circular(5)), | borderRadius: BorderRadius.circular(5)), | ||||
child: Center( | child: Center( | ||||
child: Text( | child: Text( | ||||
'2020-06', | |||||
starTime, | |||||
style: TextStyle( | style: TextStyle( | ||||
fontSize: 12, | fontSize: 12, | ||||
color: Color(0xff999999), | color: Color(0xff999999), | ||||
@@ -155,7 +250,7 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
), | ), | ||||
), | ), | ||||
onTap: () { | onTap: () { | ||||
_selectDate(); | |||||
_selectStartDate(); | |||||
}, | }, | ||||
), | ), | ||||
Text( | Text( | ||||
@@ -175,7 +270,7 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
borderRadius: BorderRadius.circular(5)), | borderRadius: BorderRadius.circular(5)), | ||||
child: Center( | child: Center( | ||||
child: Text( | child: Text( | ||||
'2020-06', | |||||
endTime, | |||||
style: TextStyle( | style: TextStyle( | ||||
fontSize: 12, | fontSize: 12, | ||||
color: Color(0xff999999), | color: Color(0xff999999), | ||||
@@ -184,7 +279,7 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
), | ), | ||||
), | ), | ||||
onTap: () { | onTap: () { | ||||
_selectDate(); | |||||
_selectEndDate(); | |||||
}, | }, | ||||
), | ), | ||||
], | ], | ||||
@@ -192,7 +287,7 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
); | ); | ||||
} | } | ||||
void _selectDate() async { | |||||
void _selectStartDate() async { | |||||
DateTime dateTime = await showModalBottomSheet( | DateTime dateTime = await showModalBottomSheet( | ||||
context: context, | context: context, | ||||
builder: (context) { | builder: (context) { | ||||
@@ -203,8 +298,24 @@ class _OrderFilterWidgetState extends State<OrderFilterWidget> { | |||||
isScrollControlled: false, | isScrollControlled: false, | ||||
backgroundColor: Colors.transparent); | backgroundColor: Colors.transparent); | ||||
if (dateTime != null) { | if (dateTime != null) { | ||||
String timeStamp = | |||||
(dateTime.millisecondsSinceEpoch / 1000).ceil().toString(); | |||||
_startTime = dateTime.millisecondsSinceEpoch; | |||||
} | |||||
setState(() {}); | |||||
} | |||||
void _selectEndDate() async { | |||||
DateTime dateTime = await showModalBottomSheet( | |||||
context: context, | |||||
builder: (context) { | |||||
return ActionDateAlert( | |||||
title: '选择结束日期', | |||||
); | |||||
}, | |||||
isScrollControlled: false, | |||||
backgroundColor: Colors.transparent); | |||||
if (dateTime != null) { | |||||
_endTime = dateTime.millisecondsSinceEpoch; | |||||
} | } | ||||
setState(() {}); | |||||
} | } | ||||
} | } |
@@ -1,11 +1,16 @@ | |||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:flutter/services.dart'; | |||||
import 'package:fluttertoast/fluttertoast.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_model.dart'; | import 'package:zhiying_base_widget/pages/orders_page/models/order_model.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_item_style_model.dart'; | |||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_style_model.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | import 'package:zhiying_comm/zhiying_comm.dart'; | ||||
class OrderItemWidget extends StatelessWidget { | class OrderItemWidget extends StatelessWidget { | ||||
final OrderModel model; | final OrderModel model; | ||||
final OrderPageStyleModel style; | |||||
const OrderItemWidget(this.model, {Key key}) : super(key: key); | |||||
const OrderItemWidget(this.model, this.style, {Key key}) : super(key: key); | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
@@ -19,19 +24,39 @@ class OrderItemWidget extends StatelessWidget { | |||||
children: <Widget>[ | children: <Widget>[ | ||||
_createHeader(), | _createHeader(), | ||||
_createCenter(), | _createCenter(), | ||||
_createTips(), | |||||
], | ], | ||||
), | ), | ||||
); | ); | ||||
} | } | ||||
Widget _createHeader() { | Widget _createHeader() { | ||||
List<OrderTypeModel> types = style.list.orderType; | |||||
OrderTypeModel orderType = types.firstWhere((element) { | |||||
return element.type == model.orderType.toString(); | |||||
}); | |||||
// orderType = types.last; | |||||
String type = ''; | |||||
type = orderType.name ?? ''; | |||||
String replaceKey = orderType.replaceKey ?? ''; | |||||
if (replaceKey.length > 4) { | |||||
String key = replaceKey.substring(2, replaceKey.length - 2); | |||||
Logger.debug(key); | |||||
if (model.data.containsKey(key)) { | |||||
type = orderType.name.replaceAll(replaceKey, model.data[key]); | |||||
} | |||||
} | |||||
List<OrderStateModel> states = style.list.orderState; | |||||
OrderStateModel state = | |||||
states.firstWhere((element) => element.type == model.state.toString()); | |||||
return Padding( | return Padding( | ||||
padding: const EdgeInsets.only(bottom: 8), | padding: const EdgeInsets.only(bottom: 8), | ||||
child: Row( | child: Row( | ||||
children: <Widget>[ | children: <Widget>[ | ||||
Expanded( | Expanded( | ||||
child: Text( | child: Text( | ||||
'粉丝订单:Mickey', | |||||
type ?? '', | |||||
maxLines: 1, | maxLines: 1, | ||||
style: TextStyle( | style: TextStyle( | ||||
fontSize: 12, | fontSize: 12, | ||||
@@ -41,7 +66,7 @@ class OrderItemWidget extends StatelessWidget { | |||||
), | ), | ||||
), | ), | ||||
Text( | Text( | ||||
'待结算', | |||||
state.name ?? '', | |||||
maxLines: 1, | maxLines: 1, | ||||
style: TextStyle( | style: TextStyle( | ||||
fontSize: 12, | fontSize: 12, | ||||
@@ -65,7 +90,7 @@ class OrderItemWidget extends StatelessWidget { | |||||
child: ClipRRect( | child: ClipRRect( | ||||
borderRadius: BorderRadius.circular(8), | borderRadius: BorderRadius.circular(8), | ||||
child: CachedNetworkImage( | child: CachedNetworkImage( | ||||
imageUrl: model.imgUrl ?? '', | |||||
imageUrl: model.thumbnail ?? '', | |||||
fit: BoxFit.cover, | fit: BoxFit.cover, | ||||
), | ), | ||||
), | ), | ||||
@@ -75,9 +100,42 @@ class OrderItemWidget extends StatelessWidget { | |||||
crossAxisAlignment: CrossAxisAlignment.start, | crossAxisAlignment: CrossAxisAlignment.start, | ||||
children: <Widget>[ | children: <Widget>[ | ||||
_createTitle(), | _createTitle(), | ||||
_creteText('订单编号:15487945211587'), | |||||
_creteText('下单时间:2020-06-18 17:11:15'), | |||||
_creteText('完成时间:2020-06-18 17:11:15'), | |||||
Row( | |||||
children: <Widget>[ | |||||
_creteText( | |||||
'${style?.list?.textOrderNo ?? ''}${model?.ordId ?? ''}'), | |||||
GestureDetector( | |||||
onTap: () { | |||||
if (model?.ordId != null && model.ordId.length > 0) { | |||||
Fluttertoast.showToast(msg: '复制成功'); | |||||
Clipboard.setData(ClipboardData(text: model.ordId)); | |||||
} | |||||
}, | |||||
child: Container( | |||||
margin: EdgeInsets.only(left: 10), | |||||
padding: EdgeInsets.only( | |||||
left: 10, | |||||
right: 10, | |||||
), | |||||
decoration: BoxDecoration( | |||||
color: Color(0xfff5f5f5), | |||||
borderRadius: BorderRadius.circular(2.5), | |||||
border: Border.all( | |||||
color: Color(0xffd6d6d6), | |||||
width: 0.5, | |||||
)), | |||||
child: Text( | |||||
style.list.textCopy, | |||||
style: TextStyle(fontSize: 9, color: Color(0xff999999)), | |||||
), | |||||
), | |||||
) | |||||
], | |||||
), | |||||
_creteText( | |||||
'${style?.list?.textOrderTime ?? ''}${model?.createAt ?? ''}'), | |||||
_creteText( | |||||
'${style?.list?.textFinishTime ?? ''}${model?.confirmAt ?? ''}'), | |||||
], | ], | ||||
), | ), | ||||
) | ) | ||||
@@ -87,25 +145,36 @@ class OrderItemWidget extends StatelessWidget { | |||||
Widget _createTitle() { | Widget _createTitle() { | ||||
List<InlineSpan> list = List(); | List<InlineSpan> list = List(); | ||||
list.add(WidgetSpan( | |||||
child: Container( | |||||
padding: EdgeInsets.only(left: 2, right: 2, top: 3, bottom: 3), | |||||
margin: EdgeInsets.only(right: 4), | |||||
child: Text( | |||||
'淘宝', | |||||
style: TextStyle( | |||||
fontSize: 9, | |||||
height: 1, | |||||
color: Colors.white, | |||||
String shop = ''; | |||||
if (model?.provider != null && model.provider != '') { | |||||
shop = style.filter.providerType | |||||
.firstWhere((element) => element.type == model.provider) | |||||
?.name ?? | |||||
''; | |||||
} | |||||
if (shop != '') { | |||||
list.add(WidgetSpan( | |||||
child: Container( | |||||
padding: EdgeInsets.only(left: 2, right: 2, top: 3, bottom: 3), | |||||
margin: EdgeInsets.only(right: 4), | |||||
child: Text( | |||||
shop, | |||||
style: TextStyle( | |||||
fontSize: 9, | |||||
height: 1, | |||||
color: | |||||
HexColor.fromHex(style.list.colorProviderFont ?? '#ffffff'), | |||||
), | |||||
), | ), | ||||
decoration: BoxDecoration( | |||||
color: HexColor.fromHex(style.list.colorProviderBg ?? '#ffffff'), | |||||
borderRadius: BorderRadius.circular(2.5)), | |||||
), | ), | ||||
decoration: BoxDecoration( | |||||
color: Colors.redAccent, borderRadius: BorderRadius.circular(2.5)), | |||||
), | |||||
)); | |||||
)); | |||||
} | |||||
list.add( | list.add( | ||||
TextSpan( | TextSpan( | ||||
text: model.title, | |||||
text: model?.itemTitle ?? '', | |||||
style: TextStyle( | style: TextStyle( | ||||
fontSize: 15, | fontSize: 15, | ||||
color: Color(0xff333333), | color: Color(0xff333333), | ||||
@@ -120,14 +189,37 @@ class OrderItemWidget extends StatelessWidget { | |||||
} | } | ||||
Widget _creteText(String text) { | Widget _creteText(String text) { | ||||
return Padding( | |||||
padding: EdgeInsets.only(top: 4), | |||||
return text == null || text == '' | |||||
? Container() | |||||
: Padding( | |||||
padding: EdgeInsets.only(top: 2, bottom: 2), | |||||
child: Text( | |||||
text, | |||||
style: TextStyle( | |||||
fontSize: 10, | |||||
color: Color(0xff999999), | |||||
), | |||||
), | |||||
); | |||||
} | |||||
Widget _createTips() { | |||||
List<OrderStateModel> states = style.list.orderState; | |||||
OrderStateModel state = | |||||
states.firstWhere((element) => element.type == model.state.toString()); | |||||
if (state == null || state.tips == null || state.tips == '') { | |||||
return Container(); | |||||
} | |||||
return Container( | |||||
margin: EdgeInsets.only(top: 8), | |||||
padding: EdgeInsets.only(left: 8, right: 8, top: 2, bottom: 2), | |||||
width: double.infinity, | |||||
decoration: BoxDecoration( | |||||
color: HexColor.fromHex(style.list.colorTipsBg ?? '#f5f5f5'), | |||||
borderRadius: BorderRadius.circular(4)), | |||||
child: Text( | child: Text( | ||||
text, | |||||
style: TextStyle( | |||||
fontSize: 10, | |||||
color: Color(0xff999999), | |||||
), | |||||
state?.tips ?? '', | |||||
style: TextStyle(color: Color(0xff666666), fontSize: 10), | |||||
), | ), | ||||
); | ); | ||||
} | } | ||||
@@ -1,7 +1,14 @@ | |||||
import 'package:flutter/cupertino.dart'; | import 'package:flutter/cupertino.dart'; | ||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_style_model.dart'; | |||||
import 'package:zhiying_comm/util/extension/color.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
class OrderSearchWidget extends StatelessWidget { | class OrderSearchWidget extends StatelessWidget { | ||||
final OrderPageStyleModel model; | |||||
const OrderSearchWidget(this.model, {Key key}) : super(key: key); | |||||
@override | @override | ||||
Widget build(BuildContext context) { | Widget build(BuildContext context) { | ||||
return Container( | return Container( | ||||
@@ -12,13 +19,25 @@ class OrderSearchWidget extends StatelessWidget { | |||||
child: Container( | child: Container( | ||||
padding: EdgeInsets.only(left: 12, right: 12), | padding: EdgeInsets.only(left: 12, right: 12), | ||||
decoration: BoxDecoration( | decoration: BoxDecoration( | ||||
borderRadius: BorderRadius.circular(16), color: Color(0xfff9f9f9)), | |||||
child: Center( | |||||
child: Text( | |||||
'搜索商品标题/粉丝姓名/订单号', | |||||
textAlign: TextAlign.center, | |||||
style: TextStyle(color: Color(0xff999999), fontSize: 14), | |||||
), | |||||
borderRadius: BorderRadius.circular(16), | |||||
color: HexColor.fromHex(model?.searchBarBgColor ?? '#f7f7f7')), | |||||
child: Row( | |||||
mainAxisAlignment: MainAxisAlignment.center, | |||||
children: <Widget>[ | |||||
Container( | |||||
width: 16, | |||||
height: 16, | |||||
margin: EdgeInsets.only(right: 4), | |||||
child: CachedNetworkImage( | |||||
imageUrl: model?.searchBarLeftIcon ?? '', | |||||
), | |||||
), | |||||
Text( | |||||
model?.searchBarPlaceholder ?? '', | |||||
textAlign: TextAlign.center, | |||||
style: TextStyle(color: Color(0xff999999), fontSize: 14), | |||||
), | |||||
], | |||||
), | ), | ||||
), | ), | ||||
); | ); | ||||
@@ -1,12 +1,17 @@ | |||||
import 'package:flutter/material.dart'; | import 'package:flutter/material.dart'; | ||||
import 'package:zhiying_base_widget/pages/orders_page/models/order_page_style_model.dart'; | |||||
import 'package:zhiying_base_widget/widgets/search/widget/my_tab.dart'; | import 'package:zhiying_base_widget/widgets/search/widget/my_tab.dart'; | ||||
import 'package:zhiying_comm/util/extension/color.dart'; | |||||
import 'package:zhiying_comm/zhiying_comm.dart'; | |||||
class OrderTabbarWidget extends StatelessWidget { | class OrderTabbarWidget extends StatelessWidget { | ||||
final OrderPageStyleModel model; | |||||
final TabController controller; | final TabController controller; | ||||
final List<String> titles; | final List<String> titles; | ||||
final VoidCallback onMoreClick; | final VoidCallback onMoreClick; | ||||
const OrderTabbarWidget( | const OrderTabbarWidget( | ||||
this.model, | |||||
this.controller, | this.controller, | ||||
this.titles, { | this.titles, { | ||||
Key key, | Key key, | ||||
@@ -27,8 +32,10 @@ class OrderTabbarWidget extends StatelessWidget { | |||||
isScrollable: true, | isScrollable: true, | ||||
indicatorSize: TabBarIndicatorSize.label, | indicatorSize: TabBarIndicatorSize.label, | ||||
// tabs: widgets, | // tabs: widgets, | ||||
indicatorColor: Color(0xffff4242), | |||||
labelColor: Color(0xffff4242), | |||||
indicatorColor: | |||||
HexColor.fromHex(model?.appActivateColor ?? '#ff4242'), | |||||
labelColor: | |||||
HexColor.fromHex(model?.appActivateColor ?? '#ff4242'), | |||||
unselectedLabelColor: Color(0xff999999), | unselectedLabelColor: Color(0xff999999), | ||||
tabs: titles.map((item) { | tabs: titles.map((item) { | ||||
return MyTab( | return MyTab( | ||||
@@ -39,12 +46,14 @@ class OrderTabbarWidget extends StatelessWidget { | |||||
), | ), | ||||
), | ), | ||||
GestureDetector( | GestureDetector( | ||||
behavior: HitTestBehavior.opaque, | |||||
child: Container( | child: Container( | ||||
width: 40, | width: 40, | ||||
height: 40, | height: 40, | ||||
child: Icon( | |||||
Icons.filter_4, | |||||
size: 14, | |||||
padding: EdgeInsets.all(10), | |||||
child: CachedNetworkImage( | |||||
imageUrl: model?.filter?.icon ?? '', | |||||
fit: BoxFit.contain, | |||||
), | ), | ||||
), | ), | ||||
onTap: () { | onTap: () { | ||||
@@ -57,23 +66,3 @@ class OrderTabbarWidget extends StatelessWidget { | |||||
)); | )); | ||||
} | } | ||||
} | } | ||||
class OrderTabbarItemWidget extends StatelessWidget { | |||||
final String title; | |||||
final bool isSelected; | |||||
const OrderTabbarItemWidget({Key key, this.title, this.isSelected = false}) | |||||
: super(key: key); | |||||
@override | |||||
Widget build(BuildContext context) { | |||||
return Container( | |||||
height: 26, | |||||
child: Text( | |||||
title, | |||||
style: TextStyle( | |||||
color: isSelected ? Color(0xFFFF4242) : Color(0xff999999)), | |||||
), | |||||
); | |||||
} | |||||
} |