diff --git a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart index c26d72d..85c969d 100644 --- a/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart +++ b/lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart @@ -1,19 +1,17 @@ import 'dart:convert'; +import 'dart:io'; +import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_alibc/alibc_const_key.dart'; +import 'package:flutter_alibc/alibc_model.dart'; +import 'package:flutter_alibc/flutter_alibc.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:provider/provider.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/has_goods_dialog_style_model.dart'; import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/intellect_dialog_data_model.dart'; -import 'package:zhiying_base_widget/widgets/home/home_quick_entry/cached_network_image_util.dart'; -import 'package:cached_network_image/cached_network_image.dart'; -import 'package:zhiying_base_widget/widgets/wallet/wallet_detail/model/wallet_detail_model.dart'; import 'package:zhiying_comm/zhiying_comm.dart'; -import 'package:provider/provider.dart'; -import 'package:zhiying_comm/zhiying_comm.dart'; -import 'package:flutter_alibc/flutter_alibc.dart'; -import 'package:flutter_alibc/alibc_model.dart'; -import 'package:flutter_alibc/alibc_const_key.dart'; class IntellectSearchGoodsDialog extends StatefulWidget { final IntellectDialogDataModel model; @@ -244,8 +242,8 @@ class _IntellectSearchGoodsDialogState ), Text( (num.tryParse(widget?.model?.price ?? "0") - - num.tryParse( - widget?.model?.couponPrice ?? "0")).toString() ?? + num.tryParse(widget?.model?.couponPrice ?? "0")) + .toString() ?? "", style: TextStyle( fontSize: 32.sp, @@ -286,8 +284,7 @@ class _IntellectSearchGoodsDialogState " ¥" + ((num.tryParse(widget?.model?.couponPrice ?? "0") ?? 0) + - num.tryParse( - widget?.model?.commission ?? '0')) + num.tryParse(widget?.model?.commission ?? '0')) .toString(), style: TextStyle( color: HexColor.fromHex( @@ -357,10 +354,18 @@ class _IntellectSearchGoodsDialogState print("平台" + widget?.model?.provider ?? ""); print("链接" + widget?.model?.couponUrl ?? ""); if (widget?.model?.provider == 'taobao') { - TradeResult result = await FlutterAlibc.openByUrl( + TradeResult result; + if (Platform.isAndroid) { + result = await FlutterAlibc.openByUrl( + url: widget?.model?.couponUrl ?? "", + openType: AlibcOpenType.AlibcOpenTypeNative, + backUrl: "alisdk://"); + } else if (Platform.isIOS) { + result = await FlutterAlibc.openByUrl( url: widget?.model?.couponUrl ?? "", openType: AlibcOpenType.AlibcOpenTypeNative, - backUrl: "alisdk://"); + ); + } Logger.debug('${result.errorCode} ${result.errorMessage} '); print("链接" + widget?.model?.couponUrl ?? ""); print("错误码" + result.errorCode); diff --git a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart index 45c2a22..508a525 100644 --- a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart +++ b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:io'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/cupertino.dart'; @@ -126,9 +127,12 @@ class _GooddsDetailsFooterContainerState TaobaoAuth.auth(context); return; } - - TradeResult result = - await FlutterAlibc.openByUrl(url: url, backUrl: "alisdk://"); + TradeResult result; + if (Platform.isAndroid) { + result = await FlutterAlibc.openByUrl(url: url, backUrl: "alisdk://"); + } else if (Platform.isIOS) { + result = await FlutterAlibc.openByUrl(url: url); + } Logger.debug('${result.errorCode} ${result.errorMessage} '); } else { RouterUtil.openWebview(url, context);