|
1
|
import 'package:easy_contact_picker/easy_contact_picker.dart';
|
1
|
import 'package:easy_contact_picker/easy_contact_picker.dart';
|
|
2
|
import 'package:flutter/material.dart';
|
2
|
import 'package:flutter/material.dart';
|
|
3
|
import 'package:flutter_screenutil/screenutil.dart';
|
3
|
import 'package:flutter_screenutil/screenutil.dart';
|
|
|
|
4
|
+import 'package:one_key/provider/coupon_provider.dart';
|
|
4
|
import 'package:one_key/provider/notebook_detail_model.dart';
|
5
|
import 'package:one_key/provider/notebook_detail_model.dart';
|
|
5
|
import 'package:one_key/provider/user_model.dart';
|
6
|
import 'package:one_key/provider/user_model.dart';
|
|
6
|
import 'package:one_key/res/colors.dart';
|
7
|
import 'package:one_key/res/colors.dart';
|
|
@@ -19,7 +20,8 @@ import 'package:provider/provider.dart'; |
|
@@ -19,7 +20,8 @@ import 'package:provider/provider.dart'; |
|
19
|
*/
|
20
|
*/
|
|
20
|
class EditReserverPage extends StatefulWidget {
|
21
|
class EditReserverPage extends StatefulWidget {
|
|
21
|
final String rid;
|
22
|
final String rid;
|
|
22
|
- EditReserverPage(this.rid, {Key key}) : super(key: key);
|
23
|
+ final bool needBtn;
|
|
|
|
24
|
+ EditReserverPage(this.rid, {Key key, this.needBtn}) : super(key: key);
|
|
23
|
|
25
|
|
|
24
|
@override
|
26
|
@override
|
|
25
|
_EditReserverPageState createState() => _EditReserverPageState();
|
27
|
_EditReserverPageState createState() => _EditReserverPageState();
|
|
@@ -153,352 +155,482 @@ class _EditReserverPageState extends State<EditReserverPage> { |
|
@@ -153,352 +155,482 @@ class _EditReserverPageState extends State<EditReserverPage> { |
|
153
|
Navigator.pop(context);
|
155
|
Navigator.pop(context);
|
|
154
|
},
|
156
|
},
|
|
155
|
),
|
157
|
),
|
|
156
|
- body: Padding(
|
|
|
|
157
|
- padding:
|
|
|
|
158
|
- EdgeInsets.symmetric(horizontal: ScreenUtil().setWidth(40)),
|
|
|
|
159
|
- child: Column(children: [
|
|
|
|
160
|
- //第一行 顾客姓名
|
158
|
+ body: Container(
|
|
|
|
159
|
+ color: MyColours.color_ffffff,
|
|
|
|
160
|
+ child: InkWell(
|
|
|
|
161
|
+ onTap: () {
|
|
|
|
162
|
+ FocusScope.of(context).requestFocus(FocusNode()); //点击空白处隐藏键盘
|
|
|
|
163
|
+ },
|
|
|
|
164
|
+ child: Padding(
|
|
|
|
165
|
+ padding: EdgeInsets.symmetric(
|
|
|
|
166
|
+ horizontal: ScreenUtil().setWidth(40)),
|
|
|
|
167
|
+ child: Column(children: [
|
|
|
|
168
|
+ //第一行 顾客姓名
|
|
161
|
|
169
|
|
|
162
|
- VEmptyView(40),
|
170
|
+ VEmptyView(40),
|
|
163
|
|
171
|
|
|
164
|
- Expanded(
|
|
|
|
165
|
- child: Column(
|
|
|
|
166
|
- children: [
|
|
|
|
167
|
- Row(
|
|
|
|
168
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
169
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
170
|
- children: [
|
|
|
|
171
|
Expanded(
|
172
|
Expanded(
|
|
172
|
- child: Container(
|
|
|
|
173
|
- height: ScreenUtil().setWidth(60),
|
|
|
|
174
|
- decoration: BoxDecoration(
|
|
|
|
175
|
- border: Border(
|
|
|
|
176
|
- bottom: BorderSide(
|
|
|
|
177
|
- width: ScreenUtil().setWidth(2),
|
|
|
|
178
|
- color: MyColours.color_efefef))),
|
|
|
|
179
|
- child: TextField(
|
|
|
|
180
|
- maxLines: 1,
|
173
|
+ child: Column(
|
|
|
|
174
|
+ children: [
|
|
|
|
175
|
+ Row(
|
|
|
|
176
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
177
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
178
|
+ children: [
|
|
|
|
179
|
+ Expanded(
|
|
|
|
180
|
+ child: Container(
|
|
|
|
181
|
+ height: ScreenUtil().setWidth(60),
|
|
|
|
182
|
+ decoration: BoxDecoration(
|
|
|
|
183
|
+ border: Border(
|
|
|
|
184
|
+ bottom: BorderSide(
|
|
|
|
185
|
+ width: ScreenUtil().setWidth(2),
|
|
|
|
186
|
+ color: MyColours.color_efefef))),
|
|
|
|
187
|
+ child: TextField(
|
|
|
|
188
|
+ maxLines: 1,
|
|
181
|
|
189
|
|
|
182
|
- //输入文本的样式
|
|
|
|
183
|
- style: TextStyle(
|
|
|
|
184
|
- fontSize: ScreenUtil().setSp(30),
|
|
|
|
185
|
- color: MyColours.color_353535),
|
|
|
|
186
|
- controller: detailModel.nameController,
|
|
|
|
187
|
- focusNode: _nameNode,
|
|
|
|
188
|
- // textAlignVertical: TextAlignVertical.top,
|
|
|
|
189
|
- decoration: InputDecoration(
|
|
|
|
190
|
- hintText: "客人姓名",
|
|
|
|
191
|
- hintStyle: TextStyle(
|
|
|
|
192
|
- color: MyColours.color_999999,
|
|
|
|
193
|
- fontSize: ScreenUtil().setSp(30),
|
|
|
|
194
|
- ),
|
|
|
|
195
|
- // contentPadding:
|
|
|
|
196
|
- // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
|
|
|
|
197
|
- border: InputBorder.none,
|
|
|
|
198
|
- ),
|
|
|
|
199
|
- onChanged: (value) {
|
|
|
|
200
|
- print('ggg');
|
190
|
+ //输入文本的样式
|
|
|
|
191
|
+ style: TextStyle(
|
|
|
|
192
|
+ fontSize: ScreenUtil().setSp(30),
|
|
|
|
193
|
+ color: MyColours.color_353535),
|
|
|
|
194
|
+ controller: detailModel.nameController,
|
|
|
|
195
|
+ focusNode: _nameNode,
|
|
|
|
196
|
+ // textAlignVertical: TextAlignVertical.top,
|
|
|
|
197
|
+ decoration: InputDecoration(
|
|
|
|
198
|
+ hintText: "客人姓名",
|
|
|
|
199
|
+ hintStyle: TextStyle(
|
|
|
|
200
|
+ color: MyColours.color_999999,
|
|
|
|
201
|
+ fontSize: ScreenUtil().setSp(30),
|
|
|
|
202
|
+ ),
|
|
|
|
203
|
+ // contentPadding:
|
|
|
|
204
|
+ // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
|
|
|
|
205
|
+ border: InputBorder.none,
|
|
|
|
206
|
+ ),
|
|
|
|
207
|
+ onChanged: (value) {
|
|
|
|
208
|
+ print('ggg');
|
|
201
|
|
209
|
|
|
202
|
- nameStr = value;
|
|
|
|
203
|
- },
|
|
|
|
204
|
- onEditingComplete: () {
|
|
|
|
205
|
- print('fff');
|
|
|
|
206
|
- _nameNode.unfocus();
|
|
|
|
207
|
- // _homeEnterModel.nameController.text =
|
|
|
|
208
|
- // nameStr + _nameSuffix();
|
|
|
|
209
|
- _addNameSuffix(nameStr, _nameSuffix());
|
|
|
|
210
|
- },
|
|
|
|
211
|
- keyboardType: TextInputType.text,
|
|
|
|
212
|
- ),
|
|
|
|
213
|
- ),
|
|
|
|
214
|
- ),
|
|
|
|
215
|
- // HEmptyView(40),
|
|
|
|
216
|
- Row(
|
|
|
|
217
|
- children: detailModel.sexList.map((value) {
|
|
|
|
218
|
- return _callButton(
|
|
|
|
219
|
- onPress: () {
|
|
|
|
220
|
- for (var item in detailModel.sexList) {
|
|
|
|
221
|
- item['select'] = false;
|
|
|
|
222
|
- if (item['title'] == value['title']) {
|
|
|
|
223
|
- item['select'] = true;
|
|
|
|
224
|
- // _homeEnterModel.nameController.text =
|
|
|
|
225
|
- // nameStr + item['title'];
|
|
|
|
226
|
- if (nameStr != null && nameStr != '') {
|
|
|
|
227
|
- _addNameSuffix(nameStr, item['title']);
|
|
|
|
228
|
- }
|
|
|
|
229
|
- }
|
|
|
|
230
|
- }
|
|
|
|
231
|
- detailModel.notifyListeners();
|
|
|
|
232
|
- },
|
|
|
|
233
|
- content: value['title'],
|
|
|
|
234
|
- hasLeftBorder: value['hasLeftBorder'],
|
|
|
|
235
|
- isSelect: value['select']);
|
|
|
|
236
|
- }).toList()),
|
|
|
|
237
|
- ],
|
|
|
|
238
|
- ),
|
|
|
|
239
|
- // VEmptyView(30),
|
|
|
|
240
|
- // MyDivider(double.infinity,
|
|
|
|
241
|
- // ScreenUtil().setWidth(2),
|
|
|
|
242
|
- // color:
|
|
|
|
243
|
- // MyColours.color_efefef),
|
|
|
|
244
|
- //电话
|
|
|
|
245
|
- VEmptyView(20),
|
|
|
|
246
|
-
|
|
|
|
247
|
- Row(
|
|
|
|
248
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
249
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
250
|
- children: [
|
|
|
|
251
|
- Expanded(
|
|
|
|
252
|
- child: Container(
|
|
|
|
253
|
- height: ScreenUtil().setWidth(60),
|
|
|
|
254
|
- decoration: BoxDecoration(
|
|
|
|
255
|
- border: Border(
|
|
|
|
256
|
- bottom: BorderSide(
|
|
|
|
257
|
- width: ScreenUtil().setWidth(2),
|
|
|
|
258
|
- color: MyColours.color_efefef))),
|
|
|
|
259
|
- child: TextField(
|
|
|
|
260
|
- maxLines: 1,
|
|
|
|
261
|
- //输入文本的样式
|
|
|
|
262
|
- style: TextStyle(
|
|
|
|
263
|
- fontSize: ScreenUtil().setSp(30),
|
|
|
|
264
|
- color: MyColours.color_353535),
|
|
|
|
265
|
- controller: detailModel.phoneController,
|
|
|
|
266
|
- focusNode: _phoneNode,
|
|
|
|
267
|
- // textAlignVertical: TextAlignVertical.top,
|
|
|
|
268
|
- decoration: InputDecoration(
|
|
|
|
269
|
- hintText: "电话",
|
|
|
|
270
|
- hintStyle: TextStyle(
|
|
|
|
271
|
- color: MyColours.color_999999,
|
|
|
|
272
|
- fontSize: ScreenUtil().setSp(30),
|
210
|
+ nameStr = value;
|
|
|
|
211
|
+ },
|
|
|
|
212
|
+ onEditingComplete: () {
|
|
|
|
213
|
+ print('fff');
|
|
|
|
214
|
+ _nameNode.unfocus();
|
|
|
|
215
|
+ // _homeEnterModel.nameController.text =
|
|
|
|
216
|
+ // nameStr + _nameSuffix();
|
|
|
|
217
|
+ _addNameSuffix(nameStr, _nameSuffix());
|
|
|
|
218
|
+ },
|
|
|
|
219
|
+ keyboardType: TextInputType.text,
|
|
|
|
220
|
+ ),
|
|
273
|
),
|
221
|
),
|
|
274
|
- // contentPadding:
|
|
|
|
275
|
- // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
|
|
|
|
276
|
- border: InputBorder.none,
|
|
|
|
277
|
),
|
222
|
),
|
|
278
|
- onChanged: (value) {
|
|
|
|
279
|
- if (value.isEmpty || value.length > 11) {
|
|
|
|
280
|
- //内容为空,或 超过11位
|
|
|
|
281
|
- setState(() {
|
|
|
|
282
|
- detailModel.userHistorys.clear();
|
|
|
|
283
|
- });
|
|
|
|
284
|
- return;
|
|
|
|
285
|
- }
|
|
|
|
286
|
- Map<String, String> params = {
|
|
|
|
287
|
- "keywords": value,
|
|
|
|
288
|
- "sid": Provider.of<UserModel>(context,
|
|
|
|
289
|
- listen: false)
|
|
|
|
290
|
- .user
|
|
|
|
291
|
- .sellerid,
|
|
|
|
292
|
- };
|
|
|
|
293
|
- detailModel.getUserHistorys(context, params);
|
|
|
|
294
|
- },
|
|
|
|
295
|
- onEditingComplete: () {
|
|
|
|
296
|
- _phoneNode.unfocus();
|
|
|
|
297
|
- },
|
|
|
|
298
|
- onTap: () {
|
|
|
|
299
|
- setState(() {
|
|
|
|
300
|
- showPhoneHistory = true;
|
|
|
|
301
|
- });
|
|
|
|
302
|
- // Future.delayed(Duration(milliseconds: 300), () {
|
|
|
|
303
|
- // _controller.jumpTo(_controller.position.maxScrollExtent);
|
|
|
|
304
|
- // });
|
|
|
|
305
|
- },
|
|
|
|
306
|
- keyboardType: TextInputType.number,
|
|
|
|
307
|
- )),
|
|
|
|
308
|
- ),
|
|
|
|
309
|
- InkWell(
|
|
|
|
310
|
- onTap: () {
|
|
|
|
311
|
- _openAddressBook();
|
|
|
|
312
|
- },
|
|
|
|
313
|
- child: Container(
|
|
|
|
314
|
- width: ScreenUtil().setWidth(84) * 3,
|
|
|
|
315
|
- height: ScreenUtil().setWidth(48),
|
|
|
|
316
|
- alignment: Alignment.centerRight,
|
|
|
|
317
|
- child: Text('一键录入',
|
|
|
|
318
|
- style: TextStyle(
|
|
|
|
319
|
- color: MyColours.color_199095,
|
|
|
|
320
|
- fontSize: ScreenUtil().setSp(28),
|
|
|
|
321
|
- decoration: TextDecoration.underline)),
|
|
|
|
322
|
- ),
|
|
|
|
323
|
- ),
|
|
|
|
324
|
- ],
|
|
|
|
325
|
- ),
|
|
|
|
326
|
- Stack(
|
|
|
|
327
|
- children: [
|
|
|
|
328
|
- Container(
|
|
|
|
329
|
- height: ScreenUtil().setWidth(180),
|
|
|
|
330
|
- width: double.infinity,
|
|
|
|
331
|
- color: MyColours.color_ffffff,
|
|
|
|
332
|
- ),
|
|
|
|
333
|
- Offstage(
|
|
|
|
334
|
- offstage: !(showPhoneHistory &&
|
|
|
|
335
|
- detailModel.userHistorys.length > 0),
|
|
|
|
336
|
- child: Container(
|
|
|
|
337
|
- decoration: BoxDecoration(
|
|
|
|
338
|
- borderRadius: BorderRadius.circular(8),
|
|
|
|
339
|
- border: Border.all(color: Colors.white),
|
|
|
|
340
|
- color: MyColours.color_ffffff,
|
|
|
|
341
|
- boxShadow: [
|
|
|
|
342
|
- BoxShadow(
|
|
|
|
343
|
- color: MyColours.color_e5e5e5,
|
|
|
|
344
|
- blurRadius: ScreenUtil().setWidth(20))
|
|
|
|
345
|
- ]),
|
|
|
|
346
|
- width: ScreenUtil().setWidth(440),
|
|
|
|
347
|
- height: detailModel.userHistorys.length > 1
|
|
|
|
348
|
- ? ScreenUtil().setWidth(180)
|
|
|
|
349
|
- : ScreenUtil().setWidth(104),
|
|
|
|
350
|
- padding: EdgeInsets.symmetric(
|
|
|
|
351
|
- horizontal: ScreenUtil().setWidth(30)),
|
|
|
|
352
|
- child: Align(
|
|
|
|
353
|
- alignment: Alignment.topCenter,
|
|
|
|
354
|
- child: MediaQuery.removePadding(
|
|
|
|
355
|
- context: context,
|
|
|
|
356
|
- removeTop: true,
|
|
|
|
357
|
- child: ListView.builder(
|
|
|
|
358
|
- itemBuilder: (context, index) {
|
|
|
|
359
|
- return GestureDetector(
|
|
|
|
360
|
- onTap: () {
|
|
|
|
361
|
- setState(() {
|
|
|
|
362
|
- showPhoneHistory = false;
|
|
|
|
363
|
- detailModel.phoneController.text =
|
|
|
|
364
|
- detailModel
|
|
|
|
365
|
- .userHistorys[index].phone;
|
|
|
|
366
|
- // _homeEnterModel.nameController.text =
|
|
|
|
367
|
- // _homeEnterModel
|
|
|
|
368
|
- // .userHistorys[index].rname +
|
|
|
|
369
|
- // _nameSuffix();
|
223
|
+ // HEmptyView(40),
|
|
|
|
224
|
+ Row(
|
|
|
|
225
|
+ children: detailModel.sexList.map((value) {
|
|
|
|
226
|
+ return _callButton(
|
|
|
|
227
|
+ onPress: () {
|
|
|
|
228
|
+ for (var item in detailModel.sexList) {
|
|
|
|
229
|
+ item['select'] = false;
|
|
|
|
230
|
+ if (item['title'] == value['title']) {
|
|
|
|
231
|
+ item['select'] = true;
|
|
|
|
232
|
+ // _homeEnterModel.nameController.text =
|
|
|
|
233
|
+ // nameStr + item['title'];
|
|
|
|
234
|
+ if (nameStr != null &&
|
|
|
|
235
|
+ nameStr != '') {
|
|
370
|
_addNameSuffix(
|
236
|
_addNameSuffix(
|
|
371
|
- detailModel
|
|
|
|
372
|
- .userHistorys[index].rname,
|
|
|
|
373
|
- _nameSuffix());
|
|
|
|
374
|
- nameStr = detailModel
|
|
|
|
375
|
- .userHistorys[index].rname;
|
|
|
|
376
|
- _phoneNode.unfocus();
|
237
|
+ nameStr, item['title']);
|
|
|
|
238
|
+ }
|
|
|
|
239
|
+ }
|
|
|
|
240
|
+ }
|
|
|
|
241
|
+ detailModel.notifyListeners();
|
|
|
|
242
|
+ },
|
|
|
|
243
|
+ content: value['title'],
|
|
|
|
244
|
+ hasLeftBorder: value['hasLeftBorder'],
|
|
|
|
245
|
+ isSelect: value['select']);
|
|
|
|
246
|
+ }).toList()),
|
|
|
|
247
|
+ ],
|
|
|
|
248
|
+ ),
|
|
|
|
249
|
+ // VEmptyView(30),
|
|
|
|
250
|
+ // MyDivider(double.infinity,
|
|
|
|
251
|
+ // ScreenUtil().setWidth(2),
|
|
|
|
252
|
+ // color:
|
|
|
|
253
|
+ // MyColours.color_efefef),
|
|
|
|
254
|
+ //电话
|
|
|
|
255
|
+ VEmptyView(20),
|
|
|
|
256
|
+
|
|
|
|
257
|
+ Row(
|
|
|
|
258
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
259
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
260
|
+ children: [
|
|
|
|
261
|
+ Expanded(
|
|
|
|
262
|
+ child: Container(
|
|
|
|
263
|
+ height: ScreenUtil().setWidth(60),
|
|
|
|
264
|
+ decoration: BoxDecoration(
|
|
|
|
265
|
+ border: Border(
|
|
|
|
266
|
+ bottom: BorderSide(
|
|
|
|
267
|
+ width: ScreenUtil().setWidth(2),
|
|
|
|
268
|
+ color:
|
|
|
|
269
|
+ MyColours.color_efefef))),
|
|
|
|
270
|
+ child: TextField(
|
|
|
|
271
|
+ maxLines: 1,
|
|
|
|
272
|
+ //输入文本的样式
|
|
|
|
273
|
+ style: TextStyle(
|
|
|
|
274
|
+ fontSize: ScreenUtil().setSp(30),
|
|
|
|
275
|
+ color: MyColours.color_353535),
|
|
|
|
276
|
+ controller: detailModel.phoneController,
|
|
|
|
277
|
+ focusNode: _phoneNode,
|
|
|
|
278
|
+ // textAlignVertical: TextAlignVertical.top,
|
|
|
|
279
|
+ decoration: InputDecoration(
|
|
|
|
280
|
+ hintText: "电话",
|
|
|
|
281
|
+ hintStyle: TextStyle(
|
|
|
|
282
|
+ color: MyColours.color_999999,
|
|
|
|
283
|
+ fontSize: ScreenUtil().setSp(30),
|
|
|
|
284
|
+ ),
|
|
|
|
285
|
+ // contentPadding:
|
|
|
|
286
|
+ // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),
|
|
|
|
287
|
+ border: InputBorder.none,
|
|
|
|
288
|
+ ),
|
|
|
|
289
|
+ onChanged: (value) {
|
|
|
|
290
|
+ if (value.isEmpty ||
|
|
|
|
291
|
+ value.length > 11) {
|
|
|
|
292
|
+ //内容为空,或 超过11位
|
|
|
|
293
|
+ setState(() {
|
|
377
|
detailModel.userHistorys.clear();
|
294
|
detailModel.userHistorys.clear();
|
|
378
|
});
|
295
|
});
|
|
379
|
- },
|
|
|
|
380
|
- child: Container(
|
|
|
|
381
|
- width: double.infinity,
|
|
|
|
382
|
- height: ScreenUtil().setWidth(102),
|
|
|
|
383
|
- decoration: BoxDecoration(
|
|
|
|
384
|
- border: Border(
|
|
|
|
385
|
- bottom: (index !=
|
|
|
|
386
|
- (detailModel
|
|
|
|
387
|
- .userHistorys
|
|
|
|
388
|
- .length -
|
|
|
|
389
|
- 1) &&
|
|
|
|
390
|
- detailModel
|
|
|
|
391
|
- .userHistorys
|
|
|
|
392
|
- .length >
|
|
|
|
393
|
- 1)
|
|
|
|
394
|
- ? BorderSide(
|
|
|
|
395
|
- color: MyColours
|
|
|
|
396
|
- .color_e5e5e5,
|
|
|
|
397
|
- width: ScreenUtil()
|
|
|
|
398
|
- .setWidth(2))
|
|
|
|
399
|
- : BorderSide.none)),
|
|
|
|
400
|
- child: Row(
|
|
|
|
401
|
- mainAxisAlignment:
|
|
|
|
402
|
- MainAxisAlignment.spaceBetween,
|
|
|
|
403
|
- children: [
|
|
|
|
404
|
- Text(
|
|
|
|
405
|
- detailModel
|
|
|
|
406
|
- .userHistorys[index].phone,
|
|
|
|
407
|
- style: TextStyle(
|
|
|
|
408
|
- color:
|
|
|
|
409
|
- MyColours.color_333333,
|
|
|
|
410
|
- fontSize:
|
|
|
|
411
|
- ScreenUtil().setSp(32)),
|
|
|
|
412
|
- ),
|
|
|
|
413
|
- Expanded(
|
|
|
|
414
|
- child: Text(
|
296
|
+ return;
|
|
|
|
297
|
+ }
|
|
|
|
298
|
+ Map<String, String> params = {
|
|
|
|
299
|
+ "keywords": value,
|
|
|
|
300
|
+ "sid": Provider.of<UserModel>(context,
|
|
|
|
301
|
+ listen: false)
|
|
|
|
302
|
+ .user
|
|
|
|
303
|
+ .sellerid,
|
|
|
|
304
|
+ };
|
|
|
|
305
|
+ detailModel.getUserHistorys(
|
|
|
|
306
|
+ context, params);
|
|
|
|
307
|
+ },
|
|
|
|
308
|
+ onEditingComplete: () {
|
|
|
|
309
|
+ _phoneNode.unfocus();
|
|
|
|
310
|
+ },
|
|
|
|
311
|
+ onTap: () {
|
|
|
|
312
|
+ setState(() {
|
|
|
|
313
|
+ showPhoneHistory = true;
|
|
|
|
314
|
+ });
|
|
|
|
315
|
+ // Future.delayed(Duration(milliseconds: 300), () {
|
|
|
|
316
|
+ // _controller.jumpTo(_controller.position.maxScrollExtent);
|
|
|
|
317
|
+ // });
|
|
|
|
318
|
+ },
|
|
|
|
319
|
+ keyboardType: TextInputType.number,
|
|
|
|
320
|
+ )),
|
|
|
|
321
|
+ ),
|
|
|
|
322
|
+ InkWell(
|
|
|
|
323
|
+ onTap: () {
|
|
|
|
324
|
+ _openAddressBook();
|
|
|
|
325
|
+ },
|
|
|
|
326
|
+ child: Container(
|
|
|
|
327
|
+ width: ScreenUtil().setWidth(84) * 3,
|
|
|
|
328
|
+ height: ScreenUtil().setWidth(48),
|
|
|
|
329
|
+ alignment: Alignment.centerRight,
|
|
|
|
330
|
+ child: Text('一键录入',
|
|
|
|
331
|
+ style: TextStyle(
|
|
|
|
332
|
+ color: MyColours.color_199095,
|
|
|
|
333
|
+ fontSize: ScreenUtil().setSp(28),
|
|
|
|
334
|
+ decoration:
|
|
|
|
335
|
+ TextDecoration.underline)),
|
|
|
|
336
|
+ ),
|
|
|
|
337
|
+ ),
|
|
|
|
338
|
+ ],
|
|
|
|
339
|
+ ),
|
|
|
|
340
|
+ Stack(
|
|
|
|
341
|
+ children: [
|
|
|
|
342
|
+ Container(
|
|
|
|
343
|
+ height: ScreenUtil().setWidth(180),
|
|
|
|
344
|
+ width: double.infinity,
|
|
|
|
345
|
+ color: MyColours.color_ffffff,
|
|
|
|
346
|
+ ),
|
|
|
|
347
|
+ Offstage(
|
|
|
|
348
|
+ offstage: !(showPhoneHistory &&
|
|
|
|
349
|
+ detailModel.userHistorys.length > 0),
|
|
|
|
350
|
+ child: Container(
|
|
|
|
351
|
+ decoration: BoxDecoration(
|
|
|
|
352
|
+ borderRadius: BorderRadius.circular(8),
|
|
|
|
353
|
+ border: Border.all(color: Colors.white),
|
|
|
|
354
|
+ color: MyColours.color_ffffff,
|
|
|
|
355
|
+ boxShadow: [
|
|
|
|
356
|
+ BoxShadow(
|
|
|
|
357
|
+ color: MyColours.color_e5e5e5,
|
|
|
|
358
|
+ blurRadius:
|
|
|
|
359
|
+ ScreenUtil().setWidth(20))
|
|
|
|
360
|
+ ]),
|
|
|
|
361
|
+ width: ScreenUtil().setWidth(440),
|
|
|
|
362
|
+ height: detailModel.userHistorys.length > 1
|
|
|
|
363
|
+ ? ScreenUtil().setWidth(180)
|
|
|
|
364
|
+ : ScreenUtil().setWidth(104),
|
|
|
|
365
|
+ padding: EdgeInsets.symmetric(
|
|
|
|
366
|
+ horizontal: ScreenUtil().setWidth(30)),
|
|
|
|
367
|
+ child: Align(
|
|
|
|
368
|
+ alignment: Alignment.topCenter,
|
|
|
|
369
|
+ child: MediaQuery.removePadding(
|
|
|
|
370
|
+ context: context,
|
|
|
|
371
|
+ removeTop: true,
|
|
|
|
372
|
+ child: ListView.builder(
|
|
|
|
373
|
+ itemBuilder: (context, index) {
|
|
|
|
374
|
+ return GestureDetector(
|
|
|
|
375
|
+ onTap: () {
|
|
|
|
376
|
+ setState(() {
|
|
|
|
377
|
+ showPhoneHistory = false;
|
|
|
|
378
|
+ detailModel.phoneController
|
|
|
|
379
|
+ .text = detailModel
|
|
|
|
380
|
+ .userHistorys[
|
|
|
|
381
|
+ index]
|
|
|
|
382
|
+ .phone !=
|
|
|
|
383
|
+ null
|
|
|
|
384
|
+ ? detailModel
|
|
|
|
385
|
+ .userHistorys[index]
|
|
|
|
386
|
+ .phone
|
|
|
|
387
|
+ : '';
|
|
|
|
388
|
+ // _homeEnterModel.nameController.text =
|
|
|
|
389
|
+ // _homeEnterModel
|
|
|
|
390
|
+ // .userHistorys[index].rname +
|
|
|
|
391
|
+ // _nameSuffix();
|
|
|
|
392
|
+ _addNameSuffix(
|
|
|
|
393
|
+ detailModel
|
|
|
|
394
|
+ .userHistorys[index]
|
|
|
|
395
|
+ .rname,
|
|
|
|
396
|
+ _nameSuffix());
|
|
|
|
397
|
+ nameStr = detailModel
|
|
|
|
398
|
+ .userHistorys[index]
|
|
|
|
399
|
+ .rname;
|
|
|
|
400
|
+ _phoneNode.unfocus();
|
|
|
|
401
|
+ detailModel.userHistorys
|
|
|
|
402
|
+ .clear();
|
|
|
|
403
|
+ });
|
|
|
|
404
|
+ },
|
|
|
|
405
|
+ child: Container(
|
|
|
|
406
|
+ width: double.infinity,
|
|
|
|
407
|
+ height: ScreenUtil()
|
|
|
|
408
|
+ .setWidth(102),
|
|
|
|
409
|
+ decoration: BoxDecoration(
|
|
|
|
410
|
+ border: Border(
|
|
|
|
411
|
+ bottom: (index !=
|
|
|
|
412
|
+ (detailModel
|
|
|
|
413
|
+ .userHistorys
|
|
|
|
414
|
+ .length -
|
|
|
|
415
|
+ 1) &&
|
|
|
|
416
|
+ detailModel
|
|
|
|
417
|
+ .userHistorys
|
|
|
|
418
|
+ .length >
|
|
|
|
419
|
+ 1)
|
|
|
|
420
|
+ ? BorderSide(
|
|
|
|
421
|
+ color: MyColours
|
|
|
|
422
|
+ .color_e5e5e5,
|
|
|
|
423
|
+ width: ScreenUtil()
|
|
|
|
424
|
+ .setWidth(
|
|
|
|
425
|
+ 2))
|
|
|
|
426
|
+ : BorderSide
|
|
|
|
427
|
+ .none)),
|
|
|
|
428
|
+ child: Row(
|
|
|
|
429
|
+ mainAxisAlignment:
|
|
|
|
430
|
+ MainAxisAlignment
|
|
|
|
431
|
+ .spaceBetween,
|
|
|
|
432
|
+ children: [
|
|
|
|
433
|
+ Text(
|
|
|
|
434
|
+ detailModel
|
|
|
|
435
|
+ .userHistorys[index]
|
|
|
|
436
|
+ .phone,
|
|
|
|
437
|
+ style: TextStyle(
|
|
|
|
438
|
+ color: MyColours
|
|
|
|
439
|
+ .color_333333,
|
|
|
|
440
|
+ fontSize:
|
|
|
|
441
|
+ ScreenUtil()
|
|
|
|
442
|
+ .setSp(32)),
|
|
|
|
443
|
+ ),
|
|
|
|
444
|
+ Expanded(
|
|
|
|
445
|
+ child: Text(
|
|
|
|
446
|
+ detailModel
|
|
|
|
447
|
+ .userHistorys[index]
|
|
|
|
448
|
+ .rname,
|
|
|
|
449
|
+ style: TextStyle(
|
|
|
|
450
|
+ color: MyColours
|
|
|
|
451
|
+ .color_333333,
|
|
|
|
452
|
+ fontSize:
|
|
|
|
453
|
+ ScreenUtil()
|
|
|
|
454
|
+ .setSp(32)),
|
|
|
|
455
|
+ ))
|
|
|
|
456
|
+ ],
|
|
|
|
457
|
+ ),
|
|
|
|
458
|
+ ),
|
|
|
|
459
|
+ );
|
|
|
|
460
|
+ },
|
|
|
|
461
|
+ itemExtent:
|
|
|
|
462
|
+ ScreenUtil().setWidth(104),
|
|
|
|
463
|
+ itemCount:
|
|
|
|
464
|
+ detailModel.userHistorys.length,
|
|
|
|
465
|
+ ))),
|
|
|
|
466
|
+ ),
|
|
|
|
467
|
+ )
|
|
|
|
468
|
+ ],
|
|
|
|
469
|
+ ),
|
|
|
|
470
|
+ ],
|
|
|
|
471
|
+ )),
|
|
|
|
472
|
+
|
|
|
|
473
|
+ Padding(
|
|
|
|
474
|
+ padding:
|
|
|
|
475
|
+ EdgeInsets.only(top: ScreenUtil().setWidth(60)),
|
|
|
|
476
|
+ child: Row(
|
|
|
|
477
|
+ mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
478
|
+ children: [
|
|
|
|
479
|
+ RoundButton(
|
|
|
|
480
|
+ text: '返回',
|
|
|
|
481
|
+ fontSize: 28,
|
|
|
|
482
|
+ isBold: false,
|
|
|
|
483
|
+ height: ScreenUtil().setWidth(70),
|
|
|
|
484
|
+ width: ScreenUtil().setWidth(180),
|
|
|
|
485
|
+ radius: ScreenUtil().setWidth(10),
|
|
|
|
486
|
+ gradientStart: MyColours.color_ffffff,
|
|
|
|
487
|
+ textColor: MyColours.color_333333,
|
|
|
|
488
|
+ borderColor: MyColours.color_199095,
|
|
|
|
489
|
+ gradientEnd: MyColours.color_ffffff,
|
|
|
|
490
|
+ onPressed: () {
|
|
|
|
491
|
+ // setState(() {
|
|
|
|
492
|
+ // nameStr = '';
|
|
|
|
493
|
+ // detailModel.nameController.text = '';
|
|
|
|
494
|
+ // detailModel.phoneController.text = '';
|
|
|
|
495
|
+ // });
|
|
|
|
496
|
+ Navigator.of(context).pop();
|
|
|
|
497
|
+ },
|
|
|
|
498
|
+ ),
|
|
|
|
499
|
+ widget.needBtn
|
|
|
|
500
|
+ ? RoundButton(
|
|
|
|
501
|
+ text: '保存并发短信',
|
|
|
|
502
|
+ fontSize: 28,
|
|
|
|
503
|
+ isBold: false,
|
|
|
|
504
|
+ height: ScreenUtil().setWidth(70),
|
|
|
|
505
|
+ width: ScreenUtil().setWidth(200),
|
|
|
|
506
|
+ radius: ScreenUtil().setWidth(10),
|
|
|
|
507
|
+ gradientStart: MyColours.color_199095,
|
|
|
|
508
|
+ textColor: MyColours.color_ffffff,
|
|
|
|
509
|
+ borderColor: MyColours.color_199095,
|
|
|
|
510
|
+ gradientEnd: MyColours.color_199095,
|
|
|
|
511
|
+ onPressed: () async {
|
|
|
|
512
|
+ if (nameStr == null ||
|
|
|
|
513
|
+ nameStr.trim().length == 0) {
|
|
|
|
514
|
+ Utils.showToast('请填写客人姓名');
|
|
|
|
515
|
+ return;
|
|
|
|
516
|
+ }
|
|
|
|
517
|
+
|
|
|
|
518
|
+ if (detailModel.phoneController.text
|
|
|
|
519
|
+ .trim()
|
|
|
|
520
|
+ .length ==
|
|
|
|
521
|
+ 0) {
|
|
|
|
522
|
+ Utils.showToast('请填写电话');
|
|
|
|
523
|
+ return;
|
|
|
|
524
|
+ }
|
|
|
|
525
|
+ if (!Utils.phoneRegExp(
|
|
|
|
526
|
+ detailModel.phoneController.text)) {
|
|
|
|
527
|
+ Utils.showToast('手机号错误,请修改正确');
|
|
|
|
528
|
+ return;
|
|
|
|
529
|
+ }
|
|
|
|
530
|
+ String sex = '1';
|
|
|
|
531
|
+ for (var item in detailModel.sexList) {
|
|
|
|
532
|
+ if (item['select']) {
|
|
|
|
533
|
+ sex = item['code'];
|
|
|
|
534
|
+ }
|
|
|
|
535
|
+ }
|
|
|
|
536
|
+ bool sucess = await detailModel
|
|
|
|
537
|
+ .upReserveInfo(context, widget.rid,
|
|
|
|
538
|
+ name: nameStr,
|
|
|
|
539
|
+ sex: sex,
|
|
|
|
540
|
+ phone: detailModel
|
|
|
|
541
|
+ .phoneController.text,
|
|
|
|
542
|
+ showLoading: true);
|
|
|
|
543
|
+ if (sucess) {
|
|
|
|
544
|
+ bus.emit(
|
|
|
|
545
|
+ "refresh_tablemanager"); //刷新桌位
|
|
|
|
546
|
+ bus.emit(
|
|
|
|
547
|
+ "refresh_book_list"); //刷新已预订列表
|
|
|
|
548
|
+ bus.emit("refresh_detail");
|
|
|
|
549
|
+ UserModel userModel =
|
|
|
|
550
|
+ Provider.of<UserModel>(context,
|
|
|
|
551
|
+ listen: false);
|
|
|
|
552
|
+ Map<String, String> params = {
|
|
|
|
553
|
+ "rid": widget.rid,
|
|
|
|
554
|
+ "sid": userModel.user.sellerid
|
|
|
|
555
|
+ };
|
|
|
|
556
|
+ CouponProvider couponProvider =
|
|
|
|
557
|
+ Provider.of<CouponProvider>(
|
|
|
|
558
|
+ context,
|
|
|
|
559
|
+ listen: false);
|
|
|
|
560
|
+ bool success = await couponProvider
|
|
|
|
561
|
+ .sendSMSWxSendSms(
|
|
|
|
562
|
+ context, params);
|
|
|
|
563
|
+ print(success);
|
|
|
|
564
|
+ if (success) {
|
|
|
|
565
|
+ Navigator.of(context).pop(
|
|
415
|
detailModel
|
566
|
detailModel
|
|
416
|
- .userHistorys[index].rname,
|
|
|
|
417
|
- style: TextStyle(
|
|
|
|
418
|
- color:
|
|
|
|
419
|
- MyColours.color_333333,
|
|
|
|
420
|
- fontSize:
|
|
|
|
421
|
- ScreenUtil().setSp(32)),
|
|
|
|
422
|
- ))
|
|
|
|
423
|
- ],
|
|
|
|
424
|
- ),
|
|
|
|
425
|
- ),
|
|
|
|
426
|
- );
|
|
|
|
427
|
- },
|
|
|
|
428
|
- itemExtent: ScreenUtil().setWidth(104),
|
|
|
|
429
|
- itemCount: detailModel.userHistorys.length,
|
|
|
|
430
|
- ))),
|
|
|
|
431
|
- ),
|
|
|
|
432
|
- )
|
|
|
|
433
|
- ],
|
|
|
|
434
|
- ),
|
|
|
|
435
|
- ],
|
|
|
|
436
|
- )),
|
567
|
+ .phoneController.text);
|
|
|
|
568
|
+ }
|
|
|
|
569
|
+ }
|
|
|
|
570
|
+ },
|
|
|
|
571
|
+ )
|
|
|
|
572
|
+ : SizedBox(),
|
|
|
|
573
|
+ RoundButton(
|
|
|
|
574
|
+ text: widget.needBtn ? '仅保存' : '保存',
|
|
|
|
575
|
+ fontSize: 28,
|
|
|
|
576
|
+ isBold: false,
|
|
|
|
577
|
+ height: ScreenUtil().setWidth(70),
|
|
|
|
578
|
+ width: ScreenUtil().setWidth(180),
|
|
|
|
579
|
+ radius: ScreenUtil().setWidth(10),
|
|
|
|
580
|
+ gradientStart: widget.needBtn
|
|
|
|
581
|
+ ? MyColours.color_ffffff
|
|
|
|
582
|
+ : MyColours.color_199095,
|
|
|
|
583
|
+ gradientEnd: widget.needBtn
|
|
|
|
584
|
+ ? MyColours.color_ffffff
|
|
|
|
585
|
+ : MyColours.color_199095,
|
|
|
|
586
|
+ textColor: widget.needBtn
|
|
|
|
587
|
+ ? MyColours.color_333333
|
|
|
|
588
|
+ : MyColours.color_ffffff,
|
|
|
|
589
|
+ borderColor: MyColours.color_199095,
|
|
|
|
590
|
+ onPressed: () async {
|
|
|
|
591
|
+ if (nameStr == null ||
|
|
|
|
592
|
+ nameStr.trim().length == 0) {
|
|
|
|
593
|
+ Utils.showToast('请填写客人姓名');
|
|
|
|
594
|
+ return;
|
|
|
|
595
|
+ }
|
|
437
|
|
596
|
|
|
438
|
- Padding(
|
|
|
|
439
|
- padding: EdgeInsets.only(top: ScreenUtil().setWidth(60)),
|
|
|
|
440
|
- child: Row(
|
|
|
|
441
|
- mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
442
|
- children: [
|
|
|
|
443
|
- RoundButton(
|
|
|
|
444
|
- text: '返回',
|
|
|
|
445
|
- fontSize: 28,
|
|
|
|
446
|
- isBold: false,
|
|
|
|
447
|
- height: ScreenUtil().setWidth(70),
|
|
|
|
448
|
- width: ScreenUtil().setWidth(180),
|
|
|
|
449
|
- radius: ScreenUtil().setWidth(10),
|
|
|
|
450
|
- gradientStart: MyColours.color_ffffff,
|
|
|
|
451
|
- textColor: MyColours.color_333333,
|
|
|
|
452
|
- borderColor: MyColours.color_199095,
|
|
|
|
453
|
- gradientEnd: MyColours.color_ffffff,
|
|
|
|
454
|
- onPressed: () {
|
|
|
|
455
|
- setState(() {
|
|
|
|
456
|
- nameStr = '';
|
|
|
|
457
|
- detailModel.nameController.text = '';
|
|
|
|
458
|
- detailModel.phoneController.text = '';
|
|
|
|
459
|
- });
|
|
|
|
460
|
- },
|
|
|
|
461
|
- ),
|
|
|
|
462
|
- RoundButton(
|
|
|
|
463
|
- text: '保存',
|
|
|
|
464
|
- fontSize: 28,
|
|
|
|
465
|
- isBold: false,
|
|
|
|
466
|
- height: ScreenUtil().setWidth(70),
|
|
|
|
467
|
- width: ScreenUtil().setWidth(180),
|
|
|
|
468
|
- radius: ScreenUtil().setWidth(10),
|
|
|
|
469
|
- onPressed: () async {
|
|
|
|
470
|
- if (nameStr == null || nameStr.trim().length == 0) {
|
|
|
|
471
|
- Utils.showToast('请填写客人姓名');
|
|
|
|
472
|
- return;
|
|
|
|
473
|
- }
|
597
|
+ if (detailModel.phoneController.text
|
|
|
|
598
|
+ .trim()
|
|
|
|
599
|
+ .length ==
|
|
|
|
600
|
+ 0) {
|
|
|
|
601
|
+ Utils.showToast('请填写电话');
|
|
|
|
602
|
+ return;
|
|
|
|
603
|
+ }
|
|
|
|
604
|
+ if (!Utils.phoneRegExp(
|
|
|
|
605
|
+ detailModel.phoneController.text)) {
|
|
|
|
606
|
+ Utils.showToast('手机号错误,请修改正确');
|
|
|
|
607
|
+ return;
|
|
|
|
608
|
+ }
|
|
|
|
609
|
+ String sex = '1';
|
|
|
|
610
|
+ for (var item in detailModel.sexList) {
|
|
|
|
611
|
+ if (item['select']) {
|
|
|
|
612
|
+ sex = item['code'];
|
|
|
|
613
|
+ }
|
|
|
|
614
|
+ }
|
|
|
|
615
|
+ bool sucess = await detailModel.upReserveInfo(
|
|
|
|
616
|
+ context, widget.rid,
|
|
|
|
617
|
+ name: nameStr,
|
|
|
|
618
|
+ sex: sex,
|
|
|
|
619
|
+ phone: detailModel.phoneController.text);
|
|
|
|
620
|
+ if (sucess) {
|
|
|
|
621
|
+ EventBus()
|
|
|
|
622
|
+ .emit("refresh_tablemanager"); //刷新桌位
|
|
|
|
623
|
+ bus.emit("refresh_book_list"); //刷新已预订列表
|
|
|
|
624
|
+ bus.emit("refresh_detail");
|
|
474
|
|
625
|
|
|
475
|
- if (detailModel.phoneController.text.trim().length ==
|
|
|
|
476
|
- 0) {
|
|
|
|
477
|
- Utils.showToast('请填写电话');
|
|
|
|
478
|
- return;
|
|
|
|
479
|
- }
|
|
|
|
480
|
- String sex = '1';
|
|
|
|
481
|
- for (var item in detailModel.sexList) {
|
|
|
|
482
|
- if (item['select']) {
|
|
|
|
483
|
- sex = item['code'];
|
|
|
|
484
|
- }
|
|
|
|
485
|
- }
|
|
|
|
486
|
- bool sucess = await detailModel.upReserveInfo(
|
|
|
|
487
|
- context, widget.rid,
|
|
|
|
488
|
- name: nameStr,
|
|
|
|
489
|
- sex: sex,
|
|
|
|
490
|
- phone: detailModel.phoneController.text);
|
|
|
|
491
|
- if (sucess) {
|
|
|
|
492
|
- EventBus().emit("refresh_tablemanager"); //刷新桌位
|
|
|
|
493
|
- bus.emit("refresh_book_list"); //刷新已预订列表
|
|
|
|
494
|
- bus.emit("refresh_detail");
|
|
|
|
495
|
- Navigator.pop(context);
|
|
|
|
496
|
- }
|
|
|
|
497
|
- },
|
|
|
|
498
|
- )
|
|
|
|
499
|
- ],
|
|
|
|
500
|
- )),
|
|
|
|
501
|
- VEmptyView(40)
|
|
|
|
502
|
- ])));
|
626
|
+ Navigator.of(context)
|
|
|
|
627
|
+ .pop(detailModel.phoneController.text);
|
|
|
|
628
|
+ }
|
|
|
|
629
|
+ },
|
|
|
|
630
|
+ )
|
|
|
|
631
|
+ ],
|
|
|
|
632
|
+ )),
|
|
|
|
633
|
+ VEmptyView(40)
|
|
|
|
634
|
+ ])))));
|
|
503
|
}
|
635
|
}
|
|
504
|
} |
636
|
} |