Commit 71a705f0dc209aeb071d81cfccfca79498938d85

Authored by wdn127929
1 parent 4744584f

封装柱形图widget

  1 +import 'package:flutter/material.dart';
  2 +import 'package:fl_chart/fl_chart.dart';
  3 +
  4 +import '../../../../res/colors.dart';
  5 +import '../../../../utils/screen_util.dart';
  6 +
  7 +/**
  8 + * 柱形图
  9 + */
  10 +
  11 +class BarData {
  12 + const BarData(this.color, this.value);
  13 + final Color color;
  14 + final double value;
  15 +}
  16 +
  17 +class BarChartWidget extends StatefulWidget {
  18 + final List<BarData> dataList;
  19 + BarChartWidget({Key key, this.dataList}) : super(key: key);
  20 +
  21 + @override
  22 + _BarChartWidgetState createState() => _BarChartWidgetState();
  23 +}
  24 +
  25 +class _BarChartWidgetState extends State<BarChartWidget> {
  26 + BarChartGroupData generateBarGroup(
  27 + int x,
  28 + Color color,
  29 + double value,
  30 + ) {
  31 + return BarChartGroupData(
  32 + x: x,
  33 + barRods: [
  34 + BarChartRodData(
  35 + toY: value,
  36 + // gradient: _barsGradient,
  37 + color: color,
  38 + borderRadius: BorderRadius.zero,
  39 + width: w(13),
  40 + )
  41 + ],
  42 + showingTooltipIndicators: [0],
  43 + );
  44 + }
  45 +
  46 + BarTouchData get barTouchData => BarTouchData(
  47 + enabled: false,
  48 + touchTooltipData: BarTouchTooltipData(
  49 + tooltipBgColor: Colors.transparent,
  50 + tooltipPadding: EdgeInsets.zero,
  51 + tooltipMargin: w(0),
  52 + getTooltipItem: (
  53 + BarChartGroupData group,
  54 + int groupIndex,
  55 + BarChartRodData rod,
  56 + int rodIndex,
  57 + ) {
  58 + return BarTooltipItem(
  59 + // rod.toY.toString(),
  60 + rod.toY.round().toString(), //整数的话,可以这样显示
  61 + TextStyle(
  62 + fontSize: font(10),
  63 + color: MyColours.color_666666,
  64 + // fontWeight: FontWeight.bold,
  65 + ),
  66 + );
  67 + },
  68 + ),
  69 + );
  70 +
  71 + Widget getTitles(double value, TitleMeta meta) {
  72 + final style = TextStyle(
  73 + color: MyColours.color_999999,
  74 + fontSize: font(10),
  75 + );
  76 + String text;
  77 + switch (value.toInt()) {
  78 + case 0:
  79 + text = '1月';
  80 + break;
  81 + case 1:
  82 + text = '2月';
  83 + break;
  84 + case 2:
  85 + text = '3月';
  86 + break;
  87 + case 3:
  88 + text = '4月';
  89 + break;
  90 + case 4:
  91 + text = '5月';
  92 + break;
  93 + case 5:
  94 + text = '6月';
  95 + break;
  96 + case 6:
  97 + text = '7月';
  98 + break;
  99 + case 7:
  100 + text = '8月';
  101 + break;
  102 + case 8:
  103 + text = '9月';
  104 + break;
  105 + case 9:
  106 + text = '10月';
  107 + break;
  108 + case 10:
  109 + text = '11月';
  110 + break;
  111 + case 11:
  112 + text = '12月';
  113 + break;
  114 + default:
  115 + text = '';
  116 + break;
  117 + }
  118 + return SideTitleWidget(
  119 + axisSide: meta.axisSide,
  120 + space: w(6),
  121 + child: Text(text, style: style),
  122 + );
  123 + }
  124 +
  125 + Widget leftTitles(double value, TitleMeta meta) {
  126 + if (value == meta.max) {
  127 + return Container();
  128 + }
  129 + TextStyle style =
  130 + TextStyle(fontSize: font(10), color: MyColours.color_999999);
  131 + return SideTitleWidget(
  132 + axisSide: meta.axisSide,
  133 + space: w(6),
  134 + child: Text(
  135 + meta.formattedValue,
  136 + style: style,
  137 + textAlign: TextAlign.right,
  138 + ));
  139 + }
  140 +
  141 + FlTitlesData get titlesData => FlTitlesData(
  142 + show: true,
  143 + bottomTitles: AxisTitles(
  144 + sideTitles: SideTitles(
  145 + showTitles: true,
  146 + reservedSize: font(40),
  147 + getTitlesWidget: getTitles,
  148 + ),
  149 + ),
  150 + leftTitles: AxisTitles(
  151 + drawBehindEverything: true,
  152 + sideTitles: SideTitles(
  153 + showTitles: true,
  154 + reservedSize: w(30),
  155 + getTitlesWidget: leftTitles,
  156 + // interval: 5
  157 + ),
  158 + ),
  159 + topTitles: AxisTitles(
  160 + sideTitles: SideTitles(showTitles: false),
  161 + ),
  162 + rightTitles: AxisTitles(
  163 + sideTitles: SideTitles(showTitles: false),
  164 + ),
  165 + );
  166 +
  167 + FlBorderData get borderData => FlBorderData(
  168 + show: false,
  169 + );
  170 +
  171 + LinearGradient get _barsGradient => LinearGradient(
  172 + colors: [
  173 + MyColours.color_8EBBBE,
  174 + MyColours.color_8EBBBE,
  175 + ],
  176 + begin: Alignment.bottomCenter,
  177 + end: Alignment.topCenter,
  178 + );
  179 +
  180 + List<BarChartGroupData> getData(double barsWidth, double barsSpace) {
  181 + return [
  182 + BarChartGroupData(
  183 + x: 0,
  184 + barRods: [
  185 + BarChartRodData(
  186 + toY: 8,
  187 + // gradient: _barsGradient,
  188 + color: MyColours.color_8EBBBE,
  189 + borderRadius: BorderRadius.zero,
  190 + width: barsWidth,
  191 + )
  192 + ],
  193 + showingTooltipIndicators: [0],
  194 + ),
  195 + BarChartGroupData(
  196 + x: 1,
  197 + barRods: [
  198 + BarChartRodData(
  199 + toY: 10,
  200 + // gradient: _barsGradient,
  201 + borderRadius: BorderRadius.zero,
  202 + width: barsWidth,
  203 + color: MyColours.color_8EBBBE)
  204 + ],
  205 + showingTooltipIndicators: [0],
  206 + ),
  207 + BarChartGroupData(
  208 + x: 2,
  209 + barRods: [
  210 + BarChartRodData(
  211 + toY: 14,
  212 + borderRadius: BorderRadius.zero,
  213 + width: barsWidth,
  214 + // gradient: _barsGradient,
  215 + color: MyColours.color_8EBBBE)
  216 + ],
  217 + showingTooltipIndicators: [0],
  218 + ),
  219 + BarChartGroupData(
  220 + x: 3,
  221 + barRods: [
  222 + BarChartRodData(
  223 + toY: 15,
  224 + borderRadius: BorderRadius.zero,
  225 + width: barsWidth,
  226 + // gradient: _barsGradient,
  227 + color: MyColours.color_8EBBBE)
  228 + ],
  229 + showingTooltipIndicators: [0],
  230 + ),
  231 + BarChartGroupData(
  232 + x: 4,
  233 + barRods: [
  234 + BarChartRodData(
  235 + toY: 13,
  236 + borderRadius: BorderRadius.zero,
  237 + width: barsWidth,
  238 + // gradient: _barsGradient,
  239 + color: MyColours.color_8EBBBE)
  240 + ],
  241 + showingTooltipIndicators: [0],
  242 + ),
  243 + BarChartGroupData(
  244 + x: 5,
  245 + barRods: [
  246 + BarChartRodData(
  247 + toY: 10,
  248 + borderRadius: BorderRadius.zero,
  249 + width: barsWidth,
  250 + // gradient: _barsGradient,
  251 + color: MyColours.color_8EBBBE)
  252 + ],
  253 + showingTooltipIndicators: [0],
  254 + ),
  255 + BarChartGroupData(
  256 + x: 6,
  257 + barRods: [
  258 + BarChartRodData(
  259 + toY: 16,
  260 + borderRadius: BorderRadius.zero,
  261 + width: barsWidth,
  262 + // gradient: _barsGradient,
  263 + color: MyColours.color_8EBBBE)
  264 + ],
  265 + showingTooltipIndicators: [0],
  266 + ),
  267 + BarChartGroupData(
  268 + x: 7,
  269 + barRods: [
  270 + BarChartRodData(
  271 + toY: 16,
  272 + borderRadius: BorderRadius.zero,
  273 + width: barsWidth,
  274 + // gradient: _barsGradient,
  275 + color: MyColours.color_8EBBBE)
  276 + ],
  277 + showingTooltipIndicators: [0],
  278 + ),
  279 + BarChartGroupData(
  280 + x: 8,
  281 + barRods: [
  282 + BarChartRodData(
  283 + toY: 16,
  284 + borderRadius: BorderRadius.zero,
  285 + width: barsWidth,
  286 + // gradient: _barsGradient,
  287 + color: MyColours.color_8EBBBE)
  288 + ],
  289 + showingTooltipIndicators: [0],
  290 + ),
  291 + BarChartGroupData(
  292 + x: 9,
  293 + barRods: [
  294 + BarChartRodData(
  295 + toY: 16,
  296 + borderRadius: BorderRadius.zero,
  297 + width: barsWidth,
  298 + // gradient: _barsGradient,
  299 + color: MyColours.color_8EBBBE)
  300 + ],
  301 + showingTooltipIndicators: [0],
  302 + ),
  303 + BarChartGroupData(
  304 + x: 10,
  305 + barRods: [
  306 + BarChartRodData(
  307 + toY: 16,
  308 + borderRadius: BorderRadius.zero,
  309 + width: barsWidth,
  310 + // gradient: _barsGradient,
  311 + color: MyColours.color_8EBBBE)
  312 + ],
  313 + showingTooltipIndicators: [0],
  314 + ),
  315 + BarChartGroupData(
  316 + x: 11,
  317 + barRods: [
  318 + BarChartRodData(
  319 + toY: 16,
  320 + borderRadius: BorderRadius.zero,
  321 + width: barsWidth,
  322 + // gradient: _barsGradient,
  323 + color: MyColours.color_8EBBBE)
  324 + ],
  325 + showingTooltipIndicators: [0],
  326 + ),
  327 + ];
  328 + }
  329 +
  330 + @override
  331 + Widget build(BuildContext context) {
  332 + return BarChart(
  333 + BarChartData(
  334 + barTouchData: barTouchData,
  335 + titlesData: titlesData,
  336 + borderData: borderData,
  337 + barGroups: widget.dataList.asMap().entries.map((e) {
  338 + final index = e.key;
  339 + final data = e.value;
  340 + return generateBarGroup(
  341 + index,
  342 + data.color,
  343 + data.value,
  344 + );
  345 + }).toList(),
  346 + groupsSpace: w(10),
  347 + gridData: FlGridData(
  348 + show: true,
  349 + // checkToShowHorizontalLine: (value) => value % 10 == 0,
  350 + getDrawingHorizontalLine: (value) => FlLine(
  351 + color: MyColours.color_DBDBDB,
  352 + strokeWidth: w(1),
  353 + ),
  354 + drawVerticalLine: false,
  355 + ),
  356 + alignment: BarChartAlignment.spaceAround,
  357 + // maxY: 20,
  358 + // minY: 0,
  359 + // baselineY:
  360 + ),
  361 + );
  362 + }
  363 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +import 'package:one_key/constant/state.dart';
  4 +import 'package:one_key/models/marketing_by_seller_model.dart';
  5 +import 'package:one_key/models/seller_info.dart';
  6 +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/provider/customer_provider.dart';
  9 +import 'package:one_key/provider/user_model.dart';
  10 +import 'package:one_key/res/colors.dart';
  11 +import 'package:one_key/route/navigator_util.dart';
  12 +import 'package:one_key/utils/event_bus.dart';
  13 +import 'package:one_key/utils/utils.dart';
  14 +import 'package:one_key/widgets/h_empty_view.dart';
  15 +import 'package:one_key/widgets/page_exception.dart';
  16 +import 'package:one_key/widgets/round_button.dart';
  17 +import 'package:one_key/widgets/system_app_bar.dart';
  18 +import 'package:one_key/widgets/v_empty_view.dart';
  19 +import 'package:provider/provider.dart';
  20 +
  21 +import '../../../../utils/screen_util.dart';
  22 +
  23 +class StoreCustomerHomePage extends StatefulWidget {
  24 + StoreCustomerHomePage({Key key}) : super(key: key);
  25 +
  26 + @override
  27 + _StoreCustomerHomePageState createState() => _StoreCustomerHomePageState();
  28 +}
  29 +
  30 +class _StoreCustomerHomePageState extends State<StoreCustomerHomePage> {
  31 + ScrollController _controller = ScrollController();
  32 + CustomerProvider customerProvider;
  33 + bool showWarning = false;
  34 +
  35 + List<BarData> dataList = [
  36 + BarData(MyColours.color_8EBBBE, 188),
  37 + BarData(MyColours.color_8EBBBE, 8),
  38 + BarData(MyColours.color_8EBBBE, 15),
  39 + BarData(MyColours.color_8EBBBE, 5),
  40 + BarData(MyColours.color_8EBBBE, 2),
  41 + BarData(MyColours.color_8EBBBE, 2),
  42 + BarData(MyColours.color_8EBBBE, 18),
  43 + BarData(MyColours.color_8EBBBE, 8),
  44 + BarData(MyColours.color_8EBBBE, 15),
  45 + BarData(MyColours.color_8EBBBE, 5),
  46 + BarData(MyColours.color_8EBBBE, 2),
  47 + BarData(MyColours.color_8EBBBE, 2),
  48 + ];
  49 +
  50 + @override
  51 + void initState() {
  52 + super.initState();
  53 +
  54 + WidgetsBinding.instance.addPostFrameCallback((_) {
  55 + _getSellerGuestManage();
  56 + _getMarketingBySeller();
  57 + });
  58 + bus.on("refresh_store_customer_home", (arg) {
  59 + _getMarketingBySeller();
  60 + _getSellerGuestManage();
  61 + });
  62 + }
  63 +
  64 + @override
  65 + void dispose() {
  66 + bus.off('refresh_store_customer_home');
  67 + // bus.off("refresh_coupon_list");
  68 + super.dispose();
  69 + }
  70 +
  71 + ///全店客情首页
  72 + _getSellerGuestManage() async {
  73 + StoreCustomerHomeSunModel model =
  74 + await customerProvider.getSellerGuestManage(context);
  75 + // setState(() {});
  76 + }
  77 +
  78 + _getMarketingBySeller() async {
  79 + Map<String, String> params = {
  80 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid
  81 + };
  82 + List<MarketingBySellerSunModel> list =
  83 + await customerProvider.getMarketingBySeller(context, params);
  84 + if (list != null && list.length > 0) {
  85 + bool temp = list.any((value) {
  86 + return value.finishedStatus == '0';
  87 + });
  88 + setState(() {
  89 + showWarning = temp;
  90 + });
  91 + }
  92 + // await customerProvider.searchData(customerProvider.controller.text);
  93 + }
  94 +
  95 + ///活跃客户、沉睡客户、流失客户
  96 + Widget _percentWidget(String pnum, String btnTitle, String percent,
  97 + {String uid = ''}) {
  98 + return InkWell(
  99 + onTap: () async {
  100 + String index = '0';
  101 +
  102 + if (btnTitle == '活跃客户') {
  103 + index = '1';
  104 + } else if (btnTitle == '沉睡客户') {
  105 + index = '2';
  106 + } else if (btnTitle == '流失客户') {
  107 + index = '3';
  108 + }
  109 + if (btnTitle == '未分配') {
  110 + NavigatorUtil.goCustomerListPage(
  111 + context, FromPage.FromPageHome, uid,
  112 + index: index, distribution: true);
  113 + } else {
  114 + NavigatorUtil.goCustomerListPage(
  115 + context, FromPage.FromPageHome, uid,
  116 + index: index);
  117 + }
  118 + },
  119 + child: Container(
  120 + color: MyColours.color_ffffff,
  121 + // height: ScreenUtil().setWidth(230),
  122 + width: (ScreenUtil().screenWidth - ScreenUtil().setWidth(20)) / 3,
  123 + height: (ScreenUtil().screenWidth - ScreenUtil().setWidth(20)) / 3,
  124 + child: Column(
  125 + mainAxisAlignment: MainAxisAlignment.center,
  126 + children: [
  127 + Row(
  128 + mainAxisAlignment: MainAxisAlignment.center,
  129 + children: [
  130 + Text(pnum,
  131 + style: TextStyle(
  132 + color: MyColours.color_199095,
  133 + fontSize: ScreenUtil().setSp(40),
  134 + fontWeight: FontWeight.bold)),
  135 + Text('位',
  136 + style: TextStyle(
  137 + color: MyColours.color_199095,
  138 + fontSize: ScreenUtil().setSp(24),
  139 + ))
  140 + ],
  141 + ),
  142 + btnTitle == '' ? SizedBox() : VEmptyView(20),
  143 + btnTitle == ''
  144 + ? SizedBox()
  145 + : InkWell(
  146 + onTap: () async {
  147 + String index = '0';
  148 +
  149 + if (btnTitle == '活跃客户') {
  150 + index = '1';
  151 + } else if (btnTitle == '沉睡客户') {
  152 + index = '2';
  153 + } else if (btnTitle == '流失客户') {
  154 + index = '3';
  155 + }
  156 + if (btnTitle == '未分配') {
  157 + NavigatorUtil.goCustomerListPage(
  158 + context, FromPage.FromPageHome, uid,
  159 + index: index, distribution: true);
  160 + } else {
  161 + NavigatorUtil.goCustomerListPage(
  162 + context, FromPage.FromPageHome, uid,
  163 + index: index);
  164 + }
  165 + },
  166 + child: Container(
  167 + height: ScreenUtil().setWidth(45),
  168 + width: ScreenUtil().setWidth(160),
  169 + alignment: Alignment.center,
  170 + padding: EdgeInsets.symmetric(horizontal: w(10)),
  171 + decoration: BoxDecoration(
  172 + color: MyColours.color_ffffff,
  173 + border: Border.all(
  174 + width: w(1),
  175 + color: Color.fromRGBO(118, 118, 118, 1),
  176 + ),
  177 + borderRadius:
  178 + BorderRadius.circular(ScreenUtil().setWidth(30)),
  179 + ),
  180 + child: Text(
  181 + btnTitle,
  182 + maxLines: 1,
  183 + overflow: TextOverflow.ellipsis,
  184 + style: TextStyle(
  185 + color: MyColours.color_333333,
  186 + fontSize: font(12)),
  187 + ),
  188 + ))
  189 + // RoundButton(
  190 + // onPressed: () async {
  191 + // String index = '0';
  192 +
  193 + // if (btnTitle == '活跃客户') {
  194 + // index = '1';
  195 + // } else if (btnTitle == '沉睡客户') {
  196 + // index = '2';
  197 + // } else if (btnTitle == '流失客户') {
  198 + // index = '3';
  199 + // }
  200 + // NavigatorUtil.goCustomerListPage(
  201 + // context, FromPage.FromPageHome, uid,
  202 + // index: index);
  203 + // },
  204 + // text: btnTitle,
  205 + // fontSize: 24,
  206 + // isBold: false,
  207 + // textColor: MyColours.color_333333,
  208 + // gradientStart: MyColours.color_ffffff,
  209 + // gradientEnd: MyColours.color_ffffff,
  210 + // borderColor: Color.fromRGBO(118, 118, 118, 1),
  211 + // height: ScreenUtil().setWidth(45),
  212 + // width: ScreenUtil().setWidth(160),
  213 + // radius: ScreenUtil().setWidth(30),
  214 + // ),
  215 + ,
  216 + VEmptyView(16),
  217 + percent == null
  218 + ? SizedBox()
  219 + : Text('${percent}%',
  220 + style: TextStyle(
  221 + color: MyColours.color_199095,
  222 + fontSize: ScreenUtil().setSp(24),
  223 + )),
  224 + ],
  225 + ),
  226 + ));
  227 + }
  228 +
  229 + Widget _chart() {
  230 + return AspectRatio(
  231 + aspectRatio: 1.4,
  232 + child: Padding(
  233 + padding: EdgeInsets.all(w(20)),
  234 + child: LayoutBuilder(builder: (context, constraints) {
  235 + return BarChartWidget(
  236 + dataList: dataList,
  237 + );
  238 + })));
  239 + // return Container(
  240 + // height: w(143),
  241 + // child: BarChart(
  242 + // BarChartData(
  243 + // barTouchData: barTouchData,
  244 + // titlesData: titlesData,
  245 + // borderData: borderData,
  246 + // barGroups: barGroups,
  247 + // gridData: FlGridData(show: false),
  248 + // alignment: BarChartAlignment.spaceAround,
  249 + // maxY: 20,
  250 + // ),
  251 + // ));
  252 + }
  253 +
  254 + @override
  255 + Widget build(BuildContext context) {
  256 + customerProvider = Provider.of<CustomerProvider>(context, listen: false);
  257 + return Scaffold(
  258 + backgroundColor: Color.fromRGBO(246, 248, 250, 1),
  259 + appBar: SystemAppBar('全店客情', onTap: () {
  260 + EventBus().emit('changeStatusColor');
  261 + Navigator.pop(context);
  262 + }),
  263 + body: WillPopScope(onWillPop: () async {
  264 + EventBus().emit('changeStatusColor');
  265 + return true;
  266 + }, child: Consumer<CustomerProvider>(builder: (context, model, _) {
  267 + if (model.pageStateStoreHome != PageState.Success) {
  268 + return ExceptionPage(
  269 + pageState: model.pageStateStoreHome,
  270 + callback: () {
  271 + // getTableList();
  272 + _getSellerGuestManage();
  273 + },
  274 + emptyMsg: "暂时没有全店客情哦",
  275 + emptyImg: "empty_search",
  276 + showMsg: "加载中,请稍后...",
  277 + );
  278 + } else {
  279 + return Column(children: [
  280 + Expanded(
  281 + child: SingleChildScrollView(
  282 + controller: _controller,
  283 + child: Column(
  284 + children: [
  285 + VEmptyView(10),
  286 + Stack(
  287 + children: [
  288 + Container(
  289 + color: MyColours.color_ffffff,
  290 + padding: EdgeInsets.symmetric(
  291 + vertical: ScreenUtil().setWidth(30)),
  292 + child: Column(
  293 + children: [
  294 + Row(
  295 + mainAxisAlignment: MainAxisAlignment.center,
  296 + children: [
  297 + Text(
  298 + '${customerProvider.storeSunmodel.myCustomer}',
  299 + style: TextStyle(
  300 + color: MyColours.color_199095,
  301 + fontSize: ScreenUtil().setSp(60),
  302 + fontWeight: FontWeight.bold),
  303 + ),
  304 + Text(
  305 + '位',
  306 + style: TextStyle(
  307 + color: MyColours.color_199095,
  308 + fontWeight: FontWeight.bold,
  309 + fontSize: ScreenUtil().setSp(30)),
  310 + )
  311 + ],
  312 + ),
  313 + VEmptyView(10),
  314 + RoundButton(
  315 + onPressed: () async {
  316 + NavigatorUtil.goCustomerListPage(
  317 + context, FromPage.FromPageHome, '');
  318 + },
  319 + text: '全店客户',
  320 + fontSize: 24,
  321 + isBold: false,
  322 + textColor: MyColours.color_333333,
  323 + gradientStart: MyColours.color_ffffff,
  324 + gradientEnd: MyColours.color_ffffff,
  325 + borderColor: Color.fromRGBO(118, 118, 118, 1),
  326 + height: ScreenUtil().setWidth(45),
  327 + width: ScreenUtil().setWidth(160),
  328 + radius: ScreenUtil().setWidth(30),
  329 + )
  330 + ],
  331 + ),
  332 + ),
  333 + Positioned(
  334 + top: ScreenUtil().setWidth(30),
  335 + right: ScreenUtil().setWidth(40),
  336 + child: InkWell(
  337 + onTap: () {
  338 + NavigatorUtil.goCustomerSetPage(context);
  339 + },
  340 + child: Image.asset(Utils.getImgPath('c_set'),
  341 + width: ScreenUtil().setWidth(40))))
  342 + ],
  343 + ),
  344 + VEmptyView(10),
  345 + Row(
  346 + children: [
  347 + _percentWidget(
  348 + '${customerProvider.storeSunmodel.active.count}',
  349 + '活跃客户',
  350 + '${customerProvider.storeSunmodel.active.scale}'),
  351 + HEmptyView(10),
  352 + _percentWidget(
  353 + '${customerProvider.storeSunmodel.sleep.count}',
  354 + '沉睡客户',
  355 + '${customerProvider.storeSunmodel.sleep.scale}'),
  356 + HEmptyView(10),
  357 + _percentWidget(
  358 + '${customerProvider.storeSunmodel.drain.count}',
  359 + '流失客户',
  360 + '${customerProvider.storeSunmodel.drain.scale}'),
  361 + ],
  362 + ),
  363 + // GridView.builder(
  364 + // controller: _controller,
  365 + // shrinkWrap: true,
  366 + // cacheExtent: ScreenUtil().setWidth(0),
  367 + // itemCount: 3,
  368 + // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  369 + // crossAxisCount: 3,
  370 + // childAspectRatio: 1,
  371 + // mainAxisSpacing: ScreenUtil().setWidth(10),
  372 + // crossAxisSpacing: ScreenUtil().setWidth(10)),
  373 + // itemBuilder: (BuildContext context, int index) {
  374 + // // locationState = state;
  375 + // return _percentWidget('1999', '活跃客户', '39.20');
  376 + // }),
  377 + // Row(
  378 + // children: [
  379 + // _percentWidget('19992', '活跃客户', '90.90'),
  380 + // HEmptyView(10),
  381 + // _percentWidget('19992', '沉睡客户', '90.90'),
  382 + // HEmptyView(10),
  383 + // _percentWidget('19992', '流失客户', '5.90'),
  384 + // ],
  385 + // ),
  386 + Padding(
  387 + padding: EdgeInsets.symmetric(
  388 + vertical: ScreenUtil().setWidth(30)),
  389 + child: Text(
  390 + '客户经理',
  391 + style: TextStyle(
  392 + fontSize: ScreenUtil().setSp(28),
  393 + color: MyColours.color_333333),
  394 + ),
  395 + ),
  396 + GridView.builder(
  397 + controller: _controller,
  398 + shrinkWrap: true,
  399 + cacheExtent: ScreenUtil().setWidth(0),
  400 + itemCount:
  401 + customerProvider.storeSunmodel.sellerUser.length + 1,
  402 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  403 + crossAxisCount: 3,
  404 + childAspectRatio: 1,
  405 + mainAxisSpacing: ScreenUtil().setWidth(10),
  406 + crossAxisSpacing: ScreenUtil().setWidth(10)),
  407 + itemBuilder: (BuildContext context, int index) {
  408 + // locationState = state;
  409 + if (index == 0) {
  410 + return _percentWidget(
  411 + '${customerProvider.storeSunmodel.distribution}',
  412 + '未分配',
  413 + null);
  414 + }
  415 +
  416 + return _percentWidget(
  417 + '${customerProvider.storeSunmodel.sellerUser[index - 1].count}',
  418 + customerProvider.storeSunmodel.sellerUser[index - 1]
  419 + .account ==
  420 + null
  421 + ? ''
  422 + : '${customerProvider.storeSunmodel.sellerUser[index - 1].nickName ?? customerProvider.storeSunmodel.sellerUser[index - 1].account}经理',
  423 + null,
  424 + uid: customerProvider
  425 + .storeSunmodel.sellerUser[index - 1].uid);
  426 + }),
  427 + VEmptyView(100),
  428 + _chart()
  429 + ],
  430 + ),
  431 + )),
  432 + Padding(
  433 + padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),
  434 + child: Stack(
  435 + children: [
  436 + RoundButton(
  437 + onPressed: () {
  438 + NavigatorUtil.goMarketingRecordsPage(
  439 + context, FromPage.FromPageStoreCustomer);
  440 + },
  441 + text: '营销记录',
  442 + fontSize: 24,
  443 + isBold: false,
  444 + textColor: MyColours.color_199095,
  445 + gradientStart: MyColours.color_ffffff,
  446 + gradientEnd: MyColours.color_ffffff,
  447 + borderColor: MyColours.color_199095,
  448 + height: ScreenUtil().setWidth(75),
  449 + width: ScreenUtil().setWidth(260),
  450 + radius: ScreenUtil().setWidth(10),
  451 + ),
  452 + showWarning
  453 + ? Positioned(
  454 + right: ScreenUtil().setWidth(30),
  455 + top: ScreenUtil().setWidth(40 / 2),
  456 + child: Image.asset(
  457 + Utils.getImgPath('warning'),
  458 + width: ScreenUtil().setWidth(35),
  459 + ))
  460 + : SizedBox()
  461 + ],
  462 + ))
  463 + ]);
  464 + }
  465 + })),
  466 + );
  467 + }
  468 +}
