//
//  AStationDetailPopupView.m
//  AMapNavIOSSDK
//
//  Created by admin on 2026/3/22.
//

#import "AStationDetailPopupView.h"
#import "AMapNavCommonUtil.h"
#import <Masonry/Masonry.h>

// 主题绿色（开始导航按钮背景）
static inline UIColor *AStationThemeGreen(void) {
    return [UIColor colorWithRed:0x1A/255.0 green:0x7C/255.0 blue:0x43/255.0 alpha:1.0];
}

@interface AStationDetailPopupView ()

/// 背景蒙层
@property (nonatomic, strong) UIControl   *maskControl;

/// 弹框卡片容器
@property (nonatomic, strong) UIView      *cardView;

/// 站点名称
@property (nonatomic, strong) UILabel     *stationNameLabel;

/// 预计加氢费用（名称右侧）
@property (nonatomic, strong) UIImageView *costIconView;
@property (nonatomic, strong) UILabel     *costLabel;

/// 地址
@property (nonatomic, strong) UILabel     *addressLabel;

/// 分割线
@property (nonatomic, strong) UIView      *separator;

/// 预计时间行
@property (nonatomic, strong) UIImageView *timeIconView;
@property (nonatomic, strong) UILabel     *timeLabel;

/// 行驶里程
@property (nonatomic, strong) UIImageView *distanceIconView;
@property (nonatomic, strong) UILabel     *distanceLabel;

/// 过路费
@property (nonatomic, strong) UIImageView *tollIconView;
@property (nonatomic, strong) UILabel     *tollLabel;

/// 关闭按钮
@property (nonatomic, strong) UIButton    *closeButton;

/// 开始导航按钮
@property (nonatomic, strong) UIButton    *startNaviButton;

// ── 营业时间 ──
@property (nonatomic, strong) UILabel     *businessHoursLabel;

// ── 站点联系人 ──
@property (nonatomic, strong) UIImageView *contactPersonIconView;
@property (nonatomic, strong) UILabel     *contactPersonLabel;

// ── 加氢价格 ──
@property (nonatomic, strong) UIImageView *priceIconView;
@property (nonatomic, strong) UILabel     *priceLabel;

// ── 联系方式 ──
@property (nonatomic, strong) UIImageView *phoneIconView;
@property (nonatomic, strong) UILabel     *phoneLabel;

@end

@implementation AStationDetailPopupView

#pragma mark - Init

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        [self setupUI];
    }
    return self;
}

#pragma mark - Setup UI

- (void)setupUI {
    [self addSubview:self.maskControl];
    [self.cardView addSubview:self.closeButton];
    [self.cardView addSubview:self.stationNameLabel];
    [self.cardView addSubview:self.costLabel];
    [self.cardView addSubview:self.businessHoursLabel];
    [self.cardView addSubview:self.addressLabel];
    [self.cardView addSubview:self.costIconView];
    [self.cardView addSubview:self.separator];
    [self.cardView addSubview:self.timeIconView];
    [self.cardView addSubview:self.timeLabel];
    [self.cardView addSubview:self.distanceIconView];
    [self.cardView addSubview:self.distanceLabel];
    [self.cardView addSubview:self.tollIconView];
    [self.cardView addSubview:self.tollLabel];
    [self.cardView addSubview:self.contactPersonIconView];
    [self.cardView addSubview:self.contactPersonLabel];
    [self.cardView addSubview:self.priceIconView];
    [self.cardView addSubview:self.priceLabel];
    [self.cardView addSubview:self.phoneIconView];
    [self.cardView addSubview:self.phoneLabel];
    [self.cardView addSubview:self.startNaviButton];

    [self setupConstraints];
    [self updateUI];
}

#pragma mark - Masonry Constraints

