Commit a990a2f180383108fc7abcacf57c96796f3795c7

Authored by 张旭
2 parents 9ad08da7 fa6dc868

Merge branch 'master' of http://bj.gitlab.cnlive.com/ios-team/CNLiveMateCode

# Conflicts:
#	metaCode.xcodeproj/project.pbxproj
Showing 41 changed files with 2681 additions and 45 deletions
metaCode.xcodeproj/project.pbxproj
@@ -106,6 +106,10 @@ @@ -106,6 +106,10 @@
106 79803E272AD68D3100F05F68 /* CNLiveMineShopViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79803E262AD68D3100F05F68 /* CNLiveMineShopViewController.swift */; }; 106 79803E272AD68D3100F05F68 /* CNLiveMineShopViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79803E262AD68D3100F05F68 /* CNLiveMineShopViewController.swift */; };
107 79803E292AD6991200F05F68 /* CNLiveMineInputMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79803E282AD6991200F05F68 /* CNLiveMineInputMessageView.swift */; }; 107 79803E292AD6991200F05F68 /* CNLiveMineInputMessageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79803E282AD6991200F05F68 /* CNLiveMineInputMessageView.swift */; };
108 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7987BF3C2A497644000A1ABC /* CNLiveMineQuestViewController.swift */; }; 108 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7987BF3C2A497644000A1ABC /* CNLiveMineQuestViewController.swift */; };
  109 + 798916E92B04532D00D08302 /* CNLiveSavePointDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798916E82B04532D00D08302 /* CNLiveSavePointDB.swift */; };
  110 + 798916ED2B048E8200D08302 /* CNLiveShopTransViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798916EC2B048E8200D08302 /* CNLiveShopTransViewController.swift */; };
  111 + 798916EF2B048EC800D08302 /* CNLiveShopTransListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798916EE2B048EC800D08302 /* CNLiveShopTransListViewController.swift */; };
  112 + 798916F12B0491A400D08302 /* CNLiveShopBodyTransListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798916F02B0491A400D08302 /* CNLiveShopBodyTransListView.swift */; };
109 7989B5C52A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7989B5C42A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift */; }; 113 7989B5C52A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7989B5C42A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift */; };
110 7989B5C72A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7989B5C62A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift */; }; 114 7989B5C72A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7989B5C62A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift */; };
111 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44E72A30134400815935 /* CNLiveMineHeaderView.swift */; }; 115 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 798A44E72A30134400815935 /* CNLiveMineHeaderView.swift */; };
@@ -129,9 +133,12 @@ @@ -129,9 +133,12 @@
129 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; }; 133 79A68C4C2A26EA6000DC3B43 /* (null) in Sources */ = {isa = PBXBuildFile; };
130 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */; }; 134 79B2E3602AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */; };
131 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */; }; 135 79BA085D2AB18E8300D01875 /* CNLiveSaveAuthDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */; };
  136 + 79BB1C142B05C51900C5720C /* CNLiveShopCouponViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */; };
  137 + 79BB1C162B05C62900C5720C /* CNLiveShopBodyCouponView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB1C152B05C62900C5720C /* CNLiveShopBodyCouponView.swift */; };
132 79BB96A62AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB96A52AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift */; }; 138 79BB96A62AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB96A52AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift */; };
133 79BB96A82AF223FB00AEA4AC /* CNLiveConfigAlertManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB96A72AF223FB00AEA4AC /* CNLiveConfigAlertManager.swift */; }; 139 79BB96A82AF223FB00AEA4AC /* CNLiveConfigAlertManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB96A72AF223FB00AEA4AC /* CNLiveConfigAlertManager.swift */; };
134 79BB96AA2AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */; }; 140 79BB96AA2AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */; };
  141 + 79D094DC2B0765DD008CB1F3 /* CNLiveShopBodyCouponGoodsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79D094DB2B0765DD008CB1F3 /* CNLiveShopBodyCouponGoodsListView.swift */; };
135 79E496E32AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */; }; 142 79E496E32AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */; };
136 79E496E82AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E496E72AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift */; }; 143 79E496E82AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E496E72AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift */; };
137 79E672032AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E672022AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift */; }; 144 79E672032AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 79E672022AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift */; };
@@ -293,6 +300,10 @@ @@ -293,6 +300,10 @@
293 79803E262AD68D3100F05F68 /* CNLiveMineShopViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineShopViewController.swift; sourceTree = "<group>"; }; 300 79803E262AD68D3100F05F68 /* CNLiveMineShopViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineShopViewController.swift; sourceTree = "<group>"; };
294 79803E282AD6991200F05F68 /* CNLiveMineInputMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputMessageView.swift; sourceTree = "<group>"; }; 301 79803E282AD6991200F05F68 /* CNLiveMineInputMessageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineInputMessageView.swift; sourceTree = "<group>"; };
295 7987BF3C2A497644000A1ABC /* CNLiveMineQuestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineQuestViewController.swift; sourceTree = "<group>"; }; 302 7987BF3C2A497644000A1ABC /* CNLiveMineQuestViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineQuestViewController.swift; sourceTree = "<group>"; };
  303 + 798916E82B04532D00D08302 /* CNLiveSavePointDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSavePointDB.swift; sourceTree = "<group>"; };
  304 + 798916EC2B048E8200D08302 /* CNLiveShopTransViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopTransViewController.swift; sourceTree = "<group>"; };
  305 + 798916EE2B048EC800D08302 /* CNLiveShopTransListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopTransListViewController.swift; sourceTree = "<group>"; };
  306 + 798916F02B0491A400D08302 /* CNLiveShopBodyTransListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyTransListView.swift; sourceTree = "<group>"; };
296 7989B5C42A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineEarnViewController.swift; sourceTree = "<group>"; }; 307 7989B5C42A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineEarnViewController.swift; sourceTree = "<group>"; };
297 7989B5C62A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineEarnListViewController.swift; sourceTree = "<group>"; }; 308 7989B5C62A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineEarnListViewController.swift; sourceTree = "<group>"; };
298 798A44E72A30134400815935 /* CNLiveMineHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineHeaderView.swift; sourceTree = "<group>"; }; 309 798A44E72A30134400815935 /* CNLiveMineHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineHeaderView.swift; sourceTree = "<group>"; };
@@ -315,9 +326,12 @@ @@ -315,9 +326,12 @@
315 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; }; 326 79A68C512A26F59C00DC3B43 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = metaCode/Info.plist; sourceTree = "<group>"; };
316 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; }; 327 79B2E35F2AF39191002A8524 /* NSObject+CNLiveConfigModuleInline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSObject+CNLiveConfigModuleInline.swift"; sourceTree = "<group>"; };
317 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; }; 328 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSaveAuthDB.swift; sourceTree = "<group>"; };
  329 + 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponViewController.swift; sourceTree = "<group>"; };
  330 + 79BB1C152B05C62900C5720C /* CNLiveShopBodyCouponView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyCouponView.swift; sourceTree = "<group>"; };
318 79BB96A52AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderDetailViewController.swift; sourceTree = "<group>"; }; 331 79BB96A52AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopOrderDetailViewController.swift; sourceTree = "<group>"; };
319 79BB96A72AF223FB00AEA4AC /* CNLiveConfigAlertManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveConfigAlertManager.swift; sourceTree = "<group>"; }; 332 79BB96A72AF223FB00AEA4AC /* CNLiveConfigAlertManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveConfigAlertManager.swift; sourceTree = "<group>"; };
320 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyDetailView.swift; sourceTree = "<group>"; }; 333 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyDetailView.swift; sourceTree = "<group>"; };
  334 + 79D094DB2B0765DD008CB1F3 /* CNLiveShopBodyCouponGoodsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopBodyCouponGoodsListView.swift; sourceTree = "<group>"; };
321 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+CNLiveExtension.swift"; sourceTree = "<group>"; }; 335 79E496E22AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UITableViewCell+CNLiveExtension.swift"; sourceTree = "<group>"; };
322 79E496E72AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSMutableAttributedString+CNLiveExtensions.swift"; sourceTree = "<group>"; }; 336 79E496E72AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSMutableAttributedString+CNLiveExtensions.swift"; sourceTree = "<group>"; };
323 79E672022AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineSignOutViewController.swift; sourceTree = "<group>"; }; 337 79E672022AFDFA9C00F2F768 /* CNLiveMineSignOutViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveMineSignOutViewController.swift; sourceTree = "<group>"; };
@@ -623,6 +637,7 @@ @@ -623,6 +637,7 @@
623 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */, 637 79BA085C2AB18E8300D01875 /* CNLiveSaveAuthDB.swift */,
624 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */, 638 79EABB882AB4497700F3A4E2 /* CNLiveSaveStandDB.swift */,
625 794FF1082B02131300385E85 /* CNLiveSaveSearchDB.swift */, 639 794FF1082B02131300385E85 /* CNLiveSaveSearchDB.swift */,
  640 + 798916E82B04532D00D08302 /* CNLiveSavePointDB.swift */,
626 ); 641 );
627 path = Database; 642 path = Database;
628 sourceTree = "<group>"; 643 sourceTree = "<group>";
@@ -795,6 +810,9 @@ @@ -795,6 +810,9 @@
795 792B53272AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift */, 810 792B53272AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift */,
796 794FF1042B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift */, 811 794FF1042B01FC8800385E85 /* CNLiveShopOrderSearchViewController.swift */,
797 794FF1062B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift */, 812 794FF1062B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift */,
  813 + 798916EC2B048E8200D08302 /* CNLiveShopTransViewController.swift */,
  814 + 798916EE2B048EC800D08302 /* CNLiveShopTransListViewController.swift */,
  815 + 79BB1C132B05C51900C5720C /* CNLiveShopCouponViewController.swift */,
798 ); 816 );
799 path = Controller; 817 path = Controller;
800 sourceTree = "<group>"; 818 sourceTree = "<group>";
@@ -814,6 +832,9 @@ @@ -814,6 +832,9 @@
814 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */, 832 79BB96A92AF2330900AEA4AC /* CNLiveShopBodyDetailView.swift */,
815 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */, 833 79A267822AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift */,
816 791C1C8B2AFB85F8003E6362 /* CNLiveShopBodyExpressView.swift */, 834 791C1C8B2AFB85F8003E6362 /* CNLiveShopBodyExpressView.swift */,
  835 + 798916F02B0491A400D08302 /* CNLiveShopBodyTransListView.swift */,
  836 + 79BB1C152B05C62900C5720C /* CNLiveShopBodyCouponView.swift */,
  837 + 79D094DB2B0765DD008CB1F3 /* CNLiveShopBodyCouponGoodsListView.swift */,
817 ); 838 );
818 path = View; 839 path = View;
819 sourceTree = "<group>"; 840 sourceTree = "<group>";
@@ -1255,6 +1276,7 @@ @@ -1255,6 +1276,7 @@
1255 19CC4D4B2ADD086F00308E2A /* CNUpSlideDetailViewController.swift in Sources */, 1276 19CC4D4B2ADD086F00308E2A /* CNUpSlideDetailViewController.swift in Sources */,
1256 7C83B4402A52BB2B004BF4A4 /* CNGlobalEnum.swift in Sources */, 1277 7C83B4402A52BB2B004BF4A4 /* CNGlobalEnum.swift in Sources */,
1257 7C83B4442A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift in Sources */, 1278 7C83B4442A541F36004BF4A4 /* NSDate+CNLiveExtensions.swift in Sources */,
  1279 + 798916F12B0491A400D08302 /* CNLiveShopBodyTransListView.swift in Sources */,
1258 7CD675482A274167008354C1 /* PGIndexBannerSubiew.m in Sources */, 1280 7CD675482A274167008354C1 /* PGIndexBannerSubiew.m in Sources */,
1259 790D019F2A2DD66E00C5978D /* CNLiveLoginViewModel.swift in Sources */, 1281 790D019F2A2DD66E00C5978D /* CNLiveLoginViewModel.swift in Sources */,
1260 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */, 1282 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */,
@@ -1266,6 +1288,8 @@ @@ -1266,6 +1288,8 @@
1266 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */, 1288 790D019D2A2DCBD000C5978D /* UIView+CNLiveExtensions.swift in Sources */,
1267 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */, 1289 790B1FB62A41938F0074CF00 /* UIImage+CNLiveExtensions.swift in Sources */,
1268 191732F82B08AB9D007BCC04 /* CNLiveShopClassilyViewModel.swift in Sources */, 1290 191732F82B08AB9D007BCC04 /* CNLiveShopClassilyViewModel.swift in Sources */,
  1291 + 79BB1C162B05C62900C5720C /* CNLiveShopBodyCouponView.swift in Sources */,
  1292 + 798916E92B04532D00D08302 /* CNLiveSavePointDB.swift in Sources */,
1269 19FA20172AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift in Sources */, 1293 19FA20172AE22D3C001F7186 /* CNLiveDownSlideRecommendCell.swift in Sources */,
1270 19123FC12ABC11170075C883 /* CNWebViewController.swift in Sources */, 1294 19123FC12ABC11170075C883 /* CNWebViewController.swift in Sources */,
1271 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */, 1295 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */,
@@ -1307,6 +1331,8 @@ @@ -1307,6 +1331,8 @@
1307 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */, 1331 79656E382AAEBA8E00119A61 /* CNLiveMineInputViewController.swift in Sources */,
1308 19CC4D522ADD129800308E2A /* CNUpSlideAnimationTransition.swift in Sources */, 1332 19CC4D522ADD129800308E2A /* CNUpSlideAnimationTransition.swift in Sources */,
1309 7CD6754F2A2840B9008354C1 /* CNMetaCodeHomePageController.swift in Sources */, 1333 7CD6754F2A2840B9008354C1 /* CNMetaCodeHomePageController.swift in Sources */,
  1334 + 79D094DC2B0765DD008CB1F3 /* CNLiveShopBodyCouponGoodsListView.swift in Sources */,
  1335 + 798916EF2B048EC800D08302 /* CNLiveShopTransListViewController.swift in Sources */,
1310 7989B5C52A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift in Sources */, 1336 7989B5C52A4BDC6000A19B10 /* CNLiveMineEarnViewController.swift in Sources */,
1311 792E57DB2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift in Sources */, 1337 792E57DB2A3AE9F4005834DB /* CNLiveCommonQiniuTool.swift in Sources */,
1312 191732F12B084822007BCC04 /* CNLiveShopClassifyInputTableViewCell.swift in Sources */, 1338 191732F12B084822007BCC04 /* CNLiveShopClassifyInputTableViewCell.swift in Sources */,
@@ -1361,6 +1387,8 @@ @@ -1361,6 +1387,8 @@
1361 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */, 1387 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */,
1362 1965FA3E2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift in Sources */, 1388 1965FA3E2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift in Sources */,
1363 7CD6753C2A2740B0008354C1 /* CNUpSlideViewRemindView.swift in Sources */, 1389 7CD6753C2A2740B0008354C1 /* CNUpSlideViewRemindView.swift in Sources */,
  1390 + 79BB1C142B05C51900C5720C /* CNLiveShopCouponViewController.swift in Sources */,
  1391 + 798916ED2B048E8200D08302 /* CNLiveShopTransViewController.swift in Sources */,
1364 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */, 1392 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */,
1365 794FF1072B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift in Sources */, 1393 794FF1072B01FC9800385E85 /* CNLiveShopOrderSearchListViewController.swift in Sources */,
1366 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, 1394 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */,
metaCode/Classes/Common/Util/CNLiveCommonQiniuTool.swift
@@ -39,6 +39,16 @@ class UploadManager: NSObject { @@ -39,6 +39,16 @@ class UploadManager: NSObject {
39 UploadManager.uploadData(madiaData: imageData, key: key, progress: progressBlock, success: successBlock) 39 UploadManager.uploadData(madiaData: imageData, key: key, progress: progressBlock, success: successBlock)
40 } 40 }
41 41
  42 + /// 上传视频
  43 + /// - Parameters:
  44 + /// - imageData: 视频数据
  45 + /// - progressBlock: 进度回调
  46 + /// - successBlock: 成功回调
  47 + static func uploadVideo(videoData: NSData, progressBlock:@escaping ProgressBlcok, successBlock: @escaping SuccessBlock) {
  48 + let key = UploadManager.createVideoFileName()
  49 + UploadManager.uploadData(madiaData: videoData, key: key, progress: progressBlock, success: successBlock)
  50 + }
  51 +
42 52
43 53
44 /// 上传到七牛 54 /// 上传到七牛
@@ -113,6 +123,13 @@ class UploadManager: NSObject { @@ -113,6 +123,13 @@ class UploadManager: NSObject {
113 let imageName = "802/mateCode/img/\(NSDate().string(withFormat: "yyyy/MM/dd") )/\(arc4random()).jpg" 123 let imageName = "802/mateCode/img/\(NSDate().string(withFormat: "yyyy/MM/dd") )/\(arc4random()).jpg"
114 return imageName 124 return imageName
115 } 125 }
  126 +
  127 + /// 设置视频名称
  128 + /// - Returns: 图片名
  129 + static private func createVideoFileName() -> String {
  130 + let imageName = "802/mateCode/video/\(NSDate().string(withFormat: "yyyy/MM/dd") )/\(arc4random()).mp4"
  131 + return imageName
  132 + }