1 -import 'package:flutter/material.dart';  
2 -import 'package:flutter_screenutil/flutter_screenutil.dart';  
3 -import 'package:one_key/constant/state.dart';  
4 -import 'package:one_key/models/marketing_by_seller_model.dart';  
5 -import 'package:one_key/models/seller_info.dart';  
6 -import 'package:one_key/models/store_customer_home_model.dart';  
7 -import 'package:one_key/provider/customer_provider.dart';  
8 -import 'package:one_key/provider/user_model.dart';  
9 -import 'package:one_key/res/colors.dart';  
10 -import 'package:one_key/route/navigator_util.dart';  
11 -import 'package:one_key/utils/event_bus.dart';  
12 -import 'package:one_key/utils/utils.dart';  
13 -import 'package:one_key/widgets/h_empty_view.dart';  
14 -import 'package:one_key/widgets/page_exception.dart';  
15 -import 'package:one_key/widgets/round_button.dart';  
16 -import 'package:one_key/widgets/system_app_bar.dart';  
17 -import 'package:one_key/widgets/v_empty_view.dart';  
18 -import 'package:provider/provider.dart'; 1 +// import 'package:flutter/material.dart';
  2 +// import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +// import 'package:one_key/constant/state.dart';
  4 +// import 'package:one_key/models/marketing_by_seller_model.dart';
  5 +// import 'package:one_key/models/seller_info.dart';
  6 +// import 'package:one_key/models/store_customer_home_model.dart';
  7 +// import 'package:one_key/provider/customer_provider.dart';
  8 +// import 'package:one_key/provider/user_model.dart';
  9 +// import 'package:one_key/res/colors.dart';
  10 +// import 'package:one_key/route/navigator_util.dart';
  11 +// import 'package:one_key/utils/event_bus.dart';
  12 +// import 'package:one_key/utils/utils.dart';
  13 +// import 'package:one_key/widgets/h_empty_view.dart';
  14 +// import 'package:one_key/widgets/page_exception.dart';
  15 +// import 'package:one_key/widgets/round_button.dart';
  16 +// import 'package:one_key/widgets/system_app_bar.dart';
  17 +// import 'package:one_key/widgets/v_empty_view.dart';
  18 +// import 'package:provider/provider.dart';