- (void)setupConstraints {
    UIView  *card     = self.cardView;
    CGFloat  iconSize = 16;

    // ── 蒙层：铺满父视图 ──
    [self.maskControl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];

    // ── 卡片：左右各16 ──
    [card mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(0);
        make.right.equalTo(self).offset(-0);
        make.bottom.equalTo(self).offset(-0);
    }];

    // ── 关闭按钮：右上角 ──
    [self.closeButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(card).offset(8);
        make.right.equalTo(card).offset(-15);
        make.width.height.mas_equalTo(40);
    }];

    // ── 站点名称 ──
    [self.stationNameLabel setContentHuggingPriority:UILayoutPriorityDefaultLow
                                            forAxis:UILayoutConstraintAxisHorizontal];
    [self.stationNameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(card).offset(25);
        make.left.equalTo(card).offset(16);
        make.right.equalTo(self.closeButton.mas_left).offset(-12);
    }];

    // ── 营业时间（站点名称下方，10pt间距） ──
    [self.businessHoursLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.stationNameLabel.mas_bottom).offset(10);
        make.left.equalTo(card).offset(16);
        make.right.equalTo(card).offset(-16);
    }];

    // ── 地址（营业时间下方，10pt间距） ──
    [self.addressLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.businessHoursLabel.mas_bottom).offset(10);
        make.left.equalTo(card).offset(16);
        make.right.equalTo(card).offset(-16);
    }];
    self.separator.hidden = YES;

    // ── 分割线（地址下方，10pt间距） ──
    [self.separator mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.addressLabel.mas_bottom).offset(10);
        make.left.equalTo(card).offset(16);
        make.right.equalTo(card).offset(-16);
        make.height.mas_equalTo(0.5);
    }];

    CGFloat _offset_y = 18;

    // ── 预计时间行（分割线下方，12pt） ──
    [self.timeIconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.separator.mas_bottom).offset(12);
        make.left.equalTo(card).offset(16);
        make.width.height.mas_equalTo(iconSize);
    }];

    [self.timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.timeIconView);
        make.left.equalTo(self.timeIconView.mas_right).offset(6);
        make.height.mas_equalTo(24);
    }];

    /// cost
    [self.costIconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.timeIconView);
        make.left.equalTo(self.timeLabel.mas_right).offset(40);
        make.width.height.mas_equalTo(iconSize);
    }];

    [self.costLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.costIconView);
        make.left.equalTo(self.costIconView.mas_right).offset(6);
        make.right.lessThanOrEqualTo(card).offset(-10);
    }];

    // ── 行驶里程 + 过路费行（时间行下方，12pt） ──
    [self.distanceIconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.timeIconView.mas_bottom).offset(_offset_y);
        make.left.equalTo(card).offset(16);
        make.width.height.mas_equalTo(iconSize);
    }];

    [self.distanceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.distanceIconView);
        make.left.equalTo(self.distanceIconView.mas_right).offset(6);
        make.width.mas_lessThanOrEqualTo(130);
        make.height.mas_equalTo(24);
    }];

    [self.tollIconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.distanceIconView);
        make.left.equalTo(self.costIconView.mas_left);
        make.width.height.mas_equalTo(iconSize);
    }];

    [self.tollLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.distanceIconView);
        make.left.equalTo(self.tollIconView.mas_right).offset(6);
        make.height.mas_equalTo(24);
    }];

    // ── 站点联系人行（过路费行下方，14pt） ──
    [self.contactPersonIconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.distanceIconView.mas_bottom).offset(_offset_y);
        make.left.equalTo(card).offset(16);
        make.width.height.mas_equalTo(iconSize);
    }];

    [self.contactPersonLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contactPersonIconView);
        make.left.equalTo(self.contactPersonIconView.mas_right).offset(6);
