Commit bb2bc43219a940dfbe306dfaf3f18423cc7ef740

Authored by wdn127929
1 parent d1c56710

UI ----- 店铺信息、包间类型、添加包间类型、选择关联其他包间桌位

... ... @@ -11,14 +11,14 @@ if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}
def flutterVersionCode = "296"
def flutterVersionCode = "300"
if (flutterVersionCode == null) {
flutterVersionCode = '296'
flutterVersionCode = '300'
}
def flutterVersionName = "2.9.6"
def flutterVersionName = "3.0.0"
if (flutterVersionName == null) {
flutterVersionName = '2.9.6'
flutterVersionName = '3.0.0'
}
apply plugin: 'com.android.application'
... ...
... ... @@ -368,7 +368,7 @@ class _BaseInfoPageState extends State<BaseInfoPage> {
return Scaffold(
backgroundColor: MyColours.color_fefefe,
appBar: SystemAppBar(
'填写信息',
'个人信息',
onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
... ...
... ... @@ -222,7 +222,25 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
)),
Positioned(
right: ScreenUtil().setWidth(40),
bottom: ScreenUtil().setWidth(120),
bottom: ScreenUtil().setWidth(190),
child: RoundButton(
image: Utils.getImgPath('edit'),
text: '店铺信息',
gradientStart: Color.fromRGBO(255, 255, 255, 0.1),
gradientEnd: Color.fromRGBO(255, 255, 255, 0.1),
borderColor: Color.fromRGBO(255, 255, 255, 0.2),
width: ScreenUtil().setWidth(195),
height: ScreenUtil().setWidth(60),
fontSize: 28,
isBold: false,
imgWidth: 26,
onPressed: () {
NavigatorUtil.goStoreBaseInfoPage(context);
},
)),
Positioned(
right: ScreenUtil().setWidth(40),
bottom: ScreenUtil().setWidth(110),
child: RoundButton(
image: Utils.getImgPath('edit'),
text: '个人信息',
... ... @@ -326,6 +344,18 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
color: MyColours.color_f3f3f3,
),
MyItem(
title: "包间类型",
content: "",
callback: () {
NavigatorUtil.goRoomTypeManagePage(context);
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "包间类型置满管理",
content: "",
callback: () {
... ...
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/table_list.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 RoomTypeCreatePage extends StatefulWidget {
RoomTypeCreatePage({Key key}) : super(key: key);
@override
_RoomTypeCreatePageState createState() => _RoomTypeCreatePageState();
}
class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
ScrollController _scrollController = ScrollController();
TextEditingController _nameController = TextEditingController();
TextEditingController _norNumController = TextEditingController();
TextEditingController _maxNumController = TextEditingController();
TextEditingController _minMoneyController = TextEditingController();
FocusNode _nameFocusNode = FocusNode();
FocusNode _norNumFocusNode = FocusNode();
FocusNode _maxNumFocusNode = FocusNode();
FocusNode _minMoneyFocusNode = FocusNode();
List<TableList> tableListSel = [];
@override
void initState() {
super.initState();
tableListSel = [];
}
///输入框
Widget _textfield(
String title,
String hintText,
TextEditingController editingController,
FocusNode focusNode,
String subTitle,
{bool needStar = true,
TextInputType inputType = TextInputType.number}) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
title,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
),
),
HEmptyView(20),
needStar
? Container(
child: Text(
'*',
style: TextStyle(
color: MyColours.color_199095,
fontWeight: FontWeight.bold,
),
),
)
: SizedBox(),
// Spacer(),
Expanded(
child: Container(
// height: ScreenUtil().setHeight(120),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(10),
top: ScreenUtil().setWidth(8)),
child: TextField(
controller: editingController,
textAlign: TextAlign.right,
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
inputFormatters: [],
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
),
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,
),
contentPadding: EdgeInsets.zero,
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: inputType,
)),
),
Container(
child: Text(
subTitle,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(32)),
),
),
],
),
);
}
///关联包间选择
Widget _select(String title, String hintText) {
return InkWell(
onTap: () async {
Map temp = await NavigatorUtil.goRoomTypeSelectTablePage(
context,
"",
DateTime.now().millisecondsSinceEpoch,
"1",
canChoose: true,
object: {'object': tableListSel},
);
if (temp != null && temp['tid'] != '') {
print(temp['tid']);
print(temp['tname']);
String tname = temp['tname'];
String tid = temp['tid'];
tableListSel = temp['object'];
setState(() {});
// _getTablePhoto(context, temp['tid'], showLoading: true);
}
},
child: Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
child: Text(
title,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
),
),
HEmptyView(20),
Spacer(),
Text(hintText,
style: TextStyle(
color: hintText == '选择包间'
? MyColours.color_999999
: MyColours.color_333333,
fontWeight:
hintText == '选择包间' ? FontWeight.normal : FontWeight.bold,
fontSize: ScreenUtil().setSp(32),
)),
HEmptyView(20),
Image.asset(
Utils.getImgPath('arr_right_gray'),
width: ScreenUtil().setWidth(12),
height: ScreenUtil().setWidth(22),
)
],
),
),
);
}
@override
Widget build(BuildContext context) {
return Material(
child: InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
child: Scaffold(
backgroundColor: MyColours.color_fefefe,
appBar: SystemAppBar(
'创建包间类型',
onTap: () {
Navigator.of(context).pop();
},
),
body: Column(children: [
Expanded(
child: SingleChildScrollView(
controller: _scrollController,
physics: BouncingScrollPhysics(),
child: Column(
children: [
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield('类型名称', '例如:6人间',
_nameController, _nameFocusNode, '',
inputType: TextInputType.text)),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield('标准可坐人数', '例如:6',
_norNumController, _norNumFocusNode, '人')),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield('最多可做人数', '例如:6',
_maxNumController, _maxNumFocusNode, '人',
needStar: false)),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield(
'最低消费',
'例如:1000',
_minMoneyController,
_minMoneyFocusNode,
'元',
needStar: false)),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(40),
),
child: _select(
'关联包间',
tableListSel.length == 0
? '选择包间'
: '查看包间')),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
],
)),
),
VEmptyView(20),
Padding(
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () {
//接口
// _setStoreBaseinfo();
},
text: '保存',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
width: double.infinity,
radius: ScreenUtil().setWidth(10),
))
]))));
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/seller_table_class_entity.dart';
import 'package:one_key/provider/store_detail_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.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';
class RoomTypeManagePage extends StatefulWidget {
RoomTypeManagePage({Key key}) : super(key: key);
@override
_RoomTypeManagePageState createState() => _RoomTypeManagePageState();
}
class _RoomTypeManagePageState extends State<RoomTypeManagePage> {
//包间
List<SellerTableClassEntity> tables = [];
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_getSellerTableClass();
});
}
//获取商家包间类型
_getSellerTableClass() async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).user.sellerid,
};
StoreDetailModel detailModel =
Provider.of<StoreDetailModel>(context, listen: false);
tables = await detailModel.getSellerTableClass(context, params);
// tables.any((element) => element.isFull == 1);
// rooms.clear();
setState(() {});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'包间类型',
onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},
),
body: WillPopScope(
onWillPop: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},
child: Container(
width: double.infinity,
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(30),
top: ScreenUtil().setWidth(20),
right: ScreenUtil().setWidth(30)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
VEmptyView(20),
Selector<StoreDetailModel,
List<SellerTableClassEntity>>(
shouldRebuild: (pre, next) => true,
selector: (context, model) => model.tables,
builder: (context, tables, child) {
return GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing:
ScreenUtil().setWidth(20),
crossAxisSpacing:
ScreenUtil().setWidth(30),
childAspectRatio: 2.4),
itemBuilder: (context, index) {
return GestureDetector(
onTap: () async {},
child: Container(
height: ScreenUtil().setWidth(140),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(30)),
decoration: BoxDecoration(
color: MyColours.color_A9E3E6,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10)),
border: Border.all(
color: MyColours.color_2AB5B7,
width: ScreenUtil().setWidth(2)),
),
alignment: Alignment.centerLeft,
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment:
MainAxisAlignment.center,
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
Text("${tables[index].name}",
style: TextStyle(
fontSize:
ScreenUtil().setSp(30),
color: MyColours.color_333333,
fontWeight: FontWeight.bold)),
VEmptyView(10),
int.parse(tables[index].max ?? "0") > 0
? Text(
"最多可坐${tables[index].max}人",
style: TextStyle(
fontSize:
ScreenUtil().setSp(24),
color:
MyColours.color_333333,
fontWeight:
FontWeight.normal),
)
: Container(),
int.parse(tables[index].low ?? "0") > 0
? Text(
"最低消费${tables[index].low}元",
style: TextStyle(
fontSize:
ScreenUtil().setSp(20),
color:
MyColours.color_199095,
fontWeight:
FontWeight.normal),
)
: Container()
],
),
),
);
},
itemCount: tables.length,
shrinkWrap: true,
physics: new NeverScrollableScrollPhysics(),
);
},
)
],
)),
),
Padding(
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () async {
NavigatorUtil.goRoomTypeCreatePage(context);
},
text: '添加类型',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
width: double.infinity,
radius: ScreenUtil().setWidth(10),
))
],
),
)));
}
}
... ...
import 'dart:ffi';
import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/area.dart';
import 'package:one_key/models/notebook.dart';
import 'package:one_key/models/tableOuter.dart';
import 'package:one_key/models/table_list.dart';
import 'package:one_key/provider/choose_table_model.dart';
import 'package:one_key/provider/notebook_detail_change_model.dart';
import 'package:one_key/provider/notebook_model.dart';
import 'package:one_key/provider/user_model.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/app_bar.dart';
import 'package:one_key/widgets/area_item.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/table_item.dart';
import 'package:one_key/models/table.dart' as t;
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import 'dart:convert' as convert;
class RoomTypeSelectTablePage extends StatefulWidget {
final String rid; //预订id
final DateTime dateTime; //日期
final String ddate_slot; //时段
final bool canChoose; //变更预订可以取消原来已预订的选中状态
final List<TableList> tableList;
final String fromPage;
final String tid;
RoomTypeSelectTablePage(this.rid, this.dateTime, this.ddate_slot,
{this.canChoose = false, this.tableList, this.fromPage, this.tid});
@override
State<StatefulWidget> createState() {
// TODO: implement createState
return new RoomTypeSelectTablePageState();
}
}
class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
List<Area> areas = []; //区域列表
List<t.Table> selectTables = []; //选择的桌位
List<TableOuter> tableOuterList = []; //区域-桌位列表
Map<String, List<t.Table>> areaTableMap = {}; //区域-桌位Map
ChooseTableModel _chooseTableModel;
Map<String, Notebook> tableMap = {}; //记录已预订桌位对应的订单
String currentArea; //当前选中区域
List<String> personNumList = [];
int selectNum = 0;
@override
void initState() {
// TODO: implement initState
super.initState();
for (int i = 1; i < 31; i++) {
personNumList.add(i.toString());
}
WidgetsBinding.instance.addPostFrameCallback((_) {
getTableList();
});
}
//获取桌位列表
getTableList({needLoading = true}) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {"sellerid": userModel.user.sellerid};
tableOuterList = await _chooseTableModel.getTableList(context, params,
needLoading: needLoading);
for (TableOuter item in tableOuterList) {
// if (item.name == "推荐") {
// itemModelList.remove(item);
// }
for (var item in item.list) {
for (var table in widget.tableList) {
if (item.id == table.id) {
item.selected = true;
selectNum++;
// if (!tableList.contains(item)) {
// tableList.add(item);
// }
}
}
}
}
// if (tableOuterList.isEmpty) {
// _chooseTableModel.pageState = PageState.Success;
// _chooseTableModel.notifyListeners();
// }
// else {
// _getReserveList(userModel.user.sellerid, needLoading: needLoading);
// }
// if (_chooseTableModel.pageState == PageState.Success) {
// }
if (needLoading) {
initData();
} else {
initData(needRetain: true);
}
}
refreshTable(context) async {
await getTableList(needLoading: false);
// if (temp.length > 0) {
// _getReserveList(context, needLoading: false);
// } else {
// // pageState = PageState.Empty;
// _chooseTableModel.pageState = PageState.Success;
// _chooseTableModel.notifyListeners();
// }
}
//获取已预订列表
_getReserveList(String sid, {needLoading = true}) async {
NoteBookModel model = new NoteBookModel();
Map<String, String> params = {
"sid": sid,
"rdate": _getRdate(),
"ddate_solt": widget.ddate_slot,
"y": "200",
"x": "1",
"keywords": "",
"sort": "1"
};
List<Notebook> noteBooks =
await model.getReserveList(context, params, needLoading: needLoading);
for (Notebook notebook in noteBooks) {
if (notebook.tid.isEmpty) continue;
if (notebook.status == "1" ||
notebook.status == "2" ||
notebook.status == "5") {
//已预订,用餐中,已安排
List<String> tids = notebook.tid.split(",");
for (String tid in tids) {
tableMap["$tid"] = notebook;
}
}
}
print(tableMap);
if (needLoading) {
initData();
} else {
initData(needRetain: true);
}
}
//初始桌位数据
initData({bool needRetain = false}) {
areas.clear();
areaTableMap.clear();
for (TableOuter outer in tableOuterList) {
int count = 0;
for (t.Table table in outer.list) {
if (widget.tid != '' && table.id == widget.tid) {
table.selected = true;
currentArea = outer.name;
}
if (table.tablestatus == "0") {
//没有用餐中
if (tableMap["${table.id}"] != null) {
Notebook notebook = tableMap["${table.id}"];
table.sign = notebook.status;
table.notebookId = notebook.id;
table.reserver = notebook.rnameStr;
} else {
table.sign = "";
table.notebookId = "";
if (table.enable == "1") {
count++;
}
}
} else {
table.sign = "2";
table.notebookId = "";
}
}
areaTableMap["${outer.name}"] = outer.list;
Area area = Area();
area.name = outer.name;
area.count = count;
area.rid = outer.list.length == 0 ? outer.rid : outer.list[0].rid;
areas.add(area);
}
if (widget.tid == '') {
if (!needRetain) {
currentArea = areaTableMap.keys.first;
}
if (areas.length == 1) {
currentArea = areaTableMap.keys.first;
}
}
_chooseTableModel.pageState = PageState.Success;
_chooseTableModel.notifyListeners();
}
//获取一天开始-结束时间字符串
String _getRdate() {
//一天开始时间
double startDay = (DateTime.parse((widget.dateTime.year.toString() +
"-" +
Utils.addZeroNumber(widget.dateTime.month) +
"-" +
Utils.addZeroNumber(widget.dateTime.day) +
" 00:00:00"))
.millisecondsSinceEpoch) /
1000;
//一天结束时间
double endDay = (DateTime.parse((widget.dateTime.year.toString() +
"-" +
Utils.addZeroNumber(widget.dateTime.month) +
"-" +
Utils.addZeroNumber(widget.dateTime.day) +
" 23:59:59"))
.millisecondsSinceEpoch) /
1000;
return startDay.floor().toString() + "-" + endDay.floor().toString();
}
@override
Widget build(BuildContext context) {
_chooseTableModel = Provider.of<ChooseTableModel>(context);
return Scaffold(
body: SafeArea(
child: Column(
children: <Widget>[
MyAppBar(
"选择桌位",
showBack: true,
),
Expanded(
child: Consumer<ChooseTableModel>(builder: (context, model, _) {
if (model.pageState != PageState.Success) {
return ExceptionPage(
pageState: model.pageState,
callback: () {
getTableList();
},
emptyMsg: "暂时没有桌位哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Container(
color: MyColours.color_ffffff,
child: Row(
children: <Widget>[
Container(
width: ScreenUtil().setWidth(170),
height: double.infinity,
color: MyColours.color_f1f1f1,
child: ListView.builder(
itemBuilder: (context, index) {
return AreaItem(areas[index], currentArea, (area) {
setState(() {
currentArea = (area as Area).name;
});
}, need: false);
},
itemExtent: ScreenUtil().setHeight(207),
itemCount: areas.length,
),
),
Expanded(
child: Padding(
padding: EdgeInsets.symmetric(
vertical: ScreenUtil().setHeight(10),
horizontal: ScreenUtil().setWidth(9)),
child: Column(
children: [
Expanded(
child: GridView.builder(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
childAspectRatio: 8 / 9),
itemBuilder: (context, index) {
return TableItem(
areaTableMap[currentArea][index],
need: false,
onSelected: (t.Table table) {
if (widget.fromPage == 'tablePhoto') {
for (String item in areaTableMap.keys) {
for (t.Table item
in areaTableMap[item]) {
item.selected = false;
selectNum = 0;
if (table.id == item.id) {
item.selected = true;
selectTables = [];
selectNum++;
selectTables.add(table);
}
}
}
setState(() {});
} else {
if ((table as t.Table).selected) {
selectTables.add(table);
selectNum++;
widget.tableList
.add(tableToTableList(table));
} else {
widget.tableList.removeWhere(
(t) => t.id == table.id);
selectNum--;
selectTables.removeWhere(
(t) => t.id == table.id);
}
setState(() {});
}
},
canSelected: true,
fromPage: widget.fromPage,
tableMap: tableMap,
rid: widget.rid);
},
itemCount: currentArea == null
? 0
: areaTableMap[currentArea].length,
)),
Container(
width: double.infinity,
height: ScreenUtil().setHeight(84),
margin: EdgeInsets.only(
bottom: ScreenUtil().setWidth(50)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(31)),
alignment: Alignment.center,
color: MyColours.color_ffffff,
child: CommonButton(
content: widget.fromPage == 'tablePhoto'
? '确定'
: "已选${selectNum}个 确定",
width: 500,
height: 84,
fontSize: 34,
state: 1,
onPress: () {
if (widget.fromPage == "tablePhoto") {
Map temp = {
'tid': selectTables.length > 0
? selectTables[0].id
: '',
'tname': selectTables.length > 0
? selectTables[0].name
: ''
};
Navigator.of(context).pop(temp);
} else {
if (widget.canChoose) {
// if (widget.tableList.length > 0) {
String tid = "";
for (TableList table
in widget.tableList) {
tid += table.id + ",";
}
if (widget.tableList.length > 0) {
tid = tid.substring(
0, tid.length - 1);
}
Map temp = {
'object': widget.tableList,
'tid': tid
};
Navigator.of(context).pop(temp);
// }
} else {
if (selectTables.length > 0) {
String tid = "";
for (t.Table table
in selectTables) {
tid += table.id + ",";
}
if (selectTables.length > 0) {
tid = tid.substring(
0, tid.length - 1);
}
Map temp = {
'object': widget.tableList,
'tid': tid
};
Navigator.of(context).pop(temp);
}
}
}
},
)),
],
)),
)
],
),
);
}
}),
),
],
),
));
}
tableToTableList(t.Table table) {
TableList _tableList = TableList(
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
_tableList.id = table.id;
_tableList.rid = table.rid;
_tableList.tid = table.tid;
_tableList.name = table.name;
_tableList.tablePnum = table.table_pnum;
_tableList.sellerid = null;
_tableList.qrcode = null;
_tableList.mostPnum = table.most_pnum;
_tableList.hot = null;
_tableList.orderO = table.order_o;
_tableList.status = table.status;
_tableList.enable = table.enable;
_tableList.spell = table.spell;
_tableList.cdate = null;
_tableList.rname = table.rname;
_tableList.regionName = table.rname;
_tableList.selected = true;
return _tableList;
}
}
... ...
import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/upload_img_model.dart';
import 'package:one_key/models/user.dart';
import 'package:one_key/pages/online_check/photo_view_wiget.dart';
import 'package:one_key/pages/online_check/progress.dart';
import 'package:one_key/provider/base_info_provider.dart';
import 'package:one_key/provider/upload_img_provider.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/upload_image_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:image_picker/image_picker.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
class StoreBaseInfoPage extends StatefulWidget {
StoreBaseInfoPage({Key key}) : super(key: key);
@override
_StoreBaseInfoPageState createState() => _StoreBaseInfoPageState();
}
class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
ScrollController _scrollController;
TextEditingController _nameController = TextEditingController();
TextEditingController _phoneController = TextEditingController();
TextEditingController _timeController = TextEditingController();
TextEditingController _addressController = TextEditingController();
TextEditingController _introductionController = TextEditingController();
FocusNode _nameFocusNode = FocusNode();
FocusNode _phoneFocusNode = FocusNode();
FocusNode _timeFocusNode = FocusNode();
FocusNode _addressFocusNode = FocusNode();
FocusNode _introductionFocusNode = FocusNode();
String storeAddress;
final picker = ImagePicker();
// OnlineCheckEditProvider _onlineCheckEditProvider;
UploadImageProvider _uploadImageProvider;
BaseIndoProvider _baseIndoProvider;
@override
void initState() {
super.initState();
_scrollController = ScrollController();
WidgetsBinding.instance.addPostFrameCallback((_) {
_uploadImageProvider.mentou.process = 0.01;
_uploadImageProvider.mentou.qiniuUrl = '';
_uploadImageProvider.imgSizeMenTou = 64;
_getQiniuInfo();
_getStoreBaseinfo();
});
}
///获取店铺信息
_getStoreBaseinfo() async {
Map<String, String> params = {
'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
"uid": Provider.of<UserModel>(context, listen: false).user.openid,
};
bool success =
await _baseIndoProvider.getCustomerActivityBaseinfo(context, params);
if (success) {
_nameController.text = _baseIndoProvider.baseInfoSunModel.name;
_uploadImageProvider.touxiang.qiniuUrl =
_baseIndoProvider.baseInfoSunModel.photo;
_uploadImageProvider.erweima.qiniuUrl =
_baseIndoProvider.baseInfoSunModel.qrcode;
_phoneController.text = _baseIndoProvider.baseInfoSunModel.phone;
// _positionController.text = _baseIndoProvider.baseInfoSunModel.position;
_uploadImageProvider.imgSizeErweima = 64;
// setState(() {});
_uploadImageProvider.notifyListeners();
}
}
///获取七牛云token
///
_getQiniuInfo() async {
await _uploadImageProvider.getQiniuInfo(context, {});
}
/// 修改店铺基本信息
_setStoreBaseinfo() async {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
User user = Provider.of<UserModel>(context, listen: false).user;
Map<String, String> params = {
'sellerid': user.sellerid,
"uid": user.openid,
"name": _nameController.text.trim().length == 0
? user.sellername
: _nameController.text.trim(),
"photo": _uploadImageProvider.touxiang.qiniuUrl.trim().length == 0
? 'http://nosqn.colorcun.com/yd_person.png'
: _uploadImageProvider.touxiang.qiniuUrl,
// "position": _positionController.text.trim().length == 0
// ? '经理'
// : _positionController.text,
};
if (_phoneController.text.trim().length == 0) {
if (user.userphone != null) {
params['phone'] = user.userphone;
}
} else {
params['phone'] = _phoneController.text.trim();
}
if (_uploadImageProvider.erweima.qiniuUrl != null &&
_uploadImageProvider.erweima.qiniuUrl != '') {
params['qrcode'] = _uploadImageProvider.erweima.qiniuUrl;
}
if (_baseIndoProvider.baseInfoSunModel != null) {
params['id'] = _baseIndoProvider.baseInfoSunModel.id;
}
bool isSuccess =
await _baseIndoProvider.setCustomerActivityBaseinfo(context, params);
// _baseIndoProvider.baseInfoSunModel = null;
if (isSuccess) {
_uploadImageProvider.touxiang.file = null;
_uploadImageProvider.erweima.file = null;
//成功之后跳回前一个页面
// bus.emit('refresh_coupon_list');
Utils.showToast('保存成功');
EventBus().emit('changeStatusColor');
Navigator.pop(context, true);
}
}
///输入框
Widget _textfield(String title, String hintText,
TextEditingController editingController, FocusNode focusNode) {
return Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Container(
child: Text(
title,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
),
),
HEmptyView(20),
Spacer(),
Container(
width: ScreenUtil().setWidth(231 * 2),
child: TextField(
controller: editingController,
textAlign: TextAlign.right,
textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
inputFormatters: title == '详细地址'
? [
LengthLimitingTextInputFormatter(20),
// WhitelistingTextInputFormatter.digitsOnly
]
: [],
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
),
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,
),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
keyboardType: TextInputType.text,
),
)
],
),
);
}
//查看大图
_showPhotoView(BuildContext context, int index, List imgs,
{isShow = false, List dashName}) async {
// if (imgs.length == 1 &&
// imgs[0] ==
// 'http://nosqn.colorcun.com/custom/lite-online/image/def-banner.png') {
// imgs[0] = 'http://nosqn.colorcun.com/app/seller-hj-empty.png';
// }
Utils.setBarStatus(false, color: Colors.black);
dynamic result = await showGeneralDialog(
context: context,
barrierDismissible: false,
// barrierColor: Colors.red,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
pageBuilder: (BuildContext context, Animation animation,
Animation secondaryAnimation) {
Widget child = Stack(
children: <Widget>[
PhotoPreview(
initialIndex: index,
photoList: imgs,
isShow: isShow,
dashName: dashName)
],
);
return child;
});
Utils.setBarStatus(true, color: Colors.white);
}
///#相机拍照,单图选择
Future _getFromPictureOrCamera(
String title, UploadImgModel imgModel, imageSource) async {
final pickedFile = await picker.getImage(source: imageSource);
setState(() {
if (pickedFile != null) {
imgModel.file = File(pickedFile.path);
imgModel.process = 0.01;
} else {
print('No image selected.');
}
});
if (pickedFile != null) {
if (title == '头像') {
_uploadImageProvider.imgSizeTouxiang = 64;
_uploadImageProvider.touxiang.qiniuUrl = null;
} else {
_uploadImageProvider.imgSizeErweima = 64;
_uploadImageProvider.erweima.qiniuUrl = null;
}
UploadImageUtil().startUploadOnly(context, File(pickedFile.path),
title == '头像' ? 0 : 1, true, _uploadImageProvider);
}
}
///图片 头像和二维码
Widget _imageWidget(
String title, UploadImgModel model, double imgSize, double radius) {
return InkWell(
onTap: () {
Utils.getPickPermission(context, () {
_getFromPictureOrCamera(title, model, ImageSource.gallery);
}, Platform.isAndroid ? Permission.storage : Permission.photos);
},
child: Container(
margin: EdgeInsets.only(
top: ScreenUtil().setWidth(40),
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40)),
height: ScreenUtil().setWidth(imgSize * 2),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
title,
textAlign: TextAlign.left,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
),
Spacer(),
Stack(
children: [
InkWell(
onTap: () {
double process;
String qiniuUrl;
List<String> tempList = [];
process = _uploadImageProvider.mentou.process;
qiniuUrl = _uploadImageProvider.mentou.qiniuUrl;
if (qiniuUrl != null && qiniuUrl != '') {
tempList.add(qiniuUrl);
///没有上传完成的不可以点击
_showPhotoView(context, 0, tempList);
} else {
Utils.getPickPermission(context, () {
_getFromPictureOrCamera(
title, model, ImageSource.gallery);
},
Platform.isAndroid
? Permission.storage
: Permission.photos);
}
},
child: ClipRRect(
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(radius)),
child: model.file == null
? model.qiniuUrl != null && model.qiniuUrl != ''
? Image.network(
model.qiniuUrl,
fit: BoxFit.cover,
width: ScreenUtil().setWidth(imgSize * 2),
height: ScreenUtil().setWidth(imgSize * 2),
)
: Image.asset(
Utils.getImgPath('no_image'),
fit: BoxFit.cover,
width: ScreenUtil().setWidth(imgSize * 2),
height: ScreenUtil().setWidth(imgSize * 2),
)
: Image.file(
model.file,
fit: BoxFit.cover,
width: ScreenUtil().setWidth(imgSize * 2),
height: ScreenUtil().setWidth(imgSize * 2),
),
),
),
(model.file != null) &&
model.process != 1 &&
model.process != 0.01
? Container(
width: ScreenUtil().setWidth(imgSize * 2),
height: ScreenUtil().setWidth(imgSize * 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(radius),
color: Color.fromRGBO(0, 0, 0, 0.6)),
child: Center(
child: Text('上传中',
style:
TextStyle(color: MyColours.color_999999)),
),
)
: Container(),
],
),
HEmptyView(30),
Image.asset(
"assets/arr_right_gray.png",
width: ScreenUtil().setWidth(14),
height: ScreenUtil().setWidth(22),
)
],
),
));
}
///地图地址选择
Widget _select(String title, String hintText) {
return InkWell(
onTap: () {
Utils.getPickPermission(context, () async {
Map address = await NavigatorUtil.goMapChoicePointPage(context);
if (address != null) {
setState(() {
storeAddress = address['address'];
// createStoreModel.storeInfo?.address = storeAddress;
// createStoreModel.storeInfo?.lat = address['lat'];
// createStoreModel.storeInfo?.lng = address['lng'];
});
}
}, Permission.location);
},
child: Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
child: Text(
title,
style: TextStyle(
color: MyColours.color_333333,
fontWeight: FontWeight.bold,
fontSize: ScreenUtil().setSp(34)),
),
),
HEmptyView(20),
Spacer(),
Text(hintText,
style: TextStyle(
color: hintText == '点击选择'
? MyColours.color_999999
: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32),
)),
HEmptyView(20),
Image.asset(
Utils.getImgPath('arr_right_gray'),
width: ScreenUtil().setWidth(12),
height: ScreenUtil().setWidth(22),
)
],
),
),
);
}
@override
Widget build(BuildContext context) {
_uploadImageProvider =
Provider.of<UploadImageProvider>(context, listen: true);
_baseIndoProvider = Provider.of<BaseIndoProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_fefefe,
appBar: SystemAppBar(
'店铺信息',
onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},
),
body: WillPopScope(
onWillPop: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},
child: InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
child: Column(children: [
Expanded(
child: SingleChildScrollView(
controller: _scrollController,
physics: BouncingScrollPhysics(),
child: Column(
children: [
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield('店铺名称', '请填写店铺名称',
_nameController, _nameFocusNode)),
VEmptyView(10),
_imageWidget('门头照片', _uploadImageProvider.mentou,
_uploadImageProvider.imgSizeMenTou, 64),
VEmptyView(30),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield('店铺电话', '请填写店铺电话',
_phoneController, _phoneFocusNode)),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield(
'营业时间',
'请填写营业时间,如09:00-23:00',
_timeController,
_timeFocusNode)),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(40),
),
child: _select('地图地址', '点击选择')),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield('详细地址', '请填写店铺详细地址',
_addressController, _addressFocusNode)),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(108 * 2),
right: ScreenUtil().setWidth(40)),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
),
child: _textfield(
'店铺简介',
'请填写店铺简介',
_introductionController,
_introductionFocusNode)),
VEmptyView(10),
],
)),
),
VEmptyView(20),
Padding(
padding: EdgeInsets.fromLTRB(ScreenUtil().setWidth(40), 0,
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () {
//接口
_setStoreBaseinfo();
},
text: '保存',
fontSize: 34,
isBold: false,
height: ScreenUtil().setWidth(80),
width: double.infinity,
radius: ScreenUtil().setWidth(10),
))
]))));
}
}
... ...
... ... @@ -12,8 +12,6 @@ import 'package:one_key/utils/utils.dart';
*/
class StoreDetailModel with ChangeNotifier {
List<SellerTableClassEntity> tables = []; //商家包间类型
int _money;
int get money => _money;
//获取商家包间类型
Future<List<SellerTableClassEntity>> getSellerTableClass(
... ...
... ... @@ -17,8 +17,10 @@ class UploadImageProvider extends ChangeNotifier {
QiniuInfoSunModel qiniuInfoSunModel;
UploadImgModel touxiang = UploadImgModel(); //头像
UploadImgModel erweima = UploadImgModel(); //二维码
UploadImgModel mentou = UploadImgModel(); //店铺信息----门头照片
double imgSizeTouxiang = 64;
double imgSizeErweima = 22;
double imgSizeMenTou = 64;
List<UploadImgModel> imageListDenvironment = []; //环境信息列表
List<UploadImgModel> imageListFront = []; //门头信息列表
List<UploadImgModel> tableImageList = []; //桌子管理图片信息列表
... ...
... ... @@ -358,4 +358,41 @@ class NavigatorUtil {
"${Routes.sms_recharge_page}?smsInfoData=${FluroConvertUtils.object2string(smsInfoData)}",
replace: replace);
}
/// 店铺信息
static Future<dynamic> goStoreBaseInfoPage(BuildContext context,
{replace = false, SmsInfoData smsInfoData}) {
return _navigateTo(context, "${Routes.store_base_info_page}",
replace: replace);
}
/// 包间类型管理
static Future<dynamic> goRoomTypeManagePage(BuildContext context,
{replace = false, SmsInfoData smsInfoData}) {
return _navigateTo(context, "${Routes.room_type_manage_page}",
replace: replace);
}
/// 包间类型创建
static Future<dynamic> goRoomTypeCreatePage(BuildContext context,
{replace = false, SmsInfoData smsInfoData}) {
return _navigateTo(context, "${Routes.room_type_create_page}",
replace: replace);
}
///包间管理中 ------ 选择桌位
static Future goRoomTypeSelectTablePage(
BuildContext context, String rid, int dateTime, String ddate_slot,
{bool canChoose = false,
Map object,
String fromPage = 'change',
String tid = ''}) {
if (object != null) {
return _navigateTo(context,
"${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${FluroConvertUtils.object2string(object)}");
}
// object = {'object': [], "tid": ''};
return _navigateTo(context,
"${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose");
}
}
... ...
... ... @@ -40,8 +40,12 @@ import 'package:one_key/pages/my/contant_page.dart';
import 'package:one_key/pages/my/my_integral_page.dart';
import 'package:one_key/pages/my/receive_orders_time_set.dart';
import 'package:one_key/pages/my/remark_manager_page.dart';
import 'package:one_key/pages/my/room_type/room_type_create_page.dart';
import 'package:one_key/pages/my/room_type/room_type_manage_page.dart';
import 'package:one_key/pages/my/room_type/room_type_select_table_page.dart';
import 'package:one_key/pages/my/sms_manager.dart';
import 'package:one_key/pages/my/sms_recharge_page.dart';
import 'package:one_key/pages/my/store_base_info_page.dart';
import 'package:one_key/pages/my/store_type_fill_manage_page.dart';
import 'package:one_key/pages/notebook/statistics_page.dart';
import 'package:one_key/pages/notebook/statistics_sms_page.dart';
... ... @@ -545,7 +549,68 @@ var smsRechargePageHandler = new Handler(
SmsInfoData data = SmsInfoData.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first)));
return ChangeNotifierProvider<SmsRechargeModel>(
create: (_) => SmsRechargeModel(), child: SmsRechargePage(infoData: data));
create: (_) => SmsRechargeModel(),
child: SmsRechargePage(infoData: data));
// return ChangeNotifierProvider<UploadImageProvider>(
// create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
});
///店铺信息
var storeBaseInfoPageHandler = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// SmsInfoData data = SmsInfoData.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first)));
return ChangeNotifierProvider<BaseIndoProvider>(
create: (_) => BaseIndoProvider(), child: StoreBaseInfoPage());
// return ChangeNotifierProvider<UploadImageProvider>(
// create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
});
///包间类型管理
var roomTypeManagePageHandler = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// SmsInfoData data = SmsInfoData.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first)));
return ChangeNotifierProvider<StoreDetailModel>(
create: (_) => StoreDetailModel(), child: RoomTypeManagePage());
// return ChangeNotifierProvider<UploadImageProvider>(
// create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
});
///包间类型创建
var roomTypeCreatePageHandler = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// SmsInfoData data = SmsInfoData.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first)));
return ChangeNotifierProvider<StoreDetailModel>(
create: (_) => StoreDetailModel(), child: RoomTypeCreatePage());
// return ChangeNotifierProvider<UploadImageProvider>(
// create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
});
// 跳转到包间管理中的选择桌位
var roomTypeSelectTablePageHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
String rid = params['rid'].first;
String tid = params['tid'].first;
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(params["dateTime"].first));
String ddate_slot = params["ddate_slot"].first;
String fromPage = params["fromPage"].first;
bool canChoose = params["canChoose"].first == "true" ? true : false;
List<TableList> res = [];
if (params.keys.contains('object')) {
Map object = FluroConvertUtils.string2map(params["object"].first);
List temp = object['object'];
for (var item in temp) {
res.add(TableList.fromJson(item));
}
}
// return SelectTablePage(rid, dateTime, ddate_slot,canChoose: canChoose);
return ChangeNotifierProvider<ChooseTableModel>(
create: (_) => ChooseTableModel(),
child: RoomTypeSelectTablePage(rid, dateTime, ddate_slot,
canChoose: canChoose, tableList: res, fromPage: fromPage, tid: tid));
});
... ...
... ... @@ -50,6 +50,11 @@ class Routes {
"/store_type_fill_manage_page"; //包间置满管理
static String sms_manager_page = "/sms_manager_page"; //短信充值
static String sms_recharge_page = "/sms_recharge_page"; //短信充值
static String store_base_info_page = "/store_base_info_page"; //店铺信息
static String room_type_manage_page = "/room_type_manage_page"; //包间类型管理
static String room_type_create_page = "/room_type_create_page"; //包间类型创建
static String room_type_select_table_page =
"/room_type_select_table_page"; //包间管理中桌位选择页面
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -107,5 +112,10 @@ class Routes {
handler: storeTypeFillManagePageHandler);
router.define(sms_manager_page, handler: smsManagerPageHandler);
router.define(sms_recharge_page, handler: smsRechargePageHandler);
router.define(store_base_info_page, handler: storeBaseInfoPageHandler);
router.define(room_type_manage_page, handler: roomTypeManagePageHandler);
router.define(room_type_create_page, handler: roomTypeCreatePageHandler);
router.define(room_type_select_table_page,
handler: roomTypeSelectTablePageHandler);
}
}
... ...
... ... @@ -3,14 +3,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/area.dart';
import 'package:one_key/res/colors.dart';
class AreaItem extends StatefulWidget{
final String currentArea;//当前选中区域名称
class AreaItem extends StatefulWidget {
final String currentArea; //当前选中区域名称
final Area area;
final ValueChanged selectCallback;
AreaItem(this.area,this.currentArea,this.selectCallback);
final bool need;
AreaItem(this.area, this.currentArea, this.selectCallback,
{this.need = true});
@override
State<StatefulWidget> createState() {
// TODO: implement createState
... ... @@ -18,16 +19,15 @@ class AreaItem extends StatefulWidget{
}
}
class AreaItemState extends State<AreaItem>{
class AreaItemState extends State<AreaItem> {
@override
Widget build(BuildContext context) {
// TODO: implement build
Area area=widget.area;
bool isSelected=area.name==widget.currentArea;
Area area = widget.area;
bool isSelected = area.name == widget.currentArea;
return GestureDetector(
onTap: (){
if(widget.selectCallback!=null){
onTap: () {
if (widget.selectCallback != null) {
widget.selectCallback(widget.area);
}
},
... ... @@ -38,27 +38,51 @@ class AreaItemState extends State<AreaItem>{
height: ScreenUtil().setHeight(207),
alignment: Alignment.center,
decoration: BoxDecoration(
color: isSelected?MyColours.color_ffffff:MyColours.color_f1f1f1,
border: Border(bottom: BorderSide(color: MyColours.color_ffffff,width: ScreenUtil().setHeight(1)))
),
child: Text(area.name,style: TextStyle(color: isSelected?MyColours.color_2bb5b7:MyColours.color_828282,fontSize: ScreenUtil().setSp(32),decoration: TextDecoration.none,fontWeight: FontWeight.normal),),
),
Positioned(
left: 0,
top: 0,
child: Container(
width: ScreenUtil().setWidth(73),
height: ScreenUtil().setHeight(37),
alignment: Alignment.center,
decoration: BoxDecoration(
color: area.count<=0?MyColours.color_999999:MyColours.color_63a6d1,
borderRadius: BorderRadius.only(topRight: Radius.circular(ScreenUtil().setWidth(8)),bottomRight: Radius.circular(ScreenUtil().setWidth(8)))
),
child: Text(area.count<=0?"满座":"余${area.count}",style: TextStyle(color: MyColours.color_ffffff,fontSize: ScreenUtil().setSp(26),decoration: TextDecoration.none,fontWeight: FontWeight.normal)),
color: isSelected
? MyColours.color_ffffff
: MyColours.color_f1f1f1,
border: Border(
bottom: BorderSide(
color: MyColours.color_ffffff,
width: ScreenUtil().setHeight(1)))),
child: Text(
area.name,
style: TextStyle(
color: isSelected
? MyColours.color_2bb5b7
: MyColours.color_828282,
fontSize: ScreenUtil().setSp(32),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
),
widget.need
? Positioned(
left: 0,
top: 0,
child: Container(
width: ScreenUtil().setWidth(73),
height: ScreenUtil().setHeight(37),
alignment: Alignment.center,
decoration: BoxDecoration(
color: area.count <= 0
? MyColours.color_999999
: MyColours.color_63a6d1,
borderRadius: BorderRadius.only(
topRight: Radius.circular(ScreenUtil().setWidth(8)),
bottomRight:
Radius.circular(ScreenUtil().setWidth(8)))),
child: Text(area.count <= 0 ? "满座" : "余${area.count}",
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal)),
),
)
: SizedBox(),
],
),
);
}
}
\ No newline at end of file
}
... ...
... ... @@ -15,6 +15,7 @@ class TableItem extends StatefulWidget {
final Map<String, Notebook> tableMap; //记录已预订桌位对应的订单
final int height; //高度
final bool need;
TableItem(this.table,
{this.onSelected,
... ... @@ -22,7 +23,8 @@ class TableItem extends StatefulWidget {
this.height = 185,
this.fromPage = 'new',
this.rid,
this.tableMap});
this.tableMap,
this.need = true});
@override
State<StatefulWidget> createState() {
... ... @@ -209,53 +211,55 @@ class TableItemState extends State<TableItem> {
],
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: signStr.isEmpty
? Container()
: Stack(
alignment: Alignment.center,
children: [
Container(
width: ScreenUtil().setWidth(160),
height: ScreenUtil().setWidth(40),
alignment: Alignment.center,
decoration: BoxDecoration(
color: signStr == '已停用'
? MyColours.color_777777
: signStr == '已买单'
? MyColours.color_F59A23
: MyColours.color_E95750,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(
ScreenUtil().setWidth(8)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(8)))),
child: Text(
signStr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
widget.need
? Positioned(
bottom: 0,
left: 0,
right: 0,
child: signStr.isEmpty
? Container()
: Stack(
alignment: Alignment.center,
children: [
Container(
width: ScreenUtil().setWidth(160),
height: ScreenUtil().setWidth(40),
alignment: Alignment.center,
decoration: BoxDecoration(
color: signStr == '已停用'
? MyColours.color_777777
: signStr == '已买单'
? MyColours.color_F59A23
: MyColours.color_E95750,
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(
ScreenUtil().setWidth(8)),
bottomRight: Radius.circular(
ScreenUtil().setWidth(8)))),
child: Text(
signStr,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(24),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
),
),
Positioned(
left: 0,
bottom: 0,
top: 0,
child: table.isPhoto == 1
? Image.asset(
"assets/photo.png",
width: ScreenUtil().setWidth(40),
// height: ScreenUtil().setWidth(40),
)
: Container())
],
),
),
Positioned(
left: 0,
bottom: 0,
top: 0,
child: table.isPhoto == 1
? Image.asset(
"assets/photo.png",
width: ScreenUtil().setWidth(40),
// height: ScreenUtil().setWidth(40),
)
: Container())
],
),
),
)
: SizedBox(),
],
),
),
... ... @@ -269,18 +273,20 @@ class TableItemState extends State<TableItem> {
height: ScreenUtil().setWidth(40),
)
: Container()),
signStr.isEmpty
? Positioned(
left: ScreenUtil().setWidth(8),
bottom: ScreenUtil().setWidth(16),
child: table.isPhoto == 1
? Image.asset(
"assets/photo.png",
width: ScreenUtil().setWidth(40),
height: ScreenUtil().setWidth(40),
)
: Container())
: Container()
widget.need
? signStr.isEmpty
? Positioned(
left: ScreenUtil().setWidth(8),
bottom: ScreenUtil().setWidth(16),
child: table.isPhoto == 1
? Image.asset(
"assets/photo.png",
width: ScreenUtil().setWidth(40),
height: ScreenUtil().setWidth(40),
)
: Container())
: Container()
: SizedBox()
],
),
);
... ...