19 19
20 -import '../../../../utils/screen_util.dart'; 20 +// import '../../../../utils/screen_util.dart';
21 21
22 -class StoreCustomerPage extends StatefulWidget {  
23 - StoreCustomerPage({Key key}) : super(key: key); 22 +// class StoreCustomerPage extends StatefulWidget {
  23 +// StoreCustomerPage({Key key}) : super(key: key);
24 24
25 - @override  
26 - _StoreCustomerPageState createState() => _StoreCustomerPageState();  
27 -} 25 +// @override
  26 +// _StoreCustomerPageState createState() => _StoreCustomerPageState();
  27 +// }
28 28
29 -class _StoreCustomerPageState extends State<StoreCustomerPage> {  
30 - ScrollController _controller = ScrollController();  
31 - CustomerProvider customerProvider;  
32 - bool showWarning = false; 29 +// class _StoreCustomerPageState extends State<StoreCustomerPage> {
  30 +// ScrollController _controller = ScrollController();
  31 +// CustomerProvider customerProvider;
  32 +// bool showWarning = false;
33 33
34 - @override  
35 - void initState() {  
36 - super.initState(); 34 +// @override
  35 +// void initState() {
  36 +// super.initState();
37 37
38 - WidgetsBinding.instance.addPostFrameCallback((_) {  
39 - _getSellerGuestManage();  
40 - _getMarketingBySeller();  
41 - });  
42 - bus.on("refresh_store_customer_home", (arg) {  
43 - _getMarketingBySeller();  
44 - _getSellerGuestManage();  
45 - });  
46 - } 38 +// WidgetsBinding.instance.addPostFrameCallback((_) {
  39 +// _getSellerGuestManage();
  40 +// _getMarketingBySeller();
  41 +// });
  42 +// bus.on("refresh_store_customer_home", (arg) {
  43 +// _getMarketingBySeller();
  44 +// _getSellerGuestManage();
  45 +// });
  46 +// }
47 47
48 - @override  
49 - void dispose() {  
50 - bus.off('refresh_store_customer_home');  
51 - // bus.off("refresh_coupon_list");  
52 - super.dispose();  
53 - } 48 +// @override
  49 +// void dispose() {
  50 +// bus.off('refresh_store_customer_home');
  51 +// // bus.off("refresh_coupon_list");
  52 +// super.dispose();
  53 +// }
54 54
55 - ///全店客情首页  
56 - _getSellerGuestManage() async {  
57 - StoreCustomerHomeSunModel model =  
58 - await customerProvider.getSellerGuestManage(context);  
59 - // setState(() {});  
60 - } 55 +// ///全店客情首页
  56 +// _getSellerGuestManage() async {
  57 +// StoreCustomerHomeSunModel model =
  58 +// await customerProvider.getSellerGuestManage(context);
  59 +// // setState(() {});
  60 +// }
61 61
62 - _getMarketingBySeller() async {  
63 - Map<String, String> params = {  
64 - "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid  
65 - };  
66 - List<MarketingBySellerSunModel> list =  
67 - await customerProvider.getMarketingBySeller(context, params);  
68 - if (list != null && list.length > 0) {  
69 - bool temp = list.any((value) {  
70 - return value.finishedStatus == '0';  
71 - });  
72 - setState(() {  
73 - showWarning = temp;  
74 - });  
75 - }  
76 - // await customerProvider.searchData(customerProvider.controller.text);  
77 - } 62 +// _getMarketingBySeller() async {
  63 +// Map<String, String> params = {
  64 +// "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid
  65 +// };
  66 +// List<MarketingBySellerSunModel> list =
  67 +// await customerProvider.getMarketingBySeller(context, params);
  68 +// if (list != null && list.length > 0) {
  69 +// bool temp = list.any((value) {
  70 +// return value.finishedStatus == '0';
  71 +// });
  72 +// setState(() {
  73 +// showWarning = temp;
  74 +// });
  75 +// }
  76 +// // await customerProvider.searchData(customerProvider.controller.text);
  77 +// }
78 78
79 - ///活跃客户、沉睡客户、流失客户  
80 - Widget _percentWidget(String pnum, String btnTitle, String percent,  
81 - {String uid = ''}) {  
82 - return InkWell(  
83 - onTap: () async {  
84 - String index = '0'; 79 +// ///活跃客户、沉睡客户、流失客户
  80 +// Widget _percentWidget(String pnum, String btnTitle, String percent,
  81 +// {String uid = ''}) {
  82 +// return InkWell(
  83 +// onTap: () async {
  84 +// String index = '0';
85 85
86 - if (btnTitle == '活跃客户') {  
87 - index = '1';  
88 - } else if (btnTitle == '沉睡客户') {  
89 - index = '2';  
90 - } else if (btnTitle == '流失客户') {  
91 - index = '3';  
92 - }  
93 - if (btnTitle == '未分配') {  
94 - NavigatorUtil.goCustomerListPage(  
95 - context, FromPage.FromPageHome, uid,  
96 - index: index, distribution: true);  
97 - } else {  
98 - NavigatorUtil.goCustomerListPage(  
99 - context, FromPage.FromPageHome, uid,  
100 - index: index);  
101 - }  
102 - },  
103 - child: Container(  
104 - color: MyColours.color_ffffff,  
105 - // height: ScreenUtil().setWidth(230),  
106 - width: (ScreenUtil().screenWidth - ScreenUtil().setWidth(20)) / 3,  
107 - height: (ScreenUtil().screenWidth - ScreenUtil().setWidth(20)) / 3,  
108 - child: Column(  
109 - mainAxisAlignment: MainAxisAlignment.center,  
110 - children: [  
111 - Row(  
112 - mainAxisAlignment: MainAxisAlignment.center,  
113 - children: [  
114 - Text(pnum,  
115 - style: TextStyle(  
116 - color: MyColours.color_199095,  
117 - fontSize: ScreenUtil().setSp(40),  
118 - fontWeight: FontWeight.bold)),  
119 - Text('位',  
120 - style: TextStyle(  
121 - color: MyColours.color_199095,  
122 - fontSize: ScreenUtil().setSp(24),  
123 - ))  
124 - ],  
125 - ),  
126 - btnTitle == '' ? SizedBox() : VEmptyView(20),  
127 - btnTitle == ''  
128 - ? SizedBox()  
129 - : InkWell(  
130 - onTap: () async {  
131 - String index = '0'; 86 +// if (btnTitle == '活跃客户') {
  87 +// index = '1';
  88 +// } else if (btnTitle == '沉睡客户') {
  89 +// index = '2';
  90 +// } else if (btnTitle == '流失客户') {
  91 +// index = '3';
  92 +// }
  93 +// if (btnTitle == '未分配') {
  94 +// NavigatorUtil.goCustomerListPage(
  95 +// context, FromPage.FromPageHome, uid,
  96 +// index: index, distribution: true);
  97 +// } else {
  98 +// NavigatorUtil.goCustomerListPage(
  99 +// context, FromPage.FromPageHome, uid,
  100 +// index: index);
  101 +// }
  102 +// },
  103 +// child: Container(
  104 +// color: MyColours.color_ffffff,
  105 +// // height: ScreenUtil().setWidth(230),
  106 +// width: (ScreenUtil().screenWidth - ScreenUtil().setWidth(20)) / 3,
  107 +// height: (ScreenUtil().screenWidth - ScreenUtil().setWidth(20)) / 3,
  108 +// child: Column(
  109 +// mainAxisAlignment: MainAxisAlignment.center,
  110 +// children: [
  111 +// Row(
  112 +// mainAxisAlignment: MainAxisAlignment.center,
  113 +// children: [
  114 +// Text(pnum,
  115 +// style: TextStyle(
  116 +// color: MyColours.color_199095,
  117 +// fontSize: ScreenUtil().setSp(40),
  118 +// fontWeight: FontWeight.bold)),
  119 +// Text('位',
  120 +// style: TextStyle(
  121 +// color: MyColours.color_199095,
  122 +// fontSize: ScreenUtil().setSp(24),
  123 +// ))
  124 +// ],
  125 +// ),
  126 +// btnTitle == '' ? SizedBox() : VEmptyView(20),
  127 +// btnTitle == ''
  128 +// ? SizedBox()
  129 +// : InkWell(
  130 +// onTap: () async {
  131 +// String index = '0';
132 132
133 - if (btnTitle == '活跃客户') {  
134 - index = '1';  
135 - } else if (btnTitle == '沉睡客户') {  
136 - index = '2';  
137 - } else if (btnTitle == '流失客户') {  
138 - index = '3';  
139 - }  
140 - if (btnTitle == '未分配') {  
141 - NavigatorUtil.goCustomerListPage(  
142 - context, FromPage.FromPageHome, uid,  
143 - index: index, distribution: true);  
144 - } else {  
145 - NavigatorUtil.goCustomerListPage(  
146 - context, FromPage.FromPageHome, uid,  
147 - index: index);  
148 - }  
149 - },  
150 - child: Container(  
151 - height: ScreenUtil().setWidth(45),  
152 - width: ScreenUtil().setWidth(160),  
153 - alignment: Alignment.center,  
154 - padding: EdgeInsets.symmetric(horizontal: w(10)),  
155 - decoration: BoxDecoration(  
156 - color: MyColours.color_ffffff,  
157 - border: Border.all(  
158 - width: w(1),  
159 - color: Color.fromRGBO(118, 118, 118, 1),  
160 - ),  
161 - borderRadius:  
162 - BorderRadius.circular(ScreenUtil().setWidth(30)),  
163 - ),  
164 - child: Text(  
165 - btnTitle,  
166 - maxLines: 1,  
167 - overflow: TextOverflow.ellipsis,  
168 - style: TextStyle(  
169 - color: MyColours.color_333333,  
170 - fontSize: font(12)),  
171 - ),  
172 - ))  
173 - // RoundButton(  
174 - // onPressed: () async {  
175 - // String index = '0'; 133 +// if (btnTitle == '活跃客户') {
  134 +// index = '1';
  135 +// } else if (btnTitle == '沉睡客户') {
  136 +// index = '2';
  137 +// } else if (btnTitle == '流失客户') {
  138 +// index = '3';
  139 +// }
  140 +// if (btnTitle == '未分配') {
  141 +// NavigatorUtil.goCustomerListPage(
  142 +// context, FromPage.FromPageHome, uid,
  143 +// index: index, distribution: true);
  144 +// } else {
  145 +// NavigatorUtil.goCustomerListPage(
  146 +// context, FromPage.FromPageHome, uid,
  147 +// index: index);
  148 +// }
  149 +// },
  150 +// child: Container(
  151 +// height: ScreenUtil().setWidth(45),
  152 +// width: ScreenUtil().setWidth(160),
  153 +// alignment: Alignment.center,
  154 +// padding: EdgeInsets.symmetric(horizontal: w(10)),
  155 +// decoration: BoxDecoration(
  156 +// color: MyColours.color_ffffff,
  157 +// border: Border.all(
  158 +// width: w(1),
  159 +// color: Color.fromRGBO(118, 118, 118, 1),
  160 +// ),
  161 +// borderRadius:
  162 +// BorderRadius.circular(ScreenUtil().setWidth(30)),
  163 +// ),
  164 +// child: Text(
  165 +// btnTitle,
  166 +// maxLines: 1,
  167 +// overflow: TextOverflow.ellipsis,
  168 +// style: TextStyle(
  169 +// color: MyColours.color_333333,
  170 +// fontSize: font(12)),
  171 +// ),
  172 +// ))
  173 +// // RoundButton(
  174 +// // onPressed: () async {
  175 +// // String index = '0';
176 176
177 - // if (btnTitle == '活跃客户') {  
178 - // index = '1';  
179 - // } else if (btnTitle == '沉睡客户') {  
180 - // index = '2';  
181 - // } else if (btnTitle == '流失客户') {  
182 - // index = '3';  
183 - // }  
184 - // NavigatorUtil.goCustomerListPage(  
185 - // context, FromPage.FromPageHome, uid,  
186 - // index: index);  
187 - // },  
188 - // text: btnTitle,  
189 - // fontSize: 24,  
190 - // isBold: false,  
191 - // textColor: MyColours.color_333333,  
192 - // gradientStart: MyColours.color_ffffff,  
193 - // gradientEnd: MyColours.color_ffffff,  
194 - // borderColor: Color.fromRGBO(118, 118, 118, 1),  
195 - // height: ScreenUtil().setWidth(45),  
196 - // width: ScreenUtil().setWidth(160),  
197 - // radius: ScreenUtil().setWidth(30),  
198 - // ),  
199 - ,  
200 - VEmptyView(16),  
201 - percent == null  
202 - ? SizedBox()  
203 - : Text('${percent}%',  
204 - style: TextStyle(  
205 - color: MyColours.color_199095,  
206 - fontSize: ScreenUtil().setSp(24),  
207 - )),  
208 - ],  
209 - ),  
210 - ));  
211 - } 177 +// // if (btnTitle == '活跃客户') {
  178 +// // index = '1';
  179 +// // } else if (btnTitle == '沉睡客户') {
  180 +// // index = '2';
  181 +// // } else if (btnTitle == '流失客户') {
  182 +// // index = '3';
  183 +// // }
  184 +// // NavigatorUtil.goCustomerListPage(
  185 +// // context, FromPage.FromPageHome, uid,
  186 +// // index: index);
  187 +// // },
  188 +// // text: btnTitle,
  189 +// // fontSize: 24,
  190 +// // isBold: false,
  191 +// // textColor: MyColours.color_333333,
  192 +// // gradientStart: MyColours.color_ffffff,
  193 +// // gradientEnd: MyColours.color_ffffff,
  194 +// // borderColor: Color.fromRGBO(118, 118, 118, 1),
  195 +// // height: ScreenUtil().setWidth(45),
  196 +// // width: ScreenUtil().setWidth(160),
  197 +// // radius: ScreenUtil().setWidth(30),
  198 +// // ),
  199 +// ,
  200 +// VEmptyView(16),
  201 +// percent == null
  202 +// ? SizedBox()
  203 +// : Text('${percent}%',
  204 +// style: TextStyle(
  205 +// color: MyColours.color_199095,
  206 +// fontSize: ScreenUtil().setSp(24),
  207 +// )),
  208 +// ],
  209 +// ),
  210 +// ));
  211 +// }
212 212
213 - @override  
214 - Widget build(BuildContext context) {  
215 - customerProvider = Provider.of<CustomerProvider>(context, listen: false);  
216 - return Scaffold(  
217 - backgroundColor: Color.fromRGBO(246, 248, 250, 1),  
218 - appBar: SystemAppBar('全店客情', onTap: () {  
219 - EventBus().emit('changeStatusColor');  
220 - Navigator.pop(context);  
221 - }),  
222 - body: WillPopScope(onWillPop: () async {  
223 - EventBus().emit('changeStatusColor');  
224 - return true;  
225 - }, child: Consumer<CustomerProvider>(builder: (context, model, _) {  
226 - if (model.pageStateStoreHome != PageState.Success) {  
227 - return ExceptionPage(  
228 - pageState: model.pageStateStoreHome,  
229 - callback: () {  
230 - // getTableList();  
231 - _getSellerGuestManage();  
232 - },  
233 - emptyMsg: "暂时没有全店客情哦",  
234 - emptyImg: "empty_search",  
235 - showMsg: "加载中,请稍后...",  
236 - );  
237 - } else {  
238 - return Column(children: [  
239 - Expanded(  
240 - child: SingleChildScrollView(  
241 - controller: _controller,  
242 - child: Column(  
243 - children: [  
244 - VEmptyView(10),  
245 - Stack(  
246 - children: [  
247 - Container(  
248 - color: MyColours.color_ffffff,  
249 - padding: EdgeInsets.symmetric(  
250 - vertical: ScreenUtil().setWidth(30)),  
251 - child: Column(  
252 - children: [  
253 - Row(  
254 - mainAxisAlignment: MainAxisAlignment.center,  
255 - children: [  
256 - Text(  
257 - '${customerProvider.storeSunmodel.myCustomer}',  
258 - style: TextStyle(  
259 - color: MyColours.color_199095,  
260 - fontSize: ScreenUtil().setSp(60),  
261 - fontWeight: FontWeight.bold),  
262 - ),  
263 - Text(  
264 - '位',  
265 - style: TextStyle(  
266 - color: MyColours.color_199095,  
267 - fontWeight: FontWeight.bold,  
268 - fontSize: ScreenUtil().setSp(30)),  
269 - )  
270 - ],  
271 - ),  
272 - VEmptyView(10),  
273 - RoundButton(  
274 - onPressed: () async {  
275 - NavigatorUtil.goCustomerListPage(  
276 - context, FromPage.FromPageHome, '');  
277 - },  
278 - text: '全店客户',  
279 - fontSize: 24,  
280 - isBold: false,  
281 - textColor: MyColours.color_333333,  
282 - gradientStart: MyColours.color_ffffff,  
283 - gradientEnd: MyColours.color_ffffff,  
284 - borderColor: Color.fromRGBO(118, 118, 118, 1),  
285 - height: ScreenUtil().setWidth(45),  
286 - width: ScreenUtil().setWidth(160),  
287 - radius: ScreenUtil().setWidth(30),  
288 - )  
289 - ],  
290 - ),  
291 - ),  
292 - Positioned(  
293 - top: ScreenUtil().setWidth(30),  
294 - right: ScreenUtil().setWidth(40),  
295 - child: InkWell(  
296 - onTap: () {  
297 - NavigatorUtil.goCustomerSetPage(context);  
298 - },  
299 - child: Image.asset(Utils.getImgPath('c_set'),  
300 - width: ScreenUtil().setWidth(40))))  
301 - ],  
302 - ),  
303 - VEmptyView(10),  
304 - Row(  
305 - children: [  
306 - _percentWidget(  
307 - '${customerProvider.storeSunmodel.active.count}',  
308 - '活跃客户',  
309 - '${customerProvider.storeSunmodel.active.scale}'),  
310 - HEmptyView(10),  
311 - _percentWidget(  
312 - '${customerProvider.storeSunmodel.sleep.count}',  
313 - '沉睡客户',  
314 - '${customerProvider.storeSunmodel.sleep.scale}'),  
315 - HEmptyView(10),  
316 - _percentWidget(  
317 - '${customerProvider.storeSunmodel.drain.count}',  
318 - '流失客户',  
319 - '${customerProvider.storeSunmodel.drain.scale}'),  
320 - ],  
321 - ),  
322 - // GridView.builder(  
323 - // controller: _controller,  
324 - // shrinkWrap: true,  
325 - // cacheExtent: ScreenUtil().setWidth(0),  
326 - // itemCount: 3,  
327 - // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(  
328 - // crossAxisCount: 3,  
329 - // childAspectRatio: 1,  
330 - // mainAxisSpacing: ScreenUtil().setWidth(10),  
331 - // crossAxisSpacing: ScreenUtil().setWidth(10)),  
332 - // itemBuilder: (BuildContext context, int index) {  
333 - // // locationState = state;  
334 - // return _percentWidget('1999', '活跃客户', '39.20');  
335 - // }),  
336 - // Row(  
337 - // children: [  
338 - // _percentWidget('19992', '活跃客户', '90.90'),  
339 - // HEmptyView(10),  
340 - // _percentWidget('19992', '沉睡客户', '90.90'),  
341 - // HEmptyView(10),  
342 - // _percentWidget('19992', '流失客户', '5.90'),  
343 - // ],  
344 - // ),  
345 - Padding(  
346 - padding: EdgeInsets.symmetric(  
347 - vertical: ScreenUtil().setWidth(30)),  
348 - child: Text(  
349 - '客户经理',  
350 - style: TextStyle(  
351 - fontSize: ScreenUtil().setSp(28),  
352 - color: MyColours.color_333333),  
353 - ),  
354 - ),  
355 - GridView.builder(  
356 - controller: _controller,  
357 - shrinkWrap: true,  
358 - cacheExtent: ScreenUtil().setWidth(0),  
359 - itemCount:  
360 - customerProvider.storeSunmodel.sellerUser.length + 1,  
361 - gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(  
362 - crossAxisCount: 3,  
363 - childAspectRatio: 1,  
364 - mainAxisSpacing: ScreenUtil().setWidth(10),  
365 - crossAxisSpacing: ScreenUtil().setWidth(10)),  
366 - itemBuilder: (BuildContext context, int index) {  
367 - // locationState = state;  
368 - if (index == 0) {  
369 - return _percentWidget(  
370 - '${customerProvider.storeSunmodel.distribution}',  
371 - '未分配',  
372 - null);  
373 - } 213 +// @override
  214 +// Widget build(BuildContext context) {
  215 +// customerProvider = Provider.of<CustomerProvider>(context, listen: false);
  216 +// return Scaffold(
  217 +// backgroundColor: Color.fromRGBO(246, 248, 250, 1),
  218 +// appBar: SystemAppBar('全店客情', onTap: () {
  219 +// EventBus().emit('changeStatusColor');
  220 +// Navigator.pop(context);
  221 +// }),
  222 +// body: WillPopScope(onWillPop: () async {
  223 +// EventBus().emit('changeStatusColor');
  224 +// return true;
  225 +// }, child: Consumer<CustomerProvider>(builder: (context, model, _) {
  226 +// if (model.pageStateStoreHome != PageState.Success) {
  227 +// return ExceptionPage(
  228 +// pageState: model.pageStateStoreHome,
  229 +// callback: () {
  230 +// // getTableList();
  231 +// _getSellerGuestManage();
  232 +// },
  233 +// emptyMsg: "暂时没有全店客情哦",
  234 +// emptyImg: "empty_search",
  235 +// showMsg: "加载中,请稍后...",
  236 +// );
  237 +// } else {
  238 +// return Column(children: [
  239 +// Expanded(
  240 +// child: SingleChildScrollView(
  241 +// controller: _controller,
  242 +// child: Column(
  243 +// children: [
  244 +// VEmptyView(10),
  245 +// Stack(
  246 +// children: [
  247 +// Container(
  248 +// color: MyColours.color_ffffff,
  249 +// padding: EdgeInsets.symmetric(
  250 +// vertical: ScreenUtil().setWidth(30)),
  251 +// child: Column(
  252 +// children: [
  253 +// Row(
  254 +// mainAxisAlignment: MainAxisAlignment.center,
  255 +// children: [
  256 +// Text(
  257 +// '${customerProvider.storeSunmodel.myCustomer}',
  258 +// style: TextStyle(
  259 +// color: MyColours.color_199095,
  260 +// fontSize: ScreenUtil().setSp(60),
  261 +// fontWeight: FontWeight.bold),
  262 +// ),
  263 +// Text(
  264 +// '位',
  265 +// style: TextStyle(
  266 +// color: MyColours.color_199095,
  267 +// fontWeight: FontWeight.bold,
  268 +// fontSize: ScreenUtil().setSp(30)),
  269 +// )
  270 +// ],
  271 +// ),
  272 +// VEmptyView(10),
  273 +// RoundButton(
  274 +// onPressed: () async {
  275 +// NavigatorUtil.goCustomerListPage(
  276 +// context, FromPage.FromPageHome, '');
  277 +// },
  278 +// text: '全店客户',
  279 +// fontSize: 24,
  280 +// isBold: false,
  281 +// textColor: MyColours.color_333333,
  282 +// gradientStart: MyColours.color_ffffff,
  283 +// gradientEnd: MyColours.color_ffffff,
  284 +// borderColor: Color.fromRGBO(118, 118, 118, 1),
  285 +// height: ScreenUtil().setWidth(45),
  286 +// width: ScreenUtil().setWidth(160),
  287 +// radius: ScreenUtil().setWidth(30),
  288 +// )
  289 +// ],
  290 +// ),
  291 +// ),
  292 +// Positioned(
  293 +// top: ScreenUtil().setWidth(30),
  294 +// right: ScreenUtil().setWidth(40),
  295 +// child: InkWell(
  296 +// onTap: () {
  297 +// NavigatorUtil.goCustomerSetPage(context);
  298 +// },
  299 +// child: Image.asset(Utils.getImgPath('c_set'),
  300 +// width: ScreenUtil().setWidth(40))))
  301 +// ],
  302 +// ),
  303 +// VEmptyView(10),
  304 +// Row(
  305 +// children: [
  306 +// _percentWidget(
  307 +// '${customerProvider.storeSunmodel.active.count}',
  308 +// '活跃客户',
  309 +// '${customerProvider.storeSunmodel.active.scale}'),
  310 +// HEmptyView(10),
  311 +// _percentWidget(
  312 +// '${customerProvider.storeSunmodel.sleep.count}',
  313 +// '沉睡客户',
  314 +// '${customerProvider.storeSunmodel.sleep.scale}'),
  315 +// HEmptyView(10),
  316 +// _percentWidget(
  317 +// '${customerProvider.storeSunmodel.drain.count}',
  318 +// '流失客户',
  319 +// '${customerProvider.storeSunmodel.drain.scale}'),
  320 +// ],
  321 +// ),
  322 +// // GridView.builder(
  323 +// // controller: _controller,
  324 +// // shrinkWrap: true,
  325 +// // cacheExtent: ScreenUtil().setWidth(0),
  326 +// // itemCount: 3,
  327 +// // gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  328 +// // crossAxisCount: 3,
  329 +// // childAspectRatio: 1,
  330 +// // mainAxisSpacing: ScreenUtil().setWidth(10),
  331 +// // crossAxisSpacing: ScreenUtil().setWidth(10)),
  332 +// // itemBuilder: (BuildContext context, int index) {
  333 +// // // locationState = state;
  334 +// // return _percentWidget('1999', '活跃客户', '39.20');
  335 +// // }),
  336 +// // Row(
  337 +// // children: [
  338 +// // _percentWidget('19992', '活跃客户', '90.90'),
  339 +// // HEmptyView(10),
  340 +// // _percentWidget('19992', '沉睡客户', '90.90'),
  341 +// // HEmptyView(10),
  342 +// // _percentWidget('19992', '流失客户', '5.90'),
  343 +// // ],
  344 +// // ),
  345 +// Padding(
  346 +// padding: EdgeInsets.symmetric(
  347 +// vertical: ScreenUtil().setWidth(30)),
  348 +// child: Text(
  349 +// '客户经理',
  350 +// style: TextStyle(
  351 +// fontSize: ScreenUtil().setSp(28),
  352 +// color: MyColours.color_333333),
  353 +// ),
  354 +// ),
  355 +// GridView.builder(
  356 +// controller: _controller,
  357 +// shrinkWrap: true,
  358 +// cacheExtent: ScreenUtil().setWidth(0),
  359 +// itemCount:
  360 +// customerProvider.storeSunmodel.sellerUser.length + 1,
  361 +// gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  362 +// crossAxisCount: 3,
  363 +// childAspectRatio: 1,
  364 +// mainAxisSpacing: ScreenUtil().setWidth(10),
  365 +// crossAxisSpacing: ScreenUtil().setWidth(10)),
  366 +// itemBuilder: (BuildContext context, int index) {
  367 +// // locationState = state;
  368 +// if (index == 0) {
  369 +// return _percentWidget(
  370 +// '${customerProvider.storeSunmodel.distribution}',
  371 +// '未分配',
  372 +// null);
  373 +// }
374 374
375 - return _percentWidget(  
376 - '${customerProvider.storeSunmodel.sellerUser[index - 1].count}',  
377 - customerProvider.storeSunmodel.sellerUser[index - 1]  
378 - .account ==  
379 - null  
380 - ? ''  
381 - : '${customerProvider.storeSunmodel.sellerUser[index - 1].nickName ?? customerProvider.storeSunmodel.sellerUser[index - 1].account}经理',  
382 - null,  
383 - uid: customerProvider  
384 - .storeSunmodel.sellerUser[index - 1].uid);  
385 - })  
386 - ],  
387 - ),  
388 - )),  
389 - Padding(  
390 - padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),  
391 - child: Stack(  
392 - children: [  
393 - RoundButton(  
394 - onPressed: () {  
395 - NavigatorUtil.goMarketingRecordsPage(  
396 - context, FromPage.FromPageStoreCustomer);  
397 - },  
398 - text: '营销记录',  
399 - fontSize: 24,  
400 - isBold: false,  
401 - textColor: MyColours.color_199095,  
402 - gradientStart: MyColours.color_ffffff,  
403 - gradientEnd: MyColours.color_ffffff,  
404 - borderColor: MyColours.color_199095,  
405 - height: ScreenUtil().setWidth(75),  
406 - width: ScreenUtil().setWidth(260),  
407 - radius: ScreenUtil().setWidth(10),  
408 - ),  
409 - showWarning  
410 - ? Positioned(  
411 - right: ScreenUtil().setWidth(30),  
412 - top: ScreenUtil().setWidth(40 / 2),  
413 - child: Image.asset(  
414 - Utils.getImgPath('warning'),  
415 - width: ScreenUtil().setWidth(35),  
416 - ))  
417 - : SizedBox()  
418 - ],  
419 - ))  
420 - ]);  
421 - }  
422 - })),  
423 - );  
424 - }  
425 -} 375 +// return _percentWidget(
  376 +// '${customerProvider.storeSunmodel.sellerUser[index - 1].count}',
  377 +// customerProvider.storeSunmodel.sellerUser[index - 1]
  378 +// .account ==
  379 +// null
  380 +// ? ''
  381 +// : '${customerProvider.storeSunmodel.sellerUser[index - 1].nickName ?? customerProvider.storeSunmodel.sellerUser[index - 1].account}经理',
  382 +// null,
  383 +// uid: customerProvider
  384 +// .storeSunmodel.sellerUser[index - 1].uid);
  385 +// })
  386 +// ],
  387 +// ),
  388 +// )),
  389 +// Padding(
  390 +// padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),
  391 +// child: Stack(
  392 +// children: [
  393 +// RoundButton(
  394 +// onPressed: () {
  395 +// NavigatorUtil.goMarketingRecordsPage(
  396 +// context, FromPage.FromPageStoreCustomer);
  397 +// },
  398 +// text: '营销记录',
  399 +// fontSize: 24,
  400 +// isBold: false,
  401 +// textColor: MyColours.color_199095,
  402 +// gradientStart: MyColours.color_ffffff,
  403 +// gradientEnd: MyColours.color_ffffff,
  404 +// borderColor: MyColours.color_199095,
  405 +// height: ScreenUtil().setWidth(75),
  406 +// width: ScreenUtil().setWidth(260),
  407 +// radius: ScreenUtil().setWidth(10),
  408 +// ),
  409 +// showWarning
  410 +// ? Positioned(
  411 +// right: ScreenUtil().setWidth(30),
  412 +// top: ScreenUtil().setWidth(40 / 2),
  413 +// child: Image.asset(
  414 +// Utils.getImgPath('warning'),
  415 +// width: ScreenUtil().setWidth(35),
  416 +// ))
  417 +// : SizedBox()
  418 +// ],
  419 +// ))
  420 +// ]);
  421 +// }
  422 +// })),
  423 +// );
  424 +// }
  425 +// }
