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 items; SaleQuotationModel({required this.name, required this.items}); // 生成fromjson SaleQuotationModel.fromJson(Map json) : name = json['name'], items = (json['items'] as List) .map((e) => SaleQuotationItemModel.fromJson(e)) .toList() .obs; // 生成tojson Map toJson() => { 'name': name, 'items': items.map((e) => e.toJson()).toList(), }; } class SaleQuotationItemModel extends BaseSearchMoreModel { final String name; // 规格 final String? spec; final String? unit; final String? remark; // 成本 num cost; int quantity; num amount; SaleQuotationItemModel( {required this.name, this.spec, this.unit, this.remark, this.cost = 0, this.quantity = 0, this.amount = 0}); SaleQuotationItemModel.fromJson(Map json) : name = json['name'], spec = json['spec'], unit = json['unit'], remark = json['remark'], cost = json['cost'], quantity = json['quantity'], amount = json['amount']; // 生成tojson Map toJson() => { 'name': name, 'spec': spec, 'unit': unit, 'remark': remark, 'cost': cost, 'quantity': quantity, 'amount': amount, }; }