116 } 133 }
117 134
118 class QiNiuUploadModel: BaseModel { 135 class QiNiuUploadModel: BaseModel {
metaCode/Classes/Config/Database/CNLiveSaveAuthDB.swift
@@ -71,6 +71,30 @@ class CNLiveSaveAuthDB : NSObject{ @@ -71,6 +71,30 @@ class CNLiveSaveAuthDB : NSObject{
71 // } 71 // }
72 } 72 }
73 73
  74 + /// 获取所有数据
  75 + /// - Returns: 返回查找的所以数据
  76 + func searchAllObject() -> Array<MineAuthListModel>{
  77 +
  78 + let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist")
  79 + if (temp_dic == nil) {
  80 + return Array()
  81 + }
  82 + let tempArray = NSMutableArray.init()
  83 + temp_dic?.allValues.forEach({ value in
  84 + let listModel = dictionaryToModel(value as! [String : Any], MineAuthListModel.self,"")
  85 + tempArray.add(listModel)
  86 + })
  87 + return tempArray as! Array<MineAuthListModel>
  88 +
  89 +// do{
  90 +// let allData: [MineAuthListModel] = try database.getObjects(fromTable: CNLiveAuthListTableName)
  91 +// return allData
  92 +// }catch{
  93 +// print("获取失败")
  94 +// return []
  95 +// }
  96 + }
  97 +
74 /// 删除一条数据 98 /// 删除一条数据
75 /// - Parameter delete: 被删除的数据 99 /// - Parameter delete: 被删除的数据
76 func deleteObject(delete: MineAuthListModel){ 100 func deleteObject(delete: MineAuthListModel){
@@ -132,29 +156,7 @@ class CNLiveSaveAuthDB : NSObject{ @@ -132,29 +156,7 @@ class CNLiveSaveAuthDB : NSObject{
132 } 156 }
133 157
134 158
135 - /// 获取所有数据  
136 - /// - Returns: 返回查找的所以数据  
137 - func searchAllObject() -> Array<MineAuthListModel>{  
138 -  
139 - let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist")  
140 - if (temp_dic == nil) {  
141 - return Array()  
142 - }  
143 - let tempArray = NSMutableArray.init()  
144 - temp_dic?.allValues.forEach({ value in  
145 - let listModel = dictionaryToModel(value as! [String : Any], MineAuthListModel.self,"")  
146 - tempArray.add(listModel)  
147 - })  
148 - return tempArray as! Array<MineAuthListModel>  
149 -  
150 -// do{  
151 -// let allData: [MineAuthListModel] = try database.getObjects(fromTable: CNLiveAuthListTableName)  
152 -// return allData  
153 -// }catch{  
154 -// print("获取失败")  
155 -// return []  
156 -// }  
157 - } 159 +
158 160
159 /// 获取所有数据唯一值id 161 /// 获取所有数据唯一值id
160 /// - Returns: 返回查找的所以数据 162 /// - Returns: 返回查找的所以数据
metaCode/Classes/Config/Database/CNLiveSavePointDB.swift 0 → 100644
  1 +//
  2 +// CNLiveSavePointDB.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/11/15.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +let CNLiveSavePointCacheKey = "kCNLiveSavePointCacheKey"
  11 +class CNLiveSavePointDB: NSObject {
  12 +
  13 + static let shared = CNLiveSavePointDB.init()
  14 +
  15 + open func save(object: MinePointCheckInModel) {
  16 + var temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist")
  17 + if (temp_dic == nil) {
  18 + temp_dic = NSMutableDictionary.init()
  19 + }
  20 + temp_dic?.setObject((object.toJSON() ?? Dictionary()) as Dictionary, forKey: CNLiveSavePointCacheKey as NSCopying)
  21 + temp_dic?.write(toFile: userFileDir+"storage.plist", atomically: true)
  22 + }
  23 +
  24 + open func take() -> MinePointCheckInModel {
  25 + let temp_dic = NSMutableDictionary.init(contentsOfFile: userFileDir+"storage.plist")
  26 + if (temp_dic == nil) {
  27 + return MinePointCheckInModel()
  28 + }
  29 + let resp = temp_dic?.object(forKey: CNLiveSavePointCacheKey)
  30 + let listModel = dictionaryToModel(resp as! [String : Any], MinePointCheckInModel.self,"") as! MinePointCheckInModel
  31 + return listModel
  32 + }
  33 +
  34 + private lazy var userFileDir: String = {
  35 + let userFileDir = NSString()
  36 + var path: String = ""
  37 + path = "\(fileDir)/userId_\(UserInfoManager.shared.userInfo.uid)/"
  38 + let fileManager = FileManager.default
  39 + var isDir: ObjCBool = false
  40 + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir)
  41 + if !(isDir.boolValue && exist) {
  42 + do {
  43 + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true)
  44 + } catch {
  45 + debugPrint("文件目录创建失败")
  46 + return ""
  47 + }
  48 + }
  49 + return path as String
  50 + }()
  51 +
  52 + private lazy var fileDir: String = {
  53 + let path = "\(NSHomeDirectory())/Documents/metaCode/savePoint"
  54 + let fileManager = FileManager.default
  55 + var isDir: ObjCBool = false
  56 + let exist: Bool = fileManager.fileExists(atPath: path, isDirectory: &isDir)
  57 + if !(isDir.boolValue && exist) {
  58 + do {
  59 + try fileManager.createDirectory(atPath: path, withIntermediateDirectories: true)
  60 + } catch {
  61 + debugPrint("文件目录创建失败")
  62 + return ""
  63 + }
  64 + }
  65 + return path as String
  66 + }()
  67 +}
metaCode/Classes/Extensions/NSString+CNLiveExtensions.swift
@@ -37,10 +37,10 @@ extension NSString { @@ -37,10 +37,10 @@ extension NSString {
37 return false; 37 return false;
38 } 38 }
39 39
40 - /// 时间戳转字符串 40 + /// 字符串转秒数
41 /// - Parameter dateFormat: 时间格式 41 /// - Parameter dateFormat: 时间格式
42 /// - Returns: 返回 42 /// - Returns: 返回
43 - func timeStrChangeTotimeInterval(dateFormat:String?) -> String { 43 + func timeStrChangeTotimeInterval(_ dateFormat:String? = "yyyy-MM-dd HH:mm:ss") -> String {
44 if !self.isNotBlank() { 44 if !self.isNotBlank() {
45 return "" 45 return ""
46 } 46 }
@@ -58,6 +58,26 @@ extension NSString { @@ -58,6 +58,26 @@ extension NSString {
58 return "\(Int(date!.timeIntervalSince1970))" 58 return "\(Int(date!.timeIntervalSince1970))"
59 } 59 }
60 60
  61 + /// 字符串转date
  62 + /// - Parameter dateFormat: 日期格式
  63 + /// - Returns: 返回
  64 + func timeStrChangeTotimedate(_ dateFormat:String? = "yyyy-MM-dd HH:mm:ss") -> NSDate {
  65 + if !self.isNotBlank() {
  66 + return NSDate()
  67 + }
  68 + let format = DateFormatter.init()
  69 + format.dateStyle = .medium
  70 + format.timeStyle = .short
  71 + format.locale = Locale(identifier: "zh_CN")
  72 + format.timeZone = TimeZone(abbreviation: "UTC+8:00")
  73 + if dateFormat == nil {
  74 + format.dateFormat = "yyyy-MM-dd HH:mm:ss"
  75 + }else{
  76 + format.dateFormat = dateFormat
  77 + }
  78 + return format.date(from: self as String)! as NSDate
  79 + }
  80 +
61 /// 保留2位小数 81 /// 保留2位小数
62 /// - Returns: 返回 82 /// - Returns: 返回
63 func keepTwoDecimalPlaces() -> String { 83 func keepTwoDecimalPlaces() -> String {
metaCode/Classes/Main/MinePage/Controller/CNLiveMineViewController.swift
@@ -45,9 +45,11 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, @@ -45,9 +45,11 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate,
45 ["name":"更多设置","icon":"mine_list_icon_set_more"]] 45 ["name":"更多设置","icon":"mine_list_icon_set_more"]]
46 dataArray.add(array03) 46 dataArray.add(array03)
47 47
48 -  
49 -// dataArray.add([["name":"订单列表","icon":"mine_list_icon_help_feedback"]])  
50 - 48 +// let array04 : [Dictionary] = [["name":"订单列表","icon":"mine_list_icon_help_feedback"],
  49 +// ["name":"交易记录","icon":"mine_list_icon_help_feedback"],
  50 +// ["name":"新增优惠券","icon":"mine_list_icon_help_feedback"],
  51 +// ["name":"优惠券管理","icon":"mine_list_icon_help_feedback"]]
  52 +// dataArray.add(array04)
51 53
52 return dataArray 54 return dataArray
53 }() 55 }()
@@ -87,6 +89,9 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate, @@ -87,6 +89,9 @@ class CNLiveMineViewController : CNLiveBaseViewController, UITableViewDelegate,
87 if respStatue == .success { 89 if respStatue == .success {
88 self?.checkModel = result as? MinePointCheckInModel 90 self?.checkModel = result as? MinePointCheckInModel
89 self?.tableView.reloadData() 91 self?.tableView.reloadData()
  92 + } else {
  93 + self?.checkModel = MinePointCheckInModel.init()
  94 + self?.tableView.reloadData()
90 } 95 }
91 } 96 }
92 } 97 }
@@ -174,7 +179,15 @@ extension CNLiveMineViewController { @@ -174,7 +179,15 @@ extension CNLiveMineViewController {
174 } 179 }
175 180
176 if indexPath.section == 4 { 181 if indexPath.section == 4 {
177 - self.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true) 182 + if indexPath.row == 0 {
  183 + self.navigationController?.pushViewController(CNLiveShopOrderViewController.init(), animated: true)
  184 + }
  185 + if indexPath.row == 1 {
  186 + self.navigationController?.pushViewController(CNLiveShopTransViewController.init(), animated: true)
  187 + }
  188 + if indexPath.row == 2 {
  189 + self.navigationController?.pushViewController(CNLiveShopCouponViewController.init(), animated: true)
  190 + }
178 } 191 }
179 192
180 } 193 }
metaCode/Classes/Main/MinePage/View/CNLiveMineBodyListView.swift
@@ -397,8 +397,13 @@ class MineBodyThreeViewCell: UITableViewCell { @@ -397,8 +397,13 @@ class MineBodyThreeViewCell: UITableViewCell {
397 _checkModel = newValue 397 _checkModel = newValue
398 balanceNumberButton.stopAnimating() 398 balanceNumberButton.stopAnimating()
399 pointNumberButton.stopAnimating() 399 pointNumberButton.stopAnimating()
400 - balanceNumberButton.setTitle(newValue?.money, for: .normal)  
401 - pointNumberButton.setTitle(newValue?.integral, for: .normal) 400 + if newValue == nil {
  401 + balanceNumberButton.setTitle("0", for: .normal)
  402 + pointNumberButton.setTitle("0", for: .normal)
  403 + } else {
  404 + balanceNumberButton.setTitle((newValue!.money!.isNotBlank()) ? newValue?.money : "0", for: .normal)
  405 + pointNumberButton.setTitle((newValue!.integral!.isNotBlank()) ? newValue?.integral : "0", for: .normal)
  406 + }
402 } 407 }
403 } 408 }
404 409
metaCode/Classes/Main/MinePage/View/CNLiveMineHeaderView.swift
@@ -370,8 +370,8 @@ class MineQuestHeaderView: UIView { @@ -370,8 +370,8 @@ class MineQuestHeaderView: UIView {
370 mainView.addSubview(balanceDescButton) 370 mainView.addSubview(balanceDescButton)
371 mainView.addSubview(descBtn) 371 mainView.addSubview(descBtn)
372 372
373 - balanceDescButton.setTitle(checkModel.money, for: .normal)  
374 - pointDescButton.setTitle(checkModel.integral, for: .normal) 373 + balanceDescButton.setTitle((checkModel.money!.isNotBlank()) ? checkModel.money : "0", for: .normal)
  374 + pointDescButton.setTitle((checkModel.integral!.isNotBlank()) ? checkModel.integral : "0", for: .normal)
375 375
376 setupConstraints() 376 setupConstraints()
377 } 377 }
@@ -540,8 +540,8 @@ class MineEarnHeaderView: UIView { @@ -540,8 +540,8 @@ class MineEarnHeaderView: UIView {
540 // mainView.addSubview(tipView) 540 // mainView.addSubview(tipView)
541 // tipView.addSubview(tipLabel) 541 // tipView.addSubview(tipLabel)
542 542
543 - left_Label.text = checkModel.integral  
544 - right_Label.text = checkModel.money 543 + left_Label.text = checkModel.integral!.isNotBlank() ? checkModel.integral : "0"
  544 + right_Label.text = checkModel.money!.isNotBlank() ? checkModel.money : "0"
545 545
546 setupConstraints() 546 setupConstraints()
547 } 547 }
metaCode/Classes/Main/MinePage/View/CNLiveMineInfoAlertView.swift
@@ -547,6 +547,8 @@ enum CNLiveStandListAlertShowType { @@ -547,6 +547,8 @@ enum CNLiveStandListAlertShowType {
547 case text 547 case text
548 case date 548 case date
549 case string 549 case string
  550 + case min_date//今天最小
  551 + case max_date//今天最大
550 } 552 }
551 class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSource { 553 class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSource {
552 554
@@ -584,7 +586,7 @@ class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSour @@ -584,7 +586,7 @@ class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSour
584 datePicker.locale = Locale(identifier: "zh_CN") 586 datePicker.locale = Locale(identifier: "zh_CN")
585 datePicker.setValue(HexColor("#3C3C3C"), forKey: "textColor") 587 datePicker.setValue(HexColor("#3C3C3C"), forKey: "textColor")
586 datePicker.datePickerMode = .date 588 datePicker.datePickerMode = .date
587 - datePicker.isHidden = !(_show_type == .date) 589 + datePicker.isHidden = !(_show_type == .date || _show_type == .min_date || _show_type == .max_date)
588 if #available(iOS 13.4, *) { 590 if #available(iOS 13.4, *) {
589 datePicker.preferredDatePickerStyle = .wheels 591 datePicker.preferredDatePickerStyle = .wheels
590 } else { 592 } else {
@@ -651,6 +653,18 @@ class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSour @@ -651,6 +653,18 @@ class MineStandListAlertView: UIView, UIPickerViewDelegate, UIPickerViewDataSour
651 text = infos.firstObject as? Dictionary<String, String> 653 text = infos.firstObject as? Dictionary<String, String>
652 } else if _show_type == .string { 654 } else if _show_type == .string {
653 text = infos.firstObject as? String 655 text = infos.firstObject as? String
  656 + } else if (_show_type == .min_date || _show_type == .max_date) {
  657 + let current_date = infos.firstObject as! Date
  658 + let formatter = DateFormatter()
  659 + formatter.locale = Locale.init(identifier: "zh_CN")
  660 + formatter.dateFormat = (infos.lastObject as! String)
  661 + datePicker.setDate(current_date as Date, animated: true)
  662 + if _show_type == .min_date {
  663 + datePicker.minimumDate = Date(timeIntervalSinceNow: 0)
  664 + } else {
  665 + datePicker.maximumDate = Date(timeIntervalSinceNow: 0)
  666 + }
  667 + text = formatter.string(from: datePicker.date)
654 }else{ 668 }else{
655 let formatter = DateFormatter() 669 let formatter = DateFormatter()
656 formatter.dateFormat = "yyyy-MM-dd" 670 formatter.dateFormat = "yyyy-MM-dd"
metaCode/Classes/Main/MinePage/View/CNLiveMineInputMessageView.swift
@@ -364,7 +364,7 @@ class MineInputTextShopCustomView: UIView, UITextViewDelegate, UITextFieldDelega @@ -364,7 +364,7 @@ class MineInputTextShopCustomView: UIView, UITextViewDelegate, UITextFieldDelega
364 contentTextView.resignFirstResponder() 364 contentTextView.resignFirstResponder()
365 MineStandListAlertView.showStandListView(infos: dataArray, name:String(title[index...]), show_type:dataArray.count == 0 ? .date : .text, result: { [self] text in 365 MineStandListAlertView.showStandListView(infos: dataArray, name:String(title[index...]), show_type:dataArray.count == 0 ? .date : .text, result: { [self] text in
366 if dataArray.count == 0 { 366 if dataArray.count == 0 {
367 - _dict.setObject((text as! NSString).timeStrChangeTotimeInterval(dateFormat: "yyyy-MM-dd"), forKey: "content" as NSCopying) 367 + _dict.setObject((text as! NSString).timeStrChangeTotimeInterval("yyyy-MM-dd"), forKey: "content" as NSCopying)
368 moreBtn.setTitle(text as? String, for: .normal) 368 moreBtn.setTitle(text as? String, for: .normal)
369 } else { 369 } else {
370 let dict = text as! NSDictionary 370 let dict = text as! NSDictionary
metaCode/Classes/Main/MinePage/View/CNLiveMineSubBodyListView.swift
@@ -51,7 +51,7 @@ class MineInfoLListTableViewCell : UITableViewCell { @@ -51,7 +51,7 @@ class MineInfoLListTableViewCell : UITableViewCell {
51 51
52 public func setupWithDataSource(icon: String, name: String, is_auth: Bool) { 52 public func setupWithDataSource(icon: String, name: String, is_auth: Bool) {
53 iconView.kf.indicatorType = .activity 53 iconView.kf.indicatorType = .activity
54 - iconView.kf.setImage(with: URL(string: icon), placeholder: UIImage.imageWithColor(color: HexColor("0xf9f9f9")!, size: CGSize(width: 50, height: 50))) 54 + iconView.kf.setImage(with: URL(string: icon), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: 50, height: 50)))
55 titleLabel.text = name 55 titleLabel.text = name
56 if is_auth { 56 if is_auth {
57 addBtn.backgroundColor = HexColor("#DCDCDC") 57 addBtn.backgroundColor = HexColor("#DCDCDC")
metaCode/Classes/Main/MinePage/ViewModel/CNLiveMineViewModel.swift
@@ -644,18 +644,34 @@ class CNLiveMineViewModel: NSObject { @@ -644,18 +644,34 @@ class CNLiveMineViewModel: NSObject {
644 let errorCode = "\(resp["code"] ?? "0")" 644 let errorCode = "\(resp["code"] ?? "0")"
645 if (errorCode == "200") { 645 if (errorCode == "200") {
646 let listModel = dictionaryToModel(resp as! [String : Any], MinePointCheckInModel.self,"data") as! MinePointCheckInModel 646 let listModel = dictionaryToModel(resp as! [String : Any], MinePointCheckInModel.self,"data") as! MinePointCheckInModel
  647 + CNLiveSavePointDB.shared.save(object: listModel)
647 resultBlock(listModel,.success) 648 resultBlock(listModel,.success)
648 } else { 649 } else {
649 - showMessage(message: resp["message"] as! String)  
650 - resultBlock(NSNull(),.failed) 650 + let listModel = CNLiveSavePointDB.shared.take()
  651 + if listModel.integral!.isNotBlank() && listModel.money!.isNotBlank() {
  652 + resultBlock(listModel,.success)
  653 + } else {
  654 + showMessage(message: resp["message"] as! String)
  655 + resultBlock(NSNull(),.failed)
  656 + }
651 } 657 }
652 } else { 658 } else {
653 if CNLiveNetworking.isNetworking() { 659 if CNLiveNetworking.isNetworking() {
654 - showMessage(message: "获取失败")  
655 - resultBlock(NSNull(),.failed) 660 + let listModel = CNLiveSavePointDB.shared.take()
  661 + if listModel.integral!.isNotBlank() && listModel.money!.isNotBlank() {
  662 + resultBlock(listModel,.success)
  663 + } else {
  664 + showMessage(message: "获取失败")
  665 + resultBlock(NSNull(),.failed)
  666 + }
656 } else { 667 } else {
657 - showMessage(message: "似乎与网络断开链接")  
658 - resultBlock(NSNull(),.noNetwork) 668 + let listModel = CNLiveSavePointDB.shared.take()
  669 + if listModel.integral!.isNotBlank() && listModel.money!.isNotBlank() {
  670 + resultBlock(listModel,.success)
  671 + } else {
  672 + showMessage(message: "似乎与网络断开链接")
  673 + resultBlock(NSNull(),.noNetwork)
  674 + }
659 } 675 }
660 } 676 }
661 } 677 }
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopCouponViewController.swift 0 → 100644
  1 +//
  2 +// CNLiveShopCouponViewController.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/11/16.
  6 +//
  7 +
  8 +import Foundation
  9 +import EmptyDataSet_Swift
  10 +import IQKeyboardManagerSwift
  11 +import APButton
  12 +
  13 +enum CNLiveShopCouponShowType {
  14 + case create //创建
  15 + case edit //编辑
  16 +}
  17 +class CNLiveShopCouponViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate {
  18 +
  19 + let kShopBodyCouponCreateTableViewCellIdentifier = "kShopBodyCouponCreateTableViewCellIdentifier"
  20 + let kUITableViewHeaderFooterViewIdentifier = "kUITableViewHeaderFooterViewIdentifier"
  21 + lazy var tableView : UITableView = {
  22 + let tableView = UITableView(frame: .zero, style: .plain)
  23 + tableView.dataSource = self
  24 + tableView.delegate = self
  25 + tableView.emptyDataSetSource = self
  26 + tableView.emptyDataSetDelegate = self
  27 + tableView.backgroundColor = HexColor("#f6f6f6")
  28 + tableView.tableFooterView = UIView.init()
  29 + tableView.separatorStyle = .none
  30 + tableView.register(ShopBodyCouponCreateTableViewCell.self, forCellReuseIdentifier: kShopBodyCouponCreateTableViewCellIdentifier)
  31 + tableView.register(UITableViewHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: kUITableViewHeaderFooterViewIdentifier)
  32 + return tableView
  33 + }()
  34 +
  35 + lazy var footerView: UIView = {
  36 + let footerView = UIView.init(frame: CGRect(x: 0, y: KSreenHeight - get_system_tabbar_height(), width: KSreenWidth, height: get_system_tabbar_height()))
  37 + footerView.backgroundColor = .white
  38 + footerView.addSubview(cancelBtn)
  39 + cancelBtn.snp.makeConstraints { make in
  40 + make.width.equalTo(adapt_length(length: 130))
  41 + make.height.equalTo(get_system_tabbar_ui_height())
  42 + make.left.equalToSuperview()
  43 + make.top.equalToSuperview()
  44 + }
  45 + footerView.addSubview(deliveryBtn)
  46 + deliveryBtn.snp.makeConstraints { make in
  47 + make.width.equalTo(KSreenWidth - adapt_length(length: 130))
  48 + make.height.equalTo(get_system_tabbar_ui_height())
  49 + make.right.equalToSuperview()
  50 + make.top.equalToSuperview()
  51 + }
  52 + return footerView
  53 + }()
  54 +
  55 + lazy var cancelBtn: UIButton = {
  56 + let cancelBtn = UIButton.init(type: .custom)
  57 + cancelBtn.backgroundColor = .white
  58 + cancelBtn.setTitle("取消", for: .normal)
  59 + cancelBtn.setTitleColor(HexColor("#3A3A3A"), for: .normal)
  60 + cancelBtn.titleLabel?.font = medium_adapt_font(pointSize: 14)
  61 + cancelBtn.addTarget(self, action: #selector(cancelBtnClick), for: .touchUpInside)
  62 + return cancelBtn
  63 + }()
  64 +
  65 + lazy var deliveryBtn: APButton = {
  66 + let deliveryBtn = APButton.init()
  67 + deliveryBtn.backgroundColor = HexColor("#65C368")
  68 + deliveryBtn.setTitle("保存", for: .normal)
  69 + deliveryBtn.activityIndicator.color = .white
  70 + deliveryBtn.titleLabel?.font = regular_adapt_font(pointSize: 15)
  71 + deliveryBtn.setTitleColor(HexColor("#FFFFFF"), for: .normal)
  72 + deliveryBtn.addTarget(self, action: #selector(sendBtnClick), for: .touchUpInside)
  73 + return deliveryBtn
  74 + }()
  75 +
  76 + lazy var dataArray: NSMutableArray = {
  77 + let dataArray = NSMutableArray.init()
  78 + return dataArray
  79 + }()
  80 +
  81 +
  82 +
  83 + var _listModel: ShopOrderCouponListModel!
  84 + var _show_type: CNLiveShopCouponShowType!
  85 + /// 创建优惠券使用的
  86 + init() {
  87 + _show_type = .create
  88 + _listModel = ShopOrderCouponListModel.init()
  89 + super.init(nibName:nil, bundle:nil)
  90 + }
  91 +
  92 + /// 编辑优惠券需要调用
  93 + /// - Parameters:
  94 + /// - listModel: 数据源
  95 + /// - show_type: 显示类型
  96 + init(listModel: ShopOrderCouponListModel) {
  97 + _show_type = .edit
  98 + _listModel = listModel
  99 + super.init(nibName:nil, bundle:nil)
  100 + }
  101 +
  102 +
  103 + required init?(coder: NSCoder) {
  104 + fatalError("init(coder:) has not been implemented")
  105 + }
  106 +
  107 +
  108 + var hiddenGoodsLine: Bool!
  109 + var network_type: CNLiveMineResponseType!
  110 + override func viewDidLoad() {
  111 + super.viewDidLoad()
  112 + view.backgroundColor = HexColor("#f6f6f6")
  113 + navigationBarHidden = false
  114 + titleName = "发布优惠券"
  115 +
  116 + loadDataSourceAction()
  117 +
  118 + view.addSubview(tableView)
  119 + tableView.snp.makeConstraints { make in
  120 + make.top.equalTo(KNavigationHeight)
  121 + make.left.right.equalToSuperview()
  122 + make.bottom.equalToSuperview().offset(-get_system_tabbar_height())
  123 + }
  124 + view.addSubview(footerView)
  125 + }
  126 +
  127 + func loadDataSourceAction() {
  128 +
  129 + CNLiveShopViewModel.requestCoupon(model: _listModel) { [weak self] result, respStatue in
  130 + if respStatue == .success {
  131 + self!.dataArray = result as! NSMutableArray
  132 + self!.tableView.reloadData()
  133 + let model = (self!.dataArray[1] as! NSArray)[0] as! ShopOrderCouponDataModel
  134 + self!.hiddenGoodsLine = model.section == "1"
  135 + }
  136 + }
  137 + }
  138 +
  139 + @objc func cancelBtnClick() {
  140 + self.navigationController?.popViewController(animated: true)
  141 + }
  142 +
  143 +
  144 + var couponTitle: String! = ""
  145 + var totalNum: String! = ""
  146 + var maxMoney: String! = ""
  147 + var lessMoney: String! = ""
  148 + var startTime: String! = ""
  149 + var endTime: String! = ""
  150 + var goodsId: String! = ""
  151 + @objc func sendBtnClick(sender: APButton) {
  152 + let model01 = (self.dataArray[1] as! NSArray)[0] as! ShopOrderCouponDataModel
  153 + let model02 = (self.dataArray[1] as! NSArray)[2] as! ShopOrderCouponDataModel
  154 + let model03 = (self.dataArray[1] as! NSArray)[3] as! ShopOrderCouponDataModel
  155 + let model04 = (self.dataArray[1] as! NSArray)[4] as! ShopOrderCouponDataModel
  156 + if _show_type == .create {
  157 + showLoading(message: "提交中...")
  158 + sender.startAnimating()
  159 + CNLiveShopViewModel.requestCouponCreate(title: couponTitle, filled: maxMoney, discount: lessMoney, startTime: startTime, endTime: endTime, state: model02.section!, isShow: model04.section!, receiveNum: model03.section!, totalNum: totalNum, goodsType: model01.section!, goodsId: goodsId) { result, respStatue in
  160 + sender.stopAnimating()
  161 + if respStatue == .success {
  162 + showMessage(message: result as! String)
  163 + }
  164 + }
  165 + } else {
  166 + showLoading(message: "提交中...")
  167 + sender.startAnimating()
  168 + CNLiveShopViewModel.requestCouponEdit(model: _listModel, title: (couponTitle.isNotBlank() ? couponTitle : _listModel.title)!, state: model02.section!, isShow: model04.section!, receiveNum: model03.section!) { result, respStatue in
  169 + sender.stopAnimating()
  170 + if respStatue == .success {
  171 + showMessage(message: result as! String)
  172 + }
  173 + }
  174 + }
  175 + }
  176 +
  177 +}
  178 +
  179 +extension CNLiveShopCouponViewController {
  180 + func numberOfSections(in tableView: UITableView) -> Int {
  181 + return dataArray.count
  182 + }
  183 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  184 + let temp_array = dataArray[section] as! NSArray
  185 + return temp_array.count
  186 + }
  187 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  188 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyCouponCreateTableViewCellIdentifier) as? ShopBodyCouponCreateTableViewCell else {
  189 + return ShopBodyCouponCreateTableViewCell()
  190 + }
  191 + if _show_type == .edit {
  192 + if ((indexPath.section == 0 && indexPath.row == 0) || (indexPath.section == 1 && (indexPath.row == 2 || indexPath.row == 3 || indexPath.row == 4))) {
  193 + cell.editEnabled = true
  194 + } else {
  195 + cell.editEnabled = false
  196 + }
  197 + } else {
  198 + cell.editEnabled = true
  199 + }
  200 + cell.setupWithDataSource(couponModel: (dataArray[indexPath.section] as! NSArray)[indexPath.row] as! ShopOrderCouponDataModel)
  201 + cell.textFieldCallBack = { [self] section, number in
  202 + switch section {
  203 + case "1":
  204 + couponTitle = number
  205 + break
  206 + case "3":
  207 + totalNum = number
  208 + break
  209 + case "1001":
  210 + maxMoney = number
  211 + break
  212 + case "1002":
  213 + lessMoney = number
  214 + break
  215 + default:
  216 + break
  217 + }
  218 + }
  219 + cell.dateSelectCallBack = { [self] id, date in
  220 + let interval = date.timeIntervalSince1970
  221 + if id == "4" {
  222 + startTime = "\(interval)"
  223 + } else {
  224 + endTime = "\(interval + 3600 * 24 - 1)"
  225 + }
  226 + }
  227 + if (indexPath.row == 1 && indexPath.section == 1) {
  228 + if goodsId.isNotBlank() && _listModel.goods_id!.isNotBlank() && _listModel.goods_id != "0" {
  229 + cell.goodsLabel.text = ""
  230 + }
  231 + cell.isHidden = hiddenGoodsLine
  232 + }
  233 + cell.goodsHiddenCallBack = { [self] isHidden in
  234 + hiddenGoodsLine = isHidden
  235 + goodsId = ""
  236 + let indexPath = IndexPath(row: 1, section: 1)
  237 + tableView.reloadRows(at: [indexPath], with: .middle)
  238 + }
  239 + cell.goodsCallBack = { [weak self] goodsId in
  240 + self!.goodsId = goodsId
  241 + }
  242 + return cell
  243 + }
  244 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  245 + if indexPath.section == 1 && indexPath.row == 1 && hiddenGoodsLine {
  246 + return 0
  247 + }
  248 + return adapt_length(length: 50)
  249 + }
  250 + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
  251 + if section == 0 {
  252 + return 0
  253 + }
  254 + return adapt_length(length: 5)
  255 + }
  256 + func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
  257 + view.endEditing(true)
  258 + }
  259 + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
  260 + let view = tableView.dequeueReusableHeaderFooterView(withIdentifier: kUITableViewHeaderFooterViewIdentifier)
  261 + view?.contentView.backgroundColor = HexColor("#f6f6f6")
  262 + return view
  263 + }
  264 +
  265 +}
  266 +
  267 +extension CNLiveShopCouponViewController {
  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/Controller/CNLiveShopTransListViewController.swift 0 → 100644
  1 +//
  2 +// CNLiveShopTransListViewController.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/11/15.
  6 +//
  7 +
  8 +
  9 +
  10 +import Foundation
  11 +import JXSegmentedView
  12 +import JXPagingView
  13 +import EmptyDataSet_Swift
  14 +import MJRefresh
  15 +
  16 +enum CNLiveShopTransListShowType {
  17 + case all //全部
  18 + case income //收入
  19 + case outcome //支出
  20 +}
  21 +
  22 +class CNLiveShopTransListViewController: CNLiveBaseViewController, UITableViewDelegate, UITableViewDataSource, JXSegmentedListContainerViewListDelegate, EmptyDataSetSource, EmptyDataSetDelegate {
  23 +
  24 + func listView() -> UIView {
  25 + return view
  26 + }
  27 +
  28 + let kShopBodyTransListViewCellIdentifier = "kShopBodyTransListViewCellIdentifier"
  29 + lazy var tableView : UITableView = {
  30 + let tableView = UITableView(frame: .zero, style: .plain)
  31 + tableView.dataSource = self
  32 + tableView.delegate = self
  33 + tableView.emptyDataSetSource = self
  34 + tableView.emptyDataSetDelegate = self
  35 + tableView.backgroundColor = .white
  36 + tableView.tableFooterView = UIView.init()
  37 + tableView.contentInset = UIEdgeInsets(top: adapt_length(length: 82), left: 0, bottom: 0, right: 0)
  38 + tableView.scrollIndicatorInsets = UIEdgeInsets(top: adapt_length(length: 82), left: 0, bottom: 0, right: 0)
  39 + tableView.separatorInset = UIEdgeInsets(top: 0, left: adapt_length(length: 20), bottom: 0, right: adapt_length(length: 20))
  40 + tableView.register(ShopBodyTransListViewCell.self, forCellReuseIdentifier: kShopBodyTransListViewCellIdentifier)
  41 + return tableView
  42 + }()
  43 +
  44 + lazy var headerView: ShopBodyTransListHeaderView = {
  45 + let headerView = ShopBodyTransListHeaderView.init(frame: CGRect.zero)
  46 + headerView.clickBlcok = { [self] headerView in
  47 + MineStandListAlertView.showStandListView(infos: [currentDate!,"YYYY年MM月"], name:"选择月份", show_type:.max_date, result: { [self] text in
  48 + currentDate = (text as! NSString).timeStrChangeTotimedate("YYYY-MM-dd")
  49 + current_string = (text as! String)
  50 + let array = (text as! NSString).components(separatedBy: "-") as NSArray
  51 + headerView.dateLab.text = "\(array[0])年\(array[1])月"
  52 + loadDataSourceAction()
  53 + })
  54 + }
  55 + return headerView
  56 + }()
  57 +
  58 + lazy var dataArray: NSMutableArray = {
  59 + let dataArray = NSMutableArray.init()
  60 + return dataArray
  61 + }()
  62 +
  63 + var currentDate: NSDate!
  64 + var current_string: String!
  65 + var network_type: CNLiveMineResponseType!
  66 + var _show_type:CNLiveShopTransListShowType!
  67 + init(show_type: CNLiveShopTransListShowType) {
  68 + _show_type = show_type
  69 + currentDate = Date() as NSDate
  70 + current_string = NSDate.timeIntervalChangeToTimeStr(timeInterval: 0)
  71 + super.init(nibName:nil, bundle:nil)
  72 + }
  73 +
  74 + required init?(coder: NSCoder) {
  75 + fatalError("init(coder:) has not been implemented")
  76 + }
  77 +
  78 + override func viewDidLoad() {
  79 + super.viewDidLoad()
  80 + view.backgroundColor = HexColor("#FAFAFA")
  81 +
  82 + loadDataSourceAction()
  83 +
  84 + view.addSubview(tableView)
  85 + tableView.snp.makeConstraints { make in
  86 + make.top.equalToSuperview()
  87 + make.bottom.left.right.equalToSuperview()
  88 + }
  89 + view.addSubview(headerView)
  90 + headerView.snp.makeConstraints { make in
  91 + make.top.left.right.equalToSuperview()
  92 + make.height.equalTo(adapt_length(length: 82))
  93 + }
  94 + }
  95 +
  96 + func loadDataSourceAction() {
  97 + showLoading(message: "")
  98 + CNLiveShopViewModel.requestAccount(date: current_string, type: _show_type) { [weak self] result, respStatue in
  99 + if respStatue == .success {
  100 + let baseModel = (result as! ShopOrderTransBaseDataModel)
  101 + self!.dataArray.addObjects(from: (result as! ShopOrderTransBaseDataModel).list)
  102 + self!.tableView.reloadData()
  103 + if self!.dataArray.count > 0 && self!.tableView.mj_header == nil && self!.tableView.mj_footer == nil {
  104 + self!.addRefreshView()
  105 + }
  106 + self!.headerView.priceLab.text = "支出 ¥\(baseModel.payment ?? "0.00") 收入 ¥\(baseModel.income ?? "0.00")"
  107 + }else if (respStatue == .noNetwork) {
  108 + self!.network_type = .noNetwork
  109 + self!.tableView.reloadEmptyDataSet()
  110 + } else {
  111 + self!.network_type = .failed
  112 + self!.tableView.reloadEmptyDataSet()
  113 + }
  114 + }
  115 + }
  116 +
  117 + func addRefreshView() {
  118 + tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in
  119 + self!.tableView.mj_header?.endRefreshing()
  120 + })
  121 +
  122 + tableView.mj_footer = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in
  123 + self!.tableView.mj_footer?.endRefreshing()
  124 + self!.tableView.mj_footer?.endRefreshingWithNoMoreData()
  125 + })
  126 + }
  127 +
  128 + override func viewDidLayoutSubviews() {
  129 + super.viewDidLayoutSubviews()
  130 + }
  131 +
  132 +}
  133 +extension CNLiveShopTransListViewController {
  134 +
  135 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  136 + return dataArray.count
  137 + }
  138 +
  139 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  140 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyTransListViewCellIdentifier) as? ShopBodyTransListViewCell else {
  141 + return ShopBodyTransListViewCell()
  142 + }
  143 + cell.setupWithDataSource(listModel: dataArray[indexPath.row] as! ShopOrderTransListDataModel)
  144 + return cell
  145 + }
  146 +
  147 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  148 + return adapt_length(length: 75)
  149 + }
  150 +
  151 + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  152 + let listModel = self.dataArray[indexPath.row] as! ShopOrderTransListDataModel
  153 + if listModel.type == "1" {
  154 + if listModel.title == "order" {
  155 + self.navigationController?.pushViewController(CNLiveShopOrderDetailViewController.init(orderId: listModel.order_id!, show_type: .order, form_type: .afterSale), animated: true)
  156 + }
  157 + if listModel.title == "foods_order" {
  158 +
  159 + }
  160 + }
  161 + }
  162 +}
  163 +
  164 +extension CNLiveShopTransListViewController {
  165 +
  166 + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? {
  167 + if network_type == .failed || network_type == .unkonw {
  168 + return UIImage(named: "mine_list_source_unusual_failed")
  169 + }
  170 + if dataArray.count == 0 {
  171 + return UIImage(named: "mine_list_source_unusual_empty")
  172 + }
  173 + if network_type == .noNetwork {
  174 + return UIImage(named: "mine_list_source_unusual_noNet")
  175 + }
  176 + return UIImage(named: "mine_list_source_unusual_empty")
  177 + }
  178 +
  179 + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? {
  180 + var defult_string = ""
  181 + if network_type == .failed || network_type == .unkonw {
  182 + defult_string = "接口请求错误,刷新试试~"
  183 + }
  184 + if network_type == .noNetwork {
  185 + defult_string = "网络开小差了,刷新试试~"
  186 + }
  187 + if dataArray.count == 0 {
  188 + defult_string = "暂时没有数据~"
  189 + }
  190 + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!])
  191 + }
  192 +
  193 + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? {
  194 + if network_type == .failed || network_type == .noNetwork {
  195 + let attributes = [NSAttributedString.Key.font:Font_16_Fit,
  196 + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")]
  197 + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any])
  198 + }
  199 + return nil
  200 + }
  201 +
  202 + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) {
  203 + if network_type == .failed || network_type == .noNetwork {
  204 + loadDataSourceAction()
  205 + }
  206 + }
  207 +}
