After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 758 B |
After Width: | Height: | Size: 760 B |
After Width: | Height: | Size: 780 B |
@ -0,0 +1,150 @@
|
||||
import 'dart:convert'; |
||||
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/foundation.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; |
||||
import 'package:huixiang/retrofit/data/business_login_info.dart'; |
||||
import 'package:huixiang/retrofit/data/day_count.dart'; |
||||
import 'package:huixiang/retrofit/data/order_trend.dart'; |
||||
import 'package:huixiang/retrofit/data/vip_counts_info.dart'; |
||||
import 'package:retrofit/retrofit.dart'; |
||||
|
||||
import '../utils/flutter_utils.dart'; |
||||
import 'data/base_data.dart'; |
||||
import 'data/popular_sales_list.dart'; |
||||
|
||||
part 'business_api.g.dart'; |
||||
|
||||
///本地 |
||||
const localBaseUrl = "http://admin-api.test.yixinhuixiang.com/"; |
||||
///测试 |
||||
// const localBaseUrl = "http://test-merchant.lotus-wallet.com/test-merchant/"; |
||||
|
||||
///线上 |
||||
const serviceBaseUrl = "http://pos.tenant.lotus-wallet.com/test-merchant/"; |
||||
|
||||
@RestApi(baseUrl: localBaseUrl) |
||||
abstract class BusinessApiService { |
||||
factory BusinessApiService( |
||||
Dio dio, { |
||||
String baseUrl, |
||||
BuildContext context, |
||||
String token, |
||||
bool showLoading = false, |
||||
String url, |
||||
String tenant, |
||||
String storeId, |
||||
bool showErrorToast = true, |
||||
}) { |
||||
Map<String, dynamic> headers = |
||||
(token == null || token == "") ? {} : {'token': "Bearer $token"}; |
||||
if (tenant != null && tenant != "") { |
||||
headers["tenant"] = tenant; |
||||
} |
||||
if (storeId != null && storeId != "") { |
||||
headers["store-id"] = storeId; |
||||
} |
||||
if (kReleaseMode) baseUrl = serviceBaseUrl; |
||||
if (url != null) baseUrl = url; |
||||
dio.options = BaseOptions( |
||||
connectTimeout: 60000, |
||||
receiveTimeout: 60000, |
||||
headers: headers, |
||||
responseType: ResponseType.json, |
||||
baseUrl: baseUrl, |
||||
); |
||||
dio.interceptors.add( |
||||
InterceptorsWrapper(onRequest: (RequestOptions options) { |
||||
debugPrint("\n======================= 请求数据 ======================="); |
||||
debugPrint("method = ${options.method.toString()}"); |
||||
debugPrint("url = ${options.uri.toString()}"); |
||||
debugPrint("headers = ${options.headers}"); |
||||
if (showLoading && !EasyLoading.isShow) { |
||||
//是否显示loading |
||||
EasyLoading.show(status: "正在加载..."); |
||||
} |
||||
if (options.data is FormData) { |
||||
debugPrint("params data = FormData"); |
||||
} else { |
||||
debugPrint("params data = ${jsonEncode(options.data)}"); |
||||
} |
||||
debugPrint("params queryParameters = ${options.queryParameters}"); |
||||
}, onResponse: (Response response) { |
||||
if (showLoading && EasyLoading.isShow) EasyLoading.dismiss(); |
||||
debugPrint("\n======================= 响应数据开始 ======================="); |
||||
debugPrint("code = ${response.statusCode}"); |
||||
p(jsonEncode(response.data)); |
||||
|
||||
// debugPrint(jsonEncode(response.data), wrapWidth: response.data.toString().length * 10); |
||||
|
||||
Map map = response.data; |
||||
// if (map["code"] != 0) { |
||||
// EasyLoading.dismiss(); |
||||
// } |
||||
// if (map["code"] == 40005 || map["code"] == 40001) { |
||||
// if (!LoginTipsDialog().isShow) { |
||||
// print("show: ${LoginTipsDialog().isShow}"); |
||||
// LoginTipsDialog().show(context); |
||||
// } |
||||
// } |
||||
if (showErrorToast && |
||||
map["code"] == 404 && |
||||
(map["msg"] ?? map["message"]) != null) { |
||||
SmartDialog.showToast(map["msg"] ?? map["message"], |
||||
alignment: Alignment.center); |
||||
} |
||||
debugPrint("======================= 响应数据结束 =======================\n"); |
||||
}, onError: (DioError e) { |
||||
if (EasyLoading.isShow) EasyLoading.dismiss(); |
||||
// SmartDialog.showToast("网络错误,请切换网络或稍后再试!", alignment: Alignment.center); |
||||
// SmartDialog.showToast(AppUtils.dioErrorTypeToString(e.type), |
||||
// alignment: Alignment.center); |
||||
debugPrint("\n======================= 错误响应数据 ======================="); |
||||
debugPrint("type = ${e.type}"); |
||||
debugPrint("message = ${e.message}"); |
||||
debugPrint("\n"); |
||||
}), |
||||
); |
||||
return _BusinessApiService(dio, baseUrl: baseUrl); |
||||
} |
||||
|
||||
void dispose(); |
||||
|
||||
static void p(String msg) { |
||||
//因为String的length是字符数量不是字节数量所以为了防止中文字符过多, |
||||
// 把4*1024的MAX字节打印长度改为1000字符数 |
||||
int maxStrLength = 900; |
||||
//大于1000时 |
||||
while (msg.length > maxStrLength) { |
||||
debugPrint(msg.substring(0, maxStrLength), wrapWidth: maxStrLength); |
||||
msg = msg.substring(maxStrLength); |
||||
} |
||||
//剩余部分 |
||||
debugPrint(msg, wrapWidth: maxStrLength); |
||||
} |
||||
|
||||
/// 获取认证token/管理系统登录 |
||||
@POST("anno/token") |
||||
Future<BaseData> annoToken(@Body() Map<String, dynamic> param); |
||||
|
||||
/// 当日各种金额统计 |
||||
@POST("comprehensiveReport/getDayCounts") |
||||
Future<BaseData<DayCount>> getDayCounts(@Body() Map<String, dynamic> param); |
||||
|
||||
///商家概览/热销榜单 |
||||
@GET("dashBoard/store/?offsetDay={offsetDay}") |
||||
Future<BaseData<PopularSalesList>> popularList( |
||||
@Path("offsetDay") String offsetDay); |
||||
|
||||
///生意总览/订单量趋势 |
||||
@GET("trend/orderTrend") |
||||
Future<BaseData<List<OrderTrend>>> orderTrend(); |
||||
|
||||
///会员数量统计/用户概览 |
||||
@GET("largeScreenReport/getDayCounts?date={date}") |
||||
Future<BaseData<VipCountsInfo>> vipCounts( |
||||
@Path("date") String date); |
||||
} |
@ -0,0 +1,137 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||
|
||||
part of 'business_api.dart'; |
||||
|
||||
// ************************************************************************** |
||||
// RetrofitGenerator |
||||
// ************************************************************************** |
||||
|
||||
class _BusinessApiService implements BusinessApiService { |
||||
_BusinessApiService(this._dio, {this.baseUrl}) { |
||||
ArgumentError.checkNotNull(_dio, '_dio'); |
||||
baseUrl ??= kReleaseMode ? serviceBaseUrl : localBaseUrl; |
||||
} |
||||
|
||||
final Dio _dio; |
||||
|
||||
String baseUrl; |
||||
|
||||
@override |
||||
void dispose() { |
||||
_dio.close(force: true); |
||||
} |
||||
|
||||
@override |
||||
Future<BaseData> annoToken(param) async { |
||||
ArgumentError.checkNotNull(param, 'param'); |
||||
const _extra = <String, dynamic>{}; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final _data = <String, dynamic>{}; |
||||
_data.addAll(param ?? <String, dynamic>{}); |
||||
final _result = await _dio.request<Map<String, dynamic>>( |
||||
'anno/token', |
||||
queryParameters: queryParameters, |
||||
options: RequestOptions( |
||||
method: 'POST', |
||||
headers: <String, dynamic>{}, |
||||
extra: _extra, |
||||
baseUrl: baseUrl), |
||||
data: _data); |
||||
final value = BaseData.fromJson( |
||||
_result.data, |
||||
(json) => json == null ? null : json, |
||||
); |
||||
return value; |
||||
} |
||||
|
||||
@override |
||||
Future<BaseData<DayCount>> getDayCounts(param) async { |
||||
ArgumentError.checkNotNull(param, 'param'); |
||||
const _extra = <String, dynamic>{}; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final _data = <String, dynamic>{}; |
||||
_data.addAll(param ?? <String, dynamic>{}); |
||||
final _result = await _dio.request<Map<String, dynamic>>( |
||||
'comprehensiveReport/getDayCounts', |
||||
queryParameters: queryParameters, |
||||
options: RequestOptions( |
||||
method: 'POST', |
||||
headers: <String, dynamic>{}, |
||||
extra: _extra, |
||||
baseUrl: baseUrl), |
||||
data: _data); |
||||
final value = BaseData<DayCount>.fromJson( |
||||
_result.data, |
||||
(json) => json == "" ? null :DayCount.fromJson(json), |
||||
); |
||||
return value; |
||||
} |
||||
|
||||
@override |
||||
Future<BaseData<PopularSalesList>> popularList(offsetDay) async { |
||||
ArgumentError.checkNotNull(offsetDay, 'offsetDay'); |
||||
const _extra = <String, dynamic>{}; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final _data = <String, dynamic>{}; |
||||
final _result = await _dio.request<Map<String, dynamic>>( |
||||
'dashBoard/store/?offsetDay=$offsetDay', |
||||
queryParameters: queryParameters, |
||||
options: RequestOptions( |
||||
method: 'GET', |
||||
headers: <String, dynamic>{}, |
||||
extra: _extra, |
||||
baseUrl: baseUrl), |
||||
data: _data); |
||||
final value = BaseData<PopularSalesList>.fromJson( |
||||
_result.data, |
||||
(json) => PopularSalesList.fromJson(json), |
||||
); |
||||
return value; |
||||
} |
||||
|
||||
@override |
||||
Future<BaseData<List<OrderTrend>>> orderTrend() async { |
||||
const _extra = <String, dynamic>{}; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final _data = <String, dynamic>{}; |
||||
final _result = await _dio.request<Map<String, dynamic>>( |
||||
'trend/orderTrend', |
||||
queryParameters: queryParameters, |
||||
options: RequestOptions( |
||||
method: 'GET', |
||||
headers: <String, dynamic>{}, |
||||
extra: _extra, |
||||
baseUrl: baseUrl), |
||||
data: _data); |
||||
final value = BaseData<List<OrderTrend>>.fromJson( |
||||
_result.data, |
||||
(json) => (json as List<dynamic>) |
||||
.map<OrderTrend>( |
||||
(i) => OrderTrend.fromJson(i as Map<String, dynamic>)) |
||||
.toList()); |
||||
return value; |
||||
} |
||||
|
||||
@override |
||||
Future<BaseData<VipCountsInfo>> vipCounts(date) async { |
||||
ArgumentError.checkNotNull(date, 'date'); |
||||
const _extra = <String, dynamic>{}; |
||||
final queryParameters = <String, dynamic>{}; |
||||
final _data = <String, dynamic>{}; |
||||
final _result = await _dio.request<Map<String, dynamic>>( |
||||
'largeScreenReport/getDayCounts?date=$date', |
||||
queryParameters: queryParameters, |
||||
options: RequestOptions( |
||||
method: 'GET', |
||||
headers: <String, dynamic>{}, |
||||
extra: _extra, |
||||
baseUrl: baseUrl), |
||||
data: _data); |
||||
final value = BaseData<VipCountsInfo>.fromJson( |
||||
_result.data, |
||||
(json) => VipCountsInfo.fromJson(json), |
||||
); |
||||
return value; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,177 @@
|
||||
/// summaryDate : "2023-09-14" |
||||
/// dayMoney : "0" |
||||
/// discountSum : "0.00" |
||||
/// paySum : "0" |
||||
/// rechargeMoney : "0" |
||||
/// refundMoney : "0" |
||||
/// orderNum : 0 |
||||
/// rechargeOrderNum : 0 |
||||
/// refundOrderNum : 0 |
||||
/// payOrderNum : 0 |
||||
/// discountOrderNum : 0 |
||||
/// startDate : null |
||||
/// endDate : null |
||||
/// tablePerConsumption : null |
||||
/// numberOfPeople : 0 |
||||
/// peoplePerConsumption : "0" |
||||
/// realDiscountPer : null |
||||
/// tableRate : null |
||||
|
||||
class DayCount { |
||||
DayCount({ |
||||
String summaryDate, |
||||
String dayMoney, |
||||
String discountSum, |
||||
String paySum, |
||||
String rechargeMoney, |
||||
String refundMoney, |
||||
num orderNum, |
||||
num rechargeOrderNum, |
||||
num refundOrderNum, |
||||
num payOrderNum, |
||||
num discountOrderNum, |
||||
dynamic startDate, |
||||
dynamic endDate, |
||||
dynamic tablePerConsumption, |
||||
num numberOfPeople, |
||||
String peoplePerConsumption, |
||||
dynamic realDiscountPer, |
||||
dynamic tableRate,}){ |
||||
_summaryDate = summaryDate; |
||||
_dayMoney = dayMoney; |
||||
_discountSum = discountSum; |
||||
_paySum = paySum; |
||||
_rechargeMoney = rechargeMoney; |
||||
_refundMoney = refundMoney; |
||||
_orderNum = orderNum; |
||||
_rechargeOrderNum = rechargeOrderNum; |
||||
_refundOrderNum = refundOrderNum; |
||||
_payOrderNum = payOrderNum; |
||||
_discountOrderNum = discountOrderNum; |
||||
_startDate = startDate; |
||||
_endDate = endDate; |
||||
_tablePerConsumption = tablePerConsumption; |
||||
_numberOfPeople = numberOfPeople; |
||||
_peoplePerConsumption = peoplePerConsumption; |
||||
_realDiscountPer = realDiscountPer; |
||||
_tableRate = tableRate; |
||||
} |
||||
|
||||
DayCount.fromJson(dynamic json) { |
||||
_summaryDate = json['summaryDate']; |
||||
_dayMoney = json['dayMoney']; |
||||
_discountSum = json['discountSum']; |
||||
_paySum = json['paySum']; |
||||
_rechargeMoney = json['rechargeMoney']; |
||||
_refundMoney = json['refundMoney']; |
||||
_orderNum = json['orderNum']; |
||||
_rechargeOrderNum = json['rechargeOrderNum']; |
||||
_refundOrderNum = json['refundOrderNum']; |
||||
_payOrderNum = json['payOrderNum']; |
||||
_discountOrderNum = json['discountOrderNum']; |
||||
_startDate = json['startDate']; |
||||
_endDate = json['endDate']; |
||||
_tablePerConsumption = json['tablePerConsumption']; |
||||
_numberOfPeople = json['numberOfPeople']; |
||||
_peoplePerConsumption = json['peoplePerConsumption']; |
||||
_realDiscountPer = json['realDiscountPer']; |
||||
_tableRate = json['tableRate']; |
||||
} |
||||
String _summaryDate; |
||||
String _dayMoney; |
||||
String _discountSum; |
||||
String _paySum; |
||||
String _rechargeMoney; |
||||
String _refundMoney; |
||||
num _orderNum; |
||||
num _rechargeOrderNum; |
||||
num _refundOrderNum; |
||||
num _payOrderNum; |
||||
num _discountOrderNum; |
||||
dynamic _startDate; |
||||
dynamic _endDate; |
||||
dynamic _tablePerConsumption; |
||||
num _numberOfPeople; |
||||
String _peoplePerConsumption; |
||||
dynamic _realDiscountPer; |
||||
dynamic _tableRate; |
||||
DayCount copyWith({ String summaryDate, |
||||
String dayMoney, |
||||
String discountSum, |
||||
String paySum, |
||||
String rechargeMoney, |
||||
String refundMoney, |
||||
num orderNum, |
||||
num rechargeOrderNum, |
||||
num refundOrderNum, |
||||
num payOrderNum, |
||||
num discountOrderNum, |
||||
dynamic startDate, |
||||
dynamic endDate, |
||||
dynamic tablePerConsumption, |
||||
num numberOfPeople, |
||||
String peoplePerConsumption, |
||||
dynamic realDiscountPer, |
||||
dynamic tableRate, |
||||
}) => DayCount( summaryDate: summaryDate ?? _summaryDate, |
||||
dayMoney: dayMoney ?? _dayMoney, |
||||
discountSum: discountSum ?? _discountSum, |
||||
paySum: paySum ?? _paySum, |
||||
rechargeMoney: rechargeMoney ?? _rechargeMoney, |
||||
refundMoney: refundMoney ?? _refundMoney, |
||||
orderNum: orderNum ?? _orderNum, |
||||
rechargeOrderNum: rechargeOrderNum ?? _rechargeOrderNum, |
||||
refundOrderNum: refundOrderNum ?? _refundOrderNum, |
||||
payOrderNum: payOrderNum ?? _payOrderNum, |
||||
discountOrderNum: discountOrderNum ?? _discountOrderNum, |
||||
startDate: startDate ?? _startDate, |
||||
endDate: endDate ?? _endDate, |
||||
tablePerConsumption: tablePerConsumption ?? _tablePerConsumption, |
||||
numberOfPeople: numberOfPeople ?? _numberOfPeople, |
||||
peoplePerConsumption: peoplePerConsumption ?? _peoplePerConsumption, |
||||
realDiscountPer: realDiscountPer ?? _realDiscountPer, |
||||
tableRate: tableRate ?? _tableRate, |
||||
); |
||||
String get summaryDate => _summaryDate; |
||||
String get dayMoney => _dayMoney; |
||||
String get discountSum => _discountSum; |
||||
String get paySum => _paySum; |
||||
String get rechargeMoney => _rechargeMoney; |
||||
String get refundMoney => _refundMoney; |
||||
num get orderNum => _orderNum; |
||||
num get rechargeOrderNum => _rechargeOrderNum; |
||||
num get refundOrderNum => _refundOrderNum; |
||||
num get payOrderNum => _payOrderNum; |
||||
num get discountOrderNum => _discountOrderNum; |
||||
dynamic get startDate => _startDate; |
||||
dynamic get endDate => _endDate; |
||||
dynamic get tablePerConsumption => _tablePerConsumption; |
||||
num get numberOfPeople => _numberOfPeople; |
||||
String get peoplePerConsumption => _peoplePerConsumption; |
||||
dynamic get realDiscountPer => _realDiscountPer; |
||||
dynamic get tableRate => _tableRate; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['summaryDate'] = _summaryDate; |
||||
map['dayMoney'] = _dayMoney; |
||||
map['discountSum'] = _discountSum; |
||||
map['paySum'] = _paySum; |
||||
map['rechargeMoney'] = _rechargeMoney; |
||||
map['refundMoney'] = _refundMoney; |
||||
map['orderNum'] = _orderNum; |
||||
map['rechargeOrderNum'] = _rechargeOrderNum; |
||||
map['refundOrderNum'] = _refundOrderNum; |
||||
map['payOrderNum'] = _payOrderNum; |
||||
map['discountOrderNum'] = _discountOrderNum; |
||||
map['startDate'] = _startDate; |
||||
map['endDate'] = _endDate; |
||||
map['tablePerConsumption'] = _tablePerConsumption; |
||||
map['numberOfPeople'] = _numberOfPeople; |
||||
map['peoplePerConsumption'] = _peoplePerConsumption; |
||||
map['realDiscountPer'] = _realDiscountPer; |
||||
map['tableRate'] = _tableRate; |
||||
return map; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,33 @@
|
||||
/// date : "2023-09-08" |
||||
/// number : 0 |
||||
|
||||
class OrderTrend { |
||||
OrderTrend({ |
||||
String date, |
||||
num number,}){ |
||||
_date = date; |
||||
_number = number; |
||||
} |
||||
|
||||
OrderTrend.fromJson(dynamic json) { |
||||
_date = json['date']; |
||||
_number = json['number']; |
||||
} |
||||
String _date; |
||||
num _number; |
||||
OrderTrend copyWith({ String date, |
||||
num number, |
||||
}) => OrderTrend( date: date ?? _date, |
||||
number: number ?? _number, |
||||
); |
||||
String get date => _date; |
||||
num get number => _number; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['date'] = _date; |
||||
map['number'] = _number; |
||||
return map; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,311 @@
|
||||
/// dashMemberList : [{"id":"1645357356843794432","name":"哈哈哈","phone":"15623342902","balance":"817.21"},{"id":"1688728183219683328","name":"","phone":"17612711844","balance":"470.00"},{"id":"1693535584301088768","name":"西瓜太郎","phone":"18716285488","balance":"104.00"},{"id":"1645691116772655104","name":"丙阳测试环境","phone":"15827991714","balance":"0.88"},{"id":"1645348000345620480","name":"璇","phone":"15871490290","balance":"0.02"},{"id":"1685233051375763456","name":"","phone":"18672789329","balance":"0.00"},{"id":"1696812803165257728","name":"","phone":"15723456545","balance":"0.00"},{"id":"1652214301991108608","name":"","phone":"18573164593","balance":"0.00"},{"id":"1646037740963233792","name":"","phone":"13517240850","balance":"0.00"},{"id":"1650818734501134336","name":"","phone":"15172398708","balance":"0.00"},{"id":"1652493162733633536","name":"","phone":"15013675571","balance":"0.00"},{"id":"1646067749123784704","name":"","phone":"13720233327","balance":"0.00"}] |
||||
/// saleProductList : [{"product_id":"1646055704735252480","saleNum":12,"product_name":"香蕉牛乳"},{"product_id":"1645714721178910720","saleNum":8,"product_name":"红薯牛乳"},{"product_id":"1645991124428390400","saleNum":3,"product_name":"南瓜牛乳"},{"product_id":"1645722834221137920","saleNum":3,"product_name":"原味豆腐"},{"product_id":"1645992331242897408","saleNum":3,"product_name":"炸鲜香菇"},{"product_id":"1646449156648075264","saleNum":2,"product_name":"桑葚牛乳"},{"product_id":"1645724097411284992","saleNum":2,"product_name":"泡菜"},{"product_id":"1646449942484484096","saleNum":1,"product_name":"芒果牛乳"},{"product_id":"1645667029320990720","saleNum":1,"product_name":"木瓜牛奶"},{"product_id":"1645732366896857088","saleNum":1,"product_name":"酱烤玉米"}] |
||||
/// avgPrice : "11.43" |
||||
/// orderNum : 21 |
||||
/// storeDailyStatistics : [] |
||||
/// orderSum : "259.04" |
||||
/// changeData : {"addCartChangeRate":0.0,"payCountChangeRate":0.0,"sumAddCartCount":"0","sumSettleCount":"0","sumPaySuccessCount":"0","sumPV":"0","totalChangeRate":0.0,"sumPayCount":"0","settleChangeRate":0.0,"paySuccessChangeRate":0.0} |
||||
/// paySum : "240.00" |
||||
|
||||
class PopularSalesList { |
||||
PopularSalesList({ |
||||
List<DashMemberList> dashMemberList, |
||||
List<SaleProductList> saleProductList, |
||||
String avgPrice, |
||||
num orderNum, |
||||
// List<dynamic> storeDailyStatistics, |
||||
String orderSum, |
||||
ChangeData changeData, |
||||
String paySum,}){ |
||||
_dashMemberList = dashMemberList; |
||||
_saleProductList = saleProductList; |
||||
_avgPrice = avgPrice; |
||||
_orderNum = orderNum; |
||||
// _storeDailyStatistics = storeDailyStatistics; |
||||
_orderSum = orderSum; |
||||
_changeData = changeData; |
||||
_paySum = paySum; |
||||
} |
||||
|
||||
PopularSalesList.fromJson(dynamic json) { |
||||
if (json['dashMemberList'] != null) { |
||||
_dashMemberList = []; |
||||
json['dashMemberList'].forEach((v) { |
||||
_dashMemberList.add(DashMemberList.fromJson(v)); |
||||
}); |
||||
} |
||||
if (json['saleProductList'] != null) { |
||||
_saleProductList = []; |
||||
json['saleProductList'].forEach((v) { |
||||
_saleProductList.add(SaleProductList.fromJson(v)); |
||||
}); |
||||
} |
||||
_avgPrice = json['avgPrice']; |
||||
_orderNum = json['orderNum']; |
||||
// if (json['storeDailyStatistics'] != null) { |
||||
// _storeDailyStatistics = []; |
||||
// json['storeDailyStatistics'].forEach((v) { |
||||
// _storeDailyStatistics.add(Dynamic.fromJson(v)); |
||||
// }); |
||||
// } |
||||
_orderSum = json['orderSum']; |
||||
_changeData = json['changeData'] != null ? ChangeData.fromJson(json['changeData']) : null; |
||||
_paySum = json['paySum']; |
||||
} |
||||
List<DashMemberList> _dashMemberList; |
||||
List<SaleProductList> _saleProductList; |
||||
String _avgPrice; |
||||
num _orderNum; |
||||
// List<dynamic> _storeDailyStatistics; |
||||
String _orderSum; |
||||
ChangeData _changeData; |
||||
String _paySum; |
||||
PopularSalesList copyWith({ List<DashMemberList> dashMemberList, |
||||
List<SaleProductList> saleProductList, |
||||
String avgPrice, |
||||
num orderNum, |
||||
// List<dynamic> storeDailyStatistics, |
||||
String orderSum, |
||||
ChangeData changeData, |
||||
String paySum, |
||||
}) => PopularSalesList( dashMemberList: dashMemberList ?? _dashMemberList, |
||||
saleProductList: saleProductList ?? _saleProductList, |
||||
avgPrice: avgPrice ?? _avgPrice, |
||||
orderNum: orderNum ?? _orderNum, |
||||
// storeDailyStatistics: storeDailyStatistics ?? _storeDailyStatistics, |
||||
orderSum: orderSum ?? _orderSum, |
||||
changeData: changeData ?? _changeData, |
||||
paySum: paySum ?? _paySum, |
||||
); |
||||
List<DashMemberList> get dashMemberList => _dashMemberList; |
||||
List<SaleProductList> get saleProductList => _saleProductList; |
||||
String get avgPrice => _avgPrice; |
||||
num get orderNum => _orderNum; |
||||
// List<dynamic> get storeDailyStatistics => _storeDailyStatistics; |
||||
String get orderSum => _orderSum; |
||||
ChangeData get changeData => _changeData; |
||||
String get paySum => _paySum; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
if (_dashMemberList != null) { |
||||
map['dashMemberList'] = _dashMemberList.map((v) => v.toJson()).toList(); |
||||
} |
||||
if (_saleProductList != null) { |
||||
map['saleProductList'] = _saleProductList.map((v) => v.toJson()).toList(); |
||||
} |
||||
map['avgPrice'] = _avgPrice; |
||||
map['orderNum'] = _orderNum; |
||||
// if (_storeDailyStatistics != null) { |
||||
// map['storeDailyStatistics'] = _storeDailyStatistics.map((v) => v.toJson()).toList(); |
||||
// } |
||||
map['orderSum'] = _orderSum; |
||||
if (_changeData != null) { |
||||
map['changeData'] = _changeData.toJson(); |
||||
} |
||||
map['paySum'] = _paySum; |
||||
return map; |
||||
} |
||||
|
||||
} |
||||
|
||||
/// addCartChangeRate : 0.0 |
||||
/// payCountChangeRate : 0.0 |
||||
/// sumAddCartCount : "0" |
||||
/// sumSettleCount : "0" |
||||
/// sumPaySuccessCount : "0" |
||||
/// sumPV : "0" |
||||
/// totalChangeRate : 0.0 |
||||
/// sumPayCount : "0" |
||||
/// settleChangeRate : 0.0 |
||||
/// paySuccessChangeRate : 0.0 |
||||
|
||||
class ChangeData { |
||||
ChangeData({ |
||||
num addCartChangeRate, |
||||
num payCountChangeRate, |
||||
String sumAddCartCount, |
||||
String sumSettleCount, |
||||
String sumPaySuccessCount, |
||||
String sumPV, |
||||
num totalChangeRate, |
||||
String sumPayCount, |
||||
num settleChangeRate, |
||||
num paySuccessChangeRate,}){ |
||||
_addCartChangeRate = addCartChangeRate; |
||||
_payCountChangeRate = payCountChangeRate; |
||||
_sumAddCartCount = sumAddCartCount; |
||||
_sumSettleCount = sumSettleCount; |
||||
_sumPaySuccessCount = sumPaySuccessCount; |
||||
_sumPV = sumPV; |
||||
_totalChangeRate = totalChangeRate; |
||||
_sumPayCount = sumPayCount; |
||||
_settleChangeRate = settleChangeRate; |
||||
_paySuccessChangeRate = paySuccessChangeRate; |
||||
} |
||||
|
||||
ChangeData.fromJson(dynamic json) { |
||||
_addCartChangeRate = json['addCartChangeRate']; |
||||
_payCountChangeRate = json['payCountChangeRate']; |
||||
_sumAddCartCount = json['sumAddCartCount']; |
||||
_sumSettleCount = json['sumSettleCount']; |
||||
_sumPaySuccessCount = json['sumPaySuccessCount']; |
||||
_sumPV = json['sumPV']; |
||||
_totalChangeRate = json['totalChangeRate']; |
||||
_sumPayCount = json['sumPayCount']; |
||||
_settleChangeRate = json['settleChangeRate']; |
||||
_paySuccessChangeRate = json['paySuccessChangeRate']; |
||||
} |
||||
num _addCartChangeRate; |
||||
num _payCountChangeRate; |
||||
String _sumAddCartCount; |
||||
String _sumSettleCount; |
||||
String _sumPaySuccessCount; |
||||
String _sumPV; |
||||
num _totalChangeRate; |
||||
String _sumPayCount; |
||||
num _settleChangeRate; |
||||
num _paySuccessChangeRate; |
||||
ChangeData copyWith({ num addCartChangeRate, |
||||
num payCountChangeRate, |
||||
String sumAddCartCount, |
||||
String sumSettleCount, |
||||
String sumPaySuccessCount, |
||||
String sumPV, |
||||
num totalChangeRate, |
||||
String sumPayCount, |
||||
num settleChangeRate, |
||||
num paySuccessChangeRate, |
||||
}) => ChangeData( addCartChangeRate: addCartChangeRate ?? _addCartChangeRate, |
||||
payCountChangeRate: payCountChangeRate ?? _payCountChangeRate, |
||||
sumAddCartCount: sumAddCartCount ?? _sumAddCartCount, |
||||
sumSettleCount: sumSettleCount ?? _sumSettleCount, |
||||
sumPaySuccessCount: sumPaySuccessCount ?? _sumPaySuccessCount, |
||||
sumPV: sumPV ?? _sumPV, |
||||
totalChangeRate: totalChangeRate ?? _totalChangeRate, |
||||
sumPayCount: sumPayCount ?? _sumPayCount, |
||||
settleChangeRate: settleChangeRate ?? _settleChangeRate, |
||||
paySuccessChangeRate: paySuccessChangeRate ?? _paySuccessChangeRate, |
||||
); |
||||
num get addCartChangeRate => _addCartChangeRate; |
||||
num get payCountChangeRate => _payCountChangeRate; |
||||
String get sumAddCartCount => _sumAddCartCount; |
||||
String get sumSettleCount => _sumSettleCount; |
||||
String get sumPaySuccessCount => _sumPaySuccessCount; |
||||
String get sumPV => _sumPV; |
||||
num get totalChangeRate => _totalChangeRate; |
||||
String get sumPayCount => _sumPayCount; |
||||
num get settleChangeRate => _settleChangeRate; |
||||
num get paySuccessChangeRate => _paySuccessChangeRate; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['addCartChangeRate'] = _addCartChangeRate; |
||||
map['payCountChangeRate'] = _payCountChangeRate; |
||||
map['sumAddCartCount'] = _sumAddCartCount; |
||||
map['sumSettleCount'] = _sumSettleCount; |
||||
map['sumPaySuccessCount'] = _sumPaySuccessCount; |
||||
map['sumPV'] = _sumPV; |
||||
map['totalChangeRate'] = _totalChangeRate; |
||||
map['sumPayCount'] = _sumPayCount; |
||||
map['settleChangeRate'] = _settleChangeRate; |
||||
map['paySuccessChangeRate'] = _paySuccessChangeRate; |
||||
return map; |
||||
} |
||||
|
||||
} |
||||
|
||||
/// product_id : "1646055704735252480" |
||||
/// saleNum : 12 |
||||
/// product_name : "香蕉牛乳" |
||||
|
||||
class SaleProductList { |
||||
SaleProductList({ |
||||
String productId, |
||||
num saleNum, |
||||
String productName,}){ |
||||
_productId = productId; |
||||
_saleNum = saleNum; |
||||
_productName = productName; |
||||
} |
||||
|
||||
SaleProductList.fromJson(dynamic json) { |
||||
_productId = json['product_id']; |
||||
_saleNum = json['saleNum']; |
||||
_productName = json['product_name']; |
||||
} |
||||
String _productId; |
||||
num _saleNum; |
||||
String _productName; |
||||
SaleProductList copyWith({ String productId, |
||||
num saleNum, |
||||
String productName, |
||||
}) => SaleProductList( productId: productId ?? _productId, |
||||
saleNum: saleNum ?? _saleNum, |
||||
productName: productName ?? _productName, |
||||
); |
||||
String get productId => _productId; |
||||
num get saleNum => _saleNum; |
||||
String get productName => _productName; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['product_id'] = _productId; |
||||
map['saleNum'] = _saleNum; |
||||
map['product_name'] = _productName; |
||||
return map; |
||||
} |
||||
|
||||
} |
||||
|
||||
/// id : "1645357356843794432" |
||||
/// name : "哈哈哈" |
||||
/// phone : "15623342902" |
||||
/// balance : "817.21" |
||||
|
||||
class DashMemberList { |
||||
DashMemberList({ |
||||
String id, |
||||
String name, |
||||
String phone, |
||||
String balance,}){ |
||||
_id = id; |
||||
_name = name; |
||||
_phone = phone; |
||||
_balance = balance; |
||||
} |
||||
|
||||
DashMemberList.fromJson(dynamic json) { |
||||
_id = json['id']; |
||||
_name = json['name']; |
||||
_phone = json['phone']; |
||||
_balance = json['balance']; |
||||
} |
||||
String _id; |
||||
String _name; |
||||
String _phone; |
||||
String _balance; |
||||
DashMemberList copyWith({ String id, |
||||
String name, |
||||
String phone, |
||||
String balance, |
||||
}) => DashMemberList( id: id ?? _id, |
||||
name: name ?? _name, |
||||
phone: phone ?? _phone, |
||||
balance: balance ?? _balance, |
||||
); |
||||
String get id => _id; |
||||
String get name => _name; |
||||
String get phone => _phone; |
||||
String get balance => _balance; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['id'] = _id; |
||||
map['name'] = _name; |
||||
map['phone'] = _phone; |
||||
map['balance'] = _balance; |
||||
return map; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,141 @@
|
||||
/// dayMoney : "0" |
||||
/// yesterdayMoney : "0" |
||||
/// paySum : "0" |
||||
/// yesterdayPaySum : "0" |
||||
/// rechargeMoney : "0" |
||||
/// weekRechargeMoney : "0" |
||||
/// lastWeekRechargeMoney : "0" |
||||
/// orderNum : 0 |
||||
/// yesterdayOrderNum : 0 |
||||
/// memberNum : 21800 |
||||
/// lastWeekMemberNum : 4 |
||||
/// weekMemberNum : 1 |
||||
/// newMemberNum : 0 |
||||
/// yesterdayNewMemberNum : 0 |
||||
|
||||
class VipCountsInfo { |
||||
VipCountsInfo({ |
||||
String dayMoney, |
||||
String yesterdayMoney, |
||||
String paySum, |
||||
String yesterdayPaySum, |
||||
String rechargeMoney, |
||||
String weekRechargeMoney, |
||||
String lastWeekRechargeMoney, |
||||
num orderNum, |
||||
num yesterdayOrderNum, |
||||
num memberNum, |
||||
num lastWeekMemberNum, |
||||
num weekMemberNum, |
||||
num newMemberNum, |
||||
num yesterdayNewMemberNum,}){ |
||||
_dayMoney = dayMoney; |
||||
_yesterdayMoney = yesterdayMoney; |
||||
_paySum = paySum; |
||||
_yesterdayPaySum = yesterdayPaySum; |
||||
_rechargeMoney = rechargeMoney; |
||||
_weekRechargeMoney = weekRechargeMoney; |
||||
_lastWeekRechargeMoney = lastWeekRechargeMoney; |
||||
_orderNum = orderNum; |
||||
_yesterdayOrderNum = yesterdayOrderNum; |
||||
_memberNum = memberNum; |
||||
_lastWeekMemberNum = lastWeekMemberNum; |
||||
_weekMemberNum = weekMemberNum; |
||||
_newMemberNum = newMemberNum; |
||||
_yesterdayNewMemberNum = yesterdayNewMemberNum; |
||||
} |
||||
|
||||
VipCountsInfo.fromJson(dynamic json) { |
||||
_dayMoney = json['dayMoney']; |
||||
_yesterdayMoney = json['yesterdayMoney']; |
||||
_paySum = json['paySum']; |
||||
_yesterdayPaySum = json['yesterdayPaySum']; |
||||
_rechargeMoney = json['rechargeMoney']; |
||||
_weekRechargeMoney = json['weekRechargeMoney']; |
||||
_lastWeekRechargeMoney = json['lastWeekRechargeMoney']; |
||||
_orderNum = json['orderNum']; |
||||
_yesterdayOrderNum = json['yesterdayOrderNum']; |
||||
_memberNum = json['memberNum']; |
||||
_lastWeekMemberNum = json['lastWeekMemberNum']; |
||||
_weekMemberNum = json['weekMemberNum']; |
||||
_newMemberNum = json['newMemberNum']; |
||||
_yesterdayNewMemberNum = json['yesterdayNewMemberNum']; |
||||
} |
||||
String _dayMoney; |
||||
String _yesterdayMoney; |
||||
String _paySum; |
||||
String _yesterdayPaySum; |
||||
String _rechargeMoney; |
||||
String _weekRechargeMoney; |
||||
String _lastWeekRechargeMoney; |
||||
num _orderNum; |
||||
num _yesterdayOrderNum; |
||||
num _memberNum; |
||||
num _lastWeekMemberNum; |
||||
num _weekMemberNum; |
||||
num _newMemberNum; |
||||
num _yesterdayNewMemberNum; |
||||
VipCountsInfo copyWith({ String dayMoney, |
||||
String yesterdayMoney, |
||||
String paySum, |
||||
String yesterdayPaySum, |
||||
String rechargeMoney, |
||||
String weekRechargeMoney, |
||||
String lastWeekRechargeMoney, |
||||
num orderNum, |
||||
num yesterdayOrderNum, |
||||
num memberNum, |
||||
num lastWeekMemberNum, |
||||
num weekMemberNum, |
||||
num newMemberNum, |
||||
num yesterdayNewMemberNum, |
||||
}) => VipCountsInfo( dayMoney: dayMoney ?? _dayMoney, |
||||
yesterdayMoney: yesterdayMoney ?? _yesterdayMoney, |
||||
paySum: paySum ?? _paySum, |
||||
yesterdayPaySum: yesterdayPaySum ?? _yesterdayPaySum, |
||||
rechargeMoney: rechargeMoney ?? _rechargeMoney, |
||||
weekRechargeMoney: weekRechargeMoney ?? _weekRechargeMoney, |
||||
lastWeekRechargeMoney: lastWeekRechargeMoney ?? _lastWeekRechargeMoney, |
||||
orderNum: orderNum ?? _orderNum, |
||||
yesterdayOrderNum: yesterdayOrderNum ?? _yesterdayOrderNum, |
||||
memberNum: memberNum ?? _memberNum, |
||||
lastWeekMemberNum: lastWeekMemberNum ?? _lastWeekMemberNum, |
||||
weekMemberNum: weekMemberNum ?? _weekMemberNum, |
||||
newMemberNum: newMemberNum ?? _newMemberNum, |
||||
yesterdayNewMemberNum: yesterdayNewMemberNum ?? _yesterdayNewMemberNum, |
||||
); |
||||
String get dayMoney => _dayMoney; |
||||
String get yesterdayMoney => _yesterdayMoney; |
||||
String get paySum => _paySum; |
||||
String get yesterdayPaySum => _yesterdayPaySum; |
||||
String get rechargeMoney => _rechargeMoney; |
||||
String get weekRechargeMoney => _weekRechargeMoney; |
||||
String get lastWeekRechargeMoney => _lastWeekRechargeMoney; |
||||
num get orderNum => _orderNum; |
||||
num get yesterdayOrderNum => _yesterdayOrderNum; |
||||
num get memberNum => _memberNum; |
||||
num get lastWeekMemberNum => _lastWeekMemberNum; |
||||
num get weekMemberNum => _weekMemberNum; |
||||
num get newMemberNum => _newMemberNum; |
||||
num get yesterdayNewMemberNum => _yesterdayNewMemberNum; |
||||
|
||||
Map<String, dynamic> toJson() { |
||||
final map = <String, dynamic>{}; |
||||
map['dayMoney'] = _dayMoney; |
||||
map['yesterdayMoney'] = _yesterdayMoney; |
||||
map['paySum'] = _paySum; |
||||
map['yesterdayPaySum'] = _yesterdayPaySum; |
||||
map['rechargeMoney'] = _rechargeMoney; |
||||
map['weekRechargeMoney'] = _weekRechargeMoney; |
||||
map['lastWeekRechargeMoney'] = _lastWeekRechargeMoney; |
||||
map['orderNum'] = _orderNum; |
||||
map['yesterdayOrderNum'] = _yesterdayOrderNum; |
||||
map['memberNum'] = _memberNum; |
||||
map['lastWeekMemberNum'] = _lastWeekMemberNum; |
||||
map['weekMemberNum'] = _weekMemberNum; |
||||
map['newMemberNum'] = _newMemberNum; |
||||
map['yesterdayNewMemberNum'] = _yesterdayNewMemberNum; |
||||
return map; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,34 @@
|
||||
class BusinessInstance { |
||||
factory BusinessInstance() => _getInstance(); |
||||
|
||||
static BusinessInstance get instance => _getInstance(); |
||||
|
||||
static BusinessInstance _instance; |
||||
|
||||
String _businessToken; |
||||
|
||||
String _businessTenant; |
||||
|
||||
String get businessToken => _businessToken; |
||||
|
||||
set businessToken(String value) { |
||||
_businessToken = value; |
||||
} |
||||
|
||||
BusinessInstance._internal() { |
||||
//单例初始化 |
||||
} |
||||
|
||||
static BusinessInstance _getInstance() { |
||||
if (_instance == null) { |
||||
_instance = BusinessInstance._internal(); |
||||
} |
||||
return _instance; |
||||
} |
||||
|
||||
String get businessTenant => _businessTenant; |
||||
|
||||
set businessTenant(String value) { |
||||
_businessTenant = value; |
||||
} |
||||
} |