Commit b073674fe0d274551cc702ae5afa0dcd06579e47

Authored by wdn127929
1 parent 3d84968f

预订安排自定义图文信息

import 'dart:convert';
class ReserveImgTextModel {
int ret;
ReserveImgTextSunModel data;
String msg;
ReserveImgTextModel({this.ret, this.data, this.msg});
ReserveImgTextModel.fromJson(Map<String, dynamic> json) {
ret = json["ret"];
data = json["data"] == null ? null : ReserveImgTextSunModel.fromJson(json["data"]);
msg = json["msg"];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> _data = <String, dynamic>{};
_data["ret"] = ret;
if(data != null) {
_data["data"] = data?.toJson();
}
_data["msg"] = msg;
return _data;
}
}
class ReserveImgTextSunModel {
String id;
String uid;
String rid;
String title;
List<ContentModel> content;
String cdate;
ReserveImgTextSunModel({this.id, this.uid, this.rid, this.title, this.content, this.cdate});
ReserveImgTextSunModel.fromJson(Map<String, dynamic> json) {
id = json["id"];
uid = json["uid"];
rid = json["rid"];
title = json["title"];
content = [];
if (json['content'] != null) {
if (jsonDecode(json['content']) is List) {
List temp = jsonDecode(json['content']);
temp.forEach((element) {
content.add(ContentModel.fromJson(element));
});
}
}
cdate = json["cdate"];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> _data = <String, dynamic>{};
_data["id"] = id;
_data["uid"] = uid;
_data["rid"] = rid;
_data["title"] = title;
_data["content"] = content;
_data["cdate"] = cdate;
return _data;
}
}
class ContentModel{
String type;
String content;
ContentModel({this.type, this.content});
ContentModel.fromJson(Map<String, dynamic> json) {
type = json["type"];
content = json["content"];
}
}
\ No newline at end of file
... ...
... ... @@ -521,14 +521,15 @@ class HttpUrl {
static const String get_sms_change_field =
"?service=App.SaiYouYun.GetSmsChangeField"; // 获取可变模板允许配置字段
static const String save_sai_you_yun_change =
"?service=App.SaiYouYun.SaveSaiYouYunChange"; // 配置可变模板内容
static const String save_sai_you_yun_change =
"?service=App.SaiYouYun.SaveSaiYouYunChange"; // 配置可变模板内容
static const String app_pay_jisu_version =
static const String app_pay_jisu_version =
"?service=App.Pay.AppPayJiSuVersion"; // App调起支付(购买版本)
static const String set_reserve_img_text =
"?service=App.Reserve.SetReserveImgText"; // 保存预订详情自定义图文
static const String get_reserve_img_text =
"?service=App.Reserve.GetReserveImgText"; // 获取预订详情自定义图文
}
... ...
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_native_image/flutter_native_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
... ... @@ -11,9 +14,13 @@ import 'package:one_key/widgets/system_app_bar.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:provider/provider.dart';
import '../../models/reserve_img_text.dart';
import '../../models/upload_img_model.dart';
import '../../provider/marketing_center_provider.dart';
import '../../provider/upload_img_provider.dart';
import '../../provider/user_model.dart';
import '../../res/colors.dart';
import '../../utils/event_bus.dart';
import '../../utils/screen_util.dart';
import '../../utils/upload_image_util.dart';
import '../../utils/utils.dart';
... ... @@ -44,7 +51,9 @@ class AdditionModel {
}
class InvicationAdditionPage extends StatefulWidget {
InvicationAdditionPage();
final String rid;
InvicationAdditionPage(this.rid);
@override
State<InvicationAdditionPage> createState() => _InvicationAdditionPageState();
... ... @@ -57,6 +66,8 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> {
final picker = ImagePicker();
ScrollController controller = ScrollController();
MarketingCenterProvider marketingCenterProvider;
@override
void initState() {
super.initState();
... ... @@ -81,6 +92,7 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> {
WidgetsBinding.instance.addPostFrameCallback((_) async {
_getQiniuInfo();
getReserveImgText();
});
}
... ... @@ -90,6 +102,55 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> {
await _uploadImageProvider.getQiniuInfo(context, {});
}
getReserveImgText() async {
await marketingCenterProvider.getReserveImgText(context, widget.rid);
if (marketingCenterProvider.reserveImgText != null) {
titleC.text = marketingCenterProvider.reserveImgText.title;
for (int i = 0;
i < marketingCenterProvider.reserveImgText.content.length;
i++) {
ContentModel contentModel =
marketingCenterProvider.reserveImgText.content[i];
if (contentModel.type == '1') {
//图片
AdditionModel additionModel = AdditionModel();
additionModel.content = contentModel.content;
additionModel.type = '1';
additionModel.image = UploadImgModel();
additionModel.image.process = 1;
additionModel.image.qiniuUrl = contentModel.content;
data.add(additionModel);
} else {
AdditionModel additionModel = AdditionModel();
additionModel.content = contentModel.content;
additionModel.infoC.text = contentModel.content;
additionModel.type = contentModel.type;
data.add(additionModel);
}
}
// AdditionModel additionModel = AdditionModel();
// additionModel.content =
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
// additionModel.type = '1';
// additionModel.order = 0;
// additionModel.image = UploadImgModel();
// additionModel.image.process = 1;
// additionModel.image.qiniuUrl =
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
// AdditionModel additionModel1 = AdditionModel();
// additionModel1.content = 'webenkjfkdfjakdfjaldfkjaldfjaldf';
// additionModel1.type = '2';
// additionModel1.order = 1;
// data.add(additionModel);
// data.add(additionModel1);
marketingCenterProvider.notifyListeners();
}
}
@override
void dispose() {
super.dispose();
... ... @@ -99,49 +160,261 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> {
///#相机拍照,单图选择
Future _getFromPictureOrCamera(int index, imageSource) async {
final pickedFile = await picker.pickImage(source: imageSource);
File compressedFile = await FlutterNativeImage.compressImage(
pickedFile.path,
quality: 50,
percentage: 50);
UploadImgModel imgModel = _uploadImageProvider.getDynamicValue('${index}');
setState(() {
if (pickedFile == null){
} else{
UploadImgModel uploadImgModel =
UploadImgModel(); //图
_uploadImageProvider.setDynamicValue(
'${data.length}', uploadImgModel);
AdditionModel additionModel =
AdditionModel();
// additionModel.content = imgModel.qiniuUrl;
additionModel.type = '1';
// additionModel.order = data.length;
additionModel.image = uploadImgModel;
// additionModel.image.process = 1;
// additionModel.image.qiniuUrl =
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
data.add(additionModel);
File compressedFile = await FlutterNativeImage.compressImage(
pickedFile.path,
quality: 50,
percentage: 50);
UploadImgModel imgModel =
_uploadImageProvider.getDynamicValue('${index}');
setState(() {
if (pickedFile != null) {
imgModel.file = File(pickedFile.path);
imgModel.process = 0.01;
} else {
print('No image selected.');
}
});
if (pickedFile != null) {
imgModel.file = File(pickedFile.path);
imgModel.process = 0.01;
} else {
print('No image selected.');
// if (title == '头像') {
// _uploadImageProvider.imgSizeTouxiang = 76;
// _uploadImageProvider.touxiang.qiniuUrl = null;
// } else {
// _uploadImageProvider.imgSizeErweima = 76;
imgModel.qiniuUrl = null;
// }
bool need = await Utils.sizeNeed(File(pickedFile.path));
File file = File(pickedFile.path);
if (need) {
file = File(compressedFile.absolute.path);
}
UploadImageUtil().startUploadOnlyAddition(
context, file, index, true, _uploadImageProvider, () {
UploadImgModel imgModel =
_uploadImageProvider.getDynamicValue('${index}');
AdditionModel additionModel = AdditionModel();
additionModel.content = imgModel.qiniuUrl;
additionModel.type = '1';
// additionModel.order = index;
additionModel.image = imgModel;
// additionModel.image.process = 1;
// additionModel.image.qiniuUrl =
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
data[index] = additionModel;
setState(() {});
});
}
});
if (pickedFile != null) {
// if (title == '头像') {
// _uploadImageProvider.imgSizeTouxiang = 76;
// _uploadImageProvider.touxiang.qiniuUrl = null;
// } else {
// _uploadImageProvider.imgSizeErweima = 76;
imgModel.qiniuUrl = null;
// }
bool need = await Utils.sizeNeed(File(pickedFile.path));
File file = File(pickedFile.path);
if (need) {
file = File(compressedFile.absolute.path);
}
}
List<Widget> _scrolleWidget() {
List<Widget> temp = [];
for (AdditionModel item in data) {
if (item.type == '1') {
if (item.image.qiniuUrl == null && item.image.file == null) {
} else {
temp.add(Container(
key: ValueKey(item),
child: InkWell(
onTap: () {
// double process;
// String qiniuUrl;
// List<String> tempList = [];
// // if (title == '头像') {
// process = item.image.process;
// qiniuUrl = item.image.qiniuUrl;
// // } else {
// // process = _uploadImageProvider.erweima.process;
// // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;
// // }
// if (qiniuUrl != null &&
// qiniuUrl != '') {
// // tempList.add(qiniuUrl);
// // ///没有上传完成的不可以点击
// // _showPhotoView(context, 0, tempList);
// // _uploadImageProvider.firstImage.qiniuUrl = null;
// // _uploadImageProvider.firstImage.process = 0;
// // setState(() {});
// _openModalBottomSheet(context);
// // Utils.getPickPermission(context, () {
// // _getFromPictureOrCamera(
// // _uploadImageProvider.firstImage,
// // ImageSource.gallery);
// // },
// // Platform.isAndroid
// // ? Permission.storage
// // : Permission.photos);
// }
},
child: Stack(alignment: Alignment.bottomCenter, children: [
Stack(clipBehavior: Clip.none, children: [
item.image.qiniuUrl != null && item.image.qiniuUrl != ''
? Image.network(
item.image.qiniuUrl,
fit: BoxFit.contain,
width: double.infinity,
// width: ScreenUtil()
// .setWidth(imgSize * 2),
// height: ScreenUtil().setWidth(
// _uploadImageProvider
// .imgSizefirstImage *
// 2),
)
: Image.file(
item.image.file,
fit: BoxFit.contain,
width: double.infinity,
// width: ScreenUtil()
// .setWidth(imgSize * 2),
// height: ScreenUtil().setWidth(
// _uploadImageProvider
// .imgSizefirstImage *
// 2),
),
Positioned(
left: 0,
top: 0,
child: (item.image.file != null) &&
item.image.process != 1 &&
item.image.process != 0.01
? Container(
width: ScreenUtil().screenWidth,
height:
w(_uploadImageProvider.imgSizefirstImage),
color: MyColours.color_4D000000,
child: Center(
child: Text('上传中',
style: TextStyle(
color: MyColours.color_F8F9FD)),
),
)
: Container()),
]),
// item.image.process == 1
// ? Container(
// width: w(150),
// height: w(30),
// color: MyColours.color_4D000000,
// alignment: Alignment.center,
// child: Text(
// '点击图片可以更换',
// style: TextStyle(
// color: MyColours
// .color_F8F9FD,
// fontSize: font(14),
// fontWeight:
// FontWeight.bold),
// ))
// : SizedBox(),
item.image.process == 1
? Positioned(
top: w(15),
right: w(15),
child: InkWell(
onTap: () {
data.remove(item);
setState(() {});
},
child: Container(
width: w(30),
height: w(30),
color: Colors.transparent,
alignment: Alignment.center,
child: Image.asset(
Utils.getImgPath('add_close')))))
: SizedBox(),
]))));
}
} else {
temp.add(Container(
key: ValueKey(item),
decoration: BoxDecoration(
border: Border.all(width: w(1), color: MyColours.color_DBDBDB)),
// child: Text(item.content),
// color: Colors.red,
child: Stack(
children: [
Container(
// height: w(152),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(5)),
border: Border.all(
width: w(1), color: MyColours.color_DBDBDB)),
margin: EdgeInsets.only(
left: w(10), top: w(10), bottom: w(10), right: w(60)),
padding: EdgeInsets.only(
top: w(16), bottom: w(16), left: w(14), right: w(10)),
child: TextField(
controller: item.infoC,
// textAlign: TextAlign.right,
// focusNode: _cusdemNode,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28),
// textBaseline: TextBaseline.alphabetic
),
// textAlignVertical: TextAlignVertical.center,
maxLines: 5,
maxLength: 50,
// inputFormatters: [
// LengthLimitingTextInputFormatter(10), // 设置输入长度限制
// ],
decoration: InputDecoration(
hintText: "点击录入文字",
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
),
contentPadding: EdgeInsets.zero,
border: OutlineInputBorder(borderSide: BorderSide.none),
),
keyboardType: TextInputType.text,
onChanged: (value) {
item.content = value;
})),
Positioned(
top: w(10),
right: w(10),
child: InkWell(
onTap: () {
data.remove(item);
setState(() {});
},
child: Container(
width: w(30),
height: w(30),
color: Colors.transparent,
alignment: Alignment.center,
child: Image.asset(Utils.getImgPath('add_close_b')))))
],
),
));
}
UploadImageUtil().startUploadOnlyAddition(
context, file, index, true, _uploadImageProvider, () {
UploadImgModel imgModel =
_uploadImageProvider.getDynamicValue('${index}');
AdditionModel additionModel = AdditionModel();
additionModel.content = imgModel.qiniuUrl;
additionModel.type = '1';
// additionModel.order = index;
additionModel.image = imgModel;
// additionModel.image.process = 1;
// additionModel.image.qiniuUrl =
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
data[index] = additionModel;
setState(() {});
});
}
return temp;
}
///添加图片UI弹出
... ... @@ -253,6 +526,8 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> {
Widget build(BuildContext context) {
_uploadImageProvider =
Provider.of<UploadImageProvider>(context, listen: true);
marketingCenterProvider =
Provider.of<MarketingCenterProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar('自定义图文'),
... ... @@ -291,9 +566,10 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> {
),
// textAlignVertical: TextAlignVertical.center,
maxLines: 1,
// inputFormatters: [
// LengthLimitingTextInputFormatter(10), // 设置输入长度限制
// ],
inputFormatters: [
LengthLimitingTextInputFormatter(
10), // 设置输入长度限制
],
decoration: InputDecoration(
hintText: "点击输入区域标题(不超过10个字)",
hintStyle: TextStyle(
... ... @@ -327,251 +603,13 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> {
child: ReorderableListView(
shrinkWrap: true,
scrollController: controller,
children: <Widget>[
for (AdditionModel item in data)
item.type == '1'
? item.image.qiniuUrl == null &&
item.image.file == null
? SizedBox()
: Container(
key: ValueKey(item),
child: InkWell(
onTap: () {
// double process;
// String qiniuUrl;
// List<String> tempList = [];
// // if (title == '头像') {
// process = item.image.process;
// qiniuUrl = item.image.qiniuUrl;
// // } else {
// // process = _uploadImageProvider.erweima.process;
// // qiniuUrl = _uploadImageProvider.erweima.qiniuUrl;
// // }
// if (qiniuUrl != null &&
// qiniuUrl != '') {
// // tempList.add(qiniuUrl);
// // ///没有上传完成的不可以点击
// // _showPhotoView(context, 0, tempList);
// // _uploadImageProvider.firstImage.qiniuUrl = null;
// // _uploadImageProvider.firstImage.process = 0;
// // setState(() {});
// _openModalBottomSheet(context);
// // Utils.getPickPermission(context, () {
// // _getFromPictureOrCamera(
// // _uploadImageProvider.firstImage,
// // ImageSource.gallery);
// // },
// // Platform.isAndroid
// // ? Permission.storage
// // : Permission.photos);
// }
},
child: Stack(
alignment: Alignment
.bottomCenter,
children: [
Stack(
clipBehavior:
Clip.none,
children: [
item.image.qiniuUrl !=
null &&
item.image
.qiniuUrl !=
''
? Image
.network(
item.image
.qiniuUrl,
fit: BoxFit
.contain,
width: double
.infinity,
// width: ScreenUtil()
// .setWidth(imgSize * 2),
// height: ScreenUtil().setWidth(
// _uploadImageProvider
// .imgSizefirstImage *
// 2),
)
: Image.file(
item.image
.file,
fit: BoxFit
.contain,
width: double
.infinity,
// width: ScreenUtil()
// .setWidth(imgSize * 2),
// height: ScreenUtil().setWidth(
// _uploadImageProvider
// .imgSizefirstImage *
// 2),
),
Positioned(
left: 0,
top: 0,
child: (item.image.file != null) &&
item.image.process !=
1 &&
item.image.process !=
0.01
? Container(
width:
ScreenUtil().screenWidth,
height:
w(_uploadImageProvider.imgSizefirstImage),
color:
MyColours.color_4D000000,
child:
Center(
child:
Text('上传中', style: TextStyle(color: MyColours.color_F8F9FD)),
),
)
: Container()),
]),
// item.image.process == 1
// ? Container(
// width: w(150),
// height: w(30),
// color: MyColours.color_4D000000,
// alignment: Alignment.center,
// child: Text(
// '点击图片可以更换',
// style: TextStyle(
// color: MyColours
// .color_F8F9FD,
// fontSize: font(14),
// fontWeight:
// FontWeight.bold),
// ))
// : SizedBox(),
item.image.process == 1
? Positioned(
top: w(15),
right: w(15),
child: InkWell(
onTap: () {
data.remove(
item);
setState(
() {});
},
child: Container(
width: w(
30),
height: w(
30),
color: Colors
.transparent,
alignment:
Alignment
.center,
child: Image.asset(
Utils.getImgPath('add_close')))))
: SizedBox(),
])))
: Container(
key: ValueKey(item),
decoration: BoxDecoration(
border: Border.all(
width: w(1),
color:
MyColours.color_DBDBDB)),
// child: Text(item.content),
// color: Colors.red,
child: Stack(
children: [
Container(
// height: w(152),
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(
r(5)),
border: Border.all(
width: w(1),
color: MyColours
.color_DBDBDB)),
margin: EdgeInsets.only(
left: w(10),
top: w(10),
bottom: w(10),
right: w(60)),
padding: EdgeInsets.only(
top: w(16),
bottom: w(16),
left: w(14),
right: w(10)),
child: TextField(
controller: item.infoC,
// textAlign: TextAlign.right,
// focusNode: _cusdemNode,
style: TextStyle(
color: MyColours
.color_515151,
fontSize: ScreenUtil()
.setSp(28),
// textBaseline: TextBaseline.alphabetic
),
// textAlignVertical: TextAlignVertical.center,
maxLines: 5,
maxLength: 50,
// inputFormatters: [
// LengthLimitingTextInputFormatter(10), // 设置输入长度限制
// ],
decoration:
InputDecoration(
hintText: "点击录入文字",
hintStyle: TextStyle(
color: MyColours
.color_999999,
fontSize: ScreenUtil()
.setSp(28),
),
contentPadding:
EdgeInsets.zero,
border:
OutlineInputBorder(
borderSide:
BorderSide
.none),
),
keyboardType:
TextInputType.text,
onChanged: (value) {
item.content = value;
})),
Positioned(
top: w(10),
right: w(10),
child: InkWell(
onTap: () {
data.remove(item);
setState(() {});
},
child: Container(
width: w(30),
height: w(30),
color: Colors
.transparent,
alignment:
Alignment.center,
child: Image.asset(
Utils.getImgPath(
'add_close_b')))))
],
),
),
],
children: _scrolleWidget(),
onReorder: (int oldIndex, int newIndex) async {
print(newIndex);
if (oldIndex < newIndex) {
newIndex -= 1;
}
print(newIndex);
// var childold = tableManagerModel.areas[oldIndex];
// Map<String, String> params = {
... ... @@ -597,24 +635,9 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> {
children: [
InkWell(
onTap: () {
UploadImgModel uploadImgModel =
UploadImgModel(); //图
_uploadImageProvider.setDynamicValue(
'${data.length}', uploadImgModel);
AdditionModel additionModel =
AdditionModel();
// additionModel.content = imgModel.qiniuUrl;
additionModel.type = '1';
// additionModel.order = data.length;
additionModel.image = uploadImgModel;
// additionModel.image.process = 1;
// additionModel.image.qiniuUrl =
// 'https://inews.gtimg.com/om_bt/OGlQWfsaAoKkuCcMZ2o9IVEPqd-72DQy5EAN02XBHUwfYAA/641';
data.add(additionModel);
_openModalBottomSheet(
context, data.length - 1);
context, data.length);
},
child: Container(
width: w(77),
... ... @@ -700,11 +723,55 @@ class _InvicationAdditionPageState extends State<InvicationAdditionPage> {
gradientEnd: MyColours.color_438E93,
textColor: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
onPressed: () {
onPressed: () async {
// _createReserveDeposit();
// print(data);
// print(titleC.text);
print(data);
print(titleC.text);
print(data);
bool can = true;
innerloop:
for (AdditionModel item in data) {
if (item.type == '1' && item.image.process < 1) {
Utils.showToast('正在上传图片,请稍等');
// return false;
can = false;
break innerloop;
}
}
data.removeWhere((element) => element.type == '2'&& (element.infoC.text.trim() == ''||element.infoC.text ==null) );
if (can) {
List temp = [];
for (int i = 0; i < data.length; i++) {
AdditionModel element = data[i];
temp.add({
'type': element.type,
'content': element.type == '2'
? element.infoC.text
: element.image.qiniuUrl,
});
}
Map<String, String> params = {
'rid': widget.rid,
'uid': Provider.of<UserModel>(context, listen: false)
.user
.openid,
'title': titleC.text,
'content': jsonEncode(temp)
};
if (marketingCenterProvider.reserveImgText != null) {
params['id'] =
marketingCenterProvider.reserveImgText.id;
}
bool success = await marketingCenterProvider.setReserveImgText(
context, params);
if (success){
bus.emit('getReserveImgText');
Navigator.pop(context);
}
}
},
)),
],
... ...
... ... @@ -186,6 +186,7 @@ class InvicationPageState extends State<InvicationPage>
String smsContent = '';
MarketingCenterProvider marketingCenterProvider;
String additionTitle = '点击设置本单追加的自定义图文';
@override
void initState() {
... ... @@ -286,6 +287,7 @@ class InvicationPageState extends State<InvicationPage>
affinity: TextAffinity.downstream,
offset: value.toString().length)));
});
getReserveImgText();
// await _couponNetworkData(isShowLoading: false);
await _getCustomerActivityBaseinfo();
... ... @@ -314,12 +316,23 @@ class InvicationPageState extends State<InvicationPage>
bus.on("getDzSellerConf", (args) {
getDzSellerConf();
});
bus.on("getReserveImgText", (args) {
getReserveImgText();
});
// Utils.changeStatusColor(color: Colors.transparent);
user = Provider.of<UserModel>(context, listen: false).user;
}
getReserveImgText() async {
await marketingCenterProvider.getReserveImgText(context, widget.rid);
if (marketingCenterProvider.reserveImgText != null) {
additionTitle = marketingCenterProvider.reserveImgText.title;
setState(() {});
}
}
getDzSellerConf() async {
bool success = await marketingCenterProvider.getDzSellerConf(context);
if (success && marketingCenterProvider.dzSellerConfModel != null) {
... ... @@ -429,6 +442,8 @@ class InvicationPageState extends State<InvicationPage>
bus.off("refresh_invitaion_info");
bus.off("refresh_photo_invication");
bus.off("getDzSellerConf");
bus.off("getReserveImgText");
WidgetsBinding.instance.removeObserver(this); //销毁观察者
if (_timer != null) {
... ... @@ -2567,97 +2582,52 @@ class InvicationPageState extends State<InvicationPage>
)
],
)),
// InkWell(
// onTap: () {
// FocusScope.of(context)
// .requestFocus(FocusNode()); //隐藏键盘
// //跳转到新页面
// NavigatorUtil.goInvicationAdditionPage(context);
// },
// child: Container(
// margin: EdgeInsets.only(
// // top: ScreenUtil().setWidth(40),
// bottom: ScreenUtil().setWidth(40)),
// height: ScreenUtil().setWidth(68),
// padding: EdgeInsets.symmetric(
// horizontal: ScreenUtil().setWidth(16)),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(
// ScreenUtil().setWidth(12)),
// // color: Colors.red,
// border: Border.all(
// width: ScreenUtil().setWidth(2),
// color: MyColours.color_DBDBDB)),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// crossAxisAlignment: CrossAxisAlignment.center,
// children: [
// Text(
// '自定义图文:',
// style: TextStyle(
// fontSize: ScreenUtil().setSp(28),
// color: MyColours.color_515151),
// ),
// Expanded(
// child: Text(
// '点击设置本单追加的自定义图文',
// textAlign: TextAlign.right,
// style: TextStyle(
// fontSize: ScreenUtil().setSp(28),
// color: MyColours.color_999999),
// ),
// ),
// // InkWell(
// // onTap: () {
// // FocusScope.of(context)
// // .requestFocus(FocusNode()); //隐藏键盘
// // // 存储
// // DialogUtil.openDishTypeSelectModalBottomSheet(
// // context,
// // detailModel.reserveTypes,
// // reserveType, rCallback: (value) async {
// // if (value != null) {
// // reserveType = value;
// // setState(() {});
// // bool sucess = await detailModel
// // .upReserveInfo(context, widget.rid,
// // reserveType: reserveType,
// // needToast: false);
// // if (sucess) {
// // EventBus()
// // .emit("refresh_tablemanager"); //刷新桌位
// // bus.emit("refresh_book_list"); //刷新已预订列表
// // bus.emit("refresh_detail");
// // // await _getReserveDetail(
// // // showCicle: false);
// // }
// // }
// // });
// // },
// // child: Row(children: [
// // Text(
// // reserveType,
// // style: TextStyle(
// // color: reserveType == '请选择'
// // ? MyColours.color_999999
// // : MyColours.color_515151,
// // fontSize: ScreenUtil().setSp(28),
// // ),
// // ),
// // HEmptyView(4),
// // Image.asset(Utils.getImgPath('quan_down_f'),
// // width: ScreenUtil().setWidth(28),
// // height: ScreenUtil().setWidth(28)),
// // ]),
// // )
// ],
// ))),
InkWell(
onTap: () async{
FocusScope.of(context)
.requestFocus(FocusNode()); //隐藏键盘
//跳转到新页面
await NavigatorUtil.goInvicationAdditionPage(context,
rid: widget.rid);
},
child: Container(
margin: EdgeInsets.only(
// top: ScreenUtil().setWidth(40),
bottom: ScreenUtil().setWidth(40)),
height: ScreenUtil().setWidth(68),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(16)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(12)),
// color: Colors.red,
border: Border.all(
width: ScreenUtil().setWidth(2),
color: MyColours.color_DBDBDB)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'自定义图文:',
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_515151),
),
Expanded(
child: Text(
additionTitle,
textAlign: TextAlign.right,
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_999999),
),
),
],
))),
//输入框
Container(
width: double.infinity,
... ...
... ... @@ -9,6 +9,7 @@ import '../constant/error.dart';
import '../models/GetDzSellerConfModel.dart';
import '../models/mark_data_model.dart';
import '../models/recharge_notice_model.dart';
import '../models/reserve_img_text.dart';
import '../models/sai_you_yun_change_model.dart';
import '../models/sai_you_yun_model.dart';
import '../models/seller_template_color_list_model.dart';
... ... @@ -51,6 +52,61 @@ class MarketingCenterProvider extends ChangeNotifier {
List<SmsChangeFieldSunModel> smsChangeFieldData = []; // 获取可变模板允许配置字段
bool phoneSwich = true;
bool nameSwich = true;
ReserveImgTextSunModel reserveImgText;
// 获取预订详情自定义图文
Future<bool> getReserveImgText(BuildContext context,String rid,
{bool showLoading = true}) async {
Map<String, String> params = {
'rid': rid
};
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.get_reserve_img_text,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
Utils.showToast('请求失败,请重试');
return false;
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data is bool) {
// 没有设置数据
} else {
reserveImgText =
ReserveImgTextModel.fromJson(baseResp.responseData).data;
}
return true;
} else {
Utils.showToast(baseResp.msg ?? '请求失败,请重试');
}
return false;
}
// 保存预订详情自定义图文
Future<bool> setReserveImgText(
BuildContext context, Map<String, String> params,
{bool showLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.set_reserve_img_text,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
Utils.showToast('设置失败,请重试');
return false;
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data is Map || baseResp.data == 1) {
return true;
} else {
Utils.showToast('设置失败,请重试');
}
} else {
Utils.showToast(baseResp.msg ?? '设置失败,请重试');
}
return false;
}
// 获取赛邮云短信模板列表 (固定模版)
... ... @@ -217,7 +273,8 @@ class MarketingCenterProvider extends ChangeNotifier {
BuildContext context, Map<String, String> params,
{bool showLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.set_seller_template_conf,
.request<dynamic>(
context, Method.post, HttpUrl.set_seller_template_conf,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
... ... @@ -299,7 +356,8 @@ class MarketingCenterProvider extends ChangeNotifier {
UserModel userModel = Provider.of<UserModel>(context, listen: false);
Map<String, String> params = {"sid": userModel.user.sellerid};
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.get_seller_template_conf,
.request<dynamic>(
context, Method.post, HttpUrl.get_seller_template_conf,
data: params,
showLoading: pageState == PageState.Loading ? false : showLoading)
.catchError((error) {
... ...
... ... @@ -89,9 +89,7 @@ class NavigatorUtil {
// }
}
/// 首页
/// 首页
static void goHomePageSim(BuildContext context,
{int initialIndex = 2,
needRefresh = true,
... ... @@ -117,9 +115,9 @@ class NavigatorUtil {
replace: replace);
}
/// 订单详情
static void goNotebookDetailPageSim(BuildContext context, String rid, String uid,
/// 订单详情
static void goNotebookDetailPageSim(
BuildContext context, String rid, String uid,
{String mid = "", bool fromNotify = false, replace = false}) {
_navigateTo(context,
"${Routes.reserve_detail_sim}?rid=$rid&mid=$mid&uid=$uid&fromNotify=$fromNotify",
... ... @@ -134,10 +132,9 @@ class NavigatorUtil {
replace: replace);
}
/// 处理在线预订
static Future goHandleOnlinePageSim(BuildContext context, String rid, String mid,
/// 处理在线预订
static Future goHandleOnlinePageSim(
BuildContext context, String rid, String mid,
{fromNotify = false, replace = false}) {
return _navigateTo(context,
"${Routes.handle_online_page_sim}?rid=$rid&mid=$mid&fromNotify=$fromNotify",
... ... @@ -202,8 +199,7 @@ class NavigatorUtil {
_navigateTo(context, "${Routes.invication}?rid=$rid", replace: replace);
}
/// 邀请函
/// 邀请函
static void goInvicationPageSim(BuildContext context, String rid,
{bool replace = false}) {
_navigateTo(context, "${Routes.invication_sim}?rid=$rid", replace: replace);
... ... @@ -323,13 +319,13 @@ class NavigatorUtil {
/// 创建优惠券
static Future<dynamic> goCouponEditPage(BuildContext context,
{replace = false, bool isMine = true, CouponSunModel couponSunModel}) {
if(couponSunModel != null){
return _navigateTo(context, "${Routes.coupon_edit}?isMine=${isMine}&couponSunModel=${FluroConvertUtils.object2string(couponSunModel)}",
replace: replace);
}
return _navigateTo(context, "${Routes.coupon_edit}?isMine=${isMine}",
if (couponSunModel != null) {
return _navigateTo(context,
"${Routes.coupon_edit}?isMine=${isMine}&couponSunModel=${FluroConvertUtils.object2string(couponSunModel)}",
replace: replace);
}
return _navigateTo(context, "${Routes.coupon_edit}?isMine=${isMine}",
replace: replace);
}
/// 选择优惠券
... ... @@ -363,10 +359,9 @@ class NavigatorUtil {
}
}
/// 个人资料页面
static Future<dynamic> goBaseInfoPageSim(BuildContext context, FromPage fromPage,
static Future<dynamic> goBaseInfoPageSim(
BuildContext context, FromPage fromPage,
{replace = false, CheckSellerAccSunModel sunModel}) {
if (sunModel != null) {
return _navigateTo(context,
... ... @@ -556,8 +551,7 @@ class NavigatorUtil {
replace: replace);
}
/// 店铺信息
/// 店铺信息
static Future<dynamic> goStoreBaseInfoPageSim(BuildContext context,
{replace = false, SmsInfoData smsInfoData}) {
return _navigateTo(context, "${Routes.store_base_info_page_sim}",
... ... @@ -627,14 +621,13 @@ class NavigatorUtil {
replace: replace);
}
/// 员工管理页面
/// 员工管理页面
static Future<dynamic> goPersonnelManagePageSim(BuildContext context,
{replace = false, bool isNew = true, String idstr}) {
return _navigateTo(context, "${Routes.personnel_manage_page_sim}",
replace: replace);
}
/// 员工管理页面
static Future<dynamic> goPersonnelDetailPage(BuildContext context,
{replace = false, int index, String position}) {
... ... @@ -704,20 +697,16 @@ class NavigatorUtil {
replace: replace);
}
/// 客情列表
static Future<dynamic> goCustomerListPageSim(
BuildContext context,
/// 客情列表
static Future<dynamic> goCustomerListPageSim(BuildContext context,
{replace = false,
bool needBtn = false,
String index = '0',
bool distribution = false}) {
return _navigateTo(context,
"${Routes.customer_list_page_sim}",
return _navigateTo(context, "${Routes.customer_list_page_sim}",
replace: replace);
}
/// 仅展示客情列表 --- 商家
static Future<dynamic> goShowCustomerListPage(
BuildContext context, FromPage fromPage, String gid,
... ... @@ -786,13 +775,10 @@ class NavigatorUtil {
replace: replace);
}
/// 客户详情
static Future<dynamic> goCustomerDetailPageSim(
BuildContext context,
CustomerBySellerSunModel userHistoryEntity,
{
CustomerBySellerSunModel userHistoryEntity, {
replace = false,
}) {
return _navigateTo(context,
... ... @@ -812,12 +798,10 @@ class NavigatorUtil {
replace: replace);
}
///编辑客户详情
///编辑客户详情
static Future<dynamic> goCustomerDetailEditPageSim(
BuildContext context,
Guest guest,
{
Guest guest, {
replace = false,
}) {
return _navigateTo(context,
... ... @@ -863,17 +847,13 @@ class NavigatorUtil {
replace: replace);
}
/// 我的客情列表
static Future<dynamic> goMyCustomerListPageSim(
BuildContext context,
static Future<dynamic> goMyCustomerListPageSim(BuildContext context,
{replace = false, bool needBtn = false, String index = '0'}) {
return _navigateTo(context,
"${Routes.my_customer_list_page_sim}",
return _navigateTo(context, "${Routes.my_customer_list_page_sim}",
replace: replace);
}
/// 我的营销记录
static Future<dynamic> goMyMarketingRecordsPage(
BuildContext context, FromPage fromPage, String uid,
... ... @@ -937,12 +917,10 @@ class NavigatorUtil {
replace: replace);
}
/// 我的客户详情
/// 我的客户详情
static Future<dynamic> goMyCustomerDetailPageSim(
BuildContext context,
CustomerListSunModel userHistoryEntity,
{
CustomerListSunModel userHistoryEntity, {
replace = false,
}) {
return _navigateTo(context,
... ... @@ -961,11 +939,11 @@ class NavigatorUtil {
"${Routes.my_customer_edit_detail_page}?guest=${FluroConvertUtils.object2string(guest)}&fromPage=${FluroConvertUtils.enumToString(fromPage)}",
replace: replace);
}
///编辑客户详情
///编辑客户详情
static Future<dynamic> goMyCustomerDetailEditPageSim(
BuildContext context,
Guest guest,
{
Guest guest, {
replace = false,
}) {
return _navigateTo(context,
... ... @@ -1009,7 +987,7 @@ class NavigatorUtil {
replace: replace);
}
///客情详情----再次预订
///客情详情----再次预订
static Future<dynamic> goTableManagerPageSim(
BuildContext context,
Guest guest, {
... ... @@ -1621,7 +1599,8 @@ class NavigatorUtil {
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.book_info_page_sim}", replace: replace);
return _navigateTo(context, "${Routes.book_info_page_sim}",
replace: replace);
}
///预订安排通知定制------店铺介绍
... ... @@ -1659,9 +1638,7 @@ class NavigatorUtil {
replace: replace);
}
///预订安排通知定制------客户互动及店铺推广
///预订安排通知定制------客户互动及店铺推广
static Future<dynamic> goMarkingInteractionPageSim(
BuildContext context, {
replace = false,
... ... @@ -1991,8 +1968,7 @@ class NavigatorUtil {
replace: replace);
}
/// 客户通知配置页
/// 客户通知配置页
static Future<dynamic> goCustomerNoticeSettingPageSim(
BuildContext context, {
replace = false,
... ... @@ -2120,7 +2096,6 @@ class NavigatorUtil {
replace: replace);
}
///预订通知短信模版选择
static Future<dynamic> goSmsTemplateSettingPageSim(
BuildContext context,
... ... @@ -2164,15 +2139,13 @@ class NavigatorUtil {
replace: replace);
}
//预订信息模块设置-自定义图文默认
//预订信息模块设置-自定义图文默认
static Future<dynamic> goInvicationAdditionPage(
BuildContext context, {
String rid,
replace = false,
}) {
return _navigateTo(context, "${Routes.invication_addition_page}",
return _navigateTo(context, "${Routes.invication_addition_page}?rid=$rid",
replace: replace);
}
}
... ...
... ... @@ -511,16 +511,16 @@ var handleSelectTableFHandler = new Handler(
return ChangeNotifierProvider<ChooseTableModel>(
create: (_) => ChooseTableModel(),
child: ChangeNotifierProvider<TableManagerModel>(
create: (_) => TableManagerModel(),
child:SelectTableFPage(rid, dateTime, ddateSlot,
canChoose: canChoose,
tableList: res,
fromPage: fromPage,
tid: tid,
hmS: hmS,
hmE: hmE,
source: source,
ridFeast: ridFeast)));
create: (_) => TableManagerModel(),
child: SelectTableFPage(rid, dateTime, ddateSlot,
canChoose: canChoose,
tableList: res,
fromPage: fromPage,
tid: tid,
hmS: hmS,
hmE: hmE,
source: source,
ridFeast: ridFeast)));
});
// 跳转到照片管理的选择桌位_方硕新修改的页面
... ... @@ -771,23 +771,14 @@ var handleCouponEditPageHandler = new Handler(
// String rid = params["rid"].first;
bool isMine = FluroConvertUtils.string2bool(params["isMine"].first);
CouponSunModel couponSunModel;
if(params.keys.contains("couponSunModel")){
couponSunModel = CouponSunModel.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
if (params.keys.contains("couponSunModel")) {
couponSunModel = CouponSunModel.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
}
return ChangeNotifierProvider<UploadImageProvider>(
create: (_) => UploadImageProvider(),
child: CouponEidtPage(
isMine: isMine,
couponSunModel:couponSunModel
));
child: CouponEidtPage(isMine: isMine, couponSunModel: couponSunModel));
});
///选择优惠券
... ... @@ -3685,16 +3676,16 @@ var monthOrderHomePageHandle = new Handler(
create: (_) => PersonnelProvider(), child: MonthOrderHomePage()));
});
///预订信息模块设置-自定义图文默认
var invicationAdditionPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
// String id = params["id"].first;
String rid = params["rid"].first;
// // String smsTemplate = params["smsTemplate"].first;
// CouponUse use = CouponUse.fromJson(
// json.decode(FluroConvertUtils.fluroCnParamsDecode(params["use"].first)));
// CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
return InvicationAdditionPage();
return ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(),
child: InvicationAdditionPage(rid));
});
... ...