Commit a1c1303ee224d243d0a1f935c766ee477da80784

Authored by wdn127929
1 parent c92d78e7

固定模版OK

@@ -51,6 +51,8 @@ class GetDzSellerConfSunModel { @@ -51,6 +51,8 @@ class GetDzSellerConfSunModel {
51 String isNotice; 51 String isNotice;
52 String isMarketing; 52 String isMarketing;
53 53
  54 + String saiyouyun;
  55 +
54 GetDzSellerConfSunModel( 56 GetDzSellerConfSunModel(
55 {this.id, 57 {this.id,
56 this.sid, 58 this.sid,
@@ -72,7 +74,8 @@ class GetDzSellerConfSunModel { @@ -72,7 +74,8 @@ class GetDzSellerConfSunModel {
72 this.isShowPrice, 74 this.isShowPrice,
73 this.isOpenCancel, 75 this.isOpenCancel,
74 this.isNotice, 76 this.isNotice,
75 - this.isMarketing}); 77 + this.isMarketing,
  78 + this.saiyouyun});
76 79
77 GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) { 80 GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) {
78 id = json['id']; 81 id = json['id'];
@@ -98,6 +101,7 @@ class GetDzSellerConfSunModel { @@ -98,6 +101,7 @@ class GetDzSellerConfSunModel {
98 isOpenCancel = json['is_open_cancel_temp']; 101 isOpenCancel = json['is_open_cancel_temp'];
99 isNotice = json['is_seller_notice']; 102 isNotice = json['is_seller_notice'];
100 isMarketing = json['is_seller_marketing']; 103 isMarketing = json['is_seller_marketing'];
  104 + saiyouyun = json['saiyouyun'];
101 } 105 }
102 106
103 Map<String, dynamic> toJson() { 107 Map<String, dynamic> toJson() {
@@ -123,6 +127,7 @@ class GetDzSellerConfSunModel { @@ -123,6 +127,7 @@ class GetDzSellerConfSunModel {
123 data['is_open_cancel_temp'] = this.isOpenCancel; 127 data['is_open_cancel_temp'] = this.isOpenCancel;
124 data['is_seller_notice'] = this.isNotice; 128 data['is_seller_notice'] = this.isNotice;
125 data['is_seller_marketing'] = this.isMarketing; 129 data['is_seller_marketing'] = this.isMarketing;
  130 + data['saiyouyun'] = this.saiyouyun;
126 131
127 return data; 132 return data;
128 } 133 }
  1 +class SaiYouYunModel {
  2 + int ret;
  3 + List<SaiYouYunSunModel> data;
  4 + String msg;
  5 +
  6 + SaiYouYunModel({this.ret, this.data, this.msg});
  7 +
  8 + SaiYouYunModel.fromJson(Map<String, dynamic> json) {
  9 + ret = json['ret'];
  10 + if (json['data'] != null) {
  11 + data = new List<SaiYouYunSunModel>();
  12 + json['data'].forEach((v) {
  13 + data.add(new SaiYouYunSunModel.fromJson(v));
  14 + });
  15 + }
  16 + msg = json['msg'];
  17 + }
  18 +
  19 + Map<String, dynamic> toJson() {
  20 + final Map<String, dynamic> data = new Map<String, dynamic>();
  21 + data['ret'] = this.ret;
  22 + if (this.data != null) {
  23 + data['data'] = this.data.map((v) => v.toJson()).toList();
  24 + }
  25 + data['msg'] = this.msg;
  26 + return data;
  27 + }
  28 +}
  29 +
  30 +class SaiYouYunSunModel {
  31 + String temp;
  32 + String content;
  33 + bool select = false;
  34 +
  35 + SaiYouYunSunModel({this.temp, this.content});
  36 +
  37 + SaiYouYunSunModel.fromJson(Map<String, dynamic> json) {
  38 + temp = json['temp'];
  39 + content = json['content'];
  40 + }
  41 +
  42 + Map<String, dynamic> toJson() {
  43 + final Map<String, dynamic> data = new Map<String, dynamic>();
  44 + data['temp'] = this.temp;
  45 + data['content'] = this.content;
  46 + return data;
  47 + }
  48 +}
@@ -213,6 +213,7 @@ class DioUtil { @@ -213,6 +213,7 @@ class DioUtil {
213 : response.data[_codeKey]; 213 : response.data[_codeKey];
214 _msg = response.data[_msgKey]; 214 _msg = response.data[_msgKey];
215 _data = response.data[_dataKey]; 215 _data = response.data[_dataKey];
  216 +
216 _responseData = response.data; 217 _responseData = response.data;
217 } else { 218 } else {
218 Map<String, dynamic> _dataMap = _decodeData(response); 219 Map<String, dynamic> _dataMap = _decodeData(response);
@@ -501,4 +501,7 @@ class HttpUrl { @@ -501,4 +501,7 @@ class HttpUrl {
501 static const String set_reserve_deposit = 501 static const String set_reserve_deposit =
502 "?service=App.Reserve.SetReserveDeposit"; // 取消订单设置定金走向 502 "?service=App.Reserve.SetReserveDeposit"; // 取消订单设置定金走向
503 503
  504 + static const String get_sai_you_yun_list =
  505 + "?service=App.SaiYouYun.GetSaiYouYunList"; // 获取赛邮云短信模板列表
  506 +
504 } 507 }
@@ -53,12 +53,16 @@ class _CustomerNoticeSettingPageState extends State<CustomerNoticeSettingPage> { @@ -53,12 +53,16 @@ class _CustomerNoticeSettingPageState extends State<CustomerNoticeSettingPage> {
53 53
54 setState(() {}); 54 setState(() {});
55 }); 55 });
  56 + bus.on("getDzSellerConf", (arg) {
  57 + getDzSellerConf();
  58 + });
56 }); 59 });
57 } 60 }
58 61
59 @override 62 @override
60 void dispose() { 63 void dispose() {
61 bus.off('theme_color_type_name'); 64 bus.off('theme_color_type_name');
  65 + bus.off('getDzSellerConf');
62 super.dispose(); 66 super.dispose();
63 } 67 }
64 68
@@ -79,6 +83,8 @@ class _CustomerNoticeSettingPageState extends State<CustomerNoticeSettingPage> { @@ -79,6 +83,8 @@ class _CustomerNoticeSettingPageState extends State<CustomerNoticeSettingPage> {
79 marketingCenterProvider.dzSellerConfModel.isMarketing == '1' 83 marketingCenterProvider.dzSellerConfModel.isMarketing == '1'
80 ? true 84 ? true
81 : false; 85 : false;
  86 +
  87 + smsTemplate = marketingCenterProvider.dzSellerConfModel.saiyouyun ?? '';
82 marketingCenterProvider.pageStateSetting = PageState.Success; 88 marketingCenterProvider.pageStateSetting = PageState.Success;
83 } else { 89 } else {
84 marketingCenterProvider.pageStateSetting = PageState.ConnectivityError; 90 marketingCenterProvider.pageStateSetting = PageState.ConnectivityError;
@@ -440,13 +446,14 @@ class _CustomerNoticeSettingPageState extends State<CustomerNoticeSettingPage> { @@ -440,13 +446,14 @@ class _CustomerNoticeSettingPageState extends State<CustomerNoticeSettingPage> {
440 VEmptyView(28), 446 VEmptyView(28),
441 InkWell( 447 InkWell(
442 onTap: () { 448 onTap: () {
443 - NavigatorUtil.goSmsTemplateSettingPage(context); 449 + NavigatorUtil.goSmsTemplateSettingPage(
  450 + context, smsTemplate);
444 }, 451 },
445 child: Padding( 452 child: Padding(
446 padding: EdgeInsets.only( 453 padding: EdgeInsets.only(
447 left: w(16), 454 left: w(16),
448 top: w(14), 455 top: w(14),
449 - bottom: w(3), 456 + bottom: w(10),
450 right: w(12)), 457 right: w(12)),
451 child: Row( 458 child: Row(
452 mainAxisAlignment: 459 mainAxisAlignment:
@@ -3,11 +3,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -3,11 +3,15 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
3 import 'package:one_key/provider/user_model.dart'; 3 import 'package:one_key/provider/user_model.dart';
4 import 'package:one_key/res/colors.dart'; 4 import 'package:one_key/res/colors.dart';
5 import 'package:one_key/utils/dialog_util.dart'; 5 import 'package:one_key/utils/dialog_util.dart';
  6 +import 'package:one_key/utils/utils.dart';
6 import 'package:one_key/widgets/h_empty_view.dart'; 7 import 'package:one_key/widgets/h_empty_view.dart';
7 import 'package:one_key/widgets/system_app_bar.dart'; 8 import 'package:one_key/widgets/system_app_bar.dart';
8 import 'package:one_key/widgets/v_empty_view.dart'; 9 import 'package:one_key/widgets/v_empty_view.dart';
9 import 'package:provider/provider.dart'; 10 import 'package:provider/provider.dart';
10 11
  12 +import '../../../models/sai_you_yun_model.dart';
  13 +import '../../../provider/marketing_center_provider.dart';
  14 +import '../../../utils/event_bus.dart';
11 import '../../../utils/screen_util.dart'; 15 import '../../../utils/screen_util.dart';
12 import '../../../widgets/round_button.dart'; 16 import '../../../widgets/round_button.dart';
13 17
@@ -16,7 +20,8 @@ import '../../../widgets/round_button.dart'; @@ -16,7 +20,8 @@ import '../../../widgets/round_button.dart';
16 */ 20 */
17 21
18 class SmsTemplateSettingPage extends StatefulWidget { 22 class SmsTemplateSettingPage extends StatefulWidget {
19 - SmsTemplateSettingPage({Key key}) : super(key: key); 23 + final String smsTemplate;
  24 + SmsTemplateSettingPage({Key key, this.smsTemplate}) : super(key: key);
20 25
21 @override 26 @override
22 _SmsTemplateSettingPageState createState() => _SmsTemplateSettingPageState(); 27 _SmsTemplateSettingPageState createState() => _SmsTemplateSettingPageState();
@@ -27,45 +32,91 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -27,45 +32,91 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
27 32
28 TextEditingController controller = TextEditingController(); 33 TextEditingController controller = TextEditingController();
29 34
30 - bool canChange = true; //选择了可变模版  
31 -  
32 - List<String> fixedData = ['SXIRf', 'Gld4X4', 'JzDjq2'];  
33 - List<String> changeableData = ['tqNH3', 'J72Nk', '6uZMW4']; 35 + bool canChange = false; //选择了可变模版
34 36
35 List<String> btnData = ['店名', '仅包间名字', '小程序预订卡片']; 37 List<String> btnData = ['店名', '仅包间名字', '小程序预订卡片'];
36 38
  39 + MarketingCenterProvider marketingCenterProvider;
  40 +
  41 + String smsSelectValue = '';
  42 +
37 @override 43 @override
38 void initState() { 44 void initState() {
39 // TODO: implement initState 45 // TODO: implement initState
40 super.initState(); 46 super.initState();
41 47
  48 + smsSelectValue = widget.smsTemplate;
  49 +
42 WidgetsBinding.instance.addPostFrameCallback((_) { 50 WidgetsBinding.instance.addPostFrameCallback((_) {
43 contentChangeStart = 51 contentChangeStart =
44 '尊敬的贵宾,您好!\n诚挚感谢您选择${Provider.of<UserModel>(context, listen: false).user.sellername}用餐!\n'; 52 '尊敬的贵宾,您好!\n诚挚感谢您选择${Provider.of<UserModel>(context, listen: false).user.sellername}用餐!\n';
  53 + _getSaiYouYunList();
45 }); 54 });
46 } 55 }
47 56
48 - List<Widget> templateWidgets(String title, List<String> temData) { 57 + _getSaiYouYunList() async {
  58 + await marketingCenterProvider.getSaiYouYunList(context);
  59 + if (widget.smsTemplate != null && widget.smsTemplate.length > 0) {
  60 + //默认选中
  61 +
  62 + marketingCenterProvider.saiYouYunFixedData.forEach((element) {
  63 + if (element.temp == widget.smsTemplate) {
  64 + element.select = true;
  65 + controller.text = element.content;
  66 + }
  67 + });
  68 + }
  69 + marketingCenterProvider.notifyListeners();
  70 + }
  71 +
  72 + ///设置店铺短信固定模版
  73 + Future<bool> _setTempleteSMS({bool isShowLoading = true}) async {
  74 + Map<String, String> params = {
  75 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  76 + 'key': 'saiyouyun',
  77 + 'value': smsSelectValue,
  78 + };
  79 +
  80 + bool success = await marketingCenterProvider.setConfing(context, params,
  81 + needToast: false);
  82 +
  83 + if (success) {
  84 + bus.emit('getDzSellerConf');
  85 + Utils.showToast('保存成功');
  86 + Navigator.pop(context);
  87 + return true;
  88 + } else {
  89 + return false;
  90 + }
  91 + }
  92 +
  93 + List<Widget> templateWidgets(String title, List<SaiYouYunSunModel> temData) {
49 List<Widget> data = []; 94 List<Widget> data = [];
50 for (var i = 0; i < temData.length; i++) { 95 for (var i = 0; i < temData.length; i++) {
51 - data.add(btnItem(temData[i], onTap: () { 96 + data.add(btnItem(temData[i].temp, temData[i].select, onTap: () {
52 if (title == '固定模版') { 97 if (title == '固定模版') {
53 canChange = false; 98 canChange = false;
54 - fixedData.forEach((element) {  
55 - // element.select = false; 99 + marketingCenterProvider.saiYouYunFixedData.forEach((element) {
  100 + element.select = false;
56 }); 101 });
57 // i 的select = true; 102 // i 的select = true;
58 - changeableData.forEach((element) {  
59 - // element.select = false; 103 + temData[i].select = true;
  104 + smsSelectValue = temData[i].temp;
  105 + controller.text = temData[i].content;
  106 + marketingCenterProvider.saiYouYunchangedData.forEach((element) {
  107 + element.select = false;
60 }); 108 });
61 } else { 109 } else {
62 canChange = true; 110 canChange = true;
63 - changeableData.forEach((element) {  
64 - // element.select = false; 111 + marketingCenterProvider.saiYouYunchangedData.forEach((element) {
  112 + element.select = false;
65 }); 113 });
66 // i 的select = true; 114 // i 的select = true;
67 - fixedData.forEach((element) {  
68 - // element.select = false; 115 + temData[i].select = true;
  116 + smsSelectValue = temData[i].temp;
  117 + controller.text = temData[i].content;
  118 + marketingCenterProvider.saiYouYunFixedData.forEach((element) {
  119 + element.select = false;
69 }); 120 });
70 } 121 }
71 setState(() {}); 122 setState(() {});
@@ -77,7 +128,7 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -77,7 +128,7 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
77 List<Widget> btnWidgets(List<String> temData) { 128 List<Widget> btnWidgets(List<String> temData) {
78 List<Widget> data = []; 129 List<Widget> data = [];
79 for (var i = 0; i < temData.length; i++) { 130 for (var i = 0; i < temData.length; i++) {
80 - data.add(btnItem(temData[i], onTap: () { 131 + data.add(btnItem(temData[i], true, onTap: () {
81 // setState(() { 132 // setState(() {
82 // contentChangeStart += temData[i] + '\n'; 133 // contentChangeStart += temData[i] + '\n';
83 // }); 134 // });
@@ -88,17 +139,18 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -88,17 +139,18 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
88 return data; 139 return data;
89 } 140 }
90 141
91 - Widget btnItem(String title, {GestureTapCallback onTap}) { 142 + Widget btnItem(String title, bool select, {GestureTapCallback onTap}) {
92 return InkWell( 143 return InkWell(
93 onTap: onTap, 144 onTap: onTap,
94 child: Container( 145 child: Container(
95 padding: EdgeInsets.all(w(3)), 146 padding: EdgeInsets.all(w(3)),
96 decoration: BoxDecoration( 147 decoration: BoxDecoration(
  148 + color: select ? MyColours.color_438E93 : MyColours.color_ffffff,
97 borderRadius: BorderRadius.circular(r(5)), 149 borderRadius: BorderRadius.circular(r(5)),
98 border: Border.all(width: w(1), color: MyColours.color_438E93)), 150 border: Border.all(width: w(1), color: MyColours.color_438E93)),
99 child: Text(title, 151 child: Text(title,
100 style: TextStyle( 152 style: TextStyle(
101 - color: MyColours.color_438E93, 153 + color: select ? MyColours.color_ffffff : MyColours.color_438E93,
102 fontSize: font(12), 154 fontSize: font(12),
103 fontWeight: FontWeight.bold)), 155 fontWeight: FontWeight.bold)),
104 ), 156 ),
@@ -123,7 +175,10 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -123,7 +175,10 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
123 spacing: w(5), 175 spacing: w(5),
124 runSpacing: w(5), 176 runSpacing: w(5),
125 children: templateWidgets( 177 children: templateWidgets(
126 - title, title == '固定模版' ? fixedData : changeableData), 178 + title,
  179 + title == '固定模版'
  180 + ? marketingCenterProvider.saiYouYunFixedData
  181 + : marketingCenterProvider.saiYouYunchangedData),
127 )) 182 ))
128 ], 183 ],
129 ), 184 ),
@@ -132,6 +187,8 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -132,6 +187,8 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
132 187
133 @override 188 @override
134 Widget build(BuildContext context) { 189 Widget build(BuildContext context) {
  190 + marketingCenterProvider =
  191 + Provider.of<MarketingCenterProvider>(context, listen: true);
135 return Scaffold( 192 return Scaffold(
136 backgroundColor: MyColours.color_ffffff, 193 backgroundColor: MyColours.color_ffffff,
137 appBar: SystemAppBar('预订通知短信模板选择'), 194 appBar: SystemAppBar('预订通知短信模板选择'),
@@ -143,7 +200,7 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -143,7 +200,7 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
143 crossAxisAlignment: CrossAxisAlignment.start, 200 crossAxisAlignment: CrossAxisAlignment.start,
144 children: [ 201 children: [
145 _templeteWidget('固定模版'), 202 _templeteWidget('固定模版'),
146 - _templeteWidget('可变模版'), 203 + // _templeteWidget('可变模版'),
147 VEmptyView(10), 204 VEmptyView(10),
148 Container( 205 Container(
149 width: double.infinity, 206 width: double.infinity,
@@ -156,13 +213,14 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -156,13 +213,14 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
156 child: Column( 213 child: Column(
157 crossAxisAlignment: CrossAxisAlignment.start, 214 crossAxisAlignment: CrossAxisAlignment.start,
158 children: [ 215 children: [
159 - Text(  
160 - contentChangeStart,  
161 - style: TextStyle(  
162 - height: 1.5,  
163 - color: MyColours.color_66000000,  
164 - fontSize: font(14)),  
165 - ), 216 + if (canChange)
  217 + Text(
  218 + contentChangeStart,
  219 + style: TextStyle(
  220 + height: 1.5,
  221 + color: MyColours.color_66000000,
  222 + fontSize: font(14)),
  223 + ),
166 TextField( 224 TextField(
167 enabled: canChange, 225 enabled: canChange,
168 controller: controller, 226 controller: controller,
@@ -189,7 +247,8 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -189,7 +247,8 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
189 decoration: InputDecoration( 247 decoration: InputDecoration(
190 border: 248 border:
191 OutlineInputBorder(borderSide: BorderSide.none), 249 OutlineInputBorder(borderSide: BorderSide.none),
192 - hintText: '以上内容为固定不可编辑,点击这里开始编辑短信内容', 250 + hintText:
  251 + canChange ? '以上内容为固定不可编辑,点击这里开始编辑短信内容' : '请选择模版',
193 hintStyle: TextStyle( 252 hintStyle: TextStyle(
194 color: MyColours.color_999999, 253 color: MyColours.color_999999,
195 fontSize: ScreenUtil().setSp(28), 254 fontSize: ScreenUtil().setSp(28),
@@ -207,14 +266,15 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -207,14 +266,15 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
207 ), 266 ),
208 ), 267 ),
209 VEmptyView(10), 268 VEmptyView(10),
210 - Container(  
211 - padding: EdgeInsets.symmetric(horizontal: w(21)),  
212 - child: Wrap(  
213 - crossAxisAlignment: WrapCrossAlignment.start,  
214 - spacing: w(10),  
215 - runSpacing: w(10),  
216 - children: btnWidgets(btnData),  
217 - )) 269 + if (canChange)
  270 + Container(
  271 + padding: EdgeInsets.symmetric(horizontal: w(21)),
  272 + child: Wrap(
  273 + crossAxisAlignment: WrapCrossAlignment.start,
  274 + spacing: w(10),
  275 + runSpacing: w(10),
  276 + children: btnWidgets(btnData),
  277 + ))
218 ], 278 ],
219 ), 279 ),
220 )), 280 )),
@@ -256,6 +316,8 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -256,6 +316,8 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
256 fontSize: 32, 316 fontSize: 32,
257 onPressed: () { 317 onPressed: () {
258 DialogUtil.cupertinoAlertDialog(context, 318 DialogUtil.cupertinoAlertDialog(context,
  319 + textAlign: TextAlign.left,
  320 + showlTitle: false,
259 content: canChange 321 content: canChange
260 ? contentChangeStart + controller.text 322 ? contentChangeStart + controller.text
261 : controller.text); 323 : controller.text);
@@ -269,7 +331,13 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> { @@ -269,7 +331,13 @@ class _SmsTemplateSettingPageState extends State<SmsTemplateSettingPage> {
269 radius: ScreenUtil().setWidth(14), 331 radius: ScreenUtil().setWidth(14),
270 isBold: true, 332 isBold: true,
271 fontSize: 32, 333 fontSize: 32,
272 - onPressed: () async {}, 334 + onPressed: () async {
  335 + if (smsSelectValue.length == 0) {
  336 + Utils.showToast('请选择模版类型');
  337 + return;
  338 + }
  339 + _setTempleteSMS();
  340 + },
273 ), 341 ),
274 ) 342 )
275 ], 343 ],
@@ -40,6 +40,7 @@ import 'package:one_key/models/table_list.dart' as table; @@ -40,6 +40,7 @@ import 'package:one_key/models/table_list.dart' as table;
40 40
41 import '../../../provider/table_manager_model.dart'; 41 import '../../../provider/table_manager_model.dart';
42 import 'package:flutter_draggable_gridview/flutter_draggable_gridview.dart'; 42 import 'package:flutter_draggable_gridview/flutter_draggable_gridview.dart';
  43 +import 'package:one_key/models/table.dart' as t;
43 44
44 const scrollDuration = Duration(microseconds: 500); 45 const scrollDuration = Duration(microseconds: 500);
45 46
@@ -68,6 +69,8 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -68,6 +69,8 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
68 69
69 ScrollController controller = ScrollController(); 70 ScrollController controller = ScrollController();
70 71
  72 + Table tableNow;
  73 +
71 @override 74 @override
72 void initState() { 75 void initState() {
73 // TODO: implement initState 76 // TODO: implement initState
@@ -581,6 +584,26 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> { @@ -581,6 +584,26 @@ class MyTableManagerHomePageState extends State<MyTableManagerHomePage> {
581 void onDragAccept( 584 void onDragAccept(
582 List<DraggableGridItem> list, int beforeIndex, int afterIndex) { 585 List<DraggableGridItem> list, int beforeIndex, int afterIndex) {
583 print('onDragAccept: $beforeIndex -> $afterIndex'); 586 print('onDragAccept: $beforeIndex -> $afterIndex');
  587 + print(list);
  588 +
  589 + _setTableByIdOrder(beforeIndex, afterIndex);
  590 + }
  591 +
  592 + //
  593 + Future<bool> _setTableByIdOrder(int beforeIndex, int afterIndex) async {
  594 + t.Table move = tableManagerModel
  595 + .tableOuterList[tableManagerModel.selectNumber].list[beforeIndex];
  596 +
  597 + t.Table after = tableManagerModel
  598 + .tableOuterList[tableManagerModel.selectNumber].list[afterIndex];
  599 + Map<String, String> params = {'id': move.id, 'order': after.order_o};
  600 +
  601 + bool success = await tableManagerModel.setTableById(context, params);
  602 + if (success) {
  603 + return true;
  604 + } else {
  605 + return false;
  606 + }
584 } 607 }
585 608
586 @override 609 @override
@@ -9,6 +9,7 @@ import '../constant/error.dart'; @@ -9,6 +9,7 @@ import '../constant/error.dart';
9 import '../models/GetDzSellerConfModel.dart'; 9 import '../models/GetDzSellerConfModel.dart';
10 import '../models/mark_data_model.dart'; 10 import '../models/mark_data_model.dart';
11 import '../models/recharge_notice_model.dart'; 11 import '../models/recharge_notice_model.dart';
  12 +import '../models/sai_you_yun_model.dart';
12 import '../models/seller_template_color_list_model.dart'; 13 import '../models/seller_template_color_list_model.dart';
13 import '../models/tableOuter.dart'; 14 import '../models/tableOuter.dart';
14 import '../net/base_resp.dart'; 15 import '../net/base_resp.dart';
@@ -42,6 +43,37 @@ class MarketingCenterProvider extends ChangeNotifier { @@ -42,6 +43,37 @@ class MarketingCenterProvider extends ChangeNotifier {
42 GetDzSellerConfSunModel dzSellerConfModel; 43 GetDzSellerConfSunModel dzSellerConfModel;
43 List<SellerTemplateColorListSunModel> templeteDatas = []; //后台配置的模版数据 44 List<SellerTemplateColorListSunModel> templeteDatas = []; //后台配置的模版数据
44 45
  46 + List<SaiYouYunSunModel> saiYouYunFixedData = []; //塞邮云固定模版数据
  47 + List<SaiYouYunSunModel> saiYouYunchangedData = []; //塞邮云固定模版数据
  48 +
  49 +// 获取赛邮云短信模板列表 (固定模版)
  50 +
  51 + Future<bool> getSaiYouYunList(BuildContext context,
  52 + {bool showLoading = true}) async {
  53 + Map<String, String> params = {
  54 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid
  55 + };
  56 + BaseResp<dynamic> baseResp = await DioUtil()
  57 + .request<dynamic>(context, Method.get, HttpUrl.get_sai_you_yun_list,
  58 + data: params, showLoading: showLoading)
  59 + .catchError((error) {
  60 + print(error.toString());
  61 + Utils.showToast('请求失败,请重试');
  62 + return false;
  63 + });
  64 + if (baseResp.code == Constant.status_success) {
  65 + saiYouYunFixedData = SaiYouYunModel.fromJson(baseResp.responseData).data;
  66 + // if (saiYouYunFixedData.length > 0) {
  67 + // saiYouYunFixedData[0].select = true;
  68 + // }
  69 + // notifyListeners();
  70 + return true;
  71 + } else {
  72 + Utils.showToast(baseResp.msg ?? '请求失败,请重试');
  73 + }
  74 + return false;
  75 + }
  76 +
45 //获取桌位列表 77 //获取桌位列表
46 getTableList(context, {needLoading = true}) async { 78 getTableList(context, {needLoading = true}) async {
47 UserModel userModel = Provider.of<UserModel>(context, listen: false); 79 UserModel userModel = Provider.of<UserModel>(context, listen: false);
@@ -123,6 +123,11 @@ class MyTableManageHomeModel with ChangeNotifier { @@ -123,6 +123,11 @@ class MyTableManageHomeModel with ChangeNotifier {
123 tableOuter.list = enableList.map((table) { 123 tableOuter.list = enableList.map((table) {
124 return t.Table.fromJson(table as Map<String, dynamic>); 124 return t.Table.fromJson(table as Map<String, dynamic>);
125 }).toList(); 125 }).toList();
  126 + tableOuter.list.sort(((a, b) =>
  127 + int.parse(a.order_o).compareTo(int.parse(b.order_o)))); //排序
  128 + print(tableOuter.list);
  129 + // tableOuter.list = tableOuter.list.reversed.toList();
  130 + // print(tableOuter.list);
126 return tableOuter; 131 return tableOuter;
127 }).toList(); 132 }).toList();
128 } 133 }
@@ -369,6 +374,8 @@ class MyTableManageHomeModel with ChangeNotifier { @@ -369,6 +374,8 @@ class MyTableManageHomeModel with ChangeNotifier {
369 return areaSunModelList; 374 return areaSunModelList;
370 } else if (baseResp.data.length > 0) { 375 } else if (baseResp.data.length > 0) {
371 areaSunModelList = AreaModel.fromJson(baseResp.responseData).data; 376 areaSunModelList = AreaModel.fromJson(baseResp.responseData).data;
  377 + areaSunModelList.sort(((a, b) =>
  378 + int.parse(a.orderO).compareTo(int.parse(b.orderO)))); //排序
372 } 379 }
373 } 380 }
374 return areaSunModelList; 381 return areaSunModelList;
@@ -1895,10 +1895,10 @@ class NavigatorUtil { @@ -1895,10 +1895,10 @@ class NavigatorUtil {
1895 1895
1896 ///预订通知短信模板选择 1896 ///预订通知短信模板选择
1897 static Future<dynamic> goSmsTemplateSettingPage( 1897 static Future<dynamic> goSmsTemplateSettingPage(
1898 - BuildContext context, { 1898 + BuildContext context, String smsTemplate,{
1899 replace = false, 1899 replace = false,
1900 }) { 1900 }) {
1901 - return _navigateTo(context, "${Routes.sms_template_setting_page}", 1901 + return _navigateTo(context, "${Routes.sms_template_setting_page}?smsTemplate=${Uri.encodeComponent(smsTemplate)}",
1902 replace: replace); 1902 replace: replace);
1903 } 1903 }
1904 } 1904 }
@@ -3231,8 +3231,8 @@ var exportBookDataPageHandle = new Handler( @@ -3231,8 +3231,8 @@ var exportBookDataPageHandle = new Handler(
3231 var smsTemplateSettingPageHandle = new Handler( 3231 var smsTemplateSettingPageHandle = new Handler(
3232 handlerFunc: (BuildContext context, Map<String, List<Object>> params) { 3232 handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
3233 // String rid = params["rid"].first; 3233 // String rid = params["rid"].first;
3234 - // String name = params["name"].first; 3234 + String smsTemplate = params["smsTemplate"].first;
3235 return ChangeNotifierProvider<MarketingCenterProvider>( 3235 return ChangeNotifierProvider<MarketingCenterProvider>(
3236 create: (_) => MarketingCenterProvider(), 3236 create: (_) => MarketingCenterProvider(),
3237 - child: SmsTemplateSettingPage()); 3237 + child: SmsTemplateSettingPage(smsTemplate:smsTemplate));
3238 }); 3238 });
@@ -8323,6 +8323,7 @@ class DialogUtil { @@ -8323,6 +8323,7 @@ class DialogUtil {
8323 Color rColor = MyColours.color_438E93, 8323 Color rColor = MyColours.color_438E93,
8324 bool isBold = false, 8324 bool isBold = false,
8325 bool isBoldContent = false, 8325 bool isBoldContent = false,
  8326 + bool showlTitle = true,
8326 Color contentColor = MyColours.color_99000000, 8327 Color contentColor = MyColours.color_99000000,
8327 VoidCallback lCallback, 8328 VoidCallback lCallback,
8328 TextAlign textAlign = TextAlign.center, 8329 TextAlign textAlign = TextAlign.center,
@@ -8346,18 +8347,19 @@ class DialogUtil { @@ -8346,18 +8347,19 @@ class DialogUtil {
8346 fontSize: ScreenUtil().setSp(32), 8347 fontSize: ScreenUtil().setSp(32),
8347 color: contentColor)), 8348 color: contentColor)),
8348 actions: [ 8349 actions: [
8349 - CupertinoDialogAction(  
8350 - child: Text(lTitle,  
8351 - style: TextStyle(  
8352 - fontSize: ScreenUtil().setSp(32),  
8353 - color: MyColours.color_E6000000)),  
8354 - onPressed: () {  
8355 - Navigator.of(context).pop();  
8356 - if (lCallback != null) {  
8357 - lCallback();  
8358 - }  
8359 - },  
8360 - ), 8350 + if (showlTitle)
  8351 + CupertinoDialogAction(
  8352 + child: Text(lTitle,
  8353 + style: TextStyle(
  8354 + fontSize: ScreenUtil().setSp(32),
  8355 + color: MyColours.color_E6000000)),
  8356 + onPressed: () {
  8357 + Navigator.of(context).pop();
  8358 + if (lCallback != null) {
  8359 + lCallback();
  8360 + }
  8361 + },
  8362 + ),
8361 CupertinoDialogAction( 8363 CupertinoDialogAction(
8362 child: Text(rTitle, 8364 child: Text(rTitle,
8363 style: TextStyle( 8365 style: TextStyle(
@@ -8366,7 +8368,10 @@ class DialogUtil { @@ -8366,7 +8368,10 @@ class DialogUtil {
8366 color: rColor)), 8368 color: rColor)),
8367 onPressed: () { 8369 onPressed: () {
8368 Navigator.of(context).pop(); 8370 Navigator.of(context).pop();
8369 - rCallback(); 8371 +
  8372 + if (rCallback != null) {
  8373 + rCallback();
  8374 + }
8370 }, 8375 },
8371 ), 8376 ),
8372 ], 8377 ],