Commit 34d6830fe491a37df2a3f4971129c0f2e17bfde7

Authored by wdn127929
1 parent 70e5b34a

意向编辑赋值

1 import 'dart:convert' as convert; 1 import 'dart:convert' as convert;
2 2
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
  4 +import 'package:one_key/utils/ConvertNumberToChineseMoneyWords.dart';
4 5
5 class GetBanquetByIdNewModel { 6 class GetBanquetByIdNewModel {
6 int ret; 7 int ret;
@@ -57,15 +58,37 @@ class GetBanquetByIdNewSunModel { @@ -57,15 +58,37 @@ class GetBanquetByIdNewSunModel {
57 contractInfo = json['contract_info'] != null 58 contractInfo = json['contract_info'] != null
58 ? new ContractInfo.fromJson(json['contract_info']) 59 ? new ContractInfo.fromJson(json['contract_info'])
59 : null; 60 : null;
60 - invoice = json['invoice'] != null  
61 - ? new Invoice.fromJson(convert.jsonDecode(json['invoice']))  
62 - : null; //发票信息 61 + if (json['invoice'] is Map) {
  62 + invoice = json['invoice'] != null
  63 + ? new Invoice.fromJson(json['invoice'])
  64 + : null; //发票信息
  65 + } else {
  66 + invoice = json['invoice'] != null
  67 + ? new Invoice.fromJson(convert.jsonDecode(json['invoice']))
  68 + : null; //发票信息
  69 + }
  70 +
63 costInfo = <CostInfoModel>[]; 71 costInfo = <CostInfoModel>[];
64 if (json['cost_info'] != null && json['cost_info'].length > 0) { 72 if (json['cost_info'] != null && json['cost_info'].length > 0) {
65 double totalP = 0.0; 73 double totalP = 0.0;
66 json['cost_info'].forEach((key, v) { 74 json['cost_info'].forEach((key, v) {
67 CostInfoModel model = CostInfoModel.fromJson(v); 75 CostInfoModel model = CostInfoModel.fromJson(v);
68 model.title = '${key}费用'; 76 model.title = '${key}费用';
  77 + int start = key.indexOf('第');
  78 + int end = key.indexOf('场');
  79 + String numstr = key.substring(start + 1, end);
  80 + int index = ConvertNumberToChineseMoneyWords.toInt(numstr);
  81 + SessionsInfo info = sessionsInfo[index];
  82 +
  83 + model.discounttype = info.discounttype;
  84 + model.discountper = info.discountper;
  85 + model.discountprice = info.discountprice;
  86 + model.servicetype = info.servicetype;
  87 + model.serviceper = info.serviceper;
  88 + model.serviceprice = info.serviceprice;
  89 + model.totalPrice = info.totalprice;
  90 + model.service = info.servicetype == '1' ? true : false;
  91 + model.discount = info.discounttype == '1' ? true : false;
69 costInfo.add(model); 92 costInfo.add(model);
70 totalP += double.parse(model.sumPrice); 93 totalP += double.parse(model.sumPrice);
71 }); 94 });
@@ -106,6 +129,7 @@ class BasicInfo { @@ -106,6 +129,7 @@ class BasicInfo {
106 Jiedan jiedan; 129 Jiedan jiedan;
107 Jiedan staff; 130 Jiedan staff;
108 String classify; 131 String classify;
  132 + List<ImagesById> images;
109 133
110 BasicInfo( 134 BasicInfo(
111 {this.ddate, 135 {this.ddate,
@@ -115,7 +139,8 @@ class BasicInfo { @@ -115,7 +139,8 @@ class BasicInfo {
115 this.remark, 139 this.remark,
116 this.jiedan, 140 this.jiedan,
117 this.staff, 141 this.staff,
118 - this.classify}); 142 + this.classify,
  143 + this.images});
119 144
120 BasicInfo.fromJson(Map<String, dynamic> json) { 145 BasicInfo.fromJson(Map<String, dynamic> json) {
121 ddate = json['ddate']; 146 ddate = json['ddate'];
@@ -127,6 +152,18 @@ class BasicInfo { @@ -127,6 +152,18 @@ class BasicInfo {
127 json['jiedan'] != null ? new Jiedan.fromJson(json['jiedan']) : null; 152 json['jiedan'] != null ? new Jiedan.fromJson(json['jiedan']) : null;
128 staff = json['staff'] != null ? new Jiedan.fromJson(json['staff']) : null; 153 staff = json['staff'] != null ? new Jiedan.fromJson(json['staff']) : null;
129 classify = json['classify']; 154 classify = json['classify'];
  155 + if (json['images'] != null) {
  156 + images = <ImagesById>[];
  157 + if (json['images'] is List) {
  158 + json['images'].forEach((v) {
  159 + images.add(new ImagesById.fromJson(v));
  160 + });
  161 + } else {
  162 + convert.jsonDecode(json['images']).forEach((v) {
  163 + images.add(new ImagesById.fromJson(v));
  164 + });
  165 + }
  166 + }
130 } 167 }
131 168
132 Map<String, dynamic> toJson() { 169 Map<String, dynamic> toJson() {
@@ -143,6 +180,8 @@ class BasicInfo { @@ -143,6 +180,8 @@ class BasicInfo {
143 data['staff'] = this.staff.toJson(); 180 data['staff'] = this.staff.toJson();
144 } 181 }
145 data['classify'] = this.classify; 182 data['classify'] = this.classify;
  183 + data['images'] = this.images;
  184 +
146 return data; 185 return data;
147 } 186 }
148 } 187 }
@@ -175,6 +214,13 @@ class SessionsInfo { @@ -175,6 +214,13 @@ class SessionsInfo {
175 String remark; 214 String remark;
176 List<ImagesById> images; 215 List<ImagesById> images;
177 dynamic tableNum; 216 dynamic tableNum;
  217 + String servicetype;
  218 + String serviceper;
  219 + String serviceprice;
  220 + String discounttype;
  221 + String discountper;
  222 + String discountprice;
  223 + String totalprice;
178 224
179 SessionsInfo( 225 SessionsInfo(
180 {this.rdate, 226 {this.rdate,
@@ -184,7 +230,14 @@ class SessionsInfo { @@ -184,7 +230,14 @@ class SessionsInfo {
184 this.other, 230 this.other,
185 this.remark, 231 this.remark,
186 this.images, 232 this.images,
187 - this.tableNum}); 233 + this.tableNum,
  234 + this.servicetype,
  235 + this.serviceper,
  236 + this.serviceprice,
  237 + this.discounttype,
  238 + this.discountper,
  239 + this.discountprice,
  240 + this.totalprice});
188 241
189 SessionsInfo.fromJson(Map<String, dynamic> json) { 242 SessionsInfo.fromJson(Map<String, dynamic> json) {
190 rdate = json['rdate']; 243 rdate = json['rdate'];
@@ -211,12 +264,25 @@ class SessionsInfo { @@ -211,12 +264,25 @@ class SessionsInfo {
211 264
212 if (json['images'] != null) { 265 if (json['images'] != null) {
213 images = <ImagesById>[]; 266 images = <ImagesById>[];
214 - convert.jsonDecode(json['images']).forEach((v) {  
215 - images.add(new ImagesById.fromJson(v));  
216 - }); 267 + if (json['images'] is List) {
  268 + json['images'].forEach((v) {
  269 + images.add(new ImagesById.fromJson(v));
  270 + });
  271 + } else {
  272 + convert.jsonDecode(json['images']).forEach((v) {
  273 + images.add(new ImagesById.fromJson(v));
  274 + });
  275 + }
217 } 276 }
218 277
219 tableNum = json['table_num']; 278 tableNum = json['table_num'];
  279 + servicetype = json['service_type'];
  280 + serviceper = json['service_per'];
  281 + serviceprice = json['service_price'];
  282 + discounttype = json['discount_type'];
  283 + discountper = json['discount_per'];
  284 + discountprice = json['discount_price'];
  285 + totalprice = json['total_price'];
220 } 286 }
221 287
222 Map<String, dynamic> toJson() { 288 Map<String, dynamic> toJson() {
@@ -235,6 +301,13 @@ class SessionsInfo { @@ -235,6 +301,13 @@ class SessionsInfo {
235 data['remark'] = this.remark; 301 data['remark'] = this.remark;
236 data['images'] = this.images; 302 data['images'] = this.images;
237 data['table_num'] = this.tableNum; 303 data['table_num'] = this.tableNum;
  304 + data['service_type'] = this.servicetype;
  305 + data['service_per'] = this.serviceper;
  306 + data['service_price'] = this.serviceprice;
  307 + data['discount_type'] = this.discounttype;
  308 + data['discount_per'] = this.discountper;
  309 + data['discount_price'] = this.discountprice;
  310 + data['total_price'] = this.totalprice;
238 return data; 311 return data;
239 } 312 }
240 } 313 }
@@ -355,12 +428,58 @@ class OtherDetail { @@ -355,12 +428,58 @@ class OtherDetail {
355 class CostInfoModel { 428 class CostInfoModel {
356 String title; 429 String title;
357 List<CostInfoSunModel> data; 430 List<CostInfoSunModel> data;
358 - bool service = true; //服务费  
359 - bool discount = true; // 优惠金额 431 + bool service;
  432 + bool discount;
  433 +
360 TextEditingController serviceC = TextEditingController(); 434 TextEditingController serviceC = TextEditingController();
361 TextEditingController discountC = TextEditingController(); 435 TextEditingController discountC = TextEditingController();
362 String totalPrice; //合计 436 String totalPrice; //合计
363 String sumPrice; //优惠和服务费之前的金额 437 String sumPrice; //优惠和服务费之前的金额
  438 + String servicetype;
  439 + String serviceper;
  440 + String serviceprice;
  441 + String discounttype;
  442 + String discountper;
  443 + String discountprice;
  444 + String totalprice;
  445 +
  446 + //详情用的服务费展示
  447 + String get showService {
  448 + double sum = double.parse(sumPrice); //原来总金额
  449 +
  450 + if (service) {
  451 + //选中固定金额
  452 + return serviceprice;
  453 + } else {
  454 + //选中百分比
  455 +
  456 + // 使除数为0
  457 + double input = double.parse(serviceper);
  458 + return '${sum * input / 100}';
  459 + }
  460 + }
  461 +
  462 + //详情用的合计展示(原价+服务费)
  463 + String get showTotalWithService {
  464 + double sum = double.parse(sumPrice); //原来总金额
  465 + return '${sum + double.parse(showService)} 元';
  466 + }
  467 +
  468 + //详情用的优惠金额展示
  469 + String get showDiscount {
  470 + double sum = double.parse(sumPrice); //原来总金额
  471 +
  472 + if (discount) {
  473 + //选中固定金额
  474 + return discountprice;
  475 + } else {
  476 + //选中百分比
  477 +
  478 + // 使除数为0
  479 + double input = double.parse(discountper);
  480 + return '-${sum * input / 100} 元';
  481 + }
  482 + }
364 483
365 CostInfoModel({this.title, this.data}); 484 CostInfoModel({this.title, this.data});
366 485
@@ -447,11 +566,18 @@ class ContractInfo { @@ -447,11 +566,18 @@ class ContractInfo {
447 contractRname = json['contract_rname']; 566 contractRname = json['contract_rname'];
448 contractSellerName = json['contract_seller_name']; 567 contractSellerName = json['contract_seller_name'];
449 contractNo = json['contract_no']; 568 contractNo = json['contract_no'];
  569 +
450 if (json['contract_images'] != null) { 570 if (json['contract_images'] != null) {
451 contractImages = <ImagesById>[]; 571 contractImages = <ImagesById>[];
452 - convert.jsonDecode(json['contract_images']).forEach((v) {  
453 - contractImages.add(new ImagesById.fromJson(v));  
454 - }); 572 + if (json['contract_images'] is List) {
  573 + json['contract_images'].forEach((v) {
  574 + contractImages.add(new ImagesById.fromJson(v));
  575 + });
  576 + } else {
  577 + convert.jsonDecode(json['contract_images']).forEach((v) {
  578 + contractImages.add(new ImagesById.fromJson(v));
  579 + });
  580 + }
455 } 581 }
456 } 582 }
457 583
@@ -75,6 +75,7 @@ class SetXuanTaiModel { @@ -75,6 +75,7 @@ class SetXuanTaiModel {
75 }); 75 });
76 } 76 }
77 remark = json['remark']; 77 remark = json['remark'];
  78 + customCxt.text = json['remark'];
78 if (json['images'] != null) { 79 if (json['images'] != null) {
79 images = <Images>[]; 80 images = <Images>[];
80 json['images'].forEach((v) { 81 json['images'].forEach((v) {
@@ -120,6 +121,7 @@ class Tids { @@ -120,6 +121,7 @@ class Tids {
120 Tids.fromJson(Map<String, dynamic> json) { 121 Tids.fromJson(Map<String, dynamic> json) {
121 tid = json['tid']; 122 tid = json['tid'];
122 numStr = json['num']; 123 numStr = json['num'];
  124 + tableNumC.text = numStr;
123 } 125 }
124 126
125 Map<String, dynamic> toJson() { 127 Map<String, dynamic> toJson() {
@@ -40,7 +40,8 @@ import '../table/area_item_table.dart'; @@ -40,7 +40,8 @@ import '../table/area_item_table.dart';
40 import 'package:one_key/models/table_list.dart' as t; 40 import 'package:one_key/models/table_list.dart' as t;
41 41
42 class FeastCreatePage extends StatefulWidget { 42 class FeastCreatePage extends StatefulWidget {
43 - FeastCreatePage({Key key}) : super(key: key); 43 + final GetBanquetByIdNewSunModel banquetDetail;
  44 + FeastCreatePage({Key key, this.banquetDetail}) : super(key: key);
44 45
45 @override 46 @override
46 _FeastCreatePageState createState() => _FeastCreatePageState(); 47 _FeastCreatePageState createState() => _FeastCreatePageState();
@@ -98,12 +99,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -98,12 +99,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
98 99
99 xuantaiData.add(initSetXuanTaiModel(index: 0)); 100 xuantaiData.add(initSetXuanTaiModel(index: 0));
100 initTime(context); 101 initTime(context);
  102 +
101 WidgetsBinding.instance.addPostFrameCallback((_) { 103 WidgetsBinding.instance.addPostFrameCallback((_) {
102 - _getSellerUserBySellerid();  
103 - _getStaff();  
104 - _getClassify();  
105 - _getSetmeal();  
106 - // scrollController.jumpTo(scrollController.position.minScrollExtent); 104 + // _getSellerUserBySellerid();
  105 + // _getStaff();
  106 + // _getClassify();
  107 + // _getSetmeal();
  108 + _getData();
107 }); 109 });
108 bus.on("feast_deposit_list", (arg) { 110 bus.on("feast_deposit_list", (arg) {
109 _getBanquetDeposit(); 111 _getBanquetDeposit();
@@ -113,6 +115,83 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -113,6 +115,83 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
113 }); 115 });
114 } 116 }
115 117
  118 + _getData() async {
  119 + await Future.wait<bool>([
  120 + _getSellerUserBySellerid(),
  121 + _getStaff(),
  122 + _getClassify(),
  123 + _getSetmeal()
  124 + ]).then((results) {
  125 + print(results[0]);
  126 + if (results[0] && results[1] && results[2] && results[3]) {
  127 + //成功
  128 + if (widget.banquetDetail != null) {
  129 + //旧内容编辑
  130 + // ******意向******
  131 + BasicInfo basicInfo = widget.banquetDetail.basicInfo;
  132 + // 宴会日期
  133 + dateTime = DateTime.fromMillisecondsSinceEpoch(
  134 + int.parse(basicInfo.ddate.toString()) * 1000);
  135 + dateTimeShow = createDateText(context, dateTime);
  136 + //接单人
  137 + jdShow = basicInfo.jiedan.nickName ?? basicInfo.jiedan.account;
  138 + jdSelIndex = feastModel.sellerManageList
  139 + .map((item) {
  140 + return item.title;
  141 + })
  142 + .toList()
  143 + .indexOf(jdShow);
  144 + //跟单人
  145 + gdShow = basicInfo.staff.nickName ?? basicInfo.staff.account;
  146 + gdSelIndex = feastModel.personnalList
  147 + .map((item) {
  148 + return item.title;
  149 + })
  150 + .toList()
  151 + .indexOf(gdShow);
  152 + //宴会类型
  153 + feastTypeShow = basicInfo.classify;
  154 + feastTypeSelIndex = feastModel.classifyData
  155 + .map((item) {
  156 + return item.className;
  157 + })
  158 + .toList()
  159 + .indexOf(feastTypeShow);
  160 + //预订人、性别
  161 + nameC.text = basicInfo.rname;
  162 + sexStr = basicInfo.sex;
  163 + sexSelectIndex = sexList
  164 + .map((item) {
  165 + return item['title'];
  166 + })
  167 + .toList()
  168 + .indexOf(sexStr);
  169 + //电话
  170 + phoneC.text = basicInfo.phone;
  171 + //备注
  172 + customC.text = basicInfo.remark;
  173 + //备注图片
  174 + _uploadImageProvider.feastRemarkImageList = [];
  175 + basicInfo.images.forEach((element) {
  176 + UploadImgModel imgModel = UploadImgModel();
  177 + imgModel.qiniuUrl = element.url;
  178 + imgModel.process = 1;
  179 + _uploadImageProvider.feastRemarkImageList.add(imgModel);
  180 + });
  181 + setState(() {});
  182 + }
  183 + } else {
  184 + if (!results[0]) {
  185 + // Utils.showToast('');
  186 + } else {
  187 + // Utils.showToast('');
  188 + }
  189 + }
  190 + }).catchError((e) {
  191 + print(e);
  192 + });
  193 + }
  194 +
116 @override 195 @override
117 void dispose() { 196 void dispose() {
118 super.dispose(); 197 super.dispose();
@@ -175,13 +254,25 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -175,13 +254,25 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
175 254
176 ///获取经理数据 ---- 接单人---全部员工 255 ///获取经理数据 ---- 接单人---全部员工
177 256
178 - _getSellerUserBySellerid() async {  
179 - await feastModel.getAuthUserLists(context); 257 + Future<bool> _getSellerUserBySellerid() async {
  258 + bool success = await feastModel.getAuthUserLists(context);
  259 +
  260 + if (success) {
  261 + return true;
  262 + } else {
  263 + return false;
  264 + }
180 } 265 }
181 266
182 ///跟单人---宴会员工 267 ///跟单人---宴会员工
183 - _getStaff() async {  
184 - await feastModel.getStaff(context); 268 + Future<bool> _getStaff() async {
  269 + bool success = await feastModel.getStaff(context);
  270 +
  271 + if (success) {
  272 + return true;
  273 + } else {
  274 + return false;
  275 + }
185 } 276 }
186 277
187 ///获取宴会详情 278 ///获取宴会详情
@@ -202,7 +293,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -202,7 +293,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
202 293
203 ///获取宴会分类 294 ///获取宴会分类
204 Future<bool> _getClassify({bool isShowLoading = true}) async { 295 Future<bool> _getClassify({bool isShowLoading = true}) async {
205 - await feastModel.getClassify(context, isShowLoading: isShowLoading); 296 + bool success =
  297 + await feastModel.getClassify(context, isShowLoading: isShowLoading);
  298 + if (success) {
  299 + return true;
  300 + } else {
  301 + return false;
  302 + }
206 } 303 }
207 304
208 ///获取宴会定金 305 ///获取宴会定金
@@ -264,7 +361,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -264,7 +361,13 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
264 361
265 /// 根据ID获取宴会套餐 362 /// 根据ID获取宴会套餐
266 Future<bool> _getSetmeal({bool isShowLoading = true}) async { 363 Future<bool> _getSetmeal({bool isShowLoading = true}) async {
267 - await feastModel.getSetmeal(context, isShowLoading: isShowLoading); 364 + bool success =
  365 + await feastModel.getSetmeal(context, isShowLoading: isShowLoading);
  366 + if (success) {
  367 + return true;
  368 + } else {
  369 + return false;
  370 + }
268 // if (success) { 371 // if (success) {
269 372
270 // for ( item in feastModel.setmealData.) { 373 // for ( item in feastModel.setmealData.) {
@@ -1031,7 +1134,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1031,7 +1134,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1031 // map['edate'] = _getEdate(element, element.dateTimext); 1134 // map['edate'] = _getEdate(element, element.dateTimext);
1032 List tids = []; 1135 List tids = [];
1033 for (Tids item in element.tids) { 1136 for (Tids item in element.tids) {
1034 - Map mapTids = {'tid': item.tid, 'num': item.numStr}; 1137 + Map mapTids = {'tid': item.tid, 'num': item.tableNumC.text};
1035 tids.add(mapTids); 1138 tids.add(mapTids);
1036 } 1139 }
1037 map['tids'] = tids; //桌位数据 1140 map['tids'] = tids; //桌位数据
@@ -1111,7 +1214,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1111,7 +1214,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1111 // } 1214 // }
1112 // 备注 1215 // 备注
1113 // if (element.customCxt.text != null) { 1216 // if (element.customCxt.text != null) {
1114 - map['remark'] = element.remark; //备注数据 1217 + map['remark'] = element.customCxt.text; //备注数据
1115 // } 1218 // }
1116 // 图片 1219 // 图片
1117 List imageQiniuUrlList = []; //接口图片数据list 1220 List imageQiniuUrlList = []; //接口图片数据list
@@ -1544,9 +1647,6 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1544,9 +1647,6 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1544 int.parse(item 1647 int.parse(item
1545 .tableNumC.text); 1648 .tableNumC.text);
1546 } 1649 }
1547 - xuantaiData[xuantaiSelIndex]  
1548 - .tids[index]  
1549 - .numStr = value;  
1550 1650
1551 setState(() {}); 1651 setState(() {});
1552 }, 1652 },
@@ -4178,24 +4278,23 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -4178,24 +4278,23 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
4178 } 4278 }
4179 4279
4180 _setData() async { 4280 _setData() async {
4181 - _setBanquetInfoPrice();  
4182 - // await Future.wait<bool>(  
4183 - // [_setBanquetContract(), _setInvoice(), _setBanquetInfoPrice()])  
4184 - // .then((results) {  
4185 - // print(results[0]);  
4186 - // if (results[0] && results[1] && results[2]) {  
4187 - // //成功  
4188 - // Utils.showToast('保存成功');  
4189 - // } else {  
4190 - // if (!results[0]) {  
4191 - // // Utils.showToast('');  
4192 - // } else {  
4193 - // // Utils.showToast('');  
4194 - // }  
4195 - // }  
4196 - // }).catchError((e) {  
4197 - // print(e);  
4198 - // }); 4281 + await Future.wait<bool>(
  4282 + [_setBanquetContract(), _setInvoice(), _setBanquetInfoPrice()])
  4283 + .then((results) {
  4284 + print(results[0]);
  4285 + if (results[0] && results[1] && results[2]) {
  4286 + //成功
  4287 + Utils.showToast('保存成功');
  4288 + } else {
  4289 + if (!results[0]) {
  4290 + // Utils.showToast('');
  4291 + } else {
  4292 + // Utils.showToast('');
  4293 + }
  4294 + }
  4295 + }).catchError((e) {
  4296 + print(e);
  4297 + });
4199 } 4298 }
4200 4299
4201 Widget taocanTextType(String per1, String title, String per) { 4300 Widget taocanTextType(String per1, String title, String per) {
@@ -539,7 +539,7 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -539,7 +539,7 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
539 feastModel.banquetDetail.costInfo[index]; 539 feastModel.banquetDetail.costInfo[index];
540 return Padding( 540 return Padding(
541 padding: EdgeInsets.only( 541 padding: EdgeInsets.only(
542 - left: w(12), right: w(12), bottom: w(27)), 542 + left: w(12), right: w(12), bottom: w(17)),
543 child: Column( 543 child: Column(
544 crossAxisAlignment: CrossAxisAlignment.start, 544 crossAxisAlignment: CrossAxisAlignment.start,
545 children: [ 545 children: [
@@ -575,6 +575,8 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -575,6 +575,8 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
575 costInfoSunModel.price.toString(), 575 costInfoSunModel.price.toString(),
576 ); 576 );
577 }), 577 }),
  578 + costItem('服务费', '', '', '${costInfoModel.showService}',
  579 + isTitle: false),
578 //服务费 580 //服务费
579 Container( 581 Container(
580 height: h(32), 582 height: h(32),
@@ -585,146 +587,26 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -585,146 +587,26 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
585 width: w(1), 587 width: w(1),
586 color: MyColours.color_DBDBDB))), 588 color: MyColours.color_DBDBDB))),
587 child: Row( 589 child: Row(
  590 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
588 children: [ 591 children: [
589 Container( 592 Container(
590 width: w(80), 593 width: w(80),
591 child: Text( 594 child: Text(
592 - '服务费:', 595 + '合计',
593 style: TextStyle( 596 style: TextStyle(
594 - color: MyColours.color_515151,  
595 - fontSize: font(12)), 597 + color: MyColours.color_999999,
  598 + fontSize: font(14)),
596 ), 599 ),
597 ), 600 ),
598 - InkWell(  
599 - onTap: () {  
600 - if (costInfoModel.service) {  
601 - return;  
602 - }  
603 - setState(() {  
604 - costInfoModel.service =  
605 - !costInfoModel.service;  
606 - });  
607 - if (costInfoModel.serviceC.text != '') {  
608 - // _calculatePrice(  
609 - // costInfoModel,  
610 - // );  
611 - }  
612 - },  
613 - child: Row(  
614 - children: [  
615 - Image.asset(  
616 - Utils.getImgPath(costInfoModel.service  
617 - ? 'f_radio_sel'  
618 - : 'f_radio_un'),  
619 - width: w(20),  
620 - ),  
621 - HEmptyView(8),  
622 - Text(  
623 - '固定金额',  
624 - style: TextStyle(  
625 - color: MyColours.color_515151,  
626 - fontSize: font(12)),  
627 - ),  
628 - ],  
629 - ),  
630 - ),  
631 - HEmptyView(16),  
632 - InkWell(  
633 - onTap: () {  
634 - if (!costInfoModel.service) {  
635 - return;  
636 - }  
637 - setState(() {  
638 - costInfoModel.service =  
639 - !costInfoModel.service;  
640 - });  
641 - if (costInfoModel.serviceC.text != '') {  
642 - // _calculatePrice(  
643 - // costInfoModel,  
644 - // );  
645 - }  
646 - },  
647 - child: Row(  
648 - children: [  
649 - Image.asset(  
650 - Utils.getImgPath(!costInfoModel.service  
651 - ? 'f_radio_sel'  
652 - : 'f_radio_un'),  
653 - width: w(20),  
654 - ),  
655 - HEmptyView(8),  
656 - Container(  
657 - width: w(40),  
658 - child: Text(  
659 - '百分比',  
660 - style: TextStyle(  
661 - color: MyColours.color_515151,  
662 - fontSize: font(12)),  
663 - )),  
664 - ], 601 + Padding(
  602 + padding: EdgeInsets.only(right: w(24)),
  603 + child: Text(
  604 + costInfoModel.showTotalWithService,
  605 + style: TextStyle(
  606 + color: MyColours.color_999999,
  607 + fontSize: font(14)),
665 ), 608 ),
666 ), 609 ),
667 - HEmptyView(12),  
668 - Expanded(  
669 - child: Container(  
670 - height: h(17),  
671 - decoration: BoxDecoration(  
672 - border: Border(  
673 - bottom: BorderSide(  
674 - width: w(1),  
675 - color:  
676 - MyColours.color_DBDBDB))),  
677 - child: TextField(  
678 - maxLines: 1,  
679 -  
680 - //输入文本的样式  
681 - style: TextStyle(  
682 - fontSize: ScreenUtil().setSp(24),  
683 - color: MyColours.color_515151),  
684 - controller: costInfoModel.serviceC,  
685 - // focusNode: node,  
686 - // textAlignVertical: TextAlignVertical.top,  
687 - decoration: InputDecoration(  
688 - hintText: '请输入',  
689 - hintStyle: TextStyle(  
690 - color: true  
691 - ? MyColours.color_999999  
692 - : MyColours.color_515151,  
693 - fontSize: ScreenUtil().setSp(24),  
694 - ),  
695 - // contentPadding:  
696 - // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),  
697 - // border: InputBorder.none,  
698 - contentPadding: EdgeInsets.zero,  
699 - border: OutlineInputBorder(  
700 - borderSide: BorderSide.none),  
701 - ),  
702 - onChanged: (value) {  
703 - print('ggg');  
704 -  
705 - // _calculatePrice(  
706 - // costInfoModel,  
707 - // );  
708 -  
709 - // nameStr = value;  
710 - },  
711 - onEditingComplete: () {  
712 - // print('fff');  
713 - // node.unfocus();  
714 - // _homeEnterModel.nameController.text =  
715 - // nameStr + _nameSuffix();  
716 - // _addNameSuffix(nameStr, sexStr);  
717 - },  
718 - keyboardType: TextInputType  
719 - .numberWithOptions())),  
720 - ),  
721 - HEmptyView(4),  
722 - Text(  
723 - costInfoModel.service ? '元' : '%',  
724 - style: TextStyle(  
725 - color: MyColours.color_000000,  
726 - fontSize: font(12)),  
727 - ),  
728 ], 610 ],
729 )), 611 )),
730 //优惠金额 612 //优惠金额
@@ -737,145 +619,31 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -737,145 +619,31 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
737 width: w(1), 619 width: w(1),
738 color: MyColours.color_DBDBDB))), 620 color: MyColours.color_DBDBDB))),
739 child: Row( 621 child: Row(
  622 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
740 children: [ 623 children: [
741 Container( 624 Container(
742 width: w(80), 625 width: w(80),
743 child: Text( 626 child: Text(
744 - '优惠金额:', 627 + '优惠金额',
745 style: TextStyle( 628 style: TextStyle(
746 color: MyColours.color_E34D59, 629 color: MyColours.color_E34D59,
747 - fontSize: font(12)), 630 + fontSize: font(14)),
748 ), 631 ),
749 ), 632 ),
750 - InkWell(  
751 - onTap: () {  
752 - if (costInfoModel.discount) {  
753 - return;  
754 - }  
755 - setState(() {  
756 - costInfoModel.discount =  
757 - !costInfoModel.discount;  
758 - });  
759 - if (costInfoModel.discountC.text != '') {  
760 - // _calculatePrice(  
761 - // costInfoModel,  
762 - // );  
763 - }  
764 - },  
765 - child: Row(children: [  
766 - Image.asset(  
767 - Utils.getImgPath(costInfoModel.discount  
768 - ? 'f_radio_sel'  
769 - : 'f_radio_un'),  
770 - width: w(20),  
771 - ),  
772 - HEmptyView(8),  
773 - Text(  
774 - '固定金额',  
775 - style: TextStyle(  
776 - color: MyColours.color_515151,  
777 - fontSize: font(12)),  
778 - ),  
779 - ])),  
780 - HEmptyView(16),  
781 - InkWell(  
782 - onTap: () {  
783 - if (!costInfoModel.discount) {  
784 - return;  
785 - }  
786 - setState(() {  
787 - costInfoModel.discount =  
788 - !costInfoModel.discount;  
789 - });  
790 - if (costInfoModel.discountC.text != '') {  
791 - // _calculatePrice(  
792 - // costInfoModel,  
793 - // );  
794 - }  
795 - },  
796 - child: Row(children: [  
797 - Image.asset(  
798 - Utils.getImgPath(!costInfoModel.discount  
799 - ? 'f_radio_sel'  
800 - : 'f_radio_un'),  
801 - width: w(20),  
802 - ),  
803 - HEmptyView(8),  
804 - Container(  
805 - width: w(40),  
806 - child: Text(  
807 - '折扣',  
808 - style: TextStyle(  
809 - color: MyColours.color_515151,  
810 - fontSize: font(12)),  
811 - ))  
812 - ])),  
813 - HEmptyView(12),  
814 - Expanded(  
815 - child: Container(  
816 - height: h(17),  
817 - decoration: BoxDecoration(  
818 - border: Border(  
819 - bottom: BorderSide(  
820 - width: w(1),  
821 - color:  
822 - MyColours.color_DBDBDB))),  
823 - child: TextField(  
824 - maxLines: 1,  
825 -  
826 - //输入文本的样式  
827 - style: TextStyle(  
828 - fontSize: ScreenUtil().setSp(24),  
829 - color: MyColours.color_515151),  
830 - controller: costInfoModel.discountC,  
831 - // focusNode: node,  
832 - // textAlignVertical: TextAlignVertical.top,  
833 - decoration: InputDecoration(  
834 - hintText: '请输入',  
835 - hintStyle: TextStyle(  
836 - color: true  
837 - ? MyColours.color_999999  
838 - : MyColours.color_E34D59,  
839 - fontSize: ScreenUtil().setSp(24),  
840 - ),  
841 - // contentPadding:  
842 - // EdgeInsets.only(bottom: ScreenUtil().setWidth(17)),  
843 - // border: InputBorder.none,  
844 - contentPadding: EdgeInsets.zero,  
845 - border: OutlineInputBorder(  
846 - borderSide: BorderSide.none),  
847 - ),  
848 - onChanged: (value) {  
849 - print('ggg');  
850 -  
851 - // _calculatePrice(  
852 - // costInfoModel,  
853 - // );  
854 -  
855 - // nameStr = value;  
856 - },  
857 - onEditingComplete: () {  
858 - // print('fff');  
859 - // node.unfocus();  
860 - // _homeEnterModel.nameController.text =  
861 - // nameStr + _nameSuffix();  
862 - // _addNameSuffix(nameStr, sexStr);  
863 - },  
864 - keyboardType: TextInputType  
865 - .numberWithOptions())),  
866 - ),  
867 - HEmptyView(4),  
868 - Text(  
869 - costInfoModel.discount ? '元' : '%',  
870 - style: TextStyle(  
871 - color: MyColours.color_000000,  
872 - fontSize: font(12)), 633 + Padding(
  634 + padding: EdgeInsets.only(right: w(24)),
  635 + child: Text(
  636 + costInfoModel.showDiscount,
  637 + style: TextStyle(
  638 + color: MyColours.color_E34D59,
  639 + fontSize: font(14)),
  640 + ),
873 ), 641 ),
874 ], 642 ],
875 )), 643 )),
876 //合计 644 //合计
877 Container( 645 Container(
878 - height: h(24), 646 + height: h(32),
879 decoration: BoxDecoration( 647 decoration: BoxDecoration(
880 border: Border( 648 border: Border(
881 bottom: BorderSide( 649 bottom: BorderSide(
@@ -883,10 +651,9 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -883,10 +651,9 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
883 color: MyColours.color_DBDBDB))), 651 color: MyColours.color_DBDBDB))),
884 child: Row(children: [ 652 child: Row(children: [
885 Text( 653 Text(
886 - '合计', 654 + '优惠后合计',
887 style: TextStyle( 655 style: TextStyle(
888 color: MyColours.color_515151, 656 color: MyColours.color_515151,
889 - fontWeight: FontWeight.bold,  
890 fontSize: font(14)), 657 fontSize: font(14)),
891 ), 658 ),
892 Spacer(), 659 Spacer(),
@@ -894,7 +661,6 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -894,7 +661,6 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
894 '${costInfoModel.totalPrice} 元', 661 '${costInfoModel.totalPrice} 元',
895 style: TextStyle( 662 style: TextStyle(
896 color: MyColours.color_515151, 663 color: MyColours.color_515151,
897 - fontWeight: FontWeight.bold,  
898 fontSize: font(14)), 664 fontSize: font(14)),
899 ), 665 ),
900 HEmptyView(48) 666 HEmptyView(48)
@@ -902,6 +668,33 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -902,6 +668,33 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
902 ], 668 ],
903 )); 669 ));
904 }), 670 }),
  671 + Container(
  672 + // height: h(22),
  673 + padding: EdgeInsets.only(bottom: h(5)),
  674 + margin: EdgeInsets.only(bottom: h(13), left: w(12), right: w(12)),
  675 + decoration: BoxDecoration(
  676 + // color: Colors.red,
  677 + border: Border(
  678 + bottom: BorderSide(
  679 + width: w(1), color: MyColours.color_DBDBDB))),
  680 + child: Row(children: [
  681 + Text(
  682 + '最终议价合计',
  683 + style: TextStyle(
  684 + color: MyColours.color_515151,
  685 + fontWeight: FontWeight.bold,
  686 + fontSize: font(16)),
  687 + ),
  688 + Spacer(),
  689 + Text(
  690 + '${feastModel.banquetDetail.contractInfo.contractFinalPrice} 元',
  691 + style: TextStyle(
  692 + color: MyColours.color_515151,
  693 + fontWeight: FontWeight.bold,
  694 + fontSize: font(16)),
  695 + ),
  696 + HEmptyView(48)
  697 + ]))
905 ])); 698 ]));
906 } 699 }
907 700
@@ -1022,7 +815,7 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -1022,7 +815,7 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
1022 VEmptyView(16), 815 VEmptyView(16),
1023 Padding( 816 Padding(
1024 padding: EdgeInsets.only( 817 padding: EdgeInsets.only(
1025 - left: w(12), right: w(12), top: w(11), bottom: w(35)), 818 + left: w(12), right: w(12), top: w(8), bottom: w(35)),
1026 child: Column( 819 child: Column(
1027 children: [ 820 children: [
1028 feastModel.banquetDetail.invoice == null || 821 feastModel.banquetDetail.invoice == null ||
@@ -1065,6 +858,21 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -1065,6 +858,21 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
1065 ), 858 ),
1066 ], 859 ],
1067 ), 860 ),
  861 + RoundButton(
  862 + text: '查看发票',
  863 + radius: r(7),
  864 + width: w(48),
  865 + height: h(18),
  866 + fontSize: 20,
  867 + textColor: MyColours.color_F6F6F6,
  868 + isBold: false,
  869 + gradientStart: MyColours.color_438E93,
  870 + gradientEnd: MyColours.color_438E93,
  871 + onPressed: () {
  872 + NavigatorUtil.goFeastInvoiceDetailPage(context,
  873 + invoice: feastModel.banquetDetail.invoice);
  874 + },
  875 + ),
