|
|
@ -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(); |
|
|
|
} |
|
|
|
} |
|
|
|