Commit 574676de1206e6b7061252d2d029fdc222683744

Authored by liushiyu
2 parents 08dbf3ce b35a1f3f
metaCode/Classes/Extensions/NSDate+CNLiveExtensions.swift
... ... @@ -27,4 +27,16 @@ extension NSDate{
27 27 }
28 28 return formatter.string(from: date as Date)
29 29 }
  30 +
  31 + ///时间戳转成年月日字符串
  32 + static func timeIntervalChangeToYMDTimeStr(timeInterval: Double, _ dateFormat:String? = "yyyy年MM月dd日") -> String {
  33 + let date:Date = Date.init(timeIntervalSince1970: timeInterval)
  34 + let formatter = DateFormatter.init()
  35 + if dateFormat == nil {
  36 + formatter.dateFormat = "yyyy年MM月dd日"
  37 + }else{
  38 + formatter.dateFormat = dateFormat
  39 + }
  40 + return formatter.string(from: date as Date)
  41 + }
30 42 }
... ...
metaCode/Classes/Main/HomePage/Controller/AuthMainController/CNMetaCodeHomePageController.swift
... ... @@ -215,6 +215,8 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
215 215  
216 216 //提交身份审核后刷新
217 217 NotificationCenter.default.addObserver(self, selector: #selector(StandAuthNotificationSuccessAction), name: Notification.Name.StandAuth.StandAuthNotificationSuccess, object: nil)
  218 + //提交电商身份审核后刷新
  219 + NotificationCenter.default.addObserver(self, selector: #selector(DSShopDarenAuthResultNotificationAction), name: Notification.Name.ShopAuthManage.DSShopDarenAuthResultNotification, object: nil)
218 220 //我的身份排序后刷新
219 221 NotificationCenter.default.addObserver(self, selector: #selector(StandAuthNotificationSuccessAction), name: Notification.Name.StandAuth.StandAuthSortNotificationResult, object: nil)
220 222  
... ... @@ -299,6 +301,12 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
299 301 self.getUserIdentityApi()
300 302 print("StandAuthNotificationSuccessAction")
301 303 }
  304 + //电商身份提交审核后刷新接口
  305 + @objc func DSShopDarenAuthResultNotificationAction(){
  306 + self.getApplyShopInfo()
  307 + print("DSShopDarenAuthResultNotificationAction")
  308 + }
  309 +
302 310  
303 311  
304 312 // MARK: -添加约束
... ... @@ -388,6 +396,9 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
388 396 bannerView?.idModel = identityModel
389 397 if (identityModel.auth == true){
390 398 bannerView?.baseScrollView.isScrollEnabled = true
  399 + if identityModel.id == 9{
  400 + self.getApplyShopInfo()
  401 + }
391 402 }else{
392 403 //未认证
393 404 if (identityModel.downType == 3 || identityModel.downType == 4 || identityModel.upType == 3 || identityModel.upType == 4)
... ... @@ -638,17 +649,11 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
638 649 }else{
639 650 //未认证
640 651 self.getStandInfo(identityId: "\(listModel.id)")
641   -// if self.unStandModelArray.contains(listModel){
642   -//
643   -// }else{
644   -// self.unStandModelArray.add(listModel)
645   -// }
646 652 }
647 653 }
648 654  
649 655 }else{
650 656 self.NetApiStatus = .apiError
651   -// self.identityStatus = .notCertified
652 657 }
653 658 }
654 659 else if (respStatue == .failed){
... ... @@ -724,9 +729,12 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel
724 729 CNLiveMineViewModel.requestApplyShopInfo { [weak self] result, respStatue in
725 730 if respStatue == .success{
726 731 let shopModel = result as! MineApplyShopInfoModel
727   - self!.dataArray.forEach {listModel in
728   - let model = listModel as! StandListModel
729   - model.shopStatus = shopModel.state
  732 +
  733 + for (index, item) in self!.dataArray.enumerated() {
  734 + let model = item as! StandListModel
  735 + model.shopInfoModel = shopModel
  736 + let bannerView = self?.pageFlowView.cells[index] as? CNCustomIndexView
  737 + bannerView?.idModel = model
730 738 }
731 739 }
732 740 }
... ...
metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNIDCardView.swift
... ... @@ -18,7 +18,23 @@ class CNIDCardView: UIView{
18 18 set{
19 19 _idModel = newValue
20 20 self.iDCardBGView.kf.setImage(with: URL(string: _idModel!.cardImg), placeholder: UIImage(named: "homePage_idCardBG"))
21   - self.loadIDDetailData()
  21 + if _idModel?.id == 9{
  22 + //电商 , 拼接数据
  23 + let nameArr = ["公司名称","认证时间","编号"]
  24 + let timeStr = NSDate.timeIntervalChangeToYMDTimeStr(timeInterval: Double(_idModel?.shopInfoModel?.addtime ?? "0")!)
  25 + let userInfoArr = [_idModel?.shopInfoModel?.commercial_name ?? "" , timeStr , _idModel?.shopInfoModel?.certificates_code ?? ""]
  26 + let cardMuteArr = NSMutableArray()
  27 + for i in 0..<3{
  28 + let standInfoModel = MineStandInfoModel()
  29 + standInfoModel.name = nameArr[i]
  30 + standInfoModel.userInfo = userInfoArr[i]
  31 + cardMuteArr.add(standInfoModel)
  32 + }
  33 + self.cardUIWithArray(cardArr: cardMuteArr)
  34 + }else{
  35 + //非电商, 接口数据
  36 + self.loadIDDetailData()
  37 + }
22 38 }
23 39 }
24 40  
... ... @@ -51,49 +67,87 @@ class CNIDCardView: UIView{
51 67  
52 68 func loadIDDetailData(){
53 69 // showLoading(message: "")
  70 +
  71 + CNLiveMineViewModel.requestsStandInfo(identityId: "\(_idModel!.id)", type: .havedate, authType: .person) { [self] result, respStatue in
  72 + hiddenLoading()
  73 + if respStatue == .success {
  74 + let cardArray = result as! NSMutableArray
  75 + self.cardUIWithArray(cardArr: cardArray)
  76 +
  77 +// if cardArray.count > 0{
  78 +// for i in (0..<cardArray.count){
  79 +// let idCardModel = cardArray[i] as! MineStandInfoModel
  80 +// let siBianGap:CGFloat = 17
  81 +// let labelsGap:CGFloat = 10
  82 +//
  83 +// let keyLabel = UILabel.init()
  84 +// keyLabel.textColor = HexColor(_idModel?.backgroundColor ?? "")
  85 +// keyLabel.textAlignment = .left
  86 +// keyLabel.font = Font(15)
  87 +// keyLabel.backgroundColor = .clear
  88 +// keyLabel.text = idCardModel.name ?? ""
  89 +// keyLabel.frame = CGRect(x: siBianGap, y: siBianGap+CGFloat(i)*21+CGFloat(i)*labelsGap, width: 70, height: 21)
  90 +// keyLabel.adjustsFontSizeToFitWidth = true
  91 +// keyLabel.tag = 10000+i
  92 +// self.addSubview(keyLabel)
  93 +//
  94 +// let valueLabel = UILabel.init()
  95 +// valueLabel.textColor = HexColor(_idModel?.backgroundColor ?? "")
  96 +// valueLabel.textAlignment = .left
  97 +// valueLabel.font = Font(15)
  98 +// valueLabel.backgroundColor = .clear
  99 +// valueLabel.text = idCardModel.userInfo ?? ""
  100 +// valueLabel.frame = CGRect(x: keyLabel.right+labelsGap+siBianGap, y: siBianGap+CGFloat(i)*21+CGFloat(i)*labelsGap, width: self.width-keyLabel.right-labelsGap-siBianGap-5, height: 21)
  101 +// valueLabel.adjustsFontSizeToFitWidth = true
  102 +// valueLabel.tag = 20000+i
  103 +// self.addSubview(valueLabel)
  104 +//
  105 +// }
  106 +// }else{
  107 +// //没数据
  108 +// }
  109 + }
  110 + }
  111 + }
  112 +
  113 + func cardUIWithArray(cardArr:NSMutableArray){
54 114 self.subviews.forEach { view in
55 115 if view.tag >= 10000{
56 116 view.removeFromSuperview()
57 117 }
58 118 }
59   - CNLiveMineViewModel.requestsStandInfo(identityId: "\(_idModel!.id)", type: .havedate, authType: .person) { [self] result, respStatue in
60   - hiddenLoading()
61   - if respStatue == .success {
62   - let cardArray = result as! NSMutableArray
63   - let count = cardArray.count
64   - if cardArray.count > 0{
65   - for i in (0..<cardArray.count){
66   - let idCardModel = cardArray[i] as! MineStandInfoModel
67   - let siBianGap:CGFloat = 17
68   - let labelsGap:CGFloat = 10
69   -
70   - let keyLabel = UILabel.init()
71   - keyLabel.textColor = HexColor(_idModel?.backgroundColor ?? "")
72   - keyLabel.textAlignment = .left
73   - keyLabel.font = Font(15)
74   - keyLabel.backgroundColor = .clear
75   - keyLabel.text = idCardModel.name ?? ""
76   - keyLabel.frame = CGRect(x: siBianGap, y: siBianGap+CGFloat(i)*21+CGFloat(i)*labelsGap, width: 70, height: 21)
77   - keyLabel.adjustsFontSizeToFitWidth = true
78   - keyLabel.tag = 10000+i
79   - self.addSubview(keyLabel)
80   -
81   - let valueLabel = UILabel.init()
82   - valueLabel.textColor = HexColor(_idModel?.backgroundColor ?? "")
83   - valueLabel.textAlignment = .left
84   - valueLabel.font = Font(15)
85   - valueLabel.backgroundColor = .clear
86   - valueLabel.text = idCardModel.userInfo ?? ""
87   - valueLabel.frame = CGRect(x: keyLabel.right+labelsGap+siBianGap, y: siBianGap+CGFloat(i)*21+CGFloat(i)*labelsGap, width: self.width-keyLabel.right-labelsGap-siBianGap-5, height: 21)
88   - valueLabel.adjustsFontSizeToFitWidth = true
89   - valueLabel.tag = 20000+i
90   - self.addSubview(valueLabel)
  119 + let cardArray = NSMutableArray(array: cardArr)
  120 + if cardArray.count > 0{
  121 + for i in (0..<cardArray.count){
  122 + let idCardModel = cardArray[i] as! MineStandInfoModel
  123 + let siBianGap:CGFloat = 17
  124 + let labelsGap:CGFloat = 10
  125 +
  126 + let keyLabel = UILabel.init()
  127 + keyLabel.textColor = HexColor(_idModel?.backgroundColor ?? "")
  128 + keyLabel.textAlignment = .left
  129 + keyLabel.font = Font(15)
  130 + keyLabel.backgroundColor = .clear
  131 + keyLabel.text = idCardModel.name ?? ""
  132 + keyLabel.frame = CGRect(x: siBianGap, y: siBianGap+CGFloat(i)*21+CGFloat(i)*labelsGap, width: 70, height: 21)
  133 + keyLabel.adjustsFontSizeToFitWidth = true
  134 + keyLabel.tag = 10000+i
  135 + self.addSubview(keyLabel)
  136 +
  137 + let valueLabel = UILabel.init()
  138 + valueLabel.textColor = HexColor(_idModel?.backgroundColor ?? "")
  139 + valueLabel.textAlignment = .left
  140 + valueLabel.font = Font(15)
  141 + valueLabel.backgroundColor = .clear
  142 + valueLabel.text = idCardModel.userInfo ?? ""
  143 + valueLabel.frame = CGRect(x: keyLabel.right+labelsGap+siBianGap, y: siBianGap+CGFloat(i)*21+CGFloat(i)*labelsGap, width: self.width-keyLabel.right-labelsGap-siBianGap-5, height: 21)
  144 + valueLabel.adjustsFontSizeToFitWidth = true
  145 + valueLabel.tag = 20000+i
  146 + self.addSubview(valueLabel)
91 147  
92   - }
93   - }else{
94   - //没数据
95   - }
96 148 }
  149 + }else{
  150 + //没数据
97 151 }
98 152 }
99 153  
... ...
metaCode/Classes/Main/HomePage/View/VerticalViews/MainView/CNMainView.swift
... ... @@ -270,19 +270,19 @@ class CNFrontMainView : UIView{
270 270 self.personalStandBtn.isHidden = true
271 271 self.enterpriseStandBtn.isHidden = true
272 272 self.addStandBtn.isUserInteractionEnabled = true
273   - if idModel?.shopStatus == "0" || idModel?.shopStatus == "4"{
  273 + if idModel?.shopInfoModel?.state == "0" || idModel?.shopInfoModel?.state == "4"{
274 274 //0未申请 //4闭店
275 275 //未认证->店铺认证
276 276 self.addStandBtn.setTitle("店铺认证", for: .normal)
277   - }else if idModel?.shopStatus == "1"{
  277 + }else if idModel?.shopInfoModel?.state == "1"{
278 278 //开店
279   - //已认证->显示卡片
280   - }else if idModel?.shopStatus == "2"{
  279 + //已认证->显示卡片 不会走到这里
  280 + }else if idModel?.shopInfoModel?.state == "2"{
281 281 //申请中
282 282 //"资料审核中"
283 283 self.addStandBtn.setTitle("资料审核中", for: .normal)
284 284 self.addStandBtn.isUserInteractionEnabled = false
285   - }else if idModel?.shopStatus == "3"{
  285 + }else if idModel?.shopInfoModel?.state == "3"{
286 286 //已拒绝
287 287 //"重新修改提交"
288 288 addStandBtn.setTitle("重新修改提交", for: .normal)
... ...
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineBaseModel.swift
... ... @@ -160,8 +160,8 @@ final class StandListModel: BaseModel {//, TableCodable {
160 160 var createTimeString: String = ""//-
161 161 var timeString: String = ""
162 162  
163   - var shopStatus: String = "0"//电商身份专用状态 0未申请 1开店 2申请中 3已拒绝 4闭店
164   -
  163 + //电商身份专用
  164 + var shopInfoModel: MineApplyShopInfoModel?
165 165  
166 166 ///自定义 判断是 0个人+企业 , 1个人, 2企业 3已认证/无企业和个人
167 167 var isPersonOrEnterprise: Int = 0
... ...