mobile_skt/lib/models/sale_quotation.model.dart

60 lines
1.7 KiB
Dart
Raw Normal View History

2024-10-16 09:48:17 +08:00
import 'package:get/get_rx/src/rx_types/rx_types.dart';
import 'package:sk_base_mobile/models/base_search_more.model.dart';
class SaleQuotationModel extends BaseSearchMoreModel {
final String name;
RxList<SaleQuotationItemModel> items;
SaleQuotationModel({required this.name, required this.items});
// 生成fromjson
SaleQuotationModel.fromJson(Map<String, dynamic> json)
: name = json['name'],
items = (json['items'] as List)
.map((e) => SaleQuotationItemModel.fromJson(e))
.toList()
.obs;
// 生成tojson
Map<String, dynamic> toJson() => {
'name': name,
'items': items.map((e) => e.toJson()).toList(),
};
}
class SaleQuotationItemModel extends BaseSearchMoreModel {
final String name;
// 规格
final String? componentSpecification;
final String? unit;
final String? remark;
// 成本
num unitPrice;
int quantity;
num amount;
SaleQuotationItemModel(
{required this.name,
this.componentSpecification,
this.unit,
this.remark,
this.unitPrice = 0,
this.quantity = 0,
this.amount = 0});
SaleQuotationItemModel.fromJson(Map<String, dynamic> json)
: name = json['name'],
componentSpecification = json['componentSpecification'],
unit = json['unit'],
remark = json['remark'],
unitPrice = json['unitPrice'],
quantity = json['quantity'],
amount = json['amount'];
// 生成tojson
Map<String, dynamic> toJson() => {
'name': name,
'componentSpecification': componentSpecification,
'unit': unit,
'remark': remark,
'unitPrice': unitPrice,
'quantity': quantity,
'amount': amount,
};
}