|
|
|
import 'dart:convert';
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:ui';
|
|
|
|
|
|
...
|
...
|
@@ -75,7 +76,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
SetTime morning = SetTime();
|
|
|
|
SetTime noon = SetTime();
|
|
|
|
SetTime night = SetTime();
|
|
|
|
BookSetTimeModel bookSetTimeModelCanReceiveTime;
|
|
|
|
bool onePhone = true;
|
|
|
|
|
|
|
|
///获取接单时间接口
|
|
|
|
_getReceiveOrdersTime() async {
|
|
...
|
...
|
@@ -271,7 +272,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
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;
|
|
...
|
...
|
@@ -279,6 +280,21 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
// _uploadImageProvider.notifyListeners();
|
|
|
|
_countName = _nameController.text.trim().length;
|
|
|
|
_countAddress = _addressController.text.trim().length;
|
|
|
|
if (itemModel.data.sellerTel.contains(',')) {
|
|
|
|
List<String> list = itemModel.data.sellerTel.split(',');
|
|
|
|
if (list.length == 2) {
|
|
|
|
_phoneController.text = list[0];
|
|
|
|
_phoneController2.text = list[1];
|
|
|
|
onePhone = false;
|
|
|
|
} else {
|
|
|
|
_phoneController.text = '';
|
|
|
|
_phoneController2.text = '';
|
|
|
|
onePhone = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
_phoneController.text = itemModel.data.sellerTel;
|
|
|
|
onePhone = true;
|
|
|
|
}
|
|
|
|
mapAddress = {
|
|
|
|
"address": itemModel.data.mapAddress,
|
|
|
|
'lat': itemModel.data.lat,
|
|
...
|
...
|
@@ -294,6 +310,57 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
await _uploadImageProvider.getQiniuInfo(context, {});
|
|
|
|
}
|
|
|
|
|
|
|
|
_setInfo() async {
|
|
|
|
if (_nameController.text.trim().length == 0) {
|
|
|
|
Utils.showToast('请输入店铺名称!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (_phoneController.text.trim().length == 0) {
|
|
|
|
Utils.showToast('请输入店铺电话!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (_timeController.text.trim().length == 0) {
|
|
|
|
Utils.showToast('请输入营业时间!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mapAddress == null || mapAddress['address'] == '') {
|
|
|
|
Utils.showToast('请输入店铺地址!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (swichState[0]) {
|
|
|
|
if (morning == null || morning.start == '' || morning.start == null) {
|
|
|
|
Utils.showToast('请输入选择早市开始时间!');
|
|
|
|
return;
|
|
|
|
} else if (morning == null || morning.end == '' || morning.end == null) {
|
|
|
|
Utils.showToast('请输入选择早市结束时间!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (swichState[1]) {
|
|
|
|
if (noon == null || noon.start == '' || noon.start == null) {
|
|
|
|
Utils.showToast('请输入选择午市开始时间!');
|
|
|
|
return;
|
|
|
|
} else if (noon == null || noon.end == '' || noon.end == null) {
|
|
|
|
Utils.showToast('请输入选择午市结束时间!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (swichState[2]) {
|
|
|
|
if (night == null || night.start == '' || night.start == null) {
|
|
|
|
Utils.showToast('请输入选择晚市开始时间!');
|
|
|
|
return;
|
|
|
|
} else if (night == null || night.end == '' || night.end == null) {
|
|
|
|
Utils.showToast('请输入选择晚市结束时间!');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
await _setReceiveTime();
|
|
|
|
await _setSellerInfoById();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// 修改店铺基本信息
|
|
|
|
_setSellerInfoById() async {
|
|
|
|
FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
...
|
...
|
@@ -311,7 +378,11 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
await MultipartFile.fromFile(_uploadImageProvider.mentou.path);
|
|
|
|
}
|
|
|
|
|
|
|
|
params['phone'] = _phoneController.text;
|
|
|
|
params['seller_tel'] = _phoneController.text;
|
|
|
|
if (_phoneController2.text.trim().length > 0) {
|
|
|
|
params['seller_tel'] =
|
|
|
|
_phoneController.text + ',' + _phoneController2.text;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mapAddress != null && mapAddress['address'] != '') {
|
|
|
|
params['map_address'] = mapAddress['address'];
|
|
...
|
...
|
@@ -329,13 +400,29 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
|
|
|
|
params['daily_time'] = _timeController.text;
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
|
|
|
params["daily"] =
|
|
|
|
jsonEncode({'morning': morningStr, 'noon': noonStr, 'night': nightStr});
|
|
|
|
|
|
|
|
FormData formData = FormData.fromMap(params);
|
|
|
|
|
|
|
|
SetSellerInfoSunModel sunModel =
|
|
|
|
await _baseIndoProvider.setSellerInfoById(context, formData);
|
|
|
|
if (sunModel != null) {
|
|
|
|
//修改成功
|
|
|
|
Utils.showToast('保存成功');
|
|
|
|
Utils.showToast('保存店铺信息成功');
|
|
|
|
EventBus().emit('changeStatusColor');
|
|
|
|
Navigator.pop(
|
|
|
|
context,
|
|
...
|
...
|
@@ -348,6 +435,46 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
_setReceiveTime() async {
|
|
|
|
bool isSuccess = await bookSetTimeModel.setReOrderTime(
|
|
|
|
context, receiveOrdersTime.start, receiveOrdersTime.end);
|
|
|
|
if (isSuccess) {
|
|
|
|
///弹出提示框
|
|
|
|
///
|
|
|
|
|
|
|
|
// EventBus().emit('changeStatusColor');
|
|
|
|
// Navigator.of(context).pop();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// _setBookTime() 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);
|
|
|
|
// }
|
|
|
|
|
|
|
|
// ///接口
|
|
|
|
// ///
|
|
|
|
// 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('保存失败');
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
///输入框
|
|
|
|
Widget _textfield(String title, String hintText,
|
|
|
|
TextEditingController editingController, FocusNode focusNode) {
|
|
...
|
...
|
@@ -1006,6 +1133,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
Provider.of<UploadImageProvider>(context, listen: true);
|
|
|
|
_baseIndoProvider =
|
|
|
|
Provider.of<StoreBaseIndoProvider>(context, listen: true);
|
|
|
|
bookSetTimeModel = Provider.of<BookSetTimeModel>(context, listen: true);
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: MyColours.color_F8F9FD,
|
|
|
|
appBar: SystemAppBar(
|
|
...
|
...
|
@@ -1309,12 +1437,22 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
color:
|
|
|
|
MyColours.color_E34D59)),
|
|
|
|
])),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
right: ScreenUtil().setWidth(26)),
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath('stoore_add'),
|
|
|
|
width: ScreenUtil().setWidth(44)))
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
onePhone = !onePhone;
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.only(
|
|
|
|
right:
|
|
|
|
ScreenUtil().setWidth(26)),
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(onePhone
|
|
|
|
? 'stoore_add'
|
|
|
|
: 'stoore_add_un'),
|
|
|
|
width:
|
|
|
|
ScreenUtil().setWidth(44))))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
VEmptyView(44),
|
|
...
|
...
|
@@ -1392,89 +1530,106 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('store_jian'),
|
|
|
|
Utils.getImgPath('store_jian_un'),
|
|
|
|
width: ScreenUtil().setWidth(44))
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
VEmptyView(32),
|
|
|
|
Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(26)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text('电话2:',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(28),
|
|
|
|
color: MyColours.color_999999)),
|
|
|
|
HEmptyView(32),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(60),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal:
|
|
|
|
ScreenUtil().setWidth(24)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(
|
|
|
|
ScreenUtil()
|
|
|
|
.setWidth(26))),
|
|
|
|
child: TextField(
|
|
|
|
controller: _phoneController2,
|
|
|
|
maxLines: 1,
|
|
|
|
// inputFormatters: [
|
|
|
|
// LengthLimitingTextInputFormatter(
|
|
|
|
// 15),
|
|
|
|
// // WhitelistingTextInputFormatter.digitsOnly
|
|
|
|
// ],
|
|
|
|
onePhone
|
|
|
|
? SizedBox()
|
|
|
|
: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal:
|
|
|
|
ScreenUtil().setWidth(26)),
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
Text('电话2:',
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(28),
|
|
|
|
color: MyColours
|
|
|
|
.color_999999)),
|
|
|
|
HEmptyView(32),
|
|
|
|
Expanded(
|
|
|
|
child: Container(
|
|
|
|
height: ScreenUtil().setWidth(60),
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil()
|
|
|
|
.setWidth(24)),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: MyColours.color_ffffff,
|
|
|
|
borderRadius:
|
|
|
|
BorderRadius.circular(
|
|
|
|
ScreenUtil()
|
|
|
|
.setWidth(26))),
|
|
|
|
child: TextField(
|
|
|
|
controller: _phoneController2,
|
|
|
|
maxLines: 1,
|
|
|
|
// inputFormatters: [
|
|
|
|
// LengthLimitingTextInputFormatter(
|
|
|
|
// 15),
|
|
|
|
// // WhitelistingTextInputFormatter.digitsOnly
|
|
|
|
// ],
|
|
|
|
|
|
|
|
// //光标颜色
|
|
|
|
// cursorColor:
|
|
|
|
// widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(24),
|
|
|
|
color: MyColours.color_515151),
|
|
|
|
focusNode: _phoneFocusNode2,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide: BorderSide.none),
|
|
|
|
hintText: '请输入区号+固定电话或11位手机号',
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color: MyColours.color_BFC4D4,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(24),
|
|
|
|
),
|
|
|
|
enabledBorder:
|
|
|
|
new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
focusedBorder:
|
|
|
|
new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
// //光标颜色
|
|
|
|
// cursorColor:
|
|
|
|
// widget.isSelect ? Colors.white : MyColours.color_199095,
|
|
|
|
//输入文本的样式
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(24),
|
|
|
|
color:
|
|
|
|
MyColours.color_515151),
|
|
|
|
focusNode: _phoneFocusNode2,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
border: OutlineInputBorder(
|
|
|
|
borderSide:
|
|
|
|
BorderSide.none),
|
|
|
|
hintText: '请输入区号+固定电话或11位手机号',
|
|
|
|
hintStyle: TextStyle(
|
|
|
|
color:
|
|
|
|
MyColours.color_BFC4D4,
|
|
|
|
fontSize:
|
|
|
|
ScreenUtil().setSp(24),
|
|
|
|
),
|
|
|
|
enabledBorder:
|
|
|
|
new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
focusedBorder:
|
|
|
|
new UnderlineInputBorder(
|
|
|
|
borderSide: BorderSide.none,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onChanged: (value) {
|
|
|
|
// if (editingController == _nameController) {
|
|
|
|
// _nameController.text = value;
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(
|
|
|
|
FocusNode()); //点击空白处隐藏键盘
|
|
|
|
},
|
|
|
|
keyboardType:
|
|
|
|
TextInputType.text,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onChanged: (value) {
|
|
|
|
// if (editingController == _nameController) {
|
|
|
|
// _nameController.text = value;
|
|
|
|
// }
|
|
|
|
},
|
|
|
|
onEditingComplete: () {
|
|
|
|
FocusScope.of(context)
|
|
|
|
.requestFocus(
|
|
|
|
FocusNode()); //点击空白处隐藏键盘
|
|
|
|
},
|
|
|
|
keyboardType: TextInputType.text,
|
|
|
|
),
|
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
InkWell(
|
|
|
|
onTap: () {
|
|
|
|
setState(() {
|
|
|
|
onePhone = !onePhone;
|
|
|
|
_phoneController2.text = '';
|
|
|
|
});
|
|
|
|
},
|
|
|
|
child: Image.asset(
|
|
|
|
Utils.getImgPath(
|
|
|
|
'store_jian'),
|
|
|
|
width: ScreenUtil()
|
|
|
|
.setWidth(44)))
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
HEmptyView(20),
|
|
|
|
Image.asset(
|
|
|
|
Utils.getImgPath('store_jian'),
|
|
|
|
width: ScreenUtil().setWidth(44))
|
|
|
|
],
|
|
|
|
)),
|
|
|
|
VEmptyView(112),
|
|
|
|
RichText(
|
|
|
|
text: TextSpan(
|
|
...
|
...
|
@@ -2010,7 +2165,7 @@ class _StoreBaseInfoPageState extends State<StoreBaseInfoPage> { |
|
|
|
child: RoundButton(
|
|
|
|
onPressed: () {
|
|
|
|
//接口
|
|
|
|
_setSellerInfoById();
|
|
|
|
_setInfo();
|
|
|
|
},
|
|
|
|
text: '保存',
|
|
|
|
fontSize: 34,
|
...
|
...
|
|