//        make.height.mas_equalTo(24);
        make.width.lessThanOrEqualTo(self).multipliedBy(0.4);
    }];

    // ── 加氢价格（与站点联系人同行，右侧对齐 costIconView） ──
    [self.priceIconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contactPersonIconView);
        make.left.equalTo(self.costIconView.mas_left);
        make.width.height.mas_equalTo(iconSize);
    }];

    [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contactPersonIconView);
        make.left.equalTo(self.priceIconView.mas_right).offset(6);
        make.right.lessThanOrEqualTo(card).offset(-10);
        make.height.mas_equalTo(24);
    }];

    // ── 联系方式行（站点联系人行下方，12pt） ──
    [self.phoneIconView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contactPersonIconView.mas_bottom).offset(_offset_y);
        make.left.equalTo(card).offset(16);
        make.width.height.mas_equalTo(iconSize);
    }];

    [self.phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.phoneIconView);
        make.left.equalTo(self.phoneIconView.mas_right).offset(6);
        make.height.mas_equalTo(24);
    }];

    // ── 开始导航按钮（联系方式行下方18pt，距卡片底部 safeArea） ──
    [self.startNaviButton mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.phoneIconView.mas_bottom).offset(40);
        make.left.equalTo(card).offset(16);
        make.right.equalTo(card).offset(-16);
        make.height.mas_equalTo(48);
        make.bottom.equalTo(card).offset(-AMP_TabbarSafeBottomMargin + (-AMP_TabbarHeight - 13));
    }];
}

#pragma mark - Public

- (void)showInView:(UIView *)parentView {
    self.alpha = 0;
    self.maskControl.alpha = 0;
    [parentView addSubview:self];
    [self mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(parentView);
    }];
    [self playShowAnimation];
}

- (void)hide {
    [self hideWithCompletion:nil];
}

- (void)hideWithCompletion:(void(^)(void))completion {
    [self playDismissAnimationWithCompletion:^{
        [self removeFromSuperview];
        if (completion) {
            completion();
        }
    }];
}

#pragma mark - Setter Override（弹出前赋值 或 弹出后动态更新）

- (void)setPointModel:(ANavPointModel *)pointModel {
    _pointModel = pointModel;
    [self updateUI];
}

- (void)setEstimatedCost:(NSString *)estimatedCost {
    _estimatedCost = [estimatedCost copy];
    [self updateUI];
}

- (void)setEstimatedTime:(NSString *)estimatedTime {
    _estimatedTime = [estimatedTime copy];
    [self updateUI];
}

- (void)setDriveDistance:(NSString *)driveDistance {
    _driveDistance = [driveDistance copy];
    [self updateUI];
}

- (void)setTollFee:(NSString *)tollFee {
    _tollFee = [tollFee copy];
    [self updateUI];
}

- (void)setBusinessHours:(NSString *)businessHours {
    _businessHours = [businessHours copy];
    [self updateUI];
}

- (void)setContactName:(NSString *)contactName {
    _contactName = [contactName copy];
    [self updateUI];
}

- (void)setContactPhone:(NSString *)contactPhone {
    _contactPhone = [contactPhone copy];
    [self updateUI];
}

- (void)setHydrogenPrice:(NSString *)hydrogenPrice {
    _hydrogenPrice = [hydrogenPrice copy];
    [self updateUI];
}

#pragma mark - Data Update

