Commit 88077267a71e02ea0285289b56b7fdd679eeaead

Authored by liushiyu
1 parent f5483280

提交修改

metaCode.xcodeproj/project.pbxproj
... ... @@ -1439,7 +1439,7 @@
1439 1439 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
1440 1440 CLANG_ENABLE_MODULES = YES;
1441 1441 CODE_SIGN_STYLE = Automatic;
1442   - CURRENT_PROJECT_VERSION = 1.0.1.23.11.09.17;
  1442 + CURRENT_PROJECT_VERSION = 1.0.1.23.11.10.10;
1443 1443 DEVELOPMENT_TEAM = 94X49GG3ZW;
1444 1444 EXCLUDED_ARCHS = "";
1445 1445 GENERATE_INFOPLIST_FILE = YES;
... ... @@ -1484,7 +1484,7 @@
1484 1484 ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
1485 1485 CLANG_ENABLE_MODULES = YES;
1486 1486 CODE_SIGN_STYLE = Automatic;
1487   - CURRENT_PROJECT_VERSION = 1.0.1.23.11.09.17;
  1487 + CURRENT_PROJECT_VERSION = 1.0.1.23.11.10.10;
1488 1488 DEVELOPMENT_TEAM = 94X49GG3ZW;
1489 1489 EXCLUDED_ARCHS = "";
1490 1490 GENERATE_INFOPLIST_FILE = YES;
... ...
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
... ... @@ -46,7 +46,7 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate,
46 46 dataArray.add(array03)
47 47  
48 48  
49   -// dataArray.add([["name":"订单列表","icon":"mine_list_icon_help_feedback"]])
  49 + dataArray.add([["name":"订单列表","icon":"mine_list_icon_help_feedback"]])
50 50  
51 51  
52 52 return dataArray
... ...
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderDetailViewController.swift
... ... @@ -197,7 +197,7 @@ extension CNLiveShopOrderDetailViewController {
197 197 if detailModel.send_num > 1 || detailModel.is_send == "0" {
198 198 self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: detailModel.id! as NSString), animated: true)
199 199 } else {
200   - self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(), animated: true)
  200 +
201 201 }
202 202 }
203 203  
... ...
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderExpressDetailViewController.swift
... ... @@ -12,6 +12,10 @@ enum CNLiveShopOrderExpressDetailShowType {
12 12 case byYourself //自提
13 13 case refundExpress //退款详情快递
14 14 }
  15 +enum CNLiveShopOrderExpressDetailYBYProgress {
  16 + case Zero //备货完毕
  17 + case Complete//自取完毕
  18 +}
15 19 class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate {
16 20  
17 21  
... ... @@ -33,7 +37,26 @@ class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITa
33 37 return dataArray
34 38 }()
35 39  
  40 + var _expId: NSString!
  41 + var _orderId: NSString!
  42 + var _refundId: NSString!
  43 + var _express_num: NSString!
  44 + var expressModel: ShopOrderExpressDetailModel!
  45 + var _show_type: CNLiveShopOrderExpressDetailShowType!
  46 + var _progress: CNLiveShopOrderExpressDetailYBYProgress!
36 47 var network_type: CNLiveMineResponseType!
  48 + init(orderId: NSString, expId: NSString, show_type: CNLiveShopOrderExpressDetailShowType, progress: CNLiveShopOrderExpressDetailYBYProgress) {
  49 + _orderId = orderId
  50 + _expId = expId
  51 + _show_type = show_type
  52 + _progress = progress
  53 + super.init(nibName:nil, bundle:nil)
  54 + }
  55 +
  56 + required init?(coder: NSCoder) {
  57 + fatalError("init(coder:) has not been implemented")
  58 + }
  59 +
