feat:超市商品页面
This commit is contained in:
1 parent
e7c2fcd733
commit
de2f5e14b6
14 files changed
+218
-85
No files matched your search
@@ -126,7 +126,7 @@ class _$AppDatabase extends AppDatabase {
|
||||
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(
|
||||
'CREATE TABLE IF NOT EXISTS `shop_card` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `orderId` INTEGER NOT NULL, `productServiceUniqueCode` TEXT NOT NULL, `productName` TEXT NOT NULL, `productPic` TEXT NOT NULL, `productPrice` INTEGER NOT NULL, `productNumber` INTEGER NOT NULL, `productWidget` REAL NOT NULL, `totalPrice` INTEGER NOT NULL)');
|
||||
'CREATE TABLE IF NOT EXISTS `shop_card` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `orderId` INTEGER NOT NULL, `productServiceUniqueCode` TEXT NOT NULL, `productName` TEXT NOT NULL, `productPic` TEXT NOT NULL, `productPrice` INTEGER NOT NULL, `nature` TEXT NOT NULL, `productNumber` INTEGER NOT NULL, `productWidget` REAL NOT NULL, `totalPrice` INTEGER NOT NULL)');
|
||||
await database.execute(
|
||||
'CREATE TABLE IF NOT EXISTS `classify` (`id` INTEGER PRIMARY KEY AUTOINCREMENT, `serviceUniqueCode` TEXT NOT NULL, `sysType` TEXT NOT NULL, `name` TEXT NOT NULL, `categoryType` TEXT NOT NULL, `sort` INTEGER NOT NULL, `createTime` TEXT NOT NULL, `updateTime` TEXT NOT NULL, `delFlag` INTEGER NOT NULL)');
|
||||
await database.execute(
|
||||
@@ -853,6 +853,7 @@ class _$ShopCardDao extends ShopCardDao {
|
||||
'productName': item.productName,
|
||||
'productPic': item.productPic,
|
||||
'productPrice': item.productPrice,
|
||||
'nature': _supermarketNatureConverter.encode(item.nature),
|
||||
'productNumber': item.productNumber,
|
||||
'productWidget': item.productWidget,
|
||||
'totalPrice': item.totalPrice
|
||||
@@ -868,6 +869,7 @@ class _$ShopCardDao extends ShopCardDao {
|
||||
'productName': item.productName,
|
||||
'productPic': item.productPic,
|
||||
'productPrice': item.productPrice,
|
||||
'nature': _supermarketNatureConverter.encode(item.nature),
|
||||
'productNumber': item.productNumber,
|
||||
'productWidget': item.productWidget,
|
||||
'totalPrice': item.totalPrice
|
||||
@@ -883,6 +885,7 @@ class _$ShopCardDao extends ShopCardDao {
|
||||
'productName': item.productName,
|
||||
'productPic': item.productPic,
|
||||
'productPrice': item.productPrice,
|
||||
'nature': _supermarketNatureConverter.encode(item.nature),
|
||||
'productNumber': item.productNumber,
|
||||
'productWidget': item.productWidget,
|
||||
'totalPrice': item.totalPrice
|
||||
@@ -911,6 +914,7 @@ class _$ShopCardDao extends ShopCardDao {
|
||||
productName: row['productName'] as String,
|
||||
productPic: row['productPic'] as String,
|
||||
productPrice: row['productPrice'] as int,
|
||||
nature: _supermarketNatureConverter.decode(row['nature'] as String),
|
||||
productNumber: row['productNumber'] as int,
|
||||
productWidget: row['productWidget'] as double,
|
||||
totalPrice: row['totalPrice'] as int),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:floor/floor.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:pj_supermarket_cloud/common/index.dart';
|
||||
|
||||
part 'shop_card_entity.g.dart';
|
||||
|
||||
@@ -25,6 +26,9 @@ class ShopCardEntity {
|
||||
/// 商品价格(分)
|
||||
int productPrice;
|
||||
|
||||
/// 商品性质
|
||||
ProductNature nature;
|
||||
|
||||
/// 数量 食堂特有
|
||||
int productNumber;
|
||||
|
||||
@@ -41,6 +45,7 @@ class ShopCardEntity {
|
||||
required this.productName,
|
||||
required this.productPic,
|
||||
required this.productPrice,
|
||||
required this.nature,
|
||||
required this.productNumber,
|
||||
required this.productWidget,
|
||||
required this.totalPrice,
|
||||
|
||||
@@ -14,6 +14,7 @@ ShopCardEntity _$ShopCardEntityFromJson(Map<String, dynamic> json) =>
|
||||
productName: json['productName'] as String,
|
||||
productPic: json['productPic'] as String,
|
||||
productPrice: (json['productPrice'] as num).toInt(),
|
||||
nature: $enumDecode(_$ProductNatureEnumMap, json['nature']),
|
||||
productNumber: (json['productNumber'] as num).toInt(),
|
||||
productWidget: (json['productWidget'] as num).toDouble(),
|
||||
totalPrice: (json['totalPrice'] as num).toInt(),
|
||||
@@ -27,7 +28,13 @@ Map<String, dynamic> _$ShopCardEntityToJson(ShopCardEntity instance) =>
|
||||
'productName': instance.productName,
|
||||
'productPic': instance.productPic,
|
||||
'productPrice': instance.productPrice,
|
||||
'nature': _$ProductNatureEnumMap[instance.nature]!,
|
||||
'productNumber': instance.productNumber,
|
||||
'productWidget': instance.productWidget,
|
||||
'totalPrice': instance.totalPrice,
|
||||
};
|
||||
|
||||
const _$ProductNatureEnumMap = {
|
||||
ProductNature.DEFAULT: 'DEFAULT',
|
||||
ProductNature.WEIGHT: 'WEIGHT',
|
||||
};
|
||||
@@ -24,7 +24,7 @@ class SupermarketSpuEntity {
|
||||
String productName;
|
||||
|
||||
/// 商品性质(字典)
|
||||
SupermarketNature productNature;
|
||||
ProductNature productNature;
|
||||
|
||||
/// 条码
|
||||
String? barCode;
|
||||
|
||||
@@ -14,8 +14,7 @@ SupermarketSpuEntity _$SupermarketSpuEntityFromJson(
|
||||
classifyServiceUniqueCode: json['classifyServiceUniqueCode'] as String,
|
||||
productCode: json['productCode'] as String,
|
||||
productName: json['productName'] as String,
|
||||
productNature:
|
||||
$enumDecode(_$SupermarketNatureEnumMap, json['productNature']),
|
||||
productNature: $enumDecode(_$ProductNatureEnumMap, json['productNature']),
|
||||
barCode: json['barCode'] as String?,
|
||||
packageNum: (json['packageNum'] as num).toInt(),
|
||||
unit: json['unit'] as String,
|
||||
@@ -40,7 +39,7 @@ Map<String, dynamic> _$SupermarketSpuEntityToJson(
|
||||
'classifyServiceUniqueCode': instance.classifyServiceUniqueCode,
|
||||
'productCode': instance.productCode,
|
||||
'productName': instance.productName,
|
||||
'productNature': _$SupermarketNatureEnumMap[instance.productNature]!,
|
||||
'productNature': _$ProductNatureEnumMap[instance.productNature]!,
|
||||
'barCode': instance.barCode,
|
||||
'packageNum': instance.packageNum,
|
||||
'unit': instance.unit,
|
||||
@@ -57,7 +56,7 @@ Map<String, dynamic> _$SupermarketSpuEntityToJson(
|
||||
'delFlag': instance.delFlag,
|
||||
};
|
||||
|
||||
const _$SupermarketNatureEnumMap = {
|
||||
SupermarketNature.DEFAULT: 'DEFAULT',
|
||||
SupermarketNature.WEIGHT: 'WEIGHT',
|
||||
const _$ProductNatureEnumMap = {
|
||||
ProductNature.DEFAULT: 'DEFAULT',
|
||||
ProductNature.WEIGHT: 'WEIGHT',
|
||||
};
|
||||
@@ -107,15 +107,14 @@ class ProductHourTypeConverter extends TypeConverter<ProductHourType, String> {
|
||||
}
|
||||
}
|
||||
|
||||
class SupermarketNatureConverter
|
||||
extends TypeConverter<SupermarketNature, String> {
|
||||
class SupermarketNatureConverter extends TypeConverter<ProductNature, String> {
|
||||
@override
|
||||
SupermarketNature decode(String databaseValue) {
|
||||
return SupermarketNature.values.byName(databaseValue);
|
||||
ProductNature decode(String databaseValue) {
|
||||
return ProductNature.values.byName(databaseValue);
|
||||
}
|
||||
|
||||
@override
|
||||
String encode(SupermarketNature value) {
|
||||
String encode(ProductNature value) {
|
||||
return value.name;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user