feat(drone-dock): 接入游客确认交付并对齐网页样式
This commit is contained in:
@@ -9,6 +9,7 @@ final class DroneDockOrdersViewController: BaseViewController {
|
||||
private let preparationControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController
|
||||
private let materialsControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController
|
||||
private let deliveryControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController
|
||||
private let confirmationControllerFactory: (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController
|
||||
private let countLabel = DroneDockStyle.label(size: 17, weight: .semibold)
|
||||
private let descriptionLabel = DroneDockStyle.label("分配给我的全部订单,含已完成订单", size: 12, color: DroneDockStyle.secondary)
|
||||
private let filterView = DroneShootingOrderFilterView()
|
||||
@@ -27,11 +28,13 @@ final class DroneDockOrdersViewController: BaseViewController {
|
||||
init(viewModel: DroneDockOrdersViewModel,
|
||||
preparationControllerFactory: @escaping (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController,
|
||||
materialsControllerFactory: @escaping (DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController,
|
||||
deliveryControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController)? = nil) {
|
||||
deliveryControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext, Int?) -> UIViewController)? = nil,
|
||||
confirmationControllerFactory: ((DroneDockHomeOrder, DroneDockHomeContext) -> UIViewController)? = nil) {
|
||||
self.viewModel = viewModel
|
||||
self.preparationControllerFactory = preparationControllerFactory
|
||||
self.materialsControllerFactory = materialsControllerFactory
|
||||
self.deliveryControllerFactory = deliveryControllerFactory ?? DroneDockDeliveryEntry.makeController
|
||||
self.confirmationControllerFactory = confirmationControllerFactory ?? DroneDockConfirmationEntry.makeController
|
||||
super.init(nibName: nil, bundle: nil)
|
||||
hidesBottomBarWhenPushed = true
|
||||
}
|
||||
@@ -117,7 +120,7 @@ final class DroneDockOrdersViewController: BaseViewController {
|
||||
cell.cardView.onShootingTap = { [weak self] in self?.openPreparation(orderID: id) }
|
||||
cell.cardView.onMaterialsTap = { [weak self] in self?.openMaterials(orderID: id) }
|
||||
cell.cardView.onDeliveryTap = { [weak self] in self?.openDelivery(orderID: id) }
|
||||
cell.cardView.onConfirmationTap = { [weak self] in self?.showUnavailable("交付确认") }
|
||||
cell.cardView.onConfirmationTap = { [weak self] in self?.openConfirmation(orderID: id) }
|
||||
}
|
||||
return cell
|
||||
}
|
||||
@@ -207,6 +210,17 @@ final class DroneDockOrdersViewController: BaseViewController {
|
||||
|
||||
private func showUnavailable(_ feature: String) { showAlert(title: feature, message: "该功能暂未开放") }
|
||||
|
||||
private func openConfirmation(orderID: String) {
|
||||
guard operation == nil, navigationController?.topViewController === self, presentedViewController == nil,
|
||||
let order = viewModel.orders.first(where: { $0.orderID == orderID }),
|
||||
order.canConfirm == true || order.orderStatus == 30 || order.confirmStatus == 2 else { return }
|
||||
guard DroneDockHomeMetric.usableText(order.orderNumber) != nil else {
|
||||
showAlert(title: "订单交付确认", message: "缺少订单号,请刷新拍摄订单后重试")
|
||||
return
|
||||
}
|
||||
navigationController?.pushViewController(confirmationControllerFactory(order, viewModel.context), animated: true)
|
||||
}
|
||||
|
||||
private func openDelivery(orderID: String) {
|
||||
guard operation == nil, presentedViewController == nil,
|
||||
let order = viewModel.orders.first(where: { $0.orderID == orderID }),
|
||||
|
||||
Reference in New Issue
Block a user