Commit e5cd8a9fbf39f610b1dd29d4373bf017d1f73d50

Authored by wdn127929
1 parent 838c246d

标签+列表 OK 差商家回复接口

  1 +class CommentsLabelModel {
  2 + int ret;
  3 + List<CommentsLabelSunModel> data;
  4 + String msg;
  5 +
  6 + CommentsLabelModel({this.ret, this.data, this.msg});
  7 +
  8 + CommentsLabelModel.fromJson(Map<String, dynamic> json) {
  9 + ret = json['ret'];
  10 + if (json['data'] != null) {
  11 + data = <CommentsLabelSunModel>[];
  12 + json['data'].forEach((v) {
  13 + data.add(new CommentsLabelSunModel.fromJson(v));
  14 + });
  15 + }
  16 + msg = json['msg'];
  17 + }
  18 +
  19 + Map<String, dynamic> toJson() {
  20 + final Map<String, dynamic> data = new Map<String, dynamic>();
  21 + data['ret'] = this.ret;
  22 + if (this.data != null) {
  23 + data['data'] = this.data.map((v) => v.toJson()).toList();
  24 + }
  25 + data['msg'] = this.msg;
  26 + return data;
  27 + }
  28 +}
  29 +
  30 +class CommentsLabelSunModel {
  31 + String name;
  32 + String total;
  33 + bool select = false;
  34 +
  35 + CommentsLabelSunModel({this.name, this.total});
  36 +
  37 + CommentsLabelSunModel.fromJson(Map<String, dynamic> json) {
  38 + name = json['name'];
  39 + total = json['total'];
  40 + }
  41 +
  42 + Map<String, dynamic> toJson() {
  43 + final Map<String, dynamic> data = new Map<String, dynamic>();
  44 + data['name'] = this.name;
  45 + data['total'] = this.total;
  46 + return data;
  47 + }
  48 +}
  1 +import 'dart:convert';
  2 +
  3 +import 'package:common_utils/common_utils.dart';
  4 +
  5 +class CommentsModel {
  6 + int ret;
  7 + List<CommentsSunModel> data;
  8 + String msg;
  9 +
  10 + CommentsModel({this.ret, this.data, this.msg});
  11 +
  12 + CommentsModel.fromJson(Map<String, dynamic> json) {
  13 + ret = json['ret'];
  14 + if (json['data'] != null) {
  15 + data = <CommentsSunModel>[];
  16 + json['data'].forEach((v) {
  17 + data.add(new CommentsSunModel.fromJson(v));
  18 + });
  19 + }
  20 + msg = json['msg'];
  21 + }
  22 +
  23 + Map<String, dynamic> toJson() {
  24 + final Map<String, dynamic> data = new Map<String, dynamic>();
  25 + data['ret'] = this.ret;
  26 + if (this.data != null) {
  27 + data['data'] = this.data.map((v) => v.toJson()).toList();
  28 + }
  29 + data['msg'] = this.msg;
  30 + return data;
  31 + }
  32 +}
  33 +
  34 +class CommentsSunModel {
  35 + String id;
  36 + String pid;
  37 + String sid;
  38 + String rid;
  39 + String author;
  40 + String authorImage;
  41 + String grade;
  42 + String status;
  43 + String evalLabel;
  44 + String text;
  45 + String createTime;
  46 + List<CommentsImageModel> enclosure;
  47 + String isnoshow;
  48 + Reply reply;
  49 +
  50 + String get createTimeStr {
  51 + DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
  52 + int.parse(createTime.toString()) * 1000);
  53 + return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
  54 + }
  55 +
  56 + CommentsSunModel(
  57 + {this.id,
  58 + this.pid,
  59 + this.sid,
  60 + this.rid,
  61 + this.author,
  62 + this.authorImage,
  63 + this.grade,
  64 + this.status,
  65 + this.evalLabel,
  66 + this.text,
  67 + this.createTime,
  68 + this.enclosure,
  69 + this.isnoshow,
  70 + this.reply});
  71 +
  72 + CommentsSunModel.fromJson(Map<String, dynamic> json) {
  73 + id = json['id'];
  74 + pid = json['pid'];
  75 + sid = json['sid'];
  76 + rid = json['rid'];
  77 + author = json['author'];
  78 + authorImage = json['author_image'];
  79 + grade = json['grade'];
  80 + status = json['status'];
  81 + evalLabel = json['eval_label'];
  82 + text = json['text'];
  83 + createTime = json['create_time'];
  84 + enclosure = <CommentsImageModel>[];
  85 + if (json['enclosure'] != null) {
  86 + if (jsonDecode(json['enclosure']) is List) {
  87 + List temp = jsonDecode(json['enclosure']);
  88 + temp.forEach((element) {
  89 + enclosure.add(CommentsImageModel.fromJson(element));
  90 + });
  91 + }
  92 + }
  93 +
  94 + isnoshow = json['isnoshow'];
  95 + reply = json['reply'] != null ? new Reply.fromJson(json['reply']) : null;
  96 + }
  97 +
  98 + Map<String, dynamic> toJson() {
  99 + final Map<String, dynamic> data = new Map<String, dynamic>();
  100 + data['id'] = this.id;
  101 + data['pid'] = this.pid;
  102 + data['sid'] = this.sid;
  103 + data['rid'] = this.rid;
  104 + data['author'] = this.author;
  105 + data['author_image'] = this.authorImage;
  106 + data['grade'] = this.grade;
  107 + data['status'] = this.status;
  108 + data['eval_label'] = this.evalLabel;
  109 + data['text'] = this.text;
  110 + data['create_time'] = this.createTime;
  111 + data['enclosure'] = this.enclosure;
  112 + data['isnoshow'] = this.isnoshow;
  113 + if (this.reply != null) {
  114 + data['reply'] = this.reply.toJson();
  115 + }
  116 + if (this.enclosure != null) {
  117 + data['enclosure'] = jsonEncode(this.enclosure);
  118 + }
  119 + return data;
  120 + }
  121 +}
  122 +
  123 +class Reply {
  124 + String id;
  125 + String pid;
  126 + String sid;
  127 + String rid;
  128 + String author;
  129 + String authorImage;
  130 + String grade;
  131 + String status;
  132 + String evalLabel;
  133 + String text;
  134 + String createTime;
  135 + String enclosure;
  136 + dynamic isnoshow;
  137 +
  138 + Reply(
  139 + {this.id,
  140 + this.pid,
  141 + this.sid,
  142 + this.rid,
  143 + this.author,
  144 + this.authorImage,
  145 + this.grade,
  146 + this.status,
  147 + this.evalLabel,
  148 + this.text,
  149 + this.createTime,
  150 + this.enclosure,
  151 + this.isnoshow});
  152 +
  153 + Reply.fromJson(Map<String, dynamic> json) {
  154 + id = json['id'];
  155 + pid = json['pid'];
  156 + sid = json['sid'];
  157 + rid = json['rid'];
  158 + author = json['author'];
  159 + authorImage = json['author_image'];
  160 + grade = json['grade'];
  161 + status = json['status'];
  162 + evalLabel = json['eval_label'];
  163 + text = json['text'];
  164 + createTime = json['create_time'];
  165 + enclosure = json['enclosure'];
  166 + isnoshow = json['isnoshow'];
  167 + }
  168 +
  169 + Map<String, dynamic> toJson() {
  170 + final Map<String, dynamic> data = new Map<String, dynamic>();
  171 + data['id'] = this.id;
  172 + data['pid'] = this.pid;
  173 + data['sid'] = this.sid;
  174 + data['rid'] = this.rid;
  175 + data['author'] = this.author;
  176 + data['author_image'] = this.authorImage;
  177 + data['grade'] = this.grade;
  178 + data['status'] = this.status;
  179 + data['eval_label'] = this.evalLabel;
  180 + data['text'] = this.text;
  181 + data['create_time'] = this.createTime;
  182 + data['enclosure'] = this.enclosure;
  183 + data['isnoshow'] = this.isnoshow;
  184 + return data;
  185 + }
  186 +}
  187 +
  188 +class CommentsImageModel {
  189 + String key;
  190 + String bucket;
  191 + String mimeType;
  192 + String fsize;
  193 + dynamic exif;
  194 + ImageInfo imageInfo;
  195 + ImageAve imageAve;
  196 + String url;
  197 +
  198 + CommentsImageModel(
  199 + {this.key,
  200 + this.bucket,
  201 + this.mimeType,
  202 + this.fsize,
  203 + this.exif,
  204 + this.imageInfo,
  205 + this.imageAve,
  206 + this.url});
  207 +
  208 + CommentsImageModel.fromJson(Map<String, dynamic> json) {
  209 + key = json['key'];
  210 + bucket = json['bucket'];
  211 + mimeType = json['mimeType'];
  212 + fsize = json['fsize'];
  213 + exif = json['exif'];
  214 + imageInfo = json['imageInfo'] != null
  215 + ? new ImageInfo.fromJson(json['imageInfo'])
  216 + : null;
  217 + imageAve = json['imageAve'] != null
  218 + ? new ImageAve.fromJson(json['imageAve'])
  219 + : null;
  220 + url = json['url'];
  221 + }
  222 +
  223 + Map<String, dynamic> toJson() {
  224 + final Map<String, dynamic> data = new Map<String, dynamic>();
  225 + data['key'] = this.key;
  226 + data['bucket'] = this.bucket;
  227 + data['mimeType'] = this.mimeType;
  228 + data['fsize'] = this.fsize;
  229 + data['exif'] = this.exif;
  230 + if (this.imageInfo != null) {
  231 + data['imageInfo'] = this.imageInfo.toJson();
  232 + }
  233 + if (this.imageAve != null) {
  234 + data['imageAve'] = this.imageAve.toJson();
  235 + }
  236 + data['url'] = this.url;
  237 + return data;
  238 + }
  239 +}
  240 +
  241 +class ImageInfo {
  242 + String colorModel;
  243 + String format;
  244 + int height;
  245 + int size;
  246 + int width;
  247 +
  248 + ImageInfo({this.colorModel, this.format, this.height, this.size, this.width});
  249 +
  250 + ImageInfo.fromJson(Map<String, dynamic> json) {
  251 + colorModel = json['colorModel'];
  252 + format = json['format'];
  253 + height = json['height'];
  254 + size = json['size'];
  255 + width = json['width'];
  256 + }
  257 +
  258 + Map<String, dynamic> toJson() {
  259 + final Map<String, dynamic> data = new Map<String, dynamic>();
  260 + data['colorModel'] = this.colorModel;
  261 + data['format'] = this.format;
  262 + data['height'] = this.height;
  263 + data['size'] = this.size;
  264 + data['width'] = this.width;
  265 + return data;
  266 + }
  267 +}
  268 +
  269 +class ImageAve {
  270 + String rGB;
  271 +
  272 + ImageAve({this.rGB});
  273 +
  274 + ImageAve.fromJson(Map<String, dynamic> json) {
  275 + rGB = json['RGB'];
  276 + }
  277 +
  278 + Map<String, dynamic> toJson() {
  279 + final Map<String, dynamic> data = new Map<String, dynamic>();
  280 + data['RGB'] = this.rGB;
  281 + return data;
  282 + }
  283 +}
