Commit e98907032ea27a7589e12e564abc257396fc2e31

Authored by “gaiyaguang”
1 parent 47c73f25

接单时间管理

<<<<<<< HEAD
c71e777004aab201609920eac28801f9
=======
7babc7873f8d177769b987ba4c6c2911
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
7babc7873f8d177769b987ba4c6c2911
\ No newline at end of file
... ...
... ... @@ -152,4 +152,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa
COCOAPODS: 1.9.1
COCOAPODS: 1.9.3
... ...
... ... @@ -409,11 +409,7 @@
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
<<<<<<< HEAD
CURRENT_PROJECT_VERSION = 145;
=======
CURRENT_PROJECT_VERSION = 146;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -426,11 +422,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
<<<<<<< HEAD
MARKETING_VERSION = 1.4.5;
=======
MARKETING_VERSION = 1.4.6;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -559,11 +551,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
<<<<<<< HEAD
CURRENT_PROJECT_VERSION = 145;
=======
CURRENT_PROJECT_VERSION = 146;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -576,11 +564,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
<<<<<<< HEAD
MARKETING_VERSION = 1.4.5;
=======
MARKETING_VERSION = 1.4.6;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ... @@ -600,11 +584,7 @@
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
CODE_SIGN_STYLE = Automatic;
<<<<<<< HEAD
CURRENT_PROJECT_VERSION = 145;
=======
CURRENT_PROJECT_VERSION = 146;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
... ... @@ -617,11 +597,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
);
<<<<<<< HEAD
MARKETING_VERSION = 1.4.5;
=======
MARKETING_VERSION = 1.4.6;
>>>>>>> 4ecf950986f1856303c83ccacadc2b15efeb20ac
PRODUCT_BUNDLE_IDENTIFIER = com.naji.reserveLine;
PRODUCT_NAME = "一键订";
PROVISIONING_PROFILE_SPECIFIER = "";
... ...
... ... @@ -37,6 +37,7 @@ Future<void> main() async {
LogUtil.init(isDebug: true, tag: 'ONE_KEY');
Provider.debugCheckInvalidValueType = null;
await initializeDateFormatting();
Utils.changeStatusColor();
SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown])
.then((_) {
... ...
import 'package:json_annotation/json_annotation.dart';
part 'get_seller_info_model.g.dart';
@JsonSerializable()
class GetSellerInfoModel extends Object {
@JsonKey(name: 'ret')
int ret;
@JsonKey(name: 'data')
GetSellerInfoSunModel data;
@JsonKey(name: 'msg')
String msg;
GetSellerInfoModel(
this.ret,
this.data,
this.msg,
);
factory GetSellerInfoModel.fromJson(Map<String, dynamic> srcJson) =>
_$GetSellerInfoModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$GetSellerInfoModelToJson(this);
}
@JsonSerializable()
class GetSellerInfoSunModel extends Object {
@JsonKey(name: 'data')
Data data;
GetSellerInfoSunModel(
this.data,
);
factory GetSellerInfoSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$GetSellerInfoSunModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$GetSellerInfoSunModelToJson(this);
}
@JsonSerializable()
class Data extends Object {
@JsonKey(name: 'id')
String id;
@JsonKey(name: 'pid')
String pid;
@JsonKey(name: 'openid')
String openid;
@JsonKey(name: 'sellername')
String sellername;
@JsonKey(name: 'selleralias')
String selleralias;
@JsonKey(name: 'slogan')
String slogan;
@JsonKey(name: 'sellerdesc')
String sellerdesc;
@JsonKey(name: 'seller_logo')
String sellerLogo;
@JsonKey(name: 'seller_image')
String sellerImage;
@JsonKey(name: 'seller_tel')
String sellerTel;
@JsonKey(name: 'phone')
String phone;
@JsonKey(name: 'map_address')
String mapAddress;
@JsonKey(name: 'long')
String long;
@JsonKey(name: 'lat')
String lat;
@JsonKey(name: 'discount_type')
String discountType;
@JsonKey(name: 'last_num')
String lastNum;
@JsonKey(name: 'ispass')
String ispass;
@JsonKey(name: 'dis_ispass')
String disIspass;
@JsonKey(name: 'account_money')
String accountMoney;
@JsonKey(name: 'isopen_dc')
String isopenDc;
@JsonKey(name: 'isopen_md')
String isopenMd;
@JsonKey(name: 'dc_adduser_code')
String dcAdduserCode;
@JsonKey(name: 'average')
String average;
@JsonKey(name: 'is_online_reserve')
String isOnlineReserve;
@JsonKey(name: 'is_tele')
String isTele;
@JsonKey(name: 'daily')
String daily;
@JsonKey(name: 'daily_time')
String dailyTime;
@JsonKey(name: 'scale')
String scale;
@JsonKey(name: 'score')
String score;
@JsonKey(name: 'is_auth')
String isAuth;
@JsonKey(name: 'is_call_tel')
String isCallTel;
@JsonKey(name: 'rec_stime')
String recStime;
@JsonKey(name: 'rec_etime')
String recEtime;
@JsonKey(name: 'status')
String status;
@JsonKey(name: 'cdate')
String cdate;
@JsonKey(name: 'pro_code')
String proCode;
@JsonKey(name: 'city_code')
String cityCode;
@JsonKey(name: 'dis_code')
String disCode;
@JsonKey(name: 'seller_code')
String sellerCode;
Data(
this.id,
this.pid,
this.openid,
this.sellername,
this.selleralias,
this.slogan,
this.sellerdesc,
this.sellerLogo,
this.sellerImage,
this.sellerTel,
this.phone,
this.mapAddress,
this.long,
this.lat,
this.discountType,
this.lastNum,
this.ispass,
this.disIspass,
this.accountMoney,
this.isopenDc,
this.isopenMd,
this.dcAdduserCode,
this.average,
this.isOnlineReserve,
this.isTele,
this.daily,
this.dailyTime,
this.scale,
this.score,
this.isAuth,
this.isCallTel,
this.recStime,
this.recEtime,
this.status,
this.cdate,
this.proCode,
this.cityCode,
this.disCode,
this.sellerCode,
);
factory Data.fromJson(Map<String, dynamic> srcJson) =>
_$DataFromJson(srcJson);
Map<String, dynamic> toJson() => _$DataToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'get_seller_info_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
GetSellerInfoModel _$GetSellerInfoModelFromJson(Map<String, dynamic> json) {
return GetSellerInfoModel(
json['ret'] as int,
json['data'] == null
? null
: GetSellerInfoSunModel.fromJson(
json['data'] as Map<String, dynamic>),
json['msg'] as String);
}
Map<String, dynamic> _$GetSellerInfoModelToJson(GetSellerInfoModel instance) =>
<String, dynamic>{
'ret': instance.ret,
'data': instance.data,
'msg': instance.msg
};
GetSellerInfoSunModel _$GetSellerInfoSunModelFromJson(
Map<String, dynamic> json) {
return GetSellerInfoSunModel(json['data'] == null
? null
: Data.fromJson(json['data'] as Map<String, dynamic>));
}
Map<String, dynamic> _$GetSellerInfoSunModelToJson(
GetSellerInfoSunModel instance) =>
<String, dynamic>{'data': instance.data};
Data _$DataFromJson(Map<String, dynamic> json) {
return Data(
json['id'] as String,
json['pid'] as String,
json['openid'] as String,
json['sellername'] as String,
json['selleralias'] as String,
json['slogan'] as String,
json['sellerdesc'] as String,
json['seller_logo'] as String,
json['seller_image'] as String,
json['seller_tel'] as String,
json['phone'] as String,
json['map_address'] as String,
json['long'] as String,
json['lat'] as String,
json['discount_type'] as String,
json['last_num'] as String,
json['ispass'] as String,
json['dis_ispass'] as String,
json['account_money'] as String,
json['isopen_dc'] as String,
json['isopen_md'] as String,
json['dc_adduser_code'] as String,
json['average'] as String,
json['is_online_reserve'] as String,
json['is_tele'] as String,
json['daily'] as String,
json['daily_time'] as String,
json['scale'] as String,
json['score'] as String,
json['is_auth'] as String,
json['is_call_tel'] as String,
json['rec_stime'] as String,
json['rec_etime'] as String,
json['status'] as String,
json['cdate'] as String,
json['pro_code'] as String,
json['city_code'] as String,
json['dis_code'] as String,
json['seller_code'] as String);
}
Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{
'id': instance.id,
'pid': instance.pid,
'openid': instance.openid,
'sellername': instance.sellername,
'selleralias': instance.selleralias,
'slogan': instance.slogan,
'sellerdesc': instance.sellerdesc,
'seller_logo': instance.sellerLogo,
'seller_image': instance.sellerImage,
'seller_tel': instance.sellerTel,
'phone': instance.phone,
'map_address': instance.mapAddress,
'long': instance.long,
'lat': instance.lat,
'discount_type': instance.discountType,
'last_num': instance.lastNum,
'ispass': instance.ispass,
'dis_ispass': instance.disIspass,
'account_money': instance.accountMoney,
'isopen_dc': instance.isopenDc,
'isopen_md': instance.isopenMd,
'dc_adduser_code': instance.dcAdduserCode,
'average': instance.average,
'is_online_reserve': instance.isOnlineReserve,
'is_tele': instance.isTele,
'daily': instance.daily,
'daily_time': instance.dailyTime,
'scale': instance.scale,
'score': instance.score,
'is_auth': instance.isAuth,
'is_call_tel': instance.isCallTel,
'rec_stime': instance.recStime,
'rec_etime': instance.recEtime,
'status': instance.status,
'cdate': instance.cdate,
'pro_code': instance.proCode,
'city_code': instance.cityCode,
'dis_code': instance.disCode,
'seller_code': instance.sellerCode
};
... ...
... ... @@ -215,6 +215,7 @@ class DioUtil {
_data = _dataMap[_dataKey];
_responseData = _dataMap;
}
Loading.hideLoading(context);
return new BaseResp(_status, _code, _msg, _data, _responseData);
} catch (e) {
... ...
... ... @@ -38,5 +38,11 @@ class HttpUrl {
static const String set_switch_status =
"?service=App.Reserve.SetSwitchStatus"; //启用/停用桌位
static const String sms_info = "?service=App.SendSMS.SmsInfo"; //短信余量查询及套餐查询接口
static const String set_seller_info = "?service=App.Seller.SetSellerById"; // 根据商家ID获取商家信息
static const String set_seller_info =
"?service=App.Seller.SetSellerById"; // 根据商家ID设置商家信息
static const String get_seller_info =
"?service=App.Seller.GetSellerById"; // 根据商家ID获取商家信息
static const String set_order_time =
"?service=App.Seller.SetReOrderTime"; //在线预订配置-接单时间
}
... ...
... ... @@ -114,7 +114,9 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: _notebookDetailChangeModel.dateList.map((value) {
return CustomButton(
dateText: value['title'].toString().length<=5?value['title'].toString():value['title'].toString().substring(5),
dateText: value['title'].toString().length <= 5
? value['title'].toString()
: value['title'].toString().substring(5),
fontSize: value['fontSize'],
dayText: value['dayText'],
isImage: value['isImage'],
... ... @@ -838,7 +840,11 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
if (permissionStatus == PermissionStatus.neverAskAgain) {
//用户选择不在弹出权限提示框
print('never');
DialogUtil.openAlertDialog(context);
DialogUtil.openAlertDialog(
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置',340.0, onTap: () {
openSetting();
Navigator.pop(context, '');
});
} else {
// 申请权限
bool canContacts = await requestContactPermission();
... ... @@ -846,7 +852,12 @@ class _NoteBookChangePageState extends State<NoteBookChangePage> {
_getContactData();
} else {
//拒绝通讯录权限 , 苹果拒绝权限后,不再提示权限框,进入此处
DialogUtil.openAlertDialog(context);
DialogUtil.openAlertDialog(
context, '未获得通讯录权限', "请在手机的权限管理里,将通讯录权限开启", '去设置', 340.0,
onTap: () {
openSetting();
Navigator.pop(context, '');
});
}
}
} else {
... ...
... ... @@ -434,9 +434,9 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
_currIndex = index;
});
if (_currIndex == 3) {
Utils.changeStatusColor(color: MyColours.color_199095);
Utils.changeStatusColor(color: Colors.transparent);
} else {
Utils.changeStatusColor(color: MyColours.color_ffffff);
Utils.changeStatusColor(color: Colors.white);
}
}
},
... ...
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:webview_flutter/webview_flutter.dart';
... ... @@ -14,7 +15,9 @@ class WebPage extends StatelessWidget {
final Completer<WebViewController> _controller =
Completer<WebViewController>();
return Scaffold(
appBar: SystemAppBar(title),
appBar: SystemAppBar(title, onTap: () {
Navigator.of(context).pop();
}),
body: WebView(
initialUrl: "http://colorcun.com/privacy1.html",
javascriptMode: JavascriptMode.unrestricted,
... ... @@ -31,9 +34,7 @@ class WebPage extends StatelessWidget {
}
return NavigationDecision.navigate;
},
onPageStarted: (String url) {
},
onPageStarted: (String url) {},
onPageFinished: (String url) {
// Loading.hideLoading(context);
},
... ...
... ... @@ -8,10 +8,12 @@ import 'package:one_key/models/settime.dart';
import 'package:one_key/provider/book_set_time_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/h_empty_view.dart';
import 'package:one_key/widgets/set_time_widget.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
... ... @@ -28,7 +30,6 @@ class BookTimeSetPage extends StatefulWidget {
class _BookTimeSetPageState extends State<BookTimeSetPage> {
List swichState;
final GlobalKey<ScaffoldState> _scaffoldKey = GlobalKey<ScaffoldState>();
List dateData;
SetTime morning = SetTime();
SetTime noon = SetTime();
SetTime night = SetTime();
... ... @@ -44,80 +45,7 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
night.start = '16:00';
night.end = '21:00';
swichState = [false, true, true];
dateData = [
{
'深夜00时': [00, 30]
},
{
'深夜01时': [00, 30]
},
{
'深夜02时': [00, 30]
},
{
'深夜03时': [00, 30]
},
{
'深夜04时': [00, 30]
},
{
'深夜05时': [00, 30]
},
{
'早上06时': [00, 30]
},
{
'早上07时': [00, 30]
},
{
'早上08时': [00, 30]
},
{
'早上09时': [00, 30]
},
{
'中午10时': [00, 30]
},
{
'中午11时': [00, 30]
},
{
'中午12时': [00, 30]
},
{
'中午13时': [00, 30]
},
{
'中午14时': [00, 30]
},
{
'下午15时': [00, 30]
},
{
'下午16时': [00, 30]
},
{
'下午17时': [00, 30]
},
{
'下午18时': [00, 30]
},
{
'晚上19时': [00, 30]
},
{
'晚上20时': [00, 30]
},
{
'晚上21时': [00, 30]
},
{
'晚上22时': [00, 30]
},
{
'晚上23时': [00, 30]
}
];
WidgetsBinding.instance.addPostFrameCallback((_) {
_getDailyTime();
});
... ... @@ -156,14 +84,14 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
}
if (swichState[0] == false) {
if (model.daily.noon.isNotEmpty) {
_compareDateTime(noon.start, morning.end, (needChange) {
Utils.compareDateTime(noon.start, morning.end, (needChange) {
if (needChange) {
morning.end = noon.start;
} else {
morning.end = '10:00';
}
});
_compareDateTime(noon.start, morning.start, (needChange) {
Utils.compareDateTime(noon.start, morning.start, (needChange) {
if (needChange) {
morning.start = noon.start;
} else {
... ... @@ -171,14 +99,14 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
}
});
} else if (model.daily.night.isNotEmpty) {
_compareDateTime(night.start, morning.end, (needChange) {
Utils.compareDateTime(night.start, morning.end, (needChange) {
if (needChange) {
morning.end = night.start;
} else {
morning.end = '10:00';
}
});
_compareDateTime(night.start, morning.start, (needChange) {
Utils.compareDateTime(night.start, morning.start, (needChange) {
if (needChange) {
morning.start = night.start;
} else {
... ... @@ -189,18 +117,18 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
}
if (swichState[1] == false) {
if (model.daily.morning.isNotEmpty) {
_compareDateTime(noon.start, morning.end, (needChange) {
Utils.compareDateTime(noon.start, morning.end, (needChange) {
if (needChange) {
noon.start = morning.end;
} else {
noon.start = '11:00';
}
});
_compareDateTime(noon.end, morning.end, (needChange) {
Utils.compareDateTime(noon.end, morning.end, (needChange) {
if (needChange) {
noon.end = morning.end;
} else {
_compareDateTime(noon.end, night.start, (needChange) {
Utils.compareDateTime(noon.end, night.start, (needChange) {
if (needChange) {
noon.end = '14:30';
} else {
... ... @@ -211,12 +139,12 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
});
}
if (model.daily.night.isNotEmpty) {
_compareDateTime(noon.start, night.start, (needChange) {
Utils.compareDateTime(noon.start, night.start, (needChange) {
if (!needChange) {
noon.start = night.start;
}
});
_compareDateTime(noon.end, morning.start, (needChange) {
Utils.compareDateTime(noon.end, morning.start, (needChange) {
if (!needChange) {
noon.end = night.start;
}
... ... @@ -225,25 +153,33 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
}
if (swichState[2] == false) {
if (model.daily.noon.isNotEmpty) {
_compareDateTime(night.start, noon.end, (needChange) {
Utils.compareDateTime(night.start, noon.end, (needChange) {
if (needChange) {
night.start = noon.end;
night.end = noon.end;
Utils.compareDateTime(night.end, noon.end, (needChange) {
if (needChange) {
night.end = noon.end;
}
});
}
});
_compareDateTime(night.end, noon.start, (needChange) {
Utils.compareDateTime(night.end, noon.start, (needChange) {
if (needChange) {
night.end = noon.start;
}
});
} else if (model.daily.morning.isNotEmpty) {
_compareDateTime(night.start, morning.end, (needChange) {
Utils.compareDateTime(night.start, morning.end, (needChange) {
if (needChange) {
night.start = morning.end;
night.end = morning.end;
Utils.compareDateTime(night.end, noon.end, (needChange) {
if (needChange) {
night.end = morning.end;
}
});
}
});
_compareDateTime(night.start, morning.start, (needChange) {
Utils.compareDateTime(night.start, morning.start, (needChange) {
if (needChange) {
night.start = morning.start;
}
... ... @@ -297,19 +233,21 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
),
timeWidget('开始时间', startTime, highted: swichState[tag], onTap: () {
if (swichState[tag]) {
List data = dateData;
List data = SetTimeWidget.dateData;
if (tag == 0) {
//早市
data = dateData;
data = SetTimeWidget.dateData;
} else if (tag == 1) {
//午市
data = _getPickerData(morning.end);
data =
Utils.getPickerData(morning.end, SetTimeWidget.dateData);
} else if (tag == 2) {
//晚市
data = _getPickerData(noon.end);
data = Utils.getPickerData(noon.end, SetTimeWidget.dateData);
}
DialogUtil.showSelectCusmanDialog(context, data, (value) {
SetTimeWidget().showTimeSelector(context, data, startTime,
(value) {
if (value != null) {
String temp;
if (data.length == 1) {
... ... @@ -323,34 +261,37 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
}
print(data[value[0]].keys.first);
String time = _getTimeString(
_getHourFromTitle(data[value[0]].keys.first), temp);
String time = Utils.getTimeString(
Utils.getHourFromTitle(data[value[0]].keys.first),
temp);
setState(() {
if (tag == 0) {
//早市
morning.start = time;
setState(() {
_compareDateTime(morning.end, time, (needChange) {
Utils.compareDateTime(morning.end, time,
(needChange) {
if (needChange) {
morning.end = time;
}
});
_compareDateTime(noon.start, time, (needChange) {
Utils.compareDateTime(noon.start, time, (needChange) {
if (needChange) {
noon.start = time;
}
});
_compareDateTime(noon.end, time, (needChange) {
Utils.compareDateTime(noon.end, time, (needChange) {
if (needChange) {
noon.end = time;
}
});
_compareDateTime(night.start, time, (needChange) {
Utils.compareDateTime(night.start, time,
(needChange) {
if (needChange) {
night.start = time;
}
});
_compareDateTime(night.end, time, (needChange) {
Utils.compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
... ... @@ -360,17 +301,18 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
//午市
noon.start = time;
setState(() {
_compareDateTime(noon.end, time, (needChange) {
Utils.compareDateTime(noon.end, time, (needChange) {
if (needChange) {
noon.end = time;
}
});
_compareDateTime(night.start, time, (needChange) {
Utils.compareDateTime(night.start, time,
(needChange) {
if (needChange) {
night.start = time;
}
});
_compareDateTime(night.end, time, (needChange) {
Utils.compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
... ... @@ -380,7 +322,7 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
//晚市
night.start = time;
setState(() {
_compareDateTime(night.end, time, (needChange) {
Utils.compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
... ... @@ -390,11 +332,6 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
});
print(value);
}
}, selecteds: [
_getFirSelected(startTime, data),
_getSecSelected(startTime)
]).then((value) {
print(value);
});
}
}),
... ... @@ -408,18 +345,22 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
)),
timeWidget('结束时间', endTime, highted: swichState[tag], onTap: () {
if (swichState[tag]) {
List data = dateData;
List data = SetTimeWidget.dateData;
if (tag == 0) {
//早市
data = _getPickerData(morning.start);
data = Utils.getPickerData(
morning.start, SetTimeWidget.dateData);
} else if (tag == 1) {
//午市
data = _getPickerData(noon.start);
data =
Utils.getPickerData(noon.start, SetTimeWidget.dateData);
} else if (tag == 2) {
//晚市
data = _getPickerData(night.start);
data =
Utils.getPickerData(night.start, SetTimeWidget.dateData);
}
DialogUtil.showSelectCusmanDialog(context, data, (value) {
SetTimeWidget().showTimeSelector(context, data, startTime,
(value) {
if (value != null) {
String temp;
if (data.length == 1) {
... ... @@ -431,29 +372,31 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
temp = '30';
}
}
String time = _getTimeString(
_getHourFromTitle(data[value[0]].keys.first), temp);
String time = Utils.getTimeString(
Utils.getHourFromTitle(data[value[0]].keys.first),
temp);
setState(() {
if (tag == 0) {
//早市
morning.end = time;
setState(() {
_compareDateTime(noon.start, time, (needChange) {
Utils.compareDateTime(noon.start, time, (needChange) {
if (needChange) {
noon.start = time;
}
});
_compareDateTime(noon.end, time, (needChange) {
Utils.compareDateTime(noon.end, time, (needChange) {
if (needChange) {
noon.end = time;
}
});
_compareDateTime(night.start, time, (needChange) {
Utils.compareDateTime(night.start, time,
(needChange) {
if (needChange) {
night.start = time;
}
});
_compareDateTime(night.end, time, (needChange) {
Utils.compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
... ... @@ -463,12 +406,13 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
//午市
noon.end = time;
setState(() {
_compareDateTime(night.start, time, (needChange) {
Utils.compareDateTime(night.start, time,
(needChange) {
if (needChange) {
night.start = time;
}
});
_compareDateTime(night.end, time, (needChange) {
Utils.compareDateTime(night.end, time, (needChange) {
if (needChange) {
night.end = time;
}
... ... @@ -481,11 +425,6 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
});
print(value);
}
}, selecteds: [
_getFirSelected(endTime, data),
_getSecSelected(endTime)
]).then((value) {
print(value);
});
}
})
... ... @@ -493,89 +432,6 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
));
}
///工具
/// 组装成07:00
_getTimeString(dynamic hour, String minute) {
return '${hour}:${minute}';
}
/// 组装成 07:00-10:00
_getTimelLongString(String start, String end) {
return '${start}-${end}';
}
/// 从07:00中获取07
_getHourFromhourAndMinute(String hourAndMinute) {
return hourAndMinute.substring(0, 2);
}
///从深夜00时中获取00
_getHourFromTitle(String title) {
return title.substring(2, 4);
}
// 第一列当前选中第几个
_getFirSelected(String hourAndMinute, List data) {
String hour = _getHourFromhourAndMinute(hourAndMinute);
for (int i = 0; i < data.length; i++) {
Map map = data[i];
String key = map.keys.first;
if (key.contains(hour)) {
return i;
}
}
return 0;
}
// 第二列当前选中第几个
_getSecSelected(String hourAndMinute) {
String minute = _getMinuteFromhourAndMinute(hourAndMinute);
if (minute == '00') {
return 0;
}
return 1;
}
/// 0 还是 30
/// 从07:00中获取0 或者 30
_getMinuteFromhourAndMinute(String hourAndMinute) {
return hourAndMinute.substring(3, 5);
}
///获取选择器数据
_getPickerData(String lastTime) {
String hour = _getHourFromhourAndMinute(lastTime);
String minute = _getMinuteFromhourAndMinute(lastTime);
if (minute == '30') {
hour = '${int.parse(hour) + 1}';
}
List tempList = List();
tempList.addAll(dateData);
tempList.removeRange(0, int.parse(hour));
if (tempList.length == 0) {
tempList = [
{
'晚上23时': [30]
}
];
}
return tempList;
}
///判断时间大小
/// a < b 则 a = b
_compareDateTime(String a, String b, BookTimeSetCallback callback) {
String tempa = '${DateUtil.getNowDateStr().substring(0, 10)} ${a}:00';
String tempb = '${DateUtil.getNowDateStr().substring(0, 10)} ${b}:00';
int aMs = DateUtil.getDateMsByTimeStr(tempa);
int bMs = DateUtil.getDateMsByTimeStr(tempb);
if (aMs < bMs) {
callback(true);
} else {
callback(false);
}
}
///底部widget
///
_bottomWidget() {
... ... @@ -602,76 +458,90 @@ class _BookTimeSetPageState extends State<BookTimeSetPage> {
@override
Widget build(BuildContext context) {
bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true);
return Scaffold(
key: _scaffoldKey,
backgroundColor: MyColours.color_f5f5f5,
appBar: SystemAppBar('可订时段'),
body: SafeArea(
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
_itemWidget('早市', morning.start, morning.end, 0),
VEmptyView(20),
_itemWidget('午市', noon.start, noon.end, 1),
VEmptyView(20),
_itemWidget('晚市', night.start, night.end, 2),
_bottomWidget()
],
),
)),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(60)),
child: CommonButton(
width: double.infinity,
height: 84,
fontSize: 34,
content: '保存',
state: 2,
onPress: () async {
String morningStr = '';
String noonStr = '';
String nightStr = '';
if (swichState[0]) {
morningStr =
_getTimelLongString(morning.start, morning.end);
}
if (swichState[1]) {
noonStr = _getTimelLongString(noon.start, noon.end);
}
if (swichState[2]) {
nightStr = _getTimelLongString(night.start, night.end);
}
return WillPopScope(
child: Scaffold(
key: _scaffoldKey,
backgroundColor: MyColours.color_f5f5f5,
appBar: SystemAppBar(
'可订时段',
onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},
),
body: SafeArea(
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
_itemWidget('早市', morning.start, morning.end, 0),
VEmptyView(20),
_itemWidget('午市', noon.start, noon.end, 1),
VEmptyView(20),
_itemWidget('晚市', night.start, night.end, 2),
_bottomWidget()
],
),
)),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(60)),
child: CommonButton(
width: double.infinity,
height: 84,
fontSize: 34,
content: '保存',
state: 2,
onPress: () async {
String morningStr = '';
String noonStr = '';
String nightStr = '';
if (swichState[0]) {
morningStr = Utils.getTimelLongString(
morning.start, morning.end);
}
if (swichState[1]) {
noonStr =
Utils.getTimelLongString(noon.start, noon.end);
}
if (swichState[2]) {
nightStr =
Utils.getTimelLongString(night.start, night.end);
}
DialogUtil.confirmTimeAlertDialog(
context, morningStr, noonStr, nightStr, () async {
///接口
///
SetSellerInfoSunModel sunModel = await bookSetTimeModel
.setSellerInfoById(context, {
'morning': morningStr,
'noon': noonStr,
'night': nightStr
});
if (sunModel != null) {
//修改成功
Utils.showToast('保存成功');
Navigator.pop(context);
} else {
// Utils.showToast('保存失败');
}
});
},
))
],
)),
);
DialogUtil.confirmTimeAlertDialog(
context, morningStr, noonStr, nightStr, () async {
///接口
///
SetSellerInfoSunModel sunModel = await bookSetTimeModel
.setSellerInfoById(context, {
'morning': morningStr,
'noon': noonStr,
'night': nightStr
});
if (sunModel != null) {
//修改成功
Utils.showToast('保存成功');
EventBus().emit('changeStatusColor');
Navigator.pop(context);
} else {
// Utils.showToast('保存失败');
}
});
},
))
],
)),
),
onWillPop: () async {
EventBus().emit('changeStatusColor');
return true;
});
}
}
... ...
... ... @@ -6,6 +6,7 @@ import 'package:one_key/provider/my_model.dart';
import 'package:one_key/provider/update_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
... ... @@ -35,6 +36,7 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
void initState() {
// TODO: implement initState
super.initState();
controller = ScrollController(initialScrollOffset: 0.0);
WidgetsBinding.instance.addObserver(this);
Utils.getCurrVersion().then((version) {
... ... @@ -46,6 +48,16 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
///获取短信余量
_getSmsInfo(context);
});
EventBus().on('changeStatusColor', (arg) {
Utils.changeStatusColor(color: Colors.transparent);
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
EventBus().off('changeStatusColor');
}
@override
... ... @@ -103,229 +115,209 @@ class MyPageState extends State<MyPage> with WidgetsBindingObserver {
fontWeight: FontWeight.normal,
decoration: TextDecoration.none),
)),
body: NestedScrollView(
controller: controller,
headerSliverBuilder:
(BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverAppBar(
pinned: false,
floating: true,
expandedHeight: ScreenUtil().setWidth(242),
flexibleSpace: FlexibleSpaceBar(
collapseMode: CollapseMode.pin,
background: Container(
//头部整个背景颜色
// height: ScreenUtil().getAdapterSize(800),
child: Consumer<UserModel>(builder:
(BuildContext context, UserModel model,
Widget child) {
return Stack(
children: [
Container(
width: double.infinity,
height: ScreenUtil().setHeight(242 + 121),
alignment: Alignment.centerLeft,
color: MyColours.color_199095,
),
Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(40)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(38),
Text(
model.user.sellername,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(36)),
),
VEmptyView(38),
Text(
model.user.account +
" | " +
model.user.role_name,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(30)),
),
],
))
],
);
}))),
)
];
},
body: Consumer<UserModel>(
builder: (BuildContext context, UserModel model, Widget child) {
return SingleChildScrollView(
physics: NeverScrollableScrollPhysics(),
body: Consumer<UserModel>(
builder: (BuildContext context, UserModel model, Widget child) {
return MediaQuery.removePadding(
context: context,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
VEmptyView(40),
MyItem(
title: "短信管理",
content: myModel.smsInfo.isNotEmpty
? '剩余${myModel.smsInfo}条'
: '',
callback: () {
Utils.goMiniProgramZm(context, "setting/sms");
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "包间类型置满管理",
content: "",
callback: () {
Utils.goMiniProgramZm(context, "roomtype/roomtype");
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "可订时段管理",
content: "",
callback: () {
NavigatorUtil.goBookTimeSetPage(context);
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "接单时间管理",
content: "",
callback: () {
NavigatorUtil.goReceiveOrdersTimeSetPage(context);
},
),
VEmptyView(40),
MyItem(
title: "联系客服",
content: "09:00~21:00",
callback: () {
Utils.goPhone("400-000-9690");
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "帮助与反馈",
content: "",
callback: () {
Utils.goHelp(context);
},
children: <Widget>[
Stack(
children: [
Container(
width: double.infinity,
height: ScreenUtil().setHeight(200),
alignment: Alignment.centerLeft,
color: MyColours.color_199095,
),
MyDivider(double.infinity, ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3),
GestureDetector(
onTap: checkUpdate,
child: Container(
width: double.infinity,
height: ScreenUtil().setHeight(122),
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
alignment: Alignment.center,
child: Row(
children: <Widget>[
Padding(
padding:
EdgeInsets.only(left: ScreenUtil().setWidth(40)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
VEmptyView(38),
Text(
"版本更新",
model.user.sellername,
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_353535),
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(36)),
),
VEmptyView(38),
Text(
model.user.account +
" | " +
model.user.role_name,
style: TextStyle(
color: MyColours.color_ffffff,
fontSize: ScreenUtil().setSp(30)),
),
Spacer(),
newVersion
? Container(
width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(34),
decoration: BoxDecoration(
color: MyColours.color_E14553,
borderRadius: BorderRadius.all(
Radius.circular(
ScreenUtil().setWidth(6))),
),
child: Center(
child: Text(
"发现新版本",
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_ffffff),
),
),
)
: Text(
cur_version,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_666666),
),
HEmptyView(20),
Image.asset(
"assets/arr_right_gray.png",
width: ScreenUtil().setWidth(14),
height: ScreenUtil().setWidth(22),
)
],
))
],
),
VEmptyView(40),
MyItem(
title: "短信管理",
content: myModel.smsInfo.isNotEmpty
? '剩余${myModel.smsInfo}条'
: '',
callback: () {
Utils.goMiniProgramZm(context, "setting/sms");
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "包间类型置满管理",
content: "",
callback: () {
Utils.goMiniProgramZm(context, "roomtype/roomtype");
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "可订时段管理",
content: "",
callback: () {
NavigatorUtil.goBookTimeSetPage(context);
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "接单时间管理",
content: "",
callback: () {
NavigatorUtil.goReceiveOrdersTimeSetPage(context);
},
),
VEmptyView(40),
MyItem(
title: "联系客服",
content: "09:00~21:00",
callback: () {
Utils.goPhone("400-000-9690");
},
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
MyItem(
title: "帮助与反馈",
content: "",
callback: () {
Utils.goHelp(context);
},
),
MyDivider(double.infinity, ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3),
GestureDetector(
onTap: checkUpdate,
child: Container(
width: double.infinity,
height: ScreenUtil().setHeight(122),
color: MyColours.color_ffffff,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
alignment: Alignment.center,
child: Row(
children: <Widget>[
Text(
"版本更新",
style: TextStyle(
fontSize: ScreenUtil().setSp(30),
color: MyColours.color_353535),
),
),
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
VEmptyView(40),
Consumer<UserModel>(
builder: (BuildContext context, UserModel model,
Widget child) {
return GestureDetector(
onTap: () {
model.showLoginOutDialog(context);
},
child: Container(
height: ScreenUtil().setHeight(122),
color: MyColours.color_ffffff,
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
"assets/icon_exist.png",
width: ScreenUtil().setWidth(30),
height: ScreenUtil().setWidth(30),
Spacer(),
newVersion
? Container(
width: ScreenUtil().setWidth(120),
height: ScreenUtil().setWidth(34),
decoration: BoxDecoration(
color: MyColours.color_E14553,
borderRadius: BorderRadius.all(
Radius.circular(
ScreenUtil().setWidth(6))),
),
child: Center(
child: Text(
"发现新版本",
style: TextStyle(
fontSize: ScreenUtil().setSp(24),
color: MyColours.color_ffffff),
),
HEmptyView(18),
Text("退出登录",
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(34),
))
],
),
)
: Text(
cur_version,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_666666),
),
),
),
);
HEmptyView(20),
Image.asset(
"assets/arr_right_gray.png",
width: ScreenUtil().setWidth(14),
height: ScreenUtil().setWidth(22),
)
],
),
),
),
MyDivider(
double.infinity,
ScreenUtil().setHeight(1),
color: MyColours.color_f3f3f3,
),
VEmptyView(40),
Consumer<UserModel>(
builder:
(BuildContext context, UserModel model, Widget child) {
return GestureDetector(
onTap: () {
model.showLoginOutDialog(context);
},
)
],
));
})));
child: Container(
height: ScreenUtil().setHeight(122),
color: MyColours.color_ffffff,
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
"assets/icon_exist.png",
width: ScreenUtil().setWidth(30),
height: ScreenUtil().setWidth(30),
),
HEmptyView(18),
Text("退出登录",
style: TextStyle(
color: MyColours.color_199095,
fontSize: ScreenUtil().setSp(34),
))
],
),
),
),
);
},
)
],
)));
}));
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/get_seller_info_model.dart';
import 'package:one_key/models/settime.dart';
import 'package:one_key/pages/my/book_time_set.dart';
import 'package:one_key/provider/book_set_time_model.dart';
import 'package:one_key/res/colors.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/common_button.dart';
import 'package:one_key/widgets/set_time_widget.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 ReceiveOrdersTimeSetPage extends StatefulWidget {
ReceiveOrdersTimeSetPage({Key key}) : super(key: key);
... ... @@ -18,76 +25,160 @@ class ReceiveOrdersTimeSetPage extends StatefulWidget {
class _ReceiveOrdersTimeSetPageState extends State<ReceiveOrdersTimeSetPage> {
SetTime receiveOrdersTime = SetTime();
BookSetTimeModel bookSetTimeModel;
@override
void initState() {
super.initState();
receiveOrdersTime.start = '08:00';
receiveOrdersTime.end = '23:00';
WidgetsBinding.instance.addPostFrameCallback((_) {
// _getDailyTime();
_getReceiveOrdersTime();
});
}
///获取接单时间接口
_getReceiveOrdersTime() async {
GetSellerInfoSunModel model = await bookSetTimeModel.getSellerById(context);
setState(() {
receiveOrdersTime.start = model.data.recStime;
receiveOrdersTime.end = model.data.recEtime;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColours.color_f5f5f5,
appBar: SystemAppBar('接单时间'),
body: SafeArea(
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: ScreenUtil().setWidth(126 * 2),
color: MyColours.color_ffffff,
child: Column(
children: [
timeWidget('开始时间', '07:00', highted: true, onTap: () {}),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: MyDivider(
double.infinity,
ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3,
)),
timeWidget('结束时间', '07:00', highted: true, onTap: () {}),
],
),
),
VEmptyView(60),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: textWidget('温馨提示:'),
bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true);
return WillPopScope(
child: Scaffold(
backgroundColor: MyColours.color_f5f5f5,
appBar: SystemAppBar(
'接单时间',
onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},
),
body: SafeArea(
child: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: ScreenUtil().setWidth(126 * 2),
color: MyColours.color_ffffff,
child: Column(
children: [
timeWidget('开始时间', receiveOrdersTime.start,
highted: true, onTap: () {
SetTimeWidget().showTimeSelector(
context,
SetTimeWidget.dateData,
receiveOrdersTime.start, (value) {
if (value != null) {
String temp;
if (value[1] == 0) {
temp = '00';
} else {
temp = '30';
}
String time = Utils.getTimeString(
Utils.getHourFromTitle(SetTimeWidget
.dateData[value[0]].keys.first),
temp);
setState(() {
receiveOrdersTime.start = time;
});
}
});
}),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: MyDivider(
double.infinity,
ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3,
)),
timeWidget('结束时间', receiveOrdersTime.end,
highted: true, onTap: () {
SetTimeWidget().showTimeSelector(
context,
SetTimeWidget.dateData,
receiveOrdersTime.end, (value) {
if (value != null) {
String temp;
if (value[1] == 0) {
temp = '00';
} else {
temp = '30';
}
String time = Utils.getTimeString(
Utils.getHourFromTitle(SetTimeWidget
.dateData[value[0]].keys.first),
temp);
setState(() {
receiveOrdersTime.end = time;
});
}
});
}),
],
),
),
VEmptyView(60),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: textWidget('温馨提示:'),
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: textWidget('修改接单时间后,必须重启话机才能正常生效。'))
],
),
VEmptyView(10),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40)),
child: textWidget('修改接单时间后,必须重启话机才能正常生效。'))
],
),
)),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(60)),
child: CommonButton(
width: double.infinity,
height: 84,
fontSize: 34,
content: '保存',
state: 2,
onPress: () async {
bool isSuccess = await bookSetTimeModel.setReOrderTime(
context,
receiveOrdersTime.start,
receiveOrdersTime.end);
if (isSuccess) {
///弹出提示框
///
DialogUtil.openAlertDialog(
context, '接单时间已修改', '需要重启电话机才能生效', '知道了', 295,
onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
Navigator.of(context).pop();
});
}
},
))
],
)),
Padding(
padding: EdgeInsets.fromLTRB(
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(0),
ScreenUtil().setWidth(40),
ScreenUtil().setWidth(60)),
child: CommonButton(
width: double.infinity,
height: 84,
fontSize: 34,
content: '保存',
state: 2,
onPress: () async {},
))
],
)),
);
),
onWillPop: () async {
EventBus().emit('changeStatusColor');
return true;
});
}
}
... ...
... ... @@ -2,28 +2,29 @@ import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:one_key/utils/event_bus.dart';
import 'package:one_key/widgets/app_bar.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:webview_flutter/webview_flutter.dart';
class WebViewPage extends StatefulWidget {
@override
_WebViewPageState createState() => _WebViewPageState();
}
class _WebViewPageState extends State<WebViewPage> {
final Completer<WebViewController> _controller =
Completer<WebViewController>();
Completer<WebViewController>();
@override
Widget build(BuildContext context) {
return Scaffold(
// We're using a Builder here so we have a context that is below the Scaffold
// to allow calling Scaffold.of(context) so we can show a snackbar.
appBar: AppBar(
title: const Text('一键订'),
// This drop down menu demonstrates that Flutter widgets can be shown over the web view.
),
appBar: SystemAppBar('一键订',onTap: () {
EventBus().emit('changeStatusColor');
Navigator.of(context).pop();
},),
body: Builder(builder: (BuildContext context) {
return WebView(
initialUrl: "https://support.qq.com/product/152856",
... ... @@ -65,5 +66,4 @@ class _WebViewPageState extends State<WebViewPage> {
);
});
}
}
\ No newline at end of file
}
... ...
... ... @@ -2,9 +2,9 @@ import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/get_seller_info_model.dart';
import 'package:one_key/models/seller_info.dart';
import 'package:one_key/models/set_seller_info_model.dart';
import 'package:one_key/models/settime.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
import 'package:one_key/net/http_url.dart';
... ... @@ -75,4 +75,68 @@ class BookSetTimeModel with ChangeNotifier {
return itemModel;
}
}
///根据商家ID获取商家信息
Future<GetSellerInfoSunModel> getSellerById(BuildContext context) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {
"sellerid": userModel.user.sellerid,
};
BaseResp<Map<String, dynamic>> baseResp = await DioUtil()
.request<Map<String, dynamic>>(
context, Method.get, HttpUrl.get_seller_info,
data: params)
.catchError((error) {
print(error.toString());
});
GetSellerInfoSunModel itemModel;
if (baseResp == null) return itemModel;
if (baseResp.code == Constant.status_success) {
if (int.parse(baseResp.status) != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "");
return itemModel;
}
if (baseResp.responseData['data'] != null) {
itemModel = GetSellerInfoModel.fromJson(baseResp.responseData).data;
} else {
Utils.showToast(baseResp.msg ?? "");
}
return itemModel;
}
}
///在线预订配置-接单时间
Future<bool> setReOrderTime(
BuildContext context, String start, String end) async {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, dynamic> params = {
"sellerid": int.parse(userModel.user.sellerid),
"start": start,
'end': end
};
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_order_time,
data: params)
.catchError((error) {
print(error.toString());
});
if (baseResp == null) return false;
if (baseResp.code == Constant.status_success) {
if (int.parse(baseResp.status) != Constant.status_success) {
Utils.showToast(baseResp.msg ?? "");
return false;
}
if (baseResp.responseData['ret'] == 200) {
// if (baseResp.responseData['data'] == 0) {
return true;
// } else {
// return false;
// }
} else {
Utils.showToast(baseResp.msg ?? "");
return false;
}
}
}
}
... ...
... ... @@ -145,7 +145,7 @@ var handleBookTimeSetHandler = new Handler(
create: (_) => BookSetTimeModel(), child: BookTimeSetPage());
});
// 跳转可订时段管理页面
// 跳转接单时间管理
var handleReceiveOrdersTimeSetHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
return ChangeNotifierProvider<BookSetTimeModel>(
... ...
... ... @@ -683,14 +683,16 @@ class DialogUtil {
});
}
static Future openAlertDialog(BuildContext context) async {
static Future openAlertDialog(BuildContext context, String title,
String content, String btnTitle, double height,
{GestureTapCallback onTap}) async {
final action = await showDialog(
context: context,
barrierDismissible: true,
builder: (BuildContext context) {
return Center(
child: Container(
height: ScreenUtil().setWidth(160 * 2 + 20),
height: ScreenUtil().setWidth(height),
width: ScreenUtil().setWidth(280 * 2),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(ScreenUtil().setWidth(30))),
... ... @@ -704,7 +706,7 @@ class DialogUtil {
Container(
height: ScreenUtil().setWidth(48),
alignment: Alignment.center,
child: Text('未获得通讯录权限',
child: Text(title,
style: TextStyle(
fontSize: ScreenUtil().setSp(36),
color: MyColours.color_353535)),
... ... @@ -723,7 +725,7 @@ class DialogUtil {
ScreenUtil()
.setWidth(2)), //1为 StrutStyle 的 leading的值
child: Text(
"请在手机的权限管理里,将通讯录权限开启",
content,
style: TextStyle(
color: MyColours.color_353535,
fontSize: ScreenUtil().setSp(28),
... ... @@ -743,16 +745,13 @@ class DialogUtil {
height: ScreenUtil().setWidth(47 * 2),
alignment: Alignment.center,
child: Text(
'去设置',
btnTitle,
style: TextStyle(
color: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setWidth(34)),
),
),
onTap: () {
openSetting();
Navigator.pop(context, '');
},
onTap: onTap,
)
],
),
... ... @@ -761,20 +760,6 @@ class DialogUtil {
);
},
);
switch (action) {
// case Action.Ok:
// setState(() {
// _choice = 'Ok';
// });
// break;
// case Action.Cancel:
// setState(() {
// _choice = 'Cancel';
// });
// break;
// default:
}
}
///时段设置提示弹框
... ...
... ... @@ -18,9 +18,12 @@ import 'package:webview_flutter/webview_flutter.dart';
import '../app.dart';
typedef BookTimeSetCallback = void Function(bool needChange);
class Utils {
static void showToast(String msg) {
Fluttertoast.showToast(msg: msg, toastLength:Toast.LENGTH_LONG,gravity: ToastGravity.CENTER);
Fluttertoast.showToast(
msg: msg, toastLength: Toast.LENGTH_LONG, gravity: ToastGravity.CENTER);
}
//本地图片资源路径
... ... @@ -199,4 +202,64 @@ class Utils {
}
return pnum;
}
///工具
/// 组装成07:00
static getTimeString(dynamic hour, String minute) {
return '${hour}:${minute}';
}
/// 组装成 07:00-10:00
static getTimelLongString(String start, String end) {
return '${start}-${end}';
}
/// 从07:00中获取07
static getHourFromhourAndMinute(String hourAndMinute) {
return hourAndMinute.substring(0, 2);
}
///从深夜00时中获取00
static getHourFromTitle(String title) {
return title.substring(2, 4);
}
/// 0 还是 30
/// 从07:00中获取0 或者 30
static getMinuteFromhourAndMinute(String hourAndMinute) {
return hourAndMinute.substring(3, 5);
}
/// a < b 则 a = b
static compareDateTime(String a, String b, BookTimeSetCallback callback) {
String tempa = '${DateUtil.getNowDateStr().substring(0, 10)} ${a}:00';
String tempb = '${DateUtil.getNowDateStr().substring(0, 10)} ${b}:00';
int aMs = DateUtil.getDateMsByTimeStr(tempa);
int bMs = DateUtil.getDateMsByTimeStr(tempb);
if (aMs < bMs) {
callback(true);
} else {
callback(false);
}
}
///获取时间选择器数据
static getPickerData(String lastTime, List dateData) {
String hour = Utils.getHourFromhourAndMinute(lastTime);
String minute = Utils.getMinuteFromhourAndMinute(lastTime);
if (minute == '30') {
hour = '${int.parse(hour) + 1}';
}
List tempList = List();
tempList.addAll(dateData);
tempList.removeRange(0, int.parse(hour));
if (tempList.length == 0) {
tempList = [
{
'晚上23时': [30]
}
];
}
return tempList;
}
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/utils.dart';
typedef SetTimeCallback = void Function(List value);
class SetTimeWidget {
static List dateData = [
{
'深夜00时': [00, 30]
},
{
'深夜01时': [00, 30]
},
{
'深夜02时': [00, 30]
},
{
'深夜03时': [00, 30]
},
{
'深夜04时': [00, 30]
},
{
'深夜05时': [00, 30]
},
{
'早上06时': [00, 30]
},
{
'早上07时': [00, 30]
},
{
'早上08时': [00, 30]
},
{
'早上09时': [00, 30]
},
{
'中午10时': [00, 30]
},
{
'中午11时': [00, 30]
},
{
'中午12时': [00, 30]
},
{
'中午13时': [00, 30]
},
{
'中午14时': [00, 30]
},
{
'下午15时': [00, 30]
},
{
'下午16时': [00, 30]
},
{
'下午17时': [00, 30]
},
{
'下午18时': [00, 30]
},
{
'晚上19时': [00, 30]
},
{
'晚上20时': [00, 30]
},
{
'晚上21时': [00, 30]
},
{
'晚上22时': [00, 30]
},
{
'晚上23时': [00, 30]
}
];
showTimeSelector(context, data, hourAndMinute, SetTimeCallback setTimeCallback) {
DialogUtil.showSelectCusmanDialog(context, data, (value) {
setTimeCallback(value);
}, selecteds: [
_getFirSelected(hourAndMinute, data),
_getSecSelected(hourAndMinute)
]).then((value) {
print(value);
});
}
// 第一列当前选中第几个
_getFirSelected(String hourAndMinute, List data) {
String hour = Utils.getHourFromhourAndMinute(hourAndMinute);
for (int i = 0; i < data.length; i++) {
Map map = data[i];
String key = map.keys.first;
if (key.contains(hour)) {
return i;
}
}
return 0;
}
// 第二列当前选中第几个
_getSecSelected(String hourAndMinute) {
String minute = Utils.getMinuteFromhourAndMinute(hourAndMinute);
if (minute == '00') {
return 0;
}
return 1;
}
}
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/res/colors.dart';
... ... @@ -16,9 +15,7 @@ class SystemAppBar extends StatelessWidget implements PreferredSizeWidget {
return AppBar(
elevation: 0,
leading: InkWell(
onTap: () {
Navigator.of(context).pop();
},
onTap: onTap,
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
... ...