Browse Source

商品查询loading修改

dart3_last
fff 1 week ago
parent
commit
d5db9c9740
  1. 34
      lib/store/store_order.dart
  2. 10
      lib/store/store_view/store_order_list.dart
  3. 12
      lib/union/union_list.dart
  4. 2
      lib/union/union_page.dart

34
lib/store/store_order.dart

@ -2,6 +2,7 @@ import 'dart:convert';
import 'dart:math' as mm;
import 'package:dio/dio.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
@ -68,6 +69,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
MemberVo? memberVo;
MiniDetail? miniDetail;
final GlobalKey<StoreOrderListPageState> productListKey = GlobalKey<StoreOrderListPageState>();
///token
String? minToken;
String? pName;
@ -120,6 +123,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
getParentInfo();
}
this.shopCarGoods = value;
productListKey.currentState?.appletGoods();
setState(() {});
}
@ -137,8 +143,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
///
Future getParentInfo() async {
BaseData? baseData =
await minService?.getParentInfo("$tableId").catchError((error) {
BaseData? baseData = await minService?.getParentInfo("$tableId")
.catchError((error) {
debugPrint("${error}");
return BaseData()..isSuccess = false;
});
@ -170,8 +176,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
///
Future queryStoreInfo() async {
BaseData<StoreInfo>? baseData =
await apiService?.queryStoreInfo(storeId).catchError((error) {
BaseData<StoreInfo>? baseData = await apiService?.queryStoreInfo(storeId)
.catchError((error) {
debugPrint("${error}");
return BaseData<StoreInfo>()..isSuccess = false;
});
@ -357,6 +363,7 @@ class _StoreOrderPage extends State<StoreOrderPage>
),
SliverFillRemaining(
child: StoreOrderListPage(
key: productListKey,
widget.arguments,
activitys,
storeInfo,
@ -365,7 +372,9 @@ class _StoreOrderPage extends State<StoreOrderPage>
minToken,
tenant,
tableId,
_queryMiNiDetail,
(String id, int count) {
_queryMiNiDetail(id, count);
},
() {
queryShopCar().then((value) {
this.shopCarGoods = value;
@ -703,9 +712,15 @@ class _StoreOrderPage extends State<StoreOrderPage>
miniDetail,
shopCarGoods,
id,
_addShopCar,
add,
reduce,
(MiniDetail? miniDetail, selectSkus, int count) {
_addShopCar(miniDetail, selectSkus, count);
},
(MiniDetail miniDetail, selectSkus) {
add(miniDetail, selectSkus);
},
(MiniDetail miNiDetail, selectSkus) {
reduce(miNiDetail, selectSkus);
},
);
},
);
@ -777,7 +792,8 @@ class _StoreOrderPage extends State<StoreOrderPage>
if (storeInfo?.posType?.code == "NORMALSTORE" && tableId == 0) {
return null;
}
BaseListData<ShoppingCart>? baseDate = await minService?.getShoppingCart(tableId).catchLEr<ShoppingCart>();
BaseListData<ShoppingCart>? baseDate = await minService?.getShoppingCart(tableId)
.catchLEr<ShoppingCart>();
if ((baseDate?.isSuccess ?? false) && (baseDate!.data?.isNotEmpty ?? false)) {
if (baseDate.data![0].selectDiscount == 1) {
baseDate.data![0].couponList?.forEach((element) {

10
lib/store/store_view/store_order_list.dart

@ -41,15 +41,15 @@ class StoreOrderListPage extends StatefulWidget {
this.tableId,
this.queryMiNiDetail,
this.queryShoppingCart,
this.scrollPhysics);
this.scrollPhysics, {super.key});
@override
State<StatefulWidget> createState() {
return _StoreOrderListPage();
return StoreOrderListPageState();
}
}
class _StoreOrderListPage extends State<StoreOrderListPage> {
class StoreOrderListPageState extends State<StoreOrderListPage> {
int isSelected = 0;
// int tempClickIndex = 0;
@ -88,7 +88,6 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
_listScrollController1 = ListObserverController(controller: _shopCoordinator.newChildScrollController());
_listScrollController2 = ListObserverController(controller: _shopCoordinator.newChildScrollController());
appletGoods();
}
@override
@ -124,14 +123,13 @@ class _StoreOrderListPage extends State<StoreOrderListPage> {
}
///
appletGoods() async {
Future appletGoods() async {
minService = MinApiService(
Dio(),
context: context,
token: widget.minToken ?? "",
tenant: widget.tenant,
storeId: widget.arguments?["id"],
showLoading: true,
);
BaseListData<FindMiniGroup> baseData = await minService.findMiNiGroupList({

12
lib/union/union_list.dart

@ -63,7 +63,7 @@ class UnionListState extends State<UnionList> with AutomaticKeepAliveClientMixin
}
Future<void> getLocation() async {
S.current.zhengzaijiazai.toast;
S.current.zhengzaijiazai.loading;
try {
powerFlag = await LocationInstance.instance.startLocation(context,
(Position? result) async {
@ -81,8 +81,7 @@ class UnionListState extends State<UnionList> with AutomaticKeepAliveClientMixin
);
Address? address = await LocationInstance.instance.getAddress(result.latitude, result.longitude);
if (address != null) {
await saveLatLng(
latLng!, address.province, address.city, address.area);
await saveLatLng(latLng!, address.province, address.city, address.area);
}
LocationInstance.instance.stopLocation();
} else {
@ -164,6 +163,8 @@ class UnionListState extends State<UnionList> with AutomaticKeepAliveClientMixin
setState(() {});
}
bool miniLogining = false;
@override
Widget build(BuildContext context) {
super.build(context);
@ -214,6 +215,10 @@ class UnionListState extends State<UnionList> with AutomaticKeepAliveClientMixin
itemBuilder: (context, position) {
return InkWell(
onTap: () {
if (miniLogining) {
return;
}
miniLogining = true;
String storeId = storeList![position].id ?? "";
String tenant = storeList![position].tenantCode ?? "";
miniLogin(apiService!, tenant, storeId, (token) {
@ -227,6 +232,7 @@ class UnionListState extends State<UnionList> with AutomaticKeepAliveClientMixin
"miniToken": token,
},
);
miniLogining = false;
});
},
child: buildStoreItem(storeList![position], position),

2
lib/union/union_page.dart

@ -96,7 +96,7 @@ class UnionPageState extends State<UnionPage> with AutomaticKeepAliveClientMixin
}
queryIpInfo() async {
S.current.zhengzaijiazai.toast;
S.current.zhengzaijiazai.loading;
ApiService apiIpService = ApiService(Dio(), context: context);
String ipResult = await apiIpService.getIpInfo1().catchError((onError) {
return "";

Loading…
Cancel
Save