1,新增增值服务相关网页购买统一处理
2,新增短信余量接口、购买流程对接逻辑 3,新增邮件余量接口、购买流程对接逻辑
This commit is contained in:
parent
ed442e1792
commit
ad8eda0345
@ -40,21 +40,21 @@ class XSConstantMacro {
|
||||
switch (keyStatus) {
|
||||
case 110401:
|
||||
// 正常使用
|
||||
return "";
|
||||
return '';
|
||||
case 110402:
|
||||
return "待接收";
|
||||
return '待接收';
|
||||
case 110403:
|
||||
return "未生效";
|
||||
return '未生效';
|
||||
case 110405:
|
||||
return "已冻结";
|
||||
return '已冻结';
|
||||
case 110408:
|
||||
return "已删除";
|
||||
return '已删除';
|
||||
// case 110410:
|
||||
// return "已重置";
|
||||
case 110412:
|
||||
return "已过期";
|
||||
return '已过期';
|
||||
default:
|
||||
return "未知";
|
||||
return '未知';
|
||||
}
|
||||
}
|
||||
|
||||
@ -75,8 +75,14 @@ class XSConstantMacro {
|
||||
static int userTypeSuperAdmin = 110301; //超级管理员
|
||||
static int userTypeAuthorizedAdmin = 110302; //授权管理员
|
||||
|
||||
|
||||
//电子钥匙类型
|
||||
static int keyRightAdmin = 1; //管理钥匙
|
||||
static int keyRightOrdinary = 2; //普通钥匙
|
||||
|
||||
//网页购买链接类型
|
||||
static int webBuyTypeSMS = 1; //短信购买
|
||||
static int webBuyTypeEmail = 2; //邮件购买
|
||||
static int webBuyTypeVip = 3; //VIP购买
|
||||
static int webBuyTypeAuth = 4; //实名购买
|
||||
static int webBuyTypeShop = 5; //商城购买
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:flutter_blue_plus/flutter_blue_plus.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/login/login/entity/LoginEntity.dart';
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/authorizedAdmin_entity.dart';
|
||||
import 'package:star_lock/main/lockDetail/authorizedAdmin/authorizedAdmin/notice_template_entity.dart';
|
||||
@ -254,8 +255,9 @@ class AuthorizedAdminLogic extends BaseGetXController {
|
||||
ShowCupertinoAlertView().showBuyTipWithContentAlert(
|
||||
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
||||
sureClick: () {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: <String, bool>{'isShop': false});
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
||||
'webBuyType': XSConstantMacro.webBuyTypeAuth,
|
||||
});
|
||||
});
|
||||
} else if (entity.errorCode == 433) {
|
||||
//需联系管理员购买
|
||||
|
||||
@ -163,8 +163,9 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
ShowCupertinoAlertView().showBuyTipWithContentAlert(
|
||||
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
||||
sureClick: () {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: <String, bool>{'isShop': false});
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
||||
'webBuyType': XSConstantMacro.webBuyTypeAuth,
|
||||
});
|
||||
});
|
||||
} else if (entity.errorCode == 433) {
|
||||
//需联系管理员购买
|
||||
@ -402,8 +403,9 @@ class ElectronicKeyDetailLogic extends BaseGetXController {
|
||||
ShowCupertinoAlertView().showBuyTipWithContentAlert(
|
||||
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
||||
sureClick: () {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: <String, bool>{'isShop': false});
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
||||
'webBuyType': XSConstantMacro.webBuyTypeAuth,
|
||||
});
|
||||
});
|
||||
} else if (entity.errorCode == 433) {
|
||||
//需联系管理员购买
|
||||
|
||||
@ -200,8 +200,9 @@ class SendElectronicKeyViewLogic extends BaseGetXController {
|
||||
ShowCupertinoAlertView().showBuyTipWithContentAlert(
|
||||
titleStr: '实名认证为付费功能,请购买后再使用'.tr,
|
||||
sureClick: () {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: {'isShop': false});
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
||||
'webBuyType': XSConstantMacro.webBuyTypeAuth,
|
||||
});
|
||||
});
|
||||
} else if (entity.errorCode == 433) {
|
||||
//需联系管理员购买
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/mine/starLockMine_state.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
@ -98,7 +99,9 @@ class StarLockMinePageState extends State<StarLockMinePage> with BaseWidget {
|
||||
// logic.showToast('请先添加锁');
|
||||
// } else {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: <String, bool>{'isShop': true});
|
||||
arguments: {
|
||||
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
||||
});
|
||||
// }
|
||||
} else {
|
||||
Get.toNamed(
|
||||
|
||||
@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:fluwx/fluwx.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_settings.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/flavors.dart';
|
||||
import 'package:star_lock/mine/mall/webview/webview_logic.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_entity.dart';
|
||||
@ -20,13 +21,27 @@ class AdvancedFeaturesWebLogic extends BaseGetXController {
|
||||
|
||||
//获取购买跳转地址
|
||||
Future<void> getVipBuyURLRequest() async {
|
||||
AdvancedFeaturesWebEntity entity =
|
||||
final AdvancedFeaturesWebEntity entity =
|
||||
await ApiRepository.to.getServicePackageBuyUrl();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
state.vipBuyUrl.value = state.isVipShop.value == true
|
||||
? entity.data!.vipBuyUrl!
|
||||
: entity.data!.cloudauthBuyUrl!;
|
||||
state.vipBuyWebView.setNavigationDelegate(
|
||||
if (state.webBuyType.value == XSConstantMacro.webBuyTypeVip) {
|
||||
state.webBuyUrl.value = entity.data!.vipBuyUrl!;
|
||||
state.webBuyTitle.value = '高级功能'.tr;
|
||||
} else if (state.webBuyType.value == XSConstantMacro.webBuyTypeAuth) {
|
||||
state.webBuyUrl.value = entity.data!.cloudauthBuyUrl!;
|
||||
state.webBuyTitle.value = '实名认证'.tr;
|
||||
} else if (state.webBuyType.value == XSConstantMacro.webBuyTypeSMS) {
|
||||
state.webBuyUrl.value = entity.data!.smsBuyUrl!;
|
||||
state.webBuyTitle.value = '短信购买'.tr;
|
||||
} else if (state.webBuyType.value == XSConstantMacro.webBuyTypeEmail) {
|
||||
state.webBuyUrl.value = entity.data!.emailBuyUrl!;
|
||||
state.webBuyTitle.value = '邮件购买'.tr;
|
||||
} else if (state.webBuyType.value == XSConstantMacro.webBuyTypeShop) {
|
||||
state.webBuyUrl.value = entity.data!.shopList!;
|
||||
state.webBuyTitle.value = '商城购买'.tr;
|
||||
}
|
||||
|
||||
state.webBuyView.setNavigationDelegate(
|
||||
NavigationDelegate(
|
||||
onProgress: (int progress) {
|
||||
// Update loading bar.
|
||||
@ -49,9 +64,9 @@ class AdvancedFeaturesWebLogic extends BaseGetXController {
|
||||
},
|
||||
),
|
||||
);
|
||||
state.vipBuyWebView.loadRequest(Uri.parse(state.vipBuyUrl.value));
|
||||
state.vipBuyWebView.addJavaScriptChannel(
|
||||
"FlutterBridge",
|
||||
state.webBuyView.loadRequest(Uri.parse(state.webBuyUrl.value));
|
||||
state.webBuyView.addJavaScriptChannel(
|
||||
'FlutterBridge',
|
||||
onMessageReceived: (JavaScriptMessage message) async {
|
||||
flutterBridge(message);
|
||||
},
|
||||
@ -66,9 +81,9 @@ class AdvancedFeaturesWebLogic extends BaseGetXController {
|
||||
if (obj is! Map && obj['action'] is String) {
|
||||
return;
|
||||
}
|
||||
String action = obj['action'];
|
||||
dynamic data = obj['data'];
|
||||
String? callFun = obj['callFun'];
|
||||
final String action = obj['action'];
|
||||
final dynamic data = obj['data'];
|
||||
final String? callFun = obj['callFun'];
|
||||
switch (action) {
|
||||
case 'WechatPayParams':
|
||||
//微信支付
|
||||
@ -79,15 +94,15 @@ class AdvancedFeaturesWebLogic extends BaseGetXController {
|
||||
|
||||
//微信支付
|
||||
Future<void> wxPay(dynamic data, String? callFun) async {
|
||||
WxPayTool.pay(WxPayTool.mapToPayment(data), (response) {
|
||||
WxPayTool.pay(WxPayTool.mapToPayment(data), (WeChatResponse response) {
|
||||
if (response is WeChatPaymentResponse) {
|
||||
Map data = {
|
||||
final Map data = {
|
||||
'type': response.type,
|
||||
'extData': response.extData,
|
||||
'errCode': response.errCode,
|
||||
'errStr': response.errStr,
|
||||
};
|
||||
state.vipBuyWebView.runJavaScript(
|
||||
state.webBuyView.runJavaScript(
|
||||
'window.$callFun(`${json.encode(data)}`)',
|
||||
);
|
||||
}
|
||||
@ -96,9 +111,9 @@ class AdvancedFeaturesWebLogic extends BaseGetXController {
|
||||
|
||||
//判断webview 是否可以有路由可以回退,无则退出当前页面
|
||||
Future<bool> canGoBack(bool didPop) async {
|
||||
bool canGoBack = await state.vipBuyWebView.canGoBack();
|
||||
final bool canGoBack = await state.webBuyView.canGoBack();
|
||||
if (canGoBack) {
|
||||
await state.vipBuyWebView.goBack();
|
||||
await state.webBuyView.goBack();
|
||||
} else if (state.allowReturn) {
|
||||
Get.back();
|
||||
} else {
|
||||
@ -123,7 +138,7 @@ class AdvancedFeaturesWebLogic extends BaseGetXController {
|
||||
if (state.allowReturn) {
|
||||
return;
|
||||
}
|
||||
state.vipBuyWebView.canGoBack().then((value) {
|
||||
state.webBuyView.canGoBack().then((bool value) {
|
||||
state.canGoBack = value;
|
||||
update();
|
||||
});
|
||||
|
||||
@ -3,6 +3,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_logic.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_state.dart';
|
||||
import 'package:star_lock/tools/titleAppBar.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
@ -15,10 +16,9 @@ class AdvancedFeaturesWebPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AdvancedFeaturesWebPageState extends State<AdvancedFeaturesWebPage> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
final AdvancedFeaturesWebLogic logic = Get.put(AdvancedFeaturesWebLogic());
|
||||
final AdvancedFeaturesWebState state =
|
||||
Get.find<AdvancedFeaturesWebLogic>().state;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -32,9 +32,7 @@ class _AdvancedFeaturesWebPageState extends State<AdvancedFeaturesWebPage> {
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: const Color(0xFFFFFFFF),
|
||||
appBar: TitleAppBar(
|
||||
barTitle: logic.state.isVipShop.value == true
|
||||
? '高级功能'.tr
|
||||
: '实名认证'.tr,
|
||||
barTitle: state.webBuyTitle.value,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor,
|
||||
backAction: () => logic.canGoBack(false),
|
||||
@ -56,8 +54,8 @@ class _AdvancedFeaturesWebPageState extends State<AdvancedFeaturesWebPage> {
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: WebViewWidget(
|
||||
controller: logic.state.vipBuyWebView),
|
||||
child:
|
||||
WebViewWidget(controller: logic.state.webBuyView),
|
||||
),
|
||||
],
|
||||
))),
|
||||
|
||||
@ -1,29 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/mine/mall/webview/webview_logic.dart';
|
||||
import 'package:webview_flutter/webview_flutter.dart';
|
||||
|
||||
class AdvancedFeaturesWebState {
|
||||
var vipBuyUrl = "".obs; //购买跳转地址
|
||||
var webProgress = 0.0.obs;
|
||||
AdvancedFeaturesWebState() {
|
||||
if (Get.arguments['webBuyType'] != null) {
|
||||
webBuyType.value = Get.arguments['webBuyType'];
|
||||
if (webBuyType.value == XSConstantMacro.webBuyTypeVip) {
|
||||
webBuyTitle.value = '高级功能'.tr;
|
||||
} else if (webBuyType.value == XSConstantMacro.webBuyTypeAuth) {
|
||||
webBuyTitle.value = '实名认证'.tr;
|
||||
} else if (webBuyType.value == XSConstantMacro.webBuyTypeSMS) {
|
||||
webBuyTitle.value = '短信购买'.tr;
|
||||
} else if (webBuyType.value == XSConstantMacro.webBuyTypeEmail) {
|
||||
webBuyTitle.value = '邮件购买'.tr;
|
||||
} else if (webBuyType.value == XSConstantMacro.webBuyTypeShop) {
|
||||
webBuyTitle.value = '商城购买'.tr;
|
||||
}
|
||||
}
|
||||
}
|
||||
RxString webBuyUrl = ''.obs; //购买跳转地址
|
||||
RxInt webBuyType = 0.obs; //购买类型
|
||||
RxString webBuyTitle = ''.obs;
|
||||
RxDouble webProgress = 0.0.obs;
|
||||
bool allowReturn = true;
|
||||
late WebViewController vipBuyWebView = initWebViewController();
|
||||
var isVipShop = true.obs; //是否为高级功能购买页面
|
||||
late WebViewController webBuyView = initWebViewController();
|
||||
bool canGoBack = false;
|
||||
|
||||
//初始化webView控制器
|
||||
WebViewController initWebViewController() {
|
||||
WebViewController allWebView = WebViewController();
|
||||
final WebViewController allWebView = WebViewController();
|
||||
allWebView.setJavaScriptMode(JavaScriptMode.unrestricted);
|
||||
allWebView.setBackgroundColor(Colors.white);
|
||||
allWebView.setUserAgent(WebViewLogic.userAgent);
|
||||
return allWebView;
|
||||
}
|
||||
|
||||
AdvancedFeaturesWebState() {
|
||||
Map map = Get.arguments;
|
||||
if (map['isShop'] != null) {
|
||||
isVipShop.value = map['isShop'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyloading/flutter_easyloading.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_logic.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesList/valueAddedServicesList_state.dart';
|
||||
import 'package:star_lock/tools/commonDataManage.dart';
|
||||
import 'package:star_lock/tools/storage.dart';
|
||||
|
||||
@ -21,8 +23,10 @@ class ValueAddedServicesListPage extends StatefulWidget {
|
||||
|
||||
class _ValueAddedServicesPageListState
|
||||
extends State<ValueAddedServicesListPage> {
|
||||
final logic = Get.put(ValueAddedServicesListLogic());
|
||||
final state = Get.find<ValueAddedServicesListLogic>().state;
|
||||
final ValueAddedServicesListLogic logic =
|
||||
Get.put(ValueAddedServicesListLogic());
|
||||
final ValueAddedServicesListState state =
|
||||
Get.find<ValueAddedServicesListLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
@ -40,21 +44,19 @@ class _ValueAddedServicesPageListState
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: ListView(
|
||||
children: [
|
||||
// _valueAddedServicesItem(
|
||||
// Image.asset('images/mine/icon_mine_valueAddedServices_note.png'),
|
||||
// TranslationLoader.lanKeys!.note!.tr, () {
|
||||
// Navigator.pushNamed(
|
||||
// context, Routers.valueAddedServicesNoteAndEmailDetailPage,
|
||||
// arguments: 1);
|
||||
// }),
|
||||
// _valueAddedServicesItem(
|
||||
// Image.asset('images/mine/icon_mine_valueAddedServices_email.png'),
|
||||
// TranslationLoader.lanKeys!.mail!.tr, () {
|
||||
// Navigator.pushNamed(
|
||||
// context, Routers.valueAddedServicesNoteAndEmailDetailPage,
|
||||
// arguments: 2);
|
||||
// }),
|
||||
children: <Widget>[
|
||||
_valueAddedServicesItem(
|
||||
Image.asset('images/mine/icon_mine_valueAddedServices_note.png'),
|
||||
TranslationLoader.lanKeys!.note!.tr, () {
|
||||
Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage,
|
||||
arguments: {'type': 1});
|
||||
}),
|
||||
_valueAddedServicesItem(
|
||||
Image.asset('images/mine/icon_mine_valueAddedServices_email.png'),
|
||||
TranslationLoader.lanKeys!.mail!.tr, () {
|
||||
Get.toNamed(Routers.valueAddedServicesNoteAndEmailDetailPage,
|
||||
arguments: {'type': 2});
|
||||
}),
|
||||
_valueAddedServicesItem(
|
||||
Image.asset(
|
||||
'images/mine/icon_mine_valueAddedServices_realName.png'),
|
||||
@ -64,13 +66,14 @@ class _ValueAddedServicesPageListState
|
||||
_valueAddedServicesItem(
|
||||
Image.asset('images/mine/icon_mine_valueAddedServices_vip.png'),
|
||||
TranslationLoader.lanKeys!.advancedFunction!.tr, () async {
|
||||
var isVip = await Storage.getBool(saveIsVip);
|
||||
bool? isVip = await Storage.getBool(saveIsVip);
|
||||
if (isVip == null || !isVip) {
|
||||
// if (CommonDataManage().currentKeyInfo.isLockOwner != 1) {
|
||||
// logic.showToast('请先添加锁');
|
||||
// } else {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: <String, bool>{'isShop': true});
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
||||
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
||||
});
|
||||
// }
|
||||
} else {
|
||||
Get.toNamed(Routers.valueAddedServicesHighFunctionPage);
|
||||
@ -91,34 +94,34 @@ class _ValueAddedServicesPageListState
|
||||
Image.asset(
|
||||
'images/mine/icon_mine_valueAddedServices_storage.png'),
|
||||
TranslationLoader.lanKeys!.recordsRetention!.tr, () {
|
||||
EasyLoading.showToast("功能暂未开放", duration: 2000.milliseconds);
|
||||
EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds);
|
||||
}),
|
||||
_valueAddedServicesItem(
|
||||
Image.asset('images/mine/icon_mine_valueAddedServices_vip.png'),
|
||||
'可视对讲', () {
|
||||
EasyLoading.showToast("功能暂未开放", duration: 2000.milliseconds);
|
||||
EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds);
|
||||
}),
|
||||
_valueAddedServicesItem(
|
||||
Text(
|
||||
"A",
|
||||
'A',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 38.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
"Amazon Alexa", () {
|
||||
EasyLoading.showToast("功能暂未开放", duration: 2000.milliseconds);
|
||||
'Amazon Alexa', () {
|
||||
EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds);
|
||||
}),
|
||||
_valueAddedServicesItem(
|
||||
Text(
|
||||
"G",
|
||||
'G',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 38.sp,
|
||||
fontWeight: FontWeight.w600),
|
||||
),
|
||||
"Google Home", () {
|
||||
EasyLoading.showToast("功能暂未开放", duration: 2000.milliseconds);
|
||||
'Google Home', () {
|
||||
EasyLoading.showToast('功能暂未开放', duration: 2000.milliseconds);
|
||||
}),
|
||||
],
|
||||
),
|
||||
@ -138,7 +141,7 @@ class _ValueAddedServicesPageListState
|
||||
borderRadius: BorderRadius.circular(10.w),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 50.w,
|
||||
height: 50.w,
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
import 'dart:async';
|
||||
import 'package:star_lock/mine/valueAddedServices/advancedFeaturesWeb/advancedFeaturesWeb_entity.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_state.dart';
|
||||
import 'package:star_lock/tools/baseGetXController.dart';
|
||||
import '../../../network/api_repository.dart';
|
||||
|
||||
class ValueAddedServicesNoteAndEmailDetailLogic extends BaseGetXController {
|
||||
final ValueAddedServicesNoteAndEmailDetailState state =
|
||||
ValueAddedServicesNoteAndEmailDetailState();
|
||||
|
||||
//获取增值服务用户余量包
|
||||
Future<void> getServiceUserPackage() async {
|
||||
var entity = await ApiRepository.to.getServiceUserPackage();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (state.selectType.value == 1) {
|
||||
state.remainCount.value = entity.data!.smsCount!;
|
||||
} else if (state.selectType.value == 2) {
|
||||
state.remainCount.value = entity.data!.emailCount!;
|
||||
}
|
||||
state.remainCount.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
//增值服务套餐购包链接
|
||||
Future<void> getServicePackageBuyUrl() async {
|
||||
final AdvancedFeaturesWebEntity entity =
|
||||
await ApiRepository.to.getServicePackageBuyUrl();
|
||||
if (entity.errorCode!.codeIsSuccessful) {
|
||||
if (state.selectType.value == 1) {
|
||||
state.buyUrl.value = entity.data!.smsBuyUrl!;
|
||||
} else if (state.selectType.value == 2) {
|
||||
state.buyUrl.value = entity.data!.emailBuyUrl!;
|
||||
}
|
||||
state.buyUrl.refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void onInit() {
|
||||
super.onInit();
|
||||
|
||||
getServiceUserPackage();
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_logic.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesNoteAndEmailDetail/valueAddedServicesNoteAndEmailDetail_state.dart';
|
||||
|
||||
import '../../../appRouters.dart';
|
||||
import '../../../app_settings/app_colors.dart';
|
||||
@ -18,33 +21,41 @@ class ValueAddedServicesNoteAndEmailDetailPage extends StatefulWidget {
|
||||
|
||||
class _ValueAddedServicesNoteAndEmailDetailPageState
|
||||
extends State<ValueAddedServicesNoteAndEmailDetailPage> {
|
||||
final ValueAddedServicesNoteAndEmailDetailLogic logic =
|
||||
Get.put(ValueAddedServicesNoteAndEmailDetailLogic());
|
||||
final ValueAddedServicesNoteAndEmailDetailState state =
|
||||
Get.find<ValueAddedServicesNoteAndEmailDetailLogic>().state;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
logic.getServicePackageBuyUrl();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var type = ModalRoute.of(context)?.settings.arguments as int;
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: AppColors.mainBackgroundColor,
|
||||
appBar: TitleAppBar(
|
||||
barTitle: type == 1
|
||||
barTitle: state.selectType.value == 1
|
||||
? TranslationLoader.lanKeys!.note!.tr
|
||||
: TranslationLoader.lanKeys!.mail!.tr,
|
||||
haveBack: true,
|
||||
backgroundColor: AppColors.mainColor),
|
||||
body: Column(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 1.sw,
|
||||
// color: Colors.grey.shade300,
|
||||
padding: EdgeInsets.only(
|
||||
left: 25.h, right: 25.h, top: 25.h, bottom: 10.h),
|
||||
child: Text(
|
||||
type == 1
|
||||
state.selectType.value == 1
|
||||
? TranslationLoader.lanKeys!.smsBuyTip!.tr
|
||||
: TranslationLoader.lanKeys!.emailBuyTip!.tr,
|
||||
style: TextStyle(
|
||||
color: AppColors.darkGrayTextColor, fontSize: 18.sp),
|
||||
)),
|
||||
middleWidget(type),
|
||||
middleWidget(state.selectType.value),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -53,31 +64,30 @@ class _ValueAddedServicesNoteAndEmailDetailPageState
|
||||
Widget middleWidget(int type) {
|
||||
return Container(
|
||||
width: 1.sw,
|
||||
// height: 100,
|
||||
// color: Colors.grey.shade300,
|
||||
margin: EdgeInsets.all(10.h),
|
||||
decoration: const BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: AssetImage(
|
||||
"images/mine/icon_mine_valueAddedServices_noteTop.png"),
|
||||
'images/mine/icon_mine_valueAddedServices_noteTop.png'),
|
||||
fit: BoxFit.cover)),
|
||||
child: Column(children: [
|
||||
// SizedBox(height:10),
|
||||
child: Column(children: <Widget>[
|
||||
Container(
|
||||
margin:
|
||||
const EdgeInsets.only(top: 15, bottom: 15, left: 30, right: 30),
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: Text(
|
||||
"${TranslationLoader.lanKeys!.currentRemainingQuantity!.tr}:0",
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
)),
|
||||
child: Obx(() => Text(
|
||||
'${TranslationLoader.lanKeys!.currentRemainingQuantity!.tr}:${state.remainCount.value}',
|
||||
style: TextStyle(fontSize: 24.sp),
|
||||
))),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.pushNamed(
|
||||
context, Routers.valueAddedServicesBuyPage,
|
||||
arguments: type);
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
||||
'webBuyType': state.selectType.value == 1
|
||||
? XSConstantMacro.webBuyTypeSMS
|
||||
: XSConstantMacro.webBuyTypeEmail,
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: 50,
|
||||
@ -93,14 +103,11 @@ class _ValueAddedServicesNoteAndEmailDetailPageState
|
||||
],
|
||||
),
|
||||
),
|
||||
// SizedBox(height:20.h),
|
||||
Container(
|
||||
margin: const EdgeInsets.only(top: 10, bottom: 10),
|
||||
// color: Colors.red,
|
||||
// height: 100.h,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
children: <Widget>[
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (type == 1) {
|
||||
@ -112,12 +119,12 @@ class _ValueAddedServicesNoteAndEmailDetailPageState
|
||||
}
|
||||
},
|
||||
child: Row(
|
||||
children: [
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
width: 30.w,
|
||||
),
|
||||
Image.asset(
|
||||
"images/mine/icon_mine_valueAddedServices_buyIcon.png",
|
||||
'images/mine/icon_mine_valueAddedServices_buyIcon.png',
|
||||
width: 36.w,
|
||||
height: 36.w,
|
||||
),
|
||||
|
||||
@ -0,0 +1,15 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class ValueAddedServicesNoteAndEmailDetailState {
|
||||
ValueAddedServicesNoteAndEmailDetailState() {
|
||||
if (Get.arguments is Map && Get.arguments.isNotEmpty) {
|
||||
if (Get.arguments['type'] != null) {
|
||||
selectType.value = Get.arguments['type'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RxInt selectType = 0.obs; //1-短信;2-邮件
|
||||
RxInt remainCount = 0.obs; //当前短信/邮箱剩余数量
|
||||
RxString buyUrl = ''.obs; //短信/邮箱购买链接
|
||||
}
|
||||
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_logic.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRealName/value_added_services_real_name_state.dart';
|
||||
import 'package:star_lock/mine/valueAddedServices/valueAddedServicesRecord/use_record_list_arg.dart';
|
||||
@ -94,8 +95,9 @@ class _ValueAddedServicesRealNamePageState
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: <String, bool>{'isShop': false});
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
||||
'webBuyType': XSConstantMacro.webBuyTypeAuth,
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
width: 200.w,
|
||||
|
||||
@ -5,6 +5,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:star_lock/appRouters.dart';
|
||||
import 'package:star_lock/app_settings/app_colors.dart';
|
||||
import 'package:star_lock/common/XSConstantMacro/XSConstantMacro.dart';
|
||||
|
||||
typedef AuthInfoCallback = void Function(String? idCard, String? name);
|
||||
|
||||
@ -89,8 +90,9 @@ class ShowCupertinoAlertView {
|
||||
style: TextStyle(color: AppColors.mainColor),
|
||||
),
|
||||
onPressed: () async {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage,
|
||||
arguments: {'isShop': true});
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
||||
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -121,7 +123,7 @@ class ShowCupertinoAlertView {
|
||||
),
|
||||
onPressed: () {
|
||||
Get.toNamed(Routers.advancedFeaturesWebPage, arguments: {
|
||||
'isShop': true,
|
||||
'webBuyType': XSConstantMacro.webBuyTypeVip,
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user