@@ -601,6 +601,7 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -601,6 +601,7 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
601 ), 601 ),
602 VEmptyView(8), 602 VEmptyView(8),
603 costItem('名称', '单价', '数量', '金额', isTitle: true), 603 costItem('名称', '单价', '数量', '金额', isTitle: true),
  604 +
604 ListView.builder( 605 ListView.builder(
605 itemCount: costInfoModel.data.length, 606 itemCount: costInfoModel.data.length,
606 shrinkWrap: true, 607 shrinkWrap: true,
  1 +import 'package:cached_network_image/cached_network_image.dart';
1 import 'package:flutter/material.dart'; 2 import 'package:flutter/material.dart';
2 import 'package:flutter/rendering.dart'; 3 import 'package:flutter/rendering.dart';
  4 +import 'package:one_key/models/comments_label_model.dart';
  5 +import 'package:one_key/models/comments_model.dart';
3 import 'package:one_key/provider/user_model.dart'; 6 import 'package:one_key/provider/user_model.dart';
4 import 'package:one_key/res/colors.dart'; 7 import 'package:one_key/res/colors.dart';
5 import 'package:one_key/widgets/h_empty_view.dart'; 8 import 'package:one_key/widgets/h_empty_view.dart';
@@ -8,10 +11,14 @@ import 'package:one_key/widgets/system_app_bar.dart'; @@ -8,10 +11,14 @@ import 'package:one_key/widgets/system_app_bar.dart';
8 import 'package:one_key/widgets/v_empty_view.dart'; 11 import 'package:one_key/widgets/v_empty_view.dart';
9 import 'package:provider/provider.dart'; 12 import 'package:provider/provider.dart';
10 13
  14 +import '../../../constant/state.dart';
11 import '../../../provider/comment_manage_provider.dart'; 15 import '../../../provider/comment_manage_provider.dart';
12 import '../../../utils/event_bus.dart'; 16 import '../../../utils/event_bus.dart';
13 import '../../../utils/screen_util.dart'; 17 import '../../../utils/screen_util.dart';
14 import '../../../utils/utils.dart'; 18 import '../../../utils/utils.dart';
  19 +import '../../../widgets/page_exception.dart';
  20 +import '../../online_check/photo_view_wiget.dart';
  21 +import 'package:sliding_up_panel2/sliding_up_panel2.dart';
15 22
16 /** 23 /**
17 * 评价管理 24 * 评价管理
@@ -24,13 +31,20 @@ class CommentManageHomePage extends StatefulWidget { @@ -24,13 +31,20 @@ class CommentManageHomePage extends StatefulWidget {
24 31
25 class _CommentManageHomePageState extends State<CommentManageHomePage> { 32 class _CommentManageHomePageState extends State<CommentManageHomePage> {
26 CommentManageProvider commentManageProvider; 33 CommentManageProvider commentManageProvider;
27 - 34 + ScrollController controller = ScrollController();
  35 + Map<String, String> starTextMap = {};
  36 + bool allSelect = true;
  37 + String label = '';
  38 + bool showInput = false;
28 @override 39 @override
29 void initState() { 40 void initState() {
30 super.initState(); 41 super.initState();
31 42
  43 + starTextMap = {'1': '差', '2': '有点差', '3': '一般', '4': '满意', '5': '非常满意'};
  44 +
32 WidgetsBinding.instance.addPostFrameCallback((_) { 45 WidgetsBinding.instance.addPostFrameCallback((_) {
33 - _getSellerComments(); 46 + _getSellerComments(isShowLoading: false);
  47 + _getCountCommentLabel(isShowLoading: false);
34 }); 48 });
35 } 49 }
36 50
@@ -41,38 +55,162 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> { @@ -41,38 +55,162 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> {
41 super.dispose(); 55 super.dispose();
42 } 56 }
43 57
44 - ///我的客户首页 58 + ///评价标签
  59 + _getCountCommentLabel({bool isShowLoading = true}) async {
  60 + Map<String, String> pramas = {
  61 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  62 + };
  63 + // label
  64 + await commentManageProvider.getCountCommentLabel(context, pramas,
  65 + isShowLoading: isShowLoading);
  66 + }
  67 +
  68 + ///评价列表
45 _getSellerComments({bool isShowLoading = true}) async { 69 _getSellerComments({bool isShowLoading = true}) async {
46 Map<String, String> pramas = { 70 Map<String, String> pramas = {
47 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid, 71 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
48 'scene': '3', 72 'scene': '3',
49 'status': '1' 73 'status': '1'
50 }; 74 };
51 - // label 75 + if (label != '') {
  76 + pramas['label'] = label;
  77 + }
  78 +
52 await commentManageProvider.getSellerComments(context, pramas, 79 await commentManageProvider.getSellerComments(context, pramas,
53 isShowLoading: isShowLoading); 80 isShowLoading: isShowLoading);
54 } 81 }
55 82
56 List<Widget> _labelWidget() { 83 List<Widget> _labelWidget() {
57 List<Widget> data = []; 84 List<Widget> data = [];
58 -  
59 - for (int i = 0; i < 10; i++) {  
60 - data.add(Container(  
61 - padding: EdgeInsets.symmetric(horizontal: w(8), vertical: w(3)),  
62 - decoration: BoxDecoration(  
63 - borderRadius: BorderRadius.circular(r(10)),  
64 - color: true ? MyColours.color_33438E93 : MyColours.color_F8F7F3),  
65 - child: Text(  
66 - '全部',  
67 - style: TextStyle(  
68 - fontSize: font(14),  
69 - color: true ? MyColours.color_438E93 : MyColours.color_515151),  
70 - ),  
71 - )); 85 + data.add(InkWell(
  86 + onTap: () {
  87 + allSelect = true;
  88 + commentManageProvider.commentsLabeldata.forEach((element) {
  89 + element.select = false;
  90 + });
  91 + setState(() {});
  92 + label = '';
  93 + _getSellerComments(isShowLoading: true);
  94 + },
  95 + child: Container(
  96 + padding: EdgeInsets.symmetric(horizontal: w(8), vertical: w(3)),
  97 + decoration: BoxDecoration(
  98 + borderRadius: BorderRadius.circular(r(10)),
  99 + color: allSelect
  100 + ? MyColours.color_33438E93
  101 + : MyColours.color_F8F7F3),
  102 + child: Text(
  103 + '全部',
  104 + style: TextStyle(
  105 + fontSize: font(14),
  106 + color: allSelect
  107 + ? MyColours.color_438E93
  108 + : MyColours.color_515151),
  109 + ),
  110 + )));
  111 + for (int i = 0; i < commentManageProvider.commentsLabeldata.length; i++) {
  112 + CommentsLabelSunModel sunModel =
  113 + commentManageProvider.commentsLabeldata[i];
  114 + data.add(InkWell(
  115 + onTap: () {
  116 + commentManageProvider.commentsLabeldata.forEach((element) {
  117 + element.select = false;
  118 + });
  119 + allSelect = false;
  120 + sunModel.select = true;
  121 + setState(() {});
  122 + label = sunModel.name;
  123 + _getSellerComments(isShowLoading: true);
  124 + },
  125 + child: Container(
  126 + padding: EdgeInsets.symmetric(horizontal: w(8), vertical: w(3)),
  127 + decoration: BoxDecoration(
  128 + borderRadius: BorderRadius.circular(r(10)),
  129 + color: sunModel.select
  130 + ? MyColours.color_33438E93
  131 + : MyColours.color_F8F7F3),
  132 + child: Text(
  133 + sunModel.name,
  134 + style: TextStyle(
  135 + fontSize: font(14),
  136 + color: sunModel.select
  137 + ? MyColours.color_438E93
  138 + : MyColours.color_515151),
  139 + ),
  140 + )));
72 } 141 }
73 return data; 142 return data;
74 } 143 }
75 144
  145 + /// 九宫格
  146 + Widget _getGridImg(List<CommentsImageModel> imags) {
  147 + return GridView.builder(
  148 + controller: controller,
  149 + padding: EdgeInsets.symmetric(vertical: w(7)),
  150 + shrinkWrap: true,
  151 + itemCount: imags.length,
  152 +
  153 + //SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
  154 + gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
  155 + //横轴元素个数
  156 + crossAxisCount: 3,
  157 + //纵轴间距
  158 + mainAxisSpacing: w(7),
  159 + //横轴间距
  160 + crossAxisSpacing: w(7),
  161 + //子组件宽高长度比例
  162 + childAspectRatio: 1.0),
  163 + itemBuilder: (BuildContext context, int index) {
  164 + return InkWell(
  165 + onTap: () {
  166 + List<String> images = imags.map((e) => e.url).toList();
  167 + _showPhotoView(context, index, images);
  168 + },
  169 + child: ClipRRect(
  170 + borderRadius: BorderRadius.circular(r(8)),
  171 + child: CachedNetworkImage(
  172 + imageUrl: imags[index].url,
  173 + fit: BoxFit.cover,
  174 +
  175 + // width: w(),
  176 + // height: ScreenUtil().setWidth(100 * 2),
  177 + ),
  178 + ));
  179 + });
  180 + }
  181 +
  182 + //查看大图
  183 + _showPhotoView(BuildContext context, int index, List imgs,
  184 + {isShow = false, List dashName}) async {
  185 + // if (imgs.length == 1 &&
  186 + // imgs[0] ==
  187 + // 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
  188 + // imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
  189 + // }
  190 + Utils.setBarStatus(false, color: Colors.black);
  191 + dynamic result = await showGeneralDialog(
  192 + context: context,
  193 + barrierDismissible: false,
  194 + // barrierColor: Colors.red,
  195 + barrierLabel:
  196 + MaterialLocalizations.of(context).modalBarrierDismissLabel,
  197 + transitionDuration: const Duration(milliseconds: 150),
  198 + pageBuilder: (BuildContext context, Animation animation,
  199 + Animation secondaryAnimation) {
  200 + Widget child = Stack(
  201 + children: <Widget>[
  202 + PhotoPreview(
  203 + initialIndex: index,
  204 + photoList: imgs,
  205 + isShow: isShow,
  206 + dashName: dashName)
  207 + ],
  208 + );
  209 + return child;
  210 + });
  211 + Utils.setBarStatus(true, color: Colors.white);
  212 + }
  213 +
76 @override 214 @override
77 Widget build(BuildContext context) { 215 Widget build(BuildContext context) {
78 commentManageProvider = 216 commentManageProvider =
@@ -80,102 +218,184 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> { @@ -80,102 +218,184 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> {
80 return Scaffold( 218 return Scaffold(
81 backgroundColor: MyColours.color_ffffff, 219 backgroundColor: MyColours.color_ffffff,
82 appBar: SystemAppBar('评价管理'), 220 appBar: SystemAppBar('评价管理'),
83 - body: Padding(  
84 - padding: EdgeInsets.symmetric(horizontal: w(20)),  
85 - child: Column(  
86 - children: [  
87 - Container(  
88 - child: Wrap(  
89 - runSpacing: w(10),  
90 - spacing: w(10),  
91 - children: _labelWidget()),  
92 - ),  
93 - VEmptyView(10),  
94 - Expanded(  
95 - child: ListView.builder(  
96 - itemCount: 10,  
97 - shrinkWrap: true,  
98 - itemBuilder: (context, index) {  
99 - return Container(  
100 - margin: EdgeInsets.only(top: w(10)),  
101 - decoration: BoxDecoration(  
102 - border: Border(  
103 - bottom: BorderSide(  
104 - width: w(0.5),  
105 - color: MyColours.color_DBDBDB))),  
106 - child: Row(  
107 - crossAxisAlignment: CrossAxisAlignment.start,  
108 - children: [  
109 - Container(  
110 - width: w(50),  
111 - height: w(50),  
112 - margin: EdgeInsets.only(  
113 - left: w(8), right: w(8), top: w(20)),  
114 - child: ClipRRect(  
115 - borderRadius:  
116 - BorderRadius.circular(w(50)),  
117 - child: Container(  
118 - width: w(50),  
119 - height: w(50),  
120 - decoration: BoxDecoration(  
121 - color: MyColours.color_d9d9d9,  
122 - borderRadius:  
123 - BorderRadius.circular(r(50))),  
124 - ))),  
125 - HEmptyView(34),  
126 - Expanded(  
127 - child: Padding(  
128 - padding: EdgeInsets.symmetric(  
129 - vertical: w(4)),  
130 - child: Column(  
131 - crossAxisAlignment:  
132 - CrossAxisAlignment.start,  
133 - children: [  
134 - Row( 221 + body: Consumer<CommentManageProvider>(builder: (context1, model, _) {
  222 + if (model.pageState != PageState.Success) {
  223 + return ExceptionPage(
  224 + pageState: model.pageState,
  225 + callback: () async {
  226 + _getCountCommentLabel();
  227 + _getSellerComments();
  228 + },
  229 + emptyMsg: "暂时没有评论列表信息哦",
  230 + emptyImg: "empty_search",
  231 + showMsg: "加载中,请稍后...",
  232 + );
  233 + } else {
  234 + return Container(
  235 + color: MyColours.color_ffffff,
  236 + padding: EdgeInsets.symmetric(horizontal: w(20)),
  237 + child: Column(
  238 + children: [
  239 + Container(
  240 + child: Wrap(
  241 + runSpacing: w(10),
  242 + spacing: w(10),
  243 + children: _labelWidget()),
  244 + ),
  245 + VEmptyView(10),
  246 + Expanded(
  247 + child: ListView.builder(
  248 + itemCount:
  249 + commentManageProvider.commentsData.length,
  250 + shrinkWrap: true,
  251 + controller: controller,
  252 + itemBuilder: (context, index) {
  253 + CommentsSunModel sunModel =
  254 + commentManageProvider.commentsData[index];
  255 + return Container(
  256 + margin: EdgeInsets.only(top: w(10)),
  257 + decoration: BoxDecoration(
  258 + border: Border(
  259 + bottom: BorderSide(
  260 + width: w(0.5),
  261 + color: MyColours.color_DBDBDB))),
  262 + child: Row(
  263 + crossAxisAlignment: CrossAxisAlignment.start,
  264 + children: [
  265 + Container(
  266 + width: w(50),
  267 + height: w(50),
  268 + margin: EdgeInsets.only(
  269 + left: w(8),
  270 + right: w(8),
  271 + top: w(20)),
  272 + child: ClipRRect(
  273 + borderRadius:
  274 + BorderRadius.circular(w(50)),
  275 + child: sunModel.authorImage !=
  276 + null &&
  277 + sunModel.authorImage != ''
  278 + ? CachedNetworkImage(
  279 + imageUrl:
  280 + sunModel.authorImage,
  281 + width: w(50),
  282 + height: w(50),
  283 + )
  284 + : Container(
  285 + width: w(50),
  286 + height: w(50),
  287 + decoration: BoxDecoration(
  288 + color: MyColours
  289 + .color_d9d9d9,
  290 + borderRadius:
  291 + BorderRadius
  292 + .circular(
  293 + r(50))),
  294 + ))),
  295 + HEmptyView(34),
  296 + Expanded(
  297 + child: Padding(
  298 + padding: EdgeInsets.symmetric(
  299 + vertical: w(4)),
  300 + child: Column(
  301 + crossAxisAlignment:
  302 + CrossAxisAlignment.start,
135 children: [ 303 children: [
  304 + Row(
  305 + children: [
  306 + Container(
  307 + padding: EdgeInsets
  308 + .symmetric(
  309 + vertical:
  310 + w(4)),
  311 + constraints:
  312 + BoxConstraints(
  313 + maxWidth:
  314 + w(120)),
  315 + child: Text(
  316 + sunModel.author ??
  317 + '',
  318 + maxLines: 10,
  319 + overflow:
  320 + TextOverflow
  321 + .ellipsis,
  322 + style: TextStyle(
  323 + fontSize:
  324 + font(14),
  325 + fontWeight:
  326 + FontWeight
  327 + .bold,
  328 + color: MyColours
  329 + .color_515151),
  330 + )),
  331 + Spacer(),
  332 + Container(
  333 + width: w(75),
  334 + height: w(24),
  335 + child:
  336 + ListView.builder(
  337 + itemCount: 5,
  338 + shrinkWrap:
  339 + true,
  340 + scrollDirection:
  341 + Axis
  342 + .horizontal,
  343 + itemBuilder:
  344 + (context,
  345 + index) {
  346 + return Image
  347 + .asset(
  348 + Utils.getImgPath(index <=
  349 + int.parse(sunModel.grade) - 1
  350 + ? 'zwzp'
  351 + : 'apple'),
  352 + width:
  353 + w(15),
  354 + );
  355 + })),
  356 + Container(
  357 + padding: EdgeInsets
  358 + .symmetric(
  359 + vertical:
  360 + w(4)),
  361 + child: Text(
  362 + starTextMap[
  363 + '${sunModel.grade}'] ??
  364 + '',
  365 + maxLines: 2,
  366 + overflow:
  367 + TextOverflow
  368 + .ellipsis,
  369 + style: TextStyle(
  370 + fontSize:
  371 + font(12),
  372 + color: MyColours
  373 + .color_999999),
  374 + )),
  375 + ],
  376 + ),
  377 + VEmptyView(8),
136 Container( 378 Container(
137 padding: 379 padding:
138 EdgeInsets.symmetric( 380 EdgeInsets.symmetric(
139 vertical: w(4)), 381 vertical: w(4)),
140 - constraints:  
141 - BoxConstraints(  
142 - maxWidth: w(120)),  
143 child: Text( 382 child: Text(
144 - '四处行走的花', 383 + '就餐于 2023-8-24 午餐 二楼205',
145 maxLines: 10, 384 maxLines: 10,
146 overflow: TextOverflow 385 overflow: TextOverflow
147 .ellipsis, 386 .ellipsis,
148 style: TextStyle( 387 style: TextStyle(
149 - fontSize: font(14),  
150 - fontWeight:  
151 - FontWeight.bold, 388 + fontSize: font(12),
152 color: MyColours 389 color: MyColours
153 - .color_515151), 390 + .color_999999),
154 )), 391 )),
155 - Spacer(),  
156 - Container(  
157 - width: w(75),  
158 - height: w(24),  
159 - child: ListView.builder(  
160 - itemCount: 5,  
161 - shrinkWrap: true,  
162 - scrollDirection:  
163 - Axis.horizontal,  
164 - itemBuilder:  
165 - (context, index) {  
166 - return Image.asset(  
167 - Utils.getImgPath(  
168 - 'zwzp'),  
169 - width: w(15),  
170 - );  
171 - })),  
172 Container( 392 Container(
173 padding: 393 padding:
174 EdgeInsets.symmetric( 394 EdgeInsets.symmetric(
175 vertical: w(4)), 395 vertical: w(4)),
176 child: Text( 396 child: Text(
177 - '非常满意',  
178 - maxLines: 2, 397 + '发表于 ${sunModel.createTimeStr}',
  398 + maxLines: 10,
179 overflow: TextOverflow 399 overflow: TextOverflow
180 .ellipsis, 400 .ellipsis,
181 style: TextStyle( 401 style: TextStyle(
@@ -183,85 +403,137 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> { @@ -183,85 +403,137 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> {
183 color: MyColours 403 color: MyColours
184 .color_999999), 404 .color_999999),
185 )), 405 )),
186 - ],  
187 - ),  
188 - VEmptyView(8),  
189 - Container(  
190 - padding: EdgeInsets.symmetric(  
191 - vertical: w(4)),  
192 - child: Text(  
193 - '就餐于 2023-8-24 午餐 二楼205',  
194 - maxLines: 10,  
195 - overflow:  
196 - TextOverflow.ellipsis,  
197 - style: TextStyle(  
198 - fontSize: font(12),  
199 - color: MyColours  
200 - .color_999999),  
201 - )),  
202 - Container(  
203 - padding: EdgeInsets.symmetric(  
204 - vertical: w(4)),  
205 - child: Text(  
206 - '发表于 2023-8-25',  
207 - maxLines: 10,  
208 - overflow:  
209 - TextOverflow.ellipsis,  
210 - style: TextStyle(  
211 - fontSize: font(12),  
212 - color: MyColours  
213 - .color_999999),  
214 - )),  
215 - VEmptyView(8),  
216 - Container(  
217 - padding: EdgeInsets.symmetric(  
218 - vertical: w(4)),  
219 - child: Text(  
220 - '第二次来了,味道还是一如既往的好吃,包间也很干净整洁,',  
221 - style: TextStyle(  
222 - height: 1.8,  
223 - fontSize: font(12),  
224 - color: MyColours  
225 - .color_515151),  
226 - )),  
227 - Container(  
228 - padding: EdgeInsets.symmetric(  
229 - vertical: w(4)),  
230 - child: Text(  
231 - '#口味佳,服务热情',  
232 - style: TextStyle(  
233 - height: 1.8,  
234 - fontSize: font(12),  
235 - color: MyColours  
236 - .color_438E93),  
237 - )),  
238 - VEmptyView(8),  
239 - Align(  
240 - alignment:  
241 - Alignment.centerRight,  
242 - child: RoundButton(  
243 - text: '回复',  
244 - width: w(54),  
245 - height: w(24),  
246 - gradientStart:  
247 - MyColours.color_ffffff,  
248 - gradientEnd:  
249 - MyColours.color_ffffff,  
250 - textColor:  
251 - MyColours.color_000000,  
252 - fontSize: 24,  
253 - borderColor:  
254 - MyColours.color_999999,  
255 - radius: r(15),  
256 - ),  
257 - ),  
258 - VEmptyView(26),  
259 - ]))),  
260 - ],  
261 - ),  
262 - );  
263 - }))  
264 - ],  
265 - ))); 406 + VEmptyView(8),
  407 + if (sunModel.text != null &&
  408 + sunModel.text.length > 0)
  409 + Container(
  410 + padding: EdgeInsets
  411 + .symmetric(
  412 + vertical: w(4)),
  413 + child: Text(
  414 + sunModel.text ?? '',
  415 + style: TextStyle(
  416 + height: 1.8,
  417 + fontSize:
  418 + font(12),
  419 + color: MyColours
  420 + .color_515151),
  421 + )),
  422 + Container(
  423 + padding:
  424 + EdgeInsets.symmetric(
  425 + vertical: w(4)),
  426 + child: Text(
  427 + '#${sunModel.evalLabel ?? ''}',
  428 + style: TextStyle(
  429 + height: 1.8,
  430 + fontSize: font(12),
  431 + color: MyColours
  432 + .color_438E93),
  433 + )),
  434 + if (sunModel
  435 + .enclosure.length >
  436 + 0)
  437 + _getGridImg(
  438 + sunModel.enclosure),
  439 + VEmptyView(8),
  440 + sunModel.reply != null
  441 + ? Container(
  442 + width:
  443 + double.infinity,
  444 + padding:
  445 + EdgeInsets.all(
  446 + w(4)),
  447 + decoration: BoxDecoration(
  448 + color: MyColours
  449 + .color_33438E93,
  450 + borderRadius:
  451 + BorderRadius
  452 + .circular(
  453 + r(8))),
  454 + child: Column(
  455 + crossAxisAlignment:
  456 + CrossAxisAlignment
  457 + .start,
  458 + children: [
  459 + Text(
  460 + '回复内容',
  461 + style: TextStyle(
  462 + color: MyColours
  463 + .color_515151,
  464 + fontWeight:
  465 + FontWeight
  466 + .bold,
  467 + fontSize:
  468 + font(
  469 + 12)),
  470 + ),
  471 + VEmptyView(6),
  472 + Container(
  473 + padding: EdgeInsets
  474 + .symmetric(
  475 + vertical:
  476 + w(4)),
  477 + child: Text(
  478 + sunModel.reply
  479 + .text ??
  480 + "",
  481 + style: TextStyle(
  482 + height:
  483 + 1.8,
  484 + fontSize:
  485 + font(
  486 + 12),
  487 + color: MyColours
  488 + .color_515151),
  489 + )),
  490 + ],
  491 + ),
  492 + )
  493 + :
  494 + // showInput
  495 + // ? SlidingUpPanel(
  496 + // panel: Center(
  497 + // child: Text(
  498 + // "This is the sliding Widget"),
  499 + // ),
  500 + // )
  501 + // :
  502 + Align(
  503 + alignment: Alignment
  504 + .centerRight,
  505 + child: RoundButton(
  506 + text: '回复',
  507 + width: w(54),
  508 + height: w(24),
  509 + gradientStart:
  510 + MyColours
  511 + .color_ffffff,
  512 + gradientEnd: MyColours
  513 + .color_ffffff,
  514 + textColor: MyColours
  515 + .color_000000,
  516 + fontSize: 24,
  517 + borderColor: MyColours
  518 + .color_999999,
  519 + radius: r(15),
  520 + onPressed: () {
  521 + setState(() {
  522 + showInput =
  523 + !showInput;
  524 + });
  525 + },
  526 + ),
  527 + ),
  528 + VEmptyView(26),
  529 + ]))),
  530 + ],
  531 + ),
  532 + );
  533 + }))
  534 + ],
  535 + ));
  536 + }
  537 + }));
266 } 538 }
267 } 539 }
@@ -3,6 +3,8 @@ import 'package:one_key/constant/state.dart'; @@ -3,6 +3,8 @@ import 'package:one_key/constant/state.dart';
3 3
4 import '../constant/constant.dart'; 4 import '../constant/constant.dart';
5 import '../constant/error.dart'; 5 import '../constant/error.dart';
  6 +import '../models/comments_label_model.dart';
  7 +import '../models/comments_model.dart';
6 import '../net/base_resp.dart'; 8 import '../net/base_resp.dart';
7 import '../net/dio_util.dart'; 9 import '../net/dio_util.dart';
8 import '../net/http_url.dart'; 10 import '../net/http_url.dart';
@@ -11,6 +13,94 @@ import '../utils/utils.dart'; @@ -11,6 +13,94 @@ import '../utils/utils.dart';
11 class CommentManageProvider extends ChangeNotifier { 13 class CommentManageProvider extends ChangeNotifier {
12 PageState pageState = PageState.Loading; 14 PageState pageState = PageState.Loading;
13 15
  16 + List<CommentsSunModel> commentsData = [];
  17 + List<CommentsLabelSunModel> commentsLabeldata = [];
  18 +
  19 + ///回复商家评价
  20 + Future<dynamic> setComment(BuildContext context, Map<String, String> params,
  21 + {isShowLoading = true}) async {
  22 + BaseResp<dynamic> baseResp = await DioUtil()
  23 + .request<dynamic>(context, Method.get, HttpUrl.set_comment,
  24 + data: params, showLoading: isShowLoading)
  25 + .catchError((error) {
  26 + print(error.toString());
  27 + if (error is MyError) {
  28 + // switch (error.type) {
  29 + // case 1:
  30 + // pageState = PageState.ConnectivityError;
  31 + // break;
  32 + // case 2:
  33 + // pageState = PageState.ConnectivityTimeOut;
  34 + // break;
  35 + // default:
  36 + // pageState = PageState.ConnectivityError;
  37 + // break;
  38 + // }
  39 + }
  40 + // notifyListeners();
  41 + return false;
  42 + });
  43 + if (baseResp.code == Constant.status_success) {
  44 +
  45 + notifyListeners();
  46 + return true;
  47 + // } else {
  48 + // return false;
  49 + // }
  50 + } else {
  51 + if (baseResp != null) {
  52 + Utils.showToast(baseResp.msg ?? "");
  53 + }
  54 +
  55 + notifyListeners();
  56 + return false;
  57 + }
  58 + }
  59 +
  60 + ///获取标签
  61 + Future<dynamic> getCountCommentLabel(
  62 + BuildContext context, Map<String, String> params,
  63 + {isShowLoading = true}) async {
  64 + BaseResp<dynamic> baseResp = await DioUtil()
  65 + .request<dynamic>(context, Method.get, HttpUrl.get_count_comment_label,
  66 + data: params, showLoading: isShowLoading)
  67 + .catchError((error) {
  68 + print(error.toString());
  69 + if (error is MyError) {
  70 + // switch (error.type) {
  71 + // case 1:
  72 + // pageState = PageState.ConnectivityError;
  73 + // break;
  74 + // case 2:
  75 + // pageState = PageState.ConnectivityTimeOut;
  76 + // break;
  77 + // default:
  78 + // pageState = PageState.ConnectivityError;
  79 + // break;
  80 + // }
  81 + }
  82 + // notifyListeners();
  83 + return false;
  84 + });
  85 + if (baseResp.code == Constant.status_success) {
  86 + commentsLabeldata =
  87 + CommentsLabelModel.fromJson(baseResp.responseData).data;
  88 +
  89 + notifyListeners();
  90 + return true;
  91 + // } else {
  92 + // return false;
  93 + // }
  94 + } else {
  95 + if (baseResp != null) {
  96 + Utils.showToast(baseResp.msg ?? "");
  97 + }
  98 +
  99 + notifyListeners();
  100 + return false;
  101 + }
  102 + }
  103 +
14 ///获取评价列表 104 ///获取评价列表
15 Future<dynamic> getSellerComments( 105 Future<dynamic> getSellerComments(
16 BuildContext context, Map<String, String> params, 106 BuildContext context, Map<String, String> params,
@@ -37,14 +127,13 @@ class CommentManageProvider extends ChangeNotifier { @@ -37,14 +127,13 @@ class CommentManageProvider extends ChangeNotifier {
37 return false; 127 return false;
38 }); 128 });
39 if (baseResp.code == Constant.status_success) { 129 if (baseResp.code == Constant.status_success) {
40 - // beFollowData =  
41 - // GetBanquetBeFollowModel.fromJson(baseResp.responseData).data; 130 + commentsData = CommentsModel.fromJson(baseResp.responseData).data;
42 131
43 - // if (beFollowData.length == 0) {  
44 - // pageState = PageState.Empty;  
45 - // } else {  
46 - // pageState = PageState.Success;  
47 - // } 132 + if (commentsData.length == 0) {
  133 + pageState = PageState.Empty;
  134 + } else {
  135 + pageState = PageState.Success;
  136 + }
48 137
49 notifyListeners(); 138 notifyListeners();
50 return true; 139 return true;
@@ -1195,6 +1195,13 @@ packages: @@ -1195,6 +1195,13 @@ packages:
1195 description: flutter 1195 description: flutter
1196 source: sdk 1196 source: sdk
1197 version: "0.0.99" 1197 version: "0.0.99"
  1198 + sliding_up_panel2:
  1199 + dependency: "direct main"
  1200 + description:
  1201 + name: sliding_up_panel2
  1202 + url: "https://pub.flutter-io.cn"
  1203 + source: hosted
  1204 + version: "3.3.0+1"
1198 source_gen: 1205 source_gen:
1199 dependency: transitive 1206 dependency: transitive
1200 description: 1207 description:
@@ -195,6 +195,9 @@ dependencies: @@ -195,6 +195,9 @@ dependencies:
195 # 柱形图 195 # 柱形图
196 fl_chart: ^0.62.0 196 fl_chart: ^0.62.0
197 197
  198 + #评论弹框
  199 + sliding_up_panel2: ^3.3.0+1
  200 +
198 201
199 202
200 # shimmer: ^3.0.0 203 # shimmer: ^3.0.0