|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/screenutil.dart';
|
|
|
|
import 'package:one_key/pages/coupon/coupon_page.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/utils/dialog_util.dart';
|
|
|
|
import 'package:one_key/utils/utils.dart';
|
|
|
|
import 'package:one_key/widgets/h_empty_view.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';
|
|
|
|
|
|
|
|
typedef ClickCallback = void Function(dynamic value);
|
|
|
|
|
|
|
|
class MakeMarkingPage extends StatefulWidget {
|
|
|
|
MakeMarkingPage({Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_MakeMarkingPageState createState() => _MakeMarkingPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _MakeMarkingPageState extends State<MakeMarkingPage> {
|
|
|
|
TextEditingController controller = TextEditingController();
|
|
|
|
List<String> couponList = [
|
|
|
|
'98折(ccccckkkkshjhjsjsvc)kkkkkk',
|
|
|
|
'fffff',
|
|
|
|
'fffff',
|
|
|
|
'ffsdfasfaf'
|
|
|
|
];
|
|
|
|
int couponSelectIndex = 0;
|
|
|
|
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
FocusNode _focusNode = FocusNode();
|
|
|
|
bool showDateSelWidget = false;
|
|
|
|
String limitDate = '';
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
_focusNode.addListener(() {
|
|
|
|
if (_focusNode.hasFocus) {
|
|
|
|
//有焦点
|
|
|
|
if (showDateSelWidget) {
|
|
|
|
Navigator.pop(context);
|
|
|
|
showDateSelWidget = false;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//失去焦点
|
|
|
|
// _editingController.text = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_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,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
style: TextStyle(
|
|
|
|
color: title == '时间(选填)' || title == '(选填)'
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setWidth(30)),
|
|
|
|
)),
|
|
|
|
HEmptyView(10),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('c_arrow_down'),
|
|
|
|
width: ScreenUtil().setWidth(30),
|
|
|
|
// height: ScreenUtil().setWidth(10),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
|
|
|
///短信内容编辑UI
|
|
|
|
Widget _contentWidget(String hintText) {
|
|
|
|
return Container(
|
|
|
|
// height: ScreenUtil().setWidth(380),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
// Align(
|
|
|
|
// alignment: Alignment.centerLeft,
|
|
|
|
// child: Text(
|
|
|
|
// title,
|
|
|
|
// textAlign: TextAlign.left,
|
|
|
|
// style: TextStyle(
|
|
|
|
// color: MyColours.color_333333,
|
|
|
|
// fontWeight: FontWeight.bold,
|
|
|
|
// fontSize: ScreenUtil().setSp(34)),
|
|
|
|
// )),
|
|
|
|
// VEmptyView(30),
|
|
|
|
TextField(
|
|
|
|
controller: controller,
|
|
|
|
// keyboardType: TextInputType.number, //键盘类型,数字键盘
|
|
|
|
maxLines: 10,
|
|
|
|
focusNode: _focusNode,
|
|
|
|
// maxLength: 50,
|
|
|
|
|
|
|
|
// maxLengthEnforced: true,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
color: MyColours.color_333333), //输入文本的样式
|
|
|
|
decoration: InputDecoration(
|
|
|
|
contentPadding: EdgeInsets.all(ScreenUtil().setWidth(30)),
|
|
|
|
hintText: hintText,
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
),
|
|
|
|
fillColor: MyColours.color_F9F9F9,
|
|
|
|
// fillColor: Colors.red,
|
|
|
|
filled: true,
|
|
|
|
enabledBorder: OutlineInputBorder(
|
|
|
|
//未选中时候的颜色
|
|
|
|
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: MyColours.color_cccccc,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
),
|
|
|
|
focusedBorder: OutlineInputBorder(
|
|
|
|
//选中时外边框颜色
|
|
|
|
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
borderSide: BorderSide(
|
|
|
|
color: MyColours.app_main,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
// border: OutlineInputBorder(
|
|
|
|
// borderRadius:
|
|
|
|
// BorderRadius.circular(ScreenUtil().setWidth(20)),
|
|
|
|
// borderSide: BorderSide(
|
|
|
|
// color: Colors.red, width: ScreenUtil().setWidth(2))),
|
|
|
|
),
|
|
|
|
onChanged: (value) {
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
// NavigatorUtil.goMarketingRecordsDetailPage(context);
|
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(20)),
|
|
|
|
child: Text('清空',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(26))),
|
|
|
|
)),
|
|
|
|
Text('共 ${controller.text.length} 字 0 条短信',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(26))),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
Row(children: [
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(true ? 'c_mul_select' : 'c_mul_select_un'),
|
|
|
|
width: ScreenUtil().setWidth(30)),
|
|
|
|
HEmptyView(15),
|
|
|
|
Text(
|
|
|
|
'营销加入优惠',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(36),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: MyColours.color_333333),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
VEmptyView(30),
|
|
|
|
Row(children: [
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(70),
|
|
|
|
// width: ScreenUtil().setWidth(130),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
color: Color.fromRGBO(239, 239, 239, 1)),
|
|
|
|
child:
|
|
|
|
_buttonChoose(couponList[couponSelectIndex], (value) {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
|
|
|
|
DialogUtil.showSelectCusmanDialog(context, couponList,
|
|
|
|
(value) {
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
couponSelectIndex = value.first;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
selecteds: couponSelectIndex == null
|
|
|
|
? []
|
|
|
|
: [couponSelectIndex])
|
|
|
|
.then((value) {});
|
|
|
|
}))),
|
|
|
|
HEmptyView(30),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
// NavigatorUtil.goMarketingRecordsDetailPage(context);
|
|
|
|
},
|
|
|
|
child: Text('创建新优惠',
|
|
|
|
style: TextStyle(
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
fontSize: ScreenUtil().setSp(26)))),
|
|
|
|
]),
|
|
|
|
VEmptyView(30),
|
|
|
|
Row(children: [
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(true ? 'c_mul_select' : 'c_mul_select_un'),
|
|
|
|
width: ScreenUtil().setWidth(30)),
|
|
|
|
HEmptyView(15),
|
|
|
|
Text(
|
|
|
|
'客户经理不可修改短信内容',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(26),
|
|
|
|
color: MyColours.color_333333),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
VEmptyView(30),
|
|
|
|
Row(children: [
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(true ? 'c_mul_select' : 'c_mul_select_un'),
|
|
|
|
width: ScreenUtil().setWidth(30)),
|
|
|
|
HEmptyView(15),
|
|
|
|
Text(
|
|
|
|
'最晚完成期限',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(26),
|
|
|
|
color: MyColours.color_333333),
|
|
|
|
),
|
|
|
|
HEmptyView(15),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
//弹出时间选择器
|
|
|
|
// showPickerDateTime(context);
|
|
|
|
showDateSelWidget = true;
|
|
|
|
DialogUtil.showPickerDateTime24(
|
|
|
|
context,
|
|
|
|
scaffoldKey,
|
|
|
|
(value) {
|
|
|
|
// {'text': picker.adapter.text, 'select': selecteds}
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
print(value);
|
|
|
|
limitDate = DateUtil.formatDateStr(value,
|
|
|
|
format: DateFormats.full);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
showDateSelWidget = false;
|
|
|
|
},
|
|
|
|
dateTime: DateUtil.getDateTime(limitDate),
|
|
|
|
onCancel: () {
|
|
|
|
showDateSelWidget = false;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
// height: ScreenUtil().setWidth(70),
|
|
|
|
alignment: Alignment.center,
|
|
|
|
// width: ScreenUtil().setWidth(280),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(30)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
color: Color.fromRGBO(175, 176, 177, 1),
|
|
|
|
width: ScreenUtil().setWidth(2)))),
|
|
|
|
child: Text(
|
|
|
|
limitDate,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(26),
|
|
|
|
color: MyColours.color_333333),
|
|
|
|
)),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('c_arrow_down'),
|
|
|
|
width: ScreenUtil().setWidth(30),
|
|
|
|
// height: ScreenUtil().setWidth(10),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Color.fromRGBO(246, 248, 250, 1),
|
|
|
|
key: scaffoldKey,
|
|
|
|
appBar: SystemAppBar(
|
|
|
|
'创建营销任务',
|
|
|
|
onTap: () {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
body: Column(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(10),
|
|
|
|
Container(
|
|
|
|
color: MyColours.color_199095,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(30),
|
|
|
|
vertical: ScreenUtil().setWidth(30)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
'已选[沉睡、活跃、流失]100位顾客',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
)),
|
|
|
|
HEmptyView(10),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
// NavigatorUtil.goMarketingRecordsDetailPage(context);
|
|
|
|
},
|
|
|
|
child: Text('查看',
|
|
|
|
style: TextStyle(
|
|
|
|
decoration: TextDecoration.underline,
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
fontSize: ScreenUtil().setSp(26)))),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(30),
|
|
|
|
),
|
|
|
|
child: Column(
|
|
|
|
children: [VEmptyView(50), _contentWidget('输入营销短信内容')],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
RoundButton(
|
|
|
|
text: '确认下发任务',
|
|
|
|
gradientStart: MyColours.color_199095,
|
|
|
|
gradientEnd: MyColours.color_199095,
|
|
|
|
// borderColor: MyColours.color_999999,
|
|
|
|
radius: ScreenUtil().setWidth(40),
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
fontSize: 26,
|
|
|
|
margin:
|
|
|
|
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(230)),
|
|
|
|
isBold: false,
|
|
|
|
onPressed: () {
|
|
|
|
// NavigatorUtil.goEnterStoreEnvironmentPage(context);
|
|
|
|
},
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
RoundButton(
|
|
|
|
text: '取消',
|
|
|
|
gradientStart: MyColours.color_ffffff,
|
|
|
|
gradientEnd: MyColours.color_ffffff,
|
|
|
|
textColor: MyColours.color_199095,
|
|
|
|
borderColor: MyColours.color_199095,
|
|
|
|
radius: ScreenUtil().setWidth(40),
|
|
|
|
height: ScreenUtil().setWidth(80),
|
|
|
|
fontSize: 26,
|
|
|
|
margin:
|
|
|
|
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(230)),
|
|
|
|
isBold: false,
|
|
|
|
onPressed: () {
|
|
|
|
// DialogUtil.cupertinoAlertDialog(context,
|
|
|
|
// title: "取消任务",
|
|
|
|
// content: "点击确定立即取消任务,已完成的客户经理继续生效",
|
|
|
|
// lTitle: "返回",
|
|
|
|
// rTitle: "确定取消", lCallback: () {
|
|
|
|
// print("返回");
|
|
|
|
// }, rCallback: () {
|
|
|
|
// print("确定取消任务");
|
|
|
|
// });
|
|
|
|
},
|
|
|
|
),
|
|
|
|
VEmptyView(40),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|