metaCode/Classes/Main/ShopPage/Controller/CNLiveShopTransViewController.swift 0 → 100644
  1 +//
  2 +// CNLiveShopTransViewController.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/11/15.
  6 +//
  7 +
  8 +import Foundation
  9 +import JXSegmentedView
  10 +import JXPagingView
  11 +
  12 +class CNLiveShopTransViewController: CNLiveBaseViewController {
  13 +
  14 + lazy var viewControllers: NSMutableArray = {
  15 + let viewControllers = NSMutableArray.init()
  16 + viewControllers.add(CNLiveShopTransListViewController.init(show_type: .all))
  17 + viewControllers.add(CNLiveShopTransListViewController.init(show_type: .income))
  18 + viewControllers.add(CNLiveShopTransListViewController.init(show_type: .outcome))
  19 + return viewControllers
  20 + }()
  21 +
  22 + lazy var dataSource: JXSegmentedNumberDataSource = {
  23 + let dataSource = JXSegmentedNumberDataSource()
  24 + dataSource.titles = ["全部","收入","支出"]
  25 + dataSource.numbers = [0,0,0,0]
  26 + dataSource.isTitleColorGradientEnabled = true
  27 + dataSource.itemWidth = JXSegmentedViewAutomaticDimension
  28 + dataSource.itemSpacing = 0
  29 + dataSource.titleNormalFont = Font_15_Fit
  30 + dataSource.titleSelectedFont = Font_15_Fit
  31 + dataSource.titleNormalColor = HexColor("#999999")!
  32 + dataSource.titleSelectedColor = HexColor("#28C1C6")!
  33 + return dataSource
  34 + }()
  35 +
  36 + lazy var categoryView: JXSegmentedView = {
  37 + let categoryView = JXSegmentedView.init(frame: CGRectMake(0, KNavigationHeight, KSreenWidth, CGFloat(kCNLiveShopOrderListSectionTitleHeight)))
  38 + categoryView.dataSource = dataSource
  39 + categoryView.delegate = self
  40 + categoryView.collectionView.backgroundColor = HexColor("fafbfd")
  41 + categoryView.backgroundColor = .white
  42 +
  43 + let lineView = JXSegmentedIndicatorBackgroundView.init()
  44 + lineView.indicatorColor = HexColor("#28C1C6")!
  45 + lineView.indicatorHeight = 2
  46 + lineView.indicatorPosition = .bottom
  47 + lineView.indicatorWidthIncrement = 0
  48 + lineView.indicatorCornerRadius = 0
  49 + categoryView.indicators = [lineView]
  50 +
  51 + return categoryView
  52 + }()
  53 +
  54 + lazy var listContainerView: JXSegmentedListContainerView! = {
  55 + return JXSegmentedListContainerView(dataSource: self)
  56 + }()
  57 +
  58 + override func viewWillAppear(_ animated: Bool) {
  59 + super.viewWillAppear(animated)
  60 + self.navigationController?.interactivePopGestureRecognizer?.isEnabled = (categoryView.selectedIndex == 0)
  61 + }
  62 +
  63 + override func viewWillDisappear(_ animated: Bool) {
  64 + super.viewWillDisappear(animated)
  65 + self.navigationController?.interactivePopGestureRecognizer?.isEnabled = true
  66 + }
  67 +
  68 + override func viewDidLoad() {
  69 + super.viewDidLoad()
  70 + view.backgroundColor = .white
  71 + navigationBarHidden = false
  72 + titleName = "交易记录"
  73 +
  74 + view.addSubview(categoryView)
  75 +
  76 + categoryView.listContainer = listContainerView
  77 + view.addSubview(listContainerView)
  78 + }
  79 +
  80 + override func viewDidLayoutSubviews() {
  81 + super.viewDidLayoutSubviews()
  82 +
  83 + categoryView.frame = CGRect(x: 0, y: KNavigationHeight, width: view.bounds.size.width, height: CGFloat(kCNLiveShopOrderListSectionTitleHeight))
  84 + listContainerView.frame = CGRect(x: 0, y: KNavigationHeight+CGFloat(kCNLiveShopOrderListSectionTitleHeight), width: view.bounds.size.width, height: view.bounds.size.height - CGFloat(kCNLiveShopOrderListSectionTitleHeight) - KNavigationHeight)
  85 + }
  86 +}
  87 +extension CNLiveShopTransViewController: JXSegmentedViewDelegate {
  88 + func segmentedView(_ segmentedView: JXSegmentedView, didSelectedItemAt index: Int) {
  89 + navigationController?.interactivePopGestureRecognizer?.isEnabled = (segmentedView.selectedIndex == 0)
  90 + }
  91 +}
  92 +
  93 +extension CNLiveShopTransViewController: JXSegmentedListContainerViewDataSource {
  94 + func numberOfLists(in listContainerView: JXSegmentedListContainerView) -> Int {
  95 + if let titleDataSource = categoryView.dataSource as? JXSegmentedBaseDataSource {
  96 + return titleDataSource.dataSource.count
  97 + }
  98 + return 0
  99 + }
  100 +
  101 + func listContainerView(_ listContainerView: JXSegmentedListContainerView, initListAt index: Int) -> JXSegmentedListContainerViewListDelegate {
  102 + return viewControllers[index] as! JXSegmentedListContainerViewListDelegate
  103 + }
  104 +}
  105 +
