Commit d7a7aff6 authored by 刘俊宏's avatar 刘俊宏

修正新增商品页面数据-并开始做商品分类数据交互

parent 15fb54d9
...@@ -12,7 +12,7 @@ import ObjectMapper ...@@ -12,7 +12,7 @@ import ObjectMapper
class GeneralInfoModel: Mappable { class GeneralInfoModel: Mappable {
var code:Int? var code:Int?
var message : String? var message : String?
var data : GoodsListDataModel? var data : GeneralDataModel?
required init?( map: Map) { required init?( map: Map) {
......
...@@ -88,7 +88,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg ...@@ -88,7 +88,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
// Create the SwiftUI view that provides the window contents. // Create the SwiftUI view that provides the window contents.
tabBarController.viewControllers = [v1, v2, v3, v4, v5] tabBarController.viewControllers = [v1, v2, v3, v4, v5]
tabBarController.selectedIndex = 2 tabBarController.selectedIndex = 1
let contentView = tabBarController let contentView = tabBarController
if let windowScene = sceneC as? UIWindowScene { if let windowScene = sceneC as? UIWindowScene {
......
...@@ -10,11 +10,15 @@ import UIKit ...@@ -10,11 +10,15 @@ import UIKit
import Dollar import Dollar
class GoodsClassViewController: BaseViewController , UITableViewDelegate, UITableViewDataSource{ class GoodsClassViewController: BaseViewController , UITableViewDelegate, UITableViewDataSource{
var dataModelArray : Array<GeneralInfoCatsModel>? = []
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
navbar.title = "请选择商品分类" navbar.title = "请选择商品分类"
print("商品分类数据==\(dataModelArray)")
self.view.addSubview(navbar) self.view.addSubview(navbar)
for i in 0..<5 { for i in 0..<5 {
let model_1 = GoodsClassModel() let model_1 = GoodsClassModel()
model_1.name = "第一级商品=\(i)" model_1.name = "第一级商品=\(i)"
......
...@@ -14,10 +14,17 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -14,10 +14,17 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
var glSelectView:GLAlertSelectView? var glSelectView:GLAlertSelectView?
let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"] let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"]
let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"] let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"]
let tishixxArr = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量"]
let tishixxArr1 = ["请输入关键字","请输入物流费用","请选择国家","请选择商品状态","请选择运输方式"]
let sptpArr = ["商品封面图(限一张)","商品主图(限五张)"] let sptpArr = ["商品封面图(限一张)","商品主图(限五张)"]
let qtxxArr = ["关键字","物流费用","国家","商品状态","运输方式"] let qtxxArr = ["关键字","物流费用","国家","商品状态","运输方式"]
let ysszArr = ["用户付款是否需要审核","预设预付定金时间段","预设预付尾款时间段","预设预付尾款发货时间"] let ysszArr = ["用户付款是否需要审核","预设预付定金时间段","预设预付尾款时间段","预设预付尾款发货时间"]
//MARK:--保存按钮
@IBAction func submitAction(_ sender: Any) { @IBAction func submitAction(_ sender: Any) {
print("保存按钮submitAction")
} }
@IBOutlet weak var submitBtn: LGButton! @IBOutlet weak var submitBtn: LGButton!
@IBOutlet weak var listTbv: UITableView! @IBOutlet weak var listTbv: UITableView!
...@@ -35,29 +42,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -35,29 +42,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
@objc func bottomBtnClick(sender:UIButton){ @objc func bottomBtnClick(sender:UIButton){
print(sender.titleLabel?.text) print(sender.titleLabel?.text)
} }
var generalInfoModel : GeneralInfoModel? = nil
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
isYuShouShangPin = true //MARK:--获取新增商品的基本信息(品牌和分类等)
// if 浏览状态 { HUD.flash(.progress)
let w = fullScreenWidth / CGFloat(btmTitleArr.count) let UserToken = UserDefaults.standard.value(forKey: "user_token")
lgBtnLbl.isHidden = true GeneralInfo(["user_token":UserToken as Any], success: { (data) in
submitBtn.isHidden = true HUD.hide(animated: true)
for i in 0 ..< btmTitleArr.count{ self.generalInfoModel = data as! GeneralInfoModel
let btn = UIButton(frame: CGRect(x: CGFloat(i) * w, y: 0, width: w, height: btmView.bounds.size.height))
btn.tag = i }) { (error) in
btn.setTitle(btmTitleArr[i], for: .normal)
btn.titleLabel?.textColor = UIColor.clear
btn.addTarget(self, action: #selector(bottomBtnClick(sender:)), for: .touchUpInside)
let lbl = UILabel(frame: CGRect(x: CGFloat(i) * w, y: 0, width: w, height: 49*glscale))
lbl.textAlignment = .center
lbl.text = btmTitleArr[i]
lbl.font = UIFont.systemFont(ofSize: 13)
lbl.textColor = UIColor(named: "蓝色字体颜色")
btmView.addSubview(btn)
btmView.addSubview(lbl)
} }
// } isYuShouShangPin = true
navbar.title = "商品详情" navbar.title = "商品详情"
self.view.addSubview(navbar) self.view.addSubview(navbar)
listTbv.separatorStyle = .none listTbv.separatorStyle = .none
...@@ -97,6 +96,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -97,6 +96,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
if indexPath.row == 0 || indexPath.row == 4 { if indexPath.row == 0 || indexPath.row == 4 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell.nameLbl.text = spxxArr[indexPath.row] cell.nameLbl.text = spxxArr[indexPath.row]
cell.textTF.placeholder = tishixxArr[indexPath.row]
return cell return cell
} }
if indexPath.row > 4{ if indexPath.row > 4{
...@@ -106,6 +106,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -106,6 +106,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
} }
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = spxxArr[indexPath.row] cell.nameLbl.text = spxxArr[indexPath.row]
cell.contentLbl.text = tishixxArr[indexPath.row]
cell.delegate = self cell.delegate = self
return cell return cell
case 1: case 1:
...@@ -139,10 +141,14 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -139,10 +141,14 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
if indexPath.row < 2 { if indexPath.row < 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell.nameLbl.text = qtxxArr[indexPath.row] cell.nameLbl.text = qtxxArr[indexPath.row]
cell.textTF.placeholder = tishixxArr1[indexPath.row]
return cell return cell
}else{ }else{
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = qtxxArr[indexPath.row] cell.nameLbl.text = qtxxArr[indexPath.row]
cell.contentLbl.text = tishixxArr1[indexPath.row]
cell.delegate = self cell.delegate = self
return cell return cell
} }
...@@ -249,16 +255,17 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -249,16 +255,17 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
listTbv.endUpdates() listTbv.endUpdates()
} }
func CommendCellSendStr(content: String) { func CommendCellSendStr(content: String) {
print("CommendCellSendStr")
} }
override func backAction() { override func backAction() {
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
//MARK: -- 选择填或跳转
func btnClick(content: String, cell: TitleAndBtnCell) { if cell.nameLbl.text == "商品类型" { func btnClick(content: String, cell: TitleAndBtnCell) { if cell.nameLbl.text == "商品类型" {
if glSelectView == nil { if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds) let view = GLAlertSelectView(frame: self.view.bounds)
view.isMultipleSelect = true view.isMultipleSelect = true
view.titleLbl.text = "请选择仓库类型" view.titleLbl.text = "请选择商品类型"
view.delegate = self view.delegate = self
view.dataArr = ["预售","普通","期货","团购"] view.dataArr = ["预售","普通","期货","团购"]
self.view.addSubview(view) self.view.addSubview(view)
...@@ -266,7 +273,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -266,7 +273,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
} }
} }
if cell.nameLbl.text == "商品分类" { if cell.nameLbl.text == "商品分类" {
let vc = GoodsClassViewController()
vc.dataModelArray = generalInfoModel?.data?.cats
self.navigationController?.pushViewController(vc, animated: true)
} }
if cell.nameLbl.text == "品牌" { if cell.nameLbl.text == "品牌" {
......
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