fix rates
This commit is contained in:
@@ -8,6 +8,9 @@ class Rate {
|
||||
double freeDeliveryWeight;
|
||||
double volumetricRatio;
|
||||
|
||||
double diffDiscountWeight;
|
||||
double diffWeightRate;
|
||||
|
||||
List<CargoType> cargoTypes;
|
||||
List<CustomDuty> customDuties;
|
||||
List<DiscountByWeight> discountByWeights;
|
||||
@@ -22,17 +25,20 @@ class Rate {
|
||||
? null
|
||||
: cargoTypes.firstWhere((e) => e.name == "General");
|
||||
|
||||
Rate({
|
||||
this.deliveryFee,
|
||||
this.freeDeliveryWeight,
|
||||
this.volumetricRatio,
|
||||
});
|
||||
Rate(
|
||||
{this.deliveryFee,
|
||||
this.freeDeliveryWeight,
|
||||
this.volumetricRatio,
|
||||
this.diffDiscountWeight,
|
||||
this.diffWeightRate});
|
||||
|
||||
factory Rate.fromMap(Map<String, dynamic> map) {
|
||||
return Rate(
|
||||
deliveryFee: (map['delivery_fee'] ?? 0).toDouble(),
|
||||
freeDeliveryWeight: (map['free_delivery_weight'] ?? 0).toDouble(),
|
||||
volumetricRatio: (map['volumetric_ratio'] ?? 0).toDouble(),
|
||||
diffDiscountWeight: (map['diff_discount_weight'] ?? 0).toDouble(),
|
||||
diffWeightRate: (map['diff_weight_rate'] ?? 0).toDouble(),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -41,17 +47,21 @@ class Rate {
|
||||
"delivery_fee": deliveryFee,
|
||||
'free_delivery_weight': freeDeliveryWeight,
|
||||
'volumetric_ratio': volumetricRatio,
|
||||
'diff_discount_weight': diffDiscountWeight,
|
||||
'diff_weight_rate': diffWeightRate,
|
||||
};
|
||||
}
|
||||
|
||||
bool isChangedForEdit(Rate rate) {
|
||||
return rate.freeDeliveryWeight != this.freeDeliveryWeight ||
|
||||
rate.deliveryFee != this.deliveryFee ||
|
||||
rate.volumetricRatio != this.volumetricRatio;
|
||||
rate.volumetricRatio != this.volumetricRatio ||
|
||||
rate.diffDiscountWeight != this.diffDiscountWeight ||
|
||||
rate.diffWeightRate != this.diffWeightRate;
|
||||
}
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Rate{deliveryFee:$deliveryFee,freeDeliveryWeight:$freeDeliveryWeight,volumetricRatio:$volumetricRatio}';
|
||||
return 'Rate{deliveryFee:$deliveryFee,freeDeliveryWeight:$freeDeliveryWeight,volumetricRatio:$volumetricRatio,diffDiscountWeight:$diffDiscountWeight,diffWeightRate:$diffWeightRate}';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user