Commit 9a1fc06fc9904a088b54c55eb52c9436f8191a6d

Authored by wdn127929
1 parent 7560b5b7

签约部分

  1 +class GetBanquetByIdModel {
  2 + int ret;
  3 + GetBanquetByIdSunModel data;
  4 + String msg;
  5 +
  6 + GetBanquetByIdModel({this.ret, this.data, this.msg});
  7 +
  8 + GetBanquetByIdModel.fromJson(Map<String, dynamic> json) {
  9 + ret = json['ret'];
  10 + data = json['data'] != null
  11 + ? new GetBanquetByIdSunModel.fromJson(json['data'])
  12 + : null;
  13 + msg = json['msg'];
  14 + }
  15 +
  16 + Map<String, dynamic> toJson() {
  17 + final Map<String, dynamic> data = new Map<String, dynamic>();
  18 + data['ret'] = this.ret;
  19 + if (this.data != null) {
  20 + data['data'] = this.data.toJson();
  21 + }
  22 + data['msg'] = this.msg;
  23 + return data;
  24 + }
  25 +}
  26 +
  27 +class GetBanquetByIdSunModel {
  28 + BasicInfo basicInfo;
  29 + List<SessionsInfo> sessionsInfo;
  30 + ContractInfo contractInfo;
  31 + String invoice;
  32 +
  33 + GetBanquetByIdSunModel(
  34 + {this.basicInfo, this.sessionsInfo, this.contractInfo, this.invoice});
  35 +
  36 + GetBanquetByIdSunModel.fromJson(Map<String, dynamic> json) {
  37 + basicInfo = json['basic_info'] != null
  38 + ? new BasicInfo.fromJson(json['basic_info'])
  39 + : null;
  40 + if (json['sessions_info'] != null) {
  41 + sessionsInfo = <SessionsInfo>[];
  42 + json['sessions_info'].forEach((v) {
  43 + sessionsInfo.add(new SessionsInfo.fromJson(v));
  44 + });
  45 + }
  46 +
  47 + contractInfo = json['contract_info'] != null
  48 + ? new ContractInfo.fromJson(json['contract_info'])
  49 + : null;
  50 + invoice = json['invoice'];
  51 + }
  52 +
  53 + Map<String, dynamic> toJson() {
  54 + final Map<String, dynamic> data = new Map<String, dynamic>();
  55 + if (this.basicInfo != null) {
  56 + data['basic_info'] = this.basicInfo.toJson();
  57 + }
  58 + if (this.sessionsInfo != null) {
  59 + data['sessions_info'] = this.sessionsInfo.map((v) => v.toJson()).toList();
  60 + }
  61 +
  62 + if (this.contractInfo != null) {
  63 + data['contract_info'] = this.contractInfo.toJson();
  64 + }
  65 + data['invoice'] = this.invoice;
  66 + return data;
  67 + }
  68 +}
  69 +
  70 +class BasicInfo {
  71 + String ddate;
  72 + String rname;
  73 + String sex;
  74 + String phone;
  75 + String remark;
  76 + Jiedan jiedan;
  77 + Jiedan staff;
  78 + String classify;
  79 +
  80 + BasicInfo(
  81 + {this.ddate,
  82 + this.rname,
  83 + this.sex,
  84 + this.phone,
  85 + this.remark,
  86 + this.jiedan,
  87 + this.staff,
  88 + this.classify});
  89 +
  90 + BasicInfo.fromJson(Map<String, dynamic> json) {
  91 + ddate = json['ddate'];
  92 + rname = json['rname'];
  93 + sex = json['sex'];
  94 + phone = json['phone'];
  95 + remark = json['remark'];
  96 + jiedan =
  97 + json['jiedan'] != null ? new Jiedan.fromJson(json['jiedan']) : null;
  98 + staff = json['staff'] != null ? new Jiedan.fromJson(json['staff']) : null;
  99 + classify = json['classify'];
  100 + }
  101 +
  102 + Map<String, dynamic> toJson() {
  103 + final Map<String, dynamic> data = new Map<String, dynamic>();
  104 + data['ddate'] = this.ddate;
  105 + data['rname'] = this.rname;
  106 + data['sex'] = this.sex;
  107 + data['phone'] = this.phone;
  108 + data['remark'] = this.remark;
  109 + if (this.jiedan != null) {
  110 + data['jiedan'] = this.jiedan.toJson();
  111 + }
  112 + if (this.staff != null) {
  113 + data['staff'] = this.staff.toJson();
  114 + }
  115 + data['classify'] = this.classify;
  116 + return data;
  117 + }
  118 +}
  119 +
  120 +class Jiedan {
  121 + String nickName;
  122 + String account;
  123 +
  124 + Jiedan({this.nickName, this.account});
  125 +
  126 + Jiedan.fromJson(Map<String, dynamic> json) {
  127 + nickName = json['nick_name'];
  128 + account = json['account'];
  129 + }
  130 +
  131 + Map<String, dynamic> toJson() {
  132 + final Map<String, dynamic> data = new Map<String, dynamic>();
  133 + data['nick_name'] = this.nickName;
  134 + data['account'] = this.account;
  135 + return data;
  136 + }
  137 +}
  138 +
  139 +class SessionsInfo {
  140 + String id;
  141 + String rid;
  142 + String reserveOrder;
  143 + String ddateInterval;
  144 + String rdate;
  145 + String tids;
  146 + String setmeal;
  147 + String wine;
  148 + String other;
  149 + dynamic remark;
  150 + String images;
  151 + dynamic serviceType;
  152 + dynamic servicePer;
  153 + dynamic servicePrice;
  154 + dynamic discountType;
  155 + dynamic discountPer;
  156 + dynamic discountPrice;
  157 +
  158 + SessionsInfo(
  159 + {this.id,
  160 + this.rid,
  161 + this.reserveOrder,
  162 + this.ddateInterval,
  163 + this.rdate,
  164 + this.tids,
  165 + this.setmeal,
  166 + this.wine,
  167 + this.other,
  168 + this.remark,
  169 + this.images,
  170 + this.serviceType,
  171 + this.servicePer,
  172 + this.servicePrice,
  173 + this.discountType,
  174 + this.discountPer,
  175 + this.discountPrice});
  176 +
  177 + SessionsInfo.fromJson(Map<String, dynamic> json) {
  178 + id = json['id'];
  179 + rid = json['rid'];
  180 + reserveOrder = json['reserve_order'];
  181 + ddateInterval = json['ddate_interval'];
  182 + rdate = json['rdate'];
  183 + tids = json['tids'];
  184 + setmeal = json['setmeal'];
  185 + wine = json['wine'];
  186 + other = json['other'];
  187 + remark = json['remark'];
  188 + images = json['images'];
  189 + serviceType = json['service_type'];
  190 + servicePer = json['service_per'];
  191 + servicePrice = json['service_price'];
  192 + discountType = json['discount_type'];
  193 + discountPer = json['discount_per'];
  194 + discountPrice = json['discount_price'];
  195 + }
  196 +
  197 + Map<String, dynamic> toJson() {
  198 + final Map<String, dynamic> data = new Map<String, dynamic>();
  199 + data['id'] = this.id;
  200 + data['rid'] = this.rid;
  201 + data['reserve_order'] = this.reserveOrder;
  202 + data['ddate_interval'] = this.ddateInterval;
  203 + data['rdate'] = this.rdate;
  204 + data['tids'] = this.tids;
  205 + data['setmeal'] = this.setmeal;
  206 + data['wine'] = this.wine;
  207 + data['other'] = this.other;
  208 + data['remark'] = this.remark;
  209 + data['images'] = this.images;
  210 + data['service_type'] = this.serviceType;
  211 + data['service_per'] = this.servicePer;
  212 + data['service_price'] = this.servicePrice;
  213 + data['discount_type'] = this.discountType;
  214 + data['discount_per'] = this.discountPer;
  215 + data['discount_price'] = this.discountPrice;
  216 + return data;
  217 + }
  218 +}
  219 +
  220 +class CostInfoModel {
  221 + String title;
  222 + CostInfoSunModel costInfoSunModel;
  223 + //服务费
  224 +// 优惠金额
  225 +}
  226 +
  227 +class CostInfoSunModel {
  228 + String cname;
  229 + String unitPrice;
  230 + String numStr;
  231 + int price;
  232 +
  233 + CostInfoSunModel({this.cname, this.unitPrice, this.numStr, this.price});
  234 +
  235 + CostInfoSunModel.fromJson(Map<String, dynamic> json) {
  236 + cname = json['cname'];
  237 + unitPrice = json['unit_price'];
  238 + numStr = json['num'];
  239 + price = json['price'];
  240 + }
  241 +
  242 + Map<String, dynamic> toJson() {
  243 + final Map<String, dynamic> data = new Map<String, dynamic>();
  244 + data['cname'] = this.cname;
  245 + data['unit_price'] = this.unitPrice;
  246 + data['num'] = this.numStr;
  247 + data['price'] = this.price;
  248 + return data;
  249 + }
  250 +}
  251 +
  252 +class ContractInfo {
  253 + String contractTotalPrice;
  254 + String contractFinalPrice;
  255 + String contractRname;
  256 + String contractSellerName;
  257 + String contractNo;
  258 + String contractImages;
  259 +
  260 + ContractInfo(
  261 + {this.contractTotalPrice,
  262 + this.contractFinalPrice,
  263 + this.contractRname,
  264 + this.contractSellerName,
  265 + this.contractNo,
  266 + this.contractImages});
  267 +
  268 + ContractInfo.fromJson(Map<String, dynamic> json) {
  269 + contractTotalPrice = json['contract_total_price'];
  270 + contractFinalPrice = json['contract_final_price'];
  271 + contractRname = json['contract_rname'];
  272 + contractSellerName = json['contract_seller_name'];
  273 + contractNo = json['contract_no'];
  274 + contractImages = json['contract_images'];
  275 + }
  276 +
  277 + Map<String, dynamic> toJson() {
  278 + final Map<String, dynamic> data = new Map<String, dynamic>();
  279 + data['contract_total_price'] = this.contractTotalPrice;
  280 + data['contract_final_price'] = this.contractFinalPrice;
  281 + data['contract_rname'] = this.contractRname;
  282 + data['contract_seller_name'] = this.contractSellerName;
  283 + data['contract_no'] = this.contractNo;
  284 + data['contract_images'] = this.contractImages;
  285 + return data;
  286 + }
  287 +}
  1 +import 'package:common_utils/common_utils.dart';
  2 +
  3 +class GetBanquetDepositModel {
  4 + int ret;
  5 + List<GetBanquetDepositSunModel> data;
  6 + String msg;
  7 +
  8 + GetBanquetDepositModel({this.ret, this.data, this.msg});
  9 +
  10 + GetBanquetDepositModel.fromJson(Map<String, dynamic> json) {
  11 + ret = json['ret'];
  12 + if (json['data'] != null) {
  13 + data = <GetBanquetDepositSunModel>[];
  14 + json['data'].forEach((v) {
  15 + data.add(new GetBanquetDepositSunModel.fromJson(v));
  16 + });
  17 + }
  18 + msg = json['msg'];
  19 + }
  20 +
  21 + Map<String, dynamic> toJson() {
  22 + final Map<String, dynamic> data = new Map<String, dynamic>();
  23 + data['ret'] = this.ret;
  24 + if (this.data != null) {
  25 + data['data'] = this.data.map((v) => v.toJson()).toList();
  26 + }
  27 + data['msg'] = this.msg;
  28 + return data;
  29 + }
  30 +}
  31 +
  32 +class GetBanquetDepositSunModel {
  33 + String id;
  34 + String sid;
  35 + String rid;
  36 + String price;
  37 + String rname;
  38 + String collectionUid;
  39 + String rtime;
  40 + String pay;
  41 + String depositId;
  42 + String no;
  43 + String nickName;
  44 + String dname;
  45 +
  46 + String get ddateStr {
  47 + if (rtime.toString() == '0') {
  48 + return '';
  49 + }
  50 + DateTime dateTime =
  51 + DateTime.fromMillisecondsSinceEpoch(int.parse(rtime.toString()) * 1000);
  52 + return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
  53 + }
  54 +
  55 + GetBanquetDepositSunModel(
  56 + {this.id,
  57 + this.sid,
  58 + this.rid,
  59 + this.price,
  60 + this.rname,
  61 + this.collectionUid,
  62 + this.rtime,
  63 + this.pay,
  64 + this.depositId,
  65 + this.no,
  66 + this.nickName,
  67 + this.dname});
  68 +
  69 + GetBanquetDepositSunModel.fromJson(Map<String, dynamic> json) {
  70 + id = json['id'];
  71 + sid = json['sid'];
  72 + rid = json['rid'];
  73 + price = json['price'];
  74 + rname = json['rname'];
  75 + collectionUid = json['collection_uid'];
  76 + rtime = json['rtime'];
  77 + pay = json['pay'];
  78 + depositId = json['deposit_id'];
  79 + no = json['no'];
  80 + nickName = json['nick_name'];
  81 + dname = json['dname'];
  82 + }
  83 +
  84 + Map<String, dynamic> toJson() {
  85 + final Map<String, dynamic> data = new Map<String, dynamic>();
  86 + data['id'] = this.id;
  87 + data['sid'] = this.sid;
  88 + data['rid'] = this.rid;
  89 + data['price'] = this.price;
  90 + data['rname'] = this.rname;
  91 + data['collection_uid'] = this.collectionUid;
  92 + data['rtime'] = this.rtime;
  93 + data['pay'] = this.pay;
  94 + data['deposit_id'] = this.depositId;
  95 + data['no'] = this.no;
  96 + data['nick_name'] = this.nickName;
  97 + data['dname'] = this.dname;
  98 + return data;
  99 + }
  100 +}
