Files
biz_xfj_cloud/lib/common/api/product_api.dart
T

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