Commit db74df0929f357121c52be647c5e7bff54083ab6

Authored by wdn127929
1 parent 15fc40ab

存酒设置

... ... @@ -30,6 +30,8 @@ class Constant {
*
*
* */
static const Map<String, List<String>> authorityConfig = {
'充值短信': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
'有效期': ['管理员', '店长', '客户经理', '收银员', '服务员', '前台'],
... ...
... ... @@ -340,6 +340,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
// bus.emit('refresh_marketting_page');
bus.emit('refresh_table_m_coupon');
bus.emit('refresh_wine_msg');
Navigator.pop(context, true);
}
}
... ...
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:provider/provider.dart';
import '../../../provider/customer_provider.dart';
import '../../../res/colors.dart';
import '../../../route/navigator_util.dart';
import '../../../utils/dialog_util.dart';
import '../../../utils/event_bus.dart';
import '../../../utils/screen_util.dart';
import '../../../utils/utils.dart';
import '../../../widgets/h_empty_view.dart';
import '../../../widgets/round_button.dart';
import '../../../widgets/v_empty_view.dart';
typedef ClickCallback = void Function(dynamic value);
class WineSettingMsgPage extends StatefulWidget {
const WineSettingMsgPage();
... ... @@ -13,28 +27,142 @@ class WineSettingMsgPage extends StatefulWidget {
}
class _WineSettingMsgPageState extends State<WineSettingMsgPage> {
String contentChangeStart = '尊敬的@var(clientname),您好!您的酒水@var(beveragename)已经在我店存放@var(days)了。点击这里编辑您的短信内容。上面的文字时固定不可编辑的。';
TextEditingController controller = TextEditingController();
String contentChangeStart =
'尊敬的@var(clientname),您好!您的酒水@var(beveragename)已经在我店存放@var(days)了。';
TextEditingController controller = TextEditingController();
CustomerProvider customerProvider;
List<String> couponList = [];
bool isUse = false;
String youhui = '选择优惠';
int couponSelectIndex = 0;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
_couponNetworkData();
});
bus.on('refresh_wine_msg', (arg) {
_couponNetworkData();
});
}
@override
void dispose() {
super.dispose();
bus.off('refresh_wine_msg');
}
///消费券
_couponNetworkData({bool isShowLoading = true}) async {
// customerMakingProvider.couponSelectIndex = 0;
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
'status': '1'
};
await customerProvider.getCustomerSelectActivityNew(context, params,
isShowLoading: isShowLoading);
//此人已经新建好券
if (customerProvider.couponListSelect.length > 0) {
// couponProvider.initCouponSelect(context);
couponList = [];
for (int i = 0; i < customerProvider.couponListSelect.length; i++) {
couponList.add(customerProvider.couponListSelect[i].aname);
}
customerProvider.notifyListeners();
} else {
//没有新建的优惠券
}
}
_buttonChoose(String title, ClickCallback callback) {
return InkWell(
onTap: () {
callback(title);
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(20),
vertical: ScreenUtil().setWidth(10)),
// height: ScreenUtil().setWidth(50),
// decoration: BoxDecoration(
// // border: Border.all(
// // width: ScreenUtil().setWidth(2),
// // color: MyColours.color_199095),
// borderRadius: BorderRadius.circular(ScreenUtil().setWidth(10))),
child: Row(
children: [
Expanded(
child: Text(
title,
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: title == '时间(选填)' ||
title == '(选填)' ||
title == '选择优惠' ||
!isUse
? MyColours.color_999999
: MyColours.color_438E93,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setWidth(30)),
)),
HEmptyView(20),
Image.asset(
// Utils.getImgPath(!customerMakingProvider.isUse
// ? 'c_arrow_down_unsel'
// : 'c_arrow_down'),
Utils.getImgPath(isUse ? 'down_c' : 'quan_down_f'),
width: ScreenUtil().setWidth(44),
// height: ScreenUtil().setWidth(10),
)
],
)));
}
_insertUrllink(String link) {
// *************开始直接插入会报错***********还没有改
var cursorPos = controller.selection.base.offset; //获取到光标的在字符串的位置
if (cursorPos < 0) {
controller.text += link;
} else {
String textAfterCursor =
controller.text.substring(cursorPos); //把字符串从光标的位置截取,光标后面的
String textBeforeCursor =
controller.text.substring(0, cursorPos); //光标前面的字符串
controller.text =
textBeforeCursor + link + textAfterCursor; //把想要的插入的内容拼接在光标位置处
controller.selection =
TextSelection.collapsed(offset: controller.text.length);
}
}
@override
Widget build(BuildContext context) {
customerProvider = Provider.of<CustomerProvider>(context, listen: true);
return Scaffold(
appBar: SystemAppBar('fff'),
body: SingleChildScrollView(child:
Column(children: [
Container(
width: double.infinity,
padding: EdgeInsets.all(w(10)),
margin: EdgeInsets.symmetric(horizontal: w(16)),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_DBDBDB, width: w(1)),
borderRadius: BorderRadius.circular(r(8))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
appBar: SystemAppBar('存酒超期通知短信内容设置'),
body: Column(children: [
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
Container(
width: double.infinity,
padding: EdgeInsets.all(w(10)),
margin: EdgeInsets.symmetric(horizontal: w(16)),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_DBDBDB, width: w(1)),
borderRadius: BorderRadius.circular(r(8))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
contentChangeStart,
style: TextStyle(
... ... @@ -42,63 +170,221 @@ class _WineSettingMsgPageState extends State<WineSettingMsgPage> {
color: MyColours.color_66000000,
fontSize: font(14)),
),
TextField(
enabled: true,
controller: controller,
// textAlign: TextAlign.right,
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 10,
// inputFormatters: title == '金额'
// ? [
// FilteringTextInputFormatter(RegExp("[0-9.]"),
// allow: true),
// MyNumberTextInputFormatter(digit: 2),
// ]
// : [],
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_515151),
// focusNode: focusNode,
decoration: InputDecoration(
border:
OutlineInputBorder(borderSide: BorderSide.none),
hintText:
'以上内容为固定不可编辑,点击这里开始编辑短信内容' ,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
TextField(
enabled: true,
controller: controller,
// textAlign: TextAlign.right,
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 8,
// inputFormatters: title == '金额'
// ? [
// FilteringTextInputFormatter(RegExp("[0-9.]"),
// allow: true),
// MyNumberTextInputFormatter(digit: 2),
// ]
// : [],
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_515151),
// focusNode: focusNode,
decoration: InputDecoration(
border:
OutlineInputBorder(borderSide: BorderSide.none),
hintText: '点击这里编辑您的短信内容。上面的文字是固定不可编辑的。',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
),
contentPadding: EdgeInsets.zero,
),
contentPadding: EdgeInsets.zero,
onChanged: (value) {
//添加的代码:光标一直在文本框后面
// controller.value = TextEditingValue(
// text: controller.text,
// selection:
// TextSelection.fromPosition(TextPosition(
// affinity: TextAffinity.downstream,
// offset: controller.text.length,
// )));
// setState(() {
// _cursorPosition = controller.selection.baseOffset;
// });
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
},
// keyboardType: inputType,
),
onChanged: (value) {
//添加的代码:光标一直在文本框后面
// controller.value = TextEditingValue(
// text: controller.text,
// selection:
// TextSelection.fromPosition(TextPosition(
// affinity: TextAffinity.downstream,
// offset: controller.text.length,
// )));
// setState(() {
// _cursorPosition = controller.selection.baseOffset;
// });
},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
},
// keyboardType: inputType,
)
],
],
),
),
),
],),),
);
Container(
width: double.infinity,
// padding: EdgeInsets.all(w(10)),
margin: EdgeInsets.symmetric(horizontal: w(16)),
child: Column(
children: [
VEmptyView(36),
InkWell(
onTap: () {
isUse = !isUse;
if (!isUse) {
youhui = '选择优惠';
}
setState(() {});
},
child: Row(children: [
Image.asset(
Utils.getImgPath(
isUse ? 'f_select' : 'f_select_not'),
width: ScreenUtil().setWidth(44)),
HEmptyView(15),
Text(
'在当前位置插入优惠',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
fontWeight: FontWeight.bold,
color: MyColours.color_515151),
),
])),
VEmptyView(26),
if (isUse)
Row(children: [
Expanded(
child: Container(
height: ScreenUtil().setWidth(70),
// width: ScreenUtil().setWidth(130),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10)),
color: MyColours.color_DBDBDB),
child: _buttonChoose(youhui, (value) {
if (isUse) {
FocusScope.of(context)
.requestFocus(FocusNode()); //隐藏键盘
if (couponList == null ||
couponList.length == 0) {
Utils.showToast('暂无优惠券,请创建新优惠');
return;
}
DialogUtil.showSelectCusmanDialog(
context, couponList,
(value) async {
if (value != null) {
if (customerProvider
.couponListSelect[
value.first]
.urllink ==
null) {
//创建链接
//创建券的二维码
Map<String, String> param = {
"sid": Provider.of<UserModel>(
context,
listen: false)
.user
.sellerid,
"id": customerProvider
.couponListSelect[
value.first]
.id,
};
dynamic object =
await customerProvider
.createActivityUrlLink(
context, param);
if (object is bool) {
//
} else {
//成功
_insertUrllink(object);
}
} else {
// 直接使用
setState(() {
couponSelectIndex =
value.first;
youhui = couponList[
couponSelectIndex];
});
_insertUrllink(customerProvider
.couponListSelect[
value.first]
.urllink);
}
}
},
selecteds:
couponSelectIndex == null
? []
: [couponSelectIndex])
.then((value) {});
}
}))),
HEmptyView(30),
InkWell(
onTap: () async {
if (isUse) {
// NavigatorUtil.goMarketingRecordsDetailPage(context);
bool needRefresh =
await NavigatorUtil.goCouponEditPage(
context);
print(needRefresh);
if (needRefresh != null && needRefresh) {
//刷新页面数据
// _controller.callRefresh();
_couponNetworkData();
}
}
},
child: Text('创建新优惠',
style: TextStyle(
decoration: TextDecoration.underline,
color: isUse
? MyColours.color_438E93
: MyColours.color_999999,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(28)))),
]),
],
))
],
),
),
),
Container(
padding: EdgeInsets.only(
left: w(23), right: w(23), top: w(12), bottom: w(25)),
child: Row(
children: [
Expanded(
child: RoundButton(
text: '保存',
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
// borderColor: MyColours.color_999999,
radius: r(5),
height: w(43),
fontSize: 32,
isBold: true,
onPressed: () {
//群发短信
// _createMarketing();
},
)),
],
),
)
]));
}
}
\ No newline at end of file
}
... ...
... ... @@ -13,6 +13,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../../provider/user_model.dart';
import '../../../route/navigator_util.dart';
import '../../../utils/screen_util.dart';
import '../../../widgets/h_empty_view.dart';
... ... @@ -323,8 +324,8 @@ class _WineSettingPageState extends State<WineSettingPage> {
VEmptyView(20),
InkWell(
onTap: () {
// NavigatorUtil.goSmsTemplateSettingPage(
// context, smsTemplate, bookinginfo);
NavigatorUtil.goWineSettingMsgPage(
context);
},
child: Container(
height: w(48),
... ...
... ... @@ -2255,4 +2255,17 @@ class NavigatorUtil {
return _navigateTo(context, "${Routes.mini_program_setting_page}",
replace: replace);
}
//存酒设置模版
static Future<dynamic> goWineSettingMsgPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.wine_setting_msg_page}",
replace: replace);
}
}
... ...
... ... @@ -263,6 +263,7 @@ import '../pages/my/store_wine_manage/out_store_record_page.dart';
import '../pages/my/store_wine_manage/sms_code_input_page.dart';
import '../pages/my/store_wine_manage/store_wine_manage_home_page.dart';
import '../pages/my/store_wine_manage/wine_detail_page.dart';
import '../pages/my/store_wine_manage/wine_setting_msg_page.dart';
import '../pages/my/store_wine_manage/wine_setting_page.dart';
import '../pages/my/table_manage/merge_table_select_page.dart';
import '../pages/order_advance/customer_detail_page.dart';
... ... @@ -3871,3 +3872,23 @@ var miniprogramSettingPageHandle = new Handler(
child: MiniprogramSettingPage());
});
///存酒短信模版设置
var wineSettingMsgPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
// String rid = params["rid"].first;
// // String smsTemplate = params["smsTemplate"].first;
// CouponUse use = CouponUse.fromJson(
// json.decode(FluroConvertUtils.fluroCnParamsDecode(params["use"].first)));
// CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
return ChangeNotifierProvider<MenuManageProvider>(
create: (_) => MenuManageProvider(),
child: ChangeNotifierProvider<CustomerProvider>(
create: (_) => CustomerProvider(),
child: WineSettingMsgPage()));
});
... ...
... ... @@ -388,6 +388,10 @@ class Routes {
static String mini_program_setting_page =
"/mini_program_setting_page"; //小程序封面样式设置
static String wine_setting_msg_page =
"/wine_setting_msg_page"; //存酒短信模版设置
static void configureRoutes(FluroRouter router) {
... ... @@ -728,6 +732,8 @@ router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHan
router.define(payment_setting_page, handler: paymentSettingPageHandle);
router.define(mini_program_setting_page, handler: miniprogramSettingPageHandle);
router.define(wine_setting_msg_page, handler:wineSettingMsgPageHandle);
}
... ...