@@ -180,6 +180,7 @@ import '../pages/feast/feast_set_page.dart'; @@ -180,6 +180,7 @@ import '../pages/feast/feast_set_page.dart';
180 import '../pages/feast/feast_setmeal_page.dart'; 180 import '../pages/feast/feast_setmeal_page.dart';
181 import '../pages/feast/feast_wine_page.dart'; 181 import '../pages/feast/feast_wine_page.dart';
182 import '../pages/message/message_recharge_info_page.dart'; 182 import '../pages/message/message_recharge_info_page.dart';
  183 +import '../pages/my/customer_type/store_customer/store_customer_home_page.dart';
183 import '../pages/my/feast_manage/feast_deposit_type_page.dart'; 184 import '../pages/my/feast_manage/feast_deposit_type_page.dart';
184 import '../pages/my/feast_manage/feast_dish_page.dart'; 185 import '../pages/my/feast_manage/feast_dish_page.dart';
185 import '../pages/my/feast_manage/feast_dish_share_page.dart'; 186 import '../pages/my/feast_manage/feast_dish_share_page.dart';
@@ -1041,7 +1042,7 @@ var storeCustomerPageHandle = new Handler( @@ -1041,7 +1042,7 @@ var storeCustomerPageHandle = new Handler(
1041 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 1042 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
1042 // String idstr = params["idstr"].first; 1043 // String idstr = params["idstr"].first;
1043 return ChangeNotifierProvider<CustomerProvider>( 1044 return ChangeNotifierProvider<CustomerProvider>(
1044 - create: (_) => CustomerProvider(), child: StoreCustomerPage()); 1045 + create: (_) => CustomerProvider(), child: StoreCustomerHomePage());
1045 }); 1046 });
1046 1047
1047 ///我的客情 1048 ///我的客情
@@ -351,6 +351,13 @@ packages: @@ -351,6 +351,13 @@ packages:
351 url: "https://pub.flutter-io.cn" 351 url: "https://pub.flutter-io.cn"
352 source: hosted 352 source: hosted
353 version: "0.0.2" 353 version: "0.0.2"
  354 + equatable:
  355 + dependency: transitive
  356 + description:
  357 + name: equatable
  358 + url: "https://pub.flutter-io.cn"
  359 + source: hosted
  360 + version: "2.0.5"
