Commit 115eefbfb40127e26d72e86dcd72589448b2602a

Authored by wdn127929
1 parent f096b86d

部分

import 'package:flutter/material.dart';
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_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';
class CouponCreateSelectTypePage extends StatefulWidget {
CouponCreateSelectTypePage({Key key}) : super(key: key);
@override
_CouponCreateSelectTypePageState createState() =>
_CouponCreateSelectTypePageState();
}
class _CouponCreateSelectTypePageState
extends State<CouponCreateSelectTypePage> {
bool selectF = true;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'选择优惠券类型',
onTap: () {
Navigator.pop(context);
},
),
body: SingleChildScrollView(
child: Column(
children: [
VEmptyView(98),
InkWell(
onTap: () {
if (!selectF) {
setState(() {
selectF = !selectF;
});
}
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
height: ScreenUtil().setWidth(106 * 2),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
offset: Offset(0, ScreenUtil().setWidth(4)),
blurRadius: ScreenUtil().setWidth(20),
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(32, 109, 114, 0.2))
],
color: selectF
? MyColours.color_438E93
: MyColours.color_ffffff,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(24))),
child: Row(
children: [
Image.asset(
Utils.getImgPath(selectF
? 'coupon_select_type_user'
: 'coupon_select_type_user_un'),
width: ScreenUtil().setWidth(70 * 2),
),
HEmptyView(70),
Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'仅为我创建',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
VEmptyView(16),
Text(
'创建后仅我可发放该优惠券',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: selectF
? MyColours.color_ffffff
: MyColours.color_BFC4D4),
),
],
),
],
),
)),
VEmptyView(94),
InkWell(
onTap: () {
if (selectF) {
setState(() {
selectF = !selectF;
});
}
},
child: Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(60)),
height: ScreenUtil().setWidth(106 * 2),
decoration: BoxDecoration(
boxShadow: [
BoxShadow(
offset: Offset(0, ScreenUtil().setWidth(4)),
blurRadius: ScreenUtil().setWidth(20),
spreadRadius: ScreenUtil().setWidth(2),
color: Color.fromRGBO(0, 0, 0, 0.1))
],
color: !selectF
? MyColours.color_438E93
: MyColours.color_ffffff,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(24))),
child: Row(
children: [
Image.asset(
Utils.getImgPath(!selectF
? 'coupon_select_type_store'
: 'coupon_select_type_store_un'),
width: ScreenUtil().setWidth(75 * 2),
),
HEmptyView(60),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'为全店创建',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(36),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_999999),
),
VEmptyView(16),
Text(
'创建后所有员工均可发放该优惠券',
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: !selectF
? MyColours.color_ffffff
: MyColours.color_BFC4D4),
),
],
)),
],
),
)),
VEmptyView(112),
RoundButton(
text: '立即创建',
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
width: ScreenUtil().setWidth(130 * 2),
height: ScreenUtil().setWidth(37 * 2),
textColor: MyColours.color_438E93,
fontSize: 24,
isBold: true,
radius: ScreenUtil().setWidth(22),
onPressed: () async {
bool needRefresh = await NavigatorUtil.goCouponEditPage(context,
isMine: selectF);
print(needRefresh);
if (needRefresh != null && needRefresh) {
//刷新页面数据
// _controller.callRefresh();
// _couponNetworkData();
}
},
)
],
),
),
);
}
}
... ...
... ... @@ -22,7 +22,8 @@ import 'package:provider/provider.dart';
*/
class CouponEidtPage extends StatefulWidget {
CouponEidtPage({Key key}) : super(key: key);
final bool isMine;
CouponEidtPage({Key key, this.isMine = true}) : super(key: key);
@override
_CouponEidtPageState createState() => _CouponEidtPageState();
... ... @@ -33,7 +34,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
TextEditingController _couponNameEditControl = TextEditingController();
TextEditingController _couponRequireEditControl = TextEditingController();
TextEditingController _couponExplainEditControl = TextEditingController();
final heightCell = ScreenUtil().setWidth(48);
final heightCell = ScreenUtil().setWidth(48 * 2);
bool swichState = true; //默认启用 开关状态
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
String fromDate = '点击选择'; //有效期开始时间
... ... @@ -42,6 +43,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
FocusNode _requireFocusNode = FocusNode();
bool showDateSelWidget = false;
CouponProvider couponProvider;
bool swichHexiao = true; //默认启用 核销状态
@override
void initState() {
... ... @@ -87,8 +89,13 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
: '${DateUtil.getDateMsByTimeStr(endDate) / 1000}',
"explain": _couponExplainEditControl.text,
"is_open": swichState ? "1" : "0",
"status": swichState ? "1" : "0"
"status": swichState ? "1" : "0",
'is_type': widget.isMine ? "2" : "1"
};
if (!widget.isMine) {
params['is_examine'] = swichHexiao ? "1" : "0";
params['uid_list'] = '';
}
bool isSuccess =
await couponProvider.createCustomerActivity(context, params);
if (isSuccess) {
... ... @@ -108,9 +115,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
child: Text(
title,
style: TextStyle(
color: MyColours.color_333333,
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(80),
... ... @@ -128,6 +135,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
),
focusNode: title == '券名称' ? _nameFocusNode : _requireFocusNode,
... ... @@ -151,51 +159,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
},
keyboardType: TextInputType.text,
),
)
),
HEmptyView(32)
],
),
);
}
///时间选择
Widget _select(String title, String hintText) {
Widget _select(String title, String hintText, GestureTapCallback onTap) {
return 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) {
if (title == '有效期从') {
setState(() {
print(value);
fromDate =
DateUtil.formatDateStr(value, format: DateFormats.full);
});
} else if (title == '有效期至') {
setState(() {
print(value);
endDate =
DateUtil.formatDateStr(value, format: DateFormats.full);
});
}
}
showDateSelWidget = false;
},
dateTime: title == '有效期从'
? DateUtil.getDateTime(fromDate)
: DateUtil.getDateTime(endDate),
onCancel: () {
showDateSelWidget = false;
});
},
onTap: onTap,
child: Container(
height: heightCell,
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
... ... @@ -206,8 +182,9 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
child: Text(
title,
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(30)),
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(20),
... ... @@ -216,15 +193,15 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
style: TextStyle(
color: hintText == '点击选择'
? MyColours.color_999999
: MyColours.color_333333,
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32),
)),
HEmptyView(20),
Image.asset(
Utils.getImgPath('arr_right_gray'),
width: ScreenUtil().setWidth(12),
height: ScreenUtil().setWidth(22),
)
Utils.getImgPath('arrow_right_new'),
width: ScreenUtil().setWidth(20),
),
HEmptyView(32),
],
),
),
... ... @@ -235,6 +212,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
Widget _explain(String title, String hintText) {
return Container(
// height: ScreenUtil().setWidth(380),
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
... ... @@ -244,15 +222,19 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
title,
textAlign: TextAlign.left,
style: TextStyle(
color: MyColours.color_333333,
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
fontSize: ScreenUtil().setSp(32)),
)),
VEmptyView(30),
VEmptyView(26),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
TextField(
controller: _couponExplainEditControl,
// keyboardType: TextInputType.number, //键盘类型,数字键盘
maxLines: 6,
maxLines: 3,
maxLength: 50,
// maxLengthEnforced: true,
... ... @@ -266,23 +248,33 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(32),
),
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)),
border: OutlineInputBorder(borderSide: BorderSide.none),
enabledBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder: OutlineInputBorder(
//选中时外边框颜色
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(20)),
borderSide: BorderSide(
color: MyColours.app_main,
),
focusedBorder: new UnderlineInputBorder(
borderSide: BorderSide.none,
),
// 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)),
... ... @@ -297,16 +289,12 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
}
///是否立即启用
Widget _canUse(String title) {
Widget _canUse(String title, bool swich, GestureTapCallback onTap) {
return InkWell(
onTap: () {
setState(() {
swichState = !swichState;
});
},
onTap: onTap,
child: Container(
padding: EdgeInsets.only(top: ScreenUtil().setWidth(30)),
// height: heightCell,
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(24)),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
... ... @@ -317,18 +305,17 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
child: Text(
title,
style: TextStyle(
color: MyColours.color_333333,
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
fontSize: ScreenUtil().setSp(32)),
),
),
Spacer(),
Image.asset(
swichState
swich
? Utils.getImgPath('swich_on')
: Utils.getImgPath('swich_off'),
width: ScreenUtil().setWidth(122),
height: ScreenUtil().setWidth(82),
width: ScreenUtil().setWidth(44 * 2),
)
],
),
... ... @@ -336,6 +323,41 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
);
}
///
Widget _item(String title, String subTitle) {
return Container(
padding: EdgeInsets.symmetric(vertical: ScreenUtil().setWidth(28)),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(32)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
child: Text(
title,
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.9),
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
HEmptyView(60),
Expanded(
child: Text(
subTitle,
maxLines: 20,
textAlign: TextAlign.right,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color.fromRGBO(0, 0, 0, 0.4),
fontSize: ScreenUtil().setSp(32),
),
))
],
),
);
}
@override
Widget build(BuildContext context) {
couponProvider = Provider.of<CouponProvider>(context, listen: true);
... ... @@ -343,7 +365,7 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
backgroundColor: MyColours.color_ffffff,
key: scaffoldKey,
appBar: SystemAppBar(
'创建新券',
'优惠券详情',
onTap: () {
Navigator.pop(context, false);
},
... ... @@ -358,98 +380,165 @@ class _CouponEidtPageState extends State<CouponEidtPage> {
controller: controller,
physics: BouncingScrollPhysics(),
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
padding: EdgeInsets.only(left: ScreenUtil().setWidth(32)),
child: Column(
children: [
VEmptyView(40),
VEmptyView(56),
_item('券类型', widget.isMine ? '我的优惠券' : '店铺优惠券'),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
VEmptyView(24),
widget.isMine
? SizedBox()
: _canUse('是否核销', swichHexiao, () {
setState(() {
swichHexiao = !swichHexiao;
});
}),
widget.isMine
? SizedBox()
: Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
_textfield('券名称', '例:9折券/200元代金券/菜品券'),
VEmptyView(22),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2)),
color: MyColours.color_E7E7E7,
),
VEmptyView(30),
VEmptyView(24),
_textfield('券要求', '例:无门槛/满2000元'),
VEmptyView(22),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2)),
color: MyColours.color_E7E7E7,
),
VEmptyView(30),
_select('有效期从', fromDate),
VEmptyView(30),
VEmptyView(24),
_select('有效期从', fromDate, () {
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);
fromDate = DateUtil.formatDateStr(value,
format: DateFormats.full);
});
}
showDateSelWidget = false;
},
dateTime: DateUtil.getDateTime(fromDate),
onCancel: () {
showDateSelWidget = false;
});
}),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2)),
color: MyColours.color_E7E7E7,
),
VEmptyView(30),
_select('有效期至', endDate),
VEmptyView(30),
VEmptyView(24),
_select('有效期至', endDate, () {
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);
endDate = DateUtil.formatDateStr(value,
format: DateFormats.full);
});
}
showDateSelWidget = false;
},
dateTime: DateUtil.getDateTime(endDate),
onCancel: () {
showDateSelWidget = false;
});
}),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2)),
color: MyColours.color_E7E7E7,
),
VEmptyView(30),
VEmptyView(24),
widget.isMine
? SizedBox()
: _select('谁可以发放', '编辑', () {}),
widget.isMine
? SizedBox()
: Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_E7E7E7,
),
widget.isMine ? SizedBox() : VEmptyView(24),
_explain('券说明', '例:可用包间,停车免费,不与店内其他活动共享等'),
// VEmptyView(20),
_canUse('是否立即启用'),
VEmptyView(20),
_canUse('立即启用', swichState, () {
setState(() {
swichState = !swichState;
});
}),
VEmptyView(30),
],
))),
),
VEmptyView(20),
Padding(
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () {
if (_couponNameEditControl.text.trim().length == 0) {
Utils.showToast('请填写券名称');
return;
}
if (_couponRequireEditControl.text.trim().length == 0) {
Utils.showToast('请填写券要求');
return;
}
if (fromDate == '点击选择') {
Utils.showToast('请选择有效期起始时间');
return;
}
if (endDate == '点击选择') {
Utils.showToast('请选择有效期结束时间');
return;
}
if (DateUtil.getDateTime(endDate)
.compareTo(DateUtil.getDateTime(fromDate)) <
0) {
Utils.showToast('有效期结束时间不能早于起始时间');
return;
}
// ***参数***
// _couponNameEditControl.text
// _couponRequireEditControl.text
// fromDate
// endDate
// _couponExplainEditControl.text
// swichState
_createNewCoupon();
},
text: '保存',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
width: double.infinity,
radius: ScreenUtil().setWidth(10),
))
RoundButton(
onPressed: () {
if (_couponNameEditControl.text.trim().length == 0) {
Utils.showToast('请填写券名称');
return;
}
if (_couponRequireEditControl.text.trim().length == 0) {
Utils.showToast('请填写券要求');
return;
}
if (fromDate == '点击选择') {
Utils.showToast('请选择有效期起始时间');
return;
}
if (endDate == '点击选择') {
Utils.showToast('请选择有效期结束时间');
return;
}
if (DateUtil.getDateTime(endDate)
.compareTo(DateUtil.getDateTime(fromDate)) <
0) {
Utils.showToast('有效期结束时间不能早于起始时间');
return;
}
// ***参数***
// _couponNameEditControl.text
// _couponRequireEditControl.text
// fromDate
// endDate
// _couponExplainEditControl.text
// swichState
_createNewCoupon();
},
text: '立即创建',
fontSize: 24,
isBold: false,
height: ScreenUtil().setWidth(37 * 2),
width: ScreenUtil().setWidth(130 * 2),
radius: ScreenUtil().setWidth(22),
),
VEmptyView(32)
])),
);
}
... ...
... ... @@ -47,9 +47,11 @@ class _CouponItemFState extends State<CouponItemF> {
if (ObjectUtil.isNotEmpty(sunModel.explain)) {
explainH = Utils.calculateTextHeight(
'说明:${sunModel.explain}',
ScreenUtil().setSp(24),
ScreenUtil().setSp(20),
FontWeight.normal,
ScreenUtil.screenWidthDp - ScreenUtil().setWidth(92 * 2),
ScreenUtil.screenWidthDp -
ScreenUtil().setWidth(92 * 2) +
ScreenUtil().setWidth(20),
5,
context);
}
... ... @@ -116,7 +118,7 @@ class _CouponItemFState extends State<CouponItemF> {
),
Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(30),
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(9 * 2),
ScreenUtil().setWidth(10),
ScreenUtil().setWidth(20)),
... ... @@ -184,8 +186,7 @@ class _CouponItemFState extends State<CouponItemF> {
// : Container()
// :
),
const MySeparator(
width: 3, color: MyColours.color_f3f3f3),
const MySeparator(width: 3, color: MyColours.color_f3f3f3),
ObjectUtil.isNotEmpty(sunModel.explain)
? InkWell(
onTap: () {
... ... @@ -213,7 +214,7 @@ class _CouponItemFState extends State<CouponItemF> {
widget.couponSonModel.showText
? Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(30),
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(14),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(14)),
... ... @@ -228,7 +229,7 @@ class _CouponItemFState extends State<CouponItemF> {
)
: Container(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(30),
ScreenUtil().setWidth(24 * 2),
ScreenUtil().setWidth(14),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(14)),
... ... @@ -248,13 +249,15 @@ class _CouponItemFState extends State<CouponItemF> {
explainH > 19
? Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(12)),
top: ScreenUtil().setWidth(10),
right: ScreenUtil().setWidth(16)),
child: Image.asset(
!widget.couponSonModel.showText
? Utils.getImgPath('quan_down')
: Utils.getImgPath('quan_up'),
width: ScreenUtil().setWidth(68),
height: ScreenUtil().setWidth(44)),
? Utils.getImgPath(
'quan_down_f')
: Utils.getImgPath('quan_up_f'),
width: ScreenUtil().setWidth(28),
height: ScreenUtil().setWidth(28)),
)
: Container(),
HEmptyView(14)
... ...
... ... @@ -148,7 +148,7 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
fontSize: ScreenUtil().setSp(24),
),
)),
VEmptyView(11),
VEmptyView(32),
Expanded(
child: TabBarView(controller: tabController, children: [
Consumer<CouponProvider>(builder: (context, model, _) {
... ... @@ -243,7 +243,23 @@ class _CouponPageState extends State<CouponPage> with TickerProviderStateMixin {
radius: ScreenUtil().setWidth(14),
isBold: false,
fontSize: 28,
onPressed: () {},
onPressed: () async{
UserModel userModel =
Provider.of<UserModel>(context, listen: false);
if (userModel.user.role_name == '管理员' ||
userModel.user.role_name == '店长') {
NavigatorUtil.goCouponCreateSelectTypePage(context);
}else{
bool needRefresh =
await NavigatorUtil.goCouponEditPage(context);
print(needRefresh);
if (needRefresh != null && needRefresh) {
//刷新页面数据
// _controller.callRefresh();
_couponNetworkData();
}
}
},
),
)
],
... ...
import 'package:flutter/material.dart';
class MyColours {
static const Color color_DBDBDB = Color(0xffDBDBDB);
static const Color color_F8F9FD = Color(0xffF8F9FD);
static const Color color_5F7292 = Color(0xff5F7292);
... ...
... ... @@ -264,8 +264,9 @@ class NavigatorUtil {
/// 创建优惠券
static Future<dynamic> goCouponEditPage(BuildContext context,
{replace = false}) {
return _navigateTo(context, "${Routes.coupon_edit}", replace: replace);
{replace = false, bool isMine = true}) {
return _navigateTo(context, "${Routes.coupon_edit}?isMine=${isMine}",
replace: replace);
}
/// 选择优惠券
... ... @@ -831,4 +832,13 @@ class NavigatorUtil {
return _navigateTo(context, "${Routes.my_area_manage_page}?",
replace: replace);
}
///优惠券选择页面
static Future<dynamic> goCouponCreateSelectTypePage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.coupon_create_select_type_page}?",
replace: replace);
}
}
... ...
... ... @@ -18,6 +18,7 @@ import 'package:one_key/models/sms_info.dart';
import 'package:one_key/models/statics_model.dart';
import 'package:one_key/models/table_list.dart';
import 'package:one_key/models/user_history_entity.dart';
import 'package:one_key/pages/coupon/coupon_create_select_type_page.dart';
import 'package:one_key/pages/coupon/coupon_detail_page.dart';
import 'package:one_key/pages/coupon/coupon_edit_page.dart';
import 'package:one_key/pages/coupon/coupon_history_page.dart';
... ... @@ -473,8 +474,10 @@ var handleCouponHistoryPageHandler = new Handler(
var handleCouponEditPageHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
// String rid = params["rid"].first;
// bool fromNotify = FluroConvertUtils.string2bool(params["fromNotify"].first);
return CouponEidtPage();
bool isMine = FluroConvertUtils.string2bool(params["isMine"].first);
return CouponEidtPage(
isMine: isMine,
);
});
///选择优惠券
... ... @@ -1281,3 +1284,14 @@ var myAreaManagePageHandle = new Handler(
child: MyAreaManagePage(),
);
});
///选择优惠券类型
var couponCreateSelectTypePageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// Guest guest = Guest.fromJson(json
// .decode(FluroConvertUtils.fluroCnParamsDecode(params["guest"].first)));
// UserHistoryEntity userHistoryEntity = UserHistoryEntity.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(
// params["userHistoryEntity"].first)));
return CouponCreateSelectTypePage();
});
... ...
... ... @@ -111,6 +111,8 @@ class Routes {
static String my_area_manage_page = "/my_area_manage_page"; //我的---区域管理
static String base_info_personnal_page =
"/base_info_personnal_page"; //员工管理---个人资料
static String coupon_create_select_type_page =
"/coupon_create_select_type_page"; //选择优惠券类型
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -223,7 +225,9 @@ class Routes {
router.define(my_table_manager_home_page,
handler: myTableManagerHomePageHandle);
router.define(my_area_manage_page, handler: myAreaManagePageHandle);
router.define(base_info_personnal_page, handler: baseInfoPersonnalPageHandle);
router.define(base_info_personnal_page,
handler: baseInfoPersonnalPageHandle);
router.define(coupon_create_select_type_page,
handler: couponCreateSelectTypePageHandle);
}
}
... ...