2024-04-01 17:35:34 +08:00
|
|
|
import 'package:get/get_rx/src/rx_types/rx_types.dart';
|
2024-04-03 13:45:34 +08:00
|
|
|
import 'package:sk_base_mobile/models/base_search_more.model.dart';
|
2024-04-01 17:35:34 +08:00
|
|
|
|
2024-04-03 13:45:34 +08:00
|
|
|
class SaleQuotationModel extends BaseSearchMoreModel {
|
2024-04-01 17:35:34 +08:00
|
|
|
final String name;
|
2024-04-02 16:22:21 +08:00
|
|
|
RxList<SaleQuotationItemModel> items;
|
2024-04-01 17:35:34 +08:00
|
|
|
SaleQuotationModel({required this.name, required this.items});
|
2024-04-03 13:45:34 +08:00
|
|
|
// 生成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(),
|
|
|
|
};
|
2024-04-01 17:35:34 +08:00
|
|
|
}
|
|
|
|
|
2024-04-03 13:45:34 +08:00
|
|
|
class SaleQuotationItemModel extends BaseSearchMoreModel {
|
2024-04-01 17:35:34 +08:00
|
|
|
final String name;
|
|
|
|
// 规格
|
|
|
|
final String? spec;
|
|
|
|
final String? unit;
|
|
|
|
final String? remark;
|
|
|
|
// 成本
|
2024-04-12 09:56:00 +08:00
|
|
|
num cost;
|
2024-04-03 13:45:34 +08:00
|
|
|
int quantity;
|
2024-04-12 09:56:00 +08:00
|
|
|
num amount;
|
2024-04-03 13:45:34 +08:00
|
|
|
|
2024-04-01 17:35:34 +08:00
|
|
|
SaleQuotationItemModel(
|
|
|
|
{required this.name,
|
|
|
|
this.spec,
|
|
|
|
this.unit,
|
|
|
|
this.remark,
|
|
|
|
this.cost = 0,
|
|
|
|
this.quantity = 0,
|
|
|
|
this.amount = 0});
|
2024-04-03 13:45:34 +08:00
|
|
|
SaleQuotationItemModel.fromJson(Map<String, dynamic> json)
|
|
|
|
: name = json['name'],
|
|
|
|
spec = json['spec'],
|
|
|
|
unit = json['unit'],
|
|
|
|
remark = json['remark'],
|
|
|
|
cost = json['cost'],
|
|
|
|
quantity = json['quantity'],
|
|
|
|
amount = json['amount'];
|
|
|
|
// 生成tojson
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
|
|
'name': name,
|
|
|
|
'spec': spec,
|
|
|
|
'unit': unit,
|
|
|
|
'remark': remark,
|
|
|
|
'cost': cost,
|
|
|
|
'quantity': quantity,
|
|
|
|
'amount': amount,
|
|
|
|
};
|
2024-04-01 17:35:34 +08:00
|
|
|
}
|