|
|
@@ -21,6 +21,93 @@ class IntellectSearchGoodsDialog extends StatefulWidget { |
|
|
|
class _IntellectSearchGoodsDialogState extends State<IntellectSearchGoodsDialog> { |
|
|
|
HasGoodsDialogStyleModel _styleModel; |
|
|
|
|
|
|
|
///打开详情 |
|
|
|
void openGoodsDetails() { |
|
|
|
Clipboard.setData(ClipboardData(text: "")); |
|
|
|
String provider = widget.model.provider; |
|
|
|
String goodId = widget.model.itemId; |
|
|
|
RouterUtil.route(SkipModel(skipIdentifier: "goods_details"), {"provider": provider, "good_id": goodId}, context).then((data) { |
|
|
|
Navigator.pop(context); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/// 跳转购买 |
|
|
|
void openUrl() async { |
|
|
|
///跳转购买 |
|
|
|
UserInfoModel userInfo = UserInfoNotifier.staitcUserInfo; |
|
|
|
|
|
|
|
/// 登录 |
|
|
|
if (userInfo?.token == null || userInfo.token == '') { |
|
|
|
print('need login...'); |
|
|
|
RouterUtil.goLogin(context); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
print("平台" + widget?.model?.provider ?? ""); |
|
|
|
// if(!widget?.model?.couponUrl.contains("http")){ |
|
|
|
// widget?.model?.couponUrl="https:"+widget?.model?.couponUrl; |
|
|
|
// } |
|
|
|
// widget?.model?.couponUrl=widget?.model?.couponUrl.replaceAll("\\", ""); |
|
|
|
print("链接" + widget?.model?.couponUrl ?? ""); |
|
|
|
Logger.log('智能弹窗有商品情况跳转数据 = ${widget?.model?.toJson()}'); |
|
|
|
|
|
|
|
String tempProvider = widget?.model?.provider ?? 'taobao'; |
|
|
|
|
|
|
|
/// 判断淘宝渠道是否授权 |
|
|
|
if (tempProvider == GlobalConfig.PROVIDER_TB || tempProvider == GlobalConfig.PROVIDER_TM) { |
|
|
|
bool isAuth = await TaobaoAuth.auth(context); |
|
|
|
|
|
|
|
///关闭弹窗 |
|
|
|
if (Navigator.canPop(context)) { |
|
|
|
Navigator.pop(context); |
|
|
|
} |
|
|
|
if (!isAuth) return; |
|
|
|
} else if (tempProvider == GlobalConfig.PROVIDER_PDD) { |
|
|
|
/// 拼多多 |
|
|
|
bool isNeedAuth = await PddAuth.auth(context, isShare: '0'); |
|
|
|
|
|
|
|
///关闭弹窗 |
|
|
|
if (Navigator.canPop(context)) { |
|
|
|
Navigator.pop(context); |
|
|
|
} |
|
|
|
if (isNeedAuth) return; |
|
|
|
} else { |
|
|
|
///关闭弹窗 |
|
|
|
if (Navigator.canPop(context)) { |
|
|
|
Navigator.pop(context); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// 改成统一跳转 |
|
|
|
await TurnChainUtil.jumpNative( |
|
|
|
context, |
|
|
|
provider: widget?.model?.provider ?? 'taobao', |
|
|
|
openAppUrl: widget?.model?.couponUrl, |
|
|
|
appUrl: widget?.model?.appUrl, |
|
|
|
webUrl: widget?.model?.couponUrl, |
|
|
|
); |
|
|
|
// if (widget?.model?.provider == GlobalConfig.PROVIDER_TB || widget?.model?.provider == GlobalConfig.PROVIDER_TM) { |
|
|
|
// TradeResult result; |
|
|
|
// if (Platform.isAndroid) { |
|
|
|
// result = await FlutterAlibc.openByUrl(url: widget?.model?.couponUrl ?? "", backUrl: "alisdk://"); |
|
|
|
// } else if (Platform.isIOS) { |
|
|
|
// result = await FlutterAlibc.openByUrl(url: widget?.model?.couponUrl ?? ""); |
|
|
|
// } |
|
|
|
// Logger.debug('${result.errorCode} ${result.errorMessage} '); |
|
|
|
// print("链接" + widget?.model?.couponUrl ?? ""); |
|
|
|
// print("错误码" + result.errorCode); |
|
|
|
// print("原因" + result.errorMessage); |
|
|
|
// } else if (widget?.model?.provider == GlobalConfig.PROVIDER_JD) { |
|
|
|
// /// 京东 |
|
|
|
// // Jdsdk.openUrl(url: openAppUrl); |
|
|
|
// Logger.log('走了京东打开'); |
|
|
|
// } else { |
|
|
|
// /// 其它 |
|
|
|
// Logger.log('走了其它打开方式'); |
|
|
|
// // await FlutterAlibc.openByUrl(url: widget?.model?.couponUrl, openType: AlibcOpenType.AlibcOpenTypeNative); |
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
|
requestStyle(); |
|
|
@@ -291,91 +378,6 @@ class _IntellectSearchGoodsDialogState extends State<IntellectSearchGoodsDialog> |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
void openUrl() async { |
|
|
|
///跳转购买 |
|
|
|
UserInfoModel userInfo = UserInfoNotifier.staitcUserInfo; |
|
|
|
|
|
|
|
/// 登录 |
|
|
|
if (userInfo?.token == null || userInfo.token == '') { |
|
|
|
print('need login...'); |
|
|
|
RouterUtil.goLogin(context); |
|
|
|
return; |
|
|
|
} else { |
|
|
|
print("平台" + widget?.model?.provider ?? ""); |
|
|
|
// if(!widget?.model?.couponUrl.contains("http")){ |
|
|
|
// widget?.model?.couponUrl="https:"+widget?.model?.couponUrl; |
|
|
|
// } |
|
|
|
// widget?.model?.couponUrl=widget?.model?.couponUrl.replaceAll("\\", ""); |
|
|
|
print("链接" + widget?.model?.couponUrl ?? ""); |
|
|
|
Logger.log('智能弹窗有商品情况跳转数据 = ${widget?.model?.toJson()}'); |
|
|
|
|
|
|
|
String tempProvider = widget?.model?.provider ?? 'taobao'; |
|
|
|
|
|
|
|
/// 判断淘宝渠道是否授权 |
|
|
|
if (tempProvider == GlobalConfig.PROVIDER_TB || tempProvider == GlobalConfig.PROVIDER_TM) { |
|
|
|
bool isAuth = await TaobaoAuth.auth(context); |
|
|
|
|
|
|
|
///关闭弹窗 |
|
|
|
if (Navigator.canPop(context)) { |
|
|
|
Navigator.pop(context); |
|
|
|
} |
|
|
|
if (!isAuth) return; |
|
|
|
} else if (tempProvider == GlobalConfig.PROVIDER_PDD) { |
|
|
|
/// 拼多多 |
|
|
|
bool isNeedAuth = await PddAuth.auth(context, isShare: '0'); |
|
|
|
|
|
|
|
///关闭弹窗 |
|
|
|
if (Navigator.canPop(context)) { |
|
|
|
Navigator.pop(context); |
|
|
|
} |
|
|
|
if (isNeedAuth) return; |
|
|
|
} else { |
|
|
|
///关闭弹窗 |
|
|
|
if (Navigator.canPop(context)) { |
|
|
|
Navigator.pop(context); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/// 改成统一跳转 |
|
|
|
await TurnChainUtil.jumpNative( |
|
|
|
context, |
|
|
|
provider: widget?.model?.provider ?? 'taobao', |
|
|
|
openAppUrl: widget?.model?.couponUrl, |
|
|
|
appUrl: widget?.model?.appUrl, |
|
|
|
webUrl: widget?.model?.couponUrl, |
|
|
|
); |
|
|
|
// if (widget?.model?.provider == GlobalConfig.PROVIDER_TB || widget?.model?.provider == GlobalConfig.PROVIDER_TM) { |
|
|
|
// TradeResult result; |
|
|
|
// if (Platform.isAndroid) { |
|
|
|
// result = await FlutterAlibc.openByUrl(url: widget?.model?.couponUrl ?? "", backUrl: "alisdk://"); |
|
|
|
// } else if (Platform.isIOS) { |
|
|
|
// result = await FlutterAlibc.openByUrl(url: widget?.model?.couponUrl ?? ""); |
|
|
|
// } |
|
|
|
// Logger.debug('${result.errorCode} ${result.errorMessage} '); |
|
|
|
// print("链接" + widget?.model?.couponUrl ?? ""); |
|
|
|
// print("错误码" + result.errorCode); |
|
|
|
// print("原因" + result.errorMessage); |
|
|
|
// } else if (widget?.model?.provider == GlobalConfig.PROVIDER_JD) { |
|
|
|
// /// 京东 |
|
|
|
// // Jdsdk.openUrl(url: openAppUrl); |
|
|
|
// Logger.log('走了京东打开'); |
|
|
|
// } else { |
|
|
|
// /// 其它 |
|
|
|
// Logger.log('走了其它打开方式'); |
|
|
|
// // await FlutterAlibc.openByUrl(url: widget?.model?.couponUrl, openType: AlibcOpenType.AlibcOpenTypeNative); |
|
|
|
// } |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
///打开详情 |
|
|
|
void openGoodsDetails() { |
|
|
|
String provider = widget.model.provider; |
|
|
|
String goodId = widget.model.itemId; |
|
|
|
RouterUtil.route(SkipModel(skipIdentifier: "goods_details"), {"provider": provider, "good_id": goodId}, context).then((data) { |
|
|
|
Navigator.pop(context); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
Clipboard.setData(ClipboardData(text: "")); |
|
|
|