diff --git a/README.md b/README.md
index cbc20081..aa4f7f4f 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,9 @@ samples, guidance on mobile development, and a full API reference.
小米开放平台 83364300@qq.com 具体问 :(汪姐)
推送:使用腾讯云推送 tpns 需扫码登录 (有问题同华为➕微信||或重新注册账号替换相关appKey)
+
+ 友盟: wu_rong 密码:Zxc09876
+
https://pos.platform.lotus-wallet.com/app/ 生产环境
http://192.168.10.236:8765/app/ 测试环境
diff --git a/assets/image/2x/icon_by_bike.webp b/assets/image/2x/icon_by_bike.webp
new file mode 100644
index 00000000..50ccc0ed
Binary files /dev/null and b/assets/image/2x/icon_by_bike.webp differ
diff --git a/assets/image/2x/icon_drive.webp b/assets/image/2x/icon_drive.webp
new file mode 100644
index 00000000..972be59d
Binary files /dev/null and b/assets/image/2x/icon_drive.webp differ
diff --git a/assets/image/2x/icon_search.webp b/assets/image/2x/icon_search.webp
new file mode 100644
index 00000000..7aa75c66
Binary files /dev/null and b/assets/image/2x/icon_search.webp differ
diff --git a/assets/image/2x/icon_transit.webp b/assets/image/2x/icon_transit.webp
new file mode 100644
index 00000000..523aa8b0
Binary files /dev/null and b/assets/image/2x/icon_transit.webp differ
diff --git a/assets/image/2x/icon_walk.webp b/assets/image/2x/icon_walk.webp
new file mode 100644
index 00000000..38e49db1
Binary files /dev/null and b/assets/image/2x/icon_walk.webp differ
diff --git a/assets/image/2x/position_sort.webp b/assets/image/2x/position_sort.webp
new file mode 100644
index 00000000..afb9000e
Binary files /dev/null and b/assets/image/2x/position_sort.webp differ
diff --git a/assets/image/3x/icon_by_bike.webp b/assets/image/3x/icon_by_bike.webp
new file mode 100644
index 00000000..de4e78ae
Binary files /dev/null and b/assets/image/3x/icon_by_bike.webp differ
diff --git a/assets/image/3x/icon_drive.webp b/assets/image/3x/icon_drive.webp
new file mode 100644
index 00000000..098241c2
Binary files /dev/null and b/assets/image/3x/icon_drive.webp differ
diff --git a/assets/image/3x/icon_search.webp b/assets/image/3x/icon_search.webp
new file mode 100644
index 00000000..d3f8316e
Binary files /dev/null and b/assets/image/3x/icon_search.webp differ
diff --git a/assets/image/3x/icon_transit.webp b/assets/image/3x/icon_transit.webp
new file mode 100644
index 00000000..11283036
Binary files /dev/null and b/assets/image/3x/icon_transit.webp differ
diff --git a/assets/image/3x/icon_walk.webp b/assets/image/3x/icon_walk.webp
new file mode 100644
index 00000000..98d95216
Binary files /dev/null and b/assets/image/3x/icon_walk.webp differ
diff --git a/assets/image/3x/position_sort.webp b/assets/image/3x/position_sort.webp
new file mode 100644
index 00000000..b51630af
Binary files /dev/null and b/assets/image/3x/position_sort.webp differ
diff --git a/assets/image/icon_by_bike.webp b/assets/image/icon_by_bike.webp
new file mode 100644
index 00000000..d7871091
Binary files /dev/null and b/assets/image/icon_by_bike.webp differ
diff --git a/assets/image/icon_drive.webp b/assets/image/icon_drive.webp
new file mode 100644
index 00000000..67dcf346
Binary files /dev/null and b/assets/image/icon_drive.webp differ
diff --git a/assets/image/icon_end.png b/assets/image/icon_end.png
new file mode 100644
index 00000000..2f288f4c
Binary files /dev/null and b/assets/image/icon_end.png differ
diff --git a/assets/image/icon_search.webp b/assets/image/icon_search.webp
new file mode 100644
index 00000000..d785e21d
Binary files /dev/null and b/assets/image/icon_search.webp differ
diff --git a/assets/image/icon_start.png b/assets/image/icon_start.png
new file mode 100644
index 00000000..ffc9a673
Binary files /dev/null and b/assets/image/icon_start.png differ
diff --git a/assets/image/icon_transit.webp b/assets/image/icon_transit.webp
new file mode 100644
index 00000000..844c3f1b
Binary files /dev/null and b/assets/image/icon_transit.webp differ
diff --git a/assets/image/icon_walk.webp b/assets/image/icon_walk.webp
new file mode 100644
index 00000000..1ec11af8
Binary files /dev/null and b/assets/image/icon_walk.webp differ
diff --git a/assets/image/position_sort.webp b/assets/image/position_sort.webp
new file mode 100644
index 00000000..c0b20055
Binary files /dev/null and b/assets/image/position_sort.webp differ
diff --git a/assets/image/traffic_texture_smooth.png b/assets/image/traffic_texture_smooth.png
new file mode 100644
index 00000000..e4252dc4
Binary files /dev/null and b/assets/image/traffic_texture_smooth.png differ
diff --git a/assets/image/traffic_texture_unknown.png b/assets/image/traffic_texture_unknown.png
new file mode 100644
index 00000000..2e84a9cd
Binary files /dev/null and b/assets/image/traffic_texture_unknown.png differ
diff --git a/assets/map_style/chinese_cities.json b/assets/map_style/chinese_cities.json
new file mode 100644
index 00000000..b2a647be
--- /dev/null
+++ b/assets/map_style/chinese_cities.json
@@ -0,0 +1,14 @@
+{
+ "热门城市": [
+ {"area": "武汉"},
+ {"area": "北京"},
+ { "area": "郑州" }
+ ],
+ "B": [
+ { "area": "北京" }
+ ],
+ "W": [{ "area": "武汉" }],
+ "Z": [
+ { "area": "郑州" }
+ ]
+}
\ No newline at end of file
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 9c6ea487..4e35d278 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -1,4 +1,5 @@
PODS:
+ - AEINFoundation (3.2.40)
- AFNetworking (4.0.1):
- AFNetworking/NSURLSession (= 4.0.1)
- AFNetworking/Reachability (= 4.0.1)
@@ -49,8 +50,7 @@ PODS:
- image_pickers (0.0.1):
- AFNetworking
- Flutter
- - SDWebImage
- - ZLPhotoBrowser (~> 4.3.9)
+ - ZLPhotoBrowser-objc (= 1.0.4)
- mob_sharesdk (4.4.15):
- mob_sharesdk/ShareSDK (= 4.4.15)
- MOBFoundation (>= 3.2.9)
@@ -240,9 +240,8 @@ PODS:
- Flutter
- webview_flutter (0.0.1):
- Flutter
- - ZLPhotoBrowser (4.3.9):
- - ZLPhotoBrowser/Core (= 4.3.9)
- - ZLPhotoBrowser/Core (4.3.9)
+ - ZLPhotoBrowser-objc (1.0.4):
+ - SDWebImage
DEPENDENCIES:
- emoji_picker_flutter (from `.symlinks/plugins/emoji_picker_flutter/ios`)
@@ -283,7 +282,7 @@ SPEC REPOS:
- TPNS-iOS
- UMCommon
- UMDevice
- - ZLPhotoBrowser
+ - ZLPhotoBrowser-objc
EXTERNAL SOURCES:
emoji_picker_flutter:
@@ -347,7 +346,7 @@ SPEC CHECKSUMS:
flutter_baidu_mapapi_utils: f6a5d23da26b0e58f1ae9908da7ba87fd48384b1
flutter_bmflocation: 1bd73181196567fe1529f765aa4f8e2615a8a3cf
fluwx: 838466d89c1ba099f6eec36c514801658371cda5
- image_pickers: 4406949954a5eb4fac5ada5f13810e6419ef4467
+ image_pickers: 25c8916d358bc9d2707cb470ba3d57497f105773
mob_sharesdk: 0698d60b3c1549a5b0bcfdec6f407439dd2960c0
MOBFoundation: 6df2684b4db4f0f5bd71b0623f82e11271bf7ac8
number_precision: 26fa2be2212f9d1429f92d667d6b0aa4df0058d8
@@ -370,7 +369,7 @@ SPEC CHECKSUMS:
video_player_avfoundation: 6d971a232d72e6ee25368378d48a079dea01f1cf
wakelock: d0fc7c864128eac40eba1617cb5264d9c940b46f
webview_flutter: 5fb4def2bbd4339889ee14d045b605cefc5bc232
- ZLPhotoBrowser: 02b3569b8f702d2e153e8fdb1f6b32fef3a2867c
+ ZLPhotoBrowser-objc: c7657d3bc85ae231884e058d0e3638f619164736
PODFILE CHECKSUM: f8bac8842dd5d4f36a3709c129ae7a2ccd5be619
diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj
index 58e111ea..c708ca8b 100644
--- a/ios/Runner.xcodeproj/project.pbxproj
+++ b/ios/Runner.xcodeproj/project.pbxproj
@@ -617,7 +617,7 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = YF3Q8DVP52;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -668,7 +668,7 @@
"$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu",
);
- MARKETING_VERSION = 3.2.19;
+ MARKETING_VERSION = 3.2.20;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
@@ -820,7 +820,7 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = YF3Q8DVP52;
ENABLE_BITCODE = NO;
ENABLE_TESTABILITY = YES;
@@ -872,7 +872,7 @@
"$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu",
);
- MARKETING_VERSION = 3.2.19;
+ MARKETING_VERSION = 3.2.20;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
@@ -915,7 +915,7 @@
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
- CURRENT_PROJECT_VERSION = 2;
+ CURRENT_PROJECT_VERSION = 14;
DEVELOPMENT_TEAM = YF3Q8DVP52;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
@@ -966,7 +966,7 @@
"$(PROJECT_DIR)/baidu",
"$(PROJECT_DIR)/Runner/baidu",
);
- MARKETING_VERSION = 3.2.19;
+ MARKETING_VERSION = 3.2.20;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
diff --git a/ios/Runner/Info.plist b/ios/Runner/Info.plist
index e12a98a1..173f6c23 100644
--- a/ios/Runner/Info.plist
+++ b/ios/Runner/Info.plist
@@ -177,5 +177,11 @@
location
+ LSApplicationQueriesSchemes
+
+ iosamap
+ qqmap
+ baidumap
+
diff --git a/lib/address/address_map_page.dart b/lib/address/address_map_page.dart
index f885d478..1324b146 100644
--- a/lib/address/address_map_page.dart
+++ b/lib/address/address_map_page.dart
@@ -80,6 +80,9 @@ class _AddressMapPage extends State {
BMFMapOptions(
center: latLng,
zoomLevel: 15,
+ showZoomControl: false,
+ showMapScaleBar: false,
+ rotateEnabled: false,
),
);
}
@@ -339,6 +342,9 @@ class _AddressMapPage extends State {
double.tryParse(value.getString("longitude")),
),
zoomLevel: 15,
+ showZoomControl: false,
+ showMapScaleBar: false,
+ rotateEnabled: false,
),
);
}
@@ -362,7 +368,10 @@ class _AddressMapPage extends State {
child: BMFMapWidget(
mapOptions: BMFMapOptions(
center: BMFCoordinate(30.553111, 114.342366),
- zoomLevel: 12,
+ zoomLevel: 15,
+ showZoomControl: false,
+ showMapScaleBar: false,
+ rotateEnabled: false,
),
onBMFMapCreated: onMapCreated,
// onCameraMoveEnd: (cameraPosition) {
diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart
index e4cacff3..3051a971 100644
--- a/lib/community/community_details.dart
+++ b/lib/community/community_details.dart
@@ -100,7 +100,7 @@ class _CommunityDetails extends State
void initState() {
super.initState();
// comunity = widget.arguments["comment"];
- EasyLoading.show(status: S.current.zhengzaijiazai);
+ EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
businessId = widget.arguments["businessId"];
WidgetsBinding.instance.addObserver(this);
commentFocus.addListener(_focusNodeListener);
@@ -399,7 +399,7 @@ class _CommunityDetails extends State
///评论列表
_queryMemberCommentList(bool isOnRefresh) async {
- if (!isOnRefresh) EasyLoading.show(status: S.current.zhengzaijiazai);
+ if (!isOnRefresh) EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
if (apiService == null)
apiService = ApiService(
diff --git a/lib/home/home_page.dart b/lib/home/home_page.dart
index 4f52ddb7..a90894af 100644
--- a/lib/home/home_page.dart
+++ b/lib/home/home_page.dart
@@ -8,7 +8,6 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/home/home_view/discount_zone.dart';
-import 'package:huixiang/home/home_view/home_banner.dart';
import 'package:huixiang/home/home_view/home_recommend_goods.dart';
import 'package:huixiang/home/home_view/top_selling_list.dart';
import 'package:huixiang/home/home_view/union_entry.dart';
@@ -27,7 +26,6 @@ import 'package:huixiang/retrofit/data/goods.dart';
import 'package:huixiang/retrofit/data/goods_category.dart';
import 'package:huixiang/retrofit/data/home_rank.dart';
import 'package:huixiang/retrofit/data/login_info.dart';
-import 'package:huixiang/retrofit/data/msg_stats.dart';
import 'package:huixiang/retrofit/data/page.dart';
import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/utils/event_type.dart';
@@ -44,6 +42,7 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import '../retrofit/data/user_info.dart';
import '../utils/flutter_utils.dart';
import '../view_widget/channel_dialog.dart';
+import '../view_widget/custom_image.dart';
import 'home_view/happy_help_farmers.dart';
import 'home_view/shortcut_operation.dart';
@@ -54,7 +53,8 @@ class HomePage extends StatefulWidget {
final List firstLoginCouponList;
HomePage(Key key, this.changeTab,
- {this.invite, this.interviewCouponList, this.firstLoginCouponList}): super(key: key);
+ {this.invite, this.interviewCouponList, this.firstLoginCouponList})
+ : super(key: key);
@override
State createState() {
@@ -64,6 +64,32 @@ class HomePage extends StatefulWidget {
class HomePageState extends State with AutomaticKeepAliveClientMixin {
ApiService apiService;
+ final RefreshController refreshController = RefreshController();
+ String categoryId;
+ bool showInvite = false;
+ bool showNew = false;
+
+ //排序类型枚举:1-自然排序,2-销量,3-价格
+ int orderType = 1;
+
+ //是否降序排列
+ bool orderDesc = true;
+ List goods = [];
+ List gooodsCategorys = [];
+ List bannerData = [];
+ List activityBannerData = [];
+ List brandData = [];
+ List articles = [];
+ Founder founder;
+ bool isSigned = false;
+ int totalMsg = 0;
+ List coupons = [];
+ int state = 1;
+ HomeRank homeRank;
+ UserInfo userInfo;
+ dynamic mRaiseMoney = 0; //众筹金余额
+ int _loadCount = 0;
+ DioErrorType dioErrorType;
@override
void initState() {
@@ -74,8 +100,11 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
setState(() {});
}
});
- queryActivity();
- _onRefresh();
+ _onRefresh(isFirstIn: true);
+ if (showInvite) {
+ inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]);
+ showInvite = false;
+ }
if ((widget.invite ?? "") != "" ||
widget.interviewCouponList != null &&
@@ -84,7 +113,6 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
//判断新人弹窗
// if (widget.firstLoginCouponList != null && widget.firstLoginCouponList.length > 0)
// showNew = true;
-
}
///邀请成功
@@ -99,18 +127,21 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
}
///活动海报弹窗
- posterShowAlertDialog(ActivityPos activityPos,firstLoginCouponList) {
+ posterShowAlertDialog(ActivityPos activityPos, firstLoginCouponList) {
var today = DateTime.now().day;
SharedPreferences.getInstance().then((value) {
- if(value.getInt("today")==today && (value.getString("ActivityPosCode") ?? "").contains("${activityPos.code}_${value.getString("userId")};"))
+ if (value.getInt("today") == today &&
+ (value.getString("ActivityPosCode") ?? "")
+ .contains("${activityPos.code}_${value.getString("userId")};"))
return;
- value.setString("ActivityPosCode", "${(value.getString("ActivityPosCode")??"")}${activityPos.code}_${value.getString("userId")};");
+ value.setString("ActivityPosCode",
+ "${(value.getString("ActivityPosCode") ?? "")}${activityPos.code}_${value.getString("userId")};");
value.setInt("today", today);
//显示对话框
showDialog(
context: context,
builder: (BuildContext context) {
- return ActivityPoster(activityPos,firstLoginCouponList);
+ return ActivityPoster(activityPos, firstLoginCouponList);
},
);
});
@@ -127,178 +158,133 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
);
}
- final SwiperController controller = SwiperController();
-
- String categoryId;
- int pageNum = 1;
- int couponPageNum = 1;
- bool showInvite = false;
- bool showNew = false;
-
- //排序类型枚举:1-自然排序,2-销量,3-价格
- int orderType = 1;
-
- //是否降序排列
- bool orderDesc = true;
- List goods = [];
- List gooodsCategorys = [];
-
- List bannerData = [];
- List brandData = [];
- List articles = [];
- List gooods = [];
- Founder founder;
- bool isSigned = false;
- int totalMsg = 0;
- List coupons = [];
- int state = 1;
- HomeRank homeRank;
- UserInfo userInfo;
- dynamic mRaiseMoney = 0;//众筹金余额
-
- queryHome() async {
- // EasyLoading.show(status: S.of(context).zhengzaijiazai);
-
- final SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(Dio(),
- context: context, token: value.getString('token'), showLoading: false);
-
- final BaseData brand =
- await apiService.queryHomeBrand().catchError((onError) {
- SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
- alignment: Alignment.center);
- refreshController.refreshFailed();
- });
- if (brand != null && brand.isSuccess) {
- brandData.clear();
- brandData.addAll((brand.data["brandList"] as List)
- .map((e) => Brand.fromJson(e))
- .toList());
- founder = Founder.fromJson(brand.data["founder"]);
+ ///头部banner
+ queryBanner() async {
+ try {
+ BaseData> baseData = await apiService.queryBanner({
+ "model": {"type": "HOME_PAGE"},
+ }).catchError((onError) {
+ dioErrorType = onError.type;
+ });
+ if (baseData != null && baseData.isSuccess) {
+ bannerData = baseData.data.records;
+ // if (bannerData.length > 0) swiperController.move(0, animation: false);
+ }
+ } finally {
+ addLoadCount();
}
+ }
- final BaseData> article = await apiService.queryArticle({
- "pageNum": 1,
- "pageSize": 3,
- "searchKey": "",
- "state": 1,
- "type": 2
- }).catchError((onError) {
- refreshController.refreshFailed();
- });
- articles.clear();
- if (article != null && article.isSuccess) {
- articles.addAll(article.data.list);
+ ///宣传banner
+ queryActivityBanner() async {
+ try {
+ BaseData> baseData = await apiService.queryBanner({
+ "model": {"type": "HOME_STORE_PAGE"},
+ }).catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
+ activityBannerData = baseData.data.records;
+ }
+ } finally {
+ addLoadCount();
}
+ }
- final BaseData rank = await apiService.recommendRank().catchError((onError) {});
- if (rank != null && rank.isSuccess) {
- homeRank = rank.data;
+ addLoadCount() {
+ _loadCount += 1;
+ if (_loadCount == 7) {
+ _loadCount = 0;
+ EasyLoading.dismiss();
+ if (dioErrorType == null)
+ refreshController.refreshCompleted();
+ else {
+ SmartDialog.showToast(AppUtils.dioErrorTypeToString(dioErrorType),
+ alignment: Alignment.center);
+ refreshController.refreshFailed();
+ }
+ if (mounted) setState(() {});
}
+ }
- final BaseData> goodsData = await apiService.creditGoods({
- "orderDesc": true,
- "orderType": 1,
- "pageNum": 1,
- "pageSize": 100,
- "state": 1
- }).catchError((onError) {
- refreshController.refreshFailed();
- });
- if (goodsData != null && goodsData.isSuccess) {
- gooods.clear();
- gooods.addAll(goodsData.data.list);
+ ///推荐排行
+ queryRecommendRank() async {
+ try {
+ BaseData rank =
+ await apiService.recommendRank().catchError((onError) {});
+ if (rank != null && rank.isSuccess) {
+ homeRank = rank.data;
+ }
+ } finally {
+ addLoadCount();
}
+ }
- BaseData> dataCategory =
- await apiService.goodsCategory({
- "current": 1,
- "map": {},
- "model": {"pageNum": 1, "pageSize": 20, "searchKey": ""},
- "order": "descending",
- "size": 20,
- "sort": "sortOrder"
- }).catchError((onError) {
- refreshController.loadFailed();
- refreshController.refreshFailed();
- });
-
- if (dataCategory != null &&
- dataCategory.isSuccess &&
- dataCategory.data != null &&
- dataCategory.data.records != null &&
- dataCategory.data.records.length > 0) {
- gooodsCategorys.clear();
- gooodsCategorys.add(GoodsCategory(name: S.of(context).quanbu));
- gooodsCategorys.addAll(dataCategory.data.records);
+ ///积分商城商品分類列表
+ queryGoodsCategory() async {
+ try {
+ BaseData> dataCategory =
+ await apiService.goodsCategory({
+ "current": 1,
+ "map": {},
+ "model": {"pageNum": 1, "pageSize": 20, "searchKey": ""},
+ "order": "descending",
+ "size": 20,
+ "sort": "sortOrder"
+ }).catchError((onError) {});
+ if (dataCategory != null &&
+ dataCategory.isSuccess &&
+ dataCategory.data != null &&
+ dataCategory.data.records != null &&
+ dataCategory.data.records.length > 0) {
+ gooodsCategorys.clear();
+ gooodsCategorys.add(GoodsCategory(name: S.of(context).quanbu));
+ gooodsCategorys.addAll(dataCategory.data.records);
+ }
+ } finally {
+ addLoadCount();
}
+ }
- var param = {
- "categoryId": categoryId ?? "",
- "orderDesc": orderDesc,
- "orderType": orderType,
- "pageNum": pageNum,
- "pageSize": 100,
- "state": 1
- };
- BaseData> pageGoods =
- await apiService.creditGoods(param).catchError((onError) {
- refreshController.loadFailed();
- refreshController.refreshFailed();
- });
- EasyLoading.dismiss();
- if (pageGoods != null && pageGoods.isSuccess) {
- if (pageNum == 1) {
- goods.clear();
+ ///积分商城商品列表
+ queryPointsProductList(bool isRefresh) async {
+ try {
+ if (!isRefresh)
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai,
+ maskType: EasyLoadingMaskType.black);
+ var param = {
+ "categoryId": categoryId ?? "",
+ "orderDesc": orderDesc,
+ "orderType": orderType,
+ "pageNum": 1,
+ "pageSize": 100,
+ "state": 1
+ };
+ BaseData> pageGoods =
+ await apiService.creditGoods(param).catchError((onError) {});
+ if (pageGoods != null && pageGoods.isSuccess) {
+ goods = pageGoods.data.list;
}
- goods.addAll(pageGoods.data.list);
- refreshController.refreshCompleted();
- refreshController.loadComplete();
- if (pageGoods.data.pageNum == pageGoods.data.pages) {
- refreshController.loadNoData();
- } else {
- pageNum += 1;
+ } finally {
+ if (isRefresh)
+ addLoadCount();
+ else {
+ EasyLoading.dismiss();
+ setState(() {});
}
- } else {
- refreshController.loadFailed();
- refreshController.refreshFailed();
}
-
- final BaseData> baseData =
- await apiService.queryBanner({
- "model": {"type": "HOME_PAGE"},
- }).catchError((onError) {
- refreshController.refreshFailed();
- });
- if (baseData != null && baseData.isSuccess) {
- bannerData.clear();
- bannerData.addAll(baseData.data.records);
- refreshController.refreshCompleted();
- if (bannerData.length > 0) controller.move(0, animation: false);
- } else {
- refreshController.refreshFailed();
- }
- EasyLoading.dismiss();
- if (showInvite) {
- inviteShowAlertDialog(widget.invite, widget.interviewCouponList[0]);
- showInvite = false;
- }
-
- //判断新人弹窗
- // if (showNew) {
- // newShowAlertDialog(widget.firstLoginCouponList);
- // showNew = false;
- // }
}
///查询会员信息
queryUserBalance() async {
- BaseData baseData =
- await apiService.queryInfo().catchError((onError) {});
- if (baseData != null && baseData.isSuccess) {
- userInfo = baseData.data;
- mRaiseMoney = double.tryParse(userInfo.raiseMoney);
- if (mounted) setState(() {});
+ try {
+ BaseData baseData =
+ await apiService.queryInfo().catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
+ userInfo = baseData.data;
+ mRaiseMoney = double.tryParse(userInfo.raiseMoney);
+ }
+ } finally {
+ addLoadCount();
}
}
@@ -326,35 +312,18 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
///活动弹窗
queryActivity() async {
- if (apiService == null) {
- SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(
- Dio(),
- context: context,
- token: value.getString("token"),
- showLoading: true
- );
- }
BaseData baseData =
- await apiService.appPopup().catchError((onError) {
- });
+ await apiService.appPopup().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
- if(baseData.data?.enabled ?? true)
- posterShowAlertDialog(baseData.data,widget.firstLoginCouponList);
+ if (baseData.data?.enabled ?? true)
+ posterShowAlertDialog(baseData.data, widget.firstLoginCouponList);
}
}
///核销用户优惠券
queryWiped(memberCouponId) async {
- if (apiService == null) {
- SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(
- Dio(),
- context: context,
- token: value.getString("token"),
- );
- }
- BaseData baseData = await apiService.wiped(memberCouponId).catchError((onError) {});
+ BaseData baseData =
+ await apiService.wiped(memberCouponId).catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
SmartDialog.showToast("核销成功", alignment: Alignment.center);
} else {
@@ -363,6 +332,25 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
}
queryCoupon() async {
+ try {
+ BaseData> baseData = await apiService.queryCoupon({
+ "centre": true,
+ "pageNum": 1,
+ "pageSize": 10,
+ "searchKey": "",
+ "state": 0
+ }).catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
+ coupons = baseData.data.list;
+ }
+ } finally {
+ addLoadCount();
+ }
+ }
+
+ _onRefresh({bool isFirstIn = false}) async {
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
@@ -371,39 +359,16 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
token: value.getString("token"),
);
}
- BaseData> baseData = await apiService.queryCoupon({
- "centre": true,
- "pageNum": couponPageNum,
- "pageSize": 10,
- "searchKey": "",
- "state": 0
- }).catchError((onError) {
- refreshController.refreshFailed();
- refreshController.loadFailed();
- });
- if (couponPageNum == 1) coupons.clear();
- if (baseData != null && baseData.isSuccess) {
- coupons.addAll(baseData.data.list);
- refreshController.refreshCompleted();
- refreshController.loadComplete();
- if (baseData.data.pageNum == baseData.data.pages) {
- refreshController.loadNoData();
- } else {
- couponPageNum += 1;
- }
- setState(() {});
- }
- else {
- refreshController.refreshFailed();
- refreshController.loadFailed();
- }
- }
-
- _onRefresh() async{
- await queryHome();
- await queryUserBalance();
+ dioErrorType = null;
+ if (isFirstIn) queryActivity();
+ queryBanner();
+ queryActivityBanner();
+ queryRecommendRank();
+ queryGoodsCategory();
+ queryPointsProductList(true);
+ queryUserBalance();
// queryMsgStats();
- await queryCoupon();
+ queryCoupon();
}
@override
@@ -412,8 +377,6 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
if (refreshController != null) refreshController.dispose();
}
- final RefreshController refreshController = RefreshController();
-
@override
Widget build(BuildContext context) {
super.build(context);
@@ -502,47 +465,43 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
enablePullUp: false,
header: MyHeader(),
physics: BouncingScrollPhysics(),
- onRefresh: () {
- setState(() {_onRefresh();
- });
- },
+ onRefresh: _onRefresh,
child: SingleChildScrollView(
- physics: NeverScrollableScrollPhysics(),
- child: FutureBuilder(
- future: queryHome(),
- builder: (context, snapshot) {
- return Column(
- children: [
- ///banner
- HomeBanner(bannerData, controller),
-
- ///吃喝玩
- UnionEntry((int jpIndex) {
- widget.changeTab(1,jpIndex);
- }),
-
- ///快捷操作
- ShortcutOperation((int jpIndex) {
- widget.changeTab(1,jpIndex);
- }),
-
- ///推广图
- spread(),
-
- // ///签到
- // SignView(isSigned, (value) {
- // setState(() {
- // isSigned = value;
- // });
- // }),
-
- ///特惠专区
- if(coupons != null && coupons.length != 0)
- DiscountZone(coupons),
-
- ///特惠专区-推荐商品展示
- if(homeRank != null && homeRank.commodityZone.length != 0)
- HomeRecommendGoods(homeRank),
+ physics: NeverScrollableScrollPhysics(),
+ child: Column(
+ children: [
+ ///banner
+ homeBanner(),
+
+ ///吃喝玩
+ UnionEntry((int jpIndex) {
+ widget.changeTab(1, jpIndex);
+ }),
+
+ ///快捷操作
+ ShortcutOperation((int jpIndex) {
+ widget.changeTab(1, jpIndex);
+ }),
+
+ ///推广图
+ if(activityBannerData.length > 0)
+ spread(),
+
+ // ///签到
+ // SignView(isSigned, (value) {
+ // setState(() {
+ // isSigned = value;
+ // });
+ // }),
+
+ ///特惠专区
+ if (coupons != null && coupons.length != 0)
+ DiscountZone(coupons),
+
+ ///特惠专区-推荐商品展示
+ if (homeRank != null &&
+ homeRank.commodityZone.length != 0)
+ HomeRecommendGoods(homeRank),
if((homeRank?.commodityZone?.length ??0) == 0)
SizedBox(height: 20.h,),
@@ -551,50 +510,49 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
// if(mRaiseMoney != 0)
HappyHelpFarmers(),
- ///福利中心
- WelfareCore(),
-
- ///吃喝玩商品热销榜
- if(homeRank != null && homeRank.commodityList.length != 0)
- TopSellingList(homeRank),
-
- // ///店铺推荐
- // QuickOrder(),
-
- // ///超级优惠券
- // CouponView(),
-
- // ///精选活动
- // FeaturedActivity(),
-
- // ///积分商城
- // HomeIntegralStore(gooods),
-
- ///积分商品头Tab
- PointsGoodsTitle(
- gooodsCategorys,
- (orderType, orderDesc) {
- this.orderType = orderType;
- this.orderDesc = orderDesc;
- setState(() {});
- },
- (index) {
- categoryId = gooodsCategorys[index].id;
- pageNum = 1;
- setState(() {});
- },
- ),
-
- ///积分商品列表
- PointGoods(
- goods,
- (index) {
- _toDetails(index);
- },
- ),
- ],
- );})
- ),
+ ///福利中心
+ WelfareCore(),
+
+ ///吃喝玩商品热销榜
+ if (homeRank != null &&
+ homeRank.commodityList.length != 0)
+ TopSellingList(homeRank),
+
+ // ///店铺推荐
+ // QuickOrder(),
+
+ // ///超级优惠券
+ // CouponView(),
+
+ // ///精选活动
+ // FeaturedActivity(),
+
+ // ///积分商城
+ // HomeIntegralStore(gooods),
+
+ ///积分商品头Tab
+ PointsGoodsTitle(
+ gooodsCategorys,
+ (orderType, orderDesc) {
+ this.orderType = orderType;
+ this.orderDesc = orderDesc;
+ queryPointsProductList(false);
+ },
+ (index) {
+ categoryId = gooodsCategorys[index].id;
+ queryPointsProductList(false);
+ },
+ ),
+
+ ///积分商品列表
+ PointGoods(
+ goods,
+ (index) {
+ _toDetails(index);
+ },
+ ),
+ ],
+ )),
),
),
),
@@ -605,57 +563,191 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
);
}
- Widget spread(){
+ Widget homeBanner() {
+ return Container(
+ child: AspectRatio(
+ aspectRatio: 1.25,
+ child: bannerData != null && bannerData.isNotEmpty
+ ? Swiper(
+ pagination: SwiperPagination(
+ margin: EdgeInsets.only(bottom: 12.h),
+ alignment: Alignment.bottomCenter,
+ builder: DotSwiperPaginationBuilder(
+ size: 8,
+ activeSize: 8,
+ space: 5,
+ activeColor: Colors.white,
+ color: Colors.white.withAlpha(76),
+ ),
+ ),
+ autoplay: true,
+ duration: 1000,
+ autoplayDelay: 2000,
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return InkWell(
+ onTap: () {
+ bannerClick(bannerData[position]);
+ },
+ child: Container(
+ child: MImage(
+ bannerData[position].imgUrl,
+ fit: BoxFit.cover,
+ errorSrc: "assets/image/default_2_1.webp",
+ fadeSrc: "assets/image/default_2_1.webp",
+ ),
+ ),
+ );
+ },
+ itemCount: bannerData.length,
+ )
+ : Image.asset(
+ "assets/image/default_2_1.webp",
+ fit: BoxFit.cover,
+ ),
+ ),
+ );
+ }
+
+ /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程,7:门店跳转)
+ bannerClick(BannerData bannerData) async {
+ switch (bannerData.contentType) {
+ case 1:
+ Navigator.of(context).pushNamed('/router/integral_store_page',
+ arguments: {"goodsId": bannerData.content});
+ break;
+ case 2:
+ Navigator.of(context).pushNamed('/router/web_page', arguments: {
+ "activityId": bannerData.content,
+ });
+ break;
+ case 3:
+ Navigator.of(context).pushNamed('/router/web_page', arguments: {
+ "articleId": bannerData.content,
+ });
+ break;
+ case 4:
+ String router = bannerData.content;
+ // String router = "/router/store_order?{\"id\":\"1512378184161558528\",\"tenant\":\"1188\",\"storeName\":\"农场煮意\"}";
+ if (router.contains("?")) {
+ String params = router.substring(router.indexOf("?") + 1);
+ Map map = jsonDecode(params);
+ Navigator.of(context).pushNamed(
+ router.substring(0, router.indexOf("?")),
+ arguments: map);
+ } else {
+ Navigator.of(context).pushNamed(router);
+ }
+ break;
+ case 5:
+ Navigator.of(context).pushNamed('/router/class_details', arguments: {
+ "id": bannerData.content,
+ });
+ break;
+ case 7:
+ String params =
+ bannerData.content.substring(bannerData.content.indexOf("?") + 1);
+ Map map = jsonDecode(params);
+ Navigator.of(context).pushNamed(
+ bannerData.content.substring(0, bannerData.content.indexOf("?")),
+ arguments: map);
+ break;
+ }
+ }
+
+ Widget spread() {
return Container(
width: double.infinity,
+ // margin: EdgeInsets.symmetric(horizontal:14.w),
height: 85.h,
- child: Swiper(
- pagination: SwiperPagination(
- alignment: Alignment.bottomCenter,
- margin: EdgeInsets.only(top: 5.h),
- builder: DotSwiperPaginationBuilder(
- size: 8.w,
- activeSize: 8.w,
- space: 5.w,
- activeColor: Colors.white,
- color: Colors.white.withAlpha(76),
- ),
- ),
- autoplay:true,
- duration: 1000,
- autoplayDelay: 2000,
- itemBuilder: (context, position) {
- return GestureDetector(
- onTap: (){
- if(position == 0){
- Navigator.of(context).pushNamed('/router/invite_friends');
- }else if(position == 1){
- Navigator.of(context).pushNamed('/router/trading_card_page');
- }
- },
- child:Container(
- margin: EdgeInsets.symmetric(horizontal:14.w),
- child: ClipRRect(
- child:Image.asset(
- spreadItem[position],
- width:double.infinity,
- fit: BoxFit.fill,
- height:double.infinity,
+ child: activityBannerData != null && activityBannerData.isNotEmpty
+ ? Swiper(
+ pagination: SwiperPagination(
+ alignment: Alignment.bottomCenter,
+ margin: EdgeInsets.only(top: 5.h),
+ builder: DotSwiperPaginationBuilder(
+ size: 8.w,
+ activeSize: 8.w,
+ space: 5.w,
+ activeColor: Colors.white,
+ color: Colors.white.withAlpha(76),
),
- borderRadius: BorderRadius.circular(6.w),
),
+ autoplay: true,
+ duration: 1000,
+ autoplayDelay: 2000,
+ itemBuilder: (context, position) {
+ return InkWell(
+ onTap: () {
+ spreadBannerClick(activityBannerData[position]);
+ },
+ child: Container(
+ margin: EdgeInsets.symmetric(horizontal: 14.w),
+ child: MImage(
+ activityBannerData[position].imgUrl,
+ fit: BoxFit.cover,
+ radius: BorderRadius.circular(6),
+ errorSrc: "assets/image/default_2_1.webp",
+ fadeSrc: "assets/image/default_2_1.webp",
+ ),
+ ),
+ );
+ },
+ itemCount: activityBannerData.length,
+ )
+ : Image.asset(
+ "assets/image/default_2_1.webp",
+ fit: BoxFit.cover,
),
- );
- },
- itemCount:2,
- ),
);
}
- final List spreadItem = [
- "assets/image/welfare_spread.webp",
- "assets/image/welfare_yz.webp",
- ];
+ /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程,7:门店跳转)
+ spreadBannerClick(BannerData activityBannerData) async {
+ switch (activityBannerData.contentType) {
+ case 1:
+ Navigator.of(context).pushNamed('/router/integral_store_page',
+ arguments: {"goodsId": activityBannerData.content});
+ break;
+ case 2:
+ Navigator.of(context).pushNamed('/router/web_page', arguments: {
+ "activityId": activityBannerData.content,
+ });
+ break;
+ case 3:
+ Navigator.of(context).pushNamed('/router/web_page', arguments: {
+ "articleId": activityBannerData.content,
+ });
+ break;
+ case 4:
+ String router = activityBannerData.content;
+ // String router = "/router/store_order?{\"id\":\"1512378184161558528\",\"tenant\":\"1188\",\"storeName\":\"农场煮意\"}";
+ if (router.contains("?")) {
+ String params = router.substring(router.indexOf("?") + 1);
+ Map map = jsonDecode(params);
+ Navigator.of(context).pushNamed(
+ router.substring(0, router.indexOf("?")),
+ arguments: map);
+ } else {
+ Navigator.of(context).pushNamed(router);
+ }
+ break;
+ case 5:
+ Navigator.of(context).pushNamed('/router/class_details', arguments: {
+ "id": activityBannerData.content,
+ });
+ break;
+ case 7:
+ String params = activityBannerData.content
+ .substring(activityBannerData.content.indexOf("?") + 1);
+ Map map = jsonDecode(params);
+ Navigator.of(context).pushNamed(
+ activityBannerData.content
+ .substring(0, activityBannerData.content.indexOf("?")),
+ arguments: map);
+ break;
+ }
+ }
///扫码
toScan() async {
@@ -681,20 +773,24 @@ class HomePageState extends State with AutomaticKeepAliveClientMixin {
// 新版桌子码跳转
// http://miniscan.lotus-wallet.com/placeorder?tenant_code=1194&table_id=1669609340031467520&store_id=1637659387134738432
var result = await Navigator.of(context).pushNamed('/router/qr_scan');
- if(result.toString().contains("type\":\"coupon")){
+ if (result.toString().contains("type\":\"coupon")) {
///活动优惠券赠送弹窗
activityShowAlertDialog(result.toString());
return;
- }if(result.toString().contains("type\":\"wiped")){
+ }
+ if (result.toString().contains("type\":\"wiped")) {
///核销券
queryWiped(jsonDecode(result.toString())["memberCouponId"]);
return;
}
// String result = await scanner.scan();
Uri uri = Uri.parse(result);
- String tableId = uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"];
- String tenantCode = uri.queryParameters["tenantCode"] ?? uri.queryParameters["tenant_code"];
- String shopId = uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"];
+ String tableId =
+ uri.queryParameters["tableId"] ?? uri.queryParameters["table_id"];
+ String tenantCode = uri.queryParameters["tenantCode"] ??
+ uri.queryParameters["tenant_code"];
+ String shopId =
+ uri.queryParameters["shopId"] ?? uri.queryParameters["store_id"];
if (tableId != null &&
tableId != "" &&
tenantCode != null &&
diff --git a/lib/home/huixiang_brand_page.dart b/lib/home/huixiang_brand_page.dart
index 22ec8ead..af0a5425 100644
--- a/lib/home/huixiang_brand_page.dart
+++ b/lib/home/huixiang_brand_page.dart
@@ -44,7 +44,7 @@ class _BrandPage extends State
Founder founder;
queryHome() async {
- EasyLoading.show(status: S.current.zhengzaijiazai);
+ EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
final SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
diff --git a/lib/home/points_mall_page.dart b/lib/home/points_mall_page.dart
index e3c86fba..4e0d55fe 100644
--- a/lib/home/points_mall_page.dart
+++ b/lib/home/points_mall_page.dart
@@ -95,7 +95,7 @@ class _PointsMallPage extends State
}
creditGoods() async {
- EasyLoading.show(status: S.current.zhengzaijiazai);
+ EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
final SharedPreferences value = await SharedPreferences.getInstance();
client = ApiService(Dio(),
diff --git a/lib/home/welfare_exchange.dart b/lib/home/welfare_exchange.dart
index 4fa8ecaa..b4ec8b8e 100644
--- a/lib/home/welfare_exchange.dart
+++ b/lib/home/welfare_exchange.dart
@@ -62,7 +62,7 @@ class _WelfareExchange extends State
}
queryUser() async {
- EasyLoading.show(status: S.current.zhengzaijiazai);
+ EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
BaseData baseData =
await apiService.queryInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
diff --git a/lib/home/welfare_page.dart b/lib/home/welfare_page.dart
index 902a9511..a6cb8fdf 100644
--- a/lib/home/welfare_page.dart
+++ b/lib/home/welfare_page.dart
@@ -39,69 +39,48 @@ class _WelfarePage extends State {
List goods = [];
Goods goodsPrice;
List coupons = [];
- List> coupon=[];
+ List> coupon = [];
String categoryId;
bool orderDesc = true;
int orderType = 1;
int type = 1;
int couponIndex = 0;
int swiperIndex = 0;
+ int _loadCount = 0;
@override
void initState() {
super.initState();
- SharedPreferences.getInstance().then((value) => {
- apiService = ApiService(Dio(), context: context, token: value.getString("token")),
- _onRefresh(),
-
- });
+ _onRefresh();
}
queryGoods() async {
- if (apiService == null) {
- SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(
- Dio(),
- context: context,
- token: value.getString("token"),
- );
- }
- var param = {
- "categoryId": categoryId ?? "",
- "orderDesc": orderDesc,
- "orderType": orderType,
- "pageNum": 1,
- "pageSize": 100,
- "state": 1
- };
- BaseData> pageGoods =
- await apiService.creditGoods(param).catchError((onError) {
- refreshController.loadFailed();
- refreshController.refreshFailed();
- });
- EasyLoading.dismiss();
- if (pageGoods != null && pageGoods.isSuccess) {
- setState(() {
+ try {
+ var param = {
+ "categoryId": categoryId ?? "",
+ "orderDesc": orderDesc,
+ "orderType": orderType,
+ "pageNum": 1,
+ "pageSize": 100,
+ "state": 1
+ };
+ BaseData> pageGoods =
+ await apiService.creditGoods(param).catchError((onError) {
+ refreshController.loadFailed();
+ refreshController.refreshFailed();
+ });
+ EasyLoading.dismiss();
+ if (pageGoods != null && pageGoods.isSuccess) {
goods.clear();
goods.addAll(pageGoods.data.list);
- });
- refreshController.refreshCompleted();
- refreshController.loadComplete();
- } else {
- refreshController.loadFailed();
- refreshController.refreshFailed();
+ }
+ } finally {
+ addLoadCount();
}
}
queryCoupon() async {
- if (apiService == null) {
- SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(
- Dio(),
- context: context,
- token: value.getString("token"),
- );
- }
+ try{
BaseData> baseData = await apiService.queryCoupon({
"centre": true,
"pageNum": 1,
@@ -110,36 +89,48 @@ class _WelfarePage extends State {
"state": 0
}).catchError((onError) {
SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
- alignment: Alignment.center);
- refreshController.refreshFailed();
- refreshController.loadFailed();
+ alignment: Alignment.center);
});
coupons.clear();
coupon.clear();
if (baseData != null && baseData.isSuccess) {
coupons.addAll(baseData.data.list);
- for(var i = 0;i < coupons.length~/3+1;i++){
+ for (var i = 0; i < coupons.length ~/ 3 + 1; i++) {
List con = [];
- con = coupons.skip(i*3).take((i*3 0 && coupon[coupon.length - 1].isEmpty)
- coupon.removeAt(coupon.length-1);
- refreshController.refreshCompleted();
- refreshController.loadComplete();
+ if (coupon.length > 0 && coupon[coupon.length - 1].isEmpty)
+ coupon.removeAt(coupon.length - 1);
setState(() {});
- } else {
- refreshController.refreshFailed();
- refreshController.loadFailed();
+ }}finally{
+ addLoadCount();
}
}
-
- _onRefresh(){
+ _onRefresh() async{
+ EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
+ if (apiService == null) {
+ SharedPreferences value = await SharedPreferences.getInstance();
+ apiService =
+ ApiService(Dio(), context: context, token: value.getString("token"));
+ }
queryGoods();
queryCoupon();
}
+ addLoadCount() {
+ _loadCount += 1;
+ if (_loadCount == 2) {
+ _loadCount = 0;
+ EasyLoading.dismiss();
+ if (refreshController.isRefresh) refreshController.refreshCompleted();
+ if (mounted) setState(() {});
+ }
+ }
@override
Widget build(BuildContext context) {
@@ -157,7 +148,10 @@ class _WelfarePage extends State {
width: double.infinity,
height: 236.h,
),
- Expanded(child: Container(color: Colors.white,))
+ Expanded(
+ child: Container(
+ color: Colors.white,
+ ))
],
),
Scaffold(
@@ -170,7 +164,7 @@ class _WelfarePage extends State {
titleSize: 18.sp,
brightness: Brightness.dark,
),
- body:SmartRefresher(
+ body: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
@@ -180,18 +174,15 @@ class _WelfarePage extends State {
return MyFooter(mode);
},
),
- onRefresh:(){
- setState(() {
- _onRefresh();
- });
- },
+ onRefresh:_onRefresh,
physics: BouncingScrollPhysics(),
scrollController: ScrollController(),
child: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
- topRight: Radius.circular(6),),
+ topRight: Radius.circular(6),
+ ),
color: Colors.white,
boxShadow: [
BoxShadow(
@@ -213,12 +204,10 @@ class _WelfarePage extends State {
Container(
color: Colors.white,
- padding: EdgeInsets.only(left: 14,right: 14),
- child:Column(
+ padding: EdgeInsets.only(left: 14, right: 14),
+ child: Column(
children: [
-
inviteFriends(),
-
benefitExchange(),
],
),
@@ -242,7 +231,8 @@ class _WelfarePage extends State {
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(6),
- topRight: Radius.circular(6),),
+ topRight: Radius.circular(6),
+ ),
color: Colors.white,
boxShadow: [
BoxShadow(
@@ -253,14 +243,13 @@ class _WelfarePage extends State {
),
],
),
- child: Column(
+ child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
- padding: EdgeInsets.symmetric(horizontal: 17.w,vertical: 16.h),
- child:
- Row(
+ padding: EdgeInsets.symmetric(horizontal: 17.w, vertical: 16.h),
+ child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
@@ -282,81 +271,82 @@ class _WelfarePage extends State {
),
],
)),
- coupon.length == 0?
- NoDataView(
+ coupon.length == 0
+ ? NoDataView(
+ src: "assets/image/ka.webp",
+ isShowBtn: false,
+ text: S.of(context).haimeiyouyouhuiquankeyilingqu,
+ fontSize: 16.sp,
+ )
+ : AspectRatio(
+ aspectRatio: 1.10,
+ child: Swiper(
+ onIndexChanged: (it) {
+ swiperIndex = it;
+ },
+ index: couponIndex,
+ viewportFraction: 0.9,
+ scale: 0.7,
+ key: UniqueKey(),
+ pagination: SwiperPagination(
+ alignment: Alignment.bottomCenter,
+ builder: DotSwiperPaginationBuilder(
+ size: 8,
+ activeSize: 8,
+ space: 5,
+ activeColor: Colors.black,
+ color: Colors.black.withAlpha(76),
+ ),
+ ),
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return Column(
+ children: [
+ Container(
+ child: weekList(coupon[position]),
+ ),
+ ],
+ );
+ },
+ itemCount: coupon.length ?? 0,
+ ),
+ )
+ ],
+ ));
+ }
+
+ Widget weekList(List cops) {
+ return Expanded(
+ child: (cops == null && cops.length == 0)
+ ? NoDataView(
src: "assets/image/ka.webp",
isShowBtn: false,
text: S.of(context).haimeiyouyouhuiquankeyilingqu,
fontSize: 16.sp,
- ): AspectRatio(
- aspectRatio: 1.10,
- child: Swiper(
- onIndexChanged: (it){
- swiperIndex = it;
- },
- index: couponIndex,
- viewportFraction: 0.9,
- scale: 0.7,
- key: UniqueKey(),
- pagination: SwiperPagination(
- alignment: Alignment.bottomCenter,
- builder: DotSwiperPaginationBuilder(
- size: 8,
- activeSize: 8,
- space: 5,
- activeColor: Colors.black,
- color: Colors.black.withAlpha(76),
- ),
- ),
- physics: BouncingScrollPhysics(),
- itemBuilder: (context, position) {
- return Column(
- children: [
- Container(
- child: weekList(coupon[position]),
- ),
- ],
- );
- },
- itemCount:coupon.length ?? 0,
- ),
)
- ],
- )
+ : ListView.builder(
+ padding: EdgeInsets.zero,
+ itemCount: cops.length,
+ scrollDirection: Axis.vertical,
+ shrinkWrap: true,
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return GestureDetector(
+ onTap: () {},
+ child: weekCoupon(cops[position]),
+ );
+ },
+ ),
);
}
- Widget weekList(List cops){
- return Expanded(
- child:(cops == null && cops.length == 0)?
- NoDataView(
- src: "assets/image/ka.webp",
- isShowBtn: false,
- text: S.of(context).haimeiyouyouhuiquankeyilingqu,
- fontSize: 16.sp,
- ):ListView.builder(
- padding: EdgeInsets.zero,
- itemCount: cops.length,
- scrollDirection: Axis.vertical,
- shrinkWrap: true,
- physics: BouncingScrollPhysics(),
- itemBuilder: (context, position) {
- return GestureDetector(
- onTap: () {
- },
- child: weekCoupon(cops[position]),
- );
- },
- ),);
- }
-
///优惠券列表
Widget weekCoupon(Coupon cop) {
return Container(
height: 95.h,
width: double.infinity,
- margin: EdgeInsets.only(bottom:10),
- padding:EdgeInsets.symmetric(horizontal: 12),
+ margin: EdgeInsets.only(bottom: 10),
+ padding: EdgeInsets.symmetric(horizontal: 12),
decoration: BoxDecoration(
image: DecorationImage(
fit: BoxFit.fill,
@@ -367,8 +357,9 @@ class _WelfarePage extends State {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Expanded(child: Container(
- margin: EdgeInsets.only(top: 12,bottom: 12),
+ Expanded(
+ child: Container(
+ margin: EdgeInsets.only(top: 12, bottom: 12),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -383,31 +374,37 @@ class _WelfarePage extends State {
color: Color(0xFF0D0D0D),
),
),
- SizedBox(height: 12,),
- (cop.status == 0)?
- Text(
- "发放时间: ${cop?.publishStartTime ?? ""}",
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.regular,
- color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
- ),
- ):Text(
- "有效期至 ${cop?.useEndTime ?? ""}",
- maxLines:1,
- overflow: TextOverflow.ellipsis,
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.regular,
- color: cop.status == 3 ? Color(0xFFB3B3B3) :Color(0xFF4D4D4D),
- ),
- )
+ SizedBox(
+ height: 12,
+ ),
+ (cop.status == 0)
+ ? Text(
+ "发放时间: ${cop?.publishStartTime ?? ""}",
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: cop.status == 3
+ ? Color(0xFFB3B3B3)
+ : Color(0xFF4D4D4D),
+ ),
+ )
+ : Text(
+ "有效期至 ${cop?.useEndTime ?? ""}",
+ maxLines: 1,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: cop.status == 3
+ ? Color(0xFFB3B3B3)
+ : Color(0xFF4D4D4D),
+ ),
+ )
],
),
)),
-
Column(
// mainAxisAlignment: MainAxisAlignment.start,
// crossAxisAlignment: CrossAxisAlignment.end,
@@ -441,7 +438,8 @@ class _WelfarePage extends State {
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
SizedBox(
@@ -450,26 +448,25 @@ class _WelfarePage extends State {
Text(
coupon != null
? double.tryParse("${cop.discountAmount}" ?? "0")
- .toInt()
- .toString()
+ .toInt()
+ .toString()
: "",
style: TextStyle(
fontSize: 24.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
),
Text(
- S.of(context).manyuankeyong(coupon != null
- ? ("${cop.fullAmount}" ?? "0")
- .toString()
- : ""),
+ S.of(context).manyuankeyong(
+ coupon != null ? ("${cop.fullAmount}" ?? "0").toString() : ""),
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -489,7 +486,8 @@ class _WelfarePage extends State {
style: TextStyle(
fontSize: 22.sp,
fontWeight: MyFontWeight.semi_bold,
- color:cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -500,7 +498,7 @@ class _WelfarePage extends State {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -511,7 +509,7 @@ class _WelfarePage extends State {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
- padding: EdgeInsets.only(bottom:10,top: 7),
+ padding: EdgeInsets.only(bottom: 10, top: 7),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@@ -520,7 +518,8 @@ class _WelfarePage extends State {
style: TextStyle(
fontSize: 26.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -531,7 +530,7 @@ class _WelfarePage extends State {
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color: cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -547,31 +546,35 @@ class _WelfarePage extends State {
textBaseline: TextBaseline.alphabetic,
children: [
Text(
- cop.limitAmount != "0.00"?"¥":"",
+ cop.limitAmount != "0.00" ? "¥" : "",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.medium,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
SizedBox(
height: 4.h,
),
Text(
- cop.limitAmount != "0.00"?(coupon != null
- ? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}"
- : "") :"",
+ cop.limitAmount != "0.00"
+ ? (coupon != null
+ ? "${AppUtils.calculateDouble(double.tryParse(cop.limitAmount) ?? 0)}"
+ : "")
+ : "",
style: TextStyle(
fontSize: 24.sp,
fontWeight: FontWeight.bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
),
],
);
- }else{
+ } else {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
@@ -582,25 +585,29 @@ class _WelfarePage extends State {
textBaseline: TextBaseline.alphabetic,
children: [
Text(
- cop.discountPercent != 0 ? (coupon != null
- ? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.discountPercent / 10.0}" ??
- "0"
- : ""):"",
+ cop.discountPercent != 0
+ ? (coupon != null
+ ? "${(cop.discountPercent / 10.0 >= 10) ? 10 : cop.discountPercent / 10.0}" ??
+ "0"
+ : "")
+ : "",
style: TextStyle(
fontSize: 30.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
SizedBox(
height: 4.h,
),
Text(
- cop.discountPercent != 0 ? "折" :"",
+ cop.discountPercent != 0 ? "折" : "",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
- color: cop.status == 3 ? Color(0xFFB3B3B3):Color(0xff32A060),
+ color:
+ cop.status == 3 ? Color(0xFFB3B3B3) : Color(0xff32A060),
),
),
],
@@ -612,67 +619,66 @@ class _WelfarePage extends State {
///优惠券领取状态
Widget weekBtn(Coupon cop) {
- if(cop.status == 0)
- return Align(
- alignment: Alignment.centerRight,
- child: InkWell(
- onTap: () {
- receiveCoupon(cop.id);
- },
- child: Container(
- padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 2.h),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(3),
- color: Color(0xFF32A060),
- ),
- child: Text(
- S.of(context).lingqu,
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.medium,
- color: Colors.white,
- ),
- ),
- ),
+ if (cop.status == 0)
+ return Align(
+ alignment: Alignment.centerRight,
+ child: InkWell(
+ onTap: () {
+ receiveCoupon(cop.id);
+ },
+ child: Container(
+ padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 2.h),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(3),
+ color: Color(0xFF32A060),
+ ),
+ child: Text(
+ S.of(context).lingqu,
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.medium,
+ color: Colors.white,
),
- );
- if(cop.status == 1 || cop.status == 2)
+ ),
+ ),
+ ),
+ );
+ if (cop.status == 1 || cop.status == 2)
return Align(
- alignment: Alignment.centerRight,
- child: InkWell(
- onTap: () {
- if (cop.bizType == 5 || cop.bizType == 3) {
- Navigator.of(context).pushNamed(
- '/router/write_off_page',
- arguments: {
- "couponId": cop.id,
- "coupon": jsonEncode(cop.toJson()),
- });
- } else {
- showStoreSelector(cop.storeList);
- }
- },
- child: Container(
- // height: 19.h,
- padding: EdgeInsets.symmetric(horizontal:8.w,vertical: 1.h),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(3),
- border: Border.all(
- width: 1, color: Color(0xFF32A060), style: BorderStyle.solid),
- color: Colors.transparent,
- ),
- alignment: Alignment.center,
- child:Text(
- S.of(context).qushiyong,
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.regular,
- color: Color(0xFF32A060),
- ),
- ),
- ),
+ alignment: Alignment.centerRight,
+ child: InkWell(
+ onTap: () {
+ if (cop.bizType == 5 || cop.bizType == 3) {
+ Navigator.of(context)
+ .pushNamed('/router/write_off_page', arguments: {
+ "couponId": cop.id,
+ "coupon": jsonEncode(cop.toJson()),
+ });
+ } else {
+ showStoreSelector(cop.storeList);
+ }
+ },
+ child: Container(
+ // height: 19.h,
+ padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 1.h),
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(3),
+ border: Border.all(
+ width: 1, color: Color(0xFF32A060), style: BorderStyle.solid),
+ color: Colors.transparent,
+ ),
+ alignment: Alignment.center,
+ child: Text(
+ S.of(context).qushiyong,
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Color(0xFF32A060),
),
- );
+ ),
+ ),
+ ),
+ );
}
///领取优惠券
@@ -682,8 +688,8 @@ class _WelfarePage extends State {
if (baseData != null && baseData.isSuccess) {
queryCoupon();
showAlertDialog();
- }else{
- SmartDialog.showToast(baseData?.msg,alignment: Alignment.center);
+ } else {
+ SmartDialog.showToast(baseData?.msg, alignment: Alignment.center);
}
}
@@ -710,8 +716,8 @@ class _WelfarePage extends State {
///邀请好友
Widget inviteFriends() {
return Container(
- margin: EdgeInsets.only(top:24.h,bottom:20.h),
- child:Column(
+ margin: EdgeInsets.only(top: 24.h, bottom: 20.h),
+ child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -723,17 +729,19 @@ class _WelfarePage extends State {
color: Color(0xFF0D0D0D),
),
),
- SizedBox(height: 12,),
+ SizedBox(
+ height: 12,
+ ),
GestureDetector(
- onTap: (){
+ onTap: () {
Navigator.of(context).pushNamed('/router/invite_friends');
},
- child:ClipRRect(
- child:Image.asset(
+ child: ClipRRect(
+ child: Image.asset(
"assets/image/welfare_spread.webp",
- width:double.infinity,
+ width: double.infinity,
fit: BoxFit.fill,
- height:80.h,
+ height: 80.h,
),
borderRadius: BorderRadius.circular(6.w),
),
@@ -747,28 +755,29 @@ class _WelfarePage extends State {
Widget benefitExchange() {
return Container(
width: double.infinity,
- margin: EdgeInsets.only(top:24.h,bottom:20.h),
- child:Column(
+ margin: EdgeInsets.only(top: 24.h, bottom: 20.h),
+ child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
- onTap: (){
+ onTap: () {
Navigator.of(context).pushNamed('/router/welfare_exchange');
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
- Expanded(child:
- Text(
- S.of(context).fuliduihuan,
- style: TextStyle(
- fontSize: 15.sp,
- fontWeight: MyFontWeight.bold,
- color: Color(0xFF0D0D0D),
+ Expanded(
+ child: Text(
+ S.of(context).fuliduihuan,
+ style: TextStyle(
+ fontSize: 15.sp,
+ fontWeight: MyFontWeight.bold,
+ color: Color(0xFF0D0D0D),
+ ),
),
- ),),
+ ),
Text(
S.of(context).gengduo,
style: TextStyle(
@@ -785,47 +794,50 @@ class _WelfarePage extends State {
],
),
),
- SizedBox(height: 12,),
- (goods == null || goods.length == 0)? NoDataView(
- src: "assets/image/xiao_fei.webp",
- isShowBtn: false,
- text: "暂无商品可兑换",
- fontSize: 16.sp,
- margin: EdgeInsets.all(60.h),
- )
- :GridView.builder(
- itemCount:goods.length>6?6:goods.length,
- padding: EdgeInsets.only(
- // left: 16.w,
- // right: 16.w,
- top: 18.h,
- bottom: 16.h,
- ),
- shrinkWrap: true,
- physics: BouncingScrollPhysics(),
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- //一行的Widget数量
- crossAxisCount: 2,
- //水平子Widget之间间距
- crossAxisSpacing: 11.w,
- //垂直子Widget之间间距
- mainAxisSpacing: 16.w,
- //子Widget宽高比例 0.59
- childAspectRatio:
- 200 / (285 / 2 + (285 / 2) * AppUtils.textScale(context)),
- ),
- itemBuilder: (context, index) {
- return GestureDetector(
- onTap: () {
- Navigator.of(context).pushNamed(
- '/router/integral_store_page',
- arguments: {"goodsId": goods[index].id},
- );
- },
- child: exchangeItem(goods[index]),
- );
- },
- )
+ SizedBox(
+ height: 12,
+ ),
+ (goods == null || goods.length == 0)
+ ? NoDataView(
+ src: "assets/image/xiao_fei.webp",
+ isShowBtn: false,
+ text: "暂无商品可兑换",
+ fontSize: 16.sp,
+ margin: EdgeInsets.all(60.h),
+ )
+ : GridView.builder(
+ itemCount: goods.length > 6 ? 6 : goods.length,
+ padding: EdgeInsets.only(
+ // left: 16.w,
+ // right: 16.w,
+ top: 18.h,
+ bottom: 16.h,
+ ),
+ shrinkWrap: true,
+ physics: BouncingScrollPhysics(),
+ gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
+ //一行的Widget数量
+ crossAxisCount: 2,
+ //水平子Widget之间间距
+ crossAxisSpacing: 11.w,
+ //垂直子Widget之间间距
+ mainAxisSpacing: 16.w,
+ //子Widget宽高比例 0.59
+ childAspectRatio: 200 /
+ (285 / 2 + (285 / 2) * AppUtils.textScale(context)),
+ ),
+ itemBuilder: (context, index) {
+ return GestureDetector(
+ onTap: () {
+ Navigator.of(context).pushNamed(
+ '/router/integral_store_page',
+ arguments: {"goodsId": goods[index].id},
+ );
+ },
+ child: exchangeItem(goods[index]),
+ );
+ },
+ )
],
),
);
@@ -871,10 +883,8 @@ class _WelfarePage extends State {
margin: EdgeInsets.only(
right: 12.w,
top: 10.h,
- ),padding: EdgeInsets.only(
- bottom: 8,
- left: 8
- ),
+ ),
+ padding: EdgeInsets.only(bottom: 8, left: 8),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
crossAxisAlignment: CrossAxisAlignment.start,
@@ -894,12 +904,12 @@ class _WelfarePage extends State {
Text(
pointPrice(goods),
style: TextStyle(
- color: Color(0xFFE5600D),
- fontSize: 16.sp,
+ color: Color(0xFFE5600D),
+ fontSize: 16.sp,
fontFamily: 'JDZhengHT',
- fontWeight: MyFontWeight.semi_bold,
- ),
- ),
+ fontWeight: MyFontWeight.semi_bold,
+ ),
+ ),
],
),
),
@@ -912,16 +922,22 @@ class _WelfarePage extends State {
);
}
- String pointPrice(Goods goodsPrice){
- if(goodsPrice == null)
- return "";
- if(goodsPrice?.oneBean!=null && goodsPrice?.oneBean!="0"){
+ String pointPrice(Goods goodsPrice) {
+ if (goodsPrice == null) return "";
+ if (goodsPrice?.oneBean != null && goodsPrice?.oneBean != "0") {
return "${goodsPrice?.oneBean}印章";
- } else if(goodsPrice?.onePrice!=null && goodsPrice?.onePrice!="0"){
+ } else if (goodsPrice?.onePrice != null && goodsPrice?.onePrice != "0") {
return S.of(context).jifen_(goodsPrice?.onePrice);
- }else if((goodsPrice?.onePrice == null || goodsPrice?.onePrice == "0") && ((goodsPrice?.price != null && goodsPrice?.price != "0") || (goodsPrice?.money != null && goodsPrice?.money != "0.00"))){
- return (goodsPrice?.price== "0"|| goodsPrice?.price == null ? "" : S.of(context).jifen_(goodsPrice?.price)) + (goodsPrice?.money== "0"|| goodsPrice?.money == null ? "" : " + ${AppUtils.calculateDouble(double.tryParse(goodsPrice?.money) ?? 0)}元");
- }else if(goodsPrice.oneMoney != null && goodsPrice.oneMoney != "0.00"){
+ } else if ((goodsPrice?.onePrice == null || goodsPrice?.onePrice == "0") &&
+ ((goodsPrice?.price != null && goodsPrice?.price != "0") ||
+ (goodsPrice?.money != null && goodsPrice?.money != "0.00"))) {
+ return (goodsPrice?.price == "0" || goodsPrice?.price == null
+ ? ""
+ : S.of(context).jifen_(goodsPrice?.price)) +
+ (goodsPrice?.money == "0" || goodsPrice?.money == null
+ ? ""
+ : " + ${AppUtils.calculateDouble(double.tryParse(goodsPrice?.money) ?? 0)}元");
+ } else if (goodsPrice.oneMoney != null && goodsPrice.oneMoney != "0.00") {
return "${AppUtils.calculateDouble(double.tryParse(goodsPrice.oneMoney) ?? 0)}元";
}
}
@@ -929,8 +945,10 @@ class _WelfarePage extends State {
///活动任务
Widget activityTask() {
return Container(
- margin: EdgeInsets.only(bottom:20.h,),
- child:Column(
+ margin: EdgeInsets.only(
+ bottom: 20.h,
+ ),
+ child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
@@ -956,17 +974,18 @@ class _WelfarePage extends State {
),
],
),
- SizedBox(height: 12.h,),
+ SizedBox(
+ height: 12.h,
+ ),
ListView.builder(
padding: EdgeInsets.zero,
- itemCount:6,
+ itemCount: 6,
scrollDirection: Axis.vertical,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return GestureDetector(
- onTap: () {
- },
+ onTap: () {},
child: taskItem(),
);
},
@@ -978,72 +997,76 @@ class _WelfarePage extends State {
Widget taskItem() {
return Container(
- width:double.infinity,
- height:95.h,
+ width: double.infinity,
+ height: 95.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Colors.white,
boxShadow: [
- BoxShadow(
- color: Color(0x08213303).withAlpha(12),
- offset: Offset(0, 2),
- blurRadius: 3,
- spreadRadius: 0,
- ),
- ],
+ BoxShadow(
+ color: Color(0x08213303).withAlpha(12),
+ offset: Offset(0, 2),
+ blurRadius: 3,
+ spreadRadius: 0,
+ ),
+ ],
),
- padding: EdgeInsets.symmetric(horizontal: 12.w,vertical: 12.h),
+ padding: EdgeInsets.symmetric(horizontal: 12.w, vertical: 12.h),
margin: EdgeInsets.only(bottom: 10.h),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
- Expanded(child:Column(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text(
- "海峡姐妹茶新品尝鲜(0/3)",
- style: TextStyle(
- fontSize: 14.sp,
- fontWeight: MyFontWeight.bold,
- color: Color(0xFF353535),
+ Expanded(
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ "海峡姐妹茶新品尝鲜(0/3)",
+ style: TextStyle(
+ fontSize: 14.sp,
+ fontWeight: MyFontWeight.bold,
+ color: Color(0xFF353535),
+ ),
),
- ),
- Text(
- "可获得¥10代金券",
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.regular,
- color: Color(0xFF4D4D4D),
+ Text(
+ "可获得¥10代金券",
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Color(0xFF4D4D4D),
+ ),
),
- ), Text(
- "购买任意3杯新品",
- style: TextStyle(
- fontSize: 10.sp,
- fontWeight: MyFontWeight.regular,
- color: Color(0xFFB3B3B3),
+ Text(
+ "购买任意3杯新品",
+ style: TextStyle(
+ fontSize: 10.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Color(0xFFB3B3B3),
+ ),
),
- ),
- ],
- ),),
+ ],
+ ),
+ ),
Container(
width: 55.w,
height: 21.h,
decoration: BoxDecoration(
gradient: new LinearGradient(
- begin: Alignment.centerLeft,
- end: Alignment.centerRight,
- colors: [
- Color(0xFFFF2700),
- Color(0xFFFF4F00),
- ],),
+ begin: Alignment.centerLeft,
+ end: Alignment.centerRight,
+ colors: [
+ Color(0xFFFF2700),
+ Color(0xFFFF4F00),
+ ],
+ ),
// border: Border.all(color: Colors.white,width: 0.5),
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(3),
),
alignment: Alignment.center,
- child:Text(
+ child: Text(
"领取",
style: TextStyle(
fontSize: 12.sp,
@@ -1056,5 +1079,4 @@ class _WelfarePage extends State {
),
);
}
-
}
diff --git a/lib/integral/integral_page.dart b/lib/integral/integral_page.dart
index 06ae97a7..771ec56e 100644
--- a/lib/integral/integral_page.dart
+++ b/lib/integral/integral_page.dart
@@ -19,10 +19,10 @@ import 'package:huixiang/view_widget/sign_in_widget.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
+import '../utils/flutter_utils.dart';
import 'intergra_view/integral_task.dart';
class IntegralPage extends StatefulWidget {
-
@override
State createState() {
return _IntegralPage();
@@ -51,13 +51,17 @@ class _IntegralPage extends State {
);
userInfo = UserInfo.fromJson(jsonDecode(value.getString("user")));
- BaseData> rankData = await apiService.rankList()
- .catchError((onError) {});
+ BaseData> rankData =
+ await apiService.rankList().catchError((onError) {
+ SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
+ alignment: Alignment.center);
+ refreshController.refreshFailed();
+ });
if (rankData != null && rankData.isSuccess) {
ranks.clear();
ranks.addAll(rankData.data);
refreshController.refreshCompleted();
- }else {
+ } else {
refreshController.refreshFailed();
}
@@ -112,7 +116,9 @@ class _IntegralPage extends State {
Scaffold(
backgroundColor: Colors.transparent,
appBar: MyAppBar(
- exit: (){Navigator.of(context).pop(signInfo.todayHasSignin ?? false);},
+ exit: () {
+ Navigator.of(context).pop(signInfo?.todayHasSignin ?? false);
+ },
background: Colors.transparent,
leadingColor: Colors.white,
title: "",
@@ -124,7 +130,9 @@ class _IntegralPage extends State {
margin: EdgeInsets.only(right: 16.w),
child: GestureDetector(
onTap: () {
- Navigator.of(context).pushNamed('/router/integral_detailed_page',arguments:{"titleType":2});
+ Navigator.of(context).pushNamed(
+ '/router/integral_detailed_page',
+ arguments: {"titleType": 2});
},
child: Text(
S.of(context).mingxi,
@@ -137,17 +145,17 @@ class _IntegralPage extends State {
),
),
),
- body:SmartRefresher(
+ body: SmartRefresher(
controller: refreshController,
enablePullDown: true,
enablePullUp: false,
- header: MyHeader(),
+ header: MyHeader(color: Colors.white,),
footer: CustomFooter(
builder: (context, mode) {
return MyFooter(mode);
},
),
- onRefresh:(){
+ onRefresh: () {
setState(() {
querySignInfo();
});
@@ -163,9 +171,19 @@ class _IntegralPage extends State {
return Column(
children: [
/// 上面的积分和VIP等级显示
- IntegralVip(rankLevel, signInfo, userInfo,"${ (signInfo?.signInList?.length ) ?? "0"}",
- ((signInfo?.rewardList != null && signInfo.rewardList.length > (signInfo?.signInList?.length ?? 0)) ?
- signInfo.rewardList[signInfo?.signInList?.length ?? 0]:0).toString()),
+ IntegralVip(
+ rankLevel,
+ signInfo,
+ userInfo,
+ "${(signInfo?.signInList?.length) ?? "0"}",
+ ((signInfo?.rewardList != null &&
+ signInfo.rewardList.length >
+ (signInfo?.signInList?.length ??
+ 0))
+ ? signInfo.rewardList[
+ signInfo?.signInList?.length ?? 0]
+ : 0)
+ .toString()),
///立即签到
InForPoints(signInfo, _signIn),
@@ -191,7 +209,9 @@ class _IntegralPage extends State {
SmartDialog.showToast("今日已签到了", alignment: Alignment.center);
return;
}
- EasyLoading.show(status: S.of(context).zhengzaijiazai);
+ EasyLoading.show(
+ status: S.of(context).zhengzaijiazai,
+ maskType: EasyLoadingMaskType.black);
BaseData baseData = await apiService.signIn().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {});
diff --git a/lib/integral/intergra_view/integral_task.dart b/lib/integral/intergra_view/integral_task.dart
index 408d8694..e9bb165a 100644
--- a/lib/integral/intergra_view/integral_task.dart
+++ b/lib/integral/intergra_view/integral_task.dart
@@ -6,6 +6,8 @@ import 'package:huixiang/utils/font_weight.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/round_button.dart';
+import '../../view_widget/no_data_view.dart';
+
class IntegralTask extends StatefulWidget {
final SignInfo signInfo;
@@ -57,28 +59,38 @@ class _IntegralTask extends State {
),
Expanded(
child: Container(
- child: ListView.builder(
- padding: EdgeInsets.only(left: 10.w, top: 20.h),
- physics: BouncingScrollPhysics(),
- // loop: false,
- // pagination: SwiperPagination(
- // alignment: Alignment.bottomCenter,
- // builder: DotSwiperPaginationBuilder(
- // size: 8,
- // activeSize: 8,
- // space: 5,
- // activeColor: Colors.black,
- // color: Colors.black.withAlpha(76),
- // ),
- // ),
- itemBuilder: (context, position) {
- return taskItem(widget.signInfo.taskList[position]);
- },
- itemCount: (widget.signInfo != null &&
- widget.signInfo.taskList != null &&
- widget.signInfo.taskList.length > 0)
- ? widget.signInfo.taskList.length
- : 0),
+ child: (widget.signInfo != null &&
+ widget.signInfo.taskList != null &&
+ widget.signInfo.taskList.length > 0)
+ ? ListView.builder(
+ padding: EdgeInsets.only(left: 10.w, top: 20.h),
+ physics: BouncingScrollPhysics(),
+ // loop: false,
+ // pagination: SwiperPagination(
+ // alignment: Alignment.bottomCenter,
+ // builder: DotSwiperPaginationBuilder(
+ // size: 8,
+ // activeSize: 8,
+ // space: 5,
+ // activeColor: Colors.black,
+ // color: Colors.black.withAlpha(76),
+ // ),
+ // ),
+ itemBuilder: (context, position) {
+ return taskItem(widget.signInfo.taskList[position]);
+ },
+ itemCount: (widget.signInfo != null &&
+ widget.signInfo.taskList != null &&
+ widget.signInfo.taskList.length > 0)
+ ? widget.signInfo.taskList.length
+ : 0)
+ : NoDataView(
+ src: "assets/image/xiao_fei.webp",
+ isShowBtn: false,
+ text: "暂无任务可做~",
+ fontSize: 16.sp,
+ margin: EdgeInsets.only(left: 60.w, right: 60.w),
+ ),
),
flex: 1,
)
diff --git a/lib/login/login_page.dart b/lib/login/login_page.dart
index 67bcc0ee..bc68553f 100644
--- a/lib/login/login_page.dart
+++ b/lib/login/login_page.dart
@@ -326,7 +326,7 @@ class _MyLoginPageState extends State with TickerProviderStateMixin {
"mobile": mobile,
"invite":invite,
};
- EasyLoading.show(status: S.of(context).zhengzaijiazai);
+ EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black);
BaseData value = await client.memberLogin(param).catchError((error) {
print(error.message);
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type), alignment: Alignment.center);
diff --git a/lib/login/new_login_page.dart b/lib/login/new_login_page.dart
index c4d5f9b1..580b4890 100644
--- a/lib/login/new_login_page.dart
+++ b/lib/login/new_login_page.dart
@@ -61,17 +61,9 @@ class _NewLoginPage extends State {
void initState() {
super.initState();
isLogin();
- queryChannels();
}
queryChannels() async{
- SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
- if (!sharedPreferences.containsKey("isShowPrivacyPolicy") ||
- !sharedPreferences.getBool("isShowPrivacyPolicy")) {
- showAlertDialog();
- return;
- }
- apiService = ApiService(Dio(), context: context);
BaseData baseData = await apiService.appChannels().catchError((error) {
print(error.message);
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
@@ -80,7 +72,6 @@ class _NewLoginPage extends State {
if (baseData != null && baseData.isSuccess) {
channelsList = baseData.data;
setState((){});
- EasyLoading.dismiss();
} else {
if (baseData?.msg != null)
SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
@@ -241,7 +232,7 @@ class _NewLoginPage extends State {
"areaCode": area,
"regChannel":channelName ?? ""
};
- EasyLoading.show(status: S.of(context).zhengzaijiazai);
+ EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black);
BaseData value = await apiService.memberLogin(param).catchError((error) {
print(error.message);
SmartDialog.showToast(AppUtils.dioErrorTypeToString(error.type),
@@ -262,11 +253,11 @@ class _NewLoginPage extends State {
"interviewCouponList": userInfo.interviewCouponList,
"firstLoginCouponList": userInfo.firstLoginCouponList
});
- EasyLoading.dismiss();
} else {
if (value.msg != null)
SmartDialog.showToast(value?.msg, alignment: Alignment.center);
}
+ EasyLoading.dismiss();
}
saveUserJson(userJson) {
@@ -295,11 +286,10 @@ class _NewLoginPage extends State {
sharedPreferences.getString("mobile") == "13800138000";
Navigator.of(context).popAndPushNamed('/router/main_page');
} else {
- initController();
-
apiService = ApiService(Dio(), context: context);
+ initController();
isShowLogin = true;
- setState(() {});
+ queryChannels();
}
}
diff --git a/lib/main.dart b/lib/main.dart
index d12e5c28..f8bce895 100644
--- a/lib/main.dart
+++ b/lib/main.dart
@@ -73,6 +73,7 @@ import 'package:huixiang/settlement/settlement.dart';
import 'package:huixiang/store/store_view/product_meals_sku.dart';
import 'package:huixiang/test_page.dart';
import 'package:huixiang/union/location_map_page.dart';
+import 'package:huixiang/union/union_select_city.dart';
import 'package:huixiang/utils/ImgCachePath.dart';
import 'package:huixiang/vip/user_vip_service_page.dart';
@@ -133,6 +134,7 @@ import 'mine/manage_address_page.dart';
import 'mine/mine_greenery.dart';
import 'mine/mine_shop_details.dart';
import 'mine/mine_shop_page.dart';
+import 'mine/mine_shop_recharge.dart';
import 'mine/mine_view/community_follow.dart';
import 'mine/mine_vip/binding_assistant_card.dart';
import 'mine/mine_vip/legal_right_details.dart';
@@ -426,6 +428,8 @@ Map routers = {
MineGreenery(),
'/router/mine_shop_page': (context, {arguments}) =>
MineShopPage(),
+ '/router/mine_shop_recharge': (context, {arguments}) =>
+ MineShopRecharge(arguments: arguments,),
'/router/mine_shop_details': (context, {arguments}) =>
MineShopDetails(arguments:arguments,),
'/router/coupon_page': (context, {arguments}) =>
@@ -462,6 +466,8 @@ Map routers = {
BindingPhonePage(arguments:arguments),
'/router/trading_card_page': (context, {arguments}) =>
TradingCardPage(),
+ '/router/union_select_city': (context, {arguments}) =>
+ UnionSelectCity(arguments:arguments),
'/router/business_login_page': (context, {arguments}) =>
BusinessLoginPage(arguments: arguments),
'/router/business_page': (context, {arguments}) =>
diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart
index 98a91778..6bbc3dc7 100644
--- a/lib/mine/mine_page.dart
+++ b/lib/mine/mine_page.dart
@@ -26,9 +26,11 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:dio/dio.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
+import '../retrofit/data/banner.dart';
import '../retrofit/data/coupon.dart';
import '../retrofit/data/page.dart';
import '../utils/flutter_utils.dart';
+import '../view_widget/custom_image.dart';
import 'mine_view/mine_item.dart';
import 'mine_view/mine_view.dart';
@@ -49,6 +51,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin {
final RefreshController _refreshController = RefreshController();
int totalMsg = 0;
String couponNum;
+ List activityBannerData = [];
_toUserInfo() async {
SharedPreferences shared = await SharedPreferences.getInstance();
@@ -78,6 +81,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin {
querySocialInfo();
queryMsgStats();
queryCoupon();
+ queryActivityBanner();
// queryCard();
eventBus.on().listen((event) {
@@ -136,6 +140,23 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin {
// EasyLoading.dismiss();
}
+ ///宣传banner
+ queryActivityBanner() async {
+ SharedPreferences value = await SharedPreferences.getInstance();
+ apiService = ApiService(
+ Dio(),
+ context: context,
+ token: value.getString("token"),
+ showLoading: false,
+ );
+ BaseData> baseData = await apiService.queryBanner({
+ "model": {"type": "HOME_STORE_PAGE"},
+ }).catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
+ activityBannerData = baseData.data.records;
+ }
+ }
+
queryCoupon() async {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
@@ -166,6 +187,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin {
queryCoupon();
querySocialInfo();
queryMsgStats();
+ queryActivityBanner();
}
///个人社交信息(粉丝/关注数量/成就数量)
@@ -427,10 +449,11 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin {
///推广图
Widget spreadImage() {
return Container(
- margin: EdgeInsets.only(bottom: 30.h,),
width: double.infinity,
+ margin: EdgeInsets.only(bottom:24.h),
height: 85.h,
- child: Swiper(
+ child: activityBannerData != null && activityBannerData.isNotEmpty
+ ? Swiper(
pagination: SwiperPagination(
alignment: Alignment.bottomCenter,
margin: EdgeInsets.only(top: 5.h),
@@ -442,37 +465,82 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin {
color: Colors.white.withAlpha(76),
),
),
- autoplay:true,
+ autoplay: true,
duration: 1000,
autoplayDelay: 2000,
itemBuilder: (context, position) {
- return GestureDetector(
- onTap: (){
- if(position == 0){
- Navigator.of(context).pushNamed('/router/invite_friends');
- }else if(position == 1){
- Navigator.of(context).pushNamed('/router/trading_card_page');
- }
+ return InkWell(
+ onTap: () {
+ spreadBannerClick(activityBannerData[position]);
},
- child:Container(
- margin: EdgeInsets.symmetric(horizontal:14.w),
- child: ClipRRect(
- child:Image.asset(
- spreadItem[position],
- width:double.infinity,
- fit: BoxFit.fill,
- height:double.infinity,
- ),
- borderRadius: BorderRadius.circular(6.w),
+ child: Container(
+ margin: EdgeInsets.symmetric(horizontal: 14.w),
+ child: MImage(
+ activityBannerData[position].imgUrl,
+ fit: BoxFit.cover,
+ radius: BorderRadius.circular(6),
+ errorSrc: "assets/image/default_2_1.webp",
+ fadeSrc: "assets/image/default_2_1.webp",
),
),
);
},
- itemCount:2,
+ itemCount: activityBannerData.length,
+ )
+ : Image.asset(
+ "assets/image/default_2_1.webp",
+ fit: BoxFit.cover,
),
);
}
+ /// contentType 跳转类型(0:不跳转,1:积分商品,2:活动,3:文章,4:页面跳转,5:课程,7:门店跳转)
+ spreadBannerClick(BannerData activityBannerData) async {
+ switch (activityBannerData.contentType) {
+ case 1:
+ Navigator.of(context).pushNamed('/router/integral_store_page',
+ arguments: {"goodsId": activityBannerData.content});
+ break;
+ case 2:
+ Navigator.of(context).pushNamed('/router/web_page', arguments: {
+ "activityId": activityBannerData.content,
+ });
+ break;
+ case 3:
+ Navigator.of(context).pushNamed('/router/web_page', arguments: {
+ "articleId": activityBannerData.content,
+ });
+ break;
+ case 4:
+ String router = activityBannerData.content;
+ // String router = "/router/store_order?{\"id\":\"1512378184161558528\",\"tenant\":\"1188\",\"storeName\":\"农场煮意\"}";
+ if (router.contains("?")) {
+ String params = router.substring(router.indexOf("?") + 1);
+ Map map = jsonDecode(params);
+ Navigator.of(context).pushNamed(
+ router.substring(0, router.indexOf("?")),
+ arguments: map);
+ } else {
+ Navigator.of(context).pushNamed(router);
+ }
+ break;
+ case 5:
+ Navigator.of(context).pushNamed('/router/class_details', arguments: {
+ "id": activityBannerData.content,
+ });
+ break;
+ case 7:
+ String params = activityBannerData.content
+ .substring(activityBannerData.content.indexOf("?") + 1);
+ Map map = jsonDecode(params);
+ Navigator.of(context).pushNamed(
+ activityBannerData.content
+ .substring(0, activityBannerData.content.indexOf("?")),
+ arguments: map);
+ break;
+ }
+ }
+
final List spreadItem = [
"assets/image/welfare_spread.webp",
"assets/image/welfare_yz.webp",
diff --git a/lib/mine/mine_shop_details.dart b/lib/mine/mine_shop_details.dart
index 244ca00c..ffbfbf16 100644
--- a/lib/mine/mine_shop_details.dart
+++ b/lib/mine/mine_shop_details.dart
@@ -511,6 +511,12 @@ class _MineShopDetails extends State {
),
),
),
+ if(((store.distance ?? 0) > 1000
+ ? S.of(context).gongli(
+ ((store.distance ?? 0) / 1000 * 100).toInt() / 100.0)
+ : S
+ .of(context)
+ .mi(((store.distance ?? 0) * 100).toInt() / 100.0)) != "0.0米")
Text(
(store.distance ?? 0) > 1000
? S.of(context).gongli(
diff --git a/lib/mine/mine_shop_page.dart b/lib/mine/mine_shop_page.dart
index 2c0e5953..60fcc8e2 100644
--- a/lib/mine/mine_shop_page.dart
+++ b/lib/mine/mine_shop_page.dart
@@ -2,6 +2,7 @@ import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/page.dart';
@@ -27,88 +28,195 @@ class MineShopPage extends StatefulWidget {
}
}
-class _MineShopPage extends State {
+class _MineShopPage extends State with WidgetsBindingObserver{
List coupons = [];
ApiService apiService;
int current = 1;
RefreshController refreshController ;
+ final TextEditingController editingController = TextEditingController();
+ int optionIndex = 0;
+ bool isKeyBoardShow = false;
+ List hotSearch = [];
+ List historySearch = [];
+ FocusNode _focusNode = FocusNode();
+ bool hasFocus = true;
+ int priceOrder = 0;
@override
void initState() {
super.initState();
refreshController = RefreshController();
-
SharedPreferences.getInstance().then((value) {
apiService =
ApiService(Dio(), context: context, token: value.getString("token"));
queryVipCard();
});
+ _focusNode.addListener(() {
+ setState(() {
+ hasFocus = _focusNode.hasFocus;
+ });
+ });
}
- _onRefresh() {
- current = 1;
- queryVipCard();
+ @override
+ void didChangeMetrics() {
+ super.didChangeMetrics();
+ WidgetsBinding.instance.addPostFrameCallback((_) {
+ setState(() {
+ print("object: ${MediaQuery.of(context).viewInsets.bottom}");
+ if (MediaQuery.of(context).viewInsets.bottom == 0) {
+ if (isKeyBoardShow) {
+ isKeyBoardShow = false;
+ //关闭键盘 软键盘关闭了, 清除输入控件的焦点, 否则重新进入页面会导致软键盘再弹出问题
+ FocusScope.of(context).requestFocus(FocusNode());
+ }
+ } else {
+ isKeyBoardShow = true;
+ }
+ });
+ });
+ }
+
+ ///离开页面记着销毁和清除
+ @override
+ void dispose() {
+ _focusNode.unfocus();
+ refreshController.dispose();
+ super.dispose();
}
- queryVipCard() async {
- BaseData> baseData =
- await apiService.vipList({}).catchError((error) {
- refreshController.refreshFailed();
- });
- if (baseData != null && baseData.isSuccess) {
- coupons.clear();
- coupons.addAll(baseData.data);
- setState(() {
- refreshController.refreshCompleted();
+ queryVipCard({bool showLoading = true}) async {
+ try{
+ if(showLoading)EasyLoading.show(status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
+ BaseData> baseData =
+ await apiService.vipList({
+ "keywords":editingController.text,
+ }).catchError((error) {
+ refreshController.refreshFailed();
});
- } else {
- refreshController.refreshFailed();
+ if (baseData != null && baseData.isSuccess) {
+ coupons.clear();
+ coupons.addAll(baseData.data);
+ refreshController.refreshCompleted();
+ } else {
+ refreshController.refreshFailed();
+ }
+ }finally{
+ EasyLoading.dismiss();
+ setState(() {});
}
}
@override
Widget build(BuildContext context) {
- return Scaffold(
- appBar: MyAppBar(
- title: S.of(context).dianpuyue,
- titleColor: Colors.black,
- background: Colors.white,
- leadingColor: Colors.black,
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: (){
+ FocusScope.of(context).requestFocus(FocusNode());
+ },
+ child: Scaffold(
+ resizeToAvoidBottomInset: false,
+ appBar: MyAppBar(
+ title: "店铺充值",
+ titleColor: Colors.black,
+ background: Colors.white,
+ leadingColor: Colors.black,
+ ),
+ body:Column(
+ children: [
+ Container(
+ color: Colors.white,
+ padding: EdgeInsets.only(top:10.h,bottom:18.h,),
+ child: searchShopItem(),
+ ),
+ Expanded(child: SmartRefresher(
+ enablePullDown: true,
+ enablePullUp: false,
+ header: MyHeader(),
+ footer: CustomFooter(
+ builder: (context, mode) {
+ return MyFooter(mode);
+ },
+ ),
+ controller: refreshController,
+ onRefresh: queryVipCard,
+ physics: BouncingScrollPhysics(),
+ child: (coupons != null && coupons.length > 0)
+ ? ListView.builder(
+ padding: EdgeInsets.symmetric(vertical: 8.h),
+ itemBuilder: (context, position) {
+ return GestureDetector(
+ onTap: () {
+ Navigator.of(context).pushNamed(
+ '/router/mine_shop_recharge',
+ arguments: {
+ "id": coupons[position].id,
+ "tenantCode":coupons[position].tenantCode,
+ "storeId":coupons[position].storeList[0].id
+ }).then((value) {
+ queryVipCard(showLoading: false);
+ });
+ },
+ child: shopItem(coupons[position]),
+ );
+ },
+ itemCount: coupons != null ? coupons.length : 0,
+ )
+ : NoDataView(
+ src: "assets/image/icon_empty.webp",
+ isShowBtn: false,
+ text: "还没有会员卡~",
+ fontSize: 16.sp,
+ margin: EdgeInsets.only(top: 120.h),
+ ),
+ ),)
+ ],
+ ),
),
- body: SmartRefresher(
- enablePullDown: true,
- enablePullUp: false,
- header: MyHeader(),
- footer: CustomFooter(
- builder: (context, mode) {
- return MyFooter(mode);
- },
+ );
+ }
+
+ Widget searchShopItem() {
+ return Container(
+ margin: EdgeInsets.fromLTRB(14.w, 0, 14.w, 0),
+ padding: EdgeInsets.symmetric(vertical: 6.h),
+ decoration: BoxDecoration(
+ color: Color(0xFFF5FAF7),
+ borderRadius: BorderRadius.circular(4),
+ boxShadow: [
+ BoxShadow(
+ color: Colors.black.withAlpha(12),
+ offset: Offset(0, 3),
+ blurRadius: 14,
+ spreadRadius: 0,
+ ),
+ ],
+ ),
+ child: TextField(
+ textInputAction: TextInputAction.search,
+ onEditingComplete: () {
+ FocusScope.of(context).requestFocus(FocusNode());
+ queryVipCard();
+ },
+ controller: editingController,
+ style: TextStyle(
+ fontSize: 14.sp,
),
- controller: refreshController,
- onRefresh: queryVipCard,
- physics: BouncingScrollPhysics(),
- child: (coupons != null && coupons.length > 0)
- ? ListView.builder(
- padding: EdgeInsets.symmetric(vertical: 8.h),
- itemBuilder: (context, position) {
- return GestureDetector(
- onTap: () {
- Navigator.of(context).pushNamed(
- '/router/mine_shop_details',
- arguments: {"id": coupons[position].id});
- },
- child: shopItem(coupons[position]),
- );
- },
- itemCount: coupons != null ? coupons.length : 0,
- )
- : NoDataView(
- src: "assets/image/icon_empty.webp",
- isShowBtn: false,
- text: "还没有会员卡~",
- fontSize: 16.sp,
- margin: EdgeInsets.only(top: 120.h),
+ decoration: InputDecoration(
+ hintText: "搜索联盟会员店",
+ hintStyle: TextStyle(
+ fontSize: 12.sp,
+ color: Color(0xFFB3B3B3),
+ ),
+ isCollapsed: true,
+ prefixIcon:Padding(padding: EdgeInsets.only(left: 5.w,right: 5.w),child: Image.asset(
+ "assets/image/icon_search.webp",
+ width: 16.h,
+ height: 16.h,
+ ),),
+ prefixIconConstraints: BoxConstraints(),
+ border: InputBorder.none,
),
),
);
@@ -218,19 +326,20 @@ class _MineShopPage extends State {
),
)),
Text(
- S.of(context).chakanxiangqing,
+ "去充值",
style: TextStyle(
- color: Color(0xFF353535),
+ color: Color(0xFF262626),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
SizedBox(width: 2,),
- Icon(
- Icons.chevron_right,
- size: 24,
- color: Colors.black,
- ),
+ Image.asset(
+ "assets/image/icon_right_z.webp",
+ width: 16,
+ height: 16,
+ color: Color(0xFF262626),
+ )
],
),
],
diff --git a/lib/mine/mine_shop_recharge.dart b/lib/mine/mine_shop_recharge.dart
new file mode 100644
index 00000000..3699879a
--- /dev/null
+++ b/lib/mine/mine_shop_recharge.dart
@@ -0,0 +1,908 @@
+import 'dart:io';
+
+import 'package:dio/dio.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_easyloading/flutter_easyloading.dart';
+import 'package:flutter_html/flutter_html.dart';
+import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
+import 'package:fluwx/fluwx.dart';
+import 'package:huixiang/generated/l10n.dart';
+import 'package:huixiang/retrofit/data/base_data.dart';
+import 'package:huixiang/retrofit/data/vip_card.dart';
+import 'package:huixiang/retrofit/retrofit_api.dart';
+import 'package:huixiang/store/scan.dart';
+import 'package:huixiang/utils/font_weight.dart';
+import 'package:huixiang/view_widget/custom_image.dart';
+import 'package:huixiang/view_widget/my_appbar.dart';
+import 'package:flutter_screenutil/flutter_screenutil.dart';
+import 'package:pull_to_refresh/pull_to_refresh.dart';
+import 'package:shared_preferences/shared_preferences.dart';
+
+import '../retrofit/data/member_recharge_list.dart';
+import '../retrofit/data/rechargeActLists.dart';
+import '../retrofit/data/wx_pay.dart';
+import '../retrofit/min_api.dart';
+import '../utils/flutter_utils.dart';
+import '../utils/min.dart';
+import '../view_widget/classic_header.dart';
+import '../view_widget/my_footer.dart';
+import '../view_widget/no_data_view.dart';
+import '../view_widget/recharge_details_dialog.dart';
+import 'package:tobias/tobias.dart' as tobias;
+
+class MineShopRecharge extends StatefulWidget {
+ final Map arguments;
+
+ MineShopRecharge({this.arguments});
+
+ @override
+ State createState() {
+ return _MineShopRecharge();
+ }
+}
+
+class _MineShopRecharge extends State {
+ ApiService apiService;
+ MinApiService minService;
+ VipCard vipCard;
+ List memberRechargeList = [];
+ int selectIndex = 0;
+ double discount = 100;
+ var checkIndex = 2;
+ dynamic payListen;
+ int _loadCount = 0;
+ String tenant;
+ String storeId;
+ String minToken;
+ final RefreshController refreshController = RefreshController();
+
+ @override
+ void dispose() {
+ super.dispose();
+ refreshController.dispose();
+ if (payListen != null) payListen.cancel();
+ }
+
+ @override
+ void initState() {
+ super.initState();
+ storeId = widget.arguments["storeId"];
+ tenant = widget.arguments["tenantCode"];
+ _onRefresh();
+ payListen = weChatResponseEventHandler.listen((event) async {
+ print("payCallback: ${event.errCode}");
+ if (event.errCode == 0) {
+ SmartDialog.showToast("充值成功", alignment: Alignment.center);
+ } else {
+ SmartDialog.showToast("充值失败", alignment: Alignment.center);
+ }
+ vipDetail();
+ });
+ }
+
+ ///会员卡详情
+ vipDetail({bool isSingle = true}) async {
+ try {
+ BaseData baseData = await apiService.vipDetail({
+ "id": widget.arguments["id"],
+ "latitude": "",
+ "longitude": "",
+ }).catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
+ vipCard = baseData.data;
+ }
+ } finally {
+ if (isSingle)
+ setState(() {});
+ else
+ addLoadCount();
+ }
+ }
+
+ ///小程序登录
+ minLogin() async {
+ try {
+ var baseData = await apiService.minLogin(storeId).catchError((onError) {
+ debugPrint(onError.toString());
+ });
+ if (baseData != null && baseData.isSuccess) {
+ minToken = baseData.data["token"];
+ SharedPreferences.getInstance().then(
+ (value) => {
+ value.setString('minToken', minToken),
+ value.setString('tenant', tenant),
+ value.setString('storeId', storeId),
+ },
+ );
+ minService = MinApiService(
+ Dio(),
+ context: context,
+ token: minToken,
+ tenant: tenant,
+ storeId: storeId,
+ );
+ }
+ } finally {}
+ }
+
+ ///充值列表
+ queryRechargeActList() async {
+ try {
+ BaseData> baseData =
+ await minService.memberRechargeList().catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
+ memberRechargeList = baseData.data;
+ }
+ } finally {
+ addLoadCount();
+ }
+ }
+
+ ///门店充值
+ shopRecharge() async {
+ if (minService == null) await minLogin();
+ BaseData baseData = await minService.memberRecharge({
+ "money": 0,
+ "rechargeId": memberRechargeList[selectIndex].id,
+ "type": checkIndex == 2 ? "wechat" : "alipay",
+ }).catchError((error) {});
+ if (baseData != null && baseData.isSuccess) {
+ if (checkIndex == 2) {
+ if (Platform.isAndroid) {
+ if (!(await Min.isInitialize())) {
+ // 小程序的微信支付和app的充值支付使用同一个WXPayEntryActivity回调,
+ // 然而充值时小程序未初始化会导致回调内部代码调用getPackage空指针,
+ // 故而在此初始化一下
+ await Min.initialize();
+ }
+ }
+ WxPay wxPay = WxPay.fromJson(baseData.data);
+ await registerWxApi(
+ appId: wxPay.appId,
+ doOnAndroid: true,
+ universalLink: "https://hx.lotus-wallet.com/app/",
+ );
+ payWithWeChat(
+ appId: wxPay.appId,
+ partnerId: wxPay.partnerId,
+ prepayId: wxPay.prepayId,
+ packageValue: wxPay.packageValue,
+ nonceStr: wxPay.nonceStr,
+ timeStamp: int.tryParse(wxPay.timeStamp),
+ sign: wxPay.sign,
+ );
+ } else {
+ tobias.isAliPayInstalled().then((value) => {
+ // 判断是否安装了支付宝
+ if (!value)
+ {SmartDialog.showToast("请安装支付宝", alignment: Alignment.center)}
+ else
+ {
+ tobias.aliPay(baseData.data["body"]).then((payRes) {
+ if (payRes['resultStatus'] == 9000 ||
+ payRes['resultStatus'] == '9000') {
+ SmartDialog.showToast("充值成功",
+ alignment: Alignment.center);
+ } else {
+ SmartDialog.showToast(payRes['memo'],
+ alignment: Alignment.center);
+ }
+ vipDetail();
+ })
+ }
+ });
+ }
+ } else {
+ SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
+ }
+ }
+
+ _onRefresh() async {
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
+ if (apiService == null) {
+ SharedPreferences value = await SharedPreferences.getInstance();
+ apiService =
+ ApiService(Dio(), context: context, token: value.getString("token"));
+ }
+ if (minService == null) await minLogin();
+ vipDetail(isSingle: false);
+ queryRechargeActList();
+ }
+
+ addLoadCount() {
+ _loadCount += 1;
+ if (_loadCount == 2) {
+ _loadCount = 0;
+ EasyLoading.dismiss();
+ if (refreshController.isRefresh) refreshController.refreshCompleted();
+ if (mounted) setState(() {});
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: MyAppBar(
+ title: "店铺充值",
+ titleColor: Colors.black,
+ background: Colors.white,
+ brightness: Brightness.dark,
+ leadingColor: Colors.black,
+ ),
+ body: SmartRefresher(
+ enablePullDown: true,
+ enablePullUp: false,
+ header: MyHeader(),
+ footer: CustomFooter(
+ builder: (context, mode) {
+ return MyFooter(mode);
+ },
+ ),
+ controller: refreshController,
+ onRefresh: _onRefresh,
+ physics: BouncingScrollPhysics(),
+ child: Column(
+ children: [
+ shopRechargeCard(),
+ (memberRechargeList != null &&
+ (memberRechargeList?.length ?? 0) > 0)
+ ? Expanded(
+ child: ListView.builder(
+ padding: EdgeInsets.zero,
+ itemCount: (memberRechargeList != null &&
+ (memberRechargeList?.length ?? 0) > 0)
+ ? memberRechargeList.length
+ : 0,
+ scrollDirection: Axis.vertical,
+ shrinkWrap: true,
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return GestureDetector(
+ onTap: () {
+ setState(() {
+ selectIndex = position;
+ });
+ },
+ child: rechargeItem(
+ memberRechargeList[position], position));
+ },
+ ))
+ : NoDataView(
+ src: "assets/image/xiao_fei.webp",
+ isShowBtn: false,
+ text: "当前店铺暂无充值套餐~",
+ fontSize: 16.sp,
+ margin:
+ EdgeInsets.only(top: 90.h, left: 60.w, right: 60.w),
+ ),
+ if (memberRechargeList != null &&
+ (memberRechargeList?.length ?? 0) > 0)
+ Container(
+ width: double.infinity,
+ margin: EdgeInsets.only(left: 16, right: 16),
+ padding: EdgeInsets.only(
+ top: 20.h,
+ bottom: 24.h,
+ ),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: EdgeInsets.only(bottom: 16.h),
+ child: Text(
+ S.of(context).zhifufangshi,
+ style: TextStyle(
+ fontSize: 16.sp,
+ color: Colors.black,
+ fontWeight: FontWeight.bold,
+ ),
+ ),
+ ),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ setState(() {
+ checkIndex = 2;
+ });
+ },
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image.asset("assets/image/icon_we_chat.webp"),
+ Expanded(
+ flex: 1,
+ child: Padding(
+ padding: EdgeInsets.only(left: 8.w),
+ child: Text(
+ S.of(context).weixinzhifu,
+ style: TextStyle(
+ fontSize: 14.sp,
+ color: Color(0xff353535),
+ ),
+ ),
+ ),
+ ),
+ checkView(2),
+ ],
+ ),
+ ),
+ SizedBox(height: 10.h),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ setState(() {
+ checkIndex = 3;
+ });
+ },
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image.asset("assets/image/icon_alipay.webp"),
+ Expanded(
+ flex: 1,
+ child: Padding(
+ padding: EdgeInsets.only(left: 8.w),
+ child: Text(
+ S.of(context).zhifubao,
+ style: TextStyle(
+ fontSize: 14.sp,
+ color: Color(0xff353535),
+ ),
+ ),
+ ),
+ ),
+ checkView(3),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ if (memberRechargeList != null &&
+ (memberRechargeList?.length ?? 0) > 0)
+ Align(
+ alignment: Alignment.bottomCenter,
+ child: GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ shopRecharge();
+ },
+ child: Container(
+ height: 56.h,
+ width: double.infinity,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ color: Color(0xFF32A060),
+ borderRadius: BorderRadius.circular(27),
+ ),
+ margin: EdgeInsets.only(
+ top: 12.h, left: 16.w, right: 16.w, bottom: 21.h),
+ child: Text(
+ S.of(context).querenchongzhi,
+ style: TextStyle(
+ fontSize: 16.sp,
+ fontWeight: MyFontWeight.medium,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ )
+ ],
+ ),
+ ));
+ }
+
+ ///卡片背景底色
+ int colorByName(String storeName) {
+ if (storeName == null) return 0xFF32A060;
+ if (storeName.contains("百年川椒") || storeName.contains("百年川椒")) {
+ return 0xFFC30D23;
+ } else if (storeName.contains("海峡姐妹") || storeName.contains("海峽姐妹")) {
+ return 0xFFE4C796;
+ } else if (storeName.contains("前进麦味") || storeName.contains("前進麥味")) {
+ return 0xFF265782;
+ }
+ return 0xFF32A060;
+ }
+
+ ///卡片详情
+ Widget shopRechargeCard() {
+ return GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ Navigator.of(context).pushNamed('/router/mine_shop_details',
+ arguments: {"id": widget.arguments["id"]});
+ },
+ child: Container(
+ width: double.infinity,
+ // height:140.h,
+ margin:
+ EdgeInsets.only(bottom: 24.h, top: 14.h, left: 14.w, right: 14.w),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Container(
+ decoration: BoxDecoration(
+ borderRadius: new BorderRadius.only(
+ topLeft: Radius.circular(6),
+ topRight: Radius.circular(6),
+ ),
+ color: Color(colorByName(vipCard?.tenantName ?? "")),
+ ),
+ padding: EdgeInsets.only(left: 12.w),
+ height: 62.h,
+ child: Row(
+ children: [
+ MImage(
+ (vipCard?.storeList?.length ?? 0) > 0
+ ? vipCard.storeList[0].logo
+ : "",
+ width: 38,
+ height: 38,
+ radius: BorderRadius.circular(100),
+ fit: BoxFit.cover,
+ errorSrc: "assets/image/default_1.webp",
+ fadeSrc: "assets/image/default_1.webp",
+ ),
+ SizedBox(
+ width: 6,
+ ),
+ Text(
+ vipCard != null ? vipCard.tenantName : "",
+ style: TextStyle(
+ color: Color(0xFFFFFFFF),
+ fontSize: 15.sp,
+ fontWeight: MyFontWeight.medium,
+ ),
+ ),
+ ],
+ ),
+ ),
+ Container(
+ decoration: BoxDecoration(
+ borderRadius: new BorderRadius.only(
+ bottomRight: Radius.circular(6),
+ topRight: Radius.circular(6),
+ ),
+ color: Colors.white,
+ ),
+ padding: EdgeInsets.all(12.h),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text(
+ "店铺余额(元)",
+ style: TextStyle(
+ color: Color(0xFF262626),
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ ),
+ ),
+ Text(
+ "No.${vipCard?.id ?? ""}",
+ style: TextStyle(
+ color: Color(0xFF262626),
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ ),
+ ),
+ ],
+ ),
+ SizedBox(
+ height: 4.h,
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Expanded(
+ child: Text(
+ "¥ ${vipCard != null ? vipCard.balance : ""}",
+ style: TextStyle(
+ color: Color(0xFF262626),
+ fontSize: 24.sp,
+ fontFamily: 'JDZhengHT',
+ fontWeight: MyFontWeight.medium,
+ ),
+ ),
+ ),
+ Text(
+ "适用门店",
+ style: TextStyle(
+ color: Color(0xFF262626),
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ ),
+ ),
+ SizedBox(
+ width: 2,
+ ),
+ Image.asset(
+ "assets/image/icon_right_z.webp",
+ width: 16,
+ height: 16,
+ color: Color(0xFF262626),
+ )
+ ],
+ ),
+ ],
+ ),
+ ),
+ ],
+ ),
+ ),
+ );
+ }
+
+ ///充值item
+ Widget rechargeItem(MemberRechargeList memberRechargeList, index) {
+ return Container(
+ width: double.infinity,
+ height: 69.h,
+ decoration: BoxDecoration(
+ borderRadius: BorderRadius.circular(4),
+ border: Border.all(
+ color:
+ selectIndex == index ? Color(0xFF32A060) : Color(0xFFFAFAFA),
+ width: selectIndex == index ? 1 : 0,
+ ),
+ color: selectIndex == index ? Color(0XFFF0FAF4) : Colors.white),
+ margin: EdgeInsets.only(bottom: 14.h, left: 14.w, right: 14.w),
+ padding: EdgeInsets.only(left: 16),
+ child: Flex(
+ direction: Axis.horizontal,
+ children: [
+ Expanded(
+ flex: 1,
+ child: Container(
+ child: Text.rich(
+ TextSpan(children: [
+ TextSpan(
+ text: "储值 ",
+ style: TextStyle(
+ fontSize: 12.sp,
+ color: selectIndex == index
+ ? Color(0xFF4D4D4D)
+ : Color(0xFF868686),
+ fontWeight: MyFontWeight.regular),
+ ),
+ TextSpan(
+ text:
+ "${AppUtils.calculateDouble(double.tryParse(memberRechargeList.rechargeMoney) ?? 0)}元",
+ style: TextStyle(
+ fontSize: 18.sp,
+ fontFamily: 'JDZhengHT',
+ color: selectIndex == index
+ ? Color(0xFF353535)
+ : Color(0xFF868686),
+ fontWeight: MyFontWeight.semi_bold),
+ ),
+ ]),
+ ),
+ )),
+ Container(
+ width: 1.w,
+ height: 37.h,
+ color:
+ selectIndex == index ? Color(0xFF32A060) : Color(0xFF979797),
+ margin: EdgeInsets.only(right: 16.w, left: 12),
+ ),
+ Expanded(
+ flex: 2,
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.center,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Text.rich(
+ TextSpan(children: [
+ TextSpan(
+ text: "实际到账 ",
+ style: TextStyle(
+ fontSize: 12.sp,
+ color: selectIndex == index
+ ? Color(0xFF353535)
+ : Color(0xFF868686),
+ fontWeight: MyFontWeight.regular),
+ ),
+ TextSpan(
+ text:
+ "${((memberRechargeList?.limitNum ?? 0) != 0 && ((memberRechargeList?.limitNum ?? 0) - (memberRechargeList?.useNum ?? 0) <= 0)) ?
+ (AppUtils.calculateDouble(double.tryParse(memberRechargeList.rechargeMoney) ?? 0)) :
+ (AppUtils.calculateDouble((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) + (double.tryParse(memberRechargeList.giftdMoney) ?? 0) + ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) - ((double.tryParse(memberRechargeList.rechargeMoney) ?? 0) * (discount / 100)))))}元",
+ style: TextStyle(
+ fontSize: 18.sp,
+ fontFamily: 'JDZhengHT',
+ color: selectIndex == index
+ ? Color(0xFF353535)
+ : Color(0xFF868686),
+ fontWeight: MyFontWeight.semi_bold),
+ ),
+ ]),
+ ),
+ SizedBox(
+ height: 4.h,
+ ),
+ GestureDetector(
+ onTap: () {
+ setState(() {
+ if (selectIndex == index)
+ showRecharge(memberRechargeList, index);
+ });
+ },
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Text(
+ "充值说明",
+ style: TextStyle(
+ color: selectIndex == index
+ ? Color(0xFF4D4D4D)
+ : Color(0xFF868686),
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ ),
+ ),
+ Icon(
+ Icons.chevron_right,
+ size: 20,
+ color: selectIndex == index
+ ? Color(0xFF353535)
+ : Color(0xFF868686),
+ ),
+ ],
+ )),
+ ],
+ ))
+ ],
+ ));
+ }
+
+ Widget checkView(var index) {
+ return Container(
+ padding: EdgeInsets.only(right: 16.w, left: 46.w),
+ alignment: Alignment.center,
+ child: Image.asset(
+ checkIndex != index
+ ? "assets/image/icon_radio_unselected.webp"
+ : "assets/image/icon_radio_selected.webp",
+ width: 15.w,
+ height: 15.h,
+ ),
+ );
+ }
+
+ ///充值说明底部弹窗
+ showRecharge(MemberRechargeList memberRechargeList, index) {
+ showModalBottomSheet(
+ context: context,
+ backgroundColor: Colors.transparent,
+ builder: (context) {
+ return Container(
+ padding: EdgeInsets.only(top: 12),
+ decoration: new BoxDecoration(
+ color: Colors.white,
+ borderRadius: new BorderRadius.only(
+ topLeft: const Radius.circular(25.0),
+ topRight: const Radius.circular(25.0))),
+ child: Container(
+ height: 355,
+ child: SingleChildScrollView(
+ physics: BouncingScrollPhysics(),
+ child: Column(
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Expanded(
+ child: Container(
+ margin: EdgeInsets.symmetric(vertical: 12.h),
+ alignment: Alignment.center,
+ child: Text(
+ "充值说明",
+ style: TextStyle(
+ fontWeight: MyFontWeight.bold,
+ fontSize: 15.sp,
+ color: Color(0xFF353535),
+ ),
+ ),
+ )),
+ GestureDetector(
+ onTap: () {
+ setState(() {
+ Navigator.of(context).pop();
+ });
+ },
+ child: Icon(
+ Icons.clear,
+ color: Colors.black,
+ size: 18,
+ ),
+ ),
+ SizedBox(width: 14),
+ ],
+ ),
+ SizedBox(
+ height: 12.h,
+ ),
+ Container(
+ width: double.infinity,
+ height: 1.h,
+ color: Color(0xFFF2F2F2),
+ margin: EdgeInsets.only(bottom: 13.h),
+ ),
+ Padding(
+ padding: EdgeInsets.only(left: 14),
+ child: Row(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ children: [
+ Expanded(
+ child: Container(
+ color: Colors.white,
+ child: Html(
+ data: memberRechargeList?.remark ?? "",
+ customImageRenders: {
+ networkSourceMatcher():
+ networkImageRender(
+ loadingWidget: () {
+ return Container();
+ },
+ ),
+ },
+ ),
+ ),
+ )
+ ],
+ ),
+ )
+ ],
+ ),
+ )));
+ });
+ }
+
+ Widget shopItem(StoreListBean store) {
+ return Container(
+ decoration: BoxDecoration(
+ borderRadius: new BorderRadius.circular(6),
+ color: Colors.white,
+ ),
+ padding: EdgeInsets.all(12),
+ margin: EdgeInsets.symmetric(horizontal: 16.w, vertical: 8.h),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ children: [
+ Expanded(
+ flex: 1,
+ child: Text(
+ (store != null) ? store.storeName : "",
+ style: TextStyle(
+ fontSize: 14.sp,
+ fontWeight: MyFontWeight.semi_bold,
+ color: Colors.black,
+ ),
+ ),
+ ),
+ GestureDetector(
+ onTap: () {
+ // Navigator.of(context).pushNamed('/router/union_detail_page',
+ // arguments: {"id": store.id});
+ if (store.posType.code == "NORMALSTORE") {
+ Scan.toScan(
+ context,
+ store.id,
+ store.tenantCode,
+ store.storeName,
+ );
+ } else {
+ Navigator.of(context).pushNamed(
+ '/router/store_order',
+ arguments: {
+ "id": store.id,
+ "tenant": store.tenantCode,
+ "storeName": store.storeName
+ },
+ );
+ }
+ },
+ child: Text(
+ S.of(context).chakan,
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.medium,
+ color: Color(0xff32A060),
+ ),
+ ),
+ ),
+ Icon(
+ Icons.chevron_right,
+ color: Color(0xff32A060),
+ size: 16,
+ ),
+ ],
+ ),
+ SizedBox(
+ height: 8.h,
+ ),
+ Row(
+ children: [
+ Text(
+ "${S.of(context).dizhi}: ",
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Color(0xff353535),
+ ),
+ ),
+ Expanded(
+ child: Text(
+ store.address,
+ overflow: TextOverflow.ellipsis,
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Color(0xff353535),
+ ),
+ ),
+ flex: 1,
+ )
+ ],
+ ),
+ SizedBox(
+ height: 4.h,
+ ),
+ Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.center,
+ children: [
+ Expanded(
+ flex: 1,
+ child: Text(
+ S.of(context).yingyeshijian((store.openStartTime == null &&
+ store.openEndTime == null)
+ ? S.of(context).quantian
+ : "${store.openStartTime.substring(0, store.openStartTime.lastIndexOf(":"))} - ${store.openEndTime.substring(0, store.openEndTime.lastIndexOf(":"))}"),
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Color(0xff353535),
+ ),
+ ),
+ ),
+ Text(
+ (store.distance ?? 0) > 1000
+ ? S.of(context).gongli(
+ ((store.distance ?? 0) / 1000 * 100).toInt() / 100.0)
+ : S
+ .of(context)
+ .mi(((store.distance ?? 0) * 100).toInt() / 100.0),
+ style: TextStyle(
+ fontSize: 12.sp,
+ fontWeight: MyFontWeight.regular,
+ color: Color(0xff868686),
+ ),
+ ),
+ ],
+ ),
+ ],
+ ),
+ );
+ }
+}
diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart
index 7642dfc6..3d58ad02 100644
--- a/lib/mine/mine_view/mine_item.dart
+++ b/lib/mine/mine_view/mine_item.dart
@@ -1,6 +1,5 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
-import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/login_tips_dialog.dart';
@@ -182,7 +181,7 @@ class _MineItem extends State {
});
},
child: mineItem(
- S.of(context).dianpuyue,
+ "店铺充值",
"assets/image/shop_yue.webp",
),
),),
@@ -224,7 +223,7 @@ class _MineItem extends State {
],
),
SizedBox(height: 12.h,),
- if(isShowMore)
+ // if(isShowMore)
Row(
children: [
///我的砍价
@@ -323,9 +322,9 @@ class _MineItem extends State {
// ),),
],
),
- if(isShowMore)
+ // if(isShowMore)
SizedBox(height: 12.h,),
- if(isShowMore)
+ // if(isShowMore)
Row(
children: [
////发票管理
@@ -354,38 +353,39 @@ class _MineItem extends State {
Expanded(child:Container(),),
],
),
- GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () {
- setState(() {
- isShowMore = !isShowMore;
- });
- },
- child: Container(
- margin: EdgeInsets.symmetric(vertical: 10),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisSize: MainAxisSize.max,
- children: [
- Text(
- (isShowMore != null && !isShowMore)?S.of(context).zhankai: S.of(context).shouqi,
- style: TextStyle(
- fontSize: 12.sp,
- fontWeight: MyFontWeight.regular,
- color: Color(0xFF32A060),
- ),
- ),
- Icon(
- (isShowMore != null && !isShowMore)
- ? Icons.keyboard_arrow_down
- : Icons.keyboard_arrow_up,
- color: Color(0xFF32A060),
- size: 18,
- ),
- ],
- ),),
- )
+ ///收起展开
+ // GestureDetector(
+ // behavior: HitTestBehavior.opaque,
+ // onTap: () {
+ // setState(() {
+ // isShowMore = !isShowMore;
+ // });
+ // },
+ // child: Container(
+ // margin: EdgeInsets.symmetric(vertical: 10),
+ // child: Row(
+ // mainAxisAlignment: MainAxisAlignment.center,
+ // crossAxisAlignment: CrossAxisAlignment.center,
+ // mainAxisSize: MainAxisSize.max,
+ // children: [
+ // Text(
+ // (isShowMore != null && !isShowMore)?S.of(context).zhankai: S.of(context).shouqi,
+ // style: TextStyle(
+ // fontSize: 12.sp,
+ // fontWeight: MyFontWeight.regular,
+ // color: Color(0xFF32A060),
+ // ),
+ // ),
+ // Icon(
+ // (isShowMore != null && !isShowMore)
+ // ? Icons.keyboard_arrow_down
+ // : Icons.keyboard_arrow_up,
+ // color: Color(0xFF32A060),
+ // size: 18,
+ // ),
+ // ],
+ // ),),
+ // )
],
),
);
diff --git a/lib/mine/mine_view/mine_navbar.dart b/lib/mine/mine_view/mine_navbar.dart
index 263332ca..0308eba6 100644
--- a/lib/mine/mine_view/mine_navbar.dart
+++ b/lib/mine/mine_view/mine_navbar.dart
@@ -175,14 +175,14 @@ class _MineNavbar extends State {
Expanded(
child: InkWell(
onTap: () {
- SharedPreferences.getInstance().then((value) {
- if (value.getString("token") == null ||
- value.getString("token") == "") {
- LoginTipsDialog().show(context);
- return;
- }
- widget.toIntegralPage();
- });
+ // SharedPreferences.getInstance().then((value) {
+ // if (value.getString("token") == null ||
+ // value.getString("token") == "") {
+ // LoginTipsDialog().show(context);
+ // return;
+ // }
+ // widget.toIntegralPage();
+ // });
},
child: mineBottomItem(
widget?.userInfo?.points?? "0",
diff --git a/lib/mine/mine_view/mine_view.dart b/lib/mine/mine_view/mine_view.dart
index 2c46c8f7..92f153ac 100644
--- a/lib/mine/mine_view/mine_view.dart
+++ b/lib/mine/mine_view/mine_view.dart
@@ -373,55 +373,56 @@ class _MineView extends State {
),
),
),
- widget.userInfo == null
- ? Container(
- alignment: Alignment.center,
- height: 50.h,
- child: Icon(
- Icons.keyboard_arrow_right,
- size: 20,
- color: Colors.black,
- ),
- )
- : Container(
- alignment: Alignment.bottomRight,
- height: 50.h,
- child: GestureDetector(
- onTap: () {
- widget.toIntegralPage();
- },
- child: Container(
- padding: EdgeInsets.only(
- top: 4.h, bottom: 4.h, right: 16.w, left: 7.w),
- margin: EdgeInsets.only(right: 14.w),
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(12),
- color: Colors.white),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.end,
- children: [
- Image.asset(
- "assets/image/icon_gold_coin.webp",
- width: 16,
- height: 16,
- ),
- Text(
- S.of(context).tiantianlingjifen,
- style: TextStyle(
- color: Color(0xFF32A060),
- fontSize: 12.sp,
- fontWeight: MyFontWeight.regular,
- ),
- ),
- // Icon(
- // Icons.keyboard_arrow_right,
- // size: 16,
- // color: Colors.black,
- // )
- ],
- ),
- )),
- ),
+ ///应运营需求暂时关闭积分板块
+ // widget.userInfo == null
+ // ? Container(
+ // alignment: Alignment.center,
+ // height: 50.h,
+ // child: Icon(
+ // Icons.keyboard_arrow_right,
+ // size: 20,
+ // color: Colors.black,
+ // ),
+ // )
+ // : Container(
+ // alignment: Alignment.bottomRight,
+ // height: 50.h,
+ // child: GestureDetector(
+ // onTap: () {
+ // widget.toIntegralPage();
+ // },
+ // child: Container(
+ // padding: EdgeInsets.only(
+ // top: 4.h, bottom: 4.h, right: 16.w, left: 7.w),
+ // margin: EdgeInsets.only(right: 14.w),
+ // decoration: BoxDecoration(
+ // borderRadius: BorderRadius.circular(12),
+ // color: Colors.white),
+ // child: Row(
+ // mainAxisAlignment: MainAxisAlignment.end,
+ // children: [
+ // Image.asset(
+ // "assets/image/icon_gold_coin.webp",
+ // width: 16,
+ // height: 16,
+ // ),
+ // Text(
+ // S.of(context).tiantianlingjifen,
+ // style: TextStyle(
+ // color: Color(0xFF32A060),
+ // fontSize: 12.sp,
+ // fontWeight: MyFontWeight.regular,
+ // ),
+ // ),
+ // // Icon(
+ // // Icons.keyboard_arrow_right,
+ // // size: 16,
+ // // color: Colors.black,
+ // // )
+ // ],
+ // ),
+ // )),
+ // ),
],
),
);
diff --git a/lib/mine/mine_vip/mine_attainment_page.dart b/lib/mine/mine_vip/mine_attainment_page.dart
index 71665f2f..c7e1895c 100644
--- a/lib/mine/mine_vip/mine_attainment_page.dart
+++ b/lib/mine/mine_vip/mine_attainment_page.dart
@@ -20,6 +20,8 @@ import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:shared_preferences/shared_preferences.dart';
+import '../../view_widget/no_data_view.dart';
+
class MineAttainmentPage extends StatefulWidget {
final Map arguments;
@@ -41,7 +43,6 @@ class _MineAttainmentPage extends State {
SocialInfo infoNumber;
final RefreshController refreshController = RefreshController();
-
@override
void dispose() {
super.dispose();
@@ -115,7 +116,7 @@ class _MineAttainmentPage extends State {
);
BaseData baseData =
- await apiService.socialInfo().catchError((onError) {});
+ await apiService.socialInfo().catchError((onError) {});
if (baseData != null && baseData.isSuccess) {
setState(() {
infoNumber = baseData.data;
@@ -125,7 +126,7 @@ class _MineAttainmentPage extends State {
EasyLoading.dismiss();
}
- _onRefresh(){
+ _onRefresh() {
queryAttainmentBadges();
querySocialInfo();
}
@@ -140,151 +141,162 @@ class _MineAttainmentPage extends State {
),
),
child: Scaffold(
- backgroundColor: Colors.transparent,
- appBar: MyAppBar(
- title:S.of(context).wodechengjiu,
- titleColor: Colors.black,
- titleSize: 18.sp,
- background: Colors.transparent,
- leadingColor: Colors.black,
- ),
- body: SmartRefresher(
- controller: refreshController,
- enablePullDown: true,
- enablePullUp: false,
- header: MyHeader(),
- footer: CustomFooter(
- builder: (context, mode) {
- return MyFooter(mode);
- },
- ),
- onRefresh:(){
- setState(() {
- _onRefresh();
- });
+ backgroundColor: Colors.transparent,
+ appBar: MyAppBar(
+ title: S.of(context).wodechengjiu,
+ titleColor: Colors.black,
+ titleSize: 18.sp,
+ background: Colors.transparent,
+ leadingColor: Colors.black,
+ ),
+ body: SmartRefresher(
+ controller: refreshController,
+ enablePullDown: true,
+ enablePullUp: false,
+ header: MyHeader(),
+ footer: CustomFooter(
+ builder: (context, mode) {
+ return MyFooter(mode);
},
- physics: BouncingScrollPhysics(),
- child: Container(
- child:
- SingleChildScrollView(
- physics: BouncingScrollPhysics(),
- child: Column(
- children: [
- SizedBox(height: 24),
- MImage(
- userInfo?.headimg ?? "",
- isCircle: true,
- width: 58,
- height: 58,
- fit: BoxFit.cover,
- errorSrc: "assets/image/default_user.webp",
- fadeSrc: "assets/image/default_user.webp",
+ ),
+ onRefresh: () {
+ setState(() {
+ _onRefresh();
+ });
+ },
+ physics: BouncingScrollPhysics(),
+ child: Container(
+ child: SingleChildScrollView(
+ physics: BouncingScrollPhysics(),
+ child: Column(
+ children: [
+ SizedBox(height: 24),
+ MImage(
+ userInfo?.headimg ?? "",
+ isCircle: true,
+ width: 58,
+ height: 58,
+ fit: BoxFit.cover,
+ errorSrc: "assets/image/default_user.webp",
+ fadeSrc: "assets/image/default_user.webp",
+ ),
+ SizedBox(height: 8),
+ Text(
+ userInfo?.nickname ?? S.of(context).denglu,
+ style: TextStyle(
+ fontSize: 16.sp,
+ fontWeight: FontWeight.bold,
+ color: Color(0xFF353535),
),
- SizedBox(height: 8),
- Text(
- userInfo?.nickname ?? S.of(context).denglu,
- style: TextStyle(
- fontSize: 16.sp,
- fontWeight: FontWeight.bold,
- color: Color(0xFF353535),
- ),
+ ),
+ SizedBox(height: 28),
+ Container(
+ margin: EdgeInsets.only(
+ left: 16, right: 16, top: 26, bottom: 8),
+ padding: EdgeInsets.all(20),
+ decoration: BoxDecoration(
+ color: Colors.white,
+ boxShadow: [
+ BoxShadow(
+ color: Colors.black.withAlpha(12),
+ offset: Offset(0, 3),
+ blurRadius: 14,
+ spreadRadius: 0,
+ )
+ ],
+ borderRadius: BorderRadius.all(Radius.circular(8)),
),
- SizedBox(height: 28),
- Container(
- margin:
- EdgeInsets.only(left: 16, right: 16, top: 26, bottom: 8),
- padding: EdgeInsets.all(20),
- decoration: BoxDecoration(
- color: Colors.white,
- boxShadow: [
- BoxShadow(
- color: Colors.black.withAlpha(12),
- offset: Offset(0, 3),
- blurRadius: 14,
- spreadRadius: 0,
- )
- ],
- borderRadius: BorderRadius.all(Radius.circular(8)),
- ),
- child: Column(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- children: [
- Text(
- S.of(context).chengjiuhuizhang,
- style: TextStyle(
- fontWeight: MyFontWeight.medium,
- fontSize: 14.sp,
- color: Color(0xFF353535)),
- ),
- SizedBox(width: 4),
- Text(
- "(",
- style: TextStyle(
- fontWeight: MyFontWeight.medium,
- fontSize: 14,
- color: Color(0xFF353535)),
- ),
- Text(
- infoNumber != null ? infoNumber.achievementNumber.toString() :"0",
- style: TextStyle(
- fontWeight: MyFontWeight.medium,
- fontSize: 14,
- color: Color(0xFF32A060)),
- ),
- Text(
- "/${vipBadgesList.length})",
- style: TextStyle(
- fontWeight: MyFontWeight.medium,
- fontSize: 14,
- color: Color(0xFF353535)),
- ),
- ],
- ),
- SizedBox(height: 12),
- attainmentBadge(),
- ],
- ),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Row(
+ children: [
+ Text(
+ S.of(context).chengjiuhuizhang,
+ style: TextStyle(
+ fontWeight: MyFontWeight.medium,
+ fontSize: 14.sp,
+ color: Color(0xFF353535)),
+ ),
+ SizedBox(width: 4),
+ Text(
+ "(",
+ style: TextStyle(
+ fontWeight: MyFontWeight.medium,
+ fontSize: 14,
+ color: Color(0xFF353535)),
+ ),
+ Text(
+ infoNumber != null
+ ? infoNumber.achievementNumber.toString()
+ : "0",
+ style: TextStyle(
+ fontWeight: MyFontWeight.medium,
+ fontSize: 14,
+ color: Color(0xFF32A060)),
+ ),
+ Text(
+ "/${vipBadgesList.length})",
+ style: TextStyle(
+ fontWeight: MyFontWeight.medium,
+ fontSize: 14,
+ color: Color(0xFF353535)),
+ ),
+ ],
+ ),
+ SizedBox(height: 12),
+ attainmentBadge(),
+ ],
),
- ],
- ),
+ ),
+ ],
),
),
- ),),
+ ),
+ ),
+ ),
);
}
///成就徽章列表
Widget attainmentBadge() {
- return GridView.builder(
- itemCount: vipBadgesList == null ? 0 : vipBadgesList.length,
- shrinkWrap: true,
- physics: NeverScrollableScrollPhysics(),
- gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
- //一行的Widget数量
- crossAxisCount: 3,
- //水平子Widget之间间距
- crossAxisSpacing: 13,
- //垂直子Widget之间间距
- mainAxisSpacing: 12,
- //子Widget宽高比例
- childAspectRatio: AppUtils.textScale(context) > 1
- ? (1 - ((AppUtils.textScale(context) - 1)))
- : 0.85,
- ),
- itemBuilder: (context, index) {
- return GestureDetector(
- onTap: () {
- setState(() {
- queryAchievementDetail(index);
- });
- },
- child: badgeItem(vipBadgesList[index]),
- );
- },
- );
+ return (vipBadgesList != null && (vipBadgesList?.length ?? 0) > 0)
+ ? GridView.builder(
+ itemCount: vipBadgesList == null ? 0 : vipBadgesList.length,
+ shrinkWrap: true,
+ physics: NeverScrollableScrollPhysics(),
+ gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
+ //一行的Widget数量
+ crossAxisCount: 3,
+ //水平子Widget之间间距
+ crossAxisSpacing: 13,
+ //垂直子Widget之间间距
+ mainAxisSpacing: 12,
+ //子Widget宽高比例
+ childAspectRatio: AppUtils.textScale(context) > 1
+ ? (1 - ((AppUtils.textScale(context) - 1)))
+ : 0.85,
+ ),
+ itemBuilder: (context, index) {
+ return GestureDetector(
+ onTap: () {
+ setState(() {
+ queryAchievementDetail(index);
+ });
+ },
+ child: badgeItem(vipBadgesList[index]),
+ );
+ },
+ )
+ : NoDataView(
+ src: "assets/image/xiao_fei.webp",
+ isShowBtn: false,
+ text: "当前暂无成就徽章~",
+ fontSize: 16.sp,
+ margin: EdgeInsets.only(left: 60.w, right: 60.w),
+ );
+ ;
}
Widget badgeItem(VipBadgesList vipBadgesList) {
@@ -358,7 +370,7 @@ class _MineAttainmentPage extends State {
),
SizedBox(height: 10),
Text(
- "${vipBadgesList.length >index ?vipBadgesList[index].name :""}${achievementDetail.length > checkPosition ?achievementDetail[checkPosition].name:""}徽章",
+ "${vipBadgesList.length > index ? vipBadgesList[index].name : ""}${achievementDetail.length > checkPosition ? achievementDetail[checkPosition].name : ""}徽章",
style: TextStyle(
fontSize: 16.sp,
fontWeight: MyFontWeight.semi_bold,
@@ -369,7 +381,7 @@ class _MineAttainmentPage extends State {
height: 6.h,
),
Text(
- "再${vipBadgesList.length >index ? vipBadgesList[index].name :""} ${AppUtils.calculateDouble(double.tryParse(achievementDetail.length > checkPosition ?achievementDetail[checkPosition].lessScore :"") ?? 0)} 即可升级",
+ "再${vipBadgesList.length > index ? vipBadgesList[index].name : ""} ${AppUtils.calculateDouble(double.tryParse(achievementDetail.length > checkPosition ? achievementDetail[checkPosition].lessScore : "") ?? 0)} 即可升级",
style: TextStyle(
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
@@ -392,27 +404,29 @@ class _MineAttainmentPage extends State {
),
SizedBox(width: 8),
Column(
- crossAxisAlignment:CrossAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children:
- achievementDetail[checkPosition].rewardList != null
- ? achievementDetail[checkPosition].rewardList.map((e) {
- return Text(
- rewardStr(e),
- style: TextStyle(
- fontWeight: MyFontWeight.regular,
- fontSize: 12.sp,
- color: Color(0xFF515151)),
- );
- }).toList()
- : [],
+ achievementDetail[checkPosition].rewardList != null
+ ? achievementDetail[checkPosition]
+ .rewardList
+ .map((e) {
+ return Text(
+ rewardStr(e),
+ style: TextStyle(
+ fontWeight: MyFontWeight.regular,
+ fontSize: 12.sp,
+ color: Color(0xFF515151)),
+ );
+ }).toList()
+ : [],
),
],
),
Expanded(
child: Container(
height: double.maxFinite,
- margin: EdgeInsets.only(top:14),
+ margin: EdgeInsets.only(top: 14),
child: ListView.builder(
shrinkWrap: true,
scrollDirection: Axis.horizontal,
@@ -443,12 +457,12 @@ class _MineAttainmentPage extends State {
);
}
- String rewardStr(RewardList rewardList){
- if(rewardList.rewardType == 1)
+ String rewardStr(RewardList rewardList) {
+ if (rewardList.rewardType == 1)
return "积分:${rewardList.refId}";
- else if(rewardList.rewardType == 2)
+ else if (rewardList.rewardType == 2)
return "平台余额:${rewardList.refId}";
- else if(rewardList.rewardType == 3)
+ else if (rewardList.rewardType == 3)
return "平台兑换券:${rewardList.couponName}";
return "";
}
diff --git a/lib/mine/recharge_page.dart b/lib/mine/recharge_page.dart
index 31b82e0e..5f946c78 100644
--- a/lib/mine/recharge_page.dart
+++ b/lib/mine/recharge_page.dart
@@ -19,9 +19,14 @@ import 'package:huixiang/utils/min.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/my_appbar.dart';
import 'package:huixiang/view_widget/recharge_details_dialog.dart';
+import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:tobias/tobias.dart' as tobias;
+import '../view_widget/classic_header.dart';
+import '../view_widget/my_footer.dart';
+import '../view_widget/no_data_view.dart';
+
class RechargePage extends StatefulWidget {
@override
State createState() {
@@ -43,19 +48,13 @@ class _RechargePage extends State {
RechargeActLists rechargeActLists;
int selectStoreIndex = 0;
String recommendName;
+ final RefreshController refreshController = RefreshController();
+ int _loadCount = 0;
@override
void initState() {
super.initState();
-
- SharedPreferences.getInstance().then((value) {
- apiService = ApiService(Dio(),
- context: context, token: value.getString("token"), pay: true);
- queryBenefitList();
- queryRuleDetails();
- queryRechargeActList();
- queryUserBalance();
- });
+ _onRefresh();
payListen = weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}");
if (event.errCode == 0) {
@@ -77,10 +76,10 @@ class _RechargePage extends State {
///会员权益列表
queryBenefitList() async {
- BaseData> baseData =
- await apiService.benefitList().catchError((onError) {});
- if (baseData != null && baseData.isSuccess) {
- setState(() {
+ try {
+ BaseData> baseData =
+ await apiService.benefitList().catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
vipBenefitList.clear();
vipBenefitList.addAll(baseData.data);
vipBenefitList.forEach((element) {
@@ -90,51 +89,77 @@ class _RechargePage extends State {
discount = double.parse(element.config);
}
});
- });
+ }
+ } finally {
+ addLoadCount();
}
- EasyLoading.dismiss();
}
queryUserBalance() async {
- BaseData baseData =
- await apiService.queryInfo().catchError((onError) {});
- if (baseData != null && baseData.isSuccess) {
- userInfo = baseData.data;
- mBalance = userInfo?.money ?? "0";
- if (mounted) setState(() {});
+ try {
+ BaseData baseData =
+ await apiService.queryInfo().catchError((onError) {
+ SmartDialog.showToast(AppUtils.dioErrorTypeToString(onError.type),
+ alignment: Alignment.center);
+ refreshController.refreshFailed();
+ refreshController.loadFailed();
+ });
+ if (baseData != null && baseData.isSuccess) {
+ userInfo = baseData.data;
+ mBalance = userInfo?.money ?? "0";
+ }
+ } finally {
+ addLoadCount();
}
}
///会员权益介绍/规则/说明/储值说明
queryRuleDetails() async {
- BaseData baseData =
- await apiService.vipBenefit().catchError((onError) {});
- if (baseData != null && baseData.isSuccess) {
- setState(() {
+ try {
+ BaseData baseData =
+ await apiService.vipBenefit().catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
vipRuleDetails = baseData.data;
- });
+ }
+ } finally {
+ addLoadCount();
}
- EasyLoading.dismiss();
}
///充值列表
queryRechargeActList() async {
- if (apiService == null) {
- SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(
- Dio(),
- context: context,
- token: value.getString("token"),
- );
- }
- BaseData baseData =
- await apiService.rechargeActList().catchError((onError) {});
- if (baseData != null && baseData.isSuccess) {
- setState(() {
+ try {
+ BaseData baseData =
+ await apiService.rechargeActList("admin").catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
rechargeActLists = baseData.data;
- });
+ }
+ } finally {
+ addLoadCount();
+ }
+ }
+
+ _onRefresh() async {
+ EasyLoading.show(
+ status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
+ SharedPreferences value = await SharedPreferences.getInstance();
+ if (apiService == null)
+ apiService = ApiService(Dio(),
+ context: context, token: value.getString("token"), pay: true);
+ queryBenefitList();
+ queryRuleDetails();
+ queryRechargeActList();
+ queryUserBalance();
+ }
+
+ addLoadCount() {
+ _loadCount += 1;
+ if (_loadCount == 4) {
+ _loadCount = 0;
+ EasyLoading.dismiss();
+ if (refreshController.isRefresh) refreshController.refreshCompleted();
+ if (mounted) setState(() {});
}
- EasyLoading.dismiss();
}
@override
@@ -148,415 +173,423 @@ class _RechargePage extends State {
leadingColor: Colors.black,
),
body: Container(
- color: Color(0xFFFFFFFF),
- child: SingleChildScrollView(
- child: Container(
- child: Stack(
- children: [
- Column(
+ color: Color(0xFFFFFFFF),
+ child: SmartRefresher(
+ enablePullDown: true,
+ enablePullUp: false,
+ header: MyHeader(),
+ footer: CustomFooter(
+ builder: (context, mode) {
+ return MyFooter(mode);
+ },
+ ),
+ controller: refreshController,
+ onRefresh: _onRefresh,
+ physics: BouncingScrollPhysics(),
+ child: SingleChildScrollView(
+ physics: BouncingScrollPhysics(),
+ child: Container(
+ child: Column(
children: [
- SingleChildScrollView(
- physics: BouncingScrollPhysics(),
- child: Container(
+ Container(
+ margin: EdgeInsets.only(left: 16, right: 16),
child: Column(
+ crossAxisAlignment: CrossAxisAlignment.start,
+ mainAxisAlignment: MainAxisAlignment.start,
children: [
- Container(
- margin: EdgeInsets.only(left: 16, right: 16),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- // ItemInputWidget(
- // S.of(context).qingshuruchongzhijine,
- // hintText: "",
- // controller: controller,
- // padding: EdgeInsets.all(20),
- // errorText: S.of(context).chongzhizuixiaojine(100),
- // titleColor: Color(0xFF727272),
- // errorTextColor: Color(0xFF32A060),
- // radius: 8,
- // discount: discount / 10,
- // style: TextStyle(
- // fontWeight: FontWeight.bold,
- // fontSize: 27.sp,
- // color: color,
- // ),
- // inputLimit: 6,
- // textInputType: TextInputType.number,
- // textInputFormatter:
- // FilteringTextInputFormatter.digitsOnly,
- // onChanged: (value) {
- // if (value != null &&
- // value != "" &&
- // double.tryParse(value) < 100) {
- // color = Colors.red;
- // } else {
- // color = Colors.black;
- // }
- // setState(() {});
- // },
- // ),
- SizedBox(
- height: 20,
+ // ItemInputWidget(
+ // S.of(context).qingshuruchongzhijine,
+ // hintText: "",
+ // controller: controller,
+ // padding: EdgeInsets.all(20),
+ // errorText: S.of(context).chongzhizuixiaojine(100),
+ // titleColor: Color(0xFF727272),
+ // errorTextColor: Color(0xFF32A060),
+ // radius: 8,
+ // discount: discount / 10,
+ // style: TextStyle(
+ // fontWeight: FontWeight.bold,
+ // fontSize: 27.sp,
+ // color: color,
+ // ),
+ // inputLimit: 6,
+ // textInputType: TextInputType.number,
+ // textInputFormatter:
+ // FilteringTextInputFormatter.digitsOnly,
+ // onChanged: (value) {
+ // if (value != null &&
+ // value != "" &&
+ // double.tryParse(value) < 100) {
+ // color = Colors.red;
+ // } else {
+ // color = Colors.black;
+ // }
+ // setState(() {});
+ // },
+ // ),
+ SizedBox(
+ height: 20,
+ ),
+ Row(
+ children: [
+ Expanded(
+ child: Text(
+ S.of(context).zhanghuyue,
+ style: TextStyle(
+ fontSize: 15.sp,
+ color: Color(0xFF181818),
+ fontFamily: 'JDZhengHT',
+ fontWeight: MyFontWeight.semi_bold),
+ )),
+ Text.rich(
+ TextSpan(children: [
+ TextSpan(
+ text: "$mBalance",
+ style: TextStyle(
+ fontSize: 26.sp,
+ fontFamily: 'JDZhengHT',
+ color: Color(0xFF181818),
+ fontWeight: MyFontWeight.semi_bold),
),
- Row(
- children: [
- Expanded(
- child: Text(
- S.of(context).zhanghuyue,
- style: TextStyle(
- fontSize: 15.sp,
- color: Color(0xFF181818),
- fontFamily: 'JDZhengHT',
- fontWeight:
- MyFontWeight.semi_bold),
- )),
- Text.rich(
- TextSpan(children: [
- TextSpan(
- text: "$mBalance",
- style: TextStyle(
- fontSize: 26.sp,
- fontFamily: 'JDZhengHT',
- color: Color(0xFF181818),
- fontWeight:
- MyFontWeight.semi_bold),
- ),
- TextSpan(
- text: "元",
- style: TextStyle(
- fontSize: 15.sp,
- color: Color(0xFF181818),
- fontWeight:
- MyFontWeight.semi_bold),
- ),
- ]),
- ),
- ],
+ TextSpan(
+ text: "元",
+ style: TextStyle(
+ fontSize: 15.sp,
+ color: Color(0xFF181818),
+ fontWeight: MyFontWeight.semi_bold),
),
- SizedBox(height: 28),
- rechargeList(),
- // Row(
- // crossAxisAlignment: CrossAxisAlignment.start,
- // mainAxisAlignment: MainAxisAlignment.spaceAround,
- // children: [
- // if (vipRuleDetails?.recharge != null &&
- // vipRuleDetails.recharge != "")
- // Expanded(
- // child: Container(
- // color: Colors.white,
- // child: Html(
- // data: "注意:${vipRuleDetails?.recharge ?? ""}",
- // customImageRenders: {
- // networkSourceMatcher(): networkImageRender(
- // loadingWidget: () {
- // return Container();
- // },
- // ),
- // },
- // ),
- // ),
- // )
- // ],
- // ),
- ],
- )),
- Container(
- width: double.infinity,
- margin: EdgeInsets.only(left: 16, right: 16),
- padding: EdgeInsets.only(
- top: 20.h,
- bottom: 24.h,
+ ]),
+ ),
+ ],
+ ),
+ SizedBox(height: 28),
+ rechargeList(),
+ // Row(
+ // crossAxisAlignment: CrossAxisAlignment.start,
+ // mainAxisAlignment: MainAxisAlignment.spaceAround,
+ // children: [
+ // if (vipRuleDetails?.recharge != null &&
+ // vipRuleDetails.recharge != "")
+ // Expanded(
+ // child: Container(
+ // color: Colors.white,
+ // child: Html(
+ // data: "注意:${vipRuleDetails?.recharge ?? ""}",
+ // customImageRenders: {
+ // networkSourceMatcher(): networkImageRender(
+ // loadingWidget: () {
+ // return Container();
+ // },
+ // ),
+ // },
+ // ),
+ // ),
+ // )
+ // ],
+ // ),
+ ],
+ )),
+ if (rechargeActLists != null &&
+ (rechargeActLists?.preferentialList?.length ?? 0) > 0)
+ Container(
+ width: double.infinity,
+ margin: EdgeInsets.only(left: 16, right: 16),
+ padding: EdgeInsets.only(
+ top: 20.h,
+ bottom: 24.h,
+ ),
+ // decoration: BoxDecoration(
+ // color: Colors.white,
+ // borderRadius: BorderRadius.circular(4),
+ // ),
+ child: Column(
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Padding(
+ padding: EdgeInsets.only(bottom: 16.h),
+ child: Text(
+ S.of(context).zhifufangshi,
+ style: TextStyle(
+ fontSize: 16.sp,
+ color: Colors.black,
+ fontWeight: FontWeight.bold,
+ ),
),
- // decoration: BoxDecoration(
- // color: Colors.white,
- // borderRadius: BorderRadius.circular(4),
- // ),
- child: Column(
- mainAxisAlignment:
- MainAxisAlignment.spaceAround,
+ ),
+ GestureDetector(
+ behavior: HitTestBehavior.opaque,
+ onTap: () {
+ setState(() {
+ checkIndex = 2;
+ });
+ },
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
- Padding(
- padding: EdgeInsets.only(bottom: 16.h),
- child: Text(
- S.of(context).zhifufangshi,
- style: TextStyle(
- fontSize: 16.sp,
- color: Colors.black,
- fontWeight: FontWeight.bold,
- ),
- ),
- ),
- GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () {
- setState(() {
- checkIndex = 2;
- });
- },
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.start,
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: [
- Image.asset(
- "assets/image/icon_we_chat.webp"),
- Expanded(
- flex: 1,
- child: Padding(
- padding: EdgeInsets.only(left: 8.w),
- child: Text(
- S.of(context).weixinzhifu,
- style: TextStyle(
- fontSize: 14.sp,
- color: Color(0xff353535),
- ),
- ),
- ),
- ),
- checkView(2),
- ],
- ),
- ),
- SizedBox(height: 10.h),
- GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () {
- setState(() {
- checkIndex = 3;
- });
- },
- child: Row(
- mainAxisAlignment:
- MainAxisAlignment.start,
- crossAxisAlignment:
- CrossAxisAlignment.start,
- children: [
- Image.asset(
- "assets/image/icon_alipay.webp"),
- Expanded(
- flex: 1,
- child: Padding(
- padding: EdgeInsets.only(left: 8.w),
- child: Text(
- S.of(context).zhifubao,
- style: TextStyle(
- fontSize: 14.sp,
- color: Color(0xff353535),
- ),
- ),
- ),
+ Image.asset("assets/image/icon_we_chat.webp"),
+ Expanded(
+ flex: 1,
+ child: Padding(
+ padding: EdgeInsets.only(left: 8.w),
+ child: Text(
+ S.of(context).weixinzhifu,
+ style: TextStyle(
+ fontSize: 14.sp,
+ color: Color(0xff353535),
),
- checkView(3),
- ],
+ ),
),
),
+ checkView(2),
],
),
),
- if((rechargeActLists?.isOpen ?? false) == true)
+ SizedBox(height: 10.h),
GestureDetector(
+ behavior: HitTestBehavior.opaque,
onTap: () {
- showRecommendStore();
+ setState(() {
+ checkIndex = 3;
+ });
},
- child: Container(
- padding: EdgeInsets.only(
- left: 14.w,
- right: 16.w,
- top: 14.h,
- bottom: 14.h),
- margin: EdgeInsets.only(
- bottom: 22.h, left: 14.w, right: 14.w),
- decoration: BoxDecoration(
- color: Color(0xFFFAFAFA),
- borderRadius: BorderRadius.circular(4),
- ),
- child: Row(
- children: [
- Image.asset(
- "assets/image/recharge_z.webp",
- width: 16.w,
- height: 17.h,
- fit: BoxFit.fill,
- ),
- SizedBox(width: 8.w),
- Expanded(
- child: Text(
- recommendName ??"为喜爱门店打call!(可选)",
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.start,
+ crossAxisAlignment: CrossAxisAlignment.start,
+ children: [
+ Image.asset("assets/image/icon_alipay.webp"),
+ Expanded(
+ flex: 1,
+ child: Padding(
+ padding: EdgeInsets.only(left: 8.w),
+ child: Text(
+ S.of(context).zhifubao,
style: TextStyle(
- fontWeight: MyFontWeight.regular,
- fontSize: 12.sp,
- color: (recommendName != null) ?Color(0xFF32A060):Color(0xFF868686),
+ fontSize: 14.sp,
+ color: Color(0xff353535),
),
- )),
- Icon(
- Icons.arrow_forward_ios,
- size: 16,
),
- ],
- )),
- ),
- Align(
- alignment: Alignment.bottomCenter,
- child: GestureDetector(
- onTap: () {
- recharge();
- },
- child: Container(
- height: 56.h,
- width: double.infinity,
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: Color(0xFF32A060),
- borderRadius: BorderRadius.circular(27),
- ),
- margin: EdgeInsets.only(
- left: 16, right: 16, bottom: 21),
- child: Text(
- S.of(context).querenchongzhi,
- style: TextStyle(
- fontSize: 16.sp,
- fontWeight: MyFontWeight.medium,
- color: Colors.white,
),
),
- ),
+ checkView(3),
+ ],
),
-
- // Container(
- // height: 56.h,
- // color: Colors.white,
- // child: Row(
- // children: [
- // Expanded(child:Container(
- // padding:EdgeInsets.only(top: 7.h,left:16),
- // child:Column(
- // crossAxisAlignment: CrossAxisAlignment.start,
- // children: [
- // Row(
- // children: [
- // Text(
- // S.of(context).heji,
- // style: TextStyle(
- // fontSize: 14.sp,
- // fontWeight: MyFontWeight.regular,
- // color: Colors.black,
- // ),
- // ),
- // Text(
- // controller.text,
- // style: TextStyle(
- // fontSize: 16.sp,
- // fontWeight: MyFontWeight.medium,
- // color: Color(0xFF32A060),
- // ),
- // ),
- // ],
- // ),
- // if(controller.text != "")
- // Text.rich(
- // TextSpan(
- // children: [
- // TextSpan(
- // text: "充值",
- // style: TextStyle(
- // fontSize:12.sp,
- // fontWeight: MyFontWeight.regular,
- // color: Color(0xFFADADAD),
- // ),
- // ),
- // TextSpan(
- // text:"¥${controller.text}",
- // style: TextStyle(
- // fontSize: 12.sp,
- // fontWeight: MyFontWeight.regular,
- // color:Color(0xff3541C9),
- // ),
- // ),
- // TextSpan(
- // text: "赠送",
- // style: TextStyle(
- // fontSize:12.sp,
- // fontWeight: MyFontWeight.regular,
- // color: Color(0xFFADADAD),
- // ),
- // ),
- // TextSpan(
- // text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}",
- // style: TextStyle(
- // fontSize: 12.sp,
- // fontWeight: MyFontWeight.regular,
- // color: Color(0xff3541C9),
- // ),
- // ),TextSpan(
- // text: "元",
- // style: TextStyle(
- // fontSize:12.sp,
- // fontWeight: MyFontWeight.regular,
- // color: Color(0xFFADADAD),
- // ),
- // ),
- // ],
- // ),
- // ),
- // ],
- // ))
- // ),
- // GestureDetector(
- // onTap: () {
- // recharge();
- // },
- // child: RoundButton(
- // width: 103.w,
- // height: 54.h,
- // text: S.of(context).chongzhi,
- // textColor: Colors.white,
- // fontWeight: MyFontWeight.regular,
- // backgroup: Color(0xFF32A060),
- // radius: 0,
- // fontSize: 16.sp,
- // padding: EdgeInsets.symmetric(vertical: 5.h),
- // ),
- // ),
- // ],
- // ),
- // )
- )
+ ),
],
),
),
- )
+ if ((rechargeActLists?.isOpen ?? false) == true)
+ GestureDetector(
+ onTap: () {
+ showRecommendStore();
+ },
+ child: Container(
+ padding: EdgeInsets.only(
+ left: 14.w,
+ right: 16.w,
+ top: 14.h,
+ bottom: 14.h),
+ margin: EdgeInsets.only(
+ bottom: 22.h, left: 14.w, right: 14.w),
+ decoration: BoxDecoration(
+ color: Color(0xFFFAFAFA),
+ borderRadius: BorderRadius.circular(4),
+ ),
+ child: Row(
+ children: [
+ Image.asset(
+ "assets/image/recharge_z.webp",
+ width: 16.w,
+ height: 17.h,
+ fit: BoxFit.fill,
+ ),
+ SizedBox(width: 8.w),
+ Expanded(
+ child: Text(
+ recommendName ?? "为喜爱门店打call!(可选)",
+ style: TextStyle(
+ fontWeight: MyFontWeight.regular,
+ fontSize: 12.sp,
+ color: (recommendName != null)
+ ? Color(0xFF32A060)
+ : Color(0xFF868686),
+ ),
+ )),
+ Icon(
+ Icons.arrow_forward_ios,
+ size: 16,
+ ),
+ ],
+ )),
+ ),
+ if (rechargeActLists != null &&
+ (rechargeActLists?.preferentialList?.length ?? 0) > 0)
+ Align(
+ alignment: Alignment.bottomCenter,
+ child: GestureDetector(
+ onTap: () {
+ recharge();
+ },
+ child: Container(
+ height: 56.h,
+ width: double.infinity,
+ alignment: Alignment.center,
+ decoration: BoxDecoration(
+ color: Color(0xFF32A060),
+ borderRadius: BorderRadius.circular(27),
+ ),
+ margin: EdgeInsets.only(
+ left: 16, right: 16, bottom: 21),
+ child: Text(
+ S.of(context).querenchongzhi,
+ style: TextStyle(
+ fontSize: 16.sp,
+ fontWeight: MyFontWeight.medium,
+ color: Colors.white,
+ ),
+ ),
+ ),
+ ),
+ // Container(
+ // height: 56.h,
+ // color: Colors.white,
+ // child: Row(
+ // children: [
+ // Expanded(child:Container(
+ // padding:EdgeInsets.only(top: 7.h,left:16),
+ // child:Column(
+ // crossAxisAlignment: CrossAxisAlignment.start,
+ // children: [
+ // Row(
+ // children: [
+ // Text(
+ // S.of(context).heji,
+ // style: TextStyle(
+ // fontSize: 14.sp,
+ // fontWeight: MyFontWeight.regular,
+ // color: Colors.black,
+ // ),
+ // ),
+ // Text(
+ // controller.text,
+ // style: TextStyle(
+ // fontSize: 16.sp,
+ // fontWeight: MyFontWeight.medium,
+ // color: Color(0xFF32A060),
+ // ),
+ // ),
+ // ],
+ // ),
+ // if(controller.text != "")
+ // Text.rich(
+ // TextSpan(
+ // children: [
+ // TextSpan(
+ // text: "充值",
+ // style: TextStyle(
+ // fontSize:12.sp,
+ // fontWeight: MyFontWeight.regular,
+ // color: Color(0xFFADADAD),
+ // ),
+ // ),
+ // TextSpan(
+ // text:"¥${controller.text}",
+ // style: TextStyle(
+ // fontSize: 12.sp,
+ // fontWeight: MyFontWeight.regular,
+ // color:Color(0xff3541C9),
+ // ),
+ // ),
+ // TextSpan(
+ // text: "赠送",
+ // style: TextStyle(
+ // fontSize:12.sp,
+ // fontWeight: MyFontWeight.regular,
+ // color: Color(0xFFADADAD),
+ // ),
+ // ),
+ // TextSpan(
+ // text:"¥${((double.tryParse(controller.text)??0) - ((double.tryParse(controller.text)??0) * (discount/100))).toStringAsFixed(2)}",
+ // style: TextStyle(
+ // fontSize: 12.sp,
+ // fontWeight: MyFontWeight.regular,
+ // color: Color(0xff3541C9),
+ // ),
+ // ),TextSpan(
+ // text: "元",
+ // style: TextStyle(
+ // fontSize:12.sp,
+ // fontWeight: MyFontWeight.regular,
+ // color: Color(0xFFADADAD),
+ // ),
+ // ),
+ // ],
+ // ),
+ // ),
+ // ],
+ // ))
+ // ),
+ // GestureDetector(
+ // onTap: () {
+ // recharge();
+ // },
+ // child: RoundButton(
+ // width: 103.w,
+ // height: 54.h,
+ // text: S.of(context).chongzhi,
+ // textColor: Colors.white,
+ // fontWeight: MyFontWeight.regular,
+ // backgroup: Color(0xFF32A060),
+ // radius: 0,
+ // fontSize: 16.sp,
+ // padding: EdgeInsets.symmetric(vertical: 5.h),
+ // ),
+ // ),
+ // ],
+ // ),
+ // )
+ )
],
),
- ],
+ ),
),
- ),
- ),
- ),
+ )),
);
}
var checkIndex = 2;
Widget rechargeList() {
- return ListView.builder(
- padding: EdgeInsets.zero,
- itemCount: (rechargeActLists != null && (rechargeActLists?.preferentialList?.length ?? 0) > 0) ? rechargeActLists.preferentialList.length : 0,
- scrollDirection: Axis.vertical,
- shrinkWrap: true,
- physics: BouncingScrollPhysics(),
- itemBuilder: (context, position) {
- return GestureDetector(
- onTap: () {
- setState(() {
- selectIndex = position;
- });
+ return (rechargeActLists != null &&
+ (rechargeActLists?.preferentialList?.length ?? 0) > 0)
+ ? ListView.builder(
+ padding: EdgeInsets.zero,
+ itemCount: (rechargeActLists != null &&
+ (rechargeActLists?.preferentialList?.length ?? 0) > 0)
+ ? rechargeActLists.preferentialList.length
+ : 0,
+ scrollDirection: Axis.vertical,
+ shrinkWrap: true,
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return GestureDetector(
+ onTap: () {
+ setState(() {
+ selectIndex = position;
+ });
+ },
+ child: rechargeItem(
+ rechargeActLists.preferentialList[position], position));
},
- child: rechargeItem(rechargeActLists.preferentialList[position], position));
- },
- );
+ )
+ : NoDataView(
+ src: "assets/image/xiao_fei.webp",
+ isShowBtn: false,
+ text: "暂无充值套餐~",
+ fontSize: 16.sp,
+ margin: EdgeInsets.only(top: 90.h, left: 60.w, right: 60.w),
+ );
}
Widget rechargeItem(PreferentialList preferentialList, index) {
@@ -707,13 +740,13 @@ class _RechargePage extends State {
///选择推荐门店
showRecommendStore() {
showModalBottomSheet(
- context: context,
- backgroundColor: Colors.transparent,
+ context: context,
+ backgroundColor: Colors.transparent,
builder: (BuildContext context) {
return StatefulBuilder(builder: (
- context,
- state,
- ) {
+ context,
+ state,
+ ) {
return Container(
height: 355.h,
decoration: BoxDecoration(
@@ -731,17 +764,17 @@ class _RechargePage extends State {
children: [
Expanded(
child: Container(
- alignment: Alignment.center,
- margin: EdgeInsets.symmetric(vertical: 12),
- child: Text(
- S.of(context).xuanzetuijianmendian,
- style: TextStyle(
- fontWeight: MyFontWeight.bold,
- fontSize: 15.sp,
- color: Color(0xFF353535),
- ),
- ),
- )),
+ alignment: Alignment.center,
+ margin: EdgeInsets.symmetric(vertical: 12),
+ child: Text(
+ S.of(context).xuanzetuijianmendian,
+ style: TextStyle(
+ fontWeight: MyFontWeight.bold,
+ fontSize: 15.sp,
+ color: Color(0xFF353535),
+ ),
+ ),
+ )),
GestureDetector(
onTap: () {
setState(() {
@@ -764,24 +797,24 @@ class _RechargePage extends State {
),
Expanded(
child: ListView.builder(
- physics: BouncingScrollPhysics(),
- itemBuilder: (context, position) {
- return GestureDetector(
- onTap: () {
- state(() {
- selectStoreIndex = position;
- });
- },
- child: recommendStoreItem(position),
- );
+ physics: BouncingScrollPhysics(),
+ itemBuilder: (context, position) {
+ return GestureDetector(
+ onTap: () {
+ state(() {
+ selectStoreIndex = position;
+ });
},
- itemCount: rechargeActLists.channels.length ?? 0,
- )),
+ child: recommendStoreItem(position),
+ );
+ },
+ itemCount: rechargeActLists.channels.length ?? 0,
+ )),
GestureDetector(
onTap: () {
setState(() {
recommendName =
- rechargeActLists.channels[selectStoreIndex];
+ rechargeActLists.channels[selectStoreIndex];
Navigator.of(context).pop();
});
},
@@ -809,7 +842,8 @@ class _RechargePage extends State {
),
);
});
- },);
+ },
+ );
}
Widget recommendStoreItem(index) {
diff --git a/lib/mine/scan_web.dart b/lib/mine/scan_web.dart
index b738be34..acab322e 100644
--- a/lib/mine/scan_web.dart
+++ b/lib/mine/scan_web.dart
@@ -26,7 +26,7 @@ class _ScanWeb extends State {
super.initState();
result = widget.arguments["result"];
title = widget.arguments["title"];
- EasyLoading.show(status: S.current.zhengzaijiazai);
+ EasyLoading.show(status: S.current.zhengzaijiazai,maskType: EasyLoadingMaskType.black);
}
@override
diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart
index 798a9c0b..925720ff 100644
--- a/lib/order/order_detail_page.dart
+++ b/lib/order/order_detail_page.dart
@@ -48,7 +48,7 @@ class _OrderDetailPage extends State {
super.initState();
jumpState = widget.arguments["jumpState"];
SharedPreferences.getInstance().then((value) {
- EasyLoading.show(status: S.of(context).zhengzaijiazai);
+ EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black);
apiService = ApiService(Dio(),
context: context, token: value.getString("token"),);
queryDetails();
diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart
index 9d19d9d0..dedaa653 100644
--- a/lib/order/order_history_page.dart
+++ b/lib/order/order_history_page.dart
@@ -1,5 +1,6 @@
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
+import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/order/order_utils.dart';
@@ -132,57 +133,29 @@ class OrderHistoryList extends StatefulWidget {
class _OrderHistoryList extends State
with AutomaticKeepAliveClientMixin {
final RefreshController refreshController = RefreshController();
-
- @override
- Widget build(BuildContext context) {
- super.build(context);
- return SmartRefresher(
- controller: refreshController,
- enablePullDown: true,
- enablePullUp: true,
- physics: BouncingScrollPhysics(),
- header: MyHeader(),
- footer: CustomFooter(
- builder: (context, mode) {
- return MyFooter(mode);
- },
- ),
- onRefresh: _onRefresh,
- onLoading: queryOrder,
- child: (orderInfos != null && orderInfos.length > 0)
- ? ListView.builder(
- itemCount: orderInfos != null ? orderInfos.length : 0,
- itemBuilder: (context, position) {
- return InkWell(
- onTap: () {
- Navigator.of(context).pushNamed('/router/order_details',
- arguments: {"id": orderInfos[position].id,"jumpState":2});
- },
- child: orderItem(orderInfos[position]),
- );
- })
- : NoDataView(
- src: "assets/image/ding_dan.webp",
- isShowBtn: false,
- text: "目前暂无订单,快去下一单吧~",
- fontSize: 16.sp,
- margin: EdgeInsets.only(top: 120),
- ),
- );
- }
-
bool isRemake = true;
-
ApiService apiService;
int current = 1;
+ List orderInfos = [];
+ UserInfo userInfo;
+ @override
+ void initState() {
+ super.initState();
+ SharedPreferences.getInstance().then((value) => {
+ apiService = ApiService(Dio(),
+ showLoading: true,
+ context: context,
+ token: value.getString("token")),
+ queryOrder(),
+ queryUserBalance(),
+ });
+ }
_onRefresh() {
current = 1;
queryOrder();
}
- List orderInfos = [];
-
queryOrder() async {
BaseData> baseData = await apiService.orderList({
"current": current,
@@ -213,24 +186,173 @@ class _OrderHistoryList extends State
}
setState(() {});
} else {
- SmartDialog.showToast(baseData?.msg ?? "",alignment: Alignment.center);
+ if((baseData?.msg ?? "") != "")
+ SmartDialog.showToast(baseData.msg,alignment: Alignment.center);
refreshController.refreshFailed();
refreshController.loadFailed();
}
}
- @override
- void initState() {
- super.initState();
-
- SharedPreferences.getInstance().then((value) => {
- apiService = ApiService(Dio(),
- showLoading: true,
+ minLogin(OrderInfo orderInfo) {
+ apiService.minLogin(orderInfo.storeId).catchError((onError) {
+ debugPrint(onError);
+ }).then((baseData) {
+ if (baseData != null && baseData.isSuccess) {
+ Map minStoreInfo = baseData.data;
+ String minToken = minStoreInfo["token"];
+ String tenant = orderInfo.tenantCode;
+ String storeId = orderInfo.storeId;
+ SharedPreferences.getInstance().then(
+ (value) => {
+ value.setString('minToken', minToken),
+ value.setString('tenant', tenant),
+ value.setString('storeId', storeId),
+ },
+ );
+ paySelected(
+ orderInfo,
+ MinApiService(
+ Dio(),
context: context,
- token: value.getString("token")),
- queryOrder(),
- queryUserBalance(),
- });
+ token: minToken,
+ tenant: tenant,
+ storeId: storeId,
+ ));
+ }
+ });
+ }
+
+ queryDetails(id) async {
+ if (apiService == null) {
+ SharedPreferences value = await SharedPreferences.getInstance();
+ apiService = ApiService(Dio(),
+ context: context, token: value.getString("token"), showLoading: true);
+ }
+ BaseData baseData =
+ await apiService.orderDetail(id).catchError((error) {});
+ if (baseData != null && baseData.isSuccess) {
+ return baseData.data;
+ }
+ }
+
+ queryUserBalance() async {
+ BaseData baseData =
+ await apiService.queryInfo().catchError((onError) {
+
+ });
+ if (baseData != null && baseData.isSuccess) {
+ userInfo = baseData.data;
+ if (mounted) setState(() {});
+ }else {
+ SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
+ }
+ }
+
+ paySelected(OrderInfo orderInfo, MinApiService minService) async {
+ var payChannel = await showModalBottomSheet(
+ context: context,
+ backgroundColor: Colors.transparent,
+ builder: (context) {
+ return OrderPaySelected(userInfo);
+ },
+ );
+ if (payChannel != null && payChannel > 0) {
+ orderInfo = await queryDetails(orderInfo.id);
+ OrderUtils.carryOnPay(
+ payChannel,
+ minService,
+ orderInfo,
+ (BaseData baseData) {
+ SmartDialog.showToast(
+ baseData?.msg == "ok" ? "订单支付成功" : baseData?.msg,
+ alignment: Alignment.center);
+ Future.delayed(Duration(seconds: 3), () {
+ _onRefresh();
+ });
+ },
+ );
+ }
+ }
+
+ payResult(BaseData baseData) {}
+
+ orderCancel(String orderId) async {
+ BaseData baseData =
+ await apiService.orderCancel(orderId).catchError((onError) {});
+ if (baseData != null && baseData.isSuccess) {
+ SmartDialog.showToast("订单取消成功");
+ _onRefresh();
+ }else{
+ if(baseData.msg != null)
+ SmartDialog.showToast(baseData.msg,alignment: Alignment.center);
+ }
+ }
+
+ aginOrder(OrderInfo orderInfo) {
+ // Navigator.of(context).pushNamed(
+ // '/router/union_detail_page',
+ // arguments: {"id": storeId},
+ // );
+ // String storeId = (orderInfo != null &&
+ // orderInfo.storeVO != null)
+ // ? (orderInfo.storeVO.id ?? "")
+ // : "";
+
+ if (orderInfo.storeVO.posType.code == "NORMALSTORE") {
+ Scan.toScan(
+ context,
+ orderInfo.storeVO.id,
+ orderInfo.tenantCode,
+ orderInfo.storeVO.storeName,
+ );
+ } else {
+ Navigator.of(context).pushNamed(
+ '/router/store_order',
+ arguments: {
+ "id": orderInfo.storeVO.id,
+ "tenant": orderInfo.tenantCode,
+ "storeName": orderInfo.storeVO.storeName
+ },
+ );
+ }
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ super.build(context);
+ return SmartRefresher(
+ controller: refreshController,
+ enablePullDown: true,
+ enablePullUp: true,
+ physics: BouncingScrollPhysics(),
+ header: MyHeader(),
+ footer: CustomFooter(
+ builder: (context, mode) {
+ return MyFooter(mode);
+ },
+ ),
+ onRefresh: _onRefresh,
+ onLoading: queryOrder,
+ child: (orderInfos != null && orderInfos.length > 0)
+ ? ListView.builder(
+ itemCount: orderInfos != null ? orderInfos.length : 0,
+ itemBuilder: (context, position) {
+ return InkWell(
+ onTap: () {
+ Navigator.of(context).pushNamed('/router/order_details',
+ arguments: {"id": orderInfos[position].id,"jumpState":2});
+ },
+ child: orderItem(orderInfos[position]),
+ );
+ })
+ : NoDataView(
+ src: "assets/image/ding_dan.webp",
+ isShowBtn: false,
+ text: "目前暂无订单,快去下一单吧~",
+ fontSize: 16.sp,
+ margin: EdgeInsets.only(top: 120),
+ ),
+ );
}
String orderAllGoods(OrderInfo orderInfo) {
@@ -535,130 +657,6 @@ class _OrderHistoryList extends State
);
}
- minLogin(OrderInfo orderInfo) {
- apiService.minLogin(orderInfo.storeId).catchError((onError) {
- debugPrint(onError);
- }).then((baseData) {
- if (baseData != null && baseData.isSuccess) {
- Map minStoreInfo = baseData.data;
- String minToken = minStoreInfo["token"];
- String tenant = orderInfo.tenantCode;
- String storeId = orderInfo.storeId;
- SharedPreferences.getInstance().then(
- (value) => {
- value.setString('minToken', minToken),
- value.setString('tenant', tenant),
- value.setString('storeId', storeId),
- },
- );
- paySelected(
- orderInfo,
- MinApiService(
- Dio(),
- context: context,
- token: minToken,
- tenant: tenant,
- storeId: storeId,
- ));
- }
- });
- }
-
- queryDetails(id) async {
- if (apiService == null) {
- SharedPreferences value = await SharedPreferences.getInstance();
- apiService = ApiService(Dio(),
- context: context, token: value.getString("token"), showLoading: true);
- }
- BaseData baseData =
- await apiService.orderDetail(id).catchError((error) {});
- if (baseData != null && baseData.isSuccess) {
- return baseData.data;
- }
- }
-
- UserInfo userInfo;
-
- queryUserBalance() async {
- BaseData baseData =
- await apiService.queryInfo().catchError((onError) {});
- if (baseData != null && baseData.isSuccess) {
- userInfo = baseData.data;
- if (mounted) setState(() {});
- }else {
- SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
- }
- }
-
- paySelected(OrderInfo orderInfo, MinApiService minService) async {
- var payChannel = await showModalBottomSheet(
- context: context,
- backgroundColor: Colors.transparent,
- builder: (context) {
- return OrderPaySelected(userInfo);
- },
- );
- if (payChannel != null && payChannel > 0) {
- orderInfo = await queryDetails(orderInfo.id);
- OrderUtils.carryOnPay(
- payChannel,
- minService,
- orderInfo,
- (BaseData baseData) {
- SmartDialog.showToast(
- baseData?.msg == "ok" ? "订单支付成功" : baseData?.msg,
- alignment: Alignment.center);
- Future.delayed(Duration(seconds: 3), () {
- _onRefresh();
- });
- },
- );
- }
- }
-
- payResult(BaseData baseData) {}
-
- orderCancel(String orderId) async {
- BaseData baseData =
- await apiService.orderCancel(orderId).catchError((onError) {});
- if (baseData != null && baseData.isSuccess) {
- SmartDialog.showToast("订单取消成功");
- _onRefresh();
- }else{
- if(baseData.msg != null)
- SmartDialog.showToast(baseData.msg,alignment: Alignment.center);
- }
- }
-
- aginOrder(OrderInfo orderInfo) {
- // Navigator.of(context).pushNamed(
- // '/router/union_detail_page',
- // arguments: {"id": storeId},
- // );
- // String storeId = (orderInfo != null &&
- // orderInfo.storeVO != null)
- // ? (orderInfo.storeVO.id ?? "")
- // : "";
-
- if (orderInfo.storeVO.posType.code == "NORMALSTORE") {
- Scan.toScan(
- context,
- orderInfo.storeVO.id,
- orderInfo.tenantCode,
- orderInfo.storeVO.storeName,
- );
- } else {
- Navigator.of(context).pushNamed(
- '/router/store_order',
- arguments: {
- "id": orderInfo.storeVO.id,
- "tenant": orderInfo.tenantCode,
- "storeName": orderInfo.storeVO.storeName
- },
- );
- }
- }
-
String totalPrice(orderInfo) {
if (orderInfo == null) return "";
double totalPrice = (double.tryParse(orderInfo.orderSum) +
diff --git a/lib/retrofit/data/ip_data.dart b/lib/retrofit/data/ip_data.dart
new file mode 100644
index 00000000..532f1804
--- /dev/null
+++ b/lib/retrofit/data/ip_data.dart
@@ -0,0 +1,105 @@
+/// ip : "27.18.151.119"
+/// pro : "湖北省"
+/// proCode : "420000"
+/// city : "武汉市"
+/// cityCode : "420100"
+/// region : ""
+/// regionCode : "0"
+/// addr : "湖北省武汉市 电信"
+/// regionNames : ""
+/// err : ""
+
+class IpData {
+ IpData({
+ String ip,
+ String pro,
+ String proCode,
+ String city,
+ String cityCode,
+ String region,
+ String regionCode,
+ String addr,
+ String regionNames,
+ String err,}){
+ _ip = ip;
+ _pro = pro;
+ _proCode = proCode;
+ _city = city;
+ _cityCode = cityCode;
+ _region = region;
+ _regionCode = regionCode;
+ _addr = addr;
+ _regionNames = regionNames;
+ _err = err;
+}
+
+ IpData.fromJson(dynamic json) {
+ _ip = json['ip'];
+ _pro = json['pro'];
+ _proCode = json['proCode'];
+ _city = json['city'];
+ _cityCode = json['cityCode'];
+ _region = json['region'];
+ _regionCode = json['regionCode'];
+ _addr = json['addr'];
+ _regionNames = json['regionNames'];
+ _err = json['err'];
+ }
+ String _ip;
+ String _pro;
+ String _proCode;
+ String _city;
+ String _cityCode;
+ String _region;
+ String _regionCode;
+ String _addr;
+ String _regionNames;
+ String _err;
+IpData copyWith({ String ip,
+ String pro,
+ String proCode,
+ String city,
+ String cityCode,
+ String region,
+ String regionCode,
+ String addr,
+ String regionNames,
+ String err,
+}) => IpData( ip: ip ?? _ip,
+ pro: pro ?? _pro,
+ proCode: proCode ?? _proCode,
+ city: city ?? _city,
+ cityCode: cityCode ?? _cityCode,
+ region: region ?? _region,
+ regionCode: regionCode ?? _regionCode,
+ addr: addr ?? _addr,
+ regionNames: regionNames ?? _regionNames,
+ err: err ?? _err,
+);
+ String get ip => _ip;
+ String get pro => _pro;
+ String get proCode => _proCode;
+ String get city => _city;
+ String get cityCode => _cityCode;
+ String get region => _region;
+ String get regionCode => _regionCode;
+ String get addr => _addr;
+ String get regionNames => _regionNames;
+ String get err => _err;
+
+ Map toJson() {
+ final map = {};
+ map['ip'] = _ip;
+ map['pro'] = _pro;
+ map['proCode'] = _proCode;
+ map['city'] = _city;
+ map['cityCode'] = _cityCode;
+ map['region'] = _region;
+ map['regionCode'] = _regionCode;
+ map['addr'] = _addr;
+ map['regionNames'] = _regionNames;
+ map['err'] = _err;
+ return map;
+ }
+
+}
\ No newline at end of file
diff --git a/lib/retrofit/data/member_recharge_list.dart b/lib/retrofit/data/member_recharge_list.dart
new file mode 100644
index 00000000..0fa2db51
--- /dev/null
+++ b/lib/retrofit/data/member_recharge_list.dart
@@ -0,0 +1,159 @@
+/// id : "1681490552371019776"
+/// rechargeMoney : "100.00"
+/// giftdMoney : "10.00"
+/// limitNum : 0
+/// gitfdCouponId : null
+/// startDate : null
+/// endDate : null
+/// startTime : null
+/// endTime : null
+/// tenantCode : "1175"
+/// createTime : "2023-07-21 09:22:53"
+/// isDeleted : 0
+/// rechargeType : 0
+/// remark : "充值100.00 赠送10.00"
+/// sortValue : 0
+/// useNum : 0
+
+class MemberRechargeList {
+ MemberRechargeList({
+ String id,
+ String rechargeMoney,
+ String giftdMoney,
+ dynamic limitNum,
+ dynamic gitfdCouponId,
+ dynamic startDate,
+ dynamic endDate,
+ dynamic startTime,
+ dynamic endTime,
+ String tenantCode,
+ String createTime,
+ num isDeleted,
+ num rechargeType,
+ String remark,
+ num sortValue,
+ dynamic useNum,}){
+ _id = id;
+ _rechargeMoney = rechargeMoney;
+ _giftdMoney = giftdMoney;
+ _limitNum = limitNum;
+ _gitfdCouponId = gitfdCouponId;
+ _startDate = startDate;
+ _endDate = endDate;
+ _startTime = startTime;
+ _endTime = endTime;
+ _tenantCode = tenantCode;
+ _createTime = createTime;
+ _isDeleted = isDeleted;
+ _rechargeType = rechargeType;
+ _remark = remark;
+ _sortValue = sortValue;
+ _useNum = useNum;
+}
+
+ MemberRechargeList.fromJson(dynamic json) {
+ _id = json['id'];
+ _rechargeMoney = json['rechargeMoney'];
+ _giftdMoney = json['giftdMoney'];
+ _limitNum = json['limitNum'];
+ _gitfdCouponId = json['gitfdCouponId'];
+ _startDate = json['startDate'];
+ _endDate = json['endDate'];
+ _startTime = json['startTime'];
+ _endTime = json['endTime'];
+ _tenantCode = json['tenantCode'];
+ _createTime = json['createTime'];
+ _isDeleted = json['isDeleted'];
+ _rechargeType = json['rechargeType'];
+ _remark = json['remark'];
+ _sortValue = json['sortValue'];
+ _useNum = json['useNum'];
+ }
+ String _id;
+ String _rechargeMoney;
+ String _giftdMoney;
+ dynamic _limitNum;
+ dynamic _gitfdCouponId;
+ dynamic _startDate;
+ dynamic _endDate;
+ dynamic _startTime;
+ dynamic _endTime;
+ String _tenantCode;
+ String _createTime;
+ num _isDeleted;
+ num _rechargeType;
+ String _remark;
+ num _sortValue;
+ dynamic _useNum;
+MemberRechargeList copyWith({ String id,
+ String rechargeMoney,
+ String giftdMoney,
+ dynamic limitNum,
+ dynamic gitfdCouponId,
+ dynamic startDate,
+ dynamic endDate,
+ dynamic startTime,
+ dynamic endTime,
+ String tenantCode,
+ String createTime,
+ num isDeleted,
+ num rechargeType,
+ String remark,
+ num sortValue,
+ dynamic useNum,
+}) => MemberRechargeList( id: id ?? _id,
+ rechargeMoney: rechargeMoney ?? _rechargeMoney,
+ giftdMoney: giftdMoney ?? _giftdMoney,
+ limitNum: limitNum ?? _limitNum,
+ gitfdCouponId: gitfdCouponId ?? _gitfdCouponId,
+ startDate: startDate ?? _startDate,
+ endDate: endDate ?? _endDate,
+ startTime: startTime ?? _startTime,
+ endTime: endTime ?? _endTime,
+ tenantCode: tenantCode ?? _tenantCode,
+ createTime: createTime ?? _createTime,
+ isDeleted: isDeleted ?? _isDeleted,
+ rechargeType: rechargeType ?? _rechargeType,
+ remark: remark ?? _remark,
+ sortValue: sortValue ?? _sortValue,
+ useNum: useNum ?? _useNum,
+);
+ String get id => _id;
+ String get rechargeMoney => _rechargeMoney;
+ String get giftdMoney => _giftdMoney;
+ dynamic get limitNum => _limitNum;
+ dynamic get gitfdCouponId => _gitfdCouponId;
+ dynamic get startDate => _startDate;
+ dynamic get endDate => _endDate;
+ dynamic get startTime => _startTime;
+ dynamic get endTime => _endTime;
+ String get tenantCode => _tenantCode;
+ String get createTime => _createTime;
+ num get isDeleted => _isDeleted;
+ num get rechargeType => _rechargeType;
+ String get remark => _remark;
+ num get sortValue => _sortValue;
+ dynamic get useNum => _useNum;
+
+ Map toJson() {
+ final map = {};
+ map['id'] = _id;
+ map['rechargeMoney'] = _rechargeMoney;
+ map['giftdMoney'] = _giftdMoney;
+ map['limitNum'] = _limitNum;
+ map['gitfdCouponId'] = _gitfdCouponId;
+ map['startDate'] = _startDate;
+ map['endDate'] = _endDate;
+ map['startTime'] = _startTime;
+ map['endTime'] = _endTime;
+ map['tenantCode'] = _tenantCode;
+ map['createTime'] = _createTime;
+ map['isDeleted'] = _isDeleted;
+ map['rechargeType'] = _rechargeType;
+ map['remark'] = _remark;
+ map['sortValue'] = _sortValue;
+ map['useNum'] = _useNum;
+ return map;
+ }
+
+}
\ No newline at end of file
diff --git a/lib/retrofit/data/product_show.dart b/lib/retrofit/data/product_show.dart
new file mode 100644
index 00000000..c4774b6b
--- /dev/null
+++ b/lib/retrofit/data/product_show.dart
@@ -0,0 +1,749 @@
+/// id : "1484156758195699712"
+/// createTime : "2022-01-20 21:32:00"
+/// createUser : "1364043181062094848"
+/// updateTime : "2022-01-21 18:27:02"
+/// updateUser : "1364043181062094848"
+/// supplierName : "一心回乡生态农场"
+/// storeId : "1460885296764682240"
+/// categoryId : "1460889654206136320"
+/// groupId : "1484146679266410496"
+/// shortName : "【一心回乡】三益米 筋道绵润、鲜稻尝鲜;自留种老品种,非转基因种子"
+/// productName : "三益米1kg"
+/// sellDesc : ""
+/// productCode : "PRO202201202132000000000000001"
+/// weight : "0"
+/// applyPrice : "39.00"
+/// price : "24.00"
+/// vipPrice : null
+/// stock : -13
+/// sellCount : 19
+/// needLogistics : 1
+/// oversold : 1
+/// organic : 0
+/// status : 1
+/// posShow : true
+/// subscribeParam : null
+/// isRaise : false
+/// productType : 0
+/// productNumber : 1
+/// setMeal : 1
+/// attrStyle : 0
+/// detail : ""
+/// isDelete : 0
+/// printerFlag : "DEFAULT"
+/// materials : null
+/// materialId : null
+/// details : ""
+/// thumbnailImg : ""
+/// info : ""
+/// buyCount : 12
+/// sellCountLimit : 0
+/// stockRecoveryTime : null
+/// isAddPurchase : null
+/// limitNum : 0
+/// rankId : "0"
+/// happyBean : 0
+/// imgs : ["https://pos.upload.lotus-wallet.com/1179/2022/01/243f54db-2dc8-4a9b-9ccc-09fc7a4e2a2e.jpg"]
+/// productSkuList : [{"id":"1484156758229254144","createTime":"2022-01-20 21:32:00","createUser":"1364043181062094848","updateTime":"2022-01-20 21:32:00","updateUser":"1364043181062094848","storeId":"1460885296764682240","skuCode":"P202201202132002","skuNameStr":"","productId":"1484156758195699712","skuPrice":"24.00","applyPrice":"39.00","vipPrice":"24.00","packagingFee":"0.00","skuImg":null,"skuStock":-13,"autoRenewSkuStock":0,"deliveries":0,"ticketType":"","ticketWipedTimeTemplateId":null,"takeType":null,"ticketDays":"0","ticketExpireTime":"23:59:59","sort":50,"setMeal":"","productSetMeals":null,"weight":0.0,"volume":0.0,"isDelete":0,"material":null,"version":0,"skuTickets":null,"ticketStyle":""}]
+
+class ProductShow {
+ ProductShow({
+ String id,
+ String createTime,
+ String createUser,
+ String updateTime,
+ String updateUser,
+ String supplierName,
+ String storeId,
+ String categoryId,
+ String groupId,
+ String shortName,
+ String productName,
+ String sellDesc,
+ String productCode,
+ String weight,
+ String applyPrice,
+ String price,
+ dynamic vipPrice,
+ num stock,
+ num sellCount,
+ num needLogistics,
+ num oversold,
+ num organic,
+ num status,
+ bool posShow,
+ dynamic subscribeParam,
+ bool isRaise,
+ num productType,
+ num productNumber,
+ num setMeal,
+ num attrStyle,
+ String detail,
+ num isDelete,
+ String printerFlag,
+ dynamic materials,
+ dynamic materialId,
+ String details,
+ String thumbnailImg,
+ String info,
+ num buyCount,
+ num sellCountLimit,
+ dynamic stockRecoveryTime,
+ dynamic isAddPurchase,
+ num limitNum,
+ String rankId,
+ num happyBean,
+ List imgs,
+ List productSkuList,}){
+ _id = id;
+ _createTime = createTime;
+ _createUser = createUser;
+ _updateTime = updateTime;
+ _updateUser = updateUser;
+ _supplierName = supplierName;
+ _storeId = storeId;
+ _categoryId = categoryId;
+ _groupId = groupId;
+ _shortName = shortName;
+ _productName = productName;
+ _sellDesc = sellDesc;
+ _productCode = productCode;
+ _weight = weight;
+ _applyPrice = applyPrice;
+ _price = price;
+ _vipPrice = vipPrice;
+ _stock = stock;
+ _sellCount = sellCount;
+ _needLogistics = needLogistics;
+ _oversold = oversold;
+ _organic = organic;
+ _status = status;
+ _posShow = posShow;
+ _subscribeParam = subscribeParam;
+ _isRaise = isRaise;
+ _productType = productType;
+ _productNumber = productNumber;
+ _setMeal = setMeal;
+ _attrStyle = attrStyle;
+ _detail = detail;
+ _isDelete = isDelete;
+ _printerFlag = printerFlag;
+ _materials = materials;
+ _materialId = materialId;
+ _details = details;
+ _thumbnailImg = thumbnailImg;
+ _info = info;
+ _buyCount = buyCount;
+ _sellCountLimit = sellCountLimit;
+ _stockRecoveryTime = stockRecoveryTime;
+ _isAddPurchase = isAddPurchase;
+ _limitNum = limitNum;
+ _rankId = rankId;
+ _happyBean = happyBean;
+ _imgs = imgs;
+ _productSkuList = productSkuList;
+}
+
+ ProductShow.fromJson(dynamic json) {
+ _id = json['id'];
+ _createTime = json['createTime'];
+ _createUser = json['createUser'];
+ _updateTime = json['updateTime'];
+ _updateUser = json['updateUser'];
+ _supplierName = json['supplierName'];
+ _storeId = json['storeId'];
+ _categoryId = json['categoryId'];
+ _groupId = json['groupId'];
+ _shortName = json['shortName'];
+ _productName = json['productName'];
+ _sellDesc = json['sellDesc'];
+ _productCode = json['productCode'];
+ _weight = json['weight'];
+ _applyPrice = json['applyPrice'];
+ _price = json['price'];
+ _vipPrice = json['vipPrice'];
+ _stock = json['stock'];
+ _sellCount = json['sellCount'];
+ _needLogistics = json['needLogistics'];
+ _oversold = json['oversold'];
+ _organic = json['organic'];
+ _status = json['status'];
+ _posShow = json['posShow'];
+ _subscribeParam = json['subscribeParam'];
+ _isRaise = json['isRaise'];
+ _productType = json['productType'];
+ _productNumber = json['productNumber'];
+ _setMeal = json['setMeal'];
+ _attrStyle = json['attrStyle'];
+ _detail = json['detail'];
+ _isDelete = json['isDelete'];
+ _printerFlag = json['printerFlag'];
+ _materials = json['materials'];
+ _materialId = json['materialId'];
+ _details = json['details'];
+ _thumbnailImg = json['thumbnailImg'];
+ _info = json['info'];
+ _buyCount = json['buyCount'];
+ _sellCountLimit = json['sellCountLimit'];
+ _stockRecoveryTime = json['stockRecoveryTime'];
+ _isAddPurchase = json['isAddPurchase'];
+ _limitNum = json['limitNum'];
+ _rankId = json['rankId'];
+ _happyBean = json['happyBean'];
+ _imgs = json['imgs'] != null ? json['imgs'].cast() : [];
+ if (json['productSkuList'] != null) {
+ _productSkuList = [];
+ json['productSkuList'].forEach((v) {
+ _productSkuList.add(ProductSkuList.fromJson(v));
+ });
+ }
+ }
+ String _id;
+ String _createTime;
+ String _createUser;
+ String _updateTime;
+ String _updateUser;
+ String _supplierName;
+ String _storeId;
+ String _categoryId;
+ String _groupId;
+ String _shortName;
+ String _productName;
+ String _sellDesc;
+ String _productCode;
+ String _weight;
+ String _applyPrice;
+ String _price;
+ dynamic _vipPrice;
+ num _stock;
+ num _sellCount;
+ num _needLogistics;
+ num _oversold;
+ num _organic;
+ num _status;
+ bool _posShow;
+ dynamic _subscribeParam;
+ bool _isRaise;
+ num _productType;
+ num _productNumber;
+ num _setMeal;
+ num _attrStyle;
+ String _detail;
+ num _isDelete;
+ String _printerFlag;
+ dynamic _materials;
+ dynamic _materialId;
+ String _details;
+ String _thumbnailImg;
+ String _info;
+ num _buyCount;
+ num _sellCountLimit;
+ dynamic _stockRecoveryTime;
+ dynamic _isAddPurchase;
+ num _limitNum;
+ String _rankId;
+ num _happyBean;
+ List _imgs;
+ List _productSkuList;
+ProductShow copyWith({ String id,
+ String createTime,
+ String createUser,
+ String updateTime,
+ String updateUser,
+ String supplierName,
+ String storeId,
+ String categoryId,
+ String groupId,
+ String shortName,
+ String productName,
+ String sellDesc,
+ String productCode,
+ String weight,
+ String applyPrice,
+ String price,
+ dynamic vipPrice,
+ num stock,
+ num sellCount,
+ num needLogistics,
+ num oversold,
+ num organic,
+ num status,
+ bool posShow,
+ dynamic subscribeParam,
+ bool isRaise,
+ num productType,
+ num productNumber,
+ num setMeal,
+ num attrStyle,
+ String detail,
+ num isDelete,
+ String printerFlag,
+ dynamic materials,
+ dynamic materialId,
+ String details,
+ String thumbnailImg,
+ String info,
+ num buyCount,
+ num sellCountLimit,
+ dynamic stockRecoveryTime,
+ dynamic isAddPurchase,
+ num limitNum,
+ String rankId,
+ num happyBean,
+ List imgs,
+ List productSkuList,
+}) => ProductShow( id: id ?? _id,
+ createTime: createTime ?? _createTime,
+ createUser: createUser ?? _createUser,
+ updateTime: updateTime ?? _updateTime,
+ updateUser: updateUser ?? _updateUser,
+ supplierName: supplierName ?? _supplierName,
+ storeId: storeId ?? _storeId,
+ categoryId: categoryId ?? _categoryId,
+ groupId: groupId ?? _groupId,
+ shortName: shortName ?? _shortName,
+ productName: productName ?? _productName,
+ sellDesc: sellDesc ?? _sellDesc,
+ productCode: productCode ?? _productCode,
+ weight: weight ?? _weight,
+ applyPrice: applyPrice ?? _applyPrice,
+ price: price ?? _price,
+ vipPrice: vipPrice ?? _vipPrice,
+ stock: stock ?? _stock,
+ sellCount: sellCount ?? _sellCount,
+ needLogistics: needLogistics ?? _needLogistics,
+ oversold: oversold ?? _oversold,
+ organic: organic ?? _organic,
+ status: status ?? _status,
+ posShow: posShow ?? _posShow,
+ subscribeParam: subscribeParam ?? _subscribeParam,
+ isRaise: isRaise ?? _isRaise,
+ productType: productType ?? _productType,
+ productNumber: productNumber ?? _productNumber,
+ setMeal: setMeal ?? _setMeal,
+ attrStyle: attrStyle ?? _attrStyle,
+ detail: detail ?? _detail,
+ isDelete: isDelete ?? _isDelete,
+ printerFlag: printerFlag ?? _printerFlag,
+ materials: materials ?? _materials,
+ materialId: materialId ?? _materialId,
+ details: details ?? _details,
+ thumbnailImg: thumbnailImg ?? _thumbnailImg,
+ info: info ?? _info,
+ buyCount: buyCount ?? _buyCount,
+ sellCountLimit: sellCountLimit ?? _sellCountLimit,
+ stockRecoveryTime: stockRecoveryTime ?? _stockRecoveryTime,
+ isAddPurchase: isAddPurchase ?? _isAddPurchase,
+ limitNum: limitNum ?? _limitNum,
+ rankId: rankId ?? _rankId,
+ happyBean: happyBean ?? _happyBean,
+ imgs: imgs ?? _imgs,
+ productSkuList: productSkuList ?? _productSkuList,
+);
+ String get id => _id;
+ String get createTime => _createTime;
+ String get createUser => _createUser;
+ String get updateTime => _updateTime;
+ String get updateUser => _updateUser;
+ String get supplierName => _supplierName;
+ String get storeId => _storeId;
+ String get categoryId => _categoryId;
+ String get groupId => _groupId;
+ String get shortName => _shortName;
+ String get productName => _productName;
+ String get sellDesc => _sellDesc;
+ String get productCode => _productCode;
+ String get weight => _weight;
+ String get applyPrice => _applyPrice;
+ String get price => _price;
+ dynamic get vipPrice => _vipPrice;
+ num get stock => _stock;
+ num get sellCount => _sellCount;
+ num get needLogistics => _needLogistics;
+ num get oversold => _oversold;
+ num get organic => _organic;
+ num get status => _status;
+ bool get posShow => _posShow;
+ dynamic get subscribeParam => _subscribeParam;
+ bool get isRaise => _isRaise;
+ num get productType => _productType;
+ num get productNumber => _productNumber;
+ num get setMeal => _setMeal;
+ num get attrStyle => _attrStyle;
+ String get detail => _detail;
+ num get isDelete => _isDelete;
+ String get printerFlag => _printerFlag;
+ dynamic get materials => _materials;
+ dynamic get materialId => _materialId;
+ String get details => _details;
+ String get thumbnailImg => _thumbnailImg;
+ String get info => _info;
+ num get buyCount => _buyCount;
+ num get sellCountLimit => _sellCountLimit;
+ dynamic get stockRecoveryTime => _stockRecoveryTime;
+ dynamic get isAddPurchase => _isAddPurchase;
+ num get limitNum => _limitNum;
+ String get rankId => _rankId;
+ num get happyBean => _happyBean;
+ List get imgs => _imgs;
+ List get productSkuList => _productSkuList;
+
+ Map toJson() {
+ final map = {};
+ map['id'] = _id;
+ map['createTime'] = _createTime;
+ map['createUser'] = _createUser;
+ map['updateTime'] = _updateTime;
+ map['updateUser'] = _updateUser;
+ map['supplierName'] = _supplierName;
+ map['storeId'] = _storeId;
+ map['categoryId'] = _categoryId;
+ map['groupId'] = _groupId;
+ map['shortName'] = _shortName;
+ map['productName'] = _productName;
+ map['sellDesc'] = _sellDesc;
+ map['productCode'] = _productCode;
+ map['weight'] = _weight;
+ map['applyPrice'] = _applyPrice;
+ map['price'] = _price;
+ map['vipPrice'] = _vipPrice;
+ map['stock'] = _stock;
+ map['sellCount'] = _sellCount;
+ map['needLogistics'] = _needLogistics;
+ map['oversold'] = _oversold;
+ map['organic'] = _organic;
+ map['status'] = _status;
+ map['posShow'] = _posShow;
+ map['subscribeParam'] = _subscribeParam;
+ map['isRaise'] = _isRaise;
+ map['productType'] = _productType;
+ map['productNumber'] = _productNumber;
+ map['setMeal'] = _setMeal;
+ map['attrStyle'] = _attrStyle;
+ map['detail'] = _detail;
+ map['isDelete'] = _isDelete;
+ map['printerFlag'] = _printerFlag;
+ map['materials'] = _materials;
+ map['materialId'] = _materialId;
+ map['details'] = _details;
+ map['thumbnailImg'] = _thumbnailImg;
+ map['info'] = _info;
+ map['buyCount'] = _buyCount;
+ map['sellCountLimit'] = _sellCountLimit;
+ map['stockRecoveryTime'] = _stockRecoveryTime;
+ map['isAddPurchase'] = _isAddPurchase;
+ map['limitNum'] = _limitNum;
+ map['rankId'] = _rankId;
+ map['happyBean'] = _happyBean;
+ map['imgs'] = _imgs;
+ if (_productSkuList != null) {
+ map['productSkuList'] = _productSkuList.map((v) => v.toJson()).toList();
+ }
+ return map;
+ }
+
+}
+
+/// id : "1484156758229254144"
+/// createTime : "2022-01-20 21:32:00"
+/// createUser : "1364043181062094848"
+/// updateTime : "2022-01-20 21:32:00"
+/// updateUser : "1364043181062094848"
+/// storeId : "1460885296764682240"
+/// skuCode : "P202201202132002"
+/// skuNameStr : ""
+/// productId : "1484156758195699712"
+/// skuPrice : "24.00"
+/// applyPrice : "39.00"
+/// vipPrice : "24.00"
+/// packagingFee : "0.00"
+/// skuImg : null
+/// skuStock : -13
+/// autoRenewSkuStock : 0
+/// deliveries : 0
+/// ticketType : ""
+/// ticketWipedTimeTemplateId : null
+/// takeType : null
+/// ticketDays : "0"
+/// ticketExpireTime : "23:59:59"
+/// sort : 50
+/// setMeal : ""
+/// productSetMeals : null
+/// weight : 0.0
+/// volume : 0.0
+/// isDelete : 0
+/// material : null
+/// version : 0
+/// skuTickets : null
+/// ticketStyle : ""
+
+class ProductSkuList {
+ ProductSkuList({
+ String id,
+ String createTime,
+ String createUser,
+ String updateTime,
+ String updateUser,
+ String storeId,
+ String skuCode,
+ String skuNameStr,
+ String productId,
+ String skuPrice,
+ String applyPrice,
+ String vipPrice,
+ String packagingFee,
+ dynamic skuImg,
+ num skuStock,
+ num autoRenewSkuStock,
+ num deliveries,
+ String ticketType,
+ dynamic ticketWipedTimeTemplateId,
+ dynamic takeType,
+ String ticketDays,
+ String ticketExpireTime,
+ num sort,
+ String setMeal,
+ dynamic productSetMeals,
+ num weight,
+ num volume,
+ num isDelete,
+ dynamic material,
+ num version,
+ dynamic skuTickets,
+ String ticketStyle,}){
+ _id = id;
+ _createTime = createTime;
+ _createUser = createUser;
+ _updateTime = updateTime;
+ _updateUser = updateUser;
+ _storeId = storeId;
+ _skuCode = skuCode;
+ _skuNameStr = skuNameStr;
+ _productId = productId;
+ _skuPrice = skuPrice;
+ _applyPrice = applyPrice;
+ _vipPrice = vipPrice;
+ _packagingFee = packagingFee;
+ _skuImg = skuImg;
+ _skuStock = skuStock;
+ _autoRenewSkuStock = autoRenewSkuStock;
+ _deliveries = deliveries;
+ _ticketType = ticketType;
+ _ticketWipedTimeTemplateId = ticketWipedTimeTemplateId;
+ _takeType = takeType;
+ _ticketDays = ticketDays;
+ _ticketExpireTime = ticketExpireTime;
+ _sort = sort;
+ _setMeal = setMeal;
+ _productSetMeals = productSetMeals;
+ _weight = weight;
+ _volume = volume;
+ _isDelete = isDelete;
+ _material = material;
+ _version = version;
+ _skuTickets = skuTickets;
+ _ticketStyle = ticketStyle;
+}
+
+ ProductSkuList.fromJson(dynamic json) {
+ _id = json['id'];
+ _createTime = json['createTime'];
+ _createUser = json['createUser'];
+ _updateTime = json['updateTime'];
+ _updateUser = json['updateUser'];
+ _storeId = json['storeId'];
+ _skuCode = json['skuCode'];
+ _skuNameStr = json['skuNameStr'];
+ _productId = json['productId'];
+ _skuPrice = json['skuPrice'];
+ _applyPrice = json['applyPrice'];
+ _vipPrice = json['vipPrice'];
+ _packagingFee = json['packagingFee'];
+ _skuImg = json['skuImg'];
+ _skuStock = json['skuStock'];
+ _autoRenewSkuStock = json['autoRenewSkuStock'];
+ _deliveries = json['deliveries'];
+ _ticketType = json['ticketType'];
+ _ticketWipedTimeTemplateId = json['ticketWipedTimeTemplateId'];
+ _takeType = json['takeType'];
+ _ticketDays = json['ticketDays'];
+ _ticketExpireTime = json['ticketExpireTime'];
+ _sort = json['sort'];
+ _setMeal = json['setMeal'];
+ _productSetMeals = json['productSetMeals'];
+ _weight = json['weight'];
+ _volume = json['volume'];
+ _isDelete = json['isDelete'];
+ _material = json['material'];
+ _version = json['version'];
+ _skuTickets = json['skuTickets'];
+ _ticketStyle = json['ticketStyle'];
+ }
+ String _id;
+ String _createTime;
+ String _createUser;
+ String _updateTime;
+ String _updateUser;
+ String _storeId;
+ String _skuCode;
+ String _skuNameStr;
+ String _productId;
+ String _skuPrice;
+ String _applyPrice;
+ String _vipPrice;
+ String _packagingFee;
+ dynamic _skuImg;
+ num _skuStock;
+ num _autoRenewSkuStock;
+ num _deliveries;
+ String _ticketType;
+ dynamic _ticketWipedTimeTemplateId;
+ dynamic _takeType;
+ String _ticketDays;
+ String _ticketExpireTime;
+ num _sort;
+ String _setMeal;
+ dynamic _productSetMeals;
+ num _weight;
+ num _volume;
+ num _isDelete;
+ dynamic _material;
+ num _version;
+ dynamic _skuTickets;
+ String _ticketStyle;
+ProductSkuList copyWith({ String id,
+ String createTime,
+ String createUser,
+ String updateTime,
+ String updateUser,
+ String storeId,
+ String skuCode,
+ String skuNameStr,
+ String productId,
+ String skuPrice,
+ String applyPrice,
+ String vipPrice,
+ String packagingFee,
+ dynamic skuImg,
+ num skuStock,
+ num autoRenewSkuStock,
+ num deliveries,
+ String ticketType,
+ dynamic ticketWipedTimeTemplateId,
+ dynamic takeType,
+ String ticketDays,
+ String ticketExpireTime,
+ num sort,
+ String setMeal,
+ dynamic productSetMeals,
+ num weight,
+ num volume,
+ num isDelete,
+ dynamic material,
+ num version,
+ dynamic skuTickets,
+ String ticketStyle,
+}) => ProductSkuList( id: id ?? _id,
+ createTime: createTime ?? _createTime,
+ createUser: createUser ?? _createUser,
+ updateTime: updateTime ?? _updateTime,
+ updateUser: updateUser ?? _updateUser,
+ storeId: storeId ?? _storeId,
+ skuCode: skuCode ?? _skuCode,
+ skuNameStr: skuNameStr ?? _skuNameStr,
+ productId: productId ?? _productId,
+ skuPrice: skuPrice ?? _skuPrice,
+ applyPrice: applyPrice ?? _applyPrice,
+ vipPrice: vipPrice ?? _vipPrice,
+ packagingFee: packagingFee ?? _packagingFee,
+ skuImg: skuImg ?? _skuImg,
+ skuStock: skuStock ?? _skuStock,
+ autoRenewSkuStock: autoRenewSkuStock ?? _autoRenewSkuStock,
+ deliveries: deliveries ?? _deliveries,
+ ticketType: ticketType ?? _ticketType,
+ ticketWipedTimeTemplateId: ticketWipedTimeTemplateId ?? _ticketWipedTimeTemplateId,
+ takeType: takeType ?? _takeType,
+ ticketDays: ticketDays ?? _ticketDays,
+ ticketExpireTime: ticketExpireTime ?? _ticketExpireTime,
+ sort: sort ?? _sort,
+ setMeal: setMeal ?? _setMeal,
+ productSetMeals: productSetMeals ?? _productSetMeals,
+ weight: weight ?? _weight,
+ volume: volume ?? _volume,
+ isDelete: isDelete ?? _isDelete,
+ material: material ?? _material,
+ version: version ?? _version,
+ skuTickets: skuTickets ?? _skuTickets,
+ ticketStyle: ticketStyle ?? _ticketStyle,
+);
+ String get id => _id;
+ String get createTime => _createTime;
+ String get createUser => _createUser;
+ String get updateTime => _updateTime;
+ String get updateUser => _updateUser;
+ String get storeId => _storeId;
+ String get skuCode => _skuCode;
+ String get skuNameStr => _skuNameStr;
+ String get productId => _productId;
+ String get skuPrice => _skuPrice;
+ String get applyPrice => _applyPrice;
+ String get vipPrice => _vipPrice;
+ String get packagingFee => _packagingFee;
+ dynamic get skuImg => _skuImg;
+ num get skuStock => _skuStock;
+ num get autoRenewSkuStock => _autoRenewSkuStock;
+ num get deliveries => _deliveries;
+ String get ticketType => _ticketType;
+ dynamic get ticketWipedTimeTemplateId => _ticketWipedTimeTemplateId;
+ dynamic get takeType => _takeType;
+ String get ticketDays => _ticketDays;
+ String get ticketExpireTime => _ticketExpireTime;
+ num get sort => _sort;
+ String get setMeal => _setMeal;
+ dynamic get productSetMeals => _productSetMeals;
+ num get weight => _weight;
+ num get volume => _volume;
+ num get isDelete => _isDelete;
+ dynamic get material => _material;
+ num get version => _version;
+ dynamic get skuTickets => _skuTickets;
+ String get ticketStyle => _ticketStyle;
+
+ Map toJson() {
+ final map = {};
+ map['id'] = _id;
+ map['createTime'] = _createTime;
+ map['createUser'] = _createUser;
+ map['updateTime'] = _updateTime;
+ map['updateUser'] = _updateUser;
+ map['storeId'] = _storeId;
+ map['skuCode'] = _skuCode;
+ map['skuNameStr'] = _skuNameStr;
+ map['productId'] = _productId;
+ map['skuPrice'] = _skuPrice;
+ map['applyPrice'] = _applyPrice;
+ map['vipPrice'] = _vipPrice;
+ map['packagingFee'] = _packagingFee;
+ map['skuImg'] = _skuImg;
+ map['skuStock'] = _skuStock;
+ map['autoRenewSkuStock'] = _autoRenewSkuStock;
+ map['deliveries'] = _deliveries;
+ map['ticketType'] = _ticketType;
+ map['ticketWipedTimeTemplateId'] = _ticketWipedTimeTemplateId;
+ map['takeType'] = _takeType;
+ map['ticketDays'] = _ticketDays;
+ map['ticketExpireTime'] = _ticketExpireTime;
+ map['sort'] = _sort;
+ map['setMeal'] = _setMeal;
+ map['productSetMeals'] = _productSetMeals;
+ map['weight'] = _weight;
+ map['volume'] = _volume;
+ map['isDelete'] = _isDelete;
+ map['material'] = _material;
+ map['version'] = _version;
+ map['skuTickets'] = _skuTickets;
+ map['ticketStyle'] = _ticketStyle;
+ return map;
+ }
+
+}
\ No newline at end of file
diff --git a/lib/retrofit/data/store.dart b/lib/retrofit/data/store.dart
index 1dd45b68..e94cc87a 100644
--- a/lib/retrofit/data/store.dart
+++ b/lib/retrofit/data/store.dart
@@ -1,8 +1,7 @@
-
import 'package:huixiang/retrofit/data/coupon_vo.dart';
+import 'package:huixiang/retrofit/data/product_show.dart';
import 'package:huixiang/retrofit/data/store_type.dart';
-
class Store {
Store();
@@ -38,81 +37,94 @@ class Store {
CouponVo couponVO;
dynamic deliveryInfo;
String businessType;
+ String businessService;
+ List productShow;
StoreType posType;
- factory Store.fromJson(Map json) => Store()
- ..id = json['id'] as String
- ..createTime = json['createTime'] as String
- ..createUser = json['createUser'] as String
- ..updateTime = json['updateTime'] as String
- ..updateUser = json['updateUser'] as String
- ..tenantCode = json['tenantCode'] as String
- ..useErp = json['useErp'] as bool
- ..openStartTime = json['openStartTime'] as String
- ..openEndTime = json['openEndTime'] as String
- ..perCapitaConsumption = json['perCapitaConsumption'] as String
- ..storeName = json['storeName'] as String
- ..distance = (json['distance'] as num)?.toDouble()
- ..logo = json['logo'] as String
- ..facade = json['facade'] as String
- ..shipAddress = json['shipAddress'] as String
- ..remark = json['remark']
- ..mobile = json['mobile'] as String
- ..longitude = json['longitude'] as String
- ..latitude = json['latitude'] as String
- ..refundAddress = json['refundAddress']
- ..refundTel = json['refundTel']
- ..refundContact = json['refundContact']
- ..isAutoSendRefundAddress = json['isAutoSendRefundAddress'] as int
- ..province = json['province'] as String
- ..city = json['city'] as String
- ..district = json['district'] as String
- ..address = json['address'] as String
- ..headName = json['headName'] as String
- ..headMobile = json['headMobile'] as String
- ..deliveryInfo = json['deliveryInfo']
- ..businessType = json['businessType'] as String
- ..couponVO = json['couponVO'] == null ? null : CouponVo.fromJson(json['couponVO'])
- ..posType = json['posType'] == null
- ? null
- : StoreType.fromJson(json['posType'] as Map);
-
- Map toJson() => {
- 'id': this.id,
- 'createTime': this.createTime,
- 'createUser': this.createUser,
- 'updateTime': this.updateTime,
- 'updateUser': this.updateUser,
- 'tenantCode': this.tenantCode,
- 'useErp': this.useErp,
- 'openStartTime': this.openStartTime,
- 'openEndTime': this.openEndTime,
- 'perCapitaConsumption': this.perCapitaConsumption,
- 'storeName': this.storeName,
- 'distance': this.distance,
- 'logo': this.logo,
- 'facade': this.facade,
- 'shipAddress': this.shipAddress,
- 'remark': this.remark,
- 'mobile': this.mobile,
- 'longitude': this.longitude,
- 'latitude': this.latitude,
- 'refundAddress': this.refundAddress,
- 'refundTel': this.refundTel,
- 'refundContact': this.refundContact,
- 'isAutoSendRefundAddress': this.isAutoSendRefundAddress,
- 'province': this.province,
- 'city': this.city,
- 'district': this.district,
- 'address': this.address,
- 'headName': this.headName,
- 'headMobile': this.headMobile,
- 'deliveryInfo': this.deliveryInfo,
- 'businessType': this.businessType,
- 'couponVO': this.couponVO != null ? this.couponVO.toJson() : null,
- 'posType': this.posType,
- };
+ factory Store.fromJson(Map json) =>
+ Store()
+ ..id = json['id'] as String
+ ..createTime = json['createTime'] as String
+ ..createUser = json['createUser'] as String
+ ..updateTime = json['updateTime'] as String
+ ..updateUser = json['updateUser'] as String
+ ..tenantCode = json['tenantCode'] as String
+ ..useErp = json['useErp'] as bool
+ ..openStartTime = json['openStartTime'] as String
+ ..openEndTime = json['openEndTime'] as String
+ ..perCapitaConsumption = json['perCapitaConsumption'] as String
+ ..storeName = json['storeName'] as String
+ ..distance = (json['distance'] as num)?.toDouble()
+ ..logo = json['logo'] as String
+ ..facade = json['facade'] as String
+ ..shipAddress = json['shipAddress'] as String
+ ..remark = json['remark']
+ ..mobile = json['mobile'] as String
+ ..longitude = json['longitude'] as String
+ ..latitude = json['latitude'] as String
+ ..refundAddress = json['refundAddress']
+ ..refundTel = json['refundTel']
+ ..refundContact = json['refundContact']
+ ..isAutoSendRefundAddress = json['isAutoSendRefundAddress'] as int
+ ..province = json['province'] as String
+ ..city = json['city'] as String
+ ..district = json['district'] as String
+ ..address = json['address'] as String
+ ..headName = json['headName'] as String
+ ..headMobile = json['headMobile'] as String
+ ..deliveryInfo = json['deliveryInfo']
+ ..businessType = json['businessType'] as String
+ ..businessService = json['businessService'] as String
+ ..couponVO = json['couponVO'] == null ? null : CouponVo.fromJson(
+ json['couponVO'])
+ ..productShow = (json['productShow'] as List)
+ ?.map((e) =>
+ e == null ? null : ProductShow.fromJson(e as Map))
+ ?.toList()
+ ..posType = json['posType'] == null
+ ? null
+ : StoreType.fromJson(json['posType'] as Map);
+ Map toJson() =>
+ {
+ 'id': this.id,
+ 'createTime': this.createTime,
+ 'createUser': this.createUser,
+ 'updateTime': this.updateTime,
+ 'updateUser': this.updateUser,
+ 'tenantCode': this.tenantCode,
+ 'useErp': this.useErp,
+ 'openStartTime': this.openStartTime,
+ 'openEndTime': this.openEndTime,
+ 'perCapitaConsumption': this.perCapitaConsumption,
+ 'storeName': this.storeName,
+ 'distance': this.distance,
+ 'logo': this.logo,
+ 'facade': this.facade,
+ 'shipAddress': this.shipAddress,
+ 'remark': this.remark,
+ 'mobile': this.mobile,
+ 'longitude': this.longitude,
+ 'latitude': this.latitude,
+ 'refundAddress': this.refundAddress,
+ 'refundTel': this.refundTel,
+ 'refundContact': this.refundContact,
+ 'isAutoSendRefundAddress': this.isAutoSendRefundAddress,
+ 'province': this.province,
+ 'city': this.city,
+ 'district': this.district,
+ 'address': this.address,
+ 'headName': this.headName,
+ 'headMobile': this.headMobile,
+ 'deliveryInfo': this.deliveryInfo,
+ 'businessType': this.businessType,
+ 'businessService': this.businessService,
+ 'couponVO': this.couponVO != null ? this.couponVO.toJson() : null,
+ 'productShow': this.productShow.map((e) => e.toJson()).toList(),
+ 'posType': this.posType,
+ };
}
+
+
diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart
index 286a292b..8a795c75 100644
--- a/lib/retrofit/min_api.dart
+++ b/lib/retrofit/min_api.dart
@@ -19,6 +19,7 @@ import 'data/activity_order_list.dart';
import 'data/findMiNiGroupList.dart';
import 'data/home_recommend_list.dart';
import 'data/launch_join_act.dart';
+import 'data/member_recharge_list.dart';
import 'data/miNiDetail.dart';
import 'data/settleOrderInfo.dart';
import 'data/shoppingCart.dart';
@@ -26,8 +27,8 @@ import 'data/shopping_home_config.dart';
part 'min_api.g.dart';
-const localBaseUrl = "http://192.168.10.78:8765/app/";///本地
-// const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///测试
+// const localBaseUrl = "http://app-api.test.yixinhuixiang.com/app/";///本地
+const localBaseUrl = "http://pos-test.api.lotus-wallet.com/app/";///测试
const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上
@@ -49,7 +50,7 @@ abstract class MinApiService {
headers["tenant"] = tenant;
}
if (storeId != null && storeId != "") {
- headers["store_id"] = storeId;
+ headers["store-id"] = storeId;
}
headers["Environment"] = "app";
dio.options = BaseOptions(
@@ -67,7 +68,7 @@ abstract class MinApiService {
debugPrint("headers = ${options.headers}");
if (showLoading && !EasyLoading.isShow) {
//是否显示loading
- EasyLoading.show(status: S.of(context).zhengzaijiazai);
+ EasyLoading.show(status: S.of(context).zhengzaijiazai,maskType: EasyLoadingMaskType.black);
}
if (options.data is FormData) {
debugPrint("params data = FormData");
@@ -243,4 +244,13 @@ abstract class MinApiService {
@POST("promotion/useMemberCoupon")
Future useMemberCoupon(@Body() Map param);
+ ///商户充值
+ @POST("/member/recharge")
+ Future> memberRecharge(@Body() Map param);
+
+ ///充值列表
+ @GET("/store/getRechargePreferential")
+ Future>> memberRechargeList();
+
+
}
diff --git a/lib/retrofit/min_api.g.dart b/lib/retrofit/min_api.g.dart
index a1aac3c6..215825a0 100644
--- a/lib/retrofit/min_api.g.dart
+++ b/lib/retrofit/min_api.g.dart
@@ -651,4 +651,49 @@ class _MinApiService implements MinApiService {
);
return value;
}
+
+ @override
+ Future> memberRecharge(param) async {
+ ArgumentError.checkNotNull(param, 'param');
+ const _extra = {};
+ final queryParameters = {};
+ final _data = {};
+ _data.addAll(param ?? {});
+ final _result = await _dio.request