metaCode/Classes/Main/ShopPage/Model/CNLiveShopBaseModel.swift
@@ -249,5 +249,98 @@ class ShopOrderExpressDetailDateModel: BaseModel { @@ -249,5 +249,98 @@ class ShopOrderExpressDetailDateModel: BaseModel {
249 }) 249 })
250 } 250 }
251 } 251 }
  252 +//!!!: 电商流水数据
  253 +class ShopOrderTransBaseDataModel: BaseModel {
  254 + var payment: String? = ""// 支出
  255 + var income: String? = ""// 收入
  256 + var list = [ShopOrderTransListDataModel]()// 电商流水
  257 +}
  258 +
  259 +class ShopOrderTransListDataModel: BaseModel {
  260 + var id: String? = ""// id
  261 + var uid: String? = ""// 用户id
  262 + var price: String? = ""// 金钱
  263 + var addtime: String? = ""// 时间戳
  264 + var type: String? = ""// 1 收入 2 支出
  265 + var title: String? = ""// order电商 foods_order美食
  266 + var order_id: String? = ""// 订单id
  267 + var payment: String? = ""// 1支付宝 2微信 3银联 4钱包
  268 + var img: String? = ""// 头像
  269 + var username: String? = ""// 昵称
  270 +
  271 + override func mapping(mapper: HelpingMapper) {
  272 + mapper <<<
  273 + self.addtime <-- TransformOf(fromJSON: { (raw) -> String in
  274 + if raw!.count > 0 {
  275 + let date = NSDate(timeIntervalSince1970: TimeInterval(raw!)!)
  276 + let dateFormatter = DateFormatter()
  277 + dateFormatter.locale = Locale.init(identifier: "zh_CN")
  278 + dateFormatter.dateFormat = "YYYY-MM-dd hh:mm:SS"
  279 + return dateFormatter.string(from: date as Date)
  280 + }
  281 + return raw!
  282 + }, toJSON: { (tuple) -> String? in
  283 + return tuple
  284 + });
  285 + }
  286 +}
252 287
  288 +///优惠券相关数据
  289 +//!!!:
  290 +class ShopOrderCouponDataModel: BaseModel {
  291 + var id: String? = ""
  292 + var type: String? = ""
  293 + var title: String? = ""
  294 + var subTitle: String? = ""
  295 + var section: String? = ""
  296 + var message: String? = ""
  297 + var filled: String? = ""
  298 + var disCount: String? = ""
  299 +}
  300 +
  301 +class ShopOrderCouponListModel: BaseModel {
  302 + var id: String? = ""//优惠券id
  303 + var type: String? = ""//
  304 + var sort: String? = ""//优惠券使用范围 1 店铺全场 3 单品券
  305 + var num: String? = ""//剩余数量
  306 + var goods_id: String? = ""//商品Id
  307 + var goods_title: String? = ""//
  308 + var filled: String? = ""//满
  309 + var discount: String? = ""//减
  310 + var starttime: String? = ""//开始时间
  311 + var endtime: String? = ""//结束时间
  312 + var addtime: String? = ""//发布时间
  313 + var store_id: String? = ""//店铺iD
  314 + var genre: String? = ""//
  315 + var day: String? = ""//
  316 + var total: String? = ""//已领取数量
  317 + var state: String? = ""//优惠券状态 1 正常 2 冻结
  318 + var title: String? = ""//标题
  319 + var receive_number: String? = ""//领取次数 1 不限制 2 限制一次
  320 + var types: String? = ""//
  321 + var is_show: String? = ""//是否显示 1 对外显示 2 不对外
  322 +}
  323 +
  324 +class ShopOrderCouponDataListModel: BaseModel {
  325 + var list = [ShopOrderCouponListModel]()// 数据
  326 +}
  327 +
  328 +//!!!: 优惠券商品数据
  329 +class ShopOrderAssociatedGoodsModel: BaseModel {
  330 + var id: String? = ""// 商品id
  331 + var title: String? = ""// 商品名称
  332 + var simg: String? = ""// 商品图片
  333 + var img: String? = ""//
  334 + var price: String? = ""//商品价格
  335 + var ads: String? = ""// 商品介绍
  336 + var groupid: String? = ""// 商品分类
  337 + var shopid: String? = ""// 店铺id
  338 + var shop_id: String? = ""//
  339 + var category_id: String? = ""// 店铺分类id
  340 + var state: String? = ""// 1下架 2上架
  341 + var count: String? = ""// 库存
  342 + var shop_type: String? = ""// 1普通商品 2文创商品
  343 + var ord: String? = ""// 排序
  344 + var select: Bool = false// 商品是否被选中(本地标记)
  345 +}
