164 lines
5.1 KiB
Dart
164 lines
5.1 KiB
Dart
import 'dart:convert';
|
|
|
|
import 'address.dart';
|
|
import 'business_time.dart';
|
|
import 'distance_info.dart';
|
|
import 'image_url.dart';
|
|
import 'product.dart';
|
|
import 'waiting_line.dart';
|
|
|
|
class QuickInput {
|
|
String value;
|
|
QuickInput.fromJson(Map<String, dynamic> json)
|
|
: value = json['value'];
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'value': value
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return json.encode(this);
|
|
}
|
|
}
|
|
|
|
class Business {
|
|
int id;
|
|
String name;
|
|
String phone;
|
|
Address address;
|
|
String fullAddress;
|
|
String picUrl;
|
|
int status;
|
|
List<BusinessTime> openingTime;
|
|
double shippingFee;
|
|
double packageFee;
|
|
double minPrice;
|
|
int shippingTime;
|
|
int monthSales;
|
|
String bulletin;
|
|
int category;
|
|
bool isLike;
|
|
String description;
|
|
String policy;
|
|
String bannerImageUrl;
|
|
int todayOpen;
|
|
int todayClose;
|
|
bool showMonthlySold;
|
|
List<ImageUrl> slideImages;
|
|
List<Product> promoProducts;
|
|
String paypalEmail;
|
|
bool deliveryCanadaPost;
|
|
bool deliveryStoreDelivery;
|
|
bool deliveryPickup;
|
|
String currency;
|
|
List<WaitingLine> waitingLine;
|
|
bool enableWaitingLine;
|
|
double pointsToCreditsConversionRate;
|
|
String chaseXLogin;
|
|
String chaseTransactionKey;
|
|
String chaseResponseKey;
|
|
DistanceInfo distanceInfo;
|
|
int commentsCount;
|
|
bool forceClose;
|
|
bool isPublic;
|
|
double referrerCoupon;
|
|
bool instanceDelivery;
|
|
List<QuickInput> quickInputs;
|
|
|
|
Business.fromJson(Map<String, dynamic> json)
|
|
: id = json['id'],
|
|
name = json['name'],
|
|
phone = json['phone'],
|
|
address = Address.fromJson(json['address']),
|
|
fullAddress = json['full_address'],
|
|
picUrl = json['pic_url'],
|
|
status = json['status'],
|
|
openingTime = (json['opening_time'] as List).map((i) => BusinessTime.fromJson(i)).toList(),
|
|
shippingFee = double.parse(json['shipping_fee'].toString()),
|
|
packageFee = double.parse(json['package_fee'].toString()),
|
|
minPrice = double.parse(json['min_price'].toString()),
|
|
shippingTime = json['shipping_time'],
|
|
monthSales = json['month_sales'],
|
|
bulletin = json['bulletin'],
|
|
category = json['category'],
|
|
isLike = json['is_like'],
|
|
description = json['description'],
|
|
policy = json['policy'],
|
|
bannerImageUrl = json['banner_image_url'],
|
|
todayOpen = json['today_open'],
|
|
todayClose = json['today_close'],
|
|
showMonthlySold = json['show_monthly_sold'],
|
|
slideImages = (json['slide_images'] as List).map((i) => ImageUrl.fromJson(i)).toList(),
|
|
promoProducts = (json['promo_products'] as List).map((i) => Product.fromJson(i)).toList(),
|
|
paypalEmail = json['paypal_email'],
|
|
deliveryCanadaPost = json['delivery_canada_post'],
|
|
deliveryStoreDelivery = json['delivery_store_delivery'],
|
|
deliveryPickup = json['delivery_pickup'],
|
|
currency = json['currency'],
|
|
|
|
waitingLine = (json['waiting_line'] as List).map((i) => WaitingLine.fromJson(i)).toList(),
|
|
|
|
enableWaitingLine = json['enable_waiting_line'],
|
|
pointsToCreditsConversionRate = double.parse(json['points_to_credits_conversion_rate'].toString()),
|
|
chaseXLogin = json['chase_x_login'],
|
|
chaseTransactionKey = json['chase_transaction_key'],
|
|
chaseResponseKey = json['chase_response_key'],
|
|
distanceInfo = json['distance_info'] != null ? DistanceInfo.fromJson(json['distance_info']) : null,
|
|
commentsCount = json['comments_count'],
|
|
forceClose = json['force_close'],
|
|
isPublic = json['is_public'],
|
|
referrerCoupon = double.parse(json['customer_referrer_coupon_amount'].toString()),
|
|
instanceDelivery = json['instance_delivery'],
|
|
quickInputs = (json['quick_inputs'] as List).map((i) => QuickInput.fromJson(i)).toList();
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'id': id,
|
|
'name': name,
|
|
'phone': phone,
|
|
'address': address,
|
|
'full_address': fullAddress,
|
|
'pic_url': picUrl,
|
|
'status': status,
|
|
'opening_time': openingTime,
|
|
'shipping_fee': shippingFee,
|
|
'package_fee': packageFee,
|
|
'min_price': minPrice,
|
|
'shipping_time': shippingTime,
|
|
'month_sales': monthSales,
|
|
'bulletin': bulletin,
|
|
'category': category,
|
|
'is_like': isLike,
|
|
'description': description,
|
|
'policy': policy,
|
|
'banner_image_url': bannerImageUrl,
|
|
'today_open': todayOpen,
|
|
'today_close': todayClose,
|
|
'show_monthly_sold': showMonthlySold,
|
|
'slide_images': slideImages,
|
|
'promo_products': promoProducts,
|
|
'paypal_email': paypalEmail,
|
|
'delivery_canada_post': deliveryCanadaPost,
|
|
'delivery_store_delivery': deliveryStoreDelivery,
|
|
'delivery_pickup': deliveryPickup,
|
|
'currency': currency,
|
|
'waiting_line': waitingLine,
|
|
'enable_waiting_line': enableWaitingLine,
|
|
'points_to_credits_conversion_rate': pointsToCreditsConversionRate,
|
|
'chase_x_login': chaseXLogin,
|
|
'chase_transaction_key': chaseTransactionKey,
|
|
'chase_response_key': chaseResponseKey,
|
|
'distance_info': distanceInfo,
|
|
'comments_count': commentsCount,
|
|
'force_close': forceClose,
|
|
'is_public': isPublic,
|
|
'customer_referrer_coupon_amount': referrerCoupon,
|
|
'instance_delivery': instanceDelivery,
|
|
'quick_inputs': quickInputs
|
|
};
|
|
|
|
@override
|
|
String toString() {
|
|
return json.encode(this);
|
|
}
|
|
} |