|
|
|
1
|
+import 'dart:convert';
|
|
|
|
2
|
+
|
|
|
|
3
|
+import 'package:flutter/material.dart';
|
|
|
|
4
|
+import 'package:one_key/constant/constant.dart';
|
|
|
|
5
|
+import 'package:one_key/models/get_reserve_type_field_model.dart';
|
|
|
|
6
|
+import 'package:one_key/models/voice_welcome_config_model.dart';
|
|
|
|
7
|
+import 'package:one_key/net/base_resp.dart';
|
|
|
|
8
|
+import 'package:one_key/net/dio_util.dart';
|
|
|
|
9
|
+import 'package:one_key/net/http_url.dart';
|
|
|
|
10
|
+import 'package:one_key/provider/user_model.dart';
|
|
|
|
11
|
+import 'package:one_key/res/colors.dart';
|
|
|
|
12
|
+import 'package:one_key/utils/screen_util.dart';
|
|
|
|
13
|
+import 'package:one_key/utils/utils.dart';
|
|
|
|
14
|
+import 'package:one_key/widgets/MyDivider.dart';
|
|
|
|
15
|
+import 'package:one_key/widgets/round_button.dart';
|
|
|
|
16
|
+import 'package:one_key/widgets/system_app_bar.dart';
|
|
|
|
17
|
+import 'package:one_key/widgets/v_empty_view.dart';
|
|
|
|
18
|
+import 'package:provider/provider.dart';
|
|
|
|
19
|
+
|
|
|
|
20
|
+/***
|
|
|
|
21
|
+ * 语音欢迎致辞设置
|
|
|
|
22
|
+ */
|
|
|
|
23
|
+class VoiceWelcomeSettingPage extends StatefulWidget {
|
|
|
|
24
|
+ VoiceWelcomeSettingPage({Key? key}) : super(key: key);
|
|
|
|
25
|
+
|
|
|
|
26
|
+ @override
|
|
|
|
27
|
+ _VoiceWelcomeSettingPageState createState() =>
|
|
|
|
28
|
+ _VoiceWelcomeSettingPageState();
|
|
|
|
29
|
+}
|
|
|
|
30
|
+
|
|
|
|
31
|
+class _VoiceWelcomeSettingPageState extends State<VoiceWelcomeSettingPage> {
|
|
|
|
32
|
+ bool addVoiceInfo = false; //预订安排中附加语音欢迎致辞
|
|
|
|
33
|
+ bool guestVoiceSame = true; //被请人语音播报与预订人一致
|
|
|
|
34
|
+ bool specialVoiceEnabled = false; //是否启用特殊用餐类型语音播报
|
|
|
|
35
|
+
|
|
|
|
36
|
+ TextEditingController voiceIncoC = TextEditingController(); //预订人语音播报
|
|
|
|
37
|
+ TextEditingController guestDefaultC = TextEditingController(); //被请人默认
|
|
|
|
38
|
+ TextEditingController guestSpecialC = TextEditingController(); //被请人特殊
|
|
|
|
39
|
+
|
|
|
|
40
|
+ FocusNode voiceIncoNode = FocusNode();
|
|
|
|
41
|
+ FocusNode guestDefaultNode = FocusNode();
|
|
|
|
42
|
+ FocusNode guestSpecialNode = FocusNode();
|
|
|
|
43
|
+
|
|
|
|
44
|
+ List<VoiceWelcomePlaceholderModel> changeFieldData = []; //可变字段标签
|
|
|
|
45
|
+ List<GetReserveTypeFieldsSunModel>? mealTypes = []; //用餐类型
|
|
|
|
46
|
+ bool mealTypesError = false; //用餐类型接口加载失败
|
|
|
|
47
|
+
|
|
|
|
48
|
+ static const String defaultVoiceText =
|
|
|
|
49
|
+ '尊敬的贵宾,您好!\n欢迎您选择本店。\n您的就餐安排在{预订日期},{餐段},坐席位于{桌位}。\n预祝您用餐愉快,期待您的光临!';
|
|
|
|
50
|
+
|
|
|
|
51
|
+ @override
|
|
|
|
52
|
+ void initState() {
|
|
|
|
53
|
+ super.initState();
|
|
|
|
54
|
+ voiceIncoC.text = defaultVoiceText;
|
|
|
|
55
|
+ guestDefaultC.text = defaultVoiceText;
|
|
|
|
56
|
+ guestSpecialC.text = defaultVoiceText;
|
|
|
|
57
|
+
|
|
|
|
58
|
+ WidgetsBinding.instance.addPostFrameCallback((_) {
|
|
|
|
59
|
+ _getData();
|
|
|
|
60
|
+ });
|
|
|
|
61
|
+ }
|
|
|
|
62
|
+
|
|
|
|
63
|
+ @override
|
|
|
|
64
|
+ void dispose() {
|
|
|
|
65
|
+ voiceIncoC.dispose();
|
|
|
|
66
|
+ guestDefaultC.dispose();
|
|
|
|
67
|
+ guestSpecialC.dispose();
|
|
|
|
68
|
+ voiceIncoNode.dispose();
|
|
|
|
69
|
+ guestDefaultNode.dispose();
|
|
|
|
70
|
+ guestSpecialNode.dispose();
|
|
|
|
71
|
+ super.dispose();
|
|
|
|
72
|
+ }
|
|
|
|
73
|
+
|
|
|
|
74
|
+ _getData() async {
|
|
|
|
75
|
+ try {
|
|
|
|
76
|
+ String? sid =
|
|
|
|
77
|
+ Provider.of<UserModel>(context, listen: false).user?.sellerid;
|
|
|
|
78
|
+ BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
|
|
|
|
79
|
+ context, Method.post, HttpUrl.get_voice_welcome_config,
|
|
|
|
80
|
+ data: {'sid': sid}, showLoading: false);
|
|
|
|
81
|
+ if (baseResp.code == Constant.status_success &&
|
|
|
|
82
|
+ baseResp.data != null &&
|
|
|
|
83
|
+ baseResp.data is Map) {
|
|
|
|
84
|
+ VoiceWelcomeConfigModel model = VoiceWelcomeConfigModel.fromJson(
|
|
|
|
85
|
+ baseResp.data as Map<String, dynamic>);
|
|
|
|
86
|
+ addVoiceInfo = model.isVoiceWelcome == '1' ? true : false;
|
|
|
|
87
|
+ guestVoiceSame =
|
|
|
|
88
|
+ model.inviteeSameAsReserver == '1' ? true : false;
|
|
|
|
89
|
+ voiceIncoC.text = (model.welcomeContent != null &&
|
|
|
|
90
|
+ model.welcomeContent!.isNotEmpty)
|
|
|
|
91
|
+ ? model.welcomeContent!
|
|
|
|
92
|
+ : defaultVoiceText;
|
|
|
|
93
|
+ guestDefaultC.text = (model.inviteeDefaultContent != null &&
|
|
|
|
94
|
+ model.inviteeDefaultContent!.isNotEmpty)
|
|
|
|
95
|
+ ? model.inviteeDefaultContent!
|
|
|
|
96
|
+ : defaultVoiceText;
|
|
|
|
97
|
+ guestSpecialC.text = (model.inviteeSpecialContent != null &&
|
|
|
|
98
|
+ model.inviteeSpecialContent!.isNotEmpty)
|
|
|
|
99
|
+ ? model.inviteeSpecialContent!
|
|
|
|
100
|
+ : defaultVoiceText;
|
|
|
|
101
|
+ specialVoiceEnabled =
|
|
|
|
102
|
+ model.isInviteeSpecialEnabled == '1' ? true : false;
|
|
|
|
103
|
+ //可变字段按钮
|
|
|
|
104
|
+ changeFieldData = model.placeholderButtons ?? [];
|
|
|
|
105
|
+ //用餐类型及已选状态
|
|
|
|
106
|
+ mealTypes = [];
|
|
|
|
107
|
+ model.reserveTypeOptions?.forEach((v) {
|
|
|
|
108
|
+ GetReserveTypeFieldsSunModel temp =
|
|
|
|
109
|
+ GetReserveTypeFieldsSunModel(name: v, select: false);
|
|
|
|
110
|
+ if (model.specialReserveTypes != null &&
|
|
|
|
111
|
+ model.specialReserveTypes!.contains(v)) {
|
|
|
|
112
|
+ temp.select = true;
|
|
|
|
113
|
+ }
|
|
|
|
114
|
+ mealTypes!.add(temp);
|
|
|
|
115
|
+ });
|
|
|
|
116
|
+ mealTypesError = false;
|
|
|
|
117
|
+ } else {
|
|
|
|
118
|
+ mealTypesError = true;
|
|
|
|
119
|
+ if (baseResp.msg != null && baseResp.msg!.isNotEmpty) {
|
|
|
|
120
|
+ Utils.showToast(baseResp.msg!);
|
|
|
|
121
|
+ }
|
|
|
|
122
|
+ }
|
|
|
|
123
|
+ } catch (error) {
|
|
|
|
124
|
+ print(error.toString());
|
|
|
|
125
|
+ mealTypesError = true;
|
|
|
|
126
|
+ }
|
|
|
|
127
|
+ if (mounted) {
|
|
|
|
128
|
+ setState(() {});
|
|
|
|
129
|
+ }
|
|
|
|
130
|
+ }
|
|
|
|
131
|
+
|
|
|
|
132
|
+ ///在光标处插入可变字段
|
|
|
|
133
|
+ _insertField(
|
|
|
|
134
|
+ TextEditingController controller, VoiceWelcomePlaceholderModel field) {
|
|
|
|
135
|
+ FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
|
|
|
|
136
|
+ int cursorPosition = controller.selection.baseOffset;
|
|
|
|
137
|
+ if (cursorPosition != -1) {
|
|
|
|
138
|
+ controller.text = controller.text.substring(0, cursorPosition) +
|
|
|
|
139
|
+ (field.placeholder ?? '') +
|
|
|
|
140
|
+ controller.text.substring(cursorPosition);
|
|
|
|
141
|
+ controller.selection = TextSelection.fromPosition(
|
|
|
|
142
|
+ TextPosition(
|
|
|
|
143
|
+ offset: cursorPosition + field.placeholder!.length,
|
|
|
|
144
|
+ affinity: TextAffinity.downstream));
|
|
|
|
145
|
+ } else {
|
|
|
|
146
|
+ controller.text += field.placeholder ?? '';
|
|
|
|
147
|
+ }
|
|
|
|
148
|
+ setState(() {});
|
|
|
|
149
|
+ }
|
|
|
|
150
|
+
|
|
|
|
151
|
+ ///可变字段标签(全部青绿实底白字)
|
|
|
|
152
|
+ Widget _fieldChip(
|
|
|
|
153
|
+ TextEditingController controller, VoiceWelcomePlaceholderModel field) {
|
|
|
|
154
|
+ return InkWell(
|
|
|
|
155
|
+ onTap: () {
|
|
|
|
156
|
+ _insertField(controller, field);
|
|
|
|
157
|
+ },
|
|
|
|
158
|
+ child: Container(
|
|
|
|
159
|
+ padding: EdgeInsets.symmetric(horizontal: w(8), vertical: w(5)),
|
|
|
|
160
|
+ decoration: BoxDecoration(
|
|
|
|
161
|
+ color: MyColours.color_529EA4,
|
|
|
|
162
|
+ borderRadius: BorderRadius.circular(r(5)),
|
|
|
|
163
|
+ ),
|
|
|
|
164
|
+ child: Text(
|
|
|
|
165
|
+ field.name!,
|
|
|
|
166
|
+ style: TextStyle(
|
|
|
|
167
|
+ color: MyColours.color_ffffff,
|
|
|
|
168
|
+ fontSize: font(12),
|
|
|
|
169
|
+ fontWeight: FontWeight.bold),
|
|
|
|
170
|
+ ),
|
|
|
|
171
|
+ ),
|
|
|
|
172
|
+ );
|
|
|
|
173
|
+ }
|
|
|
|
174
|
+
|
|
|
|
175
|
+ Widget _chipsWrap(
|
|
|
|
176
|
+ TextEditingController controller, List<VoiceWelcomePlaceholderModel> data) {
|
|
|
|
177
|
+ return Padding(
|
|
|
|
178
|
+ padding: EdgeInsets.only(left: w(30)),
|
|
|
|
179
|
+ child: Wrap(
|
|
|
|
180
|
+ spacing: w(10),
|
|
|
|
181
|
+ runSpacing: w(10),
|
|
|
|
182
|
+ children:
|
|
|
|
183
|
+ data.map((e) => _fieldChip(controller, e)).toList(),
|
|
|
|
184
|
+ ),
|
|
|
|
185
|
+ );
|
|
|
|
186
|
+ }
|
|
|
|
187
|
+
|
|
|
|
188
|
+ Widget _sectionHeader(String title, {double? left}) {
|
|
|
|
189
|
+ return Padding(
|
|
|
|
190
|
+ padding: EdgeInsets.only(left: left ?? w(16)),
|
|
|
|
191
|
+ child: Align(
|
|
|
|
192
|
+ alignment: Alignment.centerLeft,
|
|
|
|
193
|
+ child: Text(
|
|
|
|
194
|
+ title,
|
|
|
|
195
|
+ style: TextStyle(
|
|
|
|
196
|
+ color: MyColours.color_666666,
|
|
|
|
197
|
+ fontSize: font(12)),
|
|
|
|
198
|
+ ),
|
|
|
|
199
|
+ ),
|
|
|
|
200
|
+ );
|
|
|
|
201
|
+ }
|
|
|
|
202
|
+
|
|
|
|
203
|
+ ///特殊用餐类型标题行(右侧带启用复选框)
|
|
|
|
204
|
+ Widget _specialHeader() {
|
|
|
|
205
|
+ return InkWell(
|
|
|
|
206
|
+ onTap: () {
|
|
|
|
207
|
+ setState(() {
|
|
|
|
208
|
+ specialVoiceEnabled = !specialVoiceEnabled;
|
|
|
|
209
|
+ });
|
|
|
|
210
|
+ },
|
|
|
|
211
|
+ child: Padding(
|
|
|
|
212
|
+ padding: EdgeInsets.only(left: w(30), right: w(16)),
|
|
|
|
213
|
+ child: Row(
|
|
|
|
214
|
+ children: [
|
|
|
|
215
|
+ Expanded(
|
|
|
|
216
|
+ child: Text(
|
|
|
|
217
|
+ '被请人语音播报设置(特殊用餐类型)',
|
|
|
|
218
|
+ style: TextStyle(
|
|
|
|
219
|
+ color: MyColours.color_666666, fontSize: font(12)),
|
|
|
|
220
|
+ ),
|
|
|
|
221
|
+ ),
|
|
|
|
222
|
+ Image.asset(
|
|
|
|
223
|
+ Utils.getImgPath(
|
|
|
|
224
|
+ specialVoiceEnabled ? 'f_select' : 'f_select_not'),
|
|
|
|
225
|
+ width: w(22),
|
|
|
|
226
|
+ ),
|
|
|
|
227
|
+ ],
|
|
|
|
228
|
+ ),
|
|
|
|
229
|
+ ),
|
|
|
|
230
|
+ );
|
|
|
|
231
|
+ }
|
|
|
|
232
|
+
|
|
|
|
233
|
+ Widget _divider() {
|
|
|
|
234
|
+ return Padding(
|
|
|
|
235
|
+ padding: EdgeInsets.only(left: w(16), right: w(12)),
|
|
|
|
236
|
+ child: MyDivider(double.infinity, w(0.5),
|
|
|
|
237
|
+ color: MyColours.color_E7E7E7),
|
|
|
|
238
|
+ );
|
|
|
|
239
|
+ }
|
|
|
|
240
|
+
|
|
|
|
241
|
+ Widget _textArea(TextEditingController controller, String hint) {
|
|
|
|
242
|
+ return Container(
|
|
|
|
243
|
+ width: double.infinity,
|
|
|
|
244
|
+ margin: EdgeInsets.symmetric(horizontal: w(30)),
|
|
|
|
245
|
+ padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(10)),
|
|
|
|
246
|
+ alignment: Alignment.topLeft,
|
|
|
|
247
|
+ decoration: BoxDecoration(
|
|
|
|
248
|
+ color: MyColours.color_ffffff,
|
|
|
|
249
|
+ border: Border.all(color: MyColours.color_DBDBDB, width: w(1)),
|
|
|
|
250
|
+ borderRadius: BorderRadius.circular(r(10)),
|
|
|
|
251
|
+ ),
|
|
|
|
252
|
+ child: TextField(
|
|
|
|
253
|
+ controller: controller,
|
|
|
|
254
|
+ style: TextStyle(
|
|
|
|
255
|
+ color: MyColours.color_777777,
|
|
|
|
256
|
+ fontSize: font(14),
|
|
|
|
257
|
+ textBaseline: TextBaseline.alphabetic),
|
|
|
|
258
|
+ textAlignVertical: TextAlignVertical.center,
|
|
|
|
259
|
+ maxLines: 7,
|
|
|
|
260
|
+ decoration: InputDecoration(
|
|
|
|
261
|
+ hintText: hint,
|
|
|
|
262
|
+ hintStyle: TextStyle(
|
|
|
|
263
|
+ color: MyColours.color_999999,
|
|
|
|
264
|
+ fontSize: font(14),
|
|
|
|
265
|
+ ),
|
|
|
|
266
|
+ contentPadding: EdgeInsets.zero,
|
|
|
|
267
|
+ border: OutlineInputBorder(borderSide: BorderSide.none),
|
|
|
|
268
|
+ ),
|
|
|
|
269
|
+ keyboardType: TextInputType.multiline,
|
|
|
|
270
|
+ ),
|
|
|
|
271
|
+ );
|
|
|
|
272
|
+ }
|
|
|
|
273
|
+
|
|
|
|
274
|
+ Widget _hintText() {
|
|
|
|
275
|
+ return Padding(
|
|
|
|
276
|
+ padding: EdgeInsets.only(left: w(30)),
|
|
|
|
277
|
+ child: Align(
|
|
|
|
278
|
+ alignment: Alignment.centerLeft,
|
|
|
|
279
|
+ child: Text(
|
|
|
|
280
|
+ '*{预订日期}、{餐段}、{桌位}不能修改,可以删除。',
|
|
|
|
281
|
+ style: TextStyle(color: MyColours.color_B0B0B0, fontSize: font(12)),
|
|
|
|
282
|
+ ),
|
|
|
|
283
|
+ ),
|
|
|
|
284
|
+ );
|
|
|
|
285
|
+ }
|
|
|
|
286
|
+
|
|
|
|
287
|
+ Widget _radioRow(String title, bool selected, VoidCallback onTap) {
|
|
|
|
288
|
+ return InkWell(
|
|
|
|
289
|
+ onTap: onTap,
|
|
|
|
290
|
+ child: Container(
|
|
|
|
291
|
+ width: double.infinity,
|
|
|
|
292
|
+ padding: EdgeInsets.only(
|
|
|
|
293
|
+ left: w(16), right: w(16), top: w(20), bottom: w(20)),
|
|
|
|
294
|
+ child: Row(
|
|
|
|
295
|
+ children: [
|
|
|
|
296
|
+ Expanded(
|
|
|
|
297
|
+ child: Text(
|
|
|
|
298
|
+ title,
|
|
|
|
299
|
+ style: TextStyle(
|
|
|
|
300
|
+ color: MyColours.color_666666, fontSize: font(14)),
|
|
|
|
301
|
+ ),
|
|
|
|
302
|
+ ),
|
|
|
|
303
|
+ Image.asset(
|
|
|
|
304
|
+ Utils.getImgPath(selected ? 'f_radio_sel' : 'f_radio_un'),
|
|
|
|
305
|
+ width: w(20),
|
|
|
|
306
|
+ ),
|
|
|
|
307
|
+ ],
|
|
|
|
308
|
+ ),
|
|
|
|
309
|
+ ),
|
|
|
|
310
|
+ );
|
|
|
|
311
|
+ }
|
|
|
|
312
|
+
|
|
|
|
313
|
+ Widget _mealChipsWrap() {
|
|
|
|
314
|
+ if (mealTypes == null || mealTypes!.isEmpty) {
|
|
|
|
315
|
+ return InkWell(
|
|
|
|
316
|
+ onTap: () {
|
|
|
|
317
|
+ _getData();
|
|
|
|
318
|
+ },
|
|
|
|
319
|
+ child: Padding(
|
|
|
|
320
|
+ padding: EdgeInsets.only(left: w(30)),
|
|
|
|
321
|
+ child: Row(
|
|
|
|
322
|
+ children: [
|
|
|
|
323
|
+ Text(
|
|
|
|
324
|
+ '暂无用餐类型数据,点击重试',
|
|
|
|
325
|
+ style: TextStyle(
|
|
|
|
326
|
+ color: MyColours.color_666666, fontSize: font(12)),
|
|
|
|
327
|
+ ),
|
|
|
|
328
|
+ ],
|
|
|
|
329
|
+ ),
|
|
|
|
330
|
+ ),
|
|
|
|
331
|
+ );
|
|
|
|
332
|
+ }
|
|
|
|
333
|
+ return Padding(
|
|
|
|
334
|
+ padding: EdgeInsets.only(left: w(30)),
|
|
|
|
335
|
+ child: Wrap(
|
|
|
|
336
|
+ spacing: w(10),
|
|
|
|
337
|
+ runSpacing: w(10),
|
|
|
|
338
|
+ children: mealTypes!.map((item) {
|
|
|
|
339
|
+ bool selected = item.select ?? false;
|
|
|
|
340
|
+ return InkWell(
|
|
|
|
341
|
+ onTap: () {
|
|
|
|
342
|
+ setState(() {
|
|
|
|
343
|
+ item.select = !selected;
|
|
|
|
344
|
+ });
|
|
|
|
345
|
+ },
|
|
|
|
346
|
+ child: Container(
|
|
|
|
347
|
+ padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)),
|
|
|
|
348
|
+ decoration: BoxDecoration(
|
|
|
|
349
|
+ color: selected
|
|
|
|
350
|
+ ? MyColours.color_529EA4
|
|
|
|
351
|
+ : MyColours.color_ffffff,
|
|
|
|
352
|
+ borderRadius: BorderRadius.circular(r(5)),
|
|
|
|
353
|
+ border: Border.all(
|
|
|
|
354
|
+ width: w(1),
|
|
|
|
355
|
+ color: selected
|
|
|
|
356
|
+ ? MyColours.color_529EA4
|
|
|
|
357
|
+ : MyColours.color_B7B7B7),
|
|
|
|
358
|
+ ),
|
|
|
|
359
|
+ child: Text(
|
|
|
|
360
|
+ item.name ?? '',
|
|
|
|
361
|
+ style: TextStyle(
|
|
|
|
362
|
+ color: selected
|
|
|
|
363
|
+ ? MyColours.color_ffffff
|
|
|
|
364
|
+ : MyColours.color_B0B0B0,
|
|
|
|
365
|
+ fontSize: font(12),
|
|
|
|
366
|
+ ),
|
|
|
|
367
|
+ ),
|
|
|
|
368
|
+ ),
|
|
|
|
369
|
+ );
|
|
|
|
370
|
+ }).toList(),
|
|
|
|
371
|
+ ),
|
|
|
|
372
|
+ );
|
|
|
|
373
|
+ }
|
|
|
|
374
|
+
|
|
|
|
375
|
+ _save() async {
|
|
|
|
376
|
+ if (addVoiceInfo && voiceIncoC.text.trim().isEmpty) {
|
|
|
|
377
|
+ Utils.showToast('请输入语音欢迎致辞!');
|
|
|
|
378
|
+ return;
|
|
|
|
379
|
+ }
|
|
|
|
380
|
+ List<String> selectedMealTypes = [];
|
|
|
|
381
|
+ mealTypes?.forEach((item) {
|
|
|
|
382
|
+ if (item.select ?? false) {
|
|
|
|
383
|
+ selectedMealTypes.add(item.name ?? '');
|
|
|
|
384
|
+ }
|
|
|
|
385
|
+ });
|
|
|
|
386
|
+
|
|
|
|
387
|
+ Map<String, String?> params = {
|
|
|
|
388
|
+ 'sid': Provider.of<UserModel>(context, listen: false).user?.sellerid,
|
|
|
|
389
|
+ 'is_voice_welcome': addVoiceInfo ? '1' : '0',
|
|
|
|
390
|
+ 'welcome_content': voiceIncoC.text,
|
|
|
|
391
|
+ 'invitee_same_as_reserver': guestVoiceSame ? '1' : '0',
|
|
|
|
392
|
+ 'invitee_default_content': guestDefaultC.text,
|
|
|
|
393
|
+ 'invitee_special_content': guestSpecialC.text,
|
|
|
|
394
|
+ 'special_reserve_types': json.encode(selectedMealTypes),
|
|
|
|
395
|
+ 'is_invitee_special_enabled': specialVoiceEnabled ? '1' : '0',
|
|
|
|
396
|
+ };
|
|
|
|
397
|
+
|
|
|
|
398
|
+ try {
|
|
|
|
399
|
+ BaseResp<dynamic> baseResp = await DioUtil().request<dynamic>(
|
|
|
|
400
|
+ context, Method.post, HttpUrl.save_voice_welcome_config,
|
|
|
|
401
|
+ data: params, showLoading: true);
|
|
|
|
402
|
+ if (baseResp.code == Constant.status_success) {
|
|
|
|
403
|
+ Utils.showToast('保存成功');
|
|
|
|
404
|
+ if (Navigator.canPop(context)) {
|
|
|
|
405
|
+ Navigator.pop(context);
|
|
|
|
406
|
+ }
|
|
|
|
407
|
+ } else {
|
|
|
|
408
|
+ if (baseResp.msg != null && baseResp.msg!.isNotEmpty) {
|
|
|
|
409
|
+ Utils.showToast(baseResp.msg!);
|
|
|
|
410
|
+ }
|
|
|
|
411
|
+ }
|
|
|
|
412
|
+ } catch (error) {
|
|
|
|
413
|
+ print(error.toString());
|
|
|
|
414
|
+ }
|
|
|
|
415
|
+ }
|
|
|
|
416
|
+
|
|
|
|
417
|
+ @override
|
|
|
|
418
|
+ Widget build(BuildContext context) {
|
|
|
|
419
|
+ return Scaffold(
|
|
|
|
420
|
+ backgroundColor: MyColours.color_ffffff,
|
|
|
|
421
|
+ appBar: SystemAppBar('语音欢迎致辞设置'),
|
|
|
|
422
|
+ body: Column(
|
|
|
|
423
|
+ children: [
|
|
|
|
424
|
+ Expanded(
|
|
|
|
425
|
+ child: SingleChildScrollView(
|
|
|
|
426
|
+ child: Column(
|
|
|
|
427
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
428
|
+ children: [
|
|
|
|
429
|
+ //预订安排中附加语音欢迎致辞
|
|
|
|
430
|
+ InkWell(
|
|
|
|
431
|
+ onTap: () {
|
|
|
|
432
|
+ setState(() {
|
|
|
|
433
|
+ addVoiceInfo = !addVoiceInfo;
|
|
|
|
434
|
+ });
|
|
|
|
435
|
+ },
|
|
|
|
436
|
+ child: Container(
|
|
|
|
437
|
+ width: double.infinity,
|
|
|
|
438
|
+ margin: EdgeInsets.only(left: w(16), right: w(16)),
|
|
|
|
439
|
+ padding:
|
|
|
|
440
|
+ EdgeInsets.symmetric(vertical: w(24)),
|
|
|
|
441
|
+ child: Row(
|
|
|
|
442
|
+ children: [
|
|
|
|
443
|
+ Text(
|
|
|
|
444
|
+ '预订安排中附加语音欢迎致辞',
|
|
|
|
445
|
+ style: TextStyle(
|
|
|
|
446
|
+ color: MyColours.color_666666,
|
|
|
|
447
|
+ fontSize: font(16)),
|
|
|
|
448
|
+ ),
|
|
|
|
449
|
+ Spacer(),
|
|
|
|
450
|
+ Image.asset(
|
|
|
|
451
|
+ Utils.getImgPath(
|
|
|
|
452
|
+ addVoiceInfo ? 'swich_on' : 'swich_off'),
|
|
|
|
453
|
+ width: w(44),
|
|
|
|
454
|
+ ),
|
|
|
|
455
|
+ ],
|
|
|
|
456
|
+ ),
|
|
|
|
457
|
+ ),
|
|
|
|
458
|
+ ),
|
|
|
|
459
|
+ _divider(),
|
|
|
|
460
|
+ if (addVoiceInfo) ...[
|
|
|
|
461
|
+ VEmptyView(8),
|
|
|
|
462
|
+ _sectionHeader('预订人语音播报设置'),
|
|
|
|
463
|
+ VEmptyView(16),
|
|
|
|
464
|
+ _textArea(voiceIncoC, '点击录入语音欢迎致辞'),
|
|
|
|
465
|
+ VEmptyView(16),
|
|
|
|
466
|
+ _hintText(),
|
|
|
|
467
|
+ VEmptyView(16),
|
|
|
|
468
|
+ _chipsWrap(voiceIncoC, changeFieldData),
|
|
|
|
469
|
+ VEmptyView(24),
|
|
|
|
470
|
+ _divider(),
|
|
|
|
471
|
+ VEmptyView(24),
|
|
|
|
472
|
+ _sectionHeader('被请人语音播报设置'),
|
|
|
|
473
|
+ VEmptyView(24),
|
|
|
|
474
|
+ _radioRow('被请人语音播报与预订人一致', guestVoiceSame, () {
|
|
|
|
475
|
+ setState(() {
|
|
|
|
476
|
+ guestVoiceSame = true;
|
|
|
|
477
|
+ });
|
|
|
|
478
|
+ }),
|
|
|
|
479
|
+ _divider(),
|
|
|
|
480
|
+ _radioRow('被请人语音播报与预订人不一致', !guestVoiceSame, () {
|
|
|
|
481
|
+ setState(() {
|
|
|
|
482
|
+ guestVoiceSame = false;
|
|
|
|
483
|
+ });
|
|
|
|
484
|
+ }),
|
|
|
|
485
|
+ if (!guestVoiceSame) ...[
|
|
|
|
486
|
+ _divider(),
|
|
|
|
487
|
+ VEmptyView(16),
|
|
|
|
488
|
+ _sectionHeader('被请人语音播报设置(默认)', left: w(30)),
|
|
|
|
489
|
+ VEmptyView(16),
|
|
|
|
490
|
+ _textArea(guestDefaultC, '点击录入被请人语音播报'),
|
|
|
|
491
|
+ VEmptyView(16),
|
|
|
|
492
|
+ _hintText(),
|
|
|
|
493
|
+ VEmptyView(16),
|
|
|
|
494
|
+ _chipsWrap(guestDefaultC, changeFieldData),
|
|
|
|
495
|
+ VEmptyView(24),
|
|
|
|
496
|
+ _specialHeader(),
|
|
|
|
497
|
+ if (specialVoiceEnabled) ...[
|
|
|
|
498
|
+ VEmptyView(16),
|
|
|
|
499
|
+ _textArea(guestSpecialC, '点击录入特殊用餐类型语音播报'),
|
|
|
|
500
|
+ VEmptyView(16),
|
|
|
|
501
|
+ _hintText(),
|
|
|
|
502
|
+ VEmptyView(16),
|
|
|
|
503
|
+ _chipsWrap(guestSpecialC, changeFieldData),
|
|
|
|
504
|
+ VEmptyView(24),
|
|
|
|
505
|
+ Padding(
|
|
|
|
506
|
+ padding: EdgeInsets.only(left: w(30)),
|
|
|
|
507
|
+ child: Text(
|
|
|
|
508
|
+ '请选择该语音播报适用的用餐类型',
|
|
|
|
509
|
+ style: TextStyle(
|
|
|
|
510
|
+ color: MyColours.color_666666,
|
|
|
|
511
|
+ fontSize: font(12)),
|
|
|
|
512
|
+ ),
|
|
|
|
513
|
+ ),
|
|
|
|
514
|
+ VEmptyView(16),
|
|
|
|
515
|
+ _mealChipsWrap(),
|
|
|
|
516
|
+ ],
|
|
|
|
517
|
+ ],
|
|
|
|
518
|
+ VEmptyView(32),
|
|
|
|
519
|
+ ],
|
|
|
|
520
|
+ ],
|
|
|
|
521
|
+ ),
|
|
|
|
522
|
+ ),
|
|
|
|
523
|
+ ),
|
|
|
|
524
|
+ Container(
|
|
|
|
525
|
+ color: MyColours.color_ffffff,
|
|
|
|
526
|
+ padding: EdgeInsets.only(
|
|
|
|
527
|
+ left: w(24), right: w(24), top: w(12), bottom: w(25)),
|
|
|
|
528
|
+ child: RoundButton(
|
|
|
|
529
|
+ text: '保存',
|
|
|
|
530
|
+ gradientStart: MyColours.color_529EA4,
|
|
|
|
531
|
+ gradientEnd: MyColours.color_529EA4,
|
|
|
|
532
|
+ radius: r(5),
|
|
|
|
533
|
+ fontSize: 34,
|
|
|
|
534
|
+ height: w(40),
|
|
|
|
535
|
+ isBold: true,
|
|
|
|
536
|
+ onPressed: () {
|
|
|
|
537
|
+ _save();
|
|
|
|
538
|
+ },
|
|
|
|
539
|
+ ),
|
|
|
|
540
|
+ ),
|
|
|
|
541
|
+ ],
|
|
|
|
542
|
+ ),
|
|
|
|
543
|
+ );
|
|
|
|
544
|
+ }
|
|
|
|
545
|
+} |