Showing
4 changed files
with
293 additions
and
196 deletions
| @@ -358,7 +358,8 @@ class InvicationPageState extends State<InvicationPage> | @@ -358,7 +358,8 @@ class InvicationPageState extends State<InvicationPage> | ||
| 358 | } | 358 | } |
| 359 | 359 | ||
| 360 | getReserveImgText() async { | 360 | getReserveImgText() async { |
| 361 | - await marketingCenterProvider.getReserveImgText(context, widget.rid,showLoading: false); | 361 | + await marketingCenterProvider.getReserveImgText(context, widget.rid, |
| 362 | + showLoading: false); | ||
| 362 | if (marketingCenterProvider.reserveImgText != null) { | 363 | if (marketingCenterProvider.reserveImgText != null) { |
| 363 | additionTitle = marketingCenterProvider.reserveImgText.title; | 364 | additionTitle = marketingCenterProvider.reserveImgText.title; |
| 364 | setState(() {}); | 365 | setState(() {}); |
| @@ -366,7 +367,8 @@ class InvicationPageState extends State<InvicationPage> | @@ -366,7 +367,8 @@ class InvicationPageState extends State<InvicationPage> | ||
| 366 | } | 367 | } |
| 367 | 368 | ||
| 368 | getDzSellerConf() async { | 369 | getDzSellerConf() async { |
| 369 | - bool success = await marketingCenterProvider.getDzSellerConf(context,showLoading: false); | 370 | + bool success = await marketingCenterProvider.getDzSellerConf(context, |
| 371 | + showLoading: false); | ||
| 370 | if (success && marketingCenterProvider.dzSellerConfModel != null) { | 372 | if (success && marketingCenterProvider.dzSellerConfModel != null) { |
| 371 | if (marketingCenterProvider.dzSellerConfModel.isShowNoticeDeposit == '1' | 373 | if (marketingCenterProvider.dzSellerConfModel.isShowNoticeDeposit == '1' |
| 372 | // && | 374 | // && |
| @@ -1203,7 +1205,7 @@ class InvicationPageState extends State<InvicationPage> | @@ -1203,7 +1205,7 @@ class InvicationPageState extends State<InvicationPage> | ||
| 1203 | } | 1205 | } |
| 1204 | 1206 | ||
| 1205 | _getReserveTypeField() async { | 1207 | _getReserveTypeField() async { |
| 1206 | - await detailModel.getReserveTypeField(context,isShowLoading: false); | 1208 | + await detailModel.getReserveTypeField(context, isShowLoading: false); |
| 1207 | } | 1209 | } |
| 1208 | 1210 | ||
| 1209 | ///订座详情 | 1211 | ///订座详情 |
| @@ -1339,8 +1341,8 @@ class InvicationPageState extends State<InvicationPage> | @@ -1339,8 +1341,8 @@ class InvicationPageState extends State<InvicationPage> | ||
| 1339 | params['phone'] = user.userphone; | 1341 | params['phone'] = user.userphone; |
| 1340 | } | 1342 | } |
| 1341 | 1343 | ||
| 1342 | - bool isSuccess = | ||
| 1343 | - await _baseIndoProvider.setCustomerActivityBaseinfo(context, params,isShowLoading: false); | 1344 | + bool isSuccess = await _baseIndoProvider |
| 1345 | + .setCustomerActivityBaseinfo(context, params, isShowLoading: false); | ||
| 1344 | // _baseIndoProvider.baseInfoSunModel = null; | 1346 | // _baseIndoProvider.baseInfoSunModel = null; |
| 1345 | if (isSuccess) { | 1347 | if (isSuccess) { |
| 1346 | name = user.sellername; | 1348 | name = user.sellername; |
| @@ -2676,7 +2678,9 @@ class InvicationPageState extends State<InvicationPage> | @@ -2676,7 +2678,9 @@ class InvicationPageState extends State<InvicationPage> | ||
| 2676 | textAlignVertical: | 2678 | textAlignVertical: |
| 2677 | TextAlignVertical.bottom, | 2679 | TextAlignVertical.bottom, |
| 2678 | maxLines: 1, | 2680 | maxLines: 1, |
| 2679 | - enabled: detailModel.depositId == null ? true:false, | 2681 | + enabled: detailModel.depositId == null |
| 2682 | + ? true | ||
| 2683 | + : false, | ||
| 2680 | inputFormatters: [ | 2684 | inputFormatters: [ |
| 2681 | FilteringTextInputFormatter( | 2685 | FilteringTextInputFormatter( |
| 2682 | RegExp("[0-9.]"), | 2686 | RegExp("[0-9.]"), |
| @@ -4672,6 +4676,12 @@ class InvicationPageState extends State<InvicationPage> | @@ -4672,6 +4676,12 @@ class InvicationPageState extends State<InvicationPage> | ||
| 4672 | } | 4676 | } |
| 4673 | } | 4677 | } |
| 4674 | 4678 | ||
| 4679 | + String returnWeek(DateTime day, BuildContext context) { | ||
| 4680 | + String date = "周${Utils.formatWeekDayNum(day.weekday)} "; | ||
| 4681 | + | ||
| 4682 | + return date; | ||
| 4683 | + } | ||
| 4684 | + | ||
| 4675 | _createReserveDeposit() async { | 4685 | _createReserveDeposit() async { |
| 4676 | if (marketingCenterProvider.dzSellerConfModel.isShowNoticeDeposit == '1') { | 4686 | if (marketingCenterProvider.dzSellerConfModel.isShowNoticeDeposit == '1') { |
| 4677 | //页面有预订订金选项 | 4687 | //页面有预订订金选项 |
| @@ -4706,6 +4716,9 @@ class InvicationPageState extends State<InvicationPage> | @@ -4706,6 +4716,9 @@ class InvicationPageState extends State<InvicationPage> | ||
| 4706 | context, | 4716 | context, |
| 4707 | widget.rid, | 4717 | widget.rid, |
| 4708 | Provider.of<UserModel>(context, listen: false).user.openid, | 4718 | Provider.of<UserModel>(context, listen: false).user.openid, |
| 4719 | + '${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日', | ||
| 4720 | + returnWeek(dateTime, context) + | ||
| 4721 | + '${ddateHm == null || ddateHm == '' ? '' : ddateHm}', | ||
| 4709 | depositId: detailModel.depositId); | 4722 | depositId: detailModel.depositId); |
| 4710 | print(isSuccess); | 4723 | print(isSuccess); |
| 4711 | if (isSuccess) { | 4724 | if (isSuccess) { |
| @@ -4713,19 +4726,37 @@ class InvicationPageState extends State<InvicationPage> | @@ -4713,19 +4726,37 @@ class InvicationPageState extends State<InvicationPage> | ||
| 4713 | } | 4726 | } |
| 4714 | // bus.emit('refresh_invication_deposit'); | 4727 | // bus.emit('refresh_invication_deposit'); |
| 4715 | } | 4728 | } |
| 4729 | + } else { | ||
| 4730 | + // 不可编辑 | ||
| 4731 | + //页面无预订订金选项 | ||
| 4732 | + bool isSuccess = await Utils.goShareInvicationToWeChat( | ||
| 4733 | + context, | ||
| 4734 | + widget.rid, | ||
| 4735 | + Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 4736 | + '${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日', | ||
| 4737 | + returnWeek(dateTime, context) + | ||
| 4738 | + '${ddateHm == null || ddateHm == '' ? '' : ddateHm}', | ||
| 4739 | + depositId: detailModel.depositId); | ||
| 4740 | + print(isSuccess); | ||
| 4741 | + if (isSuccess) { | ||
| 4742 | + _addForward(); | ||
| 4743 | + } | ||
| 4716 | } | 4744 | } |
| 4717 | } else { | 4745 | } else { |
| 4718 | // 不可编辑 | 4746 | // 不可编辑 |
| 4719 | - //页面无预订订金选项 | ||
| 4720 | - bool isSuccess = await Utils.goShareInvicationToWeChat( | ||
| 4721 | - context, | ||
| 4722 | - widget.rid, | ||
| 4723 | - Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 4724 | - depositId: detailModel.depositId); | ||
| 4725 | - print(isSuccess); | ||
| 4726 | - if (isSuccess) { | ||
| 4727 | - _addForward(); | ||
| 4728 | - } | 4747 | + //页面无预订订金选项 |
| 4748 | + bool isSuccess = await Utils.goShareInvicationToWeChat( | ||
| 4749 | + context, | ||
| 4750 | + widget.rid, | ||
| 4751 | + Provider.of<UserModel>(context, listen: false).user.openid, | ||
| 4752 | + '${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日', | ||
| 4753 | + returnWeek(dateTime, context) + | ||
| 4754 | + '${ddateHm == null || ddateHm == '' ? '' : ddateHm}', | ||
| 4755 | + depositId: detailModel.depositId); | ||
| 4756 | + print(isSuccess); | ||
| 4757 | + if (isSuccess) { | ||
| 4758 | + _addForward(); | ||
| 4759 | + } | ||
| 4729 | } | 4760 | } |
| 4730 | } else { | 4761 | } else { |
| 4731 | //页面无预订订金选项 | 4762 | //页面无预订订金选项 |
| @@ -4733,6 +4764,9 @@ class InvicationPageState extends State<InvicationPage> | @@ -4733,6 +4764,9 @@ class InvicationPageState extends State<InvicationPage> | ||
| 4733 | context, | 4764 | context, |
| 4734 | widget.rid, | 4765 | widget.rid, |
| 4735 | Provider.of<UserModel>(context, listen: false).user.openid, | 4766 | Provider.of<UserModel>(context, listen: false).user.openid, |
| 4767 | + '${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日', | ||
| 4768 | + returnWeek(dateTime, context) + | ||
| 4769 | + '${ddateHm == null || ddateHm == '' ? '' : ddateHm}', | ||
| 4736 | depositId: detailModel.depositId); | 4770 | depositId: detailModel.depositId); |
| 4737 | print(isSuccess); | 4771 | print(isSuccess); |
| 4738 | if (isSuccess) { | 4772 | if (isSuccess) { |
| @@ -4408,6 +4408,12 @@ class InvicationPageSimState extends State<InvicationPageSim> | @@ -4408,6 +4408,12 @@ class InvicationPageSimState extends State<InvicationPageSim> | ||
| 4408 | // ]); | 4408 | // ]); |
| 4409 | // } | 4409 | // } |
| 4410 | 4410 | ||
| 4411 | + String returnWeek(DateTime day, BuildContext context) { | ||
| 4412 | + String date = "周${Utils.formatWeekDayNum(day.weekday)} "; | ||
| 4413 | + | ||
| 4414 | + return date; | ||
| 4415 | + } | ||
| 4416 | + | ||
| 4411 | // 跳转系统短信页面 | 4417 | // 跳转系统短信页面 |
| 4412 | _goSendSmsPageSim() async { | 4418 | _goSendSmsPageSim() async { |
| 4413 | if (reserverPhone == null || | 4419 | if (reserverPhone == null || |
| @@ -4505,48 +4511,48 @@ class InvicationPageSimState extends State<InvicationPageSim> | @@ -4505,48 +4511,48 @@ class InvicationPageSimState extends State<InvicationPageSim> | ||
| 4505 | // //跳转系统发短信 | 4511 | // //跳转系统发短信 |
| 4506 | // _goSendSmsPageSim(); | 4512 | // _goSendSmsPageSim(); |
| 4507 | // } else { | 4513 | // } else { |
| 4508 | - if (myModel.smsInfo == '0') { | 4514 | + if (myModel.smsInfo == '0') { |
| 4515 | + setState(() { | ||
| 4516 | + showErroInfo = true; | ||
| 4517 | + erroInfo = '短信余额不足,请充值短信条数'; | ||
| 4518 | + }); | ||
| 4519 | + return; | ||
| 4520 | + } | ||
| 4521 | + if (canSendSms) { | ||
| 4522 | + if (reserverPhone == null || | ||
| 4523 | + reserverPhone.isEmpty || | ||
| 4524 | + !Utils.isInteger(reserverPhone)) { | ||
| 4525 | + //跳转到录入联系人页面 | ||
| 4526 | + // String temp = await NavigatorUtil.goEditReserverPageSim( | ||
| 4527 | + // context, widget.rid, name, sex, | ||
| 4528 | + // needBtn: true); | ||
| 4529 | + // if (temp != null) { | ||
| 4530 | + // reserverPhone = temp; | ||
| 4531 | + // } | ||
| 4532 | + // Utils.showToast('请输入客户手机号'); | ||
| 4533 | + //显示请输入11位手机号码 | ||
| 4509 | setState(() { | 4534 | setState(() { |
| 4510 | showErroInfo = true; | 4535 | showErroInfo = true; |
| 4511 | - erroInfo = '短信余额不足,请充值短信条数'; | 4536 | + erroInfo = '请正确输入11位手机号码'; |
| 4512 | }); | 4537 | }); |
| 4513 | - return; | ||
| 4514 | - } | ||
| 4515 | - if (canSendSms) { | ||
| 4516 | - if (reserverPhone == null || | ||
| 4517 | - reserverPhone.isEmpty || | ||
| 4518 | - !Utils.isInteger(reserverPhone)) { | ||
| 4519 | - //跳转到录入联系人页面 | ||
| 4520 | - // String temp = await NavigatorUtil.goEditReserverPageSim( | ||
| 4521 | - // context, widget.rid, name, sex, | ||
| 4522 | - // needBtn: true); | ||
| 4523 | - // if (temp != null) { | ||
| 4524 | - // reserverPhone = temp; | ||
| 4525 | - // } | ||
| 4526 | - // Utils.showToast('请输入客户手机号'); | ||
| 4527 | - //显示请输入11位手机号码 | ||
| 4528 | - setState(() { | ||
| 4529 | - showErroInfo = true; | ||
| 4530 | - erroInfo = '请正确输入11位手机号码'; | ||
| 4531 | - }); | ||
| 4532 | 4538 | ||
| 4533 | - return; | ||
| 4534 | - } else if (ObjectUtil.isEmpty( | ||
| 4535 | - _baseIndoProvider.baseInfoSunModel) || | ||
| 4536 | - ObjectUtil.isEmpty(_baseIndoProvider | ||
| 4537 | - .baseInfoSunModel.phone)) { | ||
| 4538 | - // Utils.showToast('请填写经理的联系电话'); | ||
| 4539 | - DialogUtil.cupertinoAlertDialog(context, | ||
| 4540 | - title: "填写个人信息", | ||
| 4541 | - content: "暂未填写您的联系信息,请先前往填写,个人信息将会展示给您的顾客。", | ||
| 4542 | - lTitle: "取消", | ||
| 4543 | - rTitle: "去填写", | ||
| 4544 | - lCallback: () {}, rCallback: () { | ||
| 4545 | - _goBaseInfoPageSim(); | ||
| 4546 | - }); | ||
| 4547 | - return; | ||
| 4548 | - } else { | ||
| 4549 | - /* | 4539 | + return; |
| 4540 | + } else if (ObjectUtil.isEmpty( | ||
| 4541 | + _baseIndoProvider.baseInfoSunModel) || | ||
| 4542 | + ObjectUtil.isEmpty( | ||
| 4543 | + _baseIndoProvider.baseInfoSunModel.phone)) { | ||
| 4544 | + // Utils.showToast('请填写经理的联系电话'); | ||
| 4545 | + DialogUtil.cupertinoAlertDialog(context, | ||
| 4546 | + title: "填写个人信息", | ||
| 4547 | + content: "暂未填写您的联系信息,请先前往填写,个人信息将会展示给您的顾客。", | ||
| 4548 | + lTitle: "取消", | ||
| 4549 | + rTitle: "去填写", | ||
| 4550 | + lCallback: () {}, rCallback: () { | ||
| 4551 | + _goBaseInfoPageSim(); | ||
| 4552 | + }); | ||
| 4553 | + return; | ||
| 4554 | + } else { | ||
| 4555 | + /* | ||
| 4550 | String dateSoltStr = ''; | 4556 | String dateSoltStr = ''; |
| 4551 | if (widget.dateSolt == '1') { | 4557 | if (widget.dateSolt == '1') { |
| 4552 | dateSoltStr = '早餐'; | 4558 | dateSoltStr = '早餐'; |
| @@ -4588,49 +4594,49 @@ class InvicationPageSimState extends State<InvicationPageSim> | @@ -4588,49 +4594,49 @@ class InvicationPageSimState extends State<InvicationPageSim> | ||
| 4588 | params['Strtext'] = user.sellername; | 4594 | params['Strtext'] = user.sellername; |
| 4589 | } | 4595 | } |
| 4590 | */ | 4596 | */ |
| 4597 | + setState(() { | ||
| 4598 | + showErroInfo = false; | ||
| 4599 | + erroInfo = ''; | ||
| 4600 | + }); | ||
| 4601 | + UserModel userModel = Provider.of<UserModel>( | ||
| 4602 | + context, | ||
| 4603 | + listen: false); | ||
| 4604 | + Map<String, String> params = { | ||
| 4605 | + "rid": widget.rid, | ||
| 4606 | + "sid": userModel.user.sellerid | ||
| 4607 | + }; | ||
| 4608 | + bool success = await couponProvider | ||
| 4609 | + .sendSMSWxSendSms(context, params); | ||
| 4610 | + print(success); | ||
| 4611 | + if (success) { | ||
| 4591 | setState(() { | 4612 | setState(() { |
| 4592 | - showErroInfo = false; | ||
| 4593 | - erroInfo = ''; | 4613 | + smsTitle = '已发${couponProvider.sendSMS}次'; |
| 4594 | }); | 4614 | }); |
| 4595 | - UserModel userModel = Provider.of<UserModel>( | ||
| 4596 | - context, | ||
| 4597 | - listen: false); | ||
| 4598 | - Map<String, String> params = { | ||
| 4599 | - "rid": widget.rid, | ||
| 4600 | - "sid": userModel.user.sellerid | ||
| 4601 | - }; | ||
| 4602 | - bool success = await couponProvider | ||
| 4603 | - .sendSMSWxSendSms(context, params); | ||
| 4604 | - print(success); | ||
| 4605 | - if (success) { | 4615 | + canSendSms = false; |
| 4616 | + startCountdown(120); | ||
| 4617 | + } else { | ||
| 4618 | + if (couponProvider.errorSMS != '') { | ||
| 4606 | setState(() { | 4619 | setState(() { |
| 4607 | - smsTitle = '已发${couponProvider.sendSMS}次'; | 4620 | + showErroInfo = true; |
| 4621 | + erroInfo = couponProvider.errorSMS; | ||
| 4608 | }); | 4622 | }); |
| 4609 | - canSendSms = false; | ||
| 4610 | - startCountdown(120); | ||
| 4611 | - } else { | ||
| 4612 | - if (couponProvider.errorSMS != '') { | ||
| 4613 | - setState(() { | ||
| 4614 | - showErroInfo = true; | ||
| 4615 | - erroInfo = couponProvider.errorSMS; | ||
| 4616 | - }); | ||
| 4617 | - } | ||
| 4618 | } | 4623 | } |
| 4619 | - // if (success) { | ||
| 4620 | - // Utils.showToast('短信已经发送成功!'); | ||
| 4621 | - // } else { | ||
| 4622 | - // Utils.showToast('发送次数太频繁!'); | ||
| 4623 | - // } | ||
| 4624 | - | ||
| 4625 | } | 4624 | } |
| 4626 | - } else { | ||
| 4627 | - //显示2分钟只能发1次短信 | ||
| 4628 | - setState(() { | ||
| 4629 | - showErroInfo = true; | ||
| 4630 | - erroInfo = '2分钟内只能发送一条短信'; | ||
| 4631 | - }); | ||
| 4632 | - return; | 4625 | + // if (success) { |
| 4626 | + // Utils.showToast('短信已经发送成功!'); | ||
| 4627 | + // } else { | ||
| 4628 | + // Utils.showToast('发送次数太频繁!'); | ||
| 4629 | + // } | ||
| 4630 | + | ||
| 4633 | } | 4631 | } |
| 4632 | + } else { | ||
| 4633 | + //显示2分钟只能发1次短信 | ||
| 4634 | + setState(() { | ||
| 4635 | + showErroInfo = true; | ||
| 4636 | + erroInfo = '2分钟内只能发送一条短信'; | ||
| 4637 | + }); | ||
| 4638 | + return; | ||
| 4639 | + } | ||
| 4634 | // } | 4640 | // } |
| 4635 | }); | 4641 | }); |
| 4636 | removeOverlay(); | 4642 | removeOverlay(); |
| @@ -4799,6 +4805,9 @@ class InvicationPageSimState extends State<InvicationPageSim> | @@ -4799,6 +4805,9 @@ class InvicationPageSimState extends State<InvicationPageSim> | ||
| 4799 | Provider.of<UserModel>(context, listen: false) | 4805 | Provider.of<UserModel>(context, listen: false) |
| 4800 | .user | 4806 | .user |
| 4801 | .openid, | 4807 | .openid, |
| 4808 | + '${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日', | ||
| 4809 | + returnWeek(dateTime, context) + | ||
| 4810 | + '${ddateHm == null || ddateHm == '' ? '' : ddateHm}', | ||
| 4802 | ); | 4811 | ); |
| 4803 | print(isSuccess); | 4812 | print(isSuccess); |
| 4804 | if (isSuccess) { | 4813 | if (isSuccess) { |
| @@ -4808,12 +4817,15 @@ class InvicationPageSimState extends State<InvicationPageSim> | @@ -4808,12 +4817,15 @@ class InvicationPageSimState extends State<InvicationPageSim> | ||
| 4808 | } else { | 4817 | } else { |
| 4809 | bool isSuccess = | 4818 | bool isSuccess = |
| 4810 | await Utils.goShareInvicationToWeChat( | 4819 | await Utils.goShareInvicationToWeChat( |
| 4811 | - context, | ||
| 4812 | - widget.rid, | ||
| 4813 | - Provider.of<UserModel>(context, | ||
| 4814 | - listen: false) | ||
| 4815 | - .user | ||
| 4816 | - .openid); | 4820 | + context, |
| 4821 | + widget.rid, | ||
| 4822 | + Provider.of<UserModel>(context, listen: false) | ||
| 4823 | + .user | ||
| 4824 | + .openid, | ||
| 4825 | + '${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日', | ||
| 4826 | + returnWeek(dateTime, context) + | ||
| 4827 | + '${ddateHm == null || ddateHm == '' ? '' : ddateHm}', | ||
| 4828 | + ); | ||
| 4817 | if (isSuccess) { | 4829 | if (isSuccess) { |
| 4818 | _addForward(); | 4830 | _addForward(); |
| 4819 | } | 4831 | } |
| @@ -4849,11 +4861,15 @@ class InvicationPageSimState extends State<InvicationPageSim> | @@ -4849,11 +4861,15 @@ class InvicationPageSimState extends State<InvicationPageSim> | ||
| 4849 | bus.emit("refresh_book_list"); | 4861 | bus.emit("refresh_book_list"); |
| 4850 | bool isSuccess = | 4862 | bool isSuccess = |
| 4851 | await Utils.goShareInvicationToWeChat( | 4863 | await Utils.goShareInvicationToWeChat( |
| 4852 | - context, | ||
| 4853 | - widget.rid, | ||
| 4854 | - Provider.of<UserModel>(context, listen: false) | ||
| 4855 | - .user | ||
| 4856 | - .openid); | 4864 | + context, |
| 4865 | + widget.rid, | ||
| 4866 | + Provider.of<UserModel>(context, listen: false) | ||
| 4867 | + .user | ||
| 4868 | + .openid, | ||
| 4869 | + '${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日', | ||
| 4870 | + returnWeek(dateTime, context) + | ||
| 4871 | + '${ddateHm == null || ddateHm == '' ? '' : ddateHm}', | ||
| 4872 | + ); | ||
| 4857 | print(isSuccess); | 4873 | print(isSuccess); |
| 4858 | if (isSuccess) { | 4874 | if (isSuccess) { |
| 4859 | _addForward(); | 4875 | _addForward(); |
| @@ -4861,11 +4877,15 @@ class InvicationPageSimState extends State<InvicationPageSim> | @@ -4861,11 +4877,15 @@ class InvicationPageSimState extends State<InvicationPageSim> | ||
| 4861 | } | 4877 | } |
| 4862 | } else { | 4878 | } else { |
| 4863 | bool isSuccess = await Utils.goShareInvicationToWeChat( | 4879 | bool isSuccess = await Utils.goShareInvicationToWeChat( |
| 4864 | - context, | ||
| 4865 | - widget.rid, | ||
| 4866 | - Provider.of<UserModel>(context, listen: false) | ||
| 4867 | - .user | ||
| 4868 | - .openid); | 4880 | + context, |
| 4881 | + widget.rid, | ||
| 4882 | + Provider.of<UserModel>(context, listen: false) | ||
| 4883 | + .user | ||
| 4884 | + .openid, | ||
| 4885 | + '${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日', | ||
| 4886 | + returnWeek(dateTime, context) + | ||
| 4887 | + '${ddateHm == null || ddateHm == '' ? '' : ddateHm}', | ||
| 4888 | + ); | ||
| 4869 | if (isSuccess) { | 4889 | if (isSuccess) { |
| 4870 | _addForward(); | 4890 | _addForward(); |
| 4871 | } | 4891 | } |
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | 2 | ||
| 3 | class MyColours { | 3 | class MyColours { |
| 4 | + | ||
| 5 | + static const Color color_FFEFC5 = Color(0xFFFFEFC5); | ||
| 4 | static const Color color_E4461D = Color(0xFFE4461D); | 6 | static const Color color_E4461D = Color(0xFFE4461D); |
| 5 | static const Color color_F8F7F3 = Color(0xFFF8F7F3); | 7 | static const Color color_F8F7F3 = Color(0xFFF8F7F3); |
| 6 | static const Color color_33438E93 = Color(0x33438E93); | 8 | static const Color color_33438E93 = Color(0x33438E93); |
| @@ -154,19 +154,19 @@ class Utils { | @@ -154,19 +154,19 @@ class Utils { | ||
| 154 | return double.tryParse(s) != null; | 154 | return double.tryParse(s) != null; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | - static bool isNumericReq(String str) { | ||
| 158 | - final reg = RegExp(r'^[0-9]+$'); | 157 | + static bool isNumericReq(String str) { |
| 158 | + final reg = RegExp(r'^[0-9]+$'); | ||
| 159 | print('$str 是否数字:${reg.hasMatch(str)}'); | 159 | print('$str 是否数字:${reg.hasMatch(str)}'); |
| 160 | return reg.hasMatch(str); | 160 | return reg.hasMatch(str); |
| 161 | } | 161 | } |
| 162 | 162 | ||
| 163 | - static bool isNumeric1Req(String str) { | ||
| 164 | - 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}))$)'); | 163 | + static bool isNumeric1Req(String str) { |
| 164 | + final reg = RegExp( | ||
| 165 | + 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}))$)'); | ||
| 165 | print('$str 是否数字:${reg.hasMatch(str)}'); | 166 | print('$str 是否数字:${reg.hasMatch(str)}'); |
| 166 | return reg.hasMatch(str); | 167 | return reg.hasMatch(str); |
| 167 | } | 168 | } |
| 168 | 169 | ||
| 169 | - | ||
| 170 | // ^(([^0][0-9]+|0)$)|^(([1-9]+)$) | 170 | // ^(([^0][0-9]+|0)$)|^(([1-9]+)$) |
| 171 | 171 | ||
| 172 | // 验证是否为数字 | 172 | // 验证是否为数字 |
| @@ -176,7 +176,7 @@ class Utils { | @@ -176,7 +176,7 @@ class Utils { | ||
| 176 | return reg.hasMatch(str); | 176 | return reg.hasMatch(str); |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | - // 验证是否为数字 | 179 | + // 验证是否为数字 |
| 180 | static bool isIntegerS(String str) { | 180 | static bool isIntegerS(String str) { |
| 181 | final reg = RegExp(r'^[0-9]\d*$'); | 181 | final reg = RegExp(r'^[0-9]\d*$'); |
| 182 | print('$str 是否数字:${reg.hasMatch(str)}'); | 182 | print('$str 是否数字:${reg.hasMatch(str)}'); |
| @@ -2080,7 +2080,8 @@ class Utils { | @@ -2080,7 +2080,8 @@ class Utils { | ||
| 2080 | bool isSuccess = await shareToWeChat(model); | 2080 | bool isSuccess = await shareToWeChat(model); |
| 2081 | return isSuccess; | 2081 | return isSuccess; |
| 2082 | } | 2082 | } |
| 2083 | - static Future<ui.Image> loadImage(var path, bool isUrl) async { | 2083 | + |
| 2084 | + static Future<ui.Image> loadImage(var path, bool isUrl) async { | ||
| 2084 | ImageStream stream; | 2085 | ImageStream stream; |
| 2085 | if (isUrl) { | 2086 | if (isUrl) { |
| 2086 | stream = NetworkImage(path).resolve(ImageConfiguration.empty); | 2087 | stream = NetworkImage(path).resolve(ImageConfiguration.empty); |
| @@ -2105,64 +2106,101 @@ class Utils { | @@ -2105,64 +2106,101 @@ class Utils { | ||
| 2105 | // return fi.image; | 2106 | // return fi.image; |
| 2106 | // } | 2107 | // } |
| 2107 | 2108 | ||
| 2108 | - | ||
| 2109 | - static Future< Uint8List> canvas(_thumbnail)async{ | ||
| 2110 | - var pictureRecorder = new ui.PictureRecorder(); // 图片记录仪 | ||
| 2111 | - var canvas = new Canvas(pictureRecorder); //canvas接受一个图片记录仪 | ||
| 2112 | - var images = await loadImage(_thumbnail,true); // 使用方法获取Unit8List格式的图片 | ||
| 2113 | - print(images); | ||
| 2114 | - Paint _linePaint = new Paint() | ||
| 2115 | - ..color = Colors.blue | ||
| 2116 | - ..style = PaintingStyle.fill | ||
| 2117 | - ..isAntiAlias = true | ||
| 2118 | - ..strokeCap = StrokeCap.round | ||
| 2119 | - ..strokeWidth = 500; | ||
| 2120 | - | ||
| 2121 | - // 绘制图片 | ||
| 2122 | - canvas.drawImage(images, Offset(0, 0), _linePaint); // 直接画图 | ||
| 2123 | - | ||
| 2124 | - // 绘制圆圈 | ||
| 2125 | - // canvas.drawCircle( | ||
| 2126 | - // new Offset( | ||
| 2127 | - // 60, | ||
| 2128 | - // images.height.toDouble() + 60, | ||
| 2129 | - // ), | ||
| 2130 | - // 40.0, | ||
| 2131 | - // _linePaint); | ||
| 2132 | - | ||
| 2133 | - // 绘制文字 | ||
| 2134 | - ui.ParagraphBuilder pb = ui.ParagraphBuilder(ui.ParagraphStyle( | ||
| 2135 | - textAlign: TextAlign.left, | ||
| 2136 | - fontWeight: FontWeight.w400, | ||
| 2137 | - fontStyle: FontStyle.normal, | ||
| 2138 | - | ||
| 2139 | - // :MyColours.color_000000, | ||
| 2140 | - fontSize: 25.0)); | ||
| 2141 | - pb.pushStyle(ui.TextStyle(color: Colors.black)); | ||
| 2142 | - pb.addText('有一种感动就做只有你懂'); | ||
| 2143 | - pb.addText('一个可以钻钱的app'); | ||
| 2144 | - // 设置文本的宽度约束 | ||
| 2145 | - ParagraphConstraints pc = ui.ParagraphConstraints(width: 500); | ||
| 2146 | - ui.Paragraph paragraph = pb.build()..layout(pc); | ||
| 2147 | - canvas.drawParagraph( | ||
| 2148 | - paragraph, Offset(0, images.height.toDouble() + 20)); | ||
| 2149 | - | ||
| 2150 | - | ||
| 2151 | - //下面的代码是生成图片的关键代码,以上绘制文字和圆圈的代码可以忽略不计 | ||
| 2152 | - var picture = await pictureRecorder.endRecording().toImage(500, 400);//设置生成图片的宽和高 | ||
| 2153 | - var pngImageBytes = await picture.toByteData(format: ui.ImageByteFormat.png); | ||
| 2154 | - // var imgBytes = Uint8List.view(pngImageBytes.buffer); //这一行和下面这一行都是生成Uint8List格式的图片(原理还不知道) | ||
| 2155 | - Uint8List pngBytes = pngImageBytes.buffer.asUint8List(); | ||
| 2156 | - print(pngBytes);//pngBytes可以放在Image.memory()中预览 | ||
| 2157 | - // setState(() { | ||
| 2158 | - // imageMemory = pngBytes; | ||
| 2159 | - // }); | ||
| 2160 | - return pngBytes; | 2109 | + static Future<Uint8List> canvas( |
| 2110 | + context, String _thumbnail, String month, String week) async { | ||
| 2111 | + var pictureRecorder = new ui.PictureRecorder(); // 图片记录仪 | ||
| 2112 | + var canvas = new Canvas(pictureRecorder); //canvas接受一个图片记录仪 | ||
| 2113 | + var images = await loadImage(_thumbnail, true); // 使用方法获取Unit8List格式的图片 | ||
| 2114 | + print(images); | ||
| 2115 | + // Paint _linePaint = new Paint() | ||
| 2116 | + // ..color = Colors.blue | ||
| 2117 | + // ..style = PaintingStyle.fill | ||
| 2118 | + // ..isAntiAlias = true | ||
| 2119 | + // ..strokeCap = StrokeCap.round | ||
| 2120 | + // ..strokeWidth = 500; | ||
| 2121 | + // Paint selfPaint = Paint() | ||
| 2122 | + // ..color = Colors.red | ||
| 2123 | + // ..style = PaintingStyle.fill | ||
| 2124 | + // ..isAntiAlias = true | ||
| 2125 | + // ..strokeCap = StrokeCap.butt | ||
| 2126 | + // ..strokeWidth = 2; | ||
| 2127 | + final paint = Paint() | ||
| 2128 | + ..color = Color.fromRGBO(0, 0, 0, 0.8) | ||
| 2129 | + ..style = PaintingStyle.fill; | ||
| 2130 | + | ||
| 2131 | + canvas.drawRect(Rect.fromLTWH(0, 0, 500, 400), paint); | ||
| 2132 | + | ||
| 2133 | + canvas.drawImage(images, Offset(0, 0), paint); | ||
| 2134 | + | ||
| 2135 | + | ||
| 2136 | + // 绘制文字 | ||
| 2137 | + ui.ParagraphBuilder pb2 = ui.ParagraphBuilder(ui.ParagraphStyle( | ||
| 2138 | + textAlign: TextAlign.center, | ||
| 2139 | + fontWeight: FontWeight.normal, | ||
| 2140 | + fontStyle: FontStyle.normal, | ||
| 2141 | + | ||
| 2142 | + // :MyColours.color_000000, | ||
| 2143 | + fontSize: 26)); | ||
| 2144 | + pb2.pushStyle(ui.TextStyle(color: MyColours.color_FFEFC5, fontSize: 26)); | ||
| 2145 | + pb2.addText( | ||
| 2146 | + '${Provider.of<UserModel>(context, listen: false).user.sellername}'); | ||
| 2147 | + | ||
| 2148 | + // 设置文本的宽度约束 | ||
| 2149 | + ParagraphConstraints pc2 = ui.ParagraphConstraints(width: 500); | ||
| 2150 | + ui.Paragraph paragraph2 = pb2.build()..layout(pc2); | ||
| 2151 | + canvas.drawParagraph(paragraph2, Offset(10, 40)); | ||
| 2152 | + | ||
| 2153 | + // 绘制文字 | ||
| 2154 | + ui.ParagraphBuilder pb = ui.ParagraphBuilder(ui.ParagraphStyle( | ||
| 2155 | + textAlign: TextAlign.center, | ||
| 2156 | + fontWeight: FontWeight.bold, | ||
| 2157 | + fontStyle: FontStyle.normal, | ||
| 2158 | + | ||
| 2159 | + // :MyColours.color_000000, | ||
| 2160 | + fontSize: 48)); | ||
| 2161 | + pb.pushStyle(ui.TextStyle(color: MyColours.color_FFEFC5, fontSize: 48)); | ||
| 2162 | + pb.addText(month); | ||
| 2163 | + | ||
| 2164 | + // 设置文本的宽度约束 | ||
| 2165 | + ParagraphConstraints pc = ui.ParagraphConstraints(width: 500); | ||
| 2166 | + ui.Paragraph paragraph = pb.build()..layout(pc); | ||
| 2167 | + canvas.drawParagraph(paragraph, Offset(10, 150)); | ||
| 2168 | + | ||
| 2169 | + // 绘制文字 | ||
| 2170 | + ui.ParagraphBuilder pb3 = ui.ParagraphBuilder(ui.ParagraphStyle( | ||
| 2171 | + textAlign: TextAlign.center, | ||
| 2172 | + fontWeight: FontWeight.bold, | ||
| 2173 | + fontStyle: FontStyle.normal, | ||
| 2174 | + | ||
| 2175 | + // :MyColours.color_000000, | ||
| 2176 | + fontSize: 42)); | ||
| 2177 | + pb3.pushStyle(ui.TextStyle(color: MyColours.color_FFEFC5, fontSize: 42)); | ||
| 2178 | + pb3.addText(week); | ||
| 2179 | + | ||
| 2180 | + // 设置文本的宽度约束 | ||
| 2181 | + ParagraphConstraints pc3 = ui.ParagraphConstraints(width: 500); | ||
| 2182 | + ui.Paragraph paragraph3 = pb3.build()..layout(pc3); | ||
| 2183 | + canvas.drawParagraph(paragraph3, Offset(10, 230)); | ||
| 2184 | + | ||
| 2185 | + //下面的代码是生成图片的关键代码,以上绘制文字和圆圈的代码可以忽略不计 | ||
| 2186 | + var picture = | ||
| 2187 | + await pictureRecorder.endRecording().toImage(500, 400); //设置生成图片的宽和高 | ||
| 2188 | + var pngImageBytes = | ||
| 2189 | + await picture.toByteData(format: ui.ImageByteFormat.png); | ||
| 2190 | + // var imgBytes = Uint8List.view(pngImageBytes.buffer); //这一行和下面这一行都是生成Uint8List格式的图片(原理还不知道) | ||
| 2191 | + Uint8List pngBytes = pngImageBytes.buffer.asUint8List(); | ||
| 2192 | + print(pngBytes); //pngBytes可以放在Image.memory()中预览 | ||
| 2193 | + // setState(() { | ||
| 2194 | + // imageMemory = pngBytes; | ||
| 2195 | + // Uint8List result = await resizeImage(pngBytes); //重置图片尺寸 | ||
| 2196 | + Uint8List result = await testFromFileComporessList(context, pngBytes); | ||
| 2197 | + return result; | ||
| 2161 | } | 2198 | } |
| 2162 | 2199 | ||
| 2163 | //分享邀请函 | 2200 | //分享邀请函 |
| 2164 | - static goShareInvicationToWeChat(BuildContext context, String rid, String uid, | ||
| 2165 | - {bool isWechat = true,String depositId}) async { | 2201 | + static goShareInvicationToWeChat( |
| 2202 | + BuildContext context, String rid, String uid, String month, String week, | ||
| 2203 | + {bool isWechat = true, String depositId}) async { | ||
| 2166 | String _webPageUrl = "http://colorcun.com/"; | 2204 | String _webPageUrl = "http://colorcun.com/"; |
| 2167 | // String _thumbnail = | 2205 | // String _thumbnail = |
| 2168 | // "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1"; | 2206 | // "https://xt04.colorcun.com/h5/index.html#/?id=163854&hasInvitation=1"; |
| @@ -2173,9 +2211,13 @@ class Utils { | @@ -2173,9 +2211,13 @@ class Utils { | ||
| 2173 | // String _thumbnail = sellerImage == null || sellerImage == '' | 2211 | // String _thumbnail = sellerImage == null || sellerImage == '' |
| 2174 | // ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png' | 2212 | // ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png' |
| 2175 | // : sellerImage; | 2213 | // : sellerImage; |
| 2176 | - Uint8List _thumbnail =await canvas(sellerImage == null || sellerImage == '' | ||
| 2177 | - ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png' | ||
| 2178 | - : sellerImage); | 2214 | + Uint8List _thumbnail = await canvas( |
| 2215 | + context, | ||
| 2216 | + sellerImage == null || sellerImage == '' | ||
| 2217 | + ? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png' | ||
| 2218 | + : sellerImage, | ||
| 2219 | + month, | ||
| 2220 | + week); | ||
| 2179 | String _title = | 2221 | String _title = |
| 2180 | "您预订的${Provider.of<UserModel>(context, listen: false).user.sellername},已经安排,点击查看详情"; | 2222 | "您预订的${Provider.of<UserModel>(context, listen: false).user.sellername},已经安排,点击查看详情"; |
| 2181 | 2223 | ||
| @@ -2193,25 +2235,24 @@ class Utils { | @@ -2193,25 +2235,24 @@ class Utils { | ||
| 2193 | String _userName = "gh_487873d353b3"; | 2235 | String _userName = "gh_487873d353b3"; |
| 2194 | // String _path = | 2236 | // String _path = |
| 2195 | // "pages/customer/index?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid"; | 2237 | // "pages/customer/index?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid"; |
| 2196 | - String _path = | 2238 | + String _path = |
| 2197 | "pages/customer/detail_owner_invitation_new?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid"; | 2239 | "pages/customer/detail_owner_invitation_new?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid"; |
| 2198 | - if(depositId != null){ | ||
| 2199 | - _path = | ||
| 2200 | - "pages/customer/detail_owner_invitation_new?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid&paymentId=$depositId"; | ||
| 2201 | - } | 2240 | + if (depositId != null) { |
| 2241 | + _path = | ||
| 2242 | + "pages/customer/detail_owner_invitation_new?id=$rid&hasInvitation=1&hasSellerShare=1&uid=$uid&paymentId=$depositId"; | ||
| 2243 | + } | ||
| 2202 | var model = new WeChatShareMiniProgramModel( | 2244 | var model = new WeChatShareMiniProgramModel( |
| 2203 | webPageUrl: _webPageUrl, | 2245 | webPageUrl: _webPageUrl, |
| 2204 | userName: _userName, | 2246 | userName: _userName, |
| 2205 | title: _title, | 2247 | title: _title, |
| 2206 | path: _path, | 2248 | path: _path, |
| 2207 | description: _description, | 2249 | description: _description, |
| 2208 | - miniProgramType: Constant.wxMiniProgramType, //体验版 | 2250 | + miniProgramType: Constant.wxMiniProgramType, // |
| 2209 | // miniProgramType: WXMiniProgramType.RELEASE, //正式版 | 2251 | // miniProgramType: WXMiniProgramType.RELEASE, //正式版 |
| 2210 | // miniProgramType: //开发版 | 2252 | // miniProgramType: //开发版 |
| 2211 | // thumbnail: WeChatImage.binary(source) | 2253 | // thumbnail: WeChatImage.binary(source) |
| 2212 | // thumbnail: WeChatImage.network(_thumbnail) | 2254 | // thumbnail: WeChatImage.network(_thumbnail) |
| 2213 | - thumbnail: WeChatImage.binary(_thumbnail) | ||
| 2214 | - ); | 2255 | + thumbnail: WeChatImage.binary(_thumbnail)); |
| 2215 | 2256 | ||
| 2216 | isSuccess = await shareToWeChat(model); | 2257 | isSuccess = await shareToWeChat(model); |
| 2217 | } else { | 2258 | } else { |
| @@ -2419,24 +2460,24 @@ class Utils { | @@ -2419,24 +2460,24 @@ class Utils { | ||
| 2419 | tempList.removeRange(0, int.parse(hour)); | 2460 | tempList.removeRange(0, int.parse(hour)); |
| 2420 | 2461 | ||
| 2421 | // if (minute != '45') { | 2462 | // if (minute != '45') { |
| 2422 | - Map<String, List<int>> map = tempList[0]; | ||
| 2423 | - Map mapNew = {}; | ||
| 2424 | - // map.map((key, value) { | ||
| 2425 | - | ||
| 2426 | - // mapNew[key] | ||
| 2427 | - // }); | ||
| 2428 | - | ||
| 2429 | - List<int> list = []; | ||
| 2430 | - map.forEach((key, value) { | ||
| 2431 | - value.forEach((element) { | ||
| 2432 | - if (int.parse(minute) <= element) { | ||
| 2433 | - list.add(element); | ||
| 2434 | - } | ||
| 2435 | - }); | ||
| 2436 | - mapNew[key] = list; | 2463 | + Map<String, List<int>> map = tempList[0]; |
| 2464 | + Map mapNew = {}; | ||
| 2465 | + // map.map((key, value) { | ||
| 2466 | + | ||
| 2467 | + // mapNew[key] | ||
| 2468 | + // }); | ||
| 2469 | + | ||
| 2470 | + List<int> list = []; | ||
| 2471 | + map.forEach((key, value) { | ||
| 2472 | + value.forEach((element) { | ||
| 2473 | + if (int.parse(minute) <= element) { | ||
| 2474 | + list.add(element); | ||
| 2475 | + } | ||
| 2437 | }); | 2476 | }); |
| 2438 | - tempList.removeAt(0); | ||
| 2439 | - tempList.insert(0, mapNew); | 2477 | + mapNew[key] = list; |
| 2478 | + }); | ||
| 2479 | + tempList.removeAt(0); | ||
| 2480 | + tempList.insert(0, mapNew); | ||
| 2440 | // } | 2481 | // } |
| 2441 | 2482 | ||
| 2442 | // tempList.replaceRange(0, 0, mapNew); | 2483 | // tempList.replaceRange(0, 0, mapNew); |
-
Please register or login to post a comment