feat:菜品排列修改

This commit is contained in:
dzc committed 2025-05-09 15:11:59 +08:00
1 parent 35fce74ab2
commit 5ce8e595b0
4 files changed
+43 -7

No files matched your search

@@ -62,7 +62,7 @@ abstract class CanteenSpuDao {
(:classifyServiceUniqueCode = '-1' OR canteen_spu.classifyServiceUniqueCode = :classifyServiceUniqueCode)
AND (:hourType = '-1' OR INSTR(',' || hourType || ',', ',' || :hourType || ',') > 0)
AND (:saleDate = '-1' OR strftime('%Y-%m-%d', saleDate) = strftime('%Y-%m-%d', :saleDate))
ORDER BY classify.sort, canteen_spu.price
ORDER BY classify.sort,canteen_spu.sort desc,canteen_spu.price
''')
Future<List<CanteenSpuEntity>> getAll(
String classifyServiceUniqueCode,
+1 -1
View File
@@ -715,7 +715,7 @@ class _$CanteenSpuDao extends CanteenSpuDao {
String saleDate,
) async {
return _queryAdapter.queryList(
'SELECT canteen_spu.* FROM canteen_spu LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE (?1 = \'-1\' OR canteen_spu.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || hourType || \',\', \',\' || ?2 || \',\') > 0) AND (?3 = \'-1\' OR strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', ?3)) ORDER BY classify.sort, canteen_spu.price',
'SELECT canteen_spu.* FROM canteen_spu LEFT JOIN classify ON canteen_spu.classifyServiceUniqueCode = classify.serviceUniqueCode AND classify.delFlag = 0 WHERE (?1 = \'-1\' OR canteen_spu.classifyServiceUniqueCode = ?1) AND (?2 = \'-1\' OR INSTR(\',\' || hourType || \',\', \',\' || ?2 || \',\') > 0) AND (?3 = \'-1\' OR strftime(\'%Y-%m-%d\', saleDate) = strftime(\'%Y-%m-%d\', ?3)) ORDER BY classify.sort,canteen_spu.sort desc,canteen_spu.price',
mapper: (Map<String, Object?> row) => CanteenSpuEntity(id: row['id'] as int?, serviceUniqueCode: row['serviceUniqueCode'] as String, classifyServiceUniqueCode: row['classifyServiceUniqueCode'] as String, hourType: row['hourType'] == null ? null : ProductHourType.values[row['hourType'] as int], saleDate: _dateTimeConverter.decode(row['saleDate'] as String), name: row['name'] as String, price: row['price'] as int, image: row['image'] as String?, isDefault: _boolConverter.decode(row['isDefault'] as int), status: row['status'] as int, sort: row['sort'] as int, createTime: _dateTimeConverter.decode(row['createTime'] as String), updateTime: _dateTimeConverter.decode(row['updateTime'] as String)),
arguments: [classifyServiceUniqueCode, hourType, saleDate]);
}
+2 -2
View File
@@ -133,7 +133,7 @@ abstract class SyncProductTool {
sysType: sysType,
name: v.name!,
categoryType: v.categoryType ?? "-1",
sort: v.sort ?? 999,
sort: v.sort ?? 0,
createTime: DateTime.now(),
updateTime: DateTime.now(),
delFlag: false,
@@ -281,7 +281,7 @@ abstract class SyncProductTool {
price: v.price ?? 0,
image: v.picUrl,
status: 1,
sort: v.sort ?? 999,
sort: v.sort ?? 0,
createTime: DateTime.now(),
updateTime: DateTime.now(),
hourType: ProductHourType.values.fromCode(v.hourType),
+39 -3
View File
@@ -45,8 +45,8 @@ class CanteenProductPage extends GetView<CanteenProductController> {
);
}
// 商品
Widget _buildProduct() {
// 商品(带标题)
Widget _buildTitleProduct() {
return LayoutBuilder(
builder: (BuildContext _, BoxConstraints constraints) {
const spacing = 10;
@@ -87,6 +87,42 @@ class CanteenProductPage extends GetView<CanteenProductController> {
);
}
Widget _buildSortProduct() {
return LayoutBuilder(
builder: (BuildContext _, BoxConstraints constraints) {
const spacing = 10;
const runSpacing = 10;
double maxHeight = constraints.maxHeight;
double maxWidth = constraints.maxWidth;
double itemWidth = (maxWidth - spacing * 6) / 7;
double itemHeight = (maxHeight - (runSpacing + 30) * 3) / 3;
return Obx(
() => GridView.builder(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 7,
mainAxisSpacing: 10.w,
crossAxisSpacing: 10.w,
childAspectRatio: 0.8,
),
itemCount: controller.canteenSpuList.length,
itemBuilder: (context, index) {
final product = controller.canteenSpuList[index];
return orderCaneenSpuCard(
context,
image: product.image,
name: product.name,
price: product.price,
)
.width(itemWidth)
.height(itemHeight)
.onTap(() => controller.doProduct(product));
},
),
);
},
);
}
/// 商品项
Widget _buildProductItem(
BuildContext context, {
@@ -224,7 +260,7 @@ class CanteenProductPage extends GetView<CanteenProductController> {
final theme = FTheme.of(context);
return <Widget>[
SizedBox(width: 15.w),
_buildProduct().expanded(),
_buildSortProduct().expanded(),
SizedBox(width: 15.w),
_buildUser().width(width * 0.25).decorated(
border: Border.all(