Commit 2c49a1dea513d105f4edbf37e99dde9bedee2f25

Authored by wdn127929
1 parent 536a7465

预订订金设置&&预订安排页订金设置

... ... @@ -1681,7 +1681,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
style: TextStyle(color: MyColours.color_515151, fontSize: font(15)),
),
Spacer(),
if(detailModel.reserveDepositList.length==0) RoundButton(
RoundButton(
text: '添加一项',
radius: r(11),
width: w(72),
... ... @@ -1777,8 +1777,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
djText('支付方式 ', '${data.payType}'),
],
),
HEmptyView(140),
Column(
Spacer(), Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
... ... @@ -1787,7 +1786,8 @@ class NotebookDetailPageState extends State<NotebookDetailPage> {
// djText('收款人 ',
// '${data.nickName == null ? '' : data.nickName}'),
],
)
),
HEmptyView(32),
],
))
])));
... ...
... ... @@ -58,6 +58,7 @@ import '../../provider/SmsModel.dart';
import '../../provider/customer_provider.dart';
import '../../provider/marketing_center_provider.dart';
import '../../provider/my_model.dart';
import '../../utils/MyNumberTextInputFormatter.dart';
import '../../utils/call_log_utils.dart';
import '../../utils/common_utils.dart';
import '../../utils/screen_util.dart';
... ... @@ -187,6 +188,10 @@ class InvicationPageState extends State<InvicationPage>
MarketingCenterProvider marketingCenterProvider;
String additionTitle = '点击设置本单追加的自定义图文';
// String paymentTitle = '选填,未填写表示无需支付订金';
TextEditingController moneyControl = TextEditingController();
FocusNode moneyFocusNode = FocusNode();
@override
void initState() {
... ... @@ -316,15 +321,42 @@ class InvicationPageState extends State<InvicationPage>
bus.on("getDzSellerConf", (args) {
getDzSellerConf();
});
bus.on("getReserveImgText", (args) {
bus.on("getReserveImgText", (args) {
getReserveImgText();
});
bus.on("refresh_invication_deposit", (args) {
_getReserveDepositByRid(); //刷新订金数据
});
// Utils.changeStatusColor(color: Colors.transparent);
user = Provider.of<UserModel>(context, listen: false).user;
}
/// 通过预订ID查收定金详情
_getReserveDepositByRid() async {
Map<String, String> params = {
'rid': widget.rid,
};
await detailModel.getReserveDepositByRid(context, params);
if (detailModel.reserveDepositList.length > 0) {
//存在在线支付订金,找到赋值,
detailModel.reserveDepositList.forEach((element) {
if (element.payType == '微信预订通知') {
moneyControl.text = element.price;
detailModel.depositId = element.id;
setState(() {});
}
});
} else {
//全局设置
moneyControl.text =
marketingCenterProvider.dzSellerConfModel.depositPrice ??
'选填,未填写表示无需支付订金';
}
}
getReserveImgText() async {
await marketingCenterProvider.getReserveImgText(context, widget.rid);
if (marketingCenterProvider.reserveImgText != null) {
... ... @@ -336,6 +368,14 @@ class InvicationPageState extends State<InvicationPage>
getDzSellerConf() async {
bool success = await marketingCenterProvider.getDzSellerConf(context);
if (success && marketingCenterProvider.dzSellerConfModel != null) {
if (marketingCenterProvider.dzSellerConfModel.isShowNoticeDeposit == '1'
// &&
// marketingCenterProvider.dzSellerConfModel.depositPrice != '0' &&
// marketingCenterProvider.dzSellerConfModel.depositPrice != null
) {
//全局设置过金额,并且开通预订方式
_getReserveDepositByRid();
}
noticeSms = marketingCenterProvider.dzSellerConfModel.isNotice == '1'
? true
: false;
... ... @@ -442,8 +482,8 @@ class InvicationPageState extends State<InvicationPage>
bus.off("refresh_invitaion_info");
bus.off("refresh_photo_invication");
bus.off("getDzSellerConf");
bus.off("getReserveImgText");
bus.off("getReserveImgText");
bus.off("refresh_invication_deposit");
WidgetsBinding.instance.removeObserver(this); //销毁观察者
if (_timer != null) {
... ... @@ -2582,16 +2622,111 @@ class InvicationPageState extends State<InvicationPage>
)
],
)),
if (marketingCenterProvider
.dzSellerConfModel.isShowNoticeDeposit ==
'1')
InkWell(
onTap: () async {
FocusScope.of(context)
.requestFocus(FocusNode()); //隐藏键盘
//跳转到新页面
// if (detailModel.reserveDepositList.length > 0) {
// //查看页面
// NavigatorUtil.goBookDepositPage(context, widget.rid,
// onlyShow: true,bookDepositModel:detailModel.reserveDepositList[0] );
// } else {
// //编辑页面
// NavigatorUtil.goBookDepositPage(
// context, detailEntity.id);
// }
},
child: Container(
margin: EdgeInsets.only(
// top: ScreenUtil().setWidth(40),
bottom: ScreenUtil().setWidth(40)),
height: ScreenUtil().setWidth(68),
padding: EdgeInsets.symmetric(
horizontal: ScreenUtil().setWidth(16)),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(
ScreenUtil().setWidth(12)),
// color: Colors.red,
border: Border.all(
width: ScreenUtil().setWidth(2),
color: MyColours.color_DBDBDB)),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
'预订订金:',
style: TextStyle(
fontSize: ScreenUtil().setSp(28),
color: MyColours.color_515151),
),
HEmptyView(40),
Expanded(
child: TextField(
controller: moneyControl,
textAlign: TextAlign.right,
textAlignVertical:
TextAlignVertical.bottom,
maxLines: 1,
inputFormatters: [
FilteringTextInputFormatter(
RegExp("[0-9.]"),
allow: true),
MyNumberTextInputFormatter(digit: 2),
],
// //光标颜色
// cursorColor:
// widget.isSelect ? Colors.white : MyColours.color_199095,
//输入文本的样式
style: TextStyle(
color: MyColours.color_515151,
fontSize: ScreenUtil().setSp(28),
),
focusNode: moneyFocusNode,
decoration: InputDecoration(
isCollapsed: true,
border: OutlineInputBorder(
borderSide: BorderSide.none),
hintText: '选填,未填写表示无需支付订金',
hintStyle: TextStyle(
color: MyColours.color_999999,
fontSize: ScreenUtil().setSp(28),
),
enabledBorder:
new UnderlineInputBorder(
borderSide: BorderSide.none,
),
focusedBorder:
new UnderlineInputBorder(
borderSide: BorderSide.none,
),
),
onChanged: (value) {},
onEditingComplete: () {
FocusScope.of(context).requestFocus(
FocusNode()); //点击空白处隐藏键盘
},
keyboardType:
TextInputType.numberWithOptions()),
),
],
))),
InkWell(
onTap: () async{
onTap: () async {
FocusScope.of(context)
.requestFocus(FocusNode()); //隐藏键盘
//跳转到新页面
await NavigatorUtil.goInvicationAdditionPage(context,
await NavigatorUtil.goInvicationAdditionPage(context,
rid: widget.rid);
},
child: Container(
margin: EdgeInsets.only(
... ... @@ -4535,6 +4670,63 @@ class InvicationPageState extends State<InvicationPage>
}
}
_createReserveDeposit() async {
if (marketingCenterProvider.dzSellerConfModel.isShowNoticeDeposit == '1') {
//页面有预订定金选项
// if( detailModel.depositId == null){
// //新建
// }else{
// // 修改或者不可编辑
// }
if (moneyControl.text != '选填,未填写表示无需支付订金' && moneyControl.text.trim().length > 0) {
Map<String, String> pramas = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'rid': widget.rid,
'price': moneyControl.text,
// 'rname': paymentC.text,
'uid': Provider.of<UserModel>(context, listen: false).user.openid,
// 'pay_time': paymentTime == '请选择'
// ? null
// : (DateUtil.getDateTime(paymentTime).millisecondsSinceEpoch / 1000)
// .floor()
// .toString(),
// 'pay_type': payTypeIndex == null ? null : payType[payTypeIndex],
// 'pay_no':
// receiptNumberC.text.trim().length == 0 ? null : receiptNumberC.text,
'insert_uid':
Provider.of<UserModel>(context, listen: false).user.openid
};
bool success = await detailModel.createReserveDeposit(context, pramas);
if (success) {
bus.emit('refresh_detail_deposit');
bool isSuccess = await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false).user.openid,
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
_addForward();
}
// bus.emit('refresh_invication_deposit');
}
}
} else {
//页面无预订定金选项
bool isSuccess = await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false).user.openid,
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
_addForward();
}
}
}
///微信通知、发短信
Widget _btnWidget() {
return Padding(
... ... @@ -4852,31 +5044,21 @@ class InvicationPageState extends State<InvicationPage>
if (isSuc) {
couponProvider.hasModify = true;
bus.emit("refresh_book_list");
bool isSuccess =
await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
.user
.openid,
);
print(isSuccess);
if (isSuccess) {
_addForward();
}
await _createReserveDeposit();
}
} else {
bool isSuccess =
await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context,
listen: false)
.user
.openid);
if (isSuccess) {
_addForward();
}
await _createReserveDeposit();
// bool isSuccess =
// await Utils.goShareInvicationToWeChat(
// context,
// widget.rid,
// Provider.of<UserModel>(context,
// listen: false)
// .user
// .openid);
// if (isSuccess) {
// _addForward();
// }
}
});
removeOverlay();
... ... @@ -4907,28 +5089,30 @@ class InvicationPageState extends State<InvicationPage>
if (isSuc) {
couponProvider.hasModify = true;
bus.emit("refresh_book_list");
bool isSuccess =
await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
.user
.openid);
print(isSuccess);
if (isSuccess) {
_addForward();
}
await _createReserveDeposit();
// bool isSuccess =
// await Utils.goShareInvicationToWeChat(
// context,
// widget.rid,
// Provider.of<UserModel>(context, listen: false)
// .user
// .openid);
// print(isSuccess);
// if (isSuccess) {
// _addForward();
// }
}
} else {
bool isSuccess = await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
.user
.openid);
if (isSuccess) {
_addForward();
}
await _createReserveDeposit();
// bool isSuccess = await Utils.goShareInvicationToWeChat(
// context,
// widget.rid,
// Provider.of<UserModel>(context, listen: false)
// .user
// .openid);
// if (isSuccess) {
// _addForward();
// }
}
}
})
... ...
... ... @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:one_key/provider/marketing_center_provider.dart';
import 'package:one_key/utils/dialog_util.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:provider/provider.dart';
... ... @@ -60,7 +61,6 @@ class _PaymentSettingPageState extends State<PaymentSettingPage> {
_setData() async {
Future.wait<bool>([
_setIsShowNoticeDeposit(),
_setDepositPrice(),
]).then((results) {
print(results[0]);
... ... @@ -87,7 +87,14 @@ class _PaymentSettingPageState extends State<PaymentSettingPage> {
_setData();
} else {
//商家未开通微信支付
Utils.showToast('商家未开通微信支付功能!');
// Utils.showToast('商家未开通微信支付功能!');
isPayment = false;
setState(() {});
_setIsShowNoticeDeposit();
DialogUtil.cupertinoAlertDialogOnly(context,
content: '您的店铺尚未开通微信支付商家账号,请拨打400-0009690 联系客服,或联系您的销售服务开通后再开启本功能!',
rTitle: '我知道了');
}
}
}
... ... @@ -112,25 +119,24 @@ class _PaymentSettingPageState extends State<PaymentSettingPage> {
///使用店铺手机发送通知短信
Future<bool> _setDepositPrice({bool isShowLoading = true}) async {
if(moneyControl.text.trim().length > 0){
Map<String, String> params = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'key': 'deposit_price',
'value': moneyControl.text
};
if (moneyControl.text.trim().length > 0) {
Map<String, String> params = {
'sid': Provider.of<UserModel>(context, listen: false).user.sellerid,
'key': 'deposit_price',
'value': moneyControl.text
};
bool success = await marketingCenterProvider.setConfing(context, params,
needToast: false);
bool success = await marketingCenterProvider.setConfing(context, params,
needToast: false);
if (success) {
return true;
} else {
return false;
}
}else{
if (success) {
return true;
} else {
return false;
}
} else {
return true;
}
}
///输入框
... ... @@ -303,8 +309,7 @@ class _PaymentSettingPageState extends State<PaymentSettingPage> {
height: w(40),
isBold: true,
onPressed: () async {
FocusScope.of(context)
.requestFocus(FocusNode()); //隐藏键盘
FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘
_getSellerById();
},
... ...
... ... @@ -42,6 +42,8 @@ class NotebookDetailModel extends ChangeNotifier {
List<ReserveActionLogSunModol> reserveActionLogData = []; // 获取预订操作记录
String depositId; //订金id
NotebookDetailModel() {
initSexList();
}
... ... @@ -272,6 +274,9 @@ class NotebookDetailModel extends ChangeNotifier {
return false;
});
if (baseResp.code == Constant.status_success) {
if(baseResp.data is Map){
depositId = baseResp.data['id'];
}
return true;
} else {
Utils.showToast(baseResp.msg ?? "");
... ...
... ... @@ -2045,7 +2045,7 @@ class NavigatorUtil {
///预订----添加定金
static Future<dynamic> goBookDepositPage(BuildContext context, String rid,
{replace = false,
bool onlyShow = false,
bool isNew = true,
BookDepositSunModel bookDepositModel}) {
return _navigateTo(context,
... ...
... ... @@ -3556,6 +3556,7 @@ var bookDepositPageHandle = new Handler(
String rid = params["rid"].first;
// String uids = params["uids"].first;
bool isNew = FluroConvertUtils.string2bool(params["isNew"].first);
// bool onlyShow = FluroConvertUtils.string2bool(params["onlyShow"].first);
if (!isNew) {
BookDepositSunModel depositSunModel = BookDepositSunModel.fromJson(
json.decode(FluroConvertUtils.fluroCnParamsDecode(
... ... @@ -3565,15 +3566,16 @@ var bookDepositPageHandle = new Handler(
create: (_) => NotebookDetailModel(),
child: ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(),
child:
child:
BookDepositPage(rid: rid, depositSunModel: depositSunModel)));
}
return ChangeNotifierProvider<NotebookDetailModel>(
create: (_) => NotebookDetailModel(),
child: ChangeNotifierProvider<FeastModel>(
create: (_) => FeastModel(),
child: BookDepositPage(
child: BookDepositPage(
rid: rid,
)));
});
... ...
... ... @@ -2081,7 +2081,7 @@ class Utils {
//分享邀请函
static goShareInvicationToWeChat(BuildContext context, String rid, String uid,
{bool isWechat = true}) async {
{bool isWechat = true,String depositId}) async {
String _webPageUrl = "http://colorcun.com/";
// String _thumbnail =
// "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1";
... ... @@ -2111,7 +2111,10 @@ class Utils {
// "pages/customer/index?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
String _path =
"pages/customer/detail_owner_invitation_new?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
if(depositId != null){
_path =
"pages/customer/detail_owner_invitation_new?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid&paymentId=$depositId";
}
var model = new WeChatShareMiniProgramModel(
webPageUrl: _webPageUrl,
userName: _userName,
... ... @@ -2134,7 +2137,10 @@ class Utils {
// "pages/customer/index.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
String _path =
"pages/customer/detail_owner_invitation_new.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
if(depositId != null){
_path =
"pages/customer/detail_owner_invitation_new.html?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid&paymentId=$depositId";
}
FlutterWxwork flutterWxwork = FlutterWxwork();
bool isAppInstalled = await flutterWxwork.isAppInstalled();
print(isAppInstalled);
... ...