Commit b69ed69d3987059ec65e76f0148050ead8ed383e

Authored by wdn127929
1 parent ee8fc2d8

接口 OK

  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:json_annotation/json_annotation.dart';
  3 +
  4 +part 'marketing_by_id_model.g.dart';
  5 +
  6 +@JsonSerializable()
  7 +class MarketingByIdModel extends Object {
  8 + @JsonKey(name: 'ret')
  9 + int ret;
  10 +
  11 + @JsonKey(name: 'data')
  12 + MarketingByIdSunModel data;
  13 +
  14 + @JsonKey(name: 'msg')
  15 + String msg;
  16 +
  17 + MarketingByIdModel(
  18 + this.ret,
  19 + this.data,
  20 + this.msg,
  21 + );
  22 +
  23 + factory MarketingByIdModel.fromJson(Map<String, dynamic> srcJson) =>
  24 + _$MarketingByIdModelFromJson(srcJson);
  25 +
  26 + Map<String, dynamic> toJson() => _$MarketingByIdModelToJson(this);
  27 +}
  28 +
  29 +@JsonSerializable()
  30 +class MarketingByIdSunModel extends Object {
  31 + @JsonKey(name: 'id')
  32 + String id;
  33 +
  34 + @JsonKey(name: 'sellerid')
  35 + String sellerid;
  36 +
  37 + @JsonKey(name: 'uid')
  38 + String uid;
  39 +
  40 + @JsonKey(name: 'aid')
  41 + String aid;
  42 +
  43 + @JsonKey(name: 'gid')
  44 + String gid;
  45 +
  46 + @JsonKey(name: 'content')
  47 + String content;
  48 +
  49 + @JsonKey(name: 'is_update')
  50 + String isUpdate;
  51 +
  52 + @JsonKey(name: 'edate')
  53 + String edate;
  54 +
  55 + @JsonKey(name: 'cdate')
  56 + String cdate;
  57 +
  58 + @JsonKey(name: 'guest_count')
  59 + String guestCount;
  60 +
  61 + @JsonKey(name: 'seller_user_count')
  62 + int sellerUserCount;
  63 +
  64 + @JsonKey(name: 'not_finished')
  65 + int notFinished;
  66 +
  67 + @JsonKey(name: 'seller_user')
  68 + List<SellerUser> sellerUser;
  69 +
  70 + String aidStr = '';
  71 +
  72 + String get cdateStr {
  73 + DateTime dateTime =
  74 + DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000);
  75 + return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
  76 + }
  77 +
  78 + MarketingByIdSunModel(
  79 + this.id,
  80 + this.sellerid,
  81 + this.uid,
  82 + this.aid,
  83 + this.gid,
  84 + this.content,
  85 + this.isUpdate,
  86 + this.edate,
  87 + this.cdate,
  88 + this.guestCount,
  89 + this.sellerUserCount,
  90 + this.notFinished,
  91 + this.sellerUser,
  92 + );
  93 +
  94 + factory MarketingByIdSunModel.fromJson(Map<String, dynamic> srcJson) =>
  95 + _$MarketingByIdSunModelFromJson(srcJson);
  96 +
  97 + Map<String, dynamic> toJson() => _$MarketingByIdSunModelToJson(this);
  98 +}
  99 +
  100 +@JsonSerializable()
  101 +class SellerUser extends Object {
  102 + @JsonKey(name: 'id')
  103 + String id;
  104 +
  105 + @JsonKey(name: 'finished_status')
  106 + int finishedStatus;
  107 +
  108 + @JsonKey(name: 'nick_name')
  109 + String nickName;
  110 +
  111 + SellerUser(
  112 + this.id,
  113 + this.finishedStatus,
  114 + this.nickName,
  115 + );
  116 +
  117 + factory SellerUser.fromJson(Map<String, dynamic> srcJson) =>
  118 + _$SellerUserFromJson(srcJson);
  119 +
  120 + Map<String, dynamic> toJson() => _$SellerUserToJson(this);
  121 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'marketing_by_id_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +MarketingByIdModel _$MarketingByIdModelFromJson(Map<String, dynamic> json) {
  10 + return MarketingByIdModel(
  11 + json['ret'] as int,
  12 + json['data'] == null
  13 + ? null
  14 + : MarketingByIdSunModel.fromJson(json['data'] as Map<String, dynamic>),
  15 + json['msg'] as String,
  16 + );
  17 +}
  18 +
  19 +Map<String, dynamic> _$MarketingByIdModelToJson(MarketingByIdModel instance) =>
  20 + <String, dynamic>{
  21 + 'ret': instance.ret,
  22 + 'data': instance.data,
  23 + 'msg': instance.msg,
  24 + };
  25 +
  26 +MarketingByIdSunModel _$MarketingByIdSunModelFromJson(
  27 + Map<String, dynamic> json) {
  28 + return MarketingByIdSunModel(
  29 + json['id'] as String,
  30 + json['sellerid'] as String,
  31 + json['uid'] as String,
  32 + json['aid'] as String,
  33 + json['gid'] as String,
  34 + json['content'] as String,
  35 + json['is_update'] as String,
  36 + json['edate'] as String,
  37 + json['cdate'] as String,
  38 + json['guest_count'] as String,
  39 + json['seller_user_count'] as int,
  40 + json['not_finished'] as int,
  41 + (json['seller_user'] as List)
  42 + ?.map((e) =>
  43 + e == null ? null : SellerUser.fromJson(e as Map<String, dynamic>))
  44 + ?.toList(),
  45 + );
  46 +}
  47 +
  48 +Map<String, dynamic> _$MarketingByIdSunModelToJson(
  49 + MarketingByIdSunModel instance) =>
  50 + <String, dynamic>{
  51 + 'id': instance.id,
  52 + 'sellerid': instance.sellerid,
  53 + 'uid': instance.uid,
  54 + 'aid': instance.aid,
  55 + 'gid': instance.gid,
  56 + 'content': instance.content,
  57 + 'is_update': instance.isUpdate,
  58 + 'edate': instance.edate,
  59 + 'cdate': instance.cdate,
  60 + 'guest_count': instance.guestCount,
  61 + 'seller_user_count': instance.sellerUserCount,
  62 + 'not_finished': instance.notFinished,
  63 + 'seller_user': instance.sellerUser,
  64 + };
  65 +
  66 +SellerUser _$SellerUserFromJson(Map<String, dynamic> json) {
  67 + return SellerUser(
  68 + json['id'] as String,
  69 + json['finished_status'] as int,
  70 + json['nick_name'] as String,
  71 + );
  72 +}
  73 +
  74 +Map<String, dynamic> _$SellerUserToJson(SellerUser instance) =>
  75 + <String, dynamic>{
  76 + 'id': instance.id,
  77 + 'finished_status': instance.finishedStatus,
  78 + 'nick_name': instance.nickName,
  79 + };
  1 +import 'package:common_utils/common_utils.dart';
  2 +import 'package:json_annotation/json_annotation.dart';
  3 +
  4 +part 'marketing_by_seller_model.g.dart';
  5 +
  6 +@JsonSerializable()
  7 +class MarketingBySellerModel extends Object {
  8 + @JsonKey(name: 'ret')
  9 + int ret;
  10 +
  11 + @JsonKey(name: 'data')
  12 + List<MarketingBySellerSunModel> data;
  13 +
  14 + @JsonKey(name: 'msg')
  15 + String msg;
  16 +
  17 + MarketingBySellerModel(
  18 + this.ret,
  19 + this.data,
  20 + this.msg,
  21 + );
  22 +
  23 + factory MarketingBySellerModel.fromJson(Map<String, dynamic> srcJson) =>
  24 + _$MarketingBySellerModelFromJson(srcJson);
  25 +
  26 + Map<String, dynamic> toJson() => _$MarketingBySellerModelToJson(this);
  27 +}
  28 +
  29 +@JsonSerializable()
  30 +class MarketingBySellerSunModel extends Object {
  31 + @JsonKey(name: 'id')
  32 + String id;
  33 +
  34 + @JsonKey(name: 'sellerid')
  35 + String sellerid;
  36 +
  37 + @JsonKey(name: 'uid')
  38 + String uid;
  39 +
  40 + @JsonKey(name: 'aid')
  41 + String aid;
  42 +
  43 + @JsonKey(name: 'gid')
  44 + String gid;
  45 +
  46 + @JsonKey(name: 'content')
  47 + String content;
  48 +
  49 + @JsonKey(name: 'is_update')
  50 + String isUpdate;
  51 +
  52 + @JsonKey(name: 'edate')
  53 + String edate;
  54 +
  55 + @JsonKey(name: 'cdate')
  56 + String cdate;
  57 +
  58 + @JsonKey(name: 'not_finished')
  59 + String notFinished;
  60 +
  61 + @JsonKey(name: 'remaining_time')
  62 + int remainingTime;
  63 +
  64 + String get cdateStr {
  65 + DateTime dateTime =
  66 + DateTime.fromMillisecondsSinceEpoch(int.parse(cdate.toString()) * 1000);
  67 + return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
  68 + }
  69 +
  70 + MarketingBySellerSunModel(
  71 + this.id,
  72 + this.sellerid,
  73 + this.uid,
  74 + this.aid,
  75 + this.gid,
  76 + this.content,
  77 + this.isUpdate,
  78 + this.edate,
  79 + this.cdate,
  80 + this.notFinished,
  81 + this.remainingTime,
  82 + );
  83 +
  84 + factory MarketingBySellerSunModel.fromJson(Map<String, dynamic> srcJson) =>
  85 + _$MarketingBySellerSunModelFromJson(srcJson);
  86 +
  87 + Map<String, dynamic> toJson() => _$MarketingBySellerSunModelToJson(this);
  88 +}
  1 +// GENERATED CODE - DO NOT MODIFY BY HAND
  2 +
  3 +part of 'marketing_by_seller_model.dart';
  4 +
  5 +// **************************************************************************
  6 +// JsonSerializableGenerator
  7 +// **************************************************************************
  8 +
  9 +MarketingBySellerModel _$MarketingBySellerModelFromJson(
  10 + Map<String, dynamic> json) {
  11 + return MarketingBySellerModel(
  12 + json['ret'] as int,
  13 + (json['data'] as List)
  14 + ?.map((e) => e == null
  15 + ? null
  16 + : MarketingBySellerSunModel.fromJson(e as Map<String, dynamic>))
  17 + ?.toList(),
  18 + json['msg'] as String,
  19 + );
  20 +}
  21 +
  22 +Map<String, dynamic> _$MarketingBySellerModelToJson(
  23 + MarketingBySellerModel instance) =>
  24 + <String, dynamic>{
  25 + 'ret': instance.ret,
  26 + 'data': instance.data,
  27 + 'msg': instance.msg,
  28 + };
  29 +
  30 +MarketingBySellerSunModel _$MarketingBySellerSunModelFromJson(
  31 + Map<String, dynamic> json) {
  32 + return MarketingBySellerSunModel(
  33 + json['id'] as String,
  34 + json['sellerid'] as String,
  35 + json['uid'] as String,
  36 + json['aid'] as String,
  37 + json['gid'] as String,
  38 + json['content'] as String,
  39 + json['is_update'] as String,
  40 + json['edate'] as String,
  41 + json['cdate'] as String,
  42 + json['not_finished'] as String,
  43 + json['remaining_time'] as int,
  44 + );
  45 +}
  46 +
  47 +Map<String, dynamic> _$MarketingBySellerSunModelToJson(
  48 + MarketingBySellerSunModel instance) =>
  49 + <String, dynamic>{
  50 + 'id': instance.id,
  51 + 'sellerid': instance.sellerid,
  52 + 'uid': instance.uid,
  53 + 'aid': instance.aid,
  54 + 'gid': instance.gid,
  55 + 'content': instance.content,
  56 + 'is_update': instance.isUpdate,
  57 + 'edate': instance.edate,
  58 + 'cdate': instance.cdate,
  59 + 'not_finished': instance.notFinished,
  60 + 'remaining_time': instance.remainingTime,
  61 + };
