Commit b3179404fd361a12b944c5caa8f29d760f39a851
1 parent
b39e46c4
新增优惠券
Showing
50 changed files
with
3614 additions
and
25 deletions
metaCode.xcodeproj/project.pbxproj
| ... | ... | @@ -52,6 +52,22 @@ |
| 52 | 52 | 191733382B27FD66007BCC04 /* CNLiveShopClassifySectionHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733372B27FD66007BCC04 /* CNLiveShopClassifySectionHeaderView.swift */; }; |
| 53 | 53 | 1917333A2B27FDF3007BCC04 /* CNLiveShopClassilyManageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733392B27FDF3007BCC04 /* CNLiveShopClassilyManageTableViewCell.swift */; }; |
| 54 | 54 | 1917333C2B27FE75007BCC04 /* CNLiveShopClassilyManageHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917333B2B27FE75007BCC04 /* CNLiveShopClassilyManageHeaderView.swift */; }; |
| 55 | + 1917333F2B284C93007BCC04 /* CNLiveShopCouponCreateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917333E2B284C93007BCC04 /* CNLiveShopCouponCreateViewController.swift */; }; | |
| 56 | + 191733422B284D5E007BCC04 /* CNLiveShopCouponCreateBottomView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733412B284D5E007BCC04 /* CNLiveShopCouponCreateBottomView.swift */; }; | |
| 57 | + 191733452B284DCD007BCC04 /* CNLiveShopCouponListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733442B284DCD007BCC04 /* CNLiveShopCouponListModel.swift */; }; | |
| 58 | + 191733482B2855E8007BCC04 /* CNLiveShopCouponViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733472B2855E8007BCC04 /* CNLiveShopCouponViewModel.swift */; }; | |
| 59 | + 1917334A2B2BE746007BCC04 /* CNLiveCreateCouponTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733492B2BE746007BCC04 /* CNLiveCreateCouponTableViewCell.swift */; }; | |
| 60 | + 1917334C2B2BE9CA007BCC04 /* CNLiveCreateCouponTypeMoneyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917334B2B2BE9CA007BCC04 /* CNLiveCreateCouponTypeMoneyView.swift */; }; | |
| 61 | + 1917334E2B2C1A08007BCC04 /* CNLiveSelectCouponTapView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917334D2B2C1A08007BCC04 /* CNLiveSelectCouponTapView.swift */; }; | |
| 62 | + 191733502B2C3E1F007BCC04 /* CNLivePickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917334F2B2C3E1F007BCC04 /* CNLivePickerView.swift */; }; | |
| 63 | + 191733522B2C4CEA007BCC04 /* CNLivePickerSelectDateTools.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733512B2C4CEA007BCC04 /* CNLivePickerSelectDateTools.swift */; }; | |
| 64 | + 191733542B2C4D58007BCC04 /* CNLivePickerToolsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733532B2C4D58007BCC04 /* CNLivePickerToolsView.swift */; }; | |
| 65 | + 191733562B2FE855007BCC04 /* CNLivePickerReusingModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733552B2FE855007BCC04 /* CNLivePickerReusingModel.swift */; }; | |
| 66 | + 191733582B319552007BCC04 /* CNLiveCouponGoodsListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733572B319552007BCC04 /* CNLiveCouponGoodsListView.swift */; }; | |
| 67 | + 1917335A2B3283A1007BCC04 /* CNLiveCouponGoodsSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 191733592B3283A1007BCC04 /* CNLiveCouponGoodsSearchView.swift */; }; | |
| 68 | + 1917335C2B3283FF007BCC04 /* CNLiveCouponGoodsListSearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917335B2B3283FF007BCC04 /* CNLiveCouponGoodsListSearchView.swift */; }; | |
| 69 | + 1917335E2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917335D2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift */; }; | |
| 70 | + 191733602B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1917335F2B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift */; }; | |
| 55 | 71 | 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */; }; |
| 56 | 72 | 1926C28F2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */; }; |
| 57 | 73 | 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */; }; |
| ... | ... | @@ -267,6 +283,22 @@ |
| 267 | 283 | 191733372B27FD66007BCC04 /* CNLiveShopClassifySectionHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopClassifySectionHeaderView.swift; sourceTree = "<group>"; }; |
| 268 | 284 | 191733392B27FDF3007BCC04 /* CNLiveShopClassilyManageTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopClassilyManageTableViewCell.swift; sourceTree = "<group>"; }; |
| 269 | 285 | 1917333B2B27FE75007BCC04 /* CNLiveShopClassilyManageHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopClassilyManageHeaderView.swift; sourceTree = "<group>"; }; |
| 286 | + 1917333E2B284C93007BCC04 /* CNLiveShopCouponCreateViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponCreateViewController.swift; sourceTree = "<group>"; }; | |
| 287 | + 191733412B284D5E007BCC04 /* CNLiveShopCouponCreateBottomView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponCreateBottomView.swift; sourceTree = "<group>"; }; | |
| 288 | + 191733442B284DCD007BCC04 /* CNLiveShopCouponListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponListModel.swift; sourceTree = "<group>"; }; | |
| 289 | + 191733472B2855E8007BCC04 /* CNLiveShopCouponViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopCouponViewModel.swift; sourceTree = "<group>"; }; | |
| 290 | + 191733492B2BE746007BCC04 /* CNLiveCreateCouponTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCreateCouponTableViewCell.swift; sourceTree = "<group>"; }; | |
| 291 | + 1917334B2B2BE9CA007BCC04 /* CNLiveCreateCouponTypeMoneyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCreateCouponTypeMoneyView.swift; sourceTree = "<group>"; }; | |
| 292 | + 1917334D2B2C1A08007BCC04 /* CNLiveSelectCouponTapView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveSelectCouponTapView.swift; sourceTree = "<group>"; }; | |
| 293 | + 1917334F2B2C3E1F007BCC04 /* CNLivePickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLivePickerView.swift; sourceTree = "<group>"; }; | |
| 294 | + 191733512B2C4CEA007BCC04 /* CNLivePickerSelectDateTools.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLivePickerSelectDateTools.swift; sourceTree = "<group>"; }; | |
| 295 | + 191733532B2C4D58007BCC04 /* CNLivePickerToolsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLivePickerToolsView.swift; sourceTree = "<group>"; }; | |
| 296 | + 191733552B2FE855007BCC04 /* CNLivePickerReusingModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLivePickerReusingModel.swift; sourceTree = "<group>"; }; | |
| 297 | + 191733572B319552007BCC04 /* CNLiveCouponGoodsListView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponGoodsListView.swift; sourceTree = "<group>"; }; | |
| 298 | + 191733592B3283A1007BCC04 /* CNLiveCouponGoodsSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponGoodsSearchView.swift; sourceTree = "<group>"; }; | |
| 299 | + 1917335B2B3283FF007BCC04 /* CNLiveCouponGoodsListSearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponGoodsListSearchView.swift; sourceTree = "<group>"; }; | |
| 300 | + 1917335D2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponListTableViewCell.swift; sourceTree = "<group>"; }; | |
| 301 | + 1917335F2B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveCouponGoodsListTableViewCell.swift; sourceTree = "<group>"; }; | |
| 270 | 302 | 192336EA2AD9224300D47CD4 /* CNUpSlideViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNUpSlideViewController.swift; sourceTree = "<group>"; }; |
| 271 | 303 | 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideViewModel.swift; sourceTree = "<group>"; }; |
| 272 | 304 | 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveDownSlideModel.swift; sourceTree = "<group>"; }; |
| ... | ... | @@ -507,6 +539,50 @@ |
| 507 | 539 | path = CNLivePlayer; |
| 508 | 540 | sourceTree = "<group>"; |
| 509 | 541 | }; |
| 542 | + 1917333D2B284C6B007BCC04 /* ShopCoupon */ = { | |
| 543 | + isa = PBXGroup; | |
| 544 | + children = ( | |
| 545 | + 1917333E2B284C93007BCC04 /* CNLiveShopCouponCreateViewController.swift */, | |
| 546 | + ); | |
| 547 | + path = ShopCoupon; | |
| 548 | + sourceTree = "<group>"; | |
| 549 | + }; | |
| 550 | + 191733402B284D4A007BCC04 /* ShopCoupon */ = { | |
| 551 | + isa = PBXGroup; | |
| 552 | + children = ( | |
| 553 | + 191733412B284D5E007BCC04 /* CNLiveShopCouponCreateBottomView.swift */, | |
| 554 | + 191733572B319552007BCC04 /* CNLiveCouponGoodsListView.swift */, | |
| 555 | + 1917335F2B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift */, | |
| 556 | + 191733592B3283A1007BCC04 /* CNLiveCouponGoodsSearchView.swift */, | |
| 557 | + 1917335B2B3283FF007BCC04 /* CNLiveCouponGoodsListSearchView.swift */, | |
| 558 | + 1917335D2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift */, | |
| 559 | + 191733492B2BE746007BCC04 /* CNLiveCreateCouponTableViewCell.swift */, | |
| 560 | + 1917334B2B2BE9CA007BCC04 /* CNLiveCreateCouponTypeMoneyView.swift */, | |
| 561 | + 1917334D2B2C1A08007BCC04 /* CNLiveSelectCouponTapView.swift */, | |
| 562 | + 1917334F2B2C3E1F007BCC04 /* CNLivePickerView.swift */, | |
| 563 | + 191733512B2C4CEA007BCC04 /* CNLivePickerSelectDateTools.swift */, | |
| 564 | + 191733532B2C4D58007BCC04 /* CNLivePickerToolsView.swift */, | |
| 565 | + ); | |
| 566 | + path = ShopCoupon; | |
| 567 | + sourceTree = "<group>"; | |
| 568 | + }; | |
| 569 | + 191733432B284DB9007BCC04 /* ShopCoupon */ = { | |
| 570 | + isa = PBXGroup; | |
| 571 | + children = ( | |
| 572 | + 191733442B284DCD007BCC04 /* CNLiveShopCouponListModel.swift */, | |
| 573 | + 191733552B2FE855007BCC04 /* CNLivePickerReusingModel.swift */, | |
| 574 | + ); | |
| 575 | + path = ShopCoupon; | |
| 576 | + sourceTree = "<group>"; | |
| 577 | + }; | |
| 578 | + 191733462B2855D6007BCC04 /* ShopCoupon */ = { | |
| 579 | + isa = PBXGroup; | |
| 580 | + children = ( | |
| 581 | + 191733472B2855E8007BCC04 /* CNLiveShopCouponViewModel.swift */, | |
| 582 | + ); | |
| 583 | + path = ShopCoupon; | |
| 584 | + sourceTree = "<group>"; | |
| 585 | + }; | |
| 510 | 586 | 19565EC32AF8ACC2007D6727 /* GoodsManager */ = { |
| 511 | 587 | isa = PBXGroup; |
| 512 | 588 | children = ( |
| ... | ... | @@ -565,6 +641,7 @@ |
| 565 | 641 | 19BB1FE42AEB93850094D962 /* Model */ = { |
| 566 | 642 | isa = PBXGroup; |
| 567 | 643 | children = ( |
| 644 | + 191733432B284DB9007BCC04 /* ShopCoupon */, | |
| 568 | 645 | 191732F92B0AF329007BCC04 /* GoodsDetail */, |
| 569 | 646 | 19565ED22AF9FE67007D6727 /* GoodsManager */, |
| 570 | 647 | 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */, |
| ... | ... | @@ -946,6 +1023,7 @@ |
| 946 | 1023 | 7C83B43C2A52B899004BF4A4 /* ViewModel */ = { |
| 947 | 1024 | isa = PBXGroup; |
| 948 | 1025 | children = ( |
| 1026 | + 191733462B2855D6007BCC04 /* ShopCoupon */, | |
| 949 | 1027 | 191732F62B08AAD4007BCC04 /* ShopClassify */, |
| 950 | 1028 | 19565ED12AF9FE56007D6727 /* GoodsManager */, |
| 951 | 1029 | 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */, |
| ... | ... | @@ -971,6 +1049,7 @@ |
| 971 | 1049 | 7CD675232A26F8F8008354C1 /* View */ = { |
| 972 | 1050 | isa = PBXGroup; |
| 973 | 1051 | children = ( |
| 1052 | + 191733402B284D4A007BCC04 /* ShopCoupon */, | |
| 974 | 1053 | 19565ED02AF8D904007D6727 /* GoodsManager */, |
| 975 | 1054 | 7CD675372A2740B0008354C1 /* CNUpSlideViewRemindView.swift */, |
| 976 | 1055 | 7CD6753B2A2740B0008354C1 /* CNDownSlideView.swift */, |
| ... | ... | @@ -998,6 +1077,7 @@ |
| 998 | 1077 | 7CD6754D2A2840B9008354C1 /* Controller */ = { |
| 999 | 1078 | isa = PBXGroup; |
| 1000 | 1079 | children = ( |
| 1080 | + 1917333D2B284C6B007BCC04 /* ShopCoupon */, | |
| 1001 | 1081 | 191732FC2B0B3EB4007BCC04 /* GoodsDetail */, |
| 1002 | 1082 | 19565EC32AF8ACC2007D6727 /* GoodsManager */, |
| 1003 | 1083 | 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */, |
| ... | ... | @@ -1318,6 +1398,7 @@ |
| 1318 | 1398 | 19565EC92AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift in Sources */, |
| 1319 | 1399 | 19BB1FE82AECAD060094D962 /* CNLiveShopConsoleModel.swift in Sources */, |
| 1320 | 1400 | 19BB1FEE2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift in Sources */, |
| 1401 | + 1917334C2B2BE9CA007BCC04 /* CNLiveCreateCouponTypeMoneyView.swift in Sources */, | |
| 1321 | 1402 | 191733002B0B58E5007BCC04 /* CNLiveSelectUploadImageModel.swift in Sources */, |
| 1322 | 1403 | 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */, |
| 1323 | 1404 | 191732F32B084DBC007BCC04 /* CNLiveShopClassifySwitchTableViewCell.swift in Sources */, |
| ... | ... | @@ -1332,9 +1413,11 @@ |
| 1332 | 1413 | 1917330D2B1096AB007BCC04 /* CNLivePlayerViewController.swift in Sources */, |
| 1333 | 1414 | 1917330F2B10989C007BCC04 /* CNLivePlayerView.swift in Sources */, |
| 1334 | 1415 | 7989B5C72A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift in Sources */, |
| 1416 | + 191733502B2C3E1F007BCC04 /* CNLivePickerView.swift in Sources */, | |
| 1335 | 1417 | 191732902B0348F6007BCC04 /* CNLiveSwitchView.swift in Sources */, |
| 1336 | 1418 | 792B53282AFCD7640009AB49 /* CNLiveShopOrderExpressDetailViewController.swift in Sources */, |
| 1337 | 1419 | 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */, |
| 1420 | + 191733422B284D5E007BCC04 /* CNLiveShopCouponCreateBottomView.swift in Sources */, | |
| 1338 | 1421 | 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */, |
| 1339 | 1422 | 19565ECB2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift in Sources */, |
| 1340 | 1423 | 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */, |
| ... | ... | @@ -1364,6 +1447,7 @@ |
| 1364 | 1447 | 1917332B2B15CDC6007BCC04 /* CNLivePlayerLandscapeViewController.swift in Sources */, |
| 1365 | 1448 | 798916F12B0491A400D08302 /* CNLiveShopBodyTransListView.swift in Sources */, |
| 1366 | 1449 | 7CD675482A274167008354C1 /* PGIndexBannerSubiew.m in Sources */, |
| 1450 | + 191733562B2FE855007BCC04 /* CNLivePickerReusingModel.swift in Sources */, | |
| 1367 | 1451 | 790D019F2A2DD66E00C5978D /* CNLiveLoginViewModel.swift in Sources */, |
| 1368 | 1452 | 1926C2912AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift in Sources */, |
| 1369 | 1453 | 7C7C62F62A4D72E9007A912E /* CNLiveIdentityDB.swift in Sources */, |
| ... | ... | @@ -1390,6 +1474,7 @@ |
| 1390 | 1474 | 79E496E82AB9674300127BF8 /* NSMutableAttributedString+CNLiveExtensions.swift in Sources */, |
| 1391 | 1475 | 19CC4D472ADD006600308E2A /* CNDownSlideSingleCourseCell.swift in Sources */, |
| 1392 | 1476 | 191733232B14601A007BCC04 /* CNLivePlayerProgressSlider.swift in Sources */, |
| 1477 | + 1917334A2B2BE746007BCC04 /* CNLiveCreateCouponTableViewCell.swift in Sources */, | |
| 1393 | 1478 | 191732FE2B0B3EBF007BCC04 /* CNLiveShopGoodsDetailsViewController.swift in Sources */, |
| 1394 | 1479 | 79E496E32AB9357000127BF8 /* UITableViewCell+CNLiveExtension.swift in Sources */, |
| 1395 | 1480 | 7C83B4422A541EBF004BF4A4 /* CALayer+CNLiveExtensions.swift in Sources */, |
| ... | ... | @@ -1397,6 +1482,7 @@ |
| 1397 | 1482 | 798A44F72A3077ED00815935 /* CNLiveHotButton.swift in Sources */, |
| 1398 | 1483 | 7CD6753D2A2740B0008354C1 /* CNMainView.swift in Sources */, |
| 1399 | 1484 | 793CAF522A58FCA200882EF4 /* CNLiveMineExchangeViewController.swift in Sources */, |
| 1485 | + 1917334E2B2C1A08007BCC04 /* CNLiveSelectCouponTapView.swift in Sources */, | |
| 1400 | 1486 | 191733272B148BB1007BCC04 /* CNLivePlayerFastForwardPreviewView.swift in Sources */, |
| 1401 | 1487 | 7CD675522A29C04B008354C1 /* CNLiveConfigstant.swift in Sources */, |
| 1402 | 1488 | 79282A402A2F055100B5F8CF /* CNLiveConfigUserInfo.swift in Sources */, |
| ... | ... | @@ -1405,6 +1491,7 @@ |
| 1405 | 1491 | 19BB1FE12AEB5C220094D962 /* CNLiveShopConsoleController.swift in Sources */, |
| 1406 | 1492 | 7C4931382A307BDB000E44B4 /* CNHomePageGuideView.swift in Sources */, |
| 1407 | 1493 | 7CD6753E2A2740B0008354C1 /* CNUpSlideView.swift in Sources */, |
| 1494 | + 191733582B319552007BCC04 /* CNLiveCouponGoodsListView.swift in Sources */, | |
| 1408 | 1495 | 7CD675402A2740B0008354C1 /* CNDownSlideView.swift in Sources */, |
| 1409 | 1496 | 19BB1FE32AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift in Sources */, |
| 1410 | 1497 | 1965FA422AFB79EA00F0F435 /* CNLiveGoodsCategoryController.swift in Sources */, |
| ... | ... | @@ -1431,13 +1518,16 @@ |
| 1431 | 1518 | 19BB1FE62AEB93B80094D962 /* CNLiveShopUserInfoModel.swift in Sources */, |
| 1432 | 1519 | 7CD675472A274167008354C1 /* NewPagedFlowView.m in Sources */, |
| 1433 | 1520 | 191732ED2B073C52007BCC04 /* CNLiveShopClassifyListModel.swift in Sources */, |
| 1521 | + 191733482B2855E8007BCC04 /* CNLiveShopCouponViewModel.swift in Sources */, | |
| 1434 | 1522 | 79F4B11A2A32F21400993C03 /* CNLiveMineNickViewController.swift in Sources */, |
| 1523 | + 191733542B2C4D58007BCC04 /* CNLivePickerToolsView.swift in Sources */, | |
| 1435 | 1524 | 191733112B109EDC007BCC04 /* CNLivePlayerControlView.swift in Sources */, |
| 1436 | 1525 | 1917331F2B10A1BE007BCC04 /* CNLivePlayerEnum.swift in Sources */, |
| 1437 | 1526 | 191733382B27FD66007BCC04 /* CNLiveShopClassifySectionHeaderView.swift in Sources */, |
| 1438 | 1527 | 798A44FF2A30A0A800815935 /* CNLiveInputFeedBackViewController.swift in Sources */, |
| 1439 | 1528 | 79282A442A2F1C1E00B5F8CF /* CNLiveLoginAuthView.swift in Sources */, |
| 1440 | 1529 | 79BB96A62AF21E2800AEA4AC /* CNLiveShopOrderDetailViewController.swift in Sources */, |
| 1530 | + 191733452B284DCD007BCC04 /* CNLiveShopCouponListModel.swift in Sources */, | |
| 1441 | 1531 | 7C2703302A36CBE30061EC50 /* CNCertificationView.swift in Sources */, |
| 1442 | 1532 | 19CC4D542ADD163D00308E2A /* CNUpSlideCardPresentationController.swift in Sources */, |
| 1443 | 1533 | 790D01A32A2DDBA300C5978D /* CNLiveConfigManager.swift in Sources */, |
| ... | ... | @@ -1447,9 +1537,12 @@ |
| 1447 | 1537 | 7C2703332A36CC660061EC50 /* CNLiveGlobalBlock.swift in Sources */, |
| 1448 | 1538 | 7987BF3D2A497644000A1ABC /* CNLiveMineQuestViewController.swift in Sources */, |
| 1449 | 1539 | 798A44EA2A30135D00815935 /* CNLiveMineBodyListView.swift in Sources */, |
| 1540 | + 1917335A2B3283A1007BCC04 /* CNLiveCouponGoodsSearchView.swift in Sources */, | |
| 1450 | 1541 | 191733362B27EFD4007BCC04 /* CNLiveShopClassilyManageViewController.swift in Sources */, |
| 1451 | 1542 | 799172322AF08D1B00DC01A8 /* CNLiveShopOrderViewController.swift in Sources */, |
| 1452 | 1543 | 1917332D2B15DB20007BCC04 /* CNLivePlayerKVOModel.swift in Sources */, |
| 1544 | + 1917333F2B284C93007BCC04 /* CNLiveShopCouponCreateViewController.swift in Sources */, | |
| 1545 | + 1917335C2B3283FF007BCC04 /* CNLiveCouponGoodsListSearchView.swift in Sources */, | |
| 1453 | 1546 | 798A44F92A30835400815935 /* CNLiveHelpFeedBackViewController.swift in Sources */, |
| 1454 | 1547 | 79A68C4A2A26E6CE00DC3B43 /* (null) in Sources */, |
| 1455 | 1548 | 790D01852A2D89E100C5978D /* UIColor+CNLiveExtensions.swift in Sources */, |
| ... | ... | @@ -1488,6 +1581,7 @@ |
| 1488 | 1581 | 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */, |
| 1489 | 1582 | 1965FA3E2AFB176E00F0F435 /* CNLiveShopAddGoodsSingleView.swift in Sources */, |
| 1490 | 1583 | 7CD6753C2A2740B0008354C1 /* CNUpSlideViewRemindView.swift in Sources */, |
| 1584 | + 191733602B352488007BCC04 /* CNLiveCouponGoodsListTableViewCell.swift in Sources */, | |
| 1491 | 1585 | 79BB1C142B05C51900C5720C /* CNLiveShopCouponViewController.swift in Sources */, |
| 1492 | 1586 | 798916ED2B048E8200D08302 /* CNLiveShopTransViewController.swift in Sources */, |
| 1493 | 1587 | 191733172B10A017007BCC04 /* CNLivePlayerBottomNaviView.swift in Sources */, |
| ... | ... | @@ -1496,6 +1590,7 @@ |
| 1496 | 1590 | 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */, |
| 1497 | 1591 | 7C49312D2A2DB9FA000E44B4 /* UITabBar+CNLiveExtensions.swift in Sources */, |
| 1498 | 1592 | 79A267832AF8D7BC0088D9F6 /* CNLiveShopBodyCustomView.swift in Sources */, |
| 1593 | + 1917335E2B328495007BCC04 /* CNLiveCouponListTableViewCell.swift in Sources */, | |
| 1499 | 1594 | 791C1C8C2AFB85F8003E6362 /* CNLiveShopBodyExpressView.swift in Sources */, |
| 1500 | 1595 | 790D019A2A2DCAE400C5978D /* CNLiveViewController.swift in Sources */, |
| 1501 | 1596 | 191733192B10A05D007BCC04 /* CNLivePlayerProgressView.swift in Sources */, |
| ... | ... | @@ -1505,6 +1600,7 @@ |
| 1505 | 1600 | 79282A462A2F457D00B5F8CF /* CNLiveMineViewController.swift in Sources */, |
| 1506 | 1601 | 7991723A2AF091E100DC01A8 /* CNLiveShopOrderListViewController.swift in Sources */, |
| 1507 | 1602 | 798A44F02A305BC200815935 /* UIButton+CNLiveExtensions.swift in Sources */, |
| 1603 | + 191733522B2C4CEA007BCC04 /* CNLivePickerSelectDateTools.swift in Sources */, | |
| 1508 | 1604 | 1917333A2B27FDF3007BCC04 /* CNLiveShopClassilyManageTableViewCell.swift in Sources */, |
| 1509 | 1605 | ); |
| 1510 | 1606 | runOnlyForDeploymentPostprocessing = 0; | ... | ... |
metaCode/Classes/Config/CNLiveConfigstant.swift
| ... | ... | @@ -35,32 +35,17 @@ let kBucketName_QN:String = "mam-wjjtest-802" |
| 35 | 35 | let KVCBackgroupColor = UIColor("#F9F9F9") |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | - 判断是否是iPhone X系列 | |
| 39 | - */ | |
| 40 | -public func is_iPhoneX_series() -> Bool { | |
| 41 | - var iPhoneXSeries: Bool = false | |
| 42 | - if (UIDevice.current.userInterfaceIdiom != .phone) { | |
| 43 | - return iPhoneXSeries | |
| 44 | - } | |
| 45 | - let window = UIApplication.shared.delegate?.window!! | |
| 46 | - if (window?.safeAreaInsets.bottom ?? 0.0 > 0.0) { | |
| 47 | - iPhoneXSeries = true; | |
| 48 | - } | |
| 49 | - return iPhoneXSeries; | |
| 50 | -} | |
| 51 | - | |
| 52 | -/** | |
| 53 | 38 | 获取系统状态栏高度 |
| 54 | 39 | */ |
| 55 | 40 | public func get_system_statusBar_height() -> CGFloat { |
| 56 | - return is_iPhoneX_series() ? 44 : 20; | |
| 41 | + return isiPhoneXSeries ? 44 : 20; | |
| 57 | 42 | } |
| 58 | 43 | |
| 59 | 44 | /** |
| 60 | 45 | 获取系统导航高度 |
| 61 | 46 | */ |
| 62 | 47 | public func get_system_nav_height() -> CGFloat { |
| 63 | - return is_iPhoneX_series() ? (44.0 + 44.0) : 64; | |
| 48 | + return isiPhoneXSeries ? (44.0 + 44.0) : 64; | |
| 64 | 49 | } |
| 65 | 50 | |
| 66 | 51 | /** |
| ... | ... | @@ -74,14 +59,14 @@ public func get_system_nav_ui_height() -> CGFloat { |
| 74 | 59 | 获取iPhoneX顶部高度 |
| 75 | 60 | */ |
| 76 | 61 | public func get_system_nav_top_height() -> CGFloat { |
| 77 | - return is_iPhoneX_series() ? KStatusBarHeight - 64.0 : 0.0 | |
| 62 | + return isiPhoneXSeries ? KStatusBarHeight - 64.0 : 0.0 | |
| 78 | 63 | } |
| 79 | 64 | |
| 80 | 65 | /** |
| 81 | 66 | 获取系统tabbar高度 |
| 82 | 67 | */ |
| 83 | 68 | public func get_system_tabbar_height() -> CGFloat { |
| 84 | - return is_iPhoneX_series() ? 83.0 : 49.0; | |
| 69 | + return isiPhoneXSeries ? 83.0 : 49.0; | |
| 85 | 70 | } |
| 86 | 71 | |
| 87 | 72 | /** | ... | ... |
metaCode/Classes/Config/NSObject+CNLiveConfigModuleInline.swift
metaCode/Classes/Extensions/NSDate+CNLiveExtensions.swift
metaCode/Classes/Main/HomePage/Controller/CNLiveShopConsoleController.swift
| ... | ... | @@ -94,10 +94,12 @@ class CNLiveShopConsoleController: CNLiveBaseViewController, UICollectionViewDel |
| 94 | 94 | currentViewController()?.navigationController?.pushViewController(CNLiveShopProductManagerController.init(), animated: false) |
| 95 | 95 | }else if itemModel.type == CNLiveShopConsoleType.XZYHQ.rawValue{ |
| 96 | 96 | //新增优惠券 |
| 97 | - | |
| 97 | + let vc = CNLiveShopCouponCreateViewController(couponListModel: nil, type: .create) | |
| 98 | + currentViewController()?.navigationController?.pushViewController(vc, animated: false) | |
| 98 | 99 | }else if itemModel.type == CNLiveShopConsoleType.GLYHQ.rawValue{ |
| 99 | 100 | //优惠券管理 |
| 100 | - | |
| 101 | +// CNLiveShopCouponsManagerViewController *vc = [[DSShopCouponsManagerViewController alloc] init]; | |
| 102 | +// [self dsPushViewController:vc animated:YES]; | |
| 101 | 103 | }else if itemModel.type == CNLiveShopConsoleType.CreateShopClassify.rawValue{ |
| 102 | 104 | //创建店铺分类 |
| 103 | 105 | let vc = CNLiveCreateShopClassifyViewController() | ... | ... |
metaCode/Classes/Main/HomePage/Controller/ShopCoupon/CNLiveShopCouponCreateViewController.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopCouponCreateViewController.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/12. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import SnapKit | |
| 10 | + | |
| 11 | +///跳转类型 | |
| 12 | +enum CNLivePushCreateCouponType:Int { | |
| 13 | + //创建优惠券 | |
| 14 | + case create | |
| 15 | + ///编辑优惠券 | |
| 16 | + case edit | |
| 17 | +} | |
| 18 | + | |
| 19 | +class CNLiveShopCouponCreateViewController:CNLiveBaseViewController,UITableViewDelegate,UITableViewDataSource, CNLiveShopCouponButtonClickDelegate{ | |
| 20 | + let kCNLiveCreateCouponCellIdentifier = "kCNLiveCreateCouponCellIdentifier" | |
| 21 | + let kCNLiveCreateCouponTableViewHeaderFooterViewID = "kCNLiveCreateCouponTableViewHeaderFooterViewID" | |
| 22 | + | |
| 23 | + lazy var bottomView :CNLiveShopCouponCreateBottomView = { | |
| 24 | + let bottomView = CNLiveShopCouponCreateBottomView() | |
| 25 | + bottomView.delegate = self | |
| 26 | + return bottomView | |
| 27 | + }() | |
| 28 | + | |
| 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.separatorStyle = .none | |
| 36 | + tableView.backgroundColor = HexColor("#F6F6F6") | |
| 37 | + tableView.register(CNLiveCreateCouponTableViewCell.self, forCellReuseIdentifier: kCNLiveCreateCouponCellIdentifier) | |
| 38 | + tableView.register(UITableViewHeaderFooterView.self, forHeaderFooterViewReuseIdentifier: kCNLiveCreateCouponTableViewHeaderFooterViewID) | |
| 39 | + return tableView | |
| 40 | + }() | |
| 41 | + | |
| 42 | + var dataSource:Array<Array<CNLiveShopCouponModel>>? | |
| 43 | + var couponTitle:String? | |
| 44 | + var totalNum:String? | |
| 45 | + var maxMoney:String? | |
| 46 | + var lessMoney:String? | |
| 47 | + var startTime:String? | |
| 48 | + var endTime:String? | |
| 49 | + var goodsId:String? | |
| 50 | + var hiddenGoodsLine:Bool = false | |
| 51 | + var couponModel:CNLiveShopCouponListModel? | |
| 52 | + var type:CNLivePushCreateCouponType = .create | |
| 53 | + init(couponListModel:CNLiveShopCouponListModel?,type:CNLivePushCreateCouponType){ | |
| 54 | + super.init(nibName: nil, bundle: nil) | |
| 55 | + self.couponModel = couponListModel | |
| 56 | + self.type = type | |
| 57 | + } | |
| 58 | + | |
| 59 | + required init?(coder: NSCoder) { | |
| 60 | + fatalError("init(coder:) has not been implemented") | |
| 61 | + } | |
| 62 | + override func viewDidLoad() { | |
| 63 | + super.viewDidLoad() | |
| 64 | + self.dataSource = CNLiveShopCouponViewModel.responseCouponCreateWithModel(listModel: self.couponModel) | |
| 65 | + let model = self.dataSource![1][0] | |
| 66 | + if model.section == 1{ | |
| 67 | + self.hiddenGoodsLine = true | |
| 68 | + }else{ | |
| 69 | + self.hiddenGoodsLine = false | |
| 70 | + } | |
| 71 | + self.view.backgroundColor = HexColor("#F6F6F6") | |
| 72 | + navigationBarHidden = false | |
| 73 | + titleName = "发布优惠券" | |
| 74 | + self.view.addSubview(self.tableView) | |
| 75 | + self.view.addSubview(self.bottomView) | |
| 76 | + self.bottomView.snp.makeConstraints { make in | |
| 77 | + make.left.right.equalTo(self.view) | |
| 78 | + make.bottom.equalTo(self.view.safeAreaLayoutGuide.snp.bottom) | |
| 79 | + make.height.equalTo(50) | |
| 80 | + } | |
| 81 | + self.tableView.snp.makeConstraints { make in | |
| 82 | + make.left.right.equalTo(self.view) | |
| 83 | + make.top.equalTo(self.view).offset(KNavigationHeight) | |
| 84 | + make.bottom.equalTo(self.bottomView.snp.top) | |
| 85 | + } | |
| 86 | + } | |
| 87 | + // MARK: - DSShopCouponButtonClickDelegate | |
| 88 | + func selectedItemButton(section:Int){ | |
| 89 | + switch section{ | |
| 90 | + case 0: | |
| 91 | + self.navigationController?.popViewController(animated: true) | |
| 92 | + break | |
| 93 | + case 1: | |
| 94 | + let model1 = self.dataSource![1][0] | |
| 95 | + let model2 = self.dataSource![1][2] | |
| 96 | + let model3 = self.dataSource![1][3] | |
| 97 | + let model4 = self.dataSource![1][4] | |
| 98 | + if self.type == .create{ | |
| 99 | + CNLiveShopCouponViewModel.requestCreateCouponWithTitle(title: self.couponTitle ?? "", filled: self.maxMoney ?? "", discount: self.lessMoney ?? "", startTime: self.startTime ?? "", endTime: self.endTime ?? "", state: String(format: "%d", model2.section), isShow: String(format: "%d", model4.section), receiveNum: String(format: "%d", model3.section), totalNum: self.totalNum ?? "", type: model1.section, goodsId: self.goodsId ?? "") { result, status in | |
| 100 | + if status == .success{ | |
| 101 | + if let ret = result as? Dictionary<String, Any> { | |
| 102 | + if ret["code"] as! String != "0" && ret["code"] as! String != "200"{ | |
| 103 | + showMessage(message: ret["message"] as! String) | |
| 104 | + return | |
| 105 | + } | |
| 106 | + } | |
| 107 | + | |
| 108 | + showMessage(message: "发布成功") | |
| 109 | + self.navigationController?.popViewController(animated: true) | |
| 110 | + }else{ | |
| 111 | + showMessage(message: "发布失败") | |
| 112 | + } | |
| 113 | + } | |
| 114 | + }else{ | |
| 115 | + CNLiveShopCouponViewModel.requestEditCouponWithModel(model: self.couponModel!, title: (self.couponTitle?.count ?? 0>0 ? self.couponTitle! : self.couponModel!.title)!, state: String(format: "%d", model2.section), isShow: String(format: "%d", model4.section), receiveNum: String(format: "%d", model3.section)) { result, status in | |
| 116 | + if status == .success{ | |
| 117 | + showMessage(message: "发布成功") | |
| 118 | + self.navigationController?.popViewController(animated: true) | |
| 119 | + }else{ | |
| 120 | + showMessage(message: "发布失败") | |
| 121 | + } | |
| 122 | + } | |
| 123 | + } | |
| 124 | + break | |
| 125 | + default: | |
| 126 | + break | |
| 127 | + } | |
| 128 | + } | |
| 129 | + // MARK: - UITableViewDelegate | |
| 130 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |
| 131 | + if indexPath.section == 1 && indexPath.row == 1 && self.hiddenGoodsLine{ | |
| 132 | + return 0 | |
| 133 | + } | |
| 134 | + return 50 | |
| 135 | + } | |
| 136 | + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { | |
| 137 | + if section == 0{ | |
| 138 | + return 0 | |
| 139 | + } | |
| 140 | + return 5 | |
| 141 | + } | |
| 142 | + func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { | |
| 143 | + self.view.endEditing(true) | |
| 144 | + } | |
| 145 | + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { | |
| 146 | + let view = tableView.dequeueReusableHeaderFooterView(withIdentifier: kCNLiveCreateCouponTableViewHeaderFooterViewID) | |
| 147 | + view?.contentView.backgroundColor = HexColor("#F6F6F6") | |
| 148 | + return view | |
| 149 | + } | |
| 150 | + // MARK: - UITableViewDataSource | |
| 151 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| 152 | + let listArr = self.dataSource![section] | |
| 153 | + return listArr.count | |
| 154 | + } | |
| 155 | + func numberOfSections(in tableView: UITableView) -> Int { | |
| 156 | + return self.dataSource!.count | |
| 157 | + } | |
| 158 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| 159 | + | |
| 160 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveCreateCouponCellIdentifier) as? CNLiveCreateCouponTableViewCell | |
| 161 | + else { | |
| 162 | + let cell = CNLiveCreateCouponTableViewCell() | |
| 163 | + return cell | |
| 164 | + } | |
| 165 | + if self.type == .edit{ | |
| 166 | + if (indexPath.section == 0 && indexPath.row == 0) || (indexPath.section == 1 && (indexPath.row == 2 || indexPath.row == 3 || indexPath.row == 4)) { | |
| 167 | + cell.editEnabled = true | |
| 168 | + }else{ | |
| 169 | + cell.editEnabled = false | |
| 170 | + } | |
| 171 | + }else{ | |
| 172 | + cell.editEnabled = true | |
| 173 | + } | |
| 174 | + cell.model = self.dataSource![indexPath.section][indexPath.row] | |
| 175 | + cell.textFieldChangeBlock = {section, number in | |
| 176 | + switch section { | |
| 177 | + case 1: | |
| 178 | + self.couponTitle = number | |
| 179 | + break | |
| 180 | + case 3: | |
| 181 | + self.totalNum = number | |
| 182 | + break | |
| 183 | + case 1001: | |
| 184 | + self.maxMoney = number | |
| 185 | + break | |
| 186 | + case 1002: | |
| 187 | + self.lessMoney = number | |
| 188 | + break | |
| 189 | + default: | |
| 190 | + break | |
| 191 | + } | |
| 192 | + } | |
| 193 | + cell.dateSelectBlock = { id,date in | |
| 194 | + let interval = date.timeIntervalSince1970 | |
| 195 | + if id == 4{ | |
| 196 | + self.startTime = String(format: "%f", interval) | |
| 197 | + }else{ | |
| 198 | + self.endTime = String(format: "%f", interval+3600*24-1) | |
| 199 | + } | |
| 200 | + } | |
| 201 | + if indexPath.row == 1 && indexPath.section == 1{ | |
| 202 | + if self.goodsId == nil && (self.couponModel?.goods_id == nil || self.couponModel?.goods_id == "0"){ | |
| 203 | + cell.goodsLabel.text = "" | |
| 204 | + } | |
| 205 | + cell.isHidden = self.hiddenGoodsLine | |
| 206 | + } | |
| 207 | + cell.couponGoodsHiddenBlock = { isHidden in | |
| 208 | + self.hiddenGoodsLine = isHidden | |
| 209 | + self.goodsId = nil | |
| 210 | + tableView.reloadRows(at: [IndexPath(row: 1, section: 1)], with: .middle) | |
| 211 | + } | |
| 212 | + cell.couponGoodsBlock = { goodsId in | |
| 213 | + self.goodsId = goodsId | |
| 214 | + } | |
| 215 | + return cell | |
| 216 | + } | |
| 217 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/GoodsManager/CNLiveShopClassifySectionHeaderView.swift
| ... | ... | @@ -52,7 +52,7 @@ class CNLiveShopClassifySectionHeaderView:UITableViewHeaderFooterView{ |
| 52 | 52 | classifyNameBtn.setImage(UIImage(named: "DS_shopclassily_up"), for: .selected) |
| 53 | 53 | classifyNameBtn.setTitleColor(HexColor("#333333"), for: .normal) |
| 54 | 54 | classifyNameBtn.setTitle("分类", for: .normal) |
| 55 | - classifyNameBtn.setupButtonImageAndTitlePossitionWith(padding: 5, style: .right) | |
| 55 | + classifyNameBtn.setupButtonImageAndTitlePossitionWith(padding: 5, style: .right) | |
| 56 | 56 | classifyNameBtn.titleLabel?.font = Font_14 |
| 57 | 57 | classifyNameBtn.addTarget(self, action: #selector(showChildCalssifyAction), for: .touchUpInside) |
| 58 | 58 | return classifyNameBtn | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLiveCouponGoodsListSearchView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveCouponGoodsListSearchView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/20. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import SnapKit | |
| 10 | +typealias searchActionBlock = (_ searchStr:String) -> Void | |
| 11 | +class CNLiveCouponGoodsListSearchView:UIView,UITextFieldDelegate{ | |
| 12 | + var searchBlock:searchActionBlock? | |
| 13 | + | |
| 14 | + lazy var searchImage :UIImageView = { | |
| 15 | + let searchImage = UIImageView() | |
| 16 | + searchImage.clipsToBounds = true | |
| 17 | + searchImage.contentMode = .scaleAspectFit | |
| 18 | + searchImage.image = UIImage(named: "goods_search") | |
| 19 | + return searchImage | |
| 20 | + }() | |
| 21 | + | |
| 22 | + lazy var searchLine :UIView = { | |
| 23 | + let searchLine = UIView() | |
| 24 | + searchLine.backgroundColor = UIColor(red: 133/255.0, green: 133/255.0, blue: 133/255.0, alpha: 1.0) | |
| 25 | + return searchLine | |
| 26 | + }() | |
| 27 | + | |
| 28 | + lazy var searchTF :UITextField = { | |
| 29 | + let searchTF = UITextField() | |
| 30 | + searchTF.clearButtonMode = .always | |
| 31 | + searchTF.textColor = UIColor(red: 51/255.0, green: 51/255.0, blue: 51/255.0, alpha: 1.0) | |
| 32 | + searchTF.font = Font_13 | |
| 33 | + let attributedPlaceholder = NSAttributedString(string: "请输入商品名称或商品货号", attributes: [.foregroundColor: UIColor(red: 200/255.0, green: 200/255.0, blue: 200/255.0, alpha: 1.0), .font: searchTF.font!]) | |
| 34 | + searchTF.attributedPlaceholder = attributedPlaceholder | |
| 35 | + searchTF.delegate = self | |
| 36 | + return searchTF | |
| 37 | + }() | |
| 38 | + | |
| 39 | + override init(frame: CGRect) { | |
| 40 | + super.init(frame: frame) | |
| 41 | + self.addSubview(self.searchImage) | |
| 42 | + self.addSubview(self.searchLine) | |
| 43 | + self.addSubview(self.searchTF) | |
| 44 | + self.setSubViewsLayout() | |
| 45 | + } | |
| 46 | + | |
| 47 | + required init?(coder: NSCoder) { | |
| 48 | + fatalError("init(coder:) has not been implemented") | |
| 49 | + } | |
| 50 | + | |
| 51 | + func setSubViewsLayout(){ | |
| 52 | + self.searchImage.snp.makeConstraints { make in | |
| 53 | + make.left.equalTo(self) | |
| 54 | + make.width.height.equalTo(16) | |
| 55 | + make.centerY.equalTo(self) | |
| 56 | + } | |
| 57 | + self.searchLine.snp.makeConstraints { make in | |
| 58 | + make.left.equalTo(self.searchImage.snp.right).offset(10) | |
| 59 | + make.width.equalTo(0.5) | |
| 60 | + make.height.equalTo(11) | |
| 61 | + make.centerY.equalTo(self) | |
| 62 | + } | |
| 63 | + self.searchTF.snp.makeConstraints { make in | |
| 64 | + make.left.equalTo(self.searchLine.snp.right).offset(3.5) | |
| 65 | + make.top.bottom.right.equalTo(self) | |
| 66 | + } | |
| 67 | + } | |
| 68 | + | |
| 69 | + // MARK: - UITextFieldDelegate | |
| 70 | + func textFieldDidEndEditing(_ textField: UITextField) { | |
| 71 | + self.searchBlock!(textField.text ?? "") | |
| 72 | + } | |
| 73 | + func textFieldShouldReturn(_ textField: UITextField) -> Bool { | |
| 74 | + self.endEditing(true) | |
| 75 | + return true | |
| 76 | + } | |
| 77 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLiveCouponGoodsListTableViewCell.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveCouponGoodsListTableViewCell.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/22. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import SnapKit | |
| 10 | +class CNLiveCouponGoodsListTableViewCell:UITableViewCell{ | |
| 11 | + var _model:ShopOrderAssociatedGoodsModel? | |
| 12 | + var model:ShopOrderAssociatedGoodsModel?{ | |
| 13 | + get{ | |
| 14 | + _model | |
| 15 | + } | |
| 16 | + set{ | |
| 17 | + _model = newValue | |
| 18 | + self.singImage.kf.setImage(with: URL(string: model?.simg ?? "")) | |
| 19 | + self.titleLabel.text = model?.title | |
| 20 | + self.priceLabel.text = "¥"+"\(model?.price ?? "0")" | |
| 21 | + } | |
| 22 | + } | |
| 23 | + | |
| 24 | + lazy var backView: UIView = { | |
| 25 | + let view = UIView() | |
| 26 | + view.backgroundColor = HexColor("#F9F9F9") | |
| 27 | + view.layer.cornerRadius = 6 | |
| 28 | + return view | |
| 29 | + }() | |
| 30 | + | |
| 31 | + lazy var singImage: UIImageView = { | |
| 32 | + let imageView = UIImageView() | |
| 33 | + imageView.contentMode = .scaleAspectFit | |
| 34 | + imageView.layer.cornerRadius = 5 | |
| 35 | + return imageView | |
| 36 | + }() | |
| 37 | + | |
| 38 | + lazy var titleLabel: UILabel = { | |
| 39 | + let label = UILabel() | |
| 40 | + label.textAlignment = .justified | |
| 41 | + label.numberOfLines = 2 | |
| 42 | + label.textColor = HexColor("#333333") | |
| 43 | + label.font = UIFont.systemFont(ofSize: 13) | |
| 44 | + return label | |
| 45 | + }() | |
| 46 | + | |
| 47 | + lazy var priceLabel: UILabel = { | |
| 48 | + let label = UILabel(frame: CGRect(x: self.titleLabel.left, y: self.titleLabel.bottom + 8.5, width: self.backView.width - self.titleLabel.left, height: 16.5)) | |
| 49 | + label.font = UIFont.systemFont(ofSize: 12) | |
| 50 | + label.textAlignment = .left | |
| 51 | + label.textColor = HexColor("#333333") | |
| 52 | + return label | |
| 53 | + }() | |
| 54 | + | |
| 55 | + lazy var sendBtn: UIButton = { | |
| 56 | + let button = UIButton(type: .custom) | |
| 57 | + let layer = CAGradientLayer() | |
| 58 | + layer.frame = CGRect(x: 0, y: 0, width: 65, height: 19) | |
| 59 | + layer.startPoint = CGPoint(x: 0, y: 0.5) | |
| 60 | + layer.endPoint = CGPoint(x: 1, y: 0.5) | |
| 61 | + layer.locations = [0, 1.0] | |
| 62 | + layer.colors = [HexColor("#FD9700")!.cgColor, HexColor("#FF5907")!.cgColor] | |
| 63 | + button.layer.addSublayer(layer) | |
| 64 | + button.right = self.backView.width - 10 | |
| 65 | + button.bottom = self.backView.bottom - 10 | |
| 66 | + button.isUserInteractionEnabled = false | |
| 67 | + button.setTitle("选择商品", for: .normal) | |
| 68 | + button.setTitleColor(.white, for: .normal) | |
| 69 | + button.titleLabel?.font = Font_13 | |
| 70 | + button.layer.cornerRadius = 6 | |
| 71 | + button.clipsToBounds = true | |
| 72 | + return button | |
| 73 | + }() | |
| 74 | + | |
| 75 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | |
| 76 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | |
| 77 | + self.selectionStyle = .none | |
| 78 | + self.contentView.addSubview(self.backView) | |
| 79 | + self.backView.addSubview(self.singImage) | |
| 80 | + self.backView.addSubview(self.titleLabel) | |
| 81 | + self.backView.addSubview(self.priceLabel) | |
| 82 | + self.backView.addSubview(self.sendBtn) | |
| 83 | + self.setSubViewsLayout() | |
| 84 | + } | |
| 85 | + | |
| 86 | + func setSubViewsLayout(){ | |
| 87 | + self.backView.snp.makeConstraints { make in | |
| 88 | + make.top.equalTo(self).offset(10) | |
| 89 | + make.left.equalTo(self).offset(15) | |
| 90 | + make.right.equalTo(self).offset(-15) | |
| 91 | + make.bottom.equalTo(self) | |
| 92 | + } | |
| 93 | + self.singImage.snp.makeConstraints { make in | |
| 94 | + make.left.top.equalTo(self.backView).offset(10) | |
| 95 | + make.width.height.equalTo(60) | |
| 96 | + } | |
| 97 | + self.titleLabel.snp.makeConstraints { make in | |
| 98 | + make.left.equalTo(self.singImage.snp.right).offset(10) | |
| 99 | + make.right.equalTo(self.backView).offset(-10) | |
| 100 | + make.top.equalTo(self.singImage) | |
| 101 | + } | |
| 102 | + self.priceLabel.snp.makeConstraints { make in | |
| 103 | + make.left.equalTo(self.titleLabel) | |
| 104 | + make.bottom.equalTo(self.singImage) | |
| 105 | + } | |
| 106 | + self.sendBtn.snp.makeConstraints { make in | |
| 107 | + make.right.equalTo(self.titleLabel) | |
| 108 | + make.bottom.equalTo(self.singImage) | |
| 109 | + make.width.equalTo(65) | |
| 110 | + make.height.equalTo(19) | |
| 111 | + } | |
| 112 | + } | |
| 113 | + | |
| 114 | + required init?(coder: NSCoder) { | |
| 115 | + fatalError("init(coder:) has not been implemented") | |
| 116 | + } | |
| 117 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLiveCouponGoodsListView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveCouponGoodsListView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/19. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import MJRefresh | |
| 10 | +import SnapKit | |
| 11 | +typealias chooseGoodsActionBlock = (_ goodsId:String,_ goodsTitle:String) -> Void | |
| 12 | + | |
| 13 | +class CNLiveCouponGoodsListView: UIView,UITableViewDelegate,UITableViewDataSource{ | |
| 14 | + | |
| 15 | + var chooseGoodsBlock:chooseGoodsActionBlock? | |
| 16 | + let kCNLiveCouponGoodsListTableViewCellID = "kCNLiveCouponGoodsListTableViewCellID" | |
| 17 | + | |
| 18 | + lazy var listBackView : UIView = { | |
| 19 | + let listBackView = UIView() | |
| 20 | + listBackView.backgroundColor = .white | |
| 21 | + let path = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: KSreenWidth, height: 390), byRoundingCorners: [.topLeft, .topRight], cornerRadii: CGSize(width: 8, height: 8)) | |
| 22 | + let maskLayer = CAShapeLayer() | |
| 23 | + maskLayer.path = path.cgPath | |
| 24 | + listBackView.layer.mask = maskLayer | |
| 25 | + return listBackView | |
| 26 | + }() | |
| 27 | + | |
| 28 | + lazy var headerLabel: UILabel = { | |
| 29 | + let titleLabel = UILabel.init() | |
| 30 | + titleLabel.textColor = HexColor("#3A3A3A") | |
| 31 | + titleLabel.textAlignment = .left | |
| 32 | + titleLabel.font = Font_16 | |
| 33 | + titleLabel.text = "请选择您要优惠的商品" | |
| 34 | + return titleLabel | |
| 35 | + }() | |
| 36 | + | |
| 37 | + lazy var closeBtn: UIButton = { | |
| 38 | + let closeBtn = UIButton(type: .custom) | |
| 39 | + closeBtn.setImage(UIImage(named: "icon_shop_order_close"), for: .normal) | |
| 40 | + closeBtn.addTarget(self, action: #selector(closeBtnTarget), for: .touchUpInside) | |
| 41 | + return closeBtn | |
| 42 | + }() | |
| 43 | + | |
| 44 | + lazy var searchView :CNLiveCouponGoodsSearchView = { | |
| 45 | + let searchView = CNLiveCouponGoodsSearchView() | |
| 46 | + searchView.searchBlock = { searchStr in | |
| 47 | + self.keyWords = searchStr | |
| 48 | + self.reloadData() | |
| 49 | + } | |
| 50 | + return searchView | |
| 51 | + }() | |
| 52 | + | |
| 53 | + lazy var listTableView : UITableView = { | |
| 54 | + let tableView = UITableView(frame: .zero, style: .plain) | |
| 55 | + tableView.separatorStyle = .none | |
| 56 | + tableView.dataSource = self | |
| 57 | + tableView.delegate = self | |
| 58 | + tableView.register(CNLiveCouponGoodsListTableViewCell.self, forCellReuseIdentifier: kCNLiveCouponGoodsListTableViewCellID) | |
| 59 | + tableView.mj_header = MJRefreshNormalHeader.init(refreshingBlock: {[weak self] in | |
| 60 | + self!.reloadData() | |
| 61 | + }) | |
| 62 | + | |
| 63 | + tableView.mj_footer = MJRefreshAutoNormalFooter.init(refreshingBlock: {[weak self] in | |
| 64 | + self!.page += 1 | |
| 65 | + self!.requestGoodsList(page: self!.page) | |
| 66 | + }) | |
| 67 | + return tableView | |
| 68 | + }() | |
| 69 | + | |
| 70 | + var dataArray:NSMutableArray? | |
| 71 | + var page:Int = 0 | |
| 72 | + var keyWords:String? | |
| 73 | + | |
| 74 | + static func couponGoodsViewShow(chooseBlock:@escaping chooseGoodsActionBlock){ | |
| 75 | + let view = CNLiveCouponGoodsListView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: KSreenHeight)) | |
| 76 | + view.chooseGoodsBlock = chooseBlock | |
| 77 | + keyWindow?.addSubview(view) | |
| 78 | + view.listViewShow() | |
| 79 | + } | |
| 80 | + override init(frame: CGRect) { | |
| 81 | + super.init(frame: frame) | |
| 82 | + self.reloadData() | |
| 83 | + self.dataArray = NSMutableArray() | |
| 84 | + self.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.6) | |
| 85 | + self.addSubview(self.listBackView) | |
| 86 | + self.listBackView.addSubview(self.headerLabel) | |
| 87 | + self.listBackView.addSubview(self.closeBtn) | |
| 88 | + self.listBackView.addSubview(self.searchView) | |
| 89 | + self.listBackView.addSubview(self.listTableView) | |
| 90 | + self.setSubViewsLayout() | |
| 91 | + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillShow), name: UIResponder.keyboardWillShowNotification, object: nil) | |
| 92 | + | |
| 93 | + NotificationCenter.default.addObserver(self, selector: #selector(keyboardWillHide), name: UIResponder.keyboardWillHideNotification, object: nil) | |
| 94 | + } | |
| 95 | + | |
| 96 | + required init?(coder: NSCoder) { | |
| 97 | + fatalError("init(coder:) has not been implemented") | |
| 98 | + } | |
| 99 | + | |
| 100 | + @objc func closeBtnTarget(){ | |
| 101 | + self.endEditing(true) | |
| 102 | + self.listBackView.snp.makeConstraints { make in | |
| 103 | + make.top.equalTo(self.snp.bottom) | |
| 104 | + } | |
| 105 | + self.removeFromSuperview() | |
| 106 | + } | |
| 107 | + | |
| 108 | + func listViewShow(){ | |
| 109 | + UIView.animate(withDuration: 1) { | |
| 110 | + self.listBackView.snp.makeConstraints { make in | |
| 111 | + make.top.equalTo(self.snp.bottom).offset(-390) | |
| 112 | + } | |
| 113 | + } | |
| 114 | + } | |
| 115 | + | |
| 116 | + func reloadData(){ | |
| 117 | + self.page = 1 | |
| 118 | + self.dataArray?.removeAllObjects() | |
| 119 | + self.requestGoodsList(page: self.page) | |
| 120 | + } | |
| 121 | + | |
| 122 | + func requestGoodsList(page:Int){ | |
| 123 | + CNLiveShopGoodListViewModel.getGetGoodsListWithShopId(shopId: DSUserInfoManager.shared.dsUserInfo.id, sortType: "1", state: 0, categoryId: nil, keyword: self.keyWords, page: page) { result, status in | |
| 124 | + self.listTableView.mj_header?.endRefreshing() | |
| 125 | + self.listTableView.mj_footer?.endRefreshing() | |
| 126 | + let resArr = result as! [ShopOrderAssociatedGoodsModel] | |
| 127 | + let dataArr = Array(resArr) | |
| 128 | + if status == .success{ | |
| 129 | + if dataArr.count == 0 && page == 1{ | |
| 130 | + self.listTableView.reloadData() | |
| 131 | + return | |
| 132 | + } | |
| 133 | + if (dataArr.count == 0) { | |
| 134 | + self.listTableView.reloadData() | |
| 135 | + self.listTableView.mj_footer?.endRefreshingWithNoMoreData() | |
| 136 | + self.page -= 1 | |
| 137 | + return | |
| 138 | + } | |
| 139 | +// self.listBackView.removeEmptyView() | |
| 140 | + self.dataArray?.addObjects(from: dataArr) | |
| 141 | + self.listTableView.reloadData() | |
| 142 | + }else{ | |
| 143 | + showMessage(message: "暂无数据哦~") | |
| 144 | + return | |
| 145 | +// [weakSelf.listBackView displayEmptyView:[UIImage cnliveGetShopListImageWithImageName:@"DS_empty_default"] remind:@"暂无数据哦~" hint:nil disposeBtnTitle:@"刷一刷" inset:UIEdgeInsetsMake(weakSelf.searchView.bottom, 0, 0, 0) tapDisposeBtnCallBack:^{ | |
| 146 | +// [self reloadData]; | |
| 147 | +// }]; | |
| 148 | +// return; | |
| 149 | + } | |
| 150 | + } | |
| 151 | + } | |
| 152 | + | |
| 153 | + deinit { | |
| 154 | + NotificationCenter.default.removeObserver(self) | |
| 155 | + } | |
| 156 | + func setSubViewsLayout(){ | |
| 157 | + self.listBackView.snp.makeConstraints { make in | |
| 158 | + make.left.right.equalTo(self) | |
| 159 | + make.top.equalTo(self.snp.bottom) | |
| 160 | + make.height.equalTo(390) | |
| 161 | + } | |
| 162 | + self.headerLabel.snp.makeConstraints { make in | |
| 163 | + make.left.top.equalTo(self.listBackView).offset(15) | |
| 164 | + } | |
| 165 | + self.closeBtn.snp.makeConstraints { make in | |
| 166 | + make.right.equalTo(self.listBackView).offset(-15) | |
| 167 | + make.centerY.equalTo(self.headerLabel) | |
| 168 | + } | |
| 169 | + self.searchView.snp.makeConstraints { make in | |
| 170 | + make.left.right.equalTo(self.listBackView) | |
| 171 | + make.top.equalTo(self.headerLabel.snp.bottom).offset(15) | |
| 172 | + make.height.equalTo(52.5) | |
| 173 | + } | |
| 174 | + self.listTableView.snp.makeConstraints { make in | |
| 175 | + make.left.right.bottom.equalTo(self.listBackView) | |
| 176 | + make.top.equalTo(self.searchView.snp.bottom) | |
| 177 | + } | |
| 178 | + } | |
| 179 | + | |
| 180 | + // MARK: - Notificatiom | |
| 181 | + //当键盘出现 | |
| 182 | + @objc func keyboardWillShow(_ notification:NSNotification){ | |
| 183 | + //获取键盘的高度 | |
| 184 | + let userInfo = notification.userInfo | |
| 185 | + let value = userInfo![UIResponder.keyboardFrameEndUserInfoKey] as! NSValue | |
| 186 | + let keyboardRect = value.cgRectValue | |
| 187 | + let height = keyboardRect.size.height | |
| 188 | + UIView.animate(withDuration: 1) { | |
| 189 | + self.listBackView.snp.updateConstraints { make in | |
| 190 | + make.top.equalTo(self.snp.bottom).offset(-300-height) | |
| 191 | + } | |
| 192 | + } | |
| 193 | + } | |
| 194 | + | |
| 195 | + //当键退出 | |
| 196 | + @objc func keyboardWillHide(_ notification:NSNotification){ | |
| 197 | + UIView.animate(withDuration: 1) { | |
| 198 | + self.listBackView.snp.updateConstraints { make in | |
| 199 | + make.top.equalTo(self.snp.bottom).offset(-390) | |
| 200 | + } | |
| 201 | + } | |
| 202 | + } | |
| 203 | + | |
| 204 | + // MARK: - UITableViewDelegate | |
| 205 | + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { | |
| 206 | + return 90 | |
| 207 | + } | |
| 208 | + | |
| 209 | + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { | |
| 210 | + if self.dataArray?.count ?? 0 > 0{ | |
| 211 | + let model = self.dataArray![indexPath.row] as! ShopOrderAssociatedGoodsModel | |
| 212 | + self.chooseGoodsBlock!(model.id!,model.title!) | |
| 213 | + } | |
| 214 | + self.closeBtnTarget() | |
| 215 | + | |
| 216 | + } | |
| 217 | + | |
| 218 | + // MARK: - UITableViewDataSource | |
| 219 | + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { | |
| 220 | + return self.dataArray!.count | |
| 221 | + } | |
| 222 | + | |
| 223 | + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { | |
| 224 | + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveCouponGoodsListTableViewCellID) as? CNLiveCouponGoodsListTableViewCell else { | |
| 225 | + return CNLiveCouponGoodsListTableViewCell() | |
| 226 | + } | |
| 227 | + cell.model = (self.dataArray![indexPath.row] as! ShopOrderAssociatedGoodsModel) | |
| 228 | + return cell | |
| 229 | + } | |
| 230 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLiveCouponGoodsSearchView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveCouponGoodsSearchView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/20. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import SnapKit | |
| 10 | +class CNLiveCouponGoodsSearchView:UIView{ | |
| 11 | + var searchBlock:searchActionBlock? | |
| 12 | + | |
| 13 | + lazy var topLineView :UIView = { | |
| 14 | + let topLineView = UIView() | |
| 15 | + topLineView.backgroundColor = HexColor("#EEEEEE") | |
| 16 | + return topLineView | |
| 17 | + }() | |
| 18 | + lazy var bottomLineView :UIView = { | |
| 19 | + let bottomLineView = UIView() | |
| 20 | + bottomLineView.backgroundColor = HexColor("#EEEEEE") | |
| 21 | + return bottomLineView | |
| 22 | + }() | |
| 23 | + | |
| 24 | + lazy var searchView :CNLiveCouponGoodsListSearchView = { | |
| 25 | + let searchView = CNLiveCouponGoodsListSearchView() | |
| 26 | + searchView.backgroundColor = HexColor("#F9F9F9") | |
| 27 | + searchView.layer.cornerRadius = 16 | |
| 28 | + searchView.searchBlock = { searchStr in | |
| 29 | + self.searchStr = searchStr | |
| 30 | + } | |
| 31 | + return searchView | |
| 32 | + }() | |
| 33 | + | |
| 34 | + lazy var searchBtn: UIButton = { | |
| 35 | + let searchBtn = UIButton(type: .custom) | |
| 36 | + searchBtn.setTitle("搜索", for: .normal) | |
| 37 | + searchBtn.titleLabel?.font = Font_14 | |
| 38 | + searchBtn.setTitleColor(HexColor("#FC1541"), for: .normal) | |
| 39 | + searchBtn.addTarget(self, action: #selector(searchBtnClick(_:)), for: .touchUpInside) | |
| 40 | + return searchBtn | |
| 41 | + }() | |
| 42 | + var searchStr:String? | |
| 43 | + | |
| 44 | + override init(frame: CGRect) { | |
| 45 | + super.init(frame: frame) | |
| 46 | + self.addSubview(self.topLineView) | |
| 47 | + self.addSubview(self.bottomLineView) | |
| 48 | + self.addSubview(self.searchView) | |
| 49 | + self.addSubview(self.searchBtn) | |
| 50 | + self.setSubViewsLayout() | |
| 51 | + } | |
| 52 | + | |
| 53 | + required init?(coder: NSCoder) { | |
| 54 | + fatalError("init(coder:) has not been implemented") | |
| 55 | + } | |
| 56 | + | |
| 57 | + func setSubViewsLayout(){ | |
| 58 | + self.topLineView.snp.makeConstraints { make in | |
| 59 | + make.left.right.top.equalTo(self) | |
| 60 | + make.height.equalTo(0.5) | |
| 61 | + } | |
| 62 | + self.bottomLineView.snp.makeConstraints { make in | |
| 63 | + make.left.right.bottom.equalTo(self) | |
| 64 | + make.height.equalTo(0.5) | |
| 65 | + } | |
| 66 | + self.searchView.snp.makeConstraints { make in | |
| 67 | + make.left.equalTo(self).offset(15) | |
| 68 | + make.centerY.equalTo(self) | |
| 69 | + make.width.equalTo(299) | |
| 70 | + make.height.equalTo(32) | |
| 71 | + } | |
| 72 | + self.searchBtn.snp.makeConstraints { make in | |
| 73 | + make.left.equalTo(self.searchView.snp.right) | |
| 74 | + make.centerY.equalTo(self) | |
| 75 | + make.width.equalTo(61) | |
| 76 | + make.height.equalTo(32) | |
| 77 | + } | |
| 78 | + } | |
| 79 | + | |
| 80 | + @objc func searchBtnClick(_ sender:UIButton){ | |
| 81 | + self.endEditing(true) | |
| 82 | + self.searchBlock!(self.searchStr ?? "") | |
| 83 | + } | |
| 84 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLiveCouponListTableViewCell.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveCouponListTableViewCell.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/20. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +typealias actionClickActionBlock = (_ index:Int,_ model:CNLiveShopCouponListModel) -> Void | |
| 11 | + | |
| 12 | +typealias editBtnClickActionBlock = (_ selected:Bool,_ couponId:String) -> Void | |
| 13 | + | |
| 14 | +class CNLiveCouponListTableViewCell:UITableViewCell{ | |
| 15 | + var _model:CNLiveShopCouponListModel? | |
| 16 | + var model:CNLiveShopCouponListModel?{ | |
| 17 | + get{ | |
| 18 | + _model | |
| 19 | + } | |
| 20 | + set{ | |
| 21 | + _model = newValue | |
| 22 | + self.selectBtn.isSelected = false | |
| 23 | + let discount = self.dealDiscountAndFilledNumber(count: Int(model!.discount!)!) | |
| 24 | + let filled = self.dealDiscountAndFilledNumber(count: Int(model!.filled!)!) | |
| 25 | + let str = NSMutableAttributedString(string: String(format: "¥%@", discount)) | |
| 26 | + str.addAttribute(NSAttributedString.Key.font, value: UIFont.systemFont(ofSize: 12.5), range: NSRange(location: 0, length: 1)) | |
| 27 | + | |
| 28 | + if discount.contains("万") { | |
| 29 | + str.addAttribute(NSAttributedString.Key.font, value: UIFont.systemFont(ofSize: 12.5), range: NSRange(location: str.length - 1, length: 1)) | |
| 30 | + } | |
| 31 | + | |
| 32 | + self.lessMoneyLabel.attributedText = str | |
| 33 | + self.maxMoneyLabel.text = String(format: "满%@元可用", filled) | |
| 34 | + self.titleLabel.text = model!.title | |
| 35 | + self.idLabel.text = String(format: "(ID:%@)", model!.id!) | |
| 36 | + | |
| 37 | + if model!.sort == 1 { | |
| 38 | + self.typeLabel.text = "所属类型:店铺全场" | |
| 39 | + } else { | |
| 40 | + self.typeLabel.text = "所属类型:单个商品" | |
| 41 | + } | |
| 42 | + | |
| 43 | + self.totalLabel.text = String(format: "剩余数量:%@", model!.num!) | |
| 44 | + | |
| 45 | + if Int(model!.is_show!) == 1 { | |
| 46 | + self.showSwitch.setOn(true, animated: true) | |
| 47 | + } else { | |
| 48 | + self.showSwitch.setOn(false, animated: true) | |
| 49 | + } | |
| 50 | + } | |
| 51 | + } | |
| 52 | + | |
| 53 | + var actionClickBlock:actionClickActionBlock? | |
| 54 | + var editBtnClickBlock:editBtnClickActionBlock? | |
| 55 | + | |
| 56 | + lazy var selectBtn: UIButton = { | |
| 57 | + let _selectBtn = UIButton(type: .custom) | |
| 58 | + _selectBtn.isHidden = true | |
| 59 | + _selectBtn.setImage(UIImage(named: "DS_coupon_edit_no"), for: .normal) | |
| 60 | + _selectBtn.setImage(UIImage(named: "DS_coupon_edit_se"), for: .selected) | |
| 61 | + _selectBtn.addTarget(self, action: #selector(editBtnClick), for: .touchUpInside) | |
| 62 | + return _selectBtn | |
| 63 | + }() | |
| 64 | + | |
| 65 | + lazy var leftBgView :UIView = { | |
| 66 | + let leftBgView = UIView() | |
| 67 | + leftBgView.backgroundColor = HexColor("#FBA2A2") | |
| 68 | + return leftBgView | |
| 69 | + }() | |
| 70 | + lazy var bgWhiteView :UIView = { | |
| 71 | + let bgWhiteView = UIView() | |
| 72 | + bgWhiteView.backgroundColor = .white | |
| 73 | + bgWhiteView.layer.cornerRadius = 7 | |
| 74 | + bgWhiteView.clipsToBounds = true | |
| 75 | + return bgWhiteView | |
| 76 | + }() | |
| 77 | + | |
| 78 | + private lazy var lessMoneyLabel: UILabel = { | |
| 79 | + let label = UILabel() | |
| 80 | + label.textColor = .white | |
| 81 | + label.font = UIFont(name: "HelveticaNeue", size: 38)! | |
| 82 | + label.textAlignment = .center | |
| 83 | + return label | |
| 84 | + }() | |
| 85 | + | |
| 86 | + private lazy var maxMoneyLabel: UILabel = { | |
| 87 | + let label = UILabel() | |
| 88 | + label.textColor = .white | |
| 89 | + label.font = UIFont(name: "HelveticaNeue", size: 12.5)! | |
| 90 | + label.textAlignment = .center | |
| 91 | + return label | |
| 92 | + }() | |
| 93 | + | |
| 94 | + private lazy var titleLabel: UILabel = { | |
| 95 | + let label = UILabel() | |
| 96 | + label.textColor = HexColor("#444444") | |
| 97 | + label.font = UIFont(name: "HelveticaNeue", size: 15)! | |
| 98 | + label.textAlignment = .left | |
| 99 | + return label | |
| 100 | + }() | |
| 101 | + | |
| 102 | + private lazy var idLabel: UILabel = { | |
| 103 | + let label = UILabel() | |
| 104 | + label.textColor = HexColor("#BEBEBE") | |
| 105 | + label.font = UIFont(name: "HelveticaNeue", size: 12)! | |
| 106 | + label.textAlignment = .left | |
| 107 | + return label | |
| 108 | + }() | |
| 109 | + | |
| 110 | + private lazy var typeLabel: UILabel = { | |
| 111 | + let label = UILabel() | |
| 112 | + label.textColor = HexColor("#999999") | |
| 113 | + label.font = UIFont(name: "HelveticaNeue", size: 12)! | |
| 114 | + label.textAlignment = .left | |
| 115 | + return label | |
| 116 | + }() | |
| 117 | + | |
| 118 | + private lazy var totalLabel: UILabel = { | |
| 119 | + let label = UILabel() | |
| 120 | + label.textColor = HexColor("#999999") | |
| 121 | + label.font = UIFont(name: "HelveticaNeue", size: 12)! | |
| 122 | + label.textAlignment = .left | |
| 123 | + return label | |
| 124 | + }() | |
| 125 | + | |
| 126 | + private lazy var lineView: UIView = { | |
| 127 | + let view = UIView() | |
| 128 | + view.backgroundColor = HexColor("#E6E6E6") | |
| 129 | + return view | |
| 130 | + }() | |
| 131 | + | |
| 132 | + private lazy var showMessageLabel: UILabel = { | |
| 133 | + let label = UILabel() | |
| 134 | + label.textColor = HexColor("#999999") | |
| 135 | + label.font = UIFont(name: "HelveticaNeue", size: 12)! | |
| 136 | + label.text = "是否显示" | |
| 137 | + label.textAlignment = .left | |
| 138 | + return label | |
| 139 | + }() | |
| 140 | + | |
| 141 | + private lazy var shareBtn: UIButton = { | |
| 142 | + let button = UIButton(type: .custom) | |
| 143 | + button.tag = 1001 | |
| 144 | + button.setTitle("分享", for: .normal) | |
| 145 | + button.titleLabel?.font = UIFont(name: "HelveticaNeue", size: 13)! | |
| 146 | + button.setTitleColor(HexColor("#FD862E"), for: .normal) | |
| 147 | + button.addTarget(self, action: #selector(actionClick), for: .touchUpInside) | |
| 148 | + return button | |
| 149 | + }() | |
| 150 | + | |
| 151 | + private lazy var editBtn: UIButton = { | |
| 152 | + let editButton = UIButton(type: .custom) | |
| 153 | + editButton.tag = 1002 | |
| 154 | + editButton.setTitle("编辑", for: .normal) | |
| 155 | + editButton.setImage(UIImage(named: "DS_main_rightArrow"), for: .normal) | |
| 156 | + editButton.titleLabel?.font = UIFont(name: "HelveticaNeue", size: 13)! | |
| 157 | + editButton.setupButtonImageAndTitlePossitionWith(padding: 4, style: .right) | |
| 158 | + editButton.setTitleColor(HexColor("#999999"), for: .normal) | |
| 159 | + editButton.addTarget(self, action: #selector(actionClick), for: .touchUpInside) | |
| 160 | + return editButton | |
| 161 | + }() | |
| 162 | + | |
| 163 | + private lazy var showSwitch: UISwitch = { | |
| 164 | + let switchControl = UISwitch() | |
| 165 | + switchControl.addTarget(self, action: #selector(switchChangesd), for: .valueChanged) | |
| 166 | + switchControl.transform = CGAffineTransformMakeScale(0.7, 0.7) | |
| 167 | + return switchControl | |
| 168 | + }() | |
| 169 | + | |
| 170 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | |
| 171 | + super.init(style: style,reuseIdentifier: reuseIdentifier) | |
| 172 | + self.backgroundColor = UIColor.clear | |
| 173 | + self.contentView.backgroundColor = UIColor.clear | |
| 174 | + self.selectionStyle = .none | |
| 175 | + self.isUserInteractionEnabled = true | |
| 176 | + | |
| 177 | + self.addSubview(self.selectBtn) | |
| 178 | + self.contentView.addSubview(self.bgWhiteView) | |
| 179 | + self.bgWhiteView.addSubview(self.leftBgView) | |
| 180 | + self.leftBgView.addSubview(self.lessMoneyLabel) | |
| 181 | + self.leftBgView.addSubview(self.maxMoneyLabel) | |
| 182 | + self.bgWhiteView.addSubview(self.titleLabel) | |
| 183 | + self.bgWhiteView.addSubview(self.idLabel) | |
| 184 | + self.bgWhiteView.addSubview(self.typeLabel) | |
| 185 | + self.bgWhiteView.addSubview(self.totalLabel) | |
| 186 | + self.bgWhiteView.addSubview(self.lineView) | |
| 187 | + self.bgWhiteView.addSubview(self.showMessageLabel) | |
| 188 | + self.bgWhiteView.addSubview(self.shareBtn) | |
| 189 | + self.bgWhiteView.addSubview(self.editBtn) | |
| 190 | + self.bgWhiteView.addSubview(self.showSwitch) | |
| 191 | + | |
| 192 | + self.setSubViewsLayout() | |
| 193 | + } | |
| 194 | + | |
| 195 | + required init?(coder: NSCoder) { | |
| 196 | + fatalError("init(coder:) has not been implemented") | |
| 197 | + } | |
| 198 | + | |
| 199 | + func setSubViewsLayout(){ | |
| 200 | + self.selectBtn.snp.makeConstraints { make in | |
| 201 | + make.left.equalTo(self).offset(15) | |
| 202 | + make.centerY.equalTo(self) | |
| 203 | + make.width.height.equalTo(30) | |
| 204 | + } | |
| 205 | + self.bgWhiteView.snp.makeConstraints { make in | |
| 206 | + make.left.equalTo(self).offset(15) | |
| 207 | + make.right.equalTo(self).offset(-15) | |
| 208 | + make.top.bottom.equalTo(self) | |
| 209 | + } | |
| 210 | + self.leftBgView.snp.makeConstraints { make in | |
| 211 | + make.left.top.bottom.equalTo(self.bgWhiteView) | |
| 212 | + make.width.equalTo(110) | |
| 213 | + } | |
| 214 | + self.lessMoneyLabel.snp.makeConstraints { make in | |
| 215 | + make.top.equalTo(self.leftBgView).offset(23) | |
| 216 | + make.left.right.equalTo(self.leftBgView) | |
| 217 | + } | |
| 218 | + self.maxMoneyLabel.snp.makeConstraints { make in | |
| 219 | + make.top.equalTo(self.lessMoneyLabel.snp.bottom) | |
| 220 | + make.left.right.equalTo(self.leftBgView) | |
| 221 | + } | |
| 222 | + self.titleLabel.snp.makeConstraints { make in | |
| 223 | + make.top.equalTo(self.bgWhiteView).offset(15) | |
| 224 | + make.left.equalTo(self.leftBgView.snp.right).offset(15) | |
| 225 | + } | |
| 226 | + self.idLabel.snp.makeConstraints { make in | |
| 227 | + make.right.equalTo(self.shareBtn.snp.left) | |
| 228 | + make.left.equalTo(self.titleLabel.snp.right) | |
| 229 | + make.centerY.equalTo(self.titleLabel) | |
| 230 | + } | |
| 231 | + self.typeLabel.snp.makeConstraints { make in | |
| 232 | + make.left.equalTo(self.titleLabel) | |
| 233 | + make.top.equalTo(self.titleLabel.snp.bottom).offset(5) | |
| 234 | + } | |
| 235 | + self.totalLabel.snp.makeConstraints { make in | |
| 236 | + make.left.equalTo(self.titleLabel) | |
| 237 | + make.top.equalTo(self.typeLabel.snp.bottom).offset(1) | |
| 238 | + make.right.equalTo(self.editBtn.snp.left) | |
| 239 | + } | |
| 240 | + self.lineView.snp.makeConstraints { make in | |
| 241 | + make.left.equalTo(self.titleLabel) | |
| 242 | + make.top.equalTo(self.totalLabel.snp.bottom).offset(10) | |
| 243 | + make.right.equalTo(self.bgWhiteView).offset(-15) | |
| 244 | + make.height.equalTo(0.5) | |
| 245 | + } | |
| 246 | + self.showMessageLabel.snp.makeConstraints { make in | |
| 247 | + make.left.equalTo(self.titleLabel) | |
| 248 | + make.bottom.equalTo(self.bgWhiteView).offset(-15) | |
| 249 | + } | |
| 250 | + self.shareBtn.snp.makeConstraints { make in | |
| 251 | + make.right.equalTo(self.lineView) | |
| 252 | + make.centerY.equalTo(self.titleLabel) | |
| 253 | + make.width.equalTo(30) | |
| 254 | + make.height.equalTo(18.5) | |
| 255 | + } | |
| 256 | + self.editBtn.snp.makeConstraints { make in | |
| 257 | + make.right.equalTo(self.lineView) | |
| 258 | + make.centerY.equalTo(self.totalLabel) | |
| 259 | + make.width.equalTo(45) | |
| 260 | + make.height.equalTo(18.5) | |
| 261 | + } | |
| 262 | + self.showSwitch.snp.makeConstraints { make in | |
| 263 | + make.right.equalTo(self.lineView) | |
| 264 | + make.centerY.equalTo(self.showMessageLabel) | |
| 265 | + } | |
| 266 | + } | |
| 267 | + | |
| 268 | + func setEditing(editing:Bool,animated:Bool){ | |
| 269 | + if editing{ | |
| 270 | + self.selectBtn.isHidden = false | |
| 271 | + self.bgWhiteView.snp.updateConstraints { make in | |
| 272 | + make.left.equalTo(self.contentView).offset(55) | |
| 273 | + } | |
| 274 | + }else{ | |
| 275 | + self.selectBtn.isSelected = false | |
| 276 | + self.selectBtn.isHidden = true | |
| 277 | + self.bgWhiteView.snp.updateConstraints { make in | |
| 278 | + make.left.equalTo(self.contentView).offset(15) | |
| 279 | + } | |
| 280 | + } | |
| 281 | + } | |
| 282 | + | |
| 283 | + @objc func actionClick(_ sender:UIButton){ | |
| 284 | + self.actionClickBlock!(sender.tag - 1001,_model!) | |
| 285 | + } | |
| 286 | + | |
| 287 | + @objc func switchChangesd(_ sender:UISwitch){ | |
| 288 | + showLoading(message: "") | |
| 289 | + CNLiveShopCouponViewModel.requestEditCouponAtterWithId(couponId: _model!.id!) { result, status in | |
| 290 | + if status == .success{ | |
| 291 | + showMessage(message: "修改成功") | |
| 292 | + self.model?.is_show = sender.isOn ? "1" : "2" | |
| 293 | + }else{ | |
| 294 | + showMessage(message: "修改失败") | |
| 295 | + } | |
| 296 | + } | |
| 297 | + } | |
| 298 | + | |
| 299 | + @objc func editBtnClick(_ sender:UIButton){ | |
| 300 | + sender.isSelected = !sender.isSelected | |
| 301 | + self.editBtnClickBlock!(sender.isSelected,_model!.id!) | |
| 302 | + } | |
| 303 | + | |
| 304 | + func dealDiscountAndFilledNumber(count:Int) -> String{ | |
| 305 | + var afterCount = "" | |
| 306 | + if count >= 0 && count < 10000{ | |
| 307 | + afterCount = String(format: "%d", count) | |
| 308 | + }else if count > 10000 && count < 10000000{ | |
| 309 | + if (count % 10000 != 0) { | |
| 310 | + afterCount = String(format: "%.1f万", Double(count)/10000.0) | |
| 311 | + }else{ | |
| 312 | + afterCount = String(format: "%d万", count/10000) | |
| 313 | + } | |
| 314 | + }else if (count >= 10000000){ | |
| 315 | + afterCount = "1000万" | |
| 316 | + } | |
| 317 | + return afterCount | |
| 318 | + } | |
| 319 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLiveCreateCouponTableViewCell.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveCreateCouponTableViewCell.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/15. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +typealias couponGoodsHiddenActionBlock = (_ isHidden:Bool)->Void | |
| 11 | +typealias textFieldChangeActionBlock = (_ section:Int,_ number:String)->Void | |
| 12 | +typealias dateSelectActionBlock = (_ id:Int,_ date:NSDate)->Void | |
| 13 | +typealias couponGoodsActionBlock = (_ goodsId:String)->Void | |
| 14 | + | |
| 15 | +class CNLiveCreateCouponTableViewCell:UITableViewCell,UITextFieldDelegate{ | |
| 16 | + var _model:CNLiveShopCouponModel? | |
| 17 | + var model:CNLiveShopCouponModel?{ | |
| 18 | + get{ | |
| 19 | + _model | |
| 20 | + } | |
| 21 | + set{ | |
| 22 | + _model = newValue | |
| 23 | + self.titleLabel.text = _model!.title | |
| 24 | + self.leftView.isHidden = true | |
| 25 | + self.titleNumber.isHidden = true | |
| 26 | + self.moneyView.isHidden = true | |
| 27 | + self.chooseView.isHidden = true | |
| 28 | + self.goodsLabel.isHidden = true | |
| 29 | + self.rightView.isHidden = true | |
| 30 | + self.showSwitch.isHidden = true | |
| 31 | + if _model!.id%5 == 0{ | |
| 32 | + self.lineView.isHidden = true | |
| 33 | + }else{ | |
| 34 | + self.lineView.isHidden = false | |
| 35 | + } | |
| 36 | + switch _model!.type{ | |
| 37 | + case 1: | |
| 38 | + self.leftView.isHidden = false | |
| 39 | + self.titleNumber.isHidden = false | |
| 40 | + self.titleNumber.isEnabled = true | |
| 41 | + self.titleNumber.placeholder = _model!.subTitle | |
| 42 | + self.titleNumber.text = _model!.message | |
| 43 | + if (_model!.id == 3) { | |
| 44 | + self.titleNumber.keyboardType = .numberPad | |
| 45 | + }else{ | |
| 46 | + self.titleNumber.keyboardType = .default | |
| 47 | + } | |
| 48 | + | |
| 49 | + break | |
| 50 | + case 2: | |
| 51 | + self.leftView.isHidden = false | |
| 52 | + self.moneyView.isHidden = false | |
| 53 | + self.moneyView.editEnabled = self.editEnabled | |
| 54 | + self.moneyView.model = _model | |
| 55 | + break | |
| 56 | + case 3: | |
| 57 | + self.leftView.isHidden = false | |
| 58 | + self.titleNumber.isHidden = false | |
| 59 | + self.titleNumber.placeholder = _model?.subTitle | |
| 60 | + self.titleNumber.isEnabled = false | |
| 61 | + if model?.message?.isEmpty == false{ | |
| 62 | + let interval = Double((_model?.message)!)! | |
| 63 | + let dateFormatter = DateFormatter() | |
| 64 | + dateFormatter.dateFormat = "yyyy-MM-dd" | |
| 65 | + let date = Date(timeIntervalSince1970: TimeInterval(interval)) | |
| 66 | + let dateStr = dateFormatter.string(from: date) | |
| 67 | + self.titleNumber.text = dateStr | |
| 68 | + } | |
| 69 | + break | |
| 70 | + case 4: | |
| 71 | + self.chooseView.isHidden = false | |
| 72 | + self.chooseView.editEnabled = self.editEnabled | |
| 73 | + self.chooseView.titles = CNLiveShopCouponViewModel.selectTitles(id: _model!.id) | |
| 74 | + self.chooseView.selectIndex = _model!.section | |
| 75 | + break | |
| 76 | + case 5: | |
| 77 | + self.rightView.isHidden = false | |
| 78 | + self.goodsLabel.isHidden = false | |
| 79 | + self.goodsLabel.placeholder = _model!.subTitle | |
| 80 | + self.goodsLabel.text = _model!.message | |
| 81 | + break | |
| 82 | + case 6: | |
| 83 | + self.showSwitch.isHidden = false | |
| 84 | + if _model!.section == 1{ | |
| 85 | + self.showSwitch.setOn(true, animated: true) | |
| 86 | + }else{ | |
| 87 | + self.showSwitch.setOn(false, animated: true) | |
| 88 | + } | |
| 89 | + break | |
| 90 | + default: | |
| 91 | + break | |
| 92 | + } | |
| 93 | + } | |
| 94 | + } | |
| 95 | + | |
| 96 | + lazy var goodsLabel :UITextField = { | |
| 97 | + let goodsLabel = UITextField() | |
| 98 | + goodsLabel.textColor = HexColor("#333333") | |
| 99 | + goodsLabel.textAlignment = .right | |
| 100 | + goodsLabel.font = Font_14 | |
| 101 | + goodsLabel.delegate = self | |
| 102 | + goodsLabel.isEnabled = false | |
| 103 | + return goodsLabel | |
| 104 | + }() | |
| 105 | + | |
| 106 | + var editEnabled:Bool = false | |
| 107 | + var couponGoodsHiddenBlock:couponGoodsHiddenActionBlock? | |
| 108 | + var textFieldChangeBlock:textFieldChangeActionBlock? | |
| 109 | + var dateSelectBlock:dateSelectActionBlock? | |
| 110 | + var couponGoodsBlock:couponGoodsActionBlock? | |
| 111 | + | |
| 112 | + lazy var leftView :UIImageView = { | |
| 113 | + let leftView = UIImageView() | |
| 114 | + leftView.contentMode = .scaleAspectFit | |
| 115 | + leftView.image = UIImage(named: "DS_coupon_need") | |
| 116 | + return leftView | |
| 117 | + }() | |
| 118 | + | |
| 119 | + lazy var titleLabel: UILabel = { | |
| 120 | + let titleLabel = UILabel.init() | |
| 121 | + titleLabel.textColor = HexColor("#333333") | |
| 122 | + titleLabel.textAlignment = .left | |
| 123 | + titleLabel.font = Font_14 | |
| 124 | + return titleLabel | |
| 125 | + }() | |
| 126 | + | |
| 127 | + lazy var lineView :UIView = { | |
| 128 | + let lineView = UIView() | |
| 129 | + lineView.backgroundColor = HexColor("#E4E4E4") | |
| 130 | + return lineView | |
| 131 | + }() | |
| 132 | + | |
| 133 | + //右侧输入框 | |
| 134 | + lazy var titleNumber :UITextField = { | |
| 135 | + let textFiled = UITextField() | |
| 136 | + textFiled.textColor = HexColor("#333333") | |
| 137 | + textFiled.textAlignment = .right | |
| 138 | + textFiled.font = Font_14 | |
| 139 | + textFiled.delegate = self | |
| 140 | + return textFiled | |
| 141 | + }() | |
| 142 | + | |
| 143 | + var currentDate:NSDate? | |
| 144 | + //满减view | |
| 145 | + lazy var moneyView :CNLiveCreateCouponTypeMoneyView = { | |
| 146 | + let moneyView = CNLiveCreateCouponTypeMoneyView() | |
| 147 | + moneyView.textFieldChangeBlock = {section,number in | |
| 148 | + self.textFieldChangeBlock!(section, number) | |
| 149 | + } | |
| 150 | + return moneyView | |
| 151 | + }() | |
| 152 | + | |
| 153 | + //单选选择器 | |
| 154 | + lazy var chooseView :CNLiveSelectCouponTapView = { | |
| 155 | + let chooseView = CNLiveSelectCouponTapView() | |
| 156 | + chooseView.selectTypeBlock = { section in | |
| 157 | + self.model?.section = section | |
| 158 | + if self.model!.id == 6{ | |
| 159 | + self.couponGoodsHiddenBlock!((section == 1) ? true : false) | |
| 160 | + } | |
| 161 | + } | |
| 162 | + return chooseView | |
| 163 | + }() | |
| 164 | + | |
| 165 | + //商品选择器 | |
| 166 | + lazy var rightView :UIImageView = { | |
| 167 | + let rightView = UIImageView() | |
| 168 | + rightView.contentMode = .scaleAspectFit | |
| 169 | + rightView.image = UIImage(named: "DS_main_rightArrow") | |
| 170 | + return rightView | |
| 171 | + }() | |
| 172 | + | |
| 173 | + //开关 | |
| 174 | + lazy var showSwitch :UISwitch = { | |
| 175 | + let showSwitch = UISwitch() | |
| 176 | + showSwitch.addTarget(self, action: #selector(switchChangesd(_:)), for: .valueChanged) | |
| 177 | + return showSwitch | |
| 178 | + }() | |
| 179 | + | |
| 180 | + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | |
| 181 | + super.init(style: style, reuseIdentifier: reuseIdentifier) | |
| 182 | + self.selectionStyle = .none | |
| 183 | + self.currentDate = NSDate(timeIntervalSince1970: NSDate().timeIntervalSince1970) | |
| 184 | + CNLiveCommonManager.shared.postGetTimeWithResult(resultBlock: { networkTimestamp in | |
| 185 | + self.currentDate = NSDate(timeIntervalSince1970:networkTimestamp) | |
| 186 | + }) | |
| 187 | + self.contentView.addSubview(self.leftView) | |
| 188 | + self.contentView.addSubview(self.titleLabel) | |
| 189 | + self.contentView.addSubview(self.lineView) | |
| 190 | + self.contentView.addSubview(self.titleNumber) | |
| 191 | + self.contentView.addSubview(self.moneyView) | |
| 192 | + self.contentView.addSubview(self.chooseView) | |
| 193 | + self.contentView.addSubview(self.rightView) | |
| 194 | + self.contentView.addSubview(self.goodsLabel) | |
| 195 | + self.contentView.addSubview(self.showSwitch) | |
| 196 | + self.setSubViewsLayout() | |
| 197 | + | |
| 198 | + } | |
| 199 | + | |
| 200 | + required init?(coder: NSCoder) { | |
| 201 | + fatalError("init(coder:) has not been implemented") | |
| 202 | + } | |
| 203 | + func setSubViewsLayout(){ | |
| 204 | + self.leftView.snp.makeConstraints({ make in | |
| 205 | + make.left.equalTo(self).offset(5.5) | |
| 206 | + make.centerY.equalTo(self) | |
| 207 | + make.width.height.equalTo(5) | |
| 208 | + }) | |
| 209 | + self.titleLabel.snp.makeConstraints({ make in | |
| 210 | + make.left.equalTo(self.leftView.snp.right).offset(4.5) | |
| 211 | + make.centerY.equalTo(self) | |
| 212 | + make.width.equalTo(70) | |
| 213 | + }) | |
| 214 | + self.lineView.snp.makeConstraints({ make in | |
| 215 | + make.left.equalTo(self).offset(15) | |
| 216 | + make.right.equalTo(self).offset(-15) | |
| 217 | + make.height.equalTo(0.5) | |
| 218 | + make.bottom.equalTo(self) | |
| 219 | + }) | |
| 220 | + self.titleNumber.snp.makeConstraints({ make in | |
| 221 | + make.right.equalTo(self).offset(-15) | |
| 222 | + make.left.equalTo(self.titleLabel.snp.right) | |
| 223 | + make.centerY.equalTo(self) | |
| 224 | + }) | |
| 225 | + self.moneyView.snp.makeConstraints({ make in | |
| 226 | + make.right.equalTo(self.titleNumber) | |
| 227 | + make.left.equalTo(self.titleLabel.snp.right) | |
| 228 | + make.centerY.height.equalTo(self) | |
| 229 | + }) | |
| 230 | + self.chooseView.snp.makeConstraints({ make in | |
| 231 | + make.right.equalTo(self.titleNumber) | |
| 232 | + make.left.equalTo(self.titleLabel.snp.right) | |
| 233 | + make.centerY.height.equalTo(self) | |
| 234 | + }) | |
| 235 | + self.rightView.snp.makeConstraints({ make in | |
| 236 | + make.right.equalTo(self.titleNumber) | |
| 237 | + make.width.equalTo(16) | |
| 238 | + make.centerY.height.equalTo(self) | |
| 239 | + }) | |
| 240 | + self.goodsLabel.snp.makeConstraints({ make in | |
| 241 | + make.right.equalTo(self.rightView.snp.left).offset(-5) | |
| 242 | + make.centerY.equalTo(self) | |
| 243 | + }) | |
| 244 | + self.showSwitch.snp.makeConstraints({ make in | |
| 245 | + make.right.equalTo(self.titleNumber) | |
| 246 | + make.centerY.equalTo(self) | |
| 247 | + }) | |
| 248 | + } | |
| 249 | + | |
| 250 | + override func setSelected(_ selected: Bool, animated: Bool) { | |
| 251 | + if self.model?.type == 3 && selected{ | |
| 252 | + if self.editEnabled == false{ | |
| 253 | + showMessage(message: "该项不可编辑") | |
| 254 | + return | |
| 255 | + } | |
| 256 | + CNLiveCommonManager.shared.postGetTimeWithResult(resultBlock: {networkTimestamp in | |
| 257 | + let pickerView = CNLivePickerView(pickerDateStyle: [.displayYear , .displayMonth , .displayDay], selectDate: self.currentDate!, maxDate: NSDate(timeIntervalSinceNow: 3600.0 * 24 * 30 * 24), minDate: NSDate(timeIntervalSince1970: networkTimestamp), remind: self.model!.subTitle!) | |
| 258 | + pickerView.confirmSelectDateCallback = { date in | |
| 259 | + let formatter = DateFormatter() | |
| 260 | + formatter.dateFormat = "yyyy-MM-dd" | |
| 261 | + let dateStr = formatter.string(from: date as Date) | |
| 262 | + | |
| 263 | + self.currentDate = date | |
| 264 | + self.titleNumber.text = dateStr | |
| 265 | + formatter.timeZone = NSTimeZone.local | |
| 266 | + self.dateSelectBlock!(self.model!.id, formatter.date(from: dateStr)! as NSDate) | |
| 267 | + } | |
| 268 | + pickerView.show() | |
| 269 | + }) | |
| 270 | + }else if self.model!.type == 5 && selected{ | |
| 271 | + if self.editEnabled == false{ | |
| 272 | + showMessage(message: "该项不可编辑") | |
| 273 | + return | |
| 274 | + } | |
| 275 | + | |
| 276 | + CNLiveCouponGoodsListView.couponGoodsViewShow(){ goodsId ,goodsTitle in | |
| 277 | + self.couponGoodsBlock!(goodsId) | |
| 278 | + if goodsTitle.count > 20 { | |
| 279 | + self.goodsLabel.text = goodsTitle.substring(to: goodsTitle.index(goodsTitle.startIndex, offsetBy: 20)) | |
| 280 | + } else { | |
| 281 | + self.goodsLabel.text = goodsTitle | |
| 282 | + } | |
| 283 | + } | |
| 284 | + | |
| 285 | + } | |
| 286 | + } | |
| 287 | + | |
| 288 | + @objc func switchChangesd(_ sender:UISwitch){ | |
| 289 | + self.model?.section = sender.isOn ? 1 : 2 | |
| 290 | + } | |
| 291 | + | |
| 292 | + // MARK: - UITextFieldDelegate | |
| 293 | + func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { | |
| 294 | + if self.model!.id != 1 { | |
| 295 | + if !self.editEnabled{ | |
| 296 | + showMessage(message: "该项不可编辑") | |
| 297 | + return false | |
| 298 | + } | |
| 299 | + } | |
| 300 | + return true | |
| 301 | + } | |
| 302 | + | |
| 303 | + func textFieldDidEndEditing(_ textField: UITextField){ | |
| 304 | + | |
| 305 | + if self.model!.id == 1{ | |
| 306 | + self.model!.message = textField.text | |
| 307 | + } | |
| 308 | + self.textFieldChangeBlock!(self.model!.id,textField.text!) | |
| 309 | + } | |
| 310 | + | |
| 311 | + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { | |
| 312 | + if self.model!.id == 1{ | |
| 313 | + if textField.text!.count + string.count > 20{ | |
| 314 | + | |
| 315 | + let substringToAdd = string.prefix(20 - (textField.text?.count ?? 0) ) | |
| 316 | + textField.text = textField.text?.appending(substringToAdd) | |
| 317 | + return false | |
| 318 | + } | |
| 319 | + return true | |
| 320 | + }else{ | |
| 321 | + return true | |
| 322 | + } | |
| 323 | + } | |
| 324 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLiveCreateCouponTypeMoneyView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveCreateCouponTypeMoneyView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/15. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLiveCreateCouponTypeMoneyView:UIView,UITextFieldDelegate{ | |
| 11 | + var textFieldChangeBlock:textFieldChangeActionBlock? | |
| 12 | + var _model:CNLiveShopCouponModel? | |
| 13 | + var model:CNLiveShopCouponModel?{ | |
| 14 | + get{ | |
| 15 | + _model | |
| 16 | + } | |
| 17 | + set{ | |
| 18 | + _model = newValue | |
| 19 | + self.maxPut.text = _model?.filled | |
| 20 | + self.lessPut.text = _model?.disCount | |
| 21 | + } | |
| 22 | + } | |
| 23 | + | |
| 24 | + var editEnabled:Bool = false | |
| 25 | + lazy var man1Label: UILabel = { | |
| 26 | + let man1Label = UILabel.init() | |
| 27 | + man1Label.textColor = HexColor("#999999") | |
| 28 | + man1Label.font = Font_14 | |
| 29 | + man1Label.text = "满" | |
| 30 | + return man1Label | |
| 31 | + }() | |
| 32 | + | |
| 33 | + lazy var maxPut :UITextField = { | |
| 34 | + let maxPut = UITextField() | |
| 35 | + maxPut.textColor = HexColor("#333333") | |
| 36 | + maxPut.textAlignment = .center | |
| 37 | + maxPut.font = Font_14 | |
| 38 | + maxPut.delegate = self | |
| 39 | + maxPut.tag = 1001 | |
| 40 | + maxPut.backgroundColor = HexColor("#F9F9F9") | |
| 41 | + maxPut.keyboardType = .numberPad | |
| 42 | + let path = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: 60, height: 29), byRoundingCorners: .allCorners, cornerRadii: CGSize(width: 4, height: 4)) | |
| 43 | + let shapelayer = CAShapeLayer() | |
| 44 | + shapelayer.path = path.cgPath | |
| 45 | + maxPut.layer.mask = shapelayer | |
| 46 | + return maxPut | |
| 47 | + }() | |
| 48 | + | |
| 49 | + lazy var midLabel: UILabel = { | |
| 50 | + let midLabel = UILabel.init() | |
| 51 | + midLabel.textColor = HexColor("#999999") | |
| 52 | + midLabel.font = Font_14 | |
| 53 | + midLabel.text = "元减" | |
| 54 | + return midLabel | |
| 55 | + }() | |
| 56 | + | |
| 57 | + lazy var lessPut :UITextField = { | |
| 58 | + let lessPut = UITextField() | |
| 59 | + lessPut.textColor = HexColor("#333333") | |
| 60 | + lessPut.textAlignment = .center | |
| 61 | + lessPut.font = Font_14 | |
| 62 | + lessPut.delegate = self | |
| 63 | + lessPut.tag = 1002 | |
| 64 | + lessPut.backgroundColor = HexColor("#F9F9F9") | |
| 65 | + lessPut.keyboardType = .numberPad | |
| 66 | + let path = UIBezierPath(roundedRect: CGRect(x: 0, y: 0, width: 60, height: 29), byRoundingCorners: .allCorners, cornerRadii: CGSize(width: 4, height: 4)) | |
| 67 | + let shapelayer = CAShapeLayer() | |
| 68 | + shapelayer.path = path.cgPath | |
| 69 | + lessPut.layer.mask = shapelayer | |
| 70 | + return lessPut | |
| 71 | + }() | |
| 72 | + | |
| 73 | + lazy var lastLabel: UILabel = { | |
| 74 | + let lastLabel = UILabel.init() | |
| 75 | + lastLabel.textColor = HexColor("#999999") | |
| 76 | + lastLabel.font = Font_14 | |
| 77 | + lastLabel.text = "元" | |
| 78 | + return lastLabel | |
| 79 | + }() | |
| 80 | + | |
| 81 | + init() { | |
| 82 | + super.init(frame: CGRectZero) | |
| 83 | + self.addSubview(self.man1Label) | |
| 84 | + self.addSubview(self.maxPut) | |
| 85 | + self.addSubview(self.midLabel) | |
| 86 | + self.addSubview(self.lessPut) | |
| 87 | + self.addSubview(self.lastLabel) | |
| 88 | + self.setSubViewsLayout() | |
| 89 | + } | |
| 90 | + | |
| 91 | + required init?(coder: NSCoder) { | |
| 92 | + fatalError("init(coder:) has not been implemented") | |
| 93 | + } | |
| 94 | + func setSubViewsLayout(){ | |
| 95 | + self.lastLabel.snp.makeConstraints({ make in | |
| 96 | + make.right.centerY.equalTo(self) | |
| 97 | + }) | |
| 98 | + self.lessPut.snp.makeConstraints({ make in | |
| 99 | + make.right.equalTo(self.lastLabel.snp.left) | |
| 100 | + make.centerY.equalTo(self) | |
| 101 | + make.width.equalTo(60) | |
| 102 | + make.height.equalTo(29) | |
| 103 | + }) | |
| 104 | + self.midLabel.snp.makeConstraints({ make in | |
| 105 | + make.centerY.equalTo(self) | |
| 106 | + make.right.equalTo(self.lessPut.snp.left).offset(-10) | |
| 107 | + }) | |
| 108 | + self.maxPut.snp.makeConstraints({ make in | |
| 109 | + make.right.equalTo(self.midLabel.snp.left).offset(-10) | |
| 110 | + make.centerY.equalTo(self) | |
| 111 | + make.width.equalTo(60) | |
| 112 | + make.height.equalTo(29) | |
| 113 | + }) | |
| 114 | + self.man1Label.snp.makeConstraints({ make in | |
| 115 | + make.centerY.equalTo(self) | |
| 116 | + make.right.equalTo(self.maxPut.snp.left).offset(-10) | |
| 117 | + }) | |
| 118 | + } | |
| 119 | + | |
| 120 | + // MARK: - UITextFieldDelegate | |
| 121 | + func textFieldShouldBeginEditing(_ textField: UITextField) -> Bool { | |
| 122 | + if self.editEnabled == false{ | |
| 123 | + showMessage(message: "该项不可编辑") | |
| 124 | + return false | |
| 125 | + } | |
| 126 | + return true | |
| 127 | + } | |
| 128 | + func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool { | |
| 129 | + if string == ""{ | |
| 130 | + return true | |
| 131 | + } | |
| 132 | + let isNum = (string as NSString).isPurnInt() | |
| 133 | + return isNum | |
| 134 | + } | |
| 135 | + func textFieldDidEndEditing(_ textField: UITextField) { | |
| 136 | + self.textFieldChangeBlock?(textField.tag, textField.text ?? "") | |
| 137 | + } | |
| 138 | + | |
| 139 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLivePickerSelectDateTools.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLivePickerSelectDateTools.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/15. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLivePickerSelectDateTools:NSObject{ | |
| 11 | + /** | |
| 12 | + 年 | |
| 13 | + */ | |
| 14 | + var selectYear:Int = 0 | |
| 15 | + /** | |
| 16 | + 月 | |
| 17 | + */ | |
| 18 | + var selectMonth:Int = 0 | |
| 19 | + /** | |
| 20 | + 日 | |
| 21 | + */ | |
| 22 | + var selectDay:Int = 0 | |
| 23 | + /** | |
| 24 | + 时 | |
| 25 | + */ | |
| 26 | + var selectHour:Int = 0 | |
| 27 | + /** | |
| 28 | + 分 | |
| 29 | + */ | |
| 30 | + var selectMinute:Int = 0 | |
| 31 | + /** | |
| 32 | + 秒 | |
| 33 | + */ | |
| 34 | + var selectSecond:Int = 0 | |
| 35 | + | |
| 36 | + /** | |
| 37 | + 转化成年份 | |
| 38 | + | |
| 39 | + @return 年份 | |
| 40 | + */ | |
| 41 | + func bk_transformYear(date:NSDate) ->Int{ | |
| 42 | + return self.picker_calendar.component(.year, from:date as Date) | |
| 43 | + } | |
| 44 | + /** | |
| 45 | + 转化成月份 | |
| 46 | + | |
| 47 | + @return 月份 | |
| 48 | + */ | |
| 49 | + func bk_transformMonth(date:NSDate) ->Int{ | |
| 50 | + return self.picker_calendar.component(.month, from:date as Date) | |
| 51 | + } | |
| 52 | + /** | |
| 53 | + 转化成天 | |
| 54 | + | |
| 55 | + @return 天 | |
| 56 | + */ | |
| 57 | + func bk_transformDay(date:NSDate) ->Int{ | |
| 58 | + return self.picker_calendar.component(.day, from:date as Date) | |
| 59 | + } | |
| 60 | + /** | |
| 61 | + 转化成时 | |
| 62 | + | |
| 63 | + @return 时 | |
| 64 | + */ | |
| 65 | + func bk_transformHour(date:NSDate) ->Int{ | |
| 66 | + return self.picker_calendar.component(.hour, from:date as Date) | |
| 67 | + } | |
| 68 | + /** | |
| 69 | + 转化成分 | |
| 70 | + | |
| 71 | + @returnf 分 | |
| 72 | + */ | |
| 73 | + func bk_transformMinute(date:NSDate) ->Int{ | |
| 74 | + return self.picker_calendar.component(.minute, from:date as Date) | |
| 75 | + } | |
| 76 | + /** | |
| 77 | + 转化成秒 | |
| 78 | + | |
| 79 | + @return 秒 | |
| 80 | + */ | |
| 81 | + func bk_transformSecond(date:NSDate) ->Int{ | |
| 82 | + return self.picker_calendar.component(.second, from:date as Date) | |
| 83 | + } | |
| 84 | + lazy var picker_calendar :NSCalendar = { | |
| 85 | + let picker_calendar = NSCalendar(identifier: .gregorian) | |
| 86 | + return picker_calendar! | |
| 87 | + }() | |
| 88 | + /** | |
| 89 | + 切换选中日期 | |
| 90 | + | |
| 91 | + @param date 选中日期 | |
| 92 | + */ | |
| 93 | + func changeSelectDate(date:NSDate){ | |
| 94 | + self.selectYear = self.bk_transformYear(date: date) | |
| 95 | + self.selectMonth = self.bk_transformMonth(date: date) | |
| 96 | + self.selectDay = self.bk_transformDay(date: date) | |
| 97 | + self.selectHour = self.bk_transformHour(date: date) | |
| 98 | + self.selectMinute = self.bk_transformMinute(date: date) | |
| 99 | + self.selectSecond = self.bk_transformSecond(date: date) | |
| 100 | + } | |
| 101 | +// -(void)setSelectYear:(NSUInteger)selectYear | |
| 102 | +// { | |
| 103 | +// _selectYear = selectYear; | |
| 104 | +// } | |
| 105 | +// | |
| 106 | +// -(void)setSelectMonth:(NSUInteger)selectMonth | |
| 107 | +// { | |
| 108 | +// _selectMonth = selectMonth; | |
| 109 | +// } | |
| 110 | +// | |
| 111 | +// -(void)setSelectDay:(NSUInteger)selectDay | |
| 112 | +// { | |
| 113 | +// _selectDay = selectDay; | |
| 114 | +// } | |
| 115 | +// | |
| 116 | +// -(void)setSelectHour:(NSUInteger)selectHour | |
| 117 | +// { | |
| 118 | +// _selectHour = selectHour; | |
| 119 | +// } | |
| 120 | +// | |
| 121 | +// -(void)setSelectMinute:(NSUInteger)selectMinute | |
| 122 | +// { | |
| 123 | +// _selectMinute = selectMinute; | |
| 124 | +// } | |
| 125 | +// | |
| 126 | +// -(void)setSelectSecond:(NSUInteger)selectSecond | |
| 127 | +// { | |
| 128 | +// _selectSecond = selectSecond; | |
| 129 | +// } | |
| 130 | + | |
| 131 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLivePickerToolsView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLivePickerToolsView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/15. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +typealias clickCancelBtnActionCallBack = ()-> Void | |
| 11 | +typealias clickConfirmBtnActionCallBack = ()-> Void | |
| 12 | + | |
| 13 | +class CNLivePickerToolsView:UIView{ | |
| 14 | + var _remind:String? | |
| 15 | + var remind:String?{ | |
| 16 | + get{ | |
| 17 | + _remind | |
| 18 | + } | |
| 19 | + set{ | |
| 20 | + _remind = newValue | |
| 21 | + self.remindLab?.text = _remind?.count ?? 0 > 0 ? _remind : "" | |
| 22 | + } | |
| 23 | + } | |
| 24 | + | |
| 25 | + var clickCancelBtnCallBack:clickCancelBtnActionCallBack? | |
| 26 | + var clickConfirmBtnCallBack:clickConfirmBtnActionCallBack? | |
| 27 | + var remindLab:UILabel? | |
| 28 | + var confirmBtn:UIButton? | |
| 29 | + | |
| 30 | + required init?(coder: NSCoder) { | |
| 31 | + fatalError("init(coder:) has not been implemented") | |
| 32 | + } | |
| 33 | + override init(frame: CGRect) { | |
| 34 | + super.init(frame: frame) | |
| 35 | + self.backgroundColor = HexColor("#F6F6F6") | |
| 36 | + self.initUI() | |
| 37 | + } | |
| 38 | + | |
| 39 | + func initUI(){ | |
| 40 | + let cancelBtn = UIButton(type: .system) | |
| 41 | + cancelBtn.frame = CGRect(x: 0, y: 0, width: 64, height: self.height) | |
| 42 | + cancelBtn.setTitle("取消", for: .normal) | |
| 43 | + cancelBtn.setTitleColor(HexColor("#1E86FF"), for: .normal) | |
| 44 | + cancelBtn.titleLabel?.font = Font_16 | |
| 45 | + cancelBtn.addTarget(self, action: #selector(cancelBtnClick), for: .touchUpInside) | |
| 46 | + self.addSubview(cancelBtn) | |
| 47 | + | |
| 48 | + let confirmBtn = UIButton(type: .system) | |
| 49 | + confirmBtn.frame = CGRect(x: self.width - 64, y: 0, width: 64, height: self.height) | |
| 50 | + confirmBtn.setTitle("完成", for: .normal) | |
| 51 | + confirmBtn.setTitleColor(HexColor("#1E86FF"), for: .normal) | |
| 52 | + confirmBtn.titleLabel?.font = Font_16 | |
| 53 | + confirmBtn.addTarget(self, action: #selector(confirmBtnClick), for: .touchUpInside) | |
| 54 | + self.addSubview(confirmBtn) | |
| 55 | + | |
| 56 | + let remindLab = UILabel.init(frame: CGRectMake(64, 0, self.width - 64*2, self.height)) | |
| 57 | + remindLab.textColor = HexColor("#999999") | |
| 58 | + remindLab.textAlignment = .center | |
| 59 | + remindLab.font = Font_15 | |
| 60 | + remindLab.text = self.remind?.count ?? 0 > 0 ? self.remind : "" | |
| 61 | + self.remindLab = remindLab | |
| 62 | + self.addSubview(self.remindLab!) | |
| 63 | + } | |
| 64 | + | |
| 65 | + @objc func cancelBtnClick(){ | |
| 66 | + if ((self.clickCancelBtnCallBack?()) != nil){ | |
| 67 | + self.clickCancelBtnCallBack!() | |
| 68 | + } | |
| 69 | + } | |
| 70 | + @objc func confirmBtnClick(){ | |
| 71 | + if ((self.clickConfirmBtnCallBack?()) != nil){ | |
| 72 | + self.clickConfirmBtnCallBack!() | |
| 73 | + } | |
| 74 | + } | |
| 75 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLivePickerView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLivePickerView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/15. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import UIKit | |
| 10 | + | |
| 11 | +//普通格式 | |
| 12 | +enum CNLivePickerStyle { | |
| 13 | + ///单选 | |
| 14 | + case single | |
| 15 | + ///多级联动 | |
| 16 | + case multilevelLinkage | |
| 17 | +} | |
| 18 | + | |
| 19 | +//时间格式 | |
| 20 | +struct CNLivePickerDateStyle: OptionSet { | |
| 21 | + let rawValue: UInt | |
| 22 | + | |
| 23 | + static let displayYear = CNLivePickerDateStyle(rawValue: 1 << 0) // 显示年 | |
| 24 | + static let displayMonth = CNLivePickerDateStyle(rawValue: 1 << 1) // 显示月 | |
| 25 | + static let displayDay = CNLivePickerDateStyle(rawValue: 1 << 2) // 显示日 | |
| 26 | + static let displayHour = CNLivePickerDateStyle(rawValue: 1 << 3) // 显示时 | |
| 27 | + static let displayMinute = CNLivePickerDateStyle(rawValue: 1 << 4) // 显示分 | |
| 28 | + static let displaySecond = CNLivePickerDateStyle(rawValue: 1 << 5) // 显示秒 | |
| 29 | +} | |
| 30 | +//enum CNLivePickerDateStyle{//:OptionSet { | |
| 31 | +// ///显示年 | |
| 32 | +// case displayYear | |
| 33 | +// ///显示月 | |
| 34 | +// case displayMonth | |
| 35 | +// ///显示日 | |
| 36 | +// case displayDay | |
| 37 | +// ///显示时 | |
| 38 | +// case displayHour | |
| 39 | +// ///显示分 | |
| 40 | +// case displayMinute | |
| 41 | +// ///显示秒 | |
| 42 | +// case displaySecond | |
| 43 | +//} | |
| 44 | + | |
| 45 | +typealias confirmSelectActionCallback = (_ selectIndex:Int) -> Void | |
| 46 | +typealias changeSelectIndexsActionCallback = (_ pickerView:CNLivePickerView,_ selectIndexArr:Array<NSNumber>) -> Void | |
| 47 | +typealias confirmSelectIndexsActionCallback = (_ selectIndexArr:Array<NSNumber>) -> Void | |
| 48 | +typealias confirmSelectDateActionCallback = (_ date:NSDate) -> Void | |
| 49 | + | |
| 50 | +enum CNLivePickerDisplayStyle { | |
| 51 | + ///普通样式 | |
| 52 | + case normal | |
| 53 | + ///时间样式 | |
| 54 | + case date | |
| 55 | +} | |
| 56 | + | |
| 57 | +class CNLivePickerView:UIView,UIPickerViewDelegate, UIPickerViewDataSource{ | |
| 58 | + | |
| 59 | + // MARK: - 普通格式 | |
| 60 | + /** | |
| 61 | + 创建方法(普通格式) | |
| 62 | + | |
| 63 | + @param dataArr 数据 | |
| 64 | + 当传一维数组时 例子@[@"",@"",@""] BKPickerStyle == BKPickerStyleSingle | |
| 65 | + 当传二维数组时 例子@[@[@"",@"",@""], @[@"",@"",@""], @[@"",@"",@""]] BKPickerStyle == BKPickerStyleMultilevelLinkage | |
| 66 | + @param remind 选取器提示 | |
| 67 | + @return 选取器 | |
| 68 | + */ | |
| 69 | + init(dataArr:Array<Any>,remind:String) { | |
| 70 | + super.init(frame: UIScreen.main.bounds) | |
| 71 | + self.backgroundColor = .clear | |
| 72 | + self.pickerDisplayStyle = .normal | |
| 73 | + self.dataArr = dataArr | |
| 74 | + self.remind = remind | |
| 75 | + for obj in self.dataArr!{ | |
| 76 | + if obj is Array<Any>{ | |
| 77 | + //是数组 | |
| 78 | + _ = obj as! Array<Any> | |
| 79 | + self.pickerStyle = .multilevelLinkage | |
| 80 | + let selectIndexs = NSMutableArray() | |
| 81 | + let reusings = NSMutableArray() | |
| 82 | + for (_,_) in self.dataArr!.enumerated(){ | |
| 83 | + selectIndexs.add(0) | |
| 84 | + let model = CNLivePickerReusingModel() | |
| 85 | + reusings.add(model) | |
| 86 | + } | |
| 87 | + self.selectIndexArr = (selectIndexs as! Array<NSNumber>) | |
| 88 | + self.pickerReusingArr = reusings as? [CNLivePickerReusingModel] | |
| 89 | + }else if obj is String{ | |
| 90 | + //是字符串 | |
| 91 | + _ = obj as! String | |
| 92 | + self.pickerStyle = .single | |
| 93 | + self.selectIndex = 0 | |
| 94 | + let model = CNLivePickerReusingModel() | |
| 95 | + self.pickerReusingArr = [model] | |
| 96 | + }else{ | |
| 97 | + | |
| 98 | + } | |
| 99 | + self.addSubview(self.shadowView) | |
| 100 | + self.addSubview(self.alertView) | |
| 101 | + } | |
| 102 | + } | |
| 103 | + | |
| 104 | + /** | |
| 105 | + 显示数据 | |
| 106 | + */ | |
| 107 | + var _dataArr:Array<Any>? | |
| 108 | + var dataArr:Array<Any>?{ | |
| 109 | + get{ | |
| 110 | + _dataArr | |
| 111 | + } | |
| 112 | + set{ | |
| 113 | + _dataArr = newValue | |
| 114 | + } | |
| 115 | + } | |
| 116 | + | |
| 117 | + // MARK: - 普通格式 - BKPickerStyleSingle | |
| 118 | + | |
| 119 | + /** | |
| 120 | + 当前选取索引 | |
| 121 | + 当BKPickerStyle == BKPickerStyleSingle时有效 | |
| 122 | + */ | |
| 123 | + var _selectIndex:Int = 0 | |
| 124 | + var selectIndex:Int{ | |
| 125 | + get{ | |
| 126 | + _selectIndex | |
| 127 | + } | |
| 128 | + set{ | |
| 129 | + _selectIndex = newValue | |
| 130 | + self.pickerView?.selectRow(self.selectIndex, inComponent: 0, animated: false) | |
| 131 | + } | |
| 132 | + } | |
| 133 | + /** | |
| 134 | + 完成选择返回索引回调 | |
| 135 | + 当BKPickerStyle == BKPickerStyleSingle时有效 | |
| 136 | + */ | |
| 137 | + var confirmSelectCallback:confirmSelectActionCallback? | |
| 138 | + | |
| 139 | + // MARK: - 普通格式 - BKPickerStyleMultilevelLinkage | |
| 140 | + | |
| 141 | + /** | |
| 142 | + 当前选取索引数组 传一维数组 例子@[@(),@(),@()] | |
| 143 | + 当BKPickerStyle == BKPickerStyleMultilevelLinkage时有效 | |
| 144 | + */ | |
| 145 | + var _selectIndexArr:Array<NSNumber>? | |
| 146 | + var selectIndexArr:Array<NSNumber>?{ | |
| 147 | + get{ | |
| 148 | + _selectIndexArr | |
| 149 | + } | |
| 150 | + set{ | |
| 151 | + _selectIndexArr = newValue | |
| 152 | + if _selectIndexArr?.count ?? 0 > 0{ | |
| 153 | + for i in 0..<self.selectIndexArr!.count{ | |
| 154 | + self.pickerView?.selectRow((self.selectIndexArr![i] as NSNumber).intValue, inComponent: i, animated: false) | |
| 155 | + } | |
| 156 | + } | |
| 157 | + } | |
| 158 | + } | |
| 159 | + /** | |
| 160 | + 切换选择返回索引数组回调 用于修改数据源 返回一维数组 例子@[@(),@(),@()] | |
| 161 | + 提示 修改了当前滑动component的index 大于当前component后的index置为0 | |
| 162 | + 当BKPickerStyle == BKPickerStyleMultilevelLinkage时有效 | |
| 163 | + */ | |
| 164 | + var changeSelectIndexsCallback:changeSelectIndexsActionCallback? | |
| 165 | + /** | |
| 166 | + 完成选择返回索引数组回调 返回一维数组 例子@[@(),@(),@()] | |
| 167 | + 当BKPickerStyle == BKPickerStyleMultilevelLinkage时有效 | |
| 168 | + */ | |
| 169 | + var confirmSelectIndexsCallback:confirmSelectIndexsActionCallback? | |
| 170 | + // MARK: - 时间格式 | |
| 171 | + /** | |
| 172 | + 创建方法(时间格式) | |
| 173 | + | |
| 174 | + @param pickerDateStyle 选取器格式 | |
| 175 | + @param selectDate 当前选取日期 | |
| 176 | + @param maxDate 最大日期 | |
| 177 | + @param minDate 最小日期 | |
| 178 | + @param remind 选取器提示 | |
| 179 | + @return 选取器 | |
| 180 | + */ | |
| 181 | + init(pickerDateStyle:CNLivePickerDateStyle,selectDate:NSDate,maxDate:NSDate,minDate:NSDate,remind:String) { | |
| 182 | + super.init(frame: UIScreen.main.bounds) | |
| 183 | + self.backgroundColor = .clear | |
| 184 | + self.pickerDisplayStyle = .date | |
| 185 | + self.pickerDateStyle = pickerDateStyle | |
| 186 | + self.maxDate = maxDate | |
| 187 | + self.minDate = minDate | |
| 188 | + self.selectDate = selectDate | |
| 189 | + if (self.maxDate != nil) && (self.minDate != nil){ | |
| 190 | + assert(self.minDate!.timeIntervalSince1970 < self.maxDate!.timeIntervalSince1970, "最大时间小于最小时间") | |
| 191 | + } | |
| 192 | + if self.selectDate == nil{ | |
| 193 | + if self.maxDate != nil{ | |
| 194 | + self.selectDate = self.maxDate | |
| 195 | + }else if (self.minDate != nil){ | |
| 196 | + self.selectDate = self.minDate | |
| 197 | + } | |
| 198 | + } | |
| 199 | + self.remind = remind | |
| 200 | + var types = Array<String>() | |
| 201 | + var reusings = [CNLivePickerReusingModel]() | |
| 202 | + if pickerDateStyle.contains(.displayYear){ | |
| 203 | + types.append("年") | |
| 204 | + let model = CNLivePickerReusingModel() | |
| 205 | + reusings.append(model) | |
| 206 | + } | |
| 207 | + if pickerDateStyle.contains(.displayMonth){ | |
| 208 | + types.append("月") | |
| 209 | + let model = CNLivePickerReusingModel() | |
| 210 | + reusings.append(model) | |
| 211 | + } | |
| 212 | + if pickerDateStyle.contains(.displayDay){ | |
| 213 | + types.append("日") | |
| 214 | + let model = CNLivePickerReusingModel() | |
| 215 | + reusings.append(model) | |
| 216 | + let year = self.bk_transformYear(date: selectDate) | |
| 217 | + let month = self.bk_transformMonth(date: selectDate) | |
| 218 | + self.daysOfMonth = self.getDaysWithYear(year: year, month: month) | |
| 219 | + } | |
| 220 | + if pickerDateStyle.contains(.displayHour){ | |
| 221 | + types.append("时") | |
| 222 | + let model = CNLivePickerReusingModel() | |
| 223 | + reusings.append(model) | |
| 224 | + } | |
| 225 | + if pickerDateStyle.contains(.displayMinute){ | |
| 226 | + types.append("分") | |
| 227 | + let model = CNLivePickerReusingModel() | |
| 228 | + reusings.append(model) | |
| 229 | + } | |
| 230 | + if pickerDateStyle.contains(.displaySecond){ | |
| 231 | + types.append("秒") | |
| 232 | + let model = CNLivePickerReusingModel() | |
| 233 | + reusings.append(model) | |
| 234 | + } | |
| 235 | + self.dateTypes = Array(types) | |
| 236 | + self.pickerReusingArr = Array(reusings) | |
| 237 | + self.addSubview(self.shadowView) | |
| 238 | + isiPhoneX = isiPhoneXSeries | |
| 239 | + self.addSubview(self.alertView) | |
| 240 | + self.scrollDatePickerViewWithDate(date: self.selectDate!, animated: false) | |
| 241 | + } | |
| 242 | + /** | |
| 243 | + 转化成年份 | |
| 244 | + | |
| 245 | + @return 年份 | |
| 246 | + */ | |
| 247 | + func bk_transformYear(date:NSDate) ->Int{ | |
| 248 | + return self.picker_calendar.component(.year, from:date as Date) | |
| 249 | + } | |
| 250 | + /** | |
| 251 | + 转化成月份 | |
| 252 | + | |
| 253 | + @return 月份 | |
| 254 | + */ | |
| 255 | + func bk_transformMonth(date:NSDate) ->Int{ | |
| 256 | + return self.picker_calendar.component(.month, from:date as Date) | |
| 257 | + } | |
| 258 | + /** | |
| 259 | + 转化成天 | |
| 260 | + | |
| 261 | + @return 天 | |
| 262 | + */ | |
| 263 | + func bk_transformDay(date:NSDate) ->Int{ | |
| 264 | + return self.picker_calendar.component(.day, from:date as Date) | |
| 265 | + } | |
| 266 | + /** | |
| 267 | + 转化成时 | |
| 268 | + | |
| 269 | + @return 时 | |
| 270 | + */ | |
| 271 | + func bk_transformHour(date:NSDate) ->Int{ | |
| 272 | + return self.picker_calendar.component(.hour, from:date as Date) | |
| 273 | + } | |
| 274 | + /** | |
| 275 | + 转化成分 | |
| 276 | + | |
| 277 | + @returnf 分 | |
| 278 | + */ | |
| 279 | + func bk_transformMinute(date:NSDate) ->Int{ | |
| 280 | + return self.picker_calendar.component(.minute, from:date as Date) | |
| 281 | + } | |
| 282 | + /** | |
| 283 | + 转化成秒 | |
| 284 | + | |
| 285 | + @return 秒 | |
| 286 | + */ | |
| 287 | + func bk_transformSecond(date:NSDate) ->Int{ | |
| 288 | + return self.picker_calendar.component(.second, from:date as Date) | |
| 289 | + } | |
| 290 | + lazy var picker_calendar :NSCalendar = { | |
| 291 | + let picker_calendar = NSCalendar(identifier: .gregorian) | |
| 292 | + return picker_calendar! | |
| 293 | + }() | |
| 294 | + | |
| 295 | + required init?(coder: NSCoder) { | |
| 296 | + fatalError("init(coder:) has not been implemented") | |
| 297 | + } | |
| 298 | + /** | |
| 299 | + 确认选取时间返回 | |
| 300 | + */ | |
| 301 | + var confirmSelectDateCallback:confirmSelectDateActionCallback? | |
| 302 | + // MARK: - 隐藏/显示 | |
| 303 | + /** | |
| 304 | + 显示方法 | |
| 305 | + */ | |
| 306 | + func show(){ | |
| 307 | + let window = UIApplication.shared.keyWindow | |
| 308 | + if window?.isUserInteractionEnabled == false{ | |
| 309 | + return | |
| 310 | + } | |
| 311 | + window?.isUserInteractionEnabled = false | |
| 312 | + window?.addSubview(self) | |
| 313 | + | |
| 314 | + UIView.animate(withDuration: 0.3) { | |
| 315 | + self.shadowView.alpha = 1 | |
| 316 | + self.alertView.top = self.height - self.CNLivePicker_alertHeight() | |
| 317 | + } completion: { finished in | |
| 318 | + window?.isUserInteractionEnabled = true | |
| 319 | + } | |
| 320 | + } | |
| 321 | + /** | |
| 322 | + 获取系统状态栏高度 | |
| 323 | + */ | |
| 324 | + func CNLivePicker_bottom_offset() -> CGFloat { | |
| 325 | + return isiPhoneX ? 83 - 49 : 0 | |
| 326 | + } | |
| 327 | + var isiPhoneX = false | |
| 328 | + /** | |
| 329 | + 获取picker高度 | |
| 330 | + */ | |
| 331 | + func CNLivePicker_alertHeight() -> CGFloat{ | |
| 332 | + let pickerHeight = 280 + self.CNLivePicker_bottom_offset() | |
| 333 | + return pickerHeight | |
| 334 | + } | |
| 335 | + | |
| 336 | + //显示样式 | |
| 337 | + var pickerDisplayStyle:CNLivePickerDisplayStyle? | |
| 338 | + //普通样式 | |
| 339 | + var pickerStyle:CNLivePickerStyle? | |
| 340 | + //时间样式 | |
| 341 | + var pickerDateStyle:CNLivePickerDateStyle? | |
| 342 | + //当前选取日期 | |
| 343 | + var _selectDate:NSDate? | |
| 344 | + var selectDate:NSDate?{ | |
| 345 | + get{ | |
| 346 | + _selectDate | |
| 347 | + } | |
| 348 | + set{ | |
| 349 | + _selectDate = newValue | |
| 350 | + if self.selectDateTools == nil{ | |
| 351 | + self.selectDateTools = CNLivePickerSelectDateTools() | |
| 352 | + } | |
| 353 | + self.selectDateTools?.changeSelectDate(date: _selectDate!) | |
| 354 | + } | |
| 355 | + } | |
| 356 | + //最大选取日期 | |
| 357 | + var maxDate:NSDate? | |
| 358 | + //最小选取日期 | |
| 359 | + var minDate:NSDate? | |
| 360 | + //选取日期工具 | |
| 361 | + var selectDateTools:CNLivePickerSelectDateTools? | |
| 362 | + //时间格式数组 如@[@"年",@"月",@"日",@"时",@"分",@"秒"] | |
| 363 | + var dateTypes:Array<String>? | |
| 364 | + //时间样式中当月天数 | |
| 365 | + var daysOfMonth:Int = 0 | |
| 366 | + //提示 | |
| 367 | + var remind:String? | |
| 368 | + //阴影 | |
| 369 | + lazy var shadowView :UIView = { | |
| 370 | + let shadowView = UIView(frame:self.bounds) | |
| 371 | + shadowView.backgroundColor = UIColor(white: 0, alpha: 0.3) | |
| 372 | + shadowView.alpha = 0 | |
| 373 | + let shadowTap = UITapGestureRecognizer(target: self, action: #selector(shadowTap)) | |
| 374 | + shadowView.addGestureRecognizer(shadowTap) | |
| 375 | + return shadowView | |
| 376 | + }() | |
| 377 | + //弹框 | |
| 378 | + lazy var alertView :UIView = { | |
| 379 | + let alertView = UIView(frame: CGRect(x: 0, y: self.height, width: self.width, height: self.CNLivePicker_alertHeight())) | |
| 380 | + alertView.backgroundColor = HexColor("#D1D5DB") | |
| 381 | + alertView.addSubview(self.toolsView) | |
| 382 | + //UIPickerView不能设置全局 否则刷新时有刷新数据显示不变bug | |
| 383 | + let pickerView = UIPickerView(frame: CGRect(x: 0, y: self.toolsView.bottom, width: self.width, height: alertView.height-self.toolsView.bottom-self.CNLivePicker_bottom_offset())) | |
| 384 | + pickerView.delegate = self | |
| 385 | + pickerView.dataSource = self | |
| 386 | + pickerView.backgroundColor = .clear | |
| 387 | + alertView.addSubview(pickerView) | |
| 388 | + self.pickerView = pickerView | |
| 389 | + //UIPickerView系统线的高度是0.5 | |
| 390 | + let sysLineH:CGFloat = 0.5 | |
| 391 | + let topLine = UIImageView(frame: CGRect(x: 0, y: self.toolsView.bottom+(self.pickerView!.height-40)/2 - sysLineH - 1, width: alertView.width, height: 1)) | |
| 392 | + topLine.backgroundColor = HexColor("#A8ABB0") | |
| 393 | + alertView.addSubview(topLine) | |
| 394 | + | |
| 395 | + let bottomLine = UIImageView(frame: CGRect(x: 0, y: self.toolsView.bottom+(self.pickerView!.height+40)/2 + sysLineH - 1, width: alertView.width, height: 1)) | |
| 396 | + bottomLine.backgroundColor = HexColor("#A8ABB0") | |
| 397 | + alertView.addSubview(bottomLine) | |
| 398 | + | |
| 399 | + return alertView | |
| 400 | + }() | |
| 401 | + //工具栏 | |
| 402 | + lazy var toolsView :CNLivePickerToolsView = { | |
| 403 | + let toolsView = CNLivePickerToolsView(frame: CGRect(x: 0, y: 0, width: self.width, height: 50)) | |
| 404 | + toolsView.remind = self.remind | |
| 405 | + toolsView.clickCancelBtnCallBack = { [weak self] in | |
| 406 | + self!.cancel() | |
| 407 | + } | |
| 408 | + toolsView.clickConfirmBtnCallBack = { [weak self] in | |
| 409 | + self!.confirm() | |
| 410 | + } | |
| 411 | + return toolsView | |
| 412 | + }() | |
| 413 | + //选取器 | |
| 414 | + var pickerView:UIPickerView? | |
| 415 | + //pickerView复用数据 | |
| 416 | + var pickerReusingArr:[CNLivePickerReusingModel]? | |
| 417 | + | |
| 418 | + deinit { | |
| 419 | + print("CNLivePickerView释放") | |
| 420 | + } | |
| 421 | + func hiddenComplete(complete:@escaping successComplete){ | |
| 422 | + if self.isUserInteractionEnabled == false{ | |
| 423 | + return | |
| 424 | + } | |
| 425 | + self.isUserInteractionEnabled = false | |
| 426 | + UIView.animate(withDuration: 0.3) { | |
| 427 | + self.shadowView.alpha = 0 | |
| 428 | + self.alertView.top = self.height | |
| 429 | + } completion: { finished in | |
| 430 | + self.isUserInteractionEnabled = true | |
| 431 | + complete() | |
| 432 | + } | |
| 433 | + } | |
| 434 | + | |
| 435 | + @objc func shadowTap(){ | |
| 436 | + self.cancel() | |
| 437 | + } | |
| 438 | + | |
| 439 | + func cancel(){ | |
| 440 | + self.hiddenComplete { | |
| 441 | + self.removeFromSuperview() | |
| 442 | + } | |
| 443 | + } | |
| 444 | + func confirm(){ | |
| 445 | + if self.pickerDisplayStyle == .normal{ | |
| 446 | + if self.pickerStyle == .single{ | |
| 447 | + | |
| 448 | + self.confirmSelectCallback!(self.selectIndex) | |
| 449 | + }else if self.pickerStyle == .multilevelLinkage{ | |
| 450 | + self.confirmSelectIndexsCallback!(self.selectIndexArr!) | |
| 451 | + } | |
| 452 | + }else if self.pickerDisplayStyle == .date{ | |
| 453 | + self.confirmSelectDateCallback!(self.selectDate!) | |
| 454 | + } | |
| 455 | + self.cancel() | |
| 456 | + } | |
| 457 | + // MARK: - UIPickerViewDelegate, UIPickerViewDataSource | |
| 458 | + func numberOfComponents(in pickerView: UIPickerView) -> Int { | |
| 459 | + if self.pickerDisplayStyle == .normal{ | |
| 460 | + if self.pickerStyle == .single{ | |
| 461 | + return 1 | |
| 462 | + }else{ | |
| 463 | + return self.dataArr!.count | |
| 464 | + } | |
| 465 | + }else{ | |
| 466 | + return self.dateTypes!.count | |
| 467 | + } | |
| 468 | + } | |
| 469 | + func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int { | |
| 470 | + if self.pickerDisplayStyle == .normal{ | |
| 471 | + if self.pickerStyle == .single{ | |
| 472 | + return self.dataArr!.count | |
| 473 | + }else{ | |
| 474 | + return (self.dataArr![component] as! Array<Any>).count | |
| 475 | + } | |
| 476 | + }else{ | |
| 477 | + return 100000 | |
| 478 | + } | |
| 479 | + } | |
| 480 | + | |
| 481 | + func pickerView(_ pickerView: UIPickerView, widthForComponent component: Int) -> CGFloat { | |
| 482 | + if self.pickerDisplayStyle == .date{ | |
| 483 | + if self.pickerDateStyle!.contains(.displayYear) { | |
| 484 | + let type = self.dateTypes?[component] | |
| 485 | + //UIPickerView每列有间距 不知道多少 为了使年宽一点 多平分一份 | |
| 486 | + let width:CGFloat = self.width / CGFloat(self.dateTypes!.count+1) | |
| 487 | + if type ?? "" == "年"{ | |
| 488 | + return width * 1.5//使年宽一点 | |
| 489 | + }else{ | |
| 490 | + return width | |
| 491 | + } | |
| 492 | + }else{ | |
| 493 | + //UIPickerView每列有间距 不知道多少 所有宽*0.95 | |
| 494 | + let width:CGFloat = self.width / CGFloat(self.dateTypes!.count) * 0.95 | |
| 495 | + return width | |
| 496 | + } | |
| 497 | + }else { | |
| 498 | + if (self.pickerStyle == .single) { | |
| 499 | + //UIPickerView每列有间距 不知道多少 所有宽*0.95 | |
| 500 | + return self.width * 0.95 | |
| 501 | + }else { | |
| 502 | + //UIPickerView每列有间距 不知道多少 所有宽*0.95 | |
| 503 | + let width:CGFloat = self.width / CGFloat(self.dataArr!.count) * 0.95 | |
| 504 | + return width | |
| 505 | + } | |
| 506 | + } | |
| 507 | + } | |
| 508 | + | |
| 509 | + func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat { | |
| 510 | + return 40 | |
| 511 | + } | |
| 512 | + func pickerView(_ pickerView: UIPickerView, viewForRow row: Int, forComponent component: Int, reusing view: UIView?) -> UIView { | |
| 513 | + //隐藏系统分割线 | |
| 514 | + for subview in pickerView.subviews{ | |
| 515 | + if subview.height <= 1{ | |
| 516 | + subview.backgroundColor = .clear | |
| 517 | + } | |
| 518 | + } | |
| 519 | + let model = self.pickerReusingArr![component] | |
| 520 | + for (_,object) in model.visible.enumerated(){ | |
| 521 | + let obj = object as! CNLivePickerReusingViewModel | |
| 522 | + if obj.titleLab?.superview == nil{ | |
| 523 | + //没父视图,代表不显示 | |
| 524 | + //不显示行数归为-1 | |
| 525 | + obj.row = -1 | |
| 526 | + model.visible.remove(obj) | |
| 527 | + model.cache.add(obj) | |
| 528 | + } | |
| 529 | + } | |
| 530 | + var reusingViewModel:CNLivePickerReusingViewModel? = nil | |
| 531 | + if model.cache.count > 0{ | |
| 532 | + //不显示,缓存数大于0,从缓存取 | |
| 533 | + reusingViewModel = (model.cache.lastObject) as? CNLivePickerReusingViewModel | |
| 534 | + reusingViewModel?.row = row | |
| 535 | + model.visible.add(reusingViewModel!) | |
| 536 | + model.cache.removeLastObject() | |
| 537 | + }else{ | |
| 538 | + //不显示,缓存数等于0,创建 | |
| 539 | + let titleLab = UILabel() | |
| 540 | + titleLab.font = Font_16 | |
| 541 | + titleLab.textColor = .black | |
| 542 | + titleLab.textAlignment = .center | |
| 543 | + reusingViewModel = CNLivePickerReusingViewModel() | |
| 544 | + reusingViewModel?.titleLab = titleLab | |
| 545 | + reusingViewModel?.row = row | |
| 546 | + model.visible.add(reusingViewModel!) | |
| 547 | + } | |
| 548 | + self.assignDataWithTitleLab(titleLab: reusingViewModel!.titleLab!, component: component, row: row) | |
| 549 | + | |
| 550 | + return reusingViewModel!.titleLab! | |
| 551 | + } | |
| 552 | + | |
| 553 | + func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) { | |
| 554 | + if self.pickerDisplayStyle == .normal{ | |
| 555 | + if self.pickerStyle == .single{ | |
| 556 | + self.selectIndex = row | |
| 557 | + }else if self.pickerStyle == .multilevelLinkage{ | |
| 558 | + let selectIndexArr = NSMutableArray(array: self.selectIndexArr!) | |
| 559 | + for (idx,_) in selectIndexArr.enumerated(){ | |
| 560 | + if (component == idx) { | |
| 561 | + selectIndexArr.replaceObject(at: idx, with: row) | |
| 562 | + }else if (component < idx){ | |
| 563 | + selectIndexArr.replaceObject(at: idx, with: 0) | |
| 564 | + } | |
| 565 | + } | |
| 566 | + | |
| 567 | + self.changeSelectIndexsCallback!(self, selectIndexArr as! Array<NSNumber>) | |
| 568 | + self.selectIndexArr = Array(_immutableCocoaArray: selectIndexArr) | |
| 569 | + for (idx,obj) in self.selectIndexArr!.enumerated(){ | |
| 570 | + self.pickerView?.selectRow(obj.intValue, inComponent: idx, animated: false) | |
| 571 | + } | |
| 572 | + //刷新pickerView | |
| 573 | + self.pickerView?.reloadAllComponents() | |
| 574 | + } | |
| 575 | + }else if self.pickerDisplayStyle == .date{ | |
| 576 | + //获取选中日期 | |
| 577 | + self.selectDate = self.getSelectDateAndCheckToSeeIfDateExists() | |
| 578 | + //比较是否超过最大时间 | |
| 579 | + let isMoreThan = self.isMoreThanMaxDate(date: self.selectDate!) | |
| 580 | + if isMoreThan{ | |
| 581 | + //超过 替换 | |
| 582 | + self.selectDate = self.maxDate | |
| 583 | + //修改当月的最大日数 | |
| 584 | + let year = self.bk_transformYear(date: self.selectDate!) | |
| 585 | + let month = self.bk_transformMonth(date: self.selectDate!) | |
| 586 | + self.daysOfMonth = self.getDaysWithYear(year: year, month: month) | |
| 587 | + //修改选中 | |
| 588 | + self.scrollDatePickerViewWithDate(date: self.selectDate!, animated: true) | |
| 589 | + } | |
| 590 | + //比较是否小于最小时间 | |
| 591 | + let isLessThan = self.isLessThanMinDate(date: self.selectDate!) | |
| 592 | + if isLessThan{ | |
| 593 | + //小于 替换 | |
| 594 | + self.selectDate = self.minDate | |
| 595 | + //修改当月的最大日数 | |
| 596 | + let year = self.bk_transformYear(date: self.selectDate!) | |
| 597 | + let month = self.bk_transformMonth(date: self.selectDate!) | |
| 598 | + self.daysOfMonth = self.getDaysWithYear(year: year, month: month) | |
| 599 | + //修改选中 | |
| 600 | + self.scrollDatePickerViewWithDate(date: self.selectDate!, animated: true) | |
| 601 | + } | |
| 602 | + //刷新pickerView | |
| 603 | + self.reloadPickerView() | |
| 604 | + } | |
| 605 | + } | |
| 606 | + | |
| 607 | + // MARK: - 获取选中日期 并且 查看选中日期是不是不存在 如(2019-02-30 00:00:00) | |
| 608 | + /** | |
| 609 | + 获取选中日期 并且 查看选中日期是不是不存在 如(2019-02-30 00:00:00) | |
| 610 | + | |
| 611 | + @return 日期 | |
| 612 | + */ | |
| 613 | + func getSelectDateAndCheckToSeeIfDateExists()->NSDate{ | |
| 614 | + let year = self.getCurrentCorrespondingValueWithDateStyle(dateStyle: .displayYear) | |
| 615 | + let month = self.getCurrentCorrespondingValueWithDateStyle(dateStyle: .displayMonth) | |
| 616 | + var day = self.getCurrentCorrespondingValueWithDateStyle(dateStyle: .displayDay) | |
| 617 | + //修改当月的最大日数 | |
| 618 | + self.daysOfMonth = self.getDaysWithYear(year: year, month: month) | |
| 619 | + //回退行数 | |
| 620 | + var backRow = 0 | |
| 621 | + if (day > self.daysOfMonth) { | |
| 622 | + //获取日所在component | |
| 623 | + var dayComponent = -1 | |
| 624 | + if self.dateTypes!.contains("日"){ | |
| 625 | + dayComponent = (self.dateTypes!.firstIndex(of: "日"))! | |
| 626 | + } | |
| 627 | + let row = (self.pickerView?.selectedRow(inComponent: dayComponent))! | |
| 628 | + backRow = day - self.daysOfMonth | |
| 629 | + //修改选中行数 | |
| 630 | + self.pickerView?.selectRow(row-backRow, inComponent: dayComponent, animated: true) | |
| 631 | + //转成当月最大日 | |
| 632 | + day = self.daysOfMonth | |
| 633 | + } | |
| 634 | + let dateStr = NSMutableString() | |
| 635 | + dateStr.appendFormat("%d-", year) | |
| 636 | + dateStr.appendFormat("%d-", month) | |
| 637 | + dateStr.appendFormat("%d ", day) | |
| 638 | + dateStr.appendFormat("%d:", self.getCurrentCorrespondingValueWithDateStyle(dateStyle: .displayHour)) | |
| 639 | + dateStr.appendFormat("%d:", self.getCurrentCorrespondingValueWithDateStyle(dateStyle: .displayMinute)) | |
| 640 | + dateStr.appendFormat("%d", self.getCurrentCorrespondingValueWithDateStyle(dateStyle: .displaySecond)) | |
| 641 | + let dateFormatter = DateFormatter() | |
| 642 | + dateFormatter.dateFormat = "YYYY-MM-dd HH:mm:ss" | |
| 643 | + return dateFormatter.date(from: String(dateStr))! as NSDate | |
| 644 | + } | |
| 645 | + | |
| 646 | + // MARK: - 根据时间格式获取当前对应的值 | |
| 647 | + /** | |
| 648 | + 根据时间格式获取当前对应的值 | |
| 649 | + | |
| 650 | + @param dateStyle 时间格式(年月日时分秒) | |
| 651 | + @return 值 | |
| 652 | + */ | |
| 653 | + func getCurrentCorrespondingValueWithDateStyle(dateStyle:CNLivePickerDateStyle) -> Int{ | |
| 654 | + var typeStr = "" | |
| 655 | + switch dateStyle { | |
| 656 | + case .displayYear: | |
| 657 | + typeStr = "年" | |
| 658 | + break | |
| 659 | + case .displayMonth: | |
| 660 | + typeStr = "月" | |
| 661 | + break | |
| 662 | + case .displayDay: | |
| 663 | + typeStr = "日" | |
| 664 | + break | |
| 665 | + case .displayHour: | |
| 666 | + typeStr = "时" | |
| 667 | + break | |
| 668 | + case .displayMinute: | |
| 669 | + typeStr = "分" | |
| 670 | + break | |
| 671 | + case .displaySecond: | |
| 672 | + typeStr = "秒" | |
| 673 | + break | |
| 674 | + default: | |
| 675 | + break | |
| 676 | + } | |
| 677 | + var component = -1 | |
| 678 | + if self.dateTypes!.contains(typeStr){ | |
| 679 | + component = self.dateTypes!.firstIndex(of: typeStr)! | |
| 680 | + } | |
| 681 | + //找到了 | |
| 682 | + if component > -1{ | |
| 683 | + return self.exportSelectDateInComponent(component: component) | |
| 684 | + } | |
| 685 | + //没找到 | |
| 686 | + switch dateStyle { | |
| 687 | + case .displayYear: | |
| 688 | + return self.selectDateTools!.selectYear | |
| 689 | + case .displayMonth: | |
| 690 | + return self.selectDateTools!.selectMonth | |
| 691 | + case .displayDay: | |
| 692 | + return self.selectDateTools!.selectDay | |
| 693 | + case .displayHour: | |
| 694 | + return self.selectDateTools!.selectHour | |
| 695 | + case .displayMinute: | |
| 696 | + return self.selectDateTools!.selectMinute | |
| 697 | + case .displaySecond: | |
| 698 | + return self.selectDateTools!.selectSecond | |
| 699 | + default: | |
| 700 | + return 0 | |
| 701 | + } | |
| 702 | + } | |
| 703 | + /** | |
| 704 | + 导出该列选中的时间 | |
| 705 | + | |
| 706 | + @param component 列 | |
| 707 | + @return 时间 | |
| 708 | + */ | |
| 709 | + func exportSelectDateInComponent(component:Int) -> Int{ | |
| 710 | + let row = self.pickerView?.selectedRow(inComponent: component) | |
| 711 | + let titleLab = self.pickerView?.view(forRow: row!, forComponent: component) as! UILabel | |
| 712 | + let dateStr:NSMutableString = NSMutableString(string: titleLab.text!) | |
| 713 | + dateStr.deleteCharacters(in: NSRange(location: titleLab.text!.count-1, length: 1)) | |
| 714 | + let date = dateStr.integerValue | |
| 715 | + return date | |
| 716 | + } | |
| 717 | + // MARK: - 比较最大/最小时间 | |
| 718 | + func isMoreThanMaxDate(date:NSDate) -> Bool{ | |
| 719 | + if self.maxDate == nil{ | |
| 720 | + return false | |
| 721 | + } | |
| 722 | + //最小到秒 不计毫秒 | |
| 723 | + let maxDateSp = self.maxDate!.timeIntervalSince1970 | |
| 724 | + let dateSp = date.timeIntervalSince1970 | |
| 725 | + if dateSp > maxDateSp{ | |
| 726 | + return true | |
| 727 | + } | |
| 728 | + return false | |
| 729 | + } | |
| 730 | + | |
| 731 | + func isLessThanMinDate(date:NSDate) -> Bool{ | |
| 732 | + if self.minDate == nil{ | |
| 733 | + return false | |
| 734 | + } | |
| 735 | + //最小到秒 不计毫秒 | |
| 736 | + let minDateSp = self.minDate!.timeIntervalSince1970 | |
| 737 | + let dateSp = date.timeIntervalSince1970 | |
| 738 | + if dateSp < minDateSp{ | |
| 739 | + return true | |
| 740 | + } | |
| 741 | + return false | |
| 742 | + } | |
| 743 | + // MARK: - 时间滚轮转至指定位置 | |
| 744 | + /** | |
| 745 | + 时间滚轮转至指定位置 | |
| 746 | + | |
| 747 | + @param date 时间 | |
| 748 | + */ | |
| 749 | + func scrollDatePickerViewWithDate(date:NSDate,animated:Bool){ | |
| 750 | + let midRow = 10000 / 2 | |
| 751 | + for (idx,obj) in self.dateTypes!.enumerated(){ | |
| 752 | + let type = obj | |
| 753 | + var row = 0 | |
| 754 | + if type == "年"{ | |
| 755 | + let year = self.bk_transformYear(date: date) | |
| 756 | + row = year - 1 | |
| 757 | + }else if type == "月"{ | |
| 758 | + let month = self.bk_transformMonth(date: date) | |
| 759 | + row = midRow - midRow % 12 + month - 1 | |
| 760 | + }else if type == "日"{ | |
| 761 | + let day = self.bk_transformDay(date: date) | |
| 762 | + row = midRow - midRow % 31 + day - 1 | |
| 763 | + }else if type == "时"{ | |
| 764 | + let hour = self.bk_transformHour(date: date) | |
| 765 | + row = midRow - midRow % 24 + hour | |
| 766 | + }else if type == "分"{ | |
| 767 | + let minute = self.bk_transformMinute(date: date) | |
| 768 | + row = midRow - midRow % 60 + minute | |
| 769 | + }else if type == "秒"{ | |
| 770 | + let second = self.bk_transformSecond(date: date) | |
| 771 | + row = midRow - midRow % 60 + second | |
| 772 | + } | |
| 773 | + self.pickerView?.selectRow(row, inComponent: idx, animated: animated) | |
| 774 | + } | |
| 775 | + } | |
| 776 | + /** | |
| 777 | + 刷新 | |
| 778 | + */ | |
| 779 | + func reloadPickerView(){ | |
| 780 | + for (idx,_) in self.dateTypes!.enumerated(){ | |
| 781 | + self.reloadComponent(component: idx) | |
| 782 | + } | |
| 783 | + } | |
| 784 | + | |
| 785 | + /** | |
| 786 | + 刷新列 | |
| 787 | + | |
| 788 | + @param component 列 | |
| 789 | + */ | |
| 790 | + func reloadComponent(component:Int){ | |
| 791 | + let reusingModel = self.pickerReusingArr![component] | |
| 792 | + for (_,object) in reusingModel.visible.enumerated(){ | |
| 793 | + let obj = object as! CNLivePickerReusingViewModel | |
| 794 | + self.assignDataWithTitleLab(titleLab: obj.titleLab!, component: component, row: obj.row) | |
| 795 | + } | |
| 796 | + } | |
| 797 | + | |
| 798 | + // MARK: - 给对应行赋值 | |
| 799 | + /** | |
| 800 | + 给对应行赋值 | |
| 801 | + | |
| 802 | + @param titleLab 标题 | |
| 803 | + @param component 列 | |
| 804 | + @param row 行 | |
| 805 | + */ | |
| 806 | + func assignDataWithTitleLab(titleLab:UILabel,component:Int,row:Int){ | |
| 807 | + if self.pickerDisplayStyle == .normal{ | |
| 808 | + if self.pickerStyle == .multilevelLinkage{ | |
| 809 | + if component < self.dataArr!.count{ | |
| 810 | + let dataArr = self.dataArr![component] as! Array<String> | |
| 811 | + if row < dataArr.count { | |
| 812 | + titleLab.text = dataArr[row] | |
| 813 | + }else { | |
| 814 | + titleLab.text = "" | |
| 815 | + } | |
| 816 | + }else { | |
| 817 | + titleLab.text = "" | |
| 818 | + } | |
| 819 | + }else{ | |
| 820 | + if (row < self.dataArr!.count) { | |
| 821 | + titleLab.text = (self.dataArr![row] as! String) | |
| 822 | + }else { | |
| 823 | + titleLab.text = "" | |
| 824 | + } | |
| 825 | + } | |
| 826 | + }else if (self.pickerDisplayStyle == .date) { | |
| 827 | + let type = self.dateTypes![component] | |
| 828 | + var value = 0 | |
| 829 | + var min_year = 1 | |
| 830 | + var min_month = 1 | |
| 831 | + var min_day = 1 | |
| 832 | + var min_hour = 0 | |
| 833 | + var min_minute = 0 | |
| 834 | + var min_second = 0 | |
| 835 | + var max_year = 1 | |
| 836 | + var max_month = 1 | |
| 837 | + var max_day = 1 | |
| 838 | + var max_hour = 0 | |
| 839 | + var max_minute = 0 | |
| 840 | + var max_second = 0 | |
| 841 | + if type == "年"{ | |
| 842 | + value = row + 1 | |
| 843 | + min_year = value | |
| 844 | + min_month = 12 | |
| 845 | + min_day = 31 | |
| 846 | + min_hour = 23 | |
| 847 | + min_minute = 59 | |
| 848 | + min_second = 59 | |
| 849 | + max_year = value | |
| 850 | + max_month = 1 | |
| 851 | + max_day = 1 | |
| 852 | + max_hour = 0 | |
| 853 | + max_minute = 0 | |
| 854 | + max_second = 0 | |
| 855 | + titleLab.text = String(format: "%d年", value) | |
| 856 | + }else if type == "月"{ | |
| 857 | + value = row % 12 + 1 | |
| 858 | + let year = self.selectDateTools?.selectYear | |
| 859 | + let maxDay = self.getDaysWithYear(year: year!, month: value) | |
| 860 | + min_year = year! | |
| 861 | + min_month = value | |
| 862 | + min_day = maxDay | |
| 863 | + min_hour = 23 | |
| 864 | + min_minute = 59 | |
| 865 | + min_second = 59 | |
| 866 | + max_year = year! | |
| 867 | + max_month = value | |
| 868 | + max_day = 1 | |
| 869 | + max_hour = 0 | |
| 870 | + max_minute = 0 | |
| 871 | + max_second = 0 | |
| 872 | + titleLab.text = String(format: "%d月", value) | |
| 873 | + }else if type == "日"{ | |
| 874 | + value = row % 31 + 1 | |
| 875 | + let year = self.selectDateTools?.selectYear | |
| 876 | + let month = self.selectDateTools?.selectMonth | |
| 877 | + min_year = year! | |
| 878 | + min_month = month! | |
| 879 | + min_day = value | |
| 880 | + min_hour = 23 | |
| 881 | + min_minute = 59 | |
| 882 | + min_second = 59 | |
| 883 | + max_year = year! | |
| 884 | + max_month = month! | |
| 885 | + max_day = value | |
| 886 | + max_hour = 0 | |
| 887 | + max_minute = 0 | |
| 888 | + max_second = 0 | |
| 889 | + titleLab.text = String(format: "%d日", value) | |
| 890 | + }else if type == "时"{ | |
| 891 | + value = row % 24 | |
| 892 | + let year = self.selectDateTools?.selectYear | |
| 893 | + let month = self.selectDateTools?.selectMonth | |
| 894 | + let day = self.selectDateTools?.selectDay | |
| 895 | + min_year = year! | |
| 896 | + min_month = month! | |
| 897 | + min_day = day! | |
| 898 | + min_hour = value | |
| 899 | + min_minute = 59 | |
| 900 | + min_second = 59 | |
| 901 | + max_year = year! | |
| 902 | + max_month = month! | |
| 903 | + max_day = day! | |
| 904 | + max_hour = value | |
| 905 | + max_minute = 0 | |
| 906 | + max_second = 0 | |
| 907 | + titleLab.text = String(format: "%d时", value) | |
| 908 | + }else if type == "分"{ | |
| 909 | + value = row % 60 | |
| 910 | + let year = self.selectDateTools?.selectYear | |
| 911 | + let month = self.selectDateTools?.selectMonth | |
| 912 | + let day = self.selectDateTools?.selectDay | |
| 913 | + let hour = self.selectDateTools?.selectHour | |
| 914 | + min_year = year! | |
| 915 | + min_month = month! | |
| 916 | + min_day = day! | |
| 917 | + min_hour = hour! | |
| 918 | + min_minute = value | |
| 919 | + min_second = 59 | |
| 920 | + max_year = year! | |
| 921 | + max_month = month! | |
| 922 | + max_day = day! | |
| 923 | + max_hour = hour! | |
| 924 | + max_minute = value | |
| 925 | + max_second = 0 | |
| 926 | + titleLab.text = String(format: "%d分", value) | |
| 927 | + }else if type == "秒"{ | |
| 928 | + value = row % 60 | |
| 929 | + let year = self.selectDateTools?.selectYear | |
| 930 | + let month = self.selectDateTools?.selectMonth | |
| 931 | + let day = self.selectDateTools?.selectDay | |
| 932 | + let hour = self.selectDateTools?.selectHour | |
| 933 | + let minute = self.selectDateTools?.selectMinute | |
| 934 | + min_year = year! | |
| 935 | + min_month = month! | |
| 936 | + min_day = day! | |
| 937 | + min_hour = hour! | |
| 938 | + min_minute = minute! | |
| 939 | + min_second = value | |
| 940 | + max_year = year! | |
| 941 | + max_month = month! | |
| 942 | + max_day = day! | |
| 943 | + max_hour = hour! | |
| 944 | + max_minute = minute! | |
| 945 | + max_second = value | |
| 946 | + titleLab.text = String(format: "%d秒", value) | |
| 947 | + } | |
| 948 | + var isLessThan = false | |
| 949 | + if (self.minDate != nil) == true{ | |
| 950 | + let min_currentDate = self.getDatePickerSelectTimeWithYearValue(yearValue: min_year, monthValue: min_month, dayValue: min_day, hourValue: min_hour, minuteValue: min_minute, secondValue: min_second) | |
| 951 | + isLessThan = self.isLessThanMinDate(date: min_currentDate) | |
| 952 | + } | |
| 953 | + var isMoreThan = false | |
| 954 | + if (self.maxDate != nil) == true{ | |
| 955 | + let max_currentDate = self.getDatePickerSelectTimeWithYearValue(yearValue: max_year, monthValue: max_month, dayValue: max_day, hourValue: max_hour, minuteValue: max_minute, secondValue: max_second) | |
| 956 | + isMoreThan = self.isMoreThanMaxDate(date: max_currentDate) | |
| 957 | + } | |
| 958 | + if isMoreThan || isLessThan{ | |
| 959 | + titleLab.textColor = .lightGray | |
| 960 | + }else{ | |
| 961 | + if type == "日"{ | |
| 962 | + if value > self.daysOfMonth{ | |
| 963 | + titleLab.textColor = .lightGray | |
| 964 | + }else{ | |
| 965 | + titleLab.textColor = .black | |
| 966 | + } | |
| 967 | + }else{ | |
| 968 | + titleLab.textColor = .black | |
| 969 | + } | |
| 970 | + } | |
| 971 | + } | |
| 972 | + } | |
| 973 | + | |
| 974 | + // MARK: - 获取时间选取器中指定的时间 | |
| 975 | + | |
| 976 | + /** | |
| 977 | + 获取时间选取器中指定的时间 | |
| 978 | + | |
| 979 | + @param yearValue 年对应的值 | |
| 980 | + @param monthValue 月对应的值 | |
| 981 | + @param dayValue 日对应的值 | |
| 982 | + @param hourValue 时对应的值 | |
| 983 | + @param minuteValue 分对应的值 | |
| 984 | + @param secondValue 秒对应的值 | |
| 985 | + @return 时间 | |
| 986 | + */ | |
| 987 | + func getDatePickerSelectTimeWithYearValue(yearValue:Int,monthValue:Int,dayValue:Int,hourValue:Int,minuteValue:Int,secondValue:Int) -> NSDate{ | |
| 988 | + let dateStr = String(format: "%d-%d-%d %d:%d:%d", yearValue,monthValue,dayValue,hourValue,minuteValue,secondValue) | |
| 989 | + let dateFormatter = DateFormatter() | |
| 990 | + dateFormatter.dateFormat = "YYYY-MM-dd HH:mm:ss" | |
| 991 | + dateFormatter.locale = Locale(identifier: "zh_CN") | |
| 992 | + | |
| 993 | + return dateFormatter.date(from: String(dateStr))! as NSDate | |
| 994 | + } | |
| 995 | + // MARK: - 切换年/月时 获取当月天数 | |
| 996 | + /** | |
| 997 | + 用年/月获取天数 | |
| 998 | + | |
| 999 | + @param year 年 | |
| 1000 | + @param month 月 | |
| 1001 | + @return 天数 | |
| 1002 | + */ | |
| 1003 | + func getDaysWithYear(year:Int,month:Int) -> Int{ | |
| 1004 | + var days = 0 | |
| 1005 | + if month == 2{ | |
| 1006 | + //闰年:能被4整除但不能被100整除的年份为普通闰年。 能被400整除的为世纪闰年 | |
| 1007 | + if ((year%4 == 0 && year%100 != 0) || year%400 == 0) { | |
| 1008 | + days = 29 | |
| 1009 | + }else { | |
| 1010 | + days = 28 | |
| 1011 | + } | |
| 1012 | + }else if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { | |
| 1013 | + days = 31 | |
| 1014 | + }else { | |
| 1015 | + days = 30 | |
| 1016 | + } | |
| 1017 | + return days | |
| 1018 | + } | |
| 1019 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLiveSelectCouponTapView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveSelectCouponTapView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/15. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +typealias selectTypeActionBlock = (_ section:Int) -> Void | |
| 10 | + | |
| 11 | +class CNLiveSelectCouponTapView:UIView{ | |
| 12 | + var _titles:Array<String>? | |
| 13 | + var titles:Array<String>?{ | |
| 14 | + get{ | |
| 15 | + _titles | |
| 16 | + } | |
| 17 | + set{ | |
| 18 | + _titles = newValue | |
| 19 | + if _titles?.count ?? 0 == 0{ | |
| 20 | + return | |
| 21 | + } | |
| 22 | + for (idx,obj) in _titles!.enumerated(){ | |
| 23 | + let btn = UIButton(type: .custom) | |
| 24 | + btn.setTitleColor(HexColor("#666666"), for: .normal) | |
| 25 | + btn.setTitle(obj, for: .normal) | |
| 26 | + btn.setImage(UIImage(named: "DS_coupon_unSelect"), for: .normal) | |
| 27 | + btn.setImage(UIImage(named: "DS_coupon_select"), for: .selected) | |
| 28 | + btn.titleLabel?.font = Font_15 | |
| 29 | + btn.tag = 1001+idx | |
| 30 | + btn.addTarget(self, action: #selector(selectIndex(_:)), for: .touchUpInside) | |
| 31 | + self.addSubview(btn) | |
| 32 | + | |
| 33 | + self.btnArray.add(btn) | |
| 34 | + } | |
| 35 | + let btn1 = self.btnArray[1] as! UIButton | |
| 36 | + let btn2 = self.btnArray[0] as! UIButton | |
| 37 | + var width1:CGFloat = 0 | |
| 38 | + if titles![1].count == 4{ | |
| 39 | + width1 = 83 | |
| 40 | + }else if titles![1].count == 3{ | |
| 41 | + width1 = 68 | |
| 42 | + }else if titles![1].count == 2{ | |
| 43 | + width1 = 53 | |
| 44 | + } | |
| 45 | + btn1.snp.makeConstraints { make in | |
| 46 | + make.right.equalTo(self) | |
| 47 | + make.width.equalTo(width1) | |
| 48 | + make.height.equalTo(self) | |
| 49 | + } | |
| 50 | + var width2:CGFloat = 0 | |
| 51 | + if titles![0].count == 4{ | |
| 52 | + width2 = 83 | |
| 53 | + }else if titles![0].count == 3{ | |
| 54 | + width2 = 68 | |
| 55 | + }else if titles![0].count == 2{ | |
| 56 | + width2 = 53 | |
| 57 | + } | |
| 58 | + btn2.snp.makeConstraints { make in | |
| 59 | + make.right.equalTo(btn1.snp.left).offset(-30) | |
| 60 | + make.width.equalTo(width2) | |
| 61 | + make.height.equalTo(self) | |
| 62 | + } | |
| 63 | + } | |
| 64 | + } | |
| 65 | + | |
| 66 | + var _selectIndex:Int = 0 | |
| 67 | + var selectIndex:Int{ | |
| 68 | + get{ | |
| 69 | + _selectIndex | |
| 70 | + } | |
| 71 | + set{ | |
| 72 | + _selectIndex = newValue | |
| 73 | + for button in self.btnArray{ | |
| 74 | + let btn = button as! UIButton | |
| 75 | + if btn.tag - 1000 == selectIndex{ | |
| 76 | + btn.isSelected = true | |
| 77 | + }else{ | |
| 78 | + btn.isSelected = false | |
| 79 | + } | |
| 80 | + } | |
| 81 | + } | |
| 82 | + } | |
| 83 | + | |
| 84 | + var editEnabled:Bool = false | |
| 85 | + var selectTypeBlock:selectTypeActionBlock? | |
| 86 | + lazy var btnArray :NSMutableArray = { | |
| 87 | + let btnArray = NSMutableArray() | |
| 88 | + return btnArray | |
| 89 | + }() | |
| 90 | + @objc func selectIndex(_ sender:UIButton){ | |
| 91 | + if self.editEnabled == false{ | |
| 92 | + showMessage(message: "该项不可编辑") | |
| 93 | + return | |
| 94 | + } | |
| 95 | + for btn in self.btnArray{ | |
| 96 | + let button = btn as! UIButton | |
| 97 | + if button.tag == sender.tag{ | |
| 98 | + button.isSelected = true | |
| 99 | + self.selectTypeBlock!(sender.tag - 1000) | |
| 100 | + }else{ | |
| 101 | + button.isSelected = false | |
| 102 | + } | |
| 103 | + } | |
| 104 | + } | |
| 105 | + | |
| 106 | +} | ... | ... |
metaCode/Classes/Main/HomePage/View/ShopCoupon/CNLiveShopCouponCreateBottomView.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopCouponCreateBottomView.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/12. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import SnapKit | |
| 10 | +protocol CNLiveShopCouponButtonClickDelegate:NSObjectProtocol{ | |
| 11 | + /// 单点 | |
| 12 | + /// @param gestureView 手势视图 | |
| 13 | + /// @param recognizer 手势 | |
| 14 | + func selectedItemButton(section:Int) | |
| 15 | + | |
| 16 | +} | |
| 17 | + | |
| 18 | +class CNLiveShopCouponCreateBottomView:UIView{ | |
| 19 | + /// 代理 | |
| 20 | + weak var delegate:CNLiveShopCouponButtonClickDelegate? | |
| 21 | + | |
| 22 | + private lazy var cancelBtn: UIButton = { | |
| 23 | + | |
| 24 | + let button = UIButton(type: .custom) | |
| 25 | + button.backgroundColor = UIColor.white | |
| 26 | + button.setTitleColor( HexColor("#3A3A3A"), for: .normal) | |
| 27 | + button.setTitle("取消", for: .normal) | |
| 28 | + button.tag = 1000 | |
| 29 | + button.addTarget(self, action: #selector(selectAction), for: .touchUpInside) | |
| 30 | + return button | |
| 31 | + }() | |
| 32 | + | |
| 33 | + lazy var saveBtn: UIButton = { | |
| 34 | + let saveBtn = UIButton(type: .custom) | |
| 35 | + saveBtn.tag = 1001 | |
| 36 | + let gradientLayer = CAGradientLayer() | |
| 37 | + | |
| 38 | + gradientLayer.locations = [0, 1] | |
| 39 | + gradientLayer.startPoint = CGPoint(x: 0.88, y: 0.11) | |
| 40 | + gradientLayer.endPoint = CGPoint(x: 0.28, y: 0.81) | |
| 41 | + | |
| 42 | + let color1 = HexColor("#7ED785")!.cgColor | |
| 43 | + let color2 = HexColor("#64C367")!.cgColor | |
| 44 | + gradientLayer.colors = [color1, color2] | |
| 45 | + | |
| 46 | + gradientLayer.frame = CGRect(x: 0, y: 0, width: 245, height: 50) | |
| 47 | + saveBtn.layer.addSublayer(gradientLayer) | |
| 48 | + saveBtn.setTitle("保存", for: .normal) | |
| 49 | + saveBtn.setTitleColor(.white, for: .normal) | |
| 50 | + | |
| 51 | + saveBtn.addTarget(self, action: #selector(selectAction), for: .touchUpInside) | |
| 52 | + return saveBtn | |
| 53 | + }() | |
| 54 | + | |
| 55 | + override init(frame: CGRect) { | |
| 56 | + super.init(frame: frame) | |
| 57 | + | |
| 58 | + self.addSubview(self.cancelBtn) | |
| 59 | + self.addSubview(self.saveBtn) | |
| 60 | + self.saveBtn.snp.makeConstraints { make in | |
| 61 | + make.top.right.bottom.equalTo(self) | |
| 62 | + make.width.equalTo(245) | |
| 63 | + } | |
| 64 | + self.cancelBtn.snp.makeConstraints { make in | |
| 65 | + make.left.top.bottom.equalTo(self) | |
| 66 | + make.right.equalTo(self.saveBtn.snp.left) | |
| 67 | + } | |
| 68 | + } | |
| 69 | + | |
| 70 | + required init?(coder: NSCoder) { | |
| 71 | + fatalError("init(coder:) has not been implemented") | |
| 72 | + } | |
| 73 | + | |
| 74 | + @objc func selectAction(_ sender: UIButton) { | |
| 75 | + self.delegate?.selectedItemButton(section: sender.tag - 1000) | |
| 76 | + } | |
| 77 | +} | ... | ... |
metaCode/Classes/Main/HomePage/ViewModel/GoodsManager/CNLiveShopGoodListViewModel.swift
| ... | ... | @@ -11,6 +11,49 @@ import CNLiveRequestBastKit |
| 11 | 11 | typealias categoryResultBlock = (_ result: Any,_ status:CNLiveDownSlideResponseType) -> Void |
| 12 | 12 | |
| 13 | 13 | class CNLiveShopGoodListViewModel:NSObject{ |
| 14 | + | |
| 15 | + // MARK: - 关联商品 | |
| 16 | + /** | |
| 17 | + 请求店铺商品列表 | |
| 18 | + | |
| 19 | + @param shopId 商家id | |
| 20 | + @param sortType 1新品 2价格从底到高 3 价格从高到底 | |
| 21 | + @param state 2上架的商品 1下架的商品 0全部商品 | |
| 22 | + @param categoryId 分类id | |
| 23 | + @param keyword 关键字 | |
| 24 | + @param page 页数(一页20条) | |
| 25 | + @param result 结果 | |
| 26 | + */ | |
| 27 | + static func getGetGoodsListWithShopId(shopId:String?,sortType:String?,state:Int,categoryId:String?,keyword:String?,page:Int,resultBlock: @escaping downSlideResultBlock) { | |
| 28 | + let param = NSMutableDictionary() | |
| 29 | + param.setValue(shopId, forKey: "shop_id") | |
| 30 | + param.setValue(sortType ?? "1", forKey: "type") | |
| 31 | + param.setValue(String(format: "%d", state), forKey: "state") | |
| 32 | + param.setValue(categoryId, forKey: "category_id") | |
| 33 | + param.setValue(keyword, forKey: "keyword") | |
| 34 | + param.setValue(String(format: "%d", page), forKey: "page") | |
| 35 | + | |
| 36 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 37 | + CNLiveNetworking.setupShowDataResult(false) | |
| 38 | + CNLiveNetworking.setupDSRequest(true) | |
| 39 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/getGoodsList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 40 | + hiddenLoading() | |
| 41 | + if (error == nil) { | |
| 42 | + let resp = result as! NSDictionary | |
| 43 | + var dataArr:[BaseModel] = [] | |
| 44 | + let respArr = resp["data"] as! NSArray | |
| 45 | + for dic in respArr{ | |
| 46 | + let dataDic = dic as! NSDictionary | |
| 47 | + let goodsListModel = newDictionaryToModel(dataDic as! [String : Any], ShopOrderAssociatedGoodsModel.self) | |
| 48 | + dataArr.append(goodsListModel) | |
| 49 | + } | |
| 50 | + resultBlock(dataArr,.success) | |
| 51 | + }else{ | |
| 52 | + resultBlock(NSNull(),.failed) | |
| 53 | + } | |
| 54 | + } | |
| 55 | + } | |
| 56 | + | |
| 14 | 57 | /// 请求店铺商品列表 |
| 15 | 58 | /// - Parameters: |
| 16 | 59 | /// - shopId:id | ... | ... |
metaCode/Classes/Main/HomePage/ViewModel/ShopCoupon/CNLiveShopCouponViewModel.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopCouponViewModel.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/12. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | +import CNLiveRequestBastKit | |
| 10 | +class CNLiveShopCouponViewModel:NSObject{ | |
| 11 | + class func responseCouponCreateWithModel(listModel:CNLiveShopCouponListModel?) -> [[CNLiveShopCouponModel]] { | |
| 12 | + let model = CNLiveShopCouponListModel() | |
| 13 | + model.title = listModel?.title ?? "" | |
| 14 | + if (listModel?.filled != nil){ | |
| 15 | + if listModel!.filled!.count > 0{ | |
| 16 | + model.filled = listModel!.filled | |
| 17 | + } | |
| 18 | + }else{ | |
| 19 | + model.filled = "" | |
| 20 | + } | |
| 21 | + if (listModel?.discount != nil){ | |
| 22 | + if listModel!.discount!.count > 0{ | |
| 23 | + model.discount = listModel!.discount | |
| 24 | + } | |
| 25 | + }else{ | |
| 26 | + model.discount = "" | |
| 27 | + } | |
| 28 | + model.num = listModel?.num ?? "" | |
| 29 | + model.starttime = listModel?.starttime ?? "" | |
| 30 | + model.endtime = listModel?.endtime ?? "" | |
| 31 | + model.sort = (listModel?.sort != nil && (listModel?.sort != 1)) ? 2 : 1 | |
| 32 | + model.goods_title = listModel?.goods_title ?? "" | |
| 33 | + model.state = (listModel?.state != nil && listModel?.state != 1) ? 2 : 1 | |
| 34 | + model.receive_number = (listModel?.receive_number != nil && (listModel?.receive_number != "1")) ? "2" : "1" | |
| 35 | + model.is_show = (listModel?.is_show != nil && (listModel?.is_show != "1")) ? "2" : "1" | |
| 36 | + | |
| 37 | + let arr = [[["id":1,"type":1,"title":"名称","subTitle":"请输入(20字以内)","section":1,"message":model.title!],["id":2,"type":2,"title":"满减折扣","subTitle":"","section":1,"filled":model.filled,"disCount":model.discount],["id":3,"type":1,"title":"数量","subTitle":"请输入数量","section":1,"message":model.num],["id":4,"type":3,"title":"开始时间","subTitle":"请选择开始时间","section":1,"message":model.starttime],["id":5,"type":3,"title":"结束时间","subTitle":"请选择结束时间","section":1,"message":model.endtime]],[["id":6,"type":4,"title":"所属类型","subTitle":"","section":model.sort],["id":7,"type":5,"title":"优惠商品","subTitle":"请选择","section":1,"message":model.goods_title],["id":8,"type":4,"title":"领取状态","subTitle":"","section":model.state],["id":9,"type":4,"title":"领取次数","subTitle":"","section":model.receive_number],["id":10,"type":6,"title":"显示状态","subTitle":"","section":model.is_show]]] | |
| 38 | +// let arr = [[["id":1,"type":1,"title":"名称","subTitle":"请输入(20字以内)","section":1,"message":model.title ?? ""],["id":2,"type":2,"title":"满减折扣","subTitle":"","section":1,"filled":(model.filled>0 ? String(format: "%ld", model.filled) : ""),"disCount":(model.discount>0 ? String(format: "%ld",model.discount) : "")],["id":3,"type":1,"title":"数量","subTitle":"请输入数量","section":1,"message":model.num ?? ""],["id":4,"type":3,"title":"开始时间","subTitle":"请选择开始时间","section":1,"message":model.starttime ?? ""],["id":5,"type":3,"title":"结束时间","subTitle":"请选择结束时间","section":1,"message":model.endtime ?? ""]],[["id":6,"type":4,"title":"所属类型","subTitle":"","section":(model.sort != nil && (model.sort != "1")) ? 2 : 1],["id":7,"type":5,"title":"优惠商品","subTitle":"请选择","section":1,"message":model.goods_title ?? ""],["id":8,"type":4,"title":"领取状态","subTitle":"","section":(model.state != nil && (model.state != "1")) ? 2 : 1],["id":9,"type":4,"title":"领取次数","subTitle":"","section":(model.receive_number != nil && (model.receive_number != "1")) ? 2 : 1],["id":10,"type":6,"title":"显示状态","subTitle":"","section":(model.is_show != nil && (model.is_show != "1")) ? 2 : 1]]] | |
| 39 | +// | |
| 40 | + var dataArr = [[CNLiveShopCouponModel]]() // 修改为二维数组 | |
| 41 | + | |
| 42 | + for subArr in arr { | |
| 43 | + var dataSubArr = [CNLiveShopCouponModel]() // 修改为数组 | |
| 44 | + for (_,mdl) in subArr.enumerated() { | |
| 45 | + let model = newDictionaryToModel(mdl, CNLiveShopCouponModel.self) as? CNLiveShopCouponModel | |
| 46 | + if model != nil { | |
| 47 | + dataSubArr.append(model!) // 如果转换成功,添加到数组中 | |
| 48 | + } | |
| 49 | + } | |
| 50 | + dataArr.append(dataSubArr) // 将子数组添加到主数组中 | |
| 51 | + } | |
| 52 | + return dataArr | |
| 53 | + } | |
| 54 | + class func selectTitles(id:Int) -> Array<String>{ | |
| 55 | + var selectTitles = Array<String>() | |
| 56 | + switch id{ | |
| 57 | + case 6: | |
| 58 | + selectTitles = ["店铺全场","单个商品"] | |
| 59 | + break | |
| 60 | + case 8: | |
| 61 | + selectTitles = ["正常","冻结"] | |
| 62 | + break | |
| 63 | + case 9: | |
| 64 | + selectTitles = ["不限","限一次"] | |
| 65 | + break | |
| 66 | + default: break | |
| 67 | + | |
| 68 | + } | |
| 69 | + return selectTitles | |
| 70 | + } | |
| 71 | + /// 发布优惠券 | |
| 72 | + /// @param title 优惠券标题 | |
| 73 | + /// @param filled 满多少 | |
| 74 | + /// @param discount 减多少 | |
| 75 | + /// @param startTime 开始时间戳 | |
| 76 | + /// @param endTime 结束时间戳 | |
| 77 | + /// @param state 是否开启 1 开启 2 关闭 | |
| 78 | + /// @param isShow 是否显示 1 对外显示 2 不对外 | |
| 79 | + /// @param receiveNum 领取次数 1 不限制 2 限领一次 | |
| 80 | + /// @param totalNum 优惠券数量 -1 为不限量 | |
| 81 | + /// @param type 所属类型 1全场 2 单品,判断需要 | |
| 82 | + /// @param goodsId 商品id 单品优惠券传此值 | |
| 83 | + class func requestCreateCouponWithTitle(title:String,filled:String,discount:String,startTime:String,endTime:String,state:String,isShow:String,receiveNum:String,totalNum:String,type:Int,goodsId:String,resultBlock: @escaping downSlideResultBlock){ | |
| 84 | + if title == ""{ | |
| 85 | + showMessage(message:"优惠券名称不能为空") | |
| 86 | + return | |
| 87 | + } | |
| 88 | + if filled == "" || discount == ""{ | |
| 89 | + showMessage(message:"优惠券满减金额不能为空") | |
| 90 | + return | |
| 91 | + } | |
| 92 | + if (discount as NSString).floatValue > (filled as NSString).floatValue{ | |
| 93 | + showMessage(message: "减免金额不可大于总金额") | |
| 94 | + return | |
| 95 | + } | |
| 96 | + if totalNum == ""{ | |
| 97 | + showMessage(message:"优惠券总数量不能为空") | |
| 98 | + return | |
| 99 | + } | |
| 100 | + if (totalNum as NSString).integerValue <= 0{ | |
| 101 | + showMessage(message: "优惠券总数量必须大于0") | |
| 102 | + return | |
| 103 | + } | |
| 104 | + if startTime == ""{ | |
| 105 | + showMessage(message:"优惠券开始时间不能为空") | |
| 106 | + return | |
| 107 | + } | |
| 108 | + if endTime == ""{ | |
| 109 | + showMessage(message:"优惠券结束时间不能为空") | |
| 110 | + return | |
| 111 | + } | |
| 112 | + if (startTime as NSString).floatValue >= (endTime as NSString).floatValue{ | |
| 113 | + showMessage(message: "结束时间必须大于开始时间") | |
| 114 | + return | |
| 115 | + } | |
| 116 | + if type == 2 && goodsId == ""{ | |
| 117 | + showMessage(message: "请选择需要优惠的商品") | |
| 118 | + return | |
| 119 | + } | |
| 120 | + let param = NSMutableDictionary() | |
| 121 | + param.setValue(DSUserInfoManager.shared.dsUserInfo.uid, forKey: "uid") | |
| 122 | + param.setValue(title, forKey: "title") | |
| 123 | + param.setValue(filled, forKey: "filled") | |
| 124 | + param.setValue(discount, forKey: "discount") | |
| 125 | + param.setValue(startTime, forKey: "starttime") | |
| 126 | + param.setValue(endTime, forKey: "endtime") | |
| 127 | + param.setValue(state, forKey: "state") | |
| 128 | + param.setValue(isShow, forKey: "is_show") | |
| 129 | + param.setValue(receiveNum, forKey: "receive_number") | |
| 130 | + param.setValue(totalNum, forKey: "num") | |
| 131 | + param.setValue(goodsId, forKey: "goods_id") | |
| 132 | + | |
| 133 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 134 | + CNLiveNetworking.setupShowDataResult(false) | |
| 135 | + CNLiveNetworking.setupDSRequest(true) | |
| 136 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/addCoupon", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 137 | + hiddenLoading() | |
| 138 | + if (error == nil) { | |
| 139 | + resultBlock(result as Any,.success) | |
| 140 | + }else{ | |
| 141 | + resultBlock(NSNull(),.failed) | |
| 142 | + } | |
| 143 | + } | |
| 144 | + } | |
| 145 | + /// 商家优惠券列表 | |
| 146 | + class func requestCouponListResponse(resultBlock: @escaping downSlideResultBlock){ | |
| 147 | + let param = NSMutableDictionary() | |
| 148 | + param.setValue(DSUserInfoManager.shared.dsUserInfo.uid, forKey: "uid") | |
| 149 | + | |
| 150 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 151 | + CNLiveNetworking.setupShowDataResult(false) | |
| 152 | + CNLiveNetworking.setupDSRequest(true) | |
| 153 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/shopCouponList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 154 | + hiddenLoading() | |
| 155 | + if (error == nil) { | |
| 156 | + let resDic = (result as! Dictionary<String, Any>)["data"] as! Dictionary<String, Any> | |
| 157 | + let model = newDictionaryToModel(resDic, CNLiveShopCouponDataListModel.self) | |
| 158 | + resultBlock(model,.success) | |
| 159 | + }else{ | |
| 160 | + resultBlock(NSNull(),.failed) | |
| 161 | + } | |
| 162 | + } | |
| 163 | + } | |
| 164 | + /// 优惠券显示隐藏 | |
| 165 | + /// @param couponId 优惠券Id | |
| 166 | + class func requestEditCouponAtterWithId(couponId:String,resultBlock: @escaping downSlideResultBlock){ | |
| 167 | + let param = NSMutableDictionary() | |
| 168 | + param.setValue(couponId, forKey: "id") | |
| 169 | + | |
| 170 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 171 | + CNLiveNetworking.setupShowDataResult(false) | |
| 172 | + CNLiveNetworking.setupDSRequest(true) | |
| 173 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/editCouponAttr", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 174 | + hiddenLoading() | |
| 175 | + if (error == nil) { | |
| 176 | + resultBlock(result as Any,.success) | |
| 177 | + }else{ | |
| 178 | + resultBlock(NSNull(),.failed) | |
| 179 | + } | |
| 180 | + } | |
| 181 | + } | |
| 182 | + /// 编辑优惠券 | |
| 183 | + /// @param model 信息model | |
| 184 | + /// @param title 标题 | |
| 185 | + /// @param state 是否开启 | |
| 186 | + /// @param isShow 是否显示 | |
| 187 | + /// @param receiveNum 领取次数 | |
| 188 | + class func requestEditCouponWithModel(model:CNLiveShopCouponListModel,title:String,state:String,isShow:String,receiveNum:String,resultBlock: @escaping downSlideResultBlock){ | |
| 189 | + if title == ""{ | |
| 190 | + showMessage(message: "优惠券名称不能为空") | |
| 191 | + return | |
| 192 | + } | |
| 193 | + let param = NSMutableDictionary() | |
| 194 | + param.setValue(DSUserInfoManager.shared.dsUserInfo.uid, forKey: "uid") | |
| 195 | + param.setValue(model.id, forKey: "id") | |
| 196 | + param.setValue(title, forKey: "title") | |
| 197 | + param.setValue(model.filled, forKey: "filled") | |
| 198 | + param.setValue(model.discount, forKey: "discount") | |
| 199 | + param.setValue(model.starttime, forKey: "starttime") | |
| 200 | + param.setValue(model.endtime, forKey: "endtime") | |
| 201 | + param.setValue(state, forKey: "state") | |
| 202 | + param.setValue(isShow, forKey: "is_show") | |
| 203 | + param.setValue(receiveNum, forKey: "receive_number") | |
| 204 | + param.setValue(model.num, forKey: "num") | |
| 205 | + param.setValue(model.goods_id, forKey: "goods_id") | |
| 206 | + | |
| 207 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 208 | + CNLiveNetworking.setupShowDataResult(false) | |
| 209 | + CNLiveNetworking.setupDSRequest(true) | |
| 210 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/editCoupon", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 211 | + hiddenLoading() | |
| 212 | + if (error == nil) { | |
| 213 | + resultBlock(result as Any,.success) | |
| 214 | + }else{ | |
| 215 | + resultBlock(NSNull(),.failed) | |
| 216 | + } | |
| 217 | + } | |
| 218 | + } | |
| 219 | + /// 删除优惠券 | |
| 220 | + /// @param couponDic 优惠券数组 | |
| 221 | + class func requestDeleteCoupon(couponDic:NSMutableDictionary,resultBlock: @escaping downSlideResultBlock){ | |
| 222 | + var idStr = "" | |
| 223 | + for couponID in couponDic.allValues{ | |
| 224 | + let couponIDStr = couponID as! String | |
| 225 | + idStr = idStr.appendingFormat("%@,", couponIDStr) | |
| 226 | + } | |
| 227 | + let param = NSMutableDictionary() | |
| 228 | + param.setValue(idStr, forKey: "id") | |
| 229 | + | |
| 230 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 231 | + CNLiveNetworking.setupShowDataResult(false) | |
| 232 | + CNLiveNetworking.setupDSRequest(true) | |
| 233 | + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/delCoupon", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in | |
| 234 | + hiddenLoading() | |
| 235 | + if (error == nil) { | |
| 236 | + resultBlock(result as Any,.success) | |
| 237 | + }else{ | |
| 238 | + resultBlock(NSNull(),.failed) | |
| 239 | + } | |
| 240 | + } | |
| 241 | + } | |
| 242 | +} | ... | ... |
metaCode/Classes/Main/Model/CNLiveShopConsoleModel.swift
| ... | ... | @@ -60,7 +60,9 @@ class CNLiveShopConsoleModel:BaseModel { |
| 60 | 60 | [["title":"商品管理", |
| 61 | 61 | "list":[ |
| 62 | 62 | ["title":"新增商品", "subtitle":"创建新的商品", "simg":"DS_WB_XZSP", "type":0], |
| 63 | - ["title":"商品管理", "subtitle":"管理现有的商品", "simg":"DS_WB_SPGL", "type":1]]], | |
| 63 | + ["title":"商品管理", "subtitle":"管理现有的商品", "simg":"DS_WB_SPGL", "type":1], | |
| 64 | + ["title":"新增优惠券", "subtitle":"创建新增优惠券", "simg":"DS_WB_XZYHQ", "type":2], | |
| 65 | + ["title":"优惠券管理", "subtitle":"管理现有的优惠券", "simg":"DS_WB_GLYHQ", "type":3]]], | |
| 64 | 66 | ["title":"分类管理", |
| 65 | 67 | "list":[ |
| 66 | 68 | ["title":"创建店铺分类", "subtitle":"创建店铺分类", "simg":"DS_WB_SJPZ_REPAST", "type":4], | ... | ... |
metaCode/Classes/Main/Model/ShopCoupon/CNLivePickerReusingModel.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLivePickerReusingModel.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/18. | |
| 6 | +// 复用model | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLivePickerReusingModel:BaseModel{ | |
| 11 | + /** | |
| 12 | + 可见的titleLab | |
| 13 | + */ | |
| 14 | + lazy var visible:NSMutableArray = { | |
| 15 | + let visible = NSMutableArray() | |
| 16 | + return visible | |
| 17 | + }() | |
| 18 | + /** | |
| 19 | + 缓存的titleLab | |
| 20 | + */ | |
| 21 | + lazy var cache:NSMutableArray = { | |
| 22 | + let cache = NSMutableArray() | |
| 23 | + return cache | |
| 24 | + }() | |
| 25 | +} | |
| 26 | + | |
| 27 | +//复用view Model | |
| 28 | +class CNLivePickerReusingViewModel:NSObject{ | |
| 29 | + /** | |
| 30 | + 显示在的行 如果不显示为-1 | |
| 31 | + */ | |
| 32 | + var row:Int = 0 | |
| 33 | + /** | |
| 34 | + 显示的view | |
| 35 | + */ | |
| 36 | + var titleLab:UILabel? | |
| 37 | +} | ... | ... |
metaCode/Classes/Main/Model/ShopCoupon/CNLiveShopCouponListModel.swift
0 → 100644
| 1 | +// | |
| 2 | +// CNLiveShopCouponListModel.swift | |
| 3 | +// metaCode | |
| 4 | +// | |
| 5 | +// Created by zx on 2023/12/12. | |
| 6 | +// | |
| 7 | + | |
| 8 | +import Foundation | |
| 9 | + | |
| 10 | +class CNLiveShopCouponModel:BaseModel{ | |
| 11 | + /// 优惠券id | |
| 12 | + var id:Int = 1 | |
| 13 | + var type:Int = 1 | |
| 14 | + var title:String? | |
| 15 | + var subTitle:String? | |
| 16 | + var section:Int = 1 | |
| 17 | + var message:String? | |
| 18 | + var filled:String? | |
| 19 | + var disCount:String? | |
| 20 | +} | |
| 21 | +class CNLiveShopCouponListModel:BaseModel{ | |
| 22 | + /// 优惠券id | |
| 23 | + var id:String? | |
| 24 | + var type:String? | |
| 25 | + /// 优惠券使用范围 1 店铺全场 3 单品券 | |
| 26 | + var sort:Int = 1 | |
| 27 | + /// 剩余数量 | |
| 28 | + var num:String? | |
| 29 | + ///商品Id | |
| 30 | + var goods_id:String? | |
| 31 | + var goods_title:String? | |
| 32 | + /// 满 | |
| 33 | + var filled:String? | |
| 34 | + /// 减 | |
| 35 | + var discount:String? | |
| 36 | + /// 开始时间 | |
| 37 | + var starttime:String? | |
| 38 | + /// 结束时间 | |
| 39 | + var endtime:String? | |
| 40 | + /// 发布时间 | |
| 41 | + var addtime:String? | |
| 42 | + /// 店铺iD | |
| 43 | + var store_id:String? | |
| 44 | + var genre:String? | |
| 45 | + var day:String? | |
| 46 | + /// 已领取数量 | |
| 47 | + var total:String? | |
| 48 | + /// 优惠券状态 1 正常 2 冻结 | |
| 49 | + var state:Int = 1 | |
| 50 | + /// 标题 | |
| 51 | + var title:String? | |
| 52 | + /// 领取次数 1 不限制 2 限制一次 | |
| 53 | + var receive_number:String? | |
| 54 | + var types:String? | |
| 55 | + /// 是否显示 1 对外显示 2 不对外 | |
| 56 | + var is_show:String? | |
| 57 | + | |
| 58 | +} | |
| 59 | + | |
| 60 | +class CNLiveShopCouponDataListModel:BaseModel{ | |
| 61 | + var list:[CNLiveShopCouponListModel]? | |
| 62 | +} | |
| 63 | + | ... | ... |
metaCode/Classes/Main/Util/CNLiveCommonManager.swift
| ... | ... | @@ -6,7 +6,9 @@ |
| 6 | 6 | // |
| 7 | 7 | |
| 8 | 8 | import Foundation |
| 9 | +import CNLiveRequestBastKit | |
| 9 | 10 | |
| 11 | +typealias getTimeWithResultBlock = (_ networkTimestamp:Double) -> Void | |
| 10 | 12 | |
| 11 | 13 | class CNLiveCommonManager: NSObject{ |
| 12 | 14 | |
| ... | ... | @@ -23,4 +25,29 @@ class CNLiveCommonManager: NSObject{ |
| 23 | 25 | vc.coverImageUrl = coverImageUrl |
| 24 | 26 | currentViewController()?.navigationController?.pushViewController(vc, animated: false) |
| 25 | 27 | } |
| 28 | + | |
| 29 | + /** | |
| 30 | + 获取网络时间 | |
| 31 | + */ | |
| 32 | + func postGetTimeWithResult(resultBlock:@escaping getTimeWithResultBlock){ | |
| 33 | + | |
| 34 | + CNLiveNetworking.setAllowRequestDefaultArgument(true) | |
| 35 | + CNLiveNetworking.setupShowDataResult(false) | |
| 36 | + CNLiveNetworking.setupDSRequest(true) | |
| 37 | + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/Api/Index3/get_time", param: nil, cacheType: .networkOnly) { task, result, error in | |
| 38 | + if error == nil{ | |
| 39 | + let res = (result as! NSDictionary) | |
| 40 | + let allKeys = res.allKeys as NSArray | |
| 41 | + var networkTimestamp:Double = 0 | |
| 42 | + if allKeys.contains("time"){ | |
| 43 | + networkTimestamp = (res["time"] as! NSString).doubleValue | |
| 44 | + } | |
| 45 | + resultBlock(networkTimestamp) | |
| 46 | + }else{ | |
| 47 | + let date = Date() | |
| 48 | + let timestamp = date.timeIntervalSince1970 | |
| 49 | + resultBlock(timestamp) | |
| 50 | + } | |
| 51 | + } | |
| 52 | + } | |
| 26 | 53 | } | ... | ... |
metaCode/Info.plist
| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> |
| 3 | 3 | <plist version="1.0"> |
| 4 | 4 | <dict> |
| 5 | + <key>CFBundleDevelopmentRegion</key> | |
| 6 | + <string>zh_CN</string> | |
| 5 | 7 | <key>CFBundleAllowMixedLocalizations</key> |
| 6 | 8 | <true/> |
| 7 | 9 | <key>CFBundleLocalizations</key> | ... | ... |
metaCode/Supporting Files/Assets.xcassets/Home/DS_main_rightArrow.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "DS_main_rightArrow@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "DS_main_rightArrow@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/Home/DS_main_rightArrow.imageset/DS_main_rightArrow@2x.png
0 → 100644
330 Bytes
metaCode/Supporting Files/Assets.xcassets/Home/DS_main_rightArrow.imageset/DS_main_rightArrow@3x.png
0 → 100644
436 Bytes
metaCode/Supporting Files/Assets.xcassets/Home/icon_shop_order_close.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "icon_shop_order_close@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "icon_shop_order_close@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/Home/icon_shop_order_close.imageset/icon_shop_order_close@2x.png
0 → 100644
962 Bytes
metaCode/Supporting Files/Assets.xcassets/Home/icon_shop_order_close.imageset/icon_shop_order_close@3x.png
0 → 100644
1.75 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_create.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "DS_coupon_create@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "DS_coupon_create@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_create.imageset/DS_coupon_create@2x.png
0 → 100644
1.22 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_create.imageset/DS_coupon_create@3x.png
0 → 100644
1.89 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_edit_delete.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "DS_coupon_edit_delete@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "DS_coupon_edit_delete@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_edit_delete.imageset/DS_coupon_edit_delete@2x.png
0 → 100644
748 Bytes
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_edit_delete.imageset/DS_coupon_edit_delete@3x.png
0 → 100644
1.01 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_edit_no.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "DS_coupon_edit_no@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "DS_coupon_edit_no@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_edit_no.imageset/DS_coupon_edit_no@2x.png
0 → 100644
823 Bytes
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_edit_no.imageset/DS_coupon_edit_no@3x.png
0 → 100644
1.39 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_edit_se.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "DS_coupon_edit_se@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "DS_coupon_edit_se@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_edit_se.imageset/DS_coupon_edit_se@2x.png
0 → 100644
1.26 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_edit_se.imageset/DS_coupon_edit_se@3x.png
0 → 100644
1.96 KB
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_need.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "DS_coupon_need@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "DS_coupon_need@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_need.imageset/DS_coupon_need@2x.png
0 → 100644
387 Bytes
metaCode/Supporting Files/Assets.xcassets/Shop/DS_coupon_need.imageset/DS_coupon_need@3x.png
0 → 100644
600 Bytes
metaCode/Supporting Files/Assets.xcassets/Shop/goods_search.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "scale" : "1x" | |
| 6 | + }, | |
| 7 | + { | |
| 8 | + "filename" : "goods_search@2x.png", | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "filename" : "goods_search@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/goods_search.imageset/goods_search@2x.png
0 → 100644
1.17 KB
metaCode/Supporting Files/Assets.xcassets/Shop/goods_search.imageset/goods_search@3x.png
0 → 100644
1.85 KB