Commit d49ad703 authored by lujunye's avatar lujunye

键盘

parent e665c46f
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
9C3AD0BD567C3C122CCE3169 /* Pods_GeliBusinessPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DA2D518C6159EA47DCD8E0C /* Pods_GeliBusinessPlatform.framework */; }; 9C3AD0BD567C3C122CCE3169 /* Pods_GeliBusinessPlatform.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DA2D518C6159EA47DCD8E0C /* Pods_GeliBusinessPlatform.framework */; };
E00B0B1B24629E99006DC846 /* SJMapCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E00B0B1924629E99006DC846 /* SJMapCell.swift */; }; E00B0B1B24629E99006DC846 /* SJMapCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E00B0B1924629E99006DC846 /* SJMapCell.swift */; };
E00B0B1C24629E99006DC846 /* SJMapCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E00B0B1A24629E99006DC846 /* SJMapCell.xib */; }; E00B0B1C24629E99006DC846 /* SJMapCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E00B0B1A24629E99006DC846 /* SJMapCell.xib */; };
E00CDE732474BBB60018AEF8 /* EPViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E00CDE712474BBB60018AEF8 /* EPViewController.swift */; };
E00CDE742474BBB60018AEF8 /* EPViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E00CDE722474BBB60018AEF8 /* EPViewController.xib */; };
E00D85DF244561FD00F5F816 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E00D85DE244561FD00F5F816 /* AppDelegate.swift */; }; E00D85DF244561FD00F5F816 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E00D85DE244561FD00F5F816 /* AppDelegate.swift */; };
E00D85E1244561FD00F5F816 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E00D85E0244561FD00F5F816 /* SceneDelegate.swift */; }; E00D85E1244561FD00F5F816 /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E00D85E0244561FD00F5F816 /* SceneDelegate.swift */; };
E00D85E5244561FE00F5F816 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E00D85E4244561FE00F5F816 /* Assets.xcassets */; }; E00D85E5244561FE00F5F816 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E00D85E4244561FE00F5F816 /* Assets.xcassets */; };
...@@ -148,8 +150,6 @@ ...@@ -148,8 +150,6 @@
E07B1E70245929060055BA3C /* GYSGLViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E07B1E6E245929060055BA3C /* GYSGLViewController.xib */; }; E07B1E70245929060055BA3C /* GYSGLViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E07B1E6E245929060055BA3C /* GYSGLViewController.xib */; };
E07B1E78245966E60055BA3C /* XinCaiGouViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E07B1E76245966E60055BA3C /* XinCaiGouViewController.swift */; }; E07B1E78245966E60055BA3C /* XinCaiGouViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E07B1E76245966E60055BA3C /* XinCaiGouViewController.swift */; };
E07B1E79245966E60055BA3C /* XinCaiGouViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E07B1E77245966E60055BA3C /* XinCaiGouViewController.xib */; }; E07B1E79245966E60055BA3C /* XinCaiGouViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E07B1E77245966E60055BA3C /* XinCaiGouViewController.xib */; };
E07C7F86246BD8AB000B0714 /* EditProductViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E07C7F84246BD8AB000B0714 /* EditProductViewController.swift */; };
E07C7F87246BD8AB000B0714 /* EditProductViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E07C7F85246BD8AB000B0714 /* EditProductViewController.xib */; };
E088CC8D24470BF0000DAA8A /* CodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E088CC8C24470BF0000DAA8A /* CodeView.swift */; }; E088CC8D24470BF0000DAA8A /* CodeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E088CC8C24470BF0000DAA8A /* CodeView.swift */; };
E088CC932447124D000DAA8A /* BindViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E088CC912447124D000DAA8A /* BindViewController.swift */; }; E088CC932447124D000DAA8A /* BindViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E088CC912447124D000DAA8A /* BindViewController.swift */; };
E088CC942447124D000DAA8A /* BindViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E088CC922447124D000DAA8A /* BindViewController.xib */; }; E088CC942447124D000DAA8A /* BindViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E088CC922447124D000DAA8A /* BindViewController.xib */; };
...@@ -490,6 +490,8 @@ ...@@ -490,6 +490,8 @@
6FA79EFC99FED0CA28AA1444 /* Pods-GeliBusinessPlatform.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GeliBusinessPlatform.debug.xcconfig"; path = "Target Support Files/Pods-GeliBusinessPlatform/Pods-GeliBusinessPlatform.debug.xcconfig"; sourceTree = "<group>"; }; 6FA79EFC99FED0CA28AA1444 /* Pods-GeliBusinessPlatform.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-GeliBusinessPlatform.debug.xcconfig"; path = "Target Support Files/Pods-GeliBusinessPlatform/Pods-GeliBusinessPlatform.debug.xcconfig"; sourceTree = "<group>"; };
E00B0B1924629E99006DC846 /* SJMapCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SJMapCell.swift; sourceTree = "<group>"; }; E00B0B1924629E99006DC846 /* SJMapCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SJMapCell.swift; sourceTree = "<group>"; };
E00B0B1A24629E99006DC846 /* SJMapCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SJMapCell.xib; sourceTree = "<group>"; }; E00B0B1A24629E99006DC846 /* SJMapCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SJMapCell.xib; sourceTree = "<group>"; };
E00CDE712474BBB60018AEF8 /* EPViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EPViewController.swift; sourceTree = "<group>"; };
E00CDE722474BBB60018AEF8 /* EPViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EPViewController.xib; sourceTree = "<group>"; };
E00D85DB244561FD00F5F816 /* GeliBusinessPlatform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GeliBusinessPlatform.app; sourceTree = BUILT_PRODUCTS_DIR; }; E00D85DB244561FD00F5F816 /* GeliBusinessPlatform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GeliBusinessPlatform.app; sourceTree = BUILT_PRODUCTS_DIR; };
E00D85DE244561FD00F5F816 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; }; E00D85DE244561FD00F5F816 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
E00D85E0244561FD00F5F816 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; }; E00D85E0244561FD00F5F816 /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
...@@ -636,8 +638,6 @@ ...@@ -636,8 +638,6 @@
E07B1E6E245929060055BA3C /* GYSGLViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GYSGLViewController.xib; sourceTree = "<group>"; }; E07B1E6E245929060055BA3C /* GYSGLViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = GYSGLViewController.xib; sourceTree = "<group>"; };
E07B1E76245966E60055BA3C /* XinCaiGouViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XinCaiGouViewController.swift; sourceTree = "<group>"; }; E07B1E76245966E60055BA3C /* XinCaiGouViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XinCaiGouViewController.swift; sourceTree = "<group>"; };
E07B1E77245966E60055BA3C /* XinCaiGouViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XinCaiGouViewController.xib; sourceTree = "<group>"; }; E07B1E77245966E60055BA3C /* XinCaiGouViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XinCaiGouViewController.xib; sourceTree = "<group>"; };
E07C7F84246BD8AB000B0714 /* EditProductViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditProductViewController.swift; sourceTree = "<group>"; };
E07C7F85246BD8AB000B0714 /* EditProductViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EditProductViewController.xib; sourceTree = "<group>"; };
E088CC8C24470BF0000DAA8A /* CodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeView.swift; sourceTree = "<group>"; }; E088CC8C24470BF0000DAA8A /* CodeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CodeView.swift; sourceTree = "<group>"; };
E088CC912447124D000DAA8A /* BindViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BindViewController.swift; sourceTree = "<group>"; }; E088CC912447124D000DAA8A /* BindViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BindViewController.swift; sourceTree = "<group>"; };
E088CC922447124D000DAA8A /* BindViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BindViewController.xib; sourceTree = "<group>"; }; E088CC922447124D000DAA8A /* BindViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BindViewController.xib; sourceTree = "<group>"; };
...@@ -1845,8 +1845,8 @@ ...@@ -1845,8 +1845,8 @@
E0F97B072451620B001BD600 /* ProductDetailViewController.xib */, E0F97B072451620B001BD600 /* ProductDetailViewController.xib */,
E0F1BE4624692379003015B2 /* ItemCell.swift */, E0F1BE4624692379003015B2 /* ItemCell.swift */,
E0F1BE4724692379003015B2 /* ItemCell.xib */, E0F1BE4724692379003015B2 /* ItemCell.xib */,
E07C7F84246BD8AB000B0714 /* EditProductViewController.swift */, E00CDE712474BBB60018AEF8 /* EPViewController.swift */,
E07C7F85246BD8AB000B0714 /* EditProductViewController.xib */, E00CDE722474BBB60018AEF8 /* EPViewController.xib */,
); );
path = "商品详情"; path = "商品详情";
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2509,7 +2509,6 @@ ...@@ -2509,7 +2509,6 @@
E09B03C12445B96500211A51 /* FgPassViewController.xib in Resources */, E09B03C12445B96500211A51 /* FgPassViewController.xib in Resources */,
E06524EE2458008900CA22E2 /* RuKuViewController.xib in Resources */, E06524EE2458008900CA22E2 /* RuKuViewController.xib in Resources */,
E06524F624580BB600CA22E2 /* BaoZhiQiCell.xib in Resources */, E06524F624580BB600CA22E2 /* BaoZhiQiCell.xib in Resources */,
E07C7F87246BD8AB000B0714 /* EditProductViewController.xib in Resources */,
E0D197C7244845FD002B080C /* PersonCenterViewController.xib in Resources */, E0D197C7244845FD002B080C /* PersonCenterViewController.xib in Resources */,
F93E320B2473D83D00524DFC /* GeliAlertTextFiled.xib in Resources */, F93E320B2473D83D00524DFC /* GeliAlertTextFiled.xib in Resources */,
E07B1E5F24591AA50055BA3C /* KeHuXQViewController.xib in Resources */, E07B1E5F24591AA50055BA3C /* KeHuXQViewController.xib in Resources */,
...@@ -2563,6 +2562,7 @@ ...@@ -2563,6 +2562,7 @@
F95567A82453DA86009674AB /* WarehoseMangementListVC.xib in Resources */, F95567A82453DA86009674AB /* WarehoseMangementListVC.xib in Resources */,
E0C4F4BE244EF53D00CC7E2F /* BindStepTwoViewController.xib in Resources */, E0C4F4BE244EF53D00CC7E2F /* BindStepTwoViewController.xib in Resources */,
E00B0B1C24629E99006DC846 /* SJMapCell.xib in Resources */, E00B0B1C24629E99006DC846 /* SJMapCell.xib in Resources */,
E00CDE742474BBB60018AEF8 /* EPViewController.xib in Resources */,
E02C882B2456B4BA00925766 /* WLGZCell.xib in Resources */, E02C882B2456B4BA00925766 /* WLGZCell.xib in Resources */,
E042F735245274F200CDFA12 /* YunDanLieBiaoCell.xib in Resources */, E042F735245274F200CDFA12 /* YunDanLieBiaoCell.xib in Resources */,
E0D197CB24484D90002B080C /* PersonCenterCell.xib in Resources */, E0D197CB24484D90002B080C /* PersonCenterCell.xib in Resources */,
...@@ -2855,7 +2855,6 @@ ...@@ -2855,7 +2855,6 @@
F961D271245016B7007FBE70 /* SelectContentView.swift in Sources */, F961D271245016B7007FBE70 /* SelectContentView.swift in Sources */,
F933F6C02452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift in Sources */, F933F6C02452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift in Sources */,
E08B0674244A98B2001D2E01 /* WareHouseSpCell.swift in Sources */, E08B0674244A98B2001D2E01 /* WareHouseSpCell.swift in Sources */,
E07C7F86246BD8AB000B0714 /* EditProductViewController.swift in Sources */,
E0A2E81E24552F0A00D6DB34 /* TilteAndTextViewCell.swift in Sources */, E0A2E81E24552F0A00D6DB34 /* TilteAndTextViewCell.swift in Sources */,
F9531F3D2465108800724BEE /* JXPhotoBrowserAnimatedTransitioning.swift in Sources */, F9531F3D2465108800724BEE /* JXPhotoBrowserAnimatedTransitioning.swift in Sources */,
E0D197CA24484D90002B080C /* PersonCenterCell.swift in Sources */, E0D197CA24484D90002B080C /* PersonCenterCell.swift in Sources */,
...@@ -2873,6 +2872,7 @@ ...@@ -2873,6 +2872,7 @@
E0A2E82724555B4400D6DB34 /* KuCunShangPinCell.swift in Sources */, E0A2E82724555B4400D6DB34 /* KuCunShangPinCell.swift in Sources */,
F950FDA72451494500C40530 /* GeliPayInfoModel.swift in Sources */, F950FDA72451494500C40530 /* GeliPayInfoModel.swift in Sources */,
F9531F432465108800724BEE /* JXPhotoBrowserImageCell.swift in Sources */, F9531F432465108800724BEE /* JXPhotoBrowserImageCell.swift in Sources */,
E00CDE732474BBB60018AEF8 /* EPViewController.swift in Sources */,
E07B1E6B245926330055BA3C /* GYSGLCell.swift in Sources */, E07B1E6B245926330055BA3C /* GYSGLCell.swift in Sources */,
F956D5AC246A2D9C003FF510 /* LMNImageLine.m in Sources */, F956D5AC246A2D9C003FF510 /* LMNImageLine.m in Sources */,
E09B03C02445B96500211A51 /* FgPassViewController.swift in Sources */, E09B03C02445B96500211A51 /* FgPassViewController.swift in Sources */,
......
...@@ -42,7 +42,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg ...@@ -42,7 +42,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
} }
//MARK:--loginVC //MARK:--loginVC
func addLoginVc (isAgain:Bool){ func addLoginVc (isAgain:Bool){
//
let vc = LoginViewController() let vc = LoginViewController()
vc.delegate = self vc.delegate = self
let contentView = vc let contentView = vc
......
...@@ -408,13 +408,17 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect ...@@ -408,13 +408,17 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
} }
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
print("选中===\(indexPath)") print("选中===\(indexPath)")
let vc = ProductDetailViewController() let vc = EPViewController()
let data = items[indexPath.row]
vc.goods_id = data.goods_id
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
//MARK:---cell delegate 选中 //MARK:---cell delegate 选中
func selectListsIndex(index: Int) { func selectListsIndex(index: Int) {
let vc = ProductDetailViewController() let vc = EPViewController()
let data = items[index]
vc.goods_id = data.goods_id
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} }
//MARK:-- cell delegate 上下架,入库 //MARK:-- cell delegate 上下架,入库
......
//
// EPViewController.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/5/20.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
import LGButton
import Photos
import IQKeyboardManagerSwift
import Dollar
class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate,TitleAndTFCellDelegate,YuShouWeiKuanFaHuoCellDelegate,UITextFieldDelegate,ShowTimeSelectViewDelegate {
@IBOutlet weak var btmBtnViewH: NSLayoutConstraint!
@IBOutlet weak var tbvBGView: UIView!
@IBOutlet weak var btmBtnBGView: UIView!
var generalInfoModel : GeneralInfoModel? = nil
var goods_id:Int?
func GLASClose(view: GLAlertSelectView, selectnum: Int, selectArr: Array<Int>) {
if view.titleLbl.text == "请选择商品类型" {
print(itemTypeArr,selectArr)
itemTypeArr = selectArr
}
if selectnum != 10086 {
if view.titleLbl.text == "请选择国家" {
print(itemTypeArr,selectArr)
countrySelect = selectnum
}
if view.titleLbl.text == "请选择运输方式" {
yunShuType = selectnum
}
if view.titleLbl.text == "请选择商品状态" {
shangPinStatus = selectnum
}
}
view.removeFromSuperview()
glSelectView = nil
}
let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"]
let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"]
var tishixxArr = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量"]
var tishixxArr1 = ["请输入关键字","请输入物流费用","请选择国家","请选择商品状态","请选择运输方式"]
let sptpArr = ["商品封面图(限一张)","商品主图(限五张)"]
let qtxxArr = ["关键字","物流费用","国家","商品状态","运输方式"]
let ysszArr = ["用户付款是否需要审核","预设预付定金时间段","预设预付尾款时间段","预设预付尾款发货时间"]
var ysszHolder = ["0","请选择时段","请选择时段","0"]
var shangPinStatusArr:Array<GeneralInfoGsModel>? = []
var yunShuTypeArr = ["冷链","常温","热链"]
var countryArr = ["中国"]
var layout = UICollectionViewFlowLayout()
var glSelectView:GLAlertSelectView?
var selectIdx:IndexPath? = IndexPath(item: 0, section: 0) //多规格状态下点击collectionCell的row记录
var isYuShouShangPin:Bool?//是否为预售商品
var itemTypeArr:Array<Int>? = []//多选
var isYuShou:Bool = false//是否预售
var shangPinStatus:Int? = 0//商品状态
var yunShuType:Int? = 0//运输类型
var maxFiveImgsArr:Array<UIImage> = []//多图
var singleImgArr:Array<UIImage> = []//单张图
var itemName = ""//商品名称
var qiMaiShuLiang = ""//起卖数量
var shiFouQZ = false//是否清真
var shiFouXJ = false//是否询价
var keyWord = ""//关键字
var wuLiuPrice = ""//物流费用
var countrySelect:Int?//选择国家
var guiGeArr:Array<GuiGeModel> = []//规格数组,根据规格资料数量控制右上角新增按钮是否显示
var shiFouSH = false //是否审核
var faHuoTime = ""//发货时间
//预售时间段
var dj_time_start:Int? = 0
var dj_time_end:Int? = 0
var wk_time_start:Int? = 0
var wk_time_end:Int? = 0
var listTbv:UITableView!
override func viewDidLoad() {
super.viewDidLoad()
//MARK:--获取新增商品的基本信息(品牌和分类等)
HUD.flash(.progress)
//MARK:--新增商品和编辑商品所需要的基本信息(无)就页面不正常显示
// let UserToken = UserDefaults.standard.value(forKey: "user_token")
// GeneralInfo(["user_token":UserToken as Any], success: { (data) in
// HUD.hide(animated: true)
// self.generalInfoModel = (data as! GeneralInfoModel)
// self.shangPinStatusArr = (self.generalInfoModel?.data!.gs)!
//
// }) { (error) in
//
// }
//是否为预售商品
isYuShouShangPin = false
navbar.title = "商品详情"
self.view.addSubview(navbar)
if listTbv == nil {
let tbv = UITableView()
tbvBGView.addSubview(tbv)
tbv.snp.makeConstraints { (make) in
make.top.left.bottom.right.equalTo(0)
}
listTbv = tbv
}
listTbv.separatorStyle = .none
listTbv.delegate = self
listTbv.dataSource = self
SetTopFrameView(view: tbvBGView, btmView: btmBtnBGView)
listTbv.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTF")
listTbv.register(UINib(nibName: "TitleAndSwitchCell", bundle: nil), forCellReuseIdentifier: "TitleAndSwitch")
listTbv.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtn")
listTbv.register(UINib(nibName: "AddImgCell", bundle: nil), forCellReuseIdentifier: "AddImg")
listTbv.register(UINib(nibName: "AddGuiGeCell", bundle: nil), forCellReuseIdentifier: "AddGuiGe")
listTbv.register(UINib(nibName: "YuShouWeiKuanFaHuoCell", bundle: nil), forCellReuseIdentifier: "YuShouWeiKuanFaHuoCell")
listTbv.register(UINib(nibName: "ShangPinGguiGeCell", bundle: nil), forCellReuseIdentifier: "ShangPinGguiGeCell")
// Do any additional setup after loading the view.
}
//MARK: - cell delegate
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
switch indexPath.section {
case 0:
if indexPath.row == 0 || indexPath.row == 4 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
cell.textTF.delegate = self
cell.nameLbl.text = spxxArr[indexPath.row]
//商家名称
switch cell.nameLbl.text {
case "商品名称":
cell.textTF.text = itemName
cell.textTF.returnKeyType = .done
break
case "起卖数量":
cell.textTF.text = qiMaiShuLiang
cell.textTF.keyboardType = .numberPad
break
default:
break
}
cell.textTF.placeholder = tishixxArr[indexPath.row] as! String
cell.delegate = self
return cell
}
if indexPath.row > 4{
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
cell.namelbl.text = spxxArr[indexPath.row]
cell.delegate = self
switch cell.namelbl.text {
case "是否清真":
cell.infoSw.isOn = shiFouQZ
break
case "是否询价":
cell.infoSw.isOn = shiFouXJ
break
default:
break
}
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = spxxArr[indexPath.row]
cell.contentLbl.text = tishixxArr[indexPath.row] as! String
cell.tag = indexPath.row
cell.delegate = self
return cell
case 1:
let cell = tableView.dequeueReusableCell(withIdentifier: "AddImg") as! AddImgCell
cell.nameLbl.text = sptpArr[indexPath.row]
if indexPath.row == 0 {
cell.isSingle = true
if singleImgArr.count > 0{
cell.imgs = singleImgArr
cell.addBtn.isHidden = true
}else{
cell.scrollView?.isHidden = true
cell.addBtn.isHidden = false
}
}else{
cell.isSingle = false
if maxFiveImgsArr.count > 0{
cell.imgs = maxFiveImgsArr
}else{
cell.scrollView?.isHidden = true
cell.addBtnX.constant = 15
}
}
cell.delegate = self
cell.addBtn.tag = indexPath.row
cell.isEdit = true
return cell
case 2:
if guiGeArr.count > 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "ShangPinGguiGeCell") as! ShangPinGguiGeCell
cell.delegate = self
var dict:GuiGeModel!
if selectIdx != nil{
print(selectIdx?.item)
dict = guiGeArr[selectIdx!.item]
}else{
dict = guiGeArr.first
}
cell.tempLbl.text = "冷藏:\(dict.wenDu)℃"
cell.weightLbl.text = "重量(kg):\(dict.weight)kg"
cell.guiGeLbl.text = "规格:\(dict.guiGe)kg/件"
cell.danWeiLbl.text = "单位:\(dict.danWei)"
cell.sellPriceLbl.text = "售价:¥\(dict.price)"
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
cell.imgBtn.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside)
cell.imgBtn.setImage(UIImage(named: "xinzeng"), for: .normal)
return cell
case 3:
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
cell.namelbl.text = ysszArr[indexPath.row]
cell.delegate = self
cell.infoSw.isOn = shiFouSH
return cell
}
if indexPath.row == 3 {
let cell = tableView.dequeueReusableCell(withIdentifier: "YuShouWeiKuanFaHuoCell") as! YuShouWeiKuanFaHuoCell
cell.nameLbl.text = ysszArr[indexPath.row]
cell.textTF.keyboardType = .numberPad
cell.delegate = self
cell.textTF.text = faHuoTime
return cell
}
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.delegate = self
cell.textTF.returnKeyType = .done
switch cell.nameLbl.text {
case "关键字":
cell.textTF.text = keyWord
break
case "物流费用":
cell.textTF.text = wuLiuPrice
cell.textTF.keyboardType = .numbersAndPunctuation
break
default:
break
}
cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String
cell.tag = indexPath.row
cell.delegate = self
return cell
}else{
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = qtxxArr[indexPath.row]
cell.tag = indexPath.row
cell.contentLbl.text = tishixxArr1[indexPath.row] as! String
cell.delegate = self
return cell
}
default:
let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
cell.imgBtn.setImage(UIImage(named: "XiaYunDanViewController"), for: .normal)
cell.delegate = self
cell.imgBtn.tag = indexPath.row
cell.imgBtn.setImage(UIImage(named: "tjxq"), for: .normal)
cell.btmH.constant = 25
return cell
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
//MARK: - 底部广告软文跳转
func AddGuiGeCellClick(cell: AddGuiGeCell) {
print("底部广告软文跳转")
let vc = LMNoteViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
//MARK: -- 点击按钮事件,跳转或者展示选择界面
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.isShangPinType = true
view.titleLbl.text = "请选择商品类型"
view.delegate = self
view.dataArr = ["预售","普通","期货","团购"]
if itemTypeArr?.count == 0 {
for _ in view.dataArr {
itemTypeArr?.append(99)
}
}
view.selectArray = itemTypeArr
view.tempArr = itemTypeArr
self.view.addSubview(view)
glSelectView = view
}
}
if cell.nameLbl.text == "商品分类" {
let vc = GoodsClassViewController()
vc.delegate = self
vc.selectModel = selectGoodsClassModel
vc.dataModelArray = generalInfoModel?.data?.cats
self.navigationController?.pushViewController(vc, animated: true)
}
if cell.nameLbl.text == "品牌" {
let vc = PinPaiListViewController()
vc.isSelectData = true
vc.delegate = self
vc.selectModel = selectPinPaiData
vc.dataModelArray = generalInfoModel?.data?.brand
self.navigationController?.pushViewController(vc, animated: true)
}
if cell.nameLbl.text == "国家" {
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.titleLbl.text = "请选择国家"
view.delegate = self
view.dataArr = countryArr
if countrySelect != nil {
view.selectNum = countrySelect!
}
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
if shangPinStatusArr != nil {
var arr:Array<String>? = []
for item in shangPinStatusArr! {
arr?.append(item.gs_name!)
}
view.dataArr = arr!
}
if shangPinStatus != nil {
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
if yunShuType != nil{
view.selectNum = yunShuType!
}
self.view.addSubview(view)
glSelectView = view
}
if cell.nameLbl.text == "预设预付定金时间段" {
print("定金时间段")
let timeSelectV = ShowTimeSelectView(frame: self.view.window!.bounds)
timeSelectV.titleLbl.text = "预设预付定金时间段"
timeSelectV.delegate = self
self.view.window?.addSubview(timeSelectV)
isWeiTime = false
}
if cell.nameLbl.text == "预设预付尾款时间段" {
print("预付尾款时")
let timeSelectV = ShowTimeSelectView(frame: self.view.window!.bounds)
timeSelectV.titleLbl.text = "预设预付尾款时间段"
timeSelectV.delegate = self
self.view.window?.addSubview(timeSelectV)
isWeiTime = true
}
}
//MARK:--选择预售时间回调数据
var isWeiTime : Bool = false
func showTimeSelectByData(timeStr: String, beginDate: Date, endginDate: Date) {
let timeInterval:TimeInterval = beginDate.timeIntervalSince1970
let timeIntervalEnd:TimeInterval = endginDate.timeIntervalSince1970
if isWeiTime {
ysszHolder.insert(timeStr, at: 2)
ysszHolder.remove(at: 3)
wk_time_start = Int(timeInterval)
wk_time_end = Int(timeIntervalEnd)
}else{
ysszHolder.insert(timeStr, at: 1)
ysszHolder.remove(at: 2)
dj_time_start = Int(timeInterval)
dj_time_end = Int(timeIntervalEnd)
}
listTbv.reloadData()
}
//MARK:---选择商品分类返回数据
var selectGoodsClassModel:GoodsClassModel? = nil
func blackGoodsClass(sender: GoodsClassModel) {
print("选择商品分类返回数据=\(sender)")
selectGoodsClassModel = sender
tishixxArr.insert(sender.cat_name!, at: 2)
tishixxArr.remove(at: 3)
listTbv.reloadData()
}
//MARK:--选择品牌返回的数据
var selectPinPaiData:GeneralInfoBrandModel? = nil
func blackSelectPinPaiData(sender: GeneralInfoBrandModel) {
print("选择品牌返回的数据=\(sender)")
selectPinPaiData = sender
tishixxArr.insert(sender.brand_name!, at: 3)
tishixxArr.remove(at: 4)
listTbv.reloadData()
}
//MARK:--图片选择处理
func AddImgCellBtnClick(cell: AddImgCell) {
if cell.addBtn.tag == 0 {//仅一张
_ = self.presentHGImagePicker(maxSelected:1) { (assets) in
//结果处理
print("共选择了\(assets.count)张图片,分别如下:")
let option = PHImageRequestOptions()
option.isSynchronous = true
option.isNetworkAccessAllowed = true
for asset in assets {
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// print("上传图片==\(image)")
self.singleImgArr.append(image!)
self.uploadImg(imge: image!, isOriginal: true, tag: 0)
})
}
self.listTbv.reloadData()
}
}else{//可多张
let num = 5 - maxFiveImgsArr.count
_ = self.presentHGImagePicker(maxSelected:num) { (assets) in
//结果处理
print("共选择了\(assets.count)张图片,分别如下:")
let option = PHImageRequestOptions()
option.isSynchronous = true
option.isNetworkAccessAllowed = true
for asset in assets {
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// print("上传图片==\(image)")
self.maxFiveImgsArr.append(image!)
let index = Dollar.indexOf(self.maxFiveImgsArr, value: image!)
self.uploadImg(imge: image!, isOriginal: false, tag: index!)
})
}
self.listTbv.reloadData()
}
}
}
//MARK: - 修改图片
func ChangeCellBtnClick(sender: UIButton, cell: AddImgCell) {
print(sender.tag)
if cell.addBtn.tag == 0 {//仅一张
_ = self.presentHGImagePicker(maxSelected:1) { (assets) in
//结果处理
print("共选择了\(assets.count)张图片,分别如下:")
let option = PHImageRequestOptions()
option.isSynchronous = true
option.isNetworkAccessAllowed = true
for asset in assets {
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// print("上传图片==\(image)")
self.singleImgArr.removeAll()
self.singleImgArr.append(image!)
self.uploadImg(imge: image!, isOriginal: true, tag: 0)
})
}
self.listTbv.reloadData()
}
}else{//可多张
_ = self.presentHGImagePicker(maxSelected:1) { (assets) in
//结果处理
print("共选择了\(assets.count)张图片,分别如下:")
let option = PHImageRequestOptions()
option.isSynchronous = true
option.isNetworkAccessAllowed = true
for asset in assets {
PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// print("上传图片==\(image)")
self.maxFiveImgsArr.insert(image!, at: sender.tag)
self.maxFiveImgsArr.remove(at: sender.tag+1)
self.uploadImg(imge: image!, isOriginal: false, tag: sender.tag)
})
}
self.listTbv.reloadData()
}
}
}
//MARK:--图片上传功能
var original_img:String? = "" //商品封面图
var goods_banner:Array<String>? = ["","","","",""] //商品副图,多张,最多5张,使用一维数组转json格式
func uploadImg (imge:UIImage,isOriginal:Bool,tag:Int){
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let upLoadImg = imge as! UIImage
saveFile(image: upLoadImg, ["user_token":UserToken as Any], success: { (data) in
let dataM = data as! SaveFileModel
if dataM.code == 1 {
print("图片上传成功\(dataM.data?.url)")
if isOriginal {
self.original_img = dataM.data?.url!
}else{
self.goods_banner?.insert((dataM.data?.url!)!, at: tag)
self.goods_banner?.remove(at: tag + 1)
}
}
}) { (error) in
print("图片上传失败\(error)")
}
}
//MARK: - 删除图片处理
func DelImgCellBtnClick(sender:UIButton, cell: AddImgCell) {
if cell.isSingle == true {
singleImgArr.remove(at:sender.tag)
self.original_img = ""
listTbv.reloadData()
}else{
maxFiveImgsArr.remove(at:sender.tag)
self.goods_banner?.insert("", at: 5)
self.goods_banner?.remove(at: sender.tag)
listTbv.reloadData()
}
}
//MARK: - GLAlertView(单选)下的页面
func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
switch view.titleLbl.text {
case "请选择商品状态":
shangPinStatus = selectNum
let item = shangPinStatusArr![selectNum]
print(item.gs_name!)
tishixxArr1.insert(item.gs_name!, at: view.tag)
tishixxArr1.remove(at: view.tag+1)
break
case "请选择运输方式":
yunShuType = selectNum
tishixxArr1.insert(yunShuTypeArr[selectNum], at: view.tag)
tishixxArr1.remove(at: view.tag+1)
break
case "请选择国家":
countrySelect = selectNum
tishixxArr1.insert(countryArr[selectNum], at: view.tag)
tishixxArr1.remove(at: view.tag+1)
break
default:
break
}
glSelectView?.removeFromSuperview()
glSelectView = nil
listTbv.reloadData()
}
//MARK: - GLAlertView(多选)下的页面
func GLAlertMoreSelectViewClick(sender: Array<Int>, view:UIView) {
itemTypeArr = sender
let str = "\(sender.first!)"
if str != "99" {
isYuShou = true
}else{
isYuShou = false
}
let contentArr = ["预售","普通","期货","团购"]
let titles = NSMutableArray()
titles.removeAllObjects()
for num in itemTypeArr! {
if num != 99{
titles.add(contentArr[num])
}
}
if titles.componentsJoined(by: ",").contains("预售") {
isYuShouShangPin = true
}else{
isYuShouShangPin = false
}
print("isYuShouShangPin == ",isYuShouShangPin)
tishixxArr.insert(titles.componentsJoined(by: ","), at: view.tag)
tishixxArr.remove(at: view.tag+1)
if itemTypeArr == [99,99,99,99] {
tishixxArr.insert("请选择商品类型", at: view.tag)
tishixxArr.remove(at: view.tag+1)
}
glSelectView?.removeFromSuperview()
glSelectView = nil
listTbv.reloadData()
}
//MARK: - titleAndTFdelegate
func textFieldContent(content: String, cell: TitleAndTFCell) {
switch cell.nameLbl.text {
case "商品名称":
itemName = content
break
case "起卖数量":
qiMaiShuLiang = content
break
case "关键字":
keyWord = content
break
case "物流费用":
wuLiuPrice = content
break
default:
break
}
}
//MARK: - 编辑规格
func ShangPinGguiGeCellEditAction(cell: ShangPinGguiGeCell) {
let vc = CreatNewSpecsViewController()
vc.barTitle = "编辑规格"
vc.datasArr = guiGeArr
vc.danWeiArr = generalInfoModel?.data?.unit!
let dataDict:GuiGeModel!
if selectIdx?.item != nil {
dataDict = guiGeArr[selectIdx!.item]
}else{
dataDict = guiGeArr.first
}
vc.price = dataDict.price
vc.guiGe = dataDict.guiGe
vc.weight = dataDict.weight
vc.wenDu = dataDict.wenDu
vc.danWei = dataDict.danWei
vc.isJieTiOpen = dataDict.isJieTiOpen
vc.isYuShouSetting = isYuShouShangPin!
vc.yuShouPrice = dataDict.yuShouPrice
vc.specalArr = dataDict.specalArr
vc.jieTiArr = dataDict.jieTiArr
vc.isOpenYSSetting = dataDict.isOpenYSSetting
vc.selectIdx = selectIdx
vc.itemDanWeiSelect = dataDict.itemDanWeiSelect
vc.tempSelect = dataDict.tempSelect
vc.delegate = self
vc.DJBiLi = dataDict.DJBiLi
vc.ysKuCun = dataDict.ysKuCun
self.navigationController?.pushViewController(vc, animated: true)
}
// //MARK: - 删除规格
func CreatNewSpecsViewControllerDeleteAction(datas: Array<GuiGeModel>,selectIdx:IndexPath) {
guiGeArr = datas
self.selectIdx = selectIdx
listTbv.reloadData()
}
//MARK: - 新增规格
@objc func addGuiGe(){
print("新增规格")
let vc = CreatNewSpecsViewController()
vc.barTitle = "新增规格"
vc.delegate = self
vc.danWeiArr = generalInfoModel?.data!.unit
vc.isYuShouSetting = isYuShouShangPin!
vc.datasArr = guiGeArr
vc.selectIdx = selectIdx
self.navigationController?.pushViewController(vc, animated: true)
}
//MARK: - 新增、编辑规格数据返回
func CreatNewSpecsViewControllerSaveAction(datas: Array<GuiGeModel>,selectIdx:IndexPath) {
guiGeArr = datas
self.selectIdx = selectIdx
listTbv.reloadData()
}
//MARK: - COLLECTIONVIEW DELEGATE
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return guiGeArr.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath)
as! ItemCell
cell.tag = indexPath.row
cell.nameLbl.text = "规格" + "\(indexPath.item+1)"
if indexPath == selectIdx {
cell.nameLbl.textColor = UIColor(named: "蓝色字体颜色")
cell.lineView.isHidden = false
}else{
cell.nameLbl.textColor = UIColor(named: "标题字颜色")
cell.lineView.isHidden = true
}
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectIdx = indexPath
//刷新cell
collectionView.reloadData()
listTbv.reloadRows(at: [IndexPath(row: 0, section: 2)], with:.none)
}
//MARK: - switchClick
func switchClick(content: UISwitch, cell: TitleAndSwitchCell) {
switch cell.namelbl.text {
case "是否清真":
shiFouQZ = content.isOn
break
case "是否询价":
shiFouXJ = content.isOn
break
case "用户付款是否需要审核":
shiFouSH = content.isOn
break
default:
break
}
}
func numberOfSections(in tableView: UITableView) -> Int {
return 6
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section {
case 0: return 7
case 1:return 2
case 2:return 1
case 3:return 4
case 4:return 5
default:return 1
}
}
//MARK: - tableview footer
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10))
view.backgroundColor = UIColor(named: "app底色")
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if section == 3 {
if isYuShouShangPin == false {
return 0.001
}
}
return 10
}
//MARK: - tableview header
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 3 {
if isYuShouShangPin == false {
return UIView()
}
}
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39))
let lbl = UILabel(frame: CGRect(x: 15, y: 15, width: fullScreenWidth, height: 21))
lbl.text = titleArr[section]
lbl.textColor = UIColor(named: "标题字颜色")
lbl.font = UIFont.boldSystemFont(ofSize: 15)
view.addSubview(lbl)
if section == 2 && guiGeArr.count > 0{
let btn = UIButton()
btn.setTitle(" 新增", for: .normal)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
btn.setImage(UIImage(named: "jiahaoXG"), for: .normal)
view.addSubview(btn)
btn.sizeToFit()
btn.snp.makeConstraints { (make) in
make.centerY.equalTo(lbl.snp_centerY)
make.right.equalTo(-15)
make.height.equalTo(btn.frame.size.height)
make.width.equalTo(btn.frame.size.width)
}
let btn2 = UIButton()
view.addSubview(btn2)
btn2.snp.makeConstraints { (make) in
make.top.right.bottom.equalTo(0)
make.width.equalTo(80)
}
btn2.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside)
if guiGeArr.count > 1 {
view.frame = CGRect(x: 0, y: 0, width: fullScreenWidth, height: 80)
let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 0, height: 0), collectionViewLayout: layout)
collectionView.backgroundColor = UIColor.white
collectionView.delegate = self
collectionView.dataSource = self
view.addSubview(collectionView)
collectionView.snp.makeConstraints { (make) in
make.bottom.left.right.equalTo(0)
make.height.equalTo(41)
}
collectionView.showsHorizontalScrollIndicator = false
collectionView.isPagingEnabled = true
layout.itemSize = CGSize(width: fullScreenWidth*0.5, height: 41)
layout.scrollDirection = .horizontal
collectionView.collectionViewLayout = layout
collectionView.register(UINib(nibName: "ItemCell", bundle: nil), forCellWithReuseIdentifier: "ItemCell")
if guiGeArr.count > 0 {
collectionView.layoutIfNeeded()
collectionView.scrollToItem(at: selectIdx!, at: .centeredHorizontally, animated: false)
}
}
}
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if section == 3 {
if isYuShouShangPin == false {
return 0.001
}
}
if section == 2 {
if guiGeArr.count > 1 {
return 80
}
}
return 39
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
switch indexPath.section {
case 0: return 49
case 1:return 148.5
case 2:
if guiGeArr.count > 0 {
return 146
}
return 123.5
case 3:
if isYuShouShangPin == false {
return 0.01
}else{
return 49
}
case 4:return 49
default:
return 98
}
}
func YuShouWeiKuanFaHuoCellString(str: String) {
faHuoTime = str
print(faHuoTime)
}
override func backAction() {
self.navigationController?.popViewController(animated: true)
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
IQKeyboardManager.shared.resignFirstResponder()
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
IQKeyboardManager.shared.resignFirstResponder()
}
//MARK:--处理规格数据
var specifications = ""
var shop_price: Float = 0.0
var goods_unit = ""
var sku_info = ""
func getUpSkuInfoByData(dataArr:Array<GuiGeModel>) {
var price: Float = 0.0
var isgetP :Bool = false
var model : GuiGeModel? = nil
var skuArr:Array<Any> = []
dataArr.forEach { (md) in
if isPurnNumber(str: md.price) {
if isgetP {
let peiceP = Float(md.price)! //第n个售价(n > 1)
if peiceP < price {
price = peiceP
model = md
}
}else {
price = Float(md.price)! //第一个售价
model = md
isgetP = true
}
}
//普通阶梯价
var is_tiered = 0
var tiered_pri:Dictionary<String, String> = [:]
if md.isJieTiOpen {
is_tiered = 1
md.jieTiArr.forEach { (obj) in
let str = obj as! String
let arr = str.components(separatedBy: "_")
let priceStr = arr[0]
let coutStr = arr[1]
if isPurnNumber(str: priceStr) {
let specaP = Float(priceStr)!
if specaP < price {
price = specaP
model = md
}
}
tiered_pri.updateValue(priceStr, forKey: coutStr)
}
}
//预售价
var is_adsale_tiered = 0
var adsale_tiered_pri:Dictionary<String, String> = [:]
if md.isOpenYSSetting {
if isPurnNumber(str: md.yuShouPrice) {
let yushoup = Float(md.yuShouPrice)!
if yushoup < price {
price = yushoup
model = md
}
}
if md.isJieTiOpen {
is_adsale_tiered = 1
//每一个预售阶梯价
md.specalArr.forEach { (obj) in
let str = obj as! String
let arr = str.components(separatedBy: "_")
let priceStr = arr[0]
let coutStr = arr[1]
if isPurnNumber(str: priceStr) {
let specaP = Float(priceStr)!
if specaP < price {
price = specaP
model = md
}
}
adsale_tiered_pri.updateValue(priceStr, forKey: coutStr)
}
}
}
let pack_attr = ["l":"0","w":"0","h":"0","wg":md.weight,"v":"0"]
var is_open_adsale = 0
var adsale_pri = ""
var adsale_inventory = ""
var pct = ""
if md.isOpenYSSetting {
is_open_adsale = 1
adsale_pri = md.yuShouPrice
adsale_inventory = md.ysKuCun
pct = md.DJBiLi
}
var sku = ["sku_sn":"",
"spec_id":"1",
"attr":md.guiGe,
"pack_attr":pack_attr,
"refrigerate":md.wenDu,
"unit":md.danWei,
"price":md.price,
"is_tiered":is_tiered,
"is_open_adsale":is_open_adsale,
"adsale_pri":adsale_pri,
"adsale_inventory":adsale_inventory,
"pct":pct,
"is_adsale_tiered":is_adsale_tiered] as [String : Any]
if tiered_pri.keys.count > 0{
sku.updateValue(tiered_pri, forKey: "tiered_pri")
}else{
sku.updateValue("", forKey: "tiered_pri")
}
if adsale_tiered_pri.keys.count > 0 {
sku.updateValue(adsale_tiered_pri, forKey: "adsale_tiered_pri")
}else{
sku.updateValue("", forKey: "adsale_tiered_pri")
}
skuArr.append(sku)
}
if skuArr.count > 0 {
sku_info = dataChangeString(sender: skuArr)
}
shop_price = price
if model != nil {
specifications = model!.guiGe
goods_unit = model!.danWei
}
}
}
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="EditProductViewController" customModule="GeliBusinessPlatform" customModuleProvider="target"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="EPViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<connections> <connections>
<outlet property="bottomView" destination="eFg-iG-awf" id="UXR-sY-RHK"/> <outlet property="btmBtnBGView" destination="H2x-8q-Enj" id="zfZ-07-szf"/>
<outlet property="listTbv" destination="8Fv-Ss-fcb" id="xab-1c-WUC"/> <outlet property="btmBtnViewH" destination="zvU-A1-Wlq" id="gZn-F8-1hh"/>
<outlet property="tbvBGView" destination="ZLj-69-KvE" id="sHZ-SL-tOh"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/> <outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections> </connections>
</placeholder> </placeholder>
...@@ -20,47 +21,43 @@ ...@@ -20,47 +21,43 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/> <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="drN-vh-kV3"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="8BW-ln-Nxl">
<rect key="frame" x="0.0" y="813" width="414" height="83"/> <rect key="frame" x="0.0" y="813" width="414" height="83"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
</view> </view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eFg-iG-awf"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="H2x-8q-Enj">
<rect key="frame" x="0.0" y="813" width="414" height="49"/> <rect key="frame" x="0.0" y="813" width="414" height="49"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/> <color key="backgroundColor" systemColor="systemBlueColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="49" id="Yga-Ec-b4a"/> <constraint firstAttribute="height" constant="49" id="zvU-A1-Wlq"/>
</constraints> </constraints>
</view> </view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="8Fv-Ss-fcb"> <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="ZLj-69-KvE">
<rect key="frame" x="0.0" y="44" width="414" height="769"/> <rect key="frame" x="0.0" y="44" width="414" height="769"/>
<color key="backgroundColor" name="白色背景色"/> <color key="backgroundColor" name="app底色"/>
<connections> </view>
<outlet property="dataSource" destination="-1" id="UML-aq-eZJ"/>
<outlet property="delegate" destination="-1" id="LEW-Yi-wxv"/>
</connections>
</tableView>
</subviews> </subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints> <constraints>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="drN-vh-kV3" secondAttribute="trailing" id="5Ua-1G-oDk"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="ZLj-69-KvE" secondAttribute="trailing" id="3Jk-Tc-TKn"/>
<constraint firstItem="eFg-iG-awf" firstAttribute="top" secondItem="8Fv-Ss-fcb" secondAttribute="bottom" id="6nY-7j-452"/> <constraint firstAttribute="bottom" secondItem="8BW-ln-Nxl" secondAttribute="bottom" id="4Gl-Yg-o45"/>
<constraint firstItem="8Fv-Ss-fcb" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="6vq-Th-6hv"/> <constraint firstItem="8BW-ln-Nxl" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="8oR-Lt-pCU"/>
<constraint firstAttribute="bottom" secondItem="drN-vh-kV3" secondAttribute="bottom" id="EzG-9Q-6Cg"/> <constraint firstAttribute="trailing" secondItem="8BW-ln-Nxl" secondAttribute="trailing" id="NbR-OX-9fd"/>
<constraint firstItem="drN-vh-kV3" firstAttribute="top" secondItem="eFg-iG-awf" secondAttribute="top" id="PwX-Ue-uGH"/> <constraint firstItem="H2x-8q-Enj" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="Pcj-8n-w37"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="8Fv-Ss-fcb" secondAttribute="trailing" id="WIB-ml-ERa"/> <constraint firstItem="ZLj-69-KvE" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="Y3r-3J-qfn"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="eFg-iG-awf" secondAttribute="trailing" id="b1W-KS-K4v"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="H2x-8q-Enj" secondAttribute="bottom" id="bNX-52-VdE"/>
<constraint firstItem="eFg-iG-awf" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="eBR-6r-zfV"/> <constraint firstItem="8BW-ln-Nxl" firstAttribute="top" secondItem="ZLj-69-KvE" secondAttribute="bottom" id="biy-r5-iTE"/>
<constraint firstItem="8Fv-Ss-fcb" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="j0E-Bg-S0z"/> <constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="H2x-8q-Enj" secondAttribute="trailing" id="f4A-MP-LP5"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="eFg-iG-awf" secondAttribute="bottom" id="nwH-n3-0GY"/> <constraint firstItem="8BW-ln-Nxl" firstAttribute="top" secondItem="H2x-8q-Enj" secondAttribute="top" id="qVu-HU-nQk"/>
<constraint firstItem="drN-vh-kV3" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="pa9-O7-nAr"/> <constraint firstItem="ZLj-69-KvE" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="w6v-Bv-ydF"/>
</constraints> </constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/> <viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="131.8840579710145" y="130.58035714285714"/> <point key="canvasLocation" x="131.8840579710145" y="101.78571428571428"/>
</view> </view>
</objects> </objects>
<resources> <resources>
<namedColor name="白色背景色"> <namedColor name="app底色">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.94509803921568625" green="0.94509803921568625" blue="0.94509803921568625" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
</resources> </resources>
</document> </document>
////
//// ProductDetailViewController.swift
//// GeliBusinessPlatform
////
//// Created by junye lu on 2020/4/23.
//// Copyright © 2020 junye lu. All rights reserved.
////
//
//import UIKit
//import LGButton
//import Photos
//
//class EditProductViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,CommendCellDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,GoodsClassViewControllerDelegate,PinPaiListViewControllerDelegate,AddImgCellDelegate,AddGuiGeCellDelegate,CreatNewSpecsViewControllerDelegate,ShangPinGguiGeCellDelegate,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout,TitleAndSwitchCellDelegate{
//
// var isEdit:Bool = false//是否编辑状态
//
// var selectIdx:IndexPath?
// var layout = UICollectionViewFlowLayout()
// var glSelectView:GLAlertSelectView?
// let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"]
// let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"]
//
// let tishixxArr:NSMutableArray = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量"]
// let tishixxArr1:NSMutableArray = ["请输入关键字","请输入物流费用","请选择国家","请选择商品状态","请选择运输方式"]
//
// let sptpArr = ["商品封面图(限一张)","商品主图(限五张)"]
// let qtxxArr = ["关键字","物流费用","国家","商品状态","运输方式"]
// let ysszArr = ["用户付款是否需要审核","预设预付定金时间段","预设预付尾款时间段","预设预付尾款发货时间"]
// let ysszHolder = ["0","请选择时段","请选择时段","0"]
//
//
// var itemTypeArr = NSMutableArray()
//
// var shangPinStatus:Int?
// var shangPinStatusArr = ["热销","爆款","新品","促销","外采","团购"]
//
// var yunShuType:Int?
// var yunShuTypeArr = ["冷链","常温","热链"]
// //MARK:--保存按钮
// @IBOutlet weak var bottomView: UIView!
//
// @IBOutlet weak var listTbv: UITableView!
// var cellHeight = 18.5
// var contentStr:String = ""
//
// var guiGeArr:NSMutableArray = []//根据规格资料数量控制右上角新增按钮是否显示
//
//
//
// var isYuShouShangPin:Bool?
//
// let btmTitleArr = ["编辑","入库","下架","删除"]
// @objc func bottomBtnClick(sender:UIButton){
//
// switch sender.titleLabel?.text {
// case "编辑":
// isEdit = true
// sender.setTitle("保存", for: .normal)
// firstLbl!.text = "保存"
// listTbv.reloadData()
// break
// case "保存":
// isEdit = false
// sender.setTitle("编辑", for: .normal)
// firstLbl!.text = "编辑"
// listTbv.reloadData()
// break
// default:
// break
// }
// }
//
// var firstLbl:UILabel? = nil
// var generalInfoModel : GeneralInfoModel? = nil
// override func viewDidLoad() {
// super.viewDidLoad()
// //MARK:--获取新增商品的基本信息(品牌和分类等)
// HUD.flash(.progress)
// let UserToken = UserDefaults.standard.value(forKey: "user_token")
// GeneralInfo(["user_token":UserToken as Any], success: { (data) in
// HUD.hide(animated: true)
// self.generalInfoModel = data as! GeneralInfoModel
//
// }) { (error) in
//
// }
// isYuShouShangPin = true
//
// navbar.title = "商品详情"
// self.view.addSubview(navbar)
// listTbv.separatorStyle = .none
// listTbv.snp.makeConstraints { (make) in
// make.top.equalTo(NavCGRect.height)
// make.left.right.equalTo(0)
// make.bottom.equalTo(bottomView.snp_top)
// }
//
// listTbv.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTF")
// listTbv.register(UINib(nibName: "TitleAndSwitchCell", bundle: nil), forCellReuseIdentifier: "TitleAndSwitch")
// listTbv.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtn")
// listTbv.register(UINib(nibName: "AddImgCell", bundle: nil), forCellReuseIdentifier: "AddImg")
// listTbv.register(UINib(nibName: "AddGuiGeCell", bundle: nil), forCellReuseIdentifier: "AddGuiGe")
// listTbv.register(UINib(nibName: "CommendCell", bundle: nil), forCellReuseIdentifier: "Commend")
// listTbv.register(UINib(nibName: "YuShouWeiKuanFaHuoCell", bundle: nil), forCellReuseIdentifier: "YuShouWeiKuanFaHuoCell")
// listTbv.register(UINib(nibName: "ShangPinGguiGeCell", bundle: nil), forCellReuseIdentifier: "ShangPinGguiGeCell")
// // Do any additional setup after loading the view.
// let w = fullScreenWidth / CGFloat(btmTitleArr.count)
// for i in 0 ..< btmTitleArr.count{
// let btn = UIButton(frame: CGRect(x: CGFloat(i) * w, y: 0, width: w, height: bottomView.bounds.size.height))
// btn.tag = i
// 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: "蓝色字体颜色")
// if i == 0 {
// firstLbl = lbl
// }
// bottomView.addSubview(btn)
// bottomView.addSubview(lbl)
// }
// }
// //MARK: - cell delegate
// func numberOfSections(in tableView: UITableView) -> Int {
// return 6
// }
// func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
// switch section {
// case 0: return 7
// case 1:return 2
// case 2:return 1
// case 3:return 4
// case 4:return 5
// default:return 2
// }
// }
//
// func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
// switch indexPath.section {
// case 0:
// if indexPath.row == 0 || indexPath.row == 4 {
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTF") as! TitleAndTFCell
// cell.nameLbl.text = spxxArr[indexPath.row]
//
// cell.textTF.placeholder = tishixxArr[indexPath.row] as! String
// cell.textTF.isUserInteractionEnabled = isEdit
// return cell
// }
// if indexPath.row > 4{
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
// cell.delegate = self
// cell.namelbl.text = spxxArr[indexPath.row]
// cell.infoSw.isUserInteractionEnabled = isEdit
// return cell
// }
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
// cell.nameLbl.text = spxxArr[indexPath.row]
// cell.contentLbl.text = tishixxArr[indexPath.row] as! String
// cell.tag = indexPath.row
// cell.btn.isUserInteractionEnabled = isEdit
// cell.delegate = self
// return cell
// case 1:
// let cell = tableView.dequeueReusableCell(withIdentifier: "AddImg") as! AddImgCell
// cell.nameLbl.text = sptpArr[indexPath.row]
// if indexPath.row == 0 {
// cell.isSingle = true
// cell.imgs = singleImgArr
// }else{
// cell.isSingle = false
// cell.imgs = maxFiveImgsArr
// }
// cell.delegate = self
// cell.addBtn.tag = indexPath.row
// cell.isEdit = isEdit
// return cell
// case 2:
// if guiGeArr.count > 0 {
// let cell = tableView.dequeueReusableCell(withIdentifier: "ShangPinGguiGeCell") as! ShangPinGguiGeCell
// cell.delegate = self
// var dict:NSDictionary!
// if selectIdx != nil{
// dict = guiGeArr[selectIdx!.item] as! NSDictionary
// }else{
// dict = guiGeArr.firstObject as! NSDictionary
// }
// cell.tempLbl.text = "冷藏:\(String(describing: dict["wenDu"]!))℃"
// cell.weightLbl.text = "重量(kg):\(String(describing: dict["weight"]!))kg"
// cell.guiGeLbl.text = "规格:\(String(describing: dict["guiGe"]!))kg/件"
// cell.danWeiLbl.text = "单位:\(String(describing: dict["danWei"]!))"
// cell.sellPriceLbl.text = "售价:¥\(dict["price"]!)"
// if isEdit{
// cell.btn.setTitle("编辑详情", for: .normal)
// }else{
// cell.btn.setTitle("查看详情", for: .normal)
// }
// return cell
// }
// let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
// cell.imgBtn.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside)
// cell.imgBtn.setImage(UIImage(named: "xinzeng"), for: .normal)
// cell.imgBtn.isUserInteractionEnabled = isEdit
// return cell
// case 3:
// if indexPath.row == 0 {
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSwitch") as! TitleAndSwitchCell
// cell.namelbl.text = ysszArr[indexPath.row]
// cell.delegate = self
// cell.infoSw.isUserInteractionEnabled = isEdit
// return cell
// }
// if indexPath.row == 3 {
// let cell = tableView.dequeueReusableCell(withIdentifier: "YuShouWeiKuanFaHuoCell") as! YuShouWeiKuanFaHuoCell
// cell.nameLbl.text = ysszArr[indexPath.row]
// cell.textTF.keyboardType = .numberPad
// cell.textTF.isUserInteractionEnabled = isEdit
// return cell
// }
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
// cell.nameLbl.text = ysszArr[indexPath.row]
// cell.delegate = self
// cell.contentLbl.text = ysszHolder[indexPath.row]
// cell.btn.isUserInteractionEnabled = isEdit
// 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] as! String
// cell.tag = indexPath.row
// cell.textTF.isUserInteractionEnabled = isEdit
// return cell
// }else{
// let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
// cell.nameLbl.text = qtxxArr[indexPath.row]
// cell.tag = indexPath.row
// cell.contentLbl.text = tishixxArr1[indexPath.row] as! String
// cell.btn.isUserInteractionEnabled = isEdit
// cell.delegate = self
// return cell
// }
// default:
// if indexPath.row == 0 {
// let cell = tableView.dequeueReusableCell(withIdentifier: "Commend") as! CommendCell
// cell.delegate = self
// cell.autoTf?.isUserInteractionEnabled = isEdit
// return cell
// }else{
// let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
// cell.imgBtn.setImage(UIImage(named: "tupian"), for: .normal)
// cell.delegate = self
// cell.imgBtn.tag = indexPath.row
// cell.imgBtn.isUserInteractionEnabled = isEdit
// return cell
// }
// }
// }
//
// func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
//
// }
// func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
// switch indexPath.section {
// case 0: return 49
// case 1:return 148.5
// case 2:
// if guiGeArr.count > 0 {
// return 146
// }
// return 123.5
// case 3:
// if isYuShouShangPin == false {
// return 0.01
// }else{
// return 49
// }
// case 4:return 49
// default:
// if indexPath.row == 0 {
// return CGFloat(cellHeight)+27.5
// }else{
// return 155.5
// }
// }
// }
// //header
// func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
// if section == 3 {
// if isYuShouShangPin == false {
// return UIView()
// }
// }
// let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39))
// let lbl = UILabel(frame: CGRect(x: 15, y: 15, width: fullScreenWidth, height: 21))
// lbl.text = titleArr[section]
// lbl.textColor = UIColor(named: "标题字颜色")
// lbl.font = UIFont.boldSystemFont(ofSize: 15)
// view.addSubview(lbl)
// if section == 2 && guiGeArr.count > 0{
// let btn = UIButton()
// btn.setTitle(" 新增", for: .normal)
// btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
// btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
// btn.setImage(UIImage(named: "jiahaoXG"), for: .normal)
// view.addSubview(btn)
// btn.sizeToFit()
// btn.snp.makeConstraints { (make) in
// make.centerY.equalTo(lbl.snp_centerY)
// make.right.equalTo(-15)
// make.height.equalTo(btn.frame.size.height)
// make.width.equalTo(btn.frame.size.width)
// }
// let btn2 = UIButton()
// view.addSubview(btn2)
// btn2.snp.makeConstraints { (make) in
// make.top.right.bottom.equalTo(0)
// make.width.equalTo(80)
// }
// btn2.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside)
// if guiGeArr.count > 1 {
// view.frame = CGRect(x: 0, y: 0, width: fullScreenWidth, height: 80)
// let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 0, height: 0), collectionViewLayout: layout)
// collectionView.backgroundColor = UIColor.white
// collectionView.delegate = self
// collectionView.dataSource = self
// view.addSubview(collectionView)
// collectionView.snp.makeConstraints { (make) in
// make.bottom.left.right.equalTo(0)
// make.height.equalTo(41)
// }
// collectionView.showsHorizontalScrollIndicator = false
// collectionView.isPagingEnabled = true
// layout.itemSize = CGSize(width: fullScreenWidth*0.5, height: 41)
// layout.scrollDirection = .horizontal
// collectionView.collectionViewLayout = layout
// collectionView.register(UINib(nibName: "ItemCell", bundle: nil), forCellWithReuseIdentifier: "ItemCell")
// collectionView.selectItem(at:selectIdx, animated: false, scrollPosition: .left)
// }
// }
// return view
// }
// func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
// if section == 3 {
// if isYuShouShangPin == false {
// return 0.001
// }
// }
// if section == 2 {
// if guiGeArr.count > 1 {
// return 80
// }
// }
// return 39
// }
// //footer
// func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
// let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 10))
// view.backgroundColor = UIColor(named: "app底色")
// return view
// }
// func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
// if section == 3 {
// if isYuShouShangPin == false {
// return 0.001
// }
// }
// return 10
// }
// //MARK: - 自定义delegate
// func CommendCellSendH(height: CGFloat) {
// cellHeight = Double(height)
// listTbv.beginUpdates()
// listTbv.endUpdates()
// }
// func CommendCellSendStr(content: String) {
// print("CommendCellSendStr")
// }
// override func backAction() {
// self.navigationController?.popViewController(animated: true)
// }
// //MARK: -- 选择填或跳转
//
//
//
// 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 = ["预售","普通","期货","团购"]
// if itemTypeArr.count == 0 {
// for _ in view.dataArr {
// itemTypeArr.add("99")
// }
// }
// view.selectArray = itemTypeArr
// self.view.addSubview(view)
// glSelectView = view
// }
// }
// if cell.nameLbl.text == "商品分类" {
// let vc = GoodsClassViewController()
// vc.delegate = self
// vc.dataModelArray = generalInfoModel?.data?.cats
// self.navigationController?.pushViewController(vc, animated: true)
// }
// if cell.nameLbl.text == "品牌" {
// let vc = PinPaiListViewController()
// vc.isSelectData = true
// vc.delegate = self
// vc.dataModelArray = generalInfoModel?.data?.brand
// self.navigationController?.pushViewController(vc, animated: true)
// }
// if cell.nameLbl.text == "国家" {
//
// }
// 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 == "预设预付定金时间段" {
//
// }
// if cell.nameLbl.text == "预设预付尾款时间段" {
//
// }
// print(cell.nameLbl.text)
// }
// //MARK:---选择商品分类返回数据
// func blackGoodsClass(sender: GoodsClassModel) {
// print("选择商品分类返回数据=\(sender)")
// }
// //MARK:--选择品牌返回的数据
// func blackSelectPinPaiData(sender: GeneralInfoBrandModel) {
// print("选择品牌返回的数据=\(sender)")
//
// }
//
// func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
// print("单选",selectNum)
// print(view.titleLbl.text)
// switch view.titleLbl.text {
// case "请选择商品类型":
// shangPinStatus = selectNum
// tishixxArr1.replaceObject(at: view.tag, with: shangPinStatusArr[selectNum])
// break
// case "请选择运输方式":
// yunShuType = selectNum
// tishixxArr1.replaceObject(at: view.tag, with: yunShuTypeArr[selectNum])
// 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 != "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()
// }
// func GLAlertSelectViewClose(sender: UIButton) {
// glSelectView?.removeFromSuperview()
// glSelectView = nil
// }
// var maxFiveImgsArr = NSMutableArray()
// var singleImgArr = NSMutableArray()
// func DelImgCellBtnClick(sender: UIButton, cell: AddImgCell) {
// if cell.isSingle == true {
// singleImgArr.removeObject(at: sender.tag)
// listTbv.reloadData()
// }else{
// maxFiveImgsArr.removeObject(at: sender.tag)
// listTbv.reloadData()
// }
//
// }
// func AddImgCellBtnClick(cell: AddImgCell) {
// if cell.addBtn.tag == 0 {//仅一张
// _ = self.presentHGImagePicker(maxSelected:1) { (assets) in
// //结果处理
// print("共选择了\(assets.count)张图片,分别如下:")
// let option = PHImageRequestOptions()
// option.isSynchronous = true
// option.isNetworkAccessAllowed = true
// for asset in assets {
// PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// // print("上传图片==\(image)")
// self.singleImgArr.add(image)
// })
// }
// cell.imgs = self.singleImgArr
// }
// }else{//可多张
// _ = self.presentHGImagePicker(maxSelected:5) { (assets) in
// //结果处理
// print("共选择了\(assets.count)张图片,分别如下:")
// let option = PHImageRequestOptions()
// option.isSynchronous = true
// option.isNetworkAccessAllowed = true
// for asset in assets {
// PHImageManager.default().requestImage(for: asset, targetSize: PHImageManagerMaximumSize , contentMode: .default , options: option, resultHandler: { (image, _: [AnyHashable : Any]?) in
// // print("上传图片==\(image)")
// self.maxFiveImgsArr.add(image)
// })
// }
// cell.imgs = self.maxFiveImgsArr
// }
// }
// }
// func ShangPinGguiGeCellEditAction(cell: ShangPinGguiGeCell) {
// let vc = CreatNewSpecsViewController()
// vc.barTitle = "编辑规格"
// vc.datasArr = guiGeArr
// let dataDict:NSDictionary!
// if selectIdx?.item != nil {
// dataDict = guiGeArr[selectIdx!.item] as! NSDictionary
// }else{
// dataDict = guiGeArr.firstObject as! NSDictionary
// }
//
// vc.price = dataDict["price"] as! String
// vc.guiGe = dataDict["guiGe"] as! String
// vc.weight = dataDict["weight"] as! String
// vc.wenDu = dataDict["wenDu"] as! String
// 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 {
// vc.selectIdx = IndexPath(item: 0, section: 0)
// }else{
// vc.selectIdx = selectIdx
// }
// print(vc.selectIdx?.item)
// vc.delegate = self
// self.navigationController?.pushViewController(vc, animated: true)
// }
//
// func CreatNewSpecsViewControllerDeleteAction() {
// print("删除数据")
// }
// func AddGuiGeCellClick(cell: AddGuiGeCell) {
// //
// print("商品详情添加图片")
// }
// @objc func addGuiGe(){
// print("新增规格")
// 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)
// }
// @objc func addImageAction(sender:UIButton){
// print(sender.tag)
// }
//
// func CreatNewSpecsViewControllerSaveAction(datas: NSMutableArray) {
// guiGeArr = datas
// listTbv.reloadData()
// }
//
// //MARK: - COLLECTIONVIEW DELEGATE
// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
// return 0
// }
// func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
// return guiGeArr.count
// }
//
// func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
// let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath)
// as! ItemCell
// cell.tag = indexPath.row
// if selectIdx == nil {
// selectIdx = IndexPath(item: 0, section: 0)
// }
// if indexPath == selectIdx {
// cell.nameLbl.textColor = UIColor(named: "蓝色字体颜色")
// cell.lineView.isHidden = false
// }else{
// cell.nameLbl.textColor = UIColor(named: "标题字颜色")
// cell.lineView.isHidden = true
// }
// return cell
//
// }
// func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
// selectIdx = indexPath
// //刷新cell
// print("selectItem",selectIdx?.item)
// listTbv.reloadData()
// collectionView.reloadData()
// }
//}
...@@ -318,18 +318,20 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -318,18 +318,20 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
//商家名称 //商家名称
switch cell.nameLbl.text { switch cell.nameLbl.text {
case "商品名称": case "商品名称":
cell.textTF.keyboardType = .default
cell.textTF.text = itemName cell.textTF.text = itemName
cell.textTF.returnKeyType = .done cell.textTF.returnKeyType = .done
break break
case "起卖数量": case "起卖数量":
cell.textTF.text = qiMaiShuLiang
cell.textTF.keyboardType = .numberPad cell.textTF.keyboardType = .numberPad
cell.textTF.text = qiMaiShuLiang
break break
default: default:
break break
} }
cell.textTF.placeholder = tishixxArr[indexPath.row] as! String cell.textTF.placeholder = tishixxArr[indexPath.row] as! String
cell.delegate = self cell.delegate = self
return cell return cell
} }
...@@ -392,7 +394,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -392,7 +394,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
dict = guiGeArr.first dict = guiGeArr.first
} }
cell.tempLbl.text = "冷藏:\(dict.wenDu)℃" cell.tempLbl.text = "冷藏:\(dict.wenDu)℃"
cell.weightLbl.text = "重量(kg):\(dict.weight)kg" cell.weightLbl.text = "重量(kg):\(dict.weight)kg"
cell.guiGeLbl.text = "规格:\(dict.guiGe)kg/件" cell.guiGeLbl.text = "规格:\(dict.guiGe)kg/件"
...@@ -432,10 +433,11 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -432,10 +433,11 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
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.delegate = self cell.textTF.delegate = self
cell.textTF.returnKeyType = .done
switch cell.nameLbl.text { switch cell.nameLbl.text {
case "关键字": case "关键字":
cell.textTF.text = keyWord cell.textTF.text = keyWord
cell.textTF.keyboardType = .default
cell.textTF.returnKeyType = .done
break break
case "物流费用": case "物流费用":
cell.textTF.text = wuLiuPrice cell.textTF.text = wuLiuPrice
...@@ -445,6 +447,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -445,6 +447,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
break break
} }
cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String cell.textTF.placeholder = tishixxArr1[indexPath.row] as! String
cell.tag = indexPath.row cell.tag = indexPath.row
cell.delegate = self cell.delegate = self
return cell return cell
......
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