Commit 70e5b34af7027e59e3058d7d9a667ed19373a2cb

Authored by wdn127929
1 parent 258d67e1

签约费用

import 'package:common_utils/common_utils.dart';
import '../utils/utils.dart';
class GetBanquetByTimeModel {
int ret;
List<GetBanquetByTimeSunModel> data;
String msg;
GetBanquetByTimeModel({this.ret, this.data, this.msg});
GetBanquetByTimeModel.fromJson(Map<String, dynamic> json) {
ret = json['ret'];
if (json['data'] != null) {
data = <GetBanquetByTimeSunModel>[];
json['data'].forEach((v) {
data.add(new GetBanquetByTimeSunModel.fromJson(v));
});
}
msg = json['msg'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ret'] = this.ret;
if (this.data != null) {
data['data'] = this.data.map((v) => v.toJson()).toList();
}
data['msg'] = this.msg;
return data;
}
}
class GetBanquetByTimeSunModel {
String id;
String rname;
String sex;
String phone;
String staffId;
String ddate;
String classifyId;
String className;
String nickName;
String account;
List<SessionByTime> list;
String get ddateStr {
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000);
return '${dateTime.month}月${dateTime.day}日';
}
GetBanquetByTimeSunModel(
{this.id,
this.rname,
this.sex,
this.phone,
this.staffId,
this.ddate,
this.classifyId,
this.className,
this.nickName,
this.account,
this.list});
GetBanquetByTimeSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
rname = json['rname'];
sex = json['sex'];
phone = json['phone'];
staffId = json['staff_id'];
ddate = json['ddate'];
classifyId = json['classify_id'];
className = json['class_name'];
nickName = json['nick_name'];
account = json['account'];
if (json['list'] != null) {
list = <SessionByTime>[];
json['list'].forEach((v) {
list.add(new SessionByTime.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['rname'] = this.rname;
data['sex'] = this.sex;
data['phone'] = this.phone;
data['staff_id'] = this.staffId;
data['ddate'] = this.ddate;
data['classify_id'] = this.classifyId;
data['class_name'] = this.className;
data['nick_name'] = this.nickName;
data['account'] = this.account;
if (this.list != null) {
data['list'] = this.list.map((v) => v.toJson()).toList();
}
return data;
}
}
class SessionByTime {
String reserveOrder;
String ddateInterval;
String rdate;
String edate;
String tids;
List<String> tableName;
String get ddateStr {
if (rdate.length > 11) {
return '';
}
if (ddateInterval == '0') {
//不带餐
DateTime dateS =
DateTime.fromMillisecondsSinceEpoch(int.parse(rdate) * 1000);
DateTime dateE =
DateTime.fromMillisecondsSinceEpoch(int.parse(edate) * 1000);
String ymd = DateUtil.formatDate(dateS, format: DateFormats.y_mo_d);
String start = '${Utils.addZeroNumber(dateS.hour)}:${Utils.addZeroNumber(dateS.minute)}';
String end = '${Utils.addZeroNumber(dateE.hour)}:${Utils.addZeroNumber(dateE.minute)}';
return ymd + ' ' + start + '-' + end;
} else {
DateTime dateS =
DateTime.fromMillisecondsSinceEpoch(int.parse(rdate) * 1000);
// DateTime dateE =
// DateTime.fromMillisecondsSinceEpoch(int.parse(temp[1]) * 1000);
String ymd = DateUtil.formatDate(dateS, format: DateFormats.y_mo_d);
if (ddateInterval == '1') {
return ymd + ' ' + '早餐';
} else if (ddateInterval == '2') {
return ymd + ' ' + '午餐';
} else if (ddateInterval == '3') {
return ymd + ' ' + '晚餐';
}
}
return '';
}
SessionByTime(
{this.reserveOrder,
this.ddateInterval,
this.rdate,
this.edate,
this.tids,
this.tableName});
SessionByTime.fromJson(Map<String, dynamic> json) {
reserveOrder = json['reserve_order'];
ddateInterval = json['ddate_interval'];
rdate = json['rdate'];
edate = json['edate'];
tids = json['tids'];
tableName = json['table_name'].cast<String>();
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['reserve_order'] = this.reserveOrder;
data['ddate_interval'] = this.ddateInterval;
data['rdate'] = this.rdate;
data['edate'] = this.edate;
data['tids'] = this.tids;
data['table_name'] = this.tableName;
return data;
}
}
... ...
... ... @@ -311,6 +311,9 @@ class HttpUrl {
"?service=App.Banquet.SetInvoice"; //设置、修改、删除发票
static const String del_banquet_info =
"?service=App.Banquet.DelBanquetInfo"; //删除场次
static const String get_banquet_by_time =
"?service=App.Banquet.GetBanquetByTime"; //根据时间范围获取宴会订单
static const String set_banquet_info_price =
"?service=App.Banquet.SetBanquetInfoPrice"; //设置宴会场次费用
}
... ...
... ... @@ -84,6 +84,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
UserModel userModel;
Map<String, List<CookByIdSetmeal>> dataMenu = {};
Map<String, String> invoice; //发票
String morning;
String noon;
String night;
@override
void initState() {
... ... @@ -155,12 +158,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
dsoltList.add(dsoltModel('0', '不带餐'));
UserModel userModel = Provider.of<UserModel>(context, listen: false);
String morning =
morning =
userModel.user.morning.isEmpty ? "00:00-00:00" : userModel.user.morning;
String noon =
userModel.user.noon.isEmpty ? "00:00-00:00" : userModel.user.noon;
String night =
userModel.user.night.isEmpty ? "00:00-00:00" : userModel.user.night;
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") {
dsoltList.add(dsoltModel('1', '早餐'));
}
... ... @@ -893,7 +894,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
}
//获取一天开始-结束时间字符串
String _getRdate(DateTime date) {
String _getRdate(SetXuanTaiModel model, DateTime date) {
String keys = '';
String ymd = DateUtil.formatDate(date, format: DateFormats.y_mo_d);
... ... @@ -903,9 +904,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
double startDay;
//一天结束时间
double endDay;
if (xuantaiData[xuantaiSelIndex].qsDateShow != '暂未选择') {
timeStrStart = ymd + ' ' + xuantaiData[xuantaiSelIndex].startDate + ':00';
timeStrEnd = ymd + ' ' + xuantaiData[xuantaiSelIndex].endDate + ':00';
if (model.qsDateShow != '暂未选择') {
timeStrStart = ymd + ' ' + model.startDate + ':00';
timeStrEnd = ymd + ' ' + model.endDate + ':00';
} else {
timeStrStart = date.year.toString() +
"-" +
... ... @@ -925,6 +926,63 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
return startDay.floor().toString() + "-" + endDay.floor().toString();
}
//获取一天开始-结束时间字符串
String _getEdate(SetXuanTaiModel element, DateTime date) {
String keys = '';
String ymd = DateUtil.formatDate(date, format: DateFormats.y_mo_d);
String timeStrStart = '';
String timeStrEnd = '';
//一天开始时间
double startDay;
//一天结束时间
double endDay;
if (xuantaiData[xuantaiSelIndex].qsDateShow != '暂未选择') {
timeStrStart = ymd + ' ' + xuantaiData[xuantaiSelIndex].startDate + ':00';
timeStrEnd = ymd + ' ' + xuantaiData[xuantaiSelIndex].endDate + ':00';
startDay = (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000;
endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000;
return startDay.floor().toString() + "-" + endDay.floor().toString();
} else {
return null;
}
// if (element.cdShow == '不带餐') {
// timeStrStart = ymd + ' ' + xuantaiData[xuantaiSelIndex].startDate + ':00';
// timeStrEnd = ymd + ' ' + xuantaiData[xuantaiSelIndex].endDate + ':00';
// } else {
// List temp = [];
// if (element.cdShow == '早餐') {
// temp = morning.split('-');
// } else if (element.cdShow == '午餐') {
// temp = noon.split('-');
// } else if (element.cdShow == '晚餐') {
// temp = night.split('-');
// }
// if (temp.length == 2) {
// timeStrStart = ymd + ' ' + temp[0] + ':00';
// timeStrEnd = ymd + ' ' + temp[1] + ':00';
// } else {
// timeStrStart = date.year.toString() +
// "-" +
// Utils.addZeroNumber(date.month) +
// "-" +
// Utils.addZeroNumber(date.day) +
// " 00:00:00";
// timeStrEnd = date.year.toString() +
// "-" +
// Utils.addZeroNumber(date.month) +
// "-" +
// Utils.addZeroNumber(date.day) +
// " 23:59:59";
// }
// }
startDay = (DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000;
endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000;
return startDay.floor().toString() + "-" + endDay.floor().toString();
}
/// 选台保存接口
Future<bool> xtSave() async {
//判断非空选项,并弹窗提醒用户填写信息
... ... @@ -940,6 +998,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
Utils.showToast('请选择${reserveOrder}餐段');
return false;
}
if (element.cdShow == '不带餐' && element.qsDateShow == '暂未选择') {
Utils.showToast('请选择${reserveOrder}起始时间');
return false;
}
if (element.tids.length == 0) {
Utils.showToast('请选择${reserveOrder}桌位');
return false;
... ... @@ -965,7 +1027,8 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
}
map['reserve_order'] = element.reserveOrder;
map['ddate_interval'] = element.cdCode;
map['rdate'] = _getRdate(element.dateTimext);
map['rdate'] = _getRdate(element, element.dateTimext);
// map['edate'] = _getEdate(element, element.dateTimext);
List tids = [];
for (Tids item in element.tids) {
Map mapTids = {'tid': item.tid, 'num': item.numStr};
... ... @@ -1319,7 +1382,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
}),
_selectWidget(
'起始时间', xuantaiData[xuantaiSelIndex].qsDateShow,
need: false, onTap: () {
need: xuantaiData[xuantaiSelIndex].cdShow == '不带餐'
? true
: false, onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
SetTimeWidget.init.showFeastTimeSelector(
... ... @@ -1479,6 +1544,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
int.parse(item
.tableNumC.text);
}
xuantaiData[xuantaiSelIndex]
.tids[index]
.numStr = value;
setState(() {});
},
onEditingComplete: () {
... ... @@ -1517,13 +1586,19 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
.color_E6000000,
rTitle: "删除",
rCallback: () {
xuantaiData[xuantaiSelIndex]
.tableSum -=
int.parse(xuantaiData[
if (xuantaiData[
xuantaiSelIndex]
.tids[index]
.tableNumC
.text);
.tableSum >
0) {
xuantaiData[xuantaiSelIndex]
.tableSum -=
int.parse(xuantaiData[
xuantaiSelIndex]
.tids[index]
.tableNumC
.text);
}
xuantaiData[xuantaiSelIndex]
.tids
.removeAt(index);
... ... @@ -2628,7 +2703,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
children: [
Container(
width: w(80),
child: Text('套餐安排',
child: Text('套餐安排:',
style: TextStyle(
color: MyColours.color_999999,
fontSize: font(12))),
... ... @@ -3998,6 +4073,45 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
]);
}
///设置宴会场次费用
Future<bool> _setBanquetInfoPrice() async {
///组装请求数据
List dataRequest = []; //请求数据
feastModel.banquetDetail.costInfo.forEach((element) {
Map map = {};
map['rid'] = feastModel.rid;
feastModel.sessionsSunModelList.forEach((value) {
if (element.title.contains(value.reserveOrder)) {
map['info_id'] = value.id; //场次id
}
});
map['service_type'] = element.service ? '1' : '2';
if (element.service) {
map['service_price'] = element.serviceC.text;
} else {
map['service_per'] = element.serviceC.text;
}
map['discount_type'] = element.discount ? '1' : '2';
if (element.discount) {
map['discount_price'] = element.discountC.text;
} else {
map['discount_per'] = element.discountC.text;
}
map['total_price'] = element.totalPrice;
dataRequest.add(map);
});
Map<String, String> pramas = {'data': json.encode(dataRequest)};
bool success = await feastModel.setBanquetInfoPrice(context, pramas);
if (success) {
return true;
} else {
return false;
}
}
///设置合同信息
Future<bool> _setBanquetContract() async {
List imageQiniuUrlList = []; //接口图片数据list
... ... @@ -4064,22 +4178,24 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
}
_setData() async {
await Future.wait<bool>([_setBanquetContract(), _setInvoice()])
.then((results) {
print(results[0]);
if (results[0] && results[1]) {
//成功
Utils.showToast('保存成功');
} else {
if (!results[0]) {
// Utils.showToast('');
} else {
// Utils.showToast('');
}
}
}).catchError((e) {
print(e);
});
_setBanquetInfoPrice();
// await Future.wait<bool>(
// [_setBanquetContract(), _setInvoice(), _setBanquetInfoPrice()])
// .then((results) {
// print(results[0]);
// if (results[0] && results[1] && results[2]) {
// //成功
// Utils.showToast('保存成功');
// } else {
// if (!results[0]) {
// // Utils.showToast('');
// } else {
// // Utils.showToast('');
// }
// }
// }).catchError((e) {
// print(e);
// });
}
Widget taocanTextType(String per1, String title, String per) {
... ...
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:provider/provider.dart';
import '../../constant/state.dart';
import '../../models/get_banquet_by_id_new_model.dart';
import '../../provider/feast_model.dart';
import '../../res/colors.dart';
import '../../route/navigator_util.dart';
import '../../utils/ConvertNumberToChineseMoneyWords.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/h_empty_view.dart';
import '../../widgets/page_exception.dart';
import '../../widgets/round_button.dart';
import '../../widgets/system_app_bar.dart';
import '../../widgets/v_empty_view.dart';
class FeastDetailPage extends StatefulWidget {
final String rid;
FeastDetailPage({Key key, this.rid}) : super(key: key);
@override
_FeastDetailPageState createState() => _FeastDetailPageState();
}
class _FeastDetailPageState extends State<FeastDetailPage> {
FeastModel feastModel;
ScrollController _scrollController = ScrollController();
@override
void initState() {
// TODO: implement initState
super.initState();
Utils.changeStatusColor(color: MyColours.color_438E93);
WidgetsBinding.instance.addPostFrameCallback((_) {
_getBanquetById();
});
}
///获取宴会详情
_getBanquetById() async {
Map<String, String> pramas = {'rid': widget.rid}; //
bool success = await feastModel.getBanquetById(context, pramas);
if (success) {
// _uploadImageProvider.feastRemarkContractImageList = [];
// feastModel.banquetDetail.contractInfo.contractImages.forEach((element) {
// UploadImgModel uploadImgModel = UploadImgModel();
// uploadImgModel.process = 1;
// uploadImgModel.qiniuUrl = element.url;
// _uploadImageProvider.feastRemarkContractImageList.add(uploadImgModel);
// });
// setState(() {});
}
}
Widget baseInfoItem(String title, String content) {
return Padding(
padding: EdgeInsets.symmetric(vertical: h(6)),
child: Row(
children: [
Container(
width: w(80),
child: Text(title,
style: TextStyle(
color: MyColours.color_999999, fontSize: font(12))),
),
Expanded(
child: Text(content,
style: TextStyle(
color: MyColours.color_515151, fontSize: font(12))))
],
));
}
//生成日期文本
createDateText(BuildContext context, DateTime day) {
// if (Utils.isOneDay(day, dateTime)) return; //日期没变
String ymd = "${day.year}-" +
Utils.addZeroNumber(day.month) +
"-" +
Utils.addZeroNumber(day.day);
ymd += " (周${Utils.formatWeekDayNum(day.weekday)} ";
ymd += Utils.lunarCalendarHolidays(day);
ymd += ')';
return ymd;
}
//基本信息板块
Widget baseInfoWidget() {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(6)),
border: Border.all(width: w(1), color: MyColours.color_438E93)),
child: Column(
children: [
Container(
width: double.infinity,
// height: h(31),
padding: EdgeInsets.symmetric(horizontal: w(12), vertical: h(6)),
decoration: BoxDecoration(
color: MyColours.color_438E93,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(r(5)),
topRight: Radius.circular(r(5)))),
child: Text(
'基本信息',
style:
TextStyle(color: MyColours.color_F6F6F6, fontSize: font(14)),
),
),
Padding(
padding: EdgeInsets.only(
left: w(12), right: w(12), top: w(8), bottom: w(11)),
child: Column(
children: [
baseInfoItem(
'宴会日期:',
createDateText(
context,
DateTime.fromMillisecondsSinceEpoch(int.parse(
feastModel.banquetDetail.basicInfo.ddate) *
1000))),
baseInfoItem(
'宴会类型:', feastModel.banquetDetail.basicInfo.classify),
baseInfoItem('预订人:',
'${feastModel.banquetDetail.basicInfo.rname} ${feastModel.banquetDetail.basicInfo.sex}'),
baseInfoItem('场次数量:',
'共 ${feastModel.banquetDetail.sessionsInfo.length} 场'),
baseInfoItem('电话:', feastModel.banquetDetail.basicInfo.phone),
baseInfoItem(
'服务经理:',
feastModel.banquetDetail.basicInfo.jiedan.nickName ??
feastModel.banquetDetail.basicInfo.jiedan.account),
baseInfoItem(
'备注:', feastModel.banquetDetail.basicInfo.remark ?? '无'),
],
))
],
),
);
}
///三组 左---中----右
Widget sessionsItem(String title, SessionsInfo sessionsInfo) {
return Padding(
padding: EdgeInsets.symmetric(vertical: h(6)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: w(80),
child: Text(title,
style: TextStyle(
color: MyColours.color_999999, fontSize: font(12))),
),
Expanded(
child: ListView.builder(
itemCount: title == '酒水安排:'
? sessionsInfo.wine.length
: sessionsInfo.other.length,
shrinkWrap: true,
controller: _scrollController,
itemBuilder: (BuildContext context, int index) {
String name = title == '酒水安排:'
? sessionsInfo.wine[index].wineName
: sessionsInfo.other[index].otherName;
String numStr = title == '酒水安排:'
? sessionsInfo.wine[index].wineNum
: sessionsInfo.other[index].otherNum;
String spec = title == '酒水安排:'
? sessionsInfo.wine[index].spec
: sessionsInfo.other[index].spec;
return Container(
padding: EdgeInsets.only(bottom: w(8)),
margin: EdgeInsets.only(bottom: w(12)),
// decoration: BoxDecoration(
// border: Border(
// bottom: BorderSide(
// width: w(1),
// color: MyColours.color_DBDBDB))),
child: Row(
children: [
Expanded(
child: Text(name,
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(12)))),
Text('${numStr} ${spec}',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(12)))
],
));
})),
],
));
}
///第一场 。第二场。。。。
Widget sessionsWidget(String title, SessionsInfo sessionsInfo) {
// int tableNum = 0;
// List<String> temp = sessionsInfo.tableInfo.split('、');
// temp.forEach((element) {
// int start = element.indexOf('(');
// int end = element.length - 2;
// String numstr = element.substring(start + 1, end);
// tableNum += int.parse(numstr);
// });
return Container(
margin: EdgeInsets.only(bottom: h(26)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(6)),
border: Border.all(width: w(1), color: MyColours.color_438E93)),
child: Column(
children: [
Container(
width: double.infinity,
// height: h(31),
padding: EdgeInsets.symmetric(horizontal: w(12), vertical: h(6)),
decoration: BoxDecoration(
color: MyColours.color_438E93,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(r(5)),
topRight: Radius.circular(r(5)))),
child: Text(
title,
style:
TextStyle(color: MyColours.color_F6F6F6, fontSize: font(14)),
),
),
Padding(
padding: EdgeInsets.only(
left: w(12), right: w(12), top: w(8), bottom: w(11)),
child: Column(
children: [
baseInfoItem('场次时间:', sessionsInfo.rdate),
baseInfoItem('桌位数量:', '共 ${sessionsInfo.tableNum ?? 0} 桌'),
baseInfoItem('桌位信息:', sessionsInfo.tableInfo),
Padding(
padding: EdgeInsets.symmetric(vertical: h(6)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: w(80),
child: Text('套餐安排:',
style: TextStyle(
color: MyColours.color_999999,
fontSize: font(12))),
),
Expanded(
child: ListView.builder(
itemCount: sessionsInfo.setmeal.length,
shrinkWrap: true,
controller: _scrollController,
itemBuilder:
(BuildContext context, int index) {
SetmealDetail setmealDetail =
sessionsInfo.setmeal[index];
return Container(
padding: EdgeInsets.only(bottom: w(8)),
margin: EdgeInsets.only(bottom: w(12)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1),
color: MyColours
.color_DBDBDB))),
child: Column(
children: [
Row(
children: [
Text(setmealDetail.mealName,
style: TextStyle(
color: MyColours
.color_515151,
fontSize: font(12))),
Spacer(),
RoundButton(
text: '查看菜单',
radius: r(7),
width: w(48),
height: h(18),
fontSize: 20,
textColor:
MyColours.color_F6F6F6,
isBold: false,
gradientStart:
MyColours.color_438E93,
gradientEnd:
MyColours.color_438E93,
onPressed: () {
// String tableData = '';
// if (data.pnumC.text
// .trim()
// .length >
// 0) {
// tableData +=
// '${data.pnumC.text}人/桌';
// }
// if (data.minC.text
// .trim()
// .length >
// 0) {
// tableData +=
// ' 保证 ${data.minC.text} 桌';
// }
// if (data.spareC.text
// .trim()
// .length >
// 0) {
// tableData +=
// ' 备用 ${data.spareC.text} 桌';
// }
// if (data.dataMenu != null &&
// data.dataMenu.length >
// 0) {
// await NavigatorUtil
// .goFeastMenuShowPage(
// context,
// data.setmealId,
// data.name,
// widget.dateData,
// tableData,
// justSelData: {
// 'object':
// data.dataMenu
// });
// } else {
// await NavigatorUtil
// .goFeastMenuShowPage(
// context,
// data.setmealId,
// data.name,
// widget.dateData,
// tableData);
// }
NavigatorUtil
.goFeastMenuQYShowPage(
context,
object: {
'object':
setmealDetail
.cooklist
});
},
),
],
),
VEmptyView(16),
Row(
children: [
Text(
'${setmealDetail.pnum} 人/桌',
style: TextStyle(
color: MyColours
.color_999999,
fontSize: font(12))),
HEmptyView(24),
Text(
'保证 ${setmealDetail.min} 桌',
style: TextStyle(
color: MyColours
.color_999999,
fontSize: font(12))),
HEmptyView(24),
Text(
'备用 ${setmealDetail.spare} 桌',
style: TextStyle(
color: MyColours
.color_999999,
fontSize: font(12))),
],
)
],
));
}))
],
)),
sessionsItem('酒水安排:', sessionsInfo),
sessionsItem('其他配置:', sessionsInfo),
remarkItem('备注:', sessionsInfo)
],
))
],
),
);
}
///备注----照片
Widget remarkItem(String title, SessionsInfo sessionsInfo) {
return Padding(
padding: EdgeInsets.symmetric(vertical: h(6)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
width: w(80),
child: Text(title,
style: TextStyle(
color: MyColours.color_999999, fontSize: font(12))),
),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
sessionsInfo.remark == null || sessionsInfo.remark == ''
? SizedBox()
: Text(sessionsInfo.remark,
style: TextStyle(
color: MyColours.color_515151, fontSize: font(12))),
sessionsInfo.remark == null || sessionsInfo.remark == ''
? SizedBox()
: VEmptyView(16),
_getGridImg(sessionsInfo.images.map((e) {
return e.url;
}).toList())
],
)),
],
));
}
/// 九宫格
Widget _getGridImg(List<String> data) {
return GridView.builder(
controller: _scrollController,
// padding: EdgeInsets.only(top: ScreenUtil().getAdapterSize(10)),
shrinkWrap: true,
itemCount: data.length,
//SliverGridDelegateWithFixedCrossAxisCount 构建一个横轴固定数量Widget
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
//横轴元素个数
crossAxisCount: 4,
//纵轴间距
mainAxisSpacing: ScreenUtil().setWidth(52),
//横轴间距
crossAxisSpacing: ScreenUtil().setWidth(60),
//子组件宽高长度比例
childAspectRatio: 1.0),
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: () {
// _showPhotoView(
// context, index, widget.model.imageQiniuUrlList);
},
child: Stack(
// alignment: Alignment.topRight,
children: [
ClipRRect(
borderRadius: BorderRadius.circular(r(5)),
child: CachedNetworkImage(
imageUrl: data[index],
// imageUrl:
// 'https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.jj20.com%2Fup%2Fallimg%2F4k%2Fs%2F02%2F2109242332225H9-0-lp.jpg&refer=http%3A%2F%2Fimg.jj20.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1662806063&t=d576b5247e04ce721c266f098625f145',
fit: BoxFit.cover,
width: ScreenUtil().setWidth(38 * 2),
height: ScreenUtil().setWidth(38 * 2),
),
),
// Positioned(
// top: 0,
// right: 0,
// child: GestureDetector(
// child: Image.asset(
// Utils.getImgPath("f_delete"),
// width: ScreenUtil().setWidth(24),
// height: ScreenUtil().setWidth(24),
// ),
// onTap: () {
// //已经传到服务器,弹提醒窗口,是否删除
// //修改之前有内容,则弹框
// DialogUtil.cupertinoAlertDialog(context,
// title: "确认删除",
// content: "是否确定删除该照片,删除操作不可逆转,请谨慎操作",
// lCallback: () {
// print("取消");
// }, rCallback: () {
// print("确定");
// // widget.deleteCallback(index);
// });
// }
// // else {
// // //点击删除按钮
// // setState(() {
// // temp.removeWhere((element) =>
// // element == temp[index]);
// // widget.model.imageQiniuUrlList
// // .removeWhere((element) =>
// // element ==
// // widget.model
// // .imageQiniuUrlList[index]);
// // });
// // }
// // },
// )),
],
),
);
});
}
///费用详情
Widget costWidget() {
return Container(
margin: EdgeInsets.only(bottom: h(26)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(6)),
border: Border.all(width: w(1), color: MyColours.color_438E93)),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Container(
width: double.infinity,
// height: h(31),
padding: EdgeInsets.symmetric(horizontal: w(12), vertical: h(6)),
decoration: BoxDecoration(
color: MyColours.color_438E93,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(r(5)),
topRight: Radius.circular(r(5)))),
child: Text(
'费用详情',
style:
TextStyle(color: MyColours.color_F6F6F6, fontSize: font(14)),
),
),
VEmptyView(34),
ListView.builder(
itemCount: feastModel.banquetDetail.costInfo.length,
shrinkWrap: true,
controller: _scrollController,
itemBuilder: (BuildContext context, int index) {
CostInfoModel costInfoModel =
feastModel.banquetDetail.costInfo[index];
return Padding(
padding: EdgeInsets.only(
left: w(12), right: w(12), bottom: w(27)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'${costInfoModel.title}:',
style: TextStyle(
color: MyColours.color_999999,
fontSize: font(12)),
),
VEmptyView(8),
costItem('名称', '单价', '数量', '金额', isTitle: true),
ListView.builder(
itemCount: costInfoModel.data.length,
shrinkWrap: true,
controller: _scrollController,
itemBuilder: (BuildContext context, int index) {
CostInfoSunModel costInfoSunModel =
costInfoModel.data[index];
String name = '';
if (costInfoSunModel.cname != null) {
name = costInfoSunModel.cname;
}
if (costInfoSunModel.otherName != null) {
name = costInfoSunModel.otherName;
}
if (costInfoSunModel.wineName != null) {
name = costInfoSunModel.wineName;
}
return costItem(
name,
costInfoSunModel.unitPrice,
costInfoSunModel.numStr,
costInfoSunModel.price.toString(),
);
}),
//服务费
Container(
height: h(32),
margin: EdgeInsets.only(bottom: h(8)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1),
color: MyColours.color_DBDBDB))),
child: Row(
children: [
Container(
width: w(80),
child: Text(
'服务费:',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(12)),
),
),
InkWell(
onTap: () {
if (costInfoModel.service) {
return;
}
setState(() {
costInfoModel.service =
!costInfoModel.service;
});
if (costInfoModel.serviceC.text != '') {
// _calculatePrice(
// costInfoModel,
// );
}
},
child: Row(
children: [
Image.asset(
Utils.getImgPath(costInfoModel.service
? 'f_radio_sel'
: 'f_radio_un'),
width: w(20),
),
HEmptyView(8),
Text(
'固定金额',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(12)),
),
],
),
),
HEmptyView(16),
InkWell(
onTap: () {
if (!costInfoModel.service) {
return;
}
setState(() {
costInfoModel.service =
!costInfoModel.service;
});
if (costInfoModel.serviceC.text != '') {
// _calculatePrice(
// costInfoModel,
// );
}
},
child: Row(
children: [
Image.asset(
Utils.getImgPath(!costInfoModel.service
? 'f_radio_sel'
: 'f_radio_un'),
width: w(20),
),
HEmptyView(8),
Container(
width: w(40),
child: Text(
'百分比',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(12)),
)),
],
),
),
HEmptyView(12),
Expanded(
child: Container(
height: h(17),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1),
color:
MyColours.color_DBDBDB))),
child: TextField(
maxLines: 1,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_515151),
controller: costInfoModel.serviceC,
// focusNode: node,
// textAlignVertical: TextAlignVertical.top,
decoration: InputDecoration(
hintText: '请输入',
hintStyle: TextStyle(
color: true
? MyColours.color_999999
: MyColours.color_515151,
fontSize: ScreenUtil().setSp(24),
),
// contentPadding:
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
// border: InputBorder.none,
contentPadding: EdgeInsets.zero,
border: OutlineInputBorder(
borderSide: BorderSide.none),
),
onChanged: (value) {
print('ggg');
// _calculatePrice(
// costInfoModel,
// );
// nameStr = value;
},
onEditingComplete: () {
// print('fff');
// node.unfocus();
// _homeEnterModel.nameController.text =
// nameStr + _nameSuffix();
// _addNameSuffix(nameStr, sexStr);
},
keyboardType: TextInputType
.numberWithOptions())),
),
HEmptyView(4),
Text(
costInfoModel.service ? '元' : '%',
style: TextStyle(
color: MyColours.color_000000,
fontSize: font(12)),
),
],
)),
//优惠金额
Container(
height: h(32),
margin: EdgeInsets.only(bottom: h(8)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1),
color: MyColours.color_DBDBDB))),
child: Row(
children: [
Container(
width: w(80),
child: Text(
'优惠金额:',
style: TextStyle(
color: MyColours.color_E34D59,
fontSize: font(12)),
),
),
InkWell(
onTap: () {
if (costInfoModel.discount) {
return;
}
setState(() {
costInfoModel.discount =
!costInfoModel.discount;
});
if (costInfoModel.discountC.text != '') {
// _calculatePrice(
// costInfoModel,
// );
}
},
child: Row(children: [
Image.asset(
Utils.getImgPath(costInfoModel.discount
? 'f_radio_sel'
: 'f_radio_un'),
width: w(20),
),
HEmptyView(8),
Text(
'固定金额',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(12)),
),
])),
HEmptyView(16),
InkWell(
onTap: () {
if (!costInfoModel.discount) {
return;
}
setState(() {
costInfoModel.discount =
!costInfoModel.discount;
});
if (costInfoModel.discountC.text != '') {
// _calculatePrice(
// costInfoModel,
// );
}
},
child: Row(children: [
Image.asset(
Utils.getImgPath(!costInfoModel.discount
? 'f_radio_sel'
: 'f_radio_un'),
width: w(20),
),
HEmptyView(8),
Container(
width: w(40),
child: Text(
'折扣',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(12)),
))
])),
HEmptyView(12),
Expanded(
child: Container(
height: h(17),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1),
color:
MyColours.color_DBDBDB))),
child: TextField(
maxLines: 1,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_515151),
controller: costInfoModel.discountC,
// focusNode: node,
// textAlignVertical: TextAlignVertical.top,
decoration: InputDecoration(
hintText: '请输入',
hintStyle: TextStyle(
color: true
? MyColours.color_999999
: MyColours.color_E34D59,
fontSize: ScreenUtil().setSp(24),
),
// contentPadding:
// EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
// border: InputBorder.none,
contentPadding: EdgeInsets.zero,
border: OutlineInputBorder(
borderSide: BorderSide.none),
),
onChanged: (value) {
print('ggg');
// _calculatePrice(
// costInfoModel,
// );
// nameStr = value;
},
onEditingComplete: () {
// print('fff');
// node.unfocus();
// _homeEnterModel.nameController.text =
// nameStr + _nameSuffix();
// _addNameSuffix(nameStr, sexStr);
},
keyboardType: TextInputType
.numberWithOptions())),
),
HEmptyView(4),
Text(
costInfoModel.discount ? '元' : '%',
style: TextStyle(
color: MyColours.color_000000,
fontSize: font(12)),
),
],
)),
//合计
Container(
height: h(24),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1),
color: MyColours.color_DBDBDB))),
child: Row(children: [
Text(
'合计',
style: TextStyle(
color: MyColours.color_515151,
fontWeight: FontWeight.bold,
fontSize: font(14)),
),
Spacer(),
Text(
'${costInfoModel.totalPrice} 元',
style: TextStyle(
color: MyColours.color_515151,
fontWeight: FontWeight.bold,
fontSize: font(14)),
),
HEmptyView(48)
]))
],
));
}),
]));
}
Widget _callButton(
{GestureTapCallback onPress,
content,
hasLeftBorder = true,
Color textColor = MyColours.color_438E93,
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 : textColor,
fontSize: ScreenUtil().setSp(36)),
),
),
),
);
}
///费用item
Widget costItem(
String name,
String unitprice,
String amount,
String money, {
bool isTitle = false,
}) {
Color color = isTitle ? MyColours.color_438E93 : MyColours.color_515151;
return Container(
height: h(25),
margin: EdgeInsets.only(bottom: isTitle ? 0 : h(8)),
decoration: !isTitle
? BoxDecoration(
border: Border(
bottom:
BorderSide(width: w(1), color: MyColours.color_DBDBDB)))
: BoxDecoration(),
child: Row(
children: [
Expanded(
child: Text(
name,
style: TextStyle(color: color, fontSize: font(12)),
),
),
Container(
width: w(62),
child: Text(
unitprice,
style: TextStyle(color: color, fontSize: font(12)),
),
),
Container(
width: w(62),
child: Text(
amount,
style: TextStyle(color: color, fontSize: font(12)),
),
),
Container(
width: w(62),
child: Text(
money,
style: TextStyle(color: color, fontSize: font(12)),
),
)
],
));
}
/// 发票
Widget invoiceWidget() {
return Container(
margin: EdgeInsets.only(bottom: h(26)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(6)),
border: Border.all(width: w(1), color: MyColours.color_438E93)),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Container(
width: double.infinity,
// height: h(31),
padding: EdgeInsets.symmetric(horizontal: w(12), vertical: h(6)),
decoration: BoxDecoration(
color: MyColours.color_438E93,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(r(5)),
topRight: Radius.circular(r(5)))),
child: Text(
'发票',
style:
TextStyle(color: MyColours.color_F6F6F6, fontSize: font(14)),
),
),
VEmptyView(16),
Padding(
padding: EdgeInsets.only(
left: w(12), right: w(12), top: w(11), bottom: w(35)),
child: Column(
children: [
feastModel.banquetDetail.invoice == null ||
feastModel.banquetDetail.invoice.unitName == null
? SizedBox()
: Container(
// margin: EdgeInsets.only(top: w(31)),
padding: EdgeInsets.only(
top: w(8),
bottom: w(8),
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1),
color: MyColours.color_DBDBDB))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
feastModel.banquetDetail.invoice.unitName,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
VEmptyView(16),
Text(
feastModel.banquetDetail.invoice
.invoiceType ==
'1'
? '增值税普通发票'
: '增值税专用发票',
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
),
],
),
// InkWell(
// onTap: () {
// //弹框确认是否删除
// DialogUtil.cupertinoAlertDialog(context,
// title: "",
// content: "是否确定删除?",
// isBoldContent: true,
// contentColor: MyColours.color_E6000000,
// rTitle: "删除", rCallback: () {
// feastModel.banquetDetail.invoice = null;
// setState(() {});
// });
// },
// child: Image.asset(
// Utils.getImgPath('f_delete_red'),
// width: w(20))),
],
),
),
// VEmptyView(48),
// Consumer<UploadImageProvider>(builder: (context, model, _) {
// return ImgPickerFWidget(
// model: model,
// scrollController: _scrollController,
// uploadType: UploadType.FeastRemarkInvoiceType,
// bgColor: MyColours.color_DBDBDB,
// size: 64,
// crossAxisCount: 4,
// maxImageNumber: 8,
// mainAxisSpacing: 72,
// crossAxisSpacing: 56,
// );
// }),
],
),
)
]));
}
///签约
Widget qyWidget() {
return Column(children: <Widget>[
Expanded(child: Consumer<FeastModel>(builder: (context, model, _) {
if (model.pageStateBanquet != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateDeposit,
callback: () {
_getBanquetById();
},
emptyMsg: "暂时没有宴会详情哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Column(
children: [
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: w(12)),
child: SingleChildScrollView(
controller: _scrollController,
child: Column(children: [
VEmptyView(32),
baseInfoWidget(), //基本信息
VEmptyView(52),
//场次
ListView.builder(
itemCount:
feastModel.banquetDetail.sessionsInfo.length,
shrinkWrap: true,
controller: _scrollController,
itemBuilder: (BuildContext context, int index) {
SessionsInfo sessionsInfo = feastModel
.banquetDetail.sessionsInfo[index];
String numStr =
ConvertNumberToChineseMoneyWords.toChinese(
index);
return sessionsWidget(
'第${numStr}场', sessionsInfo);
}),
//费用详情
costWidget(),
//合同
// contractWidget(),
invoiceWidget()
]))),
),
Row(
children: [
Expanded(
child: _callButton(
onPress: () {},
content: '丢单',
hasLeftBorder: true,
textColor: MyColours.color_E34D59,
isSelect: false)),
Expanded(
child: _callButton(
onPress: () async {
// selectMenu = '签约';
// menuSet.add('定金');
// menuSet.add('签约');
// setState(() {});
// for (UploadImgModel item in _uploadImageProvider
// .feastRemarkContractImageList) {
// if (item.process < 1) {
// Utils.showToast('正在上传图片,请稍等');
// return false;
// }
// }
// for (UploadImgModel item in _uploadImageProvider
// .feastRemarkInvoiceImageList) {
// if (item.process < 1) {
// Utils.showToast('正在上传图片,请稍等');
// return false;
// }
// }
// _setData();
},
content: '编辑宴会',
hasLeftBorder: true,
isSelect: true))
],
)
],
);
}
}))
]);
}
@override
Widget build(BuildContext context) {
feastModel = Provider.of<FeastModel>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'宴会详情',
needWhite: true,
bgColor: MyColours.color_438E93,
titleColor: MyColours.color_F6F6F6,
onTap: () {
Navigator.pop(context);
},
),
body: qyWidget());
}
}
... ...
... ... @@ -2,10 +2,17 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import '../../models/GetBanquetByTimeModel.dart';
import '../../utils/screen_util.dart';
class FeastItem extends StatefulWidget {
FeastItem({Key key}) : super(key: key);
final ScrollController controller;
final GetBanquetByTimeSunModel sunModel;
FeastItem(this.controller, this.sunModel, {Key key}) : super(key: key);
@override
_FeastItemState createState() => _FeastItemState();
... ... @@ -15,40 +22,16 @@ class _FeastItemState extends State<FeastItem> {
List<Widget> taocanWidget(List data) {
List<Widget> list = [];
data.forEach((element) {
list.add(
RichText(
textScaleFactor: 1,
overflow: TextOverflow.ellipsis,
// textDirection: TextDirection.ltr,
// textAlign: TextAlign.left,
text: TextSpan(
children: [
TextSpan(
text: "1299套餐:",
style: TextStyle(
color: MyColours.color_000000,
fontSize: ScreenUtil().setSp(28)),
recognizer: TapGestureRecognizer()..onTap = () {}),
TextSpan(
text: "已调菜",
style: TextStyle(
color: MyColours.color_438E93,
fontSize: ScreenUtil().setSp(28)),
//点击事件
recognizer: TapGestureRecognizer()
..onTap = () {
print("点击了安全协议");
}),
TextSpan(
text: "保证30桌、备2桌",
style: TextStyle(
color: MyColours.color_000000,
fontSize: ScreenUtil().setSp(28)),
recognizer: TapGestureRecognizer()..onTap = () {}),
],
)),
);
list.add(Container(
padding: EdgeInsets.symmetric(horizontal: w(4), vertical: h(4)),
decoration: BoxDecoration(
color: MyColours.color_438E93,
borderRadius: BorderRadius.circular(w(5))),
child: Text(
element,
style: TextStyle(fontSize: font(14), color: MyColours.color_F6F6F6),
),
));
});
return list;
}
... ... @@ -84,14 +67,14 @@ class _FeastItemState extends State<FeastItem> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'8月1日 午餐 14:00-16:00',
widget.sunModel.ddateStr,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_F6F6F6,
fontSize: ScreenUtil().setSp(40)),
),
Text(
'婚宴',
widget.sunModel.className,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_F6F6F6,
... ... @@ -112,37 +95,63 @@ class _FeastItemState extends State<FeastItem> {
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
'桌位:凤凰厅、包间1、包间2',
style: TextStyle(
color: MyColours.color_000000,
fontSize: ScreenUtil().setSp(28)),
),
VEmptyView(8),
Column(
children: taocanWidget(['ff', 'ff', 'ff', 'ff']),
),
VEmptyView(36),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'方先生 订32桌 备2桌',
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_000000,
fontSize: ScreenUtil().setSp(28)),
),
Text(
'负责人:刘经理',
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_000000,
fontSize: ScreenUtil().setSp(28)),
),
],
)
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${widget.sunModel.rname} ${Utils.starPhone(widget.sunModel.phone)}',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28)),
),
Text(
'跟单经理:${widget.sunModel.nickName}',
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28)),
)
]),
VEmptyView(16),
ListView.builder(
shrinkWrap: true,
controller: widget.controller,
padding: EdgeInsets.zero,
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(24)),
itemBuilder: (context, index) {
SessionByTime sessionByTime = widget.sunModel.list[index];
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
sessionByTime.reserveOrder,
style: TextStyle(
color: MyColours.color_000000,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(30)),
),
Text(
' ${sessionByTime.ddateStr}',
style: TextStyle(
color: MyColours.color_000000,
fontSize: ScreenUtil().setSp(30)),
)
],
),
VEmptyView(20),
Wrap(
spacing: ScreenUtil().setWidth(14),
runSpacing: ScreenUtil().setWidth(20),
children: taocanWidget(sessionByTime.tableName),
),
VEmptyView(26)
]);
},
itemCount: widget.sunModel.list.length),
],
),
)
... ...
... ... @@ -2,6 +2,7 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/GetBanquetByTimeModel.dart';
import 'package:one_key/pages/feast/feast_item.dart';
import 'package:one_key/provider/feast_model.dart';
import 'package:one_key/route/navigator_util.dart';
... ... @@ -11,6 +12,7 @@ import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../constant/state.dart';
import '../../provider/user_model.dart';
import '../../res/colors.dart';
import '../../widgets/page_exception.dart';
... ... @@ -23,6 +25,45 @@ class FeastPage extends StatefulWidget {
}
class _FeastPageState extends State<FeastPage> {
ScrollController controller = ScrollController();
FeastModel feastModel;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
_getBanquetByTime();
// scrollController.jumpTo(scrollController.position.minScrollExtent);
});
}
///获取宴会详情
_getBanquetByTime() async {
DateTime now = DateTime.now();
DateTime new7 = now.add(Duration(days: 7));
String timeStrStart = now.year.toString() +
"-" +
Utils.addZeroNumber(now.month) +
"-" +
Utils.addZeroNumber(now.day) +
" 00:00:00";
String timeStrEnd = new7.year.toString() +
"-" +
Utils.addZeroNumber(new7.month) +
"-" +
Utils.addZeroNumber(new7.day) +
" 23:59:59";
double startDay =
(DateTime.parse(timeStrStart).millisecondsSinceEpoch) / 1000;
double endDay = (DateTime.parse(timeStrEnd).millisecondsSinceEpoch) / 1000;
Map<String, String> pramas = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'rdate': startDay.floor().toString(),
'edate': endDay.floor().toString()
}; //
bool success = await feastModel.getBanquetByTime(context, pramas);
}
Widget upAndDown(String image, String title, {GestureTapCallback onTap}) {
return InkWell(
onTap: onTap,
... ... @@ -43,6 +84,7 @@ class _FeastPageState extends State<FeastPage> {
@override
Widget build(BuildContext context) {
feastModel = Provider.of<FeastModel>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
// appBar: SystemAppBar(''),
... ... @@ -84,7 +126,7 @@ class _FeastPageState extends State<FeastPage> {
),
)
]),
upAndDown('y_money', '定金管理',onTap: (){
upAndDown('y_money', '定金管理', onTap: () {
NavigatorUtil.goFeastDepositDataPage(context);
})
],
... ... @@ -93,7 +135,7 @@ class _FeastPageState extends State<FeastPage> {
Padding(
padding: EdgeInsets.only(left: ScreenUtil().setWidth(48)),
child: Text(
'30天内宴会',
'7天内宴会',
style: TextStyle(
color: MyColours.color_000000,
fontSize: ScreenUtil().setSp(28)),
... ... @@ -114,12 +156,19 @@ class _FeastPageState extends State<FeastPage> {
);
} else {
return ListView.builder(
controller: controller,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(24)),
itemBuilder: (context, index) {
return FeastItem();
GetBanquetByTimeSunModel sunModel =
feastModel.banquetHome[index];
return InkWell(
onTap: () {
NavigatorUtil.goFeastDetailPage(context, sunModel.id);
},
child: FeastItem(controller, sunModel));
},
itemCount: 100,
itemCount: feastModel.banquetHome.length,
);
}
}))
... ...
... ... @@ -7,6 +7,7 @@ import 'package:provider/provider.dart';
import '../constant/constant.dart';
import '../constant/error.dart';
import '../models/GetBanquetByTimeModel.dart';
import '../models/classify_model.dart';
import '../models/filter_btn_model.dart';
import '../models/get_banquet_by_id_new_model.dart';
... ... @@ -29,7 +30,7 @@ import '../utils/utils.dart';
import 'dart:convert' as convert;
class FeastModel extends ChangeNotifier {
PageState pageState = PageState.Success;
PageState pageState = PageState.Loading; //宴会首页
List<FilterBtnModel> sellerManageList = []; //经理数据 ---- 商家编辑页面
... ... @@ -76,6 +77,63 @@ class FeastModel extends ChangeNotifier {
PageState pageStateBanquet = PageState.Loading; //宴会详情
GetBanquetByIdNewSunModel banquetDetail; //宴会详情信息
List<GetBanquetByTimeSunModel> banquetHome; //宴会首页数据
/**
* 宴会首页
*/
//根据时间范围获取宴会订单
Future<dynamic> getBanquetByTime(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_time,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {
switch (error.type) {
case 1:
pageState = PageState.ConnectivityError;
break;
case 2:
pageState = PageState.ConnectivityTimeOut;
break;
default:
pageState = PageState.ConnectivityError;
break;
}
}
notifyListeners();
return false;
});
if (baseResp.code == Constant.status_success) {
banquetHome = GetBanquetByTimeModel.fromJson(baseResp.responseData).data;
// if (baseResp.data == 1) {
// rid = baseResp.data['id'];
if (banquetHome.length == 0) {
pageState = PageState.Empty;
} else {
pageState = PageState.Success;
}
notifyListeners();
return true;
// } else {
// return false;
// }
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
pageState = PageState.ConnectivityError;
notifyListeners();
return false;
}
}
/***
*
* 新建宴会
... ... @@ -399,7 +457,34 @@ class FeastModel extends ChangeNotifier {
}
}
///设置合同信息
///设置宴会场次费用
Future<dynamic> setBanquetInfoPrice(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_banquet_info_price,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {}
return false;
});
if (baseResp.code == Constant.status_success) {
// if (baseResp.data == 1) {
// rid = baseResp.data['id'];
return true;
// } else {
// return false;
// }
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
///设置发票信息
Future<dynamic> setInvoice(BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
... ...
... ... @@ -1062,7 +1062,6 @@ class NavigatorUtil {
///宴会--签约--菜单信息
static Future<dynamic> goFeastMenuQYShowPage(BuildContext context,
{replace = false, bool onlyShow = false, Map object}) {
if (object == null) {
return _navigateTo(context, "${Routes.feast_qy_menu_show_page}",
... ... @@ -1072,4 +1071,14 @@ class NavigatorUtil {
"${Routes.feast_qy_menu_show_page}?object=${FluroConvertUtils.object2string(object)}",
replace: replace);
}
///宴会--详情
static Future<dynamic> goFeastDetailPage(
BuildContext context,
String rid, {
replace = false,
}) {
return _navigateTo(context, "${Routes.feast_detail_page}?rid=$rid",
replace: replace);
}
}
... ...
... ... @@ -155,6 +155,7 @@ import '../pages/feast/feast_board.dart';
import '../pages/feast/feast_create_page.dart';
import '../pages/feast/feast_deposit_data_page.dart';
import '../pages/feast/feast_deposit_page.dart';
import '../pages/feast/feast_detail_page.dart';
import '../pages/feast/feast_followup_page.dart';
import '../pages/feast/feast_invoice_page.dart';
import '../pages/feast/feast_menu_page.dart';
... ... @@ -1734,3 +1735,16 @@ var feastQYMenuPageHandle = new Handler(
cookListData: cook,
));
});
///宴会----详情
var feastDetailPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
String rid = params["rid"].first;
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(),
child: FeastDetailPage(
rid: rid,
));
});
... ...
... ... @@ -153,6 +153,7 @@ class Routes {
"/feast_menu_show_page"; //宴会-----新建宴会---菜单信息
static String feast_qy_menu_show_page =
"/feast_qy_menu_show_page"; //宴会-----新建宴会---签约菜单信息
static String feast_detail_page = "/feast_detail_page"; //宴会-----详情
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -306,7 +307,8 @@ class Routes {
router.define(feast_select_table_page, handler: feastSelectTablePageHandle);
router.define(feast_menu_show_page, handler: feastMenuShowPageHandle);
router.define(feast_qy_menu_show_page, handler: feastQYMenuPageHandle);
router.define(feast_qy_menu_show_page, handler: feastQYMenuPageHandle);
router.define(feast_detail_page, handler: feastDetailPageHandle);
}
}
... ...
... ... @@ -869,7 +869,10 @@ class Utils {
};
}
static String starPhone(phone) {
static String starPhone(String phone) {
if (phone.length < 5) {
return phone;
}
return phone.replaceFirst(new RegExp(r'\d{4}'), '****', 3);
}
... ...