Commit d0471654b7d5c0253b6e9cbe16fca0b1b5102714

Authored by wdn127929
1 parent f7713ffe

权限调整

... ... @@ -33,7 +33,7 @@ class Constant {
static const String qiniuUrl = 'https://qn.colorcun.com/';
static const String wechatAccessTokenKey = 'access_token';
static const String wechatAccessTokenKey = 'access_token';
static const Map<String, List<String>> authorityConfig = {
'充值短信': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
... ... @@ -41,16 +41,19 @@ class Constant {
'个人信息': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
'我的客情': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
'优惠券': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
'优惠券-停用-启用': ['管理员', '店长'],
'优惠券-详情页按钮': ['管理员', '店长'],
'常用备注': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
'套餐排菜': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
'客户存酒': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
'店铺信息': ['管理员', '店长'],
'全店客情': ['管理员', '店长'],
'桌位管理': ['管理员', '店长', '客户经理'],
'桌位管理': ['管理员', '店长'],
'桌位照片': [
'管理员',
'店长',
'客户经理',
],
'员工管理': [
'管理员',
... ... @@ -65,7 +68,6 @@ class Constant {
'包间类型': [
'管理员',
'店长',
'客户经理',
],
'包间置满': [
'管理员',
... ... @@ -75,12 +77,10 @@ class Constant {
'宴会管理': [
'管理员',
'店长',
'客户经理',
],
'营销中心': [
'管理员',
'店长',
'客户经理',
],
'评价管理': [
'管理员',
... ...
... ... @@ -369,6 +369,8 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
}
}
bool canOperate = Utils.getAuthority(context, '优惠券-详情页按钮');
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
... ... @@ -873,40 +875,48 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
width: w(100),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
borderColor: canOperate
? MyColours.color_438E93
: MyColours.color_999999,
textColor: canOperate
? MyColours.color_438E93
: MyColours.color_999999,
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: true,
fontSize: 28,
onPressed: () async {
if (couponProvider.couponSunModel!.status != '1') {
Utils.showToast('请先启用优惠券后再进行操作!');
return;
}
if (canOperate) {
if (couponProvider.couponSunModel!.status !=
'1') {
Utils.showToast('请先启用优惠券后再进行操作!');
return;
}
if (couponProvider.couponSunModel!.isType == '3') {
NavigatorUtil.goCouponPosterPage(
context,
widget.idstr,
couponProvider.couponSunModel!.use,
couponProvider.couponSunModel);
} else {
// 谁可以发放
// 可以发放的才能分享
if (couponProvider.couponSunModel!.uidList!
.split(',')
.contains(Provider.of<UserModel>(context,
listen: false)
.user!
.openid)) {
if (couponProvider.couponSunModel!.isType ==
'3') {
NavigatorUtil.goCouponPosterPage(
context,
widget.idstr,
couponProvider.couponSunModel!.use,
couponProvider.couponSunModel);
} else {
Utils.showToast('您没有此权限');
// 谁可以发放
// 可以发放的才能分享
if (couponProvider.couponSunModel!.uidList!
.split(',')
.contains(Provider.of<UserModel>(context,
listen: false)
.user!
.openid)) {
NavigatorUtil.goCouponPosterPage(
context,
widget.idstr,
couponProvider.couponSunModel!.use,
couponProvider.couponSunModel);
} else {
Utils.showToast('您没有此权限');
}
}
}
},
... ... @@ -920,44 +930,52 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
width: w(100),
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
textColor: MyColours.color_438E93,
borderColor: canOperate
? MyColours.color_438E93
: MyColours.color_999999,
textColor: canOperate
? MyColours.color_438E93
: MyColours.color_999999,
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: true,
fontSize: 28,
onPressed: () async {
if (couponProvider.couponSunModel!.isType == '3') {
//复用,跳转至编辑页面
dynamic needRefresh =
await NavigatorUtil.goCouponEditPage(context,
isMine: couponProvider
.couponSunModel!.isType ==
'1'
? false
: true,
couponSunModel:
couponProvider.couponSunModel);
if (needRefresh != null && needRefresh) {
if (Navigator.canPop(context)) {
Navigator.pop(context);
if (canOperate) {
if (couponProvider.couponSunModel!.isType ==
'3') {
//复用,跳转至编辑页面
dynamic needRefresh =
await NavigatorUtil.goCouponEditPage(
context,
isMine: couponProvider
.couponSunModel!.isType ==
'1'
? false
: true,
couponSunModel:
couponProvider.couponSunModel);
if (needRefresh != null && needRefresh) {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
}
} else {
//复用,跳转至编辑页面
dynamic needRefresh =
await NavigatorUtil.goCouponEditPayPage(
context,
isMine: couponProvider
.couponSunModel!.isType ==
'1'
? false
: true,
couponSunModel:
couponProvider.couponSunModel);
if (needRefresh != null && needRefresh) {
if (Navigator.canPop(context)) {
Navigator.pop(context);
} else {
//复用,跳转至编辑页面
dynamic needRefresh =
await NavigatorUtil.goCouponEditPayPage(
context,
isMine: couponProvider
.couponSunModel!.isType ==
'1'
? false
: true,
couponSunModel:
couponProvider.couponSunModel);
if (needRefresh != null && needRefresh) {
if (Navigator.canPop(context)) {
Navigator.pop(context);
}
}
}
}
... ... @@ -969,32 +987,25 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
text: '分享给客户',
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
gradientStart: canOperate
? MyColours.color_438E93
: MyColours.color_999999,
gradientEnd: canOperate
? MyColours.color_438E93
: MyColours.color_999999,
isBold: false,
fontSize: 28,
onPressed: () {
if (couponProvider.couponSunModel!.status != '1') {
Utils.showToast('请先启用优惠券后再进行操作!');
return;
}
if (couponProvider.couponSunModel!.status == '1') {
if (couponProvider.couponSunModel!.isType ==
'3') {
Utils.goShareBuyCouponToWeChat(
context,
widget.idstr,
couponProvider.couponSunModel!.isType,
couponProvider.couponSunModel!.use,
couponProvider.couponSunModel);
} else {
// 谁可以发放
// 可以发放的才能分享
if (couponProvider.couponSunModel!.uidList!
.split(',')
.contains(Provider.of<UserModel>(context,
listen: false)
.user!
.openid)) {
//包含当前登录人
if (canOperate) {
if (couponProvider.couponSunModel!.status !=
'1') {
Utils.showToast('请先启用优惠券后再进行操作!');
return;
}
if (couponProvider.couponSunModel!.status ==
'1') {
if (couponProvider.couponSunModel!.isType ==
'3') {
Utils.goShareBuyCouponToWeChat(
context,
widget.idstr,
... ... @@ -1002,20 +1013,37 @@ class _CouponDetailPageState extends State<CouponDetailPage> {
couponProvider.couponSunModel!.use,
couponProvider.couponSunModel);
} else {
Utils.showToast('您没有此权限');
// 谁可以发放
// 可以发放的才能分享
if (couponProvider.couponSunModel!.uidList!
.split(',')
.contains(Provider.of<UserModel>(context,
listen: false)
.user!
.openid)) {
//包含当前登录人
Utils.goShareBuyCouponToWeChat(
context,
widget.idstr,
couponProvider.couponSunModel!.isType,
couponProvider.couponSunModel!.use,
couponProvider.couponSunModel);
} else {
Utils.showToast('您没有此权限');
}
}
}
// else if (couponProvider.couponSunModel.isType ==
// '2' &&
// couponProvider.couponSunModel.status == '1') {
// // 我的优惠券
// Utils.goShareBuyCouponToWeChatMy(
// context,
// widget.idstr,
// managerName,
// couponProvider.couponSunModel);
// }
}
// else if (couponProvider.couponSunModel.isType ==
// '2' &&
// couponProvider.couponSunModel.status == '1') {
// // 我的优惠券
// Utils.goShareBuyCouponToWeChatMy(
// context,
// widget.idstr,
// managerName,
// couponProvider.couponSunModel);
// }
},
),
)
... ...
... ... @@ -21,6 +21,7 @@ class CouponItemF extends StatefulWidget {
final bool showCheck;
final bool radio;
final bool needNum;
final bool canOperate;
CouponItemF(
{Key? key,
... ... @@ -32,7 +33,8 @@ class CouponItemF extends StatefulWidget {
this.showBtn = false,
this.showCheck = false,
this.radio = false,
this.needNum = true})
this.needNum = true,
this.canOperate = false})
: super(key: key);
@override
... ... @@ -607,14 +609,14 @@ class _CouponItemFState extends State<CouponItemF> {
fontSize: 24,
textColor: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
: widget.canOperate && notSelect
? MyColours.color_438E93
: MyColours.color_999999,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: widget.from == 'history'
? MyColours.color_BFC4D4
: notSelect
: widget.canOperate && notSelect
? MyColours.color_438E93
: MyColours.color_999999,
onPressed: widget.onPressedSwich,
... ...
... ... @@ -125,7 +125,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
super.dispose();
}
Future<void> _scan() async {
Future<void> _scan() async {
try {
//全局提示权限使用目的
if (Platform.isAndroid) {
... ... @@ -190,6 +190,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
@override
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
bool isCreate = Utils.getAuthority(context, '创建新券');
return Scaffold(
backgroundColor: MyColours.color_f3f3f3,
appBar: Utils.getAuthority(context, '线上券-设置')
... ... @@ -221,7 +222,6 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
Tab(
text: "全部",
),
Tab(
text: "免费代金券",
),
... ... @@ -310,7 +310,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: true,
fontSize:32,
fontSize: 32,
onPressed: () async {
_scan();
},
... ... @@ -338,6 +338,18 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
text: '创建新券',
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
gradientStart: isCreate
? MyColours.color_199095
: MyColours.color_ffffff,
gradientEnd: isCreate
? MyColours.color_199095
: MyColours.color_ffffff,
textColor: isCreate
? MyColours.color_ffffff
: MyColours.color_999999,
borderColor: isCreate
? MyColours.color_199095
: MyColours.color_999999,
isBold: true,
fontSize: 32,
onPressed: () async {
... ...
... ... @@ -18,6 +18,7 @@ import 'package:provider/provider.dart';
import '../../models/coupon_model.dart';
import '../../provider/marketing_center_provider.dart';
import '../../utils/utils.dart';
class CouponSunPage extends StatefulWidget {
final int? index;
... ... @@ -85,9 +86,9 @@ class _CouponSunPageState extends State<CouponSunPage> {
// }
}
_getCouponData() async {
_getCouponData({bool isShowLoading = false}) async {
(bool, bool) result = await (
_couponNetworkData(widget.index, isShowLoading: false),
_couponNetworkData(widget.index, isShowLoading: isShowLoading),
getSellerTemplateConf(context)
).wait;
... ... @@ -115,7 +116,8 @@ class _CouponSunPageState extends State<CouponSunPage> {
}
Future<bool> getSellerTemplateConf(BuildContext context) async {
bool success = await marketingCenterProvider.getSellerTemplateConf(context);
bool success = await marketingCenterProvider.getSellerTemplateConf(context,
showLoading: false);
if (success &&
marketingCenterProvider.markDataModel != null &&
marketingCenterProvider.markDataModel!.marketing != null) {
... ... @@ -149,7 +151,8 @@ class _CouponSunPageState extends State<CouponSunPage> {
isShowLoading: true);
print(isSuccess);
// bus.emit('refresh_marketting_page');
_couponNetworkData(widget.index, isShowLoading: true);
_getCouponData(isShowLoading: true);
// if (isSuccess) {
// couponProvider.notifyListeners();
// } else {
... ... @@ -194,6 +197,8 @@ class _CouponSunPageState extends State<CouponSunPage> {
showText: '查看过期优惠券',
);
} else {
bool canOperate = Utils.getAuthority(context, '优惠券-停用-启用');
return EasyRefresh.custom(
controller: _controller,
shrinkWrap: true,
... ... @@ -205,10 +210,13 @@ class _CouponSunPageState extends State<CouponSunPage> {
from: 'quan',
couponSonModel: couponProvider.couponList![index],
showBtn: true,
canOperate: canOperate,
onPressedSwich: () {
couponProvider.couponList![index].isOpenBool =
!couponProvider.couponList![index].isOpenBool;
_setCustomerActivity(index);
if (canOperate) {
couponProvider.couponList![index].isOpenBool =
!couponProvider.couponList![index].isOpenBool;
_setCustomerActivity(index);
}
},
onPressed: () {
NavigatorUtil.goCouponDetailPage(
... ...
... ... @@ -5347,7 +5347,7 @@ class InvicationPageState extends State<InvicationPage>
return;
} else if (ObjectUtil.isEmpty(
detailModel.baseInfoSunModel) ||
ObjectUtil.isEmpty(_baseIndoProvider
ObjectUtil.isEmpty( detailModel
.baseInfoSunModel!.phone)) {
// Utils.showToast('请填写经理的联系电话');
DialogUtil.cupertinoAlertDialog(context,
... ... @@ -5608,7 +5608,7 @@ class InvicationPageState extends State<InvicationPage>
callback: () async {
if (ObjectUtil.isEmpty(
detailModel.baseInfoSunModel) ||
ObjectUtil.isEmpty(_baseIndoProvider
ObjectUtil.isEmpty( detailModel
.baseInfoSunModel!.phone)) {
// Utils.showToast('请填写经理的联系电话');
DialogUtil.cupertinoAlertDialog(context,
... ...
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
... ... @@ -34,8 +33,7 @@ class MyPlanDishHomePage extends StatefulWidget {
}
class _MyPlanDishHomePageState extends State<MyPlanDishHomePage>
with TickerProviderStateMixin
{
with TickerProviderStateMixin {
EasyRefreshController _controller = EasyRefreshController();
late PlanDishProvider planDishProvider;
TabController? tabController;
... ... @@ -74,14 +72,14 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage>
void initState() {
// TODO: implement initState
super.initState();
tabController = TabController(length: 3,vsync: this );
tabController = TabController(length: 3, vsync: this);
tabController!.addListener(() {
// couponProvider.couponList = [];
// couponProvider.pageState = PageState.Loading;
// setState(() {});
//点击tab时或滑动tab回调一次
if (tabController!.index.toDouble() == tabController!.animation!.value) {
// couponProvider.notifyListeners();
setState(() {});
// _couponNetworkData(tabController.index);
// selectIndex = tabController.index;
// setState(() {});
... ... @@ -233,23 +231,34 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage>
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: false,
gradientStart: tabController?.index == 1 &&
!Utils.getAuthority(context, '创建新排菜')
? MyColours.color_999999
: MyColours.color_199095,
gradientEnd: tabController?.index == 1 &&
!Utils.getAuthority(context, '创建新排菜')
? MyColours.color_999999
: MyColours.color_199095,
fontSize: 28,
onPressed: () async {
// UserModel userModel =
// Provider.of<UserModel>(context, listen: false);
if (Utils.getAuthority(context, '创建新排菜')) {
NavigatorUtil.goPlanDishCreateSelectTypePage(context);
} else {
bool? needRefresh = await NavigatorUtil.goPlanDishEditPage(
context,
isMine: true,
isEdit: true);
print(needRefresh);
if (needRefresh != null && needRefresh) {
// bus.emit('refresh_coupon_list_f');
//刷新页面数据
// _controller.callRefresh();
// _couponNetworkData(tabController.index);
if (!(tabController?.index == 1 &&
!Utils.getAuthority(context, '创建新排菜'))) {
if (Utils.getAuthority(context, '创建新排菜')) {
NavigatorUtil.goPlanDishCreateSelectTypePage(context);
} else {
bool? needRefresh = await NavigatorUtil.goPlanDishEditPage(
context,
isMine: true,
isEdit: true);
print(needRefresh);
if (needRefresh != null && needRefresh) {
// bus.emit('refresh_coupon_list_f');
//刷新页面数据
// _controller.callRefresh();
// _couponNetworkData(tabController.index);
}
}
}
},
... ...