Files
biz_xfj_cloud/lib/common/api/product_api.dart
T
dzc 4d7bc5ed33 fix:设备查询菜品频繁问题
fix:退看流水对账问题
2026-09-02 12:52:54 +08:00

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