Commit c9c486a2 authored by lujunye's avatar lujunye

商品详情串联

parent 8875f252
......@@ -10,7 +10,7 @@ import UIKit
import IQKeyboardManagerSwift
@objc protocol GLAlertSelectViewDelegate {
@objc optional func GLAlertSelectViewClick(selectNum:NSString,view:UIView)
@objc optional func GLAlertSelectViewClick(selectNum:NSString,view:GLAlertSelectView)
@objc optional func GLAlertMoreSelectViewClick(sender:NSArray,view:UIView)
@objc optional func GLAlertSelectViewClose(sender:UIButton)
......@@ -20,11 +20,14 @@ import IQKeyboardManagerSwift
@objc optional func KuWeiDataArr(sender:Array<Any>)
}
class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleAndSelectCellDelegate,KuWeiCellCellDelegate{
var isMultipleS:Bool = false
var contentView:UIView!
var delegate:GLAlertSelectViewDelegate?
var inputTextTF:UITextField?
var selectArray:NSMutableArray?
var selectNum:String? = ""
var selectLblText:String? = ""
var dataArr = Array<String>(){
didSet{
var tbvH = CGFloat(dataArr.count * 49)
......@@ -142,6 +145,7 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
cell.titleLbl.text = dataArr[indexPath.row]
cell.delegate = self
cell.tag = indexPath.row
if isMultipleS == true {
for item in selectArray! {
let row = "\(item)" as! NSString
if row.integerValue == indexPath.row {
......@@ -149,6 +153,13 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
cell.selectBtn.isSelected = true
}
}
}else{
let str = selectNum as! NSString
if str.integerValue == indexPath.row {
cell.titleLbl.textColor = UIColor(named: "蓝色字体颜色")
cell.selectBtn.isSelected = true
}
}
return cell
}
@IBAction func submitClick(_ sender: Any) {
......@@ -169,10 +180,12 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
if selectNum!.count > 0 {
for item in selectTbv.visibleCells {
let cel = item as! TitleAndSelectCell
cel.titleLbl.textColor = UIColor(named: "标题字颜色")
cel.selectBtn.isSelected = false
if cell == cel {
cell.selectBtn.isSelected = true
selectNum = "\(cell.tag)"
cel.selectBtn.isSelected = true
cel.titleLbl.textColor = UIColor(named: "蓝色字体颜色")
selectNum = "\(cel.tag)"
}
}
}else{
......
......@@ -178,7 +178,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
glSelectView = view
}
}
func GLAlertSelectViewClick(selectNum: NSString, view: UIView) {
func GLAlertSelectViewClick(selectNum: NSString, view: GLAlertSelectView) {
print("单选",selectNum)
glSelectView?.removeFromSuperview()
glSelectView = nil
......
......@@ -18,13 +18,22 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"]
let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"]
let tishixxArr = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量"]
let tishixxArr1 = ["请输入关键字","请输入物流费用","请选择国家","请选择商品状态","请选择运输方式"]
let tishixxArr:NSMutableArray = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量"]
let tishixxArr1:NSMutableArray = ["请输入关键字","请输入物流费用","请选择国家","请选择商品状态","请选择运输方式"]
let sptpArr = ["商品封面图(限一张)","商品主图(限五张)"]
let qtxxArr = ["关键字","物流费用","国家","商品状态","运输方式"]
let ysszArr = ["用户付款是否需要审核","预设预付定金时间段","预设预付尾款时间段","预设预付尾款发货时间"]
let ysszHolder = ["0","请选择时段","请选择时段","0"]
var itemTypeArr = NSMutableArray()
var shangPinStatus = "99"
var shangPinStatusArr = ["热销","爆款","新品","促销","外采","团购"]
var yunShuType = "99"
var yunShuTypeArr = ["冷链","常温","热链"]
//MARK:--保存按钮
@IBAction func submitAction(_ sender: Any) {
print("保存按钮submitAction")
......@@ -101,7 +110,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell.nameLbl.text = spxxArr[indexPath.row]
cell.textTF.placeholder = tishixxArr[indexPath.row]
cell.textTF.placeholder = tishixxArr[indexPath.row] as! String
return cell
}
......@@ -114,8 +123,8 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = spxxArr[indexPath.row]
cell.contentLbl.text = tishixxArr[indexPath.row]
cell.contentLbl.text = tishixxArr[indexPath.row] as! String
cell.tag = indexPath.row
cell.delegate = self
return cell
......@@ -148,7 +157,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
cell.guiGeLbl.text = "规格:\(String(describing: dict["guiGe"]!))kg/件"
cell.danWeiLbl.text = "单位:\(String(describing: dict["danWei"]!))"
cell.sellPriceLbl.text = "售价:¥\(dict["price"]!)"
// cell.itemIdx = dict["itemIdx"] as! Int
// cell.itemIdx = dict["itemIdx"] as! Int
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
......@@ -173,21 +182,20 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = ysszArr[indexPath.row]
cell.delegate = self
cell.contentLbl.text = ysszHolder[indexPath.row]
return cell
case 4:
if indexPath.row < 2 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell.nameLbl.text = qtxxArr[indexPath.row]
cell.textTF.placeholder = tishixxArr1[indexPath.row]
cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String
cell.tag = indexPath.row
return cell
}else{
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = qtxxArr[indexPath.row]
cell.contentLbl.text = tishixxArr1[indexPath.row]
cell.tag = indexPath.row
cell.contentLbl.text = tishixxArr1[indexPath.row] as! String
cell.delegate = self
......@@ -330,12 +338,16 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
override func backAction() {
self.navigationController?.popViewController(animated: true)
}
var itemTypeArr = NSMutableArray()
//MARK: -- 选择填或跳转
func btnClick(content: String, cell: TitleAndBtnCell) { if cell.nameLbl.text == "商品类型" {
func btnClick(content: String, cell: TitleAndBtnCell) {
if cell.nameLbl.text == "商品类型" {
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.isMultipleS = true
view.titleLbl.text = "请选择商品类型"
view.delegate = self
view.dataArr = ["预售","普通","期货","团购"]
......@@ -366,10 +378,24 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
if cell.nameLbl.text == "商品状态" {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.titleLbl.text = "请选择商品类型"
view.delegate = self
view.dataArr = shangPinStatusArr
view.selectNum = shangPinStatus
self.view.addSubview(view)
glSelectView = view
}
if cell.nameLbl.text == "运输方式" {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.titleLbl.text = "请选择运输方式"
view.delegate = self
view.dataArr = yunShuTypeArr
view.selectNum = yunShuType
self.view.addSubview(view)
glSelectView = view
}
if cell.nameLbl.text == "预设预付定金时间段" {
......@@ -389,21 +415,51 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
func GLAlertSelectViewClick(selectNum: NSString, view: UIView) {
func GLAlertSelectViewClick(selectNum: NSString, view: GLAlertSelectView) {
print("单选",selectNum)
print(view.titleLbl.text)
switch view.titleLbl.text {
case "请选择商品类型":
shangPinStatus = selectNum as String
tishixxArr1.replaceObject(at: view.tag, with: shangPinStatusArr[selectNum.integerValue])
break
case "请选择运输方式":
yunShuType = selectNum as String
tishixxArr1.replaceObject(at: view.tag, with: yunShuTypeArr[selectNum.integerValue])
break
default:
break
}
glSelectView?.removeFromSuperview()
glSelectView = nil
listTbv.reloadData()
}
var isYuShou:Bool = false
func GLAlertMoreSelectViewClick(sender: NSArray, view:UIView) {
print("多选",sender)
itemTypeArr = sender as! NSMutableArray
let str = "\(sender.firstObject)" as! NSString
if str.integerValue != 99 {
let str = "\(sender.firstObject!)" as! NSString
if str != "99" {
isYuShou = true
}else{
isYuShou = false
}
let contentArr = ["预售","普通","期货","团购"]
let titles = NSMutableArray()
titles.removeAllObjects()
for num in itemTypeArr {
let str = "\(num)" as! NSString
if str != "99"{
titles.add(contentArr[str.integerValue])
}
}
tishixxArr.replaceObject(at: view.tag, with: titles.componentsJoined(by: ","))
if itemTypeArr.componentsJoined(by: "_") == "99_99_99_99" {
tishixxArr.replaceObject(at: view.tag, with:"请选择商品类型")
}
glSelectView?.removeFromSuperview()
glSelectView = nil
listTbv.reloadData()
......@@ -461,7 +517,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let vc = CreatNewSpecsViewController()
vc.barTitle = "编辑规格"
vc.datasArr = guiGeArr
vc.isYuShouSetting = isYuShou
let dataDict:NSDictionary!
if selectIdx?.item != nil {
dataDict = guiGeArr[selectIdx!.item] as! NSDictionary
......@@ -476,6 +531,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
vc.danWei = dataDict["danWei"] as! String
let arr = dataDict["jieTiArr"] as! NSMutableArray
let arr2 = dataDict["specalArr"] as! NSMutableArray
vc.isNonYuShou = dataDict["isNonYuShou"] as! Bool
vc.isYuShouSetting = dataDict["isYuShouSetting"] as! Bool
vc.yuShouPrice = dataDict["yuShouPrice"] as! String
vc.specalArr = arr2
vc.jieTiArr = arr
if selectIdx == nil {
......@@ -500,7 +558,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
let vc = CreatNewSpecsViewController()
vc.barTitle = "新增规格"
vc.delegate = self
print("abc == ",isYuShou)
vc.isYuShouSetting = isYuShou
vc.isNonYuShou = isYuShou
vc.datasArr = guiGeArr
self.navigationController?.pushViewController(vc, animated: true)
}
......
......@@ -72,19 +72,19 @@ class PinPaiListViewController: BaseViewController,UISearchBarDelegate,SearchBar
return 49
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dataModelArray!.count
return 12
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtnCell") as! TitleAndBtnCell
let rowModel = dataModelArray![indexPath.row] as! GeneralInfoBrandModel
cell.nameLbl.text = rowModel.brand_name
cell.contentLbl.text = ""
cell.btn.isUserInteractionEnabled = false
cell.selectionStyle = .gray
if isSelectData {
cell.arrowImg.isHidden = true
}
// let rowModel = dataModelArray![indexPath.row] as! GeneralInfoBrandModel
// cell.nameLbl.text = rowModel.brand_name
// cell.contentLbl.text = ""
// cell.btn.isUserInteractionEnabled = false
// cell.selectionStyle = .gray
// if isSelectData {
// cell.arrowImg.isHidden = true
// }
return cell
}
var selectModel : GeneralInfoBrandModel? = nil
......
......@@ -9,11 +9,12 @@
import UIKit
@objc protocol YuShouCellDelegate {
@objc optional func YuShouCellSwitchStatus(sender:UISwitch)
@objc optional func YuShouCellTFContent(Price:NSString)
}
class YuShouCell: UITableViewCell {
var delegate:YuShouCellDelegate?
@IBOutlet weak var inputTF3: UITextField!
@IBOutlet weak var inputTF2: NSLayoutConstraint!
@IBOutlet weak var inputTF2: UITextField!
@IBOutlet weak var inputTF1: UITextField!
@IBOutlet weak var infoSw: UISwitch!
override func awakeFromNib() {
......@@ -22,8 +23,15 @@ var delegate:YuShouCellDelegate?
infoSw.transform = CGAffineTransform(scaleX: 0.8, y: 0.8)
infoSw.addTarget(self, action: #selector(switchChange(sender:)), for: .valueChanged)
inputTF1.addTarget(self, action: #selector(textTfValueChange(sender:)), for: .editingChanged)
inputTF2.addTarget(self, action: #selector(textTfValueChange(sender:)), for: .editingChanged)
inputTF3.addTarget(self, action: #selector(textTfValueChange(sender:)), for: .editingChanged)
// Initialization code
}
@objc func textTfValueChange(sender:UITextField){
delegate?.YuShouCellTFContent?(Price: "\(inputTF1.text!)_\(inputTF2.text!)_\(inputTF3.text!)" as NSString)
}
@objc func switchChange(sender:UISwitch){
delegate?.YuShouCellSwitchStatus?(sender: sender)
}
......
......@@ -145,7 +145,7 @@
<connections>
<outlet property="infoSw" destination="05q-1N-wvO" id="HtL-79-Qch"/>
<outlet property="inputTF1" destination="COH-zY-OUo" id="hNT-E8-8k9"/>
<outlet property="inputTF2" destination="b8D-hX-Yk3" id="YpH-fW-FaR"/>
<outlet property="inputTF2" destination="Qb7-aM-usa" id="svg-gl-51Y"/>
<outlet property="inputTF3" destination="mht-f5-qwh" id="lPo-lt-ttH"/>
</connections>
<point key="canvasLocation" x="131.8840579710145" y="112.83482142857142"/>
......@@ -153,10 +153,10 @@
</objects>
<resources>
<namedColor name="标题字颜色">
<color red="0.1803921568627451" green="0.1803921568627451" blue="0.1803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="标题字颜色">
<color red="0.18000000715255737" green="0.18000000715255737" blue="0.18000000715255737" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color red="0.1803921568627451" green="0.1803921568627451" blue="0.1803921568627451" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="灰色分界线">
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
......
......@@ -251,7 +251,7 @@ class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableVie
print("AddGuiGeCellClick")
}
func GLAlertSelectViewClick(selectNum: NSString, view: UIView) {
func GLAlertSelectViewClick(selectNum: NSString, view: GLAlertSelectView) {
print("单选",selectNum)
glSelectView?.removeFromSuperview()
glSelectView = nil
......
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