1068 // InkWell( 876 // InkWell(
1069 // onTap: () { 877 // onTap: () {
1070 // //弹框确认是否删除 878 // //弹框确认是否删除
@@ -1165,6 +973,8 @@ class _FeastDetailPageState extends State<FeastDetailPage> { @@ -1165,6 +973,8 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
1165 Expanded( 973 Expanded(
1166 child: _callButton( 974 child: _callButton(
1167 onPress: () async { 975 onPress: () async {
  976 + NavigatorUtil.goFeastCreatePage(context,
  977 + banquetDetail: feastModel.banquetDetail);
1168 // selectMenu = '签约'; 978 // selectMenu = '签约';
1169 // menuSet.add('定金'); 979 // menuSet.add('定金');
1170 // menuSet.add('签约'); 980 // menuSet.add('签约');
  1 +import 'dart:convert';
  2 +
  3 +import 'package:common_utils/common_utils.dart';
  4 +import 'package:flutter/gestures.dart';
  5 +import 'package:flutter/material.dart';
  6 +import 'package:flutter_picker/Picker.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';
  10 +import 'package:one_key/widgets/v_empty_view.dart';
  11 +import 'package:provider/provider.dart';
  12 +
  13 +import '../../res/colors.dart';
  14 +import '../../utils/dialog_util.dart';
  15 +import '../../utils/event_bus.dart';
  16 +import '../../utils/screen_util.dart';
  17 +import '../../utils/utils.dart';
  18 +import '../../widgets/h_empty_view.dart';
  19 +import '../../widgets/system_app_bar.dart';
  20 +
  21 +/**
  22 + * 查看发票
  23 + */
  24 +class FeastInvoiceDetailPage extends StatefulWidget {
  25 + final Invoice invoice;
  26 + FeastInvoiceDetailPage({Key key, this.invoice}) : super(key: key);
  27 +
  28 + @override
  29 + _FeastInvoiceDetailPageState createState() => _FeastInvoiceDetailPageState();
  30 +}
  31 +
  32 +class _FeastInvoiceDetailPageState extends State<FeastInvoiceDetailPage> {
  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 +
  49 + @override
  50 + void initState() {
  51 + // TODO: implement initState
  52 + super.initState();
  53 +
  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 + }
  71 +
  72 + WidgetsBinding.instance.addPostFrameCallback((_) {});
  73 + }
  74 +
  75 + ///请输入
  76 + ///输入框
  77 + Widget _textfield(
  78 + String title,
  79 + TextEditingController editingController,
  80 + // FocusNode focusNode,
  81 + String subTitle,
  82 + {TextInputType inputType = TextInputType.text,
  83 + bool need = false}) {
  84 + return Container(
  85 + child: Row(
  86 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  87 + children: [
  88 + Container(
  89 + width: w(92),
  90 + child: RichText(
  91 + textScaleFactor: 1,
  92 + overflow: TextOverflow.ellipsis,
  93 + // textDirection: TextDirection.ltr,
  94 +
  95 + text: TextSpan(
  96 + children: [
  97 + TextSpan(
  98 + text: title,
  99 + style: TextStyle(
  100 + color: MyColours.color_515151,
  101 + fontSize: ScreenUtil().setSp(28)),
  102 + recognizer: TapGestureRecognizer()..onTap = () {}),
  103 + // TextSpan(
  104 + // text: need ? '*' : '',
  105 + // style: TextStyle(
  106 + // color: MyColours.color_E34D59,
  107 + // fontSize: ScreenUtil().setSp(28)),
  108 + // //点击事件
  109 + // recognizer: TapGestureRecognizer()..onTap = () {}),
  110 + ],
  111 + ))),
  112 + HEmptyView(48),
  113 + Expanded(
  114 + child: Container(
  115 + decoration: BoxDecoration(
  116 + border: Border(
  117 + bottom: BorderSide(
  118 + width: h(1), color: MyColours.color_DBDBDB))),
  119 + child: Row(
  120 + children: [
  121 + Expanded(
  122 + child: Container(
  123 + // height: ScreenUtil().setHeight(120),
  124 + height: ScreenUtil().setWidth(64),
  125 + child: TextField(
  126 + enabled: false,
  127 + controller: editingController,
  128 + // textAlign: TextAlign.right,
  129 + // textAlignVertical: TextAlignVertical.bottom,
  130 + maxLines: 1,
  131 + inputFormatters: [],
  132 +
  133 + // //光标颜色
  134 + // cursorColor:
  135 + // widget.isSelect ? Colors.white : MyColours.color_199095,
  136 + //输入文本的样式
  137 + style: TextStyle(
  138 + fontSize: ScreenUtil().setSp(28),
  139 + color: MyColours.color_999999),
  140 + // focusNode: focusNode,
  141 + decoration: InputDecoration(
  142 + border:
  143 + OutlineInputBorder(borderSide: BorderSide.none),
  144 + hintText: '',
  145 + hintStyle: TextStyle(
  146 + color: MyColours.color_999999,
  147 + fontSize: ScreenUtil().setSp(28),
  148 + ),
  149 + contentPadding: EdgeInsets.zero,
  150 + ),
  151 + onChanged: (value) {},
  152 + onEditingComplete: () {
  153 + FocusScope.of(context)
  154 + .requestFocus(FocusNode()); //点击空白处隐藏键盘
  155 + },
  156 + keyboardType: inputType,
  157 + )),
  158 + ),
  159 + Container(
  160 + child: Text(
  161 + subTitle,
  162 + style: TextStyle(
  163 + color: MyColours.color_515151,
  164 + fontSize: ScreenUtil().setSp(28)),
  165 + ),
  166 + ),
  167 + ],
  168 + ),
  169 + ))
  170 + ],
  171 + ),
  172 + );
  173 + }
  174 +
  175 + ///请选择
  176 + Widget _selectWidget(String title, String labelShow,
  177 + {GestureTapCallback onTap, bool need = true}) {
  178 + return InkWell(
  179 + onTap: onTap,
  180 + // () {
  181 + // FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
  182 + // DialogUtil.showSelectCusmanDialog(
  183 + // context,
  184 + // customerProvider.labelList.map((item) {
  185 + // return item.label;
  186 + // }).toList(), (value) {
  187 + // if (value != null) {
  188 + // setState(() {
  189 + // customerProvider.labelSelIndex =
  190 + // value.first;
  191 + // labelShow = customerProvider
  192 + // .labelList[
  193 + // customerProvider.labelSelIndex]
  194 + // .label;
  195 + // });
  196 + // }
  197 + // },
  198 + // selecteds:
  199 + // customerProvider.labelSelIndex == null
  200 + // ? []
  201 + // : [
  202 + // customerProvider.labelSelIndex
  203 + // ])
  204 + // .then((value) {});
  205 + // },
  206 + child: Row(
  207 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  208 + crossAxisAlignment: CrossAxisAlignment.center,
  209 + children: [
  210 + Container(
  211 + // color: Colors.red,
  212 + width: ScreenUtil().setWidth(160),
  213 + height: ScreenUtil().setWidth(35),
  214 + child: Text(
  215 + title,
  216 + style: TextStyle(
  217 + fontSize: ScreenUtil().setSp(28),
  218 + color: MyColours.color_515151),
  219 + ),
  220 + ),
  221 + HEmptyView(60),
  222 + Expanded(
  223 + child: Container(
  224 + height: ScreenUtil().setWidth(64),
  225 + decoration: BoxDecoration(
  226 + border: Border(
  227 + bottom: BorderSide(
  228 + width: ScreenUtil().setWidth(2),
  229 + color: Color.fromRGBO(220, 220, 220, 1)))),
  230 + child: Row(
  231 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  232 + children: [
  233 + Expanded(
  234 + child: Text(
  235 + labelShow,
  236 + overflow: TextOverflow.ellipsis,
  237 + style: TextStyle(
  238 + color: labelShow == '请选择'
  239 + ? MyColours.color_999999
  240 + : MyColours.color_515151,
  241 + fontSize: ScreenUtil().setSp(28),
  242 + ),
  243 + )),
  244 + HEmptyView(10),
  245 + Image.asset(
  246 + Utils.getImgPath('f_arrow_down'),
  247 + width: ScreenUtil().setWidth(64),
  248 + // height: ScreenUtil().setWidth(10),
  249 + ),
  250 + HEmptyView(16),
  251 + ],
  252 + ))),
  253 + ],
  254 + ),
  255 + );
  256 + }
  257 +
  258 + Widget _callButton(
  259 + {GestureTapCallback onPress,
  260 + content,
  261 + hasLeftBorder = true,
  262 + isSelect = false}) {
  263 + return InkWell(
  264 + onTap: onPress,
  265 + child: Container(
  266 + height: h(48),
  267 + decoration: BoxDecoration(
  268 + color: isSelect ? MyColours.color_438E93 : MyColours.color_ffffff,
  269 + border: Border(
  270 + bottom: BorderSide(
  271 + color: MyColours.color_438E93,
  272 + width: ScreenUtil().setWidth(2)),
  273 + top: BorderSide(
  274 + color: MyColours.color_438E93,
  275 + width: ScreenUtil().setWidth(2)),
  276 + left: hasLeftBorder
  277 + ? BorderSide(
  278 + color: MyColours.color_438E93,
  279 + width: ScreenUtil().setWidth(2))
  280 + : BorderSide.none,
  281 + right: BorderSide(
  282 + color: MyColours.color_438E93,
  283 + width: ScreenUtil().setWidth(2)))),
  284 + child: Align(
  285 + alignment: Alignment.center,
  286 + child: Text(
  287 + content,
  288 + style: TextStyle(
  289 + color:
  290 + isSelect ? MyColours.color_F6F6F6 : MyColours.color_438E93,
  291 + fontSize: ScreenUtil().setSp(36)),
  292 + ),
  293 + ),
  294 + ),
  295 + );
  296 + }
  297 +
  298 + ///单选按钮
  299 + Widget radioBtn(
  300 + String title,
  301 + bool select,
  302 + GestureTapCallback onTap,
  303 + ) {
  304 + return InkWell(
  305 + onTap: onTap,
  306 + child: Row(
  307 + children: [
  308 + Image.asset(
  309 + Utils.getImgPath(select ? 'f_select_black' : 'f_select_not'),
  310 + width: w(24),
  311 + ),
  312 + HEmptyView(16),
  313 + Text(
  314 + title,
  315 + style: TextStyle(
  316 + color:
  317 + select ? MyColours.color_515151 : MyColours.color_BFC4D4,
  318 + fontWeight: FontWeight.bold,
  319 + fontSize: ScreenUtil().setSp(32)),
  320 + ),
  321 + ],
  322 + ));
  323 + }
  324 +
  325 + @override
  326 + Widget build(BuildContext context) {
  327 + feastModel = Provider.of<FeastModel>(context, listen: true);
  328 + return Scaffold(
  329 + backgroundColor: MyColours.color_ffffff,
  330 + appBar: SystemAppBar(
  331 + '添加发票',
  332 + needWhite: true,
  333 + bgColor: MyColours.color_438E93,
  334 + titleColor: MyColours.color_F6F6F6,
  335 + onTap: () {
  336 + Navigator.pop(context);
  337 + },
  338 + ),
  339 + body: SingleChildScrollView(
  340 + child: Padding(
  341 + padding: EdgeInsets.only(left: w(30), right: w(13)),
  342 + child: Column(
  343 + children: [
  344 + VEmptyView(68),
  345 + Row(
  346 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  347 + children: [
  348 + radioBtn('增值税普通发票', type, () {
  349 + // if (type) {
  350 + // return;
  351 + // }
  352 + // setState(() {
  353 + // type = !type;
  354 + // });
  355 + }),
  356 + radioBtn('增值税专用发票', !type, () {
  357 + // if (!type) {
  358 + // return;
  359 + // }
  360 + // setState(() {
  361 + // type = !type;
  362 + // });
  363 + }),
  364 + ],
  365 + ),
  366 + VEmptyView(80),
  367 + _textfield('开票金额', priceC, '元', need: true),
  368 + VEmptyView(40),
  369 + _textfield('单位全称', unitNameC, '', need: true),
  370 + VEmptyView(40),
  371 + _textfield('纳税人识别号', numC, '', need: true),
  372 + VEmptyView(40),
  373 + _textfield('注册地址', addressC, '', need: !type),
  374 + VEmptyView(40),
  375 + _textfield('注册电话', phoneC, '', need: !type),
  376 + VEmptyView(40),
  377 + _textfield('开户银行', bankC, '', need: !type),
  378 + VEmptyView(40),
  379 + _textfield('银行账号', bankNumC, '', need: !type),
  380 + VEmptyView(40),
  381 + _textfield('电子邮箱', mailC, ''),
  382 + VEmptyView(40),
  383 + _textfield('收件人', addresseeC, ''),
  384 + VEmptyView(40),
  385 + _textfield('收件人电话', addresseePhoneC, ''),
  386 + VEmptyView(40),
  387 + _textfield('收件地址', addresseeAddressC, ''),
  388 + VEmptyView(40),
  389 + _textfield('邮编', codeC, ''),
  390 + VEmptyView(40),
  391 + ],
  392 + )),
  393 + )
  394 + // Row(
  395 + // children: [
  396 + // Expanded(
  397 + // child: _callButton(
  398 + // onPress: () {
  399 + // Navigator.pop(context);
  400 + // },
  401 + // content: '返回',
  402 + // hasLeftBorder: true,
  403 + // isSelect: false)),
  404 + // Expanded(
  405 + // child: _callButton(
  406 + // onPress: () async {
  407 + // if (priceC.text.trim().length == 0) {
  408 + // Utils.showToast('请输入开票金额');
  409 + // return;
  410 + // }
  411 + // if (unitNameC.text.trim().length == 0) {
  412 + // Utils.showToast('请输入单位全称');
  413 + // return;
  414 + // }
  415 + // if (numC.text.trim().length == 0) {
  416 + // Utils.showToast('请输入纳税人识别号');
  417 + // return;
  418 + // }
  419 + // if (!type) {
  420 + // //专用发票
  421 + // if (addressC.text.trim().length == 0) {
  422 + // Utils.showToast('请输入注册地址');
  423 + // return;
  424 + // }
  425 + // if (phoneC.text.trim().length == 0) {
  426 + // Utils.showToast('请输入注册电话');
  427 + // return;
  428 + // }
  429 + // if (bankC.text.trim().length == 0) {
  430 + // Utils.showToast('请输入开户银行');
  431 + // return;
  432 + // }
  433 + // if (bankNumC.text.trim().length == 0) {
  434 + // Utils.showToast('请输入银行账号');
  435 + // return;
  436 + // }
  437 + // }
  438 + // Map<String, String> map = {
  439 + // "invoice_type": type ? '1' : '2',
  440 + // "price": priceC.text,
  441 + // "unit_name": unitNameC.text,
  442 + // "num": numC.text,
  443 + // "address": addressC.text,
  444 + // "phone": phoneC.text,
  445 + // "bank": bankC.text,
  446 + // "bank_num": bankNumC.text,
  447 + // "mail": mailC.text,
  448 + // "addressee": addresseeC.text,
  449 + // "addressee_phone": addresseePhoneC.text,
  450 + // "addressee_address": addresseeAddressC.text,
  451 + // "code": codeC.text
  452 + // };
  453 +
  454 + // Navigator.pop(context, {'object': map});
  455 + // },
  456 + // content: '保存并返回',
  457 + // hasLeftBorder: true,
  458 + // isSelect: true))
  459 + // ],
  460 + // )
  461 + );
  462 + }
  463 +}
@@ -855,7 +855,15 @@ class NavigatorUtil { @@ -855,7 +855,15 @@ class NavigatorUtil {
855 855
856 ///宴会----新建宴会 856 ///宴会----新建宴会
857 static Future<dynamic> goFeastCreatePage(BuildContext context, 857 static Future<dynamic> goFeastCreatePage(BuildContext context,
858 - {replace = false, bool onlyShow = false}) { 858 + {replace = false,
  859 + bool onlyShow = false,
  860 + GetBanquetByIdNewSunModel banquetDetail}) {
  861 + if (banquetDetail != null) {
  862 + return _navigateTo(context,
  863 + "${Routes.feast_create_page}?banquetDetail=${FluroConvertUtils.object2string(banquetDetail)}",
  864 + replace: replace);
  865 + }
  866 +
859 return _navigateTo(context, "${Routes.feast_create_page}", 867 return _navigateTo(context, "${Routes.feast_create_page}",
860 replace: replace); 868 replace: replace);
861 } 869 }
@@ -928,7 +936,7 @@ class NavigatorUtil { @@ -928,7 +936,7 @@ class NavigatorUtil {
928 "${Routes.feast_invoice_page}?invoice=${FluroConvertUtils.object2string(invoice)}", 936 "${Routes.feast_invoice_page}?invoice=${FluroConvertUtils.object2string(invoice)}",
929 replace: replace); 937 replace: replace);
930 } 938 }
931 - return _navigateTo(context, "${Routes.feast_invoice_page}?", 939 + return _navigateTo(context, "${Routes.feast_invoice_page}",
932 replace: replace); 940 replace: replace);
933 } 941 }
934 942
@@ -1081,4 +1089,16 @@ class NavigatorUtil { @@ -1081,4 +1089,16 @@ class NavigatorUtil {
1081 return _navigateTo(context, "${Routes.feast_detail_page}?rid=$rid", 1089 return _navigateTo(context, "${Routes.feast_detail_page}?rid=$rid",
1082 replace: replace); 1090 replace: replace);
1083 } 1091 }
  1092 +
  1093 + ///宴会----发票详情
  1094 + static Future<dynamic> goFeastInvoiceDetailPage(BuildContext context,
  1095 + {replace = false, bool onlyShow = false, Invoice invoice}) {
  1096 + if (invoice != null) {
  1097 + return _navigateTo(context,
  1098 + "${Routes.feast_invoice_detail_page}?invoice=${FluroConvertUtils.object2string(invoice)}",
  1099 + replace: replace);
  1100 + }
  1101 + return _navigateTo(context, "${Routes.feast_invoice_detail_page}",
  1102 + replace: replace);
  1103 + }
1084 } 1104 }
@@ -157,6 +157,7 @@ import '../pages/feast/feast_deposit_data_page.dart'; @@ -157,6 +157,7 @@ import '../pages/feast/feast_deposit_data_page.dart';
157 import '../pages/feast/feast_deposit_page.dart'; 157 import '../pages/feast/feast_deposit_page.dart';
158 import '../pages/feast/feast_detail_page.dart'; 158 import '../pages/feast/feast_detail_page.dart';
159 import '../pages/feast/feast_followup_page.dart'; 159 import '../pages/feast/feast_followup_page.dart';
  160 +import '../pages/feast/feast_invoice_detail_page.dart';
160 import '../pages/feast/feast_invoice_page.dart'; 161 import '../pages/feast/feast_invoice_page.dart';
161 import '../pages/feast/feast_menu_page.dart'; 162 import '../pages/feast/feast_menu_page.dart';
162 import '../pages/feast/feast_menu_show_page.dart'; 163 import '../pages/feast/feast_menu_show_page.dart';
@@ -1366,9 +1367,14 @@ var feastCreatePageHandle = new Handler( @@ -1366,9 +1367,14 @@ var feastCreatePageHandle = new Handler(
1366 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 1367 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
1367 // String uids = params["uids"].first; 1368 // String uids = params["uids"].first;
1368 1369
1369 - // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); 1370 + GetBanquetByIdNewSunModel banquetDetail;
  1371 + if (params.keys.contains('banquetDetail')) {
  1372 + banquetDetail = GetBanquetByIdNewSunModel.fromJson(json.decode(
  1373 + FluroConvertUtils.fluroCnParamsDecode(params["banquetDetail"].first)));
  1374 + }
1370 return ChangeNotifierProvider<FeastModel>( 1375 return ChangeNotifierProvider<FeastModel>(
1371 - create: (_) => FeastModel(), child: FeastCreatePage()); 1376 + create: (_) => FeastModel(),
  1377 + child: FeastCreatePage(banquetDetail: banquetDetail));
1372 }); 1378 });
1373 1379
1374 ///宴会----添加定金 1380 ///宴会----添加定金
@@ -1739,7 +1745,6 @@ var feastQYMenuPageHandle = new Handler( @@ -1739,7 +1745,6 @@ var feastQYMenuPageHandle = new Handler(
1739 ///宴会----详情 1745 ///宴会----详情
1740 var feastDetailPageHandle = new Handler( 1746 var feastDetailPageHandle = new Handler(
1741 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 1747 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
1742 -  
1743 String rid = params["rid"].first; 1748 String rid = params["rid"].first;
1744 1749
1745 return ChangeNotifierProvider<FeastModel>( 1750 return ChangeNotifierProvider<FeastModel>(
@@ -1748,3 +1753,16 @@ var feastDetailPageHandle = new Handler( @@ -1748,3 +1753,16 @@ var feastDetailPageHandle = new Handler(
1748 rid: rid, 1753 rid: rid,
1749 )); 1754 ));
1750 }); 1755 });
  1756 +
  1757 +///宴会----发票详情
  1758 +var feastInvoiceDetailPageHandle = new Handler(
  1759 + handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  1760 + Invoice invoice;
  1761 + if (params.keys.contains('invoice')) {
  1762 + invoice = Invoice.fromJson(json.decode(
  1763 + FluroConvertUtils.fluroCnParamsDecode(params["invoice"].first)));
  1764 + }
  1765 + return ChangeNotifierProvider<FeastModel>(
  1766 + create: (_) => FeastModel(),
  1767 + child: FeastInvoiceDetailPage(invoice: invoice));
  1768 +});