- (void)updateUI {
    self.stationNameLabel.text = (self.pointModel.name.length > 0)
        ? self.pointModel.name : @"-";

    // ── 营业时间 ──
    self.businessHoursLabel.text = (self.businessHours.length > 0)
        ? [NSString stringWithFormat:@"营业时间：%@", self.businessHours]
        : @"营业时间：-";

    self.costLabel.text = ((self.estimatedCost.length > 0) && [self.estimatedCost doubleValue])
        ? [NSString stringWithFormat:@"预计加氢费用：%@元", self.estimatedCost]
        : @"预计加氢费用：-";

    self.addressLabel.text = (self.pointModel.address.length > 0)
        ? self.pointModel.address : @"-";

    // ── 预计时间（始终显示，无值显示"-- 分钟"） ──
    self.timeLabel.text = ((self.estimatedTime.length > 0) && [self.estimatedTime doubleValue] > 0)
        ? [NSString stringWithFormat:@"预计时间：%@分钟", self.estimatedTime]
        : @"预计时间：-";

    // ── 行驶里程（始终显示，无值显示"-- 公里"） ──
    self.distanceLabel.text = ((self.driveDistance.length > 0) && [self.driveDistance doubleValue] > 0)
        ? [NSString stringWithFormat:@"行驶里程：%@公里", self.driveDistance]
        : @"行驶里程：-";

    // ── 过路费（始终显示，无值显示"-- 元"） ──
    self.tollLabel.text = (self.tollFee.length > 0)
        ? [NSString stringWithFormat:@"过路费：%@元", self.tollFee]
        : @"过路费：-";

    // ── 站点联系人（有值显示值，无值显示 -） ──
    self.contactPersonLabel.text = (self.contactName.length > 0)
        ? [NSString stringWithFormat:@"站联系人：%@", self.contactName]
        : @"站联系人：-";

    // ── 加氢价格（有值显示值，无值显示 -） ──
    self.priceLabel.text = (self.hydrogenPrice.length > 0)
        ? [NSString stringWithFormat:@"加氢价格：%@/L", self.hydrogenPrice]
        : @"加氢价格：-";

    // ── 联系方式（有值显示值，无值显示 -） ──
    self.phoneLabel.text = (self.contactPhone.length > 0)
        ? [NSString stringWithFormat:@"联系方式：%@", self.contactPhone]
        : @"联系方式：-";
}

- (void)resetUI {
    self.stationNameLabel.text = @"-";
    self.businessHoursLabel.text = @"营业时间：-";
    self.costLabel.text = @"预计加氢费用：-";
    self.addressLabel.text = @"地址：-";
    self.timeLabel.text = @"预计时间：-";
    self.distanceLabel.text = @"行驶里程：-";
    self.tollLabel.text = @"过路费：-";
    self.contactPersonLabel.text = @"站联系人：-";
    self.priceLabel.text = @"加氢价格：-";
    self.phoneLabel.text = @"联系方式：-";
}

#pragma mark - Animation

/**
 弹入动画
*/
- (void)playShowAnimation {
    // 初始状态：卡片在屏幕下方（完全隐藏在屏幕外）
    [self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(0);
        make.right.equalTo(self).offset(-0);
        make.top.equalTo(self.mas_bottom).offset(0);
    }];

    [self layoutIfNeeded];

    // 目标状态：卡片正常显示
    [self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(0);
        make.right.equalTo(self).offset(-0);
        make.bottom.equalTo(self).offset(0);
    }];

    [UIView animateWithDuration:0.36
                          delay:0
         usingSpringWithDamping:0.82
          initialSpringVelocity:0.5
                        options:UIViewAnimationOptionCurveEaseOut
                     animations:^{
        self.alpha = 1;
        self.maskControl.alpha = 1;
        [self layoutIfNeeded];
    } completion:nil];
}

- (void)playDismissAnimationWithCompletion:(void(^)(void))completion {
    [self.cardView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self).offset(0);
        make.right.equalTo(self).offset(-0);
        make.top.equalTo(self.mas_bottom).offset(20);
    }];

    [UIView animateWithDuration:0.25
                          delay:0
                        options:UIViewAnimationOptionCurveEaseIn
                     animations:^{
        self.maskControl.alpha = 0;
        [self layoutIfNeeded];
    } completion:^(BOOL finished) {
        if (completion) completion();
    }];
}

#pragma mark - Actions

- (void)onMaskTapped {
    if ([self.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapClose:)]) {
        [self.delegate stationDetailPopupViewDidTapClose:self];
    }
    [self hide];
}

- (void)onCloseTapped {
    if ([self.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapClose:)]) {
        [self.delegate stationDetailPopupViewDidTapClose:self];
    }
    [self hide];
}