@@ -188,5 +188,9 @@ class HttpUrl { @@ -188,5 +188,9 @@ class HttpUrl {
188 "?service=App.GuestManage.CreateLabelBySellerid"; // 商家创建商家标签 188 "?service=App.GuestManage.CreateLabelBySellerid"; // 商家创建商家标签
189 static const String create_marketing_by_seller = 189 static const String create_marketing_by_seller =
190 "?service=App.GuestManage.CreateMarketingBySeller"; // 商家创建营销 190 "?service=App.GuestManage.CreateMarketingBySeller"; // 商家创建营销
  191 + static const String get_marketing_by_seller =
  192 + "?service=App.GuestManage.GetMarketingBySeller"; // 商家营销列表
  193 + static const String get_marketing_by_id =
  194 + "?service=App.GuestManage.GetMarketingById"; // 商家营销详情
191 195
192 } 196 }
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/constant/state.dart';
  4 +import 'package:one_key/models/marketing_by_id_model.dart';
  5 +import 'package:one_key/provider/customer_provider.dart';
  6 +import 'package:one_key/provider/user_model.dart';
3 import 'package:one_key/res/colors.dart'; 7 import 'package:one_key/res/colors.dart';
4 import 'package:one_key/utils/dialog_util.dart'; 8 import 'package:one_key/utils/dialog_util.dart';
5 import 'package:one_key/utils/utils.dart'; 9 import 'package:one_key/utils/utils.dart';
6 import 'package:one_key/widgets/h_empty_view.dart'; 10 import 'package:one_key/widgets/h_empty_view.dart';
  11 +import 'package:one_key/widgets/page_exception.dart';
