Commit fb00b797896a2fe7b0c1542015b1bbefdc674114
1 parent
b3179404
优惠券管理
Showing
5 changed files
with
287 additions
and
21 deletions
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -68,6 +68,7 @@ |
| 68 | 68 | 1917335C2B3283FF007BCC04 /* CNLiveCouponGoodsListSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917335B2B3283FF007BCC04 /* CNLiveCouponGoodsListSearchView.swift */; }; |
| 69 | 69 | 1917335E2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917335D2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift */; }; |
| 70 | 70 | 191733602B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917335F2B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift */; }; |
| 71 | + 191733622B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733612B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift */; }; | |
| 71 | 72 | 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */; }; |
| 72 | 73 | 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */; }; |
| 73 | 74 | 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */; }; |
| ... | ... | @@ -299,6 +300,7 @@ |
| 299 | 300 | 1917335B2B3283FF007BCC04 /* CNLiveCouponGoodsListSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponGoodsListSearchView.swift; sourceTree = "<group>"; }; |
| 300 | 301 | 1917335D2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponListTableViewCell.swift; sourceTree = "<group>"; }; |
| 301 | 302 | 1917335F2B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponGoodsListTableViewCell.swift; sourceTree = "<group>"; }; |
| 303 | + 191733612B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponsManagerViewController.swift; sourceTree = "<group>"; }; | |
| 302 | 304 | 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideViewController.swift; sourceTree = "<group>"; }; |
| 303 | 305 | 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideViewModel.swift; sourceTree = "<group>"; }; |
| 304 | 306 | 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModel.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -543,6 +545,7 @@ |
| 543 | 545 | isa = PBXGroup; |
| 544 | 546 | children = ( |
| 545 | 547 | 1917333E2B284C93007BCC04 /* CNLiveShopCouponCreateViewController.swift */, |
| 548 | + 191733612B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift */, | |
| 546 | 549 | ); |
| 547 | 550 | path = ShopCoupon; |
| 548 | 551 | sourceTree = "<group>"; |
| ... | ... | @@ -1414,6 +1417,7 @@ |
| 1414 | 1417 | 1917330F2B10989C007BCC04 /* CNLivePlayerView.swift in Sources */, |
| 1415 | 1418 | 7989B5C72A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift in Sources */, |
| 1416 | 1419 | 191733502B2C3E1F007BCC04 /* CNLivePickerView.swift in Sources */, |
| 1420 | + 191733622B3538DC007BCC04 /* CNLiveShopCouponsManagerViewController.swift in Sources */, | |
| 1417 | 1421 | 191732902B0348F6007BCC04 /* CNLiveSwitchView.swift in Sources */, |
| 1418 | 1422 | 792B53282AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift in Sources */, |
| 1419 | 1423 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */, | ... | ... |
metaCode/Classes/Main/HomePage/Controller/CNLiveShopConsoleController.swift
| ... | ... | @@ -98,8 +98,8 @@ class CNLiveShopConsoleController: CNLiveBaseViewController, UICollectionViewDel |
| 98 | 98 | currentViewController()?.navigationController?.pushViewController(vc, animated: false) |
| 99 | 99 | }else if itemModel.type == CNLiveShopConsoleType.GLYHQ.rawValue{ |
| 100 | 100 | //优惠券管理 |
| 101 | -// CNLiveShopCouponsManagerViewController *vc = [[DSShopCouponsManagerViewController alloc] init]; | |
| 102 | -// [self dsPushViewController:vc animated:YES]; | |
| 101 | + let vc = CNLiveShopCouponsManagerViewController() | |
| 102 | + currentViewController()?.navigationController?.pushViewController(vc, animated: false) | |
| 103 | 103 | }else if itemModel.type == CNLiveShopConsoleType.CreateShopClassify.rawValue{ |
| 104 | 104 | //创建店铺分类 |
| 105 | 105 | let vc = CNLiveCreateShopClassifyViewController() | ... | ... |
metaCode/Classes/Main/HomePage/Controller/ShopCoupon/CNLiveShopCouponsManagerViewController.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopCouponsManagerViewController.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/22. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import MJRefresh | |
| 10 | +import SnapKit | |
| 11 | +class CNLiveShopCouponsManagerViewController:CNLiveBaseViewController,UITableViewDelegate,UITableViewDataSource{ | |
| 12 | + let CNLiveCouponListTableViewCellID = "CNLiveCouponListTableViewCellID" | |
| 13 | + let CNLiveCouponListTableViewHeaderFooterViewID = "CNLiveCouponListTableViewHeaderFooterViewID" | |
| 14 | + | |
| 15 | + lazy var listTableView: UITableView = { | |
| 16 | + let tableView = UITableView(frame: .zero, style: .plain) | |
| 17 | + tableView.separatorStyle = .none | |
| 18 | + tableView.backgroundColor = HexColor("#F6F6F6") | |
| 19 | + tableView.delegate = self | |
| 20 | + tableView.dataSource = self | |
| 21 | + tableView.allowsMultipleSelection = true | |
| 22 | + tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in | |
| 23 | + self!.requestData() | |
| 24 | + }) | |
| 25 | + tableView.register(CNLiveCouponListTableViewCell.self, forCellReuseIdentifier: CNLiveCouponListTableViewCellID) | |
| 26 | + tableView.register(UITableViewHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: CNLiveCouponListTableViewHeaderFooterViewID) | |
| 27 | + return tableView | |
| 28 | + }() | |
| 29 | + lazy var dataSource :Array<Any> = { | |
| 30 | + let dataSource = Array<Any>() | |
| 31 | + return dataSource | |
| 32 | + }() | |
| 33 | + | |
| 34 | + lazy var createCouponBtn: UIButton = { | |
| 35 | + let button = UIButton(type: .custom) | |
| 36 | + button.setTitle("新增优惠券", for: .normal) | |
| 37 | + button.setTitleColor(HexColor("#FD862E"), for: .normal) | |
| 38 | + button.setImage(UIImage(named: "DS_coupon_create"), for: .normal) | |
| 39 | + button.titleLabel?.font = Font_15 | |
| 40 | + | |
| 41 | + let createLayer = CAShapeLayer() | |
| 42 | + createLayer.backgroundColor = HexColor("#E2E2E2")?.cgColor | |
| 43 | + createLayer.frame = CGRect(x: 0, y: 0, width: KSreenWidth, height: 0.5) | |
| 44 | + button.layer.addSublayer(createLayer) | |
| 45 | + button.addTarget(self, action: #selector(createCouponClick(_:)), for: .touchUpInside) | |
| 46 | + | |
| 47 | + return button | |
| 48 | + }() | |
| 49 | + | |
| 50 | + lazy var deleteDic: NSMutableDictionary = { | |
| 51 | + let dictionary = NSMutableDictionary() | |
| 52 | + return dictionary | |
| 53 | + }() | |
| 54 | + | |
| 55 | + func requestData(){ | |
| 56 | + showLoading(message: "") | |
| 57 | + let rightBar = self.rightNavBtns[0] | |
| 58 | + if rightBar.titleLabel?.text == "完成"{ | |
| 59 | + self.tableViewEidting(edit: false) | |
| 60 | + } | |
| 61 | + CNLiveShopCouponViewModel.requestCouponListResponse { result, status in | |
| 62 | + if status == .success{ | |
| 63 | + let dataArray = result as! [CNLiveShopCouponListModel] | |
| 64 | + self.listTableView.mj_header?.endRefreshing() | |
| 65 | + hiddenLoading() | |
| 66 | + if dataArray.count == 0{ | |
| 67 | + if self.dataSource.count != 0{ | |
| 68 | + self.dataSource = dataArray | |
| 69 | + self.listTableView.reloadData() | |
| 70 | + } | |
| 71 | + rightBar.isHidden = true | |
| 72 | + return | |
| 73 | + } | |
| 74 | + rightBar.isHidden = false | |
| 75 | + self.dataSource = dataArray | |
| 76 | + self.listTableView.reloadData() | |
| 77 | + }else{ | |
| 78 | + hiddenLoading() | |
| 79 | + self.listTableView.mj_header?.endRefreshing() | |
| 80 | + } | |
| 81 | + } | |
| 82 | + } | |
| 83 | + override func viewDidLoad() { | |
| 84 | + super.viewDidLoad() | |
| 85 | + navigationBarHidden = false | |
| 86 | + titleName = "优惠券" | |
| 87 | + self.view.backgroundColor = .white | |
| 88 | + | |
| 89 | + let deleteNavBtn = UIButton(type: .custom) | |
| 90 | + deleteNavBtn.frame = CGRect(x: 0, y: KStatusBarHeight, width: KNavigationHeight-KStatusBarHeight, height: KNavigationHeight-KStatusBarHeight) | |
| 91 | + deleteNavBtn.backgroundColor = .clear | |
| 92 | + deleteNavBtn.setTitle("删除", for: .normal) | |
| 93 | + deleteNavBtn.setTitleColor(HexColor("#FC1541"), for: .normal) | |
| 94 | + deleteNavBtn.addTarget(self, action: #selector(deleteCoupons), for: .touchUpInside) | |
| 95 | + self.rightNavBtns = [deleteNavBtn] | |
| 96 | + | |
| 97 | + self.view.addSubview(self.listTableView) | |
| 98 | + self.view.addSubview(self.createCouponBtn) | |
| 99 | + | |
| 100 | + self.createCouponBtn.snp.makeConstraints { make in | |
| 101 | + make.left.equalTo(self.view.snp.left) | |
| 102 | + make.right.equalTo(self.view.snp.right) | |
| 103 | + make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom) | |
| 104 | + make.height.equalTo(45) | |
| 105 | + } | |
| 106 | + self.listTableView.snp.makeConstraints { make in | |
| 107 | + make.left.equalTo(self.view.snp.left) | |
| 108 | + make.right.equalTo(self.view.snp.right) | |
| 109 | + make.bottom.equalTo(self.createCouponBtn.snp.top) | |
| 110 | + make.top.equalTo(self.view).offset(KNavigationHeight) | |
| 111 | + } | |
| 112 | + } | |
| 113 | + override func viewWillAppear(_ animated: Bool) { | |
| 114 | + super.viewWillAppear(animated) | |
| 115 | + self.requestData() | |
| 116 | + } | |
| 117 | + // MARK: - Action | |
| 118 | + @objc func deleteCoupons(_ sender:UIButton){ | |
| 119 | + if sender.titleLabel?.text == "删除"{ | |
| 120 | + self.tableViewEidting(edit: true) | |
| 121 | + }else{ | |
| 122 | + self.tableViewEidting(edit: false) | |
| 123 | + } | |
| 124 | + } | |
| 125 | + func tableViewEidting(edit:Bool){ | |
| 126 | + let rightBar = self.rightNavBtns[0] | |
| 127 | + if edit{ | |
| 128 | + rightBar.setTitle("完成", for: .normal) | |
| 129 | + rightBar.setTitleColor(HexColor("#FD862E"), for: .normal) | |
| 130 | + self.listTableView.setEditing(true, animated: true) | |
| 131 | + self.createCouponBtn.backgroundColor = HexColor("#FD862E") | |
| 132 | + self.view.backgroundColor = HexColor("#FD862E") | |
| 133 | + self.createCouponBtn.setTitleColor(.white, for: .normal) | |
| 134 | + self.createCouponBtn.setTitle("删除", for: .normal) | |
| 135 | + self.createCouponBtn.setImage(UIImage(named: "DS_coupon_edit_delete"), for: .normal) | |
| 136 | + }else{ | |
| 137 | + self.createCouponBtn.backgroundColor = .white | |
| 138 | + self.view.backgroundColor = .white | |
| 139 | + self.createCouponBtn.setTitle("新增优惠券", for: .normal) | |
| 140 | + self.createCouponBtn.setTitleColor(HexColor("#FD862E"), for: .normal) | |
| 141 | + self.createCouponBtn.setImage(UIImage(named: "DS_coupon_create"), for: .normal) | |
| 142 | + rightBar.setTitle("删除", for: .normal) | |
| 143 | + rightBar.setTitleColor(HexColor("#666666"), for: .normal) | |
| 144 | + self.listTableView.setEditing(false, animated: true) | |
| 145 | + self.deleteDic.removeAllObjects() | |
| 146 | + } | |
| 147 | + if self.dataSource.count == 0{ | |
| 148 | + rightBar.isHidden = true | |
| 149 | + } | |
| 150 | + } | |
| 151 | + @objc func createCouponClick(_ sender:UIButton){ | |
| 152 | + if sender.titleLabel!.text == "删除"{ | |
| 153 | + if self.deleteDic.count <= 0{ | |
| 154 | + showMessage(message: "请选择需要删除的优惠券") | |
| 155 | + return | |
| 156 | + } | |
| 157 | + showLoading(message: "") | |
| 158 | + CNLiveShopCouponViewModel.requestDeleteCoupon(couponDic: self.deleteDic) { result, status in | |
| 159 | + hiddenLoading() | |
| 160 | + if status == .success{ | |
| 161 | + let arr = NSMutableArray(array: self.dataSource) | |
| 162 | + let indexSet = NSMutableIndexSet() | |
| 163 | + for sectionString in self.deleteDic.allKeys{ | |
| 164 | + let sectionStr = sectionString as! String | |
| 165 | + indexSet.add(Int(sectionStr) ?? 0) | |
| 166 | + } | |
| 167 | + arr.removeObjects(at: indexSet as IndexSet) | |
| 168 | + self.dataSource = Array(arr) | |
| 169 | + self.listTableView.reloadData() | |
| 170 | + self.deleteDic.removeAllObjects() | |
| 171 | + if self.dataSource.count == 0{ | |
| 172 | + self.tableViewEidting(edit: false) | |
| 173 | + } | |
| 174 | + }else{ | |
| 175 | + showMessage(message: "删除失败") | |
| 176 | + } | |
| 177 | + } | |
| 178 | + }else{ | |
| 179 | + let vc = CNLiveShopCouponCreateViewController(couponListModel: nil, type: .create) | |
| 180 | + currentViewController()?.navigationController?.pushViewController(vc, animated: false) | |
| 181 | + } | |
| 182 | + } | |
| 183 | + // MARK: - UITableViewDelegate | |
| 184 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |
| 185 | + return 122 | |
| 186 | + } | |
| 187 | + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | |
| 188 | + return 15 | |
| 189 | + } | |
| 190 | + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | |
| 191 | + let view = tableView.dequeueReusableHeaderFooterView(withIdentifier:CNLiveCouponListTableViewHeaderFooterViewID) | |
| 192 | + view?.contentView.backgroundColor = HexColor("#F6F6F6") | |
| 193 | + return view | |
| 194 | + } | |
| 195 | + func tableView(_ tableView: UITableView, editingStyleForRowAt indexPath: IndexPath) -> UITableViewCell.EditingStyle { | |
| 196 | + return .none | |
| 197 | + } | |
| 198 | + | |
| 199 | + // MARK: - UITableViewDataSource | |
| 200 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| 201 | + return 1 | |
| 202 | + } | |
| 203 | + func numberOfSections(in tableView: UITableView) -> Int { | |
| 204 | + return self.dataSource.count | |
| 205 | + } | |
| 206 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| 207 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: CNLiveCouponListTableViewCellID) as? CNLiveCouponListTableViewCell | |
| 208 | + else { | |
| 209 | + let cell = CNLiveCouponListTableViewCell() | |
| 210 | + return cell | |
| 211 | + } | |
| 212 | + cell.model = self.dataSource[indexPath.section] as? CNLiveShopCouponListModel | |
| 213 | + cell.actionClickBlock = { index,model in | |
| 214 | + switch index { | |
| 215 | + case 0: | |
| 216 | + if model.id!.isEmpty{ | |
| 217 | + return | |
| 218 | + } | |
| 219 | +// // 分享 | |
| 220 | +// CNShareUserViewController *shareVC = [[CNShareUserViewController alloc] initWithCouponData:[model mj_JSONObject] shareType:CNTypeShareCoupon complete:^(BOOL success) { | |
| 221 | +// | |
| 222 | +// }]; | |
| 223 | +// [self dsPushViewController:shareVC animated:YES animaterDirection:DSTransitionAnimaterDirectionTop]; | |
| 224 | + break | |
| 225 | + case 1: | |
| 226 | + // 编辑 | |
| 227 | + let vc = CNLiveShopCouponCreateViewController(couponListModel: model, type: .edit) | |
| 228 | + currentViewController()?.navigationController?.pushViewController(vc, animated: true) | |
| 229 | + break | |
| 230 | + default: break | |
| 231 | + } | |
| 232 | + } | |
| 233 | + cell.editBtnClickBlock = { selected,couponId in | |
| 234 | + if selected{ | |
| 235 | + self.deleteDic.setObject(couponId, forKey: NSString(format: "%d", indexPath.section)) | |
| 236 | + }else{ | |
| 237 | + self.deleteDic.removeObject(forKey: NSString(format: "%d", indexPath.section)) | |
| 238 | + } | |
| 239 | + } | |
| 240 | + return cell | |
| 241 | + } | |
| 242 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLiveCouponListTableViewCell.swift
| ... | ... | @@ -20,8 +20,26 @@ class CNLiveCouponListTableViewCell:UITableViewCell{ |
| 20 | 20 | set{ |
| 21 | 21 | _model = newValue |
| 22 | 22 | self.selectBtn.isSelected = false |
| 23 | - let discount = self.dealDiscountAndFilledNumber(count: Int(model!.discount!)!) | |
| 24 | - let filled = self.dealDiscountAndFilledNumber(count: Int(model!.filled!)!) | |
| 23 | + | |
| 24 | + var discount:String = "" | |
| 25 | + let string = model!.discount! | |
| 26 | + if let doubleValue = Double(string) { | |
| 27 | + let intValue = Int(doubleValue) | |
| 28 | + discount = self.dealDiscountAndFilledNumber(count: intValue) | |
| 29 | + } else { | |
| 30 | + //无法将字符串转换为Double类型 | |
| 31 | + discount = self.dealDiscountAndFilledNumber(count: 0) | |
| 32 | + } | |
| 33 | + | |
| 34 | + var filled:String = "" | |
| 35 | + let fillString = model!.filled! | |
| 36 | + if let doubleValue = Double(fillString) { | |
| 37 | + let intValue = Int(doubleValue) | |
| 38 | + filled = self.dealDiscountAndFilledNumber(count: intValue) | |
| 39 | + } else { | |
| 40 | + //无法将字符串转换为Double类型 | |
| 41 | + filled = self.dealDiscountAndFilledNumber(count: 0) | |
| 42 | + } | |
| 25 | 43 | let str = NSMutableAttributedString(string: String(format: "¥%@", discount)) |
| 26 | 44 | str.addAttribute(NSAttributedString.Key.font, value: UIFont.systemFont(ofSize: 12.5), range: NSRange(location: 0, length: 1)) |
| 27 | 45 | |
| ... | ... | @@ -54,12 +72,12 @@ class CNLiveCouponListTableViewCell:UITableViewCell{ |
| 54 | 72 | var editBtnClickBlock:editBtnClickActionBlock? |
| 55 | 73 | |
| 56 | 74 | lazy var selectBtn: UIButton = { |
| 57 | - let _selectBtn = UIButton(type: .custom) | |
| 58 | - _selectBtn.isHidden = true | |
| 59 | - _selectBtn.setImage(UIImage(named: "DS_coupon_edit_no"), for: .normal) | |
| 60 | - _selectBtn.setImage(UIImage(named: "DS_coupon_edit_se"), for: .selected) | |
| 61 | - _selectBtn.addTarget(self, action: #selector(editBtnClick), for: .touchUpInside) | |
| 62 | - return _selectBtn | |
| 75 | + let selectBtn = UIButton(type: .custom) | |
| 76 | + selectBtn.isHidden = true | |
| 77 | + selectBtn.setImage(UIImage(named: "DS_coupon_edit_no"), for: .normal) | |
| 78 | + selectBtn.setImage(UIImage(named: "DS_coupon_edit_se"), for: .selected) | |
| 79 | + selectBtn.addTarget(self, action: #selector(editBtnClick), for: .touchUpInside) | |
| 80 | + return selectBtn | |
| 63 | 81 | }() |
| 64 | 82 | |
| 65 | 83 | lazy var leftBgView :UIView = { |
| ... | ... | @@ -103,7 +121,7 @@ class CNLiveCouponListTableViewCell:UITableViewCell{ |
| 103 | 121 | let label = UILabel() |
| 104 | 122 | label.textColor = HexColor("#BEBEBE") |
| 105 | 123 | label.font = UIFont(name: "HelveticaNeue", size: 12)! |
| 106 | - label.textAlignment = .left | |
| 124 | + label.textAlignment = .right | |
| 107 | 125 | return label |
| 108 | 126 | }() |
| 109 | 127 | |
| ... | ... | @@ -141,7 +159,7 @@ class CNLiveCouponListTableViewCell:UITableViewCell{ |
| 141 | 159 | private lazy var shareBtn: UIButton = { |
| 142 | 160 | let button = UIButton(type: .custom) |
| 143 | 161 | button.tag = 1001 |
| 144 | - button.setTitle("分享", for: .normal) | |
| 162 | + button.setTitle("", for: .normal)//"分享" | |
| 145 | 163 | button.titleLabel?.font = UIFont(name: "HelveticaNeue", size: 13)! |
| 146 | 164 | button.setTitleColor(HexColor("#FD862E"), for: .normal) |
| 147 | 165 | button.addTarget(self, action: #selector(actionClick), for: .touchUpInside) |
| ... | ... | @@ -150,6 +168,7 @@ class CNLiveCouponListTableViewCell:UITableViewCell{ |
| 150 | 168 | |
| 151 | 169 | private lazy var editBtn: UIButton = { |
| 152 | 170 | let editButton = UIButton(type: .custom) |
| 171 | + editButton.frame = CGRect(x: 0, y: 0, width: 445, height: 18.5) | |
| 153 | 172 | editButton.tag = 1002 |
| 154 | 173 | editButton.setTitle("编辑", for: .normal) |
| 155 | 174 | editButton.setImage(UIImage(named: "DS_main_rightArrow"), for: .normal) |
| ... | ... | @@ -200,11 +219,12 @@ class CNLiveCouponListTableViewCell:UITableViewCell{ |
| 200 | 219 | self.selectBtn.snp.makeConstraints { make in |
| 201 | 220 | make.left.equalTo(self).offset(15) |
| 202 | 221 | make.centerY.equalTo(self) |
| 203 | - make.width.height.equalTo(30) | |
| 222 | + make.width.equalTo(30) | |
| 223 | + make.height.equalTo(self) | |
| 204 | 224 | } |
| 205 | 225 | self.bgWhiteView.snp.makeConstraints { make in |
| 206 | - make.left.equalTo(self).offset(15) | |
| 207 | - make.right.equalTo(self).offset(-15) | |
| 226 | + make.left.equalTo(self.contentView).offset(15) | |
| 227 | + make.right.equalTo(self.contentView).offset(-15) | |
| 208 | 228 | make.top.bottom.equalTo(self) |
| 209 | 229 | } |
| 210 | 230 | self.leftBgView.snp.makeConstraints { make in |
| ... | ... | @@ -248,7 +268,7 @@ class CNLiveCouponListTableViewCell:UITableViewCell{ |
| 248 | 268 | make.bottom.equalTo(self.bgWhiteView).offset(-15) |
| 249 | 269 | } |
| 250 | 270 | self.shareBtn.snp.makeConstraints { make in |
| 251 | - make.right.equalTo(self.lineView) | |
| 271 | + make.right.equalTo(self.lineView.snp.right) | |
| 252 | 272 | make.centerY.equalTo(self.titleLabel) |
| 253 | 273 | make.width.equalTo(30) |
| 254 | 274 | make.height.equalTo(18.5) |
| ... | ... | @@ -264,12 +284,12 @@ class CNLiveCouponListTableViewCell:UITableViewCell{ |
| 264 | 284 | make.centerY.equalTo(self.showMessageLabel) |
| 265 | 285 | } |
| 266 | 286 | } |
| 267 | - | |
| 268 | - func setEditing(editing:Bool,animated:Bool){ | |
| 287 | + override func setEditing(_ editing: Bool, animated: Bool) { | |
| 288 | + super.setEditing(editing, animated: animated) | |
| 269 | 289 | if editing{ |
| 270 | 290 | self.selectBtn.isHidden = false |
| 271 | 291 | self.bgWhiteView.snp.updateConstraints { make in |
| 272 | - make.left.equalTo(self.contentView).offset(55) | |
| 292 | + make.left.equalTo(self.contentView).offset(15) | |
| 273 | 293 | } |
| 274 | 294 | }else{ |
| 275 | 295 | self.selectBtn.isSelected = false | ... | ... |
metaCode/Classes/Main/HomePage/ViewModel/ShopCoupon/CNLiveShopCouponViewModel.swift
| ... | ... | @@ -154,8 +154,8 @@ class CNLiveShopCouponViewModel:NSObject{ |
| 154 | 154 | hiddenLoading() |
| 155 | 155 | if (error == nil) { |
| 156 | 156 | let resDic = (result as! Dictionary<String, Any>)["data"] as! Dictionary<String, Any> |
| 157 | - let model = newDictionaryToModel(resDic, CNLiveShopCouponDataListModel.self) | |
| 158 | - resultBlock(model,.success) | |
| 157 | + let model = newDictionaryToModel(resDic, CNLiveShopCouponDataListModel.self) as! CNLiveShopCouponDataListModel | |
| 158 | + resultBlock(model.list!,.success) | |
| 159 | 159 | }else{ |
| 160 | 160 | resultBlock(NSNull(),.failed) |
| 161 | 161 | } | ... | ... |