|
@@ -15,12 +15,10 @@ class IntellectSearchGoodsDialog extends StatefulWidget { |
|
|
const IntellectSearchGoodsDialog({Key key, this.model}) : super(key: key); |
|
|
const IntellectSearchGoodsDialog({Key key, this.model}) : super(key: key); |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
|
_IntellectSearchGoodsDialogState createState() => |
|
|
|
|
|
_IntellectSearchGoodsDialogState(); |
|
|
|
|
|
|
|
|
_IntellectSearchGoodsDialogState createState() => _IntellectSearchGoodsDialogState(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class _IntellectSearchGoodsDialogState |
|
|
|
|
|
extends State<IntellectSearchGoodsDialog> { |
|
|
|
|
|
|
|
|
class _IntellectSearchGoodsDialogState extends State<IntellectSearchGoodsDialog> { |
|
|
HasGoodsDialogStyleModel _styleModel; |
|
|
HasGoodsDialogStyleModel _styleModel; |
|
|
|
|
|
|
|
|
@override |
|
|
@override |
|
@@ -46,15 +44,8 @@ class _IntellectSearchGoodsDialogState |
|
|
children: <Widget>[ |
|
|
children: <Widget>[ |
|
|
Container( |
|
|
Container( |
|
|
margin: EdgeInsets.only(top: 19, left: 48, right: 48), |
|
|
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, |
|
|
width: double.infinity, |
|
|
child: Column( |
|
|
child: Column( |
|
|
children: <Widget>[_buildTopItem(), _buildBottomItem()], |
|
|
children: <Widget>[_buildTopItem(), _buildBottomItem()], |
|
@@ -100,12 +91,8 @@ class _IntellectSearchGoodsDialogState |
|
|
Container( |
|
|
Container( |
|
|
width: 80, |
|
|
width: 80, |
|
|
height: 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( |
|
|
SizedBox( |
|
|
width: 9.5, |
|
|
width: 9.5, |
|
@@ -133,9 +120,7 @@ class _IntellectSearchGoodsDialogState |
|
|
? Container() |
|
|
? Container() |
|
|
: Container( |
|
|
: Container( |
|
|
margin: EdgeInsets.only(right: 16), |
|
|
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), |
|
|
padding: EdgeInsets.all(2), |
|
|
child: Row( |
|
|
child: Row( |
|
|
mainAxisSize: MainAxisSize.min, |
|
|
mainAxisSize: MainAxisSize.min, |
|
@@ -143,46 +128,26 @@ class _IntellectSearchGoodsDialogState |
|
|
Container( |
|
|
Container( |
|
|
width: 15, |
|
|
width: 15, |
|
|
height: 15, |
|
|
height: 15, |
|
|
decoration: BoxDecoration( |
|
|
|
|
|
color: HexColor.fromHex(_styleModel |
|
|
|
|
|
?.moduleList?.coupon?.bgColor ?? |
|
|
|
|
|
"")), |
|
|
|
|
|
|
|
|
decoration: BoxDecoration(color: HexColor.fromHex(_styleModel?.moduleList?.coupon?.bgColor ?? "")), |
|
|
child: Center( |
|
|
child: Center( |
|
|
child: Text( |
|
|
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( |
|
|
padding: const EdgeInsets.only( |
|
|
|
|
|
left: 4, right: 4), |
|
|
|
|
|
|
|
|
padding: const EdgeInsets.only(left: 4, right: 4), |
|
|
child: Text( |
|
|
child: Text( |
|
|
"¥" + (widget.model?.couponPrice ?? ""), |
|
|
"¥" + (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( |
|
|
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), |
|
|
padding: EdgeInsets.all(2), |
|
|
child: Row( |
|
|
child: Row( |
|
|
mainAxisSize: MainAxisSize.min, |
|
|
mainAxisSize: MainAxisSize.min, |
|
@@ -192,21 +157,10 @@ class _IntellectSearchGoodsDialogState |
|
|
), |
|
|
), |
|
|
Center( |
|
|
Center( |
|
|
child: Padding( |
|
|
child: Padding( |
|
|
padding: |
|
|
|
|
|
const EdgeInsets.only(left: 4, right: 4), |
|
|
|
|
|
|
|
|
padding: const EdgeInsets.only(left: 4, right: 4), |
|
|
child: Text( |
|
|
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), |
|
|
padding: const EdgeInsets.only(bottom: 2), |
|
|
child: Text( |
|
|
child: Text( |
|
|
_styleModel?.moduleList?.couponAfter?.content ?? "", |
|
|
_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( |
|
|
padding: |
|
|
|
|
|
const EdgeInsets.only(bottom: 2, left: 4, right: 4), |
|
|
|
|
|
|
|
|
padding: const EdgeInsets.only(bottom: 2, left: 4, right: 4), |
|
|
child: Text( |
|
|
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( |
|
|
Expanded( |
|
@@ -253,8 +198,7 @@ class _IntellectSearchGoodsDialogState |
|
|
maxLines: 1, |
|
|
maxLines: 1, |
|
|
style: TextStyle( |
|
|
style: TextStyle( |
|
|
fontSize: 16, |
|
|
fontSize: 16, |
|
|
color: HexColor.fromHex(_styleModel |
|
|
|
|
|
?.moduleList?.couponAfterPrice?.fontColor), |
|
|
|
|
|
|
|
|
color: HexColor.fromHex(_styleModel?.moduleList?.couponAfterPrice?.fontColor), |
|
|
), |
|
|
), |
|
|
), |
|
|
), |
|
|
) |
|
|
) |
|
@@ -291,10 +235,7 @@ class _IntellectSearchGoodsDialogState |
|
|
Expanded( |
|
|
Expanded( |
|
|
child: Container( |
|
|
child: Container( |
|
|
margin: EdgeInsets.only(left: 10, right: 10), |
|
|
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: Center( |
|
|
child: Padding( |
|
|
child: Padding( |
|
|
padding: const EdgeInsets.all(12.0), |
|
|
padding: const EdgeInsets.all(12.0), |
|
@@ -302,10 +243,7 @@ class _IntellectSearchGoodsDialogState |
|
|
(_styleModel?.moduleList?.saveBtn?.content ?? "") + |
|
|
(_styleModel?.moduleList?.saveBtn?.content ?? "") + |
|
|
" ¥" + |
|
|
" ¥" + |
|
|
formatNum((num.tryParse(widget?.model?.couponPrice ?? "0") ?? 0) + num.tryParse(widget?.model?.commission ?? '0'), 2), |
|
|
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>[ |
|
|
children: <Widget>[ |
|
|
Expanded( |
|
|
Expanded( |
|
|
child: Container( |
|
|
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: Center( |
|
|
child: Padding( |
|
|
child: Padding( |
|
|
padding: const EdgeInsets.all(12.0), |
|
|
padding: const EdgeInsets.all(12.0), |
|
|
child: Text( |
|
|
child: Text( |
|
|
_styleModel?.moduleList?.viewGoodsBtn?.content ?? "", |
|
|
_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() { |
|
|
void requestStyle() { |
|
|
NetUtil.request("/api/v1/cfg/clipboard_identified", onSuccess: (data) { |
|
|
NetUtil.request("/api/v1/cfg/clipboard_identified", onSuccess: (data) { |
|
|
print(data); |
|
|
print(data); |
|
|
_styleModel = HasGoodsDialogStyleModel.fromJson( |
|
|
|
|
|
json.decode(data['clipboard_identified'])); |
|
|
|
|
|
|
|
|
_styleModel = HasGoodsDialogStyleModel.fromJson(json.decode(data['clipboard_identified'])); |
|
|
setState(() {}); |
|
|
setState(() {}); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
@@ -363,6 +293,7 @@ class _IntellectSearchGoodsDialogState |
|
|
void openUrl() async { |
|
|
void openUrl() async { |
|
|
///跳转购买 |
|
|
///跳转购买 |
|
|
UserInfoModel userInfo = UserInfoNotifier.staitcUserInfo; |
|
|
UserInfoModel userInfo = UserInfoNotifier.staitcUserInfo; |
|
|
|
|
|
|
|
|
/// 登录 |
|
|
/// 登录 |
|
|
if (userInfo?.token == null || userInfo.token == '') { |
|
|
if (userInfo?.token == null || userInfo.token == '') { |
|
|
print('need login...'); |
|
|
print('need login...'); |
|
@@ -370,32 +301,34 @@ class _IntellectSearchGoodsDialogState |
|
|
return; |
|
|
return; |
|
|
} else { |
|
|
} else { |
|
|
print("平台" + widget?.model?.provider ?? ""); |
|
|
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 ?? ""); |
|
|
print("链接" + widget?.model?.couponUrl ?? ""); |
|
|
Logger.log('智能弹窗有商品情况跳转数据 = ${widget?.model?.toJson()}'); |
|
|
Logger.log('智能弹窗有商品情况跳转数据 = ${widget?.model?.toJson()}'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String tempProvider = widget?.model?.provider ?? 'taobao'; |
|
|
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); |
|
|
bool isAuth = await TaobaoAuth.auth(context); |
|
|
|
|
|
|
|
|
///关闭弹窗 |
|
|
///关闭弹窗 |
|
|
if (Navigator.canPop(context)) { |
|
|
if (Navigator.canPop(context)) { |
|
|
Navigator.pop(context); |
|
|
Navigator.pop(context); |
|
|
} |
|
|
} |
|
|
if (!isAuth) return; |
|
|
if (!isAuth) return; |
|
|
} else if (tempProvider == GlobalConfig.PROVIDER_PDD) { /// 拼多多 |
|
|
|
|
|
|
|
|
} else if (tempProvider == GlobalConfig.PROVIDER_PDD) { |
|
|
|
|
|
/// 拼多多 |
|
|
bool isNeedAuth = await PddAuth.auth(context, isShare: '0'); |
|
|
bool isNeedAuth = await PddAuth.auth(context, isShare: '0'); |
|
|
|
|
|
|
|
|
///关闭弹窗 |
|
|
///关闭弹窗 |
|
|
if (Navigator.canPop(context)) { |
|
|
if (Navigator.canPop(context)) { |
|
|
Navigator.pop(context); |
|
|
Navigator.pop(context); |
|
|
} |
|
|
} |
|
|
if (isNeedAuth) return; |
|
|
if (isNeedAuth) return; |
|
|
} else{ |
|
|
|
|
|
|
|
|
} else { |
|
|
///关闭弹窗 |
|
|
///关闭弹窗 |
|
|
if (Navigator.canPop(context)) { |
|
|
if (Navigator.canPop(context)) { |
|
|
Navigator.pop(context); |
|
|
Navigator.pop(context); |
|
@@ -407,7 +340,7 @@ class _IntellectSearchGoodsDialogState |
|
|
context, |
|
|
context, |
|
|
provider: widget?.model?.provider ?? 'taobao', |
|
|
provider: widget?.model?.provider ?? 'taobao', |
|
|
openAppUrl: widget?.model?.couponUrl, |
|
|
openAppUrl: widget?.model?.couponUrl, |
|
|
appUrl: widget?.model?.couponUrl, |
|
|
|
|
|
|
|
|
appUrl: widget?.model?.appUrl, |
|
|
webUrl: widget?.model?.couponUrl, |
|
|
webUrl: widget?.model?.couponUrl, |
|
|
); |
|
|
); |
|
|
// if (widget?.model?.provider == GlobalConfig.PROVIDER_TB || widget?.model?.provider == GlobalConfig.PROVIDER_TM) { |
|
|
// if (widget?.model?.provider == GlobalConfig.PROVIDER_TB || widget?.model?.provider == GlobalConfig.PROVIDER_TM) { |
|
@@ -437,9 +370,7 @@ class _IntellectSearchGoodsDialogState |
|
|
void openGoodsDetails() { |
|
|
void openGoodsDetails() { |
|
|
String provider = widget.model.provider; |
|
|
String provider = widget.model.provider; |
|
|
String goodId = widget.model.itemId; |
|
|
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); |
|
|
Navigator.pop(context); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|