|
|
@@ -15,12 +15,10 @@ class IntellectSearchGoodsDialog extends StatefulWidget { |
|
|
|
const IntellectSearchGoodsDialog({Key key, this.model}) : super(key: key); |
|
|
|
|
|
|
|
@override |
|
|
|
_IntellectSearchGoodsDialogState createState() => |
|
|
|
_IntellectSearchGoodsDialogState(); |
|
|
|
_IntellectSearchGoodsDialogState createState() => _IntellectSearchGoodsDialogState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _IntellectSearchGoodsDialogState |
|
|
|
extends State<IntellectSearchGoodsDialog> { |
|
|
|
class _IntellectSearchGoodsDialogState extends State<IntellectSearchGoodsDialog> { |
|
|
|
HasGoodsDialogStyleModel _styleModel; |
|
|
|
|
|
|
|
@override |
|
|
@@ -46,15 +44,8 @@ class _IntellectSearchGoodsDialogState |
|
|
|
children: <Widget>[ |
|
|
|
Container( |
|
|
|
margin: EdgeInsets.only(top: 19, left: 48, right: 48), |
|
|
|
padding: EdgeInsets.only( |
|
|
|
top: 38, |
|
|
|
left: 15, |
|
|
|
right: 15, |
|
|
|
bottom: 24), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: |
|
|
|
HexColor.fromHex(_styleModel?.bgColor ?? "#FFFFFF"), |
|
|
|
borderRadius: BorderRadius.circular(16)), |
|
|
|
padding: EdgeInsets.only(top: 38, left: 15, right: 15, bottom: 24), |
|
|
|
decoration: BoxDecoration(color: HexColor.fromHex(_styleModel?.bgColor ?? "#FFFFFF"), borderRadius: BorderRadius.circular(16)), |
|
|
|
width: double.infinity, |
|
|
|
child: Column( |
|
|
|
children: <Widget>[_buildTopItem(), _buildBottomItem()], |
|
|
@@ -100,12 +91,8 @@ class _IntellectSearchGoodsDialogState |
|
|
|
Container( |
|
|
|
width: 80, |
|
|
|
height: 80, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.circular(6), |
|
|
|
image: DecorationImage( |
|
|
|
image: |
|
|
|
CachedNetworkImageProvider(widget.model?.thumbnail ?? ""), |
|
|
|
fit: BoxFit.fill)), |
|
|
|
decoration: |
|
|
|
BoxDecoration(borderRadius: BorderRadius.circular(6), image: DecorationImage(image: CachedNetworkImageProvider(widget.model?.thumbnail ?? ""), fit: BoxFit.fill)), |
|
|
|
), |
|
|
|
SizedBox( |
|
|
|
width: 9.5, |
|
|
@@ -133,9 +120,7 @@ class _IntellectSearchGoodsDialogState |
|
|
|
? Container() |
|
|
|
: Container( |
|
|
|
margin: EdgeInsets.only(right: 16), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: Colors.red, |
|
|
|
borderRadius: BorderRadius.circular(2)), |
|
|
|
decoration: BoxDecoration(color: Colors.red, borderRadius: BorderRadius.circular(2)), |
|
|
|
padding: EdgeInsets.all(2), |
|
|
|
child: Row( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
@@ -143,46 +128,26 @@ class _IntellectSearchGoodsDialogState |
|
|
|
Container( |
|
|
|
width: 15, |
|
|
|
height: 15, |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: HexColor.fromHex(_styleModel |
|
|
|
?.moduleList?.coupon?.bgColor ?? |
|
|
|
"")), |
|
|
|
decoration: BoxDecoration(color: HexColor.fromHex(_styleModel?.moduleList?.coupon?.bgColor ?? "")), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
_styleModel |
|
|
|
?.moduleList?.coupon?.content ?? |
|
|
|
"", |
|
|
|
style: TextStyle( |
|
|
|
color: HexColor.fromHex(_styleModel |
|
|
|
?.moduleList |
|
|
|
?.coupon |
|
|
|
?.fontColor ?? |
|
|
|
""), |
|
|
|
fontSize: 10), |
|
|
|
_styleModel?.moduleList?.coupon?.content ?? "", |
|
|
|
style: TextStyle(color: HexColor.fromHex(_styleModel?.moduleList?.coupon?.fontColor ?? ""), fontSize: 10), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only( |
|
|
|
left: 4, right: 4), |
|
|
|
padding: const EdgeInsets.only(left: 4, right: 4), |
|
|
|
child: Text( |
|
|
|
"¥" + (widget.model?.couponPrice ?? ""), |
|
|
|
style: TextStyle( |
|
|
|
color: HexColor.fromHex(_styleModel |
|
|
|
?.moduleList |
|
|
|
?.couponPrice |
|
|
|
?.fontColor), |
|
|
|
fontSize: 10), |
|
|
|
style: TextStyle(color: HexColor.fromHex(_styleModel?.moduleList?.couponPrice?.fontColor), fontSize: 10), |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
Container( |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: HexColor.fromHex( |
|
|
|
_styleModel?.moduleList?.commission?.bgColor), |
|
|
|
borderRadius: BorderRadius.circular(2)), |
|
|
|
decoration: BoxDecoration(color: HexColor.fromHex(_styleModel?.moduleList?.commission?.bgColor), borderRadius: BorderRadius.circular(2)), |
|
|
|
padding: EdgeInsets.all(2), |
|
|
|
child: Row( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
@@ -192,21 +157,10 @@ class _IntellectSearchGoodsDialogState |
|
|
|
), |
|
|
|
Center( |
|
|
|
child: Padding( |
|
|
|
padding: |
|
|
|
const EdgeInsets.only(left: 4, right: 4), |
|
|
|
padding: const EdgeInsets.only(left: 4, right: 4), |
|
|
|
child: Text( |
|
|
|
(_styleModel?.moduleList?.commission |
|
|
|
?.content ?? |
|
|
|
"") + |
|
|
|
" ¥" + |
|
|
|
(widget.model?.commission ?? ""), |
|
|
|
style: TextStyle( |
|
|
|
color: HexColor.fromHex(_styleModel |
|
|
|
?.moduleList |
|
|
|
?.commission |
|
|
|
?.fontColor ?? |
|
|
|
""), |
|
|
|
fontSize: 10), |
|
|
|
(_styleModel?.moduleList?.commission?.content ?? "") + " ¥" + (widget.model?.commission ?? ""), |
|
|
|
style: TextStyle(color: HexColor.fromHex(_styleModel?.moduleList?.commission?.fontColor ?? ""), fontSize: 10), |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
@@ -227,23 +181,14 @@ class _IntellectSearchGoodsDialogState |
|
|
|
padding: const EdgeInsets.only(bottom: 2), |
|
|
|
child: Text( |
|
|
|
_styleModel?.moduleList?.couponAfter?.content ?? "", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10, |
|
|
|
color: HexColor.fromHex(_styleModel |
|
|
|
?.moduleList?.couponAfterPrice?.fontColor ?? |
|
|
|
"")), |
|
|
|
style: TextStyle(fontSize: 10, color: HexColor.fromHex(_styleModel?.moduleList?.couponAfterPrice?.fontColor ?? "")), |
|
|
|
), |
|
|
|
), |
|
|
|
Padding( |
|
|
|
padding: |
|
|
|
const EdgeInsets.only(bottom: 2, left: 4, right: 4), |
|
|
|
padding: const EdgeInsets.only(bottom: 2, left: 4, right: 4), |
|
|
|
child: Text( |
|
|
|
"¥", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10, |
|
|
|
color: HexColor.fromHex(_styleModel |
|
|
|
?.moduleList?.couponAfterPrice?.fontColor ?? |
|
|
|
"")), |
|
|
|
style: TextStyle(fontSize: 10, color: HexColor.fromHex(_styleModel?.moduleList?.couponAfterPrice?.fontColor ?? "")), |
|
|
|
), |
|
|
|
), |
|
|
|
Expanded( |
|
|
@@ -253,8 +198,7 @@ class _IntellectSearchGoodsDialogState |
|
|
|
maxLines: 1, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 16, |
|
|
|
color: HexColor.fromHex(_styleModel |
|
|
|
?.moduleList?.couponAfterPrice?.fontColor), |
|
|
|
color: HexColor.fromHex(_styleModel?.moduleList?.couponAfterPrice?.fontColor), |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
@@ -291,10 +235,7 @@ class _IntellectSearchGoodsDialogState |
|
|
|
Expanded( |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.only(left: 10, right: 10), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: HexColor.fromHex( |
|
|
|
_styleModel?.moduleList?.saveBtn?.bgColor ?? ""), |
|
|
|
borderRadius: BorderRadius.circular(50)), |
|
|
|
decoration: BoxDecoration(color: HexColor.fromHex(_styleModel?.moduleList?.saveBtn?.bgColor ?? ""), borderRadius: BorderRadius.circular(50)), |
|
|
|
child: Center( |
|
|
|
child: Padding( |
|
|
|
padding: const EdgeInsets.all(12.0), |
|
|
@@ -302,10 +243,7 @@ class _IntellectSearchGoodsDialogState |
|
|
|
(_styleModel?.moduleList?.saveBtn?.content ?? "") + |
|
|
|
" ¥" + |
|
|
|
formatNum((num.tryParse(widget?.model?.couponPrice ?? "0") ?? 0) + num.tryParse(widget?.model?.commission ?? '0'), 2), |
|
|
|
style: TextStyle( |
|
|
|
color: HexColor.fromHex( |
|
|
|
_styleModel?.moduleList?.saveBtn?.fontColor), |
|
|
|
fontSize: 12), |
|
|
|
style: TextStyle(color: HexColor.fromHex(_styleModel?.moduleList?.saveBtn?.fontColor), fontSize: 12), |
|
|
|
), |
|
|
|
)), |
|
|
|
)) |
|
|
@@ -323,21 +261,14 @@ class _IntellectSearchGoodsDialogState |
|
|
|
children: <Widget>[ |
|
|
|
Expanded( |
|
|
|
child: Container( |
|
|
|
margin: EdgeInsets.only(left: 10, right:10), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: HexColor.fromHex( |
|
|
|
_styleModel?.moduleList?.viewGoodsBtn?.bgColor ?? ""), |
|
|
|
borderRadius: BorderRadius.circular(50)), |
|
|
|
margin: EdgeInsets.only(left: 10, right: 10), |
|
|
|
decoration: BoxDecoration(color: HexColor.fromHex(_styleModel?.moduleList?.viewGoodsBtn?.bgColor ?? ""), borderRadius: BorderRadius.circular(50)), |
|
|
|
child: Center( |
|
|
|
child: Padding( |
|
|
|
padding: const EdgeInsets.all(12.0), |
|
|
|
child: Text( |
|
|
|
_styleModel?.moduleList?.viewGoodsBtn?.content ?? "", |
|
|
|
style: TextStyle( |
|
|
|
color: HexColor.fromHex( |
|
|
|
_styleModel?.moduleList?.viewGoodsBtn?.fontColor ?? |
|
|
|
""), |
|
|
|
fontSize: 12), |
|
|
|
style: TextStyle(color: HexColor.fromHex(_styleModel?.moduleList?.viewGoodsBtn?.fontColor ?? ""), fontSize: 12), |
|
|
|
), |
|
|
|
)), |
|
|
|
)) |
|
|
@@ -354,8 +285,7 @@ class _IntellectSearchGoodsDialogState |
|
|
|
void requestStyle() { |
|
|
|
NetUtil.request("/api/v1/cfg/clipboard_identified", onSuccess: (data) { |
|
|
|
print(data); |
|
|
|
_styleModel = HasGoodsDialogStyleModel.fromJson( |
|
|
|
json.decode(data['clipboard_identified'])); |
|
|
|
_styleModel = HasGoodsDialogStyleModel.fromJson(json.decode(data['clipboard_identified'])); |
|
|
|
setState(() {}); |
|
|
|
}); |
|
|
|
} |
|
|
@@ -363,6 +293,7 @@ class _IntellectSearchGoodsDialogState |
|
|
|
void openUrl() async { |
|
|
|
///跳转购买 |
|
|
|
UserInfoModel userInfo = UserInfoNotifier.staitcUserInfo; |
|
|
|
|
|
|
|
/// 登录 |
|
|
|
if (userInfo?.token == null || userInfo.token == '') { |
|
|
|
print('need login...'); |
|
|
@@ -370,32 +301,34 @@ class _IntellectSearchGoodsDialogState |
|
|
|
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("\\", ""); |
|
|
|
// 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 ) { |
|
|
|
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) { /// 拼多多 |
|
|
|
} 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{ |
|
|
|
} else { |
|
|
|
///关闭弹窗 |
|
|
|
if (Navigator.canPop(context)) { |
|
|
|
Navigator.pop(context); |
|
|
@@ -407,7 +340,7 @@ class _IntellectSearchGoodsDialogState |
|
|
|
context, |
|
|
|
provider: widget?.model?.provider ?? 'taobao', |
|
|
|
openAppUrl: widget?.model?.couponUrl, |
|
|
|
appUrl: widget?.model?.couponUrl, |
|
|
|
appUrl: widget?.model?.appUrl, |
|
|
|
webUrl: widget?.model?.couponUrl, |
|
|
|
); |
|
|
|
// if (widget?.model?.provider == GlobalConfig.PROVIDER_TB || widget?.model?.provider == GlobalConfig.PROVIDER_TM) { |
|
|
@@ -437,9 +370,7 @@ class _IntellectSearchGoodsDialogState |
|
|
|
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) { |
|
|
|
RouterUtil.route(SkipModel(skipIdentifier: "goods_details"), {"provider": provider, "good_id": goodId}, context).then((data) { |
|
|
|
Navigator.pop(context); |
|
|
|
}); |
|
|
|
} |
|
|
|