253 346
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyCouponGoodsListView.swift 0 → 100644
  1 +//
  2 +// CNLiveShopBodyCouponGoodsListView.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/11/17.
  6 +//
  7 +
  8 +import Foundation
  9 +import EmptyDataSet_Swift
  10 +import Kingfisher
  11 +import MJRefresh
  12 +import IQKeyboardManagerSwift
  13 +
  14 +typealias clickCouponSearchTextFieldCallBack = (_ searchText: String) -> Void
  15 +typealias clickCouponChooseGoodsCallBack = (_ model: ShopOrderAssociatedGoodsModel) -> Void
  16 +//!!!: 商品搜索相关界面
  17 +class ShopBodyCouponGoodsListView: UIView, UITableViewDelegate, UITableViewDataSource, EmptyDataSetSource, EmptyDataSetDelegate {
  18 +
  19 + lazy var listBackView: UIView = {
  20 + let listBackView = UIView.init()
  21 + listBackView.backgroundColor = .white
  22 + let path = UIBezierPath.init(roundedRect: CGRect(x: 0, y: 0, width: KSreenWidth, height: adapt_length(length: 390)), byRoundingCorners: [.bottomLeft,.bottomRight], cornerRadii: CGSizeMake(adapt_length(length: 9), adapt_length(length: 9)))
  23 + let masklayer = CAShapeLayer()
  24 + masklayer.path = path.cgPath
  25 + listBackView.layer.mask = masklayer
  26 + return listBackView
  27 + }()
  28 +
  29 + let kShopBodyCouponGoodsListTableViewCellIdentifier = "kShopBodyCouponGoodsListTableViewCellIdentifier"
  30 + lazy var tableView : UITableView = {
  31 + let tableView = UITableView(frame: .zero, style: .plain)
  32 + tableView.dataSource = self
  33 + tableView.delegate = self
  34 + tableView.emptyDataSetSource = self
  35 + tableView.emptyDataSetDelegate = self
  36 + tableView.backgroundColor = .white
  37 + tableView.tableFooterView = UIView.init()
  38 + tableView.separatorStyle = .none
  39 + tableView.register(ShopBodyCouponGoodsListTableViewCell.self, forCellReuseIdentifier: kShopBodyCouponGoodsListTableViewCellIdentifier)
  40 + return tableView
  41 + }()
  42 +
  43 + lazy var closeBtn: UIButton = {
  44 + let closeBtn = UIButton.init(type: .custom)
  45 + closeBtn.setImage(UIImage(named: "mine_header_icon_close"), for: .normal)
  46 + closeBtn.addTarget(self, action: #selector(closeClick), for: .touchUpInside)
  47 + return closeBtn
  48 + }()
  49 +
  50 + lazy var headerLabel: UILabel = {
  51 + let headerLabel = UILabel.init()
  52 + headerLabel.textColor = HexColor("#3a3a3a")
  53 + headerLabel.font = regular_adapt_font(pointSize: 16)
  54 + headerLabel.textAlignment = .left
  55 + headerLabel.text = "请选择您要优惠的商品"
  56 + return headerLabel
  57 + }()
  58 +
  59 + lazy var searchView: ShopBodyCouponGoodsSearchView = {
  60 + let searchView = ShopBodyCouponGoodsSearchView.init(frame: .zero)
  61 + searchView.searchCallBack = {[weak self] searchText in
  62 + if searchText.isNotBlank() {
  63 + self!.pageNum = 1
  64 + self!.searchText = searchText
  65 + self!.loadDataSourceAction(page: 1)
  66 + }
  67 + }
  68 + return searchView
  69 + }()
  70 +
  71 + lazy var dataArray: NSMutableArray = {
  72 + let dataArray = NSMutableArray.init()
  73 + return dataArray
  74 + }()
  75 +
  76 + var searchText: String!
  77 + var pageNum: NSInteger!
  78 + var network_type: CNLiveMineResponseType!
  79 + var clickGoodsCallBack: clickCouponChooseGoodsCallBack!
  80 + override init(frame: CGRect) {
  81 + super.init(frame: frame)
  82 + pageNum = 1
  83 + searchText = ""
  84 + backgroundColor = HexColor("#000000", alpha: 0.6)
  85 +
  86 + loadDataSourceAction(page: 1)
  87 +
  88 + addSubview(listBackView)
  89 + listBackView.snp.makeConstraints { make in
  90 + make.left.right.equalToSuperview()
  91 + make.top.equalTo(self.snp.bottom)
  92 + make.height.equalTo(adapt_length(length: 390))
  93 + }
  94 + listBackView.addSubview(headerLabel)
  95 + headerLabel.snp.makeConstraints { make in
  96 + make.left.top.equalToSuperview().offset(adapt_length(length: 15))
  97 + }
  98 + listBackView.addSubview(closeBtn)
  99 + closeBtn.snp.makeConstraints { make in
  100 + make.right.equalTo(listBackView).offset(-adapt_length(length: 15))
  101 + make.centerY.equalTo(headerLabel)
  102 + }
  103 + listBackView.addSubview(searchView)
  104 + searchView.snp.makeConstraints { make in
  105 + make.left.right.equalTo(listBackView)
  106 + make.top.equalTo(headerLabel.snp.bottom).offset(adapt_length(length: 15))
  107 + make.height.equalTo(adapt_length(length: 52.5))
  108 + }
  109 + listBackView.addSubview(tableView)
  110 + tableView.snp.makeConstraints { make in
  111 + make.left.right.bottom.equalTo(listBackView)
  112 + make.top.equalTo(searchView.snp.bottom).offset(adapt_length(length: 10))
  113 + }
  114 +
  115 + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil)
  116 + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil)
  117 + }
  118 +
  119 + func loadDataSourceAction(page: NSInteger) {
  120 + showLoading(message: "")
  121 + CNLiveShopViewModel.requestCouponSearchGoods(shopId: DSUserInfoManager.shared.dsUserInfo.id!, sortType: "1", state: "0", categoryId: "", keyword: searchText, page: pageNum) { [weak self] result, respStatue in
  122 + if self == nil {
  123 + return
  124 + }
  125 + if respStatue == .success {
  126 + if self!.pageNum == 1 {
  127 + self!.dataArray.removeAllObjects()
  128 + self!.dataArray.addObjects(from: result as! [ShopOrderAssociatedGoodsModel])
  129 + if self!.dataArray.count > 0 && self!.tableView.mj_footer == nil {
  130 + self!.addRefreshView()
  131 + }
  132 + if self!.dataArray.count == 0 && self!.tableView.mj_footer != nil {
  133 + self!.tableView.mj_footer = nil
  134 + }
  135 + }
  136 + if self!.pageNum > 1 {
  137 + self!.dataArray.addObjects(from: result as! [ShopOrderAssociatedGoodsModel])
  138 + }
  139 + self!.tableView.mj_footer?.endRefreshing()
  140 + self!.tableView.reloadData()
  141 + if (result as! Array<Any>).count == 0 {
  142 + self!.tableView.mj_footer?.endRefreshingWithNoMoreData()
  143 + self!.tableView.reloadData()
  144 + }
  145 + }else if (respStatue == .noNetwork) {
  146 + self!.network_type = .noNetwork
  147 + self!.tableView.reloadEmptyDataSet()
  148 + } else {
  149 + self!.network_type = .failed
  150 + self!.tableView.reloadEmptyDataSet()
  151 + }
  152 + }
  153 + }
  154 +
  155 + func addRefreshView() {
  156 + tableView.mj_footer = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in
  157 + self!.pageNum = self!.pageNum + 1
  158 + self!.loadDataSourceAction(page: self!.pageNum)
  159 + })
  160 + }
  161 +
  162 + @objc func closeClick() {
  163 + self.endEditing(true)
  164 + listBackView.snp.remakeConstraints { make in
  165 + make.left.right.equalToSuperview()
  166 + make.top.equalTo(self.snp.bottom)
  167 + make.height.equalTo(adapt_length(length: 390))
  168 + }
  169 + removeFromSuperview()
  170 + }
  171 +
  172 + @objc func keyboardWillShow(notification: NSNotification) {
  173 + let userInfo = notification.userInfo! as NSDictionary
  174 + let rect = (userInfo[UIResponder.keyboardFrameEndUserInfoKey] as! NSValue).cgRectValue
  175 + let height = rect.size.height
  176 + UIView.animate(withDuration: 1) { [self] in
  177 + listBackView.snp.remakeConstraints { make in
  178 + make.left.right.equalToSuperview()
  179 + make.top.equalTo(self.snp.bottom).offset(-adapt_length(length: 300) - height)
  180 + make.height.equalTo(adapt_length(length: 390))
  181 + }
  182 + }
  183 + }
  184 +
  185 + @objc func keyboardWillHide(notification: NSNotification) {
  186 + UIView.animate(withDuration: 1) { [self] in
  187 + listBackView.snp.remakeConstraints { make in
  188 + make.left.right.equalToSuperview()
  189 + make.top.equalTo(self.snp.bottom).offset(-adapt_length(length: 390))
  190 + make.height.equalTo(adapt_length(length: 390))
  191 + }
  192 + }
  193 + }
  194 +
  195 + static func couponGoodsShow(_ clickGoodsCallBack: @escaping clickCouponChooseGoodsCallBack) {
  196 + let goodsView = ShopBodyCouponGoodsListView.init(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: KSreenHeight))
  197 + goodsView.clickGoodsCallBack = clickGoodsCallBack
  198 + UIApplication.shared.delegate?.window?!.addSubview(goodsView)
  199 + UIView.animate(withDuration: 1) {
  200 + goodsView.listBackView.snp.remakeConstraints { make in
  201 + make.left.right.bottom.equalTo(goodsView)
  202 + make.top.equalTo(goodsView.snp.bottom).offset(-adapt_length(length: 390))
  203 + }
  204 + }
  205 + }
  206 +
  207 + required init?(coder: NSCoder) {
  208 + fatalError("init(coder:) has not been implemented")
  209 + }
  210 +
  211 + func numberOfSections(in tableView: UITableView) -> Int {
  212 + return 1
  213 + }
  214 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  215 + return dataArray.count
  216 + }
  217 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  218 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kShopBodyCouponGoodsListTableViewCellIdentifier) as? ShopBodyCouponGoodsListTableViewCell else {
  219 + return ShopBodyCouponGoodsListTableViewCell()
  220 + }
  221 + cell.setupWithDataSource(goodsModel: dataArray[indexPath.row] as! ShopOrderAssociatedGoodsModel)
  222 + return cell
  223 + }
  224 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  225 + return adapt_length(length: 90)
  226 + }
  227 +
  228 + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  229 + let model = dataArray[indexPath.row] as! ShopOrderAssociatedGoodsModel
  230 + if (clickGoodsCallBack != nil) {
  231 + clickGoodsCallBack(model)
  232 + }
  233 + closeClick()
  234 + }
  235 +
  236 +
  237 + func image(forEmptyDataSet scrollView: UIScrollView) -> UIImage? {
  238 + if network_type == .failed || network_type == .unkonw {
  239 + return UIImage(named: "mine_list_source_unusual_failed")
  240 + }
  241 + if dataArray.count == 0 {
  242 + return UIImage(named: "mine_list_source_unusual_empty")
  243 + }
  244 + if network_type == .noNetwork {
  245 + return UIImage(named: "mine_list_source_unusual_noNet")
  246 + }
  247 + return UIImage(named: "mine_list_source_unusual_empty")
  248 + }
  249 +
  250 + func title(forEmptyDataSet scrollView: UIScrollView) -> NSAttributedString? {
  251 + var defult_string = ""
  252 + if network_type == .failed || network_type == .unkonw {
  253 + defult_string = "接口请求错误,刷新试试~"
  254 + }
  255 + if network_type == .noNetwork {
  256 + defult_string = "网络开小差了,刷新试试~"
  257 + }
  258 + if dataArray.count == 0 {
  259 + defult_string = "暂时没有数据~"
  260 + }
  261 + return NSAttributedString(string: defult_string, attributes: [.font: Font_17,.foregroundColor: HexColor("#666666")!])
  262 + }
  263 +
  264 + func buttonTitle(forEmptyDataSet scrollView: UIScrollView, for state: UIControl.State) -> NSAttributedString? {
  265 + if network_type == .failed || network_type == .noNetwork {
  266 + let attributes = [NSAttributedString.Key.font:Font_16_Fit,
  267 + NSAttributedString.Key.foregroundColor: HexColor("#609BFF")]
  268 + return NSAttributedString(string: "刷一刷", attributes: attributes as [NSAttributedString.Key : Any])
  269 + }
  270 + return nil
  271 + }
  272 +
  273 + func emptyDataSet(_ scrollView: UIScrollView, didTapView view: UIView) {
  274 + if network_type == .failed || network_type == .noNetwork {
  275 + loadDataSourceAction(page: 1)
  276 + }
  277 + }
  278 +
  279 +}
  280 +
  281 +class ShopBodyCouponGoodsListTableViewCell: UITableViewCell {
  282 +
  283 + lazy var backView: UIView = {
  284 + let backView = UIView.init()
  285 + backView.backgroundColor = HexColor("#f9f9f9")
  286 + backView.layer.cornerRadius = adapt_length(length: 6)
  287 + return backView
  288 + }()
  289 +
  290 + lazy var singImageView: UIImageView = {
  291 + let singImageView = UIImageView.init()
  292 + singImageView.contentMode = .scaleAspectFit
  293 + singImageView.layer.cornerRadius = adapt_length(length: 5)
  294 + return singImageView
  295 + }()
  296 +
  297 + lazy var titleLabel: UILabel = {
  298 + let titleLabel = UILabel.init()
  299 + titleLabel.textAlignment = .justified
  300 + titleLabel.numberOfLines = 2
  301 + titleLabel.textColor = HexColor("#333333")
  302 + titleLabel.font = regular_adapt_font(pointSize: 13)
  303 + return titleLabel
  304 + }()
  305 +
  306 + lazy var priceLabel: UILabel = {
  307 + let priceLabel = UILabel.init()
  308 + priceLabel.font = regular_adapt_font(pointSize: 12)
  309 + priceLabel.textAlignment = .left
  310 + priceLabel.textColor = HexColor("#333333")
  311 + return priceLabel
  312 + }()
  313 +
  314 + lazy var sendBtn: UIButton = {
  315 + let sendBtn = UIButton.init(type: .custom)
  316 + let layer = CAGradientLayer()
  317 + layer.frame = CGRect(x: 0, y: 0, width: adapt_length(length: 65), height: adapt_length(length: 19))
  318 + layer.startPoint = CGPoint(x: 0, y: 0.5)
  319 + layer.endPoint = CGPoint(x: 1, y: 0.5)
  320 + layer.locations = [0,1]
  321 + layer.colors = [HexColor("#fd9700")?.cgColor as Any,HexColor("#ff5907")?.cgColor as Any]
  322 + sendBtn.layer.addSublayer(layer)
  323 + sendBtn.right = backView.width - 10
  324 + sendBtn.bottom = backView.bottom - 10
  325 + sendBtn.isUserInteractionEnabled = false
  326 + sendBtn.setTitle("选择商品", for: .normal)
  327 + sendBtn.setTitleColor(.white, for: .normal)
  328 + sendBtn.titleLabel?.font = regular_adapt_font(pointSize: 13)
  329 + sendBtn.layer.cornerRadius = adapt_length(length: 6)
  330 + sendBtn.clipsToBounds = true
  331 + return sendBtn
  332 + }()
  333 +
  334 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  335 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  336 + contentView.backgroundColor = .clear
  337 + selectionStyle = .none
  338 +
  339 + addSubview(backView)
  340 + backView.snp.makeConstraints { make in
  341 + make.top.equalToSuperview().offset(adapt_length(length: 10))
  342 + make.left.equalToSuperview().offset(adapt_length(length: 15))
  343 + make.right.equalToSuperview().offset(-adapt_length(length: 15))
  344 + make.bottom.equalToSuperview()
  345 + }
  346 + addSubview(singImageView)
  347 + singImageView.snp.makeConstraints { make in
  348 + make.left.top.equalTo(backView).offset(adapt_length(length: 10))
  349 + make.size.equalTo(adapt_length(length: 60))
  350 + }
  351 + addSubview(titleLabel)
  352 + titleLabel.snp.makeConstraints { make in
  353 + make.left.equalTo(singImageView.snp.right).offset(adapt_length(length: 10))
  354 + make.right.equalTo(backView).offset(-adapt_length(length: 10))
  355 + make.top.equalTo(singImageView)
  356 + }
  357 + addSubview(priceLabel)
  358 + priceLabel.snp.makeConstraints { make in
  359 + make.left.equalTo(titleLabel)
  360 + make.bottom.equalTo(singImageView)
  361 + }
  362 + addSubview(sendBtn)
  363 + sendBtn.snp.makeConstraints { make in
  364 + make.right.equalTo(titleLabel)
  365 + make.bottom.equalTo(singImageView)
  366 + make.width.equalTo(adapt_length(length: 65))
  367 + make.height.equalTo(adapt_length(length: 19))
  368 + }
  369 + }
  370 +
  371 + func setupWithDataSource(goodsModel: ShopOrderAssociatedGoodsModel) {
  372 + singImageView.kf.setImage(with: URL(string: goodsModel.simg!), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: adapt_length(length: 60), height: adapt_length(length: 60))))
  373 + titleLabel.text = goodsModel.title
  374 + priceLabel.text = "¥\(goodsModel.price ?? "0.00")"
  375 + }
  376 +
  377 + required init?(coder: NSCoder) {
  378 + fatalError("init(coder:) has not been implemented")
  379 + }
  380 +
  381 +}
  382 +
  383 +class ShopBodyCouponGoodsSearchView: UIView, UITextFieldDelegate {
  384 +
  385 + lazy var searchTextField: UITextField = {
  386 + let searchTextField = UITextField.init()
  387 +
  388 + let view = UIView.init(frame: CGRectMake(0, 0, adapt_length(length: 30), adapt_length(length: 30)))
  389 +
  390 + let imageView = UIImageView.init(frame: CGRect(x: adapt_length(length: 7), y: adapt_length(length: 4), width: adapt_length(length: 22), height: adapt_length(length: 22)))
  391 + imageView.image = UIImage(named: "DS_order_search")
  392 + imageView.clipsToBounds = true
  393 + imageView.contentMode = .scaleAspectFit
  394 + view.addSubview(imageView)
  395 +
  396 + searchTextField.leftView = view
  397 + searchTextField.delegate = self
  398 + searchTextField.leftViewMode = .always
  399 + searchTextField.placeholder = "请输入商品名称或商品货号"
  400 + searchTextField.backgroundColor = HexColor("#f0f0f0")
  401 + searchTextField.returnKeyType = .search
  402 + searchTextField.layer.cornerRadius = adapt_length(length: 15)
  403 + searchTextField.layer.masksToBounds = true
  404 + searchTextField.font = regular_adapt_font(pointSize: 13)
  405 + return searchTextField
  406 + }()
  407 +
  408 + lazy var searchButton: UIButton = {
  409 + let searchButton = UIButton.init(type: .custom)
  410 + searchButton.setTitle("搜索", for: .normal)
  411 + searchButton.titleLabel?.font = semibold_adapt_font(pointSize: 15)
  412 + searchButton.setTitleColor(HexColor("#ff3355"), for: .normal)
  413 + searchButton.backgroundColor = .clear
  414 + searchButton.layer.masksToBounds = true
  415 + searchButton.layer.cornerRadius = 5
  416 + searchButton.addTarget(self, action: #selector(searchBtnClick), for: .touchUpInside)
  417 + return searchButton
  418 + }()
  419 +
  420 + var searchCallBack: clickCouponSearchTextFieldCallBack!
  421 + override init(frame: CGRect) {
  422 + super.init(frame: frame)
  423 + backgroundColor = .clear
  424 +
  425 + addSubview(searchButton)
  426 + searchButton.snp.makeConstraints { make in
  427 + make.centerY.equalToSuperview()
  428 + make.right.equalToSuperview().offset(-adapt_length(length: 15))
  429 + make.width.equalTo(adapt_length(length: 60))
  430 + make.height.equalTo(adapt_length(length: 25))
  431 + }
  432 +
  433 + addSubview(searchTextField)
  434 + searchTextField.snp.makeConstraints { make in
  435 + make.left.equalToSuperview().offset(adapt_length(length: 15))
  436 + make.centerY.centerY.equalToSuperview()
  437 + make.right.equalTo(searchButton.snp.left).offset(-adapt_length(length: 15))
  438 + make.height.equalTo(adapt_length(length: 30))
  439 + }
  440 +
  441 +
  442 + }
  443 +
  444 + @objc func searchBtnClick() {
  445 + if (searchCallBack != nil) {
  446 + searchCallBack(searchTextField.text!)
  447 + }
  448 + self.endEditing(true)
  449 + }
  450 +
  451 + required init?(coder: NSCoder) {
  452 + fatalError("init(coder:) has not been implemented")
  453 + }
  454 +
  455 + func textFieldDidEndEditing(_ textField: UITextField) {
  456 + if (searchCallBack != nil) {
  457 + searchCallBack(textField.text!)
  458 + }
  459 + }
  460 +
  461 + func textFieldShouldReturn(_ textField: UITextField) -> Bool {
  462 + self.endEditing(true)
  463 + return true
  464 + }
  465 +}
  466 +
  467 +
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyCouponView.swift 0 → 100644
  1 +//
  2 +// CNLiveShopCouponView.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/11/16.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +
  11 +typealias clickCouponGoodsHiddenCallBack = (_ isHidden: Bool) -> Void
  12 +typealias clickCouponTextFieldCallBack = (_ section: String,_ number: String) -> Void
  13 +typealias clickCouponDateSelectCallBack = (_ id: NSString,_ date: NSDate) -> Void
  14 +typealias clickCouponGoodsCallBack = (_ goodsId: String) -> Void
  15 +typealias clickCouponSelectCallBack = (_ section: NSInteger) -> Void
  16 +class ShopBodyCouponCreateTableViewCell: UITableViewCell, UITextFieldDelegate {
  17 +
  18 + lazy var leftLabel: UILabel = {
  19 + let leftLabel = UILabel.init()
  20 + leftLabel.textColor = .red
  21 + leftLabel.textAlignment = .center
  22 + leftLabel.font = semibold_adapt_font(pointSize: 18)
  23 + leftLabel.text = "*"
  24 + return leftLabel
  25 + }()
  26 +
  27 + lazy var titleLabel: UILabel = {
  28 + let titleLabel = UILabel.init()
  29 + titleLabel.textColor = HexColor("#333333")
  30 + titleLabel.font = medium_adapt_font(pointSize: 14)
  31 + return titleLabel
  32 + }()
  33 +
  34 + lazy var lineView: UILabel = {
  35 + let lineLabel = UILabel.init()
  36 + lineLabel.backgroundColor = HexColor("#f6f6f6")
  37 + return lineLabel
  38 + }()
  39 +
  40 + lazy var titleNumber: UITextField = {
  41 + let titleNumber = UITextField.init()
  42 + titleNumber.textColor = HexColor("#333333")
  43 + titleNumber.font = regular_adapt_font(pointSize: 14)
  44 + titleNumber.textAlignment = .right
  45 + titleNumber.delegate = self
  46 + return titleNumber
  47 + }()
  48 +
  49 + lazy var moneyView: ShopBodyCreateCouponTypeMoneyView = {
  50 + let moneyView = ShopBodyCreateCouponTypeMoneyView.init(frame: CGRect.zero)
  51 + moneyView.textFieldCallBack = { [weak self] section, number in
  52 + if self!.textFieldCallBack != nil {
  53 + self!.textFieldCallBack(section, number)
  54 + }
  55 + }
  56 + return moneyView
  57 + }()
  58 +
  59 + lazy var chooseView: ShopBodySelectCouponTapView = {
  60 + let chooseView = ShopBodySelectCouponTapView.init(frame: .zero)
  61 + chooseView.selectCallBack = { [weak self] section in
  62 + self!._couponModel.section = "\(section)"
  63 + if self!._couponModel.id == "6" {
  64 + if (self!.goodsHiddenCallBack != nil) {
  65 + self!.goodsHiddenCallBack(section == 1)
  66 + }
  67 + }
  68 + }
  69 + return chooseView
  70 + }()
  71 +
  72 + lazy var rightView: UIImageView = {
  73 + let rightView = UIImageView.init()
  74 + rightView.contentMode = .scaleAspectFit
  75 + rightView.image = UIImage(named: "mine_header_message_gray_more")
  76 + return rightView
  77 + }()
  78 +
  79 + lazy var goodsLabel: UITextField = {
  80 + let goodsLabel = UITextField.init()
  81 + goodsLabel.textColor = HexColor("#333333")
  82 + goodsLabel.font = regular_adapt_font(pointSize: 14)
  83 + goodsLabel.textAlignment = .right
  84 + goodsLabel.delegate = self
  85 + goodsLabel.isEnabled = false
  86 + return goodsLabel
  87 + }()
  88 +
  89 + lazy var showSwitch: UISwitch = {
  90 + let showSwitch = UISwitch.init()
  91 + showSwitch.addTarget(self, action: #selector(switchChange), for: .valueChanged)
  92 + return showSwitch
  93 + }()
  94 +
  95 + var textFieldCallBack: clickCouponTextFieldCallBack!
  96 + var goodsHiddenCallBack: clickCouponGoodsHiddenCallBack!
  97 + var dateSelectCallBack: clickCouponDateSelectCallBack!
  98 + var goodsCallBack: clickCouponGoodsCallBack!
  99 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  100 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  101 + contentView.backgroundColor = .clear
  102 + selectionStyle = .none
  103 + currentDate = Date() as NSDate
  104 +
  105 + addSubview(leftLabel)
  106 + leftLabel.snp.makeConstraints { make in
  107 + make.centerY.equalToSuperview()
  108 + make.left.equalToSuperview().offset(adapt_length(length: 5.5))
  109 + make.width.equalTo(adapt_length(length: 10))
  110 + make.height.equalTo(adapt_length(length: 15))
  111 + }
  112 +
  113 + addSubview(titleLabel)
  114 + titleLabel.snp.makeConstraints { make in
  115 + make.left.equalTo(leftLabel.snp.right).offset(adapt_length(length: 2.5))
  116 + make.centerY.equalToSuperview()
  117 + make.width.equalTo(adapt_length(length: 70))
  118 + }
  119 +
  120 + addSubview(lineView)
  121 + lineView.snp.makeConstraints { make in
  122 + make.left.equalToSuperview().offset(adapt_length(length: 15))
  123 + make.right.equalToSuperview().offset(-adapt_length(length: 15))
  124 + make.height.equalTo(adapt_length(length: 0.5))
  125 + make.bottom.equalToSuperview()
  126 + }
  127 +
  128 + addSubview(titleNumber)
  129 + titleNumber.snp.makeConstraints { make in
  130 + make.right.equalToSuperview().offset(-adapt_length(length: 15))
  131 + make.left.equalTo(titleLabel.snp.right)
  132 + make.centerY.equalToSuperview()
  133 + }
  134 + addSubview(moneyView)
  135 + moneyView.snp.makeConstraints { make in
  136 + make.right.equalTo(titleNumber)
  137 + make.centerY.height.equalToSuperview()
  138 + make.left.equalTo(titleLabel.snp.right)
  139 + }
  140 + addSubview(chooseView)
  141 + chooseView.snp.makeConstraints { make in
  142 + make.right.equalTo(titleNumber)
  143 + make.centerY.height.equalToSuperview()
  144 + make.left.equalTo(titleLabel.snp.right)
  145 + }
  146 + addSubview(rightView)
  147 + rightView.snp.makeConstraints { make in
  148 + make.right.equalTo(titleNumber)
  149 + make.centerY.height.equalToSuperview()
  150 + make.width.height.equalTo(adapt_length(length: 16))
  151 + }
  152 + addSubview(goodsLabel)
  153 + goodsLabel.snp.makeConstraints { make in
  154 + make.right.equalTo(rightView.snp.left).offset(-adapt_length(length: 5))
  155 + make.centerY.equalToSuperview()
  156 + }
  157 + addSubview(showSwitch)
  158 + showSwitch.snp.makeConstraints { make in
  159 + make.right.equalTo(titleNumber)
  160 + make.centerY.equalToSuperview()
  161 + }
  162 + }
  163 +
  164 + var editEnabled: Bool!
  165 + var currentDate: NSDate!
  166 + var _couponModel: ShopOrderCouponDataModel!
  167 + func setupWithDataSource(couponModel: ShopOrderCouponDataModel) {
  168 + _couponModel = couponModel
  169 + titleLabel.text = couponModel.title
  170 + leftLabel.isHidden = true
  171 + titleNumber.isHidden = true
  172 + moneyView.isHidden = true
  173 + chooseView.isHidden = true
  174 + goodsLabel.isHidden = true
  175 + rightView.isHidden = true
  176 + showSwitch.isHidden = true
  177 + if Int(couponModel.id!)!%5 == 0 {
  178 + lineView.isHidden = true
  179 + } else {
  180 + lineView.isHidden = false
  181 + }
  182 + switch couponModel.type {
  183 + case "1":
  184 + leftLabel.isHidden = false
  185 + titleNumber.isHidden = false
  186 + titleNumber.isEnabled = true
  187 + titleNumber.placeholder = couponModel.subTitle
  188 + titleNumber.text = couponModel.message
  189 + if couponModel.id == "3" {
  190 + titleNumber.keyboardType = .numberPad
  191 + } else {
  192 + titleNumber.keyboardType = .default
  193 + }
  194 + break
  195 + case "2":
  196 + leftLabel.isHidden = false
  197 + moneyView.isHidden = false
  198 + moneyView.editEnabled = editEnabled
  199 + moneyView._couponModel = couponModel
  200 + break
  201 + case "3":
  202 + leftLabel.isHidden = false
  203 + titleNumber.isHidden = false
  204 + titleNumber.placeholder = couponModel.subTitle
  205 + titleNumber.isEnabled = false
  206 + if couponModel.message!.isNotBlank() {
  207 + let interval = Double(couponModel.message!)!
  208 + let formatter = DateFormatter.init()
  209 + formatter.dateFormat = "yyyy-MM-dd"
  210 + let date = NSDate.init(timeIntervalSince1970: interval)
  211 + let dateStr = formatter.string(from: date as Date)
  212 + titleNumber.text = dateStr
  213 + }
  214 + break
  215 + case "4":
  216 + chooseView.isHidden = false
  217 + chooseView.editEnabled = editEnabled
  218 + chooseView.titles = selectTitles(id: _couponModel.id!)
  219 + chooseView.selectIndex = Int(couponModel.section!)
  220 + break
  221 + case "5":
  222 + rightView.isHidden = false
  223 + goodsLabel.isHidden = false
  224 + goodsLabel.placeholder = couponModel.subTitle
  225 + goodsLabel.text = couponModel.message
  226 + break
  227 + case "6":
  228 + showSwitch.isHidden = false
  229 + if couponModel.section == "1" {
  230 + showSwitch.isOn = true
  231 + } else {
  232 + showSwitch.isOn = false
  233 + }
  234 + break
  235 + default:
  236 + break
  237 + }
  238 + }
  239 +
  240 + override func setSelected(_ selected: Bool, animated: Bool) {
  241 + if _couponModel.type == "3" && selected {
  242 + if !editEnabled {
  243 + showMessage(message: "该项不可编辑")
  244 + return
  245 + }
  246 + MineStandListAlertView.showStandListView(infos: [currentDate!,"YYYY-MM-dd"], name:_couponModel.subTitle!, show_type:.min_date, result: { [self] text in
  247 + currentDate = (text as! NSString).timeStrChangeTotimedate("YYYY-MM-dd")
  248 + titleNumber.text = (text as! String)
  249 + if (dateSelectCallBack != nil) {
  250 + let formatter = DateFormatter.init()
  251 + formatter.dateFormat = "yyyy-MM-dd"
  252 + formatter.timeZone = NSTimeZone.local
  253 + dateSelectCallBack(_couponModel.id! as NSString,formatter.date(from: text as! String)! as NSDate)
  254 + }
  255 + })
  256 + } else if _couponModel.type == "5" && selected {
  257 + if !editEnabled {
  258 + showMessage(message: "该项不可编辑")
  259 + return
  260 + }
  261 + ShopBodyCouponGoodsListView.couponGoodsShow { [self] model in
  262 + if (goodsCallBack != nil) {
  263 + goodsCallBack(model.id ?? "")
  264 + }
  265 + if model.title!.count > 20 {
  266 + goodsLabel.text = (model.title! as NSString).substring(with: NSRange(location: 0, length: 20))
  267 + } else {
  268 + goodsLabel.text = model.title
  269 + }
  270 + }
  271 + }
  272 + }
  273 +
  274 + required init?(coder: NSCoder) {
  275 + fatalError("init(coder:) has not been implemented")
  276 + }
  277 +
  278 + @objc func switchChange(sender: UISwitch) {
  279 + _couponModel.section = sender.isOn ? "1" : "2"
  280 + }
  281 +
  282 + func selectTitles(id: String) -> NSArray {
  283 + var selectTitles: NSArray = []
  284 + switch id {
  285 + case "6":
  286 + selectTitles = ["店铺全场","单个商品"]
  287 + break
  288 + case "8":
  289 + selectTitles = ["正常","冻结"]
  290 + break
  291 + case "9":
  292 + selectTitles = ["不限","限一次"]
  293 + break
  294 + default:
  295 + break
  296 + }
  297 + return selectTitles
  298 + }
  299 +
  300 + func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
  301 + if _couponModel.id != "1" {
  302 + if !editEnabled {
  303 + showMessage(message: "该项不可编辑")
  304 + return false
  305 + }
  306 + }
  307 + return true
  308 + }
  309 +
  310 + func textFieldDidEndEditing(_ textField: UITextField) {
  311 + if (textFieldCallBack != nil) {
  312 + if _couponModel.id == "1" {
  313 + _couponModel.message = textField.text
  314 + }
  315 + textFieldCallBack(_couponModel.id!, textField.text!)
  316 + }
  317 + }
  318 +
  319 + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
  320 + if _couponModel.id == "1" {
  321 + if textField.text!.count + string.count > 20 {
  322 + textField.text = textField.text! + (string as NSString).substring(with: NSMakeRange(0, 20-textField.text!.count))
  323 + return false
  324 + }
  325 + return true
  326 + }
  327 + return true
  328 + }
  329 +}
  330 +
  331 +
  332 +class ShopBodyCreateCouponTypeMoneyView: UIView, UITextFieldDelegate {
  333 +
  334 + lazy var man1Label: UILabel = {
  335 + let man1Label = UILabel.init()
  336 + man1Label.textColor = HexColor("#999999")
  337 + man1Label.font = regular_adapt_font(pointSize: 14)
  338 + man1Label.text = "满"
  339 + return man1Label
  340 + }()
  341 +
  342 + lazy var maxPut: UITextField = {
  343 + let maxPut = UITextField.init()
  344 + maxPut.textColor = HexColor("#333333")
  345 + maxPut.font = regular_adapt_font(pointSize: 14)
  346 + maxPut.delegate = self
  347 + maxPut.tag = 1001
  348 + maxPut.textAlignment = .center
  349 + maxPut.backgroundColor = HexColor("#f9f9f9")
  350 + maxPut.keyboardType = .numberPad
  351 + let path = UIBezierPath.init(roundedRect: CGRectMake(0, 0, adapt_length(length: 60), adapt_length(length: 29)), byRoundingCorners: .allCorners, cornerRadii: CGSize(width: adapt_length(length: 4), height: adapt_length(length: 4)))
  352 + let shapelayer = CAShapeLayer()
  353 + shapelayer.path = path.cgPath
  354 + maxPut.layer.mask = shapelayer
  355 + return maxPut
  356 + }()
  357 +
  358 + lazy var midLabel: UILabel = {
  359 + let midLabel = UILabel.init()
  360 + midLabel.textColor = HexColor("#999999")
  361 + midLabel.font = regular_adapt_font(pointSize: 14)
  362 + midLabel.text = "元减"
  363 + return midLabel
  364 + }()
  365 +
  366 + lazy var lessPut: UITextField = {
  367 + let lessPut = UITextField.init()
  368 + lessPut.textColor = HexColor("#333333")
  369 + lessPut.font = regular_adapt_font(pointSize: 14)
  370 + lessPut.delegate = self
  371 + lessPut.tag = 1002
  372 + lessPut.textAlignment = .center
  373 + lessPut.backgroundColor = HexColor("#f9f9f9")
  374 + lessPut.keyboardType = .numberPad
  375 + let path = UIBezierPath.init(roundedRect: CGRectMake(0, 0, adapt_length(length: 60), adapt_length(length: 29)), byRoundingCorners: .allCorners, cornerRadii: CGSize(width: adapt_length(length: 4), height: adapt_length(length: 4)))
  376 + let shapelayer = CAShapeLayer()
  377 + shapelayer.path = path.cgPath
  378 + lessPut.layer.mask = shapelayer
  379 + return lessPut
  380 + }()
  381 +
  382 + lazy var lastLabel: UILabel = {
  383 + let lastLabel = UILabel.init()
  384 + lastLabel.textColor = HexColor("#999999")
  385 + lastLabel.font = regular_adapt_font(pointSize: 14)
  386 + lastLabel.text = "元"
  387 + return lastLabel
  388 + }()
  389 +
  390 + var editEnabled: Bool!
  391 + var _couponModel: ShopOrderCouponDataModel!
  392 + var textFieldCallBack: clickCouponTextFieldCallBack!
  393 + override init(frame: CGRect) {
  394 + super.init(frame: frame)
  395 + addSubview(lastLabel)
  396 + lastLabel.snp.makeConstraints { make in
  397 + make.right.centerY.equalToSuperview()
  398 + }
  399 + addSubview(lessPut)
  400 + lessPut.snp.makeConstraints { make in
  401 + make.right.equalTo(lastLabel.snp.left).offset(-adapt_length(length: 10))
  402 + make.centerY.equalToSuperview()
  403 + make.width.equalTo(adapt_length(length: 60))
  404 + make.height.equalTo(adapt_length(length: 29))
  405 + }
  406 + addSubview(midLabel)
  407 + midLabel.snp.makeConstraints { make in
  408 + make.centerY.equalToSuperview()
  409 + make.right.equalTo(lessPut.snp.left).offset(-adapt_length(length: 10))
  410 + }
  411 + addSubview(maxPut)
  412 + maxPut.snp.makeConstraints { make in
  413 + make.right.equalTo(midLabel.snp.left).offset(-adapt_length(length: 10))
  414 + make.centerY.equalToSuperview()
  415 + make.width.equalTo(adapt_length(length: 60))
  416 + make.height.equalTo(adapt_length(length: 29))
  417 + }
  418 + addSubview(man1Label)
  419 + man1Label.snp.makeConstraints { make in
  420 + make.centerY.equalToSuperview()
  421 + make.right.equalTo(maxPut.snp.left).offset(-adapt_length(length: 10))
  422 + }
  423 + }
  424 +
  425 + func setupWithDataSource(couponModel: ShopOrderCouponDataModel) {
  426 + _couponModel = couponModel
  427 +
  428 + maxPut.text = couponModel.filled
  429 + lessPut.text = couponModel.disCount
  430 + }
  431 +
  432 + required init?(coder: NSCoder) {
  433 + fatalError("init(coder:) has not been implemented")
  434 + }
  435 +
  436 + func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool {
  437 + if !editEnabled {
  438 + showMessage(message: "该项不可编辑")
  439 + return false
  440 + }
  441 + return true
  442 + }
  443 + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
  444 + if string == "" {
  445 + return true
  446 + }
  447 + if !string.isNotBlank() {
  448 + return false
  449 + }
  450 + let cs = NSCharacterSet.init(charactersIn: "0123456789.").inverted
  451 + let filtered = (string.components(separatedBy: cs) as NSArray).componentsJoined(by: "")
  452 + if string != filtered {
  453 + return false
  454 + }
  455 + return true
  456 + }
  457 + func textFieldDidEndEditing(_ textField: UITextField) {
  458 + if textFieldCallBack != nil {
  459 + textFieldCallBack("\(textField.tag)",textField.text!)
  460 + }
  461 + }
  462 +}
  463 +
  464 +class ShopBodySelectCouponTapView: UIView {
  465 +
  466 + var _titles: NSArray?
  467 + var titles: NSArray? {
  468 + get {
  469 + return _titles
  470 + }
  471 + set {
  472 + _titles = newValue
  473 + titles?.enumerateObjects({ obj, idx, stop in
  474 + let btn = UIButton.init(type: .custom)
  475 + btn.setTitleColor(HexColor("#666666"), for: .normal)
  476 + btn.setTitle(obj as? String, for: .normal)
  477 + btn.setImage(UIImage(named: "DS_coupon_unSelect"), for: .normal)
  478 + btn.titleLabel?.font = regular_adapt_font(pointSize: 15)
  479 + btn.setImage(UIImage(named: "DS_coupon_select"), for: .selected)
  480 + btn.tag = 1001+idx
  481 + btn.addTarget(self, action: #selector(selectIndexClick), for: .touchUpInside)
  482 + addSubview(btn)
  483 + btnArray.add(btn)
  484 + })
  485 + let btn1 = btnArray[1] as! UIButton
  486 + let btn2 = btnArray[0] as! UIButton
  487 + var width1: CGFloat = 0.0
  488 + if (titles![1] as! String).count == 4 {
  489 + width1 = adapt_length(length: 83)
  490 + } else if (titles![1] as! String).count == 3 {
  491 + width1 = adapt_length(length: 68)
  492 + } else if (titles![1] as! String).count == 2 {
  493 + width1 = adapt_length(length: 53)
  494 + }
  495 + btn1.snp.makeConstraints { make in
  496 + make.right.equalToSuperview()
  497 + make.width.equalTo(width1)
  498 + make.height.equalToSuperview()
  499 + }
  500 + var width2: CGFloat = 0.0
  501 + if (titles![0] as! String).count == 4 {
  502 + width2 = adapt_length(length: 83)
  503 + } else if (titles![0] as! String).count == 3 {
  504 + width2 = adapt_length(length: 68)
  505 + } else if (titles![0] as! String).count == 2 {
  506 + width2 = adapt_length(length: 53)
  507 + }
  508 + btn2.snp.makeConstraints { make in
  509 + make.right.equalTo(btn1.snp.left).offset(-adapt_length(length: 30))
  510 + make.width.equalTo(width2)
  511 + make.height.equalToSuperview()
  512 + }
  513 + }
  514 + }
  515 + var _selectIndex: NSInteger?
  516 + var selectIndex: NSInteger? {
  517 + get {
  518 + return _selectIndex
  519 + }
  520 + set {
  521 + _selectIndex = newValue
  522 + for item in btnArray {
  523 + let btn = item as! UIButton
  524 + if btn.tag - 1000 == selectIndex {
  525 + btn.isSelected = true
  526 + } else {
  527 + btn.isSelected = false
  528 + }
  529 + }
  530 + }
  531 + }
  532 +
  533 + lazy var btnArray: NSMutableArray = {
  534 + let btnArray = NSMutableArray.init()
  535 + return btnArray
  536 + }()
  537 +
  538 + var editEnabled: Bool!
  539 + var selectCallBack: clickCouponSelectCallBack!
  540 + override init(frame: CGRect) {
  541 + super.init(frame: frame)
  542 +
  543 + }
  544 +
  545 + @objc func selectIndexClick(sender: UIButton) {
  546 + if !editEnabled {
  547 + showMessage(message: "该项不可编辑")
  548 + return
  549 + }
  550 + for item in btnArray {
  551 + let btn = item as! UIButton
  552 + if btn.tag == sender.tag {
  553 + btn.isSelected = true
  554 + if (selectCallBack != nil) {
  555 + selectCallBack(sender.tag - 1000)
  556 + }
  557 + } else {
  558 + btn.isSelected = false
  559 + }
  560 + }
  561 + }
  562 +
  563 + required init?(coder: NSCoder) {
  564 + fatalError("init(coder:) has not been implemented")
  565 + }
  566 +}
  567 +
  568 +
  569 +
  570 +
metaCode/Classes/Main/ShopPage/View/CNLiveShopBodyTransListView.swift 0 → 100644
  1 +//
  2 +// CNLiveShopTransListView.swift
  3 +// metaCode
  4 +//
  5 +// Created by open on 2023/11/15.
  6 +//
  7 +
  8 +import Foundation
  9 +import Kingfisher
  10 +
  11 +typealias clickTransListHeaderCallBack = (_ headerView: ShopBodyTransListHeaderView) -> Void
  12 +class ShopBodyTransListHeaderView: UIView {
  13 +
  14 + lazy var dateLab: UILabel = {
  15 + let dateLab = UILabel.init()
  16 + dateLab.textColor = HexColor("#333333")
  17 + dateLab.font = medium_adapt_font(pointSize: 16)
  18 + dateLab.text = NSDate.timeIntervalChangeToTimeStr(timeInterval: NSDate().timeIntervalSince1970, "YYYY年M月")
  19 + return dateLab
  20 + }()
  21 +
  22 + lazy var downArrowImageView: UIImageView = {
  23 + let downArrowImageView = UIImageView.init(image: UIImage(named: "ye_xl"))
  24 + downArrowImageView.contentMode = .scaleAspectFit
  25 + downArrowImageView.clipsToBounds = true
  26 + return downArrowImageView
  27 + }()
  28 +
  29 + lazy var priceLab: UILabel = {
  30 + let priceLab = UILabel.init()
  31 + priceLab.textColor = HexColor("#9d9d9d")
  32 + priceLab.font = medium_adapt_font(pointSize: 14)
  33 + priceLab.text = "支出 ¥0.00 收入 ¥0.00"
  34 + return priceLab
  35 + }()
  36 +
  37 + var clickBlcok: clickTransListHeaderCallBack!
  38 + override init(frame: CGRect) {
  39 + super.init(frame: frame)
  40 + backgroundColor = HexColor("#f6f6f6")
  41 +
  42 + addSubview(dateLab)
  43 + dateLab.snp.makeConstraints { make in
  44 + make.left.top.equalToSuperview().offset(adapt_length(length: 20))
  45 + make.height.equalTo(adapt_length(length: 23))
  46 + make.width.lessThanOrEqualTo(adapt_length(length: 300))
  47 + }
  48 + addSubview(downArrowImageView)
  49 + downArrowImageView.snp.makeConstraints { make in
  50 + make.left.equalTo(dateLab.snp.right).offset(adapt_length(length: 5))
  51 + make.centerY.equalTo(dateLab)
  52 + make.size.equalTo(CGSize(width: adapt_length(length: 10), height: adapt_length(length: 10)))
  53 + }
  54 + addSubview(priceLab)
  55 + priceLab.snp.makeConstraints { make in
  56 + make.left.equalToSuperview().offset(adapt_length(length: 20))
  57 + make.right.equalToSuperview().offset(-adapt_length(length: 20))
  58 + make.top.equalTo(dateLab.snp.bottom).offset(adapt_length(length: 5))
  59 + make.height.equalTo(adapt_length(length: 20))
  60 + }
  61 +
  62 + isUserInteractionEnabled = true
  63 + let tap = UITapGestureRecognizer(target: self, action: #selector(selfTap))
  64 + addGestureRecognizer(tap)
  65 + }
  66 +
  67 + @objc func selfTap() {
  68 + if (clickBlcok != nil) {
  69 + clickBlcok(self)
  70 + }
  71 + }
  72 +
  73 + required init?(coder: NSCoder) {
  74 + fatalError("init(coder:) has not been implemented")
  75 + }
  76 +}
  77 +
  78 +class ShopBodyTransListViewCell: UITableViewCell {
  79 +
  80 + lazy var iconImageView: UIImageView = {
  81 + let iconImageView = UIImageView.init(frame: CGRectMake(0, 0, adapt_length(length: 40), adapt_length(length: 40)))
  82 + iconImageView.contentMode = .scaleAspectFill
  83 + iconImageView.layer.cornerRadius = adapt_length(length: 20)
  84 + iconImageView.layer.masksToBounds = true
  85 + return iconImageView
  86 + }()
  87 +
  88 + lazy var titleLabel: UILabel = {
  89 + let titleLabel = UILabel.init()
  90 + titleLabel.textColor = HexColor("#333333")
  91 + titleLabel.font = medium_adapt_font(pointSize: 15)
  92 + return titleLabel
  93 + }()
  94 +
  95 + lazy var timeLabel: UILabel = {
  96 + let timeLabel = UILabel.init()
  97 + timeLabel.textColor = HexColor("#999999")
  98 + timeLabel.font = regular_adapt_font(pointSize: 12)
  99 + return timeLabel
  100 + }()
  101 +
  102 + lazy var payTypeImageView: UIImageView = {
  103 + let payTypeImageView = UIImageView.init(frame: CGRectMake(0, 0, adapt_length(length: 54), adapt_length(length: 16)))
  104 + payTypeImageView.contentMode = .scaleAspectFit
  105 + return payTypeImageView
  106 + }()
  107 +
  108 + lazy var priceLab: UILabel = {
  109 + let priceLab = UILabel.init()
  110 + priceLab.textColor = HexColor("#333333")
  111 + priceLab.font = medium_adapt_font(pointSize: 18)
  112 + priceLab.textAlignment = .right
  113 + return priceLab
  114 + }()
  115 +
  116 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  117 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  118 + contentView.backgroundColor = .clear
  119 + selectionStyle = .none
  120 +
  121 + addSubview(iconImageView)
  122 + iconImageView.snp.makeConstraints { make in
  123 + make.centerY.equalToSuperview()
  124 + make.left.equalToSuperview().offset(20)
  125 + make.size.equalTo(adapt_length(length: 40))
  126 + }
  127 + addSubview(titleLabel)
  128 + titleLabel.snp.makeConstraints { make in
  129 + make.left.equalTo(iconImageView.snp.right).offset(adapt_length(length: 15))
  130 + make.right.equalToSuperview().offset(-adapt_length(length: 75))
  131 + make.top.equalTo(iconImageView.snp.top)
  132 + make.height.equalTo(adapt_length(length: 21))
  133 + }
  134 + addSubview(timeLabel)
  135 + timeLabel.snp.makeConstraints { make in
  136 + make.left.equalTo(titleLabel.snp.left)
  137 + make.top.equalTo(titleLabel.snp.bottom).offset(adapt_length(length: 5))
  138 + make.size.equalTo(CGSize(width: adapt_length(length: 130), height: 17))
  139 + }
  140 + addSubview(payTypeImageView)
  141 + payTypeImageView.snp.makeConstraints { make in
  142 + make.right.equalToSuperview().offset(-adapt_length(length: 20))
  143 + make.top.equalToSuperview().offset(adapt_length(length: 17))
  144 + make.size.equalTo(payTypeImageView.size)
  145 + }
  146 + addSubview(priceLab)
  147 + priceLab.snp.makeConstraints { make in
  148 + make.right.equalToSuperview().offset(-adapt_length(length: 20))
  149 + make.left.equalTo(timeLabel.snp.right).offset(adapt_length(length: 15))
  150 + make.top.equalTo(payTypeImageView.snp.bottom).offset(4)
  151 + make.height.equalTo(adapt_length(length: 25))
  152 + }
  153 + }
  154 +
  155 + func setupWithDataSource(listModel: ShopOrderTransListDataModel) {
  156 + iconImageView.kf.setImage(with: URL(string: listModel.img!), placeholder: UIImage.imageWithColor(color: HexColor("#f9f9f9")!, size: CGSize(width: adapt_length(length: 40), height: adapt_length(length: 40))))
  157 + titleLabel.text = listModel.username
  158 + timeLabel.text = listModel.addtime
  159 + if listModel.payment == "1" {
  160 + payTypeImageView.image = UIImage(named: "tsq_zhifubaozf")
  161 + }
  162 + if listModel.payment == "2" {
  163 + payTypeImageView.image = UIImage(named: "tsq_wweixinzf")
  164 + }
  165 + if listModel.payment == "3" {
  166 + payTypeImageView.image = UIImage(named: "tsq_yinlianzf")
  167 + }
  168 + if listModel.payment == "4" {
  169 + payTypeImageView.image = UIImage(named: "ye_wjjzf")
  170 + }
  171 + priceLab.text = listModel.price
  172 + }
  173 +
  174 + required init?(coder: NSCoder) {
  175 + fatalError("init(coder:) has not been implemented")
  176 + }
  177 +
  178 +}
metaCode/Classes/Main/ShopPage/ViewModel/CNLiveShopViewModel.swift
@@ -538,7 +538,6 @@ class CNLiveShopViewModel: NSObject { @@ -538,7 +538,6 @@ class CNLiveShopViewModel: NSObject {
538 if networkType == .refundExpress { 538 if networkType == .refundExpress {
539 url = "/api/v1/getRefundExpress" 539 url = "/api/v1/getRefundExpress"
540 } 540 }
541 -  
542 let custom_param = NSMutableDictionary() 541 let custom_param = NSMutableDictionary()
543 custom_param.setValue(APPId_wjj, forKey: "appId") 542 custom_param.setValue(APPId_wjj, forKey: "appId")
544 custom_param.setValue(APPKey_wjj, forKey: "appKey") 543 custom_param.setValue(APPKey_wjj, forKey: "appKey")
@@ -575,4 +574,375 @@ class CNLiveShopViewModel: NSObject { @@ -575,4 +574,375 @@ class CNLiveShopViewModel: NSObject {
575 } 574 }
576 } 575 }
577 576
  577 + /// 电商商家流水
  578 + /// - Parameters:
  579 + /// - date: 时间
  580 + /// - type: 0 全部 1 收入 2 支出
  581 + /// - resultBlock: 返回
  582 + static func requestAccount(date: String, type:CNLiveShopTransListShowType, resultBlock: @escaping resultShopBlock) {
  583 + let param = NSMutableDictionary()
  584 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")
  585 + param.setValue(date, forKey: "date")
  586 + if type == .all {
  587 + param.setValue("0", forKey: "type")
  588 + }
  589 + if type == .income {
  590 + param.setValue("1", forKey: "type")
  591 + }
  592 + if type == .outcome {
  593 + param.setValue("2", forKey: "type")
  594 + }
  595 + let custom_param = NSMutableDictionary()
  596 + custom_param.setValue(APPId_wjj, forKey: "appId")
  597 + custom_param.setValue(APPKey_wjj, forKey: "appKey")
  598 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  599 + CNLiveNetworking.setupShowDataResult(false)
  600 + CNLiveNetworking.setupDSRequest(true)
  601 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
  602 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/getShopAccount", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  603 + hiddenLoading()
  604 + if (error == nil) {
  605 + let resp = result as! NSDictionary
  606 + let errorCode = "\(resp["code"] ?? "0")"
  607 + if (errorCode == "200") {
  608 + if resp["data"] is NSNull {
  609 + resultBlock(NSNull(),.failed)
  610 + } else {
  611 + let model = dictionaryToModel(resp as! [String : Any], ShopOrderTransBaseDataModel.self,"data") as! ShopOrderTransBaseDataModel
  612 + resultBlock(model,.success)
  613 + }
  614 + } else {
  615 + showMessage(message: resp["message"] as! String)
  616 + resultBlock(NSNull(),.failed)
  617 + }
  618 + } else {
  619 + if CNLiveNetworking.isNetworking() {
  620 + showMessage(message: "请求失败")
  621 + resultBlock(NSNull(),.failed)
  622 + } else {
  623 + showMessage(message: "似乎与网络断开链接")
  624 + resultBlock(NSNull(),.noNetwork)
  625 + }
  626 + }
  627 + }
  628 + }
  629 +
  630 + /// 获取店铺商品列表
  631 + /// - Parameters:
  632 + /// - shopId: 店铺id
  633 + /// - sortType: 排序类型
  634 + /// - state: 类型
  635 + /// - categoryId: 类别id
  636 + /// - keyword: 搜索关键词
  637 + /// - page: 页数
  638 + /// - resultBlock: 返回
  639 + static func requestCouponSearchGoods(shopId: String,sortType: String,state: String,categoryId: String,keyword: String,page: NSInteger,resultBlock: @escaping resultShopBlock) {
  640 + let param = NSMutableDictionary()
  641 + param.setValue(shopId, forKey: "shop_id")
  642 + param.setValue(sortType, forKey: "type")
  643 + param.setValue(state, forKey: "state")
  644 + param.setValue(categoryId, forKey: "category_id")
  645 + param.setValue(keyword, forKey: "keyword")
  646 + param.setValue("\(page)", forKey: "page")
  647 + let custom_param = NSMutableDictionary()
  648 + custom_param.setValue(APPId_wjj, forKey: "appId")
  649 + custom_param.setValue(APPKey_wjj, forKey: "appKey")
  650 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  651 + CNLiveNetworking.setupShowDataResult(false)
  652 + CNLiveNetworking.setupDSRequest(true)
  653 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
  654 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/getGoodsList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  655 + hiddenLoading()
  656 + if (error == nil) {
  657 + let resp = result as! NSDictionary
  658 + let errorCode = "\(resp["code"] ?? "0")"
  659 + if (errorCode == "200") {
  660 + if resp["data"] is NSNull {
  661 + resultBlock(NSNull(),.failed)
  662 + } else {
  663 + let array = resp["data"] as! NSArray
  664 + let tempArray = NSMutableArray()
  665 + for item in array {
  666 + let listModel = dictionaryToModel(item as! [String : Any], ShopOrderAssociatedGoodsModel.self,"") as! ShopOrderAssociatedGoodsModel
  667 + tempArray.add(listModel)
  668 + }
  669 + resultBlock(tempArray, .success)
  670 + }
  671 + } else {
  672 + showMessage(message: resp["message"] as! String)
  673 + resultBlock(NSNull(),.failed)
  674 + }
  675 + } else {
  676 + if CNLiveNetworking.isNetworking() {
  677 + showMessage(message: "请求失败")
  678 + resultBlock(NSNull(),.failed)
  679 + } else {
  680 + showMessage(message: "似乎与网络断开链接")
  681 + resultBlock(NSNull(),.noNetwork)
  682 + }
  683 + }
  684 + }
  685 + }
  686 +
  687 +
  688 + /// 构建创建优惠券相关数据
  689 + /// - Parameter resultBlock: 返回
  690 + static func requestCoupon(model: ShopOrderCouponListModel ,resultBlock: @escaping resultShopBlock) {
  691 + let array: NSMutableArray = NSMutableArray(array: [
  692 + [
  693 + [
  694 + "id":"1",
  695 + "type":"1",
  696 + "title":"名称",
  697 + "subTitle":"请输入(20字以内)",
  698 + "section":"1",
  699 + "message":model.title ?? ""
  700 + ],
  701 + [
  702 + "id":"2",
  703 + "type":"2",
  704 + "title":"满减折扣",
  705 + "subTitle":"",
  706 + "section":"1",
  707 + "filled":model.filled ?? "",
  708 + "disCount":model.discount ?? ""
  709 + ] as [String : Any],
  710 + [
  711 + "id":"3",
  712 + "type":"1",
  713 + "title":"数量",
  714 + "subTitle":"请输入数量",
  715 + "section":"1",
  716 + "message":model.num ?? ""
  717 + ],
  718 + [
  719 + "id":"4",
  720 + "type":"3",
  721 + "title":"开始时间",
  722 + "subTitle":"请选择开始时间",
  723 + "section":"1",
  724 + "message":model.starttime ?? ""
  725 + ],
  726 + [
  727 + "id":"5",
  728 + "type":"3",
  729 + "title":"结束时间",
  730 + "subTitle":"请选择结束时间",
  731 + "section":"1",
  732 + "message":model.endtime ?? ""
  733 + ],
  734 + ],
  735 + [
  736 + [
  737 + "id":"6",
  738 + "type":"4",
  739 + "title":"所属类型",
  740 + "subTitle":"",
  741 + "section":(model.sort?.isNotBlank())! && model.sort != "1" ? "2":"1",
  742 + ],
  743 + [
  744 + "id":"7",
  745 + "type":"5",
  746 + "title":"优惠商品",
  747 + "subTitle":"请选择",
  748 + "section":"1",
  749 + "message":model.goods_title ?? ""
  750 + ],
  751 + [
  752 + "id":"8",
  753 + "type":"4",
  754 + "title":"领取状态",
  755 + "subTitle":"",
  756 + "section":(model.state?.isNotBlank())! && model.state != "1" ? "2":"1",
  757 + ],
  758 + [
  759 + "id":"9",
  760 + "type":"4",
  761 + "title":"领取次数",
  762 + "subTitle":"",
  763 + "section":(model.receive_number?.isNotBlank())! && model.receive_number != "1" ? "2":"1",
  764 + ] as [String : Any],
  765 + [
  766 + "id":"10",
  767 + "type":"6",
  768 + "title":"显示状态",
  769 + "subTitle":"",
  770 + "section":(model.is_show?.isNotBlank())! && model.is_show != "1" ?"2":"1",
  771 + ],
  772 + ]
  773 + ])
  774 + let dataArr = NSMutableArray.init()
  775 + for subArr in array {
  776 + let temp_array = subArr as! NSArray
  777 + let dataSubArr = NSMutableArray.init()
  778 + for dict in temp_array {
  779 + let model = dictionaryToModel(dict as! [String : Any], ShopOrderCouponDataModel.self,"") as! ShopOrderCouponDataModel
  780 + dataSubArr.add(model)
  781 + }
  782 + dataArr.add(dataSubArr)
  783 + }
  784 + resultBlock(dataArr,.success)
  785 + }
  786 +
  787 + /// 发布优惠券
  788 + /// - Parameters:
  789 + /// - title: 优惠券标题
  790 + /// - filled: 满多少
  791 + /// - discount: 减多少
  792 + /// - startTime: 开始时间戳
  793 + /// - endTime: 结束时间戳
  794 + /// - state: 是否开启 1 开启 2 关闭
  795 + /// - isShow: 是否显示 1 对外显示 2 不对外
  796 + /// - receiveNum: 领取次数 1 不限制 2 限领一次
  797 + /// - totalNum: 优惠券数量 -1 为不限量
  798 + /// - goodsType: 所属类型 1全场 2 单品,判断需要
  799 + /// - goodsId: 商品id 单品优惠券传此值
  800 + /// - resultBlock: 返回
  801 + static func requestCouponCreate(title: String,filled: String,discount: String, startTime: String,endTime: String,state: String,isShow: String, receiveNum: String,totalNum: String, goodsType: String,goodsId: String,resultBlock: @escaping resultShopBlock) {
  802 + if !title.isNotBlank() {
  803 + showMessage(message: "优惠券名称不能为空")
  804 + return
  805 + }
  806 + if !filled.isNotBlank() || !discount.isNotBlank() {
  807 + showMessage(message: "优惠券满减金额不能为空")
  808 + return
  809 + }
  810 + if Float(discount)! > Float(filled)! {
  811 + showMessage(message: "减免金额不可大于总金额")
  812 + return
  813 + }
  814 + if !totalNum.isNotBlank() {
  815 + showMessage(message: "优惠券总数量不能为空")
  816 + return
  817 + }
  818 + if Int(totalNum)! <= 0 {
  819 + showMessage(message: "优惠券总数量必须大于0")
  820 + return
  821 + }
  822 + if !startTime.isNotBlank() {
  823 + showMessage(message: "优惠券开始时间不能为空")
  824 + return
  825 + }
  826 + if !endTime.isNotBlank() {
  827 + showMessage(message: "优惠券结束时间不能为空")
  828 + return
  829 + }
  830 + if Float(startTime)! >= Float(endTime)! {
  831 + showMessage(message: "结束时间必须大于开始时间")
  832 + return
  833 + }
  834 + if goodsType == "2" && !goodsId.isNotBlank() {
  835 + showMessage(message: "请选择需要优惠的商品")
  836 + return
  837 + }
  838 + let param = NSMutableDictionary()
  839 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")
  840 + param.setValue(title, forKey: "title")
  841 + param.setValue(filled, forKey: "filled")
  842 + param.setValue(discount, forKey: "discount")
  843 + param.setValue(startTime, forKey: "startTime")
  844 + param.setValue(endTime, forKey: "endTime")
  845 + param.setValue(state, forKey: "state")
  846 + param.setValue(isShow, forKey: "is_show")
  847 + param.setValue(receiveNum, forKey: "receive_number")
  848 + param.setValue(totalNum, forKey: "num")
  849 + param.setValue(goodsId, forKey: "goods_id")
  850 + print("创建优惠券数据===>\(param)")
  851 + let custom_param = NSMutableDictionary()
  852 + custom_param.setValue(APPId_wjj, forKey: "appId")
  853 + custom_param.setValue(APPKey_wjj, forKey: "appKey")
  854 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  855 + CNLiveNetworking.setupShowDataResult(false)
  856 + CNLiveNetworking.setupDSRequest(true)
  857 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
  858 + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/addCoupon", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  859 + hiddenLoading()
  860 + if (error == nil) {
  861 + let resp = result as! NSDictionary
  862 + let errorCode = "\(resp["code"] ?? "0")"
  863 + if (errorCode == "200") {
  864 + if resp["data"] is NSNull {
  865 + resultBlock(NSNull(),.failed)
  866 + } else {
  867 + resultBlock("提交成功", .success)
  868 + }
  869 + } else {
  870 + showMessage(message: resp["message"] as! String)
  871 + resultBlock(NSNull(),.failed)
  872 + }
  873 + } else {
  874 + if CNLiveNetworking.isNetworking() {
  875 + showMessage(message: "提交失败")
  876 + resultBlock(NSNull(),.failed)
  877 + } else {
  878 + showMessage(message: "似乎与网络断开链接")
  879 + resultBlock(NSNull(),.noNetwork)
  880 + }
  881 + }
  882 + }
  883 + }
  884 +
  885 + /// 修改优惠券
  886 + /// - Parameters:
  887 + /// - model: 优惠券数据
  888 + /// - title: 优惠券标题
  889 + /// - state: 是否开启 1 开启 2 关闭
  890 + /// - isShow: 是否显示 1 对外显示 2 不对外
  891 + /// - receiveNum: 领取次数 1 不限制 2 限领一次
  892 + /// - resultBlock: 返回
  893 + static func requestCouponEdit(model: ShopOrderCouponListModel,title: String,state: String,isShow: String, receiveNum: String,resultBlock: @escaping resultShopBlock) {
  894 + if !title.isNotBlank() {
  895 + showMessage(message: "优惠券名称不能为空")
  896 + return
  897 + }
  898 + let param = NSMutableDictionary()
  899 + param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")
  900 + param.setValue(model.id, forKey: "id")
  901 + param.setValue(title, forKey: "title")
  902 + param.setValue(model.filled, forKey: "filled")
  903 + param.setValue(model.discount, forKey: "discount")
  904 + param.setValue("\(Int(model.starttime!) ?? 0)", forKey: "startTime")
  905 + param.setValue("\(Int(model.endtime!) ?? 0)", forKey: "endTime")
  906 + param.setValue(state, forKey: "state")
  907 + param.setValue(isShow, forKey: "is_show")
  908 + param.setValue(receiveNum, forKey: "receive_number")
  909 + param.setValue(model.num, forKey: "num")
  910 + param.setValue(model.goods_id, forKey: "goods_id")
  911 + print("修改优惠券数据===>\(param)")
  912 + let custom_param = NSMutableDictionary()
  913 + custom_param.setValue(APPId_wjj, forKey: "appId")
  914 + custom_param.setValue(APPKey_wjj, forKey: "appKey")
  915 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  916 + CNLiveNetworking.setupShowDataResult(false)
  917 + CNLiveNetworking.setupDSRequest(true)
  918 + CNLiveNetworking.setupCustomParam(custom_param as? [String : String])
  919 + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/editCoupon", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  920 + hiddenLoading()
  921 + if (error == nil) {
  922 + let resp = result as! NSDictionary
  923 + let errorCode = "\(resp["code"] ?? "0")"
  924 + if (errorCode == "200") {
  925 + if resp["data"] is NSNull {
  926 + resultBlock(NSNull(),.failed)
  927 + } else {
  928 + resultBlock("修改成功", .success)
  929 + }
  930 + } else {
  931 + showMessage(message: resp["message"] as! String)
  932 + resultBlock(NSNull(),.failed)
  933 + }
  934 + } else {
  935 + if CNLiveNetworking.isNetworking() {
  936 + showMessage(message: "修改失败")
  937 + resultBlock(NSNull(),.failed)
  938 + } else {
  939 + showMessage(message: "似乎与网络断开链接")
  940 + resultBlock(NSNull(),.noNetwork)
  941 + }
  942 + }
  943 + }
  944 + }
  945 +
  946 +
  947 +