- (void)onStartNaviTapped {
    __weak typeof(self) weakSelf = self;
    [self hideWithCompletion:^{
        __strong typeof(weakSelf) strongSelf = weakSelf;
        if ([strongSelf.delegate respondsToSelector:@selector(stationDetailPopupViewDidTapStartNavi:)]) {
            [strongSelf.delegate stationDetailPopupViewDidTapStartNavi:strongSelf];
        }
    }];
}

#pragma mark - Lazy Load

- (UIControl *)maskControl {
    if (!_maskControl) {
        _maskControl = [[UIControl alloc] init];
        _maskControl.backgroundColor = [UIColor colorWithWhite:0 alpha:0];
        [_maskControl addTarget:self action:@selector(onMaskTapped) forControlEvents:UIControlEventTouchUpInside];
    }
    return _maskControl;
}

- (UIView *)cardView {
    if (!_cardView) {
        _cardView = [[UIView alloc] init];
        _cardView.backgroundColor = [UIColor whiteColor];
        _cardView.layer.cornerRadius  = 16;
        _cardView.layer.masksToBounds = NO;
        _cardView.layer.shadowColor   = [UIColor blackColor].CGColor;
        _cardView.layer.shadowOpacity = 0.15;
        _cardView.layer.shadowRadius  = 12;
        _cardView.layer.shadowOffset  = CGSizeMake(0, -4);
        [self addSubview:_cardView];
    }
    return _cardView;
}

- (UIButton *)closeButton {
    if (!_closeButton) {
        _closeButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_closeButton setImage:[AMapNavCommonUtil imageWithName:@"icon_close"] forState:UIControlStateNormal];
        [_closeButton setTitleColor:[UIColor colorWithWhite:0.5 alpha:1] forState:UIControlStateNormal];
        _closeButton.titleLabel.font = [UIFont systemFontOfSize:16];
        [_closeButton addTarget:self action:@selector(onCloseTapped) forControlEvents:UIControlEventTouchUpInside];
    }
    return _closeButton;
}

- (UILabel *)stationNameLabel {
    if (!_stationNameLabel) {
        _stationNameLabel = [[UILabel alloc] init];
        _stationNameLabel.font = [UIFont hp_pingFangMedium:18];
        _stationNameLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
        _stationNameLabel.numberOfLines = 2;
        _stationNameLabel.minimumScaleFactor = 0.8;
    }
    return _stationNameLabel;
}

- (UILabel *)costLabel {
    if (!_costLabel) {
        _costLabel = [[UILabel alloc] init];
        _costLabel.font = [UIFont hp_pingFangMedium:14];
        _costLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
        _costLabel.numberOfLines = 1;
        _costLabel.textAlignment = NSTextAlignmentLeft;
    }
    return _costLabel;
}

- (UILabel *)businessHoursLabel {
    if (!_businessHoursLabel) {
        _businessHoursLabel = [[UILabel alloc] init];
        _businessHoursLabel.font = [UIFont hp_pingFangRegular:14];
        _businessHoursLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
        _businessHoursLabel.numberOfLines = 1;
    }
    return _businessHoursLabel;
}

- (UILabel *)addressLabel {
    if (!_addressLabel) {
        _addressLabel = [[UILabel alloc] init];
        _addressLabel.font = [UIFont hp_pingFangRegular:14];
        _addressLabel.textColor = [UIColor hp_colorWithRGBHex:0x86909C];
        _addressLabel.numberOfLines = 2;
    }
    return _addressLabel;
}

- (UIImageView *)costIconView {
    if (!_costIconView) {
        _costIconView = [[UIImageView alloc] init];
        _costIconView.contentMode = UIViewContentModeScaleAspectFit;
        _costIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_fuel"];
    }
    return _costIconView;
}

- (UIView *)separator {
    if (!_separator) {
        _separator = [[UIView alloc] init];
        _separator.backgroundColor = [UIColor colorWithWhite:0.88 alpha:1];
        _separator.hidden = YES;
    }
    return _separator;
}

