Commit cbccc635d80b1f3e178ae09d268f841a34633df1

Authored by wdn127929
1 parent fb6fe159

核销券相关UI ok

... ... @@ -6,6 +6,9 @@ class FilterBtnModel {
String roleName;
String phone;
String account;
bool selectMor = false;
bool selectNoon = false;
bool selectNig = false;
FilterBtnModel();
... ... @@ -15,7 +18,10 @@ class FilterBtnModel {
..select = json["select"]
..roleName = json["role_name"]
..phone = json["phone"]
..account = json["account"];
..account = json["account"]
..selectMor = json["selectMor"]
..selectNoon = json["selectNoon"]
..selectNig = json["selectNig"];
Map<String, dynamic> toJson() => <String, dynamic>{
"id": id,
... ... @@ -23,6 +29,9 @@ class FilterBtnModel {
"select": select,
'roleName': roleName,
'phone': phone,
'account': account
'account': account,
'selectMor': selectMor,
'selectNoon': selectNoon,
'selectNig': selectNig
};
}
... ...
... ... @@ -17,6 +17,9 @@ import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../models/filter_btn_model.dart';
import '../../utils/screen_util.dart';
/**
* 新建券
*/
... ... @@ -45,6 +48,31 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
CouponProvider couponProvider;
bool swichHexiao = true; //默认启用 核销状态
String uids = '';
TextEditingController _priceControl = TextEditingController();
FocusNode _priceFocusNode = FocusNode();
bool money = true;
bool discount = false;
bool dish = false;
TextEditingController moneyControl = TextEditingController();
TextEditingController discountControl = TextEditingController();
TextEditingController dishControl = TextEditingController();
FocusNode moneyFocusNode = FocusNode();
FocusNode discountFocusNode = FocusNode();
FocusNode dishFocusNode = FocusNode();
bool limitNone = true;
bool limitWeek = false;
bool limitBirthday = false;
String weekShow = '点击设置可用日期';
List<FilterBtnModel> weekData = [];
// morning == "00:00-00:00"
String morning;
String noon;
String night;
@override
void initState() {
... ... @@ -73,21 +101,112 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
// _editingController.text = '';
}
});
_priceFocusNode.addListener(() {
if (_priceFocusNode.hasFocus) {
//有焦点
if (showDateSelWidget) {
Navigator.pop(context);
showDateSelWidget = false;
}
} else {
//失去焦点
// _editingController.text = '';
}
});
moneyFocusNode.addListener(() {
if (moneyFocusNode.hasFocus) {
//有焦点
if (showDateSelWidget) {
Navigator.pop(context);
showDateSelWidget = false;
}
} else {
//失去焦点
// _editingController.text = '';
}
});
discountFocusNode.addListener(() {
if (discountFocusNode.hasFocus) {
//有焦点
if (showDateSelWidget) {
Navigator.pop(context);
showDateSelWidget = false;
}
} else {
//失去焦点
// _editingController.text = '';
}
});
dishFocusNode.addListener(() {
if (dishFocusNode.hasFocus) {
//有焦点
if (showDateSelWidget) {
Navigator.pop(context);
showDateSelWidget = false;
}
} else {
//失去焦点
// _editingController.text = '';
}
});
WidgetsBinding.instance.addPostFrameCallback((_) {
// _couponNetworkData(0);
_initWeekData();
});
}
// //初始化时间
// initWeekData() async {
// // UserModel userModel = Provider.of<UserModel>(context, listen: false);
// // morning =
// // userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
// // noon = userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
// // night = userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
// // if (morning != "00:00-00:00") {
// // //开通早餐
// // }
// // if (morning != "00:00-00:00") {
// // //开通午餐
// // }
// // if (morning != "00:00-00:00") {
// // //开通晚餐
// // }
// }
_initWeekData() {
FilterBtnModel filterBtnModel = FilterBtnModel();
filterBtnModel.selectNoon = false;
filterBtnModel.selectNig = false;
filterBtnModel.title = '周日';
weekData.add(filterBtnModel);
for (int i = 1; i < 7; i++) {
FilterBtnModel filterBtnModel = FilterBtnModel();
filterBtnModel.selectNoon = false;
filterBtnModel.selectNig = false;
filterBtnModel.title = '周${Utils.formatWeekDayNum(i)}';
weekData.add(filterBtnModel);
}
}
//创建新券 客户经理创建活动
_createNewCoupon() async {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
String from = fromDate + ' 00:00:00';
String end = endDate + ' 23:59:59';
Map<String, String> params = {
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
"aname": _couponNameEditControl.text.trim(),
"desc": _couponRequireEditControl.text.trim(),
"stime": fromDate == '点击选择'
? ""
: '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}',
: '${(DateUtil.getDateMsByTimeStr(from) / 1000).floor()}',
"etime": endDate == '点击选择'
? ''
: '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
: '${(DateUtil.getDateMsByTimeStr(end) / 1000).floor()}',
"explain": _couponExplainEditControl.text,
"is_open": swichState ? "1" : "0",
"status": swichState ? "1" : "0",
... ... @@ -111,7 +230,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
}
///输入框
Widget _textfield(String title, String hintText) {
Widget _textfield(String title, String hintText,
TextEditingController controller, FocusNode focusNode,
{TextInputType textInputType = TextInputType.text}) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
... ... @@ -129,41 +250,38 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
Container(
width: ScreenUtil().setWidth(231 * 2),
child: TextField(
controller: title == '券名称'
? _couponNameEditControl
: _couponRequireEditControl,
textAlign: TextAlign.right,
textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
),
focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,
decoration: InputDecoration(
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
controller: controller,
textAlign: TextAlign.right,
textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
focusNode: focusNode,
decoration: InputDecoration(
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.text,
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: textInputType),
),
HEmptyView(32)
],
... ... @@ -171,6 +289,77 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
);
}
///输入框
Widget _textfieldSelect(
String title,
String hintText,
TextEditingController controller,
FocusNode focusNode, {
TextInputType textInputType = TextInputType.text,
String subtitle = '',
}) {
return Container(
padding: EdgeInsets.only(left: w(20), right: (w(20))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
title,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(40),
Expanded(
child: TextField(
controller: controller,
textAlign: TextAlign.right,
textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
),
focusNode: focusNode,
decoration: InputDecoration(
isCollapsed: true,
border: OutlineInputBorder(borderSide: BorderSide.none),
hintText: hintText,
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32),
),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: textInputType),
),
if (subtitle != '') HEmptyView(6),
Text(
subtitle,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
],
),
);
}
///时间选择
Widget _select(String title, String hintText, GestureTapCallback onTap) {
return InkWell(
... ... @@ -363,6 +552,69 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
);
}
_itemRadioWidget(bool select, String title, {GestureTapCallback onTap}) {
return InkWell(
onTap: onTap,
child: Row(children: [
Image.asset(
Utils.getImgPath(
select ? 'plan_dish_select' : 'plan_dish_unselect'),
width: w(20),
),
HEmptyView(6),
Text(
title,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
]));
}
///时间选择
Widget _select1(String title, String hintText, GestureTapCallback onTap) {
return InkWell(
onTap: onTap,
child: Container(
padding: EdgeInsets.only(left: ScreenUtil().setWidth(32)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
// height: ScreenUtil().setWidth(40),
// color: Colors.red,
child: Text(
title,
style: TextStyle(
height: 1.5,
color: title == '点击设置可用日期'
? MyColours.color_999999
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(20),
Spacer(),
Text(hintText,
style: TextStyle(
color: hintText == '点击设置开始日期' || hintText == '点击设置结束日期'
? MyColours.color_999999
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
)),
HEmptyView(20),
Image.asset(
Utils.getImgPath('arrow_right_new'),
width: ScreenUtil().setWidth(18),
),
HEmptyView(32),
],
),
),
);
}
@override
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
... ... @@ -412,13 +664,110 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
_textfield('券名称', '例:9折券/200元代金券/菜品券'),
_textfield('券名称', '例:9折券/200元代金券/菜品券',
_couponNameEditControl, _nameFocusNode),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_textfield('券要求', '例:无门槛/满2000元'),
if (!widget.isMine)
Column(
children: [
//销售价
_textfield('销售价', '默认0元,可以免费发放',
_priceControl, _priceFocusNode,
textInputType:
TextInputType.numberWithOptions()),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
// VEmptyView(24),
//券用途
VEmptyView(56),
Container(
alignment: Alignment.centerLeft,
child: Text(
'券用途',
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(40),
Row(
children: [
HEmptyView(30),
_itemRadioWidget(money, '代金券',
onTap: () {
if (!money) {
setState(() {
money = true;
dish = false;
discount = false;
});
}
}),
Spacer(),
_itemRadioWidget(discount, '折扣券',
onTap: () {
if (!discount) {
setState(() {
discount = true;
dish = false;
money = false;
});
}
}),
Spacer(),
_itemRadioWidget(dish, '菜品券',
onTap: () {
if (!dish) {
setState(() {
dish = true;
discount = false;
money = false;
});
}
}),
HEmptyView(30),
],
),
VEmptyView(30),
if (money)
_textfieldSelect('金额:', '点击输入代金券金额',
moneyControl, moneyFocusNode,
subtitle: '元',
textInputType: TextInputType
.numberWithOptions()),
if (discount)
_textfieldSelect('折扣率:', '点击输入折扣,如9折',
moneyControl, moneyFocusNode,
subtitle: '折',
textInputType: TextInputType
.numberWithOptions()),
if (dish)
_textfieldSelect('菜品:', '点击输入赠送菜品名称',
moneyControl, moneyFocusNode,
textInputType: TextInputType
.numberWithOptions()),
VEmptyView(48),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
],
),
_textfield('券要求', '例:无门槛/满2000元',
_couponRequireEditControl, _requireFocusNode),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
... ... @@ -440,12 +789,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
print(value);
fromDate = DateUtil.formatDateStr(
value,
format: DateFormats.full);
format: DateFormats.y_mo_d);
});
}
showDateSelWidget = false;
},
dateTime: DateUtil.getDateTime(fromDate),
pickerDateTimeType: PickerDateTimeType.kYMD,
onCancel: () {
showDateSelWidget = false;
});
... ... @@ -471,12 +821,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
print(value);
endDate = DateUtil.formatDateStr(
value,
format: DateFormats.full);
format: DateFormats.y_mo_d);
});
}
showDateSelWidget = false;
},
dateTime: DateUtil.getDateTime(endDate),
pickerDateTimeType: PickerDateTimeType.kYMD,
onCancel: () {
showDateSelWidget = false;
});
... ... @@ -486,6 +837,127 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
if (!widget.isMine)
Column(
children: [
//使用限制
VEmptyView(24),
Container(
alignment: Alignment.centerLeft,
child: Text(
'使用限制',
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
VEmptyView(40),
Row(
children: [
HEmptyView(30),
_itemRadioWidget(limitNone, '无',
onTap: () {
if (!limitNone) {
setState(() {
limitNone = true;
limitWeek = false;
limitBirthday = false;
});
}
}),
Spacer(),
_itemRadioWidget(limitWeek, '每周',
onTap: () {
if (!limitWeek) {
setState(() {
limitWeek = true;
limitNone = false;
limitBirthday = false;
});
}
}),
Spacer(),
_itemRadioWidget(
limitBirthday, '会员生日当天', onTap: () {
if (!limitBirthday) {
setState(() {
limitBirthday = true;
limitNone = false;
limitWeek = false;
});
}
}),
HEmptyView(30),
],
),
if (limitWeek) VEmptyView(30),
if (limitWeek)
_select1(weekShow, '', () async {
FocusScope.of(context).requestFocus(
FocusNode()); //点击空白处隐藏键盘
//弹出时间选择器
// showPickerDateTime(context);
showDateSelWidget = false;
List<FilterBtnModel> data = await DialogUtil
.openCoponsWeekSelectModalBottomSheet(
context, weekData);
if (data != null) {
//改变了
weekData = [];
weekData.addAll(data);
weekShow = '';
String noonStr = '午餐:';
String nightStr = '晚餐:';
weekData.forEach((element) {
if (element.selectNoon) {
noonStr += '${element.title} ';
}
if (element.selectNig) {
nightStr += '${element.title} ';
}
});
if (noonStr.endsWith(' ')) {
noonStr = noonStr.substring(
0, noonStr.length - 1);
}
if (nightStr.endsWith(' ')) {
nightStr = nightStr.substring(
0, nightStr.length - 1);
}
if (noonStr == '午餐:' &&
nightStr == '晚餐:') {
weekShow = '点击设置可用日期';
} else {
if (noonStr != '午餐:' &&
nightStr != '晚餐:') {
weekShow =
noonStr + '\n' + nightStr;
} else if (noonStr != '午餐:') {
weekShow = noonStr;
} else {
weekShow = nightStr;
}
}
setState(() {});
}
}),
limitWeek ? VEmptyView(22) : VEmptyView(48),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(48),
],
),
widget.isMine
? SizedBox()
: _select('谁可以发放', '编辑', () async {
... ...
... ... @@ -19,7 +19,6 @@ import 'package:barcode_scan2/barcode_scan2.dart';
import '../../utils/dialog_util.dart';
import '../../utils/misc.dart';
/**
* 优惠券列表
*/
... ... @@ -128,6 +127,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
// result.rawContent
setState(() => scanResult = result);
print(result);
NavigatorUtil.goVerificationCouponPage(context);
} on PlatformException catch (e) {
setState(() {
scanResult = ScanResult(
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/provider/coupon_provider.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';
import 'package:provider/provider.dart';
import '../../utils/screen_util.dart';
/**
* 核销券详情页
*/
class VerificationCouponPage extends StatefulWidget {
VerificationCouponPage({
Key key,
}) : super(key: key);
@override
_VerificationCouponPageState createState() => _VerificationCouponPageState();
}
class _VerificationCouponPageState extends State<VerificationCouponPage> {
ScrollController controller = ScrollController();
final heightCell = ScreenUtil().setWidth(80);
CouponProvider couponProvider;
@override
void initState() {
super.initState();
}
///时间选择
Widget _select(String title, String hintText, GestureTapCallback onTap) {
return InkWell(
onTap: onTap,
child: Container(
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
// height: ScreenUtil().setWidth(40),
// color: Colors.red,
child: Text(
title,
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(20),
Spacer(),
Text(hintText,
style: TextStyle(
color: hintText == '点击选择'
? MyColours.color_999999
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
)),
HEmptyView(20),
Image.asset(
Utils.getImgPath('arrow_right_new'),
width: ScreenUtil().setWidth(20),
),
HEmptyView(32),
],
),
),
);
}
///输入框
Widget _item(String title, String subTitle,
{Color textColor = MyColours.color_40000000, int fontSize = 16}) {
return Container(
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
child: Text(
title,
style: TextStyle(color: MyColours.color_515151, fontSize: w(16)),
),
),
HEmptyView(60),
Expanded(
child: Text(
subTitle,
maxLines: 20,
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: textColor,
fontSize: w(fontSize),
),
))
],
),
);
}
@override
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'优惠券详情',
onTap: () {
Navigator.pop(context);
},
),
body: Column(children: [
Expanded(
child: SingleChildScrollView(
controller: controller,
physics: BouncingScrollPhysics(),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(32)),
child: Column(
children: [
VEmptyView(56),
_item('券用途', '代金券/折扣券/菜品券',
textColor: MyColours.color_438E93, fontSize: 20),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item('券金额/折扣率/所含菜品', '200元/9折/精品烤鸭',
textColor: MyColours.color_438E93, fontSize: 20),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item('券要求', '满200可用'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item('有效期从', '2022-4-4'), //Utils.getDateStrFromJiekou(
// widget.couponSunModel.stime)
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
_item('有效期至', '2022-4-4'),
// widget.couponSunModel.isType == '1'
// ? Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(24),
// _item('创建人', widget.couponSunModel.uid),
// ],
// )
// : SizedBox(),
// widget.couponSunModel.isType == '1'
// ? Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// ),
// VEmptyView(24),
// _select(
// '谁可以发放',
// '查看',
// () async {
// await NavigatorUtil.goCouponToPersonnalPage(
// context, widget.couponSunModel.uidList,
// onlyShow: true);
// },
// )
// ],
// )
// : SizedBox(),
// widget.couponSunModel.explain != null &&
// widget.couponSunModel.explain != ''
// ? Container(
// height: ScreenUtil().setWidth(2),
// color: MyColours.color_E7E7E7,
// )
// : SizedBox(),
// widget.couponSunModel.explain != null &&
// widget.couponSunModel.explain != ''
// ? VEmptyView(24)
// : SizedBox(),
_item('券说明',
'最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多最多'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
// VEmptyView(24),
// _item('券状态',
// widget.couponSunModel.status == '1' ? '发放中' : '停用')
],
))),
),
true
? Padding(
padding: EdgeInsets.only(bottom: w(58)),
child: Image.asset(
Utils.getImgPath('has_use'),
width: w(50),
),
)
: Container(
height: ScreenUtil().setWidth(91 * 2),
width: double.infinity,
padding: EdgeInsets.only(
top: ScreenUtil().setWidth(16 * 2),
bottom: ScreenUtil().setWidth(35 * 2),
left: ScreenUtil().setWidth(45 * 2),
right: ScreenUtil().setWidth(45 * 2),
),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
boxShadow: [
BoxShadow(
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.1),
offset: Offset(0, ScreenUtil().setWidth(-2)),
blurRadius: ScreenUtil().setWidth(8))
],
borderRadius: BorderRadius.all(
Radius.circular(ScreenUtil().setWidth(16)),
),
),
child: RoundButton(
text: '核销使用',
height: ScreenUtil().setWidth(80),
radius: ScreenUtil().setWidth(14),
isBold: false,
fontSize: 28,
onPressed: () async {
DialogUtil.cupertinoAlertDialog(context,
content: '确定要核销当前优惠券吗?核销使用后,该券不能再次使用。');
// "stime": fromDate == '点击选择'
// ? ""
// : '${DateUtil.getDateMsByTimeStr(fromDate) / 1000}',
// "etime": endDate == '点击选择'
// ? ''
// : '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
// UserModel userModel =
// Provider.of<UserModel>(context, listen: false);
// if (userModel.user.role_name == '管理员' ||
// userModel.user.role_name == '店长') {
// NavigatorUtil.goRechargeEditPage(context);
// } else {
// bool needRefresh =
// await NavigatorUtil.goCouponEditPage(context);
// print(needRefresh);
// if (needRefresh != null && needRefresh) {
// bus.emit('refresh_coupon_list_f');
// //刷新页面数据
// // _controller.callRefresh();
// // _couponNetworkData(tabController.index);
// }
// }
},
),
)
]),
);
}
}
... ...
... ... @@ -1580,4 +1580,15 @@ class NavigatorUtil {
return _navigateTo(context, "${Routes.recharge_detail_page}",
replace: replace);
}
///核销使用
static Future<dynamic> goVerificationCouponPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.verification_coupon_page}",
replace: replace);
}
}
... ...
... ... @@ -158,6 +158,7 @@ import '../models/plan_cook_list_model.dart';
import '../models/set_xuan_tai_model.dart';
import '../models/setmeal_by_id_model.dart';
import '../models/wine_manage_model.dart';
import '../pages/coupon/verification_coupon_page.dart';
import '../pages/feast/feast_board.dart';
import '../pages/feast/feast_create_page.dart';
import '../pages/feast/feast_deposit_data_page.dart';
... ... @@ -2543,3 +2544,19 @@ var rechargeDetailPageHandle = new Handler(
return ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(), child: RechargeDetailPage());
});
///核销使用
var verificationCouponPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// OutWineRecordSunModel outWineRecordSunModel = OutWineRecordSunModel.fromJson(
// json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["detail"].first)));
// String selectIDs = params["selectIDs"].first;
// List<String> selectList = [];
// if (selectIDs.length > 0) {
// selectList = selectIDs.split(',');
// }
return ChangeNotifierProvider<CouponProvider>(
create: (_) => CouponProvider(), child: VerificationCouponPage());
});
... ...
... ... @@ -232,6 +232,11 @@ class Routes {
static String recharge_detail_page =
"/recharge_detail_page"; //充值优惠详情页
static String verification_coupon_page =
"/verification_coupon_page"; //核销使用
static void configureRoutes(FluroRouter router) {
... ... @@ -449,6 +454,9 @@ static String recharge_detail_page =
handler: rechargeSelectStoreCouponPageHandle);
router.define(recharge_detail_page,
handler: rechargeDetailPageHandle);
router.define(verification_coupon_page,
handler: verificationCouponPageHandle);
}
... ...
... ... @@ -280,6 +280,181 @@ class DialogUtil {
});
}
///优惠券每周早餐午餐晚餐选择
static openCoponsWeekSelectModalBottomSheet(
context, List<FilterBtnModel> weekData,
{VoidCallback lCallback, VoidCallback rCallback}) async {
List<FilterBtnModel> data = weekData.map((e) {
return FilterBtnModel.fromJson(e.toJson());
}).toList();
final option = await showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
isDismissible: false,
isScrollControlled: true,
builder: (BuildContext context) {
return StatefulBuilder(builder: (context, state) {
return Container(
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(10)),
topRight: Radius.circular(ScreenUtil().setWidth(10)))),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Padding(
padding: EdgeInsets.only(
left: w(25), right: w(25), top: w(26), bottom: w(12)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
InkWell(
onTap: () {
Navigator.pop(context);
},
child: Container(
child: Text(
'取消',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_515151,
),
),
),
),
InkWell(
onTap: () {
Navigator.pop(context, data);
},
child: Container(
child: Text(
'确定',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_438E93,
),
),
),
),
],
)),
MyDivider(
double.infinity,
ScreenUtil().setWidth(2),
color: MyColours.color_DBDBDB,
),
VEmptyView(116),
ListView.builder(
shrinkWrap: true,
itemCount: data.length + 1,
itemBuilder: (context, index) {
if (index == 0) {
return Container(
margin: EdgeInsets.only(bottom: w(7)),
padding: EdgeInsets.only(
left: w(33),
right: w(33),
top: w(16),
bottom: w(7)),
decoration: index - 1 == data.length - 1
? null
: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1),
color: MyColours.color_DBDBDB))),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Spacer(),
Container(
width: w(34),
alignment: Alignment.center,
child: Text('午餐',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(16)))),
HEmptyView(90),
Container(
width: w(34),
alignment: Alignment.center,
child: Text('晚餐',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(16)))),
],
));
}
return Container(
margin: EdgeInsets.only(bottom: w(7)),
padding: EdgeInsets.only(
left: w(33),
right: w(33),
top: w(16),
bottom: w(7)),
decoration: index - 1 == data.length - 1
? null
: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1),
color: MyColours.color_DBDBDB))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(data[index - 1].title,
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(16))),
Spacer(),
InkWell(
onTap: () {
state(() {
data[index - 1].selectNoon =
!data[index - 1].selectNoon;
});
},
child: Container(
width: w(34),
alignment: Alignment.center,
child: Image.asset(
Utils.getImgPath(
data[index - 1].selectNoon
? 'c_mul_select'
: 'c_mul_select_un'),
width: w(20)))),
HEmptyView(90),
InkWell(
onTap: () {
state(() {
data[index - 1].selectNig =
!data[index - 1].selectNig;
});
},
child: Container(
width: w(34),
alignment: Alignment.center,
child: Image.asset(
Utils.getImgPath(
data[index - 1].selectNig
? 'c_mul_select'
: 'c_mul_select_un'),
width: w(20)))),
],
));
}),
],
),
);
});
});
print(option);
return option;
}
///优惠每周选择
static openWeekSelectModalBottomSheet(context, List<FilterBtnModel> weekData,
{VoidCallback lCallback, VoidCallback rCallback}) async {
... ... @@ -5748,6 +5923,7 @@ class DialogUtil {
}
}
static Future cupertinoAlertDialogFeast(BuildContext context,
{String title = "",
String content = "内容",
... ...