Browse Source

1、智能弹窗立即搜索跳转搜索结果页

tags/0.0.9+8^0
PH2 3 years ago
parent
commit
64af37cb72
2 changed files with 28 additions and 16 deletions
  1. +15
    -9
      lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart
  2. +13
    -7
      lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart

+ 15
- 9
lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_goods_dialog.dart View File

@@ -250,11 +250,8 @@ class _IntellectSearchGoodsDialogState
),
Expanded(
child: Text(
(num.tryParse(widget?.model?.price ?? "0") -
num.tryParse(
widget?.model?.couponPrice ?? "0"))
.toStringAsFixed(2) ??
"",
formatNum((num.tryParse(widget?.model?.price ?? "0") - num.tryParse(widget?.model?.couponPrice ?? "0")), 2),
// ().toStringAsFixed(2) ?? "",
maxLines: 1,
style: TextStyle(
fontSize: 16,
@@ -272,6 +269,18 @@ class _IntellectSearchGoodsDialogState
);
}

// 取两位小数,不进行四舍五入
String formatNum(var num, int position) {
String rlt = '0';
if ((num.toString().length - num.toString().lastIndexOf(".") - 1) < position) {
//小数点后有几位小数
rlt = num.toStringAsFixed(position).substring(0, num.toString().lastIndexOf(".") + position + 1).toString();
} else {
rlt = num.toString().substring(0, num.toString().lastIndexOf(".") + position + 1).toString();
}
return rlt;
}

_buildBottomItem() {
return Column(
children: <Widget>[
@@ -294,10 +303,7 @@ class _IntellectSearchGoodsDialogState
child: Text(
(_styleModel?.moduleList?.saveBtn?.content ?? "") +
" ¥" +
((num.tryParse(widget?.model?.couponPrice ?? "0") ??
0) +
num.tryParse(widget?.model?.commission ?? '0'))
.toString(),
formatNum((num.tryParse(widget?.model?.couponPrice ?? "0") ?? 0) + num.tryParse(widget?.model?.commission ?? '0'), 2),
style: TextStyle(
color: HexColor.fromHex(
_styleModel?.moduleList?.saveBtn?.fontColor),


+ 13
- 7
lib/dialog/global_dialog/intellect_search_goods_dialog/intellect_search_no_goods_dialog.dart View File

@@ -61,6 +61,18 @@ class _IntellectSearchNoGoodsDialogState extends State<IntellectSearchNoGoodsDia
});
}

/// 点击立即搜索,跳转搜索结果页
void openSearchResultPage() {
// RouterUtil.route(SkipModel.fromJson(_styleModel.moduleList.btn.skipInfo.toJson()), {"keywords": searchText, "type": _styleModel.moduleList.btn.skipInfo.pvd}, context).then((_) {
// Navigator.pop(context);
// });
// 这里直接跳搜索结果页,不能跳搜索页。app端直接写死。需要修改记得修改这个地方
_styleModel.moduleList.btn.skipInfo.skipIdentifier = 'pub.flutter.search_result';
RouterUtil.route(SkipModel.fromJson(_styleModel.moduleList.btn.skipInfo.toJson()), {"keywords": searchText, "type": _styleModel.moduleList.btn.skipInfo.pvd}, context).then((_) {
Navigator.pop(context);
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
@@ -162,13 +174,7 @@ class _IntellectSearchNoGoodsDialogState extends State<IntellectSearchNoGoodsDia
),
)),
),
onTap: () {
RouterUtil.route(
SkipModel.fromJson(_styleModel.moduleList.btn.skipInfo.toJson()), {"keywords": searchText, "type": _styleModel.moduleList.btn.skipInfo.pvd}, context)
.then((_) {
Navigator.pop(context);
});
},
onTap: () => openSearchResultPage(),
),
)
],


Loading…
Cancel
Save