|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_picker/Picker.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/res/colors.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 '../../../../utils/dialog_util.dart';
|
|
|
|
import '../../../../utils/screen_util.dart';
|
|
|
|
import '../../../../utils/utils.dart';
|
|
|
|
import '../../../../widgets/h_empty_view.dart';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 导出预订数据
|
|
|
|
*/
|
|
|
|
|
|
|
|
class ExportBookDataPage extends StatefulWidget {
|
|
|
|
ExportBookDataPage({Key key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
_ExportBookDataPageState createState() => _ExportBookDataPageState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ExportBookDataPageState extends State<ExportBookDataPage> {
|
|
|
|
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
|
|
|
|
String fromDate = '点击选择'; //有效期开始时间
|
|
|
|
String endDate = '点击选择'; //有效期结束时间
|
|
|
|
String timeType = '点击选择'; //时间类型
|
|
|
|
|
|
|
|
List<String> data = ['到店时间', '下单时间'];
|
|
|
|
int timeIndex;
|
|
|
|
|
|
|
|
///时间选择
|
|
|
|
Widget _select(String title, String hintText, GestureTapCallback onTap) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onTap,
|
|
|
|
child: Container(
|
|
|
|
height: w(48),
|
|
|
|
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: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
HEmptyView(20),
|
|
|
|
Spacer(),
|
|
|
|
Text(hintText,
|
|
|
|
style: TextStyle(
|
|
|
|
color: hintText == '点击选择'
|
|
|
|
? MyColours.color_999999
|
|
|
|
: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
)),
|
|
|
|
HEmptyView(16),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('arrow_right_new'),
|
|
|
|
width: ScreenUtil().setWidth(20),
|
|
|
|
),
|
|
|
|
HEmptyView(32),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> itemWidget() {
|
|
|
|
List<Widget> data = [];
|
|
|
|
for (var i = 0; i < 10; i++) {
|
|
|
|
data.add(
|
|
|
|
GestureDetector(
|
|
|
|
onTap: () {},
|
|
|
|
child: Container(
|
|
|
|
height: w(34),
|
|
|
|
padding:
|
|
|
|
EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(20)),
|
|
|
|
decoration: false
|
|
|
|
? BoxDecoration(
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(10)))
|
|
|
|
: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(ScreenUtil().setWidth(10)),
|
|
|
|
border: Border.all(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
width: ScreenUtil().setWidth(2))),
|
|
|
|
child: Row(mainAxisSize: MainAxisSize.min, children: <Widget>[
|
|
|
|
Flexible(
|
|
|
|
child: Text(
|
|
|
|
'下单时间',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: ScreenUtil().setSp(28),
|
|
|
|
color:
|
|
|
|
false ? MyColours.color_ffffff : MyColours.color_515151,
|
|
|
|
),
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
)),
|
|
|
|
]),
|
|
|
|
)),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
key: scaffoldKey,
|
|
|
|
backgroundColor: MyColours.color_f3f3f3,
|
|
|
|
appBar: SystemAppBar('预订数据导出'),
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
// controller: controller,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(10),
|
|
|
|
Container(
|
|
|
|
padding: EdgeInsets.only(left: w(16)),
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
VEmptyView(20),
|
|
|
|
_select('时间类型', timeType, () {
|
|
|
|
DialogUtil.showSelectCusmanDialog(context, data, (value) {
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
timeIndex = value.first;
|
|
|
|
timeType = data[timeIndex];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
cancelText: '',
|
|
|
|
title: '选择宴会类型',
|
|
|
|
selecteds: timeIndex == null ? [] : [timeIndex])
|
|
|
|
.then((value) {});
|
|
|
|
}),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(1),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
_select('开始日期', fromDate, () {
|
|
|
|
DialogUtil.showPickerDateTime24(context, scaffoldKey,
|
|
|
|
(value) {
|
|
|
|
// {'text': picker.adapter.text, 'select': selecteds}
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
print(value);
|
|
|
|
fromDate = DateUtil.formatDateStr(value,
|
|
|
|
format: DateFormats.y_mo_d);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
yearBegin: 1900,
|
|
|
|
minValue: DateTime(1900),
|
|
|
|
dateTime: DateUtil.getDateTime(fromDate),
|
|
|
|
pickerDateTimeType: PickerDateTimeType.kYMD,
|
|
|
|
onCancel: () {});
|
|
|
|
}),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(1),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
_select('结束日期', endDate, () {
|
|
|
|
DialogUtil.showPickerDateTime24(context, scaffoldKey,
|
|
|
|
(value) {
|
|
|
|
// {'text': picker.adapter.text, 'select': selecteds}
|
|
|
|
if (value != null) {
|
|
|
|
setState(() {
|
|
|
|
print(value);
|
|
|
|
endDate = DateUtil.formatDateStr(value,
|
|
|
|
format: DateFormats.y_mo_d);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
},
|
|
|
|
yearBegin: 1900,
|
|
|
|
minValue: DateTime(1900),
|
|
|
|
dateTime: DateUtil.getDateTime(endDate),
|
|
|
|
pickerDateTimeType: PickerDateTimeType.kYMD,
|
|
|
|
onCancel: () {});
|
|
|
|
}),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
Container(
|
|
|
|
// height: ScreenUtil().setWidth(40),
|
|
|
|
// color: Colors.red,
|
|
|
|
child: Text(
|
|
|
|
'导出字段选择:',
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_515151,
|
|
|
|
fontSize: ScreenUtil().setSp(32)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
Wrap(
|
|
|
|
runSpacing: w(10),
|
|
|
|
spacing: w(10),
|
|
|
|
children: itemWidget(),
|
|
|
|
),
|
|
|
|
VEmptyView(30),
|
|
|
|
Container(
|
|
|
|
height: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E7E7E7,
|
|
|
|
),
|
|
|
|
VEmptyView(20),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(26),
|
|
|
|
RoundButton(
|
|
|
|
text: '导出数据',
|
|
|
|
width: w(218),
|
|
|
|
height: w(43),
|
|
|
|
gradientStart: MyColours.color_f3f3f3,
|
|
|
|
gradientEnd: MyColours.color_f3f3f3,
|
|
|
|
textColor: MyColours.color_438E93,
|
|
|
|
borderColor: MyColours.color_438E93,
|
|
|
|
radius: r(10),
|
|
|
|
fontSize: 32,
|
|
|
|
isBold: true,
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|