Commit 1ca9de2a486c2054592ddc8ec6d7108e8d397b24

Authored by wdn127929
1 parent 0ba32b50

封面样式设置&短信手机卡发送

... ... @@ -18,19 +18,19 @@ if (flutterRoot == null) {
def flutterVersionCode = "520"
def flutterVersionCode = "529"
if (flutterVersionCode == null) {
flutterVersionCode = '520'
flutterVersionCode = '529'
}
def flutterVersionName = "5.2.0"
def flutterVersionName = "5.2.9"
if (flutterVersionName == null) {
flutterVersionName = '5.2.0'
flutterVersionName = '5.2.9'
}
... ...
... ... @@ -58,6 +58,7 @@ class GetDzSellerConfSunModel {
String isShowNoticeDeposit;
String depositPrice;
String liteStyle;
GetDzSellerConfSunModel(
{this.id,
... ... @@ -86,7 +87,8 @@ class GetDzSellerConfSunModel {
this.isAllowUpdate,
this.isShowRnamePhone,
this.isShowNoticeDeposit,
this.depositPrice});
this.depositPrice,
this.liteStyle});
GetDzSellerConfSunModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
... ... @@ -113,7 +115,7 @@ class GetDzSellerConfSunModel {
isNotice = json['is_seller_notice'];
isMarketing = json['is_seller_marketing'];
saiyouyun = json['saiyouyun'];
bookinginfo = json['bookinginfo'] != null&& json['bookinginfo'] != false
bookinginfo = json['bookinginfo'] != null && json['bookinginfo'] != false
? new Bookinginfo.fromJson(json['bookinginfo'])
: null;
isAllowUpdate = json['is_allow_update'] ?? '1';
... ... @@ -128,6 +130,7 @@ class GetDzSellerConfSunModel {
}
isShowNoticeDeposit = json['is_show_notice_deposit'];
depositPrice = json['deposit_price'];
liteStyle = json['lite_style'];
}
Map<String, dynamic> toJson() {
... ... @@ -161,6 +164,8 @@ class GetDzSellerConfSunModel {
data['is_show_ranme_phone'] = this.isShowRnamePhone;
data['is_show_notice_deposit'] = this.isShowNoticeDeposit;
data['deposit_price'] = this.depositPrice;
data['lite_style'] = this.liteStyle;
return data;
}
}
... ...
... ... @@ -446,6 +446,7 @@ class InvicationPageState extends State<InvicationPage>
},
showCircle: showCicle);
noticeSms = detailModel.isNotice;
if (detailModel.baseInfoSunModel != null) {
_baseIndoProvider.baseInfoSunModel = detailModel.baseInfoSunModel;
name = _baseIndoProvider.baseInfoSunModel.name;
... ... @@ -4855,6 +4856,24 @@ class InvicationPageState extends State<InvicationPage>
return date;
}
_getDsoltStrShow() {
String dsoltStr = '${ddateHm == null || ddateHm == '' ? '' : ddateHm}';
if (detailModel.liteStyle == '1') {
dsoltStr = detailModel.detailModelAllSunModel.ddateSolt == '1'
? '早上'
: detailModel.detailModelAllSunModel.ddateSolt == '2'
? '中午'
: '晚上';
} else if (detailModel.liteStyle == '3') {
dsoltStr = detailModel.detailModelAllSunModel.ddateSolt == '1'
? '早餐'
: detailModel.detailModelAllSunModel.ddateSolt == '2'
? '午餐'
: '晚餐';
}
return dsoltStr;
}
_createReserveDeposit() async {
if (detailModel.isShowNoticeDeposit == '1') {
//页面有预订订金选项
... ... @@ -4885,13 +4904,14 @@ class InvicationPageState extends State<InvicationPage>
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,
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
returnWeek(dateTime, context) + _getDsoltStrShow(),
detailModel.liteStyle,
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
... ... @@ -4907,8 +4927,8 @@ class InvicationPageState extends State<InvicationPage>
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}',
returnWeek(dateTime, context) + _getDsoltStrShow(),
detailModel.liteStyle,
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
... ... @@ -4923,8 +4943,8 @@ class InvicationPageState extends State<InvicationPage>
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}',
returnWeek(dateTime, context) + _getDsoltStrShow(),
detailModel.liteStyle,
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
... ... @@ -4938,8 +4958,8 @@ class InvicationPageState extends State<InvicationPage>
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}',
returnWeek(dateTime, context) + _getDsoltStrShow(),
detailModel.liteStyle,
depositId: detailModel.depositId);
print(isSuccess);
if (isSuccess) {
... ...
... ... @@ -598,6 +598,9 @@ class _CustomerNoticeSettingPageState extends State<CustomerNoticeSettingPage> {
_item('客户互动设置', onTap: () {
NavigatorUtil.goMarkingInteractionPage(context);
}),
_item('小程序通知卡片样式选择', onTap: () {
NavigatorUtil.goMiniprogramSettingPage(context);
}),
],
)),
)),
... ...
import 'package:flutter/material.dart';
import 'package:one_key/models/user.dart';
import 'package:one_key/widgets/system_app_bar.dart';
import 'package:one_key/widgets/v_empty_view.dart';
import 'package:provider/provider.dart';
import '../../../constant/state.dart';
import '../../../provider/marketing_center_provider.dart';
import '../../../provider/user_model.dart';
import '../../../res/colors.dart';
import '../../../utils/screen_util.dart';
import '../../../utils/utils.dart';
import '../../../widgets/MyDivider.dart';
import '../../../widgets/h_empty_view.dart';
import '../../../widgets/page_exception.dart';
import '../../../widgets/round_button.dart';
import '../../online_check/photo_view_wiget.dart';
import 'dart:convert' as convert;
import 'dart:math' as math;
import 'package:flutter_swiper/flutter_swiper.dart';
/**
*
* 小程序通知卡片样式
*/
class MiniprogramSettingPage extends StatefulWidget {
MiniprogramSettingPage({Key key}) : super(key: key);
@override
_MiniprogramSettingPageState createState() => _MiniprogramSettingPageState();
}
class _MiniprogramSettingPageState extends State<MiniprogramSettingPage> {
MarketingCenterProvider marketingCenterProvider;
ScrollController controller = ScrollController();
String miniType;
PageController pageController;
double pageOffset = 0;
SwiperController swiperController = SwiperController();
List<String> types = ['0', '1', '2', '3'];
User user;
@override
void initState() {
super.initState();
pageController = PageController(viewportFraction: 1);
pageController.addListener(() {
setState(() => pageOffset = pageController.page);
});
WidgetsBinding.instance.addPostFrameCallback((_) async {
getDzSellerConf();
});
}
getDzSellerConf() async {
bool success = await marketingCenterProvider.getDzSellerConf(context,
showLoading: false, selfDismiss: true);
if (success) {
marketingCenterProvider.pageStateSettingMini = PageState.Success;
miniType = marketingCenterProvider.dzSellerConfModel.liteStyle ?? '2';
int index = types.indexOf(miniType);
if (index >= 0) {
swiperController.index = index;
}
} else {
marketingCenterProvider.pageStateSettingMini =
PageState.ConnectivityError;
}
setState(() {});
}
String returnWeek(DateTime day, BuildContext context) {
String date = "周${Utils.formatWeekDayNum(day.weekday)} ";
return date;
}
@override
Widget build(BuildContext context) {
marketingCenterProvider =
Provider.of<MarketingCenterProvider>(context, listen: true);
user = Provider.of<UserModel>(context, listen: false).user;
return Scaffold(
backgroundColor: MyColours.color_ffffff,
appBar: SystemAppBar('小程序通知卡片样式'),
body: Consumer<MarketingCenterProvider>(builder: (context1, model, _) {
if (model.pageStateSettingMini != PageState.Success) {
return ExceptionPage(
pageState: model.pageStateSettingMini,
callback: () async {},
emptyMsg: "暂时没有信息展示哦",
emptyImg: "empty_search",
showMsg: "加载中,请稍后...",
);
} else {
return Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
Container(
width: double.infinity,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(
left: w(16), top: w(12), bottom: w(11), right: w(16)),
child: Text(
'通知主题选择(左右滑动选择要使用的主题)',
style: TextStyle(
color: MyColours.color_515151, fontSize: font(16)),
)),
Padding(
padding: EdgeInsets.only(left: w(16)),
child: MyDivider(double.infinity, w(0.5),
color: MyColours.color_E7E7E7)),
VEmptyView(240),
Container(
height: w(145),
child: Swiper(
controller: swiperController,
itemBuilder: (BuildContext context, int index) {
if (types[index] == '0') {
return Container(
color: Color.fromRGBO(81, 81, 81, 0.4),
padding: EdgeInsets.symmetric(horizontal: w(10)),
width: w(180),
height: h(145),
alignment: Alignment.center,
child: Text(
'无样式',
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_FFEFC5,
fontSize: font(20)),
),
);
}
return Container(
color: Color.fromRGBO(81, 81, 81, 0.4),
padding: EdgeInsets.symmetric(horizontal: w(10)),
width: w(180),
height: h(145),
child: Column(
children: [
VEmptyView(20),
Text(
'${Provider.of<UserModel>(context, listen: false).user.sellername}',
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_FFEFC5,
fontSize: font(12)),
),
VEmptyView(50),
Text(
'${Utils.addZeroNumber(DateTime.now().month)}月${Utils.addZeroNumber(DateTime.now().day)}日',
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_FFEFC5,
fontWeight: FontWeight.bold,
fontSize: font(20)),
),
VEmptyView(10),
Text(
returnWeek(DateTime.now(), context) +
(types[index] == '1'
? '中午'
: types[index] == '2'
? (user.noon != '00:00'
? user.noon.split('-')[0]
: '14:30')
: '午餐'),
textAlign: TextAlign.center,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: MyColours.color_FFEFC5,
fontWeight: FontWeight.bold,
fontSize: font(18)),
)
],
),
);
},
onTap: (v) {
print(v);
},
onIndexChanged: (index) {
print(index);
miniType = types[index];
// marketingCenterProvider.isThemeTitle =
// marketingCenterProvider
// .templeteDatas[index].isSetTitle ==
// '1'
// ? true
// : false;
// marketingCenterProvider.isThemeColor =
// marketingCenterProvider
// .templeteDatas[index].isSetColor ==
// '1'
// ? true
// : false;
// setState(() {
// swiperController.index = index;
// });
// 当前选中的主题
},
index: swiperController.index,
itemCount: types.length,
viewportFraction: 0.5,
scale: 0.4,
))
],
))),
Container(
padding:
EdgeInsets.symmetric(horizontal: w(24), vertical: w(35)),
child: Row(
children: [
RoundButton(
text: '返回',
width: w(100),
height: w(43),
radius: r(5),
fontSize: 32,
isBold: true,
gradientStart: MyColours.color_ffffff,
gradientEnd: MyColours.color_ffffff,
textColor: MyColours.color_438E93,
borderColor: MyColours.color_438E93,
onPressed: () {
Navigator.pop(context);
},
),
HEmptyView(24),
Expanded(
child: RoundButton(
text: '保存并返回',
height: w(43),
radius: r(5),
isBold: true,
fontSize: 32,
gradientStart: MyColours.color_438E93,
gradientEnd: MyColours.color_438E93,
textColor: MyColours.color_ffffff,
borderColor: MyColours.color_438E93,
onPressed: () async {
bool success = await marketingCenterProvider.setConfing(
context,
{
'sid':
Provider.of<UserModel>(context, listen: false)
.user
.sellerid,
'key': 'lite_style',
'value': miniType
},
needToast: false);
if (success) {
Navigator.pop(context);
}
},
)),
],
),
)
],
);
}
}),
);
}
}
class SlidingCard extends StatelessWidget {
final double offset;
final String movie;
final int index;
const SlidingCard({this.offset, this.movie, this.index});
@override
Widget build(BuildContext context) {
int select = 0;
double gauss = math.exp(-(math.pow((offset.abs() - 0.5), 2) / 0.08));
if (Offset(-32 * gauss * offset.sign, 0).dx == -0.0) {
//最中间的图
select = index;
}
return Transform.translate(
offset: Offset(-32 * gauss * offset.sign, 0),
child: InkWell(
onTap: () {
print(gauss);
print(Offset(-32 * gauss * offset.sign, 0));
print(index);
},
child: Card(
margin: EdgeInsets.only(left: 8, right: 8, bottom: 8),
elevation: 8,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(32),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(
r(10),
),
child: Image.network(
'${movie}',
width: select == index ? w(375) : w(179),
height: select == index ? w(359) : w(90),
// height: MediaQuery.of(context).size.height * 0.3,
alignment: Alignment(-offset.abs(), 0),
fit: BoxFit.cover,
),
),
// SizedBox(
// height: 8,
// ),
// Expanded(
// child: Padding(
// padding: const EdgeInsets.all(8.0),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: <Widget>[
// Text(
// '${movie.name}',
// style:
// TextStyle(fontSize: 20, fontWeight: FontWeight.bold),
// ),
// SizedBox(
// height: 10,
// ),
// Text(
// '上架时间: ${movie.date}',
// style: TextStyle(
// fontSize: 14, fontWeight: FontWeight.normal),
// ),
// Text(
// '${movie.intor}',
// style: TextStyle(
// fontSize: 14,
// fontWeight: FontWeight.normal,
// ),
// ),
// Spacer(),
// Row(
// children: <Widget>[
// SizedBox(width: 16,),
// Text(
// '${movie.price}',
// style: TextStyle(
// fontSize: 18, fontWeight: FontWeight.bold),
// ),
// Spacer(),
// MaterialButton(
// onPressed: () {},
// color: Colors.black,
// child: Text('购买'),
// textColor: Colors.white,
// shape: RoundedRectangleBorder(
// borderRadius: BorderRadius.circular(32),
// ),
// ),
// SizedBox(width: 16,),
// ],
// ),
// ],
// ),
// ),
// ),
)),
);
}
}
... ...
... ... @@ -4808,6 +4808,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
'0'
);
print(isSuccess);
if (isSuccess) {
... ... @@ -4825,6 +4826,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
'0'
);
if (isSuccess) {
_addForward();
... ... @@ -4869,6 +4871,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
'0'
);
print(isSuccess);
if (isSuccess) {
... ... @@ -4885,6 +4888,7 @@ class InvicationPageSimState extends State<InvicationPageSim>
'${Utils.addZeroNumber(dateTime.month)}月${Utils.addZeroNumber(dateTime.day)}日',
returnWeek(dateTime, context) +
'${ddateHm == null || ddateHm == '' ? '' : ddateHm}',
'0'
);
if (isSuccess) {
_addForward();
... ...
... ... @@ -33,7 +33,7 @@ class MarketingCenterProvider extends ChangeNotifier {
PageState pageStateBookInfo = PageState.Loading;
PageState pageStateThemeHome = PageState.Loading;
PageState pageStateSetting = PageState.Loading;
PageState pageStateSettingMini = PageState.Loading;
List<RechargeListSunModel> rechargeList = [];
List<RechargeListSunModel> rechargeListHistory = [];
... ...
... ... @@ -94,6 +94,8 @@ class NotebookDetailModel extends ChangeNotifier {
String reserveImgText;
String smsContent = '';
String isShowNoticeDeposit;
String liteStyle = '2';
bool isNotice = false;
NotebookDetailModel() {
initSexList();
... ... @@ -221,6 +223,11 @@ class NotebookDetailModel extends ChangeNotifier {
if (baseResp.data['template_param'] != null) {
smsContent = baseResp.data["template_param"];
}
if (baseResp.data['is_seller_notice'] != null) {
isNotice = baseResp.data["is_seller_notice"] == '1'?true:false;
}
if (baseResp.data['is_show_ranme_phone'] != null &&
baseResp.data['is_show_ranme_phone'] != '') {
... ... @@ -247,6 +254,9 @@ class NotebookDetailModel extends ChangeNotifier {
if (baseResp.data['is_show_notice_deposit'] != null) {
isShowNoticeDeposit = baseResp.data['is_show_notice_deposit'];
}
if (baseResp.data['lite_style'] != null) {
liteStyle = baseResp.data['lite_style'];
}
if (baseResp.data['deposit_price'] != null) {
depositPrice = baseResp.data['deposit_price'];
}
... ...
... ... @@ -2243,4 +2243,16 @@ class NavigatorUtil {
return _navigateTo(context, "${Routes.payment_setting_page}",
replace: replace);
}
//小程序通知卡片样式
static Future<dynamic> goMiniprogramSettingPage(
BuildContext context, {
replace = false,
}) {
return _navigateTo(context, "${Routes.mini_program_setting_page}",
replace: replace);
}
}
... ...
... ... @@ -232,6 +232,7 @@ import '../pages/my/marketing_center/invitation_theme_home_page.dart';
import '../pages/my/marketing_center/invitation_theme_home_preview_page.dart';
import '../pages/my/marketing_center/marketing_center_home_page.dart';
import '../pages/my/marketing_center/mini_program_setting_page.dart';
import '../pages/my/marketing_center/order_setting_manager_page.dart';
import '../pages/my/marketing_center/order_setting_page.dart';
import '../pages/my/marketing_center/payment_setting_page.dart';
... ... @@ -3853,3 +3854,20 @@ var paymentSettingPageHandle = new Handler(
child: ChangeNotifierProvider<StoreBaseIndoProvider>(
create: (_) => StoreBaseIndoProvider(), child: PaymentSettingPage()));
});
///小程序通知卡片样式
var miniprogramSettingPageHandle = new Handler(
handlerFunc: (BuildContext context, Map<String, List<Object>> params) {
// String rid = params["rid"].first;
// // String smsTemplate = params["smsTemplate"].first;
// CouponUse use = CouponUse.fromJson(
// json.decode(FluroConvertUtils.fluroCnParamsDecode(params["use"].first)));
// CouponSunModel couponSunModel = CouponSunModel.fromJson(json.decode(
// FluroConvertUtils.fluroCnParamsDecode(params["couponSunModel"].first)));
return ChangeNotifierProvider<MarketingCenterProvider>(
create: (_) => MarketingCenterProvider(),
child: MiniprogramSettingPage());
});
... ...
... ... @@ -385,6 +385,11 @@ class Routes {
static String select_table_f_or_reserve =
"/select_table_f_or_reserve"; //在客户预订通知中,增加支付订金功能
static String mini_program_setting_page =
"/mini_program_setting_page"; //小程序封面样式设置
static void configureRoutes(FluroRouter router) {
router.notFoundHandler = new Handler(
handlerFunc: (BuildContext context, Map<String, List<String>> params) {
... ... @@ -721,5 +726,9 @@ router.define(select_table_f_or_reserve, handler: handleSelectTableFOrReserveHan
router.define(invication_addition_page,
handler: invicationAdditionPageHandle);
router.define(payment_setting_page, handler: paymentSettingPageHandle);
router.define(mini_program_setting_page, handler: miniprogramSettingPageHandle);
}
}
... ...
... ... @@ -2349,8 +2349,8 @@ class Utils {
}
//分享邀请函
static goShareInvicationToWeChat(
BuildContext context, String rid, String uid, String month, String week,
static goShareInvicationToWeChat(BuildContext context, String rid, String uid,
String month, String week, String liteStyle,
{bool isWechat = true, String depositId}) async {
String _webPageUrl = "http://colorcun.com/";
// String _thumbnail =
... ... @@ -2359,16 +2359,19 @@ class Utils {
// "https://qn.colorcun.com/reserve/images/%E5%BE%AE%E4%BF%A1%E5%9B%BE%E7%89%87_201911151148572.jpg";
String sellerImage =
Provider.of<UserModel>(context, listen: false).user.sellerimage;
// String _thumbnail = 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 _thumbnail = sellerImage == null || sellerImage == ''
? 'http://nosqn.colorcun.com/reserve/images/3x/%E6%9A%82%E6%97%A0.png'
: sellerImage;
Uint8List _thumbnailUint8List;
if (liteStyle != '0') {
_thumbnailUint8List = 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},已经安排,点击查看详情";
... ... @@ -2403,7 +2406,9 @@ class Utils {
// miniProgramType: //开发版
// thumbnail: WeChatImage.binary(source)
// thumbnail: WeChatImage.network(_thumbnail)
thumbnail: WeChatImage.binary(_thumbnail));
thumbnail: liteStyle == '0'
? WeChatImage.network(_thumbnail)
: WeChatImage.binary(_thumbnailUint8List));
isSuccess = await shareToWeChat(model);
} else {
... ...