feat:超市商品管理
This commit is contained in:
1 parent
d0ecbfbc53
commit
e7c2fcd733
17 files changed
+297
-99
No files matched your search
@@ -149,6 +149,8 @@ class FaceManageController extends GetxController {
|
||||
|
||||
Future<void> doPage({int? page}) async {
|
||||
if (page != null) currentPage.value = page;
|
||||
// 收起键盘
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
await getFaceList(isLoading: true);
|
||||
}
|
||||
|
||||
@@ -182,55 +184,52 @@ Widget buildFaceSearch(BuildContext context) {
|
||||
final faceC = Get.find<FaceManageController>();
|
||||
final theme = FTheme.of(context);
|
||||
return <Widget>[
|
||||
<Widget>[
|
||||
FTextField(
|
||||
controller: faceC.usernameC,
|
||||
hint: '请输入姓名',
|
||||
maxLines: 1,
|
||||
).width(300.w),
|
||||
FButton(
|
||||
label: Text(
|
||||
'搜索',
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
const Spacer(),
|
||||
FTextField(
|
||||
controller: faceC.usernameC,
|
||||
hint: '请输入姓名',
|
||||
maxLines: 1,
|
||||
).width(300.w),
|
||||
FButton(
|
||||
label: Text(
|
||||
'搜索',
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
onPress: () => faceC.doPage(),
|
||||
),
|
||||
].toRowSpace(space: 10.w).expanded(),
|
||||
<Widget>[
|
||||
FButton(
|
||||
label: Text(
|
||||
'删除全部人脸',
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
onPress: () => faceC.doPage(),
|
||||
),
|
||||
FButton(
|
||||
label: Text(
|
||||
'删除全部人脸',
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
style: FButtonStyle.destructive,
|
||||
onPress: () => faceC.delAllFace(),
|
||||
),
|
||||
FButton(
|
||||
label: Text(
|
||||
'同步本部门人脸',
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
style: FButtonStyle.destructive,
|
||||
onPress: () => faceC.delAllFace(),
|
||||
),
|
||||
FButton(
|
||||
label: Text(
|
||||
'同步本部门人脸',
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
style: FButtonStyle.outline,
|
||||
onPress: () => faceC.asyncFace(isAll: false),
|
||||
),
|
||||
FButton(
|
||||
label: Text(
|
||||
'同步全部人脸',
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
style: FButtonStyle.outline,
|
||||
onPress: () => faceC.asyncFace(isAll: false),
|
||||
),
|
||||
FButton(
|
||||
label: Text(
|
||||
'同步全部人脸',
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
),
|
||||
style: FButtonStyle.outline,
|
||||
onPress: () => faceC.asyncFace(isAll: true),
|
||||
),
|
||||
].toRowSpace(space: 10.w),
|
||||
].toRow();
|
||||
style: FButtonStyle.outline,
|
||||
onPress: () => faceC.asyncFace(isAll: true),
|
||||
),
|
||||
].toRowSpace(space: 20.w);
|
||||
}
|
||||
|
||||
/// 列表
|
||||
|
||||
@@ -23,9 +23,12 @@ class ProductManageController extends GetxController {
|
||||
|
||||
ProductHourType hourType = ProductHourType.MORNING;
|
||||
|
||||
// 自编码
|
||||
final selfCodeC = TextEditingController();
|
||||
|
||||
RxInt currentPage = RxInt(1);
|
||||
RxInt totalPage = RxInt(0);
|
||||
RxInt pageSize = RxInt(24);
|
||||
RxInt pageSize = RxInt(18);
|
||||
|
||||
final hourTypeC = FRadioSelectGroupController<String>(
|
||||
value: ProductHourType.MORNING.code,
|
||||
@@ -51,6 +54,7 @@ class ProductManageController extends GetxController {
|
||||
void onClose() {
|
||||
super.onClose();
|
||||
hourTypeC.dispose();
|
||||
selfCodeC.dispose();
|
||||
}
|
||||
|
||||
// 更新商品和分类
|
||||
@@ -81,7 +85,7 @@ class ProductManageController extends GetxController {
|
||||
|
||||
if (sysType == SysType.SUPERMARKET) {
|
||||
// 超市
|
||||
final supermarketSpuDao = appC.dataBase.getSupermarketSpuDao;
|
||||
final supermarketSpuDao = appC.dataBase.getSupermarketSkuDao;
|
||||
final findCount = await supermarketSpuDao.getCount();
|
||||
totalPage.value = findCount ?? 0;
|
||||
final list = await supermarketSpuDao.getAllPage(
|
||||
@@ -117,6 +121,17 @@ class ProductManageController extends GetxController {
|
||||
/// 搜索
|
||||
Future<void> doPage({int? page}) async {
|
||||
if (page != null) currentPage.value = page;
|
||||
// 收起键盘
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
await getProductList(isLoading: true);
|
||||
}
|
||||
|
||||
/// 重置
|
||||
Future<void> doReset() async {
|
||||
currentPage.value = 1;
|
||||
selfCodeC.clear();
|
||||
// 收起键盘
|
||||
FocusManager.instance.primaryFocus?.unfocus();
|
||||
await getProductList(isLoading: true);
|
||||
}
|
||||
|
||||
@@ -160,8 +175,30 @@ Widget _buildSearch(BuildContext context) {
|
||||
).offstage(
|
||||
offstage: productC.sysType.value != SysType.CANTEEN,
|
||||
),
|
||||
).width(300.w)
|
||||
).width(300.w),
|
||||
].toRow().expanded(),
|
||||
Obx(
|
||||
() => FTextField(
|
||||
controller: productC.selfCodeC,
|
||||
hint: '请输入自编码',
|
||||
maxLines: 1,
|
||||
).offstage(
|
||||
offstage: productC.sysType.value != SysType.SUPERMARKET,
|
||||
),
|
||||
).width(300.w),
|
||||
FButton(
|
||||
prefix: FIcon(
|
||||
FAssets.icons.ban,
|
||||
size: theme.typography.base.fontSize,
|
||||
),
|
||||
label: Text(
|
||||
'重置',
|
||||
style: theme.typography.base.copyWith(
|
||||
color: theme.colorScheme.secondary,
|
||||
),
|
||||
),
|
||||
onPress: () => productC.doReset(),
|
||||
),
|
||||
FButton(
|
||||
prefix: FIcon(
|
||||
FAssets.icons.search,
|
||||
@@ -175,7 +212,6 @@ Widget _buildSearch(BuildContext context) {
|
||||
),
|
||||
onPress: () => productC.doPage(),
|
||||
),
|
||||
SizedBox(width: 20.w),
|
||||
FButton(
|
||||
label: Text(
|
||||
'更新商品和分类',
|
||||
@@ -185,7 +221,7 @@ Widget _buildSearch(BuildContext context) {
|
||||
),
|
||||
onPress: () => productC.updateProductAndClassify(),
|
||||
),
|
||||
].toRow();
|
||||
].toRowSpace(space: 20.w);
|
||||
}
|
||||
|
||||
// 食堂列表
|
||||
@@ -235,7 +271,7 @@ Widget _buildSupermarketList(BuildContext context) {
|
||||
return Obx(
|
||||
() => GridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 8,
|
||||
crossAxisCount: 6,
|
||||
mainAxisSpacing: 10.w,
|
||||
crossAxisSpacing: 10.w,
|
||||
childAspectRatio: 0.7,
|
||||
@@ -243,6 +279,7 @@ Widget _buildSupermarketList(BuildContext context) {
|
||||
itemCount: productC.supermarketSpuList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
final v = productC.supermarketSpuList[index];
|
||||
return orderSupermarketSpuCard(context, supermarketSpu: v);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -269,6 +306,6 @@ Widget settingProduct(BuildContext context) {
|
||||
total: productC.totalPage.value,
|
||||
onPageChanged: (pageNo) => productC.doPage(page: pageNo),
|
||||
),
|
||||
),
|
||||
)
|
||||
].toColumnSpace(space: 10.h);
|
||||
}
|
||||
Reference in new issue
Block a user