Commit 6fd560994a6e11f2faab1eb907351511029bb5fe

Authored by wdn127929
1 parent 6bb8b023

宴会新建OK

... ... @@ -54,14 +54,14 @@ class GetBanquetByIdNewSunModel {
}
contractInfo = ContractInfo();
// contractInfo = json['contract_info'] != null
// ? new ContractInfo.fromJson(json['contract_info'])
// : null;
contractInfo = json['contract_info'] != null
? new ContractInfo.fromJson(json['contract_info'])
: null;
invoice = json['invoice'] != null
? new Invoice.fromJson(convert.jsonDecode(json['invoice']))
: null; //发票信息
if (json['cost_info'] != null) {
costInfo = <CostInfoModel>[];
costInfo = <CostInfoModel>[];
if (json['cost_info'] != null && json['cost_info'].length > 0) {
double totalP = 0.0;
json['cost_info'].forEach((key, v) {
CostInfoModel model = CostInfoModel.fromJson(v);
... ... @@ -69,7 +69,12 @@ class GetBanquetByIdNewSunModel {
costInfo.add(model);
totalP += double.parse(model.sumPrice);
});
contractInfo.contractTotalPrice = totalP.toString();
contractInfo.contractTotalPrice = totalP == 0.0 ? '' : totalP.toString();
contractInfo.contractFinalPriceC.text =
totalP == 0.0 ? '' : totalP.toString();
contractInfo.customerC.text = contractInfo.contractRname;
contractInfo.storeC.text = contractInfo.contractSellerName;
contractInfo.numC.text = contractInfo.contractNo;
}
}
... ... @@ -168,7 +173,8 @@ class SessionsInfo {
List<WineDetail> wine;
List<OtherDetail> other;
String remark;
List<Images> images;
List<ImagesById> images;
dynamic tableNum;
SessionsInfo(
{this.rdate,
... ... @@ -177,7 +183,8 @@ class SessionsInfo {
this.wine,
this.other,
this.remark,
this.images});
this.images,
this.tableNum});
SessionsInfo.fromJson(Map<String, dynamic> json) {
rdate = json['rdate'];
... ... @@ -203,11 +210,13 @@ class SessionsInfo {
remark = json['remark'];
if (json['images'] != null) {
images = <Images>[];
images = <ImagesById>[];
convert.jsonDecode(json['images']).forEach((v) {
images.add(new Images.fromJson(v));
images.add(new ImagesById.fromJson(v));
});
}
tableNum = json['table_num'];
}
Map<String, dynamic> toJson() {
... ... @@ -225,6 +234,7 @@ class SessionsInfo {
}
data['remark'] = this.remark;
data['images'] = this.images;
data['table_num'] = this.tableNum;
return data;
}
}
... ... @@ -236,7 +246,7 @@ class SetmealDetail {
String pnum;
String min;
String spare;
List<Cooklist> cooklist;
List<CooklistByid> cooklist;
String mealName;
SetmealDetail(
... ... @@ -257,9 +267,9 @@ class SetmealDetail {
min = json['min'];
spare = json['spare'];
if (json['cooklist'] != null) {
cooklist = <Cooklist>[];
cooklist = <CooklistByid>[];
json['cooklist'].forEach((v) {
cooklist.add(new Cooklist.fromJson(v));
cooklist.add(new CooklistByid.fromJson(v));
});
}
mealName = json['meal_name'];
... ... @@ -281,12 +291,12 @@ class SetmealDetail {
}
}
class Cooklist {
class CooklistByid {
String cname;
Cooklist({this.cname});
CooklistByid({this.cname});
Cooklist.fromJson(Map<String, dynamic> json) {
CooklistByid.fromJson(Map<String, dynamic> json) {
cname = json['cname'];
}
... ... @@ -417,8 +427,11 @@ class ContractInfo {
String contractRname;
String contractSellerName;
String contractNo;
List<Images> contractImages;
List<ImagesById> contractImages;
TextEditingController contractFinalPriceC = TextEditingController();
TextEditingController customerC = TextEditingController(); //客户签约人
TextEditingController storeC = TextEditingController(); //店铺签约人
TextEditingController numC = TextEditingController(); //合同编号
ContractInfo(
{this.contractTotalPrice,
... ... @@ -435,9 +448,9 @@ class ContractInfo {
contractSellerName = json['contract_seller_name'];
contractNo = json['contract_no'];
if (json['contract_images'] != null) {
contractImages = <Images>[];
contractImages = <ImagesById>[];
convert.jsonDecode(json['contract_images']).forEach((v) {
contractImages.add(new Images.fromJson(v));
contractImages.add(new ImagesById.fromJson(v));
});
}
}
... ... @@ -454,12 +467,12 @@ class ContractInfo {
}
}
class Images {
class ImagesById {
String url;
Images({this.url});
ImagesById({this.url});
Images.fromJson(Map<String, dynamic> json) {
ImagesById.fromJson(Map<String, dynamic> json) {
url = json['url'];
}
... ... @@ -484,6 +497,7 @@ class Invoice {
String addresseePhone; //收件人电话
String addresseeAddress; //收件人地址
String code; //邮编
List<ImagesById> images;
Invoice(
{this.invoiceType,
... ... @@ -498,7 +512,8 @@ class Invoice {
this.addressee,
this.addresseePhone,
this.addresseeAddress,
this.code});
this.code,
this.images});
Invoice.fromJson(Map<String, dynamic> json) {
invoiceType = json['invoice_type'];
... ... @@ -514,6 +529,18 @@ class Invoice {
addresseePhone = json['addressee_phone'];
addresseeAddress = json['addressee_address'];
code = json['code'];
if (json['images'] != null) {
images = <ImagesById>[];
if (json['images'] is List) {
json['images'].forEach((v) {
images.add(new ImagesById.fromJson(v));
});
} else {
convert.jsonDecode(json['images']).forEach((v) {
images.add(new ImagesById.fromJson(v));
});
}
}
}
Map<String, dynamic> toJson() {
... ... @@ -531,6 +558,7 @@ class Invoice {
data['addressee_phone'] = this.addresseePhone;
data['addressee_address'] = this.addresseeAddress;
data['code'] = this.code;
data['images'] = this.images;
return data;
}
}
... ...
... ... @@ -302,11 +302,15 @@ class HttpUrl {
"?service=App.Banquet.GetBanquetDeposit"; //获取宴会定金
static const String del_banquet_deposit =
"?service=App.Banquet.DelBanquetDeposit"; //删除宴会定金
static const String set_warrant =
"?service=App.Banquet.SetWarrant"; //设置担保人
static const String get_banquet_by_id =
static const String set_warrant = "?service=App.Banquet.SetWarrant"; //设置担保人
static const String get_banquet_by_id =
"?service=App.Banquet.GetBanquetById"; //获取宴会详情
static const String set_banquet_contract =
"?service=App.Banquet.SetBanquetContract"; //设置合同信息
static const String set_invoice =
"?service=App.Banquet.SetInvoice"; //设置、修改、删除发票
static const String del_banquet_info =
"?service=App.Banquet.DelBanquetInfo"; //删除场次
}
... ...
... ... @@ -83,6 +83,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
List<DsoltXt> dsoltList = [];
UserModel userModel;
Map<String, List<CookByIdSetmeal>> dataMenu = {};
Map<String, String> invoice; //发票
@override
void initState() {
... ... @@ -104,12 +105,17 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
bus.on("feast_deposit_list", (arg) {
_getBanquetDeposit();
});
bus.on("feast_qy_list", (arg) {
_getBanquetById();
});
}
@override
void dispose() {
super.dispose();
bus.off('feast_deposit_list');
bus.off('feast_qy_list');
feastModel.rid = null;
feastModel.type = null;
feastModel.reserve = null;
... ... @@ -179,8 +185,18 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
///获取宴会详情
_getBanquetById() async {
Map<String, String> pramas = {'rid': '64'}; //feastModel.rid
await feastModel.getBanquetById(context, pramas);
Map<String, String> pramas = {'rid': feastModel.rid}; //
bool success = await feastModel.getBanquetById(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(() {});
}
}
///获取宴会分类
... ... @@ -297,16 +313,16 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
Widget menuBtn(String title, {GestureTapCallback onTap}) {
return InkWell(
onTap: () {
// if (menuSet.contains(title)) {
setState(() {
selectMenu = title;
});
if (title == '签约') {
feastModel.pageStateBanquet = PageState.Loading;
feastModel.notifyListeners();
_getBanquetById();
if (menuSet.contains(title)) {
setState(() {
selectMenu = title;
});
if (title == '签约') {
feastModel.pageStateBanquet = PageState.Loading;
feastModel.notifyListeners();
_getBanquetById();
}
}
// }
},
child: Container(
width: w(40),
... ... @@ -1086,7 +1102,9 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
height: h(33),
child: ListView.builder(
padding: EdgeInsets.only(left: w(21), right: w(9)),
itemCount: xuantaiData.length + 1,
itemCount: xuantaiData.length == 5
? xuantaiData.length
: xuantaiData.length + 1,
shrinkWrap: true,
scrollDirection: Axis.horizontal,
itemBuilder: (BuildContext contxt, int index) {
... ... @@ -1208,11 +1226,46 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
gradientStart: MyColours.color_E34D59,
gradientEnd: MyColours.color_E34D59,
onPressed: () async {
xuantaiData.removeAt(xuantaiSelIndex);
if (feastModel.sessionsSunModelList !=
null &&
feastModel.sessionsSunModelList
.map((element) {
return element.id;
})
.toList()
.contains(
xuantaiData[xuantaiSelIndex]
.reserveId)) {
//该场次已经提交到接口,删除场次的同时,删除本地数据
feastModel.sessionsSunModelList
.removeWhere((element) {
element.id ==
xuantaiData[xuantaiSelIndex]
.reserveId;
});
// 调用接口删除
Map<String, String> pramas = {
'rid': feastModel.rid,
'id': xuantaiData[xuantaiSelIndex]
.reserveId
};
bool success = await feastModel
.delBanquetInfo(context, pramas);
if (success) {
//删除成功
xuantaiData.removeAt(xuantaiSelIndex);
xuantaiSelIndex--; //删除后,选中前一个
setState(() {});
}
} else {
xuantaiData.removeAt(xuantaiSelIndex);
xuantaiSelIndex--; //删除后,选中前一个
xuantaiSelIndex--; //删除后,选中前一个
setState(() {});
setState(() {});
}
}))
: SizedBox(),
VEmptyView(36),
... ... @@ -1434,6 +1487,10 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
// _homeEnterModel.nameController.text =
// nameStr + _nameSuffix();
// _addNameSuffix(nameStr, sexStr);
FocusScope.of(context)
.requestFocus(
FocusNode());
},
keyboardType:
TextInputType.number)),
... ... @@ -1789,12 +1846,12 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
dateData += ymd;
}
if (dateData.length > 0) {
dateData += ' ${feastModel.reserve}';
dateData += ' ${feastModel.reserve ?? ''}';
} else {
dateData += '${feastModel.reserve}';
dateData += '${feastModel.reserve ?? ''}';
}
dateData += ' ${feastModel.type}';
dateData += ' ${feastModel.type ?? ''}';
Map temp = {};
if (xuantaiData[xuantaiSelIndex]
... ... @@ -2526,14 +2583,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
///第一场 。第二场。。。。
Widget sessionsWidget(String title, SessionsInfo sessionsInfo) {
int tableNum = 0;
List<String> temp = sessionsInfo.tableInfo.split('、');
temp.forEach((element) {
int start = element.indexOf('(');
int end = element.length - 2;
String numstr = element.substring(start + 1, end);
tableNum += int.parse(numstr);
});
// int tableNum = 0;
// List<String> temp = sessionsInfo.tableInfo.split('、');
// temp.forEach((element) {
// int start = element.indexOf('(');
// int end = element.length - 2;
// String numstr = element.substring(start + 1, end);
// tableNum += int.parse(numstr);
// });
return Container(
margin: EdgeInsets.only(bottom: h(26)),
decoration: BoxDecoration(
... ... @@ -2562,7 +2619,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
child: Column(
children: [
baseInfoItem('场次时间:', sessionsInfo.rdate),
baseInfoItem('桌位数量:', '共 ${tableNum} 桌'),
baseInfoItem('桌位数量:', '共 ${sessionsInfo.tableNum ?? 0} 桌'),
baseInfoItem('桌位信息:', sessionsInfo.tableInfo),
Padding(
padding: EdgeInsets.symmetric(vertical: h(6)),
... ... @@ -2618,7 +2675,61 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
gradientEnd:
MyColours.color_438E93,
onPressed: () {
// NavigatorUtil.goFeastSetmealPage(context);
// String tableData = '';
// if (data.pnumC.text
// .trim()
// .length >
// 0) {
// tableData +=
// '${data.pnumC.text}人/桌';
// }
// if (data.minC.text
// .trim()
// .length >
// 0) {
// tableData +=
// ' 保证 ${data.minC.text} 桌';
// }
// if (data.spareC.text
// .trim()
// .length >
// 0) {
// tableData +=
// ' 备用 ${data.spareC.text} 桌';
// }
// if (data.dataMenu != null &&
// data.dataMenu.length >
// 0) {
// await NavigatorUtil
// .goFeastMenuShowPage(
// context,
// data.setmealId,
// data.name,
// widget.dateData,
// tableData,
// justSelData: {
// 'object':
// data.dataMenu
// });
// } else {
// await NavigatorUtil
// .goFeastMenuShowPage(
// context,
// data.setmealId,
// data.name,
// widget.dateData,
// tableData);
// }
NavigatorUtil
.goFeastMenuQYShowPage(
context,
object: {
'object':
setmealDetail
.cooklist
});
},
),
],
... ... @@ -2726,6 +2837,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
// if (!Utils.isNumeric(costInfoModel.discountC.text)) {
// costInfoModel.totalPrice = costInfoModel.sumPrice;
// }
total = sum;
}
if (Utils.isNumeric(costInfoModel.discountC.text)) {
//输入的是数字,计算金额
... ... @@ -3298,7 +3410,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
),
HEmptyView(12),
Text(
'${feastModel.banquetDetail.contractInfo.contractTotalPrice} 元',
'${feastModel.banquetDetail.contractInfo.contractTotalPrice ?? '0'} 元',
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
... ... @@ -3364,11 +3476,14 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
],
),
VEmptyView(48),
_titleAndtextfield('客户签约人:', null, null),
_titleAndtextfield('客户签约人:',
feastModel.banquetDetail.contractInfo.customerC, null),
VEmptyView(48),
_titleAndtextfield('店方签约人:', null, null),
_titleAndtextfield('店方签约人:',
feastModel.banquetDetail.contractInfo.storeC, null),
VEmptyView(48),
_titleAndtextfield('合同编号:', null, null),
_titleAndtextfield(
'合同编号:', feastModel.banquetDetail.contractInfo.numC, null),
VEmptyView(48),
Consumer<UploadImageProvider>(builder: (context, model, _) {
return ImgPickerFWidget(
... ... @@ -3543,8 +3658,27 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
fontSize: ScreenUtil().setSp(28)),
),
InkWell(
onTap: () {
NavigatorUtil.goFeastInvoicePage(context);
onTap: () async {
Map temp = {};
if (feastModel.banquetDetail.invoice == null ||
feastModel.banquetDetail.invoice.unitName ==
null) {
temp = await NavigatorUtil.goFeastInvoicePage(
context,
);
} else {
temp = await NavigatorUtil.goFeastInvoicePage(
context,
invoice: feastModel.banquetDetail.invoice);
}
if (temp == null) {
} else if (temp['object'].length == 0) {
} else {
feastModel.banquetDetail.invoice =
Invoice.fromJson(temp['object']);
setState(() {});
}
},
child: Text(
'编辑',
... ... @@ -3555,42 +3689,65 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
)),
],
),
VEmptyView(42),
Container(
padding: EdgeInsets.symmetric(vertical: w(8)),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1), color: MyColours.color_DBDBDB))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'纳极(北京)科技有限公司',
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
VEmptyView(16),
Text(
'增值税普通发票',
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
),
],
feastModel.banquetDetail.invoice == null ||
feastModel.banquetDetail.invoice.unitName == null
? SizedBox()
: Container(
margin: EdgeInsets.only(top: w(31)),
padding: EdgeInsets.only(
top: w(8),
bottom: w(8),
),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
width: w(1),
color: MyColours.color_DBDBDB))),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
feastModel.banquetDetail.invoice.unitName,
style: TextStyle(
fontWeight: FontWeight.bold,
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
),
VEmptyView(16),
Text(
feastModel.banquetDetail.invoice
.invoiceType ==
'1'
? '增值税普通发票'
: '增值税专用发票',
style: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(24)),
),
],
),
InkWell(
onTap: () {
//弹框确认是否删除
DialogUtil.cupertinoAlertDialog(context,
title: "",
content: "是否确定删除?",
isBoldContent: true,
contentColor: MyColours.color_E6000000,
rTitle: "删除", rCallback: () {
feastModel.banquetDetail.invoice = null;
setState(() {});
});
},
child: Image.asset(
Utils.getImgPath('f_delete_red'),
width: w(20))),
],
),
),
InkWell(
onTap: () {},
child: Image.asset(Utils.getImgPath('f_delete_red'),
width: w(20))),
],
),
),
VEmptyView(48),
Consumer<UploadImageProvider>(builder: (context, model, _) {
return ImgPickerFWidget(
... ... @@ -3808,12 +3965,26 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {
selectMenu = '签约';
menuSet.add('定金');
menuSet.add('签约');
setState(() {});
onPress: () async {
// selectMenu = '签约';
// menuSet.add('定金');
// menuSet.add('签约');
// setState(() {});
for (UploadImgModel item in _uploadImageProvider
.feastRemarkContractImageList) {
if (item.process < 1) {
Utils.showToast('正在上传图片,请稍等');
return false;
}
}
for (UploadImgModel item in _uploadImageProvider
.feastRemarkInvoiceImageList) {
if (item.process < 1) {
Utils.showToast('正在上传图片,请稍等');
return false;
}
}
_setData();
},
content: '保存',
hasLeftBorder: true,
... ... @@ -3827,6 +3998,90 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
]);
}
///设置合同信息
Future<bool> _setBanquetContract() async {
List imageQiniuUrlList = []; //接口图片数据list
for (int i = 0;
i < _uploadImageProvider.feastRemarkContractImageList.length;
i++) {
imageQiniuUrlList.add({
"url": _uploadImageProvider.feastRemarkContractImageList[i].qiniuUrl
});
}
Map<String, String> params = {
'rid': feastModel.rid, //'64'
'contract_total_price':
feastModel.banquetDetail.contractInfo.contractTotalPrice,
'contract_final_price':
feastModel.banquetDetail.contractInfo.contractFinalPriceC.text,
'contract_rname': feastModel.banquetDetail.contractInfo.customerC.text,
'contract_seller_name': feastModel.banquetDetail.contractInfo.storeC.text,
'contract_no': feastModel.banquetDetail.contractInfo.numC.text,
'contract_images': json.encode(imageQiniuUrlList)
};
bool success = await feastModel.setBanquetContract(context, params);
if (success) {
return true;
} else {
return false;
}
}
///
Future<bool> _setInvoice() async {
if (feastModel.banquetDetail.invoice == null) {
feastModel.banquetDetail.invoice = Invoice();
}
List imageQiniuUrlListInvoice = []; //接口图片数据list
for (int i = 0;
i < _uploadImageProvider.feastRemarkInvoiceImageList.length;
i++) {
imageQiniuUrlListInvoice.add({
"url": _uploadImageProvider.feastRemarkInvoiceImageList[i].qiniuUrl
});
}
if (imageQiniuUrlListInvoice.length > 0) {
feastModel.banquetDetail.invoice.images = [];
imageQiniuUrlListInvoice.forEach((v) {
feastModel.banquetDetail.invoice.images.add(new ImagesById.fromJson(v));
});
}
Map<String, String> pramas = {
'rid': feastModel.rid,
'data': json.encode(feastModel.banquetDetail.invoice.toJson())
};
bool success = await feastModel.setInvoice(context, pramas);
if (success) {
return true;
} else {
return false;
}
}
_setData() async {
await Future.wait<bool>([_setBanquetContract(), _setInvoice()])
.then((results) {
print(results[0]);
if (results[0] && results[1]) {
//成功
Utils.showToast('保存成功');
} else {
if (!results[0]) {
// Utils.showToast('');
} else {
// Utils.showToast('');
}
}
}).catchError((e) {
print(e);
});
}
Widget taocanTextType(String per1, String title, String per) {
return RichText(
textScaleFactor: 1,
... ...
import 'dart:convert';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_picker/Picker.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/models/get_banquet_by_id_new_model.dart';
import 'package:one_key/provider/feast_model.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../res/colors.dart';
import '../../utils/dialog_util.dart';
import '../../utils/event_bus.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/h_empty_view.dart';
... ... @@ -16,7 +22,8 @@ import '../../widgets/system_app_bar.dart';
* 编辑发票
*/
class FeastInvoicePage extends StatefulWidget {
FeastInvoicePage({Key key}) : super(key: key);
final Invoice invoice;
FeastInvoicePage({Key key, this.invoice}) : super(key: key);
@override
_FeastInvoicePageState createState() => _FeastInvoicePageState();
... ... @@ -24,12 +31,43 @@ class FeastInvoicePage extends StatefulWidget {
class _FeastInvoicePageState extends State<FeastInvoicePage> {
bool type = true; //默认--增值税普通发票
TextEditingController priceC = TextEditingController(); //开票金额
TextEditingController unitNameC = TextEditingController(); //单位全称
TextEditingController numC = TextEditingController(); //税号
TextEditingController addressC = TextEditingController(); //地址
TextEditingController phoneC = TextEditingController(); //电话
TextEditingController bankC = TextEditingController(); //开户行
TextEditingController bankNumC = TextEditingController(); //开户行账号
TextEditingController mailC = TextEditingController(); //邮箱
TextEditingController addresseeC = TextEditingController(); //收件人
TextEditingController addresseePhoneC = TextEditingController(); //收件人电话
TextEditingController addresseeAddressC = TextEditingController(); // 收件人地址
TextEditingController codeC = TextEditingController(); //邮编
FeastModel feastModel;
@override
void initState() {
// TODO: implement initState
super.initState();
Utils.changeStatusColor(color: MyColours.color_438E93);
if (widget.invoice != null) {
type = widget.invoice.invoiceType == '1' ? true : false; //默认--增值税普通发票
priceC.text = widget.invoice.price; // 开票金额
unitNameC.text = widget.invoice.unitName;
numC.text = widget.invoice.numStr;
addressC.text = widget.invoice.address;
phoneC.text = widget.invoice.phone;
bankC.text = widget.invoice.bank;
bankNumC.text = widget.invoice.bankNum;
mailC.text = widget.invoice.mail;
addresseeC.text = widget.invoice.addressee;
addresseePhoneC.text = widget.invoice.addresseePhone;
addresseeAddressC.text = widget.invoice.addresseeAddress;
codeC.text = widget.invoice.code;
}
WidgetsBinding.instance.addPostFrameCallback((_) {});
}
... ... @@ -38,7 +76,7 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
///输入框
Widget _textfield(
String title,
// TextEditingController editingController,
TextEditingController editingController,
// FocusNode focusNode,
String subTitle,
{TextInputType inputType = TextInputType.text,
... ... @@ -85,7 +123,7 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
// height: ScreenUtil().setHeight(120),
height: ScreenUtil().setWidth(64),
child: TextField(
// controller: editingController,
controller: editingController,
// textAlign: TextAlign.right,
// textAlignVertical: TextAlignVertical.bottom,
maxLines: 1,
... ... @@ -257,11 +295,13 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
}
///单选按钮
Widget radioBtn(String title, bool select) {
Widget radioBtn(
String title,
bool select,
GestureTapCallback onTap,
) {
return InkWell(
onTap: () {
// setsta
},
onTap: onTap,
child: Row(
children: [
Image.asset(
... ... @@ -282,6 +322,7 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
@override
Widget build(BuildContext context) {
feastModel = Provider.of<FeastModel>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
... ... @@ -305,34 +346,48 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
radioBtn('增值税普通发票', type),
radioBtn('增值税专用发票', !type),
radioBtn('增值税普通发票', type, () {
if (type) {
return;
}
setState(() {
type = !type;
});
}),
radioBtn('增值税专用发票', !type, () {
if (!type) {
return;
}
setState(() {
type = !type;
});
}),
],
),
VEmptyView(80),
_textfield('开票金额', '元', need: true),
_textfield('开票金额', priceC, '元', need: true),
VEmptyView(40),
_textfield('单位全称', '', need: true),
_textfield('单位全称', unitNameC, '', need: true),
VEmptyView(40),
_textfield('纳税人识别号', '', need: true),
_textfield('纳税人识别号', numC, '', need: true),
VEmptyView(40),
_textfield('注册地址', ''),
_textfield('注册地址', addressC, '', need: !type),
VEmptyView(40),
_textfield('注册电话', ''),
_textfield('注册电话', phoneC, '', need: !type),
VEmptyView(40),
_textfield('开户银行', ''),
_textfield('开户银行', bankC, '', need: !type),
VEmptyView(40),
_textfield('银行账号', ''),
_textfield('银行账号', bankNumC, '', need: !type),
VEmptyView(40),
_textfield('电子邮箱', ''),
_textfield('电子邮箱', mailC, ''),
VEmptyView(40),
_textfield('收件人', ''),
_textfield('收件人', addresseeC, ''),
VEmptyView(40),
_textfield('收件人电话', ''),
_textfield('收件人电话', addresseePhoneC, ''),
VEmptyView(40),
_textfield('收件地址', ''),
_textfield('收件地址', addresseeAddressC, ''),
VEmptyView(40),
_textfield('邮编', ''),
_textfield('邮编', codeC, ''),
VEmptyView(40),
],
)),
... ... @@ -349,7 +404,56 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {},
onPress: () async {
if (priceC.text.trim().length == 0) {
Utils.showToast('请输入开票金额');
return;
}
if (unitNameC.text.trim().length == 0) {
Utils.showToast('请输入单位全称');
return;
}
if (numC.text.trim().length == 0) {
Utils.showToast('请输入纳税人识别号');
return;
}
if (!type) {
//专用发票
if (addressC.text.trim().length == 0) {
Utils.showToast('请输入注册地址');
return;
}
if (phoneC.text.trim().length == 0) {
Utils.showToast('请输入注册电话');
return;
}
if (bankC.text.trim().length == 0) {
Utils.showToast('请输入开户银行');
return;
}
if (bankNumC.text.trim().length == 0) {
Utils.showToast('请输入银行账号');
return;
}
}
Map<String, String> map = {
"invoice_type": type ? '1' : '2',
"price": priceC.text,
"unit_name": unitNameC.text,
"num": numC.text,
"address": addressC.text,
"phone": phoneC.text,
"bank": bankC.text,
"bank_num": bankNumC.text,
"mail": mailC.text,
"addressee": addresseeC.text,
"addressee_phone": addresseePhoneC.text,
"addressee_address": addresseeAddressC.text,
"code": codeC.text
};
Navigator.pop(context, {'object': map});
},
content: '保存并返回',
hasLeftBorder: true,
isSelect: true))
... ...
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../../models/get_banquet_by_id_new_model.dart';
import '../../res/colors.dart';
import '../../utils/screen_util.dart';
import '../../utils/utils.dart';
import '../../widgets/h_empty_view.dart';
import '../../widgets/system_app_bar.dart';
class FeastQYMenuPage extends StatefulWidget {
final List<CooklistByid> cookListData;
FeastQYMenuPage({Key key, this.cookListData}) : super(key: key);
@override
_FeastQYMenuPageState createState() => _FeastQYMenuPageState();
}
class _FeastQYMenuPageState extends State<FeastQYMenuPage> {
@override
void initState() {
// TODO: implement initState
super.initState();
Utils.changeStatusColor(color: MyColours.color_438E93);
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar(
'查看菜单',
needWhite: true,
bgColor: MyColours.color_438E93,
titleColor: MyColours.color_F6F6F6,
onTap: () {
Navigator.pop(context);
},
),
body: ListView.builder(
shrinkWrap: true,
padding: EdgeInsets.symmetric(horizontal: w(16), vertical: w(24)),
itemCount: widget.cookListData.length,
itemBuilder: (BuildContext context, int index) {
return Container(
margin: new EdgeInsets.only(bottom: h(12)),
padding: EdgeInsets.only(bottom: w(12)),
decoration: BoxDecoration(
color: MyColours.color_ffffff,
border: Border(
bottom: BorderSide(
width: w(0.5), color: MyColours.color_DBDBDB))),
child: new GestureDetector(
onTap: () {
// _gotoProjectDetail(projectModelList[index]);
},
child: new Container(
color: MyColours.color_ffffff,
child: Row(
children: [
Container(
width: h(119),
child: Text(
widget.cookListData[index].cname,
overflow: TextOverflow.ellipsis,
maxLines: 10,
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(32)),
)),
// HEmptyView(16),
// Container(
// width: h(36),
// child: Text(
// '${setmeal.spec}',
// overflow: TextOverflow.ellipsis,
// maxLines: 1,
// style: TextStyle(
// color: MyColours.color_515151,
// fontSize: ScreenUtil().setSp(32)),
// )),
],
)),
),
);
},
));
}
}
... ...
... ... @@ -184,6 +184,37 @@ class FeastModel extends ChangeNotifier {
}
}
///删除场次
Future<dynamic> delBanquetInfo(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.del_banquet_info,
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'];
if (baseResp.responseData['data'] is List) {
sessionsSunModelList =
SessionsModel.fromJson(baseResp.responseData).data;
}
return true;
// } else {
// return false;
// }
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
return false;
}
}
///添加定金
Future<dynamic> setBanquetDeposit(
BuildContext context, Map<String, String> params,
... ... @@ -341,6 +372,59 @@ class FeastModel extends ChangeNotifier {
}
}
///设置合同信息
Future<dynamic> setBanquetContract(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_banquet_contract,
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> setInvoice(BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_invoice,
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;
}
}
/***
*
* 宴会员工
... ...
... ... @@ -26,6 +26,7 @@ import 'package:one_key/utils/utils.dart';
import 'package:sqflite/sqlite_api.dart';
import '../app.dart';
import '../models/get_banquet_by_id_new_model.dart';
import '../models/get_banquet_deposit_model.dart';
import '../models/otherset_model.dart';
import '../models/set_xuan_tai_model.dart';
... ... @@ -921,8 +922,13 @@ class NavigatorUtil {
///宴会----添加发票
static Future<dynamic> goFeastInvoicePage(BuildContext context,
{replace = false, bool onlyShow = false}) {
return _navigateTo(context, "${Routes.feast_invoice_page}",
{replace = false, bool onlyShow = false, Invoice invoice}) {
if (invoice != null) {
return _navigateTo(context,
"${Routes.feast_invoice_page}?invoice=${FluroConvertUtils.object2string(invoice)}",
replace: replace);
}
return _navigateTo(context, "${Routes.feast_invoice_page}?",
replace: replace);
}
... ... @@ -1053,4 +1059,17 @@ class NavigatorUtil {
"${Routes.feast_menu_show_page}?setmealId=$setmealId&object=${FluroConvertUtils.object2string(justSelData)}&mealName=${Uri.encodeComponent(mealName)}&dateData=${Uri.encodeComponent(dateData)}&needtable=${Uri.encodeComponent(needtable)}",
replace: replace);
}
///宴会--签约--菜单信息
static Future<dynamic> goFeastMenuQYShowPage(BuildContext context,
{replace = false, bool onlyShow = false, Map object}) {
if (object == null) {
return _navigateTo(context, "${Routes.feast_qy_menu_show_page}",
replace: replace);
}
return _navigateTo(context,
"${Routes.feast_qy_menu_show_page}?object=${FluroConvertUtils.object2string(object)}",
replace: replace);
}
}
... ...
... ... @@ -148,6 +148,7 @@ import 'package:one_key/utils/fluro_convert_utils.dart';
import 'package:one_key/utils/utils.dart';
import 'package:provider/provider.dart';
import '../models/get_banquet_by_id_new_model.dart';
import '../models/set_xuan_tai_model.dart';
import '../models/setmeal_by_id_model.dart';
import '../pages/feast/feast_board.dart';
... ... @@ -158,6 +159,7 @@ import '../pages/feast/feast_followup_page.dart';
import '../pages/feast/feast_invoice_page.dart';
import '../pages/feast/feast_menu_page.dart';
import '../pages/feast/feast_menu_show_page.dart';
import '../pages/feast/feast_qy_menu_show_page.dart';
import '../pages/feast/feast_set_page.dart';
import '../pages/feast/feast_setmeal_page.dart';
import '../pages/feast/feast_wine_page.dart';
... ... @@ -1481,8 +1483,13 @@ var feastInvoicePageHandle = new Handler(
// String uids = params["uids"].first;
// bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
Invoice invoice;
if (params.keys.contains('invoice')) {
invoice = Invoice.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(params["invoice"].first)));
}
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(), child: FeastInvoicePage());
create: (_) => FeastModel(), child: FeastInvoicePage(invoice: invoice));
});
///宴会---宴会管理
... ... @@ -1706,3 +1713,24 @@ var feastMenuShowPageHandle = new Handler(
needtable: needtable,
));
});
///宴会----签约菜单信息
var feastQYMenuPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
List<CooklistByid> cook = [];
if (params.keys.contains('object')) {
Map object = FluroConvertUtils.string2map(params["object"].first);
List temp = object['object'];
for (var item in temp) {
cook.add(CooklistByid.fromJson(item));
}
}
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(),
child: FeastQYMenuPage(
cookListData: cook,
));
});
... ...
... ... @@ -151,7 +151,8 @@ class Routes {
"/feast_select_table_page"; //宴会-----新建宴会---选择桌位
static String feast_menu_show_page =
"/feast_menu_show_page"; //宴会-----新建宴会---菜单信息
static String feast_qy_menu_show_page =
"/feast_qy_menu_show_page"; //宴会-----新建宴会---签约菜单信息
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
... ... @@ -303,8 +304,9 @@ class Routes {
router.define(feast_deposit_data_page, handler: feastDepositDataPageHandle);
router.define(feast_select_table_page, handler: feastSelectTablePageHandle);
router.define(feast_menu_show_page, handler: feastMenuShowPageHandle);
router.define(feast_menu_show_page, handler: feastMenuShowPageHandle);
router.define(feast_qy_menu_show_page, handler: feastQYMenuPageHandle);
}
}
... ...