Commit 9a1fc06fc9904a088b54c55eb52c9436f8191a6d

Authored by wdn127929
1 parent 7560b5b7

签约部分

class GetBanquetByIdModel {
int ret;
GetBanquetByIdSunModel data;
String msg;
GetBanquetByIdModel({this.ret, this.data, this.msg});
GetBanquetByIdModel.fromJson(Map<String, dynamic> json) {
ret = json['ret'];
data = json['data'] != null
? new GetBanquetByIdSunModel.fromJson(json['data'])
: null;
msg = json['msg'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ret'] = this.ret;
if (this.data != null) {
data['data'] = this.data.toJson();
}
data['msg'] = this.msg;
return data;
}
}
class GetBanquetByIdSunModel {
BasicInfo basicInfo;
List<SessionsInfo> sessionsInfo;
ContractInfo contractInfo;
String invoice;
GetBanquetByIdSunModel(
{this.basicInfo, this.sessionsInfo, this.contractInfo, this.invoice});
GetBanquetByIdSunModel.fromJson(Map<String, dynamic> json) {
basicInfo = json['basic_info'] != null
? new BasicInfo.fromJson(json['basic_info'])
: null;
if (json['sessions_info'] != null) {
sessionsInfo = <SessionsInfo>[];
json['sessions_info'].forEach((v) {
sessionsInfo.add(new SessionsInfo.fromJson(v));
});
}
contractInfo = json['contract_info'] != null
? new ContractInfo.fromJson(json['contract_info'])
: null;
invoice = json['invoice'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.basicInfo != null) {
data['basic_info'] = this.basicInfo.toJson();
}
if (this.sessionsInfo != null) {
data['sessions_info'] = this.sessionsInfo.map((v) => v.toJson()).toList();
}
if (this.contractInfo != null) {
data['contract_info'] = this.contractInfo.toJson();
}
data['invoice'] = this.invoice;
return data;
}
}
class BasicInfo {
String ddate;
String rname;
String sex;
String phone;
String remark;
Jiedan jiedan;
Jiedan staff;
String classify;
BasicInfo(
{this.ddate,
this.rname,
this.sex,
this.phone,
this.remark,
this.jiedan,
this.staff,
this.classify});
BasicInfo.fromJson(Map<String, dynamic> json) {
ddate = json['ddate'];
rname = json['rname'];
sex = json['sex'];
phone = json['phone'];
remark = json['remark'];
jiedan =
json['jiedan'] != null ? new Jiedan.fromJson(json['jiedan']) : null;
staff = json['staff'] != null ? new Jiedan.fromJson(json['staff']) : null;
classify = json['classify'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ddate'] = this.ddate;
data['rname'] = this.rname;
data['sex'] = this.sex;
data['phone'] = this.phone;
data['remark'] = this.remark;
if (this.jiedan != null) {
data['jiedan'] = this.jiedan.toJson();
}
if (this.staff != null) {
data['staff'] = this.staff.toJson();
}
data['classify'] = this.classify;
return data;
}
}
class Jiedan {
String nickName;
String account;
Jiedan({this.nickName, this.account});
Jiedan.fromJson(Map<String, dynamic> json) {
nickName = json['nick_name'];
account = json['account'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['nick_name'] = this.nickName;
data['account'] = this.account;
return data;
}
}
class SessionsInfo {
String id;
String rid;
String reserveOrder;
String ddateInterval;
String rdate;
String tids;
String setmeal;
String wine;
String other;
dynamic remark;
String images;
dynamic serviceType;
dynamic servicePer;
dynamic servicePrice;
dynamic discountType;
dynamic discountPer;
dynamic discountPrice;
SessionsInfo(
{this.id,
this.rid,
this.reserveOrder,
this.ddateInterval,
this.rdate,
this.tids,
this.setmeal,
this.wine,
this.other,
this.remark,
this.images,
this.serviceType,
this.servicePer,
this.servicePrice,
this.discountType,
this.discountPer,
this.discountPrice});
SessionsInfo.fromJson(Map<String, dynamic> json) {
id = json['id'];
rid = json['rid'];
reserveOrder = json['reserve_order'];
ddateInterval = json['ddate_interval'];
rdate = json['rdate'];
tids = json['tids'];
setmeal = json['setmeal'];
wine = json['wine'];
other = json['other'];
remark = json['remark'];
images = json['images'];
serviceType = json['service_type'];
servicePer = json['service_per'];
servicePrice = json['service_price'];
discountType = json['discount_type'];
discountPer = json['discount_per'];
discountPrice = json['discount_price'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['rid'] = this.rid;
data['reserve_order'] = this.reserveOrder;
data['ddate_interval'] = this.ddateInterval;
data['rdate'] = this.rdate;
data['tids'] = this.tids;
data['setmeal'] = this.setmeal;
data['wine'] = this.wine;
data['other'] = this.other;
data['remark'] = this.remark;
data['images'] = this.images;
data['service_type'] = this.serviceType;
data['service_per'] = this.servicePer;
data['service_price'] = this.servicePrice;
data['discount_type'] = this.discountType;
data['discount_per'] = this.discountPer;
data['discount_price'] = this.discountPrice;
return data;
}
}
class CostInfoModel {
String title;
CostInfoSunModel costInfoSunModel;
//服务费
// 优惠金额
}
class CostInfoSunModel {
String cname;
String unitPrice;
String numStr;
int price;
CostInfoSunModel({this.cname, this.unitPrice, this.numStr, this.price});
CostInfoSunModel.fromJson(Map<String, dynamic> json) {
cname = json['cname'];
unitPrice = json['unit_price'];
numStr = json['num'];
price = json['price'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['cname'] = this.cname;
data['unit_price'] = this.unitPrice;
data['num'] = this.numStr;
data['price'] = this.price;
return data;
}
}
class ContractInfo {
String contractTotalPrice;
String contractFinalPrice;
String contractRname;
String contractSellerName;
String contractNo;
String contractImages;
ContractInfo(
{this.contractTotalPrice,
this.contractFinalPrice,
this.contractRname,
this.contractSellerName,
this.contractNo,
this.contractImages});
ContractInfo.fromJson(Map<String, dynamic> json) {
contractTotalPrice = json['contract_total_price'];
contractFinalPrice = json['contract_final_price'];
contractRname = json['contract_rname'];
contractSellerName = json['contract_seller_name'];
contractNo = json['contract_no'];
contractImages = json['contract_images'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['contract_total_price'] = this.contractTotalPrice;
data['contract_final_price'] = this.contractFinalPrice;
data['contract_rname'] = this.contractRname;
data['contract_seller_name'] = this.contractSellerName;
data['contract_no'] = this.contractNo;
data['contract_images'] = this.contractImages;
return data;
}
}
... ...
import 'package:common_utils/common_utils.dart';
class GetBanquetDepositModel {
int ret;
List<GetBanquetDepositSunModel> data;
String msg;
GetBanquetDepositModel({this.ret, this.data, this.msg});
GetBanquetDepositModel.fromJson(Map<String, dynamic> json) {
ret = json['ret'];
if (json['data'] != null) {
data = <GetBanquetDepositSunModel>[];
json['data'].forEach((v) {
data.add(new GetBanquetDepositSunModel.fromJson(v));
});
}
msg = json['msg'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['ret'] = this.ret;
if (this.data != null) {
data['data'] = this.data.map((v) => v.toJson()).toList();
}
data['msg'] = this.msg;
return data;
}
}
class GetBanquetDepositSunModel {
String id;
String sid;
String rid;
String price;
String rname;
String collectionUid;
String rtime;
String pay;
String depositId;
String no;
String nickName;
String dname;
String get ddateStr {
if (rtime.toString() == '0') {
return '';
}
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(int.parse(rtime.toString()) * 1000);
return DateUtil.formatDate(dateTime, format: DateFormats.y_mo_d);
}
GetBanquetDepositSunModel(
{this.id,
this.sid,
this.rid,
this.price,
this.rname,
this.collectionUid,
this.rtime,
this.pay,
this.depositId,
this.no,
this.nickName,
this.dname});
GetBanquetDepositSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
sid = json['sid'];
rid = json['rid'];
price = json['price'];
rname = json['rname'];
collectionUid = json['collection_uid'];
rtime = json['rtime'];
pay = json['pay'];
depositId = json['deposit_id'];
no = json['no'];
nickName = json['nick_name'];
dname = json['dname'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['sid'] = this.sid;
data['rid'] = this.rid;
data['price'] = this.price;
data['rname'] = this.rname;
data['collection_uid'] = this.collectionUid;
data['rtime'] = this.rtime;
data['pay'] = this.pay;
data['deposit_id'] = this.depositId;
data['no'] = this.no;
data['nick_name'] = this.nickName;
data['dname'] = this.dname;
return data;
}
}
... ...
... ... @@ -296,5 +296,17 @@ class HttpUrl {
"?service=App.Banquet.SetBanquetInfo"; //设置选台信息
static const String set_banquet_info_cook =
"?service=App.Banquet.SetBanquetInfoCook"; //调菜
static const String set_banquet_deposit =
"?service=App.Banquet.SetBanquetDeposit"; //添加定金
static const String get_banquet_deposit =
"?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 =
"?service=App.Banquet.GetBanquetById"; //获取宴会详情
}
... ...
... ... @@ -7,12 +7,14 @@ import 'package:flutter/gestures.dart';
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/route/navigator_util.dart';
import 'package:one_key/widgets/MyDivider.dart';
import 'package:one_key/widgets/round_button.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../constant/state.dart';
import '../../models/dsolt_xt.dart';
import '../../models/feast_menu_model.dart';
import '../../models/set_xuan_tai_model.dart';
... ... @@ -24,10 +26,12 @@ import '../../provider/user_model.dart';
import '../../res/colors.dart';
import '../../utils/ConvertNumberToChineseMoneyWords.dart';
import '../../utils/dialog_util.dart';
import '../../utils/event_bus.dart';
import '../../utils/screen_util.dart';
import '../../utils/upload_image_util.dart';
import '../../utils/utils.dart';
import '../../widgets/h_empty_view.dart';
import '../../widgets/page_exception.dart';
import '../../widgets/set_time_widget.dart';
import '../../widgets/system_app_bar.dart';
import '../online_check/img_picker_widget_f.dart';
... ... @@ -71,6 +75,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
ScrollController controller = ScrollController();
String djDBR = '请选择'; //定金担保人
int djDBRIndex; //定金担保人
UploadImageProvider _uploadImageProvider;
List<SetXuanTaiModel> xuantaiData = [];
int xuantaiSelIndex = 0;
... ... @@ -95,11 +100,15 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
_getSetmeal();
// scrollController.jumpTo(scrollController.position.minScrollExtent);
});
bus.on("feast_deposit_list", (arg) {
_getBanquetDeposit();
});
}
@override
void dispose() {
super.dispose();
bus.off('feast_deposit_list');
feastModel.rid = null;
feastModel.type = null;
feastModel.reserve = null;
... ... @@ -167,11 +176,37 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
await feastModel.getStaff(context);
}
///获取宴会详情
_getBanquetById() async {
Map<String, String> pramas = {'rid': '64'};//feastModel.rid
await feastModel.getBanquetById(context, pramas);
}
///获取宴会分类
Future<bool> _getClassify({bool isShowLoading = true}) async {
await feastModel.getClassify(context, isShowLoading: isShowLoading);
}
///获取宴会定金
Future<bool> _getBanquetDeposit({bool isShowLoading = true}) async {
Map<String, String> pramas = {'rid': feastModel.rid};
await feastModel.getBanquetDeposit(context, pramas,
isShowLoading: isShowLoading);
feastModel.notifyListeners();
}
///删除宴会定金
Future<bool> _delBanquetDeposit(String id,
{bool isShowLoading = true}) async {
Map<String, String> pramas = {'id': id};
bool success = await feastModel.delBanquetDeposit(context, pramas,
isShowLoading: isShowLoading);
if (success) {
_getBanquetDeposit();
feastModel.notifyListeners();
}
}
// ///获取宴会套餐
// Future<bool> _getSetmeal({bool isShowLoading = true}) async {
// bool success =
... ... @@ -261,11 +296,16 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
Widget menuBtn(String title, {GestureTapCallback onTap}) {
return InkWell(
onTap: () {
if (menuSet.contains(title)) {
setState(() {
selectMenu = title;
});
// if (menuSet.contains(title)) {
setState(() {
selectMenu = title;
});
if (title == '签约') {
feastModel.pageStateBanquet = PageState.Loading;
feastModel.notifyListeners();
_getBanquetById();
}
// }
},
child: Container(
width: w(40),
... ... @@ -1170,7 +1210,7 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
xuantaiData.removeAt(xuantaiSelIndex);
xuantaiSelIndex--; //删除后,选中前一个
setState(() {});
}))
: SizedBox(),
... ... @@ -2086,6 +2126,42 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
);
}
/// 选台保存接口
Future<bool> dbSave() async {
if (djDBRIndex == null) {
Utils.showToast('请选择担保人');
return false;
}
for (UploadImgModel item in _uploadImageProvider.feastRemarkDjImageList) {
if (item.process < 1) {
Utils.showToast('正在上传图片,请稍等');
return false;
}
}
List imageQiniuUrlList = []; //接口图片数据list
for (int i = 0;
i < _uploadImageProvider.feastRemarkDjImageList.length;
i++) {
imageQiniuUrlList.add(
{"url": _uploadImageProvider.feastRemarkDjImageList[i].qiniuUrl});
}
Map<String, String> pramas = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'rid': feastModel.rid,
'warrant_id': feastModel.sellerManageList[djDBRIndex].id,
'warrant_images': json.encode(imageQiniuUrlList),
'warrant_desc': customCdb.text
};
bool success = await feastModel.setWarrant(context, pramas);
if (success) {
return true;
} else {
return false;
}
}
///定金页面
Widget djWidget() {
return Column(
... ... @@ -2122,99 +2198,111 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
onPressed: () {
NavigatorUtil.goFeastDepositPage(context);
NavigatorUtil.goFeastDepositPage(context, feastModel.rid);
},
),
],
)),
ListView.builder(
padding: EdgeInsets.only(left: w(13), right: w(13), top: h(20)),
itemCount: 2,
itemCount: feastModel.banquetDepositData.length,
shrinkWrap: true,
controller: controller,
itemBuilder: (BuildContext context, int index) {
return Container(
height: h(110),
margin: EdgeInsets.only(bottom: h(20)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(r(5)),
border: Border.all(
width: h(1), color: MyColours.color_438E93)),
child: Column(children: [
Container(
height: h(24),
padding: EdgeInsets.only(left: w(16), right: w(8)),
GetBanquetDepositSunModel data =
feastModel.banquetDepositData[index];
return InkWell(
onTap: () {
NavigatorUtil.goFeastDepositPage(context, feastModel.rid,
isNew: false, getBanquetDepositSunModel: data);
},
child: Container(
height: h(110),
margin: EdgeInsets.only(bottom: h(20)),
decoration: BoxDecoration(
color: MyColours.color_438E93,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(r(4)),
topRight: Radius.circular(r(4))),
borderRadius: BorderRadius.circular(r(5)),
border: Border.all(
width: h(1), color: MyColours.color_438E93)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'定金1',
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_F6F6F6,
fontSize: font(14)),
),
Text(
'收据编号 SJ000001',
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_F6F6F6,
fontSize: font(12)),
child: Column(children: [
Container(
height: h(24),
padding: EdgeInsets.only(left: w(16), right: w(8)),
decoration: BoxDecoration(
color: MyColours.color_438E93,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(r(4)),
topRight: Radius.circular(r(4))),
border: Border.all(
width: h(1),
color: MyColours.color_438E93)),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'定金${index + 1}',
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_F6F6F6,
fontSize: font(14)),
),
Text(
'收据编号 ${data.no == '0' ? '' : data.no}',
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_F6F6F6,
fontSize: font(12)),
),
InkWell(
onTap: () {
//弹框确认是否删除
DialogUtil.cupertinoAlertDialog(context,
title: "",
content: "是否确定删除?",
isBoldContent: true,
contentColor:
MyColours.color_E6000000,
rTitle: "删除", rCallback: () {
_delBanquetDeposit(data.id);
});
},
child: Image.asset(
Utils.getImgPath('f_dj_delete'),
width: w(20),
))
],
),
InkWell(
onTap: () {
//弹框确认是否删除
DialogUtil.cupertinoAlertDialog(context,
title: "",
content: "是否确定删除?",
isBoldContent: true,
contentColor: MyColours.color_E6000000,
rTitle: "删除", rCallback: () {
Navigator.pop(context);
// _delGuestInfocDay(model.cday[index].id);
});
},
child: Image.asset(
Utils.getImgPath('f_dj_delete'),
width: w(20),
))
],
),
),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
HEmptyView(32),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
djTextType1('定金金额 ', '200', ' 元'),
djText('支付方式 ', '现金'),
djText('定金类型 ', '宴会定金')
],
),
HEmptyView(140),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
djText('付款时间 ', '2022-08-03'),
djText('收款人 ', '刘经理'),
djText('付款人 ', '方先生')
HEmptyView(32),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
djTextType1('定金金额 ', '${data.price}', ' 元'),
djText('支付方式 ', '${data.pay}'),
djText('定金类型 ',
'${data.dname == null ? '' : data.dname}')
],
),
HEmptyView(140),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment:
MainAxisAlignment.spaceEvenly,
children: [
djText('付款时间 ', '${data.ddateStr}'),
djText('收款人 ',
'${data.nickName == null ? '' : data.nickName}'),
djText('付款人 ', '${data.rname}')
],
)
],
)
],
))
]));
))
])));
}),
VEmptyView(62),
Padding(
... ... @@ -2237,29 +2325,19 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
InkWell(
onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
// DialogUtil.showSelectCusmanDialog(
// context,
// customerProvider.labelList.map((item) {
// return item.label;
// }).toList(), (value) {
// if (value != null) {
// setState(() {
// customerProvider.labelSelIndex =
// value.first;
// labelShow = customerProvider
// .labelList[
// customerProvider.labelSelIndex]
// .label;
// });
// }
// },
// selecteds:
// customerProvider.labelSelIndex == null
// ? []
// : [
// customerProvider.labelSelIndex
// ])
// .then((value) {});
DialogUtil.showSelectCusmanDialog(
context,
feastModel.sellerManageList.map((item) {
return item.title;
}).toList(), (value) {
if (value != null) {
setState(() {
djDBRIndex = value.first;
djDBR = feastModel.sellerManageList[djDBRIndex].title;
});
}
}, selecteds: djDBRIndex == null ? [] : [djDBRIndex])
.then((value) {});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
... ... @@ -2340,18 +2418,25 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
children: [
Expanded(
child: _callButton(
onPress: () {},
onPress: () async {
await dbSave();
},
content: '仅保存',
hasLeftBorder: true,
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {
selectMenu = '签约';
onPress: () async {
bool success = await dbSave();
if (success) {
selectMenu = '签约';
menuSet.add('定金');
menuSet.add('签约');
setState(() {});
menuSet.add('定金');
menuSet.add('签约');
setState(() {});
feastModel.pageStateBanquet = PageState.Loading;
_getBanquetById();
}
},
content: '保存并下一步',
hasLeftBorder: true,
... ... @@ -3402,56 +3487,75 @@ class _FeastCreatePageState extends State<FeastCreatePage> {
///签约
Widget qyWidget() {
return Column(children: [
Expanded(
child: SingleChildScrollView(
child: Column(children: <Widget>[
menu(),
MyDivider(double.infinity, h(1), color: MyColours.color_DBDBDB),
VEmptyView(26),
Padding(
padding: EdgeInsets.symmetric(horizontal: w(12)),
child: Column(children: [
baseInfoWidget(), //基本信息
VEmptyView(52),
//场次
ListView.builder(
itemCount: 3,
shrinkWrap: true,
controller: _scrollController,
itemBuilder: (BuildContext context, int index) {
return sessionsWidget('第${index + 1}场');
}),
//费用详情
costWidget(),
//合同
contractWidget(),
invoiceWidget()
]))
]))),
Row(
children: [
Expanded(
child: _callButton(
onPress: () {},
content: '分享宴会单',
hasLeftBorder: true,
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {
selectMenu = '签约';
menuSet.add('定金');
menuSet.add('签约');
setState(() {});
},
content: '保存',
hasLeftBorder: true,
isSelect: true))
],
)
return Column(children: <Widget>[
menu(),
MyDivider(double.infinity, h(1), color: MyColours.color_DBDBDB),
VEmptyView(26),
Expanded(child: Consumer<FeastModel>(builder: (context, model, _) {
if (model.pageStateBanquet != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateDeposit,
callback: () {
_getBanquetById();
},
emptyMsg: "暂时没有宴会详情哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Column(
children: [
Expanded(
child:
Padding(
padding: EdgeInsets.symmetric(horizontal: w(12)),
child: SingleChildScrollView(
controller: _scrollController,
child: Column(children: [
baseInfoWidget(), //基本信息
VEmptyView(52),
//场次
ListView.builder(
itemCount: 3,
shrinkWrap: true,
controller: _scrollController,
itemBuilder: (BuildContext context, int index) {
return sessionsWidget('第${index + 1}场');
}),
//费用详情
costWidget(),
//合同
contractWidget(),
invoiceWidget()
]))),
),
Row(
children: [
Expanded(
child: _callButton(
onPress: () {},
content: '分享宴会单',
hasLeftBorder: true,
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {
selectMenu = '签约';
menuSet.add('定金');
menuSet.add('签约');
setState(() {});
},
content: '保存',
hasLeftBorder: true,
isSelect: true))
],
)
],
);
}
}))
]);
}
... ...
... ... @@ -3,32 +3,44 @@ 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/filter_btn_model.dart';
import 'package:one_key/models/get_deposit_model.dart';
import 'package:one_key/route/route_handles.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../models/get_banquet_deposit_model.dart';
import '../../provider/feast_model.dart';
import '../../provider/user_model.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';
import '../../widgets/system_app_bar.dart';
/**
* 定金
*/
class FeastDepositPage extends StatefulWidget {
FeastDepositPage({Key key}) : super(key: key);
final String rid;
final GetBanquetDepositSunModel depositSunModel;
FeastDepositPage({Key key, this.rid, this.depositSunModel}) : super(key: key);
@override
_FeastDepositPageState createState() => _FeastDepositPageState();
}
class _FeastDepositPageState extends State<FeastDepositPage> {
String money = '请输入'; //金额
String paymentP = '请输入'; //付款人
String collectionP = '请选择'; //收款人
int collectionPIndex; //收款人
String paymentTime = '请选择'; //付款时间
String paymentType = '请选择'; //支付方式
List<String> payType = []; //支付方式
int payTypeIndex; //支付方式
String depositType = '请选择'; //定金类型
String receiptNumber = '请输入'; //收据编号
int depositTypeIndex; //定金类型
TextEditingController moneyC = TextEditingController();
FocusNode moneyF = FocusNode();
... ... @@ -39,12 +51,35 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
bool showDateSelWidget = false;
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
FeastModel feastModel;
@override
void initState() {
// TODO: implement initState
super.initState();
Utils.changeStatusColor(color: MyColours.color_438E93);
payType = ['现金', '刷卡', '微信', '支付宝', '转账'];
if (widget.depositSunModel != null) {
moneyC.text = widget.depositSunModel.price;
if (widget.depositSunModel.rname != '') {
paymentC.text = widget.depositSunModel.rname;
}
if (widget.depositSunModel.pay != '') {
paymentType = widget.depositSunModel.pay;
payTypeIndex = payType.indexOf(paymentType);
}
if (widget.depositSunModel.ddateStr != '') {
paymentTime = widget.depositSunModel.ddateStr;
}
if (widget.depositSunModel.nickName != null) {
collectionP = widget.depositSunModel.nickName;
}
if (widget.depositSunModel.no != '0') {
receiptNumberC.text = widget.depositSunModel.no;
}
}
moneyF.addListener(() {
if (moneyF.hasFocus) {
... ... @@ -83,7 +118,69 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
}
});
WidgetsBinding.instance.addPostFrameCallback((_) {});
WidgetsBinding.instance.addPostFrameCallback((_) {
_getDeposit();
_getSellerUserBySellerid();
});
}
///获取定金类型
Future<bool> _getDeposit({bool isShowLoading = true}) async {
await feastModel.getDeposit(context, isShowLoading: isShowLoading);
if (widget.depositSunModel.dname != null) {
List depositData = feastModel.depositData.map((item) {
return item.dname;
}).toList();
depositType = widget.depositSunModel.dname;
depositTypeIndex = depositData.indexOf(widget.depositSunModel.dname);
setState(() {});
}
}
///获取经理数据 ---- 接单人---全部员工
_getSellerUserBySellerid() async {
await feastModel.getAuthUserLists(context);
if (widget.depositSunModel.nickName != null) {
List sellerList = feastModel.sellerManageList.map((item) {
return item.title;
}).toList();
collectionPIndex = sellerList.indexOf(widget.depositSunModel.nickName);
}
}
_setBanquetDeposit() async {
if (moneyC.text.trim().length == 0) {
Utils.showToast('请输入金额');
return;
}
Map<String, String> pramas = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'rid': widget.rid,
'price': moneyC.text,
'rname': paymentC.text,
'collection_uid': collectionPIndex == null
? null
: feastModel.sellerManageList[collectionPIndex].id,
'rtime': paymentTime == '请选择'
? null
: (DateUtil.getDateTime(paymentTime).millisecondsSinceEpoch / 1000)
.floor()
.toString(),
'pay': payTypeIndex == null ? null : payType[payTypeIndex],
'deposit_id': depositTypeIndex == null
? null
: feastModel.depositData[depositTypeIndex].id,
'no': receiptNumberC.text
};
if (widget.depositSunModel != null) {
pramas['id'] = widget.depositSunModel.id;
}
bool success = await feastModel.setBanquetDeposit(context, pramas);
if (success) {
Navigator.pop(context);
bus.emit('feast_deposit_list');
}
}
///请输入
... ... @@ -299,6 +396,7 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
@override
Widget build(BuildContext context) {
feastModel = Provider.of<FeastModel>(context, listen: true);
return Scaffold(
backgroundColor: MyColours.color_ffffff,
key: scaffoldKey,
... ... @@ -320,11 +418,33 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
child: Column(
children: [
VEmptyView(50),
_textfield('金额', money, moneyC, moneyF, '元'),
_textfield('金额', '请输入', moneyC, moneyF, '元'),
VEmptyView(66),
_textfield('付款人', paymentP, paymentC, paymentF, ''),
_textfield('付款人', '请输入', paymentC, paymentF, '',
inputType: TextInputType.text),
VEmptyView(66),
_selectWidget('收款人', collectionP),
_selectWidget('收款人', collectionP, onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(
context,
feastModel.sellerManageList.map((item) {
return item.title;
}).toList(), (value) {
if (value != null) {
setState(() {
collectionPIndex = value.first;
collectionP = feastModel
.sellerManageList[collectionPIndex].title;
});
}
},
cancelText: '',
title: '选择收款人',
selecteds: collectionPIndex == null
? []
: [collectionPIndex])
.then((value) {});
}),
VEmptyView(66),
_selectWidget('付款时间', paymentTime, onTap: () {
FocusScope.of(context)
... ... @@ -355,12 +475,50 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
});
}),
VEmptyView(66),
_selectWidget('支付方式', paymentType),
_selectWidget('支付方式', paymentType, onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(context, payType,
(value) {
if (value != null) {
setState(() {
payTypeIndex = value.first;
paymentType = payType[payTypeIndex];
});
}
},
cancelText: '',
title: '选择支付方式',
selecteds:
payTypeIndex == null ? [] : [payTypeIndex])
.then((value) {});
}),
VEmptyView(66),
_selectWidget('定金类型', depositType),
_selectWidget('定金类型', depositType, onTap: () {
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
DialogUtil.showSelectCusmanDialog(
context,
feastModel.depositData.map((item) {
return item.dname;
}).toList(), (value) {
if (value != null) {
setState(() {
depositTypeIndex = value.first;
depositType = feastModel
.depositData[depositTypeIndex].dname;
});
}
},
cancelText: '',
title: '选择定金类型',
selecteds: depositTypeIndex == null
? []
: [depositTypeIndex])
.then((value) {});
}),
VEmptyView(66),
_textfield('收据编号', receiptNumber, receiptNumberC,
receiptNumberF, ''),
_textfield(
'收据编号', '请输入', receiptNumberC, receiptNumberF, '',
inputType: TextInputType.text),
],
)),
)),
... ... @@ -376,7 +534,9 @@ class _FeastDepositPageState extends State<FeastDepositPage> {
isSelect: false)),
Expanded(
child: _callButton(
onPress: () {},
onPress: () {
_setBanquetDeposit();
},
content: '保存并返回',
hasLeftBorder: true,
isSelect: true))
... ...
... ... @@ -23,6 +23,7 @@ class FeastInvoicePage extends StatefulWidget {
}
class _FeastInvoicePageState extends State<FeastInvoicePage> {
bool type = true; //默认--增值税普通发票
@override
void initState() {
// TODO: implement initState
... ... @@ -258,11 +259,13 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
///单选按钮
Widget radioBtn(String title, bool select) {
return InkWell(
onTap: () {},
onTap: () {
// setsta
},
child: Row(
children: [
Image.asset(
Utils.getImgPath(select ? 'select' : 'unselect'),
Utils.getImgPath(select ? 'f_select' : 'f_select_not'),
width: w(24),
),
HEmptyView(16),
... ... @@ -302,8 +305,8 @@ class _FeastInvoicePageState extends State<FeastInvoicePage> {
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
radioBtn('增值税普通发票', true),
radioBtn('增值税专用发票', false),
radioBtn('增值税普通发票', type),
radioBtn('增值税专用发票', !type),
],
),
VEmptyView(80),
... ...
import 'package:flutter/material.dart';
import 'package:one_key/constant/state.dart';
import 'package:one_key/models/get_banquet_by_id_model.dart';
import 'package:one_key/models/get_setmeal_class_model.dart';
import 'package:one_key/provider/user_model.dart';
import 'package:provider/provider.dart';
... ... @@ -8,6 +9,7 @@ import '../constant/constant.dart';
import '../constant/error.dart';
import '../models/classify_model.dart';
import '../models/filter_btn_model.dart';
import '../models/get_banquet_deposit_model.dart';
import '../models/get_deposit_model.dart';
import '../models/get_seller_user_by_sellerid_model.dart';
import '../models/get_setmeal_class_by_id_model.dart';
... ... @@ -67,6 +69,10 @@ class FeastModel extends ChangeNotifier {
String type; //宴会类型
List<SessionsSunModel> sessionsSunModelList; //选台提交成功后返回的场次id数据
List<GetBanquetDepositSunModel> banquetDepositData = []; //宴会定金列表数据
PageState pageStateBanquet = PageState.Loading; //宴会详情
/***
*
* 新建宴会
... ... @@ -175,6 +181,188 @@ class FeastModel extends ChangeNotifier {
}
}
///添加定金
Future<dynamic> setBanquetDeposit(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_banquet_deposit,
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> getBanquetDeposit(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_banquet_deposit,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {}
return false;
});
if (baseResp.code == Constant.status_success) {
banquetDepositData =
GetBanquetDepositModel.fromJson(baseResp.responseData).data;
// 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> delBanquetDeposit(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.del_banquet_deposit,
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> setWarrant(BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.set_warrant,
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> getBanquetById(
BuildContext context, Map<String, String> params,
{isShowLoading = true}) async {
BaseResp<dynamic> baseResp = await DioUtil()
.request<dynamic>(context, Method.get, HttpUrl.get_banquet_by_id,
data: params, showLoading: isShowLoading)
.catchError((error) {
print(error.toString());
if (error is MyError) {
switch (error.type) {
case 1:
pageStateBanquet = PageState.ConnectivityError;
break;
case 2:
pageStateBanquet = PageState.ConnectivityTimeOut;
break;
default:
pageStateBanquet = PageState.ConnectivityError;
break;
}
}
notifyListeners();
return false;
});
if (baseResp.code == Constant.status_success) {
GetBanquetByIdSunModel model =
GetBanquetByIdModel.fromJson(baseResp.responseData).data;
BasicInfo basicInfo = baseResp.data['basic_info'] != null
? new BasicInfo.fromJson(baseResp.data['basic_info'])
: null;
List<SessionsInfo> sessionsInfo = [];
List<String> keys = [];
if (baseResp.data['sessions_info'] != null) {
baseResp.data['sessions_info'].forEach((v) {
SessionsInfo temp = new SessionsInfo.fromJson(v);
sessionsInfo.add(temp);
keys.add(temp.reserveOrder);
});
}
List<CostInfoModel> costInfo = [];
if (baseResp.data['cost_info'] != null) {
Map map = baseResp.data['cost_info'];
for (String item in keys) {
map.forEach((key, value) {
CostInfoModel model = CostInfoModel();
model.title = '${key}费用';
model.costInfoSunModel = CostInfoSunModel.fromJson(value);
costInfo.add(model);
});
}
}
// if (baseResp.data == 1) {
// rid = baseResp.data['id'];
pageStateBanquet = PageState.Success;
notifyListeners();
return true;
// } else {
// return false;
// }
} else {
if (baseResp != null) {
Utils.showToast(baseResp.msg ?? "");
}
pageStateBanquet = PageState.ConnectivityError;
notifyListeners();
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_deposit_model.dart';
import '../models/otherset_model.dart';
import '../models/set_xuan_tai_model.dart';
import '../models/wine_model.dart';
... ... @@ -859,9 +860,13 @@ class NavigatorUtil {
}
///宴会----添加定金
static Future<dynamic> goFeastDepositPage(BuildContext context,
{replace = false, bool onlyShow = false}) {
return _navigateTo(context, "${Routes.feast_deposit_page}",
static Future<dynamic> goFeastDepositPage(BuildContext context, String rid,
{replace = false,
bool onlyShow = false,
bool isNew = true,
GetBanquetDepositSunModel getBanquetDepositSunModel}) {
return _navigateTo(context,
"${Routes.feast_deposit_page}?rid=$rid&getBanquetDepositSunModel=${FluroConvertUtils.object2string(getBanquetDepositSunModel)}&isNew=$isNew",
replace: replace);
}
... ...
... ... @@ -8,6 +8,7 @@ import 'package:one_key/models/cookbook_model.dart';
import 'package:one_key/models/coupon_model.dart';
import 'package:one_key/models/customer_by_seller_model.dart';
import 'package:one_key/models/customer_list_model.dart';
import 'package:one_key/models/get_banquet_deposit_model.dart';
import 'package:one_key/models/guest_info_model.dart';
import 'package:one_key/models/integral_model.dart';
import 'package:one_key/models/marketing_by_id_model.dart';
... ... @@ -1370,11 +1371,24 @@ var feastCreatePageHandle = new Handler(
///宴会----添加定金
var feastDepositPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<dynamic, List<Object>> params) {
String rid = params["rid"].first;
// String uids = params["uids"].first;
bool isNew = FluroConvertUtils.string2bool(params["isNew"].first);
if (!isNew) {
GetBanquetDepositSunModel depositSunModel =
GetBanquetDepositSunModel.fromJson(json.decode(
FluroConvertUtils.fluroCnParamsDecode(
params["getBanquetDepositSunModel"].first)));
//
// bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(),
child: FeastDepositPage(rid: rid, depositSunModel: depositSunModel));
}
// bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
return ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(), child: FeastDepositPage());
create: (_) => FeastModel(), child: FeastDepositPage(rid: rid));
});
///宴会----调菜
... ...