Commit e5cd8a9fbf39f610b1dd29d4373bf017d1f73d50

Authored by wdn127929
1 parent 838c246d

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

class CommentsLabelModel {
int ret;
List<CommentsLabelSunModel> data;
String msg;
CommentsLabelModel({this.ret, this.data, this.msg});
CommentsLabelModel.fromJson(Map<String, dynamic> json) {
ret = json['ret'];
if (json['data'] != null) {
data = <CommentsLabelSunModel>[];
json['data'].forEach((v) {
data.add(new CommentsLabelSunModel.fromJson(v));
});
}
msg = json['msg'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ret'] = this.ret;
if (this.data != null) {
data['data'] = this.data.map((v) => v.toJson()).toList();
}
data['msg'] = this.msg;
return data;
}
}
class CommentsLabelSunModel {
String name;
String total;
bool select = false;
CommentsLabelSunModel({this.name, this.total});
CommentsLabelSunModel.fromJson(Map<String, dynamic> json) {
name = json['name'];
total = json['total'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['total'] = this.total;
return data;
}
}
... ...
import 'dart:convert';
import 'package:common_utils/common_utils.dart';
class CommentsModel {
int ret;
List<CommentsSunModel> data;
String msg;
CommentsModel({this.ret, this.data, this.msg});
CommentsModel.fromJson(Map<String, dynamic> json) {
ret = json['ret'];
if (json['data'] != null) {
data = <CommentsSunModel>[];
json['data'].forEach((v) {
data.add(new CommentsSunModel.fromJson(v));
});
}
msg = json['msg'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ret'] = this.ret;
if (this.data != null) {
data['data'] = this.data.map((v) => v.toJson()).toList();
}
data['msg'] = this.msg;
return data;
}
}
class CommentsSunModel {
String id;
String pid;
String sid;
String rid;
String author;
String authorImage;
String grade;
String status;
String evalLabel;
String text;
String createTime;
List<CommentsImageModel> enclosure;
String isnoshow;
Reply reply;
String get createTimeStr {
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(
int.parse(createTime.toString()) * 1000);
return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
}
CommentsSunModel(
{this.id,
this.pid,
this.sid,
this.rid,
this.author,
this.authorImage,
this.grade,
this.status,
this.evalLabel,
this.text,
this.createTime,
this.enclosure,
this.isnoshow,
this.reply});
CommentsSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
pid = json['pid'];
sid = json['sid'];
rid = json['rid'];
author = json['author'];
authorImage = json['author_image'];
grade = json['grade'];
status = json['status'];
evalLabel = json['eval_label'];
text = json['text'];
createTime = json['create_time'];
enclosure = <CommentsImageModel>[];
if (json['enclosure'] != null) {
if (jsonDecode(json['enclosure']) is List) {
List temp = jsonDecode(json['enclosure']);
temp.forEach((element) {
enclosure.add(CommentsImageModel.fromJson(element));
});
}
}
isnoshow = json['isnoshow'];
reply = json['reply'] != null ? new Reply.fromJson(json['reply']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['pid'] = this.pid;
data['sid'] = this.sid;
data['rid'] = this.rid;
data['author'] = this.author;
data['author_image'] = this.authorImage;
data['grade'] = this.grade;
data['status'] = this.status;
data['eval_label'] = this.evalLabel;
data['text'] = this.text;
data['create_time'] = this.createTime;
data['enclosure'] = this.enclosure;
data['isnoshow'] = this.isnoshow;
if (this.reply != null) {
data['reply'] = this.reply.toJson();
}
if (this.enclosure != null) {
data['enclosure'] = jsonEncode(this.enclosure);
}
return data;
}
}
class Reply {
String id;
String pid;
String sid;
String rid;
String author;
String authorImage;
String grade;
String status;
String evalLabel;
String text;
String createTime;
String enclosure;
dynamic isnoshow;
Reply(
{this.id,
this.pid,
this.sid,
this.rid,
this.author,
this.authorImage,
this.grade,
this.status,
this.evalLabel,
this.text,
this.createTime,
this.enclosure,
this.isnoshow});
Reply.fromJson(Map<String, dynamic> json) {
id = json['id'];
pid = json['pid'];
sid = json['sid'];
rid = json['rid'];
author = json['author'];
authorImage = json['author_image'];
grade = json['grade'];
status = json['status'];
evalLabel = json['eval_label'];
text = json['text'];
createTime = json['create_time'];
enclosure = json['enclosure'];
isnoshow = json['isnoshow'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['pid'] = this.pid;
data['sid'] = this.sid;
data['rid'] = this.rid;
data['author'] = this.author;
data['author_image'] = this.authorImage;
data['grade'] = this.grade;
data['status'] = this.status;
data['eval_label'] = this.evalLabel;
data['text'] = this.text;
data['create_time'] = this.createTime;
data['enclosure'] = this.enclosure;
data['isnoshow'] = this.isnoshow;
return data;
}
}
class CommentsImageModel {
String key;
String bucket;
String mimeType;
String fsize;
dynamic exif;
ImageInfo imageInfo;
ImageAve imageAve;
String url;
CommentsImageModel(
{this.key,
this.bucket,
this.mimeType,
this.fsize,
this.exif,
this.imageInfo,
this.imageAve,
this.url});
CommentsImageModel.fromJson(Map<String, dynamic> json) {
key = json['key'];
bucket = json['bucket'];
mimeType = json['mimeType'];
fsize = json['fsize'];
exif = json['exif'];
imageInfo = json['imageInfo'] != null
? new ImageInfo.fromJson(json['imageInfo'])
: null;
imageAve = json['imageAve'] != null
? new ImageAve.fromJson(json['imageAve'])
: null;
url = json['url'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['key'] = this.key;
data['bucket'] = this.bucket;
data['mimeType'] = this.mimeType;
data['fsize'] = this.fsize;
data['exif'] = this.exif;
if (this.imageInfo != null) {
data['imageInfo'] = this.imageInfo.toJson();
}
if (this.imageAve != null) {
data['imageAve'] = this.imageAve.toJson();
}
data['url'] = this.url;
return data;
}
}
class ImageInfo {
String colorModel;
String format;
int height;
int size;
int width;
ImageInfo({this.colorModel, this.format, this.height, this.size, this.width});
ImageInfo.fromJson(Map<String, dynamic> json) {
colorModel = json['colorModel'];
format = json['format'];
height = json['height'];
size = json['size'];
width = json['width'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['colorModel'] = this.colorModel;
data['format'] = this.format;
data['height'] = this.height;
data['size'] = this.size;
data['width'] = this.width;
return data;
}
}
class ImageAve {
String rGB;
ImageAve({this.rGB});
ImageAve.fromJson(Map<String, dynamic> json) {
rGB = json['RGB'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['RGB'] = this.rGB;
return data;
}
}
... ...
... ... @@ -601,6 +601,7 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
),
VEmptyView(8),
costItem('名称', '单价', '数量', '金额', isTitle: true),
ListView.builder(
itemCount: costInfoModel.data.length,
shrinkWrap: true,
... ...
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:one_key/models/comments_label_model.dart';
import 'package:one_key/models/comments_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/widgets/h_empty_view.dart';
... ... @@ -8,10 +11,14 @@ import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../../constant/state.dart';
import '../../../provider/comment_manage_provider.dart';
import '../../../utils/event_bus.dart';
import '../../../utils/screen_util.dart';
import '../../../utils/utils.dart';
import '../../../widgets/page_exception.dart';
import '../../online_check/photo_view_wiget.dart';
import 'package:sliding_up_panel2/sliding_up_panel2.dart';
/**
* 评价管理
... ... @@ -24,13 +31,20 @@ class CommentManageHomePage extends StatefulWidget {
class _CommentManageHomePageState extends State<CommentManageHomePage> {
CommentManageProvider commentManageProvider;
ScrollController controller = ScrollController();
Map<String, String> starTextMap = {};
bool allSelect = true;
String label = '';
bool showInput = false;
@override
void initState() {
super.initState();
starTextMap = {'1': '差', '2': '有点差', '3': '一般', '4': '满意', '5': '非常满意'};
WidgetsBinding.instance.addPostFrameCallback((_) {
_getSellerComments();
_getSellerComments(isShowLoading: false);
_getCountCommentLabel(isShowLoading: false);
});
}
... ... @@ -41,38 +55,162 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> {
super.dispose();
}
///我的客户首页
///评价标签
_getCountCommentLabel({bool isShowLoading = true}) async {
Map<String, String> pramas = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
};
// label
await commentManageProvider.getCountCommentLabel(context, pramas,
isShowLoading: isShowLoading);
}
///评价列表
_getSellerComments({bool isShowLoading = true}) async {
Map<String, String> pramas = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'scene': '3',
'status': '1'
};
// label
if (label != '') {
pramas['label'] = label;
}
await commentManageProvider.getSellerComments(context, pramas,
isShowLoading: isShowLoading);
}
List<Widget> _labelWidget() {
List<Widget> data = [];
for (int i = 0; i < 10; i++) {
data.add(Container(
padding: EdgeInsets.symmetric(horizontal: w(8), vertical: w(3)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(10)),
color: true ? MyColours.color_33438E93 : MyColours.color_F8F7F3),
child: Text(
'全部',
style: TextStyle(
fontSize: font(14),
color: true ? MyColours.color_438E93 : MyColours.color_515151),
),
));
data.add(InkWell(
onTap: () {
allSelect = true;
commentManageProvider.commentsLabeldata.forEach((element) {
element.select = false;
});
setState(() {});
label = '';
_getSellerComments(isShowLoading: true);
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: w(8), vertical: w(3)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(10)),
color: allSelect
? MyColours.color_33438E93
: MyColours.color_F8F7F3),
child: Text(
'全部',
style: TextStyle(
fontSize: font(14),
color: allSelect
? MyColours.color_438E93
: MyColours.color_515151),
),
)));
for (int i = 0; i < commentManageProvider.commentsLabeldata.length; i++) {
CommentsLabelSunModel sunModel =
commentManageProvider.commentsLabeldata[i];
data.add(InkWell(
onTap: () {
commentManageProvider.commentsLabeldata.forEach((element) {
element.select = false;
});
allSelect = false;
sunModel.select = true;
setState(() {});
label = sunModel.name;
_getSellerComments(isShowLoading: true);
},
child: Container(
padding: EdgeInsets.symmetric(horizontal: w(8), vertical: w(3)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(10)),
color: sunModel.select
? MyColours.color_33438E93
: MyColours.color_F8F7F3),
child: Text(
sunModel.name,
style: TextStyle(
fontSize: font(14),
color: sunModel.select
? MyColours.color_438E93
: MyColours.color_515151),
),
)));
}
return data;
}
/// 九宫格
Widget _getGridImg(List<CommentsImageModel> imags) {
return GridView.builder(
controller: controller,
padding: EdgeInsets.symmetric(vertical: w(7)),
shrinkWrap: true,
itemCount: imags.length,
//SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//横轴元素个数
crossAxisCount: 3,
//纵轴间距
mainAxisSpacing: w(7),
//横轴间距
crossAxisSpacing: w(7),
//子组件宽高长度比例
childAspectRatio: 1.0),
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: () {
List<String> images = imags.map((e) => e.url).toList();
_showPhotoView(context, index, images);
},
child: ClipRRect(
borderRadius: BorderRadius.circular(r(8)),
child: CachedNetworkImage(
imageUrl: imags[index].url,
fit: BoxFit.cover,
// width: w(),
// height: ScreenUtil().setWidth(100 * 2),
),
));
});
}
//查看大图
_showPhotoView(BuildContext context, int index, List imgs,
{isShow = false, List dashName}) async {
// if (imgs.length == 1 &&
// imgs[0] ==
// 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
// imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
// }
Utils.setBarStatus(false, color: Colors.black);
dynamic result = await showGeneralDialog(
context: context,
barrierDismissible: false,
// barrierColor: Colors.red,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
pageBuilder: (BuildContext context, Animation animation,
Animation secondaryAnimation) {
Widget child = Stack(
children: <Widget>[
PhotoPreview(
initialIndex: index,
photoList: imgs,
isShow: isShow,
dashName: dashName)
],
);
return child;
});
Utils.setBarStatus(true, color: Colors.white);
}
@override
Widget build(BuildContext context) {
commentManageProvider =
... ... @@ -80,102 +218,184 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> {
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar('评价管理'),
body: Padding(
padding: EdgeInsets.symmetric(horizontal: w(20)),
child: Column(
children: [
Container(
child: Wrap(
runSpacing: w(10),
spacing: w(10),
children: _labelWidget()),
),
VEmptyView(10),
Expanded(
child: ListView.builder(
itemCount: 10,
shrinkWrap: true,
itemBuilder: (context, index) {
return Container(
margin: EdgeInsets.only(top: w(10)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(0.5),
color: MyColours.color_DBDBDB))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: w(50),
height: w(50),
margin: EdgeInsets.only(
left: w(8), right: w(8), top: w(20)),
child: ClipRRect(
borderRadius:
BorderRadius.circular(w(50)),
child: Container(
width: w(50),
height: w(50),
decoration: BoxDecoration(
color: MyColours.color_d9d9d9,
borderRadius:
BorderRadius.circular(r(50))),
))),
HEmptyView(34),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(
vertical: w(4)),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
body: Consumer<CommentManageProvider>(builder: (context1, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () async {
_getCountCommentLabel();
_getSellerComments();
},
emptyMsg: "暂时没有评论列表信息哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Container(
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(horizontal: w(20)),
child: Column(
children: [
Container(
child: Wrap(
runSpacing: w(10),
spacing: w(10),
children: _labelWidget()),
),
VEmptyView(10),
Expanded(
child: ListView.builder(
itemCount:
commentManageProvider.commentsData.length,
shrinkWrap: true,
controller: controller,
itemBuilder: (context, index) {
CommentsSunModel sunModel =
commentManageProvider.commentsData[index];
return Container(
margin: EdgeInsets.only(top: w(10)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(0.5),
color: MyColours.color_DBDBDB))),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: w(50),
height: w(50),
margin: EdgeInsets.only(
left: w(8),
right: w(8),
top: w(20)),
child: ClipRRect(
borderRadius:
BorderRadius.circular(w(50)),
child: sunModel.authorImage !=
null &&
sunModel.authorImage != ''
? CachedNetworkImage(
imageUrl:
sunModel.authorImage,
width: w(50),
height: w(50),
)
: Container(
width: w(50),
height: w(50),
decoration: BoxDecoration(
color: MyColours
.color_d9d9d9,
borderRadius:
BorderRadius
.circular(
r(50))),
))),
HEmptyView(34),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(
vertical: w(4)),
child: Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Row(
children: [
Container(
padding: EdgeInsets
.symmetric(
vertical:
w(4)),
constraints:
BoxConstraints(
maxWidth:
w(120)),
child: Text(
sunModel.author ??
'',
maxLines: 10,
overflow:
TextOverflow
.ellipsis,
style: TextStyle(
fontSize:
font(14),
fontWeight:
FontWeight
.bold,
color: MyColours
.color_515151),
)),
Spacer(),
Container(
width: w(75),
height: w(24),
child:
ListView.builder(
itemCount: 5,
shrinkWrap:
true,
scrollDirection:
Axis
.horizontal,
itemBuilder:
(context,
index) {
return Image
.asset(
Utils.getImgPath(index <=
int.parse(sunModel.grade) - 1
? 'zwzp'
: 'apple'),
width:
w(15),
);
})),
Container(
padding: EdgeInsets
.symmetric(
vertical:
w(4)),
child: Text(
starTextMap[
'${sunModel.grade}'] ??
'',
maxLines: 2,
overflow:
TextOverflow
.ellipsis,
style: TextStyle(
fontSize:
font(12),
color: MyColours
.color_999999),
)),
],
),
VEmptyView(8),
Container(
padding:
EdgeInsets.symmetric(
vertical: w(4)),
constraints:
BoxConstraints(
maxWidth: w(120)),
child: Text(
'四处行走的花',
'就餐于 2023-8-24 午餐 二楼205',
maxLines: 10,
overflow: TextOverflow
.ellipsis,
style: TextStyle(
fontSize: font(14),
fontWeight:
FontWeight.bold,
fontSize: font(12),
color: MyColours
.color_515151),
.color_999999),
)),
Spacer(),
Container(
width: w(75),
height: w(24),
child: ListView.builder(
itemCount: 5,
shrinkWrap: true,
scrollDirection:
Axis.horizontal,
itemBuilder:
(context, index) {
return Image.asset(
Utils.getImgPath(
'zwzp'),
width: w(15),
);
})),
Container(
padding:
EdgeInsets.symmetric(
vertical: w(4)),
child: Text(
'非常满意',
maxLines: 2,
'发表于 ${sunModel.createTimeStr}',
maxLines: 10,
overflow: TextOverflow
.ellipsis,
style: TextStyle(
... ... @@ -183,85 +403,137 @@ class _CommentManageHomePageState extends State<CommentManageHomePage> {
color: MyColours
.color_999999),
)),
],
),
VEmptyView(8),
Container(
padding: EdgeInsets.symmetric(
vertical: w(4)),
child: Text(
'就餐于 2023-8-24 午餐 二楼205',
maxLines: 10,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
fontSize: font(12),
color: MyColours
.color_999999),
)),
Container(
padding: EdgeInsets.symmetric(
vertical: w(4)),
child: Text(
'发表于 2023-8-25',
maxLines: 10,
overflow:
TextOverflow.ellipsis,
style: TextStyle(
fontSize: font(12),
color: MyColours
.color_999999),
)),
VEmptyView(8),
Container(
padding: EdgeInsets.symmetric(
vertical: w(4)),
child: Text(
'第二次来了,味道还是一如既往的好吃,包间也很干净整洁,',
style: TextStyle(
height: 1.8,
fontSize: font(12),
color: MyColours
.color_515151),
)),
Container(
padding: EdgeInsets.symmetric(
vertical: w(4)),
child: Text(
'#口味佳,服务热情',
style: TextStyle(
height: 1.8,
fontSize: font(12),
color: MyColours
.color_438E93),
)),
VEmptyView(8),
Align(
alignment:
Alignment.centerRight,
child: RoundButton(
text: '回复',
width: w(54),
height: w(24),
gradientStart:
MyColours.color_ffffff,
gradientEnd:
MyColours.color_ffffff,
textColor:
MyColours.color_000000,
fontSize: 24,
borderColor:
MyColours.color_999999,
radius: r(15),
),
),
VEmptyView(26),
]))),
],
),
);
}))
],
)));
VEmptyView(8),
if (sunModel.text != null &&
sunModel.text.length > 0)
Container(
padding: EdgeInsets
.symmetric(
vertical: w(4)),
child: Text(
sunModel.text ?? '',
style: TextStyle(
height: 1.8,
fontSize:
font(12),
color: MyColours
.color_515151),
)),
Container(
padding:
EdgeInsets.symmetric(
vertical: w(4)),
child: Text(
'#${sunModel.evalLabel ?? ''}',
style: TextStyle(
height: 1.8,
fontSize: font(12),
color: MyColours
.color_438E93),
)),
if (sunModel
.enclosure.length >
0)
_getGridImg(
sunModel.enclosure),
VEmptyView(8),
sunModel.reply != null
? Container(
width:
double.infinity,
padding:
EdgeInsets.all(
w(4)),
decoration: BoxDecoration(
color: MyColours
.color_33438E93,
borderRadius:
BorderRadius
.circular(
r(8))),
child: Column(
crossAxisAlignment:
CrossAxisAlignment
.start,
children: [
Text(
'回复内容',
style: TextStyle(
color: MyColours
.color_515151,
fontWeight:
FontWeight
.bold,
fontSize:
font(
12)),
),
VEmptyView(6),
Container(
padding: EdgeInsets
.symmetric(
vertical:
w(4)),
child: Text(
sunModel.reply
.text ??
"",
style: TextStyle(
height:
1.8,
fontSize:
font(
12),
color: MyColours
.color_515151),
)),
],
),
)
:
// showInput
// ? SlidingUpPanel(
// panel: Center(
// child: Text(
// "This is the sliding Widget"),
// ),
// )
// :
Align(
alignment: Alignment
.centerRight,
child: RoundButton(
text: '回复',
width: w(54),
height: w(24),
gradientStart:
MyColours
.color_ffffff,
gradientEnd: MyColours
.color_ffffff,
textColor: MyColours
.color_000000,
fontSize: 24,
borderColor: MyColours
.color_999999,
radius: r(15),
onPressed: () {
setState(() {
showInput =
!showInput;
});
},
),
),
VEmptyView(26),
]))),
],
),
);
}))
],
));
}
}));
}
}
... ...
... ... @@ -3,6 +3,8 @@ import 'package:one_key/constant/state.dart';
import '../constant/constant.dart';
import '../constant/error.dart';
import '../models/comments_label_model.dart';
import '../models/comments_model.dart';
import '../net/base_resp.dart';
import '../net/dio_util.dart';
import '../net/http_url.dart';
... ... @@ -11,6 +13,94 @@ import '../utils/utils.dart';
class CommentManageProvider extends ChangeNotifier {
PageState pageState = PageState.Loading;
List<CommentsSunModel> commentsData = [];
List<CommentsLabelSunModel> commentsLabeldata = [];
///回复商家评价
Future<dynamic> setComment(BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_comment,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {
// switch (error.type) {
// case 1:
// pageState = PageState.ConnectivityError;
// break;
// case 2:
// pageState = PageState.ConnectivityTimeOut;
// break;
// default:
// pageState = PageState.ConnectivityError;
// break;
// }
}
// notifyListeners();
return false;
});
if (baseResp.code == Constant.status_success) {
notifyListeners();
return true;
// } else {
// return false;
// }
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
notifyListeners();
return false;
}
}
///获取标签
Future<dynamic> getCountCommentLabel(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_count_comment_label,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {
// switch (error.type) {
// case 1:
// pageState = PageState.ConnectivityError;
// break;
// case 2:
// pageState = PageState.ConnectivityTimeOut;
// break;
// default:
// pageState = PageState.ConnectivityError;
// break;
// }
}
// notifyListeners();
return false;
});
if (baseResp.code == Constant.status_success) {
commentsLabeldata =
CommentsLabelModel.fromJson(baseResp.responseData).data;
notifyListeners();
return true;
// } else {
// return false;
// }
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
notifyListeners();
return false;
}
}
///获取评价列表
Future<dynamic> getSellerComments(
BuildContext context, Map<String, String> params,
... ... @@ -37,14 +127,13 @@ class CommentManageProvider extends ChangeNotifier {
return false;
});
if (baseResp.code == Constant.status_success) {
// beFollowData =
// GetBanquetBeFollowModel.fromJson(baseResp.responseData).data;
commentsData = CommentsModel.fromJson(baseResp.responseData).data;
// if (beFollowData.length == 0) {
// pageState = PageState.Empty;
// } else {
// pageState = PageState.Success;
// }
if (commentsData.length == 0) {
pageState = PageState.Empty;
} else {
pageState = PageState.Success;
}
notifyListeners();
return true;
... ...
... ... @@ -1195,6 +1195,13 @@ packages:
description: flutter
source: sdk
version: "0.0.99"
sliding_up_panel2:
dependency: "direct main"
description:
name: sliding_up_panel2
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.3.0+1"
source_gen:
dependency: transitive
description:
... ...
... ... @@ -195,6 +195,9 @@ dependencies:
# 柱形图
fl_chart: ^0.62.0
#评论弹框
sliding_up_panel2: ^3.3.0+1
# shimmer: ^3.0.0
... ...