37 60 override func viewDidLoad() {
38 61 super.viewDidLoad()
39 62 navigationBarHidden = false
... ... @@ -50,7 +73,19 @@ class CNLiveShopOrderExpressDetailViewController: CNLiveBaseViewController, UITa
50 73 }
51 74  
52 75 func loadDataSourceAction() {
53   -
  76 + CNLiveShopViewModel.requestExpressDetail(orderId: _orderId, expId: _expId, networkType: _show_type) { [weak self] result, respStatue in
  77 + if respStatue == .success {
  78 + let expressModel = result as! ShopOrderExpressDetailModel
  79 + self!.dataArray.addObjects(from: expressModel.data)
  80 + self!.tableView.reloadData()
  81 + }else if (respStatue == .noNetwork) {
  82 + self!.network_type = .noNetwork
  83 + self!.tableView.reloadEmptyDataSet()
  84 + } else {
  85 + self!.network_type = .failed
  86 + self!.tableView.reloadEmptyDataSet()
  87 + }
  88 + }
54 89 }
55 90 }
56 91  
... ...
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderListViewController.swift
... ... @@ -280,10 +280,10 @@ extension CNLiveShopOrderListViewController {
280 280 /// - Parameter detailModel: 数据源
281 281 private func pushExpressVC(listModel: ShopOrderListModel) {
282 282 if listModel.send_num > 1 || listModel.is_send == "0" {
283   - self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: listModel.id! as NSString), animated: true)
284   -// self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: "1000073435"), animated: true)
  283 +// self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: listModel.id! as NSString), animated: true)
  284 + self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: "1000073435"), animated: true)
285 285 } else {
286   - self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(), animated: true)
  286 +// self.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(), animated: true)
