Showing
10 changed files
with
452 additions
and
164 deletions
lib/models/seller_counts_list.dart
0 → 100644
| 1 | +class SellerCountsListModel { | ||
| 2 | + int ret; | ||
| 3 | + List<SellerCountsListSunModel> data; | ||
| 4 | + String msg; | ||
| 5 | + | ||
| 6 | + SellerCountsListModel({this.ret, this.data, this.msg}); | ||
| 7 | + | ||
| 8 | + SellerCountsListModel.fromJson(Map<String, dynamic> json) { | ||
| 9 | + ret = json['ret']; | ||
| 10 | + if (json['data'] != null) { | ||
| 11 | + data = new List<SellerCountsListSunModel>(); | ||
| 12 | + json['data'].forEach((v) { | ||
| 13 | + data.add(new SellerCountsListSunModel.fromJson(v)); | ||
| 14 | + }); | ||
| 15 | + } | ||
| 16 | + msg = json['msg']; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + Map<String, dynamic> toJson() { | ||
| 20 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 21 | + data['ret'] = this.ret; | ||
| 22 | + if (this.data != null) { | ||
| 23 | + data['data'] = this.data.map((v) => v.toJson()).toList(); | ||
| 24 | + } | ||
| 25 | + data['msg'] = this.msg; | ||
| 26 | + return data; | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +class SellerCountsListSunModel { | ||
| 31 | + dynamic monthss; | ||
| 32 | + dynamic totalRserve; | ||
| 33 | + dynamic totalPnum; | ||
| 34 | + dynamic totalDao; | ||
| 35 | + dynamic totalCel; | ||
| 36 | + dynamic totalPrice; | ||
| 37 | + dynamic totalConsume; | ||
| 38 | + dynamic avgPrice; | ||
| 39 | + dynamic totalDaoKe; | ||
| 40 | + dynamic totalTable; | ||
| 41 | + dynamic daoTable; | ||
| 42 | + dynamic storeWine; | ||
| 43 | + dynamic order; | ||
| 44 | + dynamic plancook; | ||
| 45 | + dynamic agvTable; | ||
| 46 | + | ||
| 47 | + SellerCountsListSunModel( | ||
| 48 | + {this.monthss, | ||
| 49 | + this.totalRserve, | ||
| 50 | + this.totalPnum, | ||
| 51 | + this.totalDao, | ||
| 52 | + this.totalCel, | ||
| 53 | + this.totalPrice, | ||
| 54 | + this.totalConsume, | ||
| 55 | + this.avgPrice, | ||
| 56 | + this.totalDaoKe, | ||
| 57 | + this.totalTable, | ||
| 58 | + this.daoTable, | ||
| 59 | + this.storeWine, | ||
| 60 | + this.order, | ||
| 61 | + this.plancook, | ||
| 62 | + this.agvTable}); | ||
| 63 | + | ||
| 64 | + SellerCountsListSunModel.fromJson(Map<String, dynamic> json) { | ||
| 65 | + monthss = json['monthss']; | ||
| 66 | + totalRserve = json['totalRserve']; | ||
| 67 | + totalPnum = json['totalPnum']; | ||
| 68 | + totalDao = json['totalDao']; | ||
| 69 | + totalCel = json['totalCel']; | ||
| 70 | + totalPrice = json['totalPrice']; | ||
| 71 | + totalConsume = json['totalConsume']; | ||
| 72 | + avgPrice = json['avgPrice']; | ||
| 73 | + totalDaoKe = json['totalDaoKe']; | ||
| 74 | + totalTable = json['totalTable']; | ||
| 75 | + daoTable = json['daoTable']; | ||
| 76 | + storeWine = json['storeWine']; | ||
| 77 | + order = json['Order']; | ||
| 78 | + plancook = json['Plancook']; | ||
| 79 | + agvTable = json['agvTable']; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + Map<String, dynamic> toJson() { | ||
| 83 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 84 | + data['monthss'] = this.monthss; | ||
| 85 | + data['totalRserve'] = this.totalRserve; | ||
| 86 | + data['totalPnum'] = this.totalPnum; | ||
| 87 | + data['totalDao'] = this.totalDao; | ||
| 88 | + data['totalCel'] = this.totalCel; | ||
| 89 | + data['totalPrice'] = this.totalPrice; | ||
| 90 | + data['totalConsume'] = this.totalConsume; | ||
| 91 | + data['avgPrice'] = this.avgPrice; | ||
| 92 | + data['totalDaoKe'] = this.totalDaoKe; | ||
| 93 | + data['totalTable'] = this.totalTable; | ||
| 94 | + data['daoTable'] = this.daoTable; | ||
| 95 | + data['storeWine'] = this.storeWine; | ||
| 96 | + data['Order'] = this.order; | ||
| 97 | + data['Plancook'] = this.plancook; | ||
| 98 | + data['agvTable'] = this.agvTable; | ||
| 99 | + return data; | ||
| 100 | + } | ||
| 101 | +} |
| @@ -390,7 +390,6 @@ class HttpUrl { | @@ -390,7 +390,6 @@ class HttpUrl { | ||
| 390 | 390 | ||
| 391 | static const String set_confing = | 391 | static const String set_confing = |
| 392 | "?service=App.Reserve.SetConfing"; // 设置订座商家配置信息 | 392 | "?service=App.Reserve.SetConfing"; // 设置订座商家配置信息 |
| 393 | - | ||
| 394 | 393 | ||
| 395 | // static const String send_vc_code = | 394 | // static const String send_vc_code = |
| 396 | // "?service=App.SendSMS.SendVcCode"; // 向指定手机号码发送验证码 | 395 | // "?service=App.SendSMS.SendVcCode"; // 向指定手机号码发送验证码 |
| @@ -437,13 +436,13 @@ class HttpUrl { | @@ -437,13 +436,13 @@ class HttpUrl { | ||
| 437 | static const String get_is_examine_list = | 436 | static const String get_is_examine_list = |
| 438 | "?service=App.Activity.GetIsExamineList"; // 商家券核销列表 | 437 | "?service=App.Activity.GetIsExamineList"; // 商家券核销列表 |
| 439 | 438 | ||
| 440 | - | ||
| 441 | - static const String get_pay_message_by_id = | 439 | + static const String get_pay_message_by_id = |
| 442 | "?service=App.Activity.GetPayMessageByID"; // 充值成功通知消息获取详情 | 440 | "?service=App.Activity.GetPayMessageByID"; // 充值成功通知消息获取详情 |
| 443 | 441 | ||
| 444 | - | ||
| 445 | - static const String set_cook_book_order = | 442 | + static const String set_cook_book_order = |
| 446 | "?service=App.Cookbook.SetCookbookOrder"; // App设置菜品移动 | 443 | "?service=App.Cookbook.SetCookbookOrder"; // App设置菜品移动 |
| 447 | - | 444 | + |
| 445 | + static const String get_seller_counts_list = | ||
| 446 | + "?service=App.GuestManage.GetSellerCountsList"; // 获取全店全年订单统计数据 | ||
| 448 | 447 | ||
| 449 | } | 448 | } |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | +import 'package:one_key/models/seller_counts_list.dart'; | ||
| 3 | 4 | ||
| 4 | import '../../../res/colors.dart'; | 5 | import '../../../res/colors.dart'; |
| 5 | import '../../../utils/screen_util.dart'; | 6 | import '../../../utils/screen_util.dart'; |
| @@ -9,7 +10,8 @@ import '../../../widgets/h_empty_view.dart'; | @@ -9,7 +10,8 @@ import '../../../widgets/h_empty_view.dart'; | ||
| 9 | import '../../../widgets/v_empty_view.dart'; | 10 | import '../../../widgets/v_empty_view.dart'; |
| 10 | 11 | ||
| 11 | class MonthItem extends StatefulWidget { | 12 | class MonthItem extends StatefulWidget { |
| 12 | - MonthItem({Key key}) : super(key: key); | 13 | + final SellerCountsListSunModel countsListSunModel; |
| 14 | + MonthItem({Key key, this.countsListSunModel}) : super(key: key); | ||
| 13 | 15 | ||
| 14 | @override | 16 | @override |
| 15 | _MonthItemState createState() => _MonthItemState(); | 17 | _MonthItemState createState() => _MonthItemState(); |
| @@ -52,7 +54,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -52,7 +54,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 52 | mainAxisAlignment: MainAxisAlignment.spaceBetween, | 54 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 53 | children: [ | 55 | children: [ |
| 54 | Text( | 56 | Text( |
| 55 | - '4月', | 57 | + '${widget.countsListSunModel.monthss}月', |
| 56 | style: TextStyle( | 58 | style: TextStyle( |
| 57 | color: MyColours.color_515151, fontSize: font(18)), | 59 | color: MyColours.color_515151, fontSize: font(18)), |
| 58 | ), | 60 | ), |
| @@ -60,13 +62,13 @@ class _MonthItemState extends State<MonthItem> { | @@ -60,13 +62,13 @@ class _MonthItemState extends State<MonthItem> { | ||
| 60 | mainAxisAlignment: MainAxisAlignment.end, | 62 | mainAxisAlignment: MainAxisAlignment.end, |
| 61 | children: [ | 63 | children: [ |
| 62 | Text( | 64 | Text( |
| 63 | - '预订1089单', | 65 | + '预订${widget.countsListSunModel.totalRserve}单', |
| 64 | style: TextStyle( | 66 | style: TextStyle( |
| 65 | color: MyColours.color_515151, fontSize: font(14)), | 67 | color: MyColours.color_515151, fontSize: font(14)), |
| 66 | ), | 68 | ), |
| 67 | _space(), | 69 | _space(), |
| 68 | Text( | 70 | Text( |
| 69 | - '1190桌', | 71 | + '${widget.countsListSunModel.totalTable}桌', |
| 70 | style: TextStyle( | 72 | style: TextStyle( |
| 71 | color: MyColours.color_515151, fontSize: font(14)), | 73 | color: MyColours.color_515151, fontSize: font(14)), |
| 72 | ), | 74 | ), |
| @@ -87,7 +89,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -87,7 +89,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 87 | runSpacing: w(6), | 89 | runSpacing: w(6), |
| 88 | children: [ | 90 | children: [ |
| 89 | Text( | 91 | Text( |
| 90 | - '到店 1059单', | 92 | + '到店 ${widget.countsListSunModel.totalDao}单', |
| 91 | style: TextStyle( | 93 | style: TextStyle( |
| 92 | color: MyColours.color_515151, | 94 | color: MyColours.color_515151, |
| 93 | fontSize: font(12)), | 95 | fontSize: font(12)), |
| @@ -100,7 +102,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -100,7 +102,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 100 | ), | 102 | ), |
| 101 | HEmptyView(10), | 103 | HEmptyView(10), |
| 102 | Text( | 104 | Text( |
| 103 | - '1160桌', | 105 | + '${widget.countsListSunModel.daoTable}桌', |
| 104 | style: TextStyle( | 106 | style: TextStyle( |
| 105 | color: MyColours.color_515151, | 107 | color: MyColours.color_515151, |
| 106 | fontSize: font(12)), | 108 | fontSize: font(12)), |
| @@ -113,7 +115,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -113,7 +115,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 113 | ), | 115 | ), |
| 114 | HEmptyView(10), | 116 | HEmptyView(10), |
| 115 | Text( | 117 | Text( |
| 116 | - '8000人', | 118 | + '${widget.countsListSunModel.totalPnum}人', |
| 117 | style: TextStyle( | 119 | style: TextStyle( |
| 118 | color: MyColours.color_515151, | 120 | color: MyColours.color_515151, |
| 119 | fontSize: font(12)), | 121 | fontSize: font(12)), |
| @@ -126,7 +128,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -126,7 +128,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 126 | ), | 128 | ), |
| 127 | HEmptyView(10), | 129 | HEmptyView(10), |
| 128 | Text( | 130 | Text( |
| 129 | - '30取消', | 131 | + '${widget.countsListSunModel.totalCel}取消', |
| 130 | style: TextStyle( | 132 | style: TextStyle( |
| 131 | color: MyColours.color_515151, | 133 | color: MyColours.color_515151, |
| 132 | fontSize: font(12)), | 134 | fontSize: font(12)), |
| @@ -139,7 +141,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -139,7 +141,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 139 | ), | 141 | ), |
| 140 | HEmptyView(10), | 142 | HEmptyView(10), |
| 141 | Text( | 143 | Text( |
| 142 | - '到客97.2%', | 144 | + '到客${widget.countsListSunModel.totalDaoKe}', |
| 143 | style: TextStyle( | 145 | style: TextStyle( |
| 144 | color: MyColours.color_515151, | 146 | color: MyColours.color_515151, |
| 145 | fontSize: font(12)), | 147 | fontSize: font(12)), |
| @@ -154,7 +156,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -154,7 +156,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 154 | runSpacing: w(6), | 156 | runSpacing: w(6), |
| 155 | children: [ | 157 | children: [ |
| 156 | Text( | 158 | Text( |
| 157 | - '有金额订单数 6000', | 159 | + '有金额订单数 ${widget.countsListSunModel.totalPrice}', |
| 158 | style: TextStyle( | 160 | style: TextStyle( |
| 159 | color: MyColours.color_999999, | 161 | color: MyColours.color_999999, |
| 160 | fontSize: font( | 162 | fontSize: font( |
| @@ -169,7 +171,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -169,7 +171,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 169 | ), | 171 | ), |
| 170 | HEmptyView(10), | 172 | HEmptyView(10), |
| 171 | Text( | 173 | Text( |
| 172 | - '总消费 9585800.00元', | 174 | + '总消费 ${widget.countsListSunModel.totalConsume ?? 0}元', |
| 173 | style: TextStyle( | 175 | style: TextStyle( |
| 174 | color: MyColours.color_999999, | 176 | color: MyColours.color_999999, |
| 175 | fontSize: font( | 177 | fontSize: font( |
| @@ -186,7 +188,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -186,7 +188,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 186 | runSpacing: w(6), | 188 | runSpacing: w(6), |
| 187 | children: [ | 189 | children: [ |
| 188 | Text( | 190 | Text( |
| 189 | - '人均 8885.58元', | 191 | + '人均 ${widget.countsListSunModel.avgPrice ?? 0}元', |
| 190 | style: TextStyle( | 192 | style: TextStyle( |
| 191 | color: MyColours.color_999999, | 193 | color: MyColours.color_999999, |
| 192 | fontSize: font( | 194 | fontSize: font( |
| @@ -201,7 +203,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -201,7 +203,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 201 | ), | 203 | ), |
| 202 | HEmptyView(10), | 204 | HEmptyView(10), |
| 203 | Text( | 205 | Text( |
| 204 | - '桌均 95888.58元', | 206 | + '桌均 ${widget.countsListSunModel.agvTable ?? 0}元', |
| 205 | style: TextStyle( | 207 | style: TextStyle( |
| 206 | color: MyColours.color_999999, | 208 | color: MyColours.color_999999, |
| 207 | fontSize: font( | 209 | fontSize: font( |
| @@ -218,7 +220,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -218,7 +220,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 218 | runSpacing: w(6), | 220 | runSpacing: w(6), |
| 219 | children: [ | 221 | children: [ |
| 220 | Text( | 222 | Text( |
| 221 | - '存酒 8位', | 223 | + '存酒 ${widget.countsListSunModel.storeWine}位', |
| 222 | style: TextStyle( | 224 | style: TextStyle( |
| 223 | color: MyColours.color_999999, | 225 | color: MyColours.color_999999, |
| 224 | fontSize: font( | 226 | fontSize: font( |
| @@ -233,7 +235,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -233,7 +235,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 233 | ), | 235 | ), |
| 234 | HEmptyView(10), | 236 | HEmptyView(10), |
| 235 | Text( | 237 | Text( |
| 236 | - '提前点餐 9位', | 238 | + '提前点餐 ${widget.countsListSunModel.order}位', |
| 237 | style: TextStyle( | 239 | style: TextStyle( |
| 238 | color: MyColours.color_999999, | 240 | color: MyColours.color_999999, |
| 239 | fontSize: font( | 241 | fontSize: font( |
| @@ -248,7 +250,7 @@ class _MonthItemState extends State<MonthItem> { | @@ -248,7 +250,7 @@ class _MonthItemState extends State<MonthItem> { | ||
| 248 | ), | 250 | ), |
| 249 | HEmptyView(10), | 251 | HEmptyView(10), |
| 250 | Text( | 252 | Text( |
| 251 | - '安排菜 9位', | 253 | + '安排菜 ${widget.countsListSunModel.plancook}位', |
| 252 | style: TextStyle( | 254 | style: TextStyle( |
| 253 | color: MyColours.color_999999, | 255 | color: MyColours.color_999999, |
| 254 | fontSize: font( | 256 | fontSize: font( |
| @@ -19,6 +19,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | @@ -19,6 +19,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 19 | import 'package:one_key/widgets/v_empty_view.dart'; | 19 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 20 | import 'package:provider/provider.dart'; | 20 | import 'package:provider/provider.dart'; |
| 21 | 21 | ||
| 22 | +import '../../../../models/seller_counts_list.dart'; | ||
| 22 | import '../../../../utils/screen_util.dart'; | 23 | import '../../../../utils/screen_util.dart'; |
| 23 | import '../../../../widgets/MyDivider.dart'; | 24 | import '../../../../widgets/MyDivider.dart'; |
| 24 | import '../month_item.dart'; | 25 | import '../month_item.dart'; |
| @@ -41,20 +42,6 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | @@ -41,20 +42,6 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | ||
| 41 | 42 | ||
| 42 | int year; | 43 | int year; |
| 43 | 44 | ||
| 44 | - List<BarData> dataList = [ | ||
| 45 | - BarData(MyColours.color_8EBBBE, 200), | ||
| 46 | - BarData(MyColours.color_8EBBBE, 8), | ||
| 47 | - BarData(MyColours.color_8EBBBE, 15), | ||
| 48 | - BarData(MyColours.color_8EBBBE, 5), | ||
| 49 | - BarData(MyColours.color_8EBBBE, 2), | ||
| 50 | - BarData(MyColours.color_8EBBBE, 2), | ||
| 51 | - BarData(MyColours.color_8EBBBE, 18), | ||
| 52 | - BarData(MyColours.color_8EBBBE, 168), | ||
| 53 | - BarData(MyColours.color_8EBBBE, 15), | ||
| 54 | - BarData(MyColours.color_8EBBBE, 5), | ||
| 55 | - BarData(MyColours.color_8EBBBE, null ?? 0), | ||
| 56 | - BarData(MyColours.color_8EBBBE, 0), | ||
| 57 | - ]; | ||
| 58 | @override | 45 | @override |
| 59 | void initState() { | 46 | void initState() { |
| 60 | super.initState(); | 47 | super.initState(); |
| @@ -63,10 +50,12 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | @@ -63,10 +50,12 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | ||
| 63 | _couponNetworkData(); | 50 | _couponNetworkData(); |
| 64 | 51 | ||
| 65 | _getMarketingByUid(); | 52 | _getMarketingByUid(); |
| 53 | + _getSellerCountsList(); | ||
| 66 | }); | 54 | }); |
| 67 | bus.on("refresh_my_customer_home", (arg) { | 55 | bus.on("refresh_my_customer_home", (arg) { |
| 68 | _getGuestManageData(isShowLoading: false); | 56 | _getGuestManageData(isShowLoading: false); |
| 69 | _getMarketingByUid(); | 57 | _getMarketingByUid(); |
| 58 | + _getSellerCountsList(); | ||
| 70 | }); | 59 | }); |
| 71 | } | 60 | } |
| 72 | 61 | ||
| @@ -84,6 +73,21 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | @@ -84,6 +73,21 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | ||
| 84 | // setState(() {}); | 73 | // setState(() {}); |
| 85 | } | 74 | } |
| 86 | 75 | ||
| 76 | + _getSellerCountsList({isShowLoading = false, VoidCallback callback}) async { | ||
| 77 | + Map<String, String> params = { | ||
| 78 | + 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 79 | + 'year': year.toString(), | ||
| 80 | + 'uid': Provider.of<UserModel>(context, listen: false).user.openid | ||
| 81 | + }; | ||
| 82 | + await customerProvider.getSellerCountsList(context, params, | ||
| 83 | + isShowLoading: isShowLoading); | ||
| 84 | + if ((customerProvider.managerStatisticsList == null || | ||
| 85 | + customerProvider.managerStatisticsList.length == 0) && | ||
| 86 | + callback != null) { | ||
| 87 | + callback(); | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | + | ||
| 87 | ///消费券 | 91 | ///消费券 |
| 88 | _couponNetworkData({bool isShowLoading = true}) async { | 92 | _couponNetworkData({bool isShowLoading = true}) async { |
| 89 | // customerMakingProvider.couponSelectIndex = 0; | 93 | // customerMakingProvider.couponSelectIndex = 0; |
| @@ -140,16 +144,27 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | @@ -140,16 +144,27 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | ||
| 140 | children: [ | 144 | children: [ |
| 141 | InkWell( | 145 | InkWell( |
| 142 | onTap: () { | 146 | onTap: () { |
| 147 | + if (year == 2018) { | ||
| 148 | + return; | ||
| 149 | + } | ||
| 143 | setState(() { | 150 | setState(() { |
| 144 | year--; | 151 | year--; |
| 145 | }); | 152 | }); |
| 146 | - // _getGuestReserve(showLoading: true); | 153 | + _getSellerCountsList( |
| 154 | + isShowLoading: true, | ||
| 155 | + callback: () { | ||
| 156 | + setState(() { | ||
| 157 | + year++; | ||
| 158 | + }); | ||
| 159 | + }); | ||
| 147 | }, | 160 | }, |
| 148 | child: Padding( | 161 | child: Padding( |
| 149 | padding: | 162 | padding: |
| 150 | EdgeInsets.only(right: ScreenUtil().setWidth(20)), | 163 | EdgeInsets.only(right: ScreenUtil().setWidth(20)), |
| 151 | child: Image.asset( | 164 | child: Image.asset( |
| 152 | - Utils.getImgPath('c_arrow_left'), | 165 | + Utils.getImgPath(year == 2018 |
| 166 | + ? 'c_arrow_left_gray' | ||
| 167 | + : 'c_arrow_left'), | ||
| 153 | width: ScreenUtil().setWidth(24), | 168 | width: ScreenUtil().setWidth(24), |
| 154 | ))), | 169 | ))), |
| 155 | Text( | 170 | Text( |
| @@ -166,7 +181,13 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | @@ -166,7 +181,13 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | ||
| 166 | setState(() { | 181 | setState(() { |
| 167 | year++; | 182 | year++; |
| 168 | }); | 183 | }); |
| 169 | - // _getGuestReserve(showLoading: true); | 184 | + _getSellerCountsList( |
| 185 | + isShowLoading: true, | ||
| 186 | + callback: () { | ||
| 187 | + setState(() { | ||
| 188 | + year--; | ||
| 189 | + }); | ||
| 190 | + }); | ||
| 170 | }, | 191 | }, |
| 171 | child: Padding( | 192 | child: Padding( |
| 172 | padding: EdgeInsets.only( | 193 | padding: EdgeInsets.only( |
| @@ -186,7 +207,7 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | @@ -186,7 +207,7 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | ||
| 186 | height: w(177), | 207 | height: w(177), |
| 187 | child: LayoutBuilder(builder: (context, constraints) { | 208 | child: LayoutBuilder(builder: (context, constraints) { |
| 188 | return BarChartWidget( | 209 | return BarChartWidget( |
| 189 | - dataList: dataList, | 210 | + dataList: customerProvider.chartManagerDataList, |
| 190 | ); | 211 | ); |
| 191 | })) | 212 | })) |
| 192 | ], | 213 | ], |
| @@ -640,12 +661,15 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | @@ -640,12 +661,15 @@ class _MyCustomerHomePageState extends State<MyCustomerHomePage> { | ||
| 640 | }), | 661 | }), |
| 641 | _chart(), | 662 | _chart(), |
| 642 | ListView.builder( | 663 | ListView.builder( |
| 643 | - itemCount: 10, | 664 | + itemCount: customerProvider.managerStatisticsList.length, |
| 644 | shrinkWrap: true, | 665 | shrinkWrap: true, |
| 645 | controller: _controller, | 666 | controller: _controller, |
| 646 | padding: EdgeInsets.symmetric(horizontal: w(10)), | 667 | padding: EdgeInsets.symmetric(horizontal: w(10)), |
| 647 | itemBuilder: (context, index) { | 668 | itemBuilder: (context, index) { |
| 648 | - return MonthItem(); | 669 | + SellerCountsListSunModel countsListSunModel = |
| 670 | + customerProvider.managerStatisticsList[index]; | ||
| 671 | + return MonthItem( | ||
| 672 | + countsListSunModel: countsListSunModel); | ||
| 649 | }) | 673 | }) |
| 650 | ], | 674 | ], |
| 651 | ), | 675 | ), |
| @@ -84,9 +84,9 @@ class _BarChartWidgetState extends State<BarChartWidget> { | @@ -84,9 +84,9 @@ class _BarChartWidgetState extends State<BarChartWidget> { | ||
| 84 | } | 84 | } |
| 85 | 85 | ||
| 86 | Widget leftTitles(double value, TitleMeta meta) { | 86 | Widget leftTitles(double value, TitleMeta meta) { |
| 87 | - // if (value == meta.max) { | ||
| 88 | - // return Container(); | ||
| 89 | - // } | 87 | + if (value == meta.max) { |
| 88 | + return Container(); | ||
| 89 | + } | ||
| 90 | print(value); | 90 | print(value); |
| 91 | print(meta); | 91 | print(meta); |
| 92 | print(meta.max); | 92 | print(meta.max); |
| @@ -139,9 +139,12 @@ class _BarChartWidgetState extends State<BarChartWidget> { | @@ -139,9 +139,12 @@ class _BarChartWidgetState extends State<BarChartWidget> { | ||
| 139 | 139 | ||
| 140 | borderData: FlBorderData( | 140 | borderData: FlBorderData( |
| 141 | show: true, | 141 | show: true, |
| 142 | - border: Border.symmetric( | ||
| 143 | - horizontal: BorderSide(color: MyColours.color_DBDBDB, width: w(1)), | 142 | + border: Border( |
| 143 | + bottom: BorderSide(color: MyColours.color_DBDBDB, width: w(1)), | ||
| 144 | ), | 144 | ), |
| 145 | + // border: Border.symmetric( | ||
| 146 | + // horizontal: BorderSide(color: MyColours.color_DBDBDB, width: w(1)), | ||
| 147 | + // ), | ||
| 145 | ), | 148 | ), |
| 146 | barGroups: widget.dataList.asMap().entries.map((e) { | 149 | barGroups: widget.dataList.asMap().entries.map((e) { |
| 147 | final index = e.key; | 150 | final index = e.key; |
| @@ -159,6 +162,7 @@ class _BarChartWidgetState extends State<BarChartWidget> { | @@ -159,6 +162,7 @@ class _BarChartWidgetState extends State<BarChartWidget> { | ||
| 159 | // checkToShowHorizontalLine: (value) => value % 10 == 0, | 162 | // checkToShowHorizontalLine: (value) => value % 10 == 0, |
| 160 | getDrawingHorizontalLine: (value) => FlLine( | 163 | getDrawingHorizontalLine: (value) => FlLine( |
| 161 | color: MyColours.color_DBDBDB, | 164 | color: MyColours.color_DBDBDB, |
| 165 | + // color: Colors.red, | ||
| 162 | strokeWidth: w(1), | 166 | strokeWidth: w(1), |
| 163 | ), | 167 | ), |
| 164 | drawVerticalLine: false, | 168 | drawVerticalLine: false, |
| @@ -166,7 +170,7 @@ class _BarChartWidgetState extends State<BarChartWidget> { | @@ -166,7 +170,7 @@ class _BarChartWidgetState extends State<BarChartWidget> { | ||
| 166 | alignment: BarChartAlignment.spaceAround, | 170 | alignment: BarChartAlignment.spaceAround, |
| 167 | // maxY: 20, | 171 | // maxY: 20, |
| 168 | // minY: 0, | 172 | // minY: 0, |
| 169 | - // baselineY: | 173 | + // baselineY:20 |
| 170 | ), | 174 | ), |
| 171 | ); | 175 | ); |
| 172 | } | 176 | } |
| @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; | @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; | ||
| 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 2 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 3 | import 'package:one_key/constant/state.dart'; | 3 | import 'package:one_key/constant/state.dart'; |
| 4 | import 'package:one_key/models/marketing_by_seller_model.dart'; | 4 | import 'package:one_key/models/marketing_by_seller_model.dart'; |
| 5 | +import 'package:one_key/models/seller_counts_list.dart'; | ||
| 5 | import 'package:one_key/models/seller_info.dart'; | 6 | import 'package:one_key/models/seller_info.dart'; |
| 6 | import 'package:one_key/models/store_customer_home_model.dart'; | 7 | import 'package:one_key/models/store_customer_home_model.dart'; |
| 7 | import 'package:one_key/pages/my/customer_type/store_customer/bar_chart_page.dart'; | 8 | import 'package:one_key/pages/my/customer_type/store_customer/bar_chart_page.dart'; |
| @@ -23,7 +24,8 @@ import '../../../../utils/screen_util.dart'; | @@ -23,7 +24,8 @@ import '../../../../utils/screen_util.dart'; | ||
| 23 | import '../month_item.dart'; | 24 | import '../month_item.dart'; |
| 24 | 25 | ||
| 25 | class StoreCustomerHomeLeftPage extends StatefulWidget { | 26 | class StoreCustomerHomeLeftPage extends StatefulWidget { |
| 26 | - StoreCustomerHomeLeftPage({Key key}) : super(key: key); | 27 | + final CustomerProvider customerProvider; |
| 28 | + StoreCustomerHomeLeftPage({Key key, this.customerProvider}) : super(key: key); | ||
| 27 | 29 | ||
| 28 | @override | 30 | @override |
| 29 | _StoreCustomerHomeLeftPageState createState() => | 31 | _StoreCustomerHomeLeftPageState createState() => |
| @@ -32,24 +34,10 @@ class StoreCustomerHomeLeftPage extends StatefulWidget { | @@ -32,24 +34,10 @@ class StoreCustomerHomeLeftPage extends StatefulWidget { | ||
| 32 | 34 | ||
| 33 | class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | 35 | class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { |
| 34 | ScrollController _controller = ScrollController(); | 36 | ScrollController _controller = ScrollController(); |
| 35 | - CustomerProvider customerProvider; | 37 | + // widget.customerProvider widget.customerProvider; |
| 36 | bool showWarning = false; | 38 | bool showWarning = false; |
| 37 | int year; | 39 | int year; |
| 38 | int month; | 40 | int month; |
| 39 | - List<BarData> dataList = [ | ||
| 40 | - BarData(MyColours.color_8EBBBE, 200), | ||
| 41 | - BarData(MyColours.color_8EBBBE, 8), | ||
| 42 | - BarData(MyColours.color_8EBBBE, 15), | ||
| 43 | - BarData(MyColours.color_8EBBBE, 5), | ||
| 44 | - BarData(MyColours.color_8EBBBE, 2), | ||
| 45 | - BarData(MyColours.color_8EBBBE, 2), | ||
| 46 | - BarData(MyColours.color_8EBBBE, 18), | ||
| 47 | - BarData(MyColours.color_8EBBBE, 168), | ||
| 48 | - BarData(MyColours.color_8EBBBE, 15), | ||
| 49 | - BarData(MyColours.color_8EBBBE, 5), | ||
| 50 | - BarData(MyColours.color_8EBBBE, null ?? 0), | ||
| 51 | - BarData(MyColours.color_8EBBBE, 0), | ||
| 52 | - ]; | ||
| 53 | 41 | ||
| 54 | @override | 42 | @override |
| 55 | void initState() { | 43 | void initState() { |
| @@ -58,12 +46,14 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -58,12 +46,14 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 58 | year = DateTime.now().year; | 46 | year = DateTime.now().year; |
| 59 | month = DateTime.now().month; | 47 | month = DateTime.now().month; |
| 60 | WidgetsBinding.instance.addPostFrameCallback((_) { | 48 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 61 | - _getSellerGuestManage(); | 49 | + // _getSellerGuestManage(); |
| 62 | _getMarketingBySeller(); | 50 | _getMarketingBySeller(); |
| 51 | + _getSellerCountsList(); | ||
| 63 | }); | 52 | }); |
| 64 | bus.on("refresh_store_customer_home", (arg) { | 53 | bus.on("refresh_store_customer_home", (arg) { |
| 65 | _getMarketingBySeller(); | 54 | _getMarketingBySeller(); |
| 66 | - _getSellerGuestManage(); | 55 | + // _getSellerGuestManage(); |
| 56 | + _getSellerCountsList(); | ||
| 67 | }); | 57 | }); |
| 68 | } | 58 | } |
| 69 | 59 | ||
| @@ -77,7 +67,7 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -77,7 +67,7 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 77 | ///全店客情首页 | 67 | ///全店客情首页 |
| 78 | _getSellerGuestManage() async { | 68 | _getSellerGuestManage() async { |
| 79 | StoreCustomerHomeSunModel model = | 69 | StoreCustomerHomeSunModel model = |
| 80 | - await customerProvider.getSellerGuestManage(context); | 70 | + await widget.customerProvider.getSellerGuestManage(context); |
| 81 | // setState(() {}); | 71 | // setState(() {}); |
| 82 | } | 72 | } |
| 83 | 73 | ||
| @@ -86,7 +76,7 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -86,7 +76,7 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 86 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid | 76 | "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid |
| 87 | }; | 77 | }; |
| 88 | List<MarketingBySellerSunModel> list = | 78 | List<MarketingBySellerSunModel> list = |
| 89 | - await customerProvider.getMarketingBySeller(context, params); | 79 | + await widget.customerProvider.getMarketingBySeller(context, params); |
| 90 | if (list != null && list.length > 0) { | 80 | if (list != null && list.length > 0) { |
| 91 | bool temp = list.any((value) { | 81 | bool temp = list.any((value) { |
| 92 | return value.finishedStatus == '0'; | 82 | return value.finishedStatus == '0'; |
| @@ -95,7 +85,21 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -95,7 +85,21 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 95 | showWarning = temp; | 85 | showWarning = temp; |
| 96 | }); | 86 | }); |
| 97 | } | 87 | } |
| 98 | - // await customerProvider.searchData(customerProvider.controller.text); | 88 | + // await widget.customerProvider.searchData(widget.customerProvider.controller.text); |
| 89 | + } | ||
| 90 | + | ||
| 91 | + _getSellerCountsList({isShowLoading = false, VoidCallback callback}) async { | ||
| 92 | + Map<String, String> params = { | ||
| 93 | + 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 94 | + 'year': year.toString() | ||
| 95 | + }; | ||
| 96 | + await widget.customerProvider | ||
| 97 | + .getSellerCountsList(context, params, isShowLoading: isShowLoading); | ||
| 98 | + if ((widget.customerProvider.homeStatisticsList == null || | ||
| 99 | + widget.customerProvider.homeStatisticsList.length == 0) && | ||
| 100 | + callback != null) { | ||
| 101 | + callback(); | ||
| 102 | + } | ||
| 99 | } | 103 | } |
| 100 | 104 | ||
| 101 | ///活跃客户、沉睡客户、流失客户 | 105 | ///活跃客户、沉睡客户、流失客户 |
| @@ -332,16 +336,28 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -332,16 +336,28 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 332 | children: [ | 336 | children: [ |
| 333 | InkWell( | 337 | InkWell( |
| 334 | onTap: () { | 338 | onTap: () { |
| 339 | + if (year == 2018) { | ||
| 340 | + return; | ||
| 341 | + } | ||
| 335 | setState(() { | 342 | setState(() { |
| 336 | year--; | 343 | year--; |
| 337 | }); | 344 | }); |
| 345 | + _getSellerCountsList( | ||
| 346 | + isShowLoading: true, | ||
| 347 | + callback: () { | ||
| 348 | + setState(() { | ||
| 349 | + year++; | ||
| 350 | + }); | ||
| 351 | + }); | ||
| 338 | // _getGuestReserve(showLoading: true); | 352 | // _getGuestReserve(showLoading: true); |
| 339 | }, | 353 | }, |
| 340 | child: Padding( | 354 | child: Padding( |
| 341 | padding: | 355 | padding: |
| 342 | EdgeInsets.only(right: ScreenUtil().setWidth(20)), | 356 | EdgeInsets.only(right: ScreenUtil().setWidth(20)), |
| 343 | child: Image.asset( | 357 | child: Image.asset( |
| 344 | - Utils.getImgPath('c_arrow_left'), | 358 | + Utils.getImgPath(year == 2018 |
| 359 | + ? 'c_arrow_left_gray' | ||
| 360 | + : 'c_arrow_left'), | ||
| 345 | width: ScreenUtil().setWidth(24), | 361 | width: ScreenUtil().setWidth(24), |
| 346 | ))), | 362 | ))), |
| 347 | Text( | 363 | Text( |
| @@ -358,6 +374,13 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -358,6 +374,13 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 358 | setState(() { | 374 | setState(() { |
| 359 | year++; | 375 | year++; |
| 360 | }); | 376 | }); |
| 377 | + _getSellerCountsList( | ||
| 378 | + isShowLoading: true, | ||
| 379 | + callback: () { | ||
| 380 | + setState(() { | ||
| 381 | + year--; | ||
| 382 | + }); | ||
| 383 | + }); | ||
| 361 | // _getGuestReserve(showLoading: true); | 384 | // _getGuestReserve(showLoading: true); |
| 362 | }, | 385 | }, |
| 363 | child: Padding( | 386 | child: Padding( |
| @@ -378,7 +401,7 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -378,7 +401,7 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 378 | height: w(177), | 401 | height: w(177), |
| 379 | child: LayoutBuilder(builder: (context, constraints) { | 402 | child: LayoutBuilder(builder: (context, constraints) { |
| 380 | return BarChartWidget( | 403 | return BarChartWidget( |
| 381 | - dataList: dataList, | 404 | + dataList: widget.customerProvider.chartHomeDataList, |
| 382 | ); | 405 | ); |
| 383 | })) | 406 | })) |
| 384 | ], | 407 | ], |
| @@ -787,7 +810,7 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -787,7 +810,7 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 787 | 810 | ||
| 788 | @override | 811 | @override |
| 789 | Widget build(BuildContext context) { | 812 | Widget build(BuildContext context) { |
| 790 | - customerProvider = Provider.of<CustomerProvider>(context, listen: false); | 813 | + // widget.customerProvider = Provider.of<widget.customerProvider>(context, listen: true); |
| 791 | return Scaffold( | 814 | return Scaffold( |
| 792 | // backgroundColor: Color.fromRGBO(246, 248, 250, 1), | 815 | // backgroundColor: Color.fromRGBO(246, 248, 250, 1), |
| 793 | // appBar: SystemAppBar('全店客情', onTap: () { | 816 | // appBar: SystemAppBar('全店客情', onTap: () { |
| @@ -831,7 +854,7 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -831,7 +854,7 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 831 | mainAxisAlignment: MainAxisAlignment.center, | 854 | mainAxisAlignment: MainAxisAlignment.center, |
| 832 | children: [ | 855 | children: [ |
| 833 | Text( | 856 | Text( |
| 834 | - '${customerProvider.storeSunmodel.myCustomer}', | 857 | + '${widget.customerProvider.storeSunmodel.myCustomer}', |
| 835 | style: TextStyle( | 858 | style: TextStyle( |
| 836 | color: MyColours.color_438E93, | 859 | color: MyColours.color_438E93, |
| 837 | fontSize: ScreenUtil().setSp(64), | 860 | fontSize: ScreenUtil().setSp(64), |
| @@ -862,19 +885,19 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -862,19 +885,19 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 862 | Row( | 885 | Row( |
| 863 | children: [ | 886 | children: [ |
| 864 | _percentWidget( | 887 | _percentWidget( |
| 865 | - '${customerProvider.storeSunmodel.active.count}', | 888 | + '${widget.customerProvider.storeSunmodel.active.count}', |
| 866 | '活跃', | 889 | '活跃', |
| 867 | - '${customerProvider.storeSunmodel.active.scale}'), | 890 | + '${widget.customerProvider.storeSunmodel.active.scale}'), |
| 868 | HEmptyView(10), | 891 | HEmptyView(10), |
| 869 | _percentWidget( | 892 | _percentWidget( |
| 870 | - '${customerProvider.storeSunmodel.sleep.count}', | 893 | + '${widget.customerProvider.storeSunmodel.sleep.count}', |
| 871 | '60天未到店', | 894 | '60天未到店', |
| 872 | - '${customerProvider.storeSunmodel.sleep.scale}'), | 895 | + '${widget.customerProvider.storeSunmodel.sleep.scale}'), |
| 873 | HEmptyView(10), | 896 | HEmptyView(10), |
| 874 | _percentWidget( | 897 | _percentWidget( |
| 875 | - '${customerProvider.storeSunmodel.drain.count}', | 898 | + '${widget.customerProvider.storeSunmodel.drain.count}', |
| 876 | '120天未到店', | 899 | '120天未到店', |
| 877 | - '${customerProvider.storeSunmodel.drain.scale}'), | 900 | + '${widget.customerProvider.storeSunmodel.drain.scale}'), |
| 878 | ], | 901 | ], |
| 879 | ), | 902 | ), |
| 880 | // GridView.builder( | 903 | // GridView.builder( |
| @@ -915,8 +938,9 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -915,8 +938,9 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 915 | controller: _controller, | 938 | controller: _controller, |
| 916 | shrinkWrap: true, | 939 | shrinkWrap: true, |
| 917 | cacheExtent: ScreenUtil().setWidth(0), | 940 | cacheExtent: ScreenUtil().setWidth(0), |
| 918 | - itemCount: | ||
| 919 | - customerProvider.storeSunmodel.sellerUser.length + 1, | 941 | + itemCount: widget.customerProvider.storeSunmodel |
| 942 | + .sellerUser.length + | ||
| 943 | + 1, | ||
| 920 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | 944 | gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( |
| 921 | crossAxisCount: 3, | 945 | crossAxisCount: 3, |
| 922 | childAspectRatio: 1.05, | 946 | childAspectRatio: 1.05, |
| @@ -926,21 +950,21 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -926,21 +950,21 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 926 | // locationState = state; | 950 | // locationState = state; |
| 927 | if (index == 0) { | 951 | if (index == 0) { |
| 928 | return _managerWidget( | 952 | return _managerWidget( |
| 929 | - '${customerProvider.storeSunmodel.distribution}', | 953 | + '${widget.customerProvider.storeSunmodel.distribution}', |
| 930 | '未分配经理', | 954 | '未分配经理', |
| 931 | null); | 955 | null); |
| 932 | } | 956 | } |
| 933 | 957 | ||
| 934 | return _managerWidget( | 958 | return _managerWidget( |
| 935 | - '${customerProvider.storeSunmodel.sellerUser[index - 1].count}', | ||
| 936 | - customerProvider.storeSunmodel.sellerUser[index - 1] | ||
| 937 | - .account == | 959 | + '${widget.customerProvider.storeSunmodel.sellerUser[index - 1].count}', |
| 960 | + widget.customerProvider.storeSunmodel | ||
| 961 | + .sellerUser[index - 1].account == | ||
| 938 | null | 962 | null |
| 939 | ? '' | 963 | ? '' |
| 940 | - : '${customerProvider.storeSunmodel.sellerUser[index - 1].nickName ?? customerProvider.storeSunmodel.sellerUser[index - 1].account}', | 964 | + : '${widget.customerProvider.storeSunmodel.sellerUser[index - 1].nickName ?? widget.customerProvider.storeSunmodel.sellerUser[index - 1].account}', |
| 941 | null, | 965 | null, |
| 942 | - uid: customerProvider | ||
| 943 | - .storeSunmodel.sellerUser[index - 1].uid); | 966 | + uid: widget.customerProvider.storeSunmodel |
| 967 | + .sellerUser[index - 1].uid); | ||
| 944 | }), | 968 | }), |
| 945 | VEmptyView(10), | 969 | VEmptyView(10), |
| 946 | ListView.builder( | 970 | ListView.builder( |
| @@ -987,16 +1011,20 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | @@ -987,16 +1011,20 @@ class _StoreCustomerHomeLeftPageState extends State<StoreCustomerHomeLeftPage> { | ||
| 987 | // _monthWidget(), | 1011 | // _monthWidget(), |
| 988 | 1012 | ||
| 989 | ListView.builder( | 1013 | ListView.builder( |
| 990 | - itemCount: 10, | 1014 | + itemCount: |
| 1015 | + widget.customerProvider.homeStatisticsList.length, | ||
| 991 | shrinkWrap: true, | 1016 | shrinkWrap: true, |
| 992 | controller: _controller, | 1017 | controller: _controller, |
| 993 | padding: EdgeInsets.symmetric(horizontal: w(10)), | 1018 | padding: EdgeInsets.symmetric(horizontal: w(10)), |
| 994 | itemBuilder: (context, index) { | 1019 | itemBuilder: (context, index) { |
| 1020 | + SellerCountsListSunModel countsListSunModel = | ||
| 1021 | + widget.customerProvider.homeStatisticsList[index]; | ||
| 995 | return InkWell( | 1022 | return InkWell( |
| 996 | onTap: () { | 1023 | onTap: () { |
| 997 | NavigatorUtil.goMonthOrderPage(context); | 1024 | NavigatorUtil.goMonthOrderPage(context); |
| 998 | }, | 1025 | }, |
| 999 | - child: MonthItem()); | 1026 | + child: MonthItem( |
| 1027 | + countsListSunModel: countsListSunModel)); | ||
| 1000 | }), | 1028 | }), |
| 1001 | /** | 1029 | /** |
| 1002 | ListView.builder( | 1030 | ListView.builder( |
| @@ -4,7 +4,10 @@ import 'package:one_key/pages/my/customer_type/store_customer/store_customer_hom | @@ -4,7 +4,10 @@ import 'package:one_key/pages/my/customer_type/store_customer/store_customer_hom | ||
| 4 | import 'package:one_key/pages/my/customer_type/store_customer/store_customer_home_right_page.dart'; | 4 | import 'package:one_key/pages/my/customer_type/store_customer/store_customer_home_right_page.dart'; |
| 5 | import 'package:one_key/widgets/h_empty_view.dart'; | 5 | import 'package:one_key/widgets/h_empty_view.dart'; |
| 6 | import 'package:one_key/widgets/system_app_bar.dart'; | 6 | import 'package:one_key/widgets/system_app_bar.dart'; |
| 7 | +import 'package:provider/provider.dart'; | ||
| 7 | 8 | ||
| 9 | +import '../../../../models/store_customer_home_model.dart'; | ||
| 10 | +import '../../../../provider/customer_provider.dart'; | ||
| 8 | import '../../../../res/colors.dart'; | 11 | import '../../../../res/colors.dart'; |
| 9 | import '../../../../utils/screen_util.dart'; | 12 | import '../../../../utils/screen_util.dart'; |
| 10 | import '../../../../widgets/v_empty_view.dart'; | 13 | import '../../../../widgets/v_empty_view.dart'; |
| @@ -25,6 +28,7 @@ class _StoreCustomerHomePageState extends State<StoreCustomerHomePage> | @@ -25,6 +28,7 @@ class _StoreCustomerHomePageState extends State<StoreCustomerHomePage> | ||
| 25 | TabController tabController; | 28 | TabController tabController; |
| 26 | Color selectedColor = MyColours.color_ffffff; | 29 | Color selectedColor = MyColours.color_ffffff; |
| 27 | Color unSelectedColor = MyColours.color_BFC4D4; | 30 | Color unSelectedColor = MyColours.color_BFC4D4; |
| 31 | + CustomerProvider customerProvider; | ||
| 28 | 32 | ||
| 29 | @override | 33 | @override |
| 30 | void initState() { | 34 | void initState() { |
| @@ -40,10 +44,21 @@ class _StoreCustomerHomePageState extends State<StoreCustomerHomePage> | @@ -40,10 +44,21 @@ class _StoreCustomerHomePageState extends State<StoreCustomerHomePage> | ||
| 40 | // setState(() {}); | 44 | // setState(() {}); |
| 41 | // } | 45 | // } |
| 42 | }); | 46 | }); |
| 47 | + WidgetsBinding.instance.addPostFrameCallback((_) { | ||
| 48 | + _getSellerGuestManage(); | ||
| 49 | + }); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + ///全店客情首页 | ||
| 53 | + _getSellerGuestManage() async { | ||
| 54 | + StoreCustomerHomeSunModel model = | ||
| 55 | + await customerProvider.getSellerGuestManage(context); | ||
| 56 | + // setState(() {}); | ||
| 43 | } | 57 | } |
| 44 | 58 | ||
| 45 | @override | 59 | @override |
| 46 | Widget build(BuildContext context) { | 60 | Widget build(BuildContext context) { |
| 61 | + customerProvider = Provider.of<CustomerProvider>(context, listen: false); | ||
| 47 | return Scaffold( | 62 | return Scaffold( |
| 48 | appBar: SystemAppBar('全店客情'), | 63 | appBar: SystemAppBar('全店客情'), |
| 49 | body: Column( | 64 | body: Column( |
| @@ -99,11 +114,12 @@ class _StoreCustomerHomePageState extends State<StoreCustomerHomePage> | @@ -99,11 +114,12 @@ class _StoreCustomerHomePageState extends State<StoreCustomerHomePage> | ||
| 99 | // right: ScreenUtil().setWidth(32)), | 114 | // right: ScreenUtil().setWidth(32)), |
| 100 | // indicatorWeight: ScreenUtil().setWidth(6.0), | 115 | // indicatorWeight: ScreenUtil().setWidth(6.0), |
| 101 | )), | 116 | )), |
| 102 | - | ||
| 103 | Expanded( | 117 | Expanded( |
| 104 | child: TabBarView(controller: tabController, children: [ | 118 | child: TabBarView(controller: tabController, children: [ |
| 105 | - StoreCustomerHomeLeftPage(), | ||
| 106 | - StoreCustomerHomeRightPage() | 119 | + StoreCustomerHomeLeftPage( |
| 120 | + customerProvider: customerProvider, | ||
| 121 | + ), | ||
| 122 | + StoreCustomerHomeRightPage(customerProvider: customerProvider) | ||
| 107 | ]), | 123 | ]), |
| 108 | ), | 124 | ), |
| 109 | ], | 125 | ], |
| @@ -20,6 +20,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; | @@ -20,6 +20,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 20 | import 'package:provider/provider.dart'; | 20 | import 'package:provider/provider.dart'; |
| 21 | 21 | ||
| 22 | import '../../../../models/message_menu_model.dart'; | 22 | import '../../../../models/message_menu_model.dart'; |
| 23 | +import '../../../../models/seller_counts_list.dart'; | ||
| 23 | import '../../../../utils/screen_util.dart'; | 24 | import '../../../../utils/screen_util.dart'; |
| 24 | import '../../../../widgets/MyDivider.dart'; | 25 | import '../../../../widgets/MyDivider.dart'; |
| 25 | import '../month_item.dart'; | 26 | import '../month_item.dart'; |
| @@ -29,7 +30,9 @@ import '../store_customer/bar_chart_page.dart'; | @@ -29,7 +30,9 @@ import '../store_customer/bar_chart_page.dart'; | ||
| 29 | * | 30 | * |
| 30 | */ | 31 | */ |
| 31 | class StoreCustomerHomeRightPage extends StatefulWidget { | 32 | class StoreCustomerHomeRightPage extends StatefulWidget { |
| 32 | - StoreCustomerHomeRightPage({Key key}) : super(key: key); | 33 | + final CustomerProvider customerProvider; |
| 34 | + StoreCustomerHomeRightPage({Key key, this.customerProvider}) | ||
| 35 | + : super(key: key); | ||
| 33 | 36 | ||
| 34 | @override | 37 | @override |
| 35 | _StoreCustomerHomeRightPageState createState() => | 38 | _StoreCustomerHomeRightPageState createState() => |
| @@ -39,45 +42,42 @@ class StoreCustomerHomeRightPage extends StatefulWidget { | @@ -39,45 +42,42 @@ class StoreCustomerHomeRightPage extends StatefulWidget { | ||
| 39 | class _StoreCustomerHomeRightPageState | 42 | class _StoreCustomerHomeRightPageState |
| 40 | extends State<StoreCustomerHomeRightPage> { | 43 | extends State<StoreCustomerHomeRightPage> { |
| 41 | ScrollController _controller = ScrollController(); | 44 | ScrollController _controller = ScrollController(); |
| 42 | - CustomerProvider customerProvider; | 45 | + // widget.customerProvider widget.customerProvider; |
| 43 | bool showWarning = false; | 46 | bool showWarning = false; |
| 44 | 47 | ||
| 45 | int year; | 48 | int year; |
| 46 | 49 | ||
| 47 | - List<BarData> dataList = [ | ||
| 48 | - BarData(MyColours.color_8EBBBE, 200), | ||
| 49 | - BarData(MyColours.color_8EBBBE, 8), | ||
| 50 | - BarData(MyColours.color_8EBBBE, 15), | ||
| 51 | - BarData(MyColours.color_8EBBBE, 5), | ||
| 52 | - BarData(MyColours.color_8EBBBE, 2), | ||
| 53 | - BarData(MyColours.color_8EBBBE, 2), | ||
| 54 | - BarData(MyColours.color_8EBBBE, 18), | ||
| 55 | - BarData(MyColours.color_8EBBBE, 168), | ||
| 56 | - BarData(MyColours.color_8EBBBE, 15), | ||
| 57 | - BarData(MyColours.color_8EBBBE, 5), | ||
| 58 | - BarData(MyColours.color_8EBBBE, null ?? 0), | ||
| 59 | - BarData(MyColours.color_8EBBBE, 0), | ||
| 60 | - ]; | ||
| 61 | - | ||
| 62 | List<MessageMenuModel> menuTitle = []; | 50 | List<MessageMenuModel> menuTitle = []; |
| 63 | @override | 51 | @override |
| 64 | void initState() { | 52 | void initState() { |
| 65 | super.initState(); | 53 | super.initState(); |
| 66 | year = DateTime.now().year; | 54 | year = DateTime.now().year; |
| 67 | - for (int i = 0; i < 15; i++) { | 55 | + widget.customerProvider.storeSunmodel.sellerUser.forEach((element) { |
| 68 | MessageMenuModel messageMenuModel = MessageMenuModel(); | 56 | MessageMenuModel messageMenuModel = MessageMenuModel(); |
| 69 | - messageMenuModel.title = '${i}经理'; | ||
| 70 | - messageMenuModel.select = i == 0 ? true : false; | 57 | + messageMenuModel.uid = element.uid; |
| 58 | + messageMenuModel.title = element.nickName ?? element.account; | ||
| 59 | + messageMenuModel.select = false; | ||
| 71 | menuTitle.add(messageMenuModel); | 60 | menuTitle.add(messageMenuModel); |
| 61 | + }); | ||
| 62 | + if (menuTitle.length > 0) { | ||
| 63 | + menuTitle[0].select = true; | ||
| 72 | } | 64 | } |
| 65 | + // for (int i = 0; i < 15; i++) { | ||
| 66 | + // MessageMenuModel messageMenuModel = MessageMenuModel(); | ||
| 67 | + // messageMenuModel.title = '${i}经理'; | ||
| 68 | + // messageMenuModel.select = i == 0 ? true : false; | ||
| 69 | + // menuTitle.add(messageMenuModel); | ||
| 70 | + // } | ||
| 73 | WidgetsBinding.instance.addPostFrameCallback((_) { | 71 | WidgetsBinding.instance.addPostFrameCallback((_) { |
| 74 | _couponNetworkData(); | 72 | _couponNetworkData(); |
| 75 | 73 | ||
| 76 | _getMarketingByUid(); | 74 | _getMarketingByUid(); |
| 75 | + _getSellerCountsList(); | ||
| 77 | }); | 76 | }); |
| 78 | bus.on("refresh_my_customer_home", (arg) { | 77 | bus.on("refresh_my_customer_home", (arg) { |
| 79 | - _getGuestManageData(isShowLoading: false); | 78 | + // _getGuestManageData(isShowLoading: false); |
| 80 | _getMarketingByUid(); | 79 | _getMarketingByUid(); |
| 80 | + _getSellerCountsList(); | ||
| 81 | }); | 81 | }); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| @@ -88,9 +88,30 @@ class _StoreCustomerHomeRightPageState | @@ -88,9 +88,30 @@ class _StoreCustomerHomeRightPageState | ||
| 88 | super.dispose(); | 88 | super.dispose(); |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | + _getSellerCountsList({isShowLoading = false, VoidCallback callback}) async { | ||
| 92 | + String uid = ''; | ||
| 93 | + menuTitle.forEach((element) { | ||
| 94 | + if (element.select) { | ||
| 95 | + uid = element.uid; | ||
| 96 | + } | ||
| 97 | + }); | ||
| 98 | + Map<String, String> params = { | ||
| 99 | + 'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 100 | + 'year': year.toString(), | ||
| 101 | + 'uid': uid | ||
| 102 | + }; | ||
| 103 | + await widget.customerProvider | ||
| 104 | + .getSellerCountsList(context, params, isShowLoading: isShowLoading); | ||
| 105 | + if ((widget.customerProvider.managerStatisticsList == null || | ||
| 106 | + widget.customerProvider.managerStatisticsList.length == 0) && | ||
| 107 | + callback != null) { | ||
| 108 | + callback(); | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + | ||
| 91 | ///我的客户首页 | 112 | ///我的客户首页 |
| 92 | _getGuestManageData({bool isShowLoading = true}) async { | 113 | _getGuestManageData({bool isShowLoading = true}) async { |
| 93 | - GuestManageSunModel model = await customerProvider | 114 | + GuestManageSunModel model = await widget.customerProvider |
| 94 | .getGuestManageData(context, isShowLoading: isShowLoading); | 115 | .getGuestManageData(context, isShowLoading: isShowLoading); |
| 95 | // setState(() {}); | 116 | // setState(() {}); |
| 96 | } | 117 | } |
| @@ -101,16 +122,16 @@ class _StoreCustomerHomeRightPageState | @@ -101,16 +122,16 @@ class _StoreCustomerHomeRightPageState | ||
| 101 | Map<String, String> params = { | 122 | Map<String, String> params = { |
| 102 | "uid": Provider.of<UserModel>(context, listen: false).user.openid, | 123 | "uid": Provider.of<UserModel>(context, listen: false).user.openid, |
| 103 | }; | 124 | }; |
| 104 | - await customerProvider.getCustomerSelectActivityNew(context, params, | 125 | + await widget.customerProvider.getCustomerSelectActivityNew(context, params, |
| 105 | isShowLoading: isShowLoading); | 126 | isShowLoading: isShowLoading); |
| 106 | //此人已经新建好券 | 127 | //此人已经新建好券 |
| 107 | - // if (customerProvider.couponListSelect.length > 0) { | ||
| 108 | - // for (int i = 0; i < customerProvider.couponListSelect.length; i++) { | ||
| 109 | - // if (widget.sellerList.aid == customerProvider.couponListSelect[i].id) { | ||
| 110 | - // aidStr = customerProvider.couponListSelect[i].aname; | 128 | + // if (widget.customerProvider.couponListSelect.length > 0) { |
| 129 | + // for (int i = 0; i < widget.customerProvider.couponListSelect.length; i++) { | ||
| 130 | + // if (widget.sellerList.aid == widget.customerProvider.couponListSelect[i].id) { | ||
| 131 | + // aidStr = widget.customerProvider.couponListSelect[i].aname; | ||
| 111 | // } | 132 | // } |
| 112 | // } | 133 | // } |
| 113 | - // customerProvider.notifyListeners(); | 134 | + // widget.customerProvider.notifyListeners(); |
| 114 | // } else { | 135 | // } else { |
| 115 | // //没有新建的优惠券 | 136 | // //没有新建的优惠券 |
| 116 | // } | 137 | // } |
| @@ -121,10 +142,10 @@ class _StoreCustomerHomeRightPageState | @@ -121,10 +142,10 @@ class _StoreCustomerHomeRightPageState | ||
| 121 | Map<String, String> params = { | 142 | Map<String, String> params = { |
| 122 | "uid": Provider.of<UserModel>(context, listen: false).user.openid | 143 | "uid": Provider.of<UserModel>(context, listen: false).user.openid |
| 123 | }; | 144 | }; |
| 124 | - // await customerProvider.getMarketingByUid(context, params); | 145 | + // await widget.customerProvider.getMarketingByUid(context, params); |
| 125 | 146 | ||
| 126 | MarketingByUidsSunModel myRecordData = | 147 | MarketingByUidsSunModel myRecordData = |
| 127 | - await customerProvider.getMarketingByUid(context, params); | 148 | + await widget.customerProvider.getMarketingByUid(context, params); |
| 128 | if (myRecordData != null && myRecordData.sellerList.length > 0) { | 149 | if (myRecordData != null && myRecordData.sellerList.length > 0) { |
| 129 | bool temp = myRecordData.sellerList.any((value) { | 150 | bool temp = myRecordData.sellerList.any((value) { |
| 130 | return value.finishedStatus == '0'; | 151 | return value.finishedStatus == '0'; |
| @@ -133,7 +154,7 @@ class _StoreCustomerHomeRightPageState | @@ -133,7 +154,7 @@ class _StoreCustomerHomeRightPageState | ||
| 133 | showWarning = temp; | 154 | showWarning = temp; |
| 134 | }); | 155 | }); |
| 135 | } | 156 | } |
| 136 | - // await customerProvider.searchData(customerProvider.controller.text); | 157 | + // await widget.customerProvider.searchData(widget.customerProvider.controller.text); |
| 137 | } | 158 | } |
| 138 | 159 | ||
| 139 | Widget _chart() { | 160 | Widget _chart() { |
| @@ -151,16 +172,27 @@ class _StoreCustomerHomeRightPageState | @@ -151,16 +172,27 @@ class _StoreCustomerHomeRightPageState | ||
| 151 | children: [ | 172 | children: [ |
| 152 | InkWell( | 173 | InkWell( |
| 153 | onTap: () { | 174 | onTap: () { |
| 175 | + if (year == 2018) { | ||
| 176 | + return; | ||
| 177 | + } | ||
| 154 | setState(() { | 178 | setState(() { |
| 155 | year--; | 179 | year--; |
| 156 | }); | 180 | }); |
| 157 | - // _getGuestReserve(showLoading: true); | 181 | + _getSellerCountsList( |
| 182 | + isShowLoading: true, | ||
| 183 | + callback: () { | ||
| 184 | + setState(() { | ||
| 185 | + year++; | ||
| 186 | + }); | ||
| 187 | + }); | ||
| 158 | }, | 188 | }, |
| 159 | child: Padding( | 189 | child: Padding( |
| 160 | padding: | 190 | padding: |
| 161 | EdgeInsets.only(right: ScreenUtil().setWidth(20)), | 191 | EdgeInsets.only(right: ScreenUtil().setWidth(20)), |
| 162 | child: Image.asset( | 192 | child: Image.asset( |
| 163 | - Utils.getImgPath('c_arrow_left'), | 193 | + Utils.getImgPath(year == 2018 |
| 194 | + ? 'c_arrow_left_gray' | ||
| 195 | + : 'c_arrow_left'), | ||
| 164 | width: ScreenUtil().setWidth(24), | 196 | width: ScreenUtil().setWidth(24), |
| 165 | ))), | 197 | ))), |
| 166 | Text( | 198 | Text( |
| @@ -177,7 +209,13 @@ class _StoreCustomerHomeRightPageState | @@ -177,7 +209,13 @@ class _StoreCustomerHomeRightPageState | ||
| 177 | setState(() { | 209 | setState(() { |
| 178 | year++; | 210 | year++; |
| 179 | }); | 211 | }); |
| 180 | - // _getGuestReserve(showLoading: true); | 212 | + _getSellerCountsList( |
| 213 | + isShowLoading: true, | ||
| 214 | + callback: () { | ||
| 215 | + setState(() { | ||
| 216 | + year--; | ||
| 217 | + }); | ||
| 218 | + }); | ||
| 181 | }, | 219 | }, |
| 182 | child: Padding( | 220 | child: Padding( |
| 183 | padding: EdgeInsets.only( | 221 | padding: EdgeInsets.only( |
| @@ -197,8 +235,7 @@ class _StoreCustomerHomeRightPageState | @@ -197,8 +235,7 @@ class _StoreCustomerHomeRightPageState | ||
| 197 | height: w(177), | 235 | height: w(177), |
| 198 | child: LayoutBuilder(builder: (context, constraints) { | 236 | child: LayoutBuilder(builder: (context, constraints) { |
| 199 | return BarChartWidget( | 237 | return BarChartWidget( |
| 200 | - dataList: dataList, | ||
| 201 | - ); | 238 | + dataList: widget.customerProvider.chartManagerDataList); |
| 202 | })) | 239 | })) |
| 203 | ], | 240 | ], |
| 204 | ), | 241 | ), |
| @@ -292,7 +329,7 @@ class _StoreCustomerHomeRightPageState | @@ -292,7 +329,7 @@ class _StoreCustomerHomeRightPageState | ||
| 292 | 329 | ||
| 293 | @override | 330 | @override |
| 294 | Widget build(BuildContext context) { | 331 | Widget build(BuildContext context) { |
| 295 | - customerProvider = Provider.of<CustomerProvider>(context, listen: false); | 332 | + // widget.customerProvider = Provider.of<widget.customerProvider>(context, listen: true); |
| 296 | return Scaffold( | 333 | return Scaffold( |
| 297 | // backgroundColor: MyColours.color_f3f3f3, | 334 | // backgroundColor: MyColours.color_f3f3f3, |
| 298 | // appBar: SystemAppBar('我的客情', onTap: () { | 335 | // appBar: SystemAppBar('我的客情', onTap: () { |
| @@ -332,6 +369,9 @@ class _StoreCustomerHomeRightPageState | @@ -332,6 +369,9 @@ class _StoreCustomerHomeRightPageState | ||
| 332 | } | 369 | } |
| 333 | menuTitle[index].select = true; | 370 | menuTitle[index].select = true; |
| 334 | setState(() {}); | 371 | setState(() {}); |
| 372 | + _getSellerCountsList( | ||
| 373 | + isShowLoading: true, | ||
| 374 | + callback: () {}); | ||
| 335 | // offset = 0; | 375 | // offset = 0; |
| 336 | // 1提前点餐/2内部预订/10在线预订/15店内消息传/12在线买单 | 376 | // 1提前点餐/2内部预订/10在线预订/15店内消息传/12在线买单 |
| 337 | 377 | ||
| @@ -437,7 +477,7 @@ class _StoreCustomerHomeRightPageState | @@ -437,7 +477,7 @@ class _StoreCustomerHomeRightPageState | ||
| 437 | // fontSize: ScreenUtil().setSp(32)), | 477 | // fontSize: ScreenUtil().setSp(32)), |
| 438 | // ), | 478 | // ), |
| 439 | Text( | 479 | Text( |
| 440 | - '${customerProvider.guestSunmodel.myCustomer}', | 480 | + '${widget.customerProvider.guestSunmodel.myCustomer}', |
| 441 | style: TextStyle( | 481 | style: TextStyle( |
| 442 | color: MyColours.color_199095, | 482 | color: MyColours.color_199095, |
| 443 | fontSize: ScreenUtil().setSp(64), | 483 | fontSize: ScreenUtil().setSp(64), |
| @@ -467,44 +507,44 @@ class _StoreCustomerHomeRightPageState | @@ -467,44 +507,44 @@ class _StoreCustomerHomeRightPageState | ||
| 467 | // itemBuilder: (BuildContext context, int index) { | 507 | // itemBuilder: (BuildContext context, int index) { |
| 468 | // // locationState = state; | 508 | // // locationState = state; |
| 469 | // return _percentWidget( | 509 | // return _percentWidget( |
| 470 | - // '${customerProvider.guestSunmodel.active.count}', | 510 | + // '${widget.customerProvider.guestSunmodel.active.count}', |
| 471 | // '活跃客户', | 511 | // '活跃客户', |
| 472 | - // '${customerProvider.guestSunmodel.active.scale}'); | 512 | + // '${widget.customerProvider.guestSunmodel.active.scale}'); |
| 473 | // }), | 513 | // }), |
| 474 | Row( | 514 | Row( |
| 475 | children: [ | 515 | children: [ |
| 476 | _percentWidget( | 516 | _percentWidget( |
| 477 | - '${customerProvider.guestSunmodel.active.count}', | 517 | + '${widget.customerProvider.guestSunmodel.active.count}', |
| 478 | '活跃', | 518 | '活跃', |
| 479 | - '${customerProvider.guestSunmodel.active.scale}'), | 519 | + '${widget.customerProvider.guestSunmodel.active.scale}'), |
| 480 | HEmptyView(10), | 520 | HEmptyView(10), |
| 481 | _percentWidget( | 521 | _percentWidget( |
| 482 | - '${customerProvider.guestSunmodel.sleep.count}', | 522 | + '${widget.customerProvider.guestSunmodel.sleep.count}', |
| 483 | '60天未到店', | 523 | '60天未到店', |
| 484 | - '${customerProvider.guestSunmodel.sleep.scale}'), | 524 | + '${widget.customerProvider.guestSunmodel.sleep.scale}'), |
| 485 | HEmptyView(10), | 525 | HEmptyView(10), |
| 486 | _percentWidget( | 526 | _percentWidget( |
| 487 | - '${customerProvider.guestSunmodel.drain.count}', | 527 | + '${widget.customerProvider.guestSunmodel.drain.count}', |
| 488 | '120天未到店', | 528 | '120天未到店', |
| 489 | - '${customerProvider.guestSunmodel.drain.scale}'), | 529 | + '${widget.customerProvider.guestSunmodel.drain.scale}'), |
| 490 | ], | 530 | ], |
| 491 | ), | 531 | ), |
| 492 | ListView.builder( | 532 | ListView.builder( |
| 493 | controller: _controller, | 533 | controller: _controller, |
| 494 | shrinkWrap: true, | 534 | shrinkWrap: true, |
| 495 | cacheExtent: ScreenUtil().setWidth(0), | 535 | cacheExtent: ScreenUtil().setWidth(0), |
| 496 | - itemCount: | ||
| 497 | - customerProvider.guestSunmodel.tips.task == | ||
| 498 | - null || | ||
| 499 | - customerProvider.guestSunmodel.tips | ||
| 500 | - .task.length == | ||
| 501 | - 0 | ||
| 502 | - ? 0 | ||
| 503 | - : customerProvider | ||
| 504 | - .guestSunmodel.tips.task.length, | 536 | + itemCount: widget.customerProvider.guestSunmodel |
| 537 | + .tips.task == | ||
| 538 | + null || | ||
| 539 | + widget.customerProvider.guestSunmodel | ||
| 540 | + .tips.task.length == | ||
| 541 | + 0 | ||
| 542 | + ? 0 | ||
| 543 | + : widget.customerProvider.guestSunmodel.tips | ||
| 544 | + .task.length, | ||
| 505 | itemBuilder: (BuildContext context, int index) { | 545 | itemBuilder: (BuildContext context, int index) { |
| 506 | // locationState = state; | 546 | // locationState = state; |
| 507 | - Task data = customerProvider | 547 | + Task data = widget.customerProvider |
| 508 | .guestSunmodel.tips.task[index]; | 548 | .guestSunmodel.tips.task[index]; |
| 509 | return Column( | 549 | return Column( |
| 510 | children: [ | 550 | children: [ |
| @@ -638,11 +678,11 @@ class _StoreCustomerHomeRightPageState | @@ -638,11 +678,11 @@ class _StoreCustomerHomeRightPageState | ||
| 638 | controller: _controller, | 678 | controller: _controller, |
| 639 | shrinkWrap: true, | 679 | shrinkWrap: true, |
| 640 | cacheExtent: ScreenUtil().setWidth(0), | 680 | cacheExtent: ScreenUtil().setWidth(0), |
| 641 | - itemCount: customerProvider | ||
| 642 | - .guestSunmodel.tips.recover == | 681 | + itemCount: widget.customerProvider.guestSunmodel |
| 682 | + .tips.recover == | ||
| 643 | null || | 683 | null || |
| 644 | - customerProvider.guestSunmodel.tips | ||
| 645 | - .recover.length == | 684 | + widget.customerProvider.guestSunmodel |
| 685 | + .tips.recover.length == | ||
| 646 | 0 | 686 | 0 |
| 647 | ? 0 | 687 | ? 0 |
| 648 | : 1, | 688 | : 1, |
| @@ -668,7 +708,7 @@ class _StoreCustomerHomeRightPageState | @@ -668,7 +708,7 @@ class _StoreCustomerHomeRightPageState | ||
| 668 | HEmptyView(15), | 708 | HEmptyView(15), |
| 669 | Expanded( | 709 | Expanded( |
| 670 | child: Text( | 710 | child: Text( |
| 671 | - '${customerProvider.guestSunmodel.tips.recover[0]}', | 711 | + '${widget.customerProvider.guestSunmodel.tips.recover[0]}', |
| 672 | maxLines: 10, | 712 | maxLines: 10, |
| 673 | overflow: TextOverflow.ellipsis, | 713 | overflow: TextOverflow.ellipsis, |
| 674 | style: TextStyle( | 714 | style: TextStyle( |
| @@ -699,7 +739,8 @@ class _StoreCustomerHomeRightPageState | @@ -699,7 +739,8 @@ class _StoreCustomerHomeRightPageState | ||
| 699 | .FromPageMyCustomer, | 739 | .FromPageMyCustomer, |
| 700 | homeGid: Utils | 740 | homeGid: Utils |
| 701 | .listToStringEnglish1( | 741 | .listToStringEnglish1( |
| 702 | - customerProvider | 742 | + widget |
| 743 | + .customerProvider | ||
| 703 | .guestSunmodel | 744 | .guestSunmodel |
| 704 | .tips | 745 | .tips |
| 705 | .recover[1])); | 746 | .recover[1])); |
| @@ -715,11 +756,11 @@ class _StoreCustomerHomeRightPageState | @@ -715,11 +756,11 @@ class _StoreCustomerHomeRightPageState | ||
| 715 | controller: _controller, | 756 | controller: _controller, |
| 716 | shrinkWrap: true, | 757 | shrinkWrap: true, |
| 717 | cacheExtent: ScreenUtil().setWidth(0), | 758 | cacheExtent: ScreenUtil().setWidth(0), |
| 718 | - itemCount: customerProvider | ||
| 719 | - .guestSunmodel.tips.awaken == | 759 | + itemCount: widget.customerProvider.guestSunmodel |
| 760 | + .tips.awaken == | ||
| 720 | null || | 761 | null || |
| 721 | - customerProvider.guestSunmodel.tips | ||
| 722 | - .awaken.length == | 762 | + widget.customerProvider.guestSunmodel |
| 763 | + .tips.awaken.length == | ||
| 723 | 0 | 764 | 0 |
| 724 | ? 0 | 765 | ? 0 |
| 725 | : 1, | 766 | : 1, |
| @@ -745,7 +786,7 @@ class _StoreCustomerHomeRightPageState | @@ -745,7 +786,7 @@ class _StoreCustomerHomeRightPageState | ||
| 745 | HEmptyView(15), | 786 | HEmptyView(15), |
| 746 | Expanded( | 787 | Expanded( |
| 747 | child: Text( | 788 | child: Text( |
| 748 | - '${customerProvider.guestSunmodel.tips.awaken[0]}', | 789 | + '${widget.customerProvider.guestSunmodel.tips.awaken[0]}', |
| 749 | maxLines: 10, | 790 | maxLines: 10, |
| 750 | overflow: TextOverflow.ellipsis, | 791 | overflow: TextOverflow.ellipsis, |
| 751 | style: TextStyle( | 792 | style: TextStyle( |
| @@ -776,7 +817,8 @@ class _StoreCustomerHomeRightPageState | @@ -776,7 +817,8 @@ class _StoreCustomerHomeRightPageState | ||
| 776 | .FromPageMyCustomer, | 817 | .FromPageMyCustomer, |
| 777 | homeGid: Utils | 818 | homeGid: Utils |
| 778 | .listToStringEnglish1( | 819 | .listToStringEnglish1( |
| 779 | - customerProvider | 820 | + widget |
| 821 | + .customerProvider | ||
| 780 | .guestSunmodel | 822 | .guestSunmodel |
| 781 | .tips | 823 | .tips |
| 782 | .awaken[1])); | 824 | .awaken[1])); |
| @@ -790,13 +832,18 @@ class _StoreCustomerHomeRightPageState | @@ -790,13 +832,18 @@ class _StoreCustomerHomeRightPageState | ||
| 790 | }), | 832 | }), |
| 791 | _chart(), | 833 | _chart(), |
| 792 | ListView.builder( | 834 | ListView.builder( |
| 793 | - itemCount: 10, | 835 | + itemCount: widget.customerProvider |
| 836 | + .managerStatisticsList.length, | ||
| 794 | shrinkWrap: true, | 837 | shrinkWrap: true, |
| 795 | controller: _controller, | 838 | controller: _controller, |
| 796 | padding: | 839 | padding: |
| 797 | EdgeInsets.symmetric(horizontal: w(10)), | 840 | EdgeInsets.symmetric(horizontal: w(10)), |
| 798 | itemBuilder: (context, index) { | 841 | itemBuilder: (context, index) { |
| 799 | - return MonthItem(); | 842 | + SellerCountsListSunModel countsListSunModel = |
| 843 | + widget.customerProvider | ||
| 844 | + .managerStatisticsList[index]; | ||
| 845 | + return MonthItem( | ||
| 846 | + countsListSunModel: countsListSunModel); | ||
| 800 | }) | 847 | }) |
| 801 | ], | 848 | ], |
| 802 | ), | 849 | ), |
| @@ -29,6 +29,10 @@ import 'package:one_key/utils/utils.dart'; | @@ -29,6 +29,10 @@ import 'package:one_key/utils/utils.dart'; | ||
| 29 | import 'package:one_key/widgets/loading.dart'; | 29 | import 'package:one_key/widgets/loading.dart'; |
| 30 | import 'package:provider/provider.dart'; | 30 | import 'package:provider/provider.dart'; |
| 31 | 31 | ||
| 32 | +import '../models/seller_counts_list.dart'; | ||
| 33 | +import '../pages/my/customer_type/store_customer/bar_chart_page.dart'; | ||
| 34 | +import '../res/colors.dart'; | ||
| 35 | + | ||
| 32 | class CustomerProvider extends ChangeNotifier { | 36 | class CustomerProvider extends ChangeNotifier { |
| 33 | PageState pageState = PageState.Loading; | 37 | PageState pageState = PageState.Loading; |
| 34 | List<CustomerListSunModel> userHistorys = []; //客户列表(总) | 38 | List<CustomerListSunModel> userHistorys = []; //客户列表(总) |
| @@ -91,6 +95,69 @@ class CustomerProvider extends ChangeNotifier { | @@ -91,6 +95,69 @@ class CustomerProvider extends ChangeNotifier { | ||
| 91 | 95 | ||
| 92 | List pageData = []; | 96 | List pageData = []; |
| 93 | List pageDataMy = []; | 97 | List pageDataMy = []; |
| 98 | + | ||
| 99 | + List<SellerCountsListSunModel> homeStatisticsList = []; //全店客情首页统计数据 | ||
| 100 | + List<BarData> chartHomeDataList = []; | ||
| 101 | + | ||
| 102 | + List<SellerCountsListSunModel> managerStatisticsList = []; //经理客情首页统计数据 | ||
| 103 | + List<BarData> chartManagerDataList = []; | ||
| 104 | + | ||
| 105 | + ///获取全店全年订单统计数据 | ||
| 106 | + Future<List<SellerCountsListSunModel>> getSellerCountsList( | ||
| 107 | + BuildContext context, Map<String, String> params, | ||
| 108 | + {isShowLoading = true}) async { | ||
| 109 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 110 | + .request<dynamic>(context, Method.get, HttpUrl.get_seller_counts_list, | ||
| 111 | + data: params, showLoading: isShowLoading) | ||
| 112 | + .catchError((error) { | ||
| 113 | + print(error.toString()); | ||
| 114 | + if (error is MyError) { | ||
| 115 | + switch (error.type) { | ||
| 116 | + } | ||
| 117 | + } | ||
| 118 | + }); | ||
| 119 | + if (baseResp == null) return []; | ||
| 120 | + if (baseResp.code == Constant.status_success) { | ||
| 121 | + List<SellerCountsListSunModel> data = []; //经理客情首页统计数据 | ||
| 122 | + List<BarData> chartDataTemp = []; | ||
| 123 | + data = SellerCountsListModel.fromJson(baseResp.responseData).data; | ||
| 124 | + | ||
| 125 | + chartDataTemp = []; | ||
| 126 | + Map<String, double> chartData = {}; | ||
| 127 | + List<String> monthss = []; | ||
| 128 | + data.forEach((element) { | ||
| 129 | + // | ||
| 130 | + monthss.add(element.monthss.toString()); | ||
| 131 | + chartData[element.monthss.toString()] = | ||
| 132 | + double.parse(element.totalRserve.toString()); | ||
| 133 | + }); | ||
| 134 | + print(monthss); | ||
| 135 | + | ||
| 136 | + monthss.sort((a, b) => int.parse(a).compareTo(int.parse(b))); | ||
| 137 | + | ||
| 138 | + // monthss.reversed.toList(); | ||
| 139 | + print(monthss); | ||
| 140 | + for (int i = 0; i < monthss.length; i++) { | ||
| 141 | + String key = monthss[i]; | ||
| 142 | + chartDataTemp.add(BarData(MyColours.color_8EBBBE, chartData[key])); | ||
| 143 | + } | ||
| 144 | + if (params.keys.contains('uid')) { | ||
| 145 | + //经理请求数据 | ||
| 146 | + managerStatisticsList = data; | ||
| 147 | + chartManagerDataList = chartDataTemp; | ||
| 148 | + } else { | ||
| 149 | + homeStatisticsList = data; | ||
| 150 | + chartHomeDataList = chartDataTemp; | ||
| 151 | + } | ||
| 152 | + notifyListeners(); | ||
| 153 | + } else { | ||
| 154 | + if (baseResp != null) { | ||
| 155 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + return homeStatisticsList; | ||
| 159 | + } | ||
| 160 | + | ||
| 94 | //获取全选按钮的状态 true or false | 161 | //获取全选按钮的状态 true or false |
| 95 | getCheckhydSelAll() { | 162 | getCheckhydSelAll() { |
| 96 | bool temp = filterHydList.any((value) { | 163 | bool temp = filterHydList.any((value) { |
-
Please register or login to post a comment