feat:超市商品管理
This commit is contained in:
1 parent
d0ecbfbc53
commit
e7c2fcd733
17 files changed
+297
-99
No files matched your search
@@ -301,7 +301,7 @@ class ServiceSupermarketSkuPackage {
|
||||
/// 零售价/单位分
|
||||
int? retailPrice;
|
||||
|
||||
/// 促销价
|
||||
/// 促销价/单位分
|
||||
int? promotionPrice;
|
||||
|
||||
ServiceSupermarketSkuPackage({
|
||||
|
||||
@@ -25,4 +25,48 @@ abstract class SupermarketSkuDao {
|
||||
|
||||
@insert
|
||||
Future<void> batchSave(List<SupermarketSkuEntity> changeList);
|
||||
|
||||
@Query("""
|
||||
SELECT DISTINCT COUNT(0) FROM supermarket_sku
|
||||
INNER JOIN supermarket_spu ON supermarket_sku.spuId = supermarket_spu.serviceUniqueCode AND supermarket_spu.delFlag = 0
|
||||
""")
|
||||
Future<int?> getCount();
|
||||
|
||||
@Query('''
|
||||
SELECT
|
||||
supermarket_sku.id,
|
||||
supermarket_sku.serviceUniqueCode,
|
||||
supermarket_sku.spuId,
|
||||
supermarket_spu.productCode,
|
||||
supermarket_spu.classifyServiceUniqueCode,
|
||||
supermarket_spu.productName,
|
||||
supermarket_spu.picUrl,
|
||||
supermarket_spu.productNature,
|
||||
supermarket_spu.salesCount,
|
||||
supermarket_spu.stock,
|
||||
supermarket_spu.sort,
|
||||
supermarket_spu.createTime,
|
||||
supermarket_spu.updateTime,
|
||||
supermarket_spu.delFlag,
|
||||
supermarket_sku.barCode,
|
||||
supermarket_sku.promotionPrice,
|
||||
supermarket_sku.purchasePrice,
|
||||
supermarket_sku.retailPrice,
|
||||
supermarket_sku.spec,
|
||||
supermarket_sku.packageNum,
|
||||
supermarket_sku.unit,
|
||||
supermarket_sku.packageNum
|
||||
FROM supermarket_sku
|
||||
INNER JOIN supermarket_spu ON supermarket_sku.spuId = supermarket_spu.serviceUniqueCode AND supermarket_spu.delFlag = 0
|
||||
WHERE
|
||||
1 = 1
|
||||
AND (:barCode = '-1' OR supermarket_sku.barCode = :barCode)
|
||||
ORDER BY supermarket_sku.spuId
|
||||
LIMIT :pageSize OFFSET :offset
|
||||
''')
|
||||
Future<List<SupermarketSpuEntity>> getAllPage(
|
||||
String barCode,
|
||||
int pageSize,
|
||||
int offset,
|
||||
);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ class _$AppDatabase extends AppDatabase {
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `supermarket_sku` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `serviceUniqueCode` TEXT NOT NULL, `spuId` TEXT NOT NULL, `barCode` TEXT NOT NULL, `spec` TEXT NOT NULL, `unit` TEXT NOT NULL, `packageNum` INTEGER NOT NULL, `purchasePrice` INTEGER NOT NULL, `retailPrice` INTEGER NOT NULL, `promotionPrice` INTEGER NOT NULL)');
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `supermarket_spu` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `serviceUniqueCode` TEXT NOT NULL, `classifyServiceUniqueCode` TEXT NOT NULL, `productCode` TEXT NOT NULL, `productName` TEXT NOT NULL, `productNature` TEXT NOT NULL, `unit` TEXT NOT NULL, `spec` TEXT NOT NULL, `picUrl` TEXT, `stock` REAL, `salesCount` REAL, `retailPrice` INTEGER NOT NULL, `promotionPrice` INTEGER NOT NULL, `sort` INTEGER NOT NULL, `createTime` TEXT NOT NULL, `updateTime` TEXT NOT NULL, `delFlag` INTEGER NOT NULL)');
|
||||
'CREATE TABLE IF NOT EXISTS `supermarket_spu` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `serviceUniqueCode` TEXT NOT NULL, `classifyServiceUniqueCode` TEXT NOT NULL, `productCode` TEXT NOT NULL, `productName` TEXT NOT NULL, `productNature` TEXT NOT NULL, `barCode` TEXT, `packageNum` INTEGER NOT NULL, `unit` TEXT NOT NULL, `spec` TEXT NOT NULL, `picUrl` TEXT, `stock` REAL, `salesCount` REAL, `purchasePrice` INTEGER NOT NULL, `retailPrice` INTEGER NOT NULL, `promotionPrice` INTEGER NOT NULL, `sort` INTEGER NOT NULL, `createTime` TEXT NOT NULL, `updateTime` TEXT NOT NULL, `delFlag` INTEGER NOT NULL)');
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `supermarket_code` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `serviceUniqueCode` TEXT NOT NULL, `spuId` TEXT NOT NULL, `unitId` TEXT NOT NULL, `barCode` TEXT NOT NULL)');
|
||||
await database.execute(
|
||||
@@ -638,7 +638,8 @@ class _$SupermarketSkuDao extends SupermarketSkuDao {
|
||||
_$SupermarketSkuDao(
|
||||
this.database,
|
||||
this.changeListener,
|
||||
) : _supermarketSkuEntityInsertionAdapter = InsertionAdapter(
|
||||
) : _queryAdapter = QueryAdapter(database),
|
||||
_supermarketSkuEntityInsertionAdapter = InsertionAdapter(
|
||||
database,
|
||||
'supermarket_sku',
|
||||
(SupermarketSkuEntity item) => <String, Object?>{
|
||||
@@ -658,9 +659,30 @@ class _$SupermarketSkuDao extends SupermarketSkuDao {
|
||||
|
||||
final StreamController<String> changeListener;
|
||||
|
||||
final QueryAdapter _queryAdapter;
|
||||
|
||||
final InsertionAdapter<SupermarketSkuEntity>
|
||||
_supermarketSkuEntityInsertionAdapter;
|
||||
|
||||
@override
|
||||
Future<int?> getCount() async {
|
||||
return _queryAdapter.query(
|
||||
'SELECT DISTINCT COUNT(0) FROM supermarket_sku INNER JOIN supermarket_spu ON supermarket_sku.spuId = supermarket_spu.serviceUniqueCode AND supermarket_spu.delFlag = 0',
|
||||
mapper: (Map<String, Object?> row) => row.values.first as int);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<SupermarketSpuEntity>> getAllPage(
|
||||
String barCode,
|
||||
int pageSize,
|
||||
int offset,
|
||||
) async {
|
||||
return _queryAdapter.queryList(
|
||||
'SELECT supermarket_sku.id, supermarket_sku.serviceUniqueCode, supermarket_sku.spuId, supermarket_spu.productCode, supermarket_spu.classifyServiceUniqueCode, supermarket_spu.productName, supermarket_spu.picUrl, supermarket_spu.productNature, supermarket_spu.salesCount, supermarket_spu.stock, supermarket_spu.sort, supermarket_spu.createTime, supermarket_spu.updateTime, supermarket_spu.delFlag, supermarket_sku.barCode, supermarket_sku.promotionPrice, supermarket_sku.purchasePrice, supermarket_sku.retailPrice, supermarket_sku.spec, supermarket_sku.packageNum, supermarket_sku.unit, supermarket_sku.packageNum FROM supermarket_sku INNER JOIN supermarket_spu ON supermarket_sku.spuId = supermarket_spu.serviceUniqueCode AND supermarket_spu.delFlag = 0 WHERE 1 = 1 AND (?1 = \'-1\' OR supermarket_sku.barCode = ?1) ORDER BY supermarket_sku.spuId LIMIT ?2 OFFSET ?3',
|
||||
mapper: (Map<String, Object?> row) => SupermarketSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, productCode: row['productCode'] as String, productName: row['productName'] as String, productNature: _supermarketNatureConverter.decode(row['productNature'] as String), barCode: row['barCode'] as String?, packageNum: row['packageNum'] as int, unit: row['unit'] as String, spec: row['spec'] as String, picUrl: row['picUrl'] as String?, stock: row['stock'] as double?, salesCount: row['salesCount'] as double?, purchasePrice: row['purchasePrice'] as int, retailPrice: row['retailPrice'] as int, promotionPrice: row['promotionPrice'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
arguments: [barCode, pageSize, offset]);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> batchSave(List<SupermarketSkuEntity> changeList) async {
|
||||
await _supermarketSkuEntityInsertionAdapter.insertList(
|
||||
@@ -684,11 +706,14 @@ class _$SupermarketSpuDao extends SupermarketSpuDao {
|
||||
'productName': item.productName,
|
||||
'productNature':
|
||||
_supermarketNatureConverter.encode(item.productNature),
|
||||
'barCode': item.barCode,
|
||||
'packageNum': item.packageNum,
|
||||
'unit': item.unit,
|
||||
'spec': item.spec,
|
||||
'picUrl': item.picUrl,
|
||||
'stock': item.stock,
|
||||
'salesCount': item.salesCount,
|
||||
'purchasePrice': item.purchasePrice,
|
||||
'retailPrice': item.retailPrice,
|
||||
'promotionPrice': item.promotionPrice,
|
||||
'sort': item.sort,
|
||||
@@ -708,11 +733,14 @@ class _$SupermarketSpuDao extends SupermarketSpuDao {
|
||||
'productName': item.productName,
|
||||
'productNature':
|
||||
_supermarketNatureConverter.encode(item.productNature),
|
||||
'barCode': item.barCode,
|
||||
'packageNum': item.packageNum,
|
||||
'unit': item.unit,
|
||||
'spec': item.spec,
|
||||
'picUrl': item.picUrl,
|
||||
'stock': item.stock,
|
||||
'salesCount': item.salesCount,
|
||||
'purchasePrice': item.purchasePrice,
|
||||
'retailPrice': item.retailPrice,
|
||||
'promotionPrice': item.promotionPrice,
|
||||
'sort': item.sort,
|
||||
@@ -737,7 +765,7 @@ class _$SupermarketSpuDao extends SupermarketSpuDao {
|
||||
String classifyServiceUniqueCode) async {
|
||||
return _queryAdapter.queryList(
|
||||
'SELECT supermarket_spu.* FROM supermarket_spu LEFT JOIN classify ON supermarket_spu.classifyServiceUniqueCode = classify.serviceUniqueCode WHERE supermarket_spu.delFlag = 0 AND (?1 = \'-1\' OR supermarket_spu.classifyServiceUniqueCode = ?1) ORDER BY classify.sort',
|
||||
mapper: (Map<String, Object?> row) => SupermarketSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, productCode: row['productCode'] as String, productName: row['productName'] as String, productNature: _supermarketNatureConverter.decode(row['productNature'] as String), unit: row['unit'] as String, spec: row['spec'] as String, picUrl: row['picUrl'] as String?, stock: row['stock'] as double?, salesCount: row['salesCount'] as double?, retailPrice: row['retailPrice'] as int, promotionPrice: row['promotionPrice'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
mapper: (Map<String, Object?> row) => SupermarketSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, productCode: row['productCode'] as String, productName: row['productName'] as String, productNature: _supermarketNatureConverter.decode(row['productNature'] as String), barCode: row['barCode'] as String?, packageNum: row['packageNum'] as int, unit: row['unit'] as String, spec: row['spec'] as String, picUrl: row['picUrl'] as String?, stock: row['stock'] as double?, salesCount: row['salesCount'] as double?, purchasePrice: row['purchasePrice'] as int, retailPrice: row['retailPrice'] as int, promotionPrice: row['promotionPrice'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
arguments: [classifyServiceUniqueCode]);
|
||||
}
|
||||
|
||||
@@ -756,7 +784,7 @@ class _$SupermarketSpuDao extends SupermarketSpuDao {
|
||||
) async {
|
||||
return _queryAdapter.queryList(
|
||||
'SELECT supermarket_spu.* FROM supermarket_spu LEFT JOIN classify ON supermarket_spu.classifyServiceUniqueCode = classify.serviceUniqueCode WHERE supermarket_spu.delFlag = 0 AND (?1 = \'-1\' OR supermarket_spu.classifyServiceUniqueCode = ?1) ORDER BY classify.sort LIMIT ?2 OFFSET ?3',
|
||||
mapper: (Map<String, Object?> row) => SupermarketSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, productCode: row['productCode'] as String, productName: row['productName'] as String, productNature: _supermarketNatureConverter.decode(row['productNature'] as String), unit: row['unit'] as String, spec: row['spec'] as String, picUrl: row['picUrl'] as String?, stock: row['stock'] as double?, salesCount: row['salesCount'] as double?, retailPrice: row['retailPrice'] as int, promotionPrice: row['promotionPrice'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
mapper: (Map<String, Object?> row) => SupermarketSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, productCode: row['productCode'] as String, productName: row['productName'] as String, productNature: _supermarketNatureConverter.decode(row['productNature'] as String), barCode: row['barCode'] as String?, packageNum: row['packageNum'] as int, unit: row['unit'] as String, spec: row['spec'] as String, picUrl: row['picUrl'] as String?, stock: row['stock'] as double?, salesCount: row['salesCount'] as double?, purchasePrice: row['purchasePrice'] as int, retailPrice: row['retailPrice'] as int, promotionPrice: row['promotionPrice'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
arguments: [classifyServiceUniqueCode, pageSize, offset]);
|
||||
}
|
||||
|
||||
@@ -764,7 +792,7 @@ class _$SupermarketSpuDao extends SupermarketSpuDao {
|
||||
Future<SupermarketSpuEntity?> getByCode(String code) async {
|
||||
return _queryAdapter.query(
|
||||
'SELECT * FROM supermarket_spu WHERE delFlag = 0 AND serviceUniqueCode = ?1',
|
||||
mapper: (Map<String, Object?> row) => SupermarketSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, productCode: row['productCode'] as String, productName: row['productName'] as String, productNature: _supermarketNatureConverter.decode(row['productNature'] as String), unit: row['unit'] as String, spec: row['spec'] as String, picUrl: row['picUrl'] as String?, stock: row['stock'] as double?, salesCount: row['salesCount'] as double?, retailPrice: row['retailPrice'] as int, promotionPrice: row['promotionPrice'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
mapper: (Map<String, Object?> row) => SupermarketSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, productCode: row['productCode'] as String, productName: row['productName'] as String, productNature: _supermarketNatureConverter.decode(row['productNature'] as String), barCode: row['barCode'] as String?, packageNum: row['packageNum'] as int, unit: row['unit'] as String, spec: row['spec'] as String, picUrl: row['picUrl'] as String?, stock: row['stock'] as double?, salesCount: row['salesCount'] as double?, purchasePrice: row['purchasePrice'] as int, retailPrice: row['retailPrice'] as int, promotionPrice: row['promotionPrice'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String), delFlag: _boolConverter.decode(row['delFlag'] as int)),
|
||||
arguments: [code]);
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,12 @@ class SupermarketSpuEntity {
|
||||
/// 商品性质(字典)
|
||||
SupermarketNature productNature;
|
||||
|
||||
/// 条码
|
||||
String? barCode;
|
||||
|
||||
/// 内装数量
|
||||
int packageNum;
|
||||
|
||||
/// 单位
|
||||
String unit;
|
||||
|
||||
@@ -41,10 +47,13 @@ class SupermarketSpuEntity {
|
||||
/// 销量
|
||||
double? salesCount;
|
||||
|
||||
/// 零售价
|
||||
/// 进价/单位分
|
||||
int purchasePrice;
|
||||
|
||||
/// 零售价/单位分
|
||||
int retailPrice;
|
||||
|
||||
/// 促销价
|
||||
/// 促销价/单位分
|
||||
int promotionPrice;
|
||||
|
||||
/// 排序 倒序排列
|
||||
@@ -66,11 +75,14 @@ class SupermarketSpuEntity {
|
||||
required this.productCode,
|
||||
required this.productName,
|
||||
required this.productNature,
|
||||
this.barCode,
|
||||
required this.packageNum,
|
||||
required this.unit,
|
||||
required this.spec,
|
||||
required this.picUrl,
|
||||
required this.stock,
|
||||
required this.salesCount,
|
||||
required this.purchasePrice,
|
||||
required this.retailPrice,
|
||||
required this.promotionPrice,
|
||||
required this.sort,
|
||||
|
||||
@@ -16,11 +16,14 @@ SupermarketSpuEntity _$SupermarketSpuEntityFromJson(
|
||||
productName: json['productName'] as String,
|
||||
productNature:
|
||||
$enumDecode(_$SupermarketNatureEnumMap, json['productNature']),
|
||||
barCode: json['barCode'] as String?,
|
||||
packageNum: (json['packageNum'] as num).toInt(),
|
||||
unit: json['unit'] as String,
|
||||
spec: json['spec'] as String,
|
||||
picUrl: json['picUrl'] as String?,
|
||||
stock: (json['stock'] as num?)?.toDouble(),
|
||||
salesCount: (json['salesCount'] as num?)?.toDouble(),
|
||||
purchasePrice: (json['purchasePrice'] as num).toInt(),
|
||||
retailPrice: (json['retailPrice'] as num).toInt(),
|
||||
promotionPrice: (json['promotionPrice'] as num).toInt(),
|
||||
sort: (json['sort'] as num).toInt(),
|
||||
@@ -38,11 +41,14 @@ Map<String, dynamic> _$SupermarketSpuEntityToJson(
|
||||
'productCode': instance.productCode,
|
||||
'productName': instance.productName,
|
||||
'productNature': _$SupermarketNatureEnumMap[instance.productNature]!,
|
||||
'barCode': instance.barCode,
|
||||
'packageNum': instance.packageNum,
|
||||
'unit': instance.unit,
|
||||
'spec': instance.spec,
|
||||
'picUrl': instance.picUrl,
|
||||
'stock': instance.stock,
|
||||
'salesCount': instance.salesCount,
|
||||
'purchasePrice': instance.purchasePrice,
|
||||
'retailPrice': instance.retailPrice,
|
||||
'promotionPrice': instance.promotionPrice,
|
||||
'sort': instance.sort,
|
||||
|
||||
@@ -353,12 +353,15 @@ abstract class SyncProductTool {
|
||||
productName: v.productCode ?? "",
|
||||
productNature: SupermarketNature.values.fromCode(v.productNature) ??
|
||||
SupermarketNature.DEFAULT,
|
||||
barCode: "",
|
||||
packageNum: 0,
|
||||
unit: v.productCode ?? "",
|
||||
spec: v.productCode ?? "",
|
||||
picUrl: v.picUrl ?? "",
|
||||
stock: v.stock ?? 0,
|
||||
salesCount:
|
||||
v.salesCount != null ? double.tryParse(v.salesCount.toString()) : 0,
|
||||
purchasePrice: 0,
|
||||
retailPrice: v.retailPrice ?? 0,
|
||||
promotionPrice: v.promotionPrice ?? 0,
|
||||
sort: 0,
|
||||
|
||||
@@ -26,7 +26,7 @@ Widget appNetworkImg(
|
||||
FAssets.icons.globeLock,
|
||||
color: theme.colorScheme.error,
|
||||
size: theme.typography.base.fontSize,
|
||||
).width(imgWidth * 0.5).height(imgHeight * 0.5);
|
||||
).center().width(imgWidth).height(imgWidth);
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -49,7 +49,7 @@ Widget appFileImg(
|
||||
FAssets.icons.globeLock,
|
||||
color: theme.colorScheme.error,
|
||||
size: theme.typography.base.fontSize,
|
||||
).width(imgWidth * 0.5).height(imgHeight * 0.5);
|
||||
).center().width(imgWidth).height(imgHeight);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,9 @@ export './card/card_common.dart';
|
||||
export './order/mixin/order_mixin.dart';
|
||||
export './order/select_pay_type_dialog.dart';
|
||||
export './order/steelyard_container.dart';
|
||||
export 'order/order_common.dart';
|
||||
export './order/order_caneen_common.dart';
|
||||
export './order/order_common.dart';
|
||||
export './order/order_supermarket_common.dart';
|
||||
|
||||
export './setting/setting_password_dialog.dart';
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:forui/forui.dart';
|
||||
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
/// 商品卡片
|
||||
Widget orderCaneenSpuCard(
|
||||
BuildContext context, {
|
||||
String? image = "",
|
||||
String name = "",
|
||||
num price = 0.0,
|
||||
}) {
|
||||
final theme = FTheme.of(context);
|
||||
return FCard(
|
||||
style: theme.cardStyle.copyWith(
|
||||
contentStyle: theme.cardStyle.contentStyle.copyWith(
|
||||
padding: EdgeInsets.all(0),
|
||||
),
|
||||
),
|
||||
image: appImg(image, width: double.infinity, height: 150.h),
|
||||
subtitle: <Widget>[
|
||||
Text(name, style: theme.typography.lg),
|
||||
SizedBox(height: 5.h),
|
||||
appPrice(context, price),
|
||||
]
|
||||
.toColumn(crossAxisAlignment: CrossAxisAlignment.center)
|
||||
.width(double.infinity),
|
||||
).width(double.infinity);
|
||||
}
|
||||
@@ -4,31 +4,6 @@ import 'package:forui/forui.dart';
|
||||
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
/// 商品卡片
|
||||
Widget orderProductCard(
|
||||
BuildContext context, {
|
||||
String? image = "",
|
||||
String name = "",
|
||||
num price = 0.0,
|
||||
}) {
|
||||
final theme = FTheme.of(context);
|
||||
return FCard(
|
||||
style: theme.cardStyle.copyWith(
|
||||
contentStyle: theme.cardStyle.contentStyle.copyWith(
|
||||
padding: EdgeInsets.all(0),
|
||||
),
|
||||
),
|
||||
image: appImg(image, width: double.infinity, height: 150.h),
|
||||
subtitle: <Widget>[
|
||||
Text(name, style: theme.typography.lg),
|
||||
SizedBox(height: 5.h),
|
||||
appPrice(context, price),
|
||||
]
|
||||
.toColumn(crossAxisAlignment: CrossAxisAlignment.center)
|
||||
.width(double.infinity),
|
||||
).width(double.infinity);
|
||||
}
|
||||
|
||||
/// 菜品总价
|
||||
/// 额外支付
|
||||
/// 实际扣款
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:forui/forui.dart';
|
||||
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
Widget orderSupermarketSpuCard(
|
||||
BuildContext context, {
|
||||
required SupermarketSpuEntity supermarketSpu,
|
||||
}) {
|
||||
final theme = FTheme.of(context);
|
||||
final textStyle = theme.typography.sm.copyWith(
|
||||
color: theme.colorScheme.primary,
|
||||
);
|
||||
return FCard(
|
||||
style: theme.cardStyle.copyWith(
|
||||
contentStyle: theme.cardStyle.contentStyle.copyWith(
|
||||
padding: EdgeInsets.all(0),
|
||||
),
|
||||
),
|
||||
image: appImg(supermarketSpu.picUrl, width: double.infinity, height: 100.h),
|
||||
subtitle: <Widget>[
|
||||
Text(supermarketSpu.productName, style: theme.typography.xl),
|
||||
SizedBox(height: 5.h),
|
||||
FBadge(
|
||||
style: FBadgeStyle.secondary,
|
||||
label: Text(
|
||||
supermarketSpu.productNature.title,
|
||||
style: textStyle,
|
||||
),
|
||||
),
|
||||
<Widget>[
|
||||
Text("零售价:", style: textStyle),
|
||||
appPrice(context, supermarketSpu.retailPrice),
|
||||
].toRow(mainAxisAlignment: MainAxisAlignment.center),
|
||||
<Widget>[
|
||||
Text("促销价:", style: textStyle),
|
||||
appPrice(context, supermarketSpu.promotionPrice),
|
||||
].toRow(mainAxisAlignment: MainAxisAlignment.center),
|
||||
<Widget>[
|
||||
Text("货号:", style: textStyle),
|
||||
Text(supermarketSpu.productCode, style: textStyle),
|
||||
].toRow(mainAxisAlignment: MainAxisAlignment.center),
|
||||
<Widget>[
|
||||
Text("辅助条码:", style: textStyle),
|
||||
Text(supermarketSpu.barCode ?? "", style: textStyle),
|
||||
].toRow(mainAxisAlignment: MainAxisAlignment.center),
|
||||
<Widget>[
|
||||
Text("包装单位:", style: textStyle),
|
||||
Text("${supermarketSpu.packageNum}", style: textStyle),
|
||||
Text("/"),
|
||||
Text(supermarketSpu.unit, style: textStyle),
|
||||
].toRow(mainAxisAlignment: MainAxisAlignment.center),
|
||||
]
|
||||
.toColumn(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
)
|
||||
.padding(horizontal: 10.w)
|
||||
.width(double.infinity),
|
||||
).width(double.infinity);
|
||||
}
|
||||
@@ -115,7 +115,7 @@ class CanteenProductPage extends GetView<CanteenProductController> {
|
||||
: const SizedBox.shrink(),
|
||||
productList
|
||||
.map(
|
||||
(v) => orderProductCard(
|
||||
(v) => orderCaneenSpuCard(
|
||||
context,
|
||||
image: v.image,
|
||||
name: v.name,
|
||||
|
||||
@@ -21,7 +21,7 @@ class CardActivePage extends GetView<CardActiveController> {
|
||||
height: height,
|
||||
onTap: () => Get.offAndToNamed(RouteNames.panel),
|
||||
),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
FButton(
|
||||
prefix: FIcon(
|
||||
FAssets.icons.idCard,
|
||||
|
||||
+13
-12
@@ -132,18 +132,19 @@ class SettingPage extends GetView<SettingController> {
|
||||
id: "setting",
|
||||
builder: (_) {
|
||||
return FScaffold(
|
||||
header: FHeader.nested(
|
||||
title: Text("设置"),
|
||||
prefixActions: [
|
||||
FHeaderAction.back(onPress: Get.back),
|
||||
],
|
||||
style: theme.headerStyle.nestedStyle.copyWith(
|
||||
titleTextStyle: theme.typography.lg,
|
||||
actionStyle: theme.headerStyle.nestedStyle.actionStyle.copyWith(
|
||||
size: theme.typography.xl2.fontSize,
|
||||
),
|
||||
),
|
||||
).height(height * 0.1),
|
||||
// header: FHeader.nested(
|
||||
// title: Text("设置"),
|
||||
// prefixActions: [
|
||||
// FHeaderAction.back(onPress: Get.back),
|
||||
// ],
|
||||
// style: theme.headerStyle.nestedStyle.copyWith(
|
||||
// titleTextStyle: theme.typography.lg,
|
||||
// actionStyle: theme.headerStyle.nestedStyle.actionStyle.copyWith(
|
||||
// size: theme.typography.xl2.fontSize,
|
||||
// ),
|
||||
// ),
|
||||
// ).height(height * 0.1),
|
||||
header: SizedBox(height: 40.h),
|
||||
content: _buildView(),
|
||||
contentPad: true,
|
||||
resizeToAvoidBottomInset: false,
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -173,7 +173,7 @@ class SupermarketOrderPage extends GetView<SupermarketOrderController> {
|
||||
style: theme.typography.xl2,
|
||||
).alignLeft(),
|
||||
].toColumn(),
|
||||
Spacer(),
|
||||
const Spacer(),
|
||||
<Widget>[
|
||||
Obx(
|
||||
() => orderAllPrice(
|
||||
|
||||
Reference in new issue
Block a user