Commit 3b75f97fbb7f309bd9121e211b6a6163aae72fe9

Authored by wdn127929
1 parent 7cca3e39

存酒超期配置

... ... @@ -60,6 +60,9 @@ class GetDzSellerConfSunModel {
String depositPrice;
String liteStyle;
String storePushMeg;
String storePushSms;
GetDzSellerConfSunModel(
{this.id,
this.sid,
... ... @@ -88,7 +91,9 @@ class GetDzSellerConfSunModel {
this.isShowRnamePhone,
this.isShowNoticeDeposit,
this.depositPrice,
this.liteStyle});
this.liteStyle,
this.storePushMeg,
this.storePushSms});
GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
... ... @@ -131,6 +136,9 @@ class GetDzSellerConfSunModel {
isShowNoticeDeposit = json['is_show_notice_deposit'];
depositPrice = json['deposit_price'];
liteStyle = json['lite_style'];
storePushMeg = json['store_push_meg'];
storePushSms = json['store_push_sms'];
}
Map<String, dynamic> toJson() {
... ... @@ -165,7 +173,8 @@ class GetDzSellerConfSunModel {
data['is_show_notice_deposit'] = this.isShowNoticeDeposit;
data['deposit_price'] = this.depositPrice;
data['lite_style'] = this.liteStyle;
data['store_push_meg'] = this.storePushMeg;
data['store_push_sms'] = this.storePushSms;
return data;
}
}
... ...
... ... @@ -394,6 +394,9 @@ class HttpUrl {
static const String set_confing =
"?service=App.Reserve.SetConfing"; // 设置订座商家配置信息
static const String set_confings =
"?service=App.Reserve.SetConfings"; // 一次设置多个订座商家配置信息
// static const String send_vc_code =
// "?service=App.SendSMS.SendVcCode"; // 向指定手机号码发送验证码
... ... @@ -565,4 +568,9 @@ class HttpUrl {
static const String qiniu_delete_img =
"?service=App.Qiniu.DeleteImg"; // 删除七牛图片资源
static const get_store_wine_sai_you_text =
"?service=App.Reserve.GetStoreWineSaiYouText"; // 存酒短信可变内容
static const set_store_wine_sai_you_text =
"?service=App.Reserve.SetStoreWineSaiYouText"; // 配置商家存酒短信可变内容
}
... ...
... ... @@ -7,6 +7,7 @@ import 'package:one_key/widgets/system_app_bar.dart';
import 'package:provider/provider.dart';
import '../../../provider/customer_provider.dart';
import '../../../provider/menu_provider.dart';
import '../../../res/colors.dart';
import '../../../route/navigator_util.dart';
import '../../../utils/dialog_util.dart';
... ... @@ -36,12 +37,14 @@ class _WineSettingMsgPageState extends State<WineSettingMsgPage> {
bool isUse = false;
String youhui = '选择优惠';
int couponSelectIndex = 0;
MenuManageProvider menuManageProvider;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) async {
_couponNetworkData();
_getStoreWineSaiYouText();
});
bus.on('refresh_wine_msg', (arg) {
_couponNetworkData();
... ... @@ -54,6 +57,26 @@ class _WineSettingMsgPageState extends State<WineSettingMsgPage> {
bus.off('refresh_wine_msg');
}
_getStoreWineSaiYouText() async {
String text = await menuManageProvider.getStoreWineSaiYouText(context);
if (text != null && text.trim().length > 0) {
controller.text = text;
setState(() {});
}
}
_setStoreWineSaiYouText() async {
Map<String, dynamic> params = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'notetext': controller.text.trim()
};
bool success =
await menuManageProvider.setStoreWineSaiYouText(context, params);
if (success) {
Navigator.pop(context);
}
}
///消费券
_couponNetworkData({bool isShowLoading = true}) async {
// customerMakingProvider.couponSelectIndex = 0;
... ... @@ -145,8 +168,10 @@ class _WineSettingMsgPageState extends State<WineSettingMsgPage> {
@override
Widget build(BuildContext context) {
customerProvider = Provider.of<CustomerProvider>(context, listen: true);
menuManageProvider = Provider.of<MenuManageProvider>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar('存酒超期通知短信内容设置'),
body: Column(children: [
Expanded(
... ... @@ -381,6 +406,11 @@ class _WineSettingMsgPageState extends State<WineSettingMsgPage> {
onPressed: () {
//群发短信
// _createMarketing();
// if (controller.text.trim().length == 0) {
// Utils.showToast('请编辑短信内容后再保存!');
// return;
// }
_setStoreWineSaiYouText();
},
)),
],
... ...
... ... @@ -33,8 +33,8 @@ class _WineSettingPageState extends State<WineSettingPage> {
FocusNode dayF = FocusNode();
bool swich = true;
bool swichNotice = true; //推送消息
bool swichMsg = true; //发短信
bool swichNotice = false; //推送消息
bool swichMsg = false; //发短信
MenuManageProvider menuManageProvider;
@override
... ... @@ -51,6 +51,13 @@ class _WineSettingPageState extends State<WineSettingPage> {
if (success) {
swich =
menuManageProvider.dzSellerConfModel.isStoreSms == '0' ? false : true;
swichNotice = menuManageProvider.dzSellerConfModel.storePushMeg == '1'
? true
: false;
swichMsg = menuManageProvider.dzSellerConfModel.storePushSms == '1'
? true
: false;
dayC.text = menuManageProvider.dzSellerConfModel.storeDate ?? '';
setState(() {});
}
... ... @@ -149,66 +156,71 @@ class _WineSettingPageState extends State<WineSettingPage> {
}
///获取经理数据
Future<bool> _setIsStoreSms() async {
_setData() async {
Map<String, dynamic> data = {
"is_store_sms": swich ? '1' : '0',
"store_date": dayC.text.trim(),
"store_push_meg": swichNotice ? '1' : '0',
"store_push_sms": swichMsg ? '1' : '0'
};
Map<String, String> params = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'key': 'is_store_sms',
'value': swich ? '1' : '0'
'data': jsonEncode(data),
};
bool success =
await menuManageProvider.setConfing(context, params, needToast: false);
if (success) {
return true;
} else {
return false;
}
await menuManageProvider.setConfings(context, params, needToast: true);
// if (success) {
// return true;
// } else {
// return false;
// }
}
///
Future<bool> _setStoreDate() async {
Map<String, String> params = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'key': 'store_date',
'value': dayC.text.trim()
};
// Future<bool> _setStoreDate() async {
// Map<String, String> params = {
// 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
// 'key': 'store_date',
// 'value': dayC.text.trim()
// };
bool success =
await menuManageProvider.setConfing(context, params, needToast: false);
if (success) {
return true;
} else {
return false;
}
}
// bool success =
// await menuManageProvider.setConfing(context, params, needToast: false);
// if (success) {
// return true;
// } else {
// return false;
// }
// }
_setData() async {
await Future.wait<bool>([_setIsStoreSms(), _setStoreDate()])
.then((results) async {
print(results[0]);
if (results[0] && results[1]) {
//都成功
Utils.showToast('设置成功');
} else {
if (results[0]) {
//取酒是否需要短信验证码成功
Utils.showToast('取酒需要提供短信验证码设置成功');
} else {
//取酒是否需要短信验证码成功失败
Utils.showToast('取酒需要提供短信验证码设置失败');
}
if (results[1]) {
//超期提醒天数成功
Utils.showToast('超期提醒天数设置成功');
} else {
//超期提醒天数失败
Utils.showToast('超期提醒天数设置失败');
}
}
}).catchError((e) {
print(e);
});
}
// _setData() async {
// await Future.wait<bool>([_setIsStoreSms(), _setStoreDate()])
// .then((results) async {
// print(results[0]);
// if (results[0] && results[1]) {
// //都成功
// Utils.showToast('设置成功');
// } else {
// if (results[0]) {
// //取酒是否需要短信验证码成功
// Utils.showToast('取酒需要提供短信验证码设置成功');
// } else {
// //取酒是否需要短信验证码成功失败
// Utils.showToast('取酒需要提供短信验证码设置失败');
// }
// if (results[1]) {
// //超期提醒天数成功
// Utils.showToast('超期提醒天数设置成功');
// } else {
// //超期提醒天数失败
// Utils.showToast('超期提醒天数设置失败');
// }
// }
// }).catchError((e) {
// print(e);
// });
// }
@override
Widget build(BuildContext context) {
... ... @@ -259,100 +271,99 @@ class _WineSettingPageState extends State<WineSettingPage> {
inputType:
TextInputType.numberWithOptions(decimal: true))),
_divider(),
// VEmptyView(20),
// InkWell(
// onTap: () {
// setState(() {
// swichNotice = !swichNotice;
// });
// },
// child: Container(
// height: w(48),
// padding: EdgeInsets.only(left: w(30), right: w(26)),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// '存酒超期时发送超期消息',
// style: TextStyle(
// fontSize: font(16),
// color: MyColours.color_515151),
// ),
// Image.asset(
// Utils.getImgPath(
// swichNotice ? 'swich_on' : 'swich_off'),
// width: w(44),
// )
// ],
// ),
// )),
// Padding(
// padding: EdgeInsets.only(left: w(15), right: w(10)),
// child: _divider(),
// ),
// VEmptyView(20),
// InkWell(
// onTap: () {
// setState(() {
// swichMsg = !swichMsg;
// });
// },
// child: Container(
// height: w(48),
// padding: EdgeInsets.only(left: w(30), right: w(26)),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// '存酒超期时自动给客户发送短信',
// style: TextStyle(
// fontSize: font(16),
// color: MyColours.color_515151),
// ),
// Image.asset(
// Utils.getImgPath(
// swichMsg ? 'swich_on' : 'swich_off'),
// width: w(44),
// )
// ],
// ),
// )),
// Padding(
// padding: EdgeInsets.only(left: w(15), right: w(10)),
// child: _divider(),
// ),
// VEmptyView(20),
// InkWell(
// onTap: () {
// NavigatorUtil.goWineSettingMsgPage(
// context);
// },
// child: Container(
// height: w(48),
// padding: EdgeInsets.only(left: w(30), right: w(26)),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Text(
// '存酒超期通知短信设置',
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: font(16)),
// ),
// Container(
// padding: EdgeInsets.symmetric(
// horizontal: w(11), vertical: w(4)),
// child: Image.asset(
// "assets/arrow_right_new.png",
// width: w(9),
// height: w(16),
// ),
// )
// ]))),
// Padding(
// padding: EdgeInsets.only(left: w(15), right: w(10)),
// child: _divider(),
// ),
VEmptyView(20),
InkWell(
onTap: () {
setState(() {
swichNotice = !swichNotice;
});
},
child: Container(
height: w(48),
padding: EdgeInsets.only(left: w(30), right: w(26)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'存酒超期时发送超期消息',
style: TextStyle(
fontSize: font(16),
color: MyColours.color_515151),
),
Image.asset(
Utils.getImgPath(
swichNotice ? 'swich_on' : 'swich_off'),
width: w(44),
)
],
),
)),
Padding(
padding: EdgeInsets.only(left: w(15), right: w(10)),
child: _divider(),
),
VEmptyView(20),
InkWell(
onTap: () {
setState(() {
swichMsg = !swichMsg;
});
},
child: Container(
height: w(48),
padding: EdgeInsets.only(left: w(30), right: w(26)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'存酒超期时自动给客户发送短信',
style: TextStyle(
fontSize: font(16),
color: MyColours.color_515151),
),
Image.asset(
Utils.getImgPath(
swichMsg ? 'swich_on' : 'swich_off'),
width: w(44),
)
],
),
)),
Padding(
padding: EdgeInsets.only(left: w(15), right: w(10)),
child: _divider(),
),
VEmptyView(20),
InkWell(
onTap: () {
NavigatorUtil.goWineSettingMsgPage(context);
},
child: Container(
height: w(48),
padding: EdgeInsets.only(left: w(30), right: w(26)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'存酒超期通知短信设置',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(16)),
),
Container(
padding: EdgeInsets.symmetric(
horizontal: w(11), vertical: w(4)),
child: Image.asset(
"assets/arrow_right_new.png",
width: w(9),
height: w(16),
),
)
]))),
Padding(
padding: EdgeInsets.only(left: w(15), right: w(10)),
child: _divider(),
),
],
)),
),
... ...
... ... @@ -455,6 +455,39 @@ class MarketingCenterProvider extends ChangeNotifier {
return false;
}
// 设置订座商家配置信息
Future<bool> setConfings(BuildContext context, Map<String, String> params,
{bool showLoading = true, bool needToast = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.set_confings,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
if (needToast) {
Utils.showToast('设置失败,请重试');
}
return false;
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data == 0 || baseResp.data == 1) {
if (needToast) {
Utils.showToast('设置成功');
}
return true;
} else {
if (needToast) {
Utils.showToast('设置失败,请重试');
}
}
} else {
if (needToast) {
Utils.showToast(baseResp.msg ?? '设置失败,请重试');
}
}
return false;
}
// 设置订座商家配置信息
Future<bool> setConfing(BuildContext context, Map<String, String> params,
{bool showLoading = true, bool needToast = true}) async {
... ...
... ... @@ -170,6 +170,106 @@ class MenuManageProvider extends ChangeNotifier {
}
// 设置订座商家配置信息
Future<bool> setConfings(BuildContext context, Map<String, String> params,
{bool showLoading = true, bool needToast = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.set_confings,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
if (needToast) {
Utils.showToast('设置失败,请重试');
}
return false;
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data == 0 || baseResp.data == 1) {
if (needToast) {
Utils.showToast('设置成功');
}
return true;
} else {
if (needToast) {
Utils.showToast('设置失败,请重试');
}
}
} else {
if (needToast) {
Utils.showToast(baseResp.msg ?? '设置失败,请重试');
}
}
return false;
}
// 获取存酒短信可变内容
Future<String> getStoreWineSaiYouText(BuildContext context,
{bool showLoading = true, bool needToast = true}) async {
Map<String, String> params = {
'sid': Provider.of<UserModel>(context,listen: false).user.sellerid
};
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(
context, Method.post, HttpUrl.get_store_wine_sai_you_text,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
return '';
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data is bool) {
//没有值
} else {
return baseResp.data['notetext'];
}
} else {
// if (needToast) {
// Utils.showToast(baseResp.msg ?? '设置失败,请重试');
// }
}
return '';
}
// 配置商家存酒短信可变内容
Future<bool> setStoreWineSaiYouText(BuildContext context, Map<String, dynamic> params,
{bool showLoading = true, bool needToast = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.set_store_wine_sai_you_text,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
if (needToast) {
Utils.showToast('设置失败,请重试');
}
return false;
});
if (baseResp.code == Constant.status_success) {
if (baseResp.data is Map || baseResp.data == 0 || baseResp.data == 1) {
if (needToast) {
Utils.showToast('设置成功');
}
return true;
} else {
if (needToast) {
Utils.showToast('设置失败,请重试');
}
}
} else {
if (needToast) {
Utils.showToast(baseResp.msg ?? '设置失败,请重试');
}
}
return false;
}
// 设置订座商家配置信息
Future<bool> setConfing(BuildContext context, Map<String, String> params,
{bool showLoading = true, bool needToast = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
... ... @@ -409,7 +509,8 @@ class MenuManageProvider extends ChangeNotifier {
BuildContext context, Map<String, String> params,
{showLoading = false}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.post, HttpUrl.set_cookbook_class_by_id,
.request<dynamic>(
context, Method.post, HttpUrl.set_cookbook_class_by_id,
data: params, showLoading: showLoading)
.catchError((error) {
print(error.toString());
... ...