Commit 497bdbda0518f61cc02f7b86361ec0d5694a1846

Authored by wdn127929
1 parent 7292c82a

包间类型

... ... @@ -264,7 +264,7 @@ SPEC CHECKSUMS:
video_compress: fce97e4fb1dfd88175aa07d2ffc8a2f297f87fbe
video_player: 9cc823b1d9da7e8427ee591e8438bfbcde500e6e
wakelock: 0d4a70faf8950410735e3f61fb15d517c8a6efc4
webview_flutter: d2b4d6c66968ad042ad94cbb791f5b72b4678a96
webview_flutter: 3603125dfd3bcbc9d8d418c3f80aeecf331c068b
WechatOpenSDK: 6a4d1436c15b3b5fe2a0bd383f3046010186da44
PODFILE CHECKSUM: a75497545d4391e2d394c3668e20cfb1c2bbd4aa
... ...
... ... @@ -482,7 +482,7 @@
CURRENT_PROJECT_VERSION = 296;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_MODE = release;
FLUTTER_BUILD_MODE = debug;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
... ... @@ -627,7 +627,7 @@
CURRENT_PROJECT_VERSION = 296;
DEVELOPMENT_TEAM = 8J59HM8B82;
ENABLE_BITCODE = NO;
FLUTTER_BUILD_MODE = release;
FLUTTER_BUILD_MODE = debug;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/Flutter",
... ...
... ... @@ -9,8 +9,10 @@ import 'package:flutter_bugly/flutter_bugly.dart';
import 'package:flutter_easyrefresh/ball_pulse_footer.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_easyrefresh/material_header.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:fluwx/fluwx.dart';
import 'package:one_key/pages/detail/handle_online_page.dart';
import 'package:one_key/pages/home/home_page.dart';
import 'package:one_key/provider/base_info_provider.dart';
import 'package:one_key/provider/coupon_provider.dart';
import 'package:one_key/provider/create_store_model.dart';
... ... @@ -104,6 +106,7 @@ Future<void> main() async {
child: MyApp(),
));
});
await App.initSp();
await AmapService.instance.init(
iosKey: 'e373581528f8fd901c01dfbda236159e',
androidKey: 'dbced781d0acd36184d5b4b54da7188d');
... ... @@ -124,6 +127,7 @@ class MyApp extends StatefulWidget {
class MyAppState extends State<MyApp> {
int xgCount = 1; //注册信鸽次数,最多5次
bool isLogin = false;
@override
void initState() {
... ... @@ -131,6 +135,7 @@ class MyAppState extends State<MyApp> {
super.initState();
initDio();
_initFluwx();
_isLogin();
Utils.changeStatusColor();
// 设置EasyRefresh的默认样式
EasyRefresh.defaultHeader = MaterialHeader();
... ... @@ -163,8 +168,16 @@ class MyAppState extends State<MyApp> {
DioUtil().setConfig(config);
}
//判断是否登录
bool _isLogin() {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
userModel.initUser();
isLogin = App.sp.getBool("isLogin") ?? false;
}
@override
Widget build(BuildContext context) {
// TODO: implement build
return MaterialApp(
debugShowCheckedModeBanner: false,
... ... @@ -177,8 +190,10 @@ class MyAppState extends State<MyApp> {
textTheme:
TextTheme(overline: TextStyle(decoration: TextDecoration.none)),
tooltipTheme: TooltipThemeData(verticalOffset: -100000)),
home: ChangeNotifierProvider<OtherLoginProvider>(
create: (_) => OtherLoginProvider(), child: LoginPage()),
home: isLogin
? HomePage(initialIndex: 2)
: ChangeNotifierProvider<OtherLoginProvider>(
create: (_) => OtherLoginProvider(), child: LoginPage()),
onGenerateRoute: App.router.generator,
);
}
... ...
... ... @@ -159,47 +159,50 @@ class Data extends Object {
@JsonKey(name: 'seller_code')
String sellerCode;
@JsonKey(name: 'real_address')
String realAddress;
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,
);
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,
this.realAddress);
factory Data.fromJson(Map<String, dynamic> srcJson) =>
_$DataFromJson(srcJson);
... ...
... ... @@ -36,45 +36,47 @@ Map<String, dynamic> _$GetSellerInfoSunModelToJson(
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);
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,
json['real_address'] as String,
);
}
Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{
... ... @@ -116,5 +118,6 @@ Map<String, dynamic> _$DataToJson(Data instance) => <String, dynamic>{
'pro_code': instance.proCode,
'city_code': instance.cityCode,
'dis_code': instance.disCode,
'seller_code': instance.sellerCode
'seller_code': instance.sellerCode,
'real_address': instance.realAddress
};
... ...
import 'package:json_annotation/json_annotation.dart';
part 'table_class_model.g.dart';
@JsonSerializable()
class TableClassModel extends Object {
@JsonKey(name: 'ret')
int ret;
@JsonKey(name: 'data')
TableClassSunModel data;
@JsonKey(name: 'msg')
String msg;
TableClassModel(
this.ret,
this.data,
this.msg,
);
factory TableClassModel.fromJson(Map<String, dynamic> srcJson) =>
_$TableClassModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$TableClassModelToJson(this);
}
@JsonSerializable()
class TableClassSunModel extends Object {
@JsonKey(name: 'id')
String id;
@JsonKey(name: 'sellerid')
String sellerid;
@JsonKey(name: 'tableid')
String tableid;
@JsonKey(name: 'name')
String name;
@JsonKey(name: 'max')
String max;
@JsonKey(name: 'low')
String low;
@JsonKey(name: 'standard')
String standard;
@JsonKey(name: 'status')
String status;
@JsonKey(name: 'cdate')
String cdate;
TableClassSunModel(
this.id,
this.sellerid,
this.tableid,
this.name,
this.max,
this.low,
this.standard,
this.status,
this.cdate,
);
factory TableClassSunModel.fromJson(Map<String, dynamic> srcJson) =>
_$TableClassSunModelFromJson(srcJson);
Map<String, dynamic> toJson() => _$TableClassSunModelToJson(this);
}
... ...
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'table_class_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
TableClassModel _$TableClassModelFromJson(Map<String, dynamic> json) {
return TableClassModel(
json['ret'] as int,
json['data'] == null
? null
: TableClassSunModel.fromJson(json['data'] as Map<String, dynamic>),
json['msg'] as String,
);
}
Map<String, dynamic> _$TableClassModelToJson(TableClassModel instance) =>
<String, dynamic>{
'ret': instance.ret,
'data': instance.data,
'msg': instance.msg,
};
TableClassSunModel _$TableClassSunModelFromJson(Map<String, dynamic> json) {
return TableClassSunModel(
json['id'] as String,
json['sellerid'] as String,
json['tableid'] as String,
json['name'] as String,
json['max'] as String,
json['low'] as String,
json['standard'] as String,
json['status'] as String,
json['cdate'] as String,
);
}
Map<String, dynamic> _$TableClassSunModelToJson(TableClassSunModel instance) =>
<String, dynamic>{
'id': instance.id,
'sellerid': instance.sellerid,
'tableid': instance.tableid,
'name': instance.name,
'max': instance.max,
'low': instance.low,
'standard': instance.standard,
'status': instance.status,
'cdate': instance.cdate,
};
... ...
... ... @@ -11,6 +11,7 @@ class UploadImgModel {
String duration; //视频时长
bool isUpload; //桌面图片管理 ----- 图片是否上传到后台服务器
String photoID; //桌面图片管理 ID
String path;
}
enum FileType {
... ...
... ... @@ -135,4 +135,9 @@ class HttpUrl {
static const String app_pay_sub =
"?service=App.Pay.AppPaySub"; // 根据指定日期,返回当前商家包间类型置满情况的日期
static const String get_table_class_by_id =
"?service=App.Seller.GetTableClassById"; // 获取包间分类
static const String set_table_class =
"?service=App.Seller.SetTableClass"; // 添加/修改包间分类
}
... ...
... ... @@ -7,6 +7,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/utils/misc.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:permission_handler/permission_handler.dart';
// import 'package:demo/resources/custom_text_style.dart';
... ... @@ -37,30 +38,59 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
_requestLocationPermission();
_getLocationPermission();
});
}
Future<bool> checkLocationPermission() async {
PermissionStatus permissionStatus = await Permission.location.status;
if (permissionStatus == PermissionStatus.granted) {
return true;
} else {
return false;
}
}
/// 检查权限并定
_getLocationPermission() async {
if (!(await checkPermission(Permission.location))) {
//没有定位权限
//申请定位权限
_requestLocationPermission();
} else {
//去定位
_requestLocationPermission();
}
}
/// 获取定位权限
_requestLocationPermission() async {
Location location = await AmapLocation.instance.fetchLocation(
// needAddress: true,
// mode: LocationAccuracy.High,
// timeout: Duration(seconds: 10)
);
bool canLocation = await requestPermission(Permission.location);
// 单次定位
if (canLocation) {
Future.delayed(Duration(milliseconds: 200), () async {
final location = await AmapLocation.instance.fetchLocation(
// needAddress: true,
// mode: LocationAccuracy.High,
// timeout: Duration(seconds: 10)
);
if (location.city == null || location.city == '') //网络不好,定位失败
{
// App.sp.setString("lat", "39.684670899");
// App.sp.setString("lng", "118.17630045");
// App.sp.setString("city", "唐山市");
if (location.city == null || location.city == '') //网络不好,定位失败
{
// App.sp.setString("lat", "39.684670899");
// App.sp.setString("lng", "118.17630045");
} else {
latitude = location.latLng.latitude;
longitude = location.latLng.longitude;
_controller.setCenterCoordinate(
LatLng(location.latLng.latitude, location.latLng.longitude));
setState(() {});
}
});
} else {
_controller.setCenterCoordinate(
LatLng(location.latLng.latitude, location.latLng.longitude));
// App.sp.setString("city", location.city);
// App.sp.setString("address", location.address);
//无权限
}
}
... ... @@ -251,8 +281,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> {
// zoomLevel: 16);
Navigator.pop(context, {
'address': item.address,
'lat': item.latLng.latitude,
'lng': item.latLng.longitude
'lat': item.latLng.latitude.toString(),
'lng': item.latLng.longitude.toString()
});
},
);
... ...
... ... @@ -487,7 +487,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver {
@override
Widget build(BuildContext context) {
// TODO: implement build
ScreenUtil.init(context, width: 750, height: 1334);
return new WillPopScope(
child: Scaffold(
bottomNavigationBar: BottomNavigationBar(
... ...
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/table_class_model.dart';
import 'package:one_key/models/table_list.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/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:provider/provider.dart';
class RoomTypeCreatePage extends StatefulWidget {
RoomTypeCreatePage({Key key}) : super(key: key);
final bool isNew;
final String tableClassId;
RoomTypeCreatePage({Key key, this.isNew = true, this.tableClassId})
: super(key: key);
@override
_RoomTypeCreatePageState createState() => _RoomTypeCreatePageState();
... ... @@ -28,12 +36,69 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
FocusNode _norNumFocusNode = FocusNode();
FocusNode _maxNumFocusNode = FocusNode();
FocusNode _minMoneyFocusNode = FocusNode();
List<TableList> tableListSel = [];
String tableListSel = '';
bool swichState = true;
StoreDetailModel detailModel;
@override
void initState() {
super.initState();
tableListSel = [];
tableListSel = '';
WidgetsBinding.instance.addPostFrameCallback((_) {
if (!widget.isNew) {
_getTableClassById();
}
});
}
///获取包间类型通过id
_getTableClassById() async {
Map<String, String> params = {
"id": widget.tableClassId,
};
TableClassSunModel sunModel =
await detailModel.getTableClassById(context, params);
if (sunModel != null) {
_nameController.text = sunModel.name;
_norNumController.text = sunModel.standard;
_maxNumController.text = sunModel.max;
_minMoneyController.text = sunModel.low;
setState(() {
sunModel.status == '1' ? swichState = true : swichState = false;
tableListSel = sunModel.tableid != null ? sunModel.tableid : '';
});
}
}
///设置包间类型
_setTableClass() async {
if (_nameController.text.trim().length == 0) {
Utils.showToast('请填写类型名称');
return;
}
if (_norNumController.text.trim().length == 0) {
Utils.showToast('请填写标准可坐人数');
return;
}
Map<String, String> params = {
'sellerid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'name': _nameController.text,
'max': _maxNumController.text,
'low': _minMoneyController.text,
'standard': _norNumController.text,
'status': swichState ? '1' : '0',
'tableid': tableListSel
};
if (widget.tableClassId != 'null') {
params['id'] = widget.tableClassId;
}
bool success =
await detailModel.setTableClass(context, params, showLoading: true);
if (success) {
EventBus().emit('table_manage_page');
Navigator.of(context).pop();
}
}
///输入框
... ... @@ -140,14 +205,15 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
DateTime.now().millisecondsSinceEpoch,
"1",
canChoose: true,
object: {'object': tableListSel},
fromPage: 'room_manage',
object: tableListSel,
);
if (temp != null && temp['tid'] != '') {
if (temp != null) {
print(temp['tid']);
print(temp['tname']);
String tname = temp['tname'];
String tid = temp['tid'];
tableListSel = temp['object'];
tableListSel = temp['tid'];
setState(() {});
// _getTablePhoto(context, temp['tid'], showLoading: true);
}
... ... @@ -191,6 +257,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
@override
Widget build(BuildContext context) {
detailModel = Provider.of<StoreDetailModel>(context, listen: true);
return Material(
child: InkWell(
onTap: () {
... ... @@ -199,7 +266,7 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
child: Scaffold(
backgroundColor: MyColours.color_fefefe,
appBar: SystemAppBar(
'创建包间类型',
widget.isNew ? "创建包间类型" : '修改包间类型',
onTap: () {
Navigator.of(context).pop();
},
... ... @@ -211,6 +278,72 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
physics: BouncingScrollPhysics(),
child: Column(
children: [
!widget.isNew
? InkWell(
onTap: () {
setState(() {
swichState = !swichState;
});
},
child: Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(40),
),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment:
CrossAxisAlignment.start,
children: [
Container(
child: Text(
swichState ? '启用' : '停用',
style: TextStyle(
color: MyColours
.color_333333,
fontWeight:
FontWeight.bold,
fontSize: ScreenUtil()
.setSp(34)),
),
),
VEmptyView(40),
Container(
child: Text(
swichState
? '已启用在线预订,可以看到该包间类型'
: '已停用在线预订,看不到该包间类型',
style: TextStyle(
color: MyColours
.color_666666,
fontSize: ScreenUtil()
.setSp(24)),
),
),
],
),
Image.asset(
swichState
? Utils.getImgPath('swich_on')
: Utils.getImgPath(
'swich_off'),
width: ScreenUtil().setWidth(122),
height: ScreenUtil().setWidth(82),
)
],
)),
)
: SizedBox(),
Container(
height: ScreenUtil().setWidth(2),
color: MyColours.color_efefef,
margin: EdgeInsets.only(
left: ScreenUtil().setWidth(40),
right: ScreenUtil().setWidth(40)),
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(40),
... ... @@ -306,8 +439,10 @@ class _RoomTypeCreatePageState extends State<RoomTypeCreatePage> {
ScreenUtil().setWidth(40), ScreenUtil().setWidth(40)),
child: RoundButton(
onPressed: () {
FocusScope.of(context)
.requestFocus(FocusNode()); //点击空白处隐藏键盘
//接口
// _setStoreBaseinfo();
_setTableClass();
},
text: '保存',
fontSize: 34,
... ...
... ... @@ -27,6 +27,16 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_getSellerTableClass();
});
EventBus().on('table_manage_page', (arg) {
_getSellerTableClass();
});
}
@override
void dispose() {
// TODO: implement dispose
super.dispose();
EventBus().off('table_manage_page');
}
//获取商家包间类型
... ... @@ -89,60 +99,117 @@ class _RoomTypeManagePageState extends State<RoomTypeManagePage> {
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}人",
onTap: () async {
NavigatorUtil.goRoomTypeCreatePage(context,
isNew: false,
tableClassId: tables[index].id);
},
child: Stack(
children: [
Container(
height: ScreenUtil().setWidth(140),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(30)),
decoration: BoxDecoration(
color: tables[index].status == '1'
? MyColours.color_A9E3E6
: MyColours.color_f5f5f5,
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(10)),
border: Border.all(
color: tables[index].status == '1'
? MyColours.color_199095
: MyColours.color_E0E0E0,
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(24),
ScreenUtil().setSp(30),
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()
],
),
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()
],
),
),
tables[index].status != '1'
? Positioned(
bottom: -ScreenUtil().setWidth(0),
right: -ScreenUtil().setWidth(10),
child: Container(
padding: EdgeInsets.only(
bottom: ScreenUtil()
.setWidth(10)),
alignment:
Alignment.bottomCenter,
width:
ScreenUtil().setWidth(100),
height:
ScreenUtil().setWidth(74),
decoration: BoxDecoration(
borderRadius:
BorderRadius.only(
topLeft:
Radius.circular(
ScreenUtil()
.setWidth(
90)),
bottomRight:
Radius.circular(
ScreenUtil()
.setWidth(
10))),
color: MyColours.color_d8d8d8,
),
child: Text(
'已停用',
style: TextStyle(
fontSize: ScreenUtil()
.setSp(24),
color: MyColours
.color_333333),
),
))
: SizedBox()
],
),
);
},
... ...
... ... @@ -30,7 +30,7 @@ class RoomTypeSelectTablePage extends StatefulWidget {
final DateTime dateTime; //日期
final String ddate_slot; //时段
final bool canChoose; //变更预订可以取消原来已预订的选中状态
final List<TableList> tableList;
final List<String> tableList;
final String fromPage;
final String tid;
... ... @@ -84,8 +84,8 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
// itemModelList.remove(item);
// }
for (var item in item.list) {
for (var table in widget.tableList) {
if (item.id == table.id) {
for (var tid in widget.tableList) {
if (item.id == tid) {
item.selected = true;
selectNum++;
// if (!tableList.contains(item)) {
... ... @@ -293,40 +293,23 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
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);
if ((table as t.Table).selected) {
selectTables.add(table);
selectNum++;
selectNum++;
widget.tableList
.add(tableToTableList(table));
} else {
widget.tableList.removeWhere(
(t) => t.id == table.id);
widget.tableList
.add(tableToTableList(table).id);
} else {
widget.tableList.removeWhere(
(t) => t == table.id);
selectNum--;
selectNum--;
selectTables.removeWhere(
(t) => t.id == table.id);
}
setState(() {});
selectTables.removeWhere(
(t) => t.id == table.id);
}
setState(() {});
},
canSelected: true,
fromPage: widget.fromPage,
... ... @@ -347,33 +330,38 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
alignment: Alignment.center,
color: MyColours.color_ffffff,
child: CommonButton(
content: widget.fromPage == 'tablePhoto'
? '确定'
: "已选${selectNum}个 确定",
content: "已选${selectNum}个 确定",
width: 500,
height: 84,
fontSize: 34,
state: 1,
onPress: () {
if (widget.fromPage == "tablePhoto") {
if (widget.canChoose) {
// if (widget.tableList.length > 0) {
String tid = "";
for (String tableid
in widget.tableList) {
tid += tableid + ",";
}
if (widget.tableList.length > 0) {
tid = tid.substring(
0, tid.length - 1);
}
Map temp = {
'tid': selectTables.length > 0
? selectTables[0].id
: '',
'tname': selectTables.length > 0
? selectTables[0].name
: ''
'object': widget.tableList,
'tid': tid
};
Navigator.of(context).pop(temp);
// }
} else {
if (widget.canChoose) {
// if (widget.tableList.length > 0) {
if (selectTables.length > 0) {
String tid = "";
for (TableList table
in widget.tableList) {
for (t.Table table
in selectTables) {
tid += table.id + ",";
}
if (widget.tableList.length > 0) {
if (selectTables.length > 0) {
tid = tid.substring(
0, tid.length - 1);
}
... ... @@ -383,25 +371,6 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
'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);
}
}
}
},
... ... @@ -420,7 +389,7 @@ class RoomTypeSelectTablePageState extends State<RoomTypeSelectTablePage> {
));
}
tableToTableList(t.Table table) {
TableList tableToTableList(t.Table table) {
TableList _tableList = TableList(
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
_tableList.id = table.id;
... ...
import 'dart:io';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/screenutil.dart';
import 'package:one_key/models/get_seller_info_model.dart';
import 'package:one_key/models/set_seller_info_model.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/store_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';
... ... @@ -43,16 +47,22 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
FocusNode _timeFocusNode = FocusNode();
FocusNode _addressFocusNode = FocusNode();
FocusNode _introductionFocusNode = FocusNode();
String storeAddress;
Map<String, dynamic> mapAddress;
final picker = ImagePicker();
// OnlineCheckEditProvider _onlineCheckEditProvider;
UploadImageProvider _uploadImageProvider;
BaseIndoProvider _baseIndoProvider;
StoreBaseIndoProvider _baseIndoProvider;
@override
void initState() {
super.initState();
mapAddress = {
"address": '点击选择',
'lat': '',
'lng': '',
};
_scrollController = ScrollController();
WidgetsBinding.instance.addPostFrameCallback((_) {
_uploadImageProvider.mentou.process = 0.01;
... ... @@ -65,23 +75,22 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
///获取店铺信息
_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();
GetSellerInfoSunModel itemModel =
await _baseIndoProvider.getSellerById(context);
if (itemModel != null) {
_nameController.text = itemModel.data.sellername;
_phoneController.text = itemModel.data.sellerTel;
_timeController.text = itemModel.data.dailyTime;
_addressController.text = itemModel.data.realAddress;
_introductionController.text = itemModel.data.sellerdesc;
_uploadImageProvider.mentou.qiniuUrl = itemModel.data.sellerImage;
// _uploadImageProvider.notifyListeners();
mapAddress = {
"address": itemModel.data.mapAddress,
'lat': itemModel.data.lat,
'lng': itemModel.data.long,
};
setState(() {});
}
}
... ... @@ -92,48 +101,51 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
}
/// 修改店铺基本信息
_setStoreBaseinfo() async {
_setSellerInfoById() 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,
Map<String, dynamic> params = {
'id': user.sellerid,
};
if (_phoneController.text.trim().length == 0) {
if (user.userphone != null) {
params['phone'] = user.userphone;
}
} else {
params['phone'] = _phoneController.text.trim();
params['name'] = _nameController.text;
if (_uploadImageProvider.mentou.file != null &&
_uploadImageProvider.mentou.file != '') {
params['image'] =
await MultipartFile.fromFile(_uploadImageProvider.mentou.path);
}
params['phone'] = _phoneController.text;
if (mapAddress != null && mapAddress['address'] != '') {
params['map_address'] = mapAddress['address'];
}
if (_uploadImageProvider.erweima.qiniuUrl != null &&
_uploadImageProvider.erweima.qiniuUrl != '') {
params['qrcode'] = _uploadImageProvider.erweima.qiniuUrl;
if (mapAddress != null && mapAddress['lng'] != '') {
params['long'] = mapAddress['lng'];
}
if (_baseIndoProvider.baseInfoSunModel != null) {
params['id'] = _baseIndoProvider.baseInfoSunModel.id;
if (mapAddress != null && mapAddress['lat'] != '') {
params['lat'] = mapAddress['lat'];
}
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');
params['real_address'] = _addressController.text;
params['sellerdesc'] = _introductionController.text;
params['daily_time'] = _timeController.text;
FormData formData = FormData.fromMap(params);
SetSellerInfoSunModel sunModel =
await _baseIndoProvider.setSellerInfoById(context, formData);
if (sunModel != null) {
//修改成功
Utils.showToast('保存成功');
EventBus().emit('changeStatusColor');
Navigator.pop(context, true);
Navigator.pop(context);
} else {
// Utils.showToast('保存失败');
}
}
... ... @@ -191,7 +203,11 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
borderSide: BorderSide.none,
),
),
onChanged: (value) {},
onChanged: (value) {
// if (editingController == _nameController) {
// _nameController.text = value;
// }
},
onEditingComplete: () {
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
},
... ... @@ -224,10 +240,12 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
Widget child = Stack(
children: <Widget>[
PhotoPreview(
initialIndex: index,
photoList: imgs,
isShow: isShow,
dashName: dashName)
initialIndex: index,
photoList: imgs,
isShow: isShow,
dashName: dashName,
needMask: false,
)
],
);
return child;
... ... @@ -248,15 +266,12 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
}
});
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);
_uploadImageProvider.imgSizeMenTou = 64;
_uploadImageProvider.mentou.qiniuUrl = null;
_uploadImageProvider.mentou.file = File(pickedFile.path);
_uploadImageProvider.mentou.path = pickedFile.path;
// UploadImageUtil().startUploadOnly(
// context, File(pickedFile.path), 2, true, _uploadImageProvider);
}
}
... ... @@ -372,13 +387,13 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
return InkWell(
onTap: () {
Utils.getPickPermission(context, () async {
Map address = await NavigatorUtil.goMapChoicePointPage(context);
if (address != null) {
mapAddress = await NavigatorUtil.goMapChoicePointPage(context);
if (mapAddress != null) {
setState(() {
storeAddress = address['address'];
// createStoreModel.storeInfo?.address = storeAddress;
// createStoreModel.storeInfo?.lat = address['lat'];
// createStoreModel.storeInfo?.lng = address['lng'];
// storeMapAddress = address['address'];
// // createStoreModel.storeInfo?.address = storeAddress;
// // createStoreModel.storeInfo?.lat = address['lat'];
// // createStoreModel.storeInfo?.lng = address['lng'];
});
}
}, Permission.location);
... ... @@ -397,15 +412,16 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
fontSize: ScreenUtil().setSp(34)),
),
),
HEmptyView(20),
Spacer(),
Text(hintText,
style: TextStyle(
color: hintText == '点击选择'
? MyColours.color_999999
: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32),
)),
HEmptyView(40),
Expanded(
child: Text(hintText,
textAlign: TextAlign.right,
style: TextStyle(
color: hintText == '点击选择'
? MyColours.color_999999
: MyColours.color_333333,
fontSize: ScreenUtil().setSp(32),
))),
HEmptyView(20),
Image.asset(
Utils.getImgPath('arr_right_gray'),
... ... @@ -422,7 +438,8 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
Widget build(BuildContext context) {
_uploadImageProvider =
Provider.of<UploadImageProvider>(context, listen: true);
_baseIndoProvider = Provider.of<BaseIndoProvider>(context, listen: true);
_baseIndoProvider =
Provider.of<StoreBaseIndoProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_fefefe,
appBar: SystemAppBar(
... ... @@ -504,7 +521,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
horizontal: ScreenUtil().setWidth(40),
vertical: ScreenUtil().setWidth(40),
),
child: _select('地图地址', '点击选择')),
child: _select('地图地址', mapAddress['address'])),
VEmptyView(10),
Container(
height: ScreenUtil().setWidth(2),
... ... @@ -549,7 +566,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> {
child: RoundButton(
onPressed: () {
//接口
_setStoreBaseinfo();
_setSellerInfoById();
},
text: '保存',
fontSize: 34,
... ...
... ... @@ -15,8 +15,14 @@ class PhotoPreview extends StatefulWidget {
final PageController pageController;
final bool isShow;
final List dashName;
PhotoPreview({this.initialIndex, this.photoList, this.isShow, this.dashName})
final bool needMask;
PhotoPreview(
{this.initialIndex,
this.photoList,
this.isShow,
this.dashName,
this.needMask = true})
: pageController = PageController(initialPage: initialIndex);
@override
... ... @@ -25,6 +31,7 @@ class PhotoPreview extends StatefulWidget {
class _PhotoPreviewState extends State<PhotoPreview> {
int currentIndex;
final _controller = new PageController();
static const _kDuration = const Duration(milliseconds: 300);
... ... @@ -38,10 +45,14 @@ class _PhotoPreviewState extends State<PhotoPreview> {
@override
void initState() {
currentIndex = widget.initialIndex;
for (var item in widget.photoList) {
tempImgList.add('$item-zdmask');
if (widget.needMask) {
for (var item in widget.photoList) {
tempImgList.add('$item-zdmask');
}
} else {
tempImgList = widget.photoList;
}
print(tempImgList);
// tempImgList = widget.photoList;
super.initState();
... ...
import 'dart:convert';
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/constant/error.dart';
import 'package:one_key/models/get_seller_info_model.dart';
import 'package:one_key/models/set_seller_info_model.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';
import 'package:one_key/provider/user_model.dart';
import 'package:one_key/utils/utils.dart';
import 'package:one_key/widgets/loading.dart';
import 'package:provider/provider.dart';
class StoreBaseIndoProvider with ChangeNotifier {
GetSellerInfoSunModel itemModel;
String _statusKey = "status";
/// BaseResp [int code]字段 key, 默认:errorCode.
String _codeKey = "errorCode";
/// BaseResp [String msg]字段 key, 默认:errorMsg.
String _msgKey = "errorMsg";
/// BaseResp [T data]字段 key, 默认:data.
String _dataKey = "data";
///根据商家ID获取商家信息
Future<GetSellerInfoSunModel> getSellerById(BuildContext context) async {
Map<String, String> params = {
"sellerid": Provider.of<UserModel>(context, listen: false).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());
});
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;
print(itemModel);
} else {
Utils.showToast(baseResp.msg ?? "");
}
return itemModel;
}
}
/// decode response data.
Map<String, dynamic> _decodeData(Response response) {
if (response == null ||
response.data == null ||
response.data.toString().isEmpty) {
return new Map();
}
return json.decode(response.data.toString());
}
///根据商家ID修改商家信息
Future<SetSellerInfoSunModel> setSellerInfoById(
BuildContext context, FormData params) async {
Loading.showLoading(context);
var dio = new Dio();
Response response = await dio.post(
"https://xt04.colorcun.com/?service=App.Seller.SetSellerById",
data: params);
print(response);
Map _responseData;
if (response.statusCode == HttpStatus.ok ||
response.statusCode == HttpStatus.created) {
try {
if (response.data is Map) {
_responseData = response.data;
} else {
Map<String, dynamic> _dataMap = _decodeData(response);
_responseData = _dataMap;
}
Loading.hideLoading(context);
SetSellerInfoSunModel itemModel;
if (_responseData['ret'] == Constant.status_success) {
if (_responseData['data'] != null) {
itemModel = SetSellerInfoModel.fromJson(_responseData).data;
} else {
Utils.showToast(_responseData['msg'] ?? "");
}
return itemModel;
}
} catch (e) {
Loading.hideLoading(context);
return new Future.error(new DioError(
// requestOptions: response.requestOptions,
response: response,
error: "data parsing exception...",
type: DioErrorType.RESPONSE,
));
}
}
}
}
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/constant.dart';
import 'package:one_key/models/seller_table_class_entity.dart';
import 'package:one_key/models/table_class_model.dart';
import 'package:one_key/models/table_fill_up_date_model.dart';
import 'package:one_key/net/base_resp.dart';
import 'package:one_key/net/dio_util.dart';
... ... @@ -12,6 +13,44 @@ import 'package:one_key/utils/utils.dart';
*/
class StoreDetailModel with ChangeNotifier {
List<SellerTableClassEntity> tables = []; //商家包间类型
TableClassSunModel tableClassSunModel;
///添加/修改包间分类
Future<bool> setTableClass(BuildContext context, Map<String, String> params,
{bool showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_table_class,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
if (baseResp.data != null) {
return true;
}
} else {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
//获取包间分类
Future<TableClassSunModel> getTableClassById(
BuildContext context, Map<String, String> params) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_table_class_by_id,
data: params, showLoading: false)
.catchError((error) {
print(error.toString());
});
if (baseResp != null && baseResp.code == Constant.status_success) {
tableClassSunModel = TableClassModel.fromJson(baseResp.responseData).data;
} else {
Utils.showToast(baseResp.msg ?? "");
}
notifyListeners();
return tableClassSunModel;
}
//获取商家包间类型
Future<List<SellerTableClassEntity>> getSellerTableClass(
... ...
... ... @@ -375,8 +375,12 @@ class NavigatorUtil {
/// 包间类型创建
static Future<dynamic> goRoomTypeCreatePage(BuildContext context,
{replace = false, SmsInfoData smsInfoData}) {
return _navigateTo(context, "${Routes.room_type_create_page}",
{replace = false,
SmsInfoData smsInfoData,
bool isNew = true,
String tableClassId}) {
return _navigateTo(
context, "${Routes.room_type_create_page}?isnew=${isNew}&tableClassId=${tableClassId}",
replace: replace);
}
... ... @@ -384,12 +388,12 @@ class NavigatorUtil {
static Future goRoomTypeSelectTablePage(
BuildContext context, String rid, int dateTime, String ddate_slot,
{bool canChoose = false,
Map object,
String 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)}");
"${Routes.room_type_select_table_page}?rid=$rid&tid=$tid&dateTime=$dateTime&fromPage=$fromPage&ddate_slot=$ddate_slot&canChoose=$canChoose&object=${object}");
}
// object = {'object': [], "tid": ''};
return _navigateTo(context,
... ...
... ... @@ -69,10 +69,12 @@ import 'package:one_key/provider/other_login_provider.dart';
import 'package:one_key/provider/remark_manager_model.dart';
import 'package:one_key/provider/sms_recharge_provider.dart';
import 'package:one_key/provider/statistics_provider.dart';
import 'package:one_key/provider/store_base_info_provider.dart';
import 'package:one_key/provider/store_detail_model.dart';
import 'package:one_key/provider/table_photo_manager_provider.dart';
import 'package:one_key/provider/upload_img_provider.dart';
import 'package:one_key/utils/fluro_convert_utils.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
// 登录页
... ... @@ -560,8 +562,8 @@ 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<StoreBaseIndoProvider>(
create: (_) => StoreBaseIndoProvider(), child: StoreBaseInfoPage());
// return ChangeNotifierProvider<UploadImageProvider>(
// create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
});
... ... @@ -582,8 +584,11 @@ var roomTypeCreatePageHandler = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
// SmsInfoData data = SmsInfoData.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["smsInfoData"].first)));
bool isnew = FluroConvertUtils.string2bool(params["isnew"].first);
String tableClassId = params["tableClassId"].first;
return ChangeNotifierProvider<StoreDetailModel>(
create: (_) => StoreDetailModel(), child: RoomTypeCreatePage());
create: (_) => StoreDetailModel(),
child: RoomTypeCreatePage(isNew: isnew, tableClassId: tableClassId));
// return ChangeNotifierProvider<UploadImageProvider>(
// create: (_) => UploadImageProvider(), child: EnterStoreFrontPhotoPage());
});
... ... @@ -598,19 +603,15 @@ var roomTypeSelectTablePageHandler = new Handler(
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));
}
}
String temp = params["object"].first;
List<String> tidSelList = temp.length > 0 ? temp.split(',') : [];
// 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));
canChoose: canChoose,
tableList: tidSelList,
fromPage: fromPage,
tid: tid));
});
... ...
... ... @@ -178,8 +178,13 @@ class UploadImageUtil {
putController.addProgressListener((percent) {
print('${index}任务进度变化:进度:${percent.toStringAsFixed(4)}');
if (index == 0) {
//0 头像
uploadImageProvider.touxiang.process = percent;
} else if (index == 2) {
//2 门头
uploadImageProvider.mentou.process = percent;
} else {
//1 二维码
uploadImageProvider.erweima.process = percent;
}
uploadImageProvider.notifyListeners();
... ... @@ -227,6 +232,11 @@ class UploadImageUtil {
uploadImageProvider.erweima.qiniuUrl = imgUrl;
uploadImageProvider.erweima.file = null;
uploadImageProvider.notifyListeners();
}else if (index == 2) {
uploadImageProvider.mentou.process = 1;
uploadImageProvider.mentou.qiniuUrl = imgUrl;
uploadImageProvider.mentou.file = null;
uploadImageProvider.notifyListeners();
}
})
..catchError((dynamic error) {
... ...
... ... @@ -81,7 +81,8 @@ class TableItemState extends State<TableItem> {
table.selected = !(table.selected ?? false);
});
widget.onSelected(table);
} else if (widget.fromPage == 'table_manage') {
} else if (widget.fromPage == 'table_manage' ||
widget.fromPage == 'room_manage') {
table.selected = !(table.selected ?? false);
widget.onSelected(table);
} else if (widget.fromPage == 'tablePhoto') {
... ... @@ -99,7 +100,7 @@ class TableItemState extends State<TableItem> {
height: ScreenUtil().setWidth(widget.height),
margin: EdgeInsets.all(ScreenUtil().setWidth(9)),
decoration: BoxDecoration(
color: table.enable == '0'
color: widget.need && table.enable == '0'
? MyColours.color_E0E0E0
: MyColours.color_A9E3E6,
borderRadius: BorderRadius.all(
... ... @@ -153,7 +154,7 @@ class TableItemState extends State<TableItem> {
table.name,
maxLines: 2,
style: TextStyle(
color: table.enable == '0'
color: widget.need && table.enable == '0'
? MyColours.color_999999
: MyColours.color_353535,
fontSize: ScreenUtil().setSp(28),
... ... @@ -187,12 +188,12 @@ class TableItemState extends State<TableItem> {
? table.tableNum
: table.reserver,
style: TextStyle(
color: signStr == '已停用'
? MyColours.color_999999
: (table.reserver == null ||
table.reserver.isEmpty)
? MyColours.color_353535
: MyColours.color_2bb5b7,
color: signStr == '已停用'
? MyColours.color_999999
: (table.reserver == null ||
table.reserver.isEmpty)
? MyColours.color_353535
: MyColours.color_2bb5b7,
fontSize: ScreenUtil().setSp(26),
decoration: TextDecoration.none,
fontWeight: FontWeight.normal),
... ...