@@ -296,5 +296,17 @@ class HttpUrl { @@ -296,5 +296,17 @@ class HttpUrl {
296 "?service=App.Banquet.SetBanquetInfo"; //设置选台信息 296 "?service=App.Banquet.SetBanquetInfo"; //设置选台信息
297 static const String set_banquet_info_cook = 297 static const String set_banquet_info_cook =
298 "?service=App.Banquet.SetBanquetInfoCook"; //调菜 298 "?service=App.Banquet.SetBanquetInfoCook"; //调菜
  299 + static const String set_banquet_deposit =
  300 + "?service=App.Banquet.SetBanquetDeposit"; //添加定金
  301 + static const String get_banquet_deposit =
  302 + "?service=App.Banquet.GetBanquetDeposit"; //获取宴会定金
  303 + static const String del_banquet_deposit =
  304 + "?service=App.Banquet.DelBanquetDeposit"; //删除宴会定金
  305 + static const String set_warrant =
  306 + "?service=App.Banquet.SetWarrant"; //设置担保人
  307 + static const String get_banquet_by_id =
  308 + "?service=App.Banquet.GetBanquetById"; //获取宴会详情
  309 +
  310 +
299 311
300 } 312 }
@@ -7,12 +7,14 @@ import 'package:flutter/gestures.dart'; @@ -7,12 +7,14 @@ import 'package:flutter/gestures.dart';
7 import 'package:flutter/material.dart'; 7 import 'package:flutter/material.dart';
8 import 'package:flutter_screenutil/flutter_screenutil.dart'; 8 import 'package:flutter_screenutil/flutter_screenutil.dart';
9 import 'package:one_key/models/cookbook_one_model.dart'; 9 import 'package:one_key/models/cookbook_one_model.dart';
  10 +import 'package:one_key/models/get_banquet_deposit_model.dart';
10 import 'package:one_key/route/navigator_util.dart'; 11 import 'package:one_key/route/navigator_util.dart';
11 import 'package:one_key/widgets/MyDivider.dart'; 12 import 'package:one_key/widgets/MyDivider.dart';
12 import 'package:one_key/widgets/round_button.dart'; 13 import 'package:one_key/widgets/round_button.dart';
13 import 'package:one_key/widgets/v_empty_view.dart'; 14 import 'package:one_key/widgets/v_empty_view.dart';
14 import 'package:provider/provider.dart'; 15 import 'package:provider/provider.dart';
15 16
  17 +import '../../constant/state.dart';
16 import '../../models/dsolt_xt.dart'; 18 import '../../models/dsolt_xt.dart';
17 import '../../models/feast_menu_model.dart'; 19 import '../../models/feast_menu_model.dart';
18 import '../../models/set_xuan_tai_model.dart'; 20 import '../../models/set_xuan_tai_model.dart';
@@ -24,10 +26,12 @@ import '../../provider/user_model.dart'; @@ -24,10 +26,12 @@ import '../../provider/user_model.dart';
24 import '../../res/colors.dart'; 26 import '../../res/colors.dart';
25 import '../../utils/ConvertNumberToChineseMoneyWords.dart'; 27 import '../../utils/ConvertNumberToChineseMoneyWords.dart';
26 import '../../utils/dialog_util.dart'; 28 import '../../utils/dialog_util.dart';
  29 +import '../../utils/event_bus.dart';
