Commit 3a80d9dd authored by Steven杜宇's avatar Steven杜宇

Merge branch 'develop' of http://gitlab.galaxy-immi.com/mobile-group/galaxy-iOS into develop

parents 78be0533 45a45ead
......@@ -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 */; };
......@@ -932,6 +933,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>"; };
......@@ -1379,6 +1381,7 @@
047AA3D42C4A3643009C4554 /* YHInvitationWithGiftsDetailView.swift */,
047AA3D62C4A4399009C4554 /* YHInvitationWithGiftsShareView.swift */,
047AA3F72C5CC7B0009C4554 /* YHShareStepView.swift */,
047AA3F92C60739E009C4554 /* YHInvitationWithGiftsSelectItemView.swift */,
);
path = V;
sourceTree = "<group>";
......@@ -3843,6 +3846,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!
......@@ -29,6 +31,10 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
var viewModel: YHInvitationWithGiftsViewModel = YHInvitationWithGiftsViewModel()
var page = 1
var list: [YHShareRecordListModel] = []
var selectOne: Int?
var selectTwo: Int?
var startTime: String = ""
var endTime: String = ""
var headData: YHShareOverviewModel? {
didSet {
......@@ -187,6 +193,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 +305,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 +326,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 +345,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 +364,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 +377,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 +398,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 +421,82 @@ class YHInvitationWithGiftsSecondTableViewCell: UITableViewCell {
}
@objc func selectItem() {
YHInvitationWithGiftsSelectItemView.show(selectOne: selectOne ?? 100, selectTwo: selectTwo ?? 100, startTime: startTime, endTime: endTime) { [weak self] one, two, start, end in
guard let self = self else { return }
self.selectOne = one
self.selectTwo = two
self.startTime = start
self.endTime = end
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
self.page = 1
//请求刷新数据
self.viewModel.postRecord(page: 1) {[weak self] success, error in
guard let self = self else { return }
self.tableView.es.stopLoadingMore()
if self.viewModel.recordModel.page_count == self.page {
self.tableView.es.noticeNoMoreData()
self.tableView.footer?.alpha = 1
}
self.tableData = self.viewModel.recordModel
self.tableView.reloadData()
}
}
}
}
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
......@@ -60,8 +63,12 @@ class YHInvitationWithGiftsViewModel: YHBaseViewModel {
func postRecord(page: Int, callBackBlock:@escaping (_ success: Bool,_ error:YHErrorModel?)->()) {
let strUrl = YHBaseUrlManager.shared.curURL() + YHAllApiName.Share.record
let registered_date: [String: Any] = ["begin_date": self.startTime,
"end_date": self.endTime]
let param: [String: Any] = ["page": page,
"pagesize": 20]
"pagesize": 20,
"registered_date": registered_date,
"status": self.state + 1 < 4 ? self.state + 1: 0]
let _ = YHNetRequest.postRequest(url: strUrl, params: param) { [weak self] json, code in
guard let self = self else { return }
//1. json字符串 转 对象
......
......@@ -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