7 import 'package:one_key/widgets/round_button.dart'; 12 import 'package:one_key/widgets/round_button.dart';
8 import 'package:one_key/widgets/row_multi_text.dart'; 13 import 'package:one_key/widgets/row_multi_text.dart';
9 import 'package:one_key/widgets/system_app_bar.dart'; 14 import 'package:one_key/widgets/system_app_bar.dart';
10 import 'package:one_key/widgets/v_empty_view.dart'; 15 import 'package:one_key/widgets/v_empty_view.dart';
  16 +import 'package:provider/provider.dart';
11 17
12 class MarketingRecordsDetailPage extends StatefulWidget { 18 class MarketingRecordsDetailPage extends StatefulWidget {
13 - MarketingRecordsDetailPage({Key key}) : super(key: key); 19 + final String idstr;
  20 + MarketingRecordsDetailPage({Key key, this.idstr}) : super(key: key);
14 21
15 @override 22 @override
16 _MarketingRecordsDetailPageState createState() => 23 _MarketingRecordsDetailPageState createState() =>
@@ -19,12 +26,63 @@ class MarketingRecordsDetailPage extends StatefulWidget { @@ -19,12 +26,63 @@ class MarketingRecordsDetailPage extends StatefulWidget {
19 26
20 class _MarketingRecordsDetailPageState 27 class _MarketingRecordsDetailPageState
21 extends State<MarketingRecordsDetailPage> { 28 extends State<MarketingRecordsDetailPage> {
  29 + CustomerProvider customerProvider;
  30 + @override
  31 + void initState() {
  32 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  33 + // if (widget.fromPage == FromPage.FromPageStoreCustomer) {
  34 + // _getMarketingBySeller();
  35 + // }
  36 + _getMarketingById();
  37 + });
  38 + }
  39 +
  40 + @override
  41 + void dispose() {
  42 + super.dispose();
  43 + }
  44 +
  45 + _getMarketingById() async {
  46 + Map<String, String> params = {"id": widget.idstr};
  47 + await customerProvider.getMarketingById(context, params);
  48 + if (customerProvider.pageStateMarketingRecordDetail == PageState.Success) {
  49 + _couponNetworkData();
  50 + }
  51 + // await customerProvider.searchData(customerProvider.controller.text);
  52 + }
  53 +
  54 + ///消费券
  55 + _couponNetworkData({bool isShowLoading = true}) async {
  56 + // customerMakingProvider.couponSelectIndex = 0;
  57 + Map<String, String> params = {
  58 + "uid": Provider.of<UserModel>(context, listen: false).user.openid,
  59 + };
  60 + await customerProvider.getCustomerSelectActivityNew(context, params,
  61 + isShowLoading: isShowLoading);
  62 + //此人已经新建好券
  63 + if (customerProvider.couponListSelect.length > 0) {
  64 + for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
  65 + if (customerProvider.marketingByIdSunModel.aid ==
  66 + customerProvider.couponListSelect[i].id) {
  67 + customerProvider.marketingByIdSunModel.aidStr =
  68 + customerProvider.couponListSelect[i].aname;
  69 + }
  70 + }
  71 + customerProvider.notifyListeners();
  72 + } else {
  73 + //没有新建的优惠券
  74 + }
  75 + }
  76 +
22 //构建经理btn 77 //构建经理btn
23 - List<Widget> _buildLabelItem(List<String> data, 78 + List<Widget> _buildLabelItem(List<SellerUser> data,
24 {Color bgColor = MyColours.color_199095}) { 79 {Color bgColor = MyColours.color_199095}) {
25 List<Widget> items = []; 80 List<Widget> items = [];
26 81
27 - for (String item in data) { 82 + for (SellerUser item in data) {
  83 + String title = '${item.nickName}经理';
  84 + title += item.finishedStatus == 0 ? '(未完成)' : '(已完成)';
  85 +
28 items.add(InkWell( 86 items.add(InkWell(
29 onTap: () {}, 87 onTap: () {},
30 child: Container( 88 child: Container(
@@ -33,12 +91,12 @@ class _MarketingRecordsDetailPageState @@ -33,12 +91,12 @@ class _MarketingRecordsDetailPageState
33 horizontal: ScreenUtil().setWidth(20), 91 horizontal: ScreenUtil().setWidth(20),
34 vertical: ScreenUtil().setWidth(6)), 92 vertical: ScreenUtil().setWidth(6)),
35 decoration: BoxDecoration( 93 decoration: BoxDecoration(
36 - color: item.contains('未完成') 94 + color: title.contains('未完成')
37 ? Color.fromRGBO(207, 29, 35, 1) 95 ? Color.fromRGBO(207, 29, 35, 1)
38 : MyColours.color_199095, 96 : MyColours.color_199095,
39 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))), 97 borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
40 child: Text( 98 child: Text(
41 - item, 99 + title,
42 style: TextStyle( 100 style: TextStyle(
43 color: MyColours.color_ffffff, 101 color: MyColours.color_ffffff,
44 fontSize: ScreenUtil().setSp(26), 102 fontSize: ScreenUtil().setSp(26),
@@ -51,6 +109,7 @@ class _MarketingRecordsDetailPageState @@ -51,6 +109,7 @@ class _MarketingRecordsDetailPageState
51 109
52 @override 110 @override
53 Widget build(BuildContext context) { 111 Widget build(BuildContext context) {
  112 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
54 return Scaffold( 113 return Scaffold(
55 backgroundColor: Color.fromRGBO(246, 248, 250, 1), 114 backgroundColor: Color.fromRGBO(246, 248, 250, 1),
56 appBar: SystemAppBar( 115 appBar: SystemAppBar(
@@ -59,175 +118,215 @@ class _MarketingRecordsDetailPageState @@ -59,175 +118,215 @@ class _MarketingRecordsDetailPageState
59 Navigator.pop(context); 118 Navigator.pop(context);
60 }, 119 },
61 ), 120 ),
62 - body: Padding(  
63 - padding: EdgeInsets.symmetric(  
64 - horizontal: ScreenUtil().setWidth(30),  
65 - // vertical: ScreenUtil().setWidth(40)  
66 - ),  
67 - child: Column(  
68 - children: [  
69 - Expanded(  
70 - child: SingleChildScrollView(  
71 - child: Column(  
72 - crossAxisAlignment: CrossAxisAlignment.start,  
73 - children: [  
74 - Stack(  
75 - alignment: Alignment.bottomCenter,  
76 - children: [  
77 - Column( 121 + body: Consumer<CustomerProvider>(builder: (context, model, _) {
  122 + if (model.pageStateMarketingRecordDetail != PageState.Success) {
  123 + return ExceptionPage(
  124 + pageState: model.pageStateMarketingRecordDetail,
  125 + callback: () {
  126 + model.pageStateMarketingRecordDetail = PageState.Loading;
  127 + model.notifyListeners();
  128 + // _getContantData();
  129 + _getMarketingById();
  130 + },
  131 + emptyMsg: "暂时没有营销详情哦",
  132 + emptyImg: "empty_search",
  133 + showMsg: "加载中,请稍后...",
  134 + );
  135 + } else {
  136 + return Padding(
  137 + padding: EdgeInsets.symmetric(
  138 + horizontal: ScreenUtil().setWidth(30),
  139 + // vertical: ScreenUtil().setWidth(40)
  140 + ),
  141 + child: Column(
  142 + children: [
  143 + Expanded(
  144 + child: SingleChildScrollView(
  145 + child: Column(
  146 + crossAxisAlignment: CrossAxisAlignment.start,
  147 + children: [
  148 + Stack(
  149 + alignment: Alignment.bottomCenter,
78 children: [ 150 children: [
79 - RowMultiText(  
80 - '创建日期',  
81 - '2021-12-22',  
82 - textColor: MyColours.color_333333,  
83 - bgColor: Color.fromRGBO(246, 248, 250, 1),  
84 - ),  
85 - RowMultiText(  
86 - '创建人',  
87 - '管理员',  
88 - textColor: MyColours.color_333333,  
89 - bgColor: Color.fromRGBO(246, 248, 250, 1), 151 + Column(
  152 + children: [
  153 + RowMultiText(
  154 + '创建日期',
  155 + model.marketingByIdSunModel.cdateStr,
  156 + textColor: MyColours.color_333333,
  157 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  158 + ),
  159 + RowMultiText(
  160 + '创建人',
  161 + '管理员(未返回)',
  162 + textColor: MyColours.color_333333,
  163 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  164 + ),
  165 + ],
90 ), 166 ),
  167 + Positioned(
  168 + child: Image.asset(
  169 + Utils.getImgPath('c_state_ing'),
  170 + width: ScreenUtil().setWidth(140),
  171 + ))
91 ], 172 ],
92 ), 173 ),
93 - Positioned(  
94 - child: Image.asset(  
95 - Utils.getImgPath('c_state_ing'),  
96 - width: ScreenUtil().setWidth(140),  
97 - ))  
98 - ],  
99 - ),  
100 - RowMultiText(  
101 - '完成期限',  
102 - '2021-12-22 23:59:59',  
103 - textColor: MyColours.color_333333,  
104 - bgColor: Color.fromRGBO(246, 248, 250, 1),  
105 - ),  
106 - RowMultiText(  
107 - '修改短信内容',  
108 - '可修改',  
109 - textColor: MyColours.color_333333,  
110 - bgColor: Color.fromRGBO(246, 248, 250, 1),  
111 - ),  
112 - RowMultiText(  
113 - '优惠信息',  
114 - '98折(仅限菜品堂食)',  
115 - textColor: MyColours.color_333333,  
116 - bgColor: Color.fromRGBO(246, 248, 250, 1),  
117 - ),  
118 - Padding(  
119 - padding: EdgeInsets.only(  
120 - top: ScreenUtil().setWidth(25),  
121 - bottom: ScreenUtil().setWidth(20)),  
122 - child: Text(  
123 - '短信内容',  
124 - style: TextStyle(  
125 - color: MyColours.color_333333,  
126 - fontSize: ScreenUtil().setSp(30)),  
127 - )),  
128 - Padding(  
129 - padding:  
130 - EdgeInsets.only(bottom: ScreenUtil().setWidth(25)),  
131 - child: Text(  
132 - 'dfdsgdfgdksgsdkghjksdhgjskdhgjsdhgsjkhdgfjksdhgsdjfdgg\nhsdfgjgsjgdhsddhfghdgjsgjdg',  
133 - style: TextStyle(  
134 - color: MyColours.color_999999,  
135 - fontSize: ScreenUtil().setSp(30)),  
136 - )),  
137 - Padding(  
138 - padding: EdgeInsets.symmetric(  
139 - vertical: ScreenUtil().setWidth(25), 174 + RowMultiText(
  175 + '完成期限',
  176 + model.marketingByIdSunModel.edate,
  177 + textColor: MyColours.color_333333,
  178 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  179 + ),
  180 + RowMultiText(
  181 + '修改短信内容',
  182 + model.marketingByIdSunModel.isUpdate == '1'
  183 + ? '可修改'
  184 + : '不可修改',
  185 + textColor: MyColours.color_333333,
  186 + bgColor: Color.fromRGBO(246, 248, 250, 1),
140 ), 187 ),
141 - child: Row(  
142 - crossAxisAlignment: CrossAxisAlignment.center,  
143 - children: [  
144 - Text(  
145 - '总客户人数',  
146 - style: TextStyle(  
147 - color: MyColours.color_333333,  
148 - fontSize: ScreenUtil().setSp(30)),  
149 - ),  
150 - Spacer(),  
151 - Text('55人',  
152 - style: TextStyle(  
153 - color: MyColours.color_333333,  
154 - fontSize: ScreenUtil().setSp(30))),  
155 - HEmptyView(10),  
156 - InkWell(  
157 - onTap: () {  
158 - // NavigatorUtil.goMarketingRecordsDetailPage(context);  
159 - },  
160 - child: Text('查看', 188 + RowMultiText(
  189 + '优惠信息',
  190 + customerProvider.marketingByIdSunModel.aidStr,
  191 + textColor: MyColours.color_333333,
  192 + bgColor: Color.fromRGBO(246, 248, 250, 1),
  193 + ),
  194 + Padding(
  195 + padding: EdgeInsets.only(
  196 + top: ScreenUtil().setWidth(25),
  197 + bottom: ScreenUtil().setWidth(20)),
  198 + child: Text(
  199 + '短信内容',
  200 + style: TextStyle(
  201 + color: MyColours.color_333333,
  202 + fontSize: ScreenUtil().setSp(30)),
  203 + )),
  204 + Padding(
  205 + padding: EdgeInsets.only(
  206 + bottom: ScreenUtil().setWidth(25)),
  207 + child: Text(
  208 + model.marketingByIdSunModel.content,
  209 + style: TextStyle(
  210 + color: MyColours.color_999999,
  211 + fontSize: ScreenUtil().setSp(30)),
  212 + )),
  213 + Padding(
  214 + padding: EdgeInsets.symmetric(
  215 + vertical: ScreenUtil().setWidth(25),
  216 + ),
  217 + child: Row(
  218 + crossAxisAlignment: CrossAxisAlignment.center,
  219 + children: [
  220 + Text(
  221 + '总客户人数',
  222 + style: TextStyle(
  223 + color: MyColours.color_333333,
  224 + fontSize: ScreenUtil().setSp(30)),
  225 + ),
  226 + Spacer(),
  227 + Text(
  228 + '${model.marketingByIdSunModel.guestCount}人',
161 style: TextStyle( 229 style: TextStyle(
162 - decoration: TextDecoration.underline,  
163 - color: MyColours.color_199095,  
164 - fontSize: ScreenUtil().setSp(30)))),  
165 - ])),  
166 - RowMultiText(  
167 - '参与经理',  
168 - '5人',  
169 - textColor: MyColours.color_333333,  
170 - bgColor: Color.fromRGBO(246, 248, 250, 1),  
171 - ),  
172 - Padding(  
173 - padding: EdgeInsets.only(  
174 - bottom: ScreenUtil().setWidth(25), 230 + color: MyColours.color_333333,
  231 + fontSize: ScreenUtil().setSp(30))),
  232 + HEmptyView(10),
  233 + InkWell(
  234 + onTap: () {
  235 + // NavigatorUtil.goMarketingRecordsDetailPage(context);
  236 + },
  237 + child: Text('查看',
  238 + style: TextStyle(
  239 + decoration:
  240 + TextDecoration.underline,
  241 + color: MyColours.color_199095,
  242 + fontSize:
  243 + ScreenUtil().setSp(30)))),
  244 + ])),
  245 + RowMultiText(
  246 + '参与经理',
  247 + '${model.marketingByIdSunModel.sellerUserCount}人',
  248 + textColor: MyColours.color_333333,
  249 + bgColor: Color.fromRGBO(246, 248, 250, 1),
175 ), 250 ),
176 - child: Wrap(  
177 - spacing: ScreenUtil().setWidth(20),  
178 - runSpacing: ScreenUtil().setWidth(10),  
179 - children: _buildLabelItem([  
180 - 'xx经理已完成',  
181 - 'xx经理未完成',  
182 - 'dfsdfsf',  
183 - 'ff',  
184 - 'ff',  
185 - 'sfsuhfsuhfiuhfuaihuf'  
186 - ]))),  
187 - ]))),  
188 - RoundButton(  
189 - text: '催促未完成经理',  
190 - gradientStart: MyColours.color_199095,  
191 - gradientEnd: MyColours.color_199095,  
192 - // borderColor: MyColours.color_999999,  
193 - radius: ScreenUtil().setWidth(10),  
194 - height: ScreenUtil().setWidth(80),  
195 - fontSize: 26,  
196 - margin: EdgeInsets.symmetric(  
197 - horizontal: ScreenUtil().setWidth(200)),  
198 - isBold: false,  
199 - onPressed: () {  
200 - // NavigatorUtil.goEnterStoreEnvironmentPage(context);  
201 - },  
202 - ),  
203 - VEmptyView(10),  
204 - RoundButton(  
205 - text: '取消任务',  
206 - gradientStart: MyColours.color_ffffff,  
207 - gradientEnd: MyColours.color_ffffff,  
208 - textColor: MyColours.color_199095,  
209 - // borderColor: MyColours.color_999999,  
210 - radius: ScreenUtil().setWidth(10),  
211 - height: ScreenUtil().setWidth(80),  
212 - fontSize: 26,  
213 - margin: EdgeInsets.symmetric(  
214 - horizontal: ScreenUtil().setWidth(200)),  
215 - isBold: false,  
216 - onPressed: () {  
217 - DialogUtil.cupertinoAlertDialog(context,  
218 - title: "取消任务",  
219 - content: "点击确定立即取消任务,已完成的客户经理继续生效",  
220 - lTitle: "返回",  
221 - rTitle: "确定取消", lCallback: () {  
222 - print("返回");  
223 - }, rCallback: () {  
224 - print("确定取消任务");  
225 - });  
226 - },  
227 - ),  
228 - VEmptyView(30),  
229 - ],  
230 - )), 251 + Padding(
  252 + padding: EdgeInsets.only(
  253 + bottom: ScreenUtil().setWidth(25),
  254 + ),
  255 + child: Wrap(
  256 + spacing: ScreenUtil().setWidth(20),
  257 + runSpacing: ScreenUtil().setWidth(10),
  258 + children: _buildLabelItem(
  259 + model.marketingByIdSunModel.sellerUser))),
  260 + ]))),
  261 + model.marketingByIdSunModel.notFinished == 0
  262 + ? Column(
  263 + children: [
  264 + RoundButton(
  265 + text: '催促未完成经理',
  266 + gradientStart: MyColours.color_199095,
  267 + gradientEnd: MyColours.color_199095,
  268 + // borderColor: MyColours.color_999999,
  269 + radius: ScreenUtil().setWidth(10),
  270 + height: ScreenUtil().setWidth(80),
  271 + fontSize: 26,
  272 + margin: EdgeInsets.symmetric(
  273 + horizontal: ScreenUtil().setWidth(200)),
  274 + isBold: false,
  275 + onPressed: () {
  276 + // NavigatorUtil.goEnterStoreEnvironmentPage(context);
  277 + },
  278 + ),
  279 + VEmptyView(10),
  280 + RoundButton(
  281 + text: '取消任务',
  282 + gradientStart: Colors.transparent,
  283 + gradientEnd: Colors.transparent,
  284 + textColor: MyColours.color_199095,
  285 + // borderColor: MyColours.color_999999,
  286 + radius: ScreenUtil().setWidth(10),
  287 + height: ScreenUtil().setWidth(80),
  288 + fontSize: 26,
  289 + margin: EdgeInsets.symmetric(
  290 + horizontal: ScreenUtil().setWidth(200)),
  291 + isBold: false,
  292 + onPressed: () {
  293 + DialogUtil.cupertinoAlertDialog(context,
  294 + title: "取消任务",
  295 + content: "点击确定立即取消任务,已完成的客户经理继续生效",
  296 + lTitle: "返回",
  297 + rTitle: "确定取消", lCallback: () {
  298 + print("返回");
  299 + }, rCallback: () {
  300 + print("确定取消任务");
  301 + });
  302 + },
  303 + ),
  304 + VEmptyView(30),
  305 + ],
  306 + )
  307 + : Column(
  308 + children: [
  309 + RoundButton(
  310 + text: '再次创建',
  311 + gradientStart: MyColours.color_ffffff,
  312 + gradientEnd: MyColours.color_ffffff,
  313 + textColor: MyColours.color_199095,
  314 + // borderColor: MyColours.color_999999,
  315 + radius: ScreenUtil().setWidth(10),
  316 + height: ScreenUtil().setWidth(80),
  317 + fontSize: 26,
  318 + margin: EdgeInsets.symmetric(
  319 + horizontal: ScreenUtil().setWidth(200)),
  320 + isBold: false,
  321 + onPressed: () {},
  322 + ),
  323 + VEmptyView(30),
  324 + ],
  325 + )
  326 + ],
  327 + ));
  328 + }
  329 + }),
231 ); 330 );
232 } 331 }
233 } 332 }
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/constant/state.dart';
  4 +import 'package:one_key/models/marketing_by_seller_model.dart';
  5 +import 'package:one_key/provider/customer_provider.dart';
  6 +import 'package:one_key/provider/user_model.dart';
3 import 'package:one_key/res/colors.dart'; 7 import 'package:one_key/res/colors.dart';
4 import 'package:one_key/route/navigator_util.dart'; 8 import 'package:one_key/route/navigator_util.dart';
5 import 'package:one_key/utils/utils.dart'; 9 import 'package:one_key/utils/utils.dart';
6 import 'package:one_key/widgets/h_empty_view.dart'; 10 import 'package:one_key/widgets/h_empty_view.dart';
  11 +import 'package:one_key/widgets/page_exception.dart';
7 import 'package:one_key/widgets/round_button.dart'; 12 import 'package:one_key/widgets/round_button.dart';
8 import 'package:one_key/widgets/system_app_bar.dart'; 13 import 'package:one_key/widgets/system_app_bar.dart';
  14 +import 'package:provider/provider.dart';
9 15
10 class MarketingRecordsPage extends StatefulWidget { 16 class MarketingRecordsPage extends StatefulWidget {
11 - MarketingRecordsPage({Key key}) : super(key: key); 17 + final FromPage fromPage;
  18 + MarketingRecordsPage({Key key, this.fromPage}) : super(key: key);
12 19
13 @override 20 @override
14 _MarketingRecordsPageState createState() => _MarketingRecordsPageState(); 21 _MarketingRecordsPageState createState() => _MarketingRecordsPageState();
15 } 22 }
16 23
17 class _MarketingRecordsPageState extends State<MarketingRecordsPage> { 24 class _MarketingRecordsPageState extends State<MarketingRecordsPage> {
  25 + CustomerProvider customerProvider;
  26 + @override
  27 + void initState() {
  28 + WidgetsBinding.instance.addPostFrameCallback((_) async {
  29 + if (widget.fromPage == FromPage.FromPageStoreCustomer) {
  30 + _getMarketingBySeller();
  31 + }
  32 + });
  33 + }
  34 +
  35 + @override
  36 + void dispose() {
  37 + super.dispose();
  38 + }
  39 +
  40 + _getMarketingBySeller() async {
  41 + Map<String, String> params = {
  42 + "sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid
  43 + };
  44 + await customerProvider.getMarketingBySeller(context, params);
  45 + // await customerProvider.searchData(customerProvider.controller.text);
  46 + }
  47 +
18 @override 48 @override
19 Widget build(BuildContext context) { 49 Widget build(BuildContext context) {
  50 + customerProvider = Provider.of<CustomerProvider>(context, listen: true);
20 return Scaffold( 51 return Scaffold(
21 backgroundColor: MyColours.color_ffffff, 52 backgroundColor: MyColours.color_ffffff,
22 appBar: SystemAppBar( 53 appBar: SystemAppBar(
23 - '全店营销记录', 54 + widget.fromPage == FromPage.FromPageMyCustomer ? '营销记录' : '全店营销记录',
24 onTap: () { 55 onTap: () {
25 Navigator.pop(context); 56 Navigator.pop(context);
26 }, 57 },
27 ), 58 ),
28 - body: ListView.builder(  
29 - padding: EdgeInsets.symmetric(  
30 - horizontal: ScreenUtil().setWidth(20),  
31 - // vertical: ScreenUtil().setWidth(40)  
32 - ),  
33 - itemCount: 100,  
34 - itemBuilder: (BuildContext context, int index) {  
35 - return Padding(  
36 - padding:  
37 - EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(20)),  
38 - child: Row(  
39 - children: [  
40 - Image.asset(Utils.getImgPath('warning'),  
41 - width: ScreenUtil().setWidth(30)),  
42 - HEmptyView(20),  
43 - Text('2021-12-22',  
44 - style: TextStyle(  
45 - color: MyColours.color_333333,  
46 - fontSize: ScreenUtil().setSp(26))),  
47 - HEmptyView(10),  
48 - RoundButton(  
49 - text: '全店任务',  
50 - gradientStart: MyColours.color_199095,  
51 - gradientEnd: MyColours.color_199095,  
52 - // borderColor: MyColours.color_999999,  
53 - radius: ScreenUtil().setWidth(10),  
54 - height: ScreenUtil().setWidth(50),  
55 - fontSize: 26,  
56 - padding: EdgeInsets.symmetric(  
57 - horizontal: ScreenUtil().setWidth(10)),  
58 - isBold: false,  
59 - onPressed: () {  
60 - // NavigatorUtil.goEnterStoreEnvironmentPage(context);  
61 - },  
62 - ),  
63 - HEmptyView(10),  
64 - Expanded(  
65 - child: Text('30位未完成',  
66 - overflow: TextOverflow.ellipsis, 59 + body: Consumer<CustomerProvider>(builder: (context, model, _) {
  60 + if (model.pageStateMarketingRecord != PageState.Success) {
  61 + return ExceptionPage(
  62 + pageState: model.pageStateMarketingRecord,
  63 + callback: () {
  64 + model.pageStateMarketingRecord = PageState.Loading;
  65 + model.notifyListeners();
  66 + // _getContantData();
  67 + _getMarketingBySeller();
  68 + },
  69 + emptyMsg: "暂时没有营销记录哦",
  70 + emptyImg: "empty_search",
  71 + showMsg: "加载中,请稍后...",
  72 + );
  73 + } else {
  74 + return ListView.builder(
  75 + padding: EdgeInsets.symmetric(
  76 + horizontal: ScreenUtil().setWidth(20),
  77 + // vertical: ScreenUtil().setWidth(40)
  78 + ),
  79 + itemCount: model.marketingBySellerSunModel.length,
  80 + itemBuilder: (BuildContext context, int index) {
  81 + MarketingBySellerSunModel data =
  82 + model.marketingBySellerSunModel[index];
  83 + return Padding(
  84 + padding: EdgeInsets.symmetric(
  85 + vertical: ScreenUtil().setWidth(20)),
  86 + child: Row(
  87 + children: [
  88 + data.notFinished != '' &&
  89 + data.notFinished != null &&
  90 + data.notFinished != '0'
  91 + ? Image.asset(Utils.getImgPath('warning'),
  92 + width: ScreenUtil().setWidth(30))
  93 + : Container(
  94 + width: ScreenUtil().setWidth(30),
  95 + ),
  96 + HEmptyView(10),
  97 + Text(data.cdateStr,
67 style: TextStyle( 98 style: TextStyle(
68 color: MyColours.color_333333, 99 color: MyColours.color_333333,
69 - fontSize: ScreenUtil().setSp(26)))),  
70 - HEmptyView(10),  
71 - Expanded(  
72 - child: Text('剩余1天',  
73 - overflow: TextOverflow.ellipsis,  
74 - style: TextStyle(  
75 - color: MyColours.color_333333,  
76 - fontSize: ScreenUtil().setSp(26)))),  
77 - HEmptyView(10),  
78 - InkWell(  
79 - onTap: () {  
80 - NavigatorUtil.goMarketingRecordsDetailPage(context);  
81 - },  
82 - child: Text('查看详情',  
83 - style: TextStyle(  
84 - decoration: TextDecoration.underline,  
85 - color: MyColours.color_199095,  
86 - fontSize: ScreenUtil().setSp(26)))),  
87 - ],  
88 - ));  
89 - }), 100 + fontSize: ScreenUtil().setSp(26))),
  101 + HEmptyView(10),
  102 + RoundButton(
  103 + text: '全店任务',
  104 + gradientStart: MyColours.color_199095,
  105 + gradientEnd: MyColours.color_199095,
  106 + // borderColor: MyColours.color_999999,
  107 + radius: ScreenUtil().setWidth(10),
  108 + height: ScreenUtil().setWidth(50),
  109 + fontSize: 26,
  110 + padding: EdgeInsets.symmetric(
  111 + horizontal: ScreenUtil().setWidth(10)),
  112 + isBold: false,
  113 + onPressed: () {
  114 + // NavigatorUtil.goEnterStoreEnvironmentPage(context);
  115 + },
  116 + ),
  117 + HEmptyView(10),
  118 + Expanded(
  119 + child: Text(
  120 + data.notFinished != '' &&
  121 + data.notFinished != null &&
  122 + data.notFinished != '0'
  123 + ? '${data.notFinished}位未完成'
  124 + : '全部完成/取消任务',
  125 + overflow: TextOverflow.ellipsis,
  126 + style: TextStyle(
  127 + color: data.notFinished != '' &&
  128 + data.notFinished != null &&
  129 + data.notFinished != '0'
  130 + ? Colors.red
  131 + : MyColours.color_333333,
  132 + fontSize: ScreenUtil().setSp(26)))),
  133 + HEmptyView(10),
  134 + Expanded(
  135 + child: Text('剩余${data.remainingTime}天',
  136 + overflow: TextOverflow.ellipsis,
  137 + style: TextStyle(
  138 + color: MyColours.color_333333,
  139 + fontSize: ScreenUtil().setSp(26)))),
  140 + InkWell(
  141 + onTap: () {
  142 + NavigatorUtil.goMarketingRecordsDetailPage(
  143 + context, data.id);
  144 + },
  145 + child: Text('查看详情',
  146 + style: TextStyle(
  147 + decoration: TextDecoration.underline,
  148 + color: MyColours.color_199095,
  149 + fontSize: ScreenUtil().setSp(26)))),
  150 + ],
  151 + ));
  152 + });
  153 + }
  154 + }),
90 ); 155 );
91 } 156 }
92 } 157 }
@@ -150,7 +150,8 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -150,7 +150,8 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
150 VEmptyView(10), 150 VEmptyView(10),
151 RoundButton( 151 RoundButton(
152 onPressed: () async { 152 onPressed: () async {
153 - NavigatorUtil.goCustomerListPage(context,FromPage.FromPageMyCustomer); 153 + NavigatorUtil.goCustomerListPage(
  154 + context, FromPage.FromPageMyCustomer);
154 }, 155 },
155 text: '我的客户', 156 text: '我的客户',
156 fontSize: 24, 157 fontSize: 24,
@@ -419,7 +420,8 @@ class _MyCustomerPageState extends State<MyCustomerPage> { @@ -419,7 +420,8 @@ class _MyCustomerPageState extends State<MyCustomerPage> {
419 padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)), 420 padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),
420 child: RoundButton( 421 child: RoundButton(
421 onPressed: () { 422 onPressed: () {
422 - NavigatorUtil.goMarketingRecordsPage(context); 423 + NavigatorUtil.goMarketingRecordsPage(
  424 + context, FromPage.FromPageMyCustomer);
423 }, 425 },
424 text: '营销记录', 426 text: '营销记录',
425 fontSize: 24, 427 fontSize: 24,
@@ -203,7 +203,8 @@ class _StoreCustomerPageState extends State<StoreCustomerPage> { @@ -203,7 +203,8 @@ class _StoreCustomerPageState extends State<StoreCustomerPage> {
203 padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)), 203 padding: EdgeInsets.only(bottom: ScreenUtil().setWidth(30)),
204 child: RoundButton( 204 child: RoundButton(
205 onPressed: () { 205 onPressed: () {
206 - NavigatorUtil.goMarketingRecordsPage(context); 206 + NavigatorUtil.goMarketingRecordsPage(
  207 + context, FromPage.FromPageStoreCustomer);
207 }, 208 },
208 text: '营销记录', 209 text: '营销记录',
209 fontSize: 24, 210 fontSize: 24,
@@ -9,6 +9,8 @@ import 'package:one_key/models/customer_list_model.dart'; @@ -9,6 +9,8 @@ import 'package:one_key/models/customer_list_model.dart';
9 import 'package:one_key/models/guest_info_model.dart'; 9 import 'package:one_key/models/guest_info_model.dart';
10 import 'package:one_key/models/guest_manage_model.dart'; 10 import 'package:one_key/models/guest_manage_model.dart';
11 import 'package:one_key/models/guest_reserve_model.dart'; 11 import 'package:one_key/models/guest_reserve_model.dart';
  12 +import 'package:one_key/models/marketing_by_id_model.dart';
  13 +import 'package:one_key/models/marketing_by_seller_model.dart';
12 import 'package:one_key/models/user_history_entity.dart'; 14 import 'package:one_key/models/user_history_entity.dart';
13 import 'package:one_key/net/base_resp.dart'; 15 import 'package:one_key/net/base_resp.dart';
14 import 'package:one_key/net/dio_util.dart'; 16 import 'package:one_key/net/dio_util.dart';
@@ -35,6 +37,9 @@ class CustomerProvider extends ChangeNotifier { @@ -35,6 +37,9 @@ class CustomerProvider extends ChangeNotifier {
35 GuestManageSunModel guestSunmodel; 37 GuestManageSunModel guestSunmodel;
36 PageState pageStateGuestInfo = PageState.Loading; //客户详情 38 PageState pageStateGuestInfo = PageState.Loading; //客户详情
37 PageState pageStateGuestReserve = PageState.Loading; //订单统计 39 PageState pageStateGuestReserve = PageState.Loading; //订单统计
  40 + PageState pageStateMarketingRecord = PageState.Loading; //营销记录
  41 + PageState pageStateMarketingRecordDetail = PageState.Loading; //营销记录详情
  42 +
38 GuestInfoSunModel guestInfoSunModel; 43 GuestInfoSunModel guestInfoSunModel;
39 GuestReserveSunModel guestReserveSunModel; 44 GuestReserveSunModel guestReserveSunModel;
40 List<CustomerListSunModel> selectCustomer = []; 45 List<CustomerListSunModel> selectCustomer = [];
@@ -43,6 +48,9 @@ class CustomerProvider extends ChangeNotifier { @@ -43,6 +48,9 @@ class CustomerProvider extends ChangeNotifier {
43 String labels = ''; 48 String labels = '';
44 List<CouponSunModel> couponListSelect = []; 49 List<CouponSunModel> couponListSelect = [];
45 int couponSelectIndex; 50 int couponSelectIndex;
  51 + List<MarketingBySellerSunModel> marketingBySellerSunModel;
  52 +
  53 + MarketingByIdSunModel marketingByIdSunModel;
46 54
47 ///客户经理获取所创建活动列表(选择优惠券) 55 ///客户经理获取所创建活动列表(选择优惠券)
48 Future<List<CouponSunModel>> getCustomerSelectActivityNew( 56 Future<List<CouponSunModel>> getCustomerSelectActivityNew(
@@ -700,4 +708,78 @@ class CustomerProvider extends ChangeNotifier { @@ -700,4 +708,78 @@ class CustomerProvider extends ChangeNotifier {
700 } 708 }
701 notifyListeners(); 709 notifyListeners();
702 } 710 }
  711 +
  712 + // 商家营销列表
  713 + getMarketingBySeller(BuildContext context, Map<String, String> params,
  714 + {bool showLoading = false}) async {
  715 + BaseResp<dynamic> baseResp = await DioUtil()
  716 + .request<dynamic>(context, Method.get, HttpUrl.get_marketing_by_seller,
  717 + data: params, showLoading: showLoading)
  718 + .catchError((error) {
  719 + print(error.toString());
  720 + if (error is MyError) {
  721 + switch (error.type) {
  722 + case 1:
  723 + pageStateMarketingRecord = PageState.ConnectivityError;
  724 + break;
  725 + case 2:
  726 + pageStateMarketingRecord = PageState.ConnectivityTimeOut;
  727 + break;
  728 + default:
  729 + pageStateMarketingRecord = PageState.ConnectivityError;
  730 + break;
  731 + }
  732 + }
  733 + notifyListeners();
  734 + });
  735 + if (baseResp != null && baseResp.code == Constant.status_success) {
  736 + pageStateMarketingRecord = PageState.Success;
  737 + marketingBySellerSunModel =
  738 + MarketingBySellerModel.fromJson(baseResp.responseData).data;
  739 + notifyListeners();
  740 + } else {
  741 + if (baseResp != null) {
  742 + Utils.showToast(baseResp.msg ?? "");
  743 + }
  744 + pageStateMarketingRecord = PageState.ConnectivityTimeOut;
  745 + }
  746 + notifyListeners();
  747 + }
  748 +
  749 + // 商家营销详情
  750 + getMarketingById(BuildContext context, Map<String, String> params,
  751 + {bool showLoading = false}) async {
  752 + BaseResp<dynamic> baseResp = await DioUtil()
  753 + .request<dynamic>(context, Method.get, HttpUrl.get_marketing_by_id,
  754 + data: params, showLoading: showLoading)
  755 + .catchError((error) {
  756 + print(error.toString());
  757 + if (error is MyError) {
  758 + switch (error.type) {
  759 + case 1:
  760 + pageStateMarketingRecordDetail = PageState.ConnectivityError;
  761 + break;
  762 + case 2:
  763 + pageStateMarketingRecordDetail = PageState.ConnectivityTimeOut;
  764 + break;
  765 + default:
  766 + pageStateMarketingRecordDetail = PageState.ConnectivityError;
  767 + break;
  768 + }
  769 + }
  770 + notifyListeners();
  771 + });
  772 + if (baseResp != null && baseResp.code == Constant.status_success) {
  773 + pageStateMarketingRecordDetail = PageState.Success;
  774 + marketingByIdSunModel =
  775 + MarketingByIdModel.fromJson(baseResp.responseData).data;
  776 + notifyListeners();
  777 + } else {
  778 + if (baseResp != null) {
  779 + Utils.showToast(baseResp.msg ?? "");
  780 + }
  781 + pageStateMarketingRecordDetail = PageState.ConnectivityTimeOut;
  782 + }
  783 + notifyListeners();
  784 + }
703 } 785 }
@@ -553,16 +553,20 @@ class NavigatorUtil { @@ -553,16 +553,20 @@ class NavigatorUtil {
553 } 553 }
554 554
555 /// 全店营销记录 555 /// 全店营销记录
556 - static Future<dynamic> goMarketingRecordsPage(BuildContext context, 556 + static Future<dynamic> goMarketingRecordsPage(
  557 + BuildContext context, FromPage fromPage,
557 {replace = false}) { 558 {replace = false}) {
558 - return _navigateTo(context, "${Routes.marketing_records_page}", 559 + return _navigateTo(context,
  560 + "${Routes.marketing_records_page}?fromPage=${FluroConvertUtils.enumToString(fromPage)}",
559 replace: replace); 561 replace: replace);
560 } 562 }
561 563
562 /// 全店营销记录详情 564 /// 全店营销记录详情
563 - static Future<dynamic> goMarketingRecordsDetailPage(BuildContext context, 565 + static Future<dynamic> goMarketingRecordsDetailPage(
  566 + BuildContext context, String idstr,
564 {replace = false}) { 567 {replace = false}) {
565 - return _navigateTo(context, "${Routes.marketing_records_detail_page}", 568 + return _navigateTo(
  569 + context, "${Routes.marketing_records_detail_page}?idstr=${idstr}",
566 replace: replace); 570 replace: replace);
567 } 571 }
568 572
@@ -876,16 +876,20 @@ var customerSettingPageHandle = new Handler( @@ -876,16 +876,20 @@ var customerSettingPageHandle = new Handler(
876 var marketingRecordsPageHandle = new Handler( 876 var marketingRecordsPageHandle = new Handler(
877 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 877 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
878 // String idstr = params["idstr"].first; 878 // String idstr = params["idstr"].first;
  879 + FromPage fromPage = FluroConvertUtils.enumFromString<FromPage>(
  880 + FromPage.values, params["fromPage"].first);
  881 + print(fromPage);
879 return ChangeNotifierProvider<CustomerProvider>( 882 return ChangeNotifierProvider<CustomerProvider>(
880 - create: (_) => CustomerProvider(), child: MarketingRecordsPage()); 883 + create: (_) => CustomerProvider(),
  884 + child: MarketingRecordsPage(fromPage: fromPage));
881 }); 885 });
882 886
883 ///全店营销记录详情 887 ///全店营销记录详情
884 var marketingRecordsDetailPageHandle = new Handler( 888 var marketingRecordsDetailPageHandle = new Handler(
885 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 889 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
886 - // String idstr = params["idstr"].first; 890 + String idstr = params["idstr"].first;
887 return ChangeNotifierProvider<CustomerProvider>( 891 return ChangeNotifierProvider<CustomerProvider>(
888 - create: (_) => CustomerProvider(), child: MarketingRecordsDetailPage()); 892 + create: (_) => CustomerProvider(), child: MarketingRecordsDetailPage(idstr:idstr));
889 }); 893 });
890 894
891 ///创建营销 895 ///创建营销