287 287 }
288 288 }
289 289  
... ...
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyExpressView.swift
... ... @@ -8,7 +8,7 @@
8 8 import Foundation
9 9 import EmptyDataSet_Swift
10 10  
11   -class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDataSource, UICollectionViewDelegate{
  11 +class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDataSource {
12 12  
13 13 lazy var logoImageView: UIImageView = {
14 14 let logoImageView = UIImageView.init()
... ... @@ -69,7 +69,6 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa
69 69 layout.scrollDirection = .horizontal
70 70 let collectionView = UICollectionView.init(frame: CGRect.zero, collectionViewLayout: layout)
71 71 collectionView.dataSource = self
72   - collectionView.delegate = self
73 72 collectionView.backgroundColor = .white
74 73 collectionView.register(ShopBodyOrderExpressListCollectionViewCell.self, forCellWithReuseIdentifier: kShopBodyOrderExpressListCollectionViewCellIdentifier)
75 74 let tap = UITapGestureRecognizer.init(target: self, action: #selector(pushExpressDetail))
... ... @@ -169,7 +168,7 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa
169 168 }
170 169  
171 170 @objc func pushExpressDetail() {
172   - currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(), animated: true)
  171 + currentViewController()?.navigationController?.pushViewController(CNLiveShopOrderExpressDetailViewController.init(orderId: _listModel.id! as NSString, expId: _listModel.express_num! as NSString, show_type: .orderExpress, progress: .Zero), animated: true)
173 172 }
174 173  
175 174 @objc func actionClick(sender: UIButton) {
... ... @@ -197,11 +196,6 @@ class ShopBodyOrderExpressListTableViewCell: UITableViewCell, UICollectionViewDa
197 196 cell.expressNum.text = "\(goodsModel.num ?? 0)件"
198 197 return cell
199 198 }
200   -
201   - func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
202   -
203   - }
204   -
205 199 }
206 200  
207 201 class ShopBodyOrderExpressListCollectionViewCell: UICollectionViewCell {
... ... @@ -244,3 +238,179 @@ class ShopBodyOrderExpressListCollectionViewCell: UICollectionViewCell {
244 238 fatalError("init(coder:) has not been implemented")
245 239 }
246 240 }
  241 +
  242 +class ShopBodyOrderExpressDetailHeaderView: UIView {
  243 +
  244 + var _showType: CNLiveShopOrderExpressDetailShowType!
  245 + init(frame: CGRect, showType: CNLiveShopOrderExpressDetailShowType) {
  246 + super.init(frame: frame)
  247 + _showType = showType
  248 + }
  249 +
  250 +
  251 +
  252 + required init?(coder: NSCoder) {
  253 + fatalError("init(coder:) has not been implemented")
  254 + }
  255 +
  256 +}
  257 +
  258 +
  259 +class ShopBodyOrderExpressDetailTableView: UITableViewCell, UITextViewDelegate {
  260 +
  261 + lazy var lineLabel: UILabel = {
  262 + let lineLabel = UILabel.init()
  263 + lineLabel.backgroundColor = HexColor("#EAEAEA")
  264 + return lineLabel
  265 + }()
  266 +
  267 + lazy var pointImageView: UIImageView = {
  268 + let pointImageView = UIImageView.init()
  269 + return pointImageView
  270 + }()
  271 +
  272 + lazy var titleTextView: UITextView = {
  273 + let titleTextView = UITextView.init(frame: CGRect(x: 0, y: 0, width: KSreenWidth - adapt_length(length: 48) - adapt_length(length: 20), height: 0))
  274 + titleTextView.isEditable = false
  275 + titleTextView.isScrollEnabled = false
  276 + titleTextView.delegate = self
  277 + titleTextView.linkTextAttributes = [.foregroundColor:HexColor("#28c1c6")!]
  278 + return titleTextView
  279 + }()
  280 +
  281 + lazy var timeLabel: UILabel = {
  282 + let timeLabel = UILabel.init()
  283 + timeLabel.textColor = HexColor("#b4b4b4")
  284 + timeLabel.font = regular_adapt_font(pointSize: 12)
  285 + return timeLabel
  286 + }()
  287 +
  288 + lazy var bottomLine: UIImageView = {
  289 + let bottomLine = UIImageView.init()
  290 + bottomLine.backgroundColor = HexColor("#e4e4e4")
  291 + return bottomLine
  292 + }()
  293 +
  294 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  295 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  296 + contentView.backgroundColor = .white
  297 + selectionStyle = .none
  298 +
  299 + addSubview(lineLabel)
  300 + addSubview(pointImageView)
  301 + addSubview(titleTextView)
  302 + addSubview(timeLabel)
  303 + addSubview(bottomLine)
  304 + }
  305 +
  306 + func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool {
  307 + if URL.absoluteString == "tel://" {
  308 + let phone = URL.absoluteString.components(separatedBy: "tel://").last
  309 + ConfigAlertManager.shared.presentAlert(title: phone!, message: "", actionTitles: ["取消","呼叫"]) { index in
  310 + if index == 1 {
  311 + UIApplication.shared.open(NSURL(string: phone!)! as URL)
  312 + }
  313 + }
  314 + } else {
  315 + let webVC = CNWebViewController.init()
  316 + webVC.url = URL
  317 + currentViewController()?.navigationController?.pushViewController(webVC, animated: true)
  318 + }
  319 + return false
  320 + }
  321 +
  322 +
  323 + var _dataModel: ShopOrderExpressDetailDateModel!
  324 + var _row: NSInteger!
  325 + var _isLastRow: Bool!
  326 + var _type: CNLiveShopOrderExpressDetailShowType!
  327 + var _address: NSString!
  328 + var _express_state: NSString!
  329 + func setupDataSource(dataModel: ShopOrderExpressDetailDateModel, row: NSInteger, isLastRow: Bool, type: CNLiveShopOrderExpressDetailShowType, address: NSString, express_state: NSString) {
  330 + _dataModel = dataModel
  331 + _row = row
  332 + _isLastRow = isLastRow
  333 + _type = type
  334 + _address = address
  335 + _express_state = express_state
  336 +
  337 + if _type == .orderExpress || _type == .refundExpress {
  338 +
  339 + let para = NSMutableParagraphStyle()
  340 + para.lineSpacing = adapt_length(length: 3)
  341 +
  342 + if row == 0 {
  343 + let title = NSMutableAttributedString.init(string: "[收货地址]\(address)", attributes: [.font:medium_adapt_font(pointSize: 14),.foregroundColor:HexColor("#999999")!,.paragraphStyle:para.copy()])
  344 + titleTextView.attributedText = setHyperlinksAttrStr(attrStr: title)
  345 + timeLabel.text = ""
  346 +
  347 + pointImageView.image = nil
  348 + pointImageView.backgroundColor = HexColor("#d2d2d2")
  349 + pointImageView.size = CGSizeMake(adapt_length(length: 5), adapt_length(length: 5))
  350 + pointImageView.layer.cornerRadius = pointImageView.height/2
  351 + pointImageView.layer.masksToBounds = true
  352 + } else if (_row == 1) {
  353 + let state = _express_state == "3" ? "已签收" : "运输中"
  354 + let title = NSMutableAttributedString.init(string: "\(state)\n\(dataModel.AcceptStation!)", attributes: [.font:medium_adapt_font(pointSize: 12),.foregroundColor:HexColor("#b4b4b4")!,.paragraphStyle:para.copy()])
  355 + para.lineSpacing = adapt_length(length: 5)
  356 + title.addAttributes([.font:medium_adapt_font(pointSize: 14),.foregroundColor:HexColor("#28c1c6")!,.paragraphStyle:para.copy()], range: NSMakeRange(0, state.count+1))
  357 + titleTextView.attributedText = setHyperlinksAttrStr(attrStr: title)
  358 + timeLabel.text = dataModel.AcceptTime
  359 +
  360 + pointImageView.image = UIImage(named: "DS_express_current")
  361 + pointImageView.backgroundColor = .clear
  362 + pointImageView.size = CGSizeMake(adapt_length(length: 15), adapt_length(length: 15))
  363 + pointImageView.layer.cornerRadius = 0
  364 + pointImageView.layer.masksToBounds = false
  365 + }
  366 + } else {
  367 + titleTextView.font = medium_adapt_font(pointSize: 14)
  368 + if _row == 0 {
  369 + titleTextView.textColor = HexColor("#28c1c6")
  370 +
  371 + pointImageView.image = UIImage(named: "DS_express_current")
  372 + pointImageView.backgroundColor = .clear
  373 + pointImageView.size = CGSizeMake(adapt_length(length: 15), adapt_length(length: 15))
  374 + pointImageView.layer.cornerRadius = 0
  375 + pointImageView.layer.masksToBounds = false
  376 + } else {
  377 + titleTextView.textColor = HexColor("#999999")
  378 +
  379 + pointImageView.image = UIImage(named: "DS_express_current")
  380 + pointImageView.backgroundColor = .clear
  381 + pointImageView.size = CGSizeMake(adapt_length(length: 15), adapt_length(length: 15))
  382 + pointImageView.layer.cornerRadius = pointImageView.height/2
  383 + pointImageView.layer.masksToBounds = true
  384 + pointImageView.layer.borderColor = HexColor("#d2d2d2")?.cgColor
  385 + pointImageView.layer.borderWidth = adapt_length(length: 1)
  386 + }
  387 + titleTextView.text = dataModel.AcceptStation
  388 + timeLabel.text = dataModel.AcceptTime
  389 + }
  390 + titleTextView.sizeToFit()
  391 +
  392 +
  393 + }
  394 +
  395 + func setHyperlinksAttrStr(attrStr: NSMutableAttributedString) -> NSAttributedString {
  396 + do {
  397 + let dataDetector = try NSDataDetector(types: NSTextCheckingTypes(NSTextCheckingResult.CheckingType.link.rawValue) | NSTextCheckingTypes(NSTextCheckingResult.CheckingType.phoneNumber.rawValue))
  398 + let res = dataDetector.matches(in: attrStr.string, options: NSRegularExpression.MatchingOptions(rawValue: 0), range: NSMakeRange(0, attrStr.string.count))
  399 + for checkingRes in res {
  400 + if (checkingRes.phoneNumber != nil) {
  401 + attrStr.addAttribute(.link, value: "tel://\(checkingRes.phoneNumber!)", range: checkingRes.range)
  402 + } else {
  403 + attrStr.addAttribute(.link, value: checkingRes.url!, range: checkingRes.range)
  404 + }
  405 + }
  406 + return attrStr.copy() as! NSAttributedString
  407 + } catch {
  408 + print(error)
  409 + }
  410 + return attrStr.copy() as! NSAttributedString
  411 + }
  412 +
  413 + required init?(coder: NSCoder) {
  414 + fatalError("init(coder:) has not been implemented")
  415 + }
  416 +}
