Commit f07914e6b0a3a423c0d8be7e7310870393ff1fd3

Authored by “gaiyaguang”
2 parents 524556de 55eda948

返回and短信

... ... @@ -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 = "135"
def flutterVersionCode = "141"
if (flutterVersionCode == null) {
flutterVersionCode = '135'
flutterVersionCode = '141'
}
def flutterVersionName = "1.3.5"
def flutterVersionName = "1.4.1"
if (flutterVersionName == null) {
flutterVersionName = '1.3.5'
flutterVersionName = '1.4.1'
}
apply plugin: 'com.android.application'
... ...
... ... @@ -406,7 +406,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/RunnerProfile.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 134;
CURRENT_PROJECT_VERSION = 136;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -419,7 +419,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.3.4;
MARKETING_VERSION = 1.3.6;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -548,7 +548,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 134;
CURRENT_PROJECT_VERSION = 136;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -561,7 +561,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.3.4;
MARKETING_VERSION = 1.3.6;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -581,7 +581,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 134;
CURRENT_PROJECT_VERSION = 136;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -594,7 +594,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
MARKETING_VERSION = 1.3.4;
MARKETING_VERSION = 1.3.6;
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ...
... ... @@ -104,6 +104,14 @@ class NotebookDetail {
}
}
String get demandStr{
String demand="";
for(t.Table table in demands){
demand+=table.name+",";
}
return demand.substring(0,demand.length-1);
}
String get ddateMd {
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(ddate) * 1000);
... ...
... ... @@ -14,6 +14,7 @@ import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/need_item.dart';
import 'package:one_key/widgets/page_exception.dart';
import 'package:one_key/widgets/row_multi_text.dart';
... ... @@ -54,6 +55,10 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
String formatPhone = ""; //格式客户号码
bool isRefused = false; //是否已拒绝
bool isPause = false; //是否暂停预订
StateSetter refuseDialogState; //决绝弹框setState
@override
void initState() {
// TODO: implement initState
... ... @@ -86,7 +91,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
}
}
});
if (detailEntity.status != "0") {
if (detailEntity.status != "0" && !isPause) {
//已处理
Future.delayed(Duration(milliseconds: 200), () {
NavigatorUtil.goNotebookDetailPage(context, detailEntity.id,
... ... @@ -112,54 +117,216 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
}
//拒绝订单弹框
_showRefuseDialog() {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text("确定拒绝订单吗?\n拒绝后无法联系客户"),
titleTextStyle: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(32)),
content: Text("如果包间类型订满,请及时停用"),
contentTextStyle: TextStyle(
color: MyColours.color_828282,
fontSize: ScreenUtil().setSp(28)),
actions: <Widget>[
FlatButton(
child: Text(
"拒绝订单",
style: TextStyle(fontSize: ScreenUtil().setSp(32)),
_showRefuseDialog2() {
Widget dialogContent = StatefulBuilder(
builder: (context, setState) {
refuseDialogState = setState;
Container container = Container(
child: Stack(
alignment: AlignmentDirectional.topCenter,
children: [
Positioned(
right: 0,
top: ScreenUtil().setWidth(6),
child: GestureDetector(
child: Container(
padding: EdgeInsets.all(ScreenUtil().setWidth(21)),
child: Image.asset(
"assets/close.png",
width: ScreenUtil().setWidth(28),
height: ScreenUtil().setWidth(28),
),
),
onTap: () {
Navigator.of(context).pop();
},
),
onPressed: () {
Navigator.of(context).pop();
setReserveStatus("6");
},
),
FlatButton(
child: Text(
"去安排",
style: TextStyle(fontSize: ScreenUtil().setSp(32)),
Offstage(
offstage: isRefused,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
VEmptyView(40),
Text(
"拒绝订单",
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_353535,
fontWeight: FontWeight.bold),
),
VEmptyView(60),
Text(
"确定要拒绝订单吗?一旦拒绝无法恢复。",
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
color: MyColours.color_353535),
),
VEmptyView(80),
GestureDetector(
onTap: () {
setReserveStatus("6", ac: "1");
},
child: Container(
width: ScreenUtil().setWidth(336),
height: ScreenUtil().setWidth(80),
alignment: Alignment.center,
color: MyColours.color_199095,
child: Text(
"拒绝并暂停预订",
style: TextStyle(
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_ffffff),
),
),
),
VEmptyView(20),
GestureDetector(
onTap: () {
Navigator.of(context).pop();
setReserveStatus("6");
},
child: Container(
width: ScreenUtil().setWidth(336),
height: ScreenUtil().setWidth(80),
alignment: Alignment.center,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border.all(
color: MyColours.color_199095,
width: ScreenUtil().setWidth(2))),
child: Text(
"直接拒绝",
style: TextStyle(
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_199095),
),
),
),
VEmptyView(20),
GestureDetector(
onTap: () async {
Navigator.of(context).pop();
Map temp = await NavigatorUtil.goSelectTablePage(
context,
widget.rid,
int.parse(detailEntity.ddate) * 1000,
detailEntity.ddate_solt);
if (temp != null && temp['tid'] != null) {
setReserveStatus("5", tid: temp['tid']);
}
},
child: Container(
width: ScreenUtil().setWidth(336),
height: ScreenUtil().setWidth(80),
alignment: Alignment.center,
color: MyColours.color_ffffff,
child: Text(
"去安排包间",
style: TextStyle(
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_199095),
),
),
),
VEmptyView(44),
],
),
),
Offstage(
offstage: !isRefused,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
VEmptyView(98),
Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Image.asset(
"assets/icon_refuse_book.png",
width: ScreenUtil().setWidth(56),
height: ScreenUtil().setWidth(56),
),
HEmptyView(10),
Text(
"订单已拒绝",
style: TextStyle(
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_353535),
)
],
),
Offstage(
offstage: !isPause,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
VEmptyView(20),
Text(
"并已将${detailEntity.ddateMd}的${detailEntity.demandStr}置满",
style: TextStyle(
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_353535),
),
],
),
),
VEmptyView(120),
Text(
"如果有包间空出来或其他包间也满了,你可以:",
style: TextStyle(
fontSize: ScreenUtil().setSp(26),
color: MyColours.color_353535),
),
VEmptyView(20),
GestureDetector(
onTap: () {
Utils.goMiniProgramZm(context, "roomtype/roomtype");
},
child: Container(
width: ScreenUtil().setWidth(336),
height: ScreenUtil().setWidth(80),
alignment: Alignment.center,
color: MyColours.color_199095,
child: Text(
"去管理包间",
style: TextStyle(
fontSize: ScreenUtil().setSp(34),
color: MyColours.color_ffffff),
),
),
),
VEmptyView(60)
],
),
onPressed: () async {
Navigator.of(context).pop();
Map temp = await NavigatorUtil.goSelectTablePage(
context,
widget.rid,
int.parse(detailEntity.ddate) * 1000,
detailEntity.ddate_solt);
if (temp != null && temp['tid'] != null) {
setReserveStatus("5", tid: temp['tid']);
}
},
)
],
),
);
return container;
},
);
Widget dialog = Container(
width: double.infinity,
decoration: BoxDecoration(
color: MyColours.color_ffffff,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(ScreenUtil().setWidth(40)),
topRight: Radius.circular(ScreenUtil().setWidth(40)))),
child: dialogContent);
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (context) {
return Stack(
children: <Widget>[dialog],
);
});
}
//处理在线预订
setReserveStatus(String status, {String tid = ""}) async {
setReserveStatus(String status, {String tid = "", String ac = ""}) async {
bus.emit("remove_untreated_message", widget.mid);
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> causeMap = {
... ... @@ -174,10 +341,21 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
"mid": widget.mid,
"cause": json.encode(causeMap)
};
bool success =
await detailModel.setReserveStatus(context, params, showLoading: true);
if (status == "6") {
isPause = true;
params['ac'] = ac; //0=直接拒绝 1=拒绝并暂停预订
}
bool success = await detailModel.setReserveStatus(context, params,
ifPush: (isPause ? false : true), showLoading: true);
if (success != null && success) {
bus.emit("refresh_book_list");
if (status == "6") {
isRefused = true;
}
if (isPause) {
_getOrderListData();
refuseDialogState(() {});
}
}
}
... ... @@ -373,108 +551,119 @@ class HandleOnlinePageState extends State<HandleOnlinePage> {
)),
),
),
Container(
margin: EdgeInsets.only(
top: ScreenUtil().setHeight(30),
bottom: ScreenUtil().setHeight(30)),
child: Column(
children: <Widget>[
CommonButton(
content: "安排包间",
width: 669,
height: 84,
fontSize: 34,
onPress: () async {
Map map = await NavigatorUtil
.goSelectTablePage(
context,
widget.rid,
int.parse(detailEntity.ddate) *
1000,
detailEntity.ddate_solt);
if (map != null && map['tid'] != null) {
setReserveStatus("5",
tid: map['tid']);
}
},
),
VEmptyView(20),
Container(
width: ScreenUtil().setWidth(669),
height: ScreenUtil().setWidth(84),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10)),
Offstage(
offstage: detailEntity.status != "0",
child: Container(
margin: EdgeInsets.only(
top: ScreenUtil().setHeight(30),
bottom: ScreenUtil().setHeight(30)),
child: Column(
children: <Widget>[
CommonButton(
content: "安排包间",
width: 669,
height: 84,
fontSize: 34,
onPress: () async {
Map map = await NavigatorUtil
.goSelectTablePage(
context,
widget.rid,
int.parse(
detailEntity.ddate) *
1000,
detailEntity.ddate_solt);
if (map != null &&
map['tid'] != null) {
setReserveStatus("5",
tid: map['tid']);
}
},
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"拒绝订单",
style: TextStyle(
color:
MyColours.color_199095,
fontSize:
ScreenUtil().setSp(34)),
VEmptyView(20),
Container(
width: ScreenUtil().setWidth(669),
height: ScreenUtil().setWidth(84),
decoration: BoxDecoration(
border: Border.all(
color: MyColours.color_199095),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10)),
),
child: Row(
crossAxisAlignment:
CrossAxisAlignment.center,
children: <Widget>[
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"拒绝订单",
style: TextStyle(
color: MyColours
.color_199095,
fontSize: ScreenUtil()
.setSp(34)),
),
),
),
onTap: () {
_showRefuseDialog();
},
)),
Offstage(
offstage: !isCallTel,
child: SizedBox(
width: ScreenUtil().setWidth(335),
height: ScreenUtil().setWidth(84),
child: Row(
children: [
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil().setHeight(52),
color:
MyColours.color_199095,
),
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"联系顾客",
style: TextStyle(
color: MyColours
.color_199095,
fontSize:
ScreenUtil()
.setSp(34)),
),
onTap: () {
_showRefuseDialog2();
},
)),
Offstage(
offstage: !isCallTel,
child: SizedBox(
width:
ScreenUtil().setWidth(335),
height:
ScreenUtil().setWidth(84),
child: Row(
children: [
MyDivider(
ScreenUtil().setWidth(2),
ScreenUtil()
.setHeight(52),
color: MyColours
.color_199095,
),
onTap: () {
if (detailEntity.phone !=
null &&
detailEntity.phone
.isNotEmpty) {
Utils.goPhone(
detailEntity.phone);
} else {
Utils.showToast(
"没有客户电话!");
}
},
)),
],
Expanded(
child: GestureDetector(
child: Center(
child: Text(
"联系顾客",
style: TextStyle(
color: MyColours
.color_199095,
fontSize:
ScreenUtil()
.setSp(
34)),
),
),
onTap: () {
if (detailEntity
.phone !=
null &&
detailEntity.phone
.isNotEmpty) {
Utils.goPhone(
detailEntity
.phone);
} else {
Utils.showToast(
"没有客户电话!");
}
},
)),
],
),
),
),
)
],
),
)
],
)
],
),
)
],
),
),
)
],
... ...
... ... @@ -56,6 +56,8 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
int xgCount = 1; //注册信鸽次数,最多5次
DateTime lastBack;
@override
void initState() {
// TODO: implement initState
... ... @@ -302,31 +304,32 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Scaffold(
bottomNavigationBar: BottomNavigationBar(
iconSize: ScreenUtil().setWidth(48),
unselectedFontSize: ScreenUtil().setSp(22),
selectedFontSize: ScreenUtil().setSp(22),
backgroundColor: MyColours.color_ffffff,
items: [
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/message_default.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
activeIcon: Image(
image: AssetImage("assets/message_selected.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
title: Text(
"消息中心",
style: TextStyle(
color: _currIndex == 0 ? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
return new WillPopScope(
child: Scaffold(
bottomNavigationBar: BottomNavigationBar(
iconSize: ScreenUtil().setWidth(48),
unselectedFontSize: ScreenUtil().setSp(22),
selectedFontSize: ScreenUtil().setSp(22),
backgroundColor: MyColours.color_ffffff,
items: [
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/message_default.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
activeIcon: Image(
image: AssetImage("assets/message_selected.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
title: Text(
"消息中心",
style: TextStyle(
color: _currIndex == 0 ? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
),
),
),
// BottomNavigationBarItem(
// icon: Image(
// image: AssetImage("assets/message_default.png"),
... ... @@ -345,150 +348,162 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
// fontSize: ScreenUtil().setSp(22)),
// ),
// ),
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/notebook_default.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
activeIcon: Image(
image: AssetImage("assets/notebook_selected.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
title: Text(
"已预订",
style: TextStyle(
color: _currIndex == 1 ? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
),
),
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/tablemanage_default.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/notebook_default.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
activeIcon: Image(
image: AssetImage("assets/notebook_selected.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
title: Text(
"已预订",
style: TextStyle(
color: _currIndex == 1 ? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
),
),
activeIcon: Image(
image: AssetImage("assets/tablemanage_selected.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/tablemanage_default.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
activeIcon: Image(
image: AssetImage("assets/tablemanage_selected.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
title: Text(
"桌位",
style: TextStyle(
color: _currIndex == 2 ? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
),
),
title: Text(
"桌位",
style: TextStyle(
color: _currIndex == 2? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/my_default.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
activeIcon: Image(
image: AssetImage("assets/my_selected.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
title: Text(
"我的",
style: TextStyle(
color: _currIndex == 3 ? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
),
),
),
BottomNavigationBarItem(
icon: Image(
image: AssetImage("assets/my_default.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
activeIcon: Image(
image: AssetImage("assets/my_selected.png"),
width: ScreenUtil().setWidth(48),
height: ScreenUtil().setWidth(48),
),
title: Text(
"我的",
style: TextStyle(
color: _currIndex == 3 ? _activeColor : _defaultColor,
fontSize: ScreenUtil().setSp(22)),
),
),
],
type: BottomNavigationBarType.fixed,
currentIndex: _currIndex,
onTap: (int index) {
if (_currIndex != index) {
setState(() {
_currIndex = index;
});
if (_currIndex == 3) {
Utils.changeStatusColor(color: MyColours.color_199095);
} else {
Utils.changeStatusColor(color: MyColours.color_ffffff);
],
type: BottomNavigationBarType.fixed,
currentIndex: _currIndex,
onTap: (int index) {
if (_currIndex != index) {
setState(() {
_currIndex = index;
});
if (_currIndex == 3) {
Utils.changeStatusColor(color: MyColours.color_199095);
} else {
Utils.changeStatusColor(color: MyColours.color_ffffff);
}
}
}
},
},
),
// bottomNavigationBar: BottomAppBar(
// shape: CircularNotchedRectangle(),
// child: Container(
// height: ScreenUtil().setWidth(98),
// // padding: EdgeInsets.fromLTRB(0, 12, 0, 8),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// GestureDetector(
// onTap: () {
// // onTap(0);
// },
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Image(
// image: AssetImage("assets/my_selected.png"),
// width: ScreenUtil().setWidth(44),
// height: ScreenUtil().setWidth(44),
// ),
// Text(
// "我的",
// style: TextStyle(
// color: _currIndex == 2
// ? _activeColor
// : _defaultColor,
// fontSize: ScreenUtil().setSp(22)),
// )
// ],
// )),
// GestureDetector(
// onTap: () {
// // onTap(1);
// },
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Image(
// image: AssetImage("assets/my_selected.png"),
// width: ScreenUtil().setWidth(44),
// height: ScreenUtil().setWidth(44),
// ),
// Text(
// "我的",
// style: TextStyle(
// color: _currIndex == 2
// ? _activeColor
// : _defaultColor,
// fontSize: ScreenUtil().setSp(22)),
// )
// ],
// )),
// Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Image(
// image: AssetImage("assets/my_selected.png"),
// width: ScreenUtil().setWidth(44),
// height: ScreenUtil().setWidth(44),
// ),
// Text(
// "我的",
// style: TextStyle(
// color:
// _currIndex == 2 ? _activeColor : _defaultColor,
// fontSize: ScreenUtil().setSp(22)),
// )
// ],
// )
// ])),
// ),
body: pages[_currIndex],
),
// bottomNavigationBar: BottomAppBar(
// shape: CircularNotchedRectangle(),
// child: Container(
// height: ScreenUtil().setWidth(98),
// // padding: EdgeInsets.fromLTRB(0, 12, 0, 8),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.spaceAround,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: <Widget>[
// GestureDetector(
// onTap: () {
// // onTap(0);
// },
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Image(
// image: AssetImage("assets/my_selected.png"),
// width: ScreenUtil().setWidth(44),
// height: ScreenUtil().setWidth(44),
// ),
// Text(
// "我的",
// style: TextStyle(
// color: _currIndex == 2
// ? _activeColor
// : _defaultColor,
// fontSize: ScreenUtil().setSp(22)),
// )
// ],
// )),
// GestureDetector(
// onTap: () {
// // onTap(1);
// },
// child: Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Image(
// image: AssetImage("assets/my_selected.png"),
// width: ScreenUtil().setWidth(44),
// height: ScreenUtil().setWidth(44),
// ),
// Text(
// "我的",
// style: TextStyle(
// color: _currIndex == 2
// ? _activeColor
// : _defaultColor,
// fontSize: ScreenUtil().setSp(22)),
// )
// ],
// )),
// Column(
// mainAxisSize: MainAxisSize.min,
// children: <Widget>[
// Image(
// image: AssetImage("assets/my_selected.png"),
// width: ScreenUtil().setWidth(44),
// height: ScreenUtil().setWidth(44),
// ),
// Text(
// "我的",
// style: TextStyle(
// color:
// _currIndex == 2 ? _activeColor : _defaultColor,
// fontSize: ScreenUtil().setSp(22)),
// )
// ],
// )
// ])),
// ),
body: pages[_currIndex],
onWillPop: () async {
if (lastBack != null &&
DateTime.now().millisecondsSinceEpoch -
lastBack.millisecondsSinceEpoch <=
3000) {
return true;
}
lastBack = DateTime.now();
Utils.showToast("再次返回退出一键订");
return false;
},
);
}
... ...
... ... @@ -24,32 +24,58 @@ class MyPage extends StatefulWidget {
}
}
class MyPageState extends State<MyPage> {
class MyPageState extends State<MyPage> with WidgetsBindingObserver {
String cur_version = "";
bool newVersion = false;
String smsInfo = "";
MyModel myModel;
@override
void initState() {
// TODO: implement initState
super.initState();
WidgetsBinding.instance.addObserver(this);
Utils.getCurrVersion().then((version) {
setState(() {
cur_version = "v" + version;
});
});
WidgetsBinding.instance.addPostFrameCallback((_) async {
///获取短信余量
_getSmsInfo(context);
});
}
///获取短信余量
_getSmsInfo();
@override
void didChangeAppLifecycleState(AppLifecycleState state) async {
// TODO: implement didChangeAppLifecycleState
super.didChangeAppLifecycleState(state);
switch (state) {
case AppLifecycleState.resumed: //应用前台可见
_getSmsInfo(context);
break;
case AppLifecycleState.inactive:
print('inactive');
break;
case AppLifecycleState.paused:
print('paused');
break;
case AppLifecycleState.detached:
print('detached');
break;
default:
break;
}
}
///获取短信余量
_getSmsInfo() async {
MyModel myModel = Provider.of<MyModel>(context, listen: false);
SmsInfoData smsInfoData = await myModel.getSmsInfo(context);
setState(() {
smsInfo = smsInfoData?.lastNum;
});
_getSmsInfo(context) async {
await myModel.getSmsInfo(context);
// setState(() {
// if (smsInfoData != null) {
// smsInfo = smsInfoData?.lastNum;
// }
// });
}
//检查版本更新
... ... @@ -60,6 +86,7 @@ class MyPageState extends State<MyPage> {
@override
Widget build(BuildContext context) {
myModel = Provider.of<MyModel>(context, listen: true);
return Stack(
children: <Widget>[
Padding(
... ... @@ -69,9 +96,10 @@ class MyPageState extends State<MyPage> {
VEmptyView(40),
MyItem(
title: "短信管理",
content: smsInfo.isNotEmpty ? '剩余${smsInfo}条' : '',
content:
myModel.smsInfo.isNotEmpty ? '剩余${myModel.smsInfo}条' : '',
callback: () {
Utils.goMiniProgramZm(context);
Utils.goMiniProgramZm(context, "setting/sms");
},
),
MyDivider(
... ... @@ -83,7 +111,7 @@ class MyPageState extends State<MyPage> {
title: "包间类型置满管理",
content: "",
callback: () {
Utils.goMiniProgramZm(context);
Utils.goMiniProgramZm(context, "roomtype/roomtype");
},
),
VEmptyView(40),
... ...
... ... @@ -11,6 +11,8 @@ import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
class MyModel extends ChangeNotifier {
String smsInfo = '';
/// 短信余量查询及套餐查询接口
Future<SmsInfoData> getSmsInfo(BuildContext context) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
... ... @@ -31,8 +33,10 @@ class MyModel extends ChangeNotifier {
Utils.showToast(smsInfo.msg);
}
} else {
Utils.showToast('查询失败');
print('查询失败');
}
smsInfo = data.lastNum;
notifyListeners();
return data;
} catch (error) {
if (error is MyError) {
... ...
... ... @@ -80,12 +80,12 @@ class Utils {
}
//跳转小程序包间类型置满管理
static goMiniProgramZm(BuildContext context) {
static goMiniProgramZm(BuildContext context, String subPath) {
UserModel model = Provider.of<UserModel>(context, listen: false);
launchWeChatMiniProgram(
username: "gh_487873d353b3",
path:
"pack-book/pages/book/b_index?seller_id=${model.user.sellerid}&seller_openid=oGefL4qKBWIh5xwyg3LVfkMbDumA&manager_id=''&goPath=roomtype/roomtype",
"pack-book/pages/book/b_index?seller_id=${model.user.sellerid}&seller_openid=seller_openid&manager_id=&goPath=${subPath}",
miniProgramType: WXMiniProgramType.RELEASE);
}
... ...