Showing
10 changed files
with
401 additions
and
228 deletions
| @@ -97,6 +97,9 @@ class CouponSunModel extends Object { | @@ -97,6 +97,9 @@ class CouponSunModel extends Object { | ||
| 97 | @JsonKey(name: 'grant_num') | 97 | @JsonKey(name: 'grant_num') |
| 98 | String grantNum; | 98 | String grantNum; |
| 99 | 99 | ||
| 100 | + @JsonKey(name: 'urllink') | ||
| 101 | + String urllink; | ||
| 102 | + | ||
| 100 | bool isCheck = false; | 103 | bool isCheck = false; |
| 101 | bool showText = false; | 104 | bool showText = false; |
| 102 | bool isMarking = false; | 105 | bool isMarking = false; |
| @@ -123,7 +126,8 @@ class CouponSunModel extends Object { | @@ -123,7 +126,8 @@ class CouponSunModel extends Object { | ||
| 123 | this.use, | 126 | this.use, |
| 124 | this.expDate, | 127 | this.expDate, |
| 125 | this.nickNameShow, | 128 | this.nickNameShow, |
| 126 | - this.grantNum); | 129 | + this.grantNum, |
| 130 | + this.urllink); | ||
| 127 | 131 | ||
| 128 | factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) => | 132 | factory CouponSunModel.fromJson(Map<String, dynamic> srcJson) => |
| 129 | _$CouponSunModelFromJson(srcJson); | 133 | _$CouponSunModelFromJson(srcJson); |
| @@ -60,6 +60,7 @@ CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) { | @@ -60,6 +60,7 @@ CouponSunModel _$CouponSunModelFromJson(Map<String, dynamic> json) { | ||
| 60 | : null, | 60 | : null, |
| 61 | json['nick_name'] as String, | 61 | json['nick_name'] as String, |
| 62 | json['grant_num'] as String, | 62 | json['grant_num'] as String, |
| 63 | + json['urllink'] as String, | ||
| 63 | ); | 64 | ); |
| 64 | } | 65 | } |
| 65 | 66 | ||
| @@ -86,7 +87,8 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) => | @@ -86,7 +87,8 @@ Map<String, dynamic> _$CouponSunModelToJson(CouponSunModel instance) => | ||
| 86 | 'use': instance.use, | 87 | 'use': instance.use, |
| 87 | 'exp_date': instance.expDate, | 88 | 'exp_date': instance.expDate, |
| 88 | 'nick_name': instance.nickNameShow, | 89 | 'nick_name': instance.nickNameShow, |
| 89 | - 'grant_num': instance.grantNum | 90 | + 'grant_num': instance.grantNum, |
| 91 | + 'urllink':instance.urllink, | ||
| 90 | }; | 92 | }; |
| 91 | 93 | ||
| 92 | CouponUse _$CouponUseFromJson(Map<String, dynamic> json) { | 94 | CouponUse _$CouponUseFromJson(Map<String, dynamic> json) { |
lib/models/marketing_sms_template_model.dart
0 → 100644
| 1 | +class MarketingSmsTemplateModel { | ||
| 2 | + int ret; | ||
| 3 | + List<MarketingSmsTemplateSunModel> data; | ||
| 4 | + String msg; | ||
| 5 | + | ||
| 6 | + MarketingSmsTemplateModel({this.ret, this.data, this.msg}); | ||
| 7 | + | ||
| 8 | + MarketingSmsTemplateModel.fromJson(Map<String, dynamic> json) { | ||
| 9 | + ret = json['ret']; | ||
| 10 | + if (json['data'] != null) { | ||
| 11 | + data = <MarketingSmsTemplateSunModel>[]; | ||
| 12 | + json['data'].forEach((v) { | ||
| 13 | + data.add(new MarketingSmsTemplateSunModel.fromJson(v)); | ||
| 14 | + }); | ||
| 15 | + } | ||
| 16 | + msg = json['msg']; | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + Map<String, dynamic> toJson() { | ||
| 20 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 21 | + data['ret'] = this.ret; | ||
| 22 | + if (this.data != null) { | ||
| 23 | + data['data'] = this.data.map((v) => v.toJson()).toList(); | ||
| 24 | + } | ||
| 25 | + data['msg'] = this.msg; | ||
| 26 | + return data; | ||
| 27 | + } | ||
| 28 | +} | ||
| 29 | + | ||
| 30 | +class MarketingSmsTemplateSunModel { | ||
| 31 | + String title; | ||
| 32 | + String content; | ||
| 33 | + | ||
| 34 | + MarketingSmsTemplateSunModel({this.title, this.content}); | ||
| 35 | + | ||
| 36 | + MarketingSmsTemplateSunModel.fromJson(Map<String, dynamic> json) { | ||
| 37 | + title = json['title']; | ||
| 38 | + content = json['content']; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + Map<String, dynamic> toJson() { | ||
| 42 | + final Map<String, dynamic> data = new Map<String, dynamic>(); | ||
| 43 | + data['title'] = this.title; | ||
| 44 | + data['content'] = this.content; | ||
| 45 | + return data; | ||
| 46 | + } | ||
| 47 | +} |
| @@ -487,4 +487,7 @@ class HttpUrl { | @@ -487,4 +487,7 @@ class HttpUrl { | ||
| 487 | static const String create_activity_url_link = | 487 | static const String create_activity_url_link = |
| 488 | "?service=App.Wechat.CreateActivityUrlLink"; // 创建商家优惠券小程序URL | 488 | "?service=App.Wechat.CreateActivityUrlLink"; // 创建商家优惠券小程序URL |
| 489 | 489 | ||
| 490 | + static const String get_marketing_sms_template = | ||
| 491 | + "?service=App.SendSMS.GetMarketingSmsTemplate"; // 获取营销短信模板列表 | ||
| 492 | + | ||
| 490 | } | 493 | } |
| @@ -278,22 +278,14 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | @@ -278,22 +278,14 @@ class _CouponEidtPageState extends State<CouponEidtPage> { | ||
| 278 | bool isSuccess = | 278 | bool isSuccess = |
| 279 | await couponProvider.createCustomerActivity(context, params); | 279 | await couponProvider.createCustomerActivity(context, params); |
| 280 | if (isSuccess) { | 280 | if (isSuccess) { |
| 281 | - //创建券的二维码 | ||
| 282 | - Map<String, String> param = { | ||
| 283 | - "sid": Provider.of<UserModel>(context, listen: false).user.sellerid, | ||
| 284 | - "id": couponProvider.couponId, | ||
| 285 | - }; | ||
| 286 | - bool success = await couponProvider.createActivityUrlLink(context, param); | ||
| 287 | - if (success) { | ||
| 288 | - //成功之后跳回前一个页面 | ||
| 289 | - // bus.emit('refresh_coupon_list'); | ||
| 290 | - EventBus().emit('refresh_coupon_invitation'); | ||
| 291 | - bus.emit('refresh_coupon_list_f'); | ||
| 292 | - // bus.emit('refresh_marketting_page'); | 281 | + //成功之后跳回前一个页面 |
| 282 | + // bus.emit('refresh_coupon_list'); | ||
| 283 | + EventBus().emit('refresh_coupon_invitation'); | ||
| 284 | + bus.emit('refresh_coupon_list_f'); | ||
| 285 | + // bus.emit('refresh_marketting_page'); | ||
| 293 | 286 | ||
| 294 | - bus.emit('refresh_table_m_coupon'); | ||
| 295 | - Navigator.pop(context, true); | ||
| 296 | - } | 287 | + bus.emit('refresh_table_m_coupon'); |
| 288 | + Navigator.pop(context, true); | ||
| 297 | } | 289 | } |
| 298 | } | 290 | } |
| 299 | 291 |
| @@ -496,7 +496,7 @@ class _MyContactListPageState extends State<MyContactListPage> { | @@ -496,7 +496,7 @@ class _MyContactListPageState extends State<MyContactListPage> { | ||
| 496 | } | 496 | } |
| 497 | 497 | ||
| 498 | NavigatorUtil.goMyCustomerDetailPage( | 498 | NavigatorUtil.goMyCustomerDetailPage( |
| 499 | - context, model, widget.fromPage,widget.uid); | 499 | + context, model, widget.fromPage, widget.uid); |
| 500 | } | 500 | } |
| 501 | }, | 501 | }, |
| 502 | child: Container( | 502 | child: Container( |
| @@ -565,7 +565,7 @@ class _MyContactListPageState extends State<MyContactListPage> { | @@ -565,7 +565,7 @@ class _MyContactListPageState extends State<MyContactListPage> { | ||
| 565 | Container( | 565 | Container( |
| 566 | width: w(70), | 566 | width: w(70), |
| 567 | child: Text( | 567 | child: Text( |
| 568 | - widget.sellerPreserve??true | 568 | + widget.sellerPreserve ?? true |
| 569 | ? model.phone | 569 | ? model.phone |
| 570 | : Utils.starPhone('${model.phone}'), | 570 | : Utils.starPhone('${model.phone}'), |
| 571 | overflow: TextOverflow.ellipsis, | 571 | overflow: TextOverflow.ellipsis, |
| @@ -629,7 +629,7 @@ class _MyContactListPageState extends State<MyContactListPage> { | @@ -629,7 +629,7 @@ class _MyContactListPageState extends State<MyContactListPage> { | ||
| 629 | if (model.isMember == '1' || model.isMember == '0') | 629 | if (model.isMember == '1' || model.isMember == '0') |
| 630 | flatBtn(model.isMember == '1' ? '会员' : '非会员', | 630 | flatBtn(model.isMember == '1' ? '会员' : '非会员', |
| 631 | MyColours.color_438E93), | 631 | MyColours.color_438E93), |
| 632 | - '${model.storeDay}' != '0' | 632 | + '${model.storeDay}' != '0' && model.storeDay != null |
| 633 | ? flatBtn('存酒${model.storeDay}天', | 633 | ? flatBtn('存酒${model.storeDay}天', |
| 634 | MyColours.color_438E93) | 634 | MyColours.color_438E93) |
| 635 | : SizedBox() | 635 | : SizedBox() |
| @@ -59,28 +59,28 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | @@ -59,28 +59,28 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | ||
| 59 | String andriodPhone = ''; | 59 | String andriodPhone = ''; |
| 60 | List<String> iosPhone = []; | 60 | List<String> iosPhone = []; |
| 61 | 61 | ||
| 62 | - List<TemplateModel> data = []; | 62 | + // List<TemplateModel> data = []; |
| 63 | 63 | ||
| 64 | @override | 64 | @override |
| 65 | void initState() { | 65 | void initState() { |
| 66 | super.initState(); | 66 | super.initState(); |
| 67 | 67 | ||
| 68 | - UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 69 | - | ||
| 70 | - data = [ | ||
| 71 | - TemplateModel('新菜上市', | ||
| 72 | - '尊敬的贵宾,本店最近有新菜上市,欢迎您来品尝,活动期间一律7折,提前预订热线${userModel.user.sellerphone},${userModel.user.sellername}全体员工恭候您的大驾光临!'), | ||
| 73 | - TemplateModel('生日营销1', | ||
| 74 | - '尊敬的贵宾,${userModel.user.sellername}全体员工提前祝您生日快乐!凡是生日当天在本店享有7折的优惠,并且为您准备了一份精美小礼品,快快来领取吧!详情请点击{礼品领取链接}。'), | ||
| 75 | - TemplateModel('生日营销2', | ||
| 76 | - '尊敬的贵宾,提前祝您生日快乐!${userModel.user.sellername}从来也没忘记在这样特别的日子里祝您:生日快乐,生活幸福。生日当天在本店消费享有6折优惠!'), | ||
| 77 | - TemplateModel('节日', | ||
| 78 | - '尊敬的贵宾:值xx节日将至,在x月x日至x日,到我店消费即可免费领取价值98节日礼包一份,大礼不断,优惠不断!详情请点击{礼品领取链接}。'), | ||
| 79 | - TemplateModel('存酒超期', | ||
| 80 | - '尊敬的贵宾:您在我店存放的酒水已经等待您30天了!已开启酒水长期存放将影响口感,${userModel.user.sellername}全体员工期待您早日到店享用完毕,静候您的光临!'), | ||
| 81 | - TemplateModel('沉睡唤醒', | ||
| 82 | - '尊敬的贵宾:对不起!很冒昧的给您发这条短信,我是${userModel.user.sellername}的${userModel.user.nickName ?? ''}.您都有很长一段时间没来我们这里了,我们非常想念您。或许是我们的服务还没有让您满意,或许是给您搭配的餐品还没有满足您的需求,总之,都是我们做的不够好!我们正在不断的改进,希望可以变得更完美,请您原谅以往我们的不足,有空回來看看我们!为您准备了一份精美小礼品,快快来领取吧!详情请点击{礼品领取链接}。') | ||
| 83 | - ]; | 68 | + // UserModel userModel = Provider.of<UserModel>(context, listen: false); |
| 69 | + | ||
| 70 | + // data = [ | ||
| 71 | + // TemplateModel('新菜上市', | ||
| 72 | + // '尊敬的贵宾,本店最近有新菜上市,欢迎您来品尝,活动期间一律7折,提前预订热线${userModel.user.sellerphone},${userModel.user.sellername}全体员工恭候您的大驾光临!'), | ||
| 73 | + // TemplateModel('生日营销1', | ||
| 74 | + // '尊敬的贵宾,${userModel.user.sellername}全体员工提前祝您生日快乐!凡是生日当天在本店享有7折的优惠,并且为您准备了一份精美小礼品,快快来领取吧!详情请点击{礼品领取链接}。'), | ||
| 75 | + // TemplateModel('生日营销2', | ||
| 76 | + // '尊敬的贵宾,提前祝您生日快乐!${userModel.user.sellername}从来也没忘记在这样特别的日子里祝您:生日快乐,生活幸福。生日当天在本店消费享有6折优惠!'), | ||
| 77 | + // TemplateModel('节日', | ||
| 78 | + // '尊敬的贵宾:值xx节日将至,在x月x日至x日,到我店消费即可免费领取价值98节日礼包一份,大礼不断,优惠不断!详情请点击{礼品领取链接}。'), | ||
| 79 | + // TemplateModel('存酒超期', | ||
| 80 | + // '尊敬的贵宾:您在我店存放的酒水已经等待您30天了!已开启酒水长期存放将影响口感,${userModel.user.sellername}全体员工期待您早日到店享用完毕,静候您的光临!'), | ||
| 81 | + // TemplateModel('沉睡唤醒', | ||
| 82 | + // '尊敬的贵宾:对不起!很冒昧的给您发这条短信,我是${userModel.user.sellername}的${userModel.user.nickName ?? ''}.您都有很长一段时间没来我们这里了,我们非常想念您。或许是我们的服务还没有让您满意,或许是给您搭配的餐品还没有满足您的需求,总之,都是我们做的不够好!我们正在不断的改进,希望可以变得更完美,请您原谅以往我们的不足,有空回來看看我们!为您准备了一份精美小礼品,快快来领取吧!详情请点击{礼品领取链接}。') | ||
| 83 | + // ]; | ||
| 84 | 84 | ||
| 85 | _focusNode.addListener(() { | 85 | _focusNode.addListener(() { |
| 86 | if (_focusNode.hasFocus) { | 86 | if (_focusNode.hasFocus) { |
| @@ -95,6 +95,7 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | @@ -95,6 +95,7 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | ||
| 95 | } | 95 | } |
| 96 | }); | 96 | }); |
| 97 | WidgetsBinding.instance.addPostFrameCallback((_) async { | 97 | WidgetsBinding.instance.addPostFrameCallback((_) async { |
| 98 | + _getMarketingSmsTemplate(); | ||
| 98 | _couponNetworkData(isShowLoading: false); | 99 | _couponNetworkData(isShowLoading: false); |
| 99 | if (widget.fromPage == FromPage.FromPageMakeRecordDetail) { | 100 | if (widget.fromPage == FromPage.FromPageMakeRecordDetail) { |
| 100 | _getGuestByGid(widget.selfList.gid); | 101 | _getGuestByGid(widget.selfList.gid); |
| @@ -106,6 +107,11 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | @@ -106,6 +107,11 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | ||
| 106 | }); | 107 | }); |
| 107 | } | 108 | } |
| 108 | 109 | ||
| 110 | + _getMarketingSmsTemplate({bool isShowLoading = true}) async { | ||
| 111 | + await customerProvider.getMarketingSmsTemplate(context, | ||
| 112 | + isShowLoading: isShowLoading); | ||
| 113 | + } | ||
| 114 | + | ||
| 109 | _getPhoneAndGid() { | 115 | _getPhoneAndGid() { |
| 110 | andriodPhone = ''; | 116 | andriodPhone = ''; |
| 111 | iosPhone = []; | 117 | iosPhone = []; |
| @@ -290,12 +296,21 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | @@ -290,12 +296,21 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | ||
| 290 | 296 | ||
| 291 | List<Widget> _templateUI() { | 297 | List<Widget> _templateUI() { |
| 292 | List<Widget> templates = []; | 298 | List<Widget> templates = []; |
| 293 | - data.forEach((element) { | 299 | + customerProvider.marketingSmsData.forEach((element) { |
| 294 | templates.add(InkWell( | 300 | templates.add(InkWell( |
| 295 | onTap: () { | 301 | onTap: () { |
| 296 | //选择模版.默认数据 | 302 | //选择模版.默认数据 |
| 297 | 303 | ||
| 298 | - customerMakingProvider.controller.text = element.content; | 304 | + String newStr = ''; |
| 305 | + UserModel userModel = | ||
| 306 | + Provider.of<UserModel>(context, listen: false); | ||
| 307 | + newStr = | ||
| 308 | + element.content.replaceAll('{店铺名称}', userModel.user.sellername); | ||
| 309 | + newStr = newStr.replaceAll('{店铺电话号码}', userModel.user.sellerphone); | ||
| 310 | + newStr = newStr.replaceAll('{经理名称}', userModel.user.nickName ?? ''); | ||
| 311 | + newStr = newStr.replaceAll('{礼品领取链接}', ''); | ||
| 312 | + | ||
| 313 | + customerMakingProvider.controller.text = newStr; | ||
| 299 | }, | 314 | }, |
| 300 | child: Container( | 315 | child: Container( |
| 301 | padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)), | 316 | padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)), |
| @@ -315,6 +330,28 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | @@ -315,6 +330,28 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | ||
| 315 | return templates; | 330 | return templates; |
| 316 | } | 331 | } |
| 317 | 332 | ||
| 333 | + _insertUrllink(String link) { | ||
| 334 | + // *************开始直接插入会报错***********还没有改 | ||
| 335 | + | ||
| 336 | + var cursorPos = | ||
| 337 | + customerMakingProvider.controller.selection.base.offset; //获取到光标的在字符串的位置 | ||
| 338 | + | ||
| 339 | + if (cursorPos < 0) { | ||
| 340 | + customerMakingProvider.controller.text += link; | ||
| 341 | + } else { | ||
| 342 | + String textAfterCursor = customerMakingProvider.controller.text | ||
| 343 | + .substring(cursorPos); //把字符串从光标的位置截取,光标后面的 | ||
| 344 | + | ||
| 345 | + String textBeforeCursor = customerMakingProvider.controller.text | ||
| 346 | + .substring(0, cursorPos); //光标前面的字符串 | ||
| 347 | + customerMakingProvider.controller.text = | ||
| 348 | + textBeforeCursor + link + textAfterCursor; //把想要的插入的内容拼接在光标位置处 | ||
| 349 | + | ||
| 350 | + customerMakingProvider.controller.selection = TextSelection.collapsed( | ||
| 351 | + offset: customerMakingProvider.controller.text.length); | ||
| 352 | + } | ||
| 353 | + } | ||
| 354 | + | ||
| 318 | ///短信内容编辑UI | 355 | ///短信内容编辑UI |
| 319 | Widget _contentWidget(String hintText) { | 356 | Widget _contentWidget(String hintText) { |
| 320 | return Container( | 357 | return Container( |
| @@ -379,38 +416,38 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | @@ -379,38 +416,38 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | ||
| 379 | }, | 416 | }, |
| 380 | ), | 417 | ), |
| 381 | VEmptyView(20), | 418 | VEmptyView(20), |
| 382 | - // Container( | ||
| 383 | - // padding: EdgeInsets.only(left: w(10), right: w(10), bottom: w(10)), | ||
| 384 | - // decoration: BoxDecoration( | ||
| 385 | - // borderRadius: BorderRadius.circular(r(5)), | ||
| 386 | - // border: Border.all(width: w(1), color: MyColours.color_F8F7F3)), | ||
| 387 | - // child: Column( | ||
| 388 | - // crossAxisAlignment: CrossAxisAlignment.start, | ||
| 389 | - // children: [ | ||
| 390 | - // Container( | ||
| 391 | - // height: w(34), | ||
| 392 | - // alignment: Alignment.centerLeft, | ||
| 393 | - // child: Text( | ||
| 394 | - // '常用模版', | ||
| 395 | - // style: TextStyle( | ||
| 396 | - // color: MyColours.color_515151, | ||
| 397 | - // fontSize: font(12), | ||
| 398 | - // ), | ||
| 399 | - // ), | ||
| 400 | - // ), | ||
| 401 | - // VEmptyView(10), | ||
| 402 | - // Padding( | ||
| 403 | - // padding: EdgeInsets.only(left: w(10)), | ||
| 404 | - // child: Wrap( | ||
| 405 | - // spacing: w(10), | ||
| 406 | - // runSpacing: w(5), | ||
| 407 | - // children: _templateUI(), | ||
| 408 | - // ), | ||
| 409 | - // ) | ||
| 410 | - // ], | ||
| 411 | - // ), | ||
| 412 | - // ), | ||
| 413 | - // VEmptyView(50), | 419 | + Container( |
| 420 | + padding: EdgeInsets.only(left: w(10), right: w(10), bottom: w(10)), | ||
| 421 | + decoration: BoxDecoration( | ||
| 422 | + borderRadius: BorderRadius.circular(r(5)), | ||
| 423 | + border: Border.all(width: w(1), color: MyColours.color_F8F7F3)), | ||
| 424 | + child: Column( | ||
| 425 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 426 | + children: [ | ||
| 427 | + Container( | ||
| 428 | + height: w(34), | ||
| 429 | + alignment: Alignment.centerLeft, | ||
| 430 | + child: Text( | ||
| 431 | + '常用模版', | ||
| 432 | + style: TextStyle( | ||
| 433 | + color: MyColours.color_515151, | ||
| 434 | + fontSize: font(12), | ||
| 435 | + ), | ||
| 436 | + ), | ||
| 437 | + ), | ||
| 438 | + VEmptyView(10), | ||
| 439 | + Padding( | ||
| 440 | + padding: EdgeInsets.only(left: w(10)), | ||
| 441 | + child: Wrap( | ||
| 442 | + spacing: w(10), | ||
| 443 | + runSpacing: w(5), | ||
| 444 | + children: _templateUI(), | ||
| 445 | + ), | ||
| 446 | + ) | ||
| 447 | + ], | ||
| 448 | + ), | ||
| 449 | + ), | ||
| 450 | + VEmptyView(50), | ||
| 414 | Row( | 451 | Row( |
| 415 | mainAxisAlignment: MainAxisAlignment.spaceBetween, | 452 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 416 | children: [ | 453 | children: [ |
| @@ -448,7 +485,7 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | @@ -448,7 +485,7 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | ||
| 448 | width: ScreenUtil().setWidth(44)), | 485 | width: ScreenUtil().setWidth(44)), |
| 449 | HEmptyView(15), | 486 | HEmptyView(15), |
| 450 | Text( | 487 | Text( |
| 451 | - '营销加入优惠', //'在当前位置插入优惠', | 488 | + '在当前位置插入优惠', |
| 452 | style: TextStyle( | 489 | style: TextStyle( |
| 453 | fontSize: ScreenUtil().setSp(32), | 490 | fontSize: ScreenUtil().setSp(32), |
| 454 | fontWeight: FontWeight.bold, | 491 | fontWeight: FontWeight.bold, |
| @@ -473,36 +510,42 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | @@ -473,36 +510,42 @@ class _MyMakeMarkingPageState extends State<MyMakeMarkingPage> { | ||
| 473 | return; | 510 | return; |
| 474 | } | 511 | } |
| 475 | DialogUtil.showSelectCusmanDialog(context, couponList, | 512 | DialogUtil.showSelectCusmanDialog(context, couponList, |
| 476 | - (value) { | 513 | + (value) async { |
| 477 | if (value != null) { | 514 | if (value != null) { |
| 478 | - setState(() { | ||
| 479 | - customerMakingProvider.couponSelectIndex = | ||
| 480 | - value.first; | ||
| 481 | - customerMakingProvider.youhui = couponList[ | ||
| 482 | - customerMakingProvider.couponSelectIndex]; | ||
| 483 | - }); | ||
| 484 | - | ||
| 485 | - // *************开始直接插入会报错***********还没有改 | ||
| 486 | - | ||
| 487 | - // var cursorPos = customerMakingProvider | ||
| 488 | - // .controller.selection.base.offset; //获取到光标的在字符串的位置 | ||
| 489 | - | ||
| 490 | - // String textAfterCursor = customerMakingProvider | ||
| 491 | - // .controller.text | ||
| 492 | - // .substring(cursorPos); //把字符串从光标的位置截取,光标后面的 | ||
| 493 | - | ||
| 494 | - // String textBeforeCursor = customerMakingProvider | ||
| 495 | - // .controller.text | ||
| 496 | - // .substring(0, cursorPos); //光标前面的字符串 | ||
| 497 | - // customerMakingProvider.controller.text = | ||
| 498 | - // textBeforeCursor + | ||
| 499 | - // "http://www.baidu.com" + | ||
| 500 | - // textAfterCursor; //把想要的插入的内容拼接在光标位置处 | ||
| 501 | - | ||
| 502 | - // customerMakingProvider.controller.selection = | ||
| 503 | - // TextSelection.collapsed( | ||
| 504 | - // offset: customerMakingProvider | ||
| 505 | - // .controller.text.length); | 515 | + if (customerProvider |
| 516 | + .couponListSelect[value.first].urllink == | ||
| 517 | + null) { | ||
| 518 | + //创建链接 | ||
| 519 | + //创建券的二维码 | ||
| 520 | + Map<String, String> param = { | ||
| 521 | + "sid": | ||
| 522 | + Provider.of<UserModel>(context, listen: false) | ||
| 523 | + .user | ||
| 524 | + .sellerid, | ||
| 525 | + "id": customerProvider | ||
| 526 | + .couponListSelect[value.first].id, | ||
| 527 | + }; | ||
| 528 | + dynamic object = await customerProvider | ||
| 529 | + .createActivityUrlLink(context, param); | ||
| 530 | + if (object is bool) { | ||
| 531 | + // | ||
| 532 | + | ||
| 533 | + } else { | ||
| 534 | + //成功 | ||
| 535 | + _insertUrllink(object); | ||
| 536 | + } | ||
| 537 | + } else { | ||
| 538 | + // 直接使用 | ||
| 539 | + setState(() { | ||
| 540 | + customerMakingProvider.couponSelectIndex = | ||
| 541 | + value.first; | ||
| 542 | + customerMakingProvider.youhui = couponList[ | ||
| 543 | + customerMakingProvider.couponSelectIndex]; | ||
| 544 | + }); | ||
| 545 | + | ||
| 546 | + _insertUrllink(customerProvider | ||
| 547 | + .couponListSelect[value.first].urllink); | ||
| 548 | + } | ||
| 506 | } | 549 | } |
| 507 | }, | 550 | }, |
| 508 | selecteds: customerMakingProvider | 551 | selecteds: customerMakingProvider |
| @@ -57,27 +57,26 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | @@ -57,27 +57,26 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | ||
| 57 | bool needClear = true; | 57 | bool needClear = true; |
| 58 | String gid = ''; | 58 | String gid = ''; |
| 59 | 59 | ||
| 60 | - List<TemplateModel> data = []; | 60 | + // List<TemplateModel> data = []; |
| 61 | 61 | ||
| 62 | @override | 62 | @override |
| 63 | void initState() { | 63 | void initState() { |
| 64 | super.initState(); | 64 | super.initState(); |
| 65 | 65 | ||
| 66 | - UserModel userModel = Provider.of<UserModel>(context, listen: false); | ||
| 67 | - data = [ | ||
| 68 | - TemplateModel('新菜上市', | ||
| 69 | - '尊敬的贵宾,本店最近有新菜上市,欢迎您来品尝,活动期间一律7折,提前预订热线${userModel.user.sellerphone},${userModel.user.sellername}全体员工恭候您的大驾光临!'), | ||
| 70 | - TemplateModel('生日营销1', | ||
| 71 | - '尊敬的贵宾,${userModel.user.sellername}全体员工提前祝您生日快乐!凡是生日当天在本店享有7折的优惠,并且为您准备了一份精美小礼品,快快来领取吧!详情请点击{礼品领取链接}。'), | ||
| 72 | - TemplateModel('生日营销2', | ||
| 73 | - '尊敬的贵宾,提前祝您生日快乐!${userModel.user.sellername}从来也没忘记在这样特别的日子里祝您:生日快乐,生活幸福。生日当天在本店消费享有6折优惠!'), | ||
| 74 | - TemplateModel('节日', | ||
| 75 | - '尊敬的贵宾:值xx节日将至,在x月x日至x日,到我店消费即可免费领取价值98节日礼包一份,大礼不断,优惠不断!详情请点击{礼品领取链接}。'), | ||
| 76 | - TemplateModel('存酒超期', | ||
| 77 | - '尊敬的贵宾:您在我店存放的酒水已经等待您30天了!已开启酒水长期存放将影响口感,${userModel.user.sellername}全体员工期待您早日到店享用完毕,静候您的光临!'), | ||
| 78 | - TemplateModel('沉睡唤醒', | ||
| 79 | - '尊敬的贵宾:对不起!很冒昧的给您发这条短信,我是${userModel.user.sellername}的${userModel.user.nickName ?? ''}.您都有很长一段时间没来我们这里了,我们非常想念您。或许是我们的服务还没有让您满意,或许是给您搭配的餐品还没有满足您的需求,总之,都是我们做的不够好!我们正在不断的改进,希望可以变得更完美,请您原谅以往我们的不足,有空回來看看我们!为您准备了一份精美小礼品,快快来领取吧!详情请点击{礼品领取链接}。') | ||
| 80 | - ]; | 66 | + // data = [ |
| 67 | + // TemplateModel('新菜上市', | ||
| 68 | + // '尊敬的贵宾,本店最近有新菜上市,欢迎您来品尝,活动期间一律7折,提前预订热线${userModel.user.sellerphone},${userModel.user.sellername}全体员工恭候您的大驾光临!'), | ||
| 69 | + // TemplateModel('生日营销1', | ||
| 70 | + // '尊敬的贵宾,${userModel.user.sellername}全体员工提前祝您生日快乐!凡是生日当天在本店享有7折的优惠,并且为您准备了一份精美小礼品,快快来领取吧!详情请点击{礼品领取链接}。'), | ||
| 71 | + // TemplateModel('生日营销2', | ||
| 72 | + // '尊敬的贵宾,提前祝您生日快乐!${userModel.user.sellername}从来也没忘记在这样特别的日子里祝您:生日快乐,生活幸福。生日当天在本店消费享有6折优惠!'), | ||
| 73 | + // TemplateModel('节日', | ||
| 74 | + // '尊敬的贵宾:值xx节日将至,在x月x日至x日,到我店消费即可免费领取价值98节日礼包一份,大礼不断,优惠不断!详情请点击{礼品领取链接}。'), | ||
| 75 | + // TemplateModel('存酒超期', | ||
| 76 | + // '尊敬的贵宾:您在我店存放的酒水已经等待您30天了!已开启酒水长期存放将影响口感,${userModel.user.sellername}全体员工期待您早日到店享用完毕,静候您的光临!'), | ||
| 77 | + // TemplateModel('沉睡唤醒', | ||
| 78 | + // '尊敬的贵宾:对不起!很冒昧的给您发这条短信,我是${userModel.user.sellername}的${userModel.user.nickName ?? ''}.您都有很长一段时间没来我们这里了,我们非常想念您。或许是我们的服务还没有让您满意,或许是给您搭配的餐品还没有满足您的需求,总之,都是我们做的不够好!我们正在不断的改进,希望可以变得更完美,请您原谅以往我们的不足,有空回來看看我们!为您准备了一份精美小礼品,快快来领取吧!详情请点击{礼品领取链接}。') | ||
| 79 | + // ]; | ||
| 81 | 80 | ||
| 82 | _focusNode.addListener(() { | 81 | _focusNode.addListener(() { |
| 83 | if (_focusNode.hasFocus) { | 82 | if (_focusNode.hasFocus) { |
| @@ -92,6 +91,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | @@ -92,6 +91,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | ||
| 92 | } | 91 | } |
| 93 | }); | 92 | }); |
| 94 | WidgetsBinding.instance.addPostFrameCallback((_) async { | 93 | WidgetsBinding.instance.addPostFrameCallback((_) async { |
| 94 | + _getMarketingSmsTemplate(); | ||
| 95 | _couponNetworkData(isShowLoading: false); | 95 | _couponNetworkData(isShowLoading: false); |
| 96 | if (widget.fromPage == FromPage.FromPageMakeRecordDetail) { | 96 | if (widget.fromPage == FromPage.FromPageMakeRecordDetail) { |
| 97 | _getGuestByGid(); | 97 | _getGuestByGid(); |
| @@ -161,6 +161,11 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | @@ -161,6 +161,11 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | ||
| 161 | setState(() {}); | 161 | setState(() {}); |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | + _getMarketingSmsTemplate({bool isShowLoading = true}) async { | ||
| 165 | + await customerProvider.getMarketingSmsTemplate(context, | ||
| 166 | + isShowLoading: isShowLoading); | ||
| 167 | + } | ||
| 168 | + | ||
| 164 | ///消费券 | 169 | ///消费券 |
| 165 | _couponNetworkData({bool isShowLoading = true}) async { | 170 | _couponNetworkData({bool isShowLoading = true}) async { |
| 166 | // customerMakingProvider.couponSelectIndex = 0; | 171 | // customerMakingProvider.couponSelectIndex = 0; |
| @@ -271,12 +276,21 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | @@ -271,12 +276,21 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | ||
| 271 | 276 | ||
| 272 | List<Widget> _templateUI() { | 277 | List<Widget> _templateUI() { |
| 273 | List<Widget> templates = []; | 278 | List<Widget> templates = []; |
| 274 | - data.forEach((element) { | 279 | + customerProvider.marketingSmsData.forEach((element) { |
| 275 | templates.add(InkWell( | 280 | templates.add(InkWell( |
| 276 | onTap: () { | 281 | onTap: () { |
| 277 | //选择模版.默认数据 | 282 | //选择模版.默认数据 |
| 278 | 283 | ||
| 279 | - customerMakingProvider.controller.text = element.content; | 284 | + String newStr = ''; |
| 285 | + UserModel userModel = | ||
| 286 | + Provider.of<UserModel>(context, listen: false); | ||
| 287 | + newStr = | ||
| 288 | + element.content.replaceAll('{店铺名称}', userModel.user.sellername); | ||
| 289 | + newStr = newStr.replaceAll('{店铺电话号码}', userModel.user.sellerphone); | ||
| 290 | + newStr = newStr.replaceAll('{经理名称}', userModel.user.nickName ?? ''); | ||
| 291 | + newStr = newStr.replaceAll('{礼品领取链接}', ''); | ||
| 292 | + | ||
| 293 | + customerMakingProvider.controller.text = newStr; | ||
| 280 | }, | 294 | }, |
| 281 | child: Container( | 295 | child: Container( |
| 282 | padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)), | 296 | padding: EdgeInsets.symmetric(horizontal: w(10), vertical: w(5)), |
| @@ -296,6 +310,28 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | @@ -296,6 +310,28 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | ||
| 296 | return templates; | 310 | return templates; |
| 297 | } | 311 | } |
| 298 | 312 | ||
| 313 | + _insertUrllink(String link) { | ||
| 314 | + // *************开始直接插入会报错***********还没有改 | ||
| 315 | + | ||
| 316 | + var cursorPos = | ||
| 317 | + customerMakingProvider.controller.selection.base.offset; //获取到光标的在字符串的位置 | ||
| 318 | + | ||
| 319 | + if (cursorPos < 0) { | ||
| 320 | + customerMakingProvider.controller.text += link; | ||
| 321 | + } else { | ||
| 322 | + String textAfterCursor = customerMakingProvider.controller.text | ||
| 323 | + .substring(cursorPos); //把字符串从光标的位置截取,光标后面的 | ||
| 324 | + | ||
| 325 | + String textBeforeCursor = customerMakingProvider.controller.text | ||
| 326 | + .substring(0, cursorPos); //光标前面的字符串 | ||
| 327 | + customerMakingProvider.controller.text = | ||
| 328 | + textBeforeCursor + link + textAfterCursor; //把想要的插入的内容拼接在光标位置处 | ||
| 329 | + | ||
| 330 | + customerMakingProvider.controller.selection = TextSelection.collapsed( | ||
| 331 | + offset: customerMakingProvider.controller.text.length); | ||
| 332 | + } | ||
| 333 | + } | ||
| 334 | + | ||
| 299 | ///短信内容编辑UI | 335 | ///短信内容编辑UI |
| 300 | Widget _contentWidget(String hintText) { | 336 | Widget _contentWidget(String hintText) { |
| 301 | return Container( | 337 | return Container( |
| @@ -360,38 +396,38 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | @@ -360,38 +396,38 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | ||
| 360 | }, | 396 | }, |
| 361 | ), | 397 | ), |
| 362 | VEmptyView(20), | 398 | VEmptyView(20), |
| 363 | - // Container( | ||
| 364 | - // padding: EdgeInsets.only(left: w(10), right: w(10), bottom: w(10)), | ||
| 365 | - // decoration: BoxDecoration( | ||
| 366 | - // borderRadius: BorderRadius.circular(r(5)), | ||
| 367 | - // border: Border.all(width: w(1), color: MyColours.color_F8F7F3)), | ||
| 368 | - // child: Column( | ||
| 369 | - // crossAxisAlignment: CrossAxisAlignment.start, | ||
| 370 | - // children: [ | ||
| 371 | - // Container( | ||
| 372 | - // height: w(34), | ||
| 373 | - // alignment: Alignment.centerLeft, | ||
| 374 | - // child: Text( | ||
| 375 | - // '常用模版', | ||
| 376 | - // style: TextStyle( | ||
| 377 | - // color: MyColours.color_515151, | ||
| 378 | - // fontSize: font(12), | ||
| 379 | - // ), | ||
| 380 | - // ), | ||
| 381 | - // ), | ||
| 382 | - // VEmptyView(10), | ||
| 383 | - // Padding( | ||
| 384 | - // padding: EdgeInsets.only(left: w(10)), | ||
| 385 | - // child: Wrap( | ||
| 386 | - // spacing: w(10), | ||
| 387 | - // runSpacing: w(5), | ||
| 388 | - // children: _templateUI(), | ||
| 389 | - // ), | ||
| 390 | - // ) | ||
| 391 | - // ], | ||
| 392 | - // ), | ||
| 393 | - // ), | ||
| 394 | - // VEmptyView(50), | 399 | + Container( |
| 400 | + padding: EdgeInsets.only(left: w(10), right: w(10), bottom: w(10)), | ||
| 401 | + decoration: BoxDecoration( | ||
| 402 | + borderRadius: BorderRadius.circular(r(5)), | ||
| 403 | + border: Border.all(width: w(1), color: MyColours.color_F8F7F3)), | ||
| 404 | + child: Column( | ||
| 405 | + crossAxisAlignment: CrossAxisAlignment.start, | ||
| 406 | + children: [ | ||
| 407 | + Container( | ||
| 408 | + height: w(34), | ||
| 409 | + alignment: Alignment.centerLeft, | ||
| 410 | + child: Text( | ||
| 411 | + '常用模版', | ||
| 412 | + style: TextStyle( | ||
| 413 | + color: MyColours.color_515151, | ||
| 414 | + fontSize: font(12), | ||
| 415 | + ), | ||
| 416 | + ), | ||
| 417 | + ), | ||
| 418 | + VEmptyView(10), | ||
| 419 | + Padding( | ||
| 420 | + padding: EdgeInsets.only(left: w(10)), | ||
| 421 | + child: Wrap( | ||
| 422 | + spacing: w(10), | ||
| 423 | + runSpacing: w(5), | ||
| 424 | + children: _templateUI(), | ||
| 425 | + ), | ||
| 426 | + ) | ||
| 427 | + ], | ||
| 428 | + ), | ||
| 429 | + ), | ||
| 430 | + VEmptyView(50), | ||
| 395 | Row( | 431 | Row( |
| 396 | mainAxisAlignment: MainAxisAlignment.spaceBetween, | 432 | mainAxisAlignment: MainAxisAlignment.spaceBetween, |
| 397 | children: [ | 433 | children: [ |
| @@ -429,7 +465,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | @@ -429,7 +465,7 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | ||
| 429 | width: ScreenUtil().setWidth(44)), | 465 | width: ScreenUtil().setWidth(44)), |
| 430 | HEmptyView(15), | 466 | HEmptyView(15), |
| 431 | Text( | 467 | Text( |
| 432 | - '营销加入优惠', //'在当前位置插入优惠', | 468 | + '在当前位置插入优惠', |
| 433 | style: TextStyle( | 469 | style: TextStyle( |
| 434 | fontSize: ScreenUtil().setSp(32), | 470 | fontSize: ScreenUtil().setSp(32), |
| 435 | fontWeight: FontWeight.bold, | 471 | fontWeight: FontWeight.bold, |
| @@ -454,36 +490,49 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | @@ -454,36 +490,49 @@ class _MakeMarkingPageState extends State<MakeMarkingPage> { | ||
| 454 | return; | 490 | return; |
| 455 | } | 491 | } |
| 456 | DialogUtil.showSelectCusmanDialog(context, couponList, | 492 | DialogUtil.showSelectCusmanDialog(context, couponList, |
| 457 | - (value) { | 493 | + (value) async { |
| 458 | if (value != null) { | 494 | if (value != null) { |
| 459 | - setState(() { | ||
| 460 | - customerMakingProvider.couponSelectIndex = | ||
| 461 | - value.first; | ||
| 462 | - customerMakingProvider.youhui = couponList[ | ||
| 463 | - customerMakingProvider.couponSelectIndex]; | ||
| 464 | - }); | ||
| 465 | - | ||
| 466 | - // *************开始直接插入会报错***********还没有改 | ||
| 467 | - | ||
| 468 | - // var cursorPos = customerMakingProvider | ||
| 469 | - // .controller.selection.base.offset; //获取到光标的在字符串的位置 | ||
| 470 | - | ||
| 471 | - // String textAfterCursor = customerMakingProvider | ||
| 472 | - // .controller.text | ||
| 473 | - // .substring(cursorPos); //把字符串从光标的位置截取,光标后面的 | ||
| 474 | - | ||
| 475 | - // String textBeforeCursor = customerMakingProvider | ||
| 476 | - // .controller.text | ||
| 477 | - // .substring(0, cursorPos); //光标前面的字符串 | ||
| 478 | - // customerMakingProvider.controller.text = | ||
| 479 | - // textBeforeCursor + | ||
| 480 | - // "http://www.baidu.com" + | ||
| 481 | - // textAfterCursor; //把想要的插入的内容拼接在光标位置处 | ||
| 482 | - | ||
| 483 | - // customerMakingProvider.controller.selection = | ||
| 484 | - // TextSelection.collapsed( | ||
| 485 | - // offset: customerMakingProvider | ||
| 486 | - // .controller.text.length); | 495 | + if (customerProvider |
| 496 | + .couponListSelect[value.first].urllink == | ||
| 497 | + null) { | ||
| 498 | + //创建链接 | ||
| 499 | + //创建券的二维码 | ||
| 500 | + Map<String, String> param = { | ||
| 501 | + "sid": | ||
| 502 | + Provider.of<UserModel>(context, listen: false) | ||
| 503 | + .user | ||
| 504 | + .sellerid, | ||
| 505 | + "id": customerProvider | ||
| 506 | + .couponListSelect[value.first].id, | ||
| 507 | + }; | ||
| 508 | + dynamic object = await customerProvider | ||
| 509 | + .createActivityUrlLink(context, param); | ||
| 510 | + if (object is bool || object == null) { | ||
| 511 | + // | ||
| 512 | + | ||
| 513 | + } else { | ||
| 514 | + //成功 | ||
| 515 | + | ||
| 516 | + setState(() { | ||
| 517 | + customerMakingProvider.couponSelectIndex = | ||
| 518 | + value.first; | ||
| 519 | + customerMakingProvider.youhui = couponList[ | ||
| 520 | + customerMakingProvider.couponSelectIndex]; | ||
| 521 | + }); | ||
| 522 | + _insertUrllink(object); | ||
| 523 | + } | ||
| 524 | + } else { | ||
| 525 | + // 直接使用 | ||
| 526 | + setState(() { | ||
| 527 | + customerMakingProvider.couponSelectIndex = | ||
| 528 | + value.first; | ||
| 529 | + customerMakingProvider.youhui = couponList[ | ||
| 530 | + customerMakingProvider.couponSelectIndex]; | ||
| 531 | + }); | ||
| 532 | + | ||
| 533 | + _insertUrllink(customerProvider | ||
| 534 | + .couponListSelect[value.first].urllink); | ||
| 535 | + } | ||
| 487 | } | 536 | } |
| 488 | }, | 537 | }, |
| 489 | selecteds: customerMakingProvider | 538 | selecteds: customerMakingProvider |
| @@ -167,53 +167,7 @@ class CouponProvider with ChangeNotifier { | @@ -167,53 +167,7 @@ class CouponProvider with ChangeNotifier { | ||
| 167 | } | 167 | } |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | - ///CreateActivityUrlLink | ||
| 171 | - Future<dynamic> createActivityUrlLink( | ||
| 172 | - BuildContext context, Map<String, String> params, | ||
| 173 | - {isShowLoading = true}) async { | ||
| 174 | - BaseResp<dynamic> baseResp = await DioUtil() | ||
| 175 | - .request<dynamic>(context, Method.get, HttpUrl.create_activity_url_link, | ||
| 176 | - data: params, showLoading: isShowLoading) | ||
| 177 | - .catchError((error) { | ||
| 178 | - print(error.toString()); | ||
| 179 | - if (error is MyError) { | ||
| 180 | - // switch (error.type) { | ||
| 181 | - // case 1: | ||
| 182 | - // pageState = PageState.ConnectivityError; | ||
| 183 | - // break; | ||
| 184 | - // case 2: | ||
| 185 | - // pageState = PageState.ConnectivityTimeOut; | ||
| 186 | - // break; | ||
| 187 | - // default: | ||
| 188 | - // pageState = PageState.ConnectivityError; | ||
| 189 | - // break; | ||
| 190 | - // } | ||
| 191 | - } | ||
| 192 | - // notifyListeners(); | ||
| 193 | - return false; | ||
| 194 | - }); | ||
| 195 | - if (baseResp.code == Constant.status_success) { | ||
| 196 | - if (baseResp.data.isEmpty) { | ||
| 197 | - // pageState = PageState.ConnectivityError; | ||
| 198 | - return false; | ||
| 199 | - } else { | ||
| 200 | - if( '${baseResp.data['errcode']}' == '0'){ | ||
| 201 | - return true; | ||
| 202 | - } | ||
| 203 | - // pageState = PageState.Success; | ||
| 204 | - return false; | ||
| 205 | - } | ||
| 206 | - | ||
| 207 | - // notifyListeners(); | ||
| 208 | - // return NotebookDetail.fromJson(baseResp.data); | ||
| 209 | - } else { | ||
| 210 | - // pageState = PageState.ConnectivityError; | ||
| 211 | - if (baseResp != null) { | ||
| 212 | - Utils.showToast(baseResp.msg ?? ""); | ||
| 213 | - } | ||
| 214 | - return false; | ||
| 215 | - } | ||
| 216 | - } | 170 | + |
| 217 | 171 | ||
| 218 | // | 172 | // |
| 219 | 173 |
| @@ -30,6 +30,7 @@ import 'package:one_key/widgets/loading.dart'; | @@ -30,6 +30,7 @@ import 'package:one_key/widgets/loading.dart'; | ||
| 30 | import 'package:provider/provider.dart'; | 30 | import 'package:provider/provider.dart'; |
| 31 | 31 | ||
| 32 | import '../models/day_statics_model.dart'; | 32 | import '../models/day_statics_model.dart'; |
| 33 | +import '../models/marketing_sms_template_model.dart'; | ||
| 33 | import '../models/month_statics_model.dart'; | 34 | import '../models/month_statics_model.dart'; |
| 34 | import '../models/seller_counts_list.dart'; | 35 | import '../models/seller_counts_list.dart'; |
| 35 | import '../pages/my/customer_type/store_customer/bar_chart_page.dart'; | 36 | import '../pages/my/customer_type/store_customer/bar_chart_page.dart'; |
| @@ -122,6 +123,8 @@ class CustomerProvider extends ChangeNotifier { | @@ -122,6 +123,8 @@ class CustomerProvider extends ChangeNotifier { | ||
| 122 | bool isrepair = false; | 123 | bool isrepair = false; |
| 123 | bool isselfphone = false; | 124 | bool isselfphone = false; |
| 124 | 125 | ||
| 126 | + List<MarketingSmsTemplateSunModel> marketingSmsData = []; | ||
| 127 | + | ||
| 125 | /// 获取全店日订单统计数据 | 128 | /// 获取全店日订单统计数据 |
| 126 | Future<DayStaticsSunModel> getSellerCountsListByDay( | 129 | Future<DayStaticsSunModel> getSellerCountsListByDay( |
| 127 | BuildContext context, Map<String, String> params, | 130 | BuildContext context, Map<String, String> params, |
| @@ -382,6 +385,82 @@ class CustomerProvider extends ChangeNotifier { | @@ -382,6 +385,82 @@ class CustomerProvider extends ChangeNotifier { | ||
| 382 | return null; | 385 | return null; |
| 383 | } | 386 | } |
| 384 | 387 | ||
| 388 | + ///获取营销短信模板列表 | ||
| 389 | + Future<List<MarketingSmsTemplateSunModel>> getMarketingSmsTemplate( | ||
| 390 | + BuildContext context, | ||
| 391 | + {isShowLoading = true}) async { | ||
| 392 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 393 | + .request<dynamic>( | ||
| 394 | + context, Method.get, HttpUrl.get_marketing_sms_template, | ||
| 395 | + showLoading: false) | ||
| 396 | + .catchError((error) { | ||
| 397 | + print(error.toString()); | ||
| 398 | + if (error is MyError) { | ||
| 399 | + switch (error.type) { | ||
| 400 | + } | ||
| 401 | + } | ||
| 402 | + }); | ||
| 403 | + if (baseResp == null) return []; | ||
| 404 | + if (baseResp.code == Constant.status_success) { | ||
| 405 | + marketingSmsData = | ||
| 406 | + MarketingSmsTemplateModel.fromJson(baseResp.responseData).data; | ||
| 407 | + notifyListeners(); | ||
| 408 | + } else { | ||
| 409 | + if (baseResp != null) { | ||
| 410 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 411 | + } | ||
| 412 | + } | ||
| 413 | + return marketingSmsData; | ||
| 414 | + } | ||
| 415 | + | ||
| 416 | + ///CreateActivityUrlLink | ||
| 417 | + Future<dynamic> createActivityUrlLink( | ||
| 418 | + BuildContext context, Map<String, String> params, | ||
| 419 | + {isShowLoading = true}) async { | ||
| 420 | + BaseResp<dynamic> baseResp = await DioUtil() | ||
| 421 | + .request<dynamic>(context, Method.get, HttpUrl.create_activity_url_link, | ||
| 422 | + data: params, showLoading: isShowLoading) | ||
| 423 | + .catchError((error) { | ||
| 424 | + print(error.toString()); | ||
| 425 | + if (error is MyError) { | ||
| 426 | + // switch (error.type) { | ||
| 427 | + // case 1: | ||
| 428 | + // pageState = PageState.ConnectivityError; | ||
| 429 | + // break; | ||
| 430 | + // case 2: | ||
| 431 | + // pageState = PageState.ConnectivityTimeOut; | ||
| 432 | + // break; | ||
| 433 | + // default: | ||
| 434 | + // pageState = PageState.ConnectivityError; | ||
| 435 | + // break; | ||
| 436 | + // } | ||
| 437 | + } | ||
| 438 | + // notifyListeners(); | ||
| 439 | + return false; | ||
| 440 | + }); | ||
| 441 | + if (baseResp.code == Constant.status_success) { | ||
| 442 | + if (baseResp.data.isEmpty) { | ||
| 443 | + // pageState = PageState.ConnectivityError; | ||
| 444 | + return false; | ||
| 445 | + } else { | ||
| 446 | + if ('${baseResp.data['errcode']}' == '0') { | ||
| 447 | + return baseResp.data['url_link']; | ||
| 448 | + } | ||
| 449 | + // pageState = PageState.Success; | ||
| 450 | + return false; | ||
| 451 | + } | ||
| 452 | + | ||
| 453 | + // notifyListeners(); | ||
| 454 | + // return NotebookDetail.fromJson(baseResp.data); | ||
| 455 | + } else { | ||
| 456 | + // pageState = PageState.ConnectivityError; | ||
| 457 | + if (baseResp != null) { | ||
| 458 | + Utils.showToast(baseResp.msg ?? ""); | ||
| 459 | + } | ||
| 460 | + return false; | ||
| 461 | + } | ||
| 462 | + } | ||
| 463 | + | ||
| 385 | ///客户经理获取所创建活动列表(选择优惠券) | 464 | ///客户经理获取所创建活动列表(选择优惠券) |
| 386 | Future<List<CouponSunModel>> getCustomerSelectActivityNew( | 465 | Future<List<CouponSunModel>> getCustomerSelectActivityNew( |
| 387 | BuildContext context, Map<String, String> params, | 466 | BuildContext context, Map<String, String> params, |
-
Please register or login to post a comment