Commit 9c0c832da1bbce660fee1aaae3df644366e2ded5

Authored by wdn127929
1 parent 0424a9d6

权限

... ... @@ -124,5 +124,42 @@ class Constant {
'到店': ['管理员', '店长', '前台', '迎宾'],
'离店': ['管理员', '店长', '前台', '迎宾'],
'全店任务': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
'创建新的优惠券': [
'管理员',
'店长',
],
'电话': ['管理员', '店长', '前台', '迎宾'],
'新建优惠': [
'管理员',
'店长',
],
'编辑优惠': [
'管理员',
'店长',
],
'指派为存酒管理员': [
'管理员',
'店长',
],
'创建新排菜': [
'管理员',
'店长',
],
'删除排菜': [
'管理员',
'店长',
],
'复用排菜': [
'管理员',
'店长',
],
'编辑排菜': [
'管理员',
'店长',
],
'存酒管理设置': [
'管理员',
'店长',
],
};
}
... ...
... ... @@ -272,12 +272,16 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
isBold: false,
fontSize: 28,
onPressed: () async {
UserModel userModel =
Provider.of<UserModel>(context, listen: false);
if (userModel.user.role_name == '管理员' ||
userModel.user.role_name == '店长') {
// UserModel userModel =
// Provider.of<UserModel>(context, listen: false);
if (Utils.getAuthority(context, '创建新的优惠券')) {
NavigatorUtil.goCouponCreateSelectTypePage(context);
} else {
}
// if (userModel.user.role_name == '管理员' ||
// userModel.user.role_name == '店长') {
// NavigatorUtil.goCouponCreateSelectTypePage(context);
// }
else {
bool needRefresh =
await NavigatorUtil.goCouponEditPage(context);
print(needRefresh);
... ...
... ... @@ -1244,17 +1244,17 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
print(userModel.user.openid);
print(widget.rid);
print(widget.uid);
bool notDo = userModel.user.role_name != '管理员' &&
userModel.user.role_name != '店长' &&
widget.uid != "null" &&
(widget.uid != userModel.user.openid &&
userModel.user.role_name != '前台') &&
userModel.user.role_name != '前台';
bool notDoWechat = userModel.user.role_name != '管理员' &&
userModel.user.role_name != '店长' &&
widget.uid != "null" &&
widget.uid != userModel.user.openid;
// bool notDo = userModel.user.role_name != '管理员' &&
// userModel.user.role_name != '店长' &&
// widget.uid != "null" &&
// (widget.uid != userModel.user.openid &&
// userModel.user.role_name != '前台') &&
// userModel.user.role_name != '前台';
// bool notDoWechat = userModel.user.role_name != '管理员' &&
// userModel.user.role_name != '店长' &&
// widget.uid != "null" &&
// widget.uid != userModel.user.openid;
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: MyColours.color_ffffff,
... ... @@ -1628,9 +1628,11 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
detailEntity.cusdem ??
"",
callback: () {
if (notDo) {
return;
} else {
if (Utils.getAuthority(
context, '备注') ||
widget.uid ==
userModel.user
.openid) {
//备注弹窗
_showCusdemDialog(
context,
... ... @@ -2191,7 +2193,13 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
text: '填写预订人信息',
fontSize: 28,
isBold: false,
textColor: notDo
textColor: !(Utils.getAuthority(
context,
'填写预订人信息') ||
widget.uid ==
userModel
.user
.openid)
? MyColours
.color_999999
: Colors.white,
... ... @@ -2201,17 +2209,35 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
.setWidth(240),
radius: ScreenUtil()
.setWidth(10),
borderColor: notDo
borderColor: !(Utils.getAuthority(
context,
'填写预订人信息') ||
widget.uid ==
userModel
.user
.openid)
? MyColours
.color_999999
: MyColours
.color_199095,
gradientStart: notDo
gradientStart: !(Utils.getAuthority(
context,
'填写预订人信息') ||
widget.uid ==
userModel
.user
.openid)
? MyColours
.color_ffffff
: MyColours
.color_199095,
gradientEnd: notDo
gradientEnd: !(Utils.getAuthority(
context,
'填写预订人信息') ||
widget.uid ==
userModel
.user
.openid)
? MyColours
.color_ffffff
: MyColours
... ... @@ -2220,9 +2246,13 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
// setState(() {
// setTop = true;
// });
if (notDo) {
return;
} else {
if (Utils.getAuthority(
context,
'填写预订人信息') ||
widget.uid ==
userModel
.user
.openid) {
NavigatorUtil
.goEditReserverPage(
context,
... ... @@ -2472,8 +2502,13 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
null &&
formatPhone !=
'') {
if (notDo) {
} else {
if (Utils.getAuthority(
context,
'电话') ||
widget.uid ==
userModel
.user
.openid) {
DialogUtil
.goPhone(
formatPhone);
... ... @@ -2637,7 +2672,11 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
flex: 1,
child: InkWell(
onTap: () {
if (!notDoWechat) {
if (Utils.getAuthority(
context, '预点菜') ||
widget.uid ==
userModel
.user.openid) {
NavigatorUtil
.goOrderAdvanceHomePage(
context,
... ... @@ -2654,7 +2693,14 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
MyColours.color_ffffff,
border: Border.all(
width: w(1),
color: notDoWechat
color: !(Utils
.getAuthority(
context,
'预点菜') ||
widget.uid ==
userModel
.user
.openid)
? MyColours
.color_999999
: MyColours
... ... @@ -2668,7 +2714,13 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
alignment: Alignment.center,
child: Text('预点菜',
style: TextStyle(
color: notDoWechat
color: !(Utils.getAuthority(
context,
'预点菜') ||
widget.uid ==
userModel
.user
.openid)
? MyColours
.color_999999
: MyColours
... ... @@ -2709,7 +2761,11 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
// _nameStr.length -
// 1);
// }
if (!notDoWechat) {
if (Utils.getAuthority(
context, '通知客户') ||
widget.uid ==
userModel
.user.openid) {
NavigatorUtil
.goInvicationPage(
context,
... ... @@ -2719,7 +2775,12 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
},
child: Container(
decoration: BoxDecoration(
color: notDoWechat
color: !(Utils.getAuthority(
context,
'通知客户') ||
widget.uid ==
userModel.user
.openid)
? MyColours.color_999999
: MyColours
.color_199095,
... ... @@ -3141,7 +3202,9 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
horizontal: ScreenUtil().setHeight(40)),
decoration: BoxDecoration(
border: Border.all(
color: notDo
color: !(Utils.getAuthority(
context, '变更预订') ||
widget.uid == userModel.user.openid)
? MyColours.color_999999
: MyColours.color_199095,
width: ScreenUtil().setWidth(2)),
... ... @@ -3156,32 +3219,45 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
Expanded(
child: _cancelAndChangeBtn(() {
print('点击变更预订');
if (notDo) {
} else {
if (Utils.getAuthority(
context, '变更预订') ||
widget.uid ==
userModel.user.openid) {
NavigatorUtil.goNoteBookChangeFPage(
context,
detailEntity,
widget.rid);
}
}, '变更预订',
fontColor: notDo
fontColor: !(Utils.getAuthority(
context, '变更预订') ||
widget.uid ==
userModel.user.openid)
? MyColours.color_999999
: MyColours.color_199095)),
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setWidth(50),
color: notDo
color: !(Utils.getAuthority(
context, '取消预订') ||
widget.uid ==
userModel.user.openid)
? MyColours.color_999999
: MyColours.color_199095,
),
Expanded(
child: _cancelAndChangeBtn(() {
if (notDo) {
} else {
if (Utils.getAuthority(
context, '取消预订') ||
widget.uid ==
userModel.user.openid) {
_showCancelWidget(context);
}
}, '取消预订',
fontColor: notDo
fontColor: !(Utils.getAuthority(
context, '取消预订') ||
widget.uid ==
userModel.user.openid)
? MyColours.color_999999
: MyColours.color_199095)),
],
... ...
... ... @@ -1480,7 +1480,7 @@ class InvicationPageState extends State<InvicationPage>
],
)));
}
/**
///优惠券选择
Widget _couponWidget() {
return Stack(
... ... @@ -1602,6 +1602,8 @@ class InvicationPageState extends State<InvicationPage>
);
}
*/
// 客情信息变更
_setInsGuest() async {
CustomerProvider customerProvider =
... ... @@ -2664,11 +2666,8 @@ class InvicationPageState extends State<InvicationPage>
print('点击变更预订');
UserModel userModel =
Provider.of<UserModel>(context, listen: false);
if (userModel.user.role_name != '管理员' &&
userModel.user.role_name != '店长' &&
detailEntity.uid != "null" &&
detailEntity.uid != userModel.user.openid) {
} else {
if (Utils.getAuthority(context, '变更预订') ||
detailEntity.uid == userModel.user.openid) {
NavigatorUtil.goNoteBookChangeFPage(
context, detailEntity, widget.rid,
back: true);
... ... @@ -3099,7 +3098,7 @@ class InvicationPageState extends State<InvicationPage>
}
return tables;
}
/*
///预订信息
Widget _orderInfoWidget() {
return Stack(clipBehavior: Clip.none, children: [
... ... @@ -3661,6 +3660,7 @@ class InvicationPageState extends State<InvicationPage>
)
]);
}
*/
showOverlay(BuildContext context) {
if (overlayEntry != null || MediaQuery.of(context).viewInsets.bottom == 0)
... ...
... ... @@ -83,11 +83,12 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
Widget build(BuildContext context) {
marketingCenterProvider =
Provider.of<MarketingCenterProvider>(context, listen: true);
bool showBtn = Provider.of<UserModel>(context, listen: false)
.user
.role_name ==
'管理员' ||
Provider.of<UserModel>(context, listen: false).user.role_name == '店长';
// bool showBtn = Provider.of<UserModel>(context, listen: false)
// .user
// .role_name ==
// '管理员' ||
// Provider.of<UserModel>(context, listen: false).user.role_name == '店长';
bool showBtn = Utils.getAuthority(context, '编辑优惠');
return Scaffold(
backgroundColor: MyColours.color_f3f3f3,
appBar: SystemAppBar(
... ... @@ -237,10 +238,11 @@ class _RechargeHomePageState extends State<RechargeHomePage> {
}
}),
)),
if (Provider.of<UserModel>(context, listen: false).user.role_name ==
'管理员' ||
Provider.of<UserModel>(context, listen: false).user.role_name ==
'店长')
// if (Provider.of<UserModel>(context, listen: false).user.role_name ==
// '管理员' ||
// Provider.of<UserModel>(context, listen: false).user.role_name ==
// '店长')
if (Utils.getAuthority(context, '新建优惠'))
Container(
height: ScreenUtil().setWidth(91 * 2),
width: double.infinity,
... ...
... ... @@ -494,37 +494,37 @@ class _PersonnelDetailPageState extends State<PersonnelDetailPage> {
)),
VEmptyView(40),
(userModel.user.role_name == '管理员' ||
userModel.user.role_name == '店长')
? InkWell(
onTap: () async {
Map<String, String> pramams = {
'sid': Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
'uid': uid,
'is_store_wine': isStoreWine == '1' ? '0' : '1'
};
StoreWineProvider storeWineProvider =
Provider.of<StoreWineProvider>(context,
listen: false);
bool success = await storeWineProvider
.setStoreWineBySellerUser(context, pramams,
showLoading: true);
if (success) {
setState(() {
isStoreWine = isStoreWine == '1' ? '0' : '1';
});
}
},
child: Text(
isStoreWine == '1' ? '解除指派存酒管理员' : '指派为存酒管理员',
style: TextStyle(
decoration: TextDecoration.underline,
color: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(28)),
))
: SizedBox(),
// (userModel.user.role_name == '管理员' ||
// userModel.user.role_name == '店长')
if (Utils.getAuthority(context, '指派为存酒管理员'))
InkWell(
onTap: () async {
Map<String, String> pramams = {
'sid': Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
'uid': uid,
'is_store_wine': isStoreWine == '1' ? '0' : '1'
};
StoreWineProvider storeWineProvider =
Provider.of<StoreWineProvider>(context,
listen: false);
bool success = await storeWineProvider
.setStoreWineBySellerUser(context, pramams,
showLoading: true);
if (success) {
setState(() {
isStoreWine = isStoreWine == '1' ? '0' : '1';
});
}
},
child: Text(
isStoreWine == '1' ? '解除指派存酒管理员' : '指派为存酒管理员',
style: TextStyle(
decoration: TextDecoration.underline,
color: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(28)),
)),
// Container(
// margin: EdgeInsets.all(ScreenUtil().setWidth(40)),
// child: Column(
... ...
... ... @@ -10,6 +10,7 @@ import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
... ... @@ -240,10 +241,9 @@ class _MyPlanDishHomePageState extends State<MyPlanDishHomePage>
isBold: false,
fontSize: 28,
onPressed: () async {
UserModel userModel =
Provider.of<UserModel>(context, listen: false);
if (userModel.user.role_name == '管理员' ||
userModel.user.role_name == '店长') {
// UserModel userModel =
// Provider.of<UserModel>(context, listen: false);
if (Utils.getAuthority(context, '创建新排菜')){
NavigatorUtil.goPlanDishCreateSelectTypePage(context);
} else {
bool needRefresh = await NavigatorUtil.goPlanDishEditPage(
... ...
... ... @@ -217,8 +217,7 @@ class _PlanDishItemState extends State<PlanDishItem> {
Spacer(),
//私,则是自己的,可删除
widget.sunList.type == '2' ||
userModel.user.role_name == '管理员' ||
userModel.user.role_name == '店长'
Utils.getAuthority(context, '删除排菜')
? RoundButton(
width: ScreenUtil().setWidth(50 * 2),
height: ScreenUtil().setWidth(20 * 2),
... ... @@ -234,8 +233,7 @@ class _PlanDishItemState extends State<PlanDishItem> {
: SizedBox(),
HEmptyView(34),
widget.sunList.type == '2' ||
userModel.user.role_name == '管理员' ||
userModel.user.role_name == '店长'
Utils.getAuthority(context, '复用排菜')
? RoundButton(
width: ScreenUtil().setWidth(50 * 2),
height: ScreenUtil().setWidth(20 * 2),
... ...
... ... @@ -12,6 +12,7 @@ import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
... ... @@ -115,11 +116,10 @@ class _PlanDishSunPageState extends State<PlanDishSunPage> {
(BuildContext context, int index) {
return InkWell(
onTap: () async {
UserModel userModel =
Provider.of<UserModel>(context, listen: false);
// UserModel userModel =
// Provider.of<UserModel>(context, listen: false);
bool canedit = widget.data[index].type == '2' ||
userModel.user.role_name == '管理员' ||
userModel.user.role_name == '店长';
Utils.getAuthority(context, '编辑排菜');
bool needRefresh =
await NavigatorUtil.goPlanDishEditPage(context,
... ...
... ... @@ -403,10 +403,11 @@ class _StoreWineManageHomePageState extends State<StoreWineManageHomePage>
rightImgName: 'set_g.png',
onTapRight: () {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
bool isRole = userModel.user.role_name == '管理员' ||
userModel.user.role_name == '店长'
? true
: false;
// bool isRole = userModel.user.role_name == '管理员' ||
// userModel.user.role_name == '店长'
// ? true
// : false;
bool isRole= Utils.getAuthority(context, '存酒管理设置');
if (isRole) {
NavigatorUtil.goWineSettingPage(context);
} else {
... ...
... ... @@ -1553,7 +1553,7 @@ class TableManagerPageState extends State<TableManagerPage> {
],
));
}
/*
///优惠券选择
Widget _couponWidget() {
return Padding(
... ... @@ -1676,6 +1676,7 @@ class TableManagerPageState extends State<TableManagerPage> {
],
));
}
*/
///选中的桌子widget
Widget _selectTableWidgetWechat() {
... ...