Commit 6fd560994a6e11f2faab1eb907351511029bb5fe

Authored by wdn127929
1 parent 6bb8b023

宴会新建OK

@@ -54,14 +54,14 @@ class GetBanquetByIdNewSunModel { @@ -54,14 +54,14 @@ class GetBanquetByIdNewSunModel {
54 } 54 }
55 55
56 contractInfo = ContractInfo(); 56 contractInfo = ContractInfo();
57 - // contractInfo = json['contract_info'] != null  
58 - // ? new ContractInfo.fromJson(json['contract_info'])  
59 - // : null; 57 + contractInfo = json['contract_info'] != null
  58 + ? new ContractInfo.fromJson(json['contract_info'])
  59 + : null;
60 invoice = json['invoice'] != null 60 invoice = json['invoice'] != null
61 ? new Invoice.fromJson(convert.jsonDecode(json['invoice'])) 61 ? new Invoice.fromJson(convert.jsonDecode(json['invoice']))
62 : null; //发票信息 62 : null; //发票信息
63 - if (json['cost_info'] != null) {  
64 - costInfo = <CostInfoModel>[]; 63 + costInfo = <CostInfoModel>[];
  64 + if (json['cost_info'] != null && json['cost_info'].length > 0) {
65 double totalP = 0.0; 65 double totalP = 0.0;
66 json['cost_info'].forEach((key, v) { 66 json['cost_info'].forEach((key, v) {
67 CostInfoModel model = CostInfoModel.fromJson(v); 67 CostInfoModel model = CostInfoModel.fromJson(v);
@@ -69,7 +69,12 @@ class GetBanquetByIdNewSunModel { @@ -69,7 +69,12 @@ class GetBanquetByIdNewSunModel {
69 costInfo.add(model); 69 costInfo.add(model);
70 totalP += double.parse(model.sumPrice); 70 totalP += double.parse(model.sumPrice);
71 }); 71 });
72 - contractInfo.contractTotalPrice = totalP.toString(); 72 + contractInfo.contractTotalPrice = totalP == 0.0 ? '' : totalP.toString();
  73 + contractInfo.contractFinalPriceC.text =
  74 + totalP == 0.0 ? '' : totalP.toString();
  75 + contractInfo.customerC.text = contractInfo.contractRname;
  76 + contractInfo.storeC.text = contractInfo.contractSellerName;
  77 + contractInfo.numC.text = contractInfo.contractNo;
73 } 78 }
74 } 79 }
75 80
@@ -168,7 +173,8 @@ class SessionsInfo { @@ -168,7 +173,8 @@ class SessionsInfo {
168 List<WineDetail> wine; 173 List<WineDetail> wine;
169 List<OtherDetail> other; 174 List<OtherDetail> other;
170 String remark; 175 String remark;
171 - List<Images> images; 176 + List<ImagesById> images;
  177 + dynamic tableNum;
172 178
173 SessionsInfo( 179 SessionsInfo(
174 {this.rdate, 180 {this.rdate,
@@ -177,7 +183,8 @@ class SessionsInfo { @@ -177,7 +183,8 @@ class SessionsInfo {
177 this.wine, 183 this.wine,
178 this.other, 184 this.other,
179 this.remark, 185 this.remark,
180 - this.images}); 186 + this.images,
  187 + this.tableNum});
181 188
182 SessionsInfo.fromJson(Map<String, dynamic> json) { 189 SessionsInfo.fromJson(Map<String, dynamic> json) {
183 rdate = json['rdate']; 190 rdate = json['rdate'];
@@ -203,11 +210,13 @@ class SessionsInfo { @@ -203,11 +210,13 @@ class SessionsInfo {
203 remark = json['remark']; 210 remark = json['remark'];
204 211
205 if (json['images'] != null) { 212 if (json['images'] != null) {
206 - images = <Images>[]; 213 + images = <ImagesById>[];
207 convert.jsonDecode(json['images']).forEach((v) { 214 convert.jsonDecode(json['images']).forEach((v) {
208 - images.add(new Images.fromJson(v)); 215 + images.add(new ImagesById.fromJson(v));
209 }); 216 });
210 } 217 }
  218 +
  219 + tableNum = json['table_num'];
211 } 220 }
212 221
213 Map<String, dynamic> toJson() { 222 Map<String, dynamic> toJson() {
@@ -225,6 +234,7 @@ class SessionsInfo { @@ -225,6 +234,7 @@ class SessionsInfo {
225 } 234 }
226 data['remark'] = this.remark; 235 data['remark'] = this.remark;
227 data['images'] = this.images; 236 data['images'] = this.images;
  237 + data['table_num'] = this.tableNum;
228 return data; 238 return data;
229 } 239 }
230 } 240 }
@@ -236,7 +246,7 @@ class SetmealDetail { @@ -236,7 +246,7 @@ class SetmealDetail {
236 String pnum; 246 String pnum;
237 String min; 247 String min;
238 String spare; 248 String spare;
239 - List<Cooklist> cooklist; 249 + List<CooklistByid> cooklist;
240 String mealName; 250 String mealName;
241 251
242 SetmealDetail( 252 SetmealDetail(
@@ -257,9 +267,9 @@ class SetmealDetail { @@ -257,9 +267,9 @@ class SetmealDetail {
257 min = json['min']; 267 min = json['min'];
258 spare = json['spare']; 268 spare = json['spare'];
259 if (json['cooklist'] != null) { 269 if (json['cooklist'] != null) {
260 - cooklist = <Cooklist>[]; 270 + cooklist = <CooklistByid>[];
261 json['cooklist'].forEach((v) { 271 json['cooklist'].forEach((v) {
262 - cooklist.add(new Cooklist.fromJson(v)); 272 + cooklist.add(new CooklistByid.fromJson(v));
263 }); 273 });
264 } 274 }
265 mealName = json['meal_name']; 275 mealName = json['meal_name'];
@@ -281,12 +291,12 @@ class SetmealDetail { @@ -281,12 +291,12 @@ class SetmealDetail {
281 } 291 }
282 } 292 }
283 293
284 -class Cooklist { 294 +class CooklistByid {
285 String cname; 295 String cname;
286 296
287 - Cooklist({this.cname}); 297 + CooklistByid({this.cname});
288 298
289 - Cooklist.fromJson(Map<String, dynamic> json) { 299 + CooklistByid.fromJson(Map<String, dynamic> json) {
290 cname = json['cname']; 300 cname = json['cname'];
291 } 301 }
292 302
@@ -417,8 +427,11 @@ class ContractInfo { @@ -417,8 +427,11 @@ class ContractInfo {
417 String contractRname; 427 String contractRname;
418 String contractSellerName; 428 String contractSellerName;
419 String contractNo; 429 String contractNo;
420 - List<Images> contractImages; 430 + List<ImagesById> contractImages;
421 TextEditingController contractFinalPriceC = TextEditingController(); 431 TextEditingController contractFinalPriceC = TextEditingController();
  432 + TextEditingController customerC = TextEditingController(); //客户签约人
  433 + TextEditingController storeC = TextEditingController(); //店铺签约人
  434 + TextEditingController numC = TextEditingController(); //合同编号
422 435
423 ContractInfo( 436 ContractInfo(
424 {this.contractTotalPrice, 437 {this.contractTotalPrice,
@@ -435,9 +448,9 @@ class ContractInfo { @@ -435,9 +448,9 @@ class ContractInfo {
435 contractSellerName = json['contract_seller_name']; 448 contractSellerName = json['contract_seller_name'];
436 contractNo = json['contract_no']; 449 contractNo = json['contract_no'];
437 if (json['contract_images'] != null) { 450 if (json['contract_images'] != null) {
438 - contractImages = <Images>[]; 451 + contractImages = <ImagesById>[];
439 convert.jsonDecode(json['contract_images']).forEach((v) { 452 convert.jsonDecode(json['contract_images']).forEach((v) {
440 - contractImages.add(new Images.fromJson(v)); 453 + contractImages.add(new ImagesById.fromJson(v));
441 }); 454 });
442 } 455 }
443 } 456 }
@@ -454,12 +467,12 @@ class ContractInfo { @@ -454,12 +467,12 @@ class ContractInfo {
454 } 467 }
455 } 468 }
456 469
457 -class Images { 470 +class ImagesById {
458 String url; 471 String url;
459 472
460 - Images({this.url}); 473 + ImagesById({this.url});
461 474
462 - Images.fromJson(Map<String, dynamic> json) { 475 + ImagesById.fromJson(Map<String, dynamic> json) {
463 url = json['url']; 476 url = json['url'];
464 } 477 }
465 478
@@ -484,6 +497,7 @@ class Invoice { @@ -484,6 +497,7 @@ class Invoice {
484 String addresseePhone; //收件人电话 497 String addresseePhone; //收件人电话
485 String addresseeAddress; //收件人地址 498 String addresseeAddress; //收件人地址
486 String code; //邮编 499 String code; //邮编
  500 + List<ImagesById> images;
487 501
488 Invoice( 502 Invoice(
489 {this.invoiceType, 503 {this.invoiceType,
@@ -498,7 +512,8 @@ class Invoice { @@ -498,7 +512,8 @@ class Invoice {
498 this.addressee, 512 this.addressee,
499 this.addresseePhone, 513 this.addresseePhone,
500 this.addresseeAddress, 514 this.addresseeAddress,
501 - this.code}); 515 + this.code,
  516 + this.images});
502 517
503 Invoice.fromJson(Map<String, dynamic> json) { 518 Invoice.fromJson(Map<String, dynamic> json) {
504 invoiceType = json['invoice_type']; 519 invoiceType = json['invoice_type'];
@@ -514,6 +529,18 @@ class Invoice { @@ -514,6 +529,18 @@ class Invoice {
514 addresseePhone = json['addressee_phone']; 529 addresseePhone = json['addressee_phone'];
515 addresseeAddress = json['addressee_address']; 530 addresseeAddress = json['addressee_address'];
516 code = json['code']; 531 code = json['code'];
  532 + if (json['images'] != null) {
  533 + images = <ImagesById>[];
  534 + if (json['images'] is List) {
  535 + json['images'].forEach((v) {
  536 + images.add(new ImagesById.fromJson(v));
  537 + });
  538 + } else {
  539 + convert.jsonDecode(json['images']).forEach((v) {
  540 + images.add(new ImagesById.fromJson(v));
  541 + });
  542 + }
  543 + }
517 } 544 }
518 545
519 Map<String, dynamic> toJson() { 546 Map<String, dynamic> toJson() {
@@ -531,6 +558,7 @@ class Invoice { @@ -531,6 +558,7 @@ class Invoice {
531 data['addressee_phone'] = this.addresseePhone; 558 data['addressee_phone'] = this.addresseePhone;
532 data['addressee_address'] = this.addresseeAddress; 559 data['addressee_address'] = this.addresseeAddress;
533 data['code'] = this.code; 560 data['code'] = this.code;
  561 + data['images'] = this.images;
534 return data; 562 return data;
535 } 563 }
536 } 564 }
@@ -302,11 +302,15 @@ class HttpUrl { @@ -302,11 +302,15 @@ class HttpUrl {
302 "?service=App.Banquet.GetBanquetDeposit"; //获取宴会定金 302 "?service=App.Banquet.GetBanquetDeposit"; //获取宴会定金
303 static const String del_banquet_deposit = 303 static const String del_banquet_deposit =
304 "?service=App.Banquet.DelBanquetDeposit"; //删除宴会定金 304 "?service=App.Banquet.DelBanquetDeposit"; //删除宴会定金
305 - static const String set_warrant =  
306 - "?service=App.Banquet.SetWarrant"; //设置担保人  
307 - static const String get_banquet_by_id = 305 + static const String set_warrant = "?service=App.Banquet.SetWarrant"; //设置担保人
  306 + static const String get_banquet_by_id =
308 "?service=App.Banquet.GetBanquetById"; //获取宴会详情 307 "?service=App.Banquet.GetBanquetById"; //获取宴会详情
309 - 308 + static const String set_banquet_contract =
  309 + "?service=App.Banquet.SetBanquetContract"; //设置合同信息
  310 + static const String set_invoice =
  311 + "?service=App.Banquet.SetInvoice"; //设置、修改、删除发票
  312 + static const String del_banquet_info =
  313 + "?service=App.Banquet.DelBanquetInfo"; //删除场次
310 314
311 315
312 } 316 }
@@ -83,6 +83,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -83,6 +83,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
83 List<DsoltXt> dsoltList = []; 83 List<DsoltXt> dsoltList = [];
84 UserModel userModel; 84 UserModel userModel;
85 Map<String, List<CookByIdSetmeal>> dataMenu = {}; 85 Map<String, List<CookByIdSetmeal>> dataMenu = {};
  86 + Map<String, String> invoice; //发票
86 87
87 @override 88 @override
88 void initState() { 89 void initState() {
@@ -104,12 +105,17 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -104,12 +105,17 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
104 bus.on("feast_deposit_list", (arg) { 105 bus.on("feast_deposit_list", (arg) {
105 _getBanquetDeposit(); 106 _getBanquetDeposit();
106 }); 107 });
  108 + bus.on("feast_qy_list", (arg) {
  109 + _getBanquetById();
  110 + });
107 } 111 }
108 112
109 @override 113 @override
110 void dispose() { 114 void dispose() {
111 super.dispose(); 115 super.dispose();
112 bus.off('feast_deposit_list'); 116 bus.off('feast_deposit_list');
  117 + bus.off('feast_qy_list');
  118 +
113 feastModel.rid = null; 119 feastModel.rid = null;
114 feastModel.type = null; 120 feastModel.type = null;
115 feastModel.reserve = null; 121 feastModel.reserve = null;
@@ -179,8 +185,18 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -179,8 +185,18 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
179 185
180 ///获取宴会详情 186 ///获取宴会详情
181 _getBanquetById() async { 187 _getBanquetById() async {
182 - Map<String, String> pramas = {'rid': '64'}; //feastModel.rid  
183 - await feastModel.getBanquetById(context, pramas); 188 + Map<String, String> pramas = {'rid': feastModel.rid}; //
  189 + bool success = await feastModel.getBanquetById(context, pramas);
  190 + if (success) {
  191 + _uploadImageProvider.feastRemarkContractImageList = [];
  192 + feastModel.banquetDetail.contractInfo.contractImages.forEach((element) {
  193 + UploadImgModel uploadImgModel = UploadImgModel();
  194 + uploadImgModel.process = 1;
  195 + uploadImgModel.qiniuUrl = element.url;
  196 + _uploadImageProvider.feastRemarkContractImageList.add(uploadImgModel);
  197 + });
  198 + setState(() {});
  199 + }
184 } 200 }
185 201
186 ///获取宴会分类 202 ///获取宴会分类
@@ -297,16 +313,16 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -297,16 +313,16 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
297 Widget menuBtn(String title, {GestureTapCallback onTap}) { 313 Widget menuBtn(String title, {GestureTapCallback onTap}) {
298 return InkWell( 314 return InkWell(
299 onTap: () { 315 onTap: () {
300 - // if (menuSet.contains(title)) {  
301 - setState(() {  
302 - selectMenu = title;  
303 - });  
304 - if (title == '签约') {  
305 - feastModel.pageStateBanquet = PageState.Loading;  
306 - feastModel.notifyListeners();  
307 - _getBanquetById(); 316 + if (menuSet.contains(title)) {
  317 + setState(() {
  318 + selectMenu = title;
  319 + });
  320 + if (title == '签约') {
  321 + feastModel.pageStateBanquet = PageState.Loading;
  322 + feastModel.notifyListeners();
  323 + _getBanquetById();
  324 + }
308 } 325 }
309 - // }  
310 }, 326 },
311 child: Container( 327 child: Container(
312 width: w(40), 328 width: w(40),
@@ -1086,7 +1102,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1086,7 +1102,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1086 height: h(33), 1102 height: h(33),
1087 child: ListView.builder( 1103 child: ListView.builder(
1088 padding: EdgeInsets.only(left: w(21), right: w(9)), 1104 padding: EdgeInsets.only(left: w(21), right: w(9)),
1089 - itemCount: xuantaiData.length + 1, 1105 + itemCount: xuantaiData.length == 5
  1106 + ? xuantaiData.length
  1107 + : xuantaiData.length + 1,
1090 shrinkWrap: true, 1108 shrinkWrap: true,
1091 scrollDirection: Axis.horizontal, 1109 scrollDirection: Axis.horizontal,
1092 itemBuilder: (BuildContext contxt, int index) { 1110 itemBuilder: (BuildContext contxt, int index) {
@@ -1208,11 +1226,46 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1208,11 +1226,46 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1208 gradientStart: MyColours.color_E34D59, 1226 gradientStart: MyColours.color_E34D59,
1209 gradientEnd: MyColours.color_E34D59, 1227 gradientEnd: MyColours.color_E34D59,
1210 onPressed: () async { 1228 onPressed: () async {
1211 - xuantaiData.removeAt(xuantaiSelIndex); 1229 + if (feastModel.sessionsSunModelList !=
  1230 + null &&
  1231 + feastModel.sessionsSunModelList
  1232 + .map((element) {
  1233 + return element.id;
  1234 + })
  1235 + .toList()
  1236 + .contains(
  1237 + xuantaiData[xuantaiSelIndex]
  1238 + .reserveId)) {
  1239 + //该场次已经提交到接口,删除场次的同时,删除本地数据
  1240 + feastModel.sessionsSunModelList
  1241 + .removeWhere((element) {
  1242 + element.id ==
  1243 + xuantaiData[xuantaiSelIndex]
  1244 + .reserveId;
  1245 + });
  1246 + // 调用接口删除
  1247 + Map<String, String> pramas = {
  1248 + 'rid': feastModel.rid,
  1249 + 'id': xuantaiData[xuantaiSelIndex]
  1250 + .reserveId
  1251 + };
  1252 + bool success = await feastModel
  1253 + .delBanquetInfo(context, pramas);
  1254 + if (success) {
  1255 + //删除成功
  1256 + xuantaiData.removeAt(xuantaiSelIndex);
  1257 +
  1258 + xuantaiSelIndex--; //删除后,选中前一个
  1259 +
  1260 + setState(() {});
  1261 + }
  1262 + } else {
  1263 + xuantaiData.removeAt(xuantaiSelIndex);
1212 1264
1213 - xuantaiSelIndex--; //删除后,选中前一个 1265 + xuantaiSelIndex--; //删除后,选中前一个
1214 1266
1215 - setState(() {}); 1267 + setState(() {});
  1268 + }
1216 })) 1269 }))
1217 : SizedBox(), 1270 : SizedBox(),
1218 VEmptyView(36), 1271 VEmptyView(36),
@@ -1434,6 +1487,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1434,6 +1487,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1434 // _homeEnterModel.nameController.text = 1487 // _homeEnterModel.nameController.text =
1435 // nameStr + _nameSuffix(); 1488 // nameStr + _nameSuffix();
1436 // _addNameSuffix(nameStr, sexStr); 1489 // _addNameSuffix(nameStr, sexStr);
  1490 +
  1491 + FocusScope.of(context)
  1492 + .requestFocus(
  1493 + FocusNode());
1437 }, 1494 },
1438 keyboardType: 1495 keyboardType:
1439 TextInputType.number)), 1496 TextInputType.number)),
@@ -1789,12 +1846,12 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1789,12 +1846,12 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1789 dateData += ymd; 1846 dateData += ymd;
1790 } 1847 }
1791 if (dateData.length > 0) { 1848 if (dateData.length > 0) {
1792 - dateData += ' ${feastModel.reserve}'; 1849 + dateData += ' ${feastModel.reserve ?? ''}';
1793 } else { 1850 } else {
1794 - dateData += '${feastModel.reserve}'; 1851 + dateData += '${feastModel.reserve ?? ''}';
1795 } 1852 }
1796 1853
1797 - dateData += ' ${feastModel.type}'; 1854 + dateData += ' ${feastModel.type ?? ''}';
1798 1855
1799 Map temp = {}; 1856 Map temp = {};
1800 if (xuantaiData[xuantaiSelIndex] 1857 if (xuantaiData[xuantaiSelIndex]
@@ -2526,14 +2583,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -2526,14 +2583,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
2526 2583
2527 ///第一场 。第二场。。。。 2584 ///第一场 。第二场。。。。
2528 Widget sessionsWidget(String title, SessionsInfo sessionsInfo) { 2585 Widget sessionsWidget(String title, SessionsInfo sessionsInfo) {
2529 - int tableNum = 0;  
2530 - List<String> temp = sessionsInfo.tableInfo.split('、');  
2531 - temp.forEach((element) {  
2532 - int start = element.indexOf('(');  
2533 - int end = element.length - 2;  
2534 - String numstr = element.substring(start + 1, end);  
2535 - tableNum += int.parse(numstr);  
2536 - }); 2586 + // int tableNum = 0;
  2587 + // List<String> temp = sessionsInfo.tableInfo.split('、');
  2588 + // temp.forEach((element) {
  2589 + // int start = element.indexOf('(');
  2590 + // int end = element.length - 2;
  2591 + // String numstr = element.substring(start + 1, end);
  2592 + // tableNum += int.parse(numstr);
  2593 + // });
2537 return Container( 2594 return Container(
2538 margin: EdgeInsets.only(bottom: h(26)), 2595 margin: EdgeInsets.only(bottom: h(26)),
2539 decoration: BoxDecoration( 2596 decoration: BoxDecoration(
@@ -2562,7 +2619,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -2562,7 +2619,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
2562 child: Column( 2619 child: Column(
2563 children: [ 2620 children: [
2564 baseInfoItem('场次时间:', sessionsInfo.rdate), 2621 baseInfoItem('场次时间:', sessionsInfo.rdate),
2565 - baseInfoItem('桌位数量:', '共 ${tableNum} 桌'), 2622 + baseInfoItem('桌位数量:', '共 ${sessionsInfo.tableNum ?? 0} 桌'),
2566 baseInfoItem('桌位信息:', sessionsInfo.tableInfo), 2623 baseInfoItem('桌位信息:', sessionsInfo.tableInfo),
2567 Padding( 2624 Padding(
2568 padding: EdgeInsets.symmetric(vertical: h(6)), 2625 padding: EdgeInsets.symmetric(vertical: h(6)),
@@ -2618,7 +2675,61 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -2618,7 +2675,61 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
2618 gradientEnd: 2675 gradientEnd:
2619 MyColours.color_438E93, 2676 MyColours.color_438E93,
2620 onPressed: () { 2677 onPressed: () {
2621 - // NavigatorUtil.goFeastSetmealPage(context); 2678 + // String tableData = '';
  2679 + // if (data.pnumC.text
  2680 + // .trim()
  2681 + // .length >
  2682 + // 0) {
  2683 + // tableData +=
  2684 + // '${data.pnumC.text}人/桌';
  2685 + // }
  2686 + // if (data.minC.text
  2687 + // .trim()
  2688 + // .length >
  2689 + // 0) {
  2690 + // tableData +=
  2691 + // ' 保证 ${data.minC.text} 桌';
  2692 + // }
  2693 + // if (data.spareC.text
  2694 + // .trim()
  2695 + // .length >
  2696 + // 0) {
  2697 + // tableData +=
  2698 + // ' 备用 ${data.spareC.text} 桌';
  2699 + // }
  2700 +
  2701 + // if (data.dataMenu != null &&
  2702 + // data.dataMenu.length >
  2703 + // 0) {
  2704 + // await NavigatorUtil
  2705 + // .goFeastMenuShowPage(
  2706 + // context,
  2707 + // data.setmealId,
  2708 + // data.name,
  2709 + // widget.dateData,
  2710 + // tableData,
  2711 + // justSelData: {
  2712 + // 'object':
  2713 + // data.dataMenu
  2714 + // });
  2715 + // } else {
  2716 + // await NavigatorUtil
  2717 + // .goFeastMenuShowPage(
  2718 + // context,
  2719 + // data.setmealId,
  2720 + // data.name,
  2721 + // widget.dateData,
  2722 + // tableData);
  2723 + // }
  2724 +
  2725 + NavigatorUtil
  2726 + .goFeastMenuQYShowPage(
  2727 + context,
  2728 + object: {
  2729 + 'object':
  2730 + setmealDetail
  2731 + .cooklist
  2732 + });
2622 }, 2733 },
2623 ), 2734 ),
2624 ], 2735 ],
@@ -2726,6 +2837,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -2726,6 +2837,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
2726 // if (!Utils.isNumeric(costInfoModel.discountC.text)) { 2837 // if (!Utils.isNumeric(costInfoModel.discountC.text)) {
2727 // costInfoModel.totalPrice = costInfoModel.sumPrice; 2838 // costInfoModel.totalPrice = costInfoModel.sumPrice;
2728 // } 2839 // }
  2840 + total = sum;
2729 } 2841 }
2730 if (Utils.isNumeric(costInfoModel.discountC.text)) { 2842 if (Utils.isNumeric(costInfoModel.discountC.text)) {
2731 //输入的是数字,计算金额 2843 //输入的是数字,计算金额
@@ -3298,7 +3410,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -3298,7 +3410,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
3298 ), 3410 ),
3299 HEmptyView(12), 3411 HEmptyView(12),
3300 Text( 3412 Text(
3301 - '${feastModel.banquetDetail.contractInfo.contractTotalPrice} 元', 3413 + '${feastModel.banquetDetail.contractInfo.contractTotalPrice ?? '0'} 元',
3302 style: TextStyle( 3414 style: TextStyle(
3303 fontWeight: FontWeight.bold, 3415 fontWeight: FontWeight.bold,
3304 color: MyColours.color_515151, 3416 color: MyColours.color_515151,
@@ -3364,11 +3476,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -3364,11 +3476,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
3364 ], 3476 ],
3365 ), 3477 ),
3366 VEmptyView(48), 3478 VEmptyView(48),
3367 - _titleAndtextfield('客户签约人:', null, null), 3479 + _titleAndtextfield('客户签约人:',
  3480 + feastModel.banquetDetail.contractInfo.customerC, null),
3368 VEmptyView(48), 3481 VEmptyView(48),
3369 - _titleAndtextfield('店方签约人:', null, null), 3482 + _titleAndtextfield('店方签约人:',
  3483 + feastModel.banquetDetail.contractInfo.storeC, null),
3370 VEmptyView(48), 3484 VEmptyView(48),
3371 - _titleAndtextfield('合同编号:', null, null), 3485 + _titleAndtextfield(
  3486 + '合同编号:', feastModel.banquetDetail.contractInfo.numC, null),
3372 VEmptyView(48), 3487 VEmptyView(48),
3373 Consumer<UploadImageProvider>(builder: (context, model, _) { 3488 Consumer<UploadImageProvider>(builder: (context, model, _) {
3374 return ImgPickerFWidget( 3489 return ImgPickerFWidget(
@@ -3543,8 +3658,27 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -3543,8 +3658,27 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
3543 fontSize: ScreenUtil().setSp(28)), 3658 fontSize: ScreenUtil().setSp(28)),
3544 ), 3659 ),
3545 InkWell( 3660 InkWell(
3546 - onTap: () {  
3547 - NavigatorUtil.goFeastInvoicePage(context); 3661 + onTap: () async {
  3662 + Map temp = {};
  3663 + if (feastModel.banquetDetail.invoice == null ||
  3664 + feastModel.banquetDetail.invoice.unitName ==
  3665 + null) {
  3666 + temp = await NavigatorUtil.goFeastInvoicePage(
  3667 + context,
  3668 + );
  3669 + } else {
  3670 + temp = await NavigatorUtil.goFeastInvoicePage(
  3671 + context,
  3672 + invoice: feastModel.banquetDetail.invoice);
  3673 + }
  3674 +
  3675 + if (temp == null) {
  3676 + } else if (temp['object'].length == 0) {
  3677 + } else {
  3678 + feastModel.banquetDetail.invoice =
  3679 + Invoice.fromJson(temp['object']);
  3680 + setState(() {});
  3681 + }
3548 }, 3682 },
3549 child: Text( 3683 child: Text(
3550 '编辑', 3684 '编辑',
@@ -3555,42 +3689,65 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -3555,42 +3689,65 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
3555 )), 3689 )),
3556 ], 3690 ],
3557 ), 3691 ),
3558 - VEmptyView(42),  
3559 - Container(  
3560 - padding: EdgeInsets.symmetric(vertical: w(8)),  
3561 - decoration: BoxDecoration(  
3562 - border: Border(  
3563 - bottom: BorderSide(  
3564 - width: w(1), color: MyColours.color_DBDBDB))),  
3565 - child: Row(  
3566 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
3567 - children: [  
3568 - Column(  
3569 - crossAxisAlignment: CrossAxisAlignment.start,  
3570 - children: [  
3571 - Text(  
3572 - '纳极(北京)科技有限公司',  
3573 - style: TextStyle(  
3574 - fontWeight: FontWeight.bold,  
3575 - color: MyColours.color_515151,  
3576 - fontSize: ScreenUtil().setSp(32)),  
3577 - ),  
3578 - VEmptyView(16),  
3579 - Text(  
3580 - '增值税普通发票',  
3581 - style: TextStyle(  
3582 - color: MyColours.color_999999,  
3583 - fontSize: ScreenUtil().setSp(24)),  
3584 - ),  
3585 - ], 3692 + feastModel.banquetDetail.invoice == null ||
  3693 + feastModel.banquetDetail.invoice.unitName == null
  3694 + ? SizedBox()
  3695 + : Container(
  3696 + margin: EdgeInsets.only(top: w(31)),
  3697 + padding: EdgeInsets.only(
  3698 + top: w(8),
  3699 + bottom: w(8),
  3700 + ),
  3701 + decoration: BoxDecoration(
  3702 + border: Border(
  3703 + bottom: BorderSide(
  3704 + width: w(1),
  3705 + color: MyColours.color_DBDBDB))),
  3706 + child: Row(
  3707 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  3708 + children: [
  3709 + Column(
  3710 + crossAxisAlignment: CrossAxisAlignment.start,
  3711 + children: [
  3712 + Text(
  3713 + feastModel.banquetDetail.invoice.unitName,
  3714 + style: TextStyle(
  3715 + fontWeight: FontWeight.bold,
  3716 + color: MyColours.color_515151,
  3717 + fontSize: ScreenUtil().setSp(32)),
  3718 + ),
  3719 + VEmptyView(16),
  3720 + Text(
  3721 + feastModel.banquetDetail.invoice
  3722 + .invoiceType ==
  3723 + '1'
  3724 + ? '增值税普通发票'
  3725 + : '增值税专用发票',
  3726 + style: TextStyle(
  3727 + color: MyColours.color_999999,
  3728 + fontSize: ScreenUtil().setSp(24)),
  3729 + ),
  3730 + ],
  3731 + ),
  3732 + InkWell(
  3733 + onTap: () {
  3734 + //弹框确认是否删除
  3735 + DialogUtil.cupertinoAlertDialog(context,
  3736 + title: "",
  3737 + content: "是否确定删除?",
  3738 + isBoldContent: true,
  3739 + contentColor: MyColours.color_E6000000,
  3740 + rTitle: "删除", rCallback: () {
  3741 + feastModel.banquetDetail.invoice = null;
  3742 + setState(() {});
  3743 + });
  3744 + },
  3745 + child: Image.asset(
  3746 + Utils.getImgPath('f_delete_red'),
  3747 + width: w(20))),
  3748 + ],
  3749 + ),
3586 ), 3750 ),
3587 - InkWell(  
3588 - onTap: () {},  
3589 - child: Image.asset(Utils.getImgPath('f_delete_red'),  
3590 - width: w(20))),  
3591 - ],  
3592 - ),  
3593 - ),  
3594 VEmptyView(48), 3751 VEmptyView(48),
3595 Consumer<UploadImageProvider>(builder: (context, model, _) { 3752 Consumer<UploadImageProvider>(builder: (context, model, _) {
3596 return ImgPickerFWidget( 3753 return ImgPickerFWidget(
@@ -3808,12 +3965,26 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -3808,12 +3965,26 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
3808 isSelect: false)), 3965 isSelect: false)),
3809 Expanded( 3966 Expanded(
3810 child: _callButton( 3967 child: _callButton(
3811 - onPress: () {  
3812 - selectMenu = '签约';  
3813 -  
3814 - menuSet.add('定金');  
3815 - menuSet.add('签约');  
3816 - setState(() {}); 3968 + onPress: () async {
  3969 + // selectMenu = '签约';
  3970 + // menuSet.add('定金');
  3971 + // menuSet.add('签约');
  3972 + // setState(() {});
  3973 + for (UploadImgModel item in _uploadImageProvider
  3974 + .feastRemarkContractImageList) {
  3975 + if (item.process < 1) {
  3976 + Utils.showToast('正在上传图片,请稍等');
  3977 + return false;
  3978 + }
  3979 + }
  3980 + for (UploadImgModel item in _uploadImageProvider
  3981 + .feastRemarkInvoiceImageList) {
  3982 + if (item.process < 1) {
  3983 + Utils.showToast('正在上传图片,请稍等');
  3984 + return false;
  3985 + }
  3986 + }
  3987 + _setData();
3817 }, 3988 },
3818 content: '保存', 3989 content: '保存',
3819 hasLeftBorder: true, 3990 hasLeftBorder: true,
@@ -3827,6 +3998,90 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -3827,6 +3998,90 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
3827 ]); 3998 ]);
3828 } 3999 }
3829 4000
  4001 + ///设置合同信息
  4002 + Future<bool> _setBanquetContract() async {
  4003 + List imageQiniuUrlList = []; //接口图片数据list
  4004 + for (int i = 0;
  4005 + i < _uploadImageProvider.feastRemarkContractImageList.length;
  4006 + i++) {
  4007 + imageQiniuUrlList.add({
  4008 + "url": _uploadImageProvider.feastRemarkContractImageList[i].qiniuUrl
  4009 + });
  4010 + }
  4011 + Map<String, String> params = {
  4012 + 'rid': feastModel.rid, //'64'
  4013 + 'contract_total_price':
  4014 + feastModel.banquetDetail.contractInfo.contractTotalPrice,
  4015 + 'contract_final_price':
  4016 + feastModel.banquetDetail.contractInfo.contractFinalPriceC.text,
  4017 + 'contract_rname': feastModel.banquetDetail.contractInfo.customerC.text,
  4018 + 'contract_seller_name': feastModel.banquetDetail.contractInfo.storeC.text,
  4019 + 'contract_no': feastModel.banquetDetail.contractInfo.numC.text,
  4020 + 'contract_images': json.encode(imageQiniuUrlList)
  4021 + };
  4022 + bool success = await feastModel.setBanquetContract(context, params);
  4023 +
  4024 + if (success) {
  4025 + return true;
  4026 + } else {
  4027 + return false;
  4028 + }
  4029 + }
  4030 +
  4031 + ///
  4032 + Future<bool> _setInvoice() async {
  4033 + if (feastModel.banquetDetail.invoice == null) {
  4034 + feastModel.banquetDetail.invoice = Invoice();
  4035 + }
  4036 +
  4037 + List imageQiniuUrlListInvoice = []; //接口图片数据list
  4038 + for (int i = 0;
  4039 + i < _uploadImageProvider.feastRemarkInvoiceImageList.length;
  4040 + i++) {
  4041 + imageQiniuUrlListInvoice.add({
  4042 + "url": _uploadImageProvider.feastRemarkInvoiceImageList[i].qiniuUrl
  4043 + });
  4044 + }
  4045 + if (imageQiniuUrlListInvoice.length > 0) {
  4046 + feastModel.banquetDetail.invoice.images = [];
  4047 +
  4048 + imageQiniuUrlListInvoice.forEach((v) {
  4049 + feastModel.banquetDetail.invoice.images.add(new ImagesById.fromJson(v));
  4050 + });
  4051 + }
  4052 +
  4053 + Map<String, String> pramas = {
  4054 + 'rid': feastModel.rid,
  4055 + 'data': json.encode(feastModel.banquetDetail.invoice.toJson())
  4056 + };
  4057 + bool success = await feastModel.setInvoice(context, pramas);
  4058 +
  4059 + if (success) {
  4060 + return true;
  4061 + } else {
  4062 + return false;
  4063 + }
  4064 + }
  4065 +
  4066 + _setData() async {
  4067 + await Future.wait<bool>([_setBanquetContract(), _setInvoice()])
  4068 + .then((results) {
  4069 + print(results[0]);
  4070 + if (results[0] && results[1]) {
  4071 + //成功
  4072 + Utils.showToast('保存成功');
  4073 + } else {
  4074 + if (!results[0]) {
  4075 + // Utils.showToast('');
  4076 + } else {
  4077 + // Utils.showToast('');
  4078 + }
  4079 + }
  4080 + }).catchError((e) {
  4081 + print(e);
  4082 + });
  4083 + }
  4084 +
3830 Widget taocanTextType(String per1, String title, String per) { 4085 Widget taocanTextType(String per1, String title, String per) {
3831 return RichText( 4086 return RichText(
3832 textScaleFactor: 1, 4087 textScaleFactor: 1,
  1 +import 'dart:convert';
  2 +
1 import 'package:common_utils/common_utils.dart'; 3 import 'package:common_utils/common_utils.dart';
2 import 'package:flutter/gestures.dart'; 4 import 'package:flutter/gestures.dart';
3 import 'package:flutter/material.dart'; 5 import 'package:flutter/material.dart';
4 import 'package:flutter_picker/Picker.dart'; 6 import 'package:flutter_picker/Picker.dart';
5 import 'package:flutter_screenutil/flutter_screenutil.dart'; 7 import 'package:flutter_screenutil/flutter_screenutil.dart';
  8 +import 'package:one_key/models/get_banquet_by_id_new_model.dart';
  9 +import 'package:one_key/provider/feast_model.dart';
6 import 'package:one_key/widgets/v_empty_view.dart'; 10 import 'package:one_key/widgets/v_empty_view.dart';
  11 +import 'package:provider/provider.dart';
7 12
8 import '../../res/colors.dart'; 13 import '../../res/colors.dart';
9 import '../../utils/dialog_util.dart'; 14 import '../../utils/dialog_util.dart';
  15 +import '../../utils/event_bus.dart';
10 import '../../utils/screen_util.dart'; 16 import '../../utils/screen_util.dart';
11 import '../../utils/utils.dart'; 17 import '../../utils/utils.dart';
12 import '../../widgets/h_empty_view.dart'; 18 import '../../widgets/h_empty_view.dart';
@@ -16,7 +22,8 @@ import '../../widgets/system_app_bar.dart'; @@ -16,7 +22,8 @@ import '../../widgets/system_app_bar.dart';
16 * 编辑发票 22 * 编辑发票
17 */ 23 */
18 class FeastInvoicePage extends StatefulWidget { 24 class FeastInvoicePage extends StatefulWidget {
19 - FeastInvoicePage({Key key}) : super(key: key); 25 + final Invoice invoice;
  26 + FeastInvoicePage({Key key, this.invoice}) : super(key: key);
20 27
21 @override 28 @override
22 _FeastInvoicePageState createState() => _FeastInvoicePageState(); 29 _FeastInvoicePageState createState() => _FeastInvoicePageState();
@@ -24,12 +31,43 @@ class FeastInvoicePage extends StatefulWidget { @@ -24,12 +31,43 @@ class FeastInvoicePage extends StatefulWidget {
24 31
25 class _FeastInvoicePageState extends State<FeastInvoicePage> { 32 class _FeastInvoicePageState extends State<FeastInvoicePage> {
26 bool type = true; //默认--增值税普通发票 33 bool type = true; //默认--增值税普通发票
  34 +
  35 + TextEditingController priceC = TextEditingController(); //开票金额
  36 + TextEditingController unitNameC = TextEditingController(); //单位全称
  37 + TextEditingController numC = TextEditingController(); //税号
  38 + TextEditingController addressC = TextEditingController(); //地址
  39 + TextEditingController phoneC = TextEditingController(); //电话
  40 + TextEditingController bankC = TextEditingController(); //开户行
  41 + TextEditingController bankNumC = TextEditingController(); //开户行账号
  42 + TextEditingController mailC = TextEditingController(); //邮箱
  43 + TextEditingController addresseeC = TextEditingController(); //收件人
  44 + TextEditingController addresseePhoneC = TextEditingController(); //收件人电话
  45 + TextEditingController addresseeAddressC = TextEditingController(); // 收件人地址
  46 + TextEditingController codeC = TextEditingController(); //邮编
  47 + FeastModel feastModel;
  48 +
27 @override 49 @override
28 void initState() { 50 void initState() {
29 // TODO: implement initState 51 // TODO: implement initState
30 super.initState(); 52 super.initState();
31 53
32 Utils.changeStatusColor(color: MyColours.color_438E93); 54 Utils.changeStatusColor(color: MyColours.color_438E93);
  55 + if (widget.invoice != null) {
  56 + type = widget.invoice.invoiceType == '1' ? true : false; //默认--增值税普通发票
  57 +
  58 + priceC.text = widget.invoice.price; // 开票金额
  59 + unitNameC.text = widget.invoice.unitName;
  60 + numC.text = widget.invoice.numStr;
  61 + addressC.text = widget.invoice.address;
  62 + phoneC.text = widget.invoice.phone;
  63 + bankC.text = widget.invoice.bank;
  64 + bankNumC.text = widget.invoice.bankNum;
  65 + mailC.text = widget.invoice.mail;
  66 + addresseeC.text = widget.invoice.addressee;
  67 + addresseePhoneC.text = widget.invoice.addresseePhone;
  68 + addresseeAddressC.text = widget.invoice.addresseeAddress;
  69 + codeC.text = widget.invoice.code;
  70 + }
33 71
34 WidgetsBinding.instance.addPostFrameCallback((_) {}); 72 WidgetsBinding.instance.addPostFrameCallback((_) {});
35 } 73 }
@@ -38,7 +76,7 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> { @@ -38,7 +76,7 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
38 ///输入框 76 ///输入框
39 Widget _textfield( 77 Widget _textfield(
40 String title, 78 String title,
41 - // TextEditingController editingController, 79 + TextEditingController editingController,
42 // FocusNode focusNode, 80 // FocusNode focusNode,
43 String subTitle, 81 String subTitle,
44 {TextInputType inputType = TextInputType.text, 82 {TextInputType inputType = TextInputType.text,
@@ -85,7 +123,7 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> { @@ -85,7 +123,7 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
85 // height: ScreenUtil().setHeight(120), 123 // height: ScreenUtil().setHeight(120),
86 height: ScreenUtil().setWidth(64), 124 height: ScreenUtil().setWidth(64),
87 child: TextField( 125 child: TextField(
88 - // controller: editingController, 126 + controller: editingController,
89 // textAlign: TextAlign.right, 127 // textAlign: TextAlign.right,
90 // textAlignVertical: TextAlignVertical.bottom, 128 // textAlignVertical: TextAlignVertical.bottom,
91 maxLines: 1, 129 maxLines: 1,
@@ -257,11 +295,13 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> { @@ -257,11 +295,13 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
257 } 295 }
258 296
259 ///单选按钮 297 ///单选按钮
260 - Widget radioBtn(String title, bool select) { 298 + Widget radioBtn(
  299 + String title,
  300 + bool select,
  301 + GestureTapCallback onTap,
  302 + ) {
261 return InkWell( 303 return InkWell(
262 - onTap: () {  
263 - // setsta  
264 - }, 304 + onTap: onTap,
265 child: Row( 305 child: Row(
266 children: [ 306 children: [
267 Image.asset( 307 Image.asset(
@@ -282,6 +322,7 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> { @@ -282,6 +322,7 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
282 322
283 @override 323 @override
284 Widget build(BuildContext context) { 324 Widget build(BuildContext context) {
  325 + feastModel = Provider.of<FeastModel>(context, listen: true);
285 return Scaffold( 326 return Scaffold(
286 backgroundColor: MyColours.color_ffffff, 327 backgroundColor: MyColours.color_ffffff,
287 appBar: SystemAppBar( 328 appBar: SystemAppBar(
@@ -305,34 +346,48 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> { @@ -305,34 +346,48 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
305 Row( 346 Row(
306 mainAxisAlignment: MainAxisAlignment.spaceBetween, 347 mainAxisAlignment: MainAxisAlignment.spaceBetween,
307 children: [ 348 children: [
308 - radioBtn('增值税普通发票', type),  
309 - radioBtn('增值税专用发票', !type), 349 + radioBtn('增值税普通发票', type, () {
  350 + if (type) {
  351 + return;
  352 + }
  353 + setState(() {
  354 + type = !type;
  355 + });
  356 + }),
  357 + radioBtn('增值税专用发票', !type, () {
  358 + if (!type) {
  359 + return;
  360 + }
  361 + setState(() {
  362 + type = !type;
  363 + });
  364 + }),
310 ], 365 ],
311 ), 366 ),
312 VEmptyView(80), 367 VEmptyView(80),
313 - _textfield('开票金额', '元', need: true), 368 + _textfield('开票金额', priceC, '元', need: true),
314 VEmptyView(40), 369 VEmptyView(40),
315 - _textfield('单位全称', '', need: true), 370 + _textfield('单位全称', unitNameC, '', need: true),
316 VEmptyView(40), 371 VEmptyView(40),
317 - _textfield('纳税人识别号', '', need: true), 372 + _textfield('纳税人识别号', numC, '', need: true),
318 VEmptyView(40), 373 VEmptyView(40),
319 - _textfield('注册地址', ''), 374 + _textfield('注册地址', addressC, '', need: !type),
320 VEmptyView(40), 375 VEmptyView(40),
321 - _textfield('注册电话', ''), 376 + _textfield('注册电话', phoneC, '', need: !type),
322 VEmptyView(40), 377 VEmptyView(40),
323 - _textfield('开户银行', ''), 378 + _textfield('开户银行', bankC, '', need: !type),
324 VEmptyView(40), 379 VEmptyView(40),
325 - _textfield('银行账号', ''), 380 + _textfield('银行账号', bankNumC, '', need: !type),
326 VEmptyView(40), 381 VEmptyView(40),
327 - _textfield('电子邮箱', ''), 382 + _textfield('电子邮箱', mailC, ''),
328 VEmptyView(40), 383 VEmptyView(40),
329 - _textfield('收件人', ''), 384 + _textfield('收件人', addresseeC, ''),
330 VEmptyView(40), 385 VEmptyView(40),
331 - _textfield('收件人电话', ''), 386 + _textfield('收件人电话', addresseePhoneC, ''),
332 VEmptyView(40), 387 VEmptyView(40),
333 - _textfield('收件地址', ''), 388 + _textfield('收件地址', addresseeAddressC, ''),
334 VEmptyView(40), 389 VEmptyView(40),
335 - _textfield('邮编', ''), 390 + _textfield('邮编', codeC, ''),
336 VEmptyView(40), 391 VEmptyView(40),
337 ], 392 ],
338 )), 393 )),
@@ -349,7 +404,56 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> { @@ -349,7 +404,56 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
349 isSelect: false)), 404 isSelect: false)),
350 Expanded( 405 Expanded(
351 child: _callButton( 406 child: _callButton(
352 - onPress: () {}, 407 + onPress: () async {
  408 + if (priceC.text.trim().length == 0) {
  409 + Utils.showToast('请输入开票金额');
  410 + return;
  411 + }
  412 + if (unitNameC.text.trim().length == 0) {
  413 + Utils.showToast('请输入单位全称');
  414 + return;
  415 + }
  416 + if (numC.text.trim().length == 0) {
  417 + Utils.showToast('请输入纳税人识别号');
  418 + return;
  419 + }
  420 + if (!type) {
  421 + //专用发票
  422 + if (addressC.text.trim().length == 0) {
  423 + Utils.showToast('请输入注册地址');
  424 + return;
  425 + }
  426 + if (phoneC.text.trim().length == 0) {
  427 + Utils.showToast('请输入注册电话');
  428 + return;
  429 + }
  430 + if (bankC.text.trim().length == 0) {
  431 + Utils.showToast('请输入开户银行');
  432 + return;
  433 + }
  434 + if (bankNumC.text.trim().length == 0) {
  435 + Utils.showToast('请输入银行账号');
  436 + return;
  437 + }
  438 + }
  439 + Map<String, String> map = {
  440 + "invoice_type": type ? '1' : '2',
  441 + "price": priceC.text,
  442 + "unit_name": unitNameC.text,
  443 + "num": numC.text,
  444 + "address": addressC.text,
  445 + "phone": phoneC.text,
  446 + "bank": bankC.text,
  447 + "bank_num": bankNumC.text,
  448 + "mail": mailC.text,
  449 + "addressee": addresseeC.text,
  450 + "addressee_phone": addresseePhoneC.text,
  451 + "addressee_address": addresseeAddressC.text,
  452 + "code": codeC.text
  453 + };
  454 +
  455 + Navigator.pop(context, {'object': map});
  456 + },
353 content: '保存并返回', 457 content: '保存并返回',
354 hasLeftBorder: true, 458 hasLeftBorder: true,
355 isSelect: true)) 459 isSelect: true))
  1 +import 'package:flutter/material.dart';
  2 +import 'package:flutter_screenutil/flutter_screenutil.dart';
  3 +
  4 +import '../../models/get_banquet_by_id_new_model.dart';
  5 +import '../../res/colors.dart';
  6 +import '../../utils/screen_util.dart';
  7 +import '../../utils/utils.dart';
  8 +import '../../widgets/h_empty_view.dart';
  9 +import '../../widgets/system_app_bar.dart';
  10 +
  11 +class FeastQYMenuPage extends StatefulWidget {
  12 + final List<CooklistByid> cookListData;
  13 + FeastQYMenuPage({Key key, this.cookListData}) : super(key: key);
  14 +
  15 + @override
  16 + _FeastQYMenuPageState createState() => _FeastQYMenuPageState();
  17 +}
  18 +
  19 +class _FeastQYMenuPageState extends State<FeastQYMenuPage> {
  20 + @override
  21 + void initState() {
  22 + // TODO: implement initState
  23 + super.initState();
  24 +
  25 + Utils.changeStatusColor(color: MyColours.color_438E93);
  26 + }
  27 +
  28 + @override
  29 + Widget build(BuildContext context) {
  30 + return Scaffold(
  31 + backgroundColor: MyColours.color_ffffff,
  32 + appBar: SystemAppBar(
  33 + '查看菜单',
  34 + needWhite: true,
  35 + bgColor: MyColours.color_438E93,
  36 + titleColor: MyColours.color_F6F6F6,
  37 + onTap: () {
  38 + Navigator.pop(context);
  39 + },
  40 + ),
  41 + body: ListView.builder(
  42 + shrinkWrap: true,
  43 + padding: EdgeInsets.symmetric(horizontal: w(16), vertical: w(24)),
  44 + itemCount: widget.cookListData.length,
  45 + itemBuilder: (BuildContext context, int index) {
  46 + return Container(
  47 + margin: new EdgeInsets.only(bottom: h(12)),
  48 + padding: EdgeInsets.only(bottom: w(12)),
  49 + decoration: BoxDecoration(
  50 + color: MyColours.color_ffffff,
  51 + border: Border(
  52 + bottom: BorderSide(
  53 + width: w(0.5), color: MyColours.color_DBDBDB))),
  54 + child: new GestureDetector(
  55 + onTap: () {
  56 + // _gotoProjectDetail(projectModelList[index]);
  57 + },
  58 + child: new Container(
  59 + color: MyColours.color_ffffff,
  60 + child: Row(
  61 + children: [
  62 + Container(
  63 + width: h(119),
  64 + child: Text(
  65 + widget.cookListData[index].cname,
  66 + overflow: TextOverflow.ellipsis,
  67 + maxLines: 10,
  68 + style: TextStyle(
  69 + color: MyColours.color_515151,
  70 + fontSize: ScreenUtil().setSp(32)),
  71 + )),
  72 + // HEmptyView(16),
  73 + // Container(
  74 + // width: h(36),
  75 + // child: Text(
  76 + // '${setmeal.spec}',
  77 + // overflow: TextOverflow.ellipsis,
  78 + // maxLines: 1,
  79 + // style: TextStyle(
  80 + // color: MyColours.color_515151,
  81 + // fontSize: ScreenUtil().setSp(32)),
  82 + // )),
  83 + ],
  84 + )),
  85 + ),
  86 + );
  87 + },
  88 + ));
  89 + }
  90 +}
@@ -184,6 +184,37 @@ class FeastModel extends ChangeNotifier { @@ -184,6 +184,37 @@ class FeastModel extends ChangeNotifier {
184 } 184 }
185 } 185 }
186 186
  187 + ///删除场次
  188 + Future<dynamic> delBanquetInfo(
  189 + BuildContext context, Map<String, String> params,
  190 + {isShowLoading = true}) async {
  191 + BaseResp<dynamic> baseResp = await DioUtil()
  192 + .request<dynamic>(context, Method.get, HttpUrl.del_banquet_info,
  193 + data: params, showLoading: isShowLoading)
  194 + .catchError((error) {
  195 + print(error.toString());
  196 + if (error is MyError) {}
  197 + return false;
  198 + });
  199 + if (baseResp.code == Constant.status_success) {
  200 + // if (baseResp.data == 1) {
  201 + // rid = baseResp.data['id'];
  202 + if (baseResp.responseData['data'] is List) {
  203 + sessionsSunModelList =
  204 + SessionsModel.fromJson(baseResp.responseData).data;
  205 + }
  206 + return true;
  207 + // } else {
  208 + // return false;
  209 + // }
  210 + } else {
  211 + if (baseResp != null) {
  212 + Utils.showToast(baseResp.msg ?? "");
  213 + }
  214 + return false;
  215 + }
  216 + }
  217 +
187 ///添加定金 218 ///添加定金
188 Future<dynamic> setBanquetDeposit( 219 Future<dynamic> setBanquetDeposit(
189 BuildContext context, Map<String, String> params, 220 BuildContext context, Map<String, String> params,
@@ -341,6 +372,59 @@ class FeastModel extends ChangeNotifier { @@ -341,6 +372,59 @@ class FeastModel extends ChangeNotifier {
341 } 372 }
342 } 373 }
343 374
  375 + ///设置合同信息
  376 + Future<dynamic> setBanquetContract(
  377 + BuildContext context, Map<String, String> params,
  378 + {isShowLoading = true}) async {
  379 + BaseResp<dynamic> baseResp = await DioUtil()
  380 + .request<dynamic>(context, Method.get, HttpUrl.set_banquet_contract,
  381 + data: params, showLoading: isShowLoading)
  382 + .catchError((error) {
  383 + print(error.toString());
  384 + if (error is MyError) {}
  385 + return false;
  386 + });
  387 + if (baseResp.code == Constant.status_success) {
  388 + // if (baseResp.data == 1) {
  389 + // rid = baseResp.data['id'];
  390 + return true;
  391 + // } else {
  392 + // return false;
  393 + // }
  394 + } else {
  395 + if (baseResp != null) {
  396 + Utils.showToast(baseResp.msg ?? "");
  397 + }
  398 + return false;
  399 + }
  400 + }
  401 +
  402 + ///设置合同信息
  403 + Future<dynamic> setInvoice(BuildContext context, Map<String, String> params,
  404 + {isShowLoading = true}) async {
  405 + BaseResp<dynamic> baseResp = await DioUtil()
  406 + .request<dynamic>(context, Method.get, HttpUrl.set_invoice,
  407 + data: params, showLoading: isShowLoading)
  408 + .catchError((error) {
  409 + print(error.toString());
  410 + if (error is MyError) {}
  411 + return false;
  412 + });
  413 + if (baseResp.code == Constant.status_success) {
  414 + // if (baseResp.data == 1) {
  415 + // rid = baseResp.data['id'];
  416 + return true;
  417 + // } else {
  418 + // return false;
  419 + // }
  420 + } else {
  421 + if (baseResp != null) {
  422 + Utils.showToast(baseResp.msg ?? "");
  423 + }
  424 + return false;
  425 + }
  426 + }
  427 +
344 /*** 428 /***
345 * 429 *
346 * 宴会员工 430 * 宴会员工
@@ -26,6 +26,7 @@ import 'package:one_key/utils/utils.dart'; @@ -26,6 +26,7 @@ import 'package:one_key/utils/utils.dart';
26 import 'package:sqflite/sqlite_api.dart'; 26 import 'package:sqflite/sqlite_api.dart';
27 27
28 import '../app.dart'; 28 import '../app.dart';
  29 +import '../models/get_banquet_by_id_new_model.dart';
29 import '../models/get_banquet_deposit_model.dart'; 30 import '../models/get_banquet_deposit_model.dart';
30 import '../models/otherset_model.dart'; 31 import '../models/otherset_model.dart';
31 import '../models/set_xuan_tai_model.dart'; 32 import '../models/set_xuan_tai_model.dart';
@@ -921,8 +922,13 @@ class NavigatorUtil { @@ -921,8 +922,13 @@ class NavigatorUtil {
921 922
922 ///宴会----添加发票 923 ///宴会----添加发票
923 static Future<dynamic> goFeastInvoicePage(BuildContext context, 924 static Future<dynamic> goFeastInvoicePage(BuildContext context,
924 - {replace = false, bool onlyShow = false}) {  
925 - return _navigateTo(context, "${Routes.feast_invoice_page}", 925 + {replace = false, bool onlyShow = false, Invoice invoice}) {
  926 + if (invoice != null) {
  927 + return _navigateTo(context,
  928 + "${Routes.feast_invoice_page}?invoice=${FluroConvertUtils.object2string(invoice)}",
  929 + replace: replace);
  930 + }
  931 + return _navigateTo(context, "${Routes.feast_invoice_page}?",
926 replace: replace); 932 replace: replace);
927 } 933 }
928 934
@@ -1053,4 +1059,17 @@ class NavigatorUtil { @@ -1053,4 +1059,17 @@ class NavigatorUtil {
1053 "${Routes.feast_menu_show_page}?setmealId=$setmealId&object=${FluroConvertUtils.object2string(justSelData)}&mealName=${Uri.encodeComponent(mealName)}&dateData=${Uri.encodeComponent(dateData)}&needtable=${Uri.encodeComponent(needtable)}", 1059 "${Routes.feast_menu_show_page}?setmealId=$setmealId&object=${FluroConvertUtils.object2string(justSelData)}&mealName=${Uri.encodeComponent(mealName)}&dateData=${Uri.encodeComponent(dateData)}&needtable=${Uri.encodeComponent(needtable)}",
1054 replace: replace); 1060 replace: replace);
1055 } 1061 }
  1062 +
  1063 + ///宴会--签约--菜单信息
  1064 + static Future<dynamic> goFeastMenuQYShowPage(BuildContext context,
  1065 +
  1066 + {replace = false, bool onlyShow = false, Map object}) {
  1067 + if (object == null) {
  1068 + return _navigateTo(context, "${Routes.feast_qy_menu_show_page}",
  1069 + replace: replace);
  1070 + }
  1071 + return _navigateTo(context,
  1072 + "${Routes.feast_qy_menu_show_page}?object=${FluroConvertUtils.object2string(object)}",
  1073 + replace: replace);
  1074 + }
1056 } 1075 }
@@ -148,6 +148,7 @@ import 'package:one_key/utils/fluro_convert_utils.dart'; @@ -148,6 +148,7 @@ import 'package:one_key/utils/fluro_convert_utils.dart';
148 import 'package:one_key/utils/utils.dart'; 148 import 'package:one_key/utils/utils.dart';
149 import 'package:provider/provider.dart'; 149 import 'package:provider/provider.dart';
150 150
  151 +import '../models/get_banquet_by_id_new_model.dart';
151 import '../models/set_xuan_tai_model.dart'; 152 import '../models/set_xuan_tai_model.dart';
152 import '../models/setmeal_by_id_model.dart'; 153 import '../models/setmeal_by_id_model.dart';
153 import '../pages/feast/feast_board.dart'; 154 import '../pages/feast/feast_board.dart';
@@ -158,6 +159,7 @@ import '../pages/feast/feast_followup_page.dart'; @@ -158,6 +159,7 @@ import '../pages/feast/feast_followup_page.dart';
158 import '../pages/feast/feast_invoice_page.dart'; 159 import '../pages/feast/feast_invoice_page.dart';
159 import '../pages/feast/feast_menu_page.dart'; 160 import '../pages/feast/feast_menu_page.dart';
160 import '../pages/feast/feast_menu_show_page.dart'; 161 import '../pages/feast/feast_menu_show_page.dart';
  162 +import '../pages/feast/feast_qy_menu_show_page.dart';
161 import '../pages/feast/feast_set_page.dart'; 163 import '../pages/feast/feast_set_page.dart';
162 import '../pages/feast/feast_setmeal_page.dart'; 164 import '../pages/feast/feast_setmeal_page.dart';
163 import '../pages/feast/feast_wine_page.dart'; 165 import '../pages/feast/feast_wine_page.dart';
@@ -1481,8 +1483,13 @@ var feastInvoicePageHandle = new Handler( @@ -1481,8 +1483,13 @@ var feastInvoicePageHandle = new Handler(
1481 // String uids = params["uids"].first; 1483 // String uids = params["uids"].first;
1482 1484
1483 // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); 1485 // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
  1486 + Invoice invoice;
  1487 + if (params.keys.contains('invoice')) {
  1488 + invoice = Invoice.fromJson(json.decode(
  1489 + FluroConvertUtils.fluroCnParamsDecode(params["invoice"].first)));
  1490 + }
1484 return ChangeNotifierProvider<FeastModel>( 1491 return ChangeNotifierProvider<FeastModel>(
1485 - create: (_) => FeastModel(), child: FeastInvoicePage()); 1492 + create: (_) => FeastModel(), child: FeastInvoicePage(invoice: invoice));
1486 }); 1493 });
1487 1494
1488 ///宴会---宴会管理 1495 ///宴会---宴会管理
@@ -1706,3 +1713,24 @@ var feastMenuShowPageHandle = new Handler( @@ -1706,3 +1713,24 @@ var feastMenuShowPageHandle = new Handler(
1706 needtable: needtable, 1713 needtable: needtable,
1707 )); 1714 ));
1708 }); 1715 });
  1716 +
  1717 +///宴会----签约菜单信息
  1718 +var feastQYMenuPageHandle = new Handler(
  1719 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  1720 + List<CooklistByid> cook = [];
  1721 + if (params.keys.contains('object')) {
  1722 + Map object = FluroConvertUtils.string2map(params["object"].first);
  1723 +
  1724 + List temp = object['object'];
  1725 +
  1726 + for (var item in temp) {
  1727 + cook.add(CooklistByid.fromJson(item));
  1728 + }
  1729 + }
  1730 +
  1731 + return ChangeNotifierProvider<FeastModel>(
  1732 + create: (_) => FeastModel(),
  1733 + child: FeastQYMenuPage(
  1734 + cookListData: cook,
  1735 + ));
  1736 +});
@@ -151,7 +151,8 @@ class Routes { @@ -151,7 +151,8 @@ class Routes {
151 "/feast_select_table_page"; //宴会-----新建宴会---选择桌位 151 "/feast_select_table_page"; //宴会-----新建宴会---选择桌位
152 static String feast_menu_show_page = 152 static String feast_menu_show_page =
153 "/feast_menu_show_page"; //宴会-----新建宴会---菜单信息 153 "/feast_menu_show_page"; //宴会-----新建宴会---菜单信息
154 - 154 + static String feast_qy_menu_show_page =
  155 + "/feast_qy_menu_show_page"; //宴会-----新建宴会---签约菜单信息
155 156
156 static void configureRoutes(FluroRouter router) { 157 static void configureRoutes(FluroRouter router) {
157 router.notFoundHandler = new Handler( 158 router.notFoundHandler = new Handler(
@@ -303,8 +304,9 @@ class Routes { @@ -303,8 +304,9 @@ class Routes {
303 304
304 router.define(feast_deposit_data_page, handler: feastDepositDataPageHandle); 305 router.define(feast_deposit_data_page, handler: feastDepositDataPageHandle);
305 router.define(feast_select_table_page, handler: feastSelectTablePageHandle); 306 router.define(feast_select_table_page, handler: feastSelectTablePageHandle);
306 -router.define(feast_menu_show_page, handler: feastMenuShowPageHandle);  
307 - 307 + router.define(feast_menu_show_page, handler: feastMenuShowPageHandle);
  308 +
  309 + router.define(feast_qy_menu_show_page, handler: feastQYMenuPageHandle);
308 310
309 } 311 }
310 } 312 }