354 extended_image: 361 extended_image:
355 dependency: transitive 362 dependency: transitive
356 description: 363 description:
@@ -407,6 +414,13 @@ packages: @@ -407,6 +414,13 @@ packages:
407 url: "https://pub.flutter-io.cn" 414 url: "https://pub.flutter-io.cn"
408 source: hosted 415 source: hosted
409 version: "1.0.0" 416 version: "1.0.0"
  417 + fl_chart:
  418 + dependency: "direct main"
  419 + description:
  420 + name: fl_chart
  421 + url: "https://pub.flutter-io.cn"
  422 + source: hosted
  423 + version: "0.62.0"
410 fluro: 424 fluro:
411 dependency: "direct main" 425 dependency: "direct main"
412 description: 426 description:
@@ -190,6 +190,8 @@ dependencies: @@ -190,6 +190,8 @@ dependencies:
190 pin_code_fields: ^7.4.0 190 pin_code_fields: ^7.4.0
191 # 二维码扫描 191 # 二维码扫描
192 barcode_scan2: ^4.2.4 192 barcode_scan2: ^4.2.4
  193 + # 柱形图
  194 + fl_chart: ^0.62.0
193 # ai_barcode 3.2.4 195 # ai_barcode 3.2.4
194 # qr_code_scanner: ^1.0.1 196 # qr_code_scanner: ^1.0.1
195 # mobile_scanner: ^3.2.0 197 # mobile_scanner: ^3.2.0