27 import '../../utils/screen_util.dart'; 30 import '../../utils/screen_util.dart';
28 import '../../utils/upload_image_util.dart'; 31 import '../../utils/upload_image_util.dart';
29 import '../../utils/utils.dart'; 32 import '../../utils/utils.dart';
30 import '../../widgets/h_empty_view.dart'; 33 import '../../widgets/h_empty_view.dart';
  34 +import '../../widgets/page_exception.dart';
31 import '../../widgets/set_time_widget.dart'; 35 import '../../widgets/set_time_widget.dart';
32 import '../../widgets/system_app_bar.dart'; 36 import '../../widgets/system_app_bar.dart';
33 import '../online_check/img_picker_widget_f.dart'; 37 import '../online_check/img_picker_widget_f.dart';
@@ -71,6 +75,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -71,6 +75,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
71 75
72 ScrollController controller = ScrollController(); 76 ScrollController controller = ScrollController();
73 String djDBR = '请选择'; //定金担保人 77 String djDBR = '请选择'; //定金担保人
  78 + int djDBRIndex; //定金担保人
74 UploadImageProvider _uploadImageProvider; 79 UploadImageProvider _uploadImageProvider;
75 List<SetXuanTaiModel> xuantaiData = []; 80 List<SetXuanTaiModel> xuantaiData = [];
76 int xuantaiSelIndex = 0; 81 int xuantaiSelIndex = 0;
@@ -95,11 +100,15 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -95,11 +100,15 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
95 _getSetmeal(); 100 _getSetmeal();
96 // scrollController.jumpTo(scrollController.position.minScrollExtent); 101 // scrollController.jumpTo(scrollController.position.minScrollExtent);
97 }); 102 });
  103 + bus.on("feast_deposit_list", (arg) {
  104 + _getBanquetDeposit();
  105 + });
98 } 106 }
99 107
100 @override 108 @override
101 void dispose() { 109 void dispose() {
102 super.dispose(); 110 super.dispose();
  111 + bus.off('feast_deposit_list');
103 feastModel.rid = null; 112 feastModel.rid = null;
104 feastModel.type = null; 113 feastModel.type = null;
105 feastModel.reserve = null; 114 feastModel.reserve = null;
@@ -167,11 +176,37 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -167,11 +176,37 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
167 await feastModel.getStaff(context); 176 await feastModel.getStaff(context);
168 } 177 }
169 178
  179 +///获取宴会详情
  180 + _getBanquetById() async {
  181 + Map<String, String> pramas = {'rid': '64'};//feastModel.rid
  182 + await feastModel.getBanquetById(context, pramas);
  183 + }
  184 +
170 ///获取宴会分类 185 ///获取宴会分类
171 Future<bool> _getClassify({bool isShowLoading = true}) async { 186 Future<bool> _getClassify({bool isShowLoading = true}) async {
172 await feastModel.getClassify(context, isShowLoading: isShowLoading); 187 await feastModel.getClassify(context, isShowLoading: isShowLoading);
173 } 188 }
174 189
  190 + ///获取宴会定金
  191 + Future<bool> _getBanquetDeposit({bool isShowLoading = true}) async {
  192 + Map<String, String> pramas = {'rid': feastModel.rid};
  193 + await feastModel.getBanquetDeposit(context, pramas,
  194 + isShowLoading: isShowLoading);
  195 + feastModel.notifyListeners();
  196 + }
  197 +
  198 + ///删除宴会定金
  199 + Future<bool> _delBanquetDeposit(String id,
  200 + {bool isShowLoading = true}) async {
  201 + Map<String, String> pramas = {'id': id};
  202 + bool success = await feastModel.delBanquetDeposit(context, pramas,
  203 + isShowLoading: isShowLoading);
  204 + if (success) {
  205 + _getBanquetDeposit();
  206 + feastModel.notifyListeners();
  207 + }
  208 + }
  209 +
175 // ///获取宴会套餐 210 // ///获取宴会套餐
176 // Future<bool> _getSetmeal({bool isShowLoading = true}) async { 211 // Future<bool> _getSetmeal({bool isShowLoading = true}) async {
177 // bool success = 212 // bool success =
@@ -261,11 +296,16 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -261,11 +296,16 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
261 Widget menuBtn(String title, {GestureTapCallback onTap}) { 296 Widget menuBtn(String title, {GestureTapCallback onTap}) {
262 return InkWell( 297 return InkWell(
263 onTap: () { 298 onTap: () {
264 - if (menuSet.contains(title)) {  
265 - setState(() {  
266 - selectMenu = title;  
267 - }); 299 + // if (menuSet.contains(title)) {
  300 + setState(() {
  301 + selectMenu = title;
  302 + });
  303 + if (title == '签约') {
  304 + feastModel.pageStateBanquet = PageState.Loading;
  305 + feastModel.notifyListeners();
  306 + _getBanquetById();
268 } 307 }
  308 + // }
269 }, 309 },
270 child: Container( 310 child: Container(
271 width: w(40), 311 width: w(40),
@@ -1170,7 +1210,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -1170,7 +1210,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
1170 xuantaiData.removeAt(xuantaiSelIndex); 1210 xuantaiData.removeAt(xuantaiSelIndex);
1171 1211
1172 xuantaiSelIndex--; //删除后,选中前一个 1212 xuantaiSelIndex--; //删除后,选中前一个
1173 - 1213 +
1174 setState(() {}); 1214 setState(() {});
1175 })) 1215 }))
1176 : SizedBox(), 1216 : SizedBox(),
@@ -2086,6 +2126,42 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -2086,6 +2126,42 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
2086 ); 2126 );
2087 } 2127 }
2088 2128
  2129 + /// 选台保存接口
  2130 + Future<bool> dbSave() async {
  2131 + if (djDBRIndex == null) {
  2132 + Utils.showToast('请选择担保人');
  2133 + return false;
  2134 + }
  2135 +
  2136 + for (UploadImgModel item in _uploadImageProvider.feastRemarkDjImageList) {
  2137 + if (item.process < 1) {
  2138 + Utils.showToast('正在上传图片,请稍等');
  2139 + return false;
  2140 + }
  2141 + }
  2142 +
  2143 + List imageQiniuUrlList = []; //接口图片数据list
  2144 + for (int i = 0;
  2145 + i < _uploadImageProvider.feastRemarkDjImageList.length;
  2146 + i++) {
  2147 + imageQiniuUrlList.add(
  2148 + {"url": _uploadImageProvider.feastRemarkDjImageList[i].qiniuUrl});
  2149 + }
  2150 + Map<String, String> pramas = {
  2151 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  2152 + 'rid': feastModel.rid,
  2153 + 'warrant_id': feastModel.sellerManageList[djDBRIndex].id,
  2154 + 'warrant_images': json.encode(imageQiniuUrlList),
  2155 + 'warrant_desc': customCdb.text
  2156 + };
  2157 + bool success = await feastModel.setWarrant(context, pramas);
  2158 + if (success) {
  2159 + return true;
  2160 + } else {
  2161 + return false;
  2162 + }
  2163 + }
  2164 +
