Commit 4e3e4b0c6ddf815c69e2ecab0914502ce506b477
1 parent
353a13e9
幼教中国-我的课程区块没内容时不显示 , 左右滑时当前视图置为顶层 , 上滑h5和下滑h5复用的问题 , 电商h5跳转的支付页面
Showing
20 changed files
with
506 additions
and
44 deletions
metaCode.xcodeproj/project.pbxproj
| @@ -113,6 +113,8 @@ | @@ -113,6 +113,8 @@ | ||
| 113 | 19B153CB2BC3E1870018906C /* CNLiveShopPayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153CA2BC3E1870018906C /* CNLiveShopPayController.swift */; }; | 113 | 19B153CB2BC3E1870018906C /* CNLiveShopPayController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153CA2BC3E1870018906C /* CNLiveShopPayController.swift */; }; |
| 114 | 19B153CD2BC3EB690018906C /* CNLiveShoph5ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153CC2BC3EB690018906C /* CNLiveShoph5ViewModel.swift */; }; | 114 | 19B153CD2BC3EB690018906C /* CNLiveShoph5ViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153CC2BC3EB690018906C /* CNLiveShoph5ViewModel.swift */; }; |
| 115 | 19B153CF2BC540FF0018906C /* CNLivePayOrderInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153CE2BC540FF0018906C /* CNLivePayOrderInfoModel.swift */; }; | 115 | 19B153CF2BC540FF0018906C /* CNLivePayOrderInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153CE2BC540FF0018906C /* CNLivePayOrderInfoModel.swift */; }; |
| 116 | + 19B153D22BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153D12BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift */; }; | ||
| 117 | + 19B153D42BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19B153D32BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift */; }; | ||
| 116 | 19BB1FDF2AEA3A450094D962 /* CNSlideBaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */; }; | 118 | 19BB1FDF2AEA3A450094D962 /* CNSlideBaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */; }; |
| 117 | 19BB1FE12AEB5C220094D962 /* CNLiveShopConsoleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */; }; | 119 | 19BB1FE12AEB5C220094D962 /* CNLiveShopConsoleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */; }; |
| 118 | 19BB1FE32AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */; }; | 120 | 19BB1FE32AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */; }; |
| @@ -385,6 +387,8 @@ | @@ -385,6 +387,8 @@ | ||
| 385 | 19B153CA2BC3E1870018906C /* CNLiveShopPayController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopPayController.swift; sourceTree = "<group>"; }; | 387 | 19B153CA2BC3E1870018906C /* CNLiveShopPayController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopPayController.swift; sourceTree = "<group>"; }; |
| 386 | 19B153CC2BC3EB690018906C /* CNLiveShoph5ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShoph5ViewModel.swift; sourceTree = "<group>"; }; | 388 | 19B153CC2BC3EB690018906C /* CNLiveShoph5ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShoph5ViewModel.swift; sourceTree = "<group>"; }; |
| 387 | 19B153CE2BC540FF0018906C /* CNLivePayOrderInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLivePayOrderInfoModel.swift; sourceTree = "<group>"; }; | 389 | 19B153CE2BC540FF0018906C /* CNLivePayOrderInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLivePayOrderInfoModel.swift; sourceTree = "<group>"; }; |
| 390 | + 19B153D12BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopPayNeedPaymentCell.swift; sourceTree = "<group>"; }; | ||
| 391 | + 19B153D32BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopPayWeChatAlipayCell.swift; sourceTree = "<group>"; }; | ||
| 388 | 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNSlideBaseNavigationController.swift; sourceTree = "<group>"; }; | 392 | 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNSlideBaseNavigationController.swift; sourceTree = "<group>"; }; |
| 389 | 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleController.swift; sourceTree = "<group>"; }; | 393 | 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleController.swift; sourceTree = "<group>"; }; |
| 390 | 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleViewModel.swift; sourceTree = "<group>"; }; | 394 | 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleViewModel.swift; sourceTree = "<group>"; }; |
| @@ -857,6 +861,7 @@ | @@ -857,6 +861,7 @@ | ||
| 857 | 191733402B284D4A007BCC04 /* ShopCoupon */, | 861 | 191733402B284D4A007BCC04 /* ShopCoupon */, |
| 858 | 19565ED02AF8D904007D6727 /* GoodsManager */, | 862 | 19565ED02AF8D904007D6727 /* GoodsManager */, |
| 859 | 1938BD4D2B512F4600390A34 /* ShopDetail */, | 863 | 1938BD4D2B512F4600390A34 /* ShopDetail */, |
| 864 | + 19B153D02BC623780018906C /* Shoph5Pay */, | ||
| 860 | ); | 865 | ); |
| 861 | path = Shop; | 866 | path = Shop; |
| 862 | sourceTree = "<group>"; | 867 | sourceTree = "<group>"; |
| @@ -975,6 +980,15 @@ | @@ -975,6 +980,15 @@ | ||
| 975 | path = ShopPayController; | 980 | path = ShopPayController; |
| 976 | sourceTree = "<group>"; | 981 | sourceTree = "<group>"; |
| 977 | }; | 982 | }; |
| 983 | + 19B153D02BC623780018906C /* Shoph5Pay */ = { | ||
| 984 | + isa = PBXGroup; | ||
| 985 | + children = ( | ||
| 986 | + 19B153D12BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift */, | ||
| 987 | + 19B153D32BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift */, | ||
| 988 | + ); | ||
| 989 | + path = Shoph5Pay; | ||
| 990 | + sourceTree = "<group>"; | ||
| 991 | + }; | ||
| 978 | 19BB1FE42AEB93850094D962 /* Model */ = { | 992 | 19BB1FE42AEB93850094D962 /* Model */ = { |
| 979 | isa = PBXGroup; | 993 | isa = PBXGroup; |
| 980 | children = ( | 994 | children = ( |
| @@ -1805,6 +1819,7 @@ | @@ -1805,6 +1819,7 @@ | ||
| 1805 | 79BB1C162B05C62900C5720C /* CNLiveShopBodyCouponView.swift in Sources */, | 1819 | 79BB1C162B05C62900C5720C /* CNLiveShopBodyCouponView.swift in Sources */, |
| 1806 | 798916E92B04532D00D08302 /* CNLiveSavePointDB.swift in Sources */, | 1820 | 798916E92B04532D00D08302 /* CNLiveSavePointDB.swift in Sources */, |
| 1807 | 1938BD242B468AC900390A34 /* CNLivePlayletHomePageHeaderCell.swift in Sources */, | 1821 | 1938BD242B468AC900390A34 /* CNLivePlayletHomePageHeaderCell.swift in Sources */, |
| 1822 | + 19B153D42BC623BE0018906C /* CNLiveShopPayWeChatAlipayCell.swift in Sources */, | ||
| 1808 | 19FA20172AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift in Sources */, | 1823 | 19FA20172AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift in Sources */, |
| 1809 | 19123FC12ABC11170075C883 /* CNWebViewController.swift in Sources */, | 1824 | 19123FC12ABC11170075C883 /* CNWebViewController.swift in Sources */, |
| 1810 | 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */, | 1825 | 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */, |
| @@ -1880,6 +1895,7 @@ | @@ -1880,6 +1895,7 @@ | ||
| 1880 | 1938BD222B467C1700390A34 /* CNLivePlayletHomePageCell.swift in Sources */, | 1895 | 1938BD222B467C1700390A34 /* CNLivePlayletHomePageCell.swift in Sources */, |
| 1881 | 1938BD3F2B4BE7C500390A34 /* CNLiveAlbumMsgModel.swift in Sources */, | 1896 | 1938BD3F2B4BE7C500390A34 /* CNLiveAlbumMsgModel.swift in Sources */, |
| 1882 | 798A44FF2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift in Sources */, | 1897 | 798A44FF2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift in Sources */, |
| 1898 | + 19B153D22BC623980018906C /* CNLiveShopPayNeedPaymentCell.swift in Sources */, | ||
| 1883 | 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */, | 1899 | 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */, |
| 1884 | 19B153CD2BC3EB690018906C /* CNLiveShoph5ViewModel.swift in Sources */, | 1900 | 19B153CD2BC3EB690018906C /* CNLiveShoph5ViewModel.swift in Sources */, |
| 1885 | 79BB96A62AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift in Sources */, | 1901 | 79BB96A62AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift in Sources */, |
metaCode/Classes/Main/HomePage/Controller/AuthMainController/CNMetaCodeHomePageController.swift
| @@ -505,6 +505,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | @@ -505,6 +505,7 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | ||
| 505 | 505 | ||
| 506 | let identityModel = dataArray[toIndex] as! StandListModel | 506 | let identityModel = dataArray[toIndex] as! StandListModel |
| 507 | if let toBannerView = self.pageFlowView.cells[toIndex] as? CNCustomIndexView{ | 507 | if let toBannerView = self.pageFlowView.cells[toIndex] as? CNCustomIndexView{ |
| 508 | + self.pageFlowView.scrollView.bringSubviewToFront(toBannerView) | ||
| 508 | UIView.animate(withDuration: 0.2) { | 509 | UIView.animate(withDuration: 0.2) { |
| 509 | toBannerView.downSlideView.frame = CGRectMake(-LeftGap, 0, KSreenWidth, KSreenHeight) | 510 | toBannerView.downSlideView.frame = CGRectMake(-LeftGap, 0, KSreenWidth, KSreenHeight) |
| 510 | toBannerView.downSlideView.upSlideVC.view.height = KSreenHeight-DownSlideBottomViewHeight | 511 | toBannerView.downSlideView.upSlideVC.view.height = KSreenHeight-DownSlideBottomViewHeight |
| @@ -515,32 +516,22 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | @@ -515,32 +516,22 @@ class CNMetaCodeHomePageController:CNLiveBaseViewController, NewPagedFlowViewDel | ||
| 515 | } | 516 | } |
| 516 | 517 | ||
| 517 | } | 518 | } |
| 518 | - if let toBannerViewLeftView = self.pageFlowView.cells[toIndex-1] as? CNCustomIndexView{ | ||
| 519 | - UIView.animate(withDuration: 0.2) { | ||
| 520 | - toBannerViewLeftView.downSlideView.frame = CGRectMake(-LeftGap, 0, 0, 0) | ||
| 521 | - toBannerViewLeftView.upSlideView.frame = CGRectMake(-LeftGap, KSreenHeight*2,0, 0) | 519 | + if toIndex-1 >= 0{ |
| 520 | + if let toBannerViewLeftView = self.pageFlowView.cells[toIndex-1] as? CNCustomIndexView{ | ||
| 521 | + UIView.animate(withDuration: 0.2) { | ||
| 522 | + toBannerViewLeftView.downSlideView.frame = CGRectMake(-LeftGap, 0, 0, 0) | ||
| 523 | + toBannerViewLeftView.upSlideView.frame = CGRectMake(-LeftGap, KSreenHeight*2,0, 0) | ||
| 524 | + } | ||
| 522 | } | 525 | } |
| 523 | } | 526 | } |
| 524 | - if let toBannerViewRightView = self.pageFlowView.cells[toIndex+1] as? CNCustomIndexView{ | ||
| 525 | - UIView.animate(withDuration: 0.2) { | ||
| 526 | - toBannerViewRightView.downSlideView.frame = CGRectMake(-LeftGap, 0, 0, 0) | ||
| 527 | - toBannerViewRightView.upSlideView.frame = CGRectMake(-LeftGap, KSreenHeight*2,0, 0) | 527 | + if toIndex+1 < self.pageFlowView.cells.count{ |
| 528 | + if let toBannerViewRightView = self.pageFlowView.cells[toIndex+1] as? CNCustomIndexView{ | ||
| 529 | + UIView.animate(withDuration: 0.2) { | ||
| 530 | + toBannerViewRightView.downSlideView.frame = CGRectMake(-LeftGap, 0, 0, 0) | ||
| 531 | + toBannerViewRightView.upSlideView.frame = CGRectMake(-LeftGap, KSreenHeight*2,0, 0) | ||
| 532 | + } | ||
| 528 | } | 533 | } |
| 529 | } | 534 | } |
| 530 | - | ||
| 531 | -// for (idx,obj) in self.pageFlowView.cells.enumerated(){ | ||
| 532 | -// let bannerView = obj as? CNCustomIndexView | ||
| 533 | -// if idx == toIndex{ | ||
| 534 | -// bannerView?.downSlideView.frame = CGRectMake(-LeftGap, 0, KSreenWidth, KSreenHeight) | ||
| 535 | -// bannerView?.downSlideView.upSlideVC.view.height = KSreenHeight-DownSlideBottomViewHeight | ||
| 536 | -// bannerView?.downSlideView.shopConsoleVC.view.height = KSreenHeight-DownSlideBottomViewHeight | ||
| 537 | -// | ||
| 538 | -// bannerView?.upSlideView.frame = CGRectMake(-LeftGap, KSreenHeight*2,KSreenWidth, KSreenHeight) | ||
| 539 | -// }else{ | ||
| 540 | -// bannerView?.downSlideView.frame = CGRectMake(-LeftGap, 0, 0, 0) | ||
| 541 | -// bannerView?.upSlideView.frame = CGRectMake(-LeftGap, KSreenHeight*2,0, 0) | ||
| 542 | -// } | ||
| 543 | -// } | ||
| 544 | } | 535 | } |
| 545 | 536 | ||
| 546 | 537 |
metaCode/Classes/Main/HomePage/Controller/DownSlideController/CNUpSlideViewController.swift
| @@ -397,7 +397,9 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa | @@ -397,7 +397,9 @@ class CNUpSlideViewController: CNLiveBaseViewController,UITableViewDelegate,UITa | ||
| 397 | //没有我的课程 | 397 | //没有我的课程 |
| 398 | self.myCurriculumIndex = -1 | 398 | self.myCurriculumIndex = -1 |
| 399 | } | 399 | } |
| 400 | - self.dataArray.insert(albumBaseModel, at: self.myCurriculumIndex) | 400 | + if self.myCurriculumIndex > -1{ |
| 401 | + self.dataArray.insert(albumBaseModel, at: self.myCurriculumIndex) | ||
| 402 | + } | ||
| 401 | self.tableView.reloadData() | 403 | self.tableView.reloadData() |
| 402 | }else if (status == .failed){ | 404 | }else if (status == .failed){ |
| 403 | // self.NetApiStatus = .apiError | 405 | // self.NetApiStatus = .apiError |
metaCode/Classes/Main/HomePage/Controller/ShopPayController/CNLiveShopPayController.swift
| @@ -6,14 +6,61 @@ | @@ -6,14 +6,61 @@ | ||
| 6 | // 支付页面 | 6 | // 支付页面 |
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | +import CNLivePayCostModule | ||
| 10 | + | ||
| 11 | +///支付类型 | ||
| 12 | +enum CNLivePayType { | ||
| 13 | + //支付宝 | ||
| 14 | + case alipay | ||
| 15 | + //微信 | ||
| 16 | + case weChat | ||
| 17 | +} | ||
| 18 | +//支付状态 | ||
| 19 | +enum CNLivePayResult { | ||
| 20 | + //成功 | ||
| 21 | + case success | ||
| 22 | + //失败 | ||
| 23 | + case failure | ||
| 24 | + //取消支付 | ||
| 25 | + case cancel | ||
| 26 | +} | ||
| 9 | 27 | ||
| 10 | //支付完成回调 | 28 | //支付完成回调 |
| 11 | -typealias FinishPayCallBack = (_ testStr:String)->Void//_ orderInfoModel:CNLivePayOrderInfoModel | 29 | +typealias FinishPayCallBack = (_ orderInfoModel:CNLivePayOrderInfoModel,_ payType:CNLivePayType,_ payResult:CNLivePayResult)->Void |
| 12 | 30 | ||
| 13 | -class CNLiveShopPayController:CNLiveBaseViewController{ | 31 | +class CNLiveShopPayController:CNLiveBaseViewController,UITableViewDelegate,UITableViewDataSource{ |
| 14 | 32 | ||
| 15 | var finishPayCallBack:FinishPayCallBack? | 33 | var finishPayCallBack:FinishPayCallBack? |
| 16 | var orderNumber:String | 34 | var orderNumber:String |
| 35 | + var orderInfoModel:CNLivePayOrderInfoModel? | ||
| 36 | + var currentSeleWechat = true | ||
| 37 | + var payType:CNLivePayType? | ||
| 38 | + | ||
| 39 | + let kCNLiveShopPayNeedPaymentCellIdentifier = "kCNLiveShopPayNeedPaymentCellIdentifier" | ||
| 40 | + let kCNLiveShopPayWeChatAlipayCellIdentifier = "kCNLiveShopPayWeChatAlipayCellIdentifier" | ||
| 41 | + | ||
| 42 | + // MARK: - 懒加载 | ||
| 43 | + lazy var tableView : UITableView = { | ||
| 44 | + let tableView = UITableView(frame: CGRect(x: 0, y: KNavigationHeight, width: KSreenWidth, height: KSreenHeight-KNavigationHeight-KTabBarHeight), style: .plain) | ||
| 45 | + tableView.dataSource = self | ||
| 46 | + tableView.delegate = self | ||
| 47 | + tableView.separatorStyle = .singleLine | ||
| 48 | + tableView.tableFooterView = UIView.init() | ||
| 49 | + tableView.register(CNLiveShopPayNeedPaymentCell.self, forCellReuseIdentifier: kCNLiveShopPayNeedPaymentCellIdentifier) | ||
| 50 | + tableView.register(CNLiveShopPayWeChatAlipayCell.self, forCellReuseIdentifier: kCNLiveShopPayWeChatAlipayCellIdentifier) | ||
| 51 | + return tableView | ||
| 52 | + }() | ||
| 53 | + | ||
| 54 | + lazy var payBtn: UIButton = { | ||
| 55 | + let payBtn = UIButton(type: .custom) | ||
| 56 | + payBtn.frame = CGRect(x: 0, y: self.tableView.bottom, width: KSreenWidth, height: KTabBarHeight) | ||
| 57 | + payBtn.backgroundColor = UIColor(red:0.29, green:0.64, blue:0.25, alpha:1.00) | ||
| 58 | + payBtn.setTitleColor(.white, for: .normal) | ||
| 59 | + payBtn.setTitle("支付", for: .normal) | ||
| 60 | + payBtn.addTarget(self, action: #selector(payBtnAction), for: .touchUpInside) | ||
| 61 | + return payBtn | ||
| 62 | + }() | ||
| 63 | + | ||
| 17 | 64 | ||
| 18 | init(orderNumber:String) { | 65 | init(orderNumber:String) { |
| 19 | self.orderNumber = orderNumber | 66 | self.orderNumber = orderNumber |
| @@ -24,6 +71,10 @@ class CNLiveShopPayController:CNLiveBaseViewController{ | @@ -24,6 +71,10 @@ class CNLiveShopPayController:CNLiveBaseViewController{ | ||
| 24 | fatalError("init(coder:) has not been implemented") | 71 | fatalError("init(coder:) has not been implemented") |
| 25 | } | 72 | } |
| 26 | 73 | ||
| 74 | + deinit { | ||
| 75 | + NotificationCenter.default.removeObserver(self, name: UIApplication.didBecomeActiveNotification, object: nil) | ||
| 76 | + } | ||
| 77 | + | ||
| 27 | override func viewDidLoad() { | 78 | override func viewDidLoad() { |
| 28 | super.viewDidLoad() | 79 | super.viewDidLoad() |
| 29 | navigationBarHidden = false | 80 | navigationBarHidden = false |
| @@ -31,6 +82,26 @@ class CNLiveShopPayController:CNLiveBaseViewController{ | @@ -31,6 +82,26 @@ class CNLiveShopPayController:CNLiveBaseViewController{ | ||
| 31 | self.view.backgroundColor = .white | 82 | self.view.backgroundColor = .white |
| 32 | NotificationCenter.default.addObserver(self, selector: #selector(didBecomeActiveNotification(_:)), name: UIApplication.didBecomeActiveNotification, object: nil) | 83 | NotificationCenter.default.addObserver(self, selector: #selector(didBecomeActiveNotification(_:)), name: UIApplication.didBecomeActiveNotification, object: nil) |
| 33 | self.getOrderInfoMessage() | 84 | self.getOrderInfoMessage() |
| 85 | + self.initUI() | ||
| 86 | + if WXApi.isWXAppInstalled(){ | ||
| 87 | + print("wx已安装") | ||
| 88 | + }else{ | ||
| 89 | + print("wx未安装") | ||
| 90 | + } | ||
| 91 | + let urlScheme = "alipay" | ||
| 92 | + if UIApplication.shared.canOpenURL(URL(string: urlScheme)!) { | ||
| 93 | + print("已安装") | ||
| 94 | + } else { | ||
| 95 | + print("未安装") | ||
| 96 | + } | ||
| 97 | + let wxUrlScheme = "weixin://" | ||
| 98 | + if UIApplication.shared.canOpenURL(URL(string: urlScheme)!) { | ||
| 99 | + print("已安装") | ||
| 100 | + } else { | ||
| 101 | + print("未安装") | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + | ||
| 34 | } | 105 | } |
| 35 | // MARK: - 获取订单信息 并且进行检测 | 106 | // MARK: - 获取订单信息 并且进行检测 |
| 36 | func getOrderInfoMessage(){ | 107 | func getOrderInfoMessage(){ |
| @@ -39,8 +110,65 @@ class CNLiveShopPayController:CNLiveBaseViewController{ | @@ -39,8 +110,65 @@ class CNLiveShopPayController:CNLiveBaseViewController{ | ||
| 39 | } | 110 | } |
| 40 | showLoading(message: "") | 111 | showLoading(message: "") |
| 41 | CNLiveShoph5ViewModel.postOrderPayWithParams(orderId: self.orderNumber) { result, status in | 112 | CNLiveShoph5ViewModel.postOrderPayWithParams(orderId: self.orderNumber) { result, status in |
| 113 | + hiddenLoading() | ||
| 42 | if status == .success{ | 114 | if status == .success{ |
| 43 | - | 115 | + let orderInfoModel = result as! CNLivePayOrderInfoModel |
| 116 | + self.orderInfoModel = orderInfoModel | ||
| 117 | + self.tableView.reloadData() | ||
| 118 | + }else{ | ||
| 119 | + } | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + func initUI(){ | ||
| 125 | + self.view.addSubview(self.tableView) | ||
| 126 | + self.view.addSubview(self.payBtn) | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + @objc func payBtnAction(){ | ||
| 130 | + showLoading(message: "") | ||
| 131 | + | ||
| 132 | + let orderId = self.orderInfoModel?.orderId | ||
| 133 | + var userId = self.orderInfoModel?.user_id | ||
| 134 | + if userId?.count == 0{ | ||
| 135 | + userId = UserInfoManager.shared.userInfo.uid | ||
| 136 | + } | ||
| 137 | + let descStr = self.orderInfoModel?.body | ||
| 138 | + let price = self.orderInfoModel?.totalMoney | ||
| 139 | + let body = self.orderInfoModel?.body | ||
| 140 | + let coupon_fee = self.orderInfoModel?.couponMoney | ||
| 141 | + let notifyUrl = self.orderInfoModel?.notify_url | ||
| 142 | + | ||
| 143 | + let paramDict = NSMutableDictionary() | ||
| 144 | + paramDict.setValue(orderId, forKey: "orderId") | ||
| 145 | + paramDict.setValue(userId, forKey: "userId") | ||
| 146 | + paramDict.setValue(descStr, forKey: "descStr") | ||
| 147 | + paramDict.setValue(price, forKey: "price") | ||
| 148 | + paramDict.setValue("1", forKey: "orderType") | ||
| 149 | + paramDict.setValue("1", forKey: "type") | ||
| 150 | + paramDict.setValue(body, forKey: "body") | ||
| 151 | + paramDict.setValue(coupon_fee, forKey: "coupon_fee") | ||
| 152 | + paramDict.setValue(notifyUrl, forKey: "notifyUrl") | ||
| 153 | + paramDict.setValue("", forKey: "password") | ||
| 154 | + | ||
| 155 | + var payCostType:CNLivePayCostPayType? | ||
| 156 | + if self.currentSeleWechat == true{ | ||
| 157 | + self.payType = .weChat | ||
| 158 | + payCostType = CNLivePayCostPayTypeWeChatPay | ||
| 159 | + }else{ | ||
| 160 | + self.payType = .alipay | ||
| 161 | + payCostType = CNLivePayCostPayTypeAliPay | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + CNLivePayCostModule.showShopPayViw(withParamDict: paramDict as! [String : Any], payType: payCostType!) { resultCode in | ||
| 165 | + hiddenLoading() | ||
| 166 | + if resultCode == 0{ | ||
| 167 | + self.checkPayIsSuccessful(lastCount: 5) | ||
| 168 | + }else if resultCode == 3{ | ||
| 169 | + showMessage(message: "取消支付") | ||
| 170 | + }else { | ||
| 171 | + showMessage(message: "支付失败") | ||
| 44 | } | 172 | } |
| 45 | } | 173 | } |
| 46 | 174 | ||
| @@ -48,8 +176,107 @@ class CNLiveShopPayController:CNLiveBaseViewController{ | @@ -48,8 +176,107 @@ class CNLiveShopPayController:CNLiveBaseViewController{ | ||
| 48 | 176 | ||
| 49 | @objc func didBecomeActiveNotification(_ notification: Notification) { | 177 | @objc func didBecomeActiveNotification(_ notification: Notification) { |
| 50 | // 处理应用变得活跃的逻辑 | 178 | // 处理应用变得活跃的逻辑 |
| 179 | + DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { | ||
| 180 | + // 这里写你想要在 0.5 秒后执行的代码 | ||
| 181 | + self.checkPayIsSuccessful(lastCount: 0) | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + // MARK: - 检测是否支付成功 | ||
| 187 | + /// 检测是否支付成功 | ||
| 188 | + /// @param lastCount 剩余检测次数 | ||
| 189 | + func checkPayIsSuccessful(lastCount:NSInteger){ | ||
| 190 | + showLoading(message: "") | ||
| 191 | + CNLiveShoph5ViewModel.postIsOrderPayWithOrderId(orderId: self.orderNumber) { result, status in | ||
| 192 | + hiddenLoading() | ||
| 193 | + if status == .success{ | ||
| 194 | + self.finishPayCallBack?(self.orderInfoModel!, self.payType!, .success) | ||
| 195 | +// NotificationCenter.default.post(name: <#T##NSNotification.Name#>, object: <#T##Any?#>)//kDSSuccessPayOrderNotification | ||
| 196 | + }else{ | ||
| 197 | + if lastCount > 0{ | ||
| 198 | + DispatchQueue.main.asyncAfter(deadline: .now() + 1) { | ||
| 199 | + // 这里写你想要在 0.5 秒后执行的代码 | ||
| 200 | + self.checkPayIsSuccessful(lastCount: lastCount-1) | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | + } | ||
| 51 | 205 | ||
| 52 | } | 206 | } |
| 53 | 207 | ||
| 208 | + // MARK: - UITableViewDelegate | ||
| 209 | + func numberOfSections(in tableView: UITableView) -> Int { | ||
| 210 | + 2 | ||
| 211 | + } | ||
| 212 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 213 | + if section == 0{ | ||
| 214 | + return 1 | ||
| 215 | + }else{ | ||
| 216 | + return 2 | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + | ||
| 220 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 221 | + if indexPath.section == 0{ | ||
| 222 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveShopPayNeedPaymentCellIdentifier) as? CNLiveShopPayNeedPaymentCell | ||
| 223 | + else { | ||
| 224 | + let cell = CNLiveShopPayNeedPaymentCell() | ||
| 225 | + return cell | ||
| 226 | + } | ||
| 227 | + let monStr = String(format: "需要付款: ¥%.2f", (Double(self.orderInfoModel?.totalMoney ?? "0.00") ?? 0.00) / 100) | ||
| 228 | + let attribute = NSMutableAttributedString.init(string:monStr) | ||
| 229 | + let attIndex = 6 | ||
| 230 | + attribute.addAttributes([NSAttributedString.Key.foregroundColor: HexColor("#222222")!], range: NSRange.init(location: 0, length: attIndex)) | ||
| 231 | + attribute.addAttributes([NSAttributedString.Key.foregroundColor: UIColor(red:0.29, green:0.64, blue:0.25, alpha:1.00)], range: NSRange.init(location: attIndex, length: monStr.count-attIndex)) | ||
| 232 | + cell.titleLabel.attributedText = attribute | ||
| 233 | + return cell | ||
| 234 | + }else{ | ||
| 235 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveShopPayWeChatAlipayCellIdentifier) as? CNLiveShopPayWeChatAlipayCell | ||
| 236 | + else { | ||
| 237 | + let cell = CNLiveShopPayWeChatAlipayCell() | ||
| 238 | + return cell | ||
| 239 | + } | ||
| 240 | + if indexPath.row == 0{ | ||
| 241 | + //微信支付 | ||
| 242 | + cell.titleLabel.text = "微信支付" | ||
| 243 | + cell.iconImgView.image = UIImage(named: "dd_weixin") | ||
| 244 | + if self.currentSeleWechat == true{ | ||
| 245 | + cell.selectImgView.isHidden = false | ||
| 246 | + }else{ | ||
| 247 | + cell.selectImgView.isHidden = true | ||
| 248 | + } | ||
| 249 | + }else{ | ||
| 250 | + //支付宝支付 | ||
| 251 | + cell.titleLabel.text = "支付宝支付" | ||
| 252 | + cell.iconImgView.image = UIImage(named: "dd_zhifubao") | ||
| 253 | + if self.currentSeleWechat == true{ | ||
| 254 | + cell.selectImgView.isHidden = true | ||
| 255 | + }else{ | ||
| 256 | + cell.selectImgView.isHidden = false | ||
| 257 | + } | ||
| 258 | + } | ||
| 259 | + return cell | ||
| 260 | + } | ||
| 261 | + } | ||
| 262 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 263 | + if indexPath.section == 1{ | ||
| 264 | + if indexPath.row == 0{ | ||
| 265 | + if self.currentSeleWechat == true{ | ||
| 266 | + return | ||
| 267 | + } | ||
| 268 | + self.currentSeleWechat = true | ||
| 269 | + }else{ | ||
| 270 | + if self.currentSeleWechat == false{ | ||
| 271 | + return | ||
| 272 | + } | ||
| 273 | + self.currentSeleWechat = false | ||
| 274 | + } | ||
| 275 | + self.tableView.reloadData() | ||
| 276 | + } | ||
| 277 | + } | ||
| 278 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 279 | + return 60 | ||
| 280 | + } | ||
| 54 | 281 | ||
| 55 | } | 282 | } |
metaCode/Classes/Main/HomePage/Controller/WebController/CNWebView.swift
| @@ -31,9 +31,18 @@ class CNWebView:UIView,WKNavigationDelegate, WKScriptMessageHandler{ | @@ -31,9 +31,18 @@ class CNWebView:UIView,WKNavigationDelegate, WKScriptMessageHandler{ | ||
| 31 | return cnWebView | 31 | return cnWebView |
| 32 | }() | 32 | }() |
| 33 | 33 | ||
| 34 | - var webUrl:URL?//初始URL | 34 | + var _webUrl:URL?//初始URL |
| 35 | + var webUrl:URL?{ | ||
| 36 | + get{ | ||
| 37 | + _webUrl | ||
| 38 | + }set{ | ||
| 39 | + _webUrl = newValue! | ||
| 40 | + } | ||
| 41 | + } | ||
| 42 | + | ||
| 35 | var currentUrl:String = ""//当前网页的url | 43 | var currentUrl:String = ""//当前网页的url |
| 36 | var bridge:WKWebViewJavascriptBridge? | 44 | var bridge:WKWebViewJavascriptBridge? |
| 45 | + var customUserAgent:String = "" | ||
| 37 | 46 | ||
| 38 | //CNWebController | 47 | //CNWebController |
| 39 | var isCNWebController:Bool = false//是否网页控制器 | 48 | var isCNWebController:Bool = false//是否网页控制器 |
| @@ -46,6 +55,12 @@ class CNWebView:UIView,WKNavigationDelegate, WKScriptMessageHandler{ | @@ -46,6 +55,12 @@ class CNWebView:UIView,WKNavigationDelegate, WKScriptMessageHandler{ | ||
| 46 | fatalError("init(coder:) has not been implemented") | 55 | fatalError("init(coder:) has not been implemented") |
| 47 | } | 56 | } |
| 48 | 57 | ||
| 58 | + func loadUrl(url:String){ | ||
| 59 | + let urlStr = self.checkURLWithStr(urlStr: url) | ||
| 60 | + self.currentUrl = urlStr | ||
| 61 | + self.cnWebView.load(URLRequest.init(url:URL(string: urlStr)!)) | ||
| 62 | + } | ||
| 63 | + | ||
| 49 | init(frame: CGRect, configuration: WKWebViewConfiguration ,url:URL?) { | 64 | init(frame: CGRect, configuration: WKWebViewConfiguration ,url:URL?) { |
| 50 | super.init(frame: frame) | 65 | super.init(frame: frame) |
| 51 | self.configuration = configuration | 66 | self.configuration = configuration |
| @@ -57,6 +72,7 @@ class CNWebView:UIView,WKNavigationDelegate, WKScriptMessageHandler{ | @@ -57,6 +72,7 @@ class CNWebView:UIView,WKNavigationDelegate, WKScriptMessageHandler{ | ||
| 57 | if !userAgent.contains(CNLiveMCEnvironmentManager.shared.base_web_UA) { | 72 | if !userAgent.contains(CNLiveMCEnvironmentManager.shared.base_web_UA) { |
| 58 | let newUserAgent = userAgent + CNLiveMCEnvironmentManager.shared.base_web_UA | 73 | let newUserAgent = userAgent + CNLiveMCEnvironmentManager.shared.base_web_UA |
| 59 | self.cnWebView.customUserAgent = newUserAgent | 74 | self.cnWebView.customUserAgent = newUserAgent |
| 75 | + self.customUserAgent = newUserAgent | ||
| 60 | 76 | ||
| 61 | if (self.webUrl != nil){ | 77 | if (self.webUrl != nil){ |
| 62 | let urlStr = self.checkURLWithStr(urlStr: self.webUrl!.absoluteString) | 78 | let urlStr = self.checkURLWithStr(urlStr: self.webUrl!.absoluteString) |
| @@ -66,12 +82,6 @@ class CNWebView:UIView,WKNavigationDelegate, WKScriptMessageHandler{ | @@ -66,12 +82,6 @@ class CNWebView:UIView,WKNavigationDelegate, WKScriptMessageHandler{ | ||
| 66 | self.configBridge() | 82 | self.configBridge() |
| 67 | self.configBridgeRegister() | 83 | self.configBridgeRegister() |
| 68 | self.webViewAddScriptMessageHandler() | 84 | self.webViewAddScriptMessageHandler() |
| 69 | -// if URL(string: urlStr)?.host == WjjH5 { | ||
| 70 | -// self.configBridgeRegister() | ||
| 71 | -// | ||
| 72 | -// }else if URL(string: urlStr)?.host == ManageshopH5 || URL(string: urlStr)?.host == ManagemallshopH5{ | ||
| 73 | -// self.webViewAddScriptMessageHandler() | ||
| 74 | -// } | ||
| 75 | } | 85 | } |
| 76 | } | 86 | } |
| 77 | } | 87 | } |
| @@ -120,12 +130,18 @@ class CNWebView:UIView,WKNavigationDelegate, WKScriptMessageHandler{ | @@ -120,12 +130,18 @@ class CNWebView:UIView,WKNavigationDelegate, WKScriptMessageHandler{ | ||
| 120 | // 获取 payModel,如果不存在或者不是字符串类型,则使用默认值 "2" | 130 | // 获取 payModel,如果不存在或者不是字符串类型,则使用默认值 "2" |
| 121 | // let payModel = (json["payModel"] as? String) ?? "2" | 131 | // let payModel = (json["payModel"] as? String) ?? "2" |
| 122 | // 现在你可以使用 orderNumber 和 payModel 进行后续操作 | 132 | // 现在你可以使用 orderNumber 和 payModel 进行后续操作 |
| 123 | - print("orderNumber: \(orderNumber)") | ||
| 124 | let vc = CNLiveShopPayController(orderNumber: orderNumber) | 133 | let vc = CNLiveShopPayController(orderNumber: orderNumber) |
| 125 | - vc.finishPayCallBack = { [weak self] testStr in | ||
| 126 | - print(testStr) | ||
| 127 | - self?.cnWebView.evaluateJavaScript(String(format: "appPaymentCallback('%@')", <#T##arguments: CVarArg...##CVarArg#>), completionHandler: { result, error in | ||
| 128 | - | 134 | + vc.finishPayCallBack = { [weak self] orderInfoModel ,payType ,payResult in |
| 135 | + let params = NSDictionary() | ||
| 136 | + params.setValue(orderInfoModel.toJSONString() ?? "", forKey: "orderInfo") | ||
| 137 | + params.setValue(payType.hashValue, forKey: "payType") | ||
| 138 | + params.setValue(payResult.hashValue, forKey: "payResult") | ||
| 139 | + | ||
| 140 | + let sparams = params.jsonString() | ||
| 141 | + let appPaymentCallbackJS = String(format: "appPaymentCallback('%@')", sparams ?? "") | ||
| 142 | + | ||
| 143 | + self?.cnWebView.evaluateJavaScript(appPaymentCallbackJS, completionHandler: { result, error in | ||
| 144 | + print("22222222appPaymentCallbackJS:\(result)") | ||
| 129 | }) | 145 | }) |
| 130 | } | 146 | } |
| 131 | // 跳转支付页面 | 147 | // 跳转支付页面 |
metaCode/Classes/Main/HomePage/View/Shop/Shoph5Pay/CNLiveShopPayNeedPaymentCell.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveShopPayNeedPaymentCell.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by zx on 2024/4/10. | ||
| 6 | +// 电商h5支付 需要付款cell | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | + | ||
| 10 | +class CNLiveShopPayNeedPaymentCell:UITableViewCell{ | ||
| 11 | + | ||
| 12 | + lazy var titleLabel: UILabel = { | ||
| 13 | + let titleLabel = UILabel.init(frame: CGRectMake(10, 0, KSreenWidth-20, 60)) | ||
| 14 | + titleLabel.textColor = UIColor(red:0.25, green:0.23, blue:0.28, alpha:1.00) | ||
| 15 | + titleLabel.textAlignment = .left | ||
| 16 | + titleLabel.font = Font_16 | ||
| 17 | + titleLabel.adjustsFontSizeToFitWidth=true | ||
| 18 | + return titleLabel | ||
| 19 | + }() | ||
| 20 | + | ||
| 21 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 22 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 23 | + self.selectionStyle = .none | ||
| 24 | + self.initUI() | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + required init?(coder: NSCoder) { | ||
| 28 | + fatalError("init(coder:) has not been implemented") | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + // MARK: - initUI | ||
| 32 | + func initUI(){ | ||
| 33 | + self.contentView.addSubview(self.titleLabel) | ||
| 34 | + } | ||
| 35 | +} | ||
| 36 | + |
metaCode/Classes/Main/HomePage/View/Shop/Shoph5Pay/CNLiveShopPayWeChatAlipayCell.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveShopPayWeChatAlipayCell.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by zx on 2024/4/10. | ||
| 6 | +// 电商h5支付 微信支付宝cell | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | +import SnapKit | ||
| 10 | + | ||
| 11 | +class CNLiveShopPayWeChatAlipayCell:UITableViewCell{ | ||
| 12 | + | ||
| 13 | + lazy var selectImgView :UIImageView = { | ||
| 14 | + let selectImgView = UIImageView(image: UIImage(named: "tsq_xz")) | ||
| 15 | + return selectImgView | ||
| 16 | + }() | ||
| 17 | + | ||
| 18 | + lazy var iconImgView :UIImageView = { | ||
| 19 | + let iconImgView = UIImageView() | ||
| 20 | + return iconImgView | ||
| 21 | + }() | ||
| 22 | + | ||
| 23 | + lazy var titleLabel: UILabel = { | ||
| 24 | + let titleLabel = UILabel.init(frame: CGRectZero) | ||
| 25 | + titleLabel.textColor = UIColor(red:0.04, green:0.02, blue:0.07, alpha:1.00) | ||
| 26 | + titleLabel.textAlignment = .left | ||
| 27 | + titleLabel.font = BoldFont_16 | ||
| 28 | + titleLabel.adjustsFontSizeToFitWidth=true | ||
| 29 | + return titleLabel | ||
| 30 | + }() | ||
| 31 | + | ||
| 32 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 33 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 34 | + self.selectionStyle = .none | ||
| 35 | + self.initUI() | ||
| 36 | + self.layout() | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + required init?(coder: NSCoder) { | ||
| 40 | + fatalError("init(coder:) has not been implemented") | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + // MARK: - initUI | ||
| 44 | + func initUI(){ | ||
| 45 | + self.contentView.addSubview(self.titleLabel) | ||
| 46 | + self.contentView.addSubview(self.iconImgView) | ||
| 47 | + self.contentView.addSubview(self.selectImgView) | ||
| 48 | + self.selectImgView.isHidden = true | ||
| 49 | + } | ||
| 50 | + func layout(){ | ||
| 51 | + self.iconImgView.snp.makeConstraints { make in | ||
| 52 | + make.left.equalToSuperview().offset(10) | ||
| 53 | + make.centerY.equalToSuperview() | ||
| 54 | + } | ||
| 55 | + self.titleLabel.snp.makeConstraints { make in | ||
| 56 | + make.left.equalTo(self.iconImgView.snp.right).offset(20) | ||
| 57 | + make.centerY.equalToSuperview() | ||
| 58 | + } | ||
| 59 | + self.selectImgView.snp.makeConstraints { make in | ||
| 60 | + make.right.equalToSuperview().offset(-30) | ||
| 61 | + make.centerY.equalToSuperview() | ||
| 62 | + } | ||
| 63 | + } | ||
| 64 | +} |
metaCode/Classes/Main/HomePage/View/VerticalViews/DownSlide/CNDownSlideView.swift
| @@ -96,6 +96,9 @@ class CNDownSlideView:UIView{ | @@ -96,6 +96,9 @@ class CNDownSlideView:UIView{ | ||
| 96 | if(type == UpDownTypeH5){ | 96 | if(type == UpDownTypeH5){ |
| 97 | if _downPath?.count ?? 0 > 0{ | 97 | if _downPath?.count ?? 0 > 0{ |
| 98 | self.addSubview(self.webView) | 98 | self.addSubview(self.webView) |
| 99 | + if self.webView.cnWebView.url?.absoluteString.contains(_downPath) == false && self.webView.cnWebView.url != nil{ | ||
| 100 | + self.webView.loadUrl(url: _downPath!) | ||
| 101 | + } | ||
| 99 | } | 102 | } |
| 100 | }else if(type == UpDownTypePage){ | 103 | }else if(type == UpDownTypePage){ |
| 101 | self.addSubview(self.upSlideVC.view) | 104 | self.addSubview(self.upSlideVC.view) |
metaCode/Classes/Main/HomePage/View/VerticalViews/UpSlide/CNUpSlideView.swift
| @@ -29,13 +29,13 @@ class CNUpSlideView:UIView{ | @@ -29,13 +29,13 @@ class CNUpSlideView:UIView{ | ||
| 29 | configuration.userContentController = WKUserContentController() | 29 | configuration.userContentController = WKUserContentController() |
| 30 | 30 | ||
| 31 | var url:URL? | 31 | var url:URL? |
| 32 | - if (_downPath != ""){ | ||
| 33 | - url = URL.init(string: "https://managemall.cnlive.com/html/mall/1/#/pages/main/goodsList/goodsList?scene=app")//_downPath!)// | 32 | + if (self.downPath != ""){ |
| 33 | + url = URL.init(string: _downPath!)//"https://managemall.cnlive.com/html/mall/1/#/pages/main/goodsList/goodsList?scene=app")// | ||
| 34 | }else{ | 34 | }else{ |
| 35 | url = nil | 35 | url = nil |
| 36 | } | 36 | } |
| 37 | - let webView = CNWebView(frame: CGRectMake(10, KNavigationHeight+KStatusBarHeight+10, self.width - 20, self.height-KNavigationHeight-KStatusBarHeight-10), configuration: configuration,url: url) | ||
| 38 | 37 | ||
| 38 | + let webView = CNWebView(frame: CGRectMake(10, KNavigationHeight+KStatusBarHeight+10, KSreenWidth - 20, KSreenHeight-KNavigationHeight-KStatusBarHeight-10), configuration: configuration,url: url) | ||
| 39 | webView.cnWebView.scrollView.showsVerticalScrollIndicator = false | 39 | webView.cnWebView.scrollView.showsVerticalScrollIndicator = false |
| 40 | webView.cnWebView.scrollView.showsHorizontalScrollIndicator = false | 40 | webView.cnWebView.scrollView.showsHorizontalScrollIndicator = false |
| 41 | webView.cnWebView.backgroundColor = .clear | 41 | webView.cnWebView.backgroundColor = .clear |
| @@ -78,9 +78,14 @@ class CNUpSlideView:UIView{ | @@ -78,9 +78,14 @@ class CNUpSlideView:UIView{ | ||
| 78 | view.removeFromSuperview() | 78 | view.removeFromSuperview() |
| 79 | } | 79 | } |
| 80 | if(type == UpDownTypeH5){ | 80 | if(type == UpDownTypeH5){ |
| 81 | - self.addSubview(self.webView) | ||
| 82 | - } | ||
| 83 | - else if(type == UpDownTypePage){ | 81 | +// _downPath = "https://manageshop.cnlive.com/html/mall/1/#/pages/main/detail/detail?id=9526907&share_mold=shop&share_uid=c7KtcyWyXy7yMGCUPWuaUQ%3D%3D&shop_type=f8Ug%2BT1YxNKjy5QcYX4XlQ%3D%3D&shop_to=HNWMXVEMCtRetyucYELQtqg80ZoCVAAx%2B2jJIJuozJLTuJhb2vXeootObdZsz43yjHZNxKqF0WsT9mICYb0zHjo4STMRuQrSWYMkFzT4EQlgQS1%2BX%2FeCQ0jmkT2n4aZ9bShTP%2BB3nLDm%2BfHeBnfRpIEuEl3l9sXHnXc4p%2BcxciI%3D&shop_shop_type=f8Ug%2BT1YxNKjy5QcYX4XlQ%3D%3D&mall_share_type=2&price=0.01&originalPrice=0.00&shopShareType=1&wjjshopType=cnliveShopCar" |
| 82 | + if _downPath?.count ?? 0 > 0{ | ||
| 83 | + self.addSubview(self.webView) | ||
| 84 | + if self.webView.cnWebView.url?.absoluteString.contains(_downPath) == false && self.webView.cnWebView.url != nil{ | ||
| 85 | + self.webView.loadUrl(url: _downPath!) | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + }else if(type == UpDownTypePage){ | ||
| 84 | 89 | ||
| 85 | }else if(type == UpDownTypeShopDetail){ | 90 | }else if(type == UpDownTypeShopDetail){ |
| 86 | currentViewController()?.addChild(self.upSlideVC)//看行不行 | 91 | currentViewController()?.addChild(self.upSlideVC)//看行不行 |
metaCode/Classes/Main/HomePage/ViewModel/CNLiveShoph5ViewModel.swift
| @@ -68,4 +68,34 @@ class CNLiveShoph5ViewModel:NSObject{ | @@ -68,4 +68,34 @@ class CNLiveShoph5ViewModel:NSObject{ | ||
| 68 | } | 68 | } |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | + /** | ||
| 72 | + 请求订单是否支付成功 | ||
| 73 | + | ||
| 74 | + @param orderId 订单号 | ||
| 75 | + @param result 结果 //dic: NSString * score, NSString * desc | ||
| 76 | + */ | ||
| 77 | + static func postIsOrderPayWithOrderId(orderId:String,resultBlock: @escaping downSlideResultBlock) { | ||
| 78 | + | ||
| 79 | + let param = NSMutableDictionary() | ||
| 80 | + param.setValue(orderId, forKey: "orderId") | ||
| 81 | + | ||
| 82 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 83 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 84 | + CNLiveNetworking.setupDSRequest(true) | ||
| 85 | + let custom_param = NSMutableDictionary() | ||
| 86 | + custom_param.setValue(CNLiveMCEnvironmentManager.shared.appId_wjj, forKey: "appId") | ||
| 87 | + custom_param.setValue(CNLiveMCEnvironmentManager.shared.appKey_wjj, forKey: "appKey") | ||
| 88 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 89 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjShopUrl+"/Api/Index3/isOrderPay", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 90 | + hiddenLoading() | ||
| 91 | + let resp = result as! NSDictionary | ||
| 92 | + let dataDic = resp["data"] as! NSDictionary | ||
| 93 | + let code = resp["code"] as? String | ||
| 94 | + if (code == "200") { | ||
| 95 | + resultBlock(dataDic,.success) | ||
| 96 | + }else{ | ||
| 97 | + resultBlock(NSNull(),.failed) | ||
| 98 | + } | ||
| 99 | + } | ||
| 100 | + } | ||
| 71 | } | 101 | } |
metaCode/Supporting Files/Assets.xcassets/Shoph5/Contents.json
0 → 100644
metaCode/Supporting Files/Assets.xcassets/Shoph5/dd_weixin.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "dd_weixin@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "dd_weixin@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/Shoph5/dd_weixin.imageset/dd_weixin@2x.png
0 → 100644
1.89 KB
metaCode/Supporting Files/Assets.xcassets/Shoph5/dd_weixin.imageset/dd_weixin@3x.png
0 → 100644
2.46 KB
metaCode/Supporting Files/Assets.xcassets/Shoph5/dd_zhifubao.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "dd_zhifubao@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "dd_zhifubao@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/Shoph5/dd_zhifubao.imageset/dd_zhifubao@2x.png
0 → 100644
1.9 KB
metaCode/Supporting Files/Assets.xcassets/Shoph5/dd_zhifubao.imageset/dd_zhifubao@3x.png
0 → 100644
2.38 KB
metaCode/Supporting Files/Assets.xcassets/Shoph5/tsq_xz.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "tsq_xz@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "tsq_xz@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/Shoph5/tsq_xz.imageset/tsq_xz@2x.png
0 → 100644
1.5 KB
metaCode/Supporting Files/Assets.xcassets/Shoph5/tsq_xz.imageset/tsq_xz@3x.png
0 → 100644
1.83 KB