90 lines
2.6 KiB
Dart
90 lines
2.6 KiB
Dart
import 'package:pj_supermarket_cloud/common/index.dart';
|
|
|
|
abstract class ProductApi {
|
|
/// 菜品分类
|
|
static Future<List<ServiceClassify>?> canteenClassify(
|
|
dynamic pa,
|
|
) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/canteen/canteenCategory/getAllSimple",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return null;
|
|
return res.data
|
|
?.map<ServiceClassify>((e) => ServiceClassify.fromJson(e))
|
|
.toList();
|
|
}
|
|
|
|
/// 查询指定单日的食堂菜谱商品。
|
|
static Future<List<ServiceProduct>?> canteenProduct(
|
|
dynamic pa,
|
|
) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/canteen/canteenDailyMenu/ad/getCanteenList",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return null;
|
|
return res.data
|
|
?.map<ServiceProduct>((e) => ServiceProduct.fromJson(e))
|
|
.toList();
|
|
}
|
|
|
|
/// 按闭区间查询多日食堂菜谱商品,响应结构与单日接口保持一致。
|
|
static Future<List<ServiceProduct>?> canteenProductsByDateRange(
|
|
Map<String, dynamic> requestBody,
|
|
) async {
|
|
final res = await HttpManage().dio.post(
|
|
"/canteen/canteenDailyMenu/ad/getCanteenListByDateRange",
|
|
data: requestBody,
|
|
);
|
|
if (res.data == null) return null;
|
|
return res.data
|
|
?.map<ServiceProduct>((e) => ServiceProduct.fromJson(e))
|
|
.toList();
|
|
}
|
|
|
|
/// 超市分类
|
|
static Future<List<ServiceClassify>?> supermarketClassify(
|
|
dynamic pa,
|
|
) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/supermarket/supermarketCategory/simpleAll",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return null;
|
|
return res.data
|
|
?.map<ServiceClassify>((e) => ServiceClassify.fromJson(e))
|
|
.toList();
|
|
}
|
|
|
|
/// 超市 spu
|
|
static Future<ServiceSupermarketSpuPage?> supermarketSpu(
|
|
dynamic pa,
|
|
) async {
|
|
final res = await HttpManage().dio.post(
|
|
"/supermarket/supermarketSpu/ad/selectListAll",
|
|
queryParameters: {
|
|
"current": pa["current"] ?? 1,
|
|
"size": pa["size"] ?? 100,
|
|
},
|
|
data: pa,
|
|
);
|
|
if (res.data == null) return null;
|
|
return ServiceSupermarketSpuPage.fromJson(res.data);
|
|
}
|
|
|
|
/// 超市 spu 详情
|
|
static Future<List<ServiceSupermarketSku>?> supermarketSupDetial(
|
|
dynamic pa,
|
|
) async {
|
|
final res = await HttpManage().dio.get(
|
|
"/supermarket/supermarketSpu/ad/SpuDetails",
|
|
queryParameters: pa,
|
|
);
|
|
if (res.data == null) return null;
|
|
return res.data
|
|
?.map<ServiceSupermarketSku>((e) => ServiceSupermarketSku.fromJson(e))
|
|
.toList();
|
|
}
|
|
}
|