- (UIImageView *)timeIconView {
    if (!_timeIconView) {
        _timeIconView = [[UIImageView alloc] init];
        _timeIconView.contentMode = UIViewContentModeScaleAspectFit;
        _timeIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_time"];
    }
    return _timeIconView;
}

- (UILabel *)timeLabel {
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc] init];
        _timeLabel.font = [UIFont hp_pingFangMedium:14];
        _timeLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
    }
    return _timeLabel;
}

- (UIImageView *)distanceIconView {
    if (!_distanceIconView) {
        _distanceIconView = [[UIImageView alloc] init];
        _distanceIconView.contentMode = UIViewContentModeScaleAspectFit;
        _distanceIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_mileage"];
    }
    return _distanceIconView;
}

- (UILabel *)distanceLabel {
    if (!_distanceLabel) {
        _distanceLabel = [[UILabel alloc] init];
        _distanceLabel.font = [UIFont hp_pingFangMedium:14];
        _distanceLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
    }
    return _distanceLabel;
}

- (UIImageView *)tollIconView {
    if (!_tollIconView) {
        _tollIconView = [[UIImageView alloc] init];
        _tollIconView.contentMode = UIViewContentModeScaleAspectFit;
        _tollIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_toll"];
    }
    return _tollIconView;
}

- (UILabel *)tollLabel {
    if (!_tollLabel) {
        _tollLabel = [[UILabel alloc] init];
        _tollLabel.font = [UIFont hp_pingFangMedium:14];
        _tollLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
    }
    return _tollLabel;
}

- (UIImageView *)contactPersonIconView {
    if (!_contactPersonIconView) {
        _contactPersonIconView = [[UIImageView alloc] init];
        _contactPersonIconView.contentMode = UIViewContentModeScaleAspectFit;
        _contactPersonIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_person"];
    }
    return _contactPersonIconView;
}

- (UILabel *)contactPersonLabel {
    if (!_contactPersonLabel) {
        _contactPersonLabel = [[UILabel alloc] init];
        _contactPersonLabel.font = [UIFont hp_pingFangMedium:14];
        _contactPersonLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
    }
    return _contactPersonLabel;
}

- (UIImageView *)priceIconView {
    if (!_priceIconView) {
        _priceIconView = [[UIImageView alloc] init];
        _priceIconView.contentMode = UIViewContentModeScaleAspectFit;
        _priceIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_price"];
    }
    return _priceIconView;
}

- (UILabel *)priceLabel {
    if (!_priceLabel) {
        _priceLabel = [[UILabel alloc] init];
        _priceLabel.font = [UIFont hp_pingFangMedium:14];
        _priceLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
    }
    return _priceLabel;
}

- (UIImageView *)phoneIconView {
    if (!_phoneIconView) {
        _phoneIconView = [[UIImageView alloc] init];
        _phoneIconView.contentMode = UIViewContentModeScaleAspectFit;
        _phoneIconView.image = [AMapNavCommonUtil imageWithName3x:@"ic_phone"];
    }
    return _phoneIconView;
}

- (UILabel *)phoneLabel {
    if (!_phoneLabel) {
        _phoneLabel = [[UILabel alloc] init];
        _phoneLabel.font = [UIFont hp_pingFangMedium:14];
        _phoneLabel.textColor = [UIColor hp_colorWithRGBHex:0x1D2129];
    }
    return _phoneLabel;
}

- (UIButton *)startNaviButton {
    if (!_startNaviButton) {
        _startNaviButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [_startNaviButton setTitle:@"开始导航" forState:UIControlStateNormal];
        [_startNaviButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _startNaviButton.titleLabel.font = [UIFont boldSystemFontOfSize:17];
        _startNaviButton.backgroundColor = AStationThemeGreen();
        _startNaviButton.layer.cornerRadius = 24;
        [_startNaviButton addTarget:self action:@selector(onStartNaviTapped) forControlEvents:UIControlEventTouchUpInside];
    }
    return _startNaviButton;
}

@end
