Commit 1fc3a88c4ed5cc11fce1250794b793c194efbc6e
Merge branch 'master' of http://bj.gitlab.cnlive.com/ios-team/CNLiveMateCode
Showing
45 changed files
with
3221 additions
and
132 deletions
Podfile
| @@ -47,7 +47,7 @@ target 'metaCode' do | @@ -47,7 +47,7 @@ target 'metaCode' do | ||
| 47 | # pod 'SDCycleScrollView', '~> 1.82' | 47 | # pod 'SDCycleScrollView', '~> 1.82' |
| 48 | 48 | ||
| 49 | #应用调试工具 | 49 | #应用调试工具 |
| 50 | -# pod 'FWDebug', :configurations => ['Debug'] | 50 | + pod 'FWDebug', :configurations => ['Debug'] |
| 51 | 51 | ||
| 52 | target 'metaCodeTests' do | 52 | target 'metaCodeTests' do |
| 53 | inherit! :search_paths | 53 | inherit! :search_paths |
metaCode.xcodeproj/project.pbxproj
| @@ -62,6 +62,10 @@ | @@ -62,6 +62,10 @@ | ||
| 62 | 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D01A22A2DDBA300C5978D /* CNLiveConfigManager.swift */; }; | 62 | 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D01A22A2DDBA300C5978D /* CNLiveConfigManager.swift */; }; |
| 63 | 790D01A52A2DF65E00C5978D /* CNLiveLoginPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D01A42A2DF65E00C5978D /* CNLiveLoginPickerView.swift */; }; | 63 | 790D01A52A2DF65E00C5978D /* CNLiveLoginPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 790D01A42A2DF65E00C5978D /* CNLiveLoginPickerView.swift */; }; |
| 64 | 790D01A72A2DF84C00C5978D /* countries.plist in Resources */ = {isa = PBXBuildFile; fileRef = 790D01A62A2DF84C00C5978D /* countries.plist */; }; | 64 | 790D01A72A2DF84C00C5978D /* countries.plist in Resources */ = {isa = PBXBuildFile; fileRef = 790D01A62A2DF84C00C5978D /* countries.plist */; }; |
| 65 | + 791C1C862AFB2EB4003E6362 /* CNLiveShopOrderExpressViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 791C1C852AFB2EB4003E6362 /* CNLiveShopOrderExpressViewController.swift */; }; | ||
| 66 | + 791C1C882AFB6FD7003E6362 /* CNLiveShopOrderExpressFirmViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 791C1C872AFB6FD7003E6362 /* CNLiveShopOrderExpressFirmViewController.swift */; }; | ||
| 67 | + 791C1C8A2AFB84EE003E6362 /* CNLiveShopOrderExpressListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 791C1C892AFB84EE003E6362 /* CNLiveShopOrderExpressListViewController.swift */; }; | ||
| 68 | + 791C1C8C2AFB85F8003E6362 /* CNLiveShopBodyExpressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 791C1C8B2AFB85F8003E6362 /* CNLiveShopBodyExpressView.swift */; }; | ||
| 65 | 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A3B2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift */; }; | 69 | 79282A3C2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A3B2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift */; }; |
| 66 | 79282A402A2F055100B5F8CF /* CNLiveConfigUserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A3F2A2F055100B5F8CF /* CNLiveConfigUserInfo.swift */; }; | 70 | 79282A402A2F055100B5F8CF /* CNLiveConfigUserInfo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A3F2A2F055100B5F8CF /* CNLiveConfigUserInfo.swift */; }; |
| 67 | 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A432A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift */; }; | 71 | 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79282A432A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift */; }; |
| @@ -71,6 +75,7 @@ | @@ -71,6 +75,7 @@ | ||
| 71 | 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */; }; | 75 | 79396EED2A319F220053E1AF /* NSObject+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */; }; |
| 72 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; }; | 76 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */; }; |
| 73 | 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */; }; | 77 | 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */; }; |
| 78 | + 794BC1652AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */; }; | ||
| 74 | 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; }; | 79 | 796398942A260C0100D045EB /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963988D2A260C0100D045EB /* AppDelegate.swift */; }; |
| 75 | 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */; }; | 80 | 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */; }; |
| 76 | 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */; }; | 81 | 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */; }; |
| @@ -96,6 +101,7 @@ | @@ -96,6 +101,7 @@ | ||
| 96 | 799172362AF08D4500DC01A8 /* CNLiveShopBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */; }; | 101 | 799172362AF08D4500DC01A8 /* CNLiveShopBaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */; }; |
| 97 | 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */; }; | 102 | 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */; }; |
| 98 | 7991723A2AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */; }; | 103 | 7991723A2AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */; }; |
| 104 | + 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */; }; | ||
| 99 | 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; | 105 | 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; |
| 100 | 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; | 106 | 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; |
| 101 | 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */; }; | 107 | 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */; }; |
| @@ -220,6 +226,10 @@ | @@ -220,6 +226,10 @@ | ||
| 220 | 790D01A22A2DDBA300C5978D /* CNLiveConfigManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveConfigManager.swift; sourceTree = "<group>"; }; | 226 | 790D01A22A2DDBA300C5978D /* CNLiveConfigManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveConfigManager.swift; sourceTree = "<group>"; }; |
| 221 | 790D01A42A2DF65E00C5978D /* CNLiveLoginPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginPickerView.swift; sourceTree = "<group>"; }; | 227 | 790D01A42A2DF65E00C5978D /* CNLiveLoginPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginPickerView.swift; sourceTree = "<group>"; }; |
| 222 | 790D01A62A2DF84C00C5978D /* countries.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = countries.plist; sourceTree = "<group>"; }; | 228 | 790D01A62A2DF84C00C5978D /* countries.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = countries.plist; sourceTree = "<group>"; }; |
| 229 | + 791C1C852AFB2EB4003E6362 /* CNLiveShopOrderExpressViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderExpressViewController.swift; sourceTree = "<group>"; }; | ||
| 230 | + 791C1C872AFB6FD7003E6362 /* CNLiveShopOrderExpressFirmViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderExpressFirmViewController.swift; sourceTree = "<group>"; }; | ||
| 231 | + 791C1C892AFB84EE003E6362 /* CNLiveShopOrderExpressListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderExpressListViewController.swift; sourceTree = "<group>"; }; | ||
| 232 | + 791C1C8B2AFB85F8003E6362 /* CNLiveShopBodyExpressView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyExpressView.swift; sourceTree = "<group>"; }; | ||
| 223 | 79282A3B2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSString+CNLiveExtensions.swift"; sourceTree = "<group>"; }; | 233 | 79282A3B2A2EDC2500B5F8CF /* NSString+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSString+CNLiveExtensions.swift"; sourceTree = "<group>"; }; |
| 224 | 79282A3F2A2F055100B5F8CF /* CNLiveConfigUserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveConfigUserInfo.swift; sourceTree = "<group>"; }; | 234 | 79282A3F2A2F055100B5F8CF /* CNLiveConfigUserInfo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveConfigUserInfo.swift; sourceTree = "<group>"; }; |
| 225 | 79282A432A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginAuthView.swift; sourceTree = "<group>"; }; | 235 | 79282A432A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveLoginAuthView.swift; sourceTree = "<group>"; }; |
| @@ -229,6 +239,7 @@ | @@ -229,6 +239,7 @@ | ||
| 229 | 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveExtensions.swift"; sourceTree = "<group>"; }; | 239 | 79396EEC2A319F220053E1AF /* NSObject+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveExtensions.swift"; sourceTree = "<group>"; }; |
| 230 | 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; }; | 240 | 79396EF02A31C21B0053E1AF /* CNLiveInfoShowViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveInfoShowViewController.swift; sourceTree = "<group>"; }; |
| 231 | 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineExchangeViewController.swift; sourceTree = "<group>"; }; | 241 | 793CAF512A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineExchangeViewController.swift; sourceTree = "<group>"; }; |
| 242 | + 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderSendViewController.swift; sourceTree = "<group>"; }; | ||
| 232 | 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; | 243 | 7963988D2A260C0100D045EB /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; |
| 233 | 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveBaseViewController.swift; sourceTree = "<group>"; }; | 244 | 7963989C2A260E6200D045EB /* CNLiveBaseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CNLiveBaseViewController.swift; sourceTree = "<group>"; }; |
| 234 | 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputViewController.swift; sourceTree = "<group>"; }; | 245 | 79656E372AAEBA8E00119A61 /* CNLiveMineInputViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputViewController.swift; sourceTree = "<group>"; }; |
| @@ -254,6 +265,7 @@ | @@ -254,6 +265,7 @@ | ||
| 254 | 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBaseModel.swift; sourceTree = "<group>"; }; | 265 | 799172352AF08D4500DC01A8 /* CNLiveShopBaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBaseModel.swift; sourceTree = "<group>"; }; |
| 255 | 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyListView.swift; sourceTree = "<group>"; }; | 266 | 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyListView.swift; sourceTree = "<group>"; }; |
| 256 | 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderListViewController.swift; sourceTree = "<group>"; }; | 267 | 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderListViewController.swift; sourceTree = "<group>"; }; |
| 268 | + 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyCustomView.swift; sourceTree = "<group>"; }; | ||
| 257 | 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; | 269 | 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; |
| 258 | 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; }; | 270 | 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; }; |
| 259 | 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; }; | 271 | 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; }; |
| @@ -687,6 +699,10 @@ | @@ -687,6 +699,10 @@ | ||
| 687 | 799172312AF08D1B00DC01A8 /* CNLiveShopOrderViewController.swift */, | 699 | 799172312AF08D1B00DC01A8 /* CNLiveShopOrderViewController.swift */, |
| 688 | 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */, | 700 | 799172392AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift */, |
| 689 | 79BB96A52AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift */, | 701 | 79BB96A52AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift */, |
| 702 | + 794BC1642AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift */, | ||
| 703 | + 791C1C852AFB2EB4003E6362 /* CNLiveShopOrderExpressViewController.swift */, | ||
| 704 | + 791C1C872AFB6FD7003E6362 /* CNLiveShopOrderExpressFirmViewController.swift */, | ||
| 705 | + 791C1C892AFB84EE003E6362 /* CNLiveShopOrderExpressListViewController.swift */, | ||
| 690 | ); | 706 | ); |
| 691 | path = Controller; | 707 | path = Controller; |
| 692 | sourceTree = "<group>"; | 708 | sourceTree = "<group>"; |
| @@ -704,6 +720,8 @@ | @@ -704,6 +720,8 @@ | ||
| 704 | children = ( | 720 | children = ( |
| 705 | 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */, | 721 | 799172372AF090CD00DC01A8 /* CNLiveShopBodyListView.swift */, |
| 706 | 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */, | 722 | 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */, |
| 723 | + 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */, | ||
| 724 | + 791C1C8B2AFB85F8003E6362 /* CNLiveShopBodyExpressView.swift */, | ||
| 707 | ); | 725 | ); |
| 708 | path = View; | 726 | path = View; |
| 709 | sourceTree = "<group>"; | 727 | sourceTree = "<group>"; |
| @@ -1172,6 +1190,7 @@ | @@ -1172,6 +1190,7 @@ | ||
| 1172 | 19BB1FE32AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift in Sources */, | 1190 | 19BB1FE32AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift in Sources */, |
| 1173 | 1965FA422AFB79EA00F0F435 /* CNLiveGoodsCategoryController.swift in Sources */, | 1191 | 1965FA422AFB79EA00F0F435 /* CNLiveGoodsCategoryController.swift in Sources */, |
| 1174 | 792E57D92A3AA2F2005834DB /* CNLiveCommonBaseModel.swift in Sources */, | 1192 | 792E57D92A3AA2F2005834DB /* CNLiveCommonBaseModel.swift in Sources */, |
| 1193 | + 791C1C862AFB2EB4003E6362 /* CNLiveShopOrderExpressViewController.swift in Sources */, | ||
| 1175 | 7CD6753E2A2740B0008354C1 /* CNUpSlideView.swift in Sources */, | 1194 | 7CD6753E2A2740B0008354C1 /* CNUpSlideView.swift in Sources */, |
| 1176 | 7CD675402A2740B0008354C1 /* CNDownSlideView.swift in Sources */, | 1195 | 7CD675402A2740B0008354C1 /* CNDownSlideView.swift in Sources */, |
| 1177 | 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */, | 1196 | 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */, |
| @@ -1209,7 +1228,9 @@ | @@ -1209,7 +1228,9 @@ | ||
| 1209 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, | 1228 | 7905BB492AB0588B0089BC50 /* CNLiveMineAuthResultViewController.swift in Sources */, |
| 1210 | 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */, | 1229 | 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */, |
| 1211 | 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */, | 1230 | 798A44EC2A302DBE00815935 /* CNLiveMineAddInfoViewController.swift in Sources */, |
| 1231 | + 791C1C882AFB6FD7003E6362 /* CNLiveShopOrderExpressFirmViewController.swift in Sources */, | ||
| 1212 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, | 1232 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, |
| 1233 | + 794BC1652AF9E70D00A68C74 /* CNLiveShopOrderSendViewController.swift in Sources */, | ||
| 1213 | 79BB96AA2AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift in Sources */, | 1234 | 79BB96AA2AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift in Sources */, |
| 1214 | 790D01912A2DAC5E00C5978D /* CNLiveConfigFontMacro.swift in Sources */, | 1235 | 790D01912A2DAC5E00C5978D /* CNLiveConfigFontMacro.swift in Sources */, |
| 1215 | 790D01852A2D89E100C5978D /* UIColor+CNLiveExtensions.swift in Sources */, | 1236 | 790D01852A2D89E100C5978D /* UIColor+CNLiveExtensions.swift in Sources */, |
| @@ -1220,6 +1241,7 @@ | @@ -1220,6 +1241,7 @@ | ||
| 1220 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, | 1241 | 7CD675422A2740F8008354C1 /* CNCustomIndexView.swift in Sources */, |
| 1221 | 7C4931292A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift in Sources */, | 1242 | 7C4931292A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift in Sources */, |
| 1222 | 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */, | 1243 | 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */, |
| 1244 | + 791C1C8A2AFB84EE003E6362 /* CNLiveShopOrderExpressListViewController.swift in Sources */, | ||
| 1223 | 7CD6753F2A2740B0008354C1 /* CNDownSlideViewRemindView.swift in Sources */, | 1245 | 7CD6753F2A2740B0008354C1 /* CNDownSlideViewRemindView.swift in Sources */, |
| 1224 | 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */, | 1246 | 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */, |
| 1225 | 1965FA3E2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift in Sources */, | 1247 | 1965FA3E2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift in Sources */, |
| @@ -1227,6 +1249,8 @@ | @@ -1227,6 +1249,8 @@ | ||
| 1227 | 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */, | 1249 | 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */, |
| 1228 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, | 1250 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, |
| 1229 | 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNLiveExtensions.swift in Sources */, | 1251 | 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNLiveExtensions.swift in Sources */, |
| 1252 | + 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */, | ||
| 1253 | + 791C1C8C2AFB85F8003E6362 /* CNLiveShopBodyExpressView.swift in Sources */, | ||
| 1230 | 790D019A2A2DCAE400C5978D /* CNLiveViewController.swift in Sources */, | 1254 | 790D019A2A2DCAE400C5978D /* CNLiveViewController.swift in Sources */, |
| 1231 | 79803E272AD68D3100F05F68 /* CNLiveMineShopViewController.swift in Sources */, | 1255 | 79803E272AD68D3100F05F68 /* CNLiveMineShopViewController.swift in Sources */, |
| 1232 | 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */, | 1256 | 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/Config/CNLiveConfigManager.swift
| @@ -67,4 +67,10 @@ extension Notification.Name { | @@ -67,4 +67,10 @@ extension Notification.Name { | ||
| 67 | //WIFI状态通知 | 67 | //WIFI状态通知 |
| 68 | public static let CNLiveNetworkStatusNotificationReachableViaWiFi = Notification.Name("CNLiveNetworkStatusNotificationReachableViaWiFi") | 68 | public static let CNLiveNetworkStatusNotificationReachableViaWiFi = Notification.Name("CNLiveNetworkStatusNotificationReachableViaWiFi") |
| 69 | } | 69 | } |
| 70 | + struct ShopOrderStatue { | ||
| 71 | + //修改发货成功通知 | ||
| 72 | + public static let CNLiveShopOrderEditExpressNotification = Notification.Name("CNLiveShopOrderEditExpressNotification") | ||
| 73 | + //发货成功通知 | ||
| 74 | + public static let CNLiveShopOrderSendExpressNotification = Notification.Name("CNLiveShopOrderSendExpressNotification") | ||
| 75 | + } | ||
| 70 | } | 76 | } |
metaCode/Classes/Config/CNLiveConfigUserInfo.swift
| @@ -242,8 +242,11 @@ class StandSortManager: NSObject { | @@ -242,8 +242,11 @@ class StandSortManager: NSObject { | ||
| 242 | let no_auths = NSMutableArray() | 242 | let no_auths = NSMutableArray() |
| 243 | for item in stands { | 243 | for item in stands { |
| 244 | let listModel = item as! StandListModel | 244 | let listModel = item as! StandListModel |
| 245 | - //这里需要及时去刷新认证状态 如果没有及时刷新这里回出现已经认证的状态不会进行排序 | ||
| 246 | - listModel.auth && have_id_auths.contains(listModel.id) ? have_auths.add(listModel) : no_auths.add(listModel) | 245 | +// print("listModel.auth==>\(listModel.auth)") |
| 246 | +// print("listModel.id==>\(listModel.id)") | ||
| 247 | +// print("have_id_auths==>\(have_id_auths)") | ||
| 248 | + //这里需要及时去刷新认证状态 如果没有及时刷新这里回出现已经认证的状态不会进行排序 listModel.auth && | ||
| 249 | + have_id_auths.contains(listModel.id) ? have_auths.add(listModel) : no_auths.add(listModel) | ||
| 247 | } | 250 | } |
| 248 | let tempArray = NSMutableArray() | 251 | let tempArray = NSMutableArray() |
| 249 | for item in have_auths { | 252 | for item in have_auths { |
metaCode/Classes/Extensions/NSString+CNLiveExtensions.swift
| @@ -56,4 +56,38 @@ extension NSString { | @@ -56,4 +56,38 @@ 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 | + } | ||
| 83 | + | ||
| 84 | + /// 查看允不允许输入 例如 允许输入1、2时传入12 | ||
| 85 | + /// - Parameter string: 输入字符串 | ||
| 86 | + /// - Returns: 返回 | ||
| 87 | + func allowWriteString(string: String) -> Bool { | ||
| 88 | + let cs = NSCharacterSet.init(charactersIn: string) | ||
| 89 | + let filtered_array = components(separatedBy: cs as CharacterSet) as NSArray | ||
| 90 | + let filtered = filtered_array.componentsJoined(by: "") | ||
| 91 | + return self as String == filtered | ||
| 92 | + } | ||
| 59 | } | 93 | } |
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
| @@ -151,8 +151,7 @@ extension CNLiveMineViewController { | @@ -151,8 +151,7 @@ extension CNLiveMineViewController { | ||
| 151 | 151 | ||
| 152 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | 152 | func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { |
| 153 | if indexPath.section == 0 { | 153 | if indexPath.section == 0 { |
| 154 | -// self.navigationController?.pushViewController(CNLiveMineQuestViewController.init(checkModel: checkModel), animated: true) | ||
| 155 | - self.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) | 154 | + self.navigationController?.pushViewController(CNLiveMineQuestViewController.init(checkModel: checkModel), animated: true) |
| 156 | } | 155 | } |
| 157 | if indexPath.section == 1 { | 156 | if indexPath.section == 1 { |
| 158 | self.navigationController?.pushViewController(CNLiveMineAddInfoViewController.init(show_type: .info), animated: true) | 157 | self.navigationController?.pushViewController(CNLiveMineAddInfoViewController.init(show_type: .info), animated: true) |
metaCode/Classes/Main/MinePage/View/CNLiveMineInfoAlertView.swift
| @@ -546,6 +546,7 @@ enum CNLiveStandListAlertShowType { | @@ -546,6 +546,7 @@ enum CNLiveStandListAlertShowType { | ||
| 546 | case custom | 546 | case custom |
| 547 | case text | 547 | case text |
| 548 | case date | 548 | case date |
| 549 | + case string | ||
| 549 | } | 550 | } |
| 550 | class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSource { | 551 | class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSource { |
| 551 | 552 | ||
| @@ -648,6 +649,8 @@ class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSour | @@ -648,6 +649,8 @@ class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSour | ||
| 648 | text = (infos.firstObject as! MineStandInfoModel).name | 649 | text = (infos.firstObject as! MineStandInfoModel).name |
| 649 | } else if _show_type == .text { | 650 | } else if _show_type == .text { |
| 650 | text = infos.firstObject as? Dictionary<String, String> | 651 | text = infos.firstObject as? Dictionary<String, String> |
| 652 | + } else if _show_type == .string { | ||
| 653 | + text = infos.firstObject as? String | ||
| 651 | }else{ | 654 | }else{ |
| 652 | let formatter = DateFormatter() | 655 | let formatter = DateFormatter() |
| 653 | formatter.dateFormat = "yyyy-MM-dd" | 656 | formatter.dateFormat = "yyyy-MM-dd" |
| @@ -748,6 +751,9 @@ class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSour | @@ -748,6 +751,9 @@ class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSour | ||
| 748 | let dict = _infos![row] as? Dictionary<String, String> | 751 | let dict = _infos![row] as? Dictionary<String, String> |
| 749 | return dict?["title"] ?? "" | 752 | return dict?["title"] ?? "" |
| 750 | } | 753 | } |
| 754 | + if _show_type == .string { | ||
| 755 | + return _infos![row] as? String | ||
| 756 | + } | ||
| 751 | return "" | 757 | return "" |
| 752 | } | 758 | } |
| 753 | 759 |
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
| @@ -267,40 +267,40 @@ class CNLiveMineViewModel: NSObject { | @@ -267,40 +267,40 @@ class CNLiveMineViewModel: NSObject { | ||
| 267 | if (errorCode == "0") { | 267 | if (errorCode == "0") { |
| 268 | let listModel = dictionaryToModel(resp as! [String : Any], StandListBaseModel.self,"data") as! StandListBaseModel | 268 | let listModel = dictionaryToModel(resp as! [String : Any], StandListBaseModel.self,"data") as! StandListBaseModel |
| 269 | if page == 1 && listModel.list.count > 0 { | 269 | if page == 1 && listModel.list.count > 0 { |
| 270 | -// CNLiveSaveStandDB.shared.insertObjects(objects: listModel.list) | 270 | + CNLiveSaveStandDB.shared.insertObjects(objects: listModel.list) |
| 271 | } | 271 | } |
| 272 | listModel.list = StandSortManager.sortAllListData(stands: listModel.list as NSArray) as! [StandListModel] | 272 | listModel.list = StandSortManager.sortAllListData(stands: listModel.list as NSArray) as! [StandListModel] |
| 273 | resultBlock(listModel,.success) | 273 | resultBlock(listModel,.success) |
| 274 | } else { | 274 | } else { |
| 275 | -// let tempArray = CNLiveSaveStandDB.shared.searchAllObject() | ||
| 276 | -// if tempArray.count > 0 { | ||
| 277 | -// let listModel = StandListBaseModel.init() | ||
| 278 | -// listModel.pageNum = page | ||
| 279 | -// listModel.total = page | ||
| 280 | -// listModel.list = StandSortManager.sortAllListData(stands: tempArray as NSArray) as! [StandListModel] | ||
| 281 | -// resultBlock(listModel,.success) | ||
| 282 | -// }else{ | ||
| 283 | -// showMessage(message: resp["errorMessage"] as! String) | ||
| 284 | -// resultBlock(NSNull(),.failed) | ||
| 285 | -// } | 275 | + let tempArray = CNLiveSaveStandDB.shared.searchAllObject() |
| 276 | + if tempArray.count > 0 { | ||
| 277 | + let listModel = StandListBaseModel.init() | ||
| 278 | + listModel.pageNum = page | ||
| 279 | + listModel.total = page | ||
| 280 | + listModel.list = StandSortManager.sortAllListData(stands: tempArray as NSArray) as! [StandListModel] | ||
| 281 | + resultBlock(listModel,.success) | ||
| 282 | + }else{ | ||
| 283 | + showMessage(message: resp["errorMessage"] as! String) | ||
| 284 | + resultBlock(NSNull(),.failed) | ||
| 285 | + } | ||
| 286 | } | 286 | } |
| 287 | } else { | 287 | } else { |
| 288 | -// let tempArray = CNLiveSaveStandDB.shared.searchAllObject() | ||
| 289 | -// if tempArray.count > 0 { | ||
| 290 | -// let listModel = StandListBaseModel.init() | ||
| 291 | -// listModel.pageNum = page | ||
| 292 | -// listModel.total = page | ||
| 293 | -// listModel.list = StandSortManager.sortAllListData(stands: tempArray as NSArray) as! [StandListModel] | ||
| 294 | -// resultBlock(listModel,.success) | ||
| 295 | -// }else{ | ||
| 296 | -// if CNLiveNetworking.isNetworking() { | ||
| 297 | -// showMessage(message: "获取失败") | ||
| 298 | -// resultBlock(NSNull(),.failed) | ||
| 299 | -// } else { | ||
| 300 | -// showMessage(message: "似乎与网络断开链接") | ||
| 301 | -// resultBlock(NSNull(),.noNetwork) | ||
| 302 | -// } | ||
| 303 | -// } | 288 | + let tempArray = CNLiveSaveStandDB.shared.searchAllObject() |
| 289 | + if tempArray.count > 0 { | ||
| 290 | + let listModel = StandListBaseModel.init() | ||
| 291 | + listModel.pageNum = page | ||
| 292 | + listModel.total = page | ||
| 293 | + listModel.list = StandSortManager.sortAllListData(stands: tempArray as NSArray) as! [StandListModel] | ||
| 294 | + resultBlock(listModel,.success) | ||
| 295 | + }else{ | ||
| 296 | + if CNLiveNetworking.isNetworking() { | ||
| 297 | + showMessage(message: "获取失败") | ||
| 298 | + resultBlock(NSNull(),.failed) | ||
| 299 | + } else { | ||
| 300 | + showMessage(message: "似乎与网络断开链接") | ||
| 301 | + resultBlock(NSNull(),.noNetwork) | ||
| 302 | + } | ||
| 303 | + } | ||
| 304 | } | 304 | } |
| 305 | } | 305 | } |
| 306 | } | 306 | } |
| @@ -325,40 +325,40 @@ class CNLiveMineViewModel: NSObject { | @@ -325,40 +325,40 @@ class CNLiveMineViewModel: NSObject { | ||
| 325 | if (errorCode == "0" && !(resp["data"] is NSNull)) { | 325 | if (errorCode == "0" && !(resp["data"] is NSNull)) { |
| 326 | let listModel = dictionaryToModel(resp as! [String : Any], MineAuthListBaseModel.self,"data") as! MineAuthListBaseModel | 326 | let listModel = dictionaryToModel(resp as! [String : Any], MineAuthListBaseModel.self,"data") as! MineAuthListBaseModel |
| 327 | if page == 1 && listModel.list.count > 0 { | 327 | if page == 1 && listModel.list.count > 0 { |
| 328 | -// CNLiveSaveAuthDB.shared.insertObjects(objects: listModel.list) | 328 | + CNLiveSaveAuthDB.shared.insertObjects(objects: listModel.list) |
| 329 | } | 329 | } |
| 330 | listModel.list = StandSortManager.sortMyListData(auths: listModel.list as NSArray) as! [MineAuthListModel] | 330 | listModel.list = StandSortManager.sortMyListData(auths: listModel.list as NSArray) as! [MineAuthListModel] |
| 331 | resultBlock(listModel,.success) | 331 | resultBlock(listModel,.success) |
| 332 | } else { | 332 | } else { |
| 333 | -// let tempArray = CNLiveSaveAuthDB.shared.searchAllObject() | ||
| 334 | -// if tempArray.count > 0 { | ||
| 335 | -// let listModel = MineAuthListBaseModel.init() | ||
| 336 | -// listModel.pageNum = page | ||
| 337 | -// listModel.total = page | ||
| 338 | -// listModel.list = StandSortManager.sortMyListData(auths: tempArray as NSArray) as! [MineAuthListModel] | ||
| 339 | -// resultBlock(listModel,.success) | ||
| 340 | -// }else{ | ||
| 341 | -// showMessage(message: resp["errorMessage"] as! String) | ||
| 342 | -// resultBlock(NSNull(),.failed) | ||
| 343 | -// } | 333 | + let tempArray = CNLiveSaveAuthDB.shared.searchAllObject() |
| 334 | + if tempArray.count > 0 { | ||
| 335 | + let listModel = MineAuthListBaseModel.init() | ||
| 336 | + listModel.pageNum = page | ||
| 337 | + listModel.total = page | ||
| 338 | + listModel.list = StandSortManager.sortMyListData(auths: tempArray as NSArray) as! [MineAuthListModel] | ||
| 339 | + resultBlock(listModel,.success) | ||
| 340 | + }else{ | ||
| 341 | + showMessage(message: resp["errorMessage"] as! String) | ||
| 342 | + resultBlock(NSNull(),.failed) | ||
| 343 | + } | ||
| 344 | } | 344 | } |
| 345 | } else { | 345 | } else { |
| 346 | -// let tempArray = CNLiveSaveAuthDB.shared.searchAllObject() | ||
| 347 | -// if tempArray.count > 0 { | ||
| 348 | -// let listModel = MineAuthListBaseModel.init() | ||
| 349 | -// listModel.pageNum = page | ||
| 350 | -// listModel.total = page | ||
| 351 | -// listModel.list = StandSortManager.sortMyListData(auths: tempArray as NSArray) as! [MineAuthListModel] | ||
| 352 | -// resultBlock(listModel,.success) | ||
| 353 | -// }else{ | ||
| 354 | -// if CNLiveNetworking.isNetworking() { | ||
| 355 | -// showMessage(message: "获取失败") | ||
| 356 | -// resultBlock(NSNull(),.failed) | ||
| 357 | -// } else { | ||
| 358 | -// showMessage(message: "似乎与网络断开链接") | ||
| 359 | -// resultBlock(NSNull(),.noNetwork) | ||
| 360 | -// } | ||
| 361 | -// } | 346 | + let tempArray = CNLiveSaveAuthDB.shared.searchAllObject() |
| 347 | + if tempArray.count > 0 { | ||
| 348 | + let listModel = MineAuthListBaseModel.init() | ||
| 349 | + listModel.pageNum = page | ||
| 350 | + listModel.total = page | ||
| 351 | + listModel.list = StandSortManager.sortMyListData(auths: tempArray as NSArray) as! [MineAuthListModel] | ||
| 352 | + resultBlock(listModel,.success) | ||
| 353 | + }else{ | ||
| 354 | + if CNLiveNetworking.isNetworking() { | ||
| 355 | + showMessage(message: "获取失败") | ||
| 356 | + resultBlock(NSNull(),.failed) | ||
| 357 | + } else { | ||
| 358 | + showMessage(message: "似乎与网络断开链接") | ||
| 359 | + resultBlock(NSNull(),.noNetwork) | ||
| 360 | + } | ||
| 361 | + } | ||
| 362 | } | 362 | } |
| 363 | } | 363 | } |
| 364 | } | 364 | } |
| @@ -603,8 +603,9 @@ class CNLiveMineViewModel: NSObject { | @@ -603,8 +603,9 @@ class CNLiveMineViewModel: NSObject { | ||
| 603 | custom_param.setValue(APPKey_wjj, forKey: "appKey") | 603 | custom_param.setValue(APPKey_wjj, forKey: "appKey") |
| 604 | CNLiveNetworking.setAllowRequestDefaultArgument(true) | 604 | CNLiveNetworking.setAllowRequestDefaultArgument(true) |
| 605 | CNLiveNetworking.setupShowDataResult(false) | 605 | CNLiveNetworking.setupShowDataResult(false) |
| 606 | + CNLiveNetworking.setupDSRequest(true) | ||
| 606 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 607 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) |
| 607 | - CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/Api/Index3/myOrderCount", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | 608 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjShopUrl+"/Api/Index3/myOrderCount", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in |
| 608 | hiddenLoading() | 609 | hiddenLoading() |
| 609 | if (error == nil) { | 610 | if (error == nil) { |
| 610 | let resp = result as! NSDictionary | 611 | let resp = result as! NSDictionary |
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,225 @@ class CNLiveShopOrderDetailViewController: CNLiveBaseViewController, EmptyDataSe | @@ -103,31 +143,225 @@ 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.id! as NSString, show_type: .splite), animated: true) | ||
| 158 | + case "查看进度": | ||
| 159 | + print("查看进度") | ||
| 160 | + case "物流详情": | ||
| 161 | + print("物流详情") | ||
| 162 | + pushExpressVC(detailModel: detailModel) | ||
| 163 | + case "退款详情": | ||
| 164 | + print("退款详情") | ||
| 165 | + let vc = CNLiveShopOrderDetailViewController(orderId: detailModel.id!, show_type: .sale, form_type: .order) | ||
| 166 | + self.navigationController?.pushViewController(vc, animated: true) | ||
| 167 | + case "订单详情": | ||
| 168 | + self.navigationController?.pushViewController(CNLiveShopOrderDetailViewController(orderId: refuundModel.id!, show_type: .order, form_type: .afterSale), animated: true) | ||
| 169 | + case "确认退款": | ||
| 170 | + ConfigAlertManager.shared.presentAlert(title: "提示", message: "确认给用户退款?", actionTitles: ["取消","确认"]) { [weak self] index in | ||
| 171 | + if index == 1 { | ||
| 172 | + self!.agreeRefund() | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | + case "拒绝退款": | ||
| 176 | + presentRefundAlert() | ||
| 177 | + case "同意等待买家寄回": | ||
| 178 | + let attAttr = NSMutableAttributedString(string: "同意等待买家寄回?\n已收到货,需要退还收到的货物") | ||
| 179 | + attAttr.addAttribute(.font, value: UIFont.systemFont(ofSize: 14), range: NSMakeRange(0, 9)) | ||
| 180 | + attAttr.addAttribute(.foregroundColor, value: UIColor(red: 50/255, green: 45/255, blue: 44/255, alpha: 1), range: NSMakeRange(0, 9)) | ||
| 181 | + attAttr.addAttribute(.font, value: UIFont.systemFont(ofSize: 12), range: NSMakeRange(9, attAttr.length - 9)) | ||
| 182 | + attAttr.addAttribute(.foregroundColor, value: UIColor(red: 155/255, green: 155/255, blue: 155/255, alpha: 1), range: NSMakeRange(9, attAttr.length - 9)) | ||
| 183 | + let preAttr = NSMutableAttributedString.init(string: "提示") | ||
| 184 | + ConfigAlertManager.shared.presentAlert(attrTitle: preAttr, attriMessage: attAttr, actionTitles: ["取消","确定"]) { [weak self] index in | ||
| 185 | + if index == 1 { | ||
| 186 | + self!.agreeRefund() | ||
| 187 | + } | ||
| 188 | + } | ||
| 189 | + default: | ||
| 190 | + break | ||
| 191 | + } | ||
| 192 | + } | ||
| 193 | + | ||
| 194 | + /// 跳转物流相关界面 | ||
| 195 | + /// - Parameter detailModel: 数据源 | ||
| 196 | + private func pushExpressVC(detailModel: ShopOrderDetailModel) { | ||
| 197 | + if detailModel.send_num > 1 || detailModel.is_send == "0" { | ||
| 198 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: detailModel.orderid! as NSString), animated: true) | ||
| 199 | + } else { | ||
| 200 | + | ||
| 201 | + } | ||
| 202 | + } | ||
| 203 | + | ||
| 204 | + /// 通知用户自提 | ||
| 205 | + /// - Parameter listModel: 数据源 | ||
| 206 | + private func notifyOrder(detailModel: ShopOrderDetailModel) { | ||
| 207 | + ConfigAlertManager.shared.presentAlert(title: "提示", message: "确认通知用户自提?", actionTitles: ["取消","确认"]) { index in | ||
| 208 | + if index == 1 { | ||
| 209 | + CNLiveShopViewModel.requestNotifyOrder(orderId: detailModel.id!) { result, respStatue in | ||
| 210 | + if respStatue == .success { | ||
| 211 | + showMessage(message: "通知成功") | ||
| 212 | + } | ||
| 213 | + } | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + /// 拒绝退款 | ||
| 219 | + private func presentRefundAlert() { | ||
| 220 | + let refundView = ShopBodyOrderRefundView.init(frame: self.view.bounds) | ||
| 221 | + refundView.clickBlock = { [weak self] refundView, desc in | ||
| 222 | + showMessage(message: "") | ||
| 223 | + CNLiveShopViewModel.requestRefund(refundId: self!.refundModel.id! as NSString, desc: desc as NSString, isAgree: false) { result, respStatue in | ||
| 224 | + if respStatue == .success { | ||
| 225 | + showMessage(message: result as! String) | ||
| 226 | + refundView.removeFromSuperview() | ||
| 227 | + self!.loadDataSourceAction() | ||
| 228 | + } | ||
| 229 | + } | ||
| 230 | + } | ||
| 231 | + view.addSubview(refundView) | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + /// 同意退款 | ||
| 235 | + private func agreeRefund() { | ||
| 236 | + showMessage(message: "") | ||
| 237 | + CNLiveShopViewModel.requestRefund(refundId: self.refundModel.id! as NSString, desc: "", isAgree: true) { result, respStatue in | ||
| 238 | + if respStatue == .success { | ||
| 239 | + showMessage(message: result as! String) | ||
| 240 | + self.loadDataSourceAction() | ||
| 241 | + } | ||
| 242 | + } | ||
| 243 | + } | ||
| 244 | +} | ||
| 106 | 245 | ||
| 107 | extension CNLiveShopOrderDetailViewController { | 246 | extension CNLiveShopOrderDetailViewController { |
| 108 | func numberOfSections(in tableView: UITableView) -> Int { | 247 | func numberOfSections(in tableView: UITableView) -> Int { |
| 109 | - return 2 | 248 | + if _show_type == .order { |
| 249 | + return 4 | ||
| 250 | + } else { | ||
| 251 | + return footerArray.count + 1 | ||
| 252 | + } | ||
| 253 | + | ||
| 110 | } | 254 | } |
| 111 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | 255 | func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { |
| 256 | + if _show_type == .order { | ||
| 257 | + if section == 0 { | ||
| 258 | + return self.headerArray.count | ||
| 259 | + } | ||
| 260 | + if section == 1 { | ||
| 261 | + return self.dataArray.count | ||
| 262 | + } | ||
| 263 | + if section == 2 { | ||
| 264 | + if self.footerArray.count > 0 { | ||
| 265 | + let tempArray = self.footerArray.firstObject as? NSArray | ||
| 266 | + return tempArray!.count | ||
| 267 | + } | ||
| 268 | + return 0 | ||
| 269 | + } | ||
| 270 | + if section == 3 { | ||
| 271 | + if self.footerArray.count > 0 { | ||
| 272 | + let tempArray = self.footerArray.lastObject as? NSArray | ||
| 273 | + return tempArray!.count | ||
| 274 | + } | ||
| 275 | + return 0 | ||
| 276 | + } | ||
| 277 | + return 0 | ||
| 278 | + } | ||
| 112 | if section == 0 { | 279 | if section == 0 { |
| 113 | - return headerArray.count | 280 | + return self.dataArray.count |
| 114 | } | 281 | } |
| 115 | - return self.dataArray.count | 282 | + if self.footerArray.count > 0 { |
| 283 | + let tempArray = self.footerArray[section-1] as? NSArray | ||
| 284 | + return tempArray!.count | ||
| 285 | + } | ||
| 286 | + return 0 | ||
| 116 | } | 287 | } |
| 117 | func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | 288 | 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 | 289 | + if _show_type == .order { |
| 290 | + if indexPath.section == 0 { | ||
| 291 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailOneViewCellIdentifier) as? ShopBodyOrderDetailOneTableViewCell else { | ||
| 292 | + return ShopBodyOrderDetailOneTableViewCell() | ||
| 293 | + } | ||
| 294 | + var isHiddenLine: Bool = false | ||
| 295 | + if indexPath.row == headerArray.count - 1 { | ||
| 296 | + isHiddenLine = true | ||
| 297 | + } | ||
| 298 | + let dict = headerArray[indexPath.row] as! NSDictionary | ||
| 299 | + cell.setupWithDataSource(dict: dict, isHiddenLine: isHiddenLine) | ||
| 300 | + return cell | ||
| 301 | + } | ||
| 302 | + if indexPath.section == 1 { | ||
| 303 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailTwoViewCellIdentifier) as? ShopBodyOrderDetailTwoTableViewCell else { | ||
| 304 | + return ShopBodyOrderDetailTwoTableViewCell() | ||
| 305 | + } | ||
| 306 | + var isHiddenLine: Bool = false | ||
| 307 | + if indexPath.row == dataArray.count - 1 { | ||
| 308 | + isHiddenLine = true | ||
| 309 | + } | ||
| 310 | + let goodsModel = dataArray[indexPath.row] as! ShopOrderListGoodsModel | ||
| 311 | + cell.setupDataSource(goodsModel: goodsModel, isHiddenLine: isHiddenLine, isRefund: false, isState: (self.detailModel.state == "3"), refundModel: ShopOrderRefundModel.init()) | ||
| 312 | + return cell | ||
| 313 | + } | ||
| 314 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailThreeViewCellIdentifier) as? ShopBodyOrderDetailThreeTableViewCell else { | ||
| 315 | + return ShopBodyOrderDetailThreeTableViewCell() | ||
| 316 | + } | ||
| 317 | + let tempArray = footerArray[indexPath.section - 2] as! NSArray | ||
| 318 | + let dict = tempArray[indexPath.row] as! NSDictionary | ||
| 319 | + cell.setupWithDataSource(dict: dict) | ||
| 320 | + return cell | ||
| 321 | + } else { | ||
| 322 | + if indexPath.section == 0 { | ||
| 323 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailTwoViewCellIdentifier) as? ShopBodyOrderDetailTwoTableViewCell else { | ||
| 324 | + return ShopBodyOrderDetailTwoTableViewCell() | ||
| 325 | + } | ||
| 326 | + var isHiddenLine: Bool = false | ||
| 327 | + if indexPath.row == dataArray.count - 1 { | ||
| 328 | + isHiddenLine = true | ||
| 329 | + } | ||
| 330 | + let goodsModel = dataArray[indexPath.row] as! ShopOrderListGoodsModel | ||
| 331 | + cell.setupDataSource(goodsModel: goodsModel, isHiddenLine: isHiddenLine, isRefund: false, isState: (self.refundModel.state == "3"), refundModel: self.refundModel) | ||
| 332 | + return cell | ||
| 333 | + } | ||
| 334 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderDetailFourViewCellIdentifier) as? ShopBodyOrderDetailFourTableViewCell else { | ||
| 335 | + return ShopBodyOrderDetailFourTableViewCell() | ||
| 336 | + } | ||
| 337 | + let tempArray = footerArray[indexPath.section - 1] as! NSArray | ||
| 338 | + let dict = tempArray[indexPath.row] as! NSDictionary | ||
| 339 | + cell.setupWithDataSource(dict: dict) | ||
| 340 | + return cell | ||
| 124 | } | 341 | } |
| 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 | } | 342 | } |
| 129 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | 343 | func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { |
| 130 | - return 110 | 344 | + if _show_type == .order { |
| 345 | + if indexPath.section == 0 { | ||
| 346 | + return 70 | ||
| 347 | + } | ||
| 348 | + if indexPath.section == 1 { | ||
| 349 | + return 110 | ||
| 350 | + } | ||
| 351 | + if indexPath.section == 2 { | ||
| 352 | + return 60 | ||
| 353 | + } | ||
| 354 | + if indexPath.section == 3 { | ||
| 355 | + return 40 | ||
| 356 | + } | ||
| 357 | + } else { | ||
| 358 | + if indexPath.section == 0 { | ||
| 359 | + return 110 | ||
| 360 | + } | ||
| 361 | + return 40 | ||
| 362 | + } | ||
| 363 | + | ||
| 364 | + return 0 | ||
| 131 | } | 365 | } |
| 132 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | 366 | func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { |
| 133 | return 0.01 | 367 | return 0.01 |
| @@ -194,7 +428,7 @@ extension CNLiveShopOrderDetailViewController { | @@ -194,7 +428,7 @@ extension CNLiveShopOrderDetailViewController { | ||
| 194 | } | 428 | } |
| 195 | 429 | ||
| 196 | extension CNLiveShopOrderDetailViewController { | 430 | extension CNLiveShopOrderDetailViewController { |
| 197 | - /// 对头视图数据进行整理 | 431 | + /// 订单详情界面对头视图数据进行整理 |
| 198 | private func tidyHeaderDataSource() { | 432 | private func tidyHeaderDataSource() { |
| 199 | var back_image = "" | 433 | var back_image = "" |
| 200 | var icon_image = "" | 434 | var icon_image = "" |
| @@ -275,7 +509,7 @@ extension CNLiveShopOrderDetailViewController { | @@ -275,7 +509,7 @@ extension CNLiveShopOrderDetailViewController { | ||
| 275 | } | 509 | } |
| 276 | let dict01 = ["title":"下单时间:\(detailModel.orderid ?? "")","desc":"订单编号:\(detailModel.addtime ?? "")","phone":""] | 510 | let dict01 = ["title":"下单时间:\(detailModel.orderid ?? "")","desc":"订单编号:\(detailModel.addtime ?? "")","phone":""] |
| 277 | let dict02 = ["title":"配送信息","desc":deliveryMessage,"phone":""] | 511 | let dict02 = ["title":"配送信息","desc":deliveryMessage,"phone":""] |
| 278 | - let dict03 = ["title":userTitle,"desc":userMessage,"phone":""] | 512 | + let dict03 = ["title":userTitle,"desc":userMessage,"phone":"\(detailModel.address_phone ?? "")"] |
| 279 | if isNoUser { | 513 | if isNoUser { |
| 280 | headerArray.add(dict01) | 514 | headerArray.add(dict01) |
| 281 | } else { | 515 | } else { |
| @@ -284,13 +518,120 @@ extension CNLiveShopOrderDetailViewController { | @@ -284,13 +518,120 @@ extension CNLiveShopOrderDetailViewController { | ||
| 284 | headerArray.add(dict03) | 518 | headerArray.add(dict03) |
| 285 | } | 519 | } |
| 286 | if detailModel.content!.isNotBlank() { | 520 | if detailModel.content!.isNotBlank() { |
| 287 | - headerArray.add(["name":"备注信息","desc":detailModel.content,"phone":""]) | 521 | + headerArray.add(["title":"备注信息","desc":detailModel.content,"phone":""]) |
| 288 | } | 522 | } |
| 289 | headerView.setupDataSource(dict: ["statues":statues,"back_image":back_image,"icon_image":icon_image]) | 523 | headerView.setupDataSource(dict: ["statues":statues,"back_image":back_image,"icon_image":icon_image]) |
| 524 | + tableView.tableHeaderView = headerView | ||
| 290 | } | 525 | } |
| 291 | 526 | ||
| 292 | - /// 对尾视图数据进行整理 | 527 | + /// 订单详情界面对尾视图数据进行整理 |
| 293 | private func tidyFooterDataSource() { | 528 | private func tidyFooterDataSource() { |
| 294 | - | 529 | + var payType: String? = "" |
| 530 | + switch detailModel.payment { | ||
| 531 | + case "0": | ||
| 532 | + payType = "未支付" | ||
| 533 | + case "1": | ||
| 534 | + payType = "支付宝" | ||
| 535 | + case "2": | ||
| 536 | + payType = "微信" | ||
| 537 | + case "3": | ||
| 538 | + payType = "银联" | ||
| 539 | + case "4": | ||
| 540 | + payType = "网家家支付" | ||
| 541 | + case "5": | ||
| 542 | + payType = "货到付款" | ||
| 543 | + default: | ||
| 544 | + payType = "" | ||
| 545 | + } | ||
| 546 | + let dict01 = ["title":"支付方式","desc":payType! as String,"red":false] as [String : Any] | ||
| 547 | + footerArray.add([dict01]) | ||
| 548 | + let dict02 = ["title":"商品总额","desc":"¥ \(detailModel.price?.keepTwoDecimalPlaces() ?? "0.00")","red":true] as [String : Any] | ||
| 549 | + let dict03 = ["title":"运费","desc":"+ \(detailModel.yunfei_fee?.keepTwoDecimalPlaces() ?? "0.00")","red":true] as [String : Any] | ||
| 550 | + if detailModel.coupon_price?.keepTwoDecimalPlaces() != "0.00" && Float(detailModel.coupon_price ?? "0.00")! > 0.00 { | ||
| 551 | + let dict04 = ["title":detailModel.coupon_type == "1" ? "平台优惠" : "店铺优惠","desc":"- \(detailModel.coupon_price?.keepTwoDecimalPlaces() ?? "0.00")","red":true] as [String : Any] | ||
| 552 | + let dict05 = ["title":"","desc":"实付金额:¥ \(detailModel.pay_price?.keepTwoDecimalPlaces() ?? "0.00")","red":true] as [String : Any] | ||
| 553 | + footerArray.add([dict02,dict03,dict04,dict05]) | ||
| 554 | + } else { | ||
| 555 | + let dict05 = ["title":"","desc":"实付金额:¥ \(detailModel.pay_price?.keepTwoDecimalPlaces() ?? "0.00")","red":true] as [String : Any] | ||
| 556 | + footerArray.add([dict02,dict03,dict05]) | ||
| 557 | + } | ||
| 558 | + } | ||
| 559 | + // 退款详情界面头视图数据 | ||
| 560 | + func tidyRefundHeaderDataSource() { | ||
| 561 | + var back_image = "" | ||
| 562 | + var icon_image = "" | ||
| 563 | + var statues = "" | ||
| 564 | + switch refundModel.state { | ||
| 565 | + case "1": | ||
| 566 | + statues = "申请中" | ||
| 567 | + back_image = "DS_order_shenqingzhong" | ||
| 568 | + icon_image = "DS_order_wait" | ||
| 569 | + case "2": | ||
| 570 | + if refundModel.status == "1" { | ||
| 571 | + statues = "同意申请" | ||
| 572 | + back_image = "DS_order_tongyishenqing" | ||
| 573 | + } else { | ||
| 574 | + statues = "退款成功" | ||
| 575 | + back_image = "DS_order_tuikuanchenggong" | ||
| 576 | + } | ||
| 577 | + icon_image = "DS_order_success" | ||
| 578 | + case "3": | ||
| 579 | + statues = "拒绝退款" | ||
| 580 | + back_image = "DS_order_jujue" | ||
| 581 | + icon_image = "DS_order_close" | ||
| 582 | + case "5": | ||
| 583 | + statues = "用户撤销申请" | ||
| 584 | + back_image = "DS_order_chexiaoshenqing" | ||
| 585 | + icon_image = "DS_order_close" | ||
| 586 | + default: | ||
| 587 | + break | ||
| 588 | + } | ||
| 589 | + headerView.setupDataSource(dict: ["statues":statues,"back_image":back_image,"icon_image":icon_image]) | ||
| 590 | + tableView.tableHeaderView = headerView | ||
| 591 | + } | ||
| 592 | + // 退款详情界面尾视图数据 | ||
| 593 | + func tidyRefundFooterDataSource() { | ||
| 594 | + let oneArray = [["title":"退款类型:","desc": refundModel.tui_mode == "1" ? "退款退货" : "仅退款"], | ||
| 595 | + ["title":"退款原因:","desc": refundModel.title ?? ""], | ||
| 596 | + ["title":"退款金额:","desc": "¥ \(refundModel.price ?? "")"], | ||
| 597 | + ["title":"退款说明:","desc": refundModel.content ?? ""]] | ||
| 598 | + footerArray.add(oneArray) | ||
| 599 | + if refundModel.state == "2" { | ||
| 600 | + let firstDataArr = [["title":"退款申请:","desc":"同意"]] | ||
| 601 | + footerArray.insert(firstDataArr, at: 0) | ||
| 602 | + var thirdDataArr: NSArray = [] | ||
| 603 | + if refundModel.status == "1" { | ||
| 604 | + thirdDataArr = [["title":"同意时间:","desc":refundModel.statetime], | ||
| 605 | + ["title":"申请时间:","desc":refundModel.addtime]] | ||
| 606 | + } else { | ||
| 607 | + thirdDataArr = [["title":"退款时间:","desc":refundModel.refundtime], | ||
| 608 | + ["title":"同意时间:","desc":refundModel.statetime], | ||
| 609 | + ["title":"申请时间:","desc":refundModel.addtime]] | ||
| 610 | + } | ||
| 611 | + footerArray.add(thirdDataArr) | ||
| 612 | + } else if refundModel.state == "3" { | ||
| 613 | + var firstDataArr: NSArray = [] | ||
| 614 | + if refundModel.desc!.count > 0 { | ||
| 615 | + firstDataArr = [["title":"退款申请:","desc":"拒绝"], | ||
| 616 | + ["title":"原因:","desc":refundModel.desc]] | ||
| 617 | + } else { | ||
| 618 | + firstDataArr = [["title":"退款申请:", "desc":"拒绝"]] | ||
| 619 | + } | ||
| 620 | + footerArray.insert(firstDataArr, at: 0) | ||
| 621 | + | ||
| 622 | + let thirdDataArr = [["title":"拒绝时间:", "desc":refundModel.refundtime], | ||
| 623 | + ["title":"申请时间:", "desc":refundModel.addtime]] | ||
| 624 | + footerArray.add(thirdDataArr) | ||
| 625 | + } else if refundModel.state == "5" { | ||
| 626 | + let thirdDataArr = [["title":"撤销时间:", "desc":refundModel.statetime], | ||
| 627 | + ["title":"申请时间:", "desc":refundModel.addtime]] | ||
| 628 | + footerArray.add(thirdDataArr) | ||
| 629 | + } else { | ||
| 630 | + let thirdDataArr = [["title":"申请时间:", "desc":refundModel.addtime]] | ||
| 631 | + footerArray.add(thirdDataArr) | ||
| 632 | + } | ||
| 633 | + if refundModel.img.count > 0 { | ||
| 634 | + footerArray.add(refundModel.img) | ||
| 635 | + } | ||
| 295 | } | 636 | } |
| 296 | } | 637 | } |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderExpressFirmViewController.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveShopOrderExpressListViewController.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by open on 2023/11/8. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | +import EmptyDataSet_Swift | ||
| 10 | + | ||
| 11 | +typealias CNLiveShopOrderExpressFirmCompleterBlock = (_ model: ShopOrderExpressModel) -> Void | ||
| 12 | +class CNLiveShopOrderExpressFirmViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate { | ||
| 13 | + | ||
| 14 | + let kShopBodyOrderExpressListTableViewCellIdentifier = "kShopBodyOrderExpressListTableViewCellIdentifier" | ||
| 15 | + lazy var tableView : UITableView = { | ||
| 16 | + let tableView = UITableView(frame: .zero, style: .plain) | ||
| 17 | + tableView.dataSource = self | ||
| 18 | + tableView.delegate = self | ||
| 19 | + tableView.emptyDataSetSource = self | ||
| 20 | + tableView.emptyDataSetDelegate = self | ||
| 21 | + tableView.backgroundColor = HexColor("#f1f2f6") | ||
| 22 | + tableView.tableFooterView = UIView.init() | ||
| 23 | + tableView.separatorStyle = .none | ||
| 24 | + tableView.register(ShopBodyOrderExpressFirmTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderExpressListTableViewCellIdentifier) | ||
| 25 | + return tableView | ||
| 26 | + }() | ||
| 27 | + | ||
| 28 | + lazy var dataArray: NSMutableArray = { | ||
| 29 | + let dataArray = NSMutableArray.init() | ||
| 30 | + return dataArray | ||
| 31 | + }() | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + var network_type: CNLiveMineResponseType! | ||
| 35 | + var completerBlock: CNLiveShopOrderExpressFirmCompleterBlock! | ||
| 36 | + override func viewDidLoad() { | ||
| 37 | + super.viewDidLoad() | ||
| 38 | + navigationBarHidden = false | ||
| 39 | + titleName = "选择快递公司" | ||
| 40 | + | ||
| 41 | + loadDataSourceAction() | ||
| 42 | + | ||
| 43 | + view.addSubview(tableView) | ||
| 44 | + tableView.snp.makeConstraints { make in | ||
| 45 | + make.top.equalTo(KNavigationHeight) | ||
| 46 | + make.left.right.equalToSuperview() | ||
| 47 | + make.bottom.equalToSuperview().offset(get_system_tabbar_height() - get_system_tabbar_ui_height()) | ||
| 48 | + } | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + func loadDataSourceAction() { | ||
| 52 | + showLoading(message: "") | ||
| 53 | + CNLiveShopViewModel.requestExpressList { [weak self] result, respStatue in | ||
| 54 | + if respStatue == .success { | ||
| 55 | + self!.dataArray.addObjects(from: (result as! NSMutableArray) as! [Any]) | ||
| 56 | + self!.tableView.reloadData() | ||
| 57 | + }else if (respStatue == .noNetwork) { | ||
| 58 | + self!.network_type = .noNetwork | ||
| 59 | + self!.tableView.reloadEmptyDataSet() | ||
| 60 | + } else { | ||
| 61 | + self!.network_type = .failed | ||
| 62 | + self!.tableView.reloadEmptyDataSet() | ||
| 63 | + } | ||
| 64 | + } | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | +} | ||
| 68 | +extension CNLiveShopOrderExpressFirmViewController { | ||
| 69 | + func numberOfSections(in tableView: UITableView) -> Int { | ||
| 70 | + return 1 | ||
| 71 | + } | ||
| 72 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 73 | + return self.dataArray.count | ||
| 74 | + } | ||
| 75 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 76 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderExpressListTableViewCellIdentifier) as? ShopBodyOrderExpressFirmTableViewCell else { | ||
| 77 | + return ShopBodyOrderExpressFirmTableViewCell() | ||
| 78 | + } | ||
| 79 | + cell.lineLabel.isHidden = (indexPath.row == dataArray.count-1) | ||
| 80 | + cell.setupDataSource(model: dataArray[indexPath.row] as! ShopOrderExpressModel) | ||
| 81 | + return cell | ||
| 82 | + } | ||
| 83 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 84 | + return adapt_length(length: 70) | ||
| 85 | + } | ||
| 86 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 87 | + let expressModel = self.dataArray[indexPath.row] as! ShopOrderExpressModel | ||
| 88 | + if (completerBlock != nil) { | ||
| 89 | + completerBlock(expressModel) | ||
| 90 | + } | ||
| 91 | + self.navigationController?.popViewController(animated: true) | ||
| 92 | + } | ||
| 93 | +} | ||
| 94 | + | ||
| 95 | +extension CNLiveShopOrderExpressFirmViewController { | ||
| 96 | + | ||
| 97 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | ||
| 98 | + if network_type == .failed || network_type == .unkonw { | ||
| 99 | + return UIImage(named: "mine_list_source_unusual_failed") | ||
| 100 | + } | ||
| 101 | + if dataArray.count == 0 { | ||
| 102 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 103 | + } | ||
| 104 | + if network_type == .noNetwork { | ||
| 105 | + return UIImage(named: "mine_list_source_unusual_noNet") | ||
| 106 | + } | ||
| 107 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | ||
| 111 | + var defult_string = "" | ||
| 112 | + if network_type == .failed || network_type == .unkonw { | ||
| 113 | + defult_string = "接口请求错误,刷新试试~" | ||
| 114 | + } | ||
| 115 | + if network_type == .noNetwork { | ||
| 116 | + defult_string = "网络开小差了,刷新试试~" | ||
| 117 | + } | ||
| 118 | + if dataArray.count == 0 { | ||
| 119 | + defult_string = "暂时没有数据~" | ||
| 120 | + } | ||
| 121 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | ||
| 125 | + if network_type == .failed || network_type == .noNetwork { | ||
| 126 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | ||
| 127 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | ||
| 128 | + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any]) | ||
| 129 | + } | ||
| 130 | + return nil | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | ||
| 134 | + if network_type == .failed || network_type == .noNetwork { | ||
| 135 | + loadDataSourceAction() | ||
| 136 | + } | ||
| 137 | + } | ||
| 138 | +} |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderExpressListViewController.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveShopOrderExpressListViewController.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by open on 2023/11/8. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | +import EmptyDataSet_Swift | ||
| 10 | + | ||
| 11 | +class CNLiveShopOrderExpressListViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate{ | ||
| 12 | + | ||
| 13 | + let kShopBodyOrderExpressListTableViewCellIdentifier = "kShopBodyOrderExpressListTableViewCellIdentifier" | ||
| 14 | + lazy var tableView: UITableView = { | ||
| 15 | + let tableView = UITableView.init(frame: CGRect.zero, style: .plain) | ||
| 16 | + tableView.dataSource = self | ||
| 17 | + tableView.delegate = self | ||
| 18 | + tableView.emptyDataSetSource = self | ||
| 19 | + tableView.emptyDataSetDelegate = self | ||
| 20 | + tableView.backgroundColor = .clear | ||
| 21 | + tableView.tableFooterView = UIView.init() | ||
| 22 | + tableView.separatorStyle = .none | ||
| 23 | + tableView.register(ShopBodyOrderExpressListTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderExpressListTableViewCellIdentifier) | ||
| 24 | + return tableView | ||
| 25 | + }() | ||
| 26 | + | ||
| 27 | + lazy var dataArray: NSMutableArray = { | ||
| 28 | + let dataArray = NSMutableArray.init() | ||
| 29 | + return dataArray | ||
| 30 | + }() | ||
| 31 | + | ||
| 32 | + var _orderId: NSString! | ||
| 33 | + var network_type: CNLiveMineResponseType! | ||
| 34 | + init(orderId: NSString) { | ||
| 35 | + _orderId = orderId | ||
| 36 | + super.init(nibName:nil, bundle:nil) | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + override func viewDidLoad() { | ||
| 40 | + super.viewDidLoad() | ||
| 41 | + navigationBarHidden = false | ||
| 42 | + titleName = "物流详情" | ||
| 43 | + | ||
| 44 | +// loadDataSourceAction() | ||
| 45 | + | ||
| 46 | + view.addSubview(tableView) | ||
| 47 | + tableView.snp.makeConstraints { make in | ||
| 48 | + make.top.equalTo(KNavigationHeight) | ||
| 49 | + make.left.right.equalToSuperview() | ||
| 50 | + make.bottom.equalToSuperview().offset(get_system_tabbar_height() - get_system_tabbar_ui_height()) | ||
| 51 | + } | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + func loadDataSourceAction() { | ||
| 55 | + showLoading(message: "") | ||
| 56 | + CNLiveShopViewModel.requestExpressList(orderId: _orderId) { [weak self] result, respStatue in | ||
| 57 | + if respStatue == .success { | ||
| 58 | + self!.dataArray.addObjects(from: result as! [ShopOrderExpressListModel]) | ||
| 59 | + self!.tableView.reloadData() | ||
| 60 | + }else if (respStatue == .noNetwork) { | ||
| 61 | + self!.network_type = .noNetwork | ||
| 62 | + self!.tableView.reloadEmptyDataSet() | ||
| 63 | + } else { | ||
| 64 | + self!.network_type = .failed | ||
| 65 | + self!.tableView.reloadEmptyDataSet() | ||
| 66 | + } | ||
| 67 | + } | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + required init?(coder: NSCoder) { | ||
| 71 | + fatalError("init(coder:) has not been implemented") | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | +} | ||
| 75 | +extension CNLiveShopOrderExpressListViewController { | ||
| 76 | + func numberOfSections(in tableView: UITableView) -> Int { | ||
| 77 | + return 1 | ||
| 78 | + } | ||
| 79 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 80 | + return self.dataArray.count | ||
| 81 | + } | ||
| 82 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 83 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderExpressListTableViewCellIdentifier) as? ShopBodyOrderExpressFirmTableViewCell else { | ||
| 84 | + return ShopBodyOrderExpressFirmTableViewCell() | ||
| 85 | + } | ||
| 86 | + return cell | ||
| 87 | + } | ||
| 88 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 89 | + return adapt_length(length: 0.01)//130) | ||
| 90 | + } | ||
| 91 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 92 | + | ||
| 93 | + } | ||
| 94 | +} | ||
| 95 | + | ||
| 96 | +extension CNLiveShopOrderExpressListViewController { | ||
| 97 | + | ||
| 98 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | ||
| 99 | + if network_type == .failed || network_type == .unkonw { | ||
| 100 | + return UIImage(named: "mine_list_source_unusual_failed") | ||
| 101 | + } | ||
| 102 | + if dataArray.count == 0 { | ||
| 103 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 104 | + } | ||
| 105 | + if network_type == .noNetwork { | ||
| 106 | + return UIImage(named: "mine_list_source_unusual_noNet") | ||
| 107 | + } | ||
| 108 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | ||
| 112 | + var defult_string = "" | ||
| 113 | + if network_type == .failed || network_type == .unkonw { | ||
| 114 | + defult_string = "接口请求错误,刷新试试~" | ||
| 115 | + } | ||
| 116 | + if network_type == .noNetwork { | ||
| 117 | + defult_string = "网络开小差了,刷新试试~" | ||
| 118 | + } | ||
| 119 | + if dataArray.count == 0 { | ||
| 120 | + defult_string = "暂时没有数据~" | ||
| 121 | + } | ||
| 122 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | ||
| 126 | + if network_type == .failed || network_type == .noNetwork { | ||
| 127 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | ||
| 128 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | ||
| 129 | + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any]) | ||
| 130 | + } | ||
| 131 | + return nil | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | ||
| 135 | + if network_type == .failed || network_type == .noNetwork { | ||
| 136 | + loadDataSourceAction() | ||
| 137 | + } | ||
| 138 | + } | ||
| 139 | +} |
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopOrderExpressViewController.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveShopOrderExpressViewController.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by open on 2023/11/8. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | + | ||
| 10 | +typealias CNLiveShopOrderExpressCompleterBlock = () -> Void | ||
| 11 | +class CNLiveShopOrderExpressViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource { | ||
| 12 | + | ||
| 13 | + let kShopBodyOrderExpressTableViewCellIdentifier = "kShopBodyOrderExpressTableViewCellIdentifier" | ||
| 14 | + lazy var tableView: UITableView = { | ||
| 15 | + let tableView = UITableView.init(frame: CGRect.zero, style: .plain) | ||
| 16 | + tableView.dataSource = self | ||
| 17 | + tableView.delegate = self | ||
| 18 | + tableView.backgroundColor = HexColor("f1f2f6") | ||
| 19 | + tableView.tableFooterView = UIView.init() | ||
| 20 | + tableView.separatorStyle = .none | ||
| 21 | + tableView.rowHeight = adapt_length(length: 50) | ||
| 22 | + tableView.register(ShopBodyOrderExpressTableViewCell.self, forCellReuseIdentifier: kShopBodyOrderExpressTableViewCellIdentifier) | ||
| 23 | + return tableView | ||
| 24 | + }() | ||
| 25 | + | ||
| 26 | + lazy var footerView: UIView = { | ||
| 27 | + let footerView = UIView.init(frame: CGRect(x: 0, y: KSreenHeight - get_system_tabbar_height(), width: KSreenWidth, height: get_system_tabbar_height())) | ||
| 28 | + footerView.backgroundColor = .white | ||
| 29 | + footerView.addSubview(cancelBtn) | ||
| 30 | + cancelBtn.snp.makeConstraints { make in | ||
| 31 | + make.width.equalTo(adapt_length(length: 130)) | ||
| 32 | + make.height.equalTo(get_system_tabbar_ui_height()) | ||
| 33 | + make.left.equalToSuperview() | ||
| 34 | + make.top.equalToSuperview() | ||
| 35 | + } | ||
| 36 | + footerView.addSubview(deliveryBtn) | ||
| 37 | + deliveryBtn.snp.makeConstraints { make in | ||
| 38 | + make.width.equalTo(KSreenWidth - adapt_length(length: 130)) | ||
| 39 | + make.height.equalTo(get_system_tabbar_ui_height()) | ||
| 40 | + make.right.equalToSuperview() | ||
| 41 | + make.top.equalToSuperview() | ||
| 42 | + } | ||
| 43 | + return footerView | ||
| 44 | + }() | ||
| 45 | + | ||
| 46 | + lazy var cancelBtn: UIButton = { | ||
| 47 | + let cancelBtn = UIButton.init(type: .custom) | ||
| 48 | + cancelBtn.backgroundColor = .white | ||
| 49 | + cancelBtn.setTitle("取消", for: .normal) | ||
| 50 | + cancelBtn.setTitleColor(HexColor("#3A3A3A"), for: .normal) | ||
| 51 | + cancelBtn.titleLabel?.font = medium_adapt_font(pointSize: 14) | ||
| 52 | + cancelBtn.addTarget(self, action: #selector(cancelBtnClick), for: .touchUpInside) | ||
| 53 | + return cancelBtn | ||
| 54 | + }() | ||
| 55 | + | ||
| 56 | + lazy var deliveryBtn: UIButton = { | ||
| 57 | + let deliveryBtn = UIButton.init() | ||
| 58 | + deliveryBtn.backgroundColor = HexColor("#65C368") | ||
| 59 | + deliveryBtn.setTitle(hiddenShop ? "确认修改" : "确认发货", for: .normal) | ||
| 60 | + deliveryBtn.titleLabel?.font = regular_adapt_font(pointSize: 15) | ||
| 61 | + deliveryBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal) | ||
| 62 | + deliveryBtn.addTarget(self, action: #selector(sendBtnClick), for: .touchUpInside) | ||
| 63 | + return deliveryBtn | ||
| 64 | + }() | ||
| 65 | + | ||
| 66 | + lazy var dataArray: NSMutableArray = { | ||
| 67 | + let dataArray = NSMutableArray.init() | ||
| 68 | + return dataArray | ||
| 69 | + }() | ||
| 70 | + | ||
| 71 | + lazy var textArray: NSMutableArray = { | ||
| 72 | + let textArray = NSMutableArray.init() | ||
| 73 | + return textArray | ||
| 74 | + }() | ||
| 75 | + | ||
| 76 | + var selectStoreModel: ShopOrderStoreModel! | ||
| 77 | + var selectExpressModel: ShopOrderExpressModel! | ||
| 78 | + var hiddenShop: Bool! = false//是否隐藏店铺名称 | ||
| 79 | + var _isExp: Bool! = false | ||
| 80 | + var expId: String! = ""// 发货单id (多物流快递有用) | ||
| 81 | + var expressModel: ShopOrderExpressModel!// 快递model | ||
| 82 | + var express_num: String! = "" | ||
| 83 | + var _goods_arr: NSArray! | ||
| 84 | + var _orderId: String! | ||
| 85 | + init(orderId: NSString,isExp: Bool,goods_arr: NSArray) { | ||
| 86 | + super.init(nibName:nil, bundle:nil) | ||
| 87 | + _orderId = orderId as String | ||
| 88 | + _isExp = isExp | ||
| 89 | + _goods_arr = goods_arr | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + override func viewDidLoad() { | ||
| 93 | + super.viewDidLoad() | ||
| 94 | + navigationBarHidden = false | ||
| 95 | + titleName = "快递信息" | ||
| 96 | + | ||
| 97 | + loadDataSourceAction {} | ||
| 98 | + | ||
| 99 | + view.addSubview(tableView) | ||
| 100 | + tableView.snp.makeConstraints { make in | ||
| 101 | + make.top.equalTo(KNavigationHeight) | ||
| 102 | + make.left.right.equalToSuperview() | ||
| 103 | + make.bottom.equalToSuperview().offset(-get_system_tabbar_height()) | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + view.addSubview(footerView) | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + func loadDataSourceAction(completerBlock: @escaping CNLiveShopOrderExpressCompleterBlock) { | ||
| 110 | + showMessage(message: "") | ||
| 111 | + CNLiveShopViewModel.requestSellerStore { [weak self] result, respStatue in | ||
| 112 | + if respStatue == .success { | ||
| 113 | + self!.dataArray.addObjects(from: (result as! [NSMutableArray]).first! as! [ShopOrderStoreModel]) | ||
| 114 | + self!.textArray.addObjects(from: (result as! [NSMutableArray]).last as! [String]) | ||
| 115 | + self!.tableView.reloadData() | ||
| 116 | + completerBlock() | ||
| 117 | + } | ||
| 118 | + } | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + @objc func sendBtnClick() { | ||
| 122 | + if !hiddenShop && (selectStoreModel == nil) { | ||
| 123 | + showMessage(message: "请选择店铺") | ||
| 124 | + return | ||
| 125 | + } else if (selectExpressModel == nil) { | ||
| 126 | + showMessage(message: "请选择快递公司") | ||
| 127 | + return | ||
| 128 | + } else if (!selectExpressModel.no!.isNotBlank()) { | ||
| 129 | + showMessage(message: "请输入快递单号") | ||
| 130 | + return | ||
| 131 | + } else if (!selectExpressModel.no!.allowWriteString(string: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHRJKLMNOPQRSTUVWXYZ")) { | ||
| 132 | + showMessage(message: "请输入正确快递单号") | ||
| 133 | + return | ||
| 134 | + } | ||
| 135 | + showLoading(message: "") | ||
| 136 | + CNLiveShopViewModel.requestExpress(orderId: _orderId, expressId: selectExpressModel.id!, expressNum: selectExpressModel.no!, hiddenSop: hiddenShop, expId: expId, goodsList: _goods_arr, storeId: selectStoreModel.id!) { [weak self] result, respStatue in | ||
| 137 | + if respStatue == .success { | ||
| 138 | + showMessage(message: result as! String) | ||
| 139 | + if !self!.hiddenShop { | ||
| 140 | + var dic: NSDictionary = [:] | ||
| 141 | + if self!._isExp { | ||
| 142 | + dic = ["selectNum":NSNumber(integerLiteral: 1)] | ||
| 143 | + } | ||
| 144 | + if self!.hiddenShop { | ||
| 145 | + NotificationCenter.default.post(name: Notification.Name.ShopOrderStatue.CNLiveShopOrderEditExpressNotification, object: nil) | ||
| 146 | + } else { | ||
| 147 | + NotificationCenter.default.post(name: Notification.Name.ShopOrderStatue.CNLiveShopOrderSendExpressNotification, object: dic) | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + } | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + @objc func cancelBtnClick() { | ||
| 155 | + self.navigationController?.popViewController(animated: true) | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + required init?(coder: NSCoder) { | ||
| 159 | + fatalError("init(coder:) has not been implemented") | ||
| 160 | + } | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +extension CNLiveShopOrderExpressViewController { | ||
| 164 | + func numberOfSections(in tableView: UITableView) -> Int { | ||
| 165 | + return 1 | ||
| 166 | + } | ||
| 167 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 168 | + return hiddenShop ? 2 : 3 | ||
| 169 | + } | ||
| 170 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 171 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderExpressTableViewCellIdentifier) as? ShopBodyOrderExpressTableViewCell else { | ||
| 172 | + return ShopBodyOrderExpressTableViewCell() | ||
| 173 | + } | ||
| 174 | + var title: String = "" | ||
| 175 | + var content: String = "" | ||
| 176 | + var placeHolder: String = "" | ||
| 177 | + var contentIsEdit: Bool = false | ||
| 178 | + var isShowArrowImage: Bool = false | ||
| 179 | + var isShowLine: Bool = false | ||
| 180 | + if !hiddenShop && indexPath.row == 0 { | ||
| 181 | + title = "店铺名称" | ||
| 182 | + if selectStoreModel != nil { | ||
| 183 | + content = selectStoreModel.title!.isNotBlank() ? selectStoreModel.title! as String : "" as String | ||
| 184 | + } | ||
| 185 | + placeHolder = "请选择店铺" | ||
| 186 | + isShowArrowImage = true | ||
| 187 | + isShowLine = true | ||
| 188 | + } else if (indexPath.row == (hiddenShop ? 0 : 1)) { | ||
| 189 | + title = "快递公司" | ||
| 190 | + if selectExpressModel != nil { | ||
| 191 | + content = selectExpressModel.com!.isNotBlank() ? selectExpressModel.com! as String : "" as String | ||
| 192 | + } | ||
| 193 | + placeHolder = "请选择快递公司" | ||
| 194 | + isShowArrowImage = true | ||
| 195 | + isShowLine = true | ||
| 196 | + } else { | ||
| 197 | + title = "快递单号" | ||
| 198 | + if express_num.isNotBlank() { | ||
| 199 | + content = express_num! as String | ||
| 200 | + selectExpressModel.no = express_num as String | ||
| 201 | + } else { | ||
| 202 | + if selectExpressModel != nil { | ||
| 203 | + content = (selectExpressModel.no != nil) ? selectExpressModel.no! : "" | ||
| 204 | + } | ||
| 205 | + } | ||
| 206 | + placeHolder = "请输入单号" | ||
| 207 | + contentIsEdit = true | ||
| 208 | + } | ||
| 209 | + cell.row = indexPath.row | ||
| 210 | + cell.setup(title: title, content: content, placeHolder: placeHolder, contentIsEdit: contentIsEdit, isShowArrowImage: isShowArrowImage, isShowLine: isShowLine) | ||
| 211 | + cell.clickBlock = {[weak self] content, row in | ||
| 212 | + if row == (self!.hiddenShop ? 1 : 2) { | ||
| 213 | + self!.selectExpressModel.no = content | ||
| 214 | + } | ||
| 215 | + } | ||
| 216 | + return cell | ||
| 217 | + } | ||
| 218 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 219 | + return adapt_length(length: 50) | ||
| 220 | + } | ||
| 221 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 222 | + if !hiddenShop && indexPath.row == 0 { | ||
| 223 | + if dataArray.count > 0 { | ||
| 224 | + MineStandListAlertView.showStandListView(infos: textArray, name: "请选择店铺", show_type: .string) { [weak self] text in | ||
| 225 | + let index = self!.textArray.index(of: text) | ||
| 226 | + self!.selectStoreModel = (self!.dataArray[index] as! ShopOrderStoreModel) | ||
| 227 | + self!.tableView.reloadData() | ||
| 228 | + } | ||
| 229 | + } else { | ||
| 230 | + loadDataSourceAction { [weak self] in | ||
| 231 | + MineStandListAlertView.showStandListView(infos: self!.textArray, name: "请选择店铺", show_type: .string) { text in | ||
| 232 | + let index = self!.textArray.index(of: text) | ||
| 233 | + self!.selectStoreModel = (self!.dataArray[index] as! ShopOrderStoreModel) | ||
| 234 | + self!.tableView.reloadData() | ||
| 235 | + } | ||
| 236 | + } | ||
| 237 | + } | ||
| 238 | + } else if (indexPath.row == (self.hiddenShop ? 0 : 1)) { | ||
| 239 | + let vc = CNLiveShopOrderExpressFirmViewController.init() | ||
| 240 | + vc.completerBlock = {[weak self] model in | ||
| 241 | + self!.selectExpressModel = model | ||
| 242 | + self!.tableView.reloadData() | ||
| 243 | + } | ||
| 244 | + self.navigationController?.pushViewController(vc, animated: true) | ||
| 245 | + } | ||
| 246 | + } | ||
| 247 | +} | ||
| 248 | + |
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 | }) |
| @@ -178,8 +178,8 @@ extension CNLiveShopOrderListViewController { | @@ -178,8 +178,8 @@ extension CNLiveShopOrderListViewController { | ||
| 178 | let footerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: kShopBodyOrderFooterViewCellIdentifier) as! ShopBodyOrderFooterViewCell | 178 | let footerView = tableView.dequeueReusableHeaderFooterView(withIdentifier: kShopBodyOrderFooterViewCellIdentifier) as! ShopBodyOrderFooterViewCell |
| 179 | let listModel = (dataArray[section] as! ShopOrderListModel) | 179 | let listModel = (dataArray[section] as! ShopOrderListModel) |
| 180 | footerView.setupDataSource(listModel: listModel) | 180 | footerView.setupDataSource(listModel: listModel) |
| 181 | - footerView.clickRightBtnCallBack = { [weak self] clickEvent, listModel in | ||
| 182 | - self?.orderOperation(clickEvent: clickEvent, listModel: listModel) | 181 | + footerView.clickRightBtnCallBack = { [weak self] title, clickEvent, listModel in |
| 182 | + self?.orderOperation(title: title, event: clickEvent, listModel: listModel) | ||
| 183 | } | 183 | } |
| 184 | return footerView | 184 | return footerView |
| 185 | } | 185 | } |
| @@ -241,21 +241,60 @@ extension CNLiveShopOrderListViewController { | @@ -241,21 +241,60 @@ extension CNLiveShopOrderListViewController { | ||
| 241 | /// - Parameters: | 241 | /// - Parameters: |
| 242 | /// - clickEvent: 按钮类型 | 242 | /// - clickEvent: 按钮类型 |
| 243 | /// - listModel: 数据源 | 243 | /// - listModel: 数据源 |
| 244 | - private func orderOperation(clickEvent: CNDSOrderListSectionFooterBtnClickEvent, listModel: ShopOrderListModel) { | ||
| 245 | - switch clickEvent { | ||
| 246 | - case .delivery: break | 244 | + private func orderOperation(title: String, event: CNDSOrderListSectionFooterBtnClickEvent, listModel: ShopOrderListModel) { |
| 245 | + switch event { | ||
| 246 | + case .delivery: | ||
| 247 | + if listModel.is_tui == "2" { | ||
| 248 | + showMessage(message: "此为退款订单") | ||
| 249 | + return | ||
| 250 | + } | ||
| 251 | + delivery(listModel: listModel) | ||
| 252 | + break | ||
| 247 | case .notifyOrder: | 253 | case .notifyOrder: |
| 248 | if listModel.is_tui == "2" { | 254 | if listModel.is_tui == "2" { |
| 249 | showMessage(message: "此为退款订单") | 255 | showMessage(message: "此为退款订单") |
| 250 | return | 256 | return |
| 251 | } | 257 | } |
| 258 | + notifyOrder(listModel: listModel) | ||
| 259 | + break | ||
| 260 | + case .connection: | ||
| 252 | pushOrderDetail(listModel: listModel) | 261 | pushOrderDetail(listModel: listModel) |
| 253 | break | 262 | break |
| 263 | + case .expDetail: | ||
| 264 | + delivery(listModel: listModel) | ||
| 265 | + break | ||
| 266 | + case .checkExpress: | ||
| 267 | + pushExpressVC(listModel: listModel) | ||
| 268 | + break | ||
| 269 | + case .express: | ||
| 270 | + pushExpressVC(listModel: listModel) | ||
| 271 | + break | ||
| 254 | default: | 272 | default: |
| 255 | break | 273 | break |
| 256 | } | 274 | } |
| 257 | } | 275 | } |
| 258 | 276 | ||
| 277 | + /// 跳转物流相关界面 | ||
| 278 | + /// - Parameter detailModel: 数据源 | ||
| 279 | + private func pushExpressVC(listModel: ShopOrderListModel) { | ||
| 280 | + if listModel.send_num > 1 || listModel.is_send == "0" { | ||
| 281 | +// self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: listModel.id! as NSString), animated: true) | ||
| 282 | + self.navigationController?.pushViewController(CNLiveShopOrderExpressListViewController.init(orderId: "1000073435"), animated: true) | ||
| 283 | + } else { | ||
| 284 | + | ||
| 285 | + } | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + /// 选取商品及拆单 | ||
| 289 | + /// - Parameter listModel: 数据源 | ||
| 290 | + private func delivery(listModel: ShopOrderListModel) { | ||
| 291 | + var type: CNLiveShopOrderSpliteSendViewType = .splite | ||
| 292 | + if listModel.is_send == "0" { | ||
| 293 | + type = .select | ||
| 294 | + } | ||
| 295 | + self.navigationController?.pushViewController(CNLiveShopOrderSendViewController.init(orderId: listModel.id! as NSString, show_type: type), animated: true) | ||
| 296 | + } | ||
| 297 | + | ||
| 259 | /// 通知用户自提 | 298 | /// 通知用户自提 |
| 260 | /// - Parameter listModel: 数据源 | 299 | /// - Parameter listModel: 数据源 |
| 261 | private func notifyOrder(listModel: ShopOrderListModel) { | 300 | private func notifyOrder(listModel: ShopOrderListModel) { |
| @@ -273,6 +312,15 @@ extension CNLiveShopOrderListViewController { | @@ -273,6 +312,15 @@ extension CNLiveShopOrderListViewController { | ||
| 273 | /// 跳转到订单详情界面 | 312 | /// 跳转到订单详情界面 |
| 274 | /// - Parameter listModel: 数据源 | 313 | /// - Parameter listModel: 数据源 |
| 275 | private func pushOrderDetail(listModel: ShopOrderListModel) { | 314 | private func pushOrderDetail(listModel: ShopOrderListModel) { |
| 276 | - self.navigationController?.pushViewController(CNLiveShopOrderDetailViewController.init(orderId: listModel.id!, show_type: .order), animated: true) | 315 | + if listModel.isRefund == "1" { |
| 316 | + let detailVC = CNLiveShopOrderDetailViewController.init(orderId: listModel.id!, show_type: .sale, form_type: .afterSale) | ||
| 317 | + self.navigationController?.pushViewController(detailVC, animated: true) | ||
| 318 | + } else { | ||
| 319 | + if listModel.address_address!.count > 0 { | ||
| 320 | + self.navigationController?.pushViewController(CNLiveShopOrderDetailViewController.init(orderId: listModel.id!, show_type: .order, form_type: .afterSale), animated: true) | ||
| 321 | + } else { | ||
| 322 | + showMessage(message: "目前没有地址信息,暂无法发货") | ||
| 323 | + } | ||
| 324 | + } | ||
| 277 | } | 325 | } |
| 278 | } | 326 | } |
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 = semibold_adapt_font(pointSize: 15) | ||
| 39 | + saveButton.setTitleColor(HexColor("#F5A623"), for: .normal) | ||
| 40 | + saveButton.backgroundColor = .clear | ||
| 41 | + saveButton.layer.masksToBounds = true | ||
| 42 | + saveButton.layer.cornerRadius = 5 | ||
| 43 | + saveButton.addTarget(self, action: #selector(bottomBtnClick), for: .touchUpInside) | ||
| 44 | + saveButton.tag = 1000 | ||
| 45 | + return saveButton | ||
| 46 | + }() | ||
| 47 | + | ||
| 48 | + lazy var footerView: UIView = { | ||
| 49 | + let footerView = UIView.init(frame: CGRect(x: 0, y: KSreenHeight - get_system_tabbar_height(), width: KSreenWidth, height: get_system_tabbar_height())) | ||
| 50 | + footerView.backgroundColor = .white | ||
| 51 | + footerView.addSubview(allSelectBtn) | ||
| 52 | + allSelectBtn.snp.makeConstraints { make in | ||
| 53 | + make.width.equalTo(65) | ||
| 54 | + make.height.equalTo(30) | ||
| 55 | + make.left.equalToSuperview().offset(adapt_length(length: 20)) | ||
| 56 | + make.top.equalToSuperview().offset(adapt_length(length: 9.5)) | ||
| 57 | + } | ||
| 58 | + footerView.addSubview(deliveryBtn) | ||
| 59 | + deliveryBtn.snp.makeConstraints { make in | ||
| 60 | + make.width.equalTo(77) | ||
| 61 | + make.height.equalTo(30) | ||
| 62 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | ||
| 63 | + make.top.equalToSuperview().offset(adapt_length(length: 9.5)) | ||
| 64 | + } | ||
| 65 | + return footerView | ||
| 66 | + }() | ||
| 67 | + | ||
| 68 | + lazy var allSelectBtn: UIButton = { | ||
| 69 | + let allSelectBtn = UIButton.init(type: .custom) | ||
| 70 | + allSelectBtn.backgroundColor = .white | ||
| 71 | + allSelectBtn.setImage(UIImage(named: "DS_goods_select_no"), for: .normal) | ||
| 72 | + allSelectBtn.setImage(UIImage(named: "DS_goods_select_yes"), for: .selected) | ||
| 73 | + allSelectBtn.setTitle(" 全选", for: .normal) | ||
| 74 | + allSelectBtn.setTitleColor(HexColor("#3A3A3A"), for: .normal) | ||
| 75 | + allSelectBtn.setTitle(" 全选", for: .selected) | ||
| 76 | + allSelectBtn.setTitleColor(HexColor("#3A3A3A"), for: .selected) | ||
| 77 | + allSelectBtn.titleLabel?.font = medium_adapt_font(pointSize: 14) | ||
| 78 | + allSelectBtn.addTarget(self, action: #selector(bottomBtnClick), for: .touchUpInside) | ||
| 79 | + allSelectBtn.isHidden = _show_type == .splite | ||
| 80 | + allSelectBtn.tag = 1001 | ||
| 81 | + return allSelectBtn | ||
| 82 | + }() | ||
| 83 | + | ||
| 84 | + lazy var deliveryBtn: UIButton = { | ||
| 85 | + let deliveryBtn = UIButton.init() | ||
| 86 | + deliveryBtn.backgroundColor = HexColor("#65C368") | ||
| 87 | + deliveryBtn.layer.cornerRadius = 4 | ||
| 88 | + deliveryBtn.layer.masksToBounds = true | ||
| 89 | + deliveryBtn.setTitle("快递发货", for: .normal) | ||
| 90 | + deliveryBtn.titleLabel?.font = regular_adapt_font(pointSize: 14) | ||
| 91 | + deliveryBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal) | ||
| 92 | + deliveryBtn.addTarget(self, action: #selector(bottomBtnClick), for: .touchUpInside) | ||
| 93 | + deliveryBtn.tag = 1002 | ||
| 94 | + return deliveryBtn | ||
| 95 | + }() | ||
| 96 | + | ||
| 97 | + lazy var dataArray: NSMutableArray = { | ||
| 98 | + let dataArray = NSMutableArray.init() | ||
| 99 | + return dataArray | ||
| 100 | + }() | ||
| 101 | + | ||
| 102 | + var _orderId: NSString | ||
| 103 | + var network_type: CNLiveMineResponseType! | ||
| 104 | + var _show_type: CNLiveShopOrderSpliteSendViewType! | ||
| 105 | + init(orderId: NSString, show_type:CNLiveShopOrderSpliteSendViewType) { | ||
| 106 | + _orderId = orderId | ||
| 107 | + _show_type = show_type | ||
| 108 | + super.init(nibName:nil, bundle:nil) | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + required init?(coder: NSCoder) { | ||
| 112 | + fatalError("init(coder:) has not been implemented") | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + override func viewDidLoad() { | ||
| 116 | + super.viewDidLoad() | ||
| 117 | + navigationBarHidden = false | ||
| 118 | + titleName = "选择发货商品" | ||
| 119 | + | ||
| 120 | + if _show_type == .splite { | ||
| 121 | + topNavView.addSubview(saveButton) | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + view.addSubview(tableView) | ||
| 125 | + tableView.snp.makeConstraints { make in | ||
| 126 | + make.top.equalTo(KNavigationHeight) | ||
| 127 | + make.left.right.equalToSuperview() | ||
| 128 | + make.bottom.equalToSuperview().offset(-get_system_tabbar_height()) | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + loadDataSourceAction() | ||
| 132 | + | ||
| 133 | + view.addSubview(footerView) | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + func loadDataSourceAction() { | ||
| 137 | + CNLiveShopViewModel.requestOrderDetail(orderId: _orderId as String, isOrderDetai: true, isRefund: false) { [weak self] result, respStatue in | ||
| 138 | + if respStatue == .success { | ||
| 139 | + let detailModel = result as! ShopOrderDetailModel | ||
| 140 | + if self!._show_type == .splite { | ||
| 141 | + for goodsModel in detailModel.order_detail { | ||
| 142 | + if (detailModel.state == "2" && (goodsModel.num! - goodsModel.refund_num!) > 0) || (goodsModel.send_num! != 0 && (goodsModel.send_num! - goodsModel.refund_num!) > 0) { | ||
| 143 | + self!.dataArray.add(goodsModel) | ||
| 144 | + } | ||
| 145 | + } | ||
| 146 | + } else { | ||
| 147 | + for goodsModel in detailModel.order_detail { | ||
| 148 | + goodsModel.select = false | ||
| 149 | + goodsModel.selectNum = 1 | ||
| 150 | + | ||
| 151 | + if (detailModel.state == "2" && (goodsModel.num! - goodsModel.refund_num!) > 0 ) || (goodsModel.send_num! != 0 && (goodsModel.send_num! - goodsModel.refund_num!) > 0 ) { | ||
| 152 | + self!.dataArray.add(goodsModel) | ||
| 153 | + } | ||
| 154 | + } | ||
| 155 | + } | ||
| 156 | + self?.tableView.reloadData() | ||
| 157 | + }else if (respStatue == .noNetwork) { | ||
| 158 | + self!.network_type = .noNetwork | ||
| 159 | + self!.tableView.reloadEmptyDataSet() | ||
| 160 | + } else { | ||
| 161 | + self!.network_type = .failed | ||
| 162 | + self!.tableView.reloadEmptyDataSet() | ||
| 163 | + } | ||
| 164 | + } | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | + @objc func bottomBtnClick(button: UIButton) { | ||
| 168 | + //拆单 | ||
| 169 | + if button.tag == 1000 { | ||
| 170 | + self.navigationController?.pushViewController(CNLiveShopOrderSendViewController.init(orderId: _orderId, show_type: .select), animated: true) | ||
| 171 | + } | ||
| 172 | + //全选 | ||
| 173 | + if button.tag == 1001 { | ||
| 174 | + button.isSelected = !button.isSelected | ||
| 175 | + for model in self.dataArray { | ||
| 176 | + (model as! ShopOrderListGoodsModel).select = button.isSelected | ||
| 177 | + } | ||
| 178 | + tableView.reloadData() | ||
| 179 | + } | ||
| 180 | + //快递发货 | ||
| 181 | + if button.tag == 1002 { | ||
| 182 | + var goods_array: NSArray = [] | ||
| 183 | + var isExp: Bool = false | ||
| 184 | + if _show_type == .select { | ||
| 185 | + let array = NSMutableArray.init() | ||
| 186 | + for item in dataArray { | ||
| 187 | + let model = item as! ShopOrderListGoodsModel | ||
| 188 | + if (model.select == false || (model.selectNum! < ((model.send_num != 0 ? model.send_num : model.num)!))) { | ||
| 189 | + isExp = true | ||
| 190 | + } | ||
| 191 | + if model.select == true { | ||
| 192 | + let dic = ["id":model.goods_id,"num":"\(model.selectNum ?? 0)"] | ||
| 193 | + array.add(dic) | ||
| 194 | + } | ||
| 195 | + } | ||
| 196 | + goods_array = array.copy() as! NSArray | ||
| 197 | + if goods_array.count <= 0 { | ||
| 198 | + showMessage(message: "请选择发货商品") | ||
| 199 | + return | ||
| 200 | + } | ||
| 201 | + } | ||
| 202 | + let vc = CNLiveShopOrderExpressViewController.init(orderId: _orderId,isExp: isExp, goods_arr: goods_array) | ||
| 203 | + self.navigationController?.pushViewController(vc, animated: true) | ||
| 204 | + } | ||
| 205 | + } | ||
| 206 | +} | ||
| 207 | +extension CNLiveShopOrderSendViewController { | ||
| 208 | + func numberOfSections(in tableView: UITableView) -> Int { | ||
| 209 | + return 1 | ||
| 210 | + } | ||
| 211 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | ||
| 212 | + return self.dataArray.count | ||
| 213 | + } | ||
| 214 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | ||
| 215 | + if _show_type == .select { | ||
| 216 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderSelectTableViewCellIdentifier) as? ShopBodyOrderSelectTableViewCell else { | ||
| 217 | + return ShopBodyOrderSelectTableViewCell() | ||
| 218 | + } | ||
| 219 | + cell.setupDataSource(goodsModel: self.dataArray[indexPath.row] as! ShopOrderListGoodsModel) | ||
| 220 | + cell.clickCallBack = { [self] isSelected in | ||
| 221 | + if isSelected { | ||
| 222 | + var select :Bool = true | ||
| 223 | + for model in dataArray { | ||
| 224 | + if !(model as! ShopOrderListGoodsModel).select { | ||
| 225 | + select = false | ||
| 226 | + } | ||
| 227 | + } | ||
| 228 | + allSelectBtn.isSelected = select | ||
| 229 | + } else { | ||
| 230 | + allSelectBtn.isSelected = false | ||
| 231 | + } | ||
| 232 | + } | ||
| 233 | + cell.lineLabel.isHidden = (indexPath.row == dataArray.count-1) | ||
| 234 | + return cell | ||
| 235 | + } else { | ||
| 236 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyOrderSpliteTableViewCellIdentifier) as? ShopBodyOrderSpliteTableViewCell else { | ||
| 237 | + return ShopBodyOrderSpliteTableViewCell() | ||
| 238 | + } | ||
| 239 | + cell.setupDataSource(goodsModel: self.dataArray[indexPath.row] as! ShopOrderListGoodsModel) | ||
| 240 | + cell.lineLabel.isHidden = (indexPath.row == dataArray.count-1) | ||
| 241 | + return cell | ||
| 242 | + } | ||
| 243 | + } | ||
| 244 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | ||
| 245 | + return adapt_length(length: 130) | ||
| 246 | + } | ||
| 247 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | ||
| 248 | + if _show_type == .select { | ||
| 249 | + let goodsModel = dataArray[indexPath.row] as! ShopOrderListGoodsModel | ||
| 250 | + goodsModel.select = !goodsModel.select | ||
| 251 | + if goodsModel.select { | ||
| 252 | + var select: Bool = true | ||
| 253 | + for model in dataArray { | ||
| 254 | + if !(model as! ShopOrderListGoodsModel).select { | ||
| 255 | + select = false | ||
| 256 | + } | ||
| 257 | + } | ||
| 258 | + allSelectBtn.isSelected = select | ||
| 259 | + } else { | ||
| 260 | + allSelectBtn.isSelected = false | ||
| 261 | + } | ||
| 262 | + tableView.reloadRows(at: [indexPath], with: .none) | ||
| 263 | + } | ||
| 264 | + } | ||
| 265 | +} | ||
| 266 | + | ||
| 267 | +extension CNLiveShopOrderSendViewController { | ||
| 268 | + | ||
| 269 | + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? { | ||
| 270 | + if network_type == .failed || network_type == .unkonw { | ||
| 271 | + return UIImage(named: "mine_list_source_unusual_failed") | ||
| 272 | + } | ||
| 273 | + if dataArray.count == 0 { | ||
| 274 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 275 | + } | ||
| 276 | + if network_type == .noNetwork { | ||
| 277 | + return UIImage(named: "mine_list_source_unusual_noNet") | ||
| 278 | + } | ||
| 279 | + return UIImage(named: "mine_list_source_unusual_empty") | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? { | ||
| 283 | + var defult_string = "" | ||
| 284 | + if network_type == .failed || network_type == .unkonw { | ||
| 285 | + defult_string = "接口请求错误,刷新试试~" | ||
| 286 | + } | ||
| 287 | + if network_type == .noNetwork { | ||
| 288 | + defult_string = "网络开小差了,刷新试试~" | ||
| 289 | + } | ||
| 290 | + if dataArray.count == 0 { | ||
| 291 | + defult_string = "暂时没有数据~" | ||
| 292 | + } | ||
| 293 | + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!]) | ||
| 294 | + } | ||
| 295 | + | ||
| 296 | + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? { | ||
| 297 | + if network_type == .failed || network_type == .noNetwork { | ||
| 298 | + let attributes = [NSAttributedString.Key.font:Font_16_Fit, | ||
| 299 | + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")] | ||
| 300 | + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any]) | ||
| 301 | + } | ||
| 302 | + return nil | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) { | ||
| 306 | + if network_type == .failed || network_type == .noNetwork { | ||
| 307 | + loadDataSourceAction() | ||
| 308 | + } | ||
| 309 | + } | ||
| 310 | +} |
metaCode/Classes/Main/ShopPage/Model/CNLiveShopBaseModel.swift
| @@ -36,7 +36,7 @@ class ShopOrderListModel: BaseModel { | @@ -36,7 +36,7 @@ class ShopOrderListModel: BaseModel { | ||
| 36 | var express_state: String? = "" // 2在途 3签收 | 36 | var express_state: String? = "" // 2在途 3签收 |
| 37 | var order_detail = [ShopOrderListGoodsModel]() // 商品 | 37 | var order_detail = [ShopOrderListGoodsModel]() // 商品 |
| 38 | var is_send: String? = "" // state为3时 is_send为 0时为部分发货 1已发货 | 38 | var is_send: String? = "" // state为3时 is_send为 0时为部分发货 1已发货 |
| 39 | - var send_num: String? = "" // 发货数量 | 39 | + var send_num: Int = 0 // 发货数量 |
| 40 | 40 | ||
| 41 | override func mapping(mapper: HelpingMapper) { | 41 | override func mapping(mapper: HelpingMapper) { |
| 42 | mapper <<< | 42 | mapper <<< |
| @@ -86,7 +86,7 @@ class ShopOrderDetailModel: BaseModel { | @@ -86,7 +86,7 @@ class ShopOrderDetailModel: BaseModel { | ||
| 86 | var order_detail = [ShopOrderListGoodsModel]() // 商品 | 86 | var order_detail = [ShopOrderListGoodsModel]() // 商品 |
| 87 | var username: String? = "" // 用户名 | 87 | var username: String? = "" // 用户名 |
| 88 | var is_send: String? = "" // 是否拆单,state = 3时判断 | 88 | var is_send: String? = "" // 是否拆单,state = 3时判断 |
| 89 | - var send_num: String? = "" // 物流数量 | 89 | + var send_num: Int = 0 // 物流数量 |
| 90 | var refund_num: String? = "" // 已经退款数量 | 90 | var refund_num: String? = "" // 已经退款数量 |
| 91 | var is_send_all: Bool = true // 是否是全部发货,这是自己设置的属性 | 91 | var is_send_all: Bool = true // 是否是全部发货,这是自己设置的属性 |
| 92 | 92 | ||
| @@ -107,20 +107,133 @@ class ShopOrderDetailModel: BaseModel { | @@ -107,20 +107,133 @@ 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 // 商品是否被选中 | ||
| 194 | +} | ||
| 195 | + | ||
| 196 | +//!!!: 快递公司model | ||
| 197 | +class ShopOrderExpressModel: BaseModel { | ||
| 198 | + var id: String? = ""// 快递公司id | ||
| 199 | + var com: String? = ""// 名称 | ||
| 200 | + var no: String? = ""// 编号 | ||
| 201 | + var tel: String? = ""// 电话 | ||
| 202 | + var simg: String? = ""// logo | ||
| 203 | + var address: String? = ""// 收货地址 | ||
| 204 | + var state: String? = ""// 3为已完成 其他为运输中 | ||
| 205 | +} | ||
| 206 | + | ||
| 207 | +//!!!: 店铺model | ||
| 208 | +class ShopOrderStoreModel: BaseModel { | ||
| 209 | + var id: String? = ""// 店铺id | ||
| 210 | + var title: String? = ""// 名称 | ||
| 211 | + var address: String? = ""// 地址 | ||
| 212 | + var phone: String? = ""// 电话 | ||
| 213 | + var longitude: String? = ""// 经度 | ||
| 214 | + var latitude: String? = ""// 维度 | ||
| 215 | + var state: String? = ""// 状态 | ||
| 216 | +} | ||
| 217 | + | ||
| 218 | +//!!!: 多物流数据源 | ||
| 219 | +class ShopOrderExpressListModel: BaseModel { | ||
| 220 | + var id: String? = ""// 发货单id | ||
| 221 | + var order_id: String? = ""// 订单id | ||
| 222 | + var express: String? = ""// 快递名称 | ||
| 223 | + var express_num: String? = ""// 快递单号 | ||
| 224 | + var simg: String? = ""// 快递logo | ||
| 225 | + var detail_goods = [ShopOrderListGoodsModel]()// 发货单内商品 | ||
| 226 | + var expressNew = ShopOrderExpressDetailDateModel()// 快递信息 | ||
| 227 | +} | ||
| 228 | +//!!!: 物流详情数据 | ||
| 229 | +class ShopOrderExpressDetailModel: BaseModel { | ||
| 230 | + var express = ShopOrderExpressModel()// 快递公司信息 | ||
| 231 | + var data = [ShopOrderExpressDetailDateModel]()// 数据 | ||
| 232 | +} | ||
| 233 | + | ||
| 234 | +//!!!: 物流详情数据 | ||
| 235 | +class ShopOrderExpressDetailDateModel: BaseModel { | ||
| 236 | + var AcceptTime: String? = ""// 时间 | ||
| 237 | + var AcceptStation: String? = ""// 内容 | ||
| 238 | + var accept_time: String? = ""// 时间戳 | ||
| 126 | } | 239 | } |
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 | +typealias clickButtonCallBack = (_ isSelected: Bool) -> Void | ||
| 14 | +typealias clickInputCallBack = (_ content: String, _ row: NSInteger) -> Void | ||
| 15 | +class ShopBodyOrderRefundView: UIView, UITextViewDelegate { | ||
| 16 | + | ||
| 17 | + var clickBlock: clickAgreeCallBack! | ||
| 18 | + | ||
| 19 | + lazy var shadowView: UIView = { | ||
| 20 | + let shadowView = UIView.init() | ||
| 21 | + shadowView.backgroundColor = UIColor(white: 0, alpha: 0.38) | ||
| 22 | + return shadowView | ||
| 23 | + }() | ||
| 24 | + | ||
| 25 | + lazy var alertView: UIView = { | ||
| 26 | + let alertView = UIView.init() | ||
| 27 | + alertView.backgroundColor = .white | ||
| 28 | + alertView.layer.cornerRadius = adapt_length(length: 4) | ||
| 29 | + alertView.layer.masksToBounds = true | ||
| 30 | + return alertView | ||
| 31 | + }() | ||
| 32 | + | ||
| 33 | + lazy var titleLab: UILabel = { | ||
| 34 | + let titleLab = UILabel.init() | ||
| 35 | + titleLab.font = medium_adapt_font(pointSize: 17) | ||
| 36 | + titleLab.textColor = HexColor("#444444") | ||
| 37 | + titleLab.textAlignment = .center | ||
| 38 | + titleLab.text = "拒绝原因" | ||
| 39 | + return titleLab | ||
| 40 | + }() | ||
| 41 | + | ||
| 42 | + lazy var contentBgView: UIView = { | ||
| 43 | + let contentBgView = UIView.init() | ||
| 44 | + contentBgView.backgroundColor = HexColor("#F5F6F8") | ||
| 45 | + contentBgView.layer.cornerRadius = adapt_length(length: 4) | ||
| 46 | + contentBgView.layer.masksToBounds = true | ||
| 47 | + return contentBgView | ||
| 48 | + }() | ||
| 49 | + | ||
| 50 | + lazy var contentTextView: UITextView = { | ||
| 51 | + let contentTextView = UITextView.init(frame: CGRect.zero) | ||
| 52 | + contentTextView.text = "拒单原因,最多不超过100字…" | ||
| 53 | + contentTextView.backgroundColor = HexColor("#F5F6F8") | ||
| 54 | + contentTextView.textColor = UIColor.lightGray | ||
| 55 | + contentTextView.font = regular_adapt_font(pointSize: 14) | ||
| 56 | + contentTextView.delegate = self | ||
| 57 | + contentTextView.returnKeyType = .done | ||
| 58 | + contentTextView.showsVerticalScrollIndicator = false | ||
| 59 | + return contentTextView | ||
| 60 | + }() | ||
| 61 | + | ||
| 62 | + lazy var cancelBtn: UIButton = { | ||
| 63 | + let cancelBtn = UIButton.init(type: .custom) | ||
| 64 | + cancelBtn.setTitle("取消", for: .normal) | ||
| 65 | + cancelBtn.setTitleColor(HexColor("#ffffff"), for: .normal) | ||
| 66 | + cancelBtn.titleLabel?.font = medium_adapt_font(pointSize: 14) | ||
| 67 | + cancelBtn.layer.cornerRadius = adapt_length(length: 4) | ||
| 68 | + cancelBtn.layer.masksToBounds = true | ||
| 69 | + cancelBtn.backgroundColor = HexColor("#F5A623") | ||
| 70 | + cancelBtn.addTarget(self, action: #selector(cancelBtnClick), for: .touchUpInside) | ||
| 71 | + return cancelBtn | ||
| 72 | + }() | ||
| 73 | + | ||
| 74 | + lazy var agreeBtn: UIButton = { | ||
| 75 | + let agreeBtn = UIButton.init(type: .custom) | ||
| 76 | + agreeBtn.setTitle("确认拒绝", for: .normal) | ||
| 77 | + agreeBtn.setTitleColor(HexColor("#ffffff"), for: .normal) | ||
| 78 | + agreeBtn.titleLabel?.font = medium_adapt_font(pointSize: 14) | ||
| 79 | + agreeBtn.layer.cornerRadius = adapt_length(length: 4) | ||
| 80 | + agreeBtn.layer.masksToBounds = true | ||
| 81 | + agreeBtn.backgroundColor = HexColor("#28C1C6") | ||
| 82 | + agreeBtn.addTarget(self, action: #selector(agreeBtnClick), for: .touchUpInside) | ||
| 83 | + return agreeBtn | ||
| 84 | + }() | ||
| 85 | + | ||
| 86 | + override init(frame: CGRect) { | ||
| 87 | + super.init(frame: frame) | ||
| 88 | + addSubview(shadowView) | ||
| 89 | + shadowView.snp.makeConstraints { make in | ||
| 90 | + make.edges.equalToSuperview() | ||
| 91 | + } | ||
| 92 | + addSubview(alertView) | ||
| 93 | + alertView.snp.makeConstraints { make in | ||
| 94 | + make.left.equalToSuperview().offset(adapt_length(length: 30)) | ||
| 95 | + make.right.equalToSuperview().offset(-adapt_length(length: 30)) | ||
| 96 | + make.center.equalToSuperview() | ||
| 97 | + make.height.equalTo(KSreenWidth-adapt_length(length: 60)) | ||
| 98 | + } | ||
| 99 | + alertView.addSubview(titleLab) | ||
| 100 | + titleLab.snp.makeConstraints { make in | ||
| 101 | + make.left.equalToSuperview().offset(adapt_length(length: 20)) | ||
| 102 | + make.top.equalToSuperview().offset(adapt_length(length: 20)) | ||
| 103 | + make.right.equalToSuperview().offset(-adapt_length(length: 20)) | ||
| 104 | + } | ||
| 105 | + alertView.addSubview(contentBgView) | ||
| 106 | + contentBgView.snp.makeConstraints { make in | ||
| 107 | + make.left.equalToSuperview().offset(adapt_length(length: 25)) | ||
| 108 | + make.top.equalTo(titleLab.snp.bottom).offset(adapt_length(length: 15)) | ||
| 109 | + make.right.equalToSuperview().offset(-adapt_length(length: 25)) | ||
| 110 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 60)) | ||
| 111 | + } | ||
| 112 | + contentBgView.addSubview(contentTextView) | ||
| 113 | + contentTextView.snp.makeConstraints { make in | ||
| 114 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 115 | + make.top.equalToSuperview().offset(adapt_length(length: 12)) | ||
| 116 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 117 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 12)) | ||
| 118 | + } | ||
| 119 | + alertView.addSubview(cancelBtn) | ||
| 120 | + cancelBtn.snp.makeConstraints { make in | ||
| 121 | + make.left.equalToSuperview().offset((KSreenWidth-adapt_length(length: 228))/3) | ||
| 122 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 123 | + make.width.equalTo(adapt_length(length: 84)) | ||
| 124 | + make.height.equalTo(adapt_length(length: 30)) | ||
| 125 | + } | ||
| 126 | + alertView.addSubview(agreeBtn) | ||
| 127 | + agreeBtn.snp.makeConstraints { make in | ||
| 128 | + make.right.equalToSuperview().offset(-((KSreenWidth-adapt_length(length: 228))/3)) | ||
| 129 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 130 | + make.width.equalTo(adapt_length(length: 84)) | ||
| 131 | + make.height.equalTo(adapt_length(length: 30)) | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + @objc func agreeBtnClick() { | ||
| 136 | + if (clickBlock != nil) { | ||
| 137 | + self.clickBlock(self, self.contentTextView.text) | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + func textViewDidBeginEditing(_ textView: UITextView) { | ||
| 142 | + if textView.textColor == UIColor.lightGray { | ||
| 143 | + textView.text = nil | ||
| 144 | + textView.textColor = HexColor("#444444") | ||
| 145 | + } | ||
| 146 | + } | ||
| 147 | + | ||
| 148 | + func textViewShouldEndEditing(_ textView: UITextView) -> Bool { | ||
| 149 | + if textView.text.isEmpty { | ||
| 150 | + textView.text = "拒单原因,最多不超过100字…" | ||
| 151 | + textView.textColor = UIColor.lightGray | ||
| 152 | + } | ||
| 153 | + return true | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + func textViewDidChange(_ textView: UITextView) { | ||
| 157 | + if self.contentTextView == textView && self.contentTextView.text.count > 100 { | ||
| 158 | + showMessage(message: "最多不超过100字!!!") | ||
| 159 | + } | ||
| 160 | + } | ||
| 161 | + | ||
| 162 | + func textViewDidEndEditing(_ textView: UITextView) { | ||
| 163 | + if self.contentTextView == textView && self.contentTextView.text.count > 100 { | ||
| 164 | + self.contentTextView.text = self.contentTextView.text.prefix(100).lowercased() | ||
| 165 | + } | ||
| 166 | + } | ||
| 167 | + func textView(_ textView: UITextView, shouldChangeTextIn range: NSRange, replacementText text: String) -> Bool { | ||
| 168 | + if text == "\n" { | ||
| 169 | + self.endEditing(true) | ||
| 170 | + return false | ||
| 171 | + } | ||
| 172 | + return true | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | + override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { | ||
| 176 | + guard let contentTextViewRect = self.contentTextView.superview?.convert(self.contentTextView.frame, to: self) else { return self.contentTextView } | ||
| 177 | + | ||
| 178 | + if !CGRectContainsPoint(contentTextViewRect, point) { | ||
| 179 | + self.endEditing(true) | ||
| 180 | + } | ||
| 181 | + return super.hitTest(point, with: event) | ||
| 182 | + } | ||
| 183 | + | ||
| 184 | + @objc func cancelBtnClick() { | ||
| 185 | + removeFromSuperview() | ||
| 186 | + } | ||
| 187 | + | ||
| 188 | + required init?(coder: NSCoder) { | ||
| 189 | + fatalError("init(coder:) has not been implemented") | ||
| 190 | + } | ||
| 191 | +} | ||
| 192 | + | ||
| 193 | + | ||
| 194 | +class ShopBodyOrderSpliteTableViewCell: UITableViewCell { | ||
| 195 | + | ||
| 196 | + | ||
| 197 | + lazy var goodsImageView: UIImageView = { | ||
| 198 | + let goodsImageView = UIImageView.init() | ||
| 199 | + goodsImageView.backgroundColor = .white | ||
| 200 | + goodsImageView.contentMode = .scaleAspectFill | ||
| 201 | + goodsImageView.layer.masksToBounds = true | ||
| 202 | + return goodsImageView | ||
| 203 | + }() | ||
| 204 | + | ||
| 205 | + lazy var goodsTitle: UILabel = { | ||
| 206 | + let goodsTitle = UILabel.init() | ||
| 207 | + goodsTitle.lineBreakMode = .byClipping | ||
| 208 | + goodsTitle.numberOfLines = 2 | ||
| 209 | + goodsTitle.textColor = HexColor("#333333") | ||
| 210 | + goodsTitle.font = regular_adapt_font(pointSize: 14) | ||
| 211 | + return goodsTitle | ||
| 212 | + }() | ||
| 213 | + | ||
| 214 | + lazy var priceLabel: UILabel = { | ||
| 215 | + let priceLabel = UILabel.init() | ||
| 216 | + priceLabel.textColor = HexColor("#FC1541") | ||
| 217 | + priceLabel.font = medium_adapt_font(pointSize: 21) | ||
| 218 | + return priceLabel | ||
| 219 | + }() | ||
| 220 | + | ||
| 221 | + lazy var numberLabel: UILabel = { | ||
| 222 | + let numberLabel = UILabel.init() | ||
| 223 | + numberLabel.textAlignment = .right | ||
| 224 | + numberLabel.textColor = HexColor("#222833") | ||
| 225 | + numberLabel.font = regular_adapt_font(pointSize: 15) | ||
| 226 | + return numberLabel | ||
| 227 | + }() | ||
| 228 | + | ||
| 229 | + lazy var lineLabel: UILabel = { | ||
| 230 | + let lineLabel = UILabel.init() | ||
| 231 | + lineLabel.backgroundColor = HexColor("#EAEAEA") | ||
| 232 | + return lineLabel | ||
| 233 | + }() | ||
| 234 | + | ||
| 235 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 236 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 237 | + contentView.backgroundColor = .clear | ||
| 238 | + selectionStyle = .none | ||
| 239 | + | ||
| 240 | + addSubview(goodsImageView) | ||
| 241 | + goodsImageView.snp.makeConstraints { make in | ||
| 242 | + make.left.top.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 243 | + make.size.equalTo(adapt_length(length: 100)) | ||
| 244 | + } | ||
| 245 | + addSubview(goodsTitle) | ||
| 246 | + goodsTitle.snp.makeConstraints { make in | ||
| 247 | + make.top.equalTo(goodsImageView) | ||
| 248 | + make.left.equalTo(goodsImageView.snp.right).offset(adapt_length(length: 15)) | ||
| 249 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 250 | + } | ||
| 251 | + addSubview(priceLabel) | ||
| 252 | + priceLabel.snp.makeConstraints { make in | ||
| 253 | + make.left.equalTo(goodsTitle) | ||
| 254 | + make.bottom.equalTo(goodsImageView) | ||
| 255 | + } | ||
| 256 | + addSubview(numberLabel) | ||
| 257 | + numberLabel.snp.makeConstraints { make in | ||
| 258 | + make.right.equalToSuperview().offset(-adapt_length(length: 10)) | ||
| 259 | + make.bottom.equalTo(goodsImageView) | ||
| 260 | + } | ||
| 261 | + addSubview(lineLabel) | ||
| 262 | + lineLabel.snp.makeConstraints { make in | ||
| 263 | + make.left.equalTo(goodsImageView) | ||
| 264 | + make.right.equalTo(numberLabel) | ||
| 265 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 0.5)) | ||
| 266 | + make.height.equalTo(adapt_length(length: 0.5)) | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + | ||
| 270 | + func setupDataSource(goodsModel: ShopOrderListGoodsModel) { | ||
| 271 | + 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)))) | ||
| 272 | + goodsTitle.text = goodsModel.title | ||
| 273 | + priceLabel.text = "¥ \(goodsModel.price ?? 0.00)" | ||
| 274 | + priceLabel.sizeToFit() | ||
| 275 | + numberLabel.text = "x \(goodsModel.num ?? 0)" | ||
| 276 | + numberLabel.sizeToFit() | ||
| 277 | + setNeedsLayout() | ||
| 278 | + } | ||
| 279 | + | ||
| 280 | + required init?(coder: NSCoder) { | ||
| 281 | + fatalError("init(coder:) has not been implemented") | ||
| 282 | + } | ||
| 283 | +} | ||
| 284 | + | ||
| 285 | + | ||
| 286 | +class ShopBodyOrderSelectTableViewCell: UITableViewCell { | ||
| 287 | + | ||
| 288 | + lazy var goodsImageView: UIImageView = { | ||
| 289 | + let goodsImageView = UIImageView.init() | ||
| 290 | + goodsImageView.backgroundColor = .white | ||
| 291 | + goodsImageView.contentMode = .scaleAspectFill | ||
| 292 | + goodsImageView.layer.masksToBounds = true | ||
| 293 | + return goodsImageView | ||
| 294 | + }() | ||
| 295 | + | ||
| 296 | + lazy var goodsTitle: UILabel = { | ||
| 297 | + let goodsTitle = UILabel.init() | ||
| 298 | + goodsTitle.lineBreakMode = .byClipping | ||
| 299 | + goodsTitle.numberOfLines = 2 | ||
| 300 | + goodsTitle.textColor = HexColor("#333333") | ||
| 301 | + goodsTitle.font = regular_adapt_font(pointSize: 14) | ||
| 302 | + return goodsTitle | ||
| 303 | + }() | ||
| 304 | + | ||
| 305 | + lazy var priceLabel: UILabel = { | ||
| 306 | + let priceLabel = UILabel.init() | ||
| 307 | + priceLabel.textColor = HexColor("#FC1541") | ||
| 308 | + priceLabel.font = medium_adapt_font(pointSize: 21) | ||
| 309 | + return priceLabel | ||
| 310 | + }() | ||
| 311 | + | ||
| 312 | + lazy var numberLabel: UILabel = { | ||
| 313 | + let numberLabel = UILabel.init() | ||
| 314 | + numberLabel.textAlignment = .right | ||
| 315 | + numberLabel.textColor = HexColor("#222833") | ||
| 316 | + numberLabel.font = regular_adapt_font(pointSize: 15) | ||
| 317 | + return numberLabel | ||
| 318 | + }() | ||
| 319 | + | ||
| 320 | + lazy var unNumberLabel: UILabel = { | ||
| 321 | + let unNumberLabel = UILabel.init() | ||
| 322 | + unNumberLabel.textAlignment = .right | ||
| 323 | + unNumberLabel.textColor = HexColor("#222833") | ||
| 324 | + unNumberLabel.font = regular_adapt_font(pointSize: 15) | ||
| 325 | + return unNumberLabel | ||
| 326 | + }() | ||
| 327 | + | ||
| 328 | + lazy var lineLabel: UILabel = { | ||
| 329 | + let lineLabel = UILabel.init() | ||
| 330 | + lineLabel.backgroundColor = HexColor("#EAEAEA") | ||
| 331 | + return lineLabel | ||
| 332 | + }() | ||
| 333 | + | ||
| 334 | + lazy var selectButton: UIButton = { | ||
| 335 | + let selectButton = UIButton.init(type: .custom) | ||
| 336 | + selectButton.setImage(UIImage(named: "DS_goods_select_no"), for: .normal) | ||
| 337 | + selectButton.setImage(UIImage(named: "DS_goods_select_yes"), for: .selected) | ||
| 338 | + selectButton.addTarget(self, action: #selector(buttonClick), for: .touchUpInside) | ||
| 339 | + selectButton.tag = 1001 | ||
| 340 | + return selectButton | ||
| 341 | + }() | ||
| 342 | + | ||
| 343 | + lazy var addButton: UIButton = { | ||
| 344 | + let addButton = UIButton.init(type: .custom) | ||
| 345 | + addButton.setImage(UIImage(named: "DS_goods_add_yes"), for: .normal) | ||
| 346 | + addButton.setImage(UIImage(named: "DS_goods_add_no"), for: .selected) | ||
| 347 | + addButton.addTarget(self, action: #selector(buttonClick), for: .touchUpInside) | ||
| 348 | + addButton.tag = 1002 | ||
| 349 | + return addButton | ||
| 350 | + }() | ||
| 351 | + | ||
| 352 | + lazy var minusButton: UIButton = { | ||
| 353 | + let minusButton = UIButton(type: .custom) | ||
| 354 | + minusButton.setImage(UIImage(named: "DS_goods_sub_yes"), for: .normal) | ||
| 355 | + minusButton.setImage(UIImage(named: "DS_goods_sub_no"), for: .selected) | ||
| 356 | + minusButton.addTarget(self, action: #selector(buttonClick), for: .touchUpInside) | ||
| 357 | + minusButton.tag = 1003 | ||
| 358 | + return minusButton | ||
| 359 | + }() | ||
| 360 | + | ||
| 361 | + var clickCallBack: clickButtonCallBack! | ||
| 362 | + var _goodsModel: ShopOrderListGoodsModel! | ||
| 363 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 364 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 365 | + contentView.backgroundColor = .clear | ||
| 366 | + selectionStyle = .none | ||
| 367 | + | ||
| 368 | + addSubview(selectButton) | ||
| 369 | + selectButton.snp.makeConstraints { make in | ||
| 370 | + make.centerY.equalToSuperview() | ||
| 371 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 372 | + make.size.equalTo(adapt_length(length: 17)) | ||
| 373 | + } | ||
| 374 | + addSubview(goodsImageView) | ||
| 375 | + goodsImageView.snp.makeConstraints { make in | ||
| 376 | + make.centerY.equalToSuperview() | ||
| 377 | + make.left.equalTo(selectButton.snp.right).offset(adapt_length(length: 15)) | ||
| 378 | + make.size.equalTo(adapt_length(length: 100)) | ||
| 379 | + } | ||
| 380 | + addSubview(goodsTitle) | ||
| 381 | + goodsTitle.snp.makeConstraints { make in | ||
| 382 | + make.top.equalTo(goodsImageView) | ||
| 383 | + make.left.equalTo(goodsImageView.snp.right).offset(adapt_length(length: 15)) | ||
| 384 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 385 | + } | ||
| 386 | + addSubview(unNumberLabel) | ||
| 387 | + unNumberLabel.snp.makeConstraints { make in | ||
| 388 | + make.left.equalTo(goodsTitle) | ||
| 389 | + make.top.equalTo(goodsTitle.snp.bottom).offset(adapt_length(length: 5)) | ||
| 390 | + } | ||
| 391 | + addSubview(addButton) | ||
| 392 | + addButton.snp.makeConstraints { make in | ||
| 393 | + make.right.bottom.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 394 | + make.size.equalTo(adapt_length(length: 29)) | ||
| 395 | + } | ||
| 396 | + addSubview(numberLabel) | ||
| 397 | + numberLabel.snp.makeConstraints { make in | ||
| 398 | + make.right.equalTo(addButton.snp.left).offset(-adapt_length(length: 6)) | ||
| 399 | + make.centerY.equalTo(addButton) | ||
| 400 | + } | ||
| 401 | + addSubview(minusButton) | ||
| 402 | + minusButton.snp.makeConstraints { make in | ||
| 403 | + make.right.equalTo(numberLabel.snp.left).offset(-adapt_length(length: 6)) | ||
| 404 | + make.centerY.equalTo(addButton) | ||
| 405 | + } | ||
| 406 | + addSubview(priceLabel) | ||
| 407 | + priceLabel.snp.makeConstraints { make in | ||
| 408 | + make.left.equalTo(goodsTitle) | ||
| 409 | + make.bottom.equalTo(goodsImageView) | ||
| 410 | + } | ||
| 411 | + addSubview(lineLabel) | ||
| 412 | + lineLabel.snp.makeConstraints { make in | ||
| 413 | + make.left.equalTo(goodsImageView) | ||
| 414 | + make.right.equalTo(numberLabel) | ||
| 415 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 0.5)) | ||
| 416 | + make.height.equalTo(adapt_length(length: 0.5)) | ||
| 417 | + } | ||
| 418 | + } | ||
| 419 | + | ||
| 420 | + @objc func buttonClick(sender: UIButton) { | ||
| 421 | + if sender.tag - 1000 != 1 { | ||
| 422 | + if sender.isSelected { | ||
| 423 | + return | ||
| 424 | + } | ||
| 425 | + var selectNum = _goodsModel.selectNum | ||
| 426 | + switch sender.tag - 1001 { | ||
| 427 | + case 1: | ||
| 428 | + selectNum! += 1 | ||
| 429 | + break | ||
| 430 | + case 2: | ||
| 431 | + selectNum! -= 1 | ||
| 432 | + default: | ||
| 433 | + break | ||
| 434 | + } | ||
| 435 | + _goodsModel.selectNum = selectNum | ||
| 436 | + numberLabel.text = "\(_goodsModel.selectNum ?? 0)" | ||
| 437 | + numberLabel.sizeToFit() | ||
| 438 | + setNeedsLayout() | ||
| 439 | + if unNumberLabel.isHidden { | ||
| 440 | + if _goodsModel.num! <= _goodsModel.selectNum! { | ||
| 441 | + addButton.isSelected = true | ||
| 442 | + } else { | ||
| 443 | + addButton.isSelected = false | ||
| 444 | + } | ||
| 445 | + } else { | ||
| 446 | + if _goodsModel.send_num! - _goodsModel.refund_num! <= _goodsModel.selectNum! { | ||
| 447 | + addButton.isSelected = true | ||
| 448 | + } else { | ||
| 449 | + addButton.isSelected = false | ||
| 450 | + } | ||
| 451 | + } | ||
| 452 | + if _goodsModel.selectNum! > 1 { | ||
| 453 | + minusButton.isSelected = false | ||
| 454 | + } else { | ||
| 455 | + minusButton.isSelected = true | ||
| 456 | + } | ||
| 457 | + } else { | ||
| 458 | + sender.isSelected = !sender.isSelected | ||
| 459 | + _goodsModel.select = sender.isSelected | ||
| 460 | + if (clickCallBack != nil) { | ||
| 461 | + self.clickCallBack(sender.isSelected) | ||
| 462 | + } | ||
| 463 | + } | ||
| 464 | + } | ||
| 465 | + | ||
| 466 | + func setupDataSource(goodsModel: ShopOrderListGoodsModel) { | ||
| 467 | + _goodsModel = goodsModel | ||
| 468 | + goodsImageView.kf.setImage(with: URL(string: goodsModel.simg!)) | ||
| 469 | + goodsTitle.text = goodsModel.title | ||
| 470 | + unNumberLabel.text = "剩余发货数量:\(Int(goodsModel.send_num!)-Int(goodsModel.refund_num!))" | ||
| 471 | + unNumberLabel.isHidden = (Int(goodsModel.send_num!)-Int(goodsModel.refund_num!) == 0) | ||
| 472 | + unNumberLabel.sizeToFit() | ||
| 473 | + priceLabel.text = "¥ \(goodsModel.price!)" | ||
| 474 | + priceLabel.sizeToFit() | ||
| 475 | + numberLabel.text = "\(goodsModel.selectNum ?? 0)" | ||
| 476 | + numberLabel.sizeToFit() | ||
| 477 | + | ||
| 478 | + setNeedsLayout() | ||
| 479 | + | ||
| 480 | + if unNumberLabel.isHidden { | ||
| 481 | + if goodsModel.num! > goodsModel.selectNum! { | ||
| 482 | + addButton.isSelected = false | ||
| 483 | + } else { | ||
| 484 | + addButton.isSelected = true | ||
| 485 | + } | ||
| 486 | + } else { | ||
| 487 | + if (goodsModel.send_num! - goodsModel.refund_num! > goodsModel.selectNum!) { | ||
| 488 | + addButton.isSelected = false | ||
| 489 | + } else { | ||
| 490 | + addButton.isSelected = true | ||
| 491 | + } | ||
| 492 | + } | ||
| 493 | + if goodsModel.selectNum! > 1 { | ||
| 494 | + minusButton.isSelected = false | ||
| 495 | + } else { | ||
| 496 | + minusButton.isSelected = true | ||
| 497 | + } | ||
| 498 | + selectButton.isSelected = goodsModel.select | ||
| 499 | + } | ||
| 500 | + | ||
| 501 | + required init?(coder: NSCoder) { | ||
| 502 | + fatalError("init(coder:) has not been implemented") | ||
| 503 | + } | ||
| 504 | +} | ||
| 505 | + | ||
| 506 | +class ShopBodyOrderExpressTableViewCell: UITableViewCell, UITextFieldDelegate { | ||
| 507 | + | ||
| 508 | + lazy var titleLab: UILabel = { | ||
| 509 | + let titleLab = UILabel.init() | ||
| 510 | + titleLab.textColor = HexColor("#3a3a3a") | ||
| 511 | + titleLab.font = medium_adapt_font(pointSize: 14) | ||
| 512 | + return titleLab | ||
| 513 | + }() | ||
| 514 | + | ||
| 515 | + lazy var contentTextField: UITextField = { | ||
| 516 | + let contentTextField = UITextField.init() | ||
| 517 | + contentTextField.textColor = HexColor("#3a3a3a") | ||
| 518 | + contentTextField.font = medium_adapt_font(pointSize: 14) | ||
| 519 | + contentTextField.textAlignment = .left | ||
| 520 | + contentTextField.clipsToBounds = true | ||
| 521 | + contentTextField.keyboardType = .default | ||
| 522 | + contentTextField.delegate = self | ||
| 523 | + contentTextField.returnKeyType = .done | ||
| 524 | + return contentTextField | ||
| 525 | + }() | ||
| 526 | + | ||
| 527 | + lazy var rightArrowImageView: UIImageView = { | ||
| 528 | + let rightArrowImageView = UIImageView.init() | ||
| 529 | + rightArrowImageView.image = UIImage(named: "mine_header_message_gray_more") | ||
| 530 | + return rightArrowImageView | ||
| 531 | + }() | ||
| 532 | + | ||
| 533 | + lazy var lineLabel: UILabel = { | ||
| 534 | + let lineLabel = UILabel.init() | ||
| 535 | + lineLabel.backgroundColor = HexColor("#EAEAEA") | ||
| 536 | + return lineLabel | ||
| 537 | + }() | ||
| 538 | + | ||
| 539 | + var row: NSInteger! | ||
| 540 | + var clickBlock: clickInputCallBack! | ||
| 541 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 542 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 543 | + contentView.backgroundColor = .clear | ||
| 544 | + selectionStyle = .none | ||
| 545 | + | ||
| 546 | + addSubview(titleLab) | ||
| 547 | + titleLab.snp.makeConstraints { make in | ||
| 548 | + make.centerY.equalToSuperview() | ||
| 549 | + make.width.equalTo(adapt_length(length: 100)) | ||
| 550 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 551 | + } | ||
| 552 | + addSubview(rightArrowImageView) | ||
| 553 | + rightArrowImageView.snp.makeConstraints { make in | ||
| 554 | + make.centerY.equalToSuperview() | ||
| 555 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 556 | + make.size.equalTo(adapt_length(length: 12)) | ||
| 557 | + } | ||
| 558 | + addSubview(contentTextField) | ||
| 559 | + contentTextField.snp.makeConstraints { make in | ||
| 560 | + make.centerY.equalToSuperview() | ||
| 561 | + make.left.equalTo(titleLab.snp.right).offset(adapt_length(length: 15)) | ||
| 562 | + make.right.equalTo(rightArrowImageView.snp.left).offset(-adapt_length(length: 10)) | ||
| 563 | + } | ||
| 564 | + addSubview(lineLabel) | ||
| 565 | + lineLabel.snp.makeConstraints { make in | ||
| 566 | + make.left.equalTo(adapt_length(length: 10)) | ||
| 567 | + make.right.equalTo(-adapt_length(length: 10)) | ||
| 568 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 0.5)) | ||
| 569 | + make.height.equalTo(adapt_length(length: 0.5)) | ||
| 570 | + } | ||
| 571 | + } | ||
| 572 | + | ||
| 573 | + func setup(title: String, content: String, placeHolder: String, contentIsEdit: Bool, isShowArrowImage: Bool, isShowLine: Bool) { | ||
| 574 | + titleLab.text = title | ||
| 575 | + contentTextField.text = content | ||
| 576 | + contentTextField.placeholder = placeHolder | ||
| 577 | + contentTextField.isUserInteractionEnabled = contentIsEdit | ||
| 578 | + rightArrowImageView.isHidden = !isShowArrowImage | ||
| 579 | + lineLabel.isHidden = !isShowLine | ||
| 580 | + | ||
| 581 | + let size = contentTextField.sizeThatFits(CGSize(width: KSreenWidth - adapt_length(length: 145), height: CGFLOAT_MAX)) | ||
| 582 | + | ||
| 583 | + contentTextField.snp.remakeConstraints { make in | ||
| 584 | + make.left.equalTo(titleLab.snp.right).offset(adapt_length(length: 15)) | ||
| 585 | + make.top.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 586 | + if rightArrowImageView.isHidden { | ||
| 587 | + make.right.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 588 | + make.height.equalTo(size.height > adapt_length(length: 20) ? size.height : adapt_length(length: 20)) | ||
| 589 | + } else { | ||
| 590 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 15)) | ||
| 591 | + make.right.equalTo(rightArrowImageView.snp.left).offset(-adapt_length(length: 5)) | ||
| 592 | + } | ||
| 593 | + } | ||
| 594 | + } | ||
| 595 | + | ||
| 596 | + func textFieldDidEndEditing(_ textField: UITextField) { | ||
| 597 | + if textField == contentTextField { | ||
| 598 | + if (clickBlock != nil) { | ||
| 599 | + clickBlock(contentTextField.text!,row) | ||
| 600 | + } | ||
| 601 | + } | ||
| 602 | + } | ||
| 603 | + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { | ||
| 604 | + if string == "\n" || contentTextField.text!.count > 20 { | ||
| 605 | + return false | ||
| 606 | + } else { | ||
| 607 | + return true | ||
| 608 | + } | ||
| 609 | + } | ||
| 610 | + | ||
| 611 | + | ||
| 612 | + required init?(coder: NSCoder) { | ||
| 613 | + fatalError("init(coder:) has not been implemented") | ||
| 614 | + } | ||
| 615 | +} | ||
| 616 | + | ||
| 617 | + | ||
| 618 | +class ShopBodyOrderExpressFirmTableViewCell: UITableViewCell { | ||
| 619 | + | ||
| 620 | + lazy var headerImageView: UIImageView = { | ||
| 621 | + let headerImageView = UIImageView.init() | ||
| 622 | + headerImageView.backgroundColor = .white | ||
| 623 | + headerImageView.contentMode = .scaleAspectFill | ||
| 624 | + headerImageView.layer.masksToBounds = true | ||
| 625 | + return headerImageView | ||
| 626 | + }() | ||
| 627 | + | ||
| 628 | + lazy var titleLabel: UILabel = { | ||
| 629 | + let titleLabel = UILabel.init() | ||
| 630 | + titleLabel.textColor = HexColor("#383838") | ||
| 631 | + titleLabel.font = regular_adapt_font(pointSize: 15) | ||
| 632 | + return titleLabel | ||
| 633 | + }() | ||
| 634 | + | ||
| 635 | + lazy var descLabel: UILabel = { | ||
| 636 | + let descLabel = UILabel.init() | ||
| 637 | + descLabel.textColor = HexColor("#a5a5a5") | ||
| 638 | + descLabel.font = light_adapt_font(pointSize: 14) | ||
| 639 | + return descLabel | ||
| 640 | + }() | ||
| 641 | + | ||
| 642 | + lazy var lineLabel: UILabel = { | ||
| 643 | + let lineLabel = UILabel.init() | ||
| 644 | + lineLabel.backgroundColor = HexColor("#EAEAEA") | ||
| 645 | + return lineLabel | ||
| 646 | + }() | ||
| 647 | + | ||
| 648 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 649 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 650 | + contentView.backgroundColor = .clear | ||
| 651 | + selectionStyle = .none | ||
| 652 | + | ||
| 653 | + addSubview(headerImageView) | ||
| 654 | + headerImageView.snp.makeConstraints { make in | ||
| 655 | + make.centerY.equalToSuperview() | ||
| 656 | + make.left.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 657 | + make.size.equalTo(adapt_length(length: 36)) | ||
| 658 | + } | ||
| 659 | + addSubview(titleLabel) | ||
| 660 | + titleLabel.snp.makeConstraints { make in | ||
| 661 | + make.top.equalTo(headerImageView.snp.top) | ||
| 662 | + make.left.equalTo(headerImageView.snp.right).offset(adapt_length(length: 10)) | ||
| 663 | + } | ||
| 664 | + addSubview(descLabel) | ||
| 665 | + descLabel.snp.makeConstraints { make in | ||
| 666 | + make.bottom.equalTo(headerImageView.snp.bottom) | ||
| 667 | + make.left.equalTo(headerImageView.snp.right).offset(adapt_length(length: 10)) | ||
| 668 | + } | ||
| 669 | + addSubview(lineLabel) | ||
| 670 | + lineLabel.snp.makeConstraints { make in | ||
| 671 | + make.left.equalTo(adapt_length(length: 10)) | ||
| 672 | + make.right.equalTo(-adapt_length(length: 10)) | ||
| 673 | + make.bottom.equalToSuperview().offset(-adapt_length(length: 0.5)) | ||
| 674 | + make.height.equalTo(adapt_length(length: 0.5)) | ||
| 675 | + } | ||
| 676 | + } | ||
| 677 | + | ||
| 678 | + func setupDataSource(model: ShopOrderExpressModel) { | ||
| 679 | + headerImageView.kf.setImage(with: URL(string: model.simg!)) | ||
| 680 | + titleLabel.text = model.com | ||
| 681 | + descLabel.text = model.tel | ||
| 682 | + } | ||
| 683 | + | ||
| 684 | + required init?(coder: NSCoder) { | ||
| 685 | + fatalError("init(coder:) has not been implemented") | ||
| 686 | + } | ||
| 687 | +} |
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/CNLiveShopBodyExpressView.swift
0 → 100644
| 1 | +// | ||
| 2 | +// CNLiveShopBodyExpressView.swift | ||
| 3 | +// metaCode | ||
| 4 | +// | ||
| 5 | +// Created by open on 2023/11/8. | ||
| 6 | +// | ||
| 7 | + | ||
| 8 | +import Foundation | ||
| 9 | + | ||
| 10 | +class ShopBodyOrderExpressListTableViewCell: UITableViewCell { | ||
| 11 | + | ||
| 12 | + lazy var logoImageView: UIImageView = { | ||
| 13 | + let logoImageView = UIImageView.init() | ||
| 14 | + logoImageView.backgroundColor = .white | ||
| 15 | + return logoImageView | ||
| 16 | + }() | ||
| 17 | + | ||
| 18 | + lazy var expressName: UILabel = { | ||
| 19 | + let expressName = UILabel.init() | ||
| 20 | + expressName.textColor = HexColor("#333333") | ||
| 21 | + expressName.font = medium_font(pointSize: 14) | ||
| 22 | + return expressName | ||
| 23 | + }() | ||
| 24 | + | ||
| 25 | + lazy var expressNo: UILabel = { | ||
| 26 | + let expressNo = UILabel.init() | ||
| 27 | + expressNo.textColor = HexColor("#b4b4b4") | ||
| 28 | + expressNo.font = regular_font(pointSize: 12) | ||
| 29 | + return expressNo | ||
| 30 | + }() | ||
| 31 | + | ||
| 32 | + lazy var expressCopy: UIButton = { | ||
| 33 | + let expressCopy = UIButton.init(type: .custom) | ||
| 34 | + expressCopy.backgroundColor = .white | ||
| 35 | + expressCopy.setTitle("复制单号", for: .normal) | ||
| 36 | + expressCopy.layer.cornerRadius = 4 | ||
| 37 | + expressCopy.titleLabel?.font = medium_font(pointSize: 14) | ||
| 38 | + expressCopy.setTitleColor(HexColor("#28c1c6"), for: .normal) | ||
| 39 | + expressCopy.contentHorizontalAlignment = .center | ||
| 40 | + expressCopy.layer.borderWidth = 1 | ||
| 41 | + expressCopy.layer.borderColor = HexColor("#28c1c6")?.cgColor | ||
| 42 | + expressCopy.addTarget(self, action: #selector(actionClick), for: .touchUpInside) | ||
| 43 | + return expressCopy | ||
| 44 | + }() | ||
| 45 | + | ||
| 46 | + lazy var expressTime: UILabel = { | ||
| 47 | + let expressTime = UILabel.init() | ||
| 48 | + expressTime.font = regular_font(pointSize: 12) | ||
| 49 | + expressTime.textColor = HexColor("#333333") | ||
| 50 | + return expressTime | ||
| 51 | + }() | ||
| 52 | + | ||
| 53 | + lazy var expressAddress: UILabel = { | ||
| 54 | + let expressAddress = UILabel.init() | ||
| 55 | + expressAddress.font = regular_font(pointSize: 12) | ||
| 56 | + expressAddress.textColor = HexColor("#333333") | ||
| 57 | + expressAddress.numberOfLines = 0 | ||
| 58 | + return expressAddress | ||
| 59 | + }() | ||
| 60 | + | ||
| 61 | + lazy var totleExpress: UILabel = { | ||
| 62 | + let totleExpress = UILabel.init() | ||
| 63 | + totleExpress.textColor = HexColor("#9b9b9b") | ||
| 64 | + totleExpress.font = regular_font(pointSize: 12) | ||
| 65 | + return totleExpress | ||
| 66 | + }() | ||
| 67 | + | ||
| 68 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
| 69 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
| 70 | + contentView.backgroundColor = .clear | ||
| 71 | + selectionStyle = .none | ||
| 72 | + | ||
| 73 | + addSubview(logoImageView) | ||
| 74 | + logoImageView.snp.makeConstraints { make in | ||
| 75 | + make.left.top.equalToSuperview().offset(adapt_length(length: 15)) | ||
| 76 | + make.size.equalTo(adapt_length(length: 39.68)) | ||
| 77 | + } | ||
| 78 | + addSubview(expressName) | ||
| 79 | + expressName.snp.makeConstraints { make in | ||
| 80 | + make.top.equalTo(logoImageView.snp.top).offset(adapt_length(length: 0.5)) | ||
| 81 | + | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + var _listModel: ShopOrderExpressListModel! | ||
| 86 | + func setupDataSource(listModel: ShopOrderExpressListModel) { | ||
| 87 | + _listModel = listModel | ||
| 88 | + | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + @objc func actionClick() { | ||
| 92 | + | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + required init?(coder: NSCoder) { | ||
| 96 | + fatalError("init(coder:) has not been implemented") | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + | ||
| 100 | +} |
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyListView.swift
| @@ -19,7 +19,7 @@ enum CNDSOrderListSectionFooterBtnClickEvent { | @@ -19,7 +19,7 @@ enum CNDSOrderListSectionFooterBtnClickEvent { | ||
| 19 | case expDetail //物流详情 | 19 | case expDetail //物流详情 |
| 20 | case none | 20 | case none |
| 21 | } | 21 | } |
| 22 | -typealias clickRightBtnCallBack = (_ event: CNDSOrderListSectionFooterBtnClickEvent,_ listModel :ShopOrderListModel) -> Void | 22 | +typealias clickRightBtnCallBack = (_ title: String,_ event: CNDSOrderListSectionFooterBtnClickEvent,_ listModel :ShopOrderListModel) -> Void |
| 23 | class ShopBodyOrderFooterViewCell: UITableViewHeaderFooterView { | 23 | class ShopBodyOrderFooterViewCell: UITableViewHeaderFooterView { |
| 24 | 24 | ||
| 25 | lazy var addressLabel: UILabel = { | 25 | lazy var addressLabel: UILabel = { |
| @@ -118,14 +118,14 @@ class ShopBodyOrderFooterViewCell: UITableViewHeaderFooterView { | @@ -118,14 +118,14 @@ class ShopBodyOrderFooterViewCell: UITableViewHeaderFooterView { | ||
| 118 | @objc func rightBtnClick(button: UIButton) { | 118 | @objc func rightBtnClick(button: UIButton) { |
| 119 | 119 | ||
| 120 | var clickEvent: CNDSOrderListSectionFooterBtnClickEvent! = CNDSOrderListSectionFooterBtnClickEvent.none | 120 | var clickEvent: CNDSOrderListSectionFooterBtnClickEvent! = CNDSOrderListSectionFooterBtnClickEvent.none |
| 121 | - | 121 | + |
| 122 | if button.titleLabel?.text == "快递发货" { | 122 | if button.titleLabel?.text == "快递发货" { |
| 123 | if _listModel.state == "2" { | 123 | if _listModel.state == "2" { |
| 124 | if _listModel.order_detail.count > 1 { | 124 | if _listModel.order_detail.count > 1 { |
| 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 |
| @@ -159,7 +159,7 @@ class ShopBodyOrderFooterViewCell: UITableViewHeaderFooterView { | @@ -159,7 +159,7 @@ class ShopBodyOrderFooterViewCell: UITableViewHeaderFooterView { | ||
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | if (_listModel != nil) && (clickRightBtnCallBack != nil) { | 161 | if (_listModel != nil) && (clickRightBtnCallBack != nil) { |
| 162 | - self.clickRightBtnCallBack(clickEvent, _listModel) | 162 | + self.clickRightBtnCallBack((button.titleLabel?.text)!, clickEvent, _listModel) |
| 163 | } | 163 | } |
| 164 | } | 164 | } |
| 165 | 165 |
metaCode/Classes/Main/ShopPage/ViewModel/CNLiveShopViewModel.swift
| @@ -149,7 +149,332 @@ class CNLiveShopViewModel: NSObject { | @@ -149,7 +149,332 @@ 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 = "" | ||
| 249 | + let param = NSMutableDictionary() | ||
| 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 | + } | ||
| 257 | + let custom_param = NSMutableDictionary() | ||
| 258 | + custom_param.setValue(APPId_wjj, forKey: "appId") | ||
| 259 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | ||
| 260 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 261 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 262 | + CNLiveNetworking.setupDSRequest(true) | ||
| 263 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 264 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+url, param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 265 | + hiddenLoading() | ||
| 266 | + if (error == nil) { | ||
| 267 | + let resp = result as! NSDictionary | ||
| 268 | + let errorCode = "\(resp["code"] ?? "0")" | ||
| 269 | + if (errorCode == "200") { | ||
| 270 | + if resp["data"] is NSNull { | ||
| 271 | + resultBlock(NSNull(),.failed) | ||
| 272 | + } else { | ||
| 273 | + resultBlock(isAgree ? "退款成功" : "拒绝退款成功",.success) | ||
| 274 | + } | ||
| 275 | + } else { | ||
| 276 | + showMessage(message: resp["message"] as! String) | ||
| 277 | + resultBlock(NSNull(),.failed) | ||
| 278 | + } | ||
| 279 | + } else { | ||
| 280 | + if CNLiveNetworking.isNetworking() { | ||
| 281 | + showMessage(message: "请求失败") | ||
| 282 | + resultBlock(NSNull(),.failed) | ||
| 283 | + } else { | ||
| 284 | + showMessage(message: "似乎与网络断开链接") | ||
| 285 | + resultBlock(NSNull(),.noNetwork) | ||
| 286 | + } | ||
| 287 | + } | ||
| 288 | + } | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + /// 获取商家店铺列表 | ||
| 292 | + /// - Parameter resultBlock: 返回 | ||
| 293 | + static func requestSellerStore(resultBlock: @escaping resultShopBlock) { | ||
| 294 | + let param = NSMutableDictionary() | ||
| 295 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "id") | ||
| 296 | + let custom_param = NSMutableDictionary() | ||
| 297 | + custom_param.setValue(APPId_wjj, forKey: "appId") | ||
| 298 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | ||
| 299 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 300 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 301 | + CNLiveNetworking.setupDSRequest(true) | ||
| 302 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 303 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/sellerStore", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 304 | + hiddenLoading() | ||
| 305 | + if (error == nil) { | ||
| 306 | + let resp = result as! NSDictionary | ||
| 307 | + let errorCode = "\(resp["code"] ?? "0")" | ||
| 308 | + if (errorCode == "200") { | ||
| 309 | + if resp["data"] is NSNull { | ||
| 310 | + resultBlock(NSNull(),.failed) | ||
| 311 | + } else { | ||
| 312 | + let resp_dict = resp["data"] as! NSDictionary | ||
| 313 | + let array = resp_dict["data"] as! NSArray | ||
| 314 | + let tempArray = NSMutableArray() | ||
| 315 | + let textArray = NSMutableArray() | ||
| 316 | + for item in array { | ||
| 317 | + let listModel = dictionaryToModel(item as! [String : Any], ShopOrderStoreModel.self,"") as! ShopOrderStoreModel | ||
| 318 | + tempArray.add(listModel) | ||
| 319 | + textArray.add(listModel.title! as String) | ||
| 320 | + } | ||
| 321 | + resultBlock([tempArray,textArray], .success) | ||
| 322 | + } | ||
| 323 | + } else { | ||
| 324 | + showMessage(message: resp["message"] as! String) | ||
| 325 | + resultBlock(NSNull(),.failed) | ||
| 326 | + } | ||
| 327 | + } else { | ||
| 328 | + if CNLiveNetworking.isNetworking() { | ||
| 329 | + showMessage(message: "请求失败") | ||
| 330 | + resultBlock(NSNull(),.failed) | ||
| 331 | + } else { | ||
| 332 | + showMessage(message: "似乎与网络断开链接") | ||
| 333 | + resultBlock(NSNull(),.noNetwork) | ||
| 334 | + } | ||
| 335 | + } | ||
| 336 | + } | ||
| 337 | + } | ||
| 338 | + | ||
| 339 | + /// 发快递 && 编辑快递 | ||
| 340 | + /// - Parameters: | ||
| 341 | + /// - orderId: 订单号 | ||
| 342 | + /// - expressId: 快递id | ||
| 343 | + /// - expressNum: 快递数量 | ||
| 344 | + /// - hiddenSop: true为修改快递 false为发快递 | ||
| 345 | + /// - expId: 扩展id (hiddenSop为true时必传) | ||
| 346 | + /// - goodsList: 商品列表 (hiddenSop为false时必传) | ||
| 347 | + /// - storeId: 店铺id (hiddenSop为false时必传) | ||
| 348 | + /// - resultBlock: 返回 | ||
| 349 | + static func requestExpress(orderId: String, expressId: String, expressNum: String, hiddenSop: Bool, expId: String, goodsList: NSArray, storeId: String, resultBlock: @escaping resultShopBlock) { | ||
| 350 | + if hiddenSop { | ||
| 351 | + let param = NSMutableDictionary() | ||
| 352 | + param.setValue(orderId, forKey: "id") | ||
| 353 | + param.setValue(expId, forKey: "exp_id") | ||
| 354 | + param.setValue(expressId, forKey: "express_id") | ||
| 355 | + param.setValue(expressNum, forKey: "express_num") | ||
| 356 | + let custom_param = NSMutableDictionary() | ||
| 357 | + custom_param.setValue(APPId_wjj, forKey: "appId") | ||
| 358 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | ||
| 359 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 360 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 361 | + CNLiveNetworking.setupDSRequest(true) | ||
| 362 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 363 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/editExpress", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 364 | + hiddenLoading() | ||
| 365 | + if (error == nil) { | ||
| 366 | + let resp = result as! NSDictionary | ||
| 367 | + let errorCode = "\(resp["code"] ?? "0")" | ||
| 368 | + if (errorCode == "200") { | ||
| 369 | + resultBlock("修改成功", .success) | ||
| 370 | + } else { | ||
| 371 | + showMessage(message: resp["message"] as! String) | ||
| 372 | + resultBlock(NSNull(),.failed) | ||
| 373 | + } | ||
| 374 | + } else { | ||
| 375 | + if CNLiveNetworking.isNetworking() { | ||
| 376 | + showMessage(message: "修改快递信息失败") | ||
| 377 | + resultBlock(NSNull(),.failed) | ||
| 378 | + } else { | ||
| 379 | + showMessage(message: "似乎与网络断开链接") | ||
| 380 | + resultBlock(NSNull(),.noNetwork) | ||
| 381 | + } | ||
| 382 | + } | ||
| 383 | + } | ||
| 384 | + } else { | ||
| 385 | + let param = NSMutableDictionary() | ||
| 386 | + param.setValue(orderId, forKey: "id") | ||
| 387 | + param.setValue(storeId, forKey: "store_id") | ||
| 388 | + param.setValue(expressId, forKey: "express_id") | ||
| 389 | + param.setValue(expressNum, forKey: "express_num") | ||
| 390 | + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "id") | ||
| 391 | + if goodsList.count > 0 { | ||
| 392 | + do { | ||
| 393 | + let jsonData = try JSONSerialization.data(withJSONObject: goodsList, options: .prettyPrinted) | ||
| 394 | + let jsonString = NSString.init(data: jsonData, encoding: NSUTF8StringEncoding) | ||
| 395 | + param.setValue(jsonString, forKey: "goods_arr") | ||
| 396 | + } catch _ {} | ||
| 397 | + } | ||
| 398 | + let custom_param = NSMutableDictionary() | ||
| 399 | + custom_param.setValue(APPId_wjj, forKey: "appId") | ||
| 400 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | ||
| 401 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 402 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 403 | + CNLiveNetworking.setupDSRequest(true) | ||
| 404 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 405 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/express", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | ||
| 406 | + hiddenLoading() | ||
| 407 | + if (error == nil) { | ||
| 408 | + let resp = result as! NSDictionary | ||
| 409 | + let errorCode = "\(resp["code"] ?? "0")" | ||
| 410 | + if (errorCode == "200") { | ||
| 411 | + resultBlock("发货成功", .success) | ||
| 412 | + } else { | ||
| 413 | + showMessage(message: resp["message"] as! String) | ||
| 414 | + resultBlock(NSNull(),.failed) | ||
| 415 | + } | ||
| 416 | + } else { | ||
| 417 | + if CNLiveNetworking.isNetworking() { | ||
| 418 | + showMessage(message: "发货失败") | ||
| 419 | + resultBlock(NSNull(),.failed) | ||
| 420 | + } else { | ||
| 421 | + showMessage(message: "似乎与网络断开链接") | ||
| 422 | + resultBlock(NSNull(),.noNetwork) | ||
| 423 | + } | ||
| 424 | + } | ||
| 425 | + } | ||
| 426 | + } | ||
| 427 | + } | ||
| 428 | + | ||
| 429 | + /// 快递公司列表 | ||
| 430 | + /// - resultBlock: 返回 | ||
| 431 | + static func requestExpressList(resultBlock: @escaping resultShopBlock) { | ||
| 432 | + let custom_param = NSMutableDictionary() | ||
| 433 | + custom_param.setValue(APPId_wjj, forKey: "appId") | ||
| 434 | + custom_param.setValue(APPKey_wjj, forKey: "appKey") | ||
| 435 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | ||
| 436 | + CNLiveNetworking.setupShowDataResult(false) | ||
| 437 | + CNLiveNetworking.setupDSRequest(true) | ||
| 438 | + CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | ||
| 439 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/expressList", param: [ : ], cacheType: .networkOnly) { task, result, error in | ||
| 440 | + hiddenLoading() | ||
| 441 | + if (error == nil) { | ||
| 442 | + let resp = result as! NSDictionary | ||
| 443 | + let errorCode = "\(resp["code"] ?? "0")" | ||
| 444 | + if (errorCode == "200") { | ||
| 445 | + if resp["data"] is NSNull { | ||
| 446 | + resultBlock(NSNull(),.failed) | ||
| 447 | + } else { | ||
| 448 | + let resp_dict = resp["data"] as! NSDictionary | ||
| 449 | + let array = resp_dict["data"] as! NSArray | ||
| 450 | + let tempArray = NSMutableArray() | ||
| 451 | + for item in array { | ||
| 452 | + let listModel = dictionaryToModel(item as! [String : Any], ShopOrderExpressModel.self,"") as! ShopOrderExpressModel | ||
| 453 | + tempArray.add(listModel) | ||
| 454 | + } | ||
| 455 | + resultBlock(tempArray, .success) | ||
| 456 | + } | ||
| 457 | + } else { | ||
| 458 | + showMessage(message: resp["message"] as! String) | ||
| 459 | + resultBlock(NSNull(),.failed) | ||
| 460 | + } | ||
| 461 | + } else { | ||
| 462 | + if CNLiveNetworking.isNetworking() { | ||
| 463 | + showMessage(message: "请求失败") | ||
| 464 | + resultBlock(NSNull(),.failed) | ||
| 465 | + } else { | ||
| 466 | + showMessage(message: "似乎与网络断开链接") | ||
| 467 | + resultBlock(NSNull(),.noNetwork) | ||
| 468 | + } | ||
| 469 | + } | ||
| 470 | + } | ||
| 471 | + } | ||
| 472 | + | ||
| 473 | + /// 获取部分发货物流详情 | ||
| 474 | + /// - Parameters: | ||
| 475 | + /// - orderId: 订单id | ||
| 476 | + /// - resultBlock: 返回 | ||
| 477 | + static func requestExpressList(orderId: NSString, resultBlock: @escaping resultShopBlock) { | ||
| 153 | let param = NSMutableDictionary() | 478 | let param = NSMutableDictionary() |
| 154 | param.setValue(orderId, forKey: "id") | 479 | param.setValue(orderId, forKey: "id") |
| 155 | let custom_param = NSMutableDictionary() | 480 | let custom_param = NSMutableDictionary() |
| @@ -159,7 +484,7 @@ class CNLiveShopViewModel: NSObject { | @@ -159,7 +484,7 @@ class CNLiveShopViewModel: NSObject { | ||
| 159 | CNLiveNetworking.setupShowDataResult(false) | 484 | CNLiveNetworking.setupShowDataResult(false) |
| 160 | CNLiveNetworking.setupDSRequest(true) | 485 | CNLiveNetworking.setupDSRequest(true) |
| 161 | CNLiveNetworking.setupCustomParam(custom_param as? [String : String]) | 486 | 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 | 487 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/orderMoreExp", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in |
| 163 | hiddenLoading() | 488 | hiddenLoading() |
| 164 | if (error == nil) { | 489 | if (error == nil) { |
| 165 | let resp = result as! NSDictionary | 490 | let resp = result as! NSDictionary |
| @@ -168,15 +493,15 @@ class CNLiveShopViewModel: NSObject { | @@ -168,15 +493,15 @@ class CNLiveShopViewModel: NSObject { | ||
| 168 | if resp["data"] is NSNull { | 493 | if resp["data"] is NSNull { |
| 169 | resultBlock(NSNull(),.failed) | 494 | resultBlock(NSNull(),.failed) |
| 170 | } else { | 495 | } 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 | 496 | + let array = resp["data"] as! NSArray |
| 497 | + let tempArray = NSMutableArray() | ||
| 498 | + for item in array { | ||
| 499 | + let listModel = dictionaryToModel(item as! [String : Any], ShopOrderExpressListModel.self,"") as! ShopOrderExpressListModel | ||
| 500 | + if listModel.id != "0" { | ||
| 501 | + tempArray.add(listModel) | ||
| 176 | } | 502 | } |
| 177 | } | 503 | } |
| 178 | - model.is_send_all = is_send_all | ||
| 179 | - resultBlock(model,.success) | 504 | + resultBlock(tempArray, .success) |
| 180 | } | 505 | } |
| 181 | } else { | 506 | } else { |
| 182 | showMessage(message: resp["message"] as! String) | 507 | showMessage(message: resp["message"] as! String) |
| @@ -184,7 +509,7 @@ class CNLiveShopViewModel: NSObject { | @@ -184,7 +509,7 @@ class CNLiveShopViewModel: NSObject { | ||
| 184 | } | 509 | } |
| 185 | } else { | 510 | } else { |
| 186 | if CNLiveNetworking.isNetworking() { | 511 | if CNLiveNetworking.isNetworking() { |
| 187 | - showMessage(message: "获取失败") | 512 | + showMessage(message: "请求失败") |
| 188 | resultBlock(NSNull(),.failed) | 513 | resultBlock(NSNull(),.failed) |
| 189 | } else { | 514 | } else { |
| 190 | showMessage(message: "似乎与网络断开链接") | 515 | showMessage(message: "似乎与网络断开链接") |
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_add_no.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "加@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "加@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_goods_add_no.imageset/加@2x.png
0 → 100644
1.82 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_add_no.imageset/加@3x.png
0 → 100644
2.78 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_add_yes.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "加@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "加@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_goods_add_yes.imageset/加@2x.png
0 → 100644
2.43 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_add_yes.imageset/加@3x.png
0 → 100644
3.77 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_select_no.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "未选中@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "未选中@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_goods_select_no.imageset/未选中@2x.png
0 → 100644
1.08 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_select_no.imageset/未选中@3x.png
0 → 100644
1.76 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_select_yes.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "选中@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "选中@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_goods_select_yes.imageset/选中@2x.png
0 → 100644
1.37 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_select_yes.imageset/选中@3x.png
0 → 100644
2.13 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_sub_no.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "减@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "减@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_goods_sub_no.imageset/减@2x.png
0 → 100644
1.87 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_sub_no.imageset/减@3x.png
0 → 100644
3.22 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_sub_yes.imageset/Contents.json
0 → 100644
| 1 | +{ | ||
| 2 | + "images" : [ | ||
| 3 | + { | ||
| 4 | + "idiom" : "universal", | ||
| 5 | + "scale" : "1x" | ||
| 6 | + }, | ||
| 7 | + { | ||
| 8 | + "filename" : "减@2x.png", | ||
| 9 | + "idiom" : "universal", | ||
| 10 | + "scale" : "2x" | ||
| 11 | + }, | ||
| 12 | + { | ||
| 13 | + "filename" : "减@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_goods_sub_yes.imageset/减@2x.png
0 → 100644
1.84 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_goods_sub_yes.imageset/减@3x.png
0 → 100644
3.44 KB
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