Browse Source

店铺充值:搜索没有数据为空时,应展示文字“没有找到相应的门店,试试其他的搜索”;

商品详情html文本优化;
点单页图片缓存处理;
商品详情图片缓存处理
首页图片缓存处理;
wr_2024_invoice
wurong 5 months ago
parent
commit
7f04acaccb
  1. 13
      lib/home/home_page.dart
  2. 2
      lib/mine/mine_shop_page.dart
  3. 22
      lib/store/shop_details_page.dart
  4. 23
      lib/store/store_order.dart
  5. 33
      lib/store/store_view/store_order_list.dart

13
lib/home/home_page.dart

@ -94,7 +94,6 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
eventBus.on<EventType>().listen((event) { eventBus.on<EventType>().listen((event) {
if (event.type < 3) { if (event.type < 3) {
setState(() {}); setState(() {});
@ -169,6 +168,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
bannerData = baseData.data.records; bannerData = baseData.data.records;
// if (bannerData.length > 0) swiperController.move(0, animation: false); // if (bannerData.length > 0) swiperController.move(0, animation: false);
SharedPreferences.getInstance().then((value) {
value.setString("bannerData", jsonEncode(bannerData));
});
} }
} finally { } finally {
addLoadCount(); addLoadCount();
@ -260,7 +262,9 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
"state": 1 "state": 1
}; };
BaseData<PageInfo<Goods>> pageGoods = BaseData<PageInfo<Goods>> pageGoods =
await apiService.creditGoods(param).catchError((onError) {}); await apiService.creditGoods(param).catchError((onError) {
debugPrint("error${onError}");
});
if (pageGoods != null && pageGoods.isSuccess) { if (pageGoods != null && pageGoods.isSuccess) {
goods = pageGoods.data.list; goods = pageGoods.data.list;
} }
@ -358,6 +362,11 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
context: context, context: context,
token: value.getString("token"), token: value.getString("token"),
); );
if (value.getString("bannerData") != null) {
bannerData = jsonDecode(value.getString("bannerData")).map<BannerData>((i) => BannerData.fromJson(i as Map<String, dynamic>))
.toList();
setState(() {});
}
} }
dioErrorType = null; dioErrorType = null;
if (isFirstIn) queryActivity(); if (isFirstIn) queryActivity();

2
lib/mine/mine_shop_page.dart

@ -177,7 +177,7 @@ class _MineShopPage extends State<MineShopPage> with WidgetsBindingObserver{
: NoDataView( : NoDataView(
src: "assets/image/icon_empty.webp", src: "assets/image/icon_empty.webp",
isShowBtn: false, isShowBtn: false,
text: "还没有会员卡", text: "没有找到相应的门店,试试其他的搜索",
fontSize: 16.sp, fontSize: 16.sp,
margin: EdgeInsets.only(top: 120.h), margin: EdgeInsets.only(top: 120.h),
)), )),

