Commit fd7f1aba authored by pete谢兆麟's avatar pete谢兆麟

邀请有礼筛选

parent 7e16af23
......@@ -300,6 +300,7 @@
047AA3F42C50E5C7009C4554 /* YHInvitationWithGiftsViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047AA3F32C50E5C7009C4554 /* YHInvitationWithGiftsViewModel.swift */; };
047AA3F62C50E773009C4554 /* YHShareCashOutModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047AA3F52C50E773009C4554 /* YHShareCashOutModel.swift */; };
047AA3F82C5CC7B0009C4554 /* YHShareStepView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047AA3F72C5CC7B0009C4554 /* YHShareStepView.swift */; };
047AA3FA2C60739E009C4554 /* YHInvitationWithGiftsSelectItemView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 047AA3F92C60739E009C4554 /* YHInvitationWithGiftsSelectItemView.swift */; };
0480976B2BA15269000B9DCA /* YHCertificateInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */; };
0480976D2BA158A1000B9DCA /* YHCertificateListVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */; };
048097712BA18D66000B9DCA /* YHCertificateSearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */; };
......@@ -930,6 +931,7 @@
047AA3F32C50E5C7009C4554 /* YHInvitationWithGiftsViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInvitationWithGiftsViewModel.swift; sourceTree = "<group>"; };
047AA3F52C50E773009C4554 /* YHShareCashOutModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHShareCashOutModel.swift; sourceTree = "<group>"; };
047AA3F72C5CC7B0009C4554 /* YHShareStepView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHShareStepView.swift; sourceTree = "<group>"; };
047AA3F92C60739E009C4554 /* YHInvitationWithGiftsSelectItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHInvitationWithGiftsSelectItemView.swift; sourceTree = "<group>"; };
0480976A2BA15269000B9DCA /* YHCertificateInfoCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateInfoCell.swift; sourceTree = "<group>"; };
0480976C2BA158A1000B9DCA /* YHCertificateListVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateListVC.swift; sourceTree = "<group>"; };
048097702BA18D66000B9DCA /* YHCertificateSearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateSearchBar.swift; sourceTree = "<group>"; };
......@@ -1375,6 +1377,7 @@
047AA3D42C4A3643009C4554 /* YHInvitationWithGiftsDetailView.swift */,
047AA3D62C4A4399009C4554 /* YHInvitationWithGiftsShareView.swift */,
047AA3F72C5CC7B0009C4554 /* YHShareStepView.swift */,
047AA3F92C60739E009C4554 /* YHInvitationWithGiftsSelectItemView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -3835,6 +3838,7 @@
A58A8C8F2BA6978100632765 /* YHMineCertificateEntryViewController.swift in Sources */,
045EEF1B2B9F171A0022A143 /* YHAddressPickViewTableViewCell.swift in Sources */,
04213B2F2C49154900797900 /* YHHomeInfoDetailContainerViewController.swift in Sources */,
047AA3FA2C60739E009C4554 /* YHInvitationWithGiftsSelectItemView.swift in Sources */,
A567E5A42BD7643D00D5D5A0 /* YHSearchInfoCell.swift in Sources */,
045EEE932B9F171A0022A143 /* YHPreviewInfoSingleLineTitleView.swift in Sources */,
045EEF1D2B9F171A0022A143 /* YHAddressPickView.swift in Sources */,
......
......@@ -83,11 +83,11 @@ extension YHInvitationWithGiftsViewController: UITableViewDelegate, UITableViewD
return KScreenWidth * 0.55 + 16.0
} else if indexPath.row == 1 {
if self.viewModel.recordModel.list.count == 0 {
return 345
return 385
} else if self.viewModel.recordModel.list.count <= 10 {
return CGFloat(305 + 40 * self.viewModel.recordModel.list.count)
return CGFloat(345 + 40 * self.viewModel.recordModel.list.count)
} else {
return 673
return 713
}
}
return 0
......
......@@ -20,6 +20,8 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
var numberTwoView: YHInvitationNumberItemView!
var numberThreeView: YHInvitationNumberItemView!
var explainLabel: UILabel!
var recommendLabel: UILabel!
var recommendButton: UIButton!
var peopleOneView: YHInvitationPeopleItemView!
var peopleTwoView: YHInvitationPeopleItemView!
var peopleThreeView: YHInvitationPeopleItemView!
......@@ -187,6 +189,36 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
make.height.equalTo(1)
}
recommendLabel = {
let label = UILabel()
label.text = "推荐明细"
label.font = UIFont.PFSC_M(ofSize: 15)
label.textColor = UIColor.mainTextColor
return label
}()
centerView.addSubview(recommendLabel)
recommendLabel.snp.makeConstraints { make in
make.left.equalTo(15)
make.top.equalTo(203)
make.right.equalTo(-15)
make.height.equalTo(21)
}
recommendButton = {
let button = UIButton()
button.setBackgroundImage(UIImage(named: "invitation_with_gifts_select_normal"), for: .normal)
button.setBackgroundImage(UIImage(named: "invitation_with_gifts_select"), for: .selected)
button.addTarget(self, action: #selector(selectItem), for: .touchUpInside)
return button
}()
centerView.addSubview(recommendButton)
recommendButton.snp.makeConstraints { make in
make.width.equalTo(47)
make.top.equalTo(205)
make.right.equalTo(-15)
make.height.equalTo(18)
}
numberTwoView = {
let view = YHInvitationNumberItemView()
view.bottomLabel.text = "已测评"
......@@ -269,7 +301,7 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
}()
centerView.addSubview(peopleOneView)
peopleOneView.snp.makeConstraints { make in
make.top.equalTo(199)
make.top.equalTo(239)
make.left.equalTo(15)
make.height.equalTo(37)
make.width.equalTo(100)
......@@ -290,7 +322,7 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
}()
centerView.addSubview(peopleFiveView)
peopleFiveView.snp.makeConstraints { make in
make.top.equalTo(199)
make.top.equalTo(239)
make.right.equalTo(-15)
make.height.equalTo(37)
make.width.equalTo(38)
......@@ -309,7 +341,7 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
}()
centerView.addSubview(peopleFourView)
peopleFourView.snp.makeConstraints { make in
make.top.equalTo(199)
make.top.equalTo(239)
make.right.equalTo(peopleFiveView.snp.left).offset(-1)
make.height.equalTo(37)
make.width.equalTo(38)
......@@ -328,7 +360,7 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
}()
centerView.addSubview(peopleThreeView)
peopleThreeView.snp.makeConstraints { make in
make.top.equalTo(199)
make.top.equalTo(239)
make.right.equalTo(peopleFourView.snp.left).offset(-1)
make.height.equalTo(37)
make.width.equalTo(38)
......@@ -341,7 +373,7 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
}()
centerView.addSubview(peopleTwoView)
peopleTwoView.snp.makeConstraints { make in
make.top.equalTo(199)
make.top.equalTo(239)
make.right.equalTo(peopleThreeView.snp.left).offset(-1)
make.height.equalTo(37)
make.left.equalTo(peopleOneView.snp.right).offset(1)
......@@ -362,7 +394,7 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
}()
centerView.addSubview(tableView)
tableView.snp.makeConstraints { make in
make.top.equalTo(236)
make.top.equalTo(276)
make.bottom.equalTo(-46)
make.left.equalTo(15)
make.right.equalTo(-15)
......@@ -385,6 +417,69 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
}
@objc func selectItem() {
YHInvitationWithGiftsSelectItemView.show(selectOne: 100, selectTwo: 100, startTime: "", endTime: "") { [weak self] one, two, start, end in
guard let self = self else { return }
if one == 100, two == 100 , start == "", end == "" {
recommendButton.isSelected = false
} else {
recommendButton.isSelected = true
if one == 0 {
viewModel.startTime = getOneMonthAgoDate()
viewModel.endTime = getCurrentDate()
} else if one == 1 {
viewModel.startTime = getSixMonthsAgoDate()
viewModel.endTime = getCurrentDate()
} else if one == 2 {
viewModel.startTime = getOneYearAgoDate()
viewModel.endTime = getCurrentDate()
} else if one == 3 {
viewModel.startTime = start
viewModel.endTime = end
} else {
viewModel.startTime = ""
viewModel.endTime = ""
}
viewModel.state = two
//请求刷新数据
}
}
}
func getCurrentDate() -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
return dateFormatter.string(from: Date())
}
// 获取一年前的日期
func getOneYearAgoDate() -> String {
let calendar = Calendar.current
let oneYearAgo = calendar.date(byAdding: .year, value: -1, to: Date())!
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
return dateFormatter.string(from: oneYearAgo)
}
// 获取半年前的日期
func getSixMonthsAgoDate() -> String {
let calendar = Calendar.current
let sixMonthsAgo = calendar.date(byAdding: .month, value: -6, to: Date())!
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
return dateFormatter.string(from: sixMonthsAgo)
}
// 获取一个月前的日期
func getOneMonthAgoDate() -> String {
let calendar = Calendar.current
let oneMonthAgo = calendar.date(byAdding: .month, value: -1, to: Date())!
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd"
return dateFormatter.string(from: oneMonthAgo)
}
}
extension YHInvitationWithGiftsSecondTableViewCell: UITableViewDelegate, UITableViewDataSource {
......
......@@ -12,6 +12,9 @@ class YHInvitationWithGiftsViewModel: YHBaseViewModel {
var model: [YHShareCashOutModel] = []
var overviewModel: YHShareOverviewModel = YHShareOverviewModel()
var recordModel: YHShareRecordModel = YHShareRecordModel()
var startTime: String = ""
var endTime: String = ""
var state: Int = 100
// 提取纪录
func getCashOutRecord(callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Share.cashOut
......
......@@ -24,6 +24,7 @@ enum YHDateType: Int {
class YHDatePickView: UIView {
var backDate: ((String) -> Void)?
var dismissBlock: (() -> Void)?
var centerView: UIView!
var titleLabel: UILabel!
var closeButton: UIButton!
......@@ -192,10 +193,11 @@ class YHDatePickView: UIView {
dismiss()
}
static func show(type:YHDateType, title: String? = nil, lastIsTaday: Bool = false, currentDay: String = "", callBack: @escaping ((String) -> Void)) {
static func show(type:YHDateType, title: String? = nil, lastIsTaday: Bool = false, currentDay: String = "", callBack: @escaping ((String) -> Void), dismiss: (() -> Void)? = nil) {
let view = YHDatePickView(frame: CGRect(x: 0, y: 0, width: KScreenWidth, height: KScreenHeight))
view.type = type
view.backDate = callBack
view.dismissBlock = dismiss
view.title = title ?? ""
let dateFormatter = DateFormatter()
switch type {
......@@ -215,6 +217,9 @@ class YHDatePickView: UIView {
}
@objc func dismiss() {
if self.dismissBlock != nil {
self.dismissBlock!()
}
removeFromSuperview()
}
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_select@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_select@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "invitation_with_gifts_select_normal@2x.png",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "invitation_with_gifts_select_normal@3x.png",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment