Commit 851f6bcdd613e1978404393e9f7088778c005553
1 parent
f44bbd4b
订单详情界面开发
Showing
18 changed files
with
1527 additions
and
65 deletions
Podfile
| @@ -45,7 +45,7 @@ target 'metaCode' do | @@ -45,7 +45,7 @@ target 'metaCode' do | ||
| 45 | #轮播图 | 45 | #轮播图 |
| 46 | pod 'FSPagerView', '~> 0.8.3' | 46 | pod 'FSPagerView', '~> 0.8.3' |
| 47 | #应用调试工具 | 47 | #应用调试工具 |
| 48 | -# pod 'FWDebug', :configurations => ['Debug'] | 48 | + pod 'FWDebug', :configurations => ['Debug'] |
| 49 | 49 | ||
| 50 | target 'metaCodeTests' do | 50 | target 'metaCodeTests' do |
| 51 | inherit! :search_paths | 51 | inherit! :search_paths |
metaCode.xcodeproj/project.pbxproj
| @@ -59,6 +59,7 @@ | @@ -59,6 +59,7 @@ | ||
| 59 | 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */; }; | 59 | 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */; }; |
| 60 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; }; | 60 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; }; |
| 61 | 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */; }; | 61 | 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */; }; |
| 62 | + 794BC1652AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */; }; | ||
| 62 | 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; }; | 63 | 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; }; |
| 63 | 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */; }; | 64 | 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */; }; |
| 64 | 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */; }; | 65 | 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */; }; |
| @@ -84,6 +85,7 @@ | @@ -84,6 +85,7 @@ | ||
| 84 | 799172362AF08D4500DC01A8 /* CNLiveShopBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */; }; | 85 | 799172362AF08D4500DC01A8 /* CNLiveShopBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */; }; |
| 85 | 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */; }; | 86 | 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */; }; |
| 86 | 7991723A2AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */; }; | 87 | 7991723A2AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */; }; |
| 88 | + 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */; }; | ||
| 87 | 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; | 89 | 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; |
| 88 | 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; | 90 | 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; |
| 89 | 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */; }; | 91 | 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */; }; |
| @@ -205,6 +207,7 @@ | @@ -205,6 +207,7 @@ | ||
| 205 | 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveExtensions.swift"; sourceTree = "<group>"; }; | 207 | 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveExtensions.swift"; sourceTree = "<group>"; }; |
| 206 | 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; }; | 208 | 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; }; |
| 207 | 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineExchangeViewController.swift; sourceTree = "<group>"; }; | 209 | 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineExchangeViewController.swift; sourceTree = "<group>"; }; |
| 210 | + 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSendViewController.swift; sourceTree = "<group>"; }; | ||
| 208 | 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; | 211 | 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; |
| 209 | 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveBaseViewController.swift; sourceTree = "<group>"; }; | 212 | 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveBaseViewController.swift; sourceTree = "<group>"; }; |
| 210 | 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputViewController.swift; sourceTree = "<group>"; }; | 213 | 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputViewController.swift; sourceTree = "<group>"; }; |
| @@ -230,6 +233,7 @@ | @@ -230,6 +233,7 @@ | ||
| 230 | 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBaseModel.swift; sourceTree = "<group>"; }; | 233 | 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBaseModel.swift; sourceTree = "<group>"; }; |
| 231 | 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyListView.swift; sourceTree = "<group>"; }; | 234 | 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyListView.swift; sourceTree = "<group>"; }; |
| 232 | 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderListViewController.swift; sourceTree = "<group>"; }; | 235 | 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderListViewController.swift; sourceTree = "<group>"; }; |
| 236 | + 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyCustomView.swift; sourceTree = "<group>"; }; | ||
| 233 | 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; | 237 | 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; |
| 234 | 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; }; | 238 | 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; }; |
| 235 | 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; }; | 239 | 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; }; |
| @@ -624,6 +628,7 @@ | @@ -624,6 +628,7 @@ | ||
| 624 | 799172312AF08D1B00DC01A8 /* CNLiveShopOrderViewController.swift */, | 628 | 799172312AF08D1B00DC01A8 /* CNLiveShopOrderViewController.swift */, |
| 625 | 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */, | 629 | 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */, |
| 626 | 79BB96A52AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift */, | 630 | 79BB96A52AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift */, |
| 631 | + 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */, | ||
| 627 | ); | 632 | ); |
| 628 | path = Controller; | 633 | path = Controller; |
| 629 | sourceTree = "<group>"; | 634 | sourceTree = "<group>"; |
| @@ -641,6 +646,7 @@ | @@ -641,6 +646,7 @@ | ||
| 641 | children = ( | 646 | children = ( |
| 642 | 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */, | 647 | 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */, |
| 643 | 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */, | 648 | 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */, |
| 649 | + 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */, | ||
| 644 | ); | 650 | ); |
| 645 | path = View; | 651 | path = View; |
| 646 | sourceTree = "<group>"; | 652 | sourceTree = "<group>"; |
| @@ -1132,6 +1138,7 @@ | @@ -1132,6 +1138,7 @@ | ||
| 1132 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, | 1138 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, |
| 1133 | 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */, | 1139 | 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */, |
| 1134 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, | 1140 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, |
| 1141 | + 794BC1652AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift in Sources */, | ||
| 1135 | 79BB96AA2AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift in Sources */, | 1142 | 79BB96AA2AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift in Sources */, |
| 1136 | 790D01912A2DAC5E00C5978D /* CNLiveConfigFontMacro.swift in Sources */, | 1143 | 790D01912A2DAC5E00C5978D /* CNLiveConfigFontMacro.swift in Sources */, |
| 1137 | 790D01852A2D89E100C5978D /* UIColor+CNLiveExtensions.swift in Sources */, | 1144 | 790D01852A2D89E100C5978D /* UIColor+CNLiveExtensions.swift in Sources */, |
| @@ -1147,6 +1154,7 @@ | @@ -1147,6 +1154,7 @@ | ||
| 1147 | 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */, | 1154 | 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */, |
| 1148 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, | 1155 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, |
| 1149 | 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNLiveExtensions.swift in Sources */, | 1156 | 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNLiveExtensions.swift in Sources */, |
| 1157 | + 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */, | ||
| 1150 | 790D019A2A2DCAE400C5978D /* CNLiveViewController.swift in Sources */, | 1158 | 790D019A2A2DCAE400C5978D /* CNLiveViewController.swift in Sources */, |
| 1151 | 79803E272AD68D3100F05F68 /* CNLiveMineShopViewController.swift in Sources */, | 1159 | 79803E272AD68D3100F05F68 /* CNLiveMineShopViewController.swift in Sources */, |
| 1152 | 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */, | 1160 | 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */, |
metaCode/Classes/Config/CNLiveConfigAlertManager.swift
| @@ -32,4 +32,31 @@ class ConfigAlertManager: NSObject { | @@ -32,4 +32,31 @@ class ConfigAlertManager: NSObject { | ||
| 32 | 32 | ||
| 33 | currentViewController()?.present(alert, animated: true) | 33 | currentViewController()?.present(alert, animated: true) |
| 34 | } | 34 | } |
| 35 | + | ||
| 36 | + /// 自定义弹框 富文本 | ||
| 37 | + /// - Parameters: | ||
| 38 | + /// - attrTitle: 标题 | ||
| 39 | + /// - attriMessage: 提示 | ||
| 40 | + /// - actionTitles: 动作按钮 | ||
| 41 | + /// - resultBlock: 返回 | ||
| 42 | + open func presentAlert(attrTitle: NSAttributedString,attriMessage: NSAttributedString, actionTitles: NSArray, resultBlock: @escaping resultActionAlertBlock) { | ||
| 43 | + | ||
| 44 | + let alert = UIAlertController(title: nil, message: nil, preferredStyle: .alert) | ||
| 45 | + alert.setValue(attrTitle, forKey: "attributedTitle") | ||
| 46 | + alert.setValue(attriMessage, forKey: "attributedMessage") | ||
| 47 | + | ||
| 48 | + for title in actionTitles { | ||
| 49 | + let style: UIAlertAction.Style | ||
| 50 | + if title as! String == "取消" { | ||
| 51 | + style = .cancel | ||
| 52 | + } else { | ||
| 53 | + style = .default | ||
| 54 | + } | ||
| 55 | + let action = UIAlertAction(title: title as? String, style: style) { action in | ||
| 56 | + resultBlock(actionTitles.index(of: title)) | ||
| 57 | + } | ||
| 58 | + alert.addAction(action) | ||
| 59 | + } | ||
| 60 | + currentViewController()?.present(alert, animated: true) | ||
| 61 | + } | ||
| 35 | } | 62 | } |
metaCode/Classes/Extensions/NSString+CNLiveExtensions.swift
| @@ -56,4 +56,28 @@ extension NSString { | @@ -56,4 +56,28 @@ extension NSString { | ||
| 56 | let date = format.date(from: self as String) | 56 | let date = format.date(from: self as String) |
| 57 | return "\(Int(date!.timeIntervalSince1970))" | 57 | return "\(Int(date!.timeIntervalSince1970))" |
| 58 | } | 58 | } |
| 59 | + | ||
| 60 | + /// 保留2位小数 | ||
| 61 | + /// - Returns: 返回 | ||
| 62 | + func keepTwoDecimalPlaces() -> String { | ||
| 63 | + let mSelf = NSMutableString.init(string: self) | ||
| 64 | + if self.contains(".") { | ||
| 65 | + let decimalLocation = mSelf.range(of: ".").location | ||
| 66 | + var lastDecimalLocationLength = mSelf.length - decimalLocation - 1 | ||
| 67 | + if lastDecimalLocationLength > 2 { | ||
| 68 | + while lastDecimalLocationLength != 2 { | ||
| 69 | + mSelf.deleteCharacters(in: NSMakeRange(mSelf.length - 1, 1)) | ||
| 70 | + lastDecimalLocationLength-=1 | ||
| 71 | + } | ||
| 72 | + } else if (lastDecimalLocationLength < 2) { | ||
| 73 | + while lastDecimalLocationLength != 0 { | ||
| 74 | + mSelf.append("0") | ||
| 75 | + lastDecimalLocationLength-=1 | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + } else { | ||
| 79 | + mSelf.append(".00") | ||
| 80 | + } | ||
| 81 | + return mSelf.copy() as! String | ||
| 82 | + } | ||
| 59 | } | 83 | } |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderDetailViewController.swift
| @@ -12,11 +12,16 @@ enum CNLiveShopOrderDetailShowType { | @@ -12,11 +12,16 @@ enum CNLiveShopOrderDetailShowType { | ||
| 12 | case sale //订单售后 | 12 | case sale //订单售后 |
| 13 | } | 13 | } |
| 14 | 14 | ||
| 15 | +/// 退款详情界面显示 | ||
| 16 | +enum CNLiveShopOrderDetailRefundFrom { | ||
| 17 | + case order //订单 | ||
| 18 | + case afterSale //售后 | ||
| 19 | +} | ||
| 15 | class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSetSource, EmptyDataSetDelegate, UITableViewDelegate, UITableViewDataSource{ | 20 | class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSetSource, EmptyDataSetDelegate, UITableViewDelegate, UITableViewDataSource{ |
| 16 | - | ||
| 17 | let kShopBodyOrderDetailOneViewCellIdentifier = "kShopBodyOrderDetailOneViewCellIdentifier" | 21 | let kShopBodyOrderDetailOneViewCellIdentifier = "kShopBodyOrderDetailOneViewCellIdentifier" |
| 18 | let kShopBodyOrderDetailTwoViewCellIdentifier = "kShopBodyOrderDetailTwoViewCellIdentifier" | 22 | let kShopBodyOrderDetailTwoViewCellIdentifier = "kShopBodyOrderDetailTwoViewCellIdentifier" |
| 19 | let kShopBodyOrderDetailThreeViewCellIdentifier = "kShopBodyOrderDetailThreeViewCellIdentifier" | 23 | let kShopBodyOrderDetailThreeViewCellIdentifier = "kShopBodyOrderDetailThreeViewCellIdentifier" |
| 24 | + let kShopBodyOrderDetailFourViewCellIdentifier = "kShopBodyOrderDetailFourViewCellIdentifier" | ||
| 20 | let kShopBodyOrderDetailHeaderViewCellIdentifier = "kShopBodyOrderDetailHeaderViewCellIdentifier" | 25 | let kShopBodyOrderDetailHeaderViewCellIdentifier = "kShopBodyOrderDetailHeaderViewCellIdentifier" |
| 21 | let kShopBodyOrderDetailFooterViewCellIdentifier = "kShopBodyOrderDetailFooterViewCellIdentifier" | 26 | let kShopBodyOrderDetailFooterViewCellIdentifier = "kShopBodyOrderDetailFooterViewCellIdentifier" |
| 22 | lazy var tableView : UITableView = { | 27 | lazy var tableView : UITableView = { |
| @@ -31,7 +36,7 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | @@ -31,7 +36,7 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | ||
| 31 | tableView.register(ShopBodyOrderDetailOneTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderDetailOneViewCellIdentifier) | 36 | tableView.register(ShopBodyOrderDetailOneTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderDetailOneViewCellIdentifier) |
| 32 | tableView.register(ShopBodyOrderDetailTwoTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderDetailTwoViewCellIdentifier) | 37 | tableView.register(ShopBodyOrderDetailTwoTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderDetailTwoViewCellIdentifier) |
| 33 | tableView.register(ShopBodyOrderDetailThreeTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderDetailThreeViewCellIdentifier) | 38 | tableView.register(ShopBodyOrderDetailThreeTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderDetailThreeViewCellIdentifier) |
| 34 | - tableView.tableHeaderView = headerView | 39 | + tableView.register(ShopBodyOrderDetailFourTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderDetailFourViewCellIdentifier) |
| 35 | return tableView | 40 | return tableView |
| 36 | }() | 41 | }() |
| 37 | 42 | ||
| @@ -41,6 +46,15 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | @@ -41,6 +46,15 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | ||
| 41 | return headerView | 46 | return headerView |
| 42 | }() | 47 | }() |
| 43 | 48 | ||
| 49 | + lazy var footerView: ShopBodyOrderDetailFooterView = { | ||
| 50 | + let footerView = ShopBodyOrderDetailFooterView.init(frame: CGRect(x: 0, y: KSreenHeight - get_system_tabbar_height(), width: KSreenWidth, height: get_system_tabbar_height())) | ||
| 51 | + footerView.isHidden = _form_type == .order | ||
| 52 | + footerView.clickBlock = { [weak self] title, detailModel, refundModel in | ||
| 53 | + self?.orderOperation(title: title,detailModel: detailModel, refuundModel: refundModel) | ||
| 54 | + } | ||
| 55 | + return footerView | ||
| 56 | + }() | ||
| 57 | + | ||
| 44 | lazy var dataArray: NSMutableArray = { | 58 | lazy var dataArray: NSMutableArray = { |
| 45 | let dataArray = NSMutableArray.init() | 59 | let dataArray = NSMutableArray.init() |
| 46 | return dataArray | 60 | return dataArray |
| @@ -58,10 +72,13 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | @@ -58,10 +72,13 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | ||
| 58 | 72 | ||
| 59 | var _orderId: String | 73 | var _orderId: String |
| 60 | var detailModel: ShopOrderDetailModel! | 74 | var detailModel: ShopOrderDetailModel! |
| 75 | + var refundModel: ShopOrderRefundModel! | ||
| 61 | var network_type: CNLiveMineResponseType! | 76 | var network_type: CNLiveMineResponseType! |
| 77 | + var _form_type: CNLiveShopOrderDetailRefundFrom! | ||
| 62 | var _show_type: CNLiveShopOrderDetailShowType! | 78 | var _show_type: CNLiveShopOrderDetailShowType! |
| 63 | - init(orderId: String, show_type:CNLiveShopOrderDetailShowType) { | 79 | + init(orderId: String, show_type:CNLiveShopOrderDetailShowType, form_type:CNLiveShopOrderDetailRefundFrom) { |
| 64 | _orderId = orderId | 80 | _orderId = orderId |
| 81 | + _form_type = form_type | ||
| 65 | _show_type = show_type | 82 | _show_type = show_type |
| 66 | super.init(nibName:nil, bundle:nil) | 83 | super.init(nibName:nil, bundle:nil) |
| 67 | } | 84 | } |
| @@ -74,7 +91,10 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | @@ -74,7 +91,10 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | ||
| 74 | super.viewDidLoad() | 91 | super.viewDidLoad() |
| 75 | 92 | ||
| 76 | navigationBarHidden = false | 93 | navigationBarHidden = false |
| 77 | - titleName = "订单详情" | 94 | + titleName = _show_type == .order ? "订单详情" : "退款详情" |
| 95 | + if _show_type == .sale && _form_type == .order { | ||
| 96 | + titleName = "退款详情" | ||
| 97 | + } | ||
| 78 | 98 | ||
| 79 | loadDataSourceAction() | 99 | loadDataSourceAction() |
| 80 | 100 | ||
| @@ -82,17 +102,37 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | @@ -82,17 +102,37 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | ||
| 82 | tableView.snp.makeConstraints { make in | 102 | tableView.snp.makeConstraints { make in |
| 83 | make.top.equalTo(KNavigationHeight) | 103 | make.top.equalTo(KNavigationHeight) |
| 84 | make.left.right.equalToSuperview() | 104 | make.left.right.equalToSuperview() |
| 85 | - make.bottom.equalToSuperview().offset(-KTabBarHeight) | 105 | + make.bottom.equalToSuperview().offset(-get_system_tabbar_height()) |
| 86 | } | 106 | } |
| 107 | + view.addSubview(footerView) | ||
| 87 | } | 108 | } |
| 88 | 109 | ||
| 89 | func loadDataSourceAction() { | 110 | func loadDataSourceAction() { |
| 90 | - CNLiveShopViewModel.requestOrderDetail(orderId: _orderId) { [weak self] result, respStatue in | 111 | + CNLiveShopViewModel.requestOrderDetail(orderId: _orderId, isOrderDetai: _show_type == .order, isRefund: _form_type == .afterSale) { [weak self] result, respStatue in |
| 91 | if respStatue == .success { | 112 | if respStatue == .success { |
| 92 | - self!.detailModel = result as? ShopOrderDetailModel | ||
| 93 | - self!.dataArray.addObjects(from: (self?.detailModel.order_detail)!) | ||
| 94 | - self!.tableView.reloadData() | ||
| 95 | - self!.tidyHeaderDataSource() | 113 | + if self!._show_type == .order { |
| 114 | + self!.detailModel = result as? ShopOrderDetailModel | ||
| 115 | + self!.dataArray.addObjects(from: (self?.detailModel.order_detail)!) | ||
| 116 | + self!.tidyHeaderDataSource() | ||
| 117 | + self!.tidyFooterDataSource() | ||
| 118 | + self!.tableView.reloadData() | ||
| 119 | + self!.footerView.setupWithDataSource(detailModel: self!.detailModel) | ||
| 120 | + } else { | ||
| 121 | + self!.refundModel = result as? ShopOrderRefundModel | ||
| 122 | + self!.dataArray.addObjects(from: (self?.refundModel.with_order_detail)!) | ||
| 123 | + self!.tidyRefundHeaderDataSource() | ||
| 124 | + self!.tidyRefundFooterDataSource() | ||
| 125 | + self!.tableView.reloadData() | ||
| 126 | + self!.footerView.setupWithDataSource(refundModel: self!.refundModel, form: self!._form_type) | ||
| 127 | + if self!._form_type == .order || (self!._form_type == .order && self!.refundModel.state == "2") { | ||
| 128 | + self!.footerView.isHidden = true | ||
| 129 | + self!.tableView.snp.remakeConstraints { make in | ||
| 130 | + make.top.equalTo(KNavigationHeight) | ||
| 131 | + make.left.right.equalToSuperview() | ||
| 132 | + make.bottom.equalToSuperview() | ||
| 133 | + } | ||
| 134 | + } | ||
| 135 | + } | ||
| 96 | }else if (respStatue == .noNetwork) { | 136 | }else if (respStatue == .noNetwork) { |
| 97 | self!.network_type = .noNetwork | 137 | self!.network_type = .noNetwork |
| 98 | self!.tableView.reloadEmptyDataSet() | 138 | self!.tableView.reloadEmptyDataSet() |
| @@ -103,31 +143,214 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | @@ -103,31 +143,214 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | ||
| 103 | } | 143 | } |
| 104 | } | 144 | } |
| 105 | } | 145 | } |
| 146 | +extension CNLiveShopOrderDetailViewController { | ||
| 147 | + | ||
| 148 | + /// 通过不同的按钮逻辑跳转不同界面 | ||
| 149 | + /// - Parameters: | ||
| 150 | + /// - clickEvent: 按钮类型 | ||
| 151 | + /// - listModel: 数据源 | ||
| 152 | + private func orderOperation(title: String,detailModel :ShopOrderDetailModel, refuundModel: ShopOrderRefundModel) { | ||
| 153 | + switch title { | ||
| 154 | + case "通知自提": | ||
| 155 | + notifyOrder(detailModel: detailModel) | ||
| 156 | + case "快递发货": | ||
| 157 | + self.navigationController?.pushViewController(CNLiveShopOrderSendViewController.init(orderId: detailModel.orderid! as NSString, show_type: .splite), animated: true) | ||
| 158 | + case "查看进度": | ||
| 159 | + print("查看进度") | ||
| 160 | + case "物流详情": | ||
| 161 | + print("物流详情") | ||
| 162 | + case "退款详情": | ||
| 163 | + print("退款详情") | ||
| 164 | + let vc = CNLiveShopOrderDetailViewController(orderId: detailModel.id!, show_type: .sale, form_type: .order) | ||
| 165 | + self.navigationController?.pushViewController(vc, animated: true) | ||
| 166 | + case "订单详情": | ||
| 167 | + self.navigationController?.pushViewController(CNLiveShopOrderDetailViewController(orderId: refuundModel.orderid!, show_type: .order, form_type: .afterSale), animated: true) | ||
| 168 | + case "确认退款": | ||
| 169 | + ConfigAlertManager.shared.presentAlert(title: "提示", message: "确认给用户退款?", actionTitles: ["取消","确认"]) { [weak self] index in | ||
| 170 | + if index == 1 { | ||
| 171 | + self!.agreeRefund() | ||
| 172 | + } | ||
| 173 | + } | ||
| 174 | + case "拒绝退款": | ||
| 175 | + presentRefundAlert() | ||
| 176 | + case "同意等待买家寄回": | ||
| 177 | + let attAttr = NSMutableAttributedString(string: "同意等待买家寄回?\n已收到货,需要退还收到的货物") | ||
| 178 | + attAttr.addAttribute(.font, value: UIFont.systemFont(ofSize: 14), range: NSMakeRange(0, 9)) | ||
| 179 | + attAttr.addAttribute(.foregroundColor, value: UIColor(red: 50/255, green: 45/255, blue: 44/255, alpha: 1), range: NSMakeRange(0, 9)) | ||
| 180 | + attAttr.addAttribute(.font, value: UIFont.systemFont(ofSize: 12), range: NSMakeRange(9, attAttr.length - 9)) | ||
| 181 | + attAttr.addAttribute(.foregroundColor, value: UIColor(red: 155/255, green: 155/255, blue: 155/255, alpha: 1), range: NSMakeRange(9, attAttr.length - 9)) | ||
| 182 | + let preAttr = NSMutableAttributedString.init(string: "提示") | ||
| 183 | + ConfigAlertManager.shared.presentAlert(attrTitle: preAttr, attriMessage: attAttr, actionTitles: ["取消","确定"]) { [weak self] index in | ||
| 184 | + if index == 1 { | ||
| 185 | + self!.agreeRefund() | ||
| 186 | + } | ||
| 187 | + } | ||
| 188 | + default: | ||
| 189 | + break | ||
| 190 | + } | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + /// 通知用户自提 | ||
| 194 | + /// - Parameter listModel: 数据源 | ||
| 195 | + private func notifyOrder(detailModel: ShopOrderDetailModel) { | ||
| 196 | + ConfigAlertManager.shared.presentAlert(title: "提示", message: "确认通知用户自提?", actionTitles: ["取消","确认"]) { index in | ||
| 197 | + if index == 1 { | ||
| 198 | + CNLiveShopViewModel.requestNotifyOrder(orderId: detailModel.orderid!) { result, respStatue in | ||
| 199 | + if respStatue == .success { | ||
| 200 | + showMessage(message: "通知成功") | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + } | ||
| 204 | + } | ||
| 205 | + } | ||
| 206 | + | ||
| 207 | + /// 拒绝退款 | ||
| 208 | + private func presentRefundAlert() { | ||
| 209 | + let refundView = ShopBodyOrderRefundView.init(frame: self.view.bounds) | ||
| 210 | + refundView.clickBlock = { [weak self] refundView, desc in | ||
| 211 | + showMessage(message: "") | ||
| 212 | + CNLiveShopViewModel.requestRefund(refundId: self!.refundModel.id! as NSString, desc: desc as NSString, isAgree: false) { result, respStatue in | ||
| 213 | + if respStatue == .success { | ||
| 214 | + showMessage(message: result as! String) | ||
| 215 | + refundView.removeFromSuperview() | ||
| 216 | + self!.loadDataSourceAction() | ||
| 217 | + } | ||
| 218 | + } | ||
| 219 | + } | ||
| 220 | + view.addSubview(refundView) | ||
| 221 | + } | ||
| 222 | + | ||
| 223 | + /// 同意退款 | ||
| 224 | + private func agreeRefund() { | ||
| 225 | + showMessage(message: "") | ||
| 226 | + CNLiveShopViewModel.requestRefund(refundId: self.refundModel.id! as NSString, desc: "", isAgree: true) { result, respStatue in | ||
| 227 | + if respStatue == .success { | ||
| 228 | + showMessage(message: result as! String) | ||
| 229 | + self.loadDataSourceAction() | ||
| 230 | + } | ||
| 231 | + } | ||
| 232 | + } | ||
| 233 | +} | ||
| 106 | 234 | ||
| 107 | extension CNLiveShopOrderDetailViewController { | 235 | extension CNLiveShopOrderDetailViewController { |
| 108 | func numberOfSections(in tableView: UITableView) -> Int { | 236 | func numberOfSections(in tableView: UITableView) -> Int { |
| 109 | - return 2 | 237 | + if _show_type == .order { |
| 238 | + return 4 | ||
| 239 | + } else { | ||
| 240 | + return footerArray.count + 1 | ||
| 241 | + } | ||
| 242 | + | ||
| 110 | } | 243 | } |
| 111 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | 244 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| 245 | + if _show_type == .order { | ||
| 246 | + if section == 0 { | ||
| 247 | + return self.headerArray.count | ||
| 248 | + } | ||
| 249 | + if section == 1 { | ||
| 250 | + return self.dataArray.count | ||
| 251 | + } | ||
| 252 | + if section == 2 { | ||
| 253 | + if self.footerArray.count > 0 { | ||
| 254 | + let tempArray = self.footerArray.firstObject as? NSArray | ||
| 255 | + return tempArray!.count | ||
| 256 | + } | ||
| 257 | + return 0 | ||
| 258 | + } | ||
| 259 | + if section == 3 { | ||
| 260 | + if self.footerArray.count > 0 { | ||
| 261 | + let tempArray = self.footerArray.lastObject as? NSArray | ||
| 262 | + return tempArray!.count | ||
| 263 | + } | ||
| 264 | + return 0 | ||
| 265 | + } | ||
| 266 | + return 0 | ||
| 267 | + } | ||
| 112 | if section == 0 { | 268 | if section == 0 { |
| 113 | - return headerArray.count | 269 | + return self.dataArray.count |
| 114 | } | 270 | } |
| 115 | - return self.dataArray.count | 271 | + if self.footerArray.count > 0 { |
| 272 | + let tempArray = self.footerArray[section-1] as? NSArray | ||
| 273 | + return tempArray!.count | ||
| 274 | + } | ||
| 275 | + return 0 | ||
| 116 | } | 276 | } |
| 117 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | 277 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { |
| 118 | - guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailTwoViewCellIdentifier) as? ShopBodyOrderDetailTwoTableViewCell else { | ||
| 119 | - return ShopBodyOrderDetailTwoTableViewCell() | ||
| 120 | - } | ||
| 121 | - var isHiddenLine: Bool = false | ||
| 122 | - if indexPath.row == dataArray.count - 1 { | ||
| 123 | - isHiddenLine = true | 278 | + if _show_type == .order { |
| 279 | + if indexPath.section == 0 { | ||
| 280 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailOneViewCellIdentifier) as? ShopBodyOrderDetailOneTableViewCell else { | ||
| 281 | + return ShopBodyOrderDetailOneTableViewCell() | ||
| 282 | + } | ||
| 283 | + var isHiddenLine: Bool = false | ||
| 284 | + if indexPath.row == headerArray.count - 1 { | ||
| 285 | + isHiddenLine = true | ||
| 286 | + } | ||
| 287 | + let dict = headerArray[indexPath.row] as! NSDictionary | ||
| 288 | + cell.setupWithDataSource(dict: dict, isHiddenLine: isHiddenLine) | ||
| 289 | + return cell | ||
| 290 | + } | ||
| 291 | + if indexPath.section == 1 { | ||
| 292 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailTwoViewCellIdentifier) as? ShopBodyOrderDetailTwoTableViewCell else { | ||
| 293 | + return ShopBodyOrderDetailTwoTableViewCell() | ||
| 294 | + } | ||
| 295 | + var isHiddenLine: Bool = false | ||
| 296 | + if indexPath.row == dataArray.count - 1 { | ||
| 297 | + isHiddenLine = true | ||
| 298 | + } | ||
| 299 | + let goodsModel = dataArray[indexPath.row] as! ShopOrderListGoodsModel | ||
| 300 | + cell.setupDataSource(goodsModel: goodsModel, isHiddenLine: isHiddenLine, isRefund: false, isState: (self.detailModel.state == "3"), refundModel: ShopOrderRefundModel.init()) | ||
| 301 | + return cell | ||
| 302 | + } | ||
| 303 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailThreeViewCellIdentifier) as? ShopBodyOrderDetailThreeTableViewCell else { | ||
| 304 | + return ShopBodyOrderDetailThreeTableViewCell() | ||
| 305 | + } | ||
| 306 | + let tempArray = footerArray[indexPath.section - 2] as! NSArray | ||
| 307 | + let dict = tempArray[indexPath.row] as! NSDictionary | ||
| 308 | + cell.setupWithDataSource(dict: dict) | ||
| 309 | + return cell | ||
| 310 | + } else { | ||
| 311 | + if indexPath.section == 0 { | ||
| 312 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailTwoViewCellIdentifier) as? ShopBodyOrderDetailTwoTableViewCell else { | ||
| 313 | + return ShopBodyOrderDetailTwoTableViewCell() | ||
| 314 | + } | ||
| 315 | + var isHiddenLine: Bool = false | ||
| 316 | + if indexPath.row == dataArray.count - 1 { | ||
| 317 | + isHiddenLine = true | ||
| 318 | + } | ||
| 319 | + let goodsModel = dataArray[indexPath.row] as! ShopOrderListGoodsModel | ||
| 320 | + cell.setupDataSource(goodsModel: goodsModel, isHiddenLine: isHiddenLine, isRefund: false, isState: (self.refundModel.state == "3"), refundModel: self.refundModel) | ||
| 321 | + return cell | ||
| 322 | + } | ||
| 323 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailFourViewCellIdentifier) as? ShopBodyOrderDetailFourTableViewCell else { | ||
| 324 | + return ShopBodyOrderDetailFourTableViewCell() | ||
| 325 | + } | ||
| 326 | + let tempArray = footerArray[indexPath.section - 1] as! NSArray | ||
| 327 | + let dict = tempArray[indexPath.row] as! NSDictionary | ||
| 328 | + cell.setupWithDataSource(dict: dict) | ||
| 329 | + return cell | ||
| 124 | } | 330 | } |
| 125 | - let goodsModel = dataArray[indexPath.row] as! ShopOrderListGoodsModel | ||
| 126 | - cell.setupDataSource(goodsModel: goodsModel, isHiddenLine: isHiddenLine, isRefund: false, isState: (self.detailModel.state == "3")) | ||
| 127 | - return cell | ||
| 128 | } | 331 | } |
| 129 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | 332 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
| 130 | - return 110 | 333 | + if _show_type == .order { |
| 334 | + if indexPath.section == 0 { | ||
| 335 | + return 70 | ||
| 336 | + } | ||
| 337 | + if indexPath.section == 1 { | ||
| 338 | + return 110 | ||
| 339 | + } | ||
| 340 | + if indexPath.section == 2 { | ||
| 341 | + return 60 | ||
| 342 | + } | ||
| 343 | + if indexPath.section == 3 { | ||
| 344 | + return 40 | ||
| 345 | + } | ||
| 346 | + } else { | ||
| 347 | + if indexPath.section == 0 { | ||
| 348 | + return 110 | ||
| 349 | + } | ||
| 350 | + return 40 | ||
| 351 | + } | ||
| 352 | + | ||
| 353 | + return 0 | ||
| 131 | } | 354 | } |
| 132 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | 355 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { |
| 133 | return 0.01 | 356 | return 0.01 |
| @@ -194,7 +417,7 @@ extension CNLiveShopOrderDetailViewController { | @@ -194,7 +417,7 @@ extension CNLiveShopOrderDetailViewController { | ||
| 194 | } | 417 | } |
| 195 | 418 | ||
| 196 | extension CNLiveShopOrderDetailViewController { | 419 | extension CNLiveShopOrderDetailViewController { |
| 197 | - /// 对头视图数据进行整理 | 420 | + /// 订单详情界面对头视图数据进行整理 |
| 198 | private func tidyHeaderDataSource() { | 421 | private func tidyHeaderDataSource() { |
| 199 | var back_image = "" | 422 | var back_image = "" |
| 200 | var icon_image = "" | 423 | var icon_image = "" |
| @@ -275,7 +498,7 @@ extension CNLiveShopOrderDetailViewController { | @@ -275,7 +498,7 @@ extension CNLiveShopOrderDetailViewController { | ||
| 275 | } | 498 | } |
| 276 | let dict01 = ["title":"下单时间:\(detailModel.orderid ?? "")","desc":"订单编号:\(detailModel.addtime ?? "")","phone":""] | 499 | let dict01 = ["title":"下单时间:\(detailModel.orderid ?? "")","desc":"订单编号:\(detailModel.addtime ?? "")","phone":""] |
| 277 | let dict02 = ["title":"配送信息","desc":deliveryMessage,"phone":""] | 500 | let dict02 = ["title":"配送信息","desc":deliveryMessage,"phone":""] |
| 278 | - let dict03 = ["title":userTitle,"desc":userMessage,"phone":""] | 501 | + let dict03 = ["title":userTitle,"desc":userMessage,"phone":"\(detailModel.address_phone ?? "")"] |
| 279 | if isNoUser { | 502 | if isNoUser { |
| 280 | headerArray.add(dict01) | 503 | headerArray.add(dict01) |
| 281 | } else { | 504 | } else { |
| @@ -284,13 +507,120 @@ extension CNLiveShopOrderDetailViewController { | @@ -284,13 +507,120 @@ extension CNLiveShopOrderDetailViewController { | ||
| 284 | headerArray.add(dict03) | 507 | headerArray.add(dict03) |
| 285 | } | 508 | } |
| 286 | if detailModel.content!.isNotBlank() { | 509 | if detailModel.content!.isNotBlank() { |
| 287 | - headerArray.add(["name":"备注信息","desc":detailModel.content,"phone":""]) | 510 | + headerArray.add(["title":"备注信息","desc":detailModel.content,"phone":""]) |
| 288 | } | 511 | } |
| 289 | headerView.setupDataSource(dict: ["statues":statues,"back_image":back_image,"icon_image":icon_image]) | 512 | headerView.setupDataSource(dict: ["statues":statues,"back_image":back_image,"icon_image":icon_image]) |
| 513 | + tableView.tableHeaderView = headerView | ||
| 290 | } | 514 | } |
| 291 | 515 | ||
| 292 | - /// 对尾视图数据进行整理 | 516 | + /// 订单详情界面对尾视图数据进行整理 |
| 293 | private func tidyFooterDataSource() { | 517 | private func tidyFooterDataSource() { |
| 294 | - | 518 | + var payType: String? = "" |
| 519 | + switch detailModel.payment { | ||
| 520 | + case "0": | ||
| 521 | + payType = "未支付" | ||
| 522 | + case "1": | ||
| 523 | + payType = "支付宝" | ||
| 524 | + case "2": | ||
| 525 | + payType = "微信" | ||
| 526 | + case "3": | ||
| 527 | + payType = "银联" | ||
| 528 | + case "4": | ||
| 529 | + payType = "网家家支付" | ||
| 530 | + case "5": | ||
| 531 | + payType = "货到付款" | ||
| 532 | + default: | ||
| 533 | + payType = "" | ||
| 534 | + } | ||
| 535 | + let dict01 = ["title":"支付方式","desc":payType! as String,"red":false] as [String : Any] | ||
| 536 | + footerArray.add([dict01]) | ||
| 537 | + let dict02 = ["title":"商品总额","desc":"¥ \(detailModel.price?.keepTwoDecimalPlaces() ?? "0.00")","red":true] as [String : Any] | ||
| 538 | + let dict03 = ["title":"运费","desc":"+ \(detailModel.yunfei_fee?.keepTwoDecimalPlaces() ?? "0.00")","red":true] as [String : Any] | ||
| 539 | + if detailModel.coupon_price?.keepTwoDecimalPlaces() != "0.00" && Float(detailModel.coupon_price ?? "0.00")! > 0.00 { | ||
| 540 | + let dict04 = ["title":detailModel.coupon_type == "1" ? "平台优惠" : "店铺优惠","desc":"- \(detailModel.coupon_price?.keepTwoDecimalPlaces() ?? "0.00")","red":true] as [String : Any] | ||
| 541 | + let dict05 = ["title":"","desc":"实付金额:¥ \(detailModel.pay_price?.keepTwoDecimalPlaces() ?? "0.00")","red":true] as [String : Any] | ||
| 542 | + footerArray.add([dict02,dict03,dict04,dict05]) | ||
| 543 | + } else { | ||
| 544 | + let dict05 = ["title":"","desc":"实付金额:¥ \(detailModel.pay_price?.keepTwoDecimalPlaces() ?? "0.00")","red":true] as [String : Any] | ||
| 545 | + footerArray.add([dict02,dict03,dict05]) | ||
| 546 | + } | ||
| 547 | + } | ||
| 548 | + // 退款详情界面头视图数据 | ||
| 549 | + func tidyRefundHeaderDataSource() { | ||
| 550 | + var back_image = "" | ||
| 551 | + var icon_image = "" | ||
| 552 | + var statues = "" | ||
| 553 | + switch refundModel.state { | ||
| 554 | + case "1": | ||
| 555 | + statues = "申请中" | ||
| 556 | + back_image = "DS_order_shenqingzhong" | ||
| 557 | + icon_image = "DS_order_wait" | ||
| 558 | + case "2": | ||
| 559 | + if refundModel.status == "1" { | ||
| 560 | + statues = "同意申请" | ||
| 561 | + back_image = "DS_order_tongyishenqing" | ||
| 562 | + } else { | ||
| 563 | + statues = "退款成功" | ||
| 564 | + back_image = "DS_order_tuikuanchenggong" | ||
| 565 | + } | ||
| 566 | + icon_image = "DS_order_success" | ||
| 567 | + case "3": | ||
| 568 | + statues = "拒绝退款" | ||
| 569 | + back_image = "DS_order_jujue" | ||
| 570 | + icon_image = "DS_order_close" | ||
| 571 | + case "5": | ||
| 572 | + statues = "用户撤销申请" | ||
| 573 | + back_image = "DS_order_chexiaoshenqing" | ||
| 574 | + icon_image = "DS_order_close" | ||
| 575 | + default: | ||
| 576 | + break | ||
| 577 | + } | ||
| 578 | + headerView.setupDataSource(dict: ["statues":statues,"back_image":back_image,"icon_image":icon_image]) | ||
| 579 | + tableView.tableHeaderView = headerView | ||
| 580 | + } | ||
| 581 | + // 退款详情界面尾视图数据 | ||
| 582 | + func tidyRefundFooterDataSource() { | ||
| 583 | + let oneArray = [["title":"退款类型:","desc": refundModel.tui_mode == "1" ? "退款退货" : "仅退款"], | ||
| 584 | + ["title":"退款原因:","desc": refundModel.title ?? ""], | ||
| 585 | + ["title":"退款金额:","desc": "¥ \(refundModel.price ?? "")"], | ||
| 586 | + ["title":"退款说明:","desc": refundModel.content ?? ""]] | ||
| 587 | + footerArray.add(oneArray) | ||
| 588 | + if refundModel.state == "2" { | ||
| 589 | + let firstDataArr = [["title":"退款申请:","desc":"同意"]] | ||
| 590 | + footerArray.insert(firstDataArr, at: 0) | ||
| 591 | + var thirdDataArr: NSArray = [] | ||
| 592 | + if refundModel.status == "1" { | ||
| 593 | + thirdDataArr = [["title":"同意时间:","desc":refundModel.statetime], | ||
| 594 | + ["title":"申请时间:","desc":refundModel.addtime]] | ||
| 595 | + } else { | ||
| 596 | + thirdDataArr = [["title":"退款时间:","desc":refundModel.refundtime], | ||
| 597 | + ["title":"同意时间:","desc":refundModel.statetime], | ||
| 598 | + ["title":"申请时间:","desc":refundModel.addtime]] | ||
| 599 | + } | ||
| 600 | + footerArray.add(thirdDataArr) | ||
| 601 | + } else if refundModel.state == "3" { | ||
| 602 | + var firstDataArr: NSArray = [] | ||
| 603 | + if refundModel.desc!.count > 0 { | ||
| 604 | + firstDataArr = [["title":"退款申请:","desc":"拒绝"], | ||
| 605 | + ["title":"原因:","desc":refundModel.desc]] | ||
| 606 | + } else { | ||
| 607 | + firstDataArr = [["title":"退款申请:", "desc":"拒绝"]] | ||
| 608 | + } | ||
| 609 | + footerArray.insert(firstDataArr, at: 0) | ||
| 610 | + | ||
| 611 | + let thirdDataArr = [["title":"拒绝时间:", "desc":refundModel.refundtime], | ||
| 612 | + ["title":"申请时间:", "desc":refundModel.addtime]] | ||
| 613 | + footerArray.add(thirdDataArr) | ||
| 614 | + } else if refundModel.state == "5" { | ||
| 615 | + let thirdDataArr = [["title":"撤销时间:", "desc":refundModel.statetime], | ||
| 616 | + ["title":"申请时间:", "desc":refundModel.addtime]] | ||
| 617 | + footerArray.add(thirdDataArr) | ||
| 618 | + } else { | ||
| 619 | + let thirdDataArr = [["title":"申请时间:", "desc":refundModel.addtime]] | ||
| 620 | + footerArray.add(thirdDataArr) | ||
| 621 | + } | ||
| 622 | + if refundModel.img.count > 0 { | ||
| 623 | + footerArray.add(refundModel.img) | ||
| 624 | + } | ||
| 295 | } | 625 | } |
| 296 | } | 626 | } |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderListViewController.swift
| @@ -86,7 +86,7 @@ class CNLiveShopOrderListViewController: CNLiveBaseViewController, UITableViewDe | @@ -86,7 +86,7 @@ class CNLiveShopOrderListViewController: CNLiveBaseViewController, UITableViewDe | ||
| 86 | state = "6" | 86 | state = "6" |
| 87 | } | 87 | } |
| 88 | showLoading(message: "") | 88 | showLoading(message: "") |
| 89 | - CNLiveShopViewModel.requestOrderList(state: state, page: 1) { [weak self] result, respStatue in | 89 | + CNLiveShopViewModel.requestOrderList(state: state, page: page) { [weak self] result, respStatue in |
| 90 | if respStatue == .success { | 90 | if respStatue == .success { |
| 91 | if self!.pageNum == 1 { | 91 | if self!.pageNum == 1 { |
| 92 | self!.dataArray.removeAllObjects() | 92 | self!.dataArray.removeAllObjects() |
| @@ -118,7 +118,7 @@ class CNLiveShopOrderListViewController: CNLiveBaseViewController, UITableViewDe | @@ -118,7 +118,7 @@ class CNLiveShopOrderListViewController: CNLiveBaseViewController, UITableViewDe | ||
| 118 | self!.loadDataSourceAction(page: 1) | 118 | self!.loadDataSourceAction(page: 1) |
| 119 | }) | 119 | }) |
| 120 | 120 | ||
| 121 | - tableView.mj_footer = MJRefreshBackFooter.init(refreshingBlock: {[weak self] in | 121 | + tableView.mj_footer = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in |
| 122 | self!.pageNum = self!.pageNum + 1 | 122 | self!.pageNum = self!.pageNum + 1 |
| 123 | self!.loadDataSourceAction(page: self!.pageNum) | 123 | self!.loadDataSourceAction(page: self!.pageNum) |
| 124 | }) | 124 | }) |
| @@ -243,12 +243,17 @@ extension CNLiveShopOrderListViewController { | @@ -243,12 +243,17 @@ extension CNLiveShopOrderListViewController { | ||
| 243 | /// - listModel: 数据源 | 243 | /// - listModel: 数据源 |
| 244 | private func orderOperation(clickEvent: CNDSOrderListSectionFooterBtnClickEvent, listModel: ShopOrderListModel) { | 244 | private func orderOperation(clickEvent: CNDSOrderListSectionFooterBtnClickEvent, listModel: ShopOrderListModel) { |
| 245 | switch clickEvent { | 245 | switch clickEvent { |
| 246 | - case .delivery: break | 246 | + case .delivery: |
| 247 | + self.navigationController?.pushViewController(CNLiveShopOrderSendViewController.init(orderId: listModel.id! as NSString, show_type: .splite), animated: true) | ||
| 248 | + break | ||
| 247 | case .notifyOrder: | 249 | case .notifyOrder: |
| 248 | if listModel.is_tui == "2" { | 250 | if listModel.is_tui == "2" { |
| 249 | showMessage(message: "此为退款订单") | 251 | showMessage(message: "此为退款订单") |
| 250 | return | 252 | return |
| 251 | } | 253 | } |
| 254 | + notifyOrder(listModel: listModel) | ||
| 255 | + break | ||
| 256 | + case .connection: | ||
| 252 | pushOrderDetail(listModel: listModel) | 257 | pushOrderDetail(listModel: listModel) |
| 253 | break | 258 | break |
| 254 | default: | 259 | default: |
| @@ -273,6 +278,15 @@ extension CNLiveShopOrderListViewController { | @@ -273,6 +278,15 @@ extension CNLiveShopOrderListViewController { | ||
| 273 | /// 跳转到订单详情界面 | 278 | /// 跳转到订单详情界面 |
| 274 | /// - Parameter listModel: 数据源 | 279 | /// - Parameter listModel: 数据源 |
| 275 | private func pushOrderDetail(listModel: ShopOrderListModel) { | 280 | private func pushOrderDetail(listModel: ShopOrderListModel) { |
| 276 | - self.navigationController?.pushViewController(CNLiveShopOrderDetailViewController.init(orderId: listModel.id!, show_type: .order), animated: true) | 281 | + if listModel.isRefund == "1" { |
| 282 | + let detailVC = CNLiveShopOrderDetailViewController.init(orderId: listModel.id!, show_type: .sale, form_type: .afterSale) | ||
| 283 | + self.navigationController?.pushViewController(detailVC, animated: true) | ||
| 284 | + } else { | ||
| 285 | + if listModel.address_address!.count > 0 { | ||
| 286 | + self.navigationController?.pushViewController(CNLiveShopOrderDetailViewController.init(orderId: listModel.id!, show_type: .order, form_type: .afterSale), animated: true) | ||
| 287 | + } else { | ||
| 288 | + showMessage(message: "目前没有地址信息,暂无法发货") | ||
| 289 | + } | ||
| 290 | + } | ||
| 277 | } | 291 | } |
| 278 | } | 292 | } |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderSendViewController.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveShopOrderSendViewController.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by open on 2023/11/7. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | +import EmptyDataSet_Swift | ||
| 10 | + | ||
| 11 | +enum CNLiveShopOrderSpliteSendViewType { | ||
| 12 | + case splite //发货界面 | ||
| 13 | + case select //拆单界面 | ||
| 14 | +} | ||
| 15 | + | ||
| 16 | +class CNLiveShopOrderSendViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate { | ||
| 17 | + | ||
| 18 | + let kShopBodyOrderSelectTableViewCellIdentifier = "kShopBodyOrderSelectTableViewCellIdentifier" | ||
| 19 | + let kShopBodyOrderSpliteTableViewCellIdentifier = "kShopBodyOrderSpliteTableViewCellIdentifier" | ||
| 20 | + lazy var tableView: UITableView = { | ||
| 21 | + let tableView = UITableView.init(frame: CGRect.zero, style: .plain) | ||
| 22 | + tableView.dataSource = self | ||
| 23 | + tableView.delegate = self | ||
| 24 | + tableView.emptyDataSetSource = self | ||
| 25 | + tableView.emptyDataSetDelegate = self | ||
| 26 | + tableView.backgroundColor = .clear | ||
| 27 | + tableView.tableFooterView = UIView.init() | ||
| 28 | + tableView.separatorStyle = .none | ||
| 29 | + tableView.register(ShopBodyOrderSelectTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderSelectTableViewCellIdentifier) | ||
| 30 | + tableView.register(ShopBodyOrderSpliteTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderSpliteTableViewCellIdentifier) | ||
| 31 | + return tableView | ||
| 32 | + }() | ||
| 33 | + | ||
| 34 | + lazy var saveButton: UIButton = { | ||
| 35 | + let saveButton = UIButton.init(type: .custom) | ||
| 36 | + saveButton.frame = CGRect(x: KSreenWidth - 70, y: (get_system_nav_height() - (get_system_statusBar_height() + 25))/2 + get_system_statusBar_height(), width: 60, height: 25) | ||
| 37 | + saveButton.setTitle("拆单", for: .normal) | ||
| 38 | + saveButton.titleLabel?.font = medium_adapt_font(pointSize: 12) | ||
| 39 | + saveButton.setTitleColor(HexColor("#F5A623"), for: .normal) | ||
| 40 | + saveButton.backgroundColor = .white | ||
| 41 | + saveButton.layer.masksToBounds = true | ||
| 42 | + saveButton.layer.cornerRadius = 5 | ||
| 43 | + saveButton.addTarget(self, action: #selector(spliteBtnClick), for: .touchUpInside) | ||
| 44 | + return saveButton | ||
| 45 | + }() | ||
| 46 | + | ||
| 47 | + lazy var dataArray: NSMutableArray = { | ||
| 48 | + let dataArray = NSMutableArray.init() | ||
| 49 | + return dataArray | ||
| 50 | + }() | ||
| 51 | + | ||
| 52 | + var _orderId: NSString | ||
| 53 | + var network_type: CNLiveMineResponseType! | ||
| 54 | + var _show_type: CNLiveShopOrderSpliteSendViewType! | ||
| 55 | + init(orderId: NSString, show_type:CNLiveShopOrderSpliteSendViewType) { | ||
| 56 | + _orderId = orderId | ||
| 57 | + _show_type = show_type | ||
| 58 | + super.init(nibName:nil, bundle:nil) | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + required init?(coder: NSCoder) { | ||
| 62 | + fatalError("init(coder:) has not been implemented") | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + override func viewDidLoad() { | ||
| 66 | + super.viewDidLoad() | ||
| 67 | + navigationBarHidden = false | ||
| 68 | + titleName = "选择发货商品" | ||
| 69 | + | ||
| 70 | + if _show_type == .splite { | ||
| 71 | + topNavView.addSubview(saveButton) | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + loadDataSourceAction() | ||
| 75 | + | ||
| 76 | + view.addSubview(tableView) | ||
| 77 | + tableView.snp.makeConstraints { make in | ||
| 78 | + make.top.equalTo(KNavigationHeight) | ||
| 79 | + make.left.right.equalToSuperview() | ||
| 80 | + make.bottom.equalToSuperview().offset(-get_system_tabbar_height()) | ||
| 81 | + } | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + func loadDataSourceAction() { | ||
| 85 | + CNLiveShopViewModel.requestOrderDetail(orderId: _orderId as String, isOrderDetai: true, isRefund: false) { [weak self] result, respStatue in | ||
| 86 | + if respStatue == .success { | ||
| 87 | + let detailModel = result as! ShopOrderDetailModel | ||
| 88 | + if self!._show_type == .splite { | ||
| 89 | + for goodsModel in detailModel.order_detail { | ||
| 90 | + if (detailModel.state == "2" && (goodsModel.num! - goodsModel.refund_num!) > 0) || (goodsModel.send_num! != 0 && (goodsModel.send_num! - goodsModel.refund_num!) > 0) { | ||
| 91 | + self!.dataArray.add(goodsModel) | ||
| 92 | + } | ||
| 93 | + } | ||
| 94 | + } else { | ||
| 95 | + for goodsModel in detailModel.order_detail { | ||
| 96 | + goodsModel.select = false | ||
| 97 | + goodsModel.selectNum = 1 | ||
| 98 | + | ||
| 99 | + if (detailModel.state == "2" && (goodsModel.num! - goodsModel.refund_num!) > 0 ) || (goodsModel.send_num! != 0 && (goodsModel.send_num! - goodsModel.refund_num!) > 0 ) { | ||
| 100 | + self!.dataArray.add(goodsModel) | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + } | ||
| 104 | + self?.tableView.reloadData() | ||
| 105 | + }else if (respStatue == .noNetwork) { | ||
| 106 | + self!.network_type = .noNetwork | ||
| 107 | + self!.tableView.reloadEmptyDataSet() | ||
| 108 | + } else { | ||
| 109 | + self!.network_type = .failed | ||
| 110 | + self!.tableView.reloadEmptyDataSet() | ||
| 111 | + } | ||
| 112 | + } | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + @objc func spliteBtnClick() { | ||
| 116 | + | ||
| 117 | + } | ||
| 118 | +} | ||
| 119 | +extension CNLiveShopOrderSendViewController { | ||
| 120 | + func numberOfSections(in tableView: UITableView) -> Int { | ||
| 121 | + return 1 | ||
| 122 | + } | ||
| 123 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 124 | + return self.dataArray.count | ||
| 125 | + } | ||
| 126 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 127 | + if _show_type == .select { | ||
| 128 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderSelectTableViewCellIdentifier) as? ShopBodyOrderSelectTableViewCell else { | ||
| 129 | + return ShopBodyOrderSelectTableViewCell() | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + return cell | ||
| 133 | + } else { | ||
| 134 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderSpliteTableViewCellIdentifier) as? ShopBodyOrderSpliteTableViewCell else { | ||
| 135 | + return ShopBodyOrderSpliteTableViewCell() | ||
| 136 | + } | ||
| 137 | + cell.setupDataSource(goodsModel: self.dataArray[indexPath.row] as! ShopOrderListGoodsModel) | ||
| 138 | + return cell | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 142 | + return adapt_length(length: 130) | ||
| 143 | + } | ||
| 144 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 145 | + | ||
| 146 | + } | ||
| 147 | +} | ||
| 148 | + | ||
| 149 | +extension CNLiveShopOrderSendViewController { | ||
| 150 | + | ||
| 151 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | ||
| 152 | + if network_type == .failed || network_type == .unkonw { | ||
| 153 | + return UIImage(named: "mine_list_source_unusual_failed") | ||
| 154 | + } | ||
| 155 | + if dataArray.count == 0 { | ||
| 156 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 157 | + } | ||
| 158 | + if network_type == .noNetwork { | ||
| 159 | + return UIImage(named: "mine_list_source_unusual_noNet") | ||
| 160 | + } | ||
| 161 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | ||
| 165 | + var defult_string = "" | ||
| 166 | + if network_type == .failed || network_type == .unkonw { | ||
| 167 | + defult_string = "接口请求错误,刷新试试~" | ||
| 168 | + } | ||
| 169 | + if network_type == .noNetwork { | ||
| 170 | + defult_string = "网络开小差了,刷新试试~" | ||
| 171 | + } | ||
| 172 | + if dataArray.count == 0 { | ||
| 173 | + defult_string = "暂时没有数据~" | ||
| 174 | + } | ||
| 175 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | ||
| 176 | + } | ||
| 177 | + | ||
| 178 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | ||
| 179 | + if network_type == .failed || network_type == .noNetwork { | ||
| 180 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | ||
| 181 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | ||
| 182 | + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any]) | ||
| 183 | + } | ||
| 184 | + return nil | ||
| 185 | + } | ||
| 186 | + | ||
| 187 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | ||
| 188 | + if network_type == .failed || network_type == .noNetwork { | ||
| 189 | + loadDataSourceAction() | ||
| 190 | + } | ||
| 191 | + } | ||
| 192 | +} |
metaCode/Classes/Main/ShopPage/Model/CNLiveShopBaseModel.swift
| @@ -107,20 +107,88 @@ class ShopOrderDetailModel: BaseModel { | @@ -107,20 +107,88 @@ class ShopOrderDetailModel: BaseModel { | ||
| 107 | } | 107 | } |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | +//!!!: /api/v1/refundById & /api/v1/refund 接口返回 | ||
| 111 | +class ShopOrderRefundModel: BaseModel { | ||
| 112 | + var id: String? = "" //清单id | ||
| 113 | + var type: String? = "" // 退款单id | ||
| 114 | + var title: String? = "" // 1 普通 2 售后 | ||
| 115 | + var orderid: String? = "" // 退款原因 | ||
| 116 | + var uid: String? = "" // 订单id | ||
| 117 | + var addtime: String? = "" // 申请时间 | ||
| 118 | + var statetime: String? = "" //同意申请时间 | ||
| 119 | + var state: String? = "" //1申请中 2同意申请 3拒绝 5用户撤销申请' | ||
| 120 | + var status: String? = "" //1 申请中 2完成退款 (判断 state == 2 && status == 1 为 已同意申请 state == 2 && status == 2 为完成退款) | ||
| 121 | + var content: String? = "" //详细说明 | ||
| 122 | + var price: String? = "" //金额 | ||
| 123 | + var tui_mode: String? = "" // 类型 1退款退货 2仅退款 | ||
| 124 | + var refundtime: String? = "" // 确认退款或者拒绝退款时间 | ||
| 125 | + var return_time: String? = "" // 放款时间 | ||
| 126 | + var img = [String]() //退款图片地址 | ||
| 127 | + var desc: String? = "" // 商家同意或拒绝原因 | ||
| 128 | + var express: String? = "" // 快递名称 | ||
| 129 | + var express_num: String? = "" // 快递单号 | ||
| 130 | + var num: Int = 0 // 总数 | ||
| 131 | + var with_order_detail = [ShopOrderListGoodsModel]() // 订单商品列表 | ||
| 132 | + var username: String? = "" //用户名 | ||
| 133 | + | ||
| 134 | + override func mapping(mapper: HelpingMapper) { | ||
| 135 | + mapper <<< | ||
| 136 | + self.addtime <-- TransformOf(fromJSON: { (raw) -> String in | ||
| 137 | + if raw!.count > 0 { | ||
| 138 | + let date = NSDate(timeIntervalSince1970: TimeInterval(raw!)!) | ||
| 139 | + let dateFormatter = DateFormatter() | ||
| 140 | + dateFormatter.locale = Locale.init(identifier: "zh_CN") | ||
| 141 | + dateFormatter.dateFormat = "YYYY-MM-dd hh:mm:SS" | ||
| 142 | + return dateFormatter.string(from: date as Date) | ||
| 143 | + } | ||
| 144 | + return raw! | ||
| 145 | + }, toJSON: { (tuple) -> String? in | ||
| 146 | + return tuple | ||
| 147 | + }); | ||
| 148 | + mapper <<< | ||
| 149 | + self.statetime <-- TransformOf(fromJSON: { (raw) -> String in | ||
| 150 | + if raw!.count > 0 { | ||
| 151 | + let date = NSDate(timeIntervalSince1970: TimeInterval(raw!)!) | ||
| 152 | + let dateFormatter = DateFormatter() | ||
| 153 | + dateFormatter.locale = Locale.init(identifier: "zh_CN") | ||
| 154 | + dateFormatter.dateFormat = "YYYY-MM-dd hh:mm:SS" | ||
| 155 | + return dateFormatter.string(from: date as Date) | ||
| 156 | + } | ||
| 157 | + return raw! | ||
| 158 | + }, toJSON: { (tuple) -> String? in | ||
| 159 | + return tuple | ||
| 160 | + }); | ||
| 161 | + mapper <<< | ||
| 162 | + self.refundtime <-- TransformOf(fromJSON: { (raw) -> String in | ||
| 163 | + if raw!.count > 0 { | ||
| 164 | + let date = NSDate(timeIntervalSince1970: TimeInterval(raw!)!) | ||
| 165 | + let dateFormatter = DateFormatter() | ||
| 166 | + dateFormatter.locale = Locale.init(identifier: "zh_CN") | ||
| 167 | + dateFormatter.dateFormat = "YYYY-MM-dd hh:mm:SS" | ||
| 168 | + return dateFormatter.string(from: date as Date) | ||
| 169 | + } | ||
| 170 | + return raw! | ||
| 171 | + }, toJSON: { (tuple) -> String? in | ||
| 172 | + return tuple | ||
| 173 | + }); | ||
| 174 | + } | ||
| 175 | +} | ||
| 110 | 176 | ||
| 111 | class ShopOrderListGoodsModel: BaseModel { | 177 | class ShopOrderListGoodsModel: BaseModel { |
| 112 | 178 | ||
| 113 | var id: String? = "" //清单id | 179 | var id: String? = "" //清单id |
| 114 | - var price: String? = "" // 价格 && 申请退款的金额 | ||
| 115 | - var prices: String? = "" // 原价 | 180 | + var price: Float? = 0.00 // 价格 && 申请退款的金额 |
| 181 | + var prices: Float? = 0.00 // 原价 | ||
| 116 | var simg: String? = "" // 图片 | 182 | var simg: String? = "" // 图片 |
| 117 | var title: String? = "" // 名称 && 主标题 | 183 | var title: String? = "" // 名称 && 主标题 |
| 118 | var ads: String? = "" // 副标题 | 184 | var ads: String? = "" // 副标题 |
| 119 | - var num: String? = "" // 数量 | 185 | + var num: Int? = 0 // 数量 |
| 120 | var goods_id: String? = "" // 商品id | 186 | var goods_id: String? = "" // 商品id |
| 121 | var coupon_price: String? = "" // 优惠金额 | 187 | var coupon_price: String? = "" // 优惠金额 |
| 122 | - var selectNum: String? = "" // 选中发货数量 | ||
| 123 | - var send_num: String? = "" // 剩余未发货数量 | ||
| 124 | - var refund_num: String? = "" // 退款成功数量 | 188 | + var selectNum: Int? = 0 // 选中发货数量 |
| 189 | + var send_num: Int? = 0// 剩余未发货数量 | ||
| 190 | + var refund_num: Int? = 0 // 退款成功数量 | ||
| 125 | var username: String? = "" // 用户名 | 191 | var username: String? = "" // 用户名 |
| 192 | + | ||
| 193 | + var select: Bool = false // 商品是否被选中 | ||
| 126 | } | 194 | } |
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyCustomView.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveShopBodyCustomView.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by open on 2023/11/6. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | +import SnapKit | ||
| 10 | +import Kingfisher | ||
| 11 | + | ||
| 12 | +typealias clickAgreeCallBack = (_ refundView: ShopBodyOrderRefundView,_ desc: String) -> Void | ||
| 13 | +class ShopBodyOrderRefundView: UIView, UITextViewDelegate { | ||
| 14 | + | ||
| 15 | + var clickBlock: clickAgreeCallBack! | ||
| 16 | + | ||
| 17 | + lazy var shadowView: UIView = { | ||
| 18 | + let shadowView = UIView.init() | ||
| 19 | + shadowView.backgroundColor = UIColor(white: 0, alpha: 0.38) | ||
| 20 | + return shadowView | ||
| 21 | + }() | ||
| 22 | + | ||
| 23 | + lazy var alertView: UIView = { | ||
| 24 | + let alertView = UIView.init() | ||
| 25 | + alertView.backgroundColor = .white | ||
| 26 | + alertView.layer.cornerRadius = adapt_length(length: 4) | ||
| 27 | + alertView.layer.masksToBounds = true | ||
| 28 | + return alertView | ||
| 29 | + }() | ||
| 30 | + | ||
| 31 | + lazy var titleLab: UILabel = { | ||
| 32 | + let titleLab = UILabel.init() | ||
| 33 | + titleLab.font = medium_adapt_font(pointSize: 17) | ||
| 34 | + titleLab.textColor = HexColor("#444444") | ||
| 35 | + titleLab.textAlignment = .center | ||
| 36 | + titleLab.text = "拒绝原因" | ||
| 37 | + return titleLab | ||
| 38 | + }() | ||
| 39 | + | ||
| 40 | + lazy var contentBgView: UIView = { | ||
| 41 | + let contentBgView = UIView.init() | ||
| 42 | + contentBgView.backgroundColor = HexColor("#F5F6F8") | ||
| 43 | + contentBgView.layer.cornerRadius = adapt_length(length: 4) | ||
| 44 | + contentBgView.layer.masksToBounds = true | ||
| 45 | + return contentBgView | ||
| 46 | + }() | ||
| 47 | + | ||
| 48 | + lazy var contentTextView: UITextView = { | ||
| 49 | + let contentTextView = UITextView.init(frame: CGRect.zero) | ||
| 50 | + contentTextView.text = "拒单原因,最多不超过100字…" | ||
| 51 | + contentTextView.backgroundColor = HexColor("#F5F6F8") | ||
| 52 | + contentTextView.textColor = UIColor.lightGray | ||
| 53 | + contentTextView.font = regular_adapt_font(pointSize: 14) | ||
| 54 | + contentTextView.delegate = self | ||
| 55 | + contentTextView.returnKeyType = .done | ||
| 56 | + contentTextView.showsVerticalScrollIndicator = false | ||
| 57 | + return contentTextView | ||
| 58 | + }() | ||
| 59 | + | ||
| 60 | + lazy var cancelBtn: UIButton = { | ||
| 61 | + let cancelBtn = UIButton.init(type: .custom) | ||
| 62 | + cancelBtn.setTitle("取消", for: .normal) | ||
| 63 | + cancelBtn.setTitleColor(HexColor("#ffffff"), for: .normal) | ||
| 64 | + cancelBtn.titleLabel?.font = medium_adapt_font(pointSize: 14) | ||
| 65 | + cancelBtn.layer.cornerRadius = adapt_length(length: 4) | ||
| 66 | + cancelBtn.layer.masksToBounds = true | ||
| 67 | + cancelBtn.backgroundColor = HexColor("#F5A623") | ||
| 68 | + cancelBtn.addTarget(self, action: #selector(cancelBtnClick), for: .touchUpInside) | ||
| 69 | + return cancelBtn | ||
| 70 | + }() | ||
| 71 | + | ||
| 72 | + lazy var agreeBtn: UIButton = { | ||
| 73 | + let agreeBtn = UIButton.init(type: .custom) | ||
| 74 | + agreeBtn.setTitle("确认拒绝", for: .normal) | ||
| 75 | + agreeBtn.setTitleColor(HexColor("#ffffff"), for: .normal) | ||
| 76 | + agreeBtn.titleLabel?.font = medium_adapt_font(pointSize: 14) | ||
| 77 | + agreeBtn.layer.cornerRadius = adapt_length(length: 4) | ||
| 78 | + agreeBtn.layer.masksToBounds = true | ||
| 79 | + agreeBtn.backgroundColor = HexColor("#28C1C6") | ||
| 80 | + agreeBtn.addTarget(self, action: #selector(agreeBtnClick), for: .touchUpInside) | ||
| 81 | + return agreeBtn | ||
| 82 | + }() | ||
| 83 | + | ||
| 84 | + override init(frame: CGRect) { | ||
| 85 | + super.init(frame: frame) | ||
| 86 | + addSubview(shadowView) | ||
| 87 | + shadowView.snp.makeConstraints { make in | ||
| 88 | + make.edges.equalToSuperview() | ||
| 89 | + } | ||
| 90 | + addSubview(alertView) | ||
| 91 | + alertView.snp.makeConstraints { make in | ||
| 92 | + make.left.equalToSuperview().offset(adapt_length(length: 30)) | ||
| 93 | + make.right.equalToSuperview().offset(-adapt_length(length: 30)) | ||
| 94 | + make.center.equalToSuperview() | ||
| 95 | + make.height.equalTo(KSreenWidth-adapt_length(length: 60)) | ||
| 96 | + } | ||
| 97 | + alertView.addSubview(titleLab) | ||
| 98 | + titleLab.snp.makeConstraints { make in | ||
| 99 | + make.left.equalToSuperview().offset(adapt_length(length: 20)) | ||
| 100 | + make.top.equalToSuperview().offset(adapt_length(length: 20)) | ||
| 101 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | ||
| 102 | + } | ||
| 103 | + alertView.addSubview(contentBgView) | ||
| 104 | + contentBgView.snp.makeConstraints { make in | ||
| 105 | + make.left.equalToSuperview().offset(adapt_length(length: 25)) | ||
| 106 | + make.top.equalTo(titleLab.snp.bottom).offset(adapt_length(length: 15)) | ||
| 107 | + make.right.equalToSuperview().offset(-adapt_length(length: 25)) | ||
| 108 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 60)) | ||
| 109 | + } | ||
| 110 | + contentBgView.addSubview(contentTextView) | ||
| 111 | + contentTextView.snp.makeConstraints { make in | ||
| 112 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 113 | + make.top.equalToSuperview().offset(adapt_length(length: 12)) | ||
| 114 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 115 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 12)) | ||
| 116 | + } | ||
| 117 | + alertView.addSubview(cancelBtn) | ||
| 118 | + cancelBtn.snp.makeConstraints { make in | ||
| 119 | + make.left.equalToSuperview().offset((KSreenWidth-adapt_length(length: 228))/3) | ||
| 120 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 121 | + make.width.equalTo(adapt_length(length: 84)) | ||
| 122 | + make.height.equalTo(adapt_length(length: 30)) | ||
| 123 | + } | ||
| 124 | + alertView.addSubview(agreeBtn) | ||
| 125 | + agreeBtn.snp.makeConstraints { make in | ||
| 126 | + make.right.equalToSuperview().offset(-((KSreenWidth-adapt_length(length: 228))/3)) | ||
| 127 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 128 | + make.width.equalTo(adapt_length(length: 84)) | ||
| 129 | + make.height.equalTo(adapt_length(length: 30)) | ||
| 130 | + } | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + @objc func agreeBtnClick() { | ||
| 134 | + if (clickBlock != nil) { | ||
| 135 | + self.clickBlock(self, self.contentTextView.text) | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | + | ||
| 139 | + func textViewDidBeginEditing(_ textView: UITextView) { | ||
| 140 | + if textView.textColor == UIColor.lightGray { | ||
| 141 | + textView.text = nil | ||
| 142 | + textView.textColor = HexColor("#444444") | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + func textViewShouldEndEditing(_ textView: UITextView) -> Bool { | ||
| 147 | + if textView.text.isEmpty { | ||
| 148 | + textView.text = "拒单原因,最多不超过100字…" | ||
| 149 | + textView.textColor = UIColor.lightGray | ||
| 150 | + } | ||
| 151 | + return true | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + func textViewDidChange(_ textView: UITextView) { | ||
| 155 | + if self.contentTextView == textView && self.contentTextView.text.count > 100 { | ||
| 156 | + showMessage(message: "最多不超过100字!!!") | ||
| 157 | + } | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + func textViewDidEndEditing(_ textView: UITextView) { | ||
| 161 | + if self.contentTextView == textView && self.contentTextView.text.count > 100 { | ||
| 162 | + self.contentTextView.text = self.contentTextView.text.prefix(100).lowercased() | ||
| 163 | + } | ||
| 164 | + } | ||
| 165 | + func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { | ||
| 166 | + if text == "\n" { | ||
| 167 | + self.endEditing(true) | ||
| 168 | + return false | ||
| 169 | + } | ||
| 170 | + return true | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { | ||
| 174 | + guard let contentTextViewRect = self.contentTextView.superview?.convert(self.contentTextView.frame, to: self) else { return self.contentTextView } | ||
| 175 | + | ||
| 176 | + if !CGRectContainsPoint(contentTextViewRect, point) { | ||
| 177 | + self.endEditing(true) | ||
| 178 | + } | ||
| 179 | + return super.hitTest(point, with: event) | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + @objc func cancelBtnClick() { | ||
| 183 | + removeFromSuperview() | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + required init?(coder: NSCoder) { | ||
| 187 | + fatalError("init(coder:) has not been implemented") | ||
| 188 | + } | ||
| 189 | +} | ||
| 190 | + | ||
| 191 | + | ||
| 192 | +class ShopBodyOrderSpliteTableViewCell: UITableViewCell { | ||
| 193 | + | ||
| 194 | + | ||
| 195 | + lazy var goodsImageView: UIImageView = { | ||
| 196 | + let goodsImageView = UIImageView.init() | ||
| 197 | + goodsImageView.backgroundColor = .white | ||
| 198 | + goodsImageView.contentMode = .scaleAspectFill | ||
| 199 | + goodsImageView.layer.masksToBounds = true | ||
| 200 | + return goodsImageView | ||
| 201 | + }() | ||
| 202 | + | ||
| 203 | + lazy var goodsTitle: UILabel = { | ||
| 204 | + let goodsTitle = UILabel.init() | ||
| 205 | + goodsTitle.lineBreakMode = .byClipping | ||
| 206 | + goodsTitle.numberOfLines = 2 | ||
| 207 | + goodsTitle.textColor = HexColor("#333333") | ||
| 208 | + goodsTitle.font = regular_adapt_font(pointSize: 14) | ||
| 209 | + return goodsTitle | ||
| 210 | + }() | ||
| 211 | + | ||
| 212 | + lazy var priceLabel: UILabel = { | ||
| 213 | + let priceLabel = UILabel.init() | ||
| 214 | + priceLabel.textColor = HexColor("#FC1541") | ||
| 215 | + priceLabel.font = medium_adapt_font(pointSize: 21) | ||
| 216 | + return priceLabel | ||
| 217 | + }() | ||
| 218 | + | ||
| 219 | + lazy var numberLabel: UILabel = { | ||
| 220 | + let numberLabel = UILabel.init() | ||
| 221 | + numberLabel.textAlignment = .right | ||
| 222 | + numberLabel.textColor = HexColor("#222833") | ||
| 223 | + numberLabel.font = regular_adapt_font(pointSize: 15) | ||
| 224 | + return numberLabel | ||
| 225 | + }() | ||
| 226 | + | ||
| 227 | + lazy var lineLabel: UILabel = { | ||
| 228 | + let lineLabel = UILabel.init() | ||
| 229 | + lineLabel.backgroundColor = HexColor("#EAEAEA") | ||
| 230 | + return lineLabel | ||
| 231 | + }() | ||
| 232 | + | ||
| 233 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 234 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 235 | + contentView.backgroundColor = .clear | ||
| 236 | + selectionStyle = .none | ||
| 237 | + | ||
| 238 | + | ||
| 239 | + addSubview(goodsImageView) | ||
| 240 | + goodsImageView.snp.makeConstraints { make in | ||
| 241 | + make.left.top.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 242 | + make.size.equalTo(adapt_length(length: 100)) | ||
| 243 | + } | ||
| 244 | + addSubview(goodsTitle) | ||
| 245 | + goodsTitle.snp.makeConstraints { make in | ||
| 246 | + make.top.equalTo(goodsImageView) | ||
| 247 | + make.left.equalTo(goodsImageView.snp.right).offset(adapt_length(length: 15)) | ||
| 248 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 249 | + } | ||
| 250 | + addSubview(priceLabel) | ||
| 251 | + priceLabel.snp.makeConstraints { make in | ||
| 252 | + make.left.equalTo(goodsTitle) | ||
| 253 | + make.bottom.equalTo(goodsImageView) | ||
| 254 | + } | ||
| 255 | + addSubview(numberLabel) | ||
| 256 | + numberLabel.snp.makeConstraints { make in | ||
| 257 | + make.right.equalToSuperview().offset(-adapt_length(length: 10)) | ||
| 258 | + make.bottom.equalTo(goodsImageView) | ||
| 259 | + } | ||
| 260 | + addSubview(lineLabel) | ||
| 261 | + lineLabel.snp.makeConstraints { make in | ||
| 262 | + make.left.equalTo(goodsImageView) | ||
| 263 | + make.right.equalTo(numberLabel) | ||
| 264 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 0.5)) | ||
| 265 | + make.height.equalTo(adapt_length(length: 0.5)) | ||
| 266 | + } | ||
| 267 | + } | ||
| 268 | + | ||
| 269 | + func setupDataSource(goodsModel: ShopOrderListGoodsModel) { | ||
| 270 | + goodsImageView.kf.setImage(with: URL(string: goodsModel.simg!), placeholder: UIImage.imageWithColor(color: HexColor("#F8F8F8")!, size: CGSize(width: adapt_length(length: 100), height: adapt_length(length: 100)))) | ||
| 271 | + goodsTitle.text = goodsModel.title | ||
| 272 | + priceLabel.text = "¥ \(goodsModel.price ?? 0.00)" | ||
| 273 | + priceLabel.sizeToFit() | ||
| 274 | + numberLabel.text = "x \(goodsModel.num ?? 0)" | ||
| 275 | + numberLabel.sizeToFit() | ||
| 276 | + setNeedsLayout() | ||
| 277 | + } | ||
| 278 | + | ||
| 279 | + required init?(coder: NSCoder) { | ||
| 280 | + fatalError("init(coder:) has not been implemented") | ||
| 281 | + } | ||
| 282 | +} | ||
| 283 | + | ||
| 284 | + | ||
| 285 | +class ShopBodyOrderSelectTableViewCell: UITableViewCell { | ||
| 286 | + | ||
| 287 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 288 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 289 | + | ||
| 290 | + | ||
| 291 | + } | ||
| 292 | + | ||
| 293 | + required init?(coder: NSCoder) { | ||
| 294 | + fatalError("init(coder:) has not been implemented") | ||
| 295 | + } | ||
| 296 | +} |
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyDetailView.swift
| @@ -7,6 +7,7 @@ | @@ -7,6 +7,7 @@ | ||
| 7 | 7 | ||
| 8 | import Foundation | 8 | import Foundation |
| 9 | 9 | ||
| 10 | +typealias clickDetailBottemBtnCallBack = (_ title: String,_ detailModel :ShopOrderDetailModel,_ refundModel: ShopOrderRefundModel) -> Void | ||
| 10 | /// 头视图 | 11 | /// 头视图 |
| 11 | class ShopBodyOrderDetailHeaderView: UIView { | 12 | class ShopBodyOrderDetailHeaderView: UIView { |
| 12 | 13 | ||
| @@ -68,7 +69,7 @@ class ShopBodyOrderDetailOneTableViewCell: UITableViewCell { | @@ -68,7 +69,7 @@ class ShopBodyOrderDetailOneTableViewCell: UITableViewCell { | ||
| 68 | 69 | ||
| 69 | lazy var titleLabel: UILabel = { | 70 | lazy var titleLabel: UILabel = { |
| 70 | let titleLabel = UILabel.init() | 71 | let titleLabel = UILabel.init() |
| 71 | - titleLabel.textColor = HexColor("0x222833") | 72 | + titleLabel.textColor = HexColor("#222833") |
| 72 | titleLabel.font = regular_adapt_font(pointSize: 15) | 73 | titleLabel.font = regular_adapt_font(pointSize: 15) |
| 73 | titleLabel.numberOfLines = 1 | 74 | titleLabel.numberOfLines = 1 |
| 74 | return titleLabel | 75 | return titleLabel |
| @@ -84,7 +85,7 @@ class ShopBodyOrderDetailOneTableViewCell: UITableViewCell { | @@ -84,7 +85,7 @@ class ShopBodyOrderDetailOneTableViewCell: UITableViewCell { | ||
| 84 | 85 | ||
| 85 | lazy var phoneButton: UIButton = { | 86 | lazy var phoneButton: UIButton = { |
| 86 | let phoneButton = UIButton(type: .custom) | 87 | let phoneButton = UIButton(type: .custom) |
| 87 | - phoneButton.setTitleColor(HexColor("4A90E2"), for: .normal) | 88 | + phoneButton.setTitleColor(HexColor("#4A90E2"), for: .normal) |
| 88 | phoneButton.titleLabel?.font = regular_adapt_font(pointSize: 14) | 89 | phoneButton.titleLabel?.font = regular_adapt_font(pointSize: 14) |
| 89 | phoneButton.addTarget(self, action: #selector(phoneCallBtnClick), for: .touchUpInside) | 90 | phoneButton.addTarget(self, action: #selector(phoneCallBtnClick), for: .touchUpInside) |
| 90 | return phoneButton | 91 | return phoneButton |
| @@ -108,7 +109,44 @@ class ShopBodyOrderDetailOneTableViewCell: UITableViewCell { | @@ -108,7 +109,44 @@ class ShopBodyOrderDetailOneTableViewCell: UITableViewCell { | ||
| 108 | contentView.backgroundColor = .clear | 109 | contentView.backgroundColor = .clear |
| 109 | selectionStyle = .none | 110 | selectionStyle = .none |
| 110 | 111 | ||
| 112 | + addSubview(titleLabel) | ||
| 113 | + titleLabel.snp.makeConstraints { make in | ||
| 114 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 115 | + make.top.equalToSuperview().offset(adapt_length(length: 10)) | ||
| 116 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 117 | + } | ||
| 118 | + addSubview(descLabel) | ||
| 119 | + descLabel.snp.makeConstraints { make in | ||
| 120 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 121 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 10)) | ||
| 122 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 123 | + } | ||
| 124 | + addSubview(phoneButton) | ||
| 125 | + phoneButton.snp.makeConstraints { make in | ||
| 126 | + make.centerY.equalTo(titleLabel) | ||
| 127 | + make.left.equalTo(titleLabel.snp.right).offset(adapt_length(length: 15)) | ||
| 128 | + } | ||
| 129 | + addSubview(phoneView) | ||
| 130 | + phoneView.snp.makeConstraints { make in | ||
| 131 | + make.centerY.equalTo(phoneButton) | ||
| 132 | + make.left.equalTo(phoneButton.snp.right).offset(adapt_length(length: 5)) | ||
| 133 | + make.size.equalTo(adapt_length(length: 10)) | ||
| 134 | + } | ||
| 135 | + addSubview(lineLabel) | ||
| 136 | + lineLabel.snp.makeConstraints { make in | ||
| 137 | + make.centerX.equalToSuperview() | ||
| 138 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 139 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 140 | + make.height.equalTo(adapt_length(length: 1)) | ||
| 141 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 1)) | ||
| 142 | + } | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + func setupWithDataSource(dict: NSDictionary, isHiddenLine: Bool) { | ||
| 146 | + titleLabel.text = dict["title"] as? String | ||
| 147 | + descLabel.text = dict["desc"] as? String | ||
| 111 | 148 | ||
| 149 | + lineLabel.isHidden = isHiddenLine | ||
| 112 | } | 150 | } |
| 113 | 151 | ||
| 114 | @objc func phoneCallBtnClick() { | 152 | @objc func phoneCallBtnClick() { |
| @@ -210,20 +248,37 @@ class ShopBodyOrderDetailTwoTableViewCell: UITableViewCell { | @@ -210,20 +248,37 @@ class ShopBodyOrderDetailTwoTableViewCell: UITableViewCell { | ||
| 210 | setConstrainta() | 248 | setConstrainta() |
| 211 | } | 249 | } |
| 212 | 250 | ||
| 213 | - func setupDataSource(goodsModel: ShopOrderListGoodsModel, isHiddenLine: Bool, isRefund: Bool, isState: Bool) { | 251 | + func setupDataSource(goodsModel: ShopOrderListGoodsModel, isHiddenLine: Bool, isRefund: Bool, isState: Bool, refundModel: ShopOrderRefundModel) { |
| 214 | titleLabel.text = goodsModel.title | 252 | titleLabel.text = goodsModel.title |
| 215 | descLabel.text = goodsModel.ads | 253 | descLabel.text = goodsModel.ads |
| 216 | - priceLab.text = "\(goodsModel.price ?? "")" | 254 | + priceLab.text = "¥ \(goodsModel.price ?? 0.00)" |
| 217 | iconView.kf.setImage(with: URL(string: goodsModel.simg!), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 90, height: 90))) | 255 | iconView.kf.setImage(with: URL(string: goodsModel.simg!), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 90, height: 90))) |
| 218 | 256 | ||
| 219 | lineLabel.isHidden = isHiddenLine | 257 | lineLabel.isHidden = isHiddenLine |
| 220 | -// if !isRefund && isState { | ||
| 221 | -// if (goodsModel.send_num == "0" || (Int(goodsModel.num) - Int(goodsModel.send_num)) + Int(goodsModel.refund_num) == Int(goodsModel.num)) { | ||
| 222 | -// statueLable.text = "全部已发货" | ||
| 223 | -// } else { | ||
| 224 | -// statueLable.text = "\(Int(goodsModel.num) - Int(goodsModel.send_num))/\(goodsModel.num)已发货" | ||
| 225 | -// } | ||
| 226 | -// } | 258 | + if (!isRefund && isState) { |
| 259 | + if (goodsModel.send_num! == 0 || (goodsModel.num! - goodsModel.send_num! + goodsModel.refund_num!) == goodsModel.num!) { | ||
| 260 | + statueLable.text = "全部已发货" | ||
| 261 | + } else { | ||
| 262 | + statueLable.text = "\(goodsModel.num! - goodsModel.send_num!)/\(goodsModel.num!)已发货" | ||
| 263 | + } | ||
| 264 | + } | ||
| 265 | + if goodsModel.price! < goodsModel.prices! { | ||
| 266 | + originalPriceLab.isHidden = false | ||
| 267 | + | ||
| 268 | + let originalPrice = NSAttributedString(string: "\(goodsModel.prices ?? 0.00)", attributes: [.font:originalPriceLab.font!,.strikethroughStyle:NSNumber(integerLiteral: NSUnderlineStyle.single.rawValue)]) | ||
| 269 | + originalPriceLab.attributedText = originalPrice | ||
| 270 | + } else { | ||
| 271 | + originalPriceLab.isHidden = true | ||
| 272 | + } | ||
| 273 | + | ||
| 274 | + if refundModel.type!.count > 0 { | ||
| 275 | + numberLabel.text = "x \(refundModel.type == "2" ? refundModel.num : goodsModel.num ?? 0)" | ||
| 276 | + } else { | ||
| 277 | + numberLabel.text = "x \(goodsModel.num ?? 0)" | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + refundLab.isHidden = goodsModel.refund_num == 0 | ||
| 281 | + refundLab.text = "已退款: \(goodsModel.refund_num ?? 0)" | ||
| 227 | } | 282 | } |
| 228 | 283 | ||
| 229 | func setConstrainta() { | 284 | func setConstrainta() { |
| @@ -274,9 +329,318 @@ class ShopBodyOrderDetailTwoTableViewCell: UITableViewCell { | @@ -274,9 +329,318 @@ class ShopBodyOrderDetailTwoTableViewCell: UITableViewCell { | ||
| 274 | /// 列表图 | 329 | /// 列表图 |
| 275 | class ShopBodyOrderDetailThreeTableViewCell: UITableViewCell { | 330 | class ShopBodyOrderDetailThreeTableViewCell: UITableViewCell { |
| 276 | 331 | ||
| 332 | + lazy var titleLabel: UILabel = { | ||
| 333 | + let titleLabel = UILabel.init() | ||
| 334 | + titleLabel.textColor = HexColor("#222833") | ||
| 335 | + titleLabel.font = regular_adapt_font(pointSize: 15) | ||
| 336 | + return titleLabel | ||
| 337 | + }() | ||
| 338 | + | ||
| 339 | + lazy var descLabel: UILabel = { | ||
| 340 | + let descLabel = UILabel.init() | ||
| 341 | + descLabel.textColor = HexColor("#222833") | ||
| 342 | + descLabel.font = regular_adapt_font(pointSize: 15) | ||
| 343 | + descLabel.textAlignment = .right | ||
| 344 | + return descLabel | ||
| 345 | + }() | ||
| 346 | + | ||
| 347 | + | ||
| 348 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 349 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 350 | + contentView.backgroundColor = .clear | ||
| 351 | + selectionStyle = .none | ||
| 352 | + | ||
| 353 | + addSubview(titleLabel) | ||
| 354 | + titleLabel.snp.makeConstraints { make in | ||
| 355 | + make.centerY.equalToSuperview() | ||
| 356 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 357 | + } | ||
| 358 | + addSubview(descLabel) | ||
| 359 | + descLabel.snp.makeConstraints { make in | ||
| 360 | + make.centerY.equalToSuperview() | ||
| 361 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 362 | + } | ||
| 363 | + } | ||
| 364 | + | ||
| 365 | + func setupWithDataSource(dict: NSDictionary) { | ||
| 366 | + titleLabel.text = dict["title"] as? String | ||
| 367 | + descLabel.text = dict["desc"] as? String | ||
| 368 | + if dict["red"] as! Bool { | ||
| 369 | + descLabel.textColor = HexColor("#FC1541") | ||
| 370 | + } else { | ||
| 371 | + descLabel.textColor = HexColor("#222833") | ||
| 372 | + } | ||
| 373 | + if titleLabel.text?.count == 0 { | ||
| 374 | + descLabel.text = "" | ||
| 375 | + let priceAttri = NSMutableAttributedString.init(string: dict["desc"] as? String ?? "实付金额:¥ 0.00") | ||
| 376 | + priceAttri.addAttribute(.font, value: regular_adapt_font(pointSize: 15), range: NSMakeRange(0, 5)) | ||
| 377 | + priceAttri.addAttribute(.foregroundColor, value: HexColor("#222833")!, range: NSMakeRange(0, 5)) | ||
| 378 | + priceAttri.addAttribute(.font, value: regular_adapt_font(pointSize: 20), range: NSMakeRange(5, (dict["desc"] as? String)!.count - 5)) | ||
| 379 | + priceAttri.addAttribute(.foregroundColor, value: HexColor("#FF415F")!, range: NSMakeRange(5, (dict["desc"] as? String)!.count - 5)) | ||
| 380 | + descLabel.attributedText = priceAttri | ||
| 381 | + } | ||
| 382 | + } | ||
| 383 | + | ||
| 384 | + required init?(coder: NSCoder) { | ||
| 385 | + fatalError("init(coder:) has not been implemented") | ||
| 386 | + } | ||
| 387 | +} | ||
| 388 | + | ||
| 389 | +/// 列表图 | ||
| 390 | +class ShopBodyOrderDetailFourTableViewCell: UITableViewCell { | ||
| 391 | + lazy var titleLabel: UILabel = { | ||
| 392 | + let titleLabel = UILabel.init() | ||
| 393 | + titleLabel.textColor = HexColor("#959595") | ||
| 394 | + titleLabel.font = regular_adapt_font(pointSize: 15) | ||
| 395 | + return titleLabel | ||
| 396 | + }() | ||
| 397 | + | ||
| 398 | + lazy var descLabel: UILabel = { | ||
| 399 | + let descLabel = UILabel.init() | ||
| 400 | + descLabel.textColor = HexColor("#222833") | ||
| 401 | + descLabel.font = semibold_adapt_font(pointSize: 15) | ||
| 402 | + descLabel.textAlignment = .right | ||
| 403 | + return descLabel | ||
| 404 | + }() | ||
| 405 | + | ||
| 406 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 407 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 408 | + contentView.backgroundColor = .clear | ||
| 409 | + selectionStyle = .none | ||
| 410 | + | ||
| 411 | + addSubview(titleLabel) | ||
| 412 | + titleLabel.snp.makeConstraints { make in | ||
| 413 | + make.centerY.equalToSuperview() | ||
| 414 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 415 | + } | ||
| 416 | + addSubview(descLabel) | ||
| 417 | + descLabel.snp.makeConstraints { make in | ||
| 418 | + make.centerY.equalToSuperview() | ||
| 419 | + make.left.equalTo(titleLabel.snp.right).offset(adapt_length(length: 15)) | ||
| 420 | + } | ||
| 421 | + } | ||
| 422 | + | ||
| 423 | + func setupWithDataSource(dict: NSDictionary) { | ||
| 424 | + titleLabel.text = dict["title"] as? String | ||
| 425 | + descLabel.text = dict["desc"] as? String | ||
| 426 | + } | ||
| 427 | + | ||
| 428 | + required init?(coder: NSCoder) { | ||
| 429 | + fatalError("init(coder:) has not been implemented") | ||
| 430 | + } | ||
| 431 | + | ||
| 277 | } | 432 | } |
| 278 | 433 | ||
| 279 | /// 尾视图 | 434 | /// 尾视图 |
| 280 | -class ShopBodyOrderDetailFooterViewCell: UITableViewHeaderFooterView { | 435 | +class ShopBodyOrderDetailFooterView: UIView { |
| 436 | + | ||
| 437 | + lazy var rightButton: UIButton = { | ||
| 438 | + let rightButton = UIButton(type: .custom) | ||
| 439 | + rightButton.backgroundColor = HexColor("#65C368") | ||
| 440 | + rightButton.layer.cornerRadius = 4 | ||
| 441 | + rightButton.layer.masksToBounds = true | ||
| 442 | + rightButton.isHidden = true | ||
| 443 | + rightButton.titleLabel?.font = medium_font(pointSize: 14) | ||
| 444 | + rightButton.addTarget(self, action: #selector(bottemBtnClick), for: .touchUpInside) | ||
| 445 | + return rightButton | ||
| 446 | + }() | ||
| 447 | + | ||
| 448 | + lazy var mindButton: UIButton = { | ||
| 449 | + let mindButton = UIButton(type: .custom) | ||
| 450 | + mindButton.backgroundColor = HexColor("#F5A623") | ||
| 451 | + mindButton.layer.cornerRadius = 4 | ||
| 452 | + mindButton.layer.masksToBounds = true | ||
| 453 | + mindButton.isHidden = true | ||
| 454 | + mindButton.titleLabel?.font = medium_font(pointSize: 14) | ||
| 455 | + mindButton.addTarget(self, action: #selector(bottemBtnClick), for: .touchUpInside) | ||
| 456 | + return mindButton | ||
| 457 | + }() | ||
| 458 | + | ||
| 459 | + lazy var leftButton: UIButton = { | ||
| 460 | + let leftButton = UIButton.init(type: .custom) | ||
| 461 | + leftButton.backgroundColor = HexColor("#3A3A3A") | ||
| 462 | + leftButton.layer.cornerRadius = 4 | ||
| 463 | + leftButton.layer.masksToBounds = true | ||
| 464 | + leftButton.isHidden = true | ||
| 465 | + leftButton.titleLabel?.font = medium_font(pointSize: 14) | ||
| 466 | + leftButton.addTarget(self, action: #selector(bottemBtnClick), for: .touchUpInside) | ||
| 467 | + return leftButton | ||
| 468 | + }() | ||
| 469 | + | ||
| 470 | + var _detailModel: ShopOrderDetailModel! | ||
| 471 | + var _refundModel: ShopOrderRefundModel! | ||
| 472 | + var clickBlock: clickDetailBottemBtnCallBack! | ||
| 473 | + override init(frame: CGRect) { | ||
| 474 | + super.init(frame: frame) | ||
| 475 | + backgroundColor = .white | ||
| 476 | + | ||
| 477 | + addSubview(rightButton) | ||
| 478 | + rightButton.snp.makeConstraints { make in | ||
| 479 | + make.width.equalTo(77) | ||
| 480 | + make.height.equalTo(30) | ||
| 481 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | ||
| 482 | + make.top.equalToSuperview().offset(adapt_length(length: 9.5)) | ||
| 483 | + } | ||
| 484 | + addSubview(mindButton) | ||
| 485 | + mindButton.snp.makeConstraints { make in | ||
| 486 | + make.centerY.equalTo(rightButton) | ||
| 487 | + make.right.equalTo(rightButton.snp.left).offset(-adapt_length(length: 15)) | ||
| 488 | + make.width.equalTo(77) | ||
| 489 | + make.height.equalTo(30) | ||
| 490 | + } | ||
| 491 | + addSubview(leftButton) | ||
| 492 | + leftButton.snp.makeConstraints { make in | ||
| 493 | + make.centerY.equalTo(rightButton) | ||
| 494 | + make.right.equalTo(mindButton.snp.left).offset(-adapt_length(length: 15)) | ||
| 495 | + make.width.equalTo(77) | ||
| 496 | + make.height.equalTo(30) | ||
| 497 | + } | ||
| 498 | + } | ||
| 281 | 499 | ||
| 500 | + func setupWithDataSource(refundModel: ShopOrderRefundModel, form: CNLiveShopOrderDetailRefundFrom) { | ||
| 501 | + _refundModel = refundModel | ||
| 502 | + rightButton.isHidden = true | ||
| 503 | + mindButton.isHidden = true | ||
| 504 | + leftButton.isHidden = true | ||
| 505 | + switch refundModel.state { | ||
| 506 | + case "1": | ||
| 507 | + leftButton.isHidden = false | ||
| 508 | + mindButton.isHidden = false | ||
| 509 | + if refundModel.tui_mode == "1" { | ||
| 510 | + leftButton.setTitle("同意等待买家寄回", for: .normal) | ||
| 511 | + } else { | ||
| 512 | + leftButton.setTitle("确认退款", for: .normal) | ||
| 513 | + } | ||
| 514 | + leftButton.setTitleColor(HexColor("#ffffff"), for: .normal) | ||
| 515 | + leftButton.backgroundColor = HexColor("#28C1C6") | ||
| 516 | + | ||
| 517 | + mindButton.setTitle("拒绝退款", for: .normal) | ||
| 518 | + mindButton.setTitleColor(HexColor("#ffffff"), for: .normal) | ||
| 519 | + mindButton.backgroundColor = HexColor("F5A623") | ||
| 520 | + | ||
| 521 | + rightButton.isHidden = form == .order | ||
| 522 | + if form == .afterSale { | ||
| 523 | + rightButton.setTitle("订单详情", for: .normal) | ||
| 524 | + rightButton.setTitleColor(HexColor("#3A3A3A"), for: .normal) | ||
| 525 | + rightButton.backgroundColor = .clear | ||
| 526 | + rightButton.layer.borderColor = HexColor("#999999")?.cgColor | ||
| 527 | + rightButton.layer.borderWidth = adapt_length(length: 1) | ||
| 528 | + } | ||
| 529 | + case "2": | ||
| 530 | + if refundModel.status == "1" { | ||
| 531 | + leftButton.isHidden = false | ||
| 532 | + leftButton.setTitle("确认退款", for: .normal) | ||
| 533 | + leftButton.setTitleColor(HexColor("#ffffff"), for: .normal) | ||
| 534 | + leftButton.backgroundColor = HexColor("#28C1C6") | ||
| 535 | + | ||
| 536 | + mindButton.isHidden = false | ||
| 537 | + mindButton.setTitle("拒绝退款", for: .normal) | ||
| 538 | + mindButton.setTitleColor(HexColor("#ffffff"), for: .normal) | ||
| 539 | + mindButton.backgroundColor = HexColor("F5A623") | ||
| 540 | + | ||
| 541 | + rightButton.isHidden = form == .order | ||
| 542 | + if form == .afterSale { | ||
| 543 | + rightButton.setTitle("订单详情", for: .normal) | ||
| 544 | + rightButton.setTitleColor(HexColor("#3A3A3A"), for: .normal) | ||
| 545 | + rightButton.backgroundColor = .clear | ||
| 546 | + rightButton.layer.borderColor = HexColor("#999999")?.cgColor | ||
| 547 | + rightButton.layer.borderWidth = adapt_length(length: 1) | ||
| 548 | + } | ||
| 549 | + } else { | ||
| 550 | + if form == .afterSale { | ||
| 551 | + rightButton.isHidden = false | ||
| 552 | + | ||
| 553 | + rightButton.setTitle("订单详情", for: .normal) | ||
| 554 | + rightButton.setTitleColor(HexColor("#3A3A3A"), for: .normal) | ||
| 555 | + rightButton.backgroundColor = .clear | ||
| 556 | + rightButton.layer.borderColor = HexColor("#999999")?.cgColor | ||
| 557 | + rightButton.layer.borderWidth = adapt_length(length: 1) | ||
| 558 | + } | ||
| 559 | + } | ||
| 560 | + default: | ||
| 561 | + if form == .afterSale { | ||
| 562 | + rightButton.isHidden = false | ||
| 563 | + | ||
| 564 | + rightButton.setTitle("订单详情", for: .normal) | ||
| 565 | + rightButton.setTitleColor(HexColor("#3A3A3A"), for: .normal) | ||
| 566 | + rightButton.backgroundColor = .clear | ||
| 567 | + rightButton.layer.borderColor = HexColor("#999999")?.cgColor | ||
| 568 | + rightButton.layer.borderWidth = adapt_length(length: 1) | ||
| 569 | + } | ||
| 570 | + break | ||
| 571 | + } | ||
| 572 | + } | ||
| 573 | + | ||
| 574 | + | ||
| 575 | + func setupWithDataSource(detailModel: ShopOrderDetailModel) { | ||
| 576 | + _detailModel = detailModel | ||
| 577 | + rightButton.isHidden = true | ||
| 578 | + mindButton.isHidden = true | ||
| 579 | + switch detailModel.state { | ||
| 580 | + case "2": | ||
| 581 | + rightButton.isHidden = false | ||
| 582 | + if detailModel.is_tui == "2" { | ||
| 583 | + rightButton.setTitle("退款详情", for: .normal) | ||
| 584 | + } else { | ||
| 585 | + if detailModel.delivery == "2" { | ||
| 586 | + rightButton.setTitle("通知自提", for: .normal) | ||
| 587 | + } else { | ||
| 588 | + rightButton.setTitle("快递发货", for: .normal) | ||
| 589 | + } | ||
| 590 | + } | ||
| 591 | + case "3": | ||
| 592 | + rightButton.isHidden = false | ||
| 593 | + if detailModel.is_tui == "2" { | ||
| 594 | + rightButton.setTitle("退款详情", for: .normal) | ||
| 595 | + } else { | ||
| 596 | + if detailModel.delivery == "2" { | ||
| 597 | + rightButton.setTitle("查看进度", for: .normal) | ||
| 598 | + } else { | ||
| 599 | + if detailModel.is_send_all { | ||
| 600 | + if detailModel.is_send == "0" { | ||
| 601 | + rightButton.setTitle("快递发货", for: .normal) | ||
| 602 | + } else { | ||
| 603 | + rightButton.backgroundColor = HexColor("#F5A623") | ||
| 604 | + rightButton.setTitle("物流详情", for: .normal) | ||
| 605 | + } | ||
| 606 | + } else { | ||
| 607 | + if detailModel.is_send == "0" { | ||
| 608 | + mindButton.isHidden = false | ||
| 609 | + rightButton.setTitle("快递发货", for: .normal) | ||
| 610 | + mindButton.setTitle("物流详情", for: .normal) | ||
| 611 | + } else { | ||
| 612 | + mindButton.isHidden = true | ||
| 613 | + rightButton.setTitle("物流详情", for: .normal) | ||
| 614 | + } | ||
| 615 | + } | ||
| 616 | + } | ||
| 617 | + } | ||
| 618 | + case "4": | ||
| 619 | + rightButton.isHidden = false | ||
| 620 | + if detailModel.delivery == "2" { | ||
| 621 | + rightButton.setTitle("查看进度", for: .normal) | ||
| 622 | + } else { | ||
| 623 | + rightButton.backgroundColor = HexColor("#F5A623") | ||
| 624 | + rightButton.setTitle("物流详情", for: .normal) | ||
| 625 | + } | ||
| 626 | + case "6": | ||
| 627 | + rightButton.isHidden = false | ||
| 628 | + rightButton.setTitle("退款详情", for: .normal) | ||
| 629 | + default: | ||
| 630 | + break | ||
| 631 | + } | ||
| 632 | + } | ||
| 633 | + | ||
| 634 | + @objc func bottemBtnClick(sender: UIButton) { | ||
| 635 | + if (_detailModel != nil) && (clickBlock != nil) { | ||
| 636 | + self.clickBlock((sender.titleLabel?.text)!, _detailModel, ShopOrderRefundModel.init()) | ||
| 637 | + } | ||
| 638 | + if (_refundModel != nil) && (clickBlock != nil) { | ||
| 639 | + self.clickBlock((sender.titleLabel?.text)!, ShopOrderDetailModel.init(), _refundModel) | ||
| 640 | + } | ||
| 641 | + } | ||
| 642 | + | ||
| 643 | + required init?(coder: NSCoder) { | ||
| 644 | + fatalError("init(coder:) has not been implemented") | ||
| 645 | + } | ||
| 282 | } | 646 | } |
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyListView.swift
| @@ -125,7 +125,7 @@ class ShopBodyOrderFooterViewCell: UITableViewHeaderFooterView { | @@ -125,7 +125,7 @@ class ShopBodyOrderFooterViewCell: UITableViewHeaderFooterView { | ||
| 125 | clickEvent = .expDetail | 125 | clickEvent = .expDetail |
| 126 | } else { | 126 | } else { |
| 127 | let goodsModel = _listModel.order_detail.first! | 127 | let goodsModel = _listModel.order_detail.first! |
| 128 | - if Int(goodsModel.num!)! > 1 { | 128 | + if goodsModel.num! > 1 { |
| 129 | clickEvent = .expDetail | 129 | clickEvent = .expDetail |
| 130 | } else { | 130 | } else { |
| 131 | clickEvent = .delivery | 131 | clickEvent = .delivery |
metaCode/Classes/Main/ShopPage/ViewModel/CNLiveShopViewModel.swift
| @@ -149,9 +149,111 @@ class CNLiveShopViewModel: NSObject { | @@ -149,9 +149,111 @@ class CNLiveShopViewModel: NSObject { | ||
| 149 | /// - Parameters: | 149 | /// - Parameters: |
| 150 | /// - orderId: 订单id | 150 | /// - orderId: 订单id |
| 151 | /// - resultBlock: 返回 | 151 | /// - resultBlock: 返回 |
| 152 | - static func requestOrderDetail(orderId: String, resultBlock: @escaping resultShopBlock) { | 152 | + static func requestOrderDetail(orderId: String, isOrderDetai: Bool, isRefund: Bool,resultBlock: @escaping resultShopBlock) { |
| 153 | + if isOrderDetai { | ||
| 154 | + let param = NSMutableDictionary() | ||
| 155 | + param.setValue(orderId, forKey: "id") | ||
| 156 | + let custom_param = NSMutableDictionary() | ||
| 157 | + custom_param.setValue(APPId_wjj, forKey: "appId") | ||
| 158 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | ||
| 159 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 160 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 161 | + CNLiveNetworking.setupDSRequest(true) | ||
| 162 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 163 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/order", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 164 | + hiddenLoading() | ||
| 165 | + if (error == nil) { | ||
| 166 | + let resp = result as! NSDictionary | ||
| 167 | + let errorCode = "\(resp["code"] ?? "0")" | ||
| 168 | + if (errorCode == "200") { | ||
| 169 | + if resp["data"] is NSNull { | ||
| 170 | + resultBlock(NSNull(),.failed) | ||
| 171 | + } else { | ||
| 172 | + let model = dictionaryToModel(resp as! [String : Any], ShopOrderDetailModel.self,"data") as! ShopOrderDetailModel | ||
| 173 | + var is_send_all: Bool = true | ||
| 174 | + for goodsModel in model.order_detail { | ||
| 175 | + if goodsModel.send_num! > 0 { | ||
| 176 | + is_send_all = false | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + model.is_send_all = is_send_all | ||
| 180 | + resultBlock(model,.success) | ||
| 181 | + } | ||
| 182 | + } else { | ||
| 183 | + showMessage(message: resp["message"] as! String) | ||
| 184 | + resultBlock(NSNull(),.failed) | ||
| 185 | + } | ||
| 186 | + } else { | ||
| 187 | + if CNLiveNetworking.isNetworking() { | ||
| 188 | + showMessage(message: "获取失败") | ||
| 189 | + resultBlock(NSNull(),.failed) | ||
| 190 | + } else { | ||
| 191 | + showMessage(message: "似乎与网络断开链接") | ||
| 192 | + resultBlock(NSNull(),.noNetwork) | ||
| 193 | + } | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | + } else { | ||
| 197 | + var url: String = "" | ||
| 198 | + if isRefund { | ||
| 199 | + url = "/api/v1/refundById" | ||
| 200 | + } else { | ||
| 201 | + url = "/api/v1/refund" | ||
| 202 | + } | ||
| 203 | + let param = NSMutableDictionary() | ||
| 204 | + param.setValue(orderId, forKey: "id") | ||
| 205 | + let custom_param = NSMutableDictionary() | ||
| 206 | + custom_param.setValue(APPId_wjj, forKey: "appId") | ||
| 207 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | ||
| 208 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 209 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 210 | + CNLiveNetworking.setupDSRequest(true) | ||
| 211 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 212 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+url, param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 213 | + hiddenLoading() | ||
| 214 | + if (error == nil) { | ||
| 215 | + let resp = result as! NSDictionary | ||
| 216 | + let errorCode = "\(resp["code"] ?? "0")" | ||
| 217 | + if (errorCode == "200") { | ||
| 218 | + if resp["data"] is NSNull { | ||
| 219 | + resultBlock(NSNull(),.failed) | ||
| 220 | + } else { | ||
| 221 | + let model = dictionaryToModel(resp as! [String : Any], ShopOrderRefundModel.self,"data") as! ShopOrderRefundModel | ||
| 222 | + resultBlock(model,.success) | ||
| 223 | + } | ||
| 224 | + } else { | ||
| 225 | + showMessage(message: resp["message"] as! String) | ||
| 226 | + resultBlock(NSNull(),.failed) | ||
| 227 | + } | ||
| 228 | + } else { | ||
| 229 | + if CNLiveNetworking.isNetworking() { | ||
| 230 | + showMessage(message: "获取失败") | ||
| 231 | + resultBlock(NSNull(),.failed) | ||
| 232 | + } else { | ||
| 233 | + showMessage(message: "似乎与网络断开链接") | ||
| 234 | + resultBlock(NSNull(),.noNetwork) | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | + } | ||
| 239 | + } | ||
| 240 | + | ||
| 241 | + /// 同意退款和拒绝退款 | ||
| 242 | + /// - Parameters: | ||
| 243 | + /// - refundId: 退款id | ||
| 244 | + /// - desc: 拒绝退款描述 | ||
| 245 | + /// - isAgree: 是否同意退款 | ||
| 246 | + /// - resultBlock: 返回 | ||
| 247 | + static func requestRefund(refundId: NSString, desc: NSString,isAgree: Bool,resultBlock: @escaping resultShopBlock) { | ||
| 248 | + var url: String = "" | ||
| 153 | let param = NSMutableDictionary() | 249 | let param = NSMutableDictionary() |
| 154 | - param.setValue(orderId, forKey: "id") | 250 | + param.setValue(refundId, forKey: "id") |
| 251 | + if isAgree { | ||
| 252 | + url = "/api/v1/confirmRefund" | ||
| 253 | + } else { | ||
| 254 | + url = "/api/v1/refuse" | ||
| 255 | + param.setValue(desc, forKey: "desc") | ||
| 256 | + } | ||
| 155 | let custom_param = NSMutableDictionary() | 257 | let custom_param = NSMutableDictionary() |
| 156 | custom_param.setValue(APPId_wjj, forKey: "appId") | 258 | custom_param.setValue(APPId_wjj, forKey: "appId") |
| 157 | custom_param.setValue(APPKey_wjj, forKey: "appKey") | 259 | custom_param.setValue(APPKey_wjj, forKey: "appKey") |
| @@ -159,7 +261,7 @@ class CNLiveShopViewModel: NSObject { | @@ -159,7 +261,7 @@ class CNLiveShopViewModel: NSObject { | ||
| 159 | CNLiveNetworking.setupShowDataResult(false) | 261 | CNLiveNetworking.setupShowDataResult(false) |
| 160 | CNLiveNetworking.setupDSRequest(true) | 262 | CNLiveNetworking.setupDSRequest(true) |
| 161 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 263 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 162 | - CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/order", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | 264 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+url, param: param as! [String : String], cacheType: .networkOnly) { task, result, error in |
| 163 | hiddenLoading() | 265 | hiddenLoading() |
| 164 | if (error == nil) { | 266 | if (error == nil) { |
| 165 | let resp = result as! NSDictionary | 267 | let resp = result as! NSDictionary |
| @@ -168,15 +270,7 @@ class CNLiveShopViewModel: NSObject { | @@ -168,15 +270,7 @@ class CNLiveShopViewModel: NSObject { | ||
| 168 | if resp["data"] is NSNull { | 270 | if resp["data"] is NSNull { |
| 169 | resultBlock(NSNull(),.failed) | 271 | resultBlock(NSNull(),.failed) |
| 170 | } else { | 272 | } else { |
| 171 | - let model = dictionaryToModel(resp as! [String : Any], ShopOrderDetailModel.self,"data") as! ShopOrderDetailModel | ||
| 172 | - var is_send_all: Bool = true | ||
| 173 | - for goodsModel in model.order_detail { | ||
| 174 | - if Int(goodsModel.send_num!)! > 0 { | ||
| 175 | - is_send_all = false | ||
| 176 | - } | ||
| 177 | - } | ||
| 178 | - model.is_send_all = is_send_all | ||
| 179 | - resultBlock(model,.success) | 273 | + resultBlock(isAgree ? "退款成功" : "拒绝退款成功",.success) |
| 180 | } | 274 | } |
| 181 | } else { | 275 | } else { |
| 182 | showMessage(message: resp["message"] as! String) | 276 | showMessage(message: resp["message"] as! String) |
| @@ -184,7 +278,7 @@ class CNLiveShopViewModel: NSObject { | @@ -184,7 +278,7 @@ class CNLiveShopViewModel: NSObject { | ||
| 184 | } | 278 | } |
| 185 | } else { | 279 | } else { |
| 186 | if CNLiveNetworking.isNetworking() { | 280 | if CNLiveNetworking.isNetworking() { |
| 187 | - showMessage(message: "获取失败") | 281 | + showMessage(message: "请求失败") |
| 188 | resultBlock(NSNull(),.failed) | 282 | resultBlock(NSNull(),.failed) |
| 189 | } else { | 283 | } else { |
| 190 | showMessage(message: "似乎与网络断开链接") | 284 | showMessage(message: "似乎与网络断开链接") |
| @@ -194,4 +288,5 @@ class CNLiveShopViewModel: NSObject { | @@ -194,4 +288,5 @@ class CNLiveShopViewModel: NSObject { | ||
| 194 | } | 288 | } |
| 195 | } | 289 | } |
| 196 | 290 | ||
| 291 | + | ||
| 197 | } | 292 | } |
metaCode/Supporting Files/Assets.xcassets/Shop/DS_order_success.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "DS_order_success@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "DS_order_success@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_order_success.imageset/DS_order_success@2x.png
0 → 100644
440 Bytes
metaCode/Supporting Files/Assets.xcassets/Shop/DS_order_success.imageset/DS_order_success@3x.png
0 → 100644
770 Bytes
metaCode/Supporting Files/Assets.xcassets/Shop/DS_order_wait.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "DS_order_wait@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "DS_order_wait@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_order_wait.imageset/DS_order_wait@2x.png
0 → 100644
387 Bytes
metaCode/Supporting Files/Assets.xcassets/Shop/DS_order_wait.imageset/DS_order_wait@3x.png
0 → 100644
669 Bytes