578 } 948 }
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_select.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_coupon_select.imageset/选中@2x.png 0 → 100644

1.03 KB

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

1.9 KB

metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_unSelect.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_coupon_unSelect.imageset/未选中@2x.png 0 → 100644

808 Bytes

metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_unSelect.imageset/未选中@3x.png 0 → 100644

1.3 KB

metaCode/Supporting Files/Assets.xcassets/Shop/tsq_wweixinzf.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "tsq_wweixinzf@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "tsq_wweixinzf@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/tsq_wweixinzf.imageset/tsq_wweixinzf@2x.png 0 → 100644

7.02 KB

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

11.4 KB

metaCode/Supporting Files/Assets.xcassets/Shop/tsq_yinlianzf.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "tsq_yinlianzf@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "tsq_yinlianzf@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/tsq_yinlianzf.imageset/tsq_yinlianzf@2x.png 0 → 100644

2.6 KB

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

5.47 KB

metaCode/Supporting Files/Assets.xcassets/Shop/tsq_zhifubaozf.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "tsq_zhifubaozf@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "tsq_zhifubaozf@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/tsq_zhifubaozf.imageset/tsq_zhifubaozf@2x.png 0 → 100644

5.12 KB

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

7.74 KB

metaCode/Supporting Files/Assets.xcassets/Shop/ye_wjjzf.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "ye_wjjzf@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "ye_wjjzf@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/ye_wjjzf.imageset/ye_wjjzf@2x.png 0 → 100644

4.17 KB

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

6.9 KB

metaCode/Supporting Files/Assets.xcassets/Shop/ye_xl.imageset/Contents.json 0 → 100644
  1 +{
  2 + "images" : [
  3 + {
  4 + "idiom" : "universal",
  5 + "scale" : "1x"
  6 + },
  7 + {
  8 + "filename" : "ye_xl@2x.png",
  9 + "idiom" : "universal",
  10 + "scale" : "2x"
  11 + },
  12 + {
  13 + "filename" : "ye_xl@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/ye_xl.imageset/ye_xl@2x.png 0 → 100644

1.24 KB

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

1.66 KB