|
...
|
...
|
@@ -2,8 +2,10 @@ |
|
|
|
* 宴会看板
|
|
|
|
*/
|
|
|
|
|
|
|
|
import 'package:common_utils/common_utils.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
import 'package:one_key/models/get_board_model.dart';
|
|
|
|
import 'package:one_key/res/colors.dart';
|
|
|
|
import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
...
|
...
|
@@ -11,10 +13,12 @@ import 'package:table_calendar/table_calendar.dart'; |
|
|
|
|
|
|
|
import '../../provider/feast_model.dart';
|
|
|
|
import '../../provider/user_model.dart';
|
|
|
|
import '../../route/navigator_util.dart';
|
|
|
|
import '../../utils/screen_util.dart';
|
|
|
|
import '../../utils/utils.dart';
|
|
|
|
import '../../widgets/round_button.dart';
|
|
|
|
import '../../widgets/v_empty_view.dart';
|
|
|
|
import 'feast_board.item.dart';
|
|
|
|
import 'feast_board_item.dart';
|
|
|
|
|
|
|
|
class FeastBoardPage extends StatefulWidget {
|
|
|
|
FeastBoardPage({Key key}) : super(key: key);
|
|
...
|
...
|
@@ -28,6 +32,7 @@ class _FeastBoardPageState extends State<FeastBoardPage> { |
|
|
|
DateTime dateTimeNow; //当前日期
|
|
|
|
bool calendarShow = true; //日历展开
|
|
|
|
FeastModel feastModel;
|
|
|
|
ScrollController controller = ScrollController();
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
...
|
...
|
@@ -37,9 +42,40 @@ class _FeastBoardPageState extends State<FeastBoardPage> { |
|
|
|
Utils.changeStatusColor(color: MyColours.color_438E93);
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
_getExitsBanquetByDate();
|
|
|
|
_getBanquetByDate();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
///指定日期、时段宴会预定
|
|
|
|
_getBanquetByDate() async {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
|
|
String timeStrStart = dateTimeNow.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTimeNow.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTimeNow.day) +
|
|
|
|
" 00:00:00";
|
|
|
|
String timeStrEnd = dateTimeNow.year.toString() +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTimeNow.month) +
|
|
|
|
"-" +
|
|
|
|
Utils.addZeroNumber(dateTimeNow.day) +
|
|
|
|
" 23:59:59";
|
|
|
|
|
|
|
|
String start =
|
|
|
|
(DateUtil.getDateMsByTimeStr(timeStrStart) / 1000).floor().toString();
|
|
|
|
String end =
|
|
|
|
(DateUtil.getDateMsByTimeStr(timeStrEnd) / 1000).floor().toString();
|
|
|
|
Map<String, String> pramas = {
|
|
|
|
'sid': userModel.user.sellerid,
|
|
|
|
'rdate': '${start}',
|
|
|
|
'edate': '${end}'
|
|
|
|
};
|
|
|
|
bool success =
|
|
|
|
await feastModel.getBanquetByDate(context, pramas, showLoading: true);
|
|
|
|
if (success) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
//解析返回显示的日期
|
|
|
|
static String _parseDateDay(DateTime dateTime) {
|
|
|
|
DateTime now = DateTime.now();
|
|
...
|
...
|
@@ -56,6 +92,46 @@ class _FeastBoardPageState extends State<FeastBoardPage> { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _callButton(
|
|
|
|
{GestureTapCallback onPress,
|
|
|
|
content,
|
|
|
|
hasLeftBorder = true,
|
|
|
|
isSelect = false}) {
|
|
|
|
return InkWell(
|
|
|
|
onTap: onPress,
|
|
|
|
child: Container(
|
|
|
|
height: h(48),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: isSelect ? MyColours.color_438E93 : MyColours.color_ffffff,
|
|
|
|
border: Border(
|
|
|
|
bottom: BorderSide(
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
top: BorderSide(
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
width: ScreenUtil().setWidth(2)),
|
|
|
|
left: hasLeftBorder
|
|
|
|
? BorderSide(
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
width: ScreenUtil().setWidth(2))
|
|
|
|
: BorderSide.none,
|
|
|
|
right: BorderSide(
|
|
|
|
color: MyColours.color_438E93,
|
|
|
|
width: ScreenUtil().setWidth(2)))),
|
|
|
|
child: Align(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
child: Text(
|
|
|
|
content,
|
|
|
|
style: TextStyle(
|
|
|
|
color:
|
|
|
|
isSelect ? MyColours.color_F6F6F6 : MyColours.color_438E93,
|
|
|
|
fontSize: ScreenUtil().setSp(36)),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
///查看指定时间内是否有宴会预定
|
|
|
|
_getExitsBanquetByDate() async {
|
|
|
|
UserModel userModel = Provider.of<UserModel>(context, listen: false);
|
|
...
|
...
|
@@ -114,6 +190,7 @@ class _FeastBoardPageState extends State<FeastBoardPage> { |
|
|
|
if (!Utils.isOneDay(day, dateTimeNow)) {
|
|
|
|
//不是一天
|
|
|
|
dateTimeNow = day;
|
|
|
|
_getBanquetByDate();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
// holidays: _holidays,
|
|
...
|
...
|
@@ -458,7 +535,6 @@ class _FeastBoardPageState extends State<FeastBoardPage> { |
|
|
|
// },
|
|
|
|
),
|
|
|
|
),
|
|
|
|
VEmptyView(4),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
calendarShow = !calendarShow;
|
|
...
|
...
|
@@ -472,57 +548,63 @@ class _FeastBoardPageState extends State<FeastBoardPage> { |
|
|
|
}
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(calendarShow
|
|
|
|
? 'y_chevron_up_circle'
|
|
|
|
: 'y_chevron_down_circle'),
|
|
|
|
width: ScreenUtil().setWidth(32))),
|
|
|
|
VEmptyView(32),
|
|
|
|
child: Container(
|
|
|
|
width: double.infinity,
|
|
|
|
color: Colors.white,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
VEmptyView(4),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath(calendarShow
|
|
|
|
? 'y_chevron_up_circle'
|
|
|
|
: 'y_chevron_down_circle'),
|
|
|
|
width: ScreenUtil().setWidth(32)),
|
|
|
|
VEmptyView(32),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
))
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
VEmptyView(48),
|
|
|
|
Expanded(
|
|
|
|
child: ListView.builder(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(8)),
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
return FeastBoardItem();
|
|
|
|
},
|
|
|
|
itemCount: 100,
|
|
|
|
)),
|
|
|
|
shrinkWrap: true,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(8)),
|
|
|
|
controller: controller,
|
|
|
|
itemBuilder: (context, index) {
|
|
|
|
FeastBoardModel boardModel =
|
|
|
|
feastModel.banquetByDateData[index];
|
|
|
|
return FeastBoardItem(
|
|
|
|
boardModel: boardModel,
|
|
|
|
controller: controller,
|
|
|
|
isOpen: !calendarShow,
|
|
|
|
);
|
|
|
|
},
|
|
|
|
itemCount: feastModel.banquetByDateData.length)),
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: [
|
|
|
|
RoundButton(
|
|
|
|
onPressed: () async {
|
|
|
|
_calendarController.setSelectedDay(DateTime.now());
|
|
|
|
setState(() {});
|
|
|
|
},
|
|
|
|
text: '回到今天',
|
|
|
|
fontSize: 28,
|
|
|
|
isBold: false,
|
|
|
|
height: ScreenUtil().setWidth(70),
|
|
|
|
width: ScreenUtil().setWidth(220),
|
|
|
|
gradientStart: MyColours.color_2bb5b7,
|
|
|
|
gradientEnd: MyColours.color_2bb5b7,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
),
|
|
|
|
RoundButton(
|
|
|
|
onPressed: () async {
|
|
|
|
Navigator.pop(context);
|
|
|
|
},
|
|
|
|
text: '取消',
|
|
|
|
fontSize: 28,
|
|
|
|
isBold: false,
|
|
|
|
textColor: MyColours.color_333333,
|
|
|
|
borderColor: Color.fromRGBO(119, 119, 119, 1),
|
|
|
|
height: ScreenUtil().setWidth(70),
|
|
|
|
width: ScreenUtil().setWidth(220),
|
|
|
|
gradientStart: Colors.transparent,
|
|
|
|
gradientEnd: Colors.transparent,
|
|
|
|
radius: ScreenUtil().setWidth(10),
|
|
|
|
)
|
|
|
|
Expanded(
|
|
|
|
child: _callButton(
|
|
|
|
onPress: () async {
|
|
|
|
_calendarController.setSelectedDay(DateTime.now());
|
|
|
|
dateTimeNow = DateTime.now();
|
|
|
|
setState(() {});
|
|
|
|
_getBanquetByDate();
|
|
|
|
},
|
|
|
|
content: '回到今天',
|
|
|
|
hasLeftBorder: true,
|
|
|
|
isSelect: false)),
|
|
|
|
Expanded(
|
|
|
|
child: _callButton(
|
|
|
|
onPress: () async {
|
|
|
|
NavigatorUtil.goFeastCreatePage(context);
|
|
|
|
},
|
|
|
|
content: '创建宴会',
|
|
|
|
hasLeftBorder: true,
|
|
|
|
isSelect: true))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
...
|
...
|
|