... ...
metaCode/Classes/Main/ShopPage/ViewModel/CNLiveShopViewModel.swift
... ... @@ -8,12 +8,6 @@
8 8 import Foundation
9 9 import CNLiveRequestBastKit
10 10  
11   -enum CNLiveShopOrderExpressDetailNetworkType {
12   - case express // 订单详情查快递
13   - case step // 订单详情查进度
14   - case refundId// 查询快递(退款详情)
15   -}
16   -
17 11 typealias resultShopBlock = (_ result: Any,_ respStatue :CNLiveMineResponseType) -> Void
18 12 class CNLiveShopViewModel: NSObject {
19 13  
... ... @@ -525,15 +519,26 @@ class CNLiveShopViewModel: NSObject {
525 519 }
526 520 }
527 521  
528   - /// 订单详情查快递
  522 + /// 订单详情查快递 && 订单详情查进度 && 查询快递(退款详情)
529 523 /// - Parameters:
530 524 /// - orderId: 订单id
531 525 /// - expId: 物流id
532 526 /// - resultBlock: 返回
533   - static func requestExpressDetail(orderId: NSString, expId: NSString, resultBlock: @escaping resultShopBlock) {
  527 + static func requestExpressDetail(orderId: NSString, expId: NSString, networkType:CNLiveShopOrderExpressDetailShowType, resultBlock: @escaping resultShopBlock) {
534 528 let param = NSMutableDictionary()
535 529 param.setValue(orderId, forKey: "id")
536   - param.setValue(expId, forKey: "exp_id")
  530 + var url: NSString = ""
  531 + if networkType == .orderExpress {
  532 + url = "/api/v1/express"
  533 + param.setValue(expId, forKey: "exp_id")
  534 + }
  535 + if networkType == .byYourself {
  536 + url = "/api/v1/step"
  537 + }
  538 + if networkType == .refundExpress {
  539 + url = "/api/v1/getRefundExpress"
  540 + }
  541 +
537 542 let custom_param = NSMutableDictionary()
538 543 custom_param.setValue(APPId_wjj, forKey: "appId")
539 544 custom_param.setValue(APPKey_wjj, forKey: "appKey")
... ... @@ -541,7 +546,7 @@ class CNLiveShopViewModel: NSObject {
541 546 CNLiveNetworking.setupShowDataResult(false)
542 547 CNLiveNetworking.setupDSRequest(true)
543 548 CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
544   - CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/express", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  549 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+(url as String), param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
545 550 hiddenLoading()
546 551 if (error == nil) {
547 552 let resp = result as! NSDictionary
... ... @@ -550,12 +555,9 @@ class CNLiveShopViewModel: NSObject {
550 555 if resp["data"] is NSNull {
551 556 resultBlock(NSNull(),.failed)
552 557 } else {
553   - let array = resp["data"] as! NSArray
554   - let tempArray = NSMutableArray()
555   - for item in array {
556   - let listModel = dictionaryToModel(item as! [String : Any], ShopOrderExpressDetailModel.self,"") as! ShopOrderExpressDetailModel
557   - }
558   - resultBlock(tempArray, .success)
  558 + let item = resp["data"] as! NSDictionary
  559 + let listModel = dictionaryToModel(item as! [String : Any], ShopOrderExpressDetailModel.self,"") as! ShopOrderExpressDetailModel
  560 + resultBlock(listModel, .success)
559 561 }
560 562 } else {
561 563 showMessage(message: resp["message"] as! String)
... ...
metaCode/Supporting Files/Assets.xcassets/Shop/DS_express_current.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "DS_express_current@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "DS_express_current@3x.png",
  14 + "idiom" : "universal",
  15 + "scale" : "3x"
  16 + }
  17 + ],
  18 + "info" : {
  19 + "author" : "xcode",
  20 + "version" : 1
  21 + }
  22 +}
... ...
metaCode/Supporting Files/Assets.xcassets/Shop/DS_express_current.imageset/DS_express_current@2x.png 0 → 100644

935 Bytes

metaCode/Supporting Files/Assets.xcassets/Shop/DS_express_current.imageset/DS_express_current@3x.png 0 → 100644

1.64 KB