|
@@ -273,11 +273,16 @@ extension ShoppingCartView : UITableViewDelegate, UITableViewDataSource {
|
|
|
SwiftMoyaNetWorkServiceProduct.shared().productCartDeleteApi(id: productId ?? 0) { [weak self] (data) -> (Void) in
|
|
|
self?.cartListModelArr![indexPath.section].productList?.remove(at: indexPath.row)
|
|
|
tableView.deleteRows(at: [indexPath], with: .none)
|
|
|
+ self?.refreshAccountView()
|
|
|
|
|
|
// 删除后商店为空,刷新table
|
|
|
if self?.cartListModelArr![indexPath.section].productList?.isEmpty ?? true {
|
|
|
+ // 删除后商店为空,刷新table
|
|
|
self?.cartListModelArr?.remove(at: indexPath.section)
|
|
|
tableView.reloadData()
|
|
|
+ } else {
|
|
|
+ // 刷新删除行所在的section(防止索引越界)
|
|
|
+ self?.tableView.reloadSections([indexPath.section], with: UITableView.RowAnimation.none)
|
|
|
}
|
|
|
}
|
|
|
})
|