22
lib/store/shop_details_page.dart

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -115,13 +117,18 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
queryStoreInfo() async { queryStoreInfo() async {
EasyLoading.show( EasyLoading.show(
status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black); status: S.current.zhengzaijiazai, maskType: EasyLoadingMaskType.black);
SharedPreferences value = await SharedPreferences.getInstance(); if (apiService == null){
if (apiService == null) SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService( apiService = ApiService(
Dio(), Dio(),
context: context, context: context,
token: value.getString("token"), token: value.getString("token"),
); );
if (value.getString("miNiDetail${id}") != null) {
miNiDetail = MiNiDetail.fromJson(jsonDecode(value.getString('miNiDetail${id}')));
setState(() {});
}
}
BaseData baseData = BaseData baseData =
await apiService.queryStoreInfo(storeId).catchError((error) { await apiService.queryStoreInfo(storeId).catchError((error) {
debugPrint(error); debugPrint(error);
@ -186,6 +193,11 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
selectSkus.add(element.attrValueList[0].attrValue); selectSkus.add(element.attrValueList[0].attrValue);
}); });
}); });
SharedPreferences.getInstance().then(
(value) => {
value.setString('miNiDetail${id}', jsonEncode(baseData.data)),
},
);
EasyLoading.dismiss(); EasyLoading.dismiss();
refreshController.refreshCompleted(); refreshController.refreshCompleted();
} else { } else {
@ -686,10 +698,14 @@ class _ShopDetailsPage extends State<ShopDetailsPage> {
style: { style: {
'body': Style( 'body': Style(
backgroundColor: Colors.white, backgroundColor: Colors.white,
padding: EdgeInsets.all(0), padding: EdgeInsets.symmetric(horizontal:12.w),
fontSize: FontSize(14.sp),
lineHeight: LineHeight.rem(1.5),
margin: EdgeInsets.all(0)), margin: EdgeInsets.all(0)),
'p': Style( 'p': Style(
margin: EdgeInsets.all(0), margin: EdgeInsets.all(0),
fontSize: FontSize(14.sp),
lineHeight: LineHeight.rem(1.5),
padding: EdgeInsets.all(0), padding: EdgeInsets.all(0),
), ),
}, },

23
lib/store/store_order.dart

@ -76,7 +76,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_onRefresh();
tableId = widget.arguments["tableId"] ?? 0; tableId = widget.arguments["tableId"] ?? 0;
tenant = widget.arguments["tenant"]; tenant = widget.arguments["tenant"];
storeId = widget.arguments["id"]; storeId = widget.arguments["id"];
@ -90,9 +90,19 @@ class _StoreOrderPage extends State<StoreOrderPage>
vsync: this, vsync: this,
); );
SharedPreferences.getInstance().then((value) { // SharedPreferences.getInstance().then((value) {
minLogin(value); // minLogin(value);
}); // });
}
_onRefresh() async{
SharedPreferences value = await SharedPreferences.getInstance();
if (value.getString("storeInfo_${storeId}") != null) {
storeInfo = StoreInfo.fromJson(jsonDecode(value.getString('storeInfo_${storeId}')));
setState(() {});
}
minLogin(value);
} }
/// ///
@ -205,6 +215,11 @@ class _StoreOrderPage extends State<StoreOrderPage>
if (mounted) { if (mounted) {
setState(() {}); setState(() {});
} }
SharedPreferences.getInstance().then(
(value) => {
value.setString('storeInfo_${storeId}', jsonEncode(baseData.data)),
},
);
} }
} }

33
lib/store/store_view/store_order_list.dart

@ -1,3 +1,5 @@
import 'dart:convert';
import 'package:dio/dio.dart'; import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart';
@ -65,6 +67,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_onRefresh();
controller.addListener(() { controller.addListener(() {
_viewportDimension = controller.position.viewportDimension; _viewportDimension = controller.position.viewportDimension;
for (int i = 0; i < appletProducts.length; i++) { for (int i = 0; i < appletProducts.length; i++) {
@ -79,19 +82,29 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
} }
} }
}); });
}
_onRefresh() async {
if (minService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
minService = MinApiService(Dio(),
context: context,
token: widget.minToken,
tenant: widget.tenant,
storeId: widget.arguments["id"],
showLoading: true);
if (value.getString("appletProducts_${widget.arguments["id"]}") != null) {
appletProducts = jsonDecode(value.getString("appletProducts_${widget.arguments["id"]}")).map<FindMiNiGroupList>((i) => FindMiNiGroupList.fromJson(i as Map<String, dynamic>))
.toList();
setState(() {});
}
}
appletGoods(); appletGoods();
} }
/// ///
appletGoods() async { appletGoods() async {
SharedPreferences value = await SharedPreferences.getInstance();
minService = MinApiService(Dio(),
context: context,
token: widget.minToken,
tenant: widget.tenant,
storeId: widget.arguments["id"],
showLoading: true);
BaseData<List<FindMiNiGroupList>> baseData = BaseData<List<FindMiNiGroupList>> baseData =
await minService.findMiNiGroupList({ await minService.findMiNiGroupList({
"id": widget.arguments["id"], "id": widget.arguments["id"],
@ -105,6 +118,9 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
// refreshController.refreshCompleted(); // refreshController.refreshCompleted();
setState(() { setState(() {
appletProducts = baseData.data ?? []; appletProducts = baseData.data ?? [];
SharedPreferences.getInstance().then((value) {
value.setString("appletProducts_${widget.arguments["id"]}", jsonEncode(appletProducts));
});
// productListBeans.clear(); // productListBeans.clear();
// if (appletProducts.length > 0) // if (appletProducts.length > 0)
// productListBeans.addAll(appletProducts[isSelected].productList); // productListBeans.addAll(appletProducts[isSelected].productList);
@ -115,6 +131,7 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
goodsIndex += element.height; goodsIndex += element.height;
}); });
}); });
} else { } else {
// refreshController.refreshFailed(); // refreshController.refreshFailed();
} }

Loading…
Cancel
Save