@@ -155,6 +155,9 @@ class Routes { @@ -155,6 +155,9 @@ class Routes {
155 "/feast_qy_menu_show_page"; //宴会-----新建宴会---签约菜单信息 155 "/feast_qy_menu_show_page"; //宴会-----新建宴会---签约菜单信息
156 static String feast_detail_page = "/feast_detail_page"; //宴会-----详情 156 static String feast_detail_page = "/feast_detail_page"; //宴会-----详情
157 157
  158 + static String feast_invoice_detail_page = "/feast_invoice_detail_page"; //宴会-----发票详情
  159 +
  160 +
158 static void configureRoutes(FluroRouter router) { 161 static void configureRoutes(FluroRouter router) {
159 router.notFoundHandler = new Handler( 162 router.notFoundHandler = new Handler(
160 handlerFunc: (BuildContext context, Map<String, List<String>> params) { 163 handlerFunc: (BuildContext context, Map<String, List<String>> params) {
@@ -310,5 +313,9 @@ class Routes { @@ -310,5 +313,9 @@ class Routes {
310 router.define(feast_qy_menu_show_page, handler: feastQYMenuPageHandle); 313 router.define(feast_qy_menu_show_page, handler: feastQYMenuPageHandle);
311 314
312 router.define(feast_detail_page, handler: feastDetailPageHandle); 315 router.define(feast_detail_page, handler: feastDetailPageHandle);
  316 +router.define(feast_invoice_detail_page, handler: feastInvoiceDetailPageHandle);
  317 +
  318 +
  319 +
313 } 320 }
314 } 321 }
1 -class ConvertNumberToChineseMoneyWords{ 1 +class ConvertNumberToChineseMoneyWords {
2 // 大写数字 2 // 大写数字
3 - static List<String> NUMBERS = ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十",""];  
4 - 3 + static List<String> NUMBERS = [
  4 + "一",
  5 + "二",
  6 + "三",
  7 + "四",
  8 + "五",
  9 + "六",
  10 + "七",
  11 + "八",
  12 + "九",
  13 + "十",
  14 + ""
  15 + ];
  16 +
5 static String toChinese(int index) { 17 static String toChinese(int index) {
6 - if(index > 100){ 18 + if (index > 100) {
7 return index.toString(); 19 return index.toString();
8 } 20 }
9 StringBuffer stringBuffer = StringBuffer(); 21 StringBuffer stringBuffer = StringBuffer();
10 - if(index / 10 < 1){ 22 + if (index / 10 < 1) {
11 return NUMBERS[index]; 23 return NUMBERS[index];
12 } 24 }
13 int tenUnit = (index / 10).toInt(); 25 int tenUnit = (index / 10).toInt();
14 int remainder = index % 10; 26 int remainder = index % 10;
15 - if(remainder == 9){ 27 + if (remainder == 9) {
16 tenUnit++; 28 tenUnit++;
17 remainder = 10; 29 remainder = 10;
18 } 30 }
19 - if(tenUnit == 1){  
20 - stringBuffer..write("十")..write(NUMBERS[remainder]); 31 + if (tenUnit == 1) {
  32 + stringBuffer
  33 + ..write("十")
  34 + ..write(NUMBERS[remainder]);
21 return stringBuffer.toString(); 35 return stringBuffer.toString();
22 } 36 }
23 - stringBuffer..write(NUMBERS[tenUnit - 1])..write("十")..write(NUMBERS[remainder]); 37 + stringBuffer
  38 + ..write(NUMBERS[tenUnit - 1])
  39 + ..write("十")
  40 + ..write(NUMBERS[remainder]);
24 return stringBuffer.toString(); 41 return stringBuffer.toString();
25 } 42 }
  43 +
  44 + static int toInt(String index) {
  45 + switch (index) {
  46 + case '一':
  47 + return 0;
  48 + break;
  49 + case '二':
  50 + return 1;
  51 + break;
  52 + case '三':
  53 + return 2;
  54 + break;
  55 + case '四':
  56 + return 3;
  57 + break;
  58 + case '五':
  59 + return 4;
  60 + break;
  61 + case '六':
  62 + return 5;
  63 + break;
  64 + case '七':
  65 + return 6;
  66 + break;
  67 + case '八':
  68 + return 7;
  69 + break;
  70 + case '九':
  71 + return 8;
  72 + break;
  73 + case '十':
  74 + return 9;
  75 + break;
  76 + case '十一':
  77 + return 10;
  78 + break;
  79 + default:
  80 + }
  81 + }
26 } 82 }