2089 ///定金页面 2165 ///定金页面
2090 Widget djWidget() { 2166 Widget djWidget() {
2091 return Column( 2167 return Column(
@@ -2122,99 +2198,111 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -2122,99 +2198,111 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
2122 gradientStart: MyColours.color_438E93, 2198 gradientStart: MyColours.color_438E93,
2123 gradientEnd: MyColours.color_438E93, 2199 gradientEnd: MyColours.color_438E93,
2124 onPressed: () { 2200 onPressed: () {
2125 - NavigatorUtil.goFeastDepositPage(context); 2201 + NavigatorUtil.goFeastDepositPage(context, feastModel.rid);
2126 }, 2202 },
2127 ), 2203 ),
2128 ], 2204 ],
2129 )), 2205 )),
2130 ListView.builder( 2206 ListView.builder(
2131 padding: EdgeInsets.only(left: w(13), right: w(13), top: h(20)), 2207 padding: EdgeInsets.only(left: w(13), right: w(13), top: h(20)),
2132 - itemCount: 2, 2208 + itemCount: feastModel.banquetDepositData.length,
2133 shrinkWrap: true, 2209 shrinkWrap: true,
2134 controller: controller, 2210 controller: controller,
2135 itemBuilder: (BuildContext context, int index) { 2211 itemBuilder: (BuildContext context, int index) {
2136 - return Container(  
2137 - height: h(110),  
2138 - margin: EdgeInsets.only(bottom: h(20)),  
2139 - decoration: BoxDecoration(  
2140 - borderRadius: BorderRadius.circular(r(5)),  
2141 - border: Border.all(  
2142 - width: h(1), color: MyColours.color_438E93)),  
2143 - child: Column(children: [  
2144 - Container(  
2145 - height: h(24),  
2146 - padding: EdgeInsets.only(left: w(16), right: w(8)), 2212 + GetBanquetDepositSunModel data =
  2213 + feastModel.banquetDepositData[index];
  2214 + return InkWell(
  2215 + onTap: () {
  2216 + NavigatorUtil.goFeastDepositPage(context, feastModel.rid,
  2217 + isNew: false, getBanquetDepositSunModel: data);
  2218 + },
  2219 + child: Container(
  2220 + height: h(110),
  2221 + margin: EdgeInsets.only(bottom: h(20)),
2147 decoration: BoxDecoration( 2222 decoration: BoxDecoration(
2148 - color: MyColours.color_438E93,  
2149 - borderRadius: BorderRadius.only(  
2150 - topLeft: Radius.circular(r(4)),  
2151 - topRight: Radius.circular(r(4))), 2223 + borderRadius: BorderRadius.circular(r(5)),
2152 border: Border.all( 2224 border: Border.all(
2153 width: h(1), color: MyColours.color_438E93)), 2225 width: h(1), color: MyColours.color_438E93)),
2154 - child: Row(  
2155 - mainAxisAlignment: MainAxisAlignment.spaceBetween,  
2156 - children: [  
2157 - Text(  
2158 - '定金1',  
2159 - overflow: TextOverflow.ellipsis,  
2160 - style: TextStyle(  
2161 - color: MyColours.color_F6F6F6,  
2162 - fontSize: font(14)),  
2163 - ),  
2164 - Text(  
2165 - '收据编号 SJ000001',  
2166 - overflow: TextOverflow.ellipsis,  
2167 - style: TextStyle(  
2168 - color: MyColours.color_F6F6F6,  
2169 - fontSize: font(12)), 2226 + child: Column(children: [
  2227 + Container(
  2228 + height: h(24),
  2229 + padding: EdgeInsets.only(left: w(16), right: w(8)),
  2230 + decoration: BoxDecoration(
  2231 + color: MyColours.color_438E93,
  2232 + borderRadius: BorderRadius.only(
  2233 + topLeft: Radius.circular(r(4)),
  2234 + topRight: Radius.circular(r(4))),
  2235 + border: Border.all(
  2236 + width: h(1),
  2237 + color: MyColours.color_438E93)),
  2238 + child: Row(
  2239 + mainAxisAlignment: MainAxisAlignment.spaceBetween,
  2240 + children: [
  2241 + Text(
  2242 + '定金${index + 1}',
  2243 + overflow: TextOverflow.ellipsis,
  2244 + style: TextStyle(
  2245 + color: MyColours.color_F6F6F6,
  2246 + fontSize: font(14)),
  2247 + ),
  2248 + Text(
  2249 + '收据编号 ${data.no == '0' ? '' : data.no}',
  2250 + overflow: TextOverflow.ellipsis,
  2251 + style: TextStyle(
  2252 + color: MyColours.color_F6F6F6,
  2253 + fontSize: font(12)),
  2254 + ),
  2255 + InkWell(
  2256 + onTap: () {
  2257 + //弹框确认是否删除
  2258 + DialogUtil.cupertinoAlertDialog(context,
  2259 + title: "",
  2260 + content: "是否确定删除?",
  2261 + isBoldContent: true,
  2262 + contentColor:
  2263 + MyColours.color_E6000000,
  2264 + rTitle: "删除", rCallback: () {
  2265 + _delBanquetDeposit(data.id);
  2266 + });
  2267 + },
  2268 + child: Image.asset(
  2269 + Utils.getImgPath('f_dj_delete'),
  2270 + width: w(20),
  2271 + ))
  2272 + ],
2170 ), 2273 ),
2171 - InkWell(  
2172 - onTap: () {  
2173 - //弹框确认是否删除  
2174 - DialogUtil.cupertinoAlertDialog(context,  
2175 - title: "",  
2176 - content: "是否确定删除?",  
2177 - isBoldContent: true,  
2178 - contentColor: MyColours.color_E6000000,  
2179 - rTitle: "删除", rCallback: () {  
2180 - Navigator.pop(context);  
2181 - // _delGuestInfocDay(model.cday[index].id);  
2182 - });  
2183 - },  
2184 - child: Image.asset(  
2185 - Utils.getImgPath('f_dj_delete'),  
2186 - width: w(20),  
2187 - ))  
2188 - ],  
2189 - ),  
2190 - ),  
2191 - Expanded(  
2192 - child: Row(  
2193 - mainAxisAlignment: MainAxisAlignment.start,  
2194 - children: [  
2195 - HEmptyView(32),  
2196 - Column(  
2197 - crossAxisAlignment: CrossAxisAlignment.start,  
2198 - mainAxisAlignment: MainAxisAlignment.spaceEvenly,  
2199 - children: [  
2200 - djTextType1('定金金额 ', '200', ' 元'),  
2201 - djText('支付方式 ', '现金'),  
2202 - djText('定金类型 ', '宴会定金')  
2203 - ],  
2204 ), 2274 ),
2205 - HEmptyView(140),  
2206 - Column(  
2207 - crossAxisAlignment: CrossAxisAlignment.start,  
2208 - mainAxisAlignment: MainAxisAlignment.spaceEvenly, 2275 + Expanded(
  2276 + child: Row(
  2277 + mainAxisAlignment: MainAxisAlignment.start,
2209 children: [ 2278 children: [
2210 - djText('付款时间 ', '2022-08-03'),  
2211 - djText('收款人 ', '刘经理'),  
2212 - djText('付款人 ', '方先生') 2279 + HEmptyView(32),
  2280 + Column(
  2281 + crossAxisAlignment: CrossAxisAlignment.start,
  2282 + mainAxisAlignment:
  2283 + MainAxisAlignment.spaceEvenly,
  2284 + children: [
  2285 + djTextType1('定金金额 ', '${data.price}', ' 元'),
  2286 + djText('支付方式 ', '${data.pay}'),
  2287 + djText('定金类型 ',
  2288 + '${data.dname == null ? '' : data.dname}')
  2289 + ],
  2290 + ),
  2291 + HEmptyView(140),
  2292 + Column(
  2293 + crossAxisAlignment: CrossAxisAlignment.start,
  2294 + mainAxisAlignment:
  2295 + MainAxisAlignment.spaceEvenly,
  2296 + children: [
  2297 + djText('付款时间 ', '${data.ddateStr}'),
  2298 + djText('收款人 ',
  2299 + '${data.nickName == null ? '' : data.nickName}'),
  2300 + djText('付款人 ', '${data.rname}')
  2301 + ],
  2302 + )
2213 ], 2303 ],
2214 - )  
2215 - ],  
2216 - ))  
2217 - ])); 2304 + ))
  2305 + ])));
2218 }), 2306 }),
2219 VEmptyView(62), 2307 VEmptyView(62),
2220 Padding( 2308 Padding(
@@ -2237,29 +2325,19 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -2237,29 +2325,19 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
2237 InkWell( 2325 InkWell(
2238 onTap: () { 2326 onTap: () {
2239 FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 2327 FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
2240 - // DialogUtil.showSelectCusmanDialog(  
2241 - // context,  
2242 - // customerProvider.labelList.map((item) {  
2243 - // return item.label;  
2244 - // }).toList(), (value) {  
2245 - // if (value != null) {  
2246 - // setState(() {  
2247 - // customerProvider.labelSelIndex =  
2248 - // value.first;  
2249 - // labelShow = customerProvider  
2250 - // .labelList[  
2251 - // customerProvider.labelSelIndex]  
2252 - // .label;  
2253 - // });  
2254 - // }  
2255 - // },  
2256 - // selecteds:  
2257 - // customerProvider.labelSelIndex == null  
2258 - // ? []  
2259 - // : [  
2260 - // customerProvider.labelSelIndex  
2261 - // ])  
2262 - // .then((value) {}); 2328 + DialogUtil.showSelectCusmanDialog(
  2329 + context,
  2330 + feastModel.sellerManageList.map((item) {
  2331 + return item.title;
  2332 + }).toList(), (value) {
  2333 + if (value != null) {
  2334 + setState(() {
  2335 + djDBRIndex = value.first;
  2336 + djDBR = feastModel.sellerManageList[djDBRIndex].title;
  2337 + });
  2338 + }
  2339 + }, selecteds: djDBRIndex == null ? [] : [djDBRIndex])
  2340 + .then((value) {});
2263 }, 2341 },
2264 child: Row( 2342 child: Row(
2265 mainAxisAlignment: MainAxisAlignment.spaceBetween, 2343 mainAxisAlignment: MainAxisAlignment.spaceBetween,
@@ -2340,18 +2418,25 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -2340,18 +2418,25 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
2340 children: [ 2418 children: [
2341 Expanded( 2419 Expanded(
2342 child: _callButton( 2420 child: _callButton(
2343 - onPress: () {}, 2421 + onPress: () async {
  2422 + await dbSave();
  2423 + },
2344 content: '仅保存', 2424 content: '仅保存',
2345 hasLeftBorder: true, 2425 hasLeftBorder: true,
2346 isSelect: false)), 2426 isSelect: false)),
2347 Expanded( 2427 Expanded(
2348 child: _callButton( 2428 child: _callButton(
2349 - onPress: () {  
2350 - selectMenu = '签约'; 2429 + onPress: () async {
  2430 + bool success = await dbSave();
  2431 + if (success) {
  2432 + selectMenu = '签约';
2351 2433
2352 - menuSet.add('定金');  
2353 - menuSet.add('签约');  
2354 - setState(() {}); 2434 + menuSet.add('定金');
  2435 + menuSet.add('签约');
  2436 + setState(() {});
  2437 + feastModel.pageStateBanquet = PageState.Loading;
  2438 + _getBanquetById();
  2439 + }
2355 }, 2440 },
2356 content: '保存并下一步', 2441 content: '保存并下一步',
2357 hasLeftBorder: true, 2442 hasLeftBorder: true,
@@ -3402,56 +3487,75 @@ class _FeastCreatePageState extends State<FeastCreatePage> { @@ -3402,56 +3487,75 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
3402 3487
3403 ///签约 3488 ///签约
3404 Widget qyWidget() { 3489 Widget qyWidget() {
3405 - return Column(children: [  
3406 - Expanded(  
3407 - child: SingleChildScrollView(  
3408 - child: Column(children: <Widget>[  
3409 - menu(),  
3410 - MyDivider(double.infinity, h(1), color: MyColours.color_DBDBDB),  
3411 - VEmptyView(26),  
3412 - Padding(  
3413 - padding: EdgeInsets.symmetric(horizontal: w(12)),  
3414 - child: Column(children: [  
3415 - baseInfoWidget(), //基本信息  
3416 - VEmptyView(52),  
3417 - //场次  
3418 - ListView.builder(  
3419 - itemCount: 3,  
3420 - shrinkWrap: true,  
3421 - controller: _scrollController,  
3422 - itemBuilder: (BuildContext context, int index) {  
3423 - return sessionsWidget('第${index + 1}场');  
3424 - }),  
3425 - //费用详情  
3426 - costWidget(),  
3427 - //合同  
3428 - contractWidget(),  
3429 -  
3430 - invoiceWidget()  
3431 - ]))  
3432 - ]))),  
3433 - Row(  
3434 - children: [  
3435 - Expanded(  
3436 - child: _callButton(  
3437 - onPress: () {},  
3438 - content: '分享宴会单',  
3439 - hasLeftBorder: true,  
3440 - isSelect: false)),  
3441 - Expanded(  
3442 - child: _callButton(  
3443 - onPress: () {  
3444 - selectMenu = '签约';  
3445 -  
3446 - menuSet.add('定金');  
3447 - menuSet.add('签约');  
3448 - setState(() {});  
3449 - },  
3450 - content: '保存',  
3451 - hasLeftBorder: true,  
3452 - isSelect: true))  
3453 - ],  
3454 - ) 3490 + return Column(children: <Widget>[
  3491 + menu(),
  3492 + MyDivider(double.infinity, h(1), color: MyColours.color_DBDBDB),
  3493 + VEmptyView(26),
  3494 + Expanded(child: Consumer<FeastModel>(builder: (context, model, _) {
  3495 + if (model.pageStateBanquet != PageState.Success) {
  3496 + return ExceptionPage(
  3497 + pageState: model.pageStateDeposit,
  3498 + callback: () {
  3499 + _getBanquetById();
  3500 + },
  3501 + emptyMsg: "暂时没有宴会详情哦",
  3502 + emptyImg: "empty_search",
  3503 + showMsg: "加载中,请稍后...",
  3504 + );
  3505 + } else {
  3506 + return Column(
  3507 + children: [
  3508 + Expanded(
  3509 + child:
  3510 + Padding(
  3511 + padding: EdgeInsets.symmetric(horizontal: w(12)),
  3512 + child: SingleChildScrollView(
  3513 + controller: _scrollController,
  3514 + child: Column(children: [
  3515 + baseInfoWidget(), //基本信息
  3516 + VEmptyView(52),
  3517 + //场次
  3518 + ListView.builder(
  3519 + itemCount: 3,
  3520 + shrinkWrap: true,
  3521 + controller: _scrollController,
  3522 + itemBuilder: (BuildContext context, int index) {
  3523 + return sessionsWidget('第${index + 1}场');
  3524 + }),
  3525 + //费用详情
  3526 + costWidget(),
  3527 + //合同
  3528 + contractWidget(),
  3529 +
  3530 + invoiceWidget()
  3531 + ]))),
  3532 + ),
  3533 + Row(
  3534 + children: [
  3535 + Expanded(
  3536 + child: _callButton(
  3537 + onPress: () {},
  3538 + content: '分享宴会单',
  3539 + hasLeftBorder: true,
  3540 + isSelect: false)),
  3541 + Expanded(
  3542 + child: _callButton(
  3543 + onPress: () {
  3544 + selectMenu = '签约';
  3545 +
  3546 + menuSet.add('定金');
  3547 + menuSet.add('签约');
  3548 + setState(() {});
  3549 + },
  3550 + content: '保存',
  3551 + hasLeftBorder: true,
  3552 + isSelect: true))
  3553 + ],
  3554 + )
  3555 + ],
  3556 + );
  3557 + }
  3558 + }))
3455 ]); 3559 ]);
3456 } 3560 }
3457 3561
@@ -3,32 +3,44 @@ import 'package:flutter/gestures.dart'; @@ -3,32 +3,44 @@ import 'package:flutter/gestures.dart';
3 import 'package:flutter/material.dart'; 3 import 'package:flutter/material.dart';
4 import 'package:flutter_picker/Picker.dart'; 4 import 'package:flutter_picker/Picker.dart';
5 import 'package:flutter_screenutil/flutter_screenutil.dart'; 5 import 'package:flutter_screenutil/flutter_screenutil.dart';
  6 +import 'package:one_key/models/filter_btn_model.dart';
  7 +import 'package:one_key/models/get_deposit_model.dart';
  8 +import 'package:one_key/route/route_handles.dart';
6 import 'package:one_key/widgets/v_empty_view.dart'; 9 import 'package:one_key/widgets/v_empty_view.dart';
  10 +import 'package:provider/provider.dart';
7 11
  12 +import '../../models/get_banquet_deposit_model.dart';
  13 +import '../../provider/feast_model.dart';
  14 +import '../../provider/user_model.dart';
8 import '../../res/colors.dart'; 15 import '../../res/colors.dart';
9 import '../../utils/dialog_util.dart'; 16 import '../../utils/dialog_util.dart';
  17 +import '../../utils/event_bus.dart';
10 import '../../utils/screen_util.dart'; 18 import '../../utils/screen_util.dart';
11 import '../../utils/utils.dart'; 19 import '../../utils/utils.dart';
12 import '../../widgets/h_empty_view.dart'; 20 import '../../widgets/h_empty_view.dart';
13 import '../../widgets/system_app_bar.dart'; 21 import '../../widgets/system_app_bar.dart';
  22 +
14 /** 23 /**
15 * 定金 24 * 定金
16 */ 25 */
17 class FeastDepositPage extends StatefulWidget { 26 class FeastDepositPage extends StatefulWidget {
18 - FeastDepositPage({Key key}) : super(key: key); 27 + final String rid;
  28 + final GetBanquetDepositSunModel depositSunModel;
  29 + FeastDepositPage({Key key, this.rid, this.depositSunModel}) : super(key: key);
19 30
20 @override 31 @override
21 _FeastDepositPageState createState() => _FeastDepositPageState(); 32 _FeastDepositPageState createState() => _FeastDepositPageState();
22 } 33 }
23 34
24 class _FeastDepositPageState extends State<FeastDepositPage> { 35 class _FeastDepositPageState extends State<FeastDepositPage> {
25 - String money = '请输入'; //金额  
26 - String paymentP = '请输入'; //付款人  
27 String collectionP = '请选择'; //收款人 36 String collectionP = '请选择'; //收款人
  37 + int collectionPIndex; //收款人
28 String paymentTime = '请选择'; //付款时间 38 String paymentTime = '请选择'; //付款时间
29 String paymentType = '请选择'; //支付方式 39 String paymentType = '请选择'; //支付方式
  40 + List<String> payType = []; //支付方式
  41 + int payTypeIndex; //支付方式
30 String depositType = '请选择'; //定金类型 42 String depositType = '请选择'; //定金类型
31 - String receiptNumber = '请输入'; //收据编号 43 + int depositTypeIndex; //定金类型
32 44
33 TextEditingController moneyC = TextEditingController(); 45 TextEditingController moneyC = TextEditingController();
34 FocusNode moneyF = FocusNode(); 46 FocusNode moneyF = FocusNode();
@@ -39,12 +51,35 @@ class _FeastDepositPageState extends State<FeastDepositPage> { @@ -39,12 +51,35 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
39 bool showDateSelWidget = false; 51 bool showDateSelWidget = false;
40 final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>(); 52 final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
41 53
  54 + FeastModel feastModel;
  55 +
42 @override 56 @override
43 void initState() { 57 void initState() {
44 - // TODO: implement initState  
45 super.initState(); 58 super.initState();
46 59
47 Utils.changeStatusColor(color: MyColours.color_438E93); 60 Utils.changeStatusColor(color: MyColours.color_438E93);
  61 + payType = ['现金', '刷卡', '微信', '支付宝', '转账'];
  62 + if (widget.depositSunModel != null) {
  63 + moneyC.text = widget.depositSunModel.price;
  64 +
  65 + if (widget.depositSunModel.rname != '') {
  66 + paymentC.text = widget.depositSunModel.rname;
  67 + }
  68 +
  69 + if (widget.depositSunModel.pay != '') {
  70 + paymentType = widget.depositSunModel.pay;
  71 + payTypeIndex = payType.indexOf(paymentType);
  72 + }
  73 + if (widget.depositSunModel.ddateStr != '') {
  74 + paymentTime = widget.depositSunModel.ddateStr;
  75 + }
  76 + if (widget.depositSunModel.nickName != null) {
  77 + collectionP = widget.depositSunModel.nickName;
  78 + }
  79 + if (widget.depositSunModel.no != '0') {
  80 + receiptNumberC.text = widget.depositSunModel.no;
  81 + }
  82 + }
48 83
49 moneyF.addListener(() { 84 moneyF.addListener(() {
50 if (moneyF.hasFocus) { 85 if (moneyF.hasFocus) {
@@ -83,7 +118,69 @@ class _FeastDepositPageState extends State<FeastDepositPage> { @@ -83,7 +118,69 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
83 } 118 }
84 }); 119 });
85 120
86 - WidgetsBinding.instance.addPostFrameCallback((_) {}); 121 + WidgetsBinding.instance.addPostFrameCallback((_) {
  122 + _getDeposit();
  123 + _getSellerUserBySellerid();
  124 + });
  125 + }
  126 +
  127 + ///获取定金类型
  128 + Future<bool> _getDeposit({bool isShowLoading = true}) async {
  129 + await feastModel.getDeposit(context, isShowLoading: isShowLoading);
  130 + if (widget.depositSunModel.dname != null) {
  131 + List depositData = feastModel.depositData.map((item) {
  132 + return item.dname;
  133 + }).toList();
  134 + depositType = widget.depositSunModel.dname;
  135 + depositTypeIndex = depositData.indexOf(widget.depositSunModel.dname);
  136 + setState(() {});
  137 + }
  138 + }
  139 +
  140 + ///获取经理数据 ---- 接单人---全部员工
  141 +
  142 + _getSellerUserBySellerid() async {
  143 + await feastModel.getAuthUserLists(context);
  144 + if (widget.depositSunModel.nickName != null) {
  145 + List sellerList = feastModel.sellerManageList.map((item) {
  146 + return item.title;
  147 + }).toList();
  148 + collectionPIndex = sellerList.indexOf(widget.depositSunModel.nickName);
  149 + }
  150 + }
  151 +
  152 + _setBanquetDeposit() async {
  153 + if (moneyC.text.trim().length == 0) {
  154 + Utils.showToast('请输入金额');
  155 + return;
  156 + }
  157 + Map<String, String> pramas = {
  158 + 'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
  159 + 'rid': widget.rid,
  160 + 'price': moneyC.text,
  161 + 'rname': paymentC.text,
  162 + 'collection_uid': collectionPIndex == null
  163 + ? null
  164 + : feastModel.sellerManageList[collectionPIndex].id,
  165 + 'rtime': paymentTime == '请选择'
  166 + ? null
  167 + : (DateUtil.getDateTime(paymentTime).millisecondsSinceEpoch / 1000)
  168 + .floor()
  169 + .toString(),
  170 + 'pay': payTypeIndex == null ? null : payType[payTypeIndex],
  171 + 'deposit_id': depositTypeIndex == null
  172 + ? null
  173 + : feastModel.depositData[depositTypeIndex].id,
  174 + 'no': receiptNumberC.text
  175 + };
  176 + if (widget.depositSunModel != null) {
  177 + pramas['id'] = widget.depositSunModel.id;
  178 + }
  179 + bool success = await feastModel.setBanquetDeposit(context, pramas);
  180 + if (success) {
  181 + Navigator.pop(context);
  182 + bus.emit('feast_deposit_list');
  183 + }
87 } 184 }
88 185
89 ///请输入 186 ///请输入
@@ -299,6 +396,7 @@ class _FeastDepositPageState extends State<FeastDepositPage> { @@ -299,6 +396,7 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
299 396
300 @override 397 @override
301 Widget build(BuildContext context) { 398 Widget build(BuildContext context) {
  399 + feastModel = Provider.of<FeastModel>(context, listen: true);
302 return Scaffold( 400 return Scaffold(
303 backgroundColor: MyColours.color_ffffff, 401 backgroundColor: MyColours.color_ffffff,
304 key: scaffoldKey, 402 key: scaffoldKey,
@@ -320,11 +418,33 @@ class _FeastDepositPageState extends State<FeastDepositPage> { @@ -320,11 +418,33 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
320 child: Column( 418 child: Column(
321 children: [ 419 children: [
322 VEmptyView(50), 420 VEmptyView(50),
323 - _textfield('金额', money, moneyC, moneyF, '元'), 421 + _textfield('金额', '请输入', moneyC, moneyF, '元'),
324 VEmptyView(66), 422 VEmptyView(66),
325 - _textfield('付款人', paymentP, paymentC, paymentF, ''), 423 + _textfield('付款人', '请输入', paymentC, paymentF, '',
  424 + inputType: TextInputType.text),
326 VEmptyView(66), 425 VEmptyView(66),
327 - _selectWidget('收款人', collectionP), 426 + _selectWidget('收款人', collectionP, onTap: () {
  427 + FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
  428 + DialogUtil.showSelectCusmanDialog(
  429 + context,
  430 + feastModel.sellerManageList.map((item) {
  431 + return item.title;
  432 + }).toList(), (value) {
  433 + if (value != null) {
  434 + setState(() {
  435 + collectionPIndex = value.first;
  436 + collectionP = feastModel
  437 + .sellerManageList[collectionPIndex].title;
  438 + });
  439 + }
  440 + },
  441 + cancelText: '',
  442 + title: '选择收款人',
  443 + selecteds: collectionPIndex == null
  444 + ? []
  445 + : [collectionPIndex])
  446 + .then((value) {});
  447 + }),
328 VEmptyView(66), 448 VEmptyView(66),
329 _selectWidget('付款时间', paymentTime, onTap: () { 449 _selectWidget('付款时间', paymentTime, onTap: () {
330 FocusScope.of(context) 450 FocusScope.of(context)
@@ -355,12 +475,50 @@ class _FeastDepositPageState extends State<FeastDepositPage> { @@ -355,12 +475,50 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
355 }); 475 });
356 }), 476 }),
357 VEmptyView(66), 477 VEmptyView(66),
358 - _selectWidget('支付方式', paymentType), 478 + _selectWidget('支付方式', paymentType, onTap: () {
  479 + FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
  480 + DialogUtil.showSelectCusmanDialog(context, payType,
  481 + (value) {
  482 + if (value != null) {
  483 + setState(() {
  484 + payTypeIndex = value.first;
  485 + paymentType = payType[payTypeIndex];
  486 + });
  487 + }
  488 + },
  489 + cancelText: '',
  490 + title: '选择支付方式',
  491 + selecteds:
  492 + payTypeIndex == null ? [] : [payTypeIndex])
  493 + .then((value) {});
  494 + }),
359 VEmptyView(66), 495 VEmptyView(66),
360 - _selectWidget('定金类型', depositType), 496 + _selectWidget('定金类型', depositType, onTap: () {
  497 + FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
  498 + DialogUtil.showSelectCusmanDialog(
  499 + context,
  500 + feastModel.depositData.map((item) {
  501 + return item.dname;
  502 + }).toList(), (value) {
  503 + if (value != null) {
  504 + setState(() {
  505 + depositTypeIndex = value.first;
  506 + depositType = feastModel
  507 + .depositData[depositTypeIndex].dname;
  508 + });
  509 + }
  510 + },
  511 + cancelText: '',
  512 + title: '选择定金类型',
  513 + selecteds: depositTypeIndex == null
  514 + ? []
  515 + : [depositTypeIndex])
  516 + .then((value) {});
  517 + }),
361 VEmptyView(66), 518 VEmptyView(66),
362 - _textfield('收据编号', receiptNumber, receiptNumberC,  
363 - receiptNumberF, ''), 519 + _textfield(
  520 + '收据编号', '请输入', receiptNumberC, receiptNumberF, '',
  521 + inputType: TextInputType.text),
364 ], 522 ],
365 )), 523 )),
366 )), 524 )),
@@ -376,7 +534,9 @@ class _FeastDepositPageState extends State<FeastDepositPage> { @@ -376,7 +534,9 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
376 isSelect: false)), 534 isSelect: false)),
377 Expanded( 535 Expanded(
378 child: _callButton( 536 child: _callButton(
379 - onPress: () {}, 537 + onPress: () {
  538 + _setBanquetDeposit();
  539 + },
380 content: '保存并返回', 540 content: '保存并返回',
381 hasLeftBorder: true, 541 hasLeftBorder: true,
382 isSelect: true)) 542 isSelect: true))
@@ -23,6 +23,7 @@ class FeastInvoicePage extends StatefulWidget { @@ -23,6 +23,7 @@ class FeastInvoicePage extends StatefulWidget {
23 } 23 }
24 24
25 class _FeastInvoicePageState extends State<FeastInvoicePage> { 25 class _FeastInvoicePageState extends State<FeastInvoicePage> {
  26 + bool type = true; //默认--增值税普通发票
26 @override 27 @override
27 void initState() { 28 void initState() {
28 // TODO: implement initState 29 // TODO: implement initState
@@ -258,11 +259,13 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> { @@ -258,11 +259,13 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
258 ///单选按钮 259 ///单选按钮
259 Widget radioBtn(String title, bool select) { 260 Widget radioBtn(String title, bool select) {
260 return InkWell( 261 return InkWell(
261 - onTap: () {}, 262 + onTap: () {
  263 + // setsta
  264 + },
262 child: Row( 265 child: Row(
263 children: [ 266 children: [
264 Image.asset( 267 Image.asset(
265 - Utils.getImgPath(select ? 'select' : 'unselect'), 268 + Utils.getImgPath(select ? 'f_select' : 'f_select_not'),
266 width: w(24), 269 width: w(24),
267 ), 270 ),
268 HEmptyView(16), 271 HEmptyView(16),
@@ -302,8 +305,8 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> { @@ -302,8 +305,8 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
302 Row( 305 Row(
303 mainAxisAlignment: MainAxisAlignment.spaceBetween, 306 mainAxisAlignment: MainAxisAlignment.spaceBetween,
304 children: [ 307 children: [
305 - radioBtn('增值税普通发票', true),  
306 - radioBtn('增值税专用发票', false), 308 + radioBtn('增值税普通发票', type),
  309 + radioBtn('增值税专用发票', !type),
307 ], 310 ],
308 ), 311 ),
309 VEmptyView(80), 312 VEmptyView(80),
1 import 'package:flutter/material.dart'; 1 import 'package:flutter/material.dart';
2 import 'package:one_key/constant/state.dart'; 2 import 'package:one_key/constant/state.dart';
  3 +import 'package:one_key/models/get_banquet_by_id_model.dart';
3 import 'package:one_key/models/get_setmeal_class_model.dart'; 4 import 'package:one_key/models/get_setmeal_class_model.dart';
4 import 'package:one_key/provider/user_model.dart'; 5 import 'package:one_key/provider/user_model.dart';
5 import 'package:provider/provider.dart'; 6 import 'package:provider/provider.dart';
@@ -8,6 +9,7 @@ import '../constant/constant.dart'; @@ -8,6 +9,7 @@ import '../constant/constant.dart';
8 import '../constant/error.dart'; 9 import '../constant/error.dart';
9 import '../models/classify_model.dart'; 10 import '../models/classify_model.dart';
10 import '../models/filter_btn_model.dart'; 11 import '../models/filter_btn_model.dart';
  12 +import '../models/get_banquet_deposit_model.dart';
11 import '../models/get_deposit_model.dart'; 13 import '../models/get_deposit_model.dart';
12 import '../models/get_seller_user_by_sellerid_model.dart'; 14 import '../models/get_seller_user_by_sellerid_model.dart';
13 import '../models/get_setmeal_class_by_id_model.dart'; 15 import '../models/get_setmeal_class_by_id_model.dart';
@@ -67,6 +69,10 @@ class FeastModel extends ChangeNotifier { @@ -67,6 +69,10 @@ class FeastModel extends ChangeNotifier {
67 String type; //宴会类型 69 String type; //宴会类型
68 List<SessionsSunModel> sessionsSunModelList; //选台提交成功后返回的场次id数据 70 List<SessionsSunModel> sessionsSunModelList; //选台提交成功后返回的场次id数据
69 71
  72 + List<GetBanquetDepositSunModel> banquetDepositData = []; //宴会定金列表数据
  73 +
  74 + PageState pageStateBanquet = PageState.Loading; //宴会详情
  75 +
70 /*** 76 /***
71 * 77 *
72 * 新建宴会 78 * 新建宴会
@@ -175,6 +181,188 @@ class FeastModel extends ChangeNotifier { @@ -175,6 +181,188 @@ class FeastModel extends ChangeNotifier {
175 } 181 }
176 } 182 }
177 183
  184 + ///添加定金
  185 + Future<dynamic> setBanquetDeposit(
  186 + BuildContext context, Map<String, String> params,
  187 + {isShowLoading = true}) async {
  188 + BaseResp<dynamic> baseResp = await DioUtil()
  189 + .request<dynamic>(context, Method.get, HttpUrl.set_banquet_deposit,
  190 + data: params, showLoading: isShowLoading)
  191 + .catchError((error) {
  192 + print(error.toString());
  193 + if (error is MyError) {}
  194 + return false;
  195 + });
  196 + if (baseResp.code == Constant.status_success) {
  197 + // if (baseResp.data == 1) {
  198 + // rid = baseResp.data['id'];
  199 + return true;
  200 + // } else {
  201 + // return false;
  202 + // }
  203 + } else {
  204 + if (baseResp != null) {
  205 + Utils.showToast(baseResp.msg ?? "");
  206 + }
  207 + return false;
  208 + }
  209 + }
  210 +
  211 +//获取宴会定金
  212 + Future<dynamic> getBanquetDeposit(
  213 + BuildContext context, Map<String, String> params,
  214 + {isShowLoading = true}) async {
  215 + BaseResp<dynamic> baseResp = await DioUtil()
  216 + .request<dynamic>(context, Method.get, HttpUrl.get_banquet_deposit,
  217 + data: params, showLoading: isShowLoading)
  218 + .catchError((error) {
  219 + print(error.toString());
  220 + if (error is MyError) {}
  221 + return false;
  222 + });
  223 + if (baseResp.code == Constant.status_success) {
  224 + banquetDepositData =
  225 + GetBanquetDepositModel.fromJson(baseResp.responseData).data;
  226 +
  227 + // if (baseResp.data == 1) {
  228 + // rid = baseResp.data['id'];
  229 + return true;
  230 + // } else {
  231 + // return false;
  232 + // }
  233 + } else {
  234 + if (baseResp != null) {
  235 + Utils.showToast(baseResp.msg ?? "");
  236 + }
  237 + return false;
  238 + }
  239 + }
  240 +
  241 +//删除宴会定金
  242 + Future<dynamic> delBanquetDeposit(
  243 + BuildContext context, Map<String, String> params,
  244 + {isShowLoading = true}) async {
  245 + BaseResp<dynamic> baseResp = await DioUtil()
  246 + .request<dynamic>(context, Method.get, HttpUrl.del_banquet_deposit,
  247 + data: params, showLoading: isShowLoading)
  248 + .catchError((error) {
  249 + print(error.toString());
  250 + if (error is MyError) {}
  251 + return false;
  252 + });
  253 + if (baseResp.code == Constant.status_success) {
  254 + // if (baseResp.data == 1) {
  255 + // rid = baseResp.data['id'];
  256 + return true;
  257 + // } else {
  258 + // return false;
  259 + // }
  260 + } else {
  261 + if (baseResp != null) {
  262 + Utils.showToast(baseResp.msg ?? "");
  263 + }
  264 + return false;
  265 + }
  266 + }
  267 +
  268 + ///设置担保人
  269 + Future<dynamic> setWarrant(BuildContext context, Map<String, String> params,
  270 + {isShowLoading = true}) async {
  271 + BaseResp<dynamic> baseResp = await DioUtil()
  272 + .request<dynamic>(context, Method.get, HttpUrl.set_warrant,
  273 + data: params, showLoading: isShowLoading)
  274 + .catchError((error) {
  275 + print(error.toString());
  276 + if (error is MyError) {}
  277 + return false;
  278 + });
  279 + if (baseResp.code == Constant.status_success) {
  280 + // if (baseResp.data == 1) {
  281 + // rid = baseResp.data['id'];
  282 + return true;
  283 + // } else {
  284 + // return false;
  285 + // }
  286 + } else {
  287 + if (baseResp != null) {
  288 + Utils.showToast(baseResp.msg ?? "");
  289 + }
  290 + return false;
  291 + }
  292 + }
  293 +
  294 + //获取宴会详情
  295 + Future<dynamic> getBanquetById(
  296 + BuildContext context, Map<String, String> params,
  297 + {isShowLoading = true}) async {
  298 + BaseResp<dynamic> baseResp = await DioUtil()
  299 + .request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_id,
  300 + data: params, showLoading: isShowLoading)
  301 + .catchError((error) {
  302 + print(error.toString());
  303 + if (error is MyError) {
  304 + switch (error.type) {
  305 + case 1:
  306 + pageStateBanquet = PageState.ConnectivityError;
  307 + break;
  308 + case 2:
  309 + pageStateBanquet = PageState.ConnectivityTimeOut;
  310 + break;
  311 + default:
  312 + pageStateBanquet = PageState.ConnectivityError;
  313 + break;
  314 + }
  315 + }
  316 + notifyListeners();
  317 + return false;
  318 + });
  319 + if (baseResp.code == Constant.status_success) {
  320 + GetBanquetByIdSunModel model =
  321 + GetBanquetByIdModel.fromJson(baseResp.responseData).data;
  322 + BasicInfo basicInfo = baseResp.data['basic_info'] != null
  323 + ? new BasicInfo.fromJson(baseResp.data['basic_info'])
  324 + : null;
  325 + List<SessionsInfo> sessionsInfo = [];
  326 + List<String> keys = [];
  327 + if (baseResp.data['sessions_info'] != null) {
  328 + baseResp.data['sessions_info'].forEach((v) {
  329 + SessionsInfo temp = new SessionsInfo.fromJson(v);
  330 + sessionsInfo.add(temp);
  331 + keys.add(temp.reserveOrder);
  332 + });
  333 + }
  334 + List<CostInfoModel> costInfo = [];
  335 + if (baseResp.data['cost_info'] != null) {
  336 + Map map = baseResp.data['cost_info'];
  337 + for (String item in keys) {
  338 + map.forEach((key, value) {
  339 + CostInfoModel model = CostInfoModel();
  340 + model.title = '${key}费用';
  341 + model.costInfoSunModel = CostInfoSunModel.fromJson(value);
  342 + costInfo.add(model);
  343 + });
  344 + }
  345 + }
  346 +
  347 +
  348 + // if (baseResp.data == 1) {
  349 + // rid = baseResp.data['id'];
  350 + pageStateBanquet = PageState.Success;
  351 + notifyListeners();
  352 + return true;
  353 + // } else {
  354 + // return false;
  355 + // }
  356 + } else {
  357 + if (baseResp != null) {
  358 + Utils.showToast(baseResp.msg ?? "");
  359 + }
  360 + pageStateBanquet = PageState.ConnectivityError;
  361 + notifyListeners();
  362 + return false;
  363 + }
  364 + }
  365 +
178 /*** 366 /***
179 * 367 *
180 * 宴会员工 368 * 宴会员工
@@ -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_deposit_model.dart';
29 import '../models/otherset_model.dart'; 30 import '../models/otherset_model.dart';
30 import '../models/set_xuan_tai_model.dart'; 31 import '../models/set_xuan_tai_model.dart';
31 import '../models/wine_model.dart'; 32 import '../models/wine_model.dart';
@@ -859,9 +860,13 @@ class NavigatorUtil { @@ -859,9 +860,13 @@ class NavigatorUtil {
859 } 860 }
860 861
861 ///宴会----添加定金 862 ///宴会----添加定金
862 - static Future<dynamic> goFeastDepositPage(BuildContext context,  
863 - {replace = false, bool onlyShow = false}) {  
864 - return _navigateTo(context, "${Routes.feast_deposit_page}", 863 + static Future<dynamic> goFeastDepositPage(BuildContext context, String rid,
  864 + {replace = false,
  865 + bool onlyShow = false,
  866 + bool isNew = true,
  867 + GetBanquetDepositSunModel getBanquetDepositSunModel}) {
  868 + return _navigateTo(context,
  869 + "${Routes.feast_deposit_page}?rid=$rid&getBanquetDepositSunModel=${FluroConvertUtils.object2string(getBanquetDepositSunModel)}&isNew=$isNew",
865 replace: replace); 870 replace: replace);
866 } 871 }
867 872
@@ -8,6 +8,7 @@ import 'package:one_key/models/cookbook_model.dart'; @@ -8,6 +8,7 @@ import 'package:one_key/models/cookbook_model.dart';
8 import 'package:one_key/models/coupon_model.dart'; 8 import 'package:one_key/models/coupon_model.dart';
9 import 'package:one_key/models/customer_by_seller_model.dart'; 9 import 'package:one_key/models/customer_by_seller_model.dart';
10 import 'package:one_key/models/customer_list_model.dart'; 10 import 'package:one_key/models/customer_list_model.dart';
  11 +import 'package:one_key/models/get_banquet_deposit_model.dart';
11 import 'package:one_key/models/guest_info_model.dart'; 12 import 'package:one_key/models/guest_info_model.dart';
12 import 'package:one_key/models/integral_model.dart'; 13 import 'package:one_key/models/integral_model.dart';
13 import 'package:one_key/models/marketing_by_id_model.dart'; 14 import 'package:one_key/models/marketing_by_id_model.dart';
@@ -1370,11 +1371,24 @@ var feastCreatePageHandle = new Handler( @@ -1370,11 +1371,24 @@ var feastCreatePageHandle = new Handler(
1370 ///宴会----添加定金 1371 ///宴会----添加定金
1371 var feastDepositPageHandle = new Handler( 1372 var feastDepositPageHandle = new Handler(
1372 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) { 1373 handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
  1374 + String rid = params["rid"].first;
1373 // String uids = params["uids"].first; 1375 // String uids = params["uids"].first;
  1376 + bool isNew = FluroConvertUtils.string2bool(params["isNew"].first);
  1377 + if (!isNew) {
  1378 + GetBanquetDepositSunModel depositSunModel =
  1379 + GetBanquetDepositSunModel.fromJson(json.decode(
  1380 + FluroConvertUtils.fluroCnParamsDecode(
  1381 + params["getBanquetDepositSunModel"].first)));
  1382 +//
  1383 + // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
  1384 + return ChangeNotifierProvider<FeastModel>(
  1385 + create: (_) => FeastModel(),
  1386 + child: FeastDepositPage(rid: rid, depositSunModel: depositSunModel));
  1387 + }
1374 1388
1375 // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first); 1389 // bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
1376 return ChangeNotifierProvider<FeastModel>( 1390 return ChangeNotifierProvider<FeastModel>(
1377 - create: (_) => FeastModel(), child: FeastDepositPage()); 1391 + create: (_) => FeastModel(), child: FeastDepositPage(rid: rid));
1378 }); 1392 });
1379 1393
1380 ///宴会----调菜 1394 ///宴会----调菜