Commit 46fef89f9861c06195835116fb5ccc7b74175f61

Authored by wdn127929
1 parent 34d6830f

编辑宴会

import 'dart:convert' as convert;
import 'package:flutter/material.dart';
import 'package:one_key/models/set_xuan_tai_model.dart';
import 'package:one_key/models/upload_img_model.dart';
import 'package:one_key/utils/ConvertNumberToChineseMoneyWords.dart';
import 'package:one_key/models/table_list.dart' as t;
class GetBanquetByIdNewModel {
int ret;
... ... @@ -71,7 +74,8 @@ class GetBanquetByIdNewSunModel {
costInfo = <CostInfoModel>[];
if (json['cost_info'] != null && json['cost_info'].length > 0) {
double totalP = 0.0;
json['cost_info'].forEach((key, v) {
Map map = json['cost_info'];
map.forEach((key, v) {
CostInfoModel model = CostInfoModel.fromJson(v);
model.title = '${key}费用';
int start = key.indexOf('第');
... ... @@ -86,7 +90,7 @@ class GetBanquetByIdNewSunModel {
model.servicetype = info.servicetype;
model.serviceper = info.serviceper;
model.serviceprice = info.serviceprice;
model.totalPrice = info.totalprice;
model.totalprice = info.totalprice;
model.service = info.servicetype == '1' ? true : false;
model.discount = info.discounttype == '1' ? true : false;
costInfo.add(model);
... ... @@ -129,7 +133,10 @@ class BasicInfo {
Jiedan jiedan;
Jiedan staff;
String classify;
List<ImagesById> images;
List<Images> images;
String warrantId; //担保人id
List<Images> warrantImages; //担保图片
String warrantDesc; //担保说明
BasicInfo(
{this.ddate,
... ... @@ -140,7 +147,10 @@ class BasicInfo {
this.jiedan,
this.staff,
this.classify,
this.images});
this.images,
this.warrantId,
this.warrantImages,
this.warrantDesc});
BasicInfo.fromJson(Map<String, dynamic> json) {
ddate = json['ddate'];
... ... @@ -153,17 +163,32 @@ class BasicInfo {
staff = json['staff'] != null ? new Jiedan.fromJson(json['staff']) : null;
classify = json['classify'];
if (json['images'] != null) {
images = <ImagesById>[];
images = <Images>[];
if (json['images'] is List) {
json['images'].forEach((v) {
images.add(new ImagesById.fromJson(v));
images.add(new Images.fromJson(v));
});
} else {
convert.jsonDecode(json['images']).forEach((v) {
images.add(new ImagesById.fromJson(v));
images.add(new Images.fromJson(v));
});
}
}
warrantId = json['warrant_id'];
if (json['warrant_images'] != null) {
warrantImages = <Images>[];
if (json['warrant_images'] is List) {
json['warrant_images'].forEach((v) {
warrantImages.add(new Images.fromJson(v));
});
} else {
convert.jsonDecode(json['warrant_images']).forEach((v) {
warrantImages.add(new Images.fromJson(v));
});
}
}
warrantDesc = json['warrant_desc'];
}
Map<String, dynamic> toJson() {
... ... @@ -212,7 +237,7 @@ class SessionsInfo {
List<WineDetail> wine;
List<OtherDetail> other;
String remark;
List<ImagesById> images;
List<Images> images;
dynamic tableNum;
String servicetype;
String serviceper;
... ... @@ -221,6 +246,57 @@ class SessionsInfo {
String discountper;
String discountprice;
String totalprice;
String id; //场次ID
String rid; //宴会ID
String qrdate; //开始时间
String jedate; //结束时间
String ddateInterval; //餐段(0不代餐,1早餐,2午餐,3晚餐)
String reserveOrder; //第一场、第二场
List<Tids> tids; // 桌位信息
List<Setmeal> setmeals; // 套餐信息
List<Wine> wines; // 酒水信息
List<Other> others; // 酒水信息
String get cdStr {
switch (ddateInterval) {
case '0':
return '不带餐';
break;
case '1':
return '早餐';
break;
case '2':
return '午餐';
break;
case '3':
return '晚餐';
break;
default:
}
}
List<t.TableList> get tableList {
List<t.TableList> tableList = [];
tids.forEach((element) {
t.TableList tmodel = t.TableList(
'', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
tmodel.id = element.tid;
tmodel.name = element.name;
tableList.add(tmodel);
});
return tableList;
}
List<UploadImgModel> get feastRemarkImages {
List<UploadImgModel> upload = [];
images.forEach((element) {
UploadImgModel model = UploadImgModel();
model.process = 1;
model.qiniuUrl = element.url;
upload.add(model);
});
return upload;
}
SessionsInfo(
{this.rdate,
... ... @@ -237,7 +313,17 @@ class SessionsInfo {
this.discounttype,
this.discountper,
this.discountprice,
this.totalprice});
this.totalprice,
this.id,
this.rid,
this.qrdate,
this.jedate,
this.ddateInterval,
this.reserveOrder,
this.tids,
this.setmeals,
this.wines,
this.others});
SessionsInfo.fromJson(Map<String, dynamic> json) {
rdate = json['rdate'];
... ... @@ -263,14 +349,14 @@ class SessionsInfo {
remark = json['remark'];
if (json['images'] != null) {
images = <ImagesById>[];
images = <Images>[];
if (json['images'] is List) {
json['images'].forEach((v) {
images.add(new ImagesById.fromJson(v));
images.add(new Images.fromJson(v));
});
} else {
convert.jsonDecode(json['images']).forEach((v) {
images.add(new ImagesById.fromJson(v));
images.add(new Images.fromJson(v));
});
}
}
... ... @@ -283,6 +369,45 @@ class SessionsInfo {
discountper = json['discount_per'];
discountprice = json['discount_price'];
totalprice = json['total_price'];
//解析session新加字段,下午做
id = json['id'];
rid = json['rid'];
qrdate = json['_rdate'];
jedate = json['_edate'];
ddateInterval = json['ddate_interval'];
reserveOrder = json['reserve_order'];
if (json['images'] != null) {
images = <Images>[];
convert.jsonDecode(json['images']).forEach((v) {
images.add(new Images.fromJson(v));
});
}
if (json['tableData'] != null) {
tids = <Tids>[];
convert.jsonDecode(json['tableData']).forEach((v) {
tids.add(new Tids.fromJson(v));
});
}
if (json['setmealData'] != null) {
setmeals = <Setmeal>[];
convert.jsonDecode(json['setmealData']).forEach((v) {
setmeals.add(new Setmeal.fromJson(v));
});
}
if (json['wineData'] != null) {
wines = <Wine>[];
convert.jsonDecode(json['wineData']).forEach((v) {
wines.add(new Wine.fromJson(v));
});
}
if (json['otherData'] != null) {
others = <Other>[];
convert.jsonDecode(json['otherData']).forEach((v) {
others.add(new Other.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
... ... @@ -308,6 +433,25 @@ class SessionsInfo {
data['discount_per'] = this.discountper;
data['discount_price'] = this.discountprice;
data['total_price'] = this.totalprice;
data['id'] = this.id;
data['rid'] = this.rid;
data['_rdate'] = this.qrdate;
data['_edate'] = this.jedate;
data['ddate_interval'] = this.ddateInterval;
data['reserve_order'] = this.reserveOrder;
if (this.tids != null) {
data['tableData'] = this.tids.map((v) => v.toJson()).toList();
}
if (this.setmeals != null) {
data['setmealData'] = this.setmeal.map((v) => v.toJson()).toList();
}
if (this.wines != null) {
data['wineData'] = this.wine.map((v) => v.toJson()).toList();
}
if (this.others != null) {
data['otherData'] = this.other.map((v) => v.toJson()).toList();
}
return data;
}
}
... ... @@ -433,7 +577,7 @@ class CostInfoModel {
TextEditingController serviceC = TextEditingController();
TextEditingController discountC = TextEditingController();
String totalPrice; //合计
String totalPriceSelf; //合计
String sumPrice; //优惠和服务费之前的金额
String servicetype;
String serviceper;
... ... @@ -441,7 +585,7 @@ class CostInfoModel {
String discounttype;
String discountper;
String discountprice;
String totalprice;
String totalprice; //接口获取到的值,在详情展示
//详情用的服务费展示
String get showService {
... ... @@ -471,7 +615,7 @@ class CostInfoModel {
if (discount) {
//选中固定金额
return discountprice;
return '-${discountprice} 元';
} else {
//选中百分比
... ... @@ -492,7 +636,7 @@ class CostInfoModel {
data.add(sunModel);
});
sumPrice = price.toString();
totalPrice = sumPrice;
totalPriceSelf = sumPrice;
}
Map<String, dynamic> toJson() {
... ... @@ -546,7 +690,7 @@ class ContractInfo {
String contractRname;
String contractSellerName;
String contractNo;
List<ImagesById> contractImages;
List<Images> contractImages;
TextEditingController contractFinalPriceC = TextEditingController();
TextEditingController customerC = TextEditingController(); //客户签约人
TextEditingController storeC = TextEditingController(); //店铺签约人
... ... @@ -568,14 +712,14 @@ class ContractInfo {
contractNo = json['contract_no'];
if (json['contract_images'] != null) {
contractImages = <ImagesById>[];
contractImages = <Images>[];
if (json['contract_images'] is List) {
json['contract_images'].forEach((v) {
contractImages.add(new ImagesById.fromJson(v));
contractImages.add(new Images.fromJson(v));
});
} else {
convert.jsonDecode(json['contract_images']).forEach((v) {
contractImages.add(new ImagesById.fromJson(v));
contractImages.add(new Images.fromJson(v));
});
}
}
... ... @@ -593,21 +737,21 @@ class ContractInfo {
}
}
class ImagesById {
String url;
// class Images {
// String url;
ImagesById({this.url});
// Images({this.url});
ImagesById.fromJson(Map<String, dynamic> json) {
url = json['url'];
}
// Images.fromJson(Map<String, dynamic> json) {
// url = json['url'];
// }
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
return data;
}
}
// Map<String, dynamic> toJson() {
// final Map<String, dynamic> data = new Map<String, dynamic>();
// data['url'] = this.url;
// return data;
// }
// }
class Invoice {
String invoiceType; // "1 普通 2 专用",
... ... @@ -623,7 +767,7 @@ class Invoice {
String addresseePhone; //收件人电话
String addresseeAddress; //收件人地址
String code; //邮编
List<ImagesById> images;
List<Images> images;
Invoice(
{this.invoiceType,
... ... @@ -656,14 +800,14 @@ class Invoice {
addresseeAddress = json['addressee_address'];
code = json['code'];
if (json['images'] != null) {
images = <ImagesById>[];
images = <Images>[];
if (json['images'] is List) {
json['images'].forEach((v) {
images.add(new ImagesById.fromJson(v));
images.add(new Images.fromJson(v));
});
} else {
convert.jsonDecode(json['images']).forEach((v) {
images.add(new ImagesById.fromJson(v));
images.add(new Images.fromJson(v));
});
}
}
... ...
... ... @@ -10,7 +10,7 @@ class SetXuanTaiModel {
String rid;
String reserveOrder;
String ddateInterval;
String rdate;
// String rdate;
List<Tids> tids;
List<Setmeal> setmeal;
List<Wine> wine;
... ... @@ -37,7 +37,7 @@ class SetXuanTaiModel {
{this.rid,
this.reserveOrder,
this.ddateInterval,
this.rdate,
// this.rdate,
this.tids,
this.setmeal,
this.wine,
... ... @@ -49,7 +49,7 @@ class SetXuanTaiModel {
rid = json['rid'];
reserveOrder = json['reserve_order'];
ddateInterval = json['ddate_interval'];
rdate = json['rdate'];
// rdate = json['rdate'];
if (json['tids'] != null) {
tids = <Tids>[];
json['tids'].forEach((v) {
... ... @@ -89,7 +89,7 @@ class SetXuanTaiModel {
data['rid'] = this.rid;
data['reserve_order'] = this.reserveOrder;
data['ddate_interval'] = this.ddateInterval;
data['rdate'] = this.rdate;
// data['rdate'] = this.rdate;
if (this.tids != null) {
data['tids'] = this.tids.map((v) => v.toJson()).toList();
}
... ... @@ -121,6 +121,7 @@ class Tids {
Tids.fromJson(Map<String, dynamic> json) {
tid = json['tid'];
numStr = json['num'];
name = json['name'];
tableNumC.text = numStr;
}
... ... @@ -128,6 +129,7 @@ class Tids {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['tid'] = this.tid;
data['num'] = this.numStr;
data['name'] = this.name;
return data;
}
}
... ... @@ -149,23 +151,24 @@ class Setmeal {
List<Cooklist> cooklist;
Map<String, List<CookByIdSetmeal>> dataMenu = {};
Setmeal(
{this.setmealId,
this.price,
this.finalPrice,
this.pnum,
this.min,
this.spare,
this.name,
this.select,
this.bargaining,
this.cooklist,
this.dataMenu
// this.finalPriceC,
// this.pnumC,
// this.minC,
// this.spareC,
});
Setmeal({
this.setmealId,
this.price,
this.finalPrice,
this.pnum,
this.min,
this.spare,
this.name,
this.select,
this.bargaining,
this.cooklist,
this.dataMenu,
// this.finalPriceC,
// this.pnumC,
// this.minC,
// this.spareC,
});
Setmeal.fromJson(Map<String, dynamic> json) {
setmealId = json['setmeal_id'];
... ... @@ -251,6 +254,7 @@ class Wine {
price = json['price'];
finalPrice = json['final_price'];
numStr = json['num'];
name = json['name'];
}
Map<String, dynamic> toJson() {
... ... @@ -259,6 +263,8 @@ class Wine {
data['price'] = this.price;
data['final_price'] = this.finalPrice;
data['num'] = this.numStr;
data['name'] = this.name;
return data;
}
}
... ... @@ -284,6 +290,7 @@ class Other {
price = json['price'];
finalPrice = json['final_price'];
numStr = json['num'];
name = json['name'];
}
Map<String, dynamic> toJson() {
... ... @@ -292,6 +299,8 @@ class Other {
data['price'] = this.price;
data['final_price'] = this.finalPrice;
data['num'] = this.numStr;
data['name'] = this.name;
return data;
}
}
... ...
... ... @@ -315,5 +315,9 @@ class HttpUrl {
"?service=App.Banquet.GetBanquetByTime"; //根据时间范围获取宴会订单
static const String set_banquet_info_price =
"?service=App.Banquet.SetBanquetInfoPrice"; //设置宴会场次费用
static const String set_banquet_lost =
"?service=App.Banquet.SetBanquetLost"; //设置丢单原因
static const String get_banquet_be_follow =
"?service=App.Banquet.GetBanquetBeFollow"; //根据时间范围查询待跟进订单
}
... ...
... ... @@ -8,6 +8,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/cookbook_one_model.dart';
import 'package:one_key/models/get_banquet_deposit_model.dart';
import 'package:one_key/models/sessions_model.dart';
import 'package:one_key/route/navigator_util.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/round_button.dart';
... ... @@ -126,6 +127,11 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
if (results[0] && results[1] && results[2] && results[3]) {
//成功
if (widget.banquetDetail != null) {
menuSet.add('意向');
menuSet.add('选台');
menuSet.add('定金');
menuSet.add('签约');
//旧内容编辑
// ******意向******
BasicInfo basicInfo = widget.banquetDetail.basicInfo;
... ... @@ -178,6 +184,96 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
imgModel.process = 1;
_uploadImageProvider.feastRemarkImageList.add(imgModel);
});
/**
* 选台
*/
xuantaiData = [];
// xuantaiSelIndex = 0;
feastModel.sessionsSunModelList = []; //场次对应的id,删除场次的时候用
List<SessionsInfo> sessionsInfos = widget.banquetDetail.sessionsInfo;
sessionsInfos.forEach((element) {
feastModel.rid = element.rid;
SetXuanTaiModel setXuanTaiModel = SetXuanTaiModel();
setXuanTaiModel.rid = element.rid;
setXuanTaiModel.reserveOrder = element.reserveOrder;
setXuanTaiModel.ddateInterval = element.ddateInterval;
// setXuanTaiModel.rdate = element.qrdate;
setXuanTaiModel.tids = element.tids;
setXuanTaiModel.setmeal = element.setmeals;
setXuanTaiModel.wine = element.wines;
setXuanTaiModel.other = element.others;
setXuanTaiModel.remark = element.remark;
setXuanTaiModel.images = element.images;
setXuanTaiModel.dateTimext = DateTime.fromMillisecondsSinceEpoch(
int.parse(element.qrdate.toString()) * 1000);
setXuanTaiModel.dateTimeShowxt =
createDateText(context, setXuanTaiModel.dateTimext);
setXuanTaiModel.cdShow = element.cdStr;
setXuanTaiModel.cdSelIndex = dsoltList
.map((item) {
return item.title;
})
.toList()
.indexOf(element.cdStr);
setXuanTaiModel.cdCode = dsoltList[setXuanTaiModel.cdSelIndex].id;
DateTime start = DateTime.fromMillisecondsSinceEpoch(
int.parse(element.qrdate.toString()) * 1000);
setXuanTaiModel.startDate =
'${Utils.addZeroNumber(start.hour)}:${Utils.addZeroNumber(start.minute)}';
DateTime end = DateTime.fromMillisecondsSinceEpoch(
int.parse(element.jedate.toString()) * 1000);
setXuanTaiModel.endDate =
'${Utils.addZeroNumber(end.hour)}:${Utils.addZeroNumber(end.minute)}';
setXuanTaiModel.qsDateShow = setXuanTaiModel.startDate +
'-' +
setXuanTaiModel.endDate; //起始时间
setXuanTaiModel.tableList = element.tableList;
setXuanTaiModel.tableSum = int.parse('${element.tableNum}'); //桌位总数
setXuanTaiModel.customCxt.text = element.remark; //选台备注
setXuanTaiModel.feastRemarkXtImageList =
element.feastRemarkImages; //宴会备注图片信息列表----选台
setXuanTaiModel.reserveId = element.id; //场次id
xuantaiData.add(setXuanTaiModel);
SessionsSunModel sessionsSunModel = SessionsSunModel();
sessionsSunModel.reserveOrder = element.reserveOrder;
sessionsSunModel.id = element.id;
feastModel.sessionsSunModelList.add(sessionsSunModel);
});
/**
* 定金
*/
_getBanquetDeposit(); //获取的rid后执行,编辑宴会信息-----定金信息获取
/**
* 担保信息
*/
//担保人
feastModel.sellerManageList.forEach((item) {
if (item.id == basicInfo.warrantId) {
djDBR = item.title;
}
});
djDBRIndex = feastModel.sellerManageList
.map((item) {
return item.title;
})
.toList()
.indexOf(djDBR);
//担保说明
customCdb.text = basicInfo.warrantDesc ?? '';
//担保图片
_uploadImageProvider.feastRemarkDjImageList = [];
basicInfo.warrantImages.forEach((element) {
UploadImgModel imgModel = UploadImgModel();
imgModel.qiniuUrl = element.url;
imgModel.process = 1;
_uploadImageProvider.feastRemarkDjImageList.add(imgModel);
});
setState(() {});
}
} else {
... ... @@ -1134,7 +1230,11 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
// map['edate'] = _getEdate(element, element.dateTimext);
List tids = [];
for (Tids item in element.tids) {
Map mapTids = {'tid': item.tid, 'num': item.tableNumC.text};
Map mapTids = {
'tid': item.tid,
'num': item.tableNumC.text,
'name': item.name
};
tids.add(mapTids);
}
map['tids'] = tids; //桌位数据
... ... @@ -1152,6 +1252,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
'pnum': mealValue.pnum,
'min': mealValue.min,
'spare': mealValue.spare,
'name': mealValue.name
};
List cooklist = []; //菜单数据
if (mealValue.dataMenu != null && mealValue.dataMenu.length > 0) {
... ... @@ -1192,7 +1293,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
'wine_id': element.wineId,
'price': element.price,
'final_price': element.finalPrice,
'num': element.numStr
'num': element.numStr,
'name': element.name,
'spec': element.spec
};
wines.add(mapWine);
});
... ... @@ -1206,7 +1309,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
'other_id': element.otherId,
'price': element.price,
'final_price': element.finalPrice,
'num': element.numStr
'num': element.numStr,
'name': element.name,
'spec': element.spec
};
others.add(mapOther);
});
... ... @@ -1586,8 +1691,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
Expanded(
child: Text(
xuantaiData[xuantaiSelIndex]
.tids[index]
.name,
.tids[index]
.name ??
"",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_438E93,
... ... @@ -1771,7 +1877,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
item.selected = true;
Tids tids = Tids();
tids.tid = item.id;
tids.name = item.name;
tids.name = item.name ?? "";
xuantaiData[xuantaiSelIndex]
.tids
.add(tids);
... ... @@ -1835,7 +1941,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
item.selected = true;
Tids tids = Tids();
tids.tid = item.id;
tids.name = item.name;
tids.name = item.name ?? "";
xuantaiData[xuantaiSelIndex]
.tids
.add(tids);
... ... @@ -1883,7 +1989,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
children: [
Expanded(
child: Text(
setmeal.name,
setmeal.name ?? "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color:
... ... @@ -2092,7 +2198,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
children: [
Expanded(
child: Text(
wine.name,
wine.name ?? "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_515151,
... ... @@ -2210,7 +2316,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
children: [
Expanded(
child: Text(
other.name,
other.name ?? "",
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_515151,
... ... @@ -3043,14 +3149,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
// }
}
if (total == 0.0) {
costInfoModel.totalPrice = costInfoModel.sumPrice;
costInfoModel.totalPriceSelf = costInfoModel.sumPrice;
} else {
String num2StrD = total.toStringAsFixed(2); //保留两位小数
costInfoModel.totalPrice = num2StrD;
costInfoModel.totalPriceSelf = num2StrD;
}
double finalContract = 0.0; //最终议价
feastModel.banquetDetail.costInfo.forEach((element) {
finalContract += double.parse(element.totalPrice);
finalContract += double.parse(element.totalPriceSelf);
});
feastModel.banquetDetail.contractInfo.contractFinalPrice =
finalContract.toString();
... ... @@ -3480,7 +3586,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
),
Spacer(),
Text(
'${costInfoModel.totalPrice} 元',
'${costInfoModel.totalPriceSelf} 元',
style: TextStyle(
color: MyColours.color_515151,
fontWeight: FontWeight.bold,
... ... @@ -4198,7 +4304,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
} else {
map['discount_per'] = element.discountC.text;
}
map['total_price'] = element.totalPrice;
map['total_price'] = element.totalPriceSelf;
dataRequest.add(map);
});
... ... @@ -4260,7 +4366,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
feastModel.banquetDetail.invoice.images = [];
imageQiniuUrlListInvoice.forEach((v) {
feastModel.banquetDetail.invoice.images.add(new ImagesById.fromJson(v));
feastModel.banquetDetail.invoice.images.add(new Images.fromJson(v));
});
}
... ...
... ... @@ -11,7 +11,9 @@ import '../../route/navigator_util.dart';
import '../../utils/ConvertNumberToChineseMoneyWords.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/MyDivider.dart';
import '../../widgets/h_empty_view.dart';
import '../../widgets/loading.dart';
import '../../widgets/page_exception.dart';
import '../../widgets/round_button.dart';
import '../../widgets/system_app_bar.dart';
... ... @@ -56,6 +58,22 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
}
}
/// 设置丢单原因
_setBanquetLost(String lost) async {
Map<String, String> pramas = {'rid': widget.rid, 'lost': lost}; //
bool success = await feastModel.setBanquetLost(context, pramas);
if (success) {
// _uploadImageProvider.feastRemarkContractImageList = [];
// feastModel.banquetDetail.contractInfo.contractImages.forEach((element) {
// UploadImgModel uploadImgModel = UploadImgModel();
// uploadImgModel.process = 1;
// uploadImgModel.qiniuUrl = element.url;
// _uploadImageProvider.feastRemarkContractImageList.add(uploadImgModel);
// });
// setState(() {});
}
}
Widget baseInfoItem(String title, String content) {
return Padding(
padding: EdgeInsets.symmetric(vertical: h(6)),
... ... @@ -658,7 +676,7 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
),
Spacer(),
Text(
'${costInfoModel.totalPrice} 元',
'${costInfoModel.totalprice} 元',
style: TextStyle(
color: MyColours.color_515151,
fontSize: font(14)),
... ... @@ -912,6 +930,307 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
]));
}
///取消预订弹框
_showCancelWidget(context) {
ScrollController _scrollController = ScrollController();
TextEditingController _cancelController = TextEditingController();
FocusNode _cancelNode = FocusNode();
List cancelReasonList = [
{'title': '已选择其他酒店', 'select': false},
{'title': '不接受增值服务', 'select': false},
{'title': '场地无法满足客户', 'select': false},
{'title': '内部失误,跟单失败', 'select': false},
{'title': '其他原因', 'select': false},
];
showGeneralDialog(
context: context,
barrierDismissible: false,
barrierLabel:
MaterialLocalizations.of(context).modalBarrierDismissLabel,
transitionDuration: const Duration(milliseconds: 150),
barrierColor: Color.fromRGBO(0, 0, 0, 0.25),
pageBuilder: (BuildContext context, Animation animation,
Animation secondaryAnimation) {
return Scaffold(
backgroundColor: Color.fromRGBO(0, 0, 0, 0.25),
body: StatefulBuilder(builder: (context, state) {
// _cancelState = state;
return GestureDetector(
behavior: HitTestBehavior.opaque,
// onTap: () {
// Navigator.of(context).pop();
// },
child: Center(
child: Container(
margin: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(28 * 2)),
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(ScreenUtil().setWidth(10)),
),
height: ScreenUtil().setWidth(355 * 2 + 20),
child: Column(
// mainAxisSize: MainAxisSize.min,
children: [
// Stack(
// children: [
VEmptyView(48),
Container(
height: ScreenUtil().setWidth(48),
child: Text(
'请选择丢单原因',
style: TextStyle(
fontSize: ScreenUtil().setSp(32),
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Color.fromRGBO(0, 0, 0, 0.9)),
),
),
// Positioned(
// top: ScreenUtil().setWidth(8),
// right: ScreenUtil().setWidth(0),
// child: GestureDetector(
// onTap: () {
// _initCancel();
// Navigator.of(context).pop();
// },
// child: Container(
// padding: EdgeInsets.only(left: 20),
// child: Image.asset(
// 'assets/close.png',
// width: ScreenUtil().setWidth(32),
// height: ScreenUtil().setWidth(32),
// ),
// )))
// ],
// ),
VEmptyView(40),
Container(
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(32)),
child: Column(
// mainAxisSize: MainAxisSize.min,
children: cancelReasonList.map((value) {
return value['title'] == '其他原因'
? SizedBox()
: GestureDetector(
onTap: () {
for (var item
in cancelReasonList) {
item['select'] = false;
// isShowTF = false;
// paddingBottom =
// ScreenUtil().screenHeight.ceil() -
// 138 -
// 340;
if (item['title'] ==
value['title']) {
item['select'] = true;
// if (item['title'] == '其他原因') {
// // isShowTF = true;
// // paddingBottom = 130;
// // paddingBottom =
// // ScreenUtil().screenHeight.ceil() -
// // 138 -
// // 340 -
// // 46;
// }
}
}
state(() {});
},
child: Container(
height: ScreenUtil().setWidth(48),
margin: EdgeInsets.only(
bottom: ScreenUtil()
.setWidth(40)),
child: Row(
children: [
Image.asset(
value['select']
? 'assets/select.png'
: 'assets/unselect.png',
width: ScreenUtil()
.setWidth(42)),
HEmptyView(20),
Container(
child: Text(
value['title'],
style: TextStyle(
fontSize:
ScreenUtil()
.setSp(
32),
fontWeight:
FontWeight
.normal,
decoration:
TextDecoration
.none,
color: MyColours
.color_333333)))
],
),
),
);
}).toList(),
)),
Material(
child: Container(
color: Colors.white,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(32)),
height: ScreenUtil().setWidth(42 * 2),
child: Row(children: [
InkWell(
onTap: () {
for (var item in cancelReasonList) {
item['select'] = false;
}
cancelReasonList[4]['select'] =
true;
state(() {});
},
child: Padding(
padding: EdgeInsets.only(
right: ScreenUtil()
.setWidth(20)),
child: Image.asset(
cancelReasonList[4]['select']
? 'assets/select.png'
: 'assets/unselect.png',
width: ScreenUtil()
.setWidth(44)))),
Expanded(
child: Container(
decoration: BoxDecoration(
color: Color.fromRGBO(
240, 240, 240, 1),
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(8))),
// height: ScreenUtil().setWidth(42 * 2),
padding: EdgeInsets.symmetric(
horizontal:
ScreenUtil().setWidth(16)),
child: TextField(
maxLines: 1,
controller: _cancelController,
focusNode: _cancelNode,
style: TextStyle(
textBaseline:
TextBaseline.alphabetic),
textAlignVertical:
TextAlignVertical.center,
decoration: InputDecoration(
contentPadding: EdgeInsets.zero,
hintText: "其他",
// focusColor: Color.fromRGBO(0, 0, 0, 0.4),
hintStyle: TextStyle(
color:
Color.fromRGBO(0, 0, 0, 0.4),
fontSize: ScreenUtil().setSp(32),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 0,
color: Colors.transparent)),
border: OutlineInputBorder(
borderSide: BorderSide(
width: 0,
color: Colors.transparent)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
width: 0,
color: Colors.transparent)),
),
// border: InputBorder.none,
onChanged: (_) {
setState(() {});
},
onEditingComplete: () {
print('fff');
_cancelNode.unfocus();
},
// keyboardType: TextInputType.number,
),
))
]))),
VEmptyView(40),
MyDivider(double.infinity, ScreenUtil().setWidth(2),
color: MyColours.color_f3f3f3),
Row(
// mainAxisAlignment:
// MainAxisAlignment.spaceBetween,
children: [
RoundButton(
text: '取消',
width: (ScreenUtil().screenWidth -
ScreenUtil().setWidth(62) * 2) /
2,
height: ScreenUtil().setWidth(112),
// radius: ScreenUtil().setWidth(10),
gradientStart: Colors.transparent,
gradientEnd: Colors.transparent,
textColor: MyColours.color_E6000000,
isBold: false,
fontSize: 32,
onPressed: () {
Navigator.pop(context);
}),
MyDivider(ScreenUtil().setWidth(2),
ScreenUtil().setWidth(112),
color: MyColours.color_f3f3f3),
RoundButton(
text: '确定丢单',
width: (ScreenUtil().screenWidth -
ScreenUtil().setWidth(62) * 2) /
2,
height: ScreenUtil().setWidth(112),
// radius: ScreenUtil().setWidth(10),
gradientStart: Colors.transparent,
gradientEnd: Colors.transparent,
textColor: MyColours.color_E34D59,
fontSize: 32,
isBold: true,
onPressed: () {
String desc = '';
for (var value in cancelReasonList) {
if (value['select'] == true) {
desc = value['title'];
if (value['title'] == '其他原因') {
desc =
_cancelController.text.trim();
if (desc.isEmpty) {
Utils.showToast("请填写原因");
return;
}
}
}
}
if (desc == '') {
Utils.showToast('请选择原因');
return;
}
Navigator.of(context).pop();
Loading.showLoading(context);
_setBanquetLost(desc);
}),
])
],
),
),
));
}));
});
}
///签约
Widget qyWidget() {
return Column(children: <Widget>[
... ... @@ -965,7 +1284,9 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
children: [
Expanded(
child: _callButton(
onPress: () {},
onPress: () {
_showCancelWidget(context);
},
content: '丢单',
hasLeftBorder: true,
textColor: MyColours.color_E34D59,
... ... @@ -974,7 +1295,9 @@ class _FeastDetailPageState extends State<FeastDetailPage> {
child: _callButton(
onPress: () async {
NavigatorUtil.goFeastCreatePage(context,
banquetDetail: feastModel.banquetDetail);
banquetDetail: {
'object': feastModel.banquetDetailMap
});
// selectMenu = '签约';
// menuSet.add('定金');
// menuSet.add('签约');
... ...
... ... @@ -363,7 +363,7 @@ class _FeastFollowUpPageState extends State<FeastFollowUpPage> {
FocusNode _cancelNode = FocusNode();
List cancelReasonList = [
{'title': '已选则其他酒店', 'select': false},
{'title': '已选择其他酒店', 'select': false},
{'title': '不接受增值服务', 'select': false},
{'title': '场地无法满足客户', 'select': false},
{'title': '内部失误,跟单失败', 'select': false},
... ... @@ -506,8 +506,8 @@ class _FeastFollowUpPageState extends State<FeastFollowUpPage> {
Material(
child: Container(
color: Colors.white,
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(32)),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(32)),
height: ScreenUtil().setWidth(42 * 2),
child: Row(children: [
InkWell(
... ... @@ -749,7 +749,8 @@ class _FeastFollowUpPageState extends State<FeastFollowUpPage> {
} else {
return ListView.builder(
itemCount: 100,
padding: EdgeInsets.only(left: w(12), top: w(19),right:w(12)),
padding:
EdgeInsets.only(left: w(12), top: w(19), right: w(12)),
itemBuilder: (BuildContext context, int index) {
// WineSunModel data = feastModel.wineData[index];
return buildFeastTypeItem();
... ...
... ... @@ -172,6 +172,7 @@ class FeastSelectTablePageState extends State<FeastSelectTablePage> {
if (item1.id == table.id) {
item1.selected = true;
selectNum++;
selectTables.add(item1);
// if (!tableList.contains(item)) {
// tableList.add(item);
// }
... ...
... ... @@ -76,8 +76,92 @@ class FeastModel extends ChangeNotifier {
PageState pageStateBanquet = PageState.Loading; //宴会详情
GetBanquetByIdNewSunModel banquetDetail; //宴会详情信息
dynamic banquetDetailMap; //宴会详情信息--接口原始数据
List<GetBanquetByTimeSunModel> banquetHome; //宴会首页数据
PageState pageStateBeFollow = PageState.Loading; //待跟进订单
/**
* 宴会待跟进
*/
/// 设置丢单原因
Future<dynamic> setBanquetLost(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_banquet_lost,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {}
return false;
});
if (baseResp.code == Constant.status_success) {
// if (baseResp.data == 1) {
// rid = baseResp.data['id'];
return true;
// } else {
// return false;
// }
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
/// 根据时间范围查询待跟进订单
Future<dynamic> getBanquetBeFollow(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_banquet_be_follow,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {
switch (error.type) {
case 1:
pageStateBeFollow = PageState.ConnectivityError;
break;
case 2:
pageStateBeFollow = PageState.ConnectivityTimeOut;
break;
default:
pageStateBeFollow = PageState.ConnectivityError;
break;
}
}
notifyListeners();
return false;
});
if (baseResp.code == Constant.status_success) {
// banquetHome = GetBanquetByTimeModel.fromJson(baseResp.responseData).data;
// if (baseResp.data == 1) {
// rid = baseResp.data['id'];
if (banquetHome.length == 0) {
pageStateBeFollow = PageState.Empty;
} else {
pageStateBeFollow = PageState.Success;
}
notifyListeners();
return true;
// } else {
// return false;
// }
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
pageStateBeFollow = PageState.ConnectivityError;
notifyListeners();
return false;
}
}
/**
* 宴会首页
... ... @@ -411,6 +495,7 @@ class FeastModel extends ChangeNotifier {
if (baseResp.code == Constant.status_success) {
banquetDetail =
GetBanquetByIdNewModel.fromJson(baseResp.responseData).data;
banquetDetailMap = baseResp.data;
// if (baseResp.data == 1) {
// rid = baseResp.data['id'];
... ...
... ... @@ -855,9 +855,7 @@ class NavigatorUtil {
///宴会----新建宴会
static Future<dynamic> goFeastCreatePage(BuildContext context,
{replace = false,
bool onlyShow = false,
GetBanquetByIdNewSunModel banquetDetail}) {
{replace = false, bool onlyShow = false, Map banquetDetail}) {
if (banquetDetail != null) {
return _navigateTo(context,
"${Routes.feast_create_page}?banquetDetail=${FluroConvertUtils.object2string(banquetDetail)}",
... ...
... ... @@ -1369,8 +1369,18 @@ var feastCreatePageHandle = new Handler(
GetBanquetByIdNewSunModel banquetDetail;
if (params.keys.contains('banquetDetail')) {
banquetDetail = GetBanquetByIdNewSunModel.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(params["banquetDetail"].first)));
Map object = FluroConvertUtils.string2map(params["banquetDetail"].first);
Map<String, dynamic> temp = object['object'];
// temp.forEach((key, value) {
// List<CookByIdSetmeal> cook = [];
// for (var item in value) {
// cook.add(CookByIdSetmeal.fromJson(item));
// }
// justSelData[key] = cook;
// });
banquetDetail = GetBanquetByIdNewSunModel.fromJson(temp);
}
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(),
... ...