Commit f6ad1c02ca40b7a373fab90e0ba7983fa1bd2bd1

Authored by wdn127929
1 parent 896d3592

转发加蒙版

... ... @@ -358,7 +358,8 @@ class InvicationPageState extends State<InvicationPage>
}
getReserveImgText() async {
await marketingCenterProvider.getReserveImgText(context, widget.rid,showLoading: false);
await marketingCenterProvider.getReserveImgText(context, widget.rid,
showLoading: false);
if (marketingCenterProvider.reserveImgText != null) {
additionTitle = marketingCenterProvider.reserveImgText.title;
setState(() {});
... ... @@ -366,7 +367,8 @@ class InvicationPageState extends State<InvicationPage>
}
getDzSellerConf() async {
bool success = await marketingCenterProvider.getDzSellerConf(context,showLoading: false);
bool success = await marketingCenterProvider.getDzSellerConf(context,
showLoading: false);
if (success && marketingCenterProvider.dzSellerConfModel != null) {
if (marketingCenterProvider.dzSellerConfModel.isShowNoticeDeposit == '1'
// &&
... ... @@ -1203,7 +1205,7 @@ class InvicationPageState extends State<InvicationPage>
}
_getReserveTypeField() async {
await detailModel.getReserveTypeField(context,isShowLoading: false);
await detailModel.getReserveTypeField(context, isShowLoading: false);
}
///订座详情
... ... @@ -1339,8 +1341,8 @@ class InvicationPageState extends State<InvicationPage>
params['phone'] = user.userphone;
}
bool isSuccess =
await _baseIndoProvider.setCustomerActivityBaseinfo(context, params,isShowLoading: false);
bool isSuccess = await _baseIndoProvider
.setCustomerActivityBaseinfo(context, params, isShowLoading: false);
// _baseIndoProvider.baseInfoSunModel = null;
if (isSuccess) {
name = user.sellername;
... ... @@ -2676,7 +2678,9 @@ class InvicationPageState extends State<InvicationPage>
textAlignVertical:
TextAlignVertical.bottom,
maxLines: 1,
enabled: detailModel.depositId == null ? true:false,
enabled: detailModel.depositId == null
? true
: false,
inputFormatters: [
FilteringTextInputFormatter(
RegExp("[0-9.]"),
... ... @@ -4672,6 +4676,12 @@ class InvicationPageState extends State<InvicationPage>
}
}
String returnWeek(DateTime day, BuildContext context) {
String date = "周${Utils.formatWeekDayNum(day.weekday)} ";
return date;
}
_createReserveDeposit() async {
if (marketingCenterProvider.dzSellerConfModel.isShowNoticeDeposit == '1') {
//页面有预订订金选项
... ... @@ -4706,6 +4716,9 @@ class InvicationPageState extends State<InvicationPage>
context,
widget.rid,
Provider.of<UserModel>(context, listen: false).user.openid,
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
... ... @@ -4713,19 +4726,37 @@ class InvicationPageState extends State<InvicationPage>
}
// bus.emit('refresh_invication_deposit');
}
} else {
// 不可编辑
//页面无预订订金选项
bool isSuccess = await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false).user.openid,
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
_addForward();
}
}
} 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();
}
//页面无预订订金选项
bool isSuccess = await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false).user.openid,
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
_addForward();
}
}
} else {
//页面无预订订金选项
... ... @@ -4733,6 +4764,9 @@ class InvicationPageState extends State<InvicationPage>
context,
widget.rid,
Provider.of<UserModel>(context, listen: false).user.openid,
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
... ...
... ... @@ -4408,6 +4408,12 @@ class InvicationPageSimState extends State<InvicationPageSim>
// ]);
// }
String returnWeek(DateTime day, BuildContext context) {
String date = "周${Utils.formatWeekDayNum(day.weekday)} ";
return date;
}
// 跳转系统短信页面
_goSendSmsPageSim() async {
if (reserverPhone == null ||
... ... @@ -4505,48 +4511,48 @@ class InvicationPageSimState extends State<InvicationPageSim>
// //跳转系统发短信
// _goSendSmsPageSim();
// } else {
if (myModel.smsInfo == '0') {
if (myModel.smsInfo == '0') {
setState(() {
showErroInfo = true;
erroInfo = '短信余额不足,请充值短信条数';
});
return;
}
if (canSendSms) {
if (reserverPhone == null ||
reserverPhone.isEmpty ||
!Utils.isInteger(reserverPhone)) {
//跳转到录入联系人页面
// String temp = await NavigatorUtil.goEditReserverPageSim(
// context, widget.rid, name, sex,
// needBtn: true);
// if (temp != null) {
// reserverPhone = temp;
// }
// Utils.showToast('请输入客户手机号');
//显示请输入11位手机号码
setState(() {
showErroInfo = true;
erroInfo = '短信余额不足,请充值短信条数';
erroInfo = '请正确输入11位手机号码';
});
return;
}
if (canSendSms) {
if (reserverPhone == null ||
reserverPhone.isEmpty ||
!Utils.isInteger(reserverPhone)) {
//跳转到录入联系人页面
// String temp = await NavigatorUtil.goEditReserverPageSim(
// context, widget.rid, name, sex,
// needBtn: true);
// if (temp != null) {
// reserverPhone = temp;
// }
// Utils.showToast('请输入客户手机号');
//显示请输入11位手机号码
setState(() {
showErroInfo = true;
erroInfo = '请正确输入11位手机号码';
});
return;
} else if (ObjectUtil.isEmpty(
_baseIndoProvider.baseInfoSunModel) ||
ObjectUtil.isEmpty(_baseIndoProvider
.baseInfoSunModel.phone)) {
// Utils.showToast('请填写经理的联系电话');
DialogUtil.cupertinoAlertDialog(context,
title: "填写个人信息",
content: "暂未填写您的联系信息,请先前往填写,个人信息将会展示给您的顾客。",
lTitle: "取消",
rTitle: "去填写",
lCallback: () {}, rCallback: () {
_goBaseInfoPageSim();
});
return;
} else {
/*
return;
} else if (ObjectUtil.isEmpty(
_baseIndoProvider.baseInfoSunModel) ||
ObjectUtil.isEmpty(
_baseIndoProvider.baseInfoSunModel.phone)) {
// Utils.showToast('请填写经理的联系电话');
DialogUtil.cupertinoAlertDialog(context,
title: "填写个人信息",
content: "暂未填写您的联系信息,请先前往填写,个人信息将会展示给您的顾客。",
lTitle: "取消",
rTitle: "去填写",
lCallback: () {}, rCallback: () {
_goBaseInfoPageSim();
});
return;
} else {
/*
String dateSoltStr = '';
if (widget.dateSolt == '1') {
dateSoltStr = '早餐';
... ... @@ -4588,49 +4594,49 @@ class InvicationPageSimState extends State<InvicationPageSim>
params['Strtext'] = user.sellername;
}
*/
setState(() {
showErroInfo = false;
erroInfo = '';
});
UserModel userModel = Provider.of<UserModel>(
context,
listen: false);
Map<String, String> params = {
"rid": widget.rid,
"sid": userModel.user.sellerid
};
bool success = await couponProvider
.sendSMSWxSendSms(context, params);
print(success);
if (success) {
setState(() {
showErroInfo = false;
erroInfo = '';
smsTitle = '已发${couponProvider.sendSMS}次';
});
UserModel userModel = Provider.of<UserModel>(
context,
listen: false);
Map<String, String> params = {
"rid": widget.rid,
"sid": userModel.user.sellerid
};
bool success = await couponProvider
.sendSMSWxSendSms(context, params);
print(success);
if (success) {
canSendSms = false;
startCountdown(120);
} else {
if (couponProvider.errorSMS != '') {
setState(() {
smsTitle = '已发${couponProvider.sendSMS}次';
showErroInfo = true;
erroInfo = couponProvider.errorSMS;
});
canSendSms = false;
startCountdown(120);
} else {
if (couponProvider.errorSMS != '') {
setState(() {
showErroInfo = true;
erroInfo = couponProvider.errorSMS;
});
}
}
// if (success) {
// Utils.showToast('短信已经发送成功!');
// } else {
// Utils.showToast('发送次数太频繁!');
// }
}
} else {
//显示2分钟只能发1次短信
setState(() {
showErroInfo = true;
erroInfo = '2分钟内只能发送一条短信';
});
return;
// if (success) {
// Utils.showToast('短信已经发送成功!');
// } else {
// Utils.showToast('发送次数太频繁!');
// }
}
} else {
//显示2分钟只能发1次短信
setState(() {
showErroInfo = true;
erroInfo = '2分钟内只能发送一条短信';
});
return;
}
// }
});
removeOverlay();
... ... @@ -4799,6 +4805,9 @@ class InvicationPageSimState extends State<InvicationPageSim>
Provider.of<UserModel>(context, listen: false)
.user
.openid,
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
);
print(isSuccess);
if (isSuccess) {
... ... @@ -4808,12 +4817,15 @@ class InvicationPageSimState extends State<InvicationPageSim>
} else {
bool isSuccess =
await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context,
listen: false)
.user
.openid);
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
.user
.openid,
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
);
if (isSuccess) {
_addForward();
}
... ... @@ -4849,11 +4861,15 @@ class InvicationPageSimState extends State<InvicationPageSim>
bus.emit("refresh_book_list");
bool isSuccess =
await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
.user
.openid);
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
.user
.openid,
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
);
print(isSuccess);
if (isSuccess) {
_addForward();
... ... @@ -4861,11 +4877,15 @@ class InvicationPageSimState extends State<InvicationPageSim>
}
} else {
bool isSuccess = await Utils.goShareInvicationToWeChat(
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
.user
.openid);
context,
widget.rid,
Provider.of<UserModel>(context, listen: false)
.user
.openid,
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
);
if (isSuccess) {
_addForward();
}
... ...
import 'package:flutter/material.dart';
class MyColours {
static const Color color_FFEFC5 = Color(0xFFFFEFC5);
static const Color color_E4461D = Color(0xFFE4461D);
static const Color color_F8F7F3 = Color(0xFFF8F7F3);
static const Color color_33438E93 = Color(0x33438E93);
... ...
... ... @@ -154,19 +154,19 @@ class Utils {
return double.tryParse(s) != null;
}
static bool isNumericReq(String str) {
final reg = RegExp(r'^[0-9]+$');
static bool isNumericReq(String str) {
final reg = RegExp(r'^[0-9]+$');
print('$str 是否数字:${reg.hasMatch(str)}');
return reg.hasMatch(str);
}
static bool isNumeric1Req(String str) {
final reg = RegExp(r'((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)');
static bool isNumeric1Req(String str) {
final reg = RegExp(
r'((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)');
print('$str 是否数字:${reg.hasMatch(str)}');
return reg.hasMatch(str);
}
// ^(([^0][0-9]+|0)$)|^(([1-9]+)$)
// 验证是否为数字
... ... @@ -176,7 +176,7 @@ class Utils {
return reg.hasMatch(str);
}
// 验证是否为数字
// 验证是否为数字
static bool isIntegerS(String str) {
final reg = RegExp(r'^[0-9]\d*$');
print('$str 是否数字:${reg.hasMatch(str)}');
... ... @@ -2080,7 +2080,8 @@ class Utils {
bool isSuccess = await shareToWeChat(model);
return isSuccess;
}
static Future<ui.Image> loadImage(var path, bool isUrl) async {
static Future<ui.Image> loadImage(var path, bool isUrl) async {
ImageStream stream;
if (isUrl) {
stream = NetworkImage(path).resolve(ImageConfiguration.empty);
... ... @@ -2105,64 +2106,101 @@ class Utils {
// return fi.image;
// }
static Future< Uint8List> canvas(_thumbnail)async{
var pictureRecorder = new ui.PictureRecorder(); // 图片记录仪
var canvas = new Canvas(pictureRecorder); //canvas接受一个图片记录仪
var images = await loadImage(_thumbnail,true); // 使用方法获取Unit8List格式的图片
print(images);
Paint _linePaint = new Paint()
..color = Colors.blue
..style = PaintingStyle.fill
..isAntiAlias = true
..strokeCap = StrokeCap.round
..strokeWidth = 500;
// 绘制图片
canvas.drawImage(images, Offset(0, 0), _linePaint); // 直接画图
// 绘制圆圈
// canvas.drawCircle(
// new Offset(
// 60,
// images.height.toDouble() + 60,
// ),
// 40.0,
// _linePaint);
// 绘制文字
ui.ParagraphBuilder pb = ui.ParagraphBuilder(ui.ParagraphStyle(
textAlign: TextAlign.left,
fontWeight: FontWeight.w400,
fontStyle: FontStyle.normal,
// :MyColours.color_000000,
fontSize: 25.0));
pb.pushStyle(ui.TextStyle(color: Colors.black));
pb.addText('有一种感动就做只有你懂');
pb.addText('一个可以钻钱的app');
// 设置文本的宽度约束
ParagraphConstraints pc = ui.ParagraphConstraints(width: 500);
ui.Paragraph paragraph = pb.build()..layout(pc);
canvas.drawParagraph(
paragraph, Offset(0, images.height.toDouble() + 20));
//下面的代码是生成图片的关键代码,以上绘制文字和圆圈的代码可以忽略不计
var picture = await pictureRecorder.endRecording().toImage(500, 400);//设置生成图片的宽和高
var pngImageBytes = await picture.toByteData(format: ui.ImageByteFormat.png);
// var imgBytes = Uint8List.view(pngImageBytes.buffer); //这一行和下面这一行都是生成Uint8List格式的图片(原理还不知道)
Uint8List pngBytes = pngImageBytes.buffer.asUint8List();
print(pngBytes);//pngBytes可以放在Image.memory()中预览
// setState(() {
// imageMemory = pngBytes;
// });
return pngBytes;
static Future<Uint8List> canvas(
context, String _thumbnail, String month, String week) async {
var pictureRecorder = new ui.PictureRecorder(); // 图片记录仪
var canvas = new Canvas(pictureRecorder); //canvas接受一个图片记录仪
var images = await loadImage(_thumbnail, true); // 使用方法获取Unit8List格式的图片
print(images);
// Paint _linePaint = new Paint()
// ..color = Colors.blue
// ..style = PaintingStyle.fill
// ..isAntiAlias = true
// ..strokeCap = StrokeCap.round
// ..strokeWidth = 500;
// Paint selfPaint = Paint()
// ..color = Colors.red
// ..style = PaintingStyle.fill
// ..isAntiAlias = true
// ..strokeCap = StrokeCap.butt
// ..strokeWidth = 2;
final paint = Paint()
..color = Color.fromRGBO(0, 0, 0, 0.8)
..style = PaintingStyle.fill;
canvas.drawRect(Rect.fromLTWH(0, 0, 500, 400), paint);
canvas.drawImage(images, Offset(0, 0), paint);
// 绘制文字
ui.ParagraphBuilder pb2 = ui.ParagraphBuilder(ui.ParagraphStyle(
textAlign: TextAlign.center,
fontWeight: FontWeight.normal,
fontStyle: FontStyle.normal,
// :MyColours.color_000000,
fontSize: 26));
pb2.pushStyle(ui.TextStyle(color: MyColours.color_FFEFC5, fontSize: 26));
pb2.addText(
'${Provider.of<UserModel>(context, listen: false).user.sellername}');
// 设置文本的宽度约束
ParagraphConstraints pc2 = ui.ParagraphConstraints(width: 500);
ui.Paragraph paragraph2 = pb2.build()..layout(pc2);
canvas.drawParagraph(paragraph2, Offset(10, 40));
// 绘制文字
ui.ParagraphBuilder pb = ui.ParagraphBuilder(ui.ParagraphStyle(
textAlign: TextAlign.center,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal,
// :MyColours.color_000000,
fontSize: 48));
pb.pushStyle(ui.TextStyle(color: MyColours.color_FFEFC5, fontSize: 48));
pb.addText(month);
// 设置文本的宽度约束
ParagraphConstraints pc = ui.ParagraphConstraints(width: 500);
ui.Paragraph paragraph = pb.build()..layout(pc);
canvas.drawParagraph(paragraph, Offset(10, 150));
// 绘制文字
ui.ParagraphBuilder pb3 = ui.ParagraphBuilder(ui.ParagraphStyle(
textAlign: TextAlign.center,
fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal,
// :MyColours.color_000000,
fontSize: 42));
pb3.pushStyle(ui.TextStyle(color: MyColours.color_FFEFC5, fontSize: 42));
pb3.addText(week);
// 设置文本的宽度约束
ParagraphConstraints pc3 = ui.ParagraphConstraints(width: 500);
ui.Paragraph paragraph3 = pb3.build()..layout(pc3);
canvas.drawParagraph(paragraph3, Offset(10, 230));
//下面的代码是生成图片的关键代码,以上绘制文字和圆圈的代码可以忽略不计
var picture =
await pictureRecorder.endRecording().toImage(500, 400); //设置生成图片的宽和高
var pngImageBytes =
await picture.toByteData(format: ui.ImageByteFormat.png);
// var imgBytes = Uint8List.view(pngImageBytes.buffer); //这一行和下面这一行都是生成Uint8List格式的图片(原理还不知道)
Uint8List pngBytes = pngImageBytes.buffer.asUint8List();
print(pngBytes); //pngBytes可以放在Image.memory()中预览
// setState(() {
// imageMemory = pngBytes;
// Uint8List result = await resizeImage(pngBytes); //重置图片尺寸
Uint8List result = await testFromFileComporessList(context, pngBytes);
return result;
}
//分享邀请函
static goShareInvicationToWeChat(BuildContext context, String rid, String uid,
{bool isWechat = true,String depositId}) async {
static goShareInvicationToWeChat(
BuildContext context, String rid, String uid, String month, String week,
{bool isWechat = true, String depositId}) async {
String _webPageUrl = "http://colorcun.com/";
// String _thumbnail =
// "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1";
... ... @@ -2173,9 +2211,13 @@ class Utils {
// String _thumbnail = sellerImage == null || sellerImage == ''
// ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
// : sellerImage;
Uint8List _thumbnail =await canvas(sellerImage == null || sellerImage == ''
? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
: sellerImage);
Uint8List _thumbnail = await canvas(
context,
sellerImage == null || sellerImage == ''
? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
: sellerImage,
month,
week);
String _title =
"您预订的${Provider.of<UserModel>(context, listen: false).user.sellername},已经安排,点击查看详情";
... ... @@ -2193,25 +2235,24 @@ class Utils {
String _userName = "gh_487873d353b3";
// String _path =
// "pages/customer/index?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid";
String _path =
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";
}
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,
title: _title,
path: _path,
description: _description,
miniProgramType: Constant.wxMiniProgramType, //体验版
miniProgramType: Constant.wxMiniProgramType, //
// miniProgramType: WXMiniProgramType.RELEASE, //正式版
// miniProgramType: //开发版
// thumbnail: WeChatImage.binary(source)
// thumbnail: WeChatImage.network(_thumbnail)
thumbnail: WeChatImage.binary(_thumbnail)
);
thumbnail: WeChatImage.binary(_thumbnail));
isSuccess = await shareToWeChat(model);
} else {
... ... @@ -2419,24 +2460,24 @@ class Utils {
tempList.removeRange(0, int.parse(hour));
// if (minute != '45') {
Map<String, List<int>> map = tempList[0];
Map mapNew = {};
// map.map((key, value) {
// mapNew[key]
// });
List<int> list = [];
map.forEach((key, value) {
value.forEach((element) {
if (int.parse(minute) <= element) {
list.add(element);
}
});
mapNew[key] = list;
Map<String, List<int>> map = tempList[0];
Map mapNew = {};
// map.map((key, value) {
// mapNew[key]
// });
List<int> list = [];
map.forEach((key, value) {
value.forEach((element) {
if (int.parse(minute) <= element) {
list.add(element);
}
});
tempList.removeAt(0);
tempList.insert(0, mapNew);
mapNew[key] = list;
});
tempList.removeAt(0);
tempList.insert(0, mapNew);
// }
// tempList.replaceRange(0, 0, mapNew);
... ...