Commit b8531ea7 authored by lujunye's avatar lujunye

编辑查看详情EditProductViewController

parent c9c486a2
......@@ -105,8 +105,6 @@
E0516F7F244806C500E373CE /* MsgCenterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0516F7E244806C500E373CE /* MsgCenterViewController.swift */; };
E0516F822448086700E373CE /* MsgCenterCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0516F802448086700E373CE /* MsgCenterCell.swift */; };
E0516F832448086700E373CE /* MsgCenterCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0516F812448086700E373CE /* MsgCenterCell.xib */; };
E0647AC12468E30B008C5A34 /* EditProductViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0647ABF2468E30B008C5A34 /* EditProductViewController.swift */; };
E0647AC22468E30B008C5A34 /* EditProductViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0647AC02468E30B008C5A34 /* EditProductViewController.xib */; };
E06524ED2458008900CA22E2 /* RuKuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E06524EB2458008900CA22E2 /* RuKuViewController.swift */; };
E06524EE2458008900CA22E2 /* RuKuViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E06524EC2458008900CA22E2 /* RuKuViewController.xib */; };
E06524F124580AAC00CA22E2 /* RuKuJiaGeCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E06524EF24580AAC00CA22E2 /* RuKuJiaGeCell.swift */; };
......@@ -141,6 +139,8 @@
E07B1E70245929060055BA3C /* GYSGLViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E07B1E6E245929060055BA3C /* GYSGLViewController.xib */; };
E07B1E78245966E60055BA3C /* XinCaiGouViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E07B1E76245966E60055BA3C /* XinCaiGouViewController.swift */; };
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 */; };
E088CC932447124D000DAA8A /* BindViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E088CC912447124D000DAA8A /* BindViewController.swift */; };
E088CC942447124D000DAA8A /* BindViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E088CC922447124D000DAA8A /* BindViewController.xib */; };
......@@ -266,8 +266,6 @@
E0F1BE452469220D003015B2 /* libopencore-amrnb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E0F1BE372469220D003015B2 /* libopencore-amrnb.a */; };
E0F1BE4824692379003015B2 /* ItemCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F1BE4624692379003015B2 /* ItemCell.swift */; };
E0F1BE4924692379003015B2 /* ItemCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0F1BE4724692379003015B2 /* ItemCell.xib */; };
E0F1BE4C24692F07003015B2 /* EditProductImgCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F1BE4A24692F07003015B2 /* EditProductImgCell.swift */; };
E0F1BE4D24692F07003015B2 /* EditProductImgCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0F1BE4B24692F07003015B2 /* EditProductImgCell.xib */; };
E0F3C2CB24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F3C2C924590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift */; };
E0F3C2CC24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E0F3C2CA24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.xib */; };
E0F97B022451228A001BD600 /* GLAlertSelectView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E0F97B012451228A001BD600 /* GLAlertSelectView.swift */; };
......@@ -567,8 +565,6 @@
E0516F7E244806C500E373CE /* MsgCenterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MsgCenterViewController.swift; sourceTree = "<group>"; };
E0516F802448086700E373CE /* MsgCenterCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MsgCenterCell.swift; sourceTree = "<group>"; };
E0516F812448086700E373CE /* MsgCenterCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MsgCenterCell.xib; sourceTree = "<group>"; };
E0647ABF2468E30B008C5A34 /* EditProductViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditProductViewController.swift; sourceTree = "<group>"; };
E0647AC02468E30B008C5A34 /* EditProductViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EditProductViewController.xib; sourceTree = "<group>"; };
E06524EB2458008900CA22E2 /* RuKuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuKuViewController.swift; sourceTree = "<group>"; };
E06524EC2458008900CA22E2 /* RuKuViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RuKuViewController.xib; sourceTree = "<group>"; };
E06524EF24580AAC00CA22E2 /* RuKuJiaGeCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuKuJiaGeCell.swift; sourceTree = "<group>"; };
......@@ -603,6 +599,8 @@
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>"; };
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>"; };
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>"; };
......@@ -737,8 +735,6 @@
E0F1BE372469220D003015B2 /* libopencore-amrnb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = "libopencore-amrnb.a"; sourceTree = "<group>"; };
E0F1BE4624692379003015B2 /* ItemCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ItemCell.swift; sourceTree = "<group>"; };
E0F1BE4724692379003015B2 /* ItemCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ItemCell.xib; sourceTree = "<group>"; };
E0F1BE4A24692F07003015B2 /* EditProductImgCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditProductImgCell.swift; sourceTree = "<group>"; };
E0F1BE4B24692F07003015B2 /* EditProductImgCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = EditProductImgCell.xib; sourceTree = "<group>"; };
E0F3C2C924590C86006F0D1F /* XinZengAndBianJiKeHuViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = XinZengAndBianJiKeHuViewController.swift; sourceTree = "<group>"; };
E0F3C2CA24590C86006F0D1F /* XinZengAndBianJiKeHuViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = XinZengAndBianJiKeHuViewController.xib; sourceTree = "<group>"; };
E0F97B012451228A001BD600 /* GLAlertSelectView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GLAlertSelectView.swift; sourceTree = "<group>"; };
......@@ -1766,12 +1762,10 @@
children = (
E0F97B062451620B001BD600 /* ProductDetailViewController.swift */,
E0F97B072451620B001BD600 /* ProductDetailViewController.xib */,
E0647ABF2468E30B008C5A34 /* EditProductViewController.swift */,
E0647AC02468E30B008C5A34 /* EditProductViewController.xib */,
E0F1BE4A24692F07003015B2 /* EditProductImgCell.swift */,
E0F1BE4B24692F07003015B2 /* EditProductImgCell.xib */,
E0F1BE4624692379003015B2 /* ItemCell.swift */,
E0F1BE4724692379003015B2 /* ItemCell.xib */,
E07C7F84246BD8AB000B0714 /* EditProductViewController.swift */,
E07C7F85246BD8AB000B0714 /* EditProductViewController.xib */,
);
path = "商品详情";
sourceTree = "<group>";
......@@ -2400,8 +2394,8 @@
E09B03C12445B96500211A51 /* FgPassViewController.xib in Resources */,
E06524EE2458008900CA22E2 /* RuKuViewController.xib in Resources */,
E06524F624580BB600CA22E2 /* BaoZhiQiCell.xib in Resources */,
E07C7F87246BD8AB000B0714 /* EditProductViewController.xib in Resources */,
E0D197C7244845FD002B080C /* PersonCenterViewController.xib in Resources */,
E0F1BE4D24692F07003015B2 /* EditProductImgCell.xib in Resources */,
E07B1E5F24591AA50055BA3C /* KeHuXQViewController.xib in Resources */,
E0707DD624624B5200E039A8 /* AMap.bundle in Resources */,
E02DDD83244FD15B00ABB707 /* TitleAndSwitchHeaderView.xib in Resources */,
......@@ -2414,7 +2408,6 @@
E0A409C42463F31600CFF109 /* ShouZhiTongJiViewController.xib in Resources */,
E0F1BE4924692379003015B2 /* ItemCell.xib in Resources */,
E01C26B72446AF3100ADCC70 /* DemoViewController.xib in Resources */,
E0647AC22468E30B008C5A34 /* EditProductViewController.xib in Resources */,
F9DDBE972457D3EC00A32CB2 /* WebViewController.xib in Resources */,
E0F97B0424512299001BD600 /* GLAlertSelectView.xib in Resources */,
F9023F6E2449A9B100DD5A63 /* TitleAndTFCell.xib in Resources */,
......@@ -2730,8 +2723,8 @@
E09B03A12445AF7100211A51 /* Define.swift in Sources */,
F961D271245016B7007FBE70 /* SelectContentView.swift in Sources */,
F933F6C02452C68B00189561 /* PKHUDSystemActivityIndicatorView.swift in Sources */,
E0F1BE4C24692F07003015B2 /* EditProductImgCell.swift in Sources */,
E08B0674244A98B2001D2E01 /* WareHouseSpCell.swift in Sources */,
E07C7F86246BD8AB000B0714 /* EditProductViewController.swift in Sources */,
E0A2E81E24552F0A00D6DB34 /* TilteAndTextViewCell.swift in Sources */,
F9531F3D2465108800724BEE /* JXPhotoBrowserAnimatedTransitioning.swift in Sources */,
E0D197CA24484D90002B080C /* PersonCenterCell.swift in Sources */,
......@@ -2827,7 +2820,6 @@
F9531F442465108800724BEE /* JXPhotoBrowserFadeAnimator.swift in Sources */,
F956D5AD246A2D9C003FF510 /* LMNLine.m in Sources */,
E088CC8D24470BF0000DAA8A /* CodeView.swift in Sources */,
E0647AC12468E30B008C5A34 /* EditProductViewController.swift in Sources */,
E01EA1A4245A60E000F019D5 /* XiaDanChengGongViewController.swift in Sources */,
F94A314D2462582F00FEC38E /* GeneralInfoModel.swift in Sources */,
E02DDD8D244FE43900ABB707 /* NewCreateFooter.swift in Sources */,
......
......@@ -11,75 +11,130 @@ import RongIMKit
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate,RCConnectionStatusChangeDelegate,RCIMClientReceiveMessageDelegate,UNUserNotificationCenterDelegate {
func onReceived(_ message: RCMessage!, left nLeft: Int32, object: Any!) {
print("message == ",message.content)
}
func onConnectionStatusChanged(_ status: RCConnectionStatus) {
print("changed == ",status.rawValue)
}
func onReceived(_ message: RCMessage!, left nLeft: Int32, object: Any!, offline: Bool, hasPackage: Bool) {
print("onReceived == ",message.content)
}
var RY_App_Key = "3argexb63sxae"
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
RCIM.shared()?.initWithAppKey(RY_App_Key)
registerNotification(application)
RCIMClient.shared()?.connect(withToken: "SMJo9B9AUTIHHcHCuZq8soPnFqzfPZJIh7xoVOlRtu8=@ta3m.cn.rongnav.com;ta3m.cn.rongcfg.com", success: { (userId) in
print("userid = \(userId)")
}, error: { (status) in
print("status = \(status)")
}, tokenIncorrect: {
print("错误")
})
RCIMClient.shared()?.setRCConnectionStatusChangeDelegate(self)
RCIMClient.shared()?.setReceiveMessageDelegate(self, object: nil)
return true
}
func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
application.registerForRemoteNotifications()
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
let nsdataStr = NSData(data: deviceToken)
let datastr = nsdataStr.description.replacingOccurrences(of: "<", with: "").replacingOccurrences(of: ">", with: "").replacingOccurrences(of: " ", with: "")
print("deviceToken:\(datastr)")
RCIMClient.shared()?.setDeviceToken(datastr)
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
//TODO: 注册失败后的结果, 可以在这里记录失败结果, 以后再伺机弹框给用户打开通知
print("错误=== ",error)
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
class AppDelegate: UIResponder,UIApplicationDelegate,UNUserNotificationCenterDelegate{
var RY_App_Key = "3argexb63sxae"
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
RCIM.shared()?.initWithAppKey(RY_App_Key)
registerNotification(application)
// RCIMClient.shared()?.connect(withToken: "SMJo9B9AUTIHHcHCuZq8soPnFqzfPZJIh7xoVOlRtu8=@ta3m.cn.rongnav.com;ta3m.cn.rongcfg.com", success: { (userId) in
// print("userid = \(userId)")
// }, error: { (status) in
// print("status = \(status)")
// }, tokenIncorrect: {
// print("错误")
// })
return true
}
func userNotificationCenter(_ center: UNUserNotificationCenter, openSettingsFor notification: UNNotification?) {
print("通知触发--111--")
}
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
print("通知触发--222--")
}
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
print("通知触发-333---")
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
//TODO: 注册失败后的结果, 可以在这里记录失败结果, 以后再伺机弹框给用户打开通知
print("错误=== ",error)
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
RCIMClient.shared()?.setDeviceTokenData(deviceToken)
}
// MARK: UISceneSession Lifecycle
func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// Called when a new scene session is being created.
// Use this method to select a configuration to create the new scene with.
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
}
func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// Called when the user discards a scene session.
// If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// Use this method to release any resources that were specific to the discarded scenes, as they will not return.
}
}
//class AppDelegate: UIResponder, UIApplicationDelegate,RCConnectionStatusChangeDelegate,RCIMClientReceiveMessageDelegate,UNUserNotificationCenterDelegate {
// func onReceived(_ message: RCMessage!, left nLeft: Int32, object: Any!) {
// print("message == ",message.content)
// }
//
//
// func onConnectionStatusChanged(_ status: RCConnectionStatus) {
// print("changed == ",status.rawValue)
// }
// func onReceived(_ message: RCMessage!, left nLeft: Int32, object: Any!, offline: Bool, hasPackage: Bool) {
// print("onReceived == ",message.content)
// }
// var RY_App_Key = "3argexb63sxae"
// func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
//
// RCIM.shared()?.initWithAppKey(RY_App_Key)
// registerNotification(application)
//
//
// RCIMClient.shared()?.connect(withToken: "SMJo9B9AUTIHHcHCuZq8soPnFqzfPZJIh7xoVOlRtu8=@ta3m.cn.rongnav.com;ta3m.cn.rongcfg.com", success: { (userId) in
// print("userid = \(userId)")
// }, error: { (status) in
// print("status = \(status)")
// }, tokenIncorrect: {
// print("错误")
// })
// RCIMClient.shared()?.setRCConnectionStatusChangeDelegate(self)
// RCIMClient.shared()?.setReceiveMessageDelegate(self, object: nil)
//
//
// return true
// }
// func application(_ application: UIApplication, didRegister notificationSettings: UIUserNotificationSettings) {
//
// application.registerForRemoteNotifications()
// }
//
//
// func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
// let nsdataStr = NSData(data: deviceToken)
// let datastr = nsdataStr.description.replacingOccurrences(of: "<", with: "").replacingOccurrences(of: ">", with: "").replacingOccurrences(of: " ", with: "")
// print("deviceToken:\(datastr)")
//
// RCIMClient.shared()?.setDeviceToken(datastr)
//
// }
//
// func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
// //TODO: 注册失败后的结果, 可以在这里记录失败结果, 以后再伺机弹框给用户打开通知
// print("错误=== ",error)
// }
//
//
//
// // MARK: UISceneSession Lifecycle
//
// func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
// // Called when a new scene session is being created.
// // Use this method to select a configuration to create the new scene with.
// return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
// }
//
//
// func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
// // Called when the user discards a scene session.
// // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
// // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
// }
//}
extension AppDelegate{
......
......@@ -60,7 +60,13 @@
</dict>
<key>UIBackgroundModes</key>
<array>
<string>audio</string>
<string>bluetooth-central</string>
<string>bluetooth-peripheral</string>
<string>external-accessory</string>
<string>fetch</string>
<string>location</string>
<string>processing</string>
<string>remote-notification</string>
</array>
<key>UILaunchStoryboardName</key>
......
......@@ -13,6 +13,12 @@ import UIKit
}
class AddImgCell: UITableViewCell {
var delegate:AddImgCellDelegate?
var isEdit:Bool?{
willSet{
isEdit = newValue
addBtn.isHidden = !isEdit!
}
}
@IBAction func btnClick(_ sender: Any) {
delegate?.AddImgCellBtnClick?(cell: self)
}
......@@ -89,7 +95,10 @@ class AddImgCell: UITableViewCell {
make.right.equalTo(img.snp_right).offset(6)
make.width.height.equalTo(15)
}
delImg.isHidden = isEdit!
let delBtn = UIButton()
delBtn.isUserInteractionEnabled = isEdit!
scrollView!.addSubview(delBtn)
delBtn.tag = i
delBtn.snp.makeConstraints { (make) in
......
......@@ -16,6 +16,7 @@ class ShangPinGguiGeCell: UITableViewCell {
delegate?.ShangPinGguiGeCellEditAction?(cell: self)
}
// var itemIdx:Int?
@IBOutlet weak var btn: UIButton!
@IBOutlet weak var tempLbl: UILabel!
@IBOutlet weak var weightLbl: UILabel!
@IBOutlet weak var guiGeLbl: UILabel!
......
......@@ -8,7 +8,11 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner">
<connections>
<outlet property="btn" destination="yWF-ML-clI" id="Bg6-Sd-ken"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="ShangPinGguiGeCell" customModule="GeliBusinessPlatform" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="146"/>
......@@ -149,6 +153,7 @@
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="btn" destination="yWF-ML-clI" id="Doh-Sc-3q4"/>
<outlet property="danWeiLbl" destination="oOy-dE-JIB" id="Dw6-Zt-80o"/>
<outlet property="guiGeLbl" destination="GPm-DS-HCD" id="ePF-lx-scy"/>
<outlet property="sellPriceLbl" destination="Mw0-dB-6KQ" id="ofk-s2-w0v"/>
......
//
// EditProductImgCell.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/5/11.
// Copyright © 2020 junye lu. All rights reserved.
//
import UIKit
class EditProductImgCell: UITableViewCell {
override func awakeFromNib() {
super.awakeFromNib()
self.selectionStyle = .none
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" rowHeight="123" id="KGk-i7-Jjw" customClass="EditProductImgCell" customModule="GeliBusinessPlatform" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="341" height="123"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
<rect key="frame" x="0.0" y="0.0" width="341" height="123"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Rz4-c4-48Q">
<rect key="frame" x="15" y="15" width="311" height="93"/>
</button>
</subviews>
<constraints>
<constraint firstItem="Rz4-c4-48Q" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" constant="15" id="FGl-bQ-V3Q"/>
<constraint firstItem="Rz4-c4-48Q" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="MmP-IT-ujm"/>
<constraint firstAttribute="trailing" secondItem="Rz4-c4-48Q" secondAttribute="trailing" constant="15" id="VDi-Wb-lDd"/>
<constraint firstAttribute="bottom" secondItem="Rz4-c4-48Q" secondAttribute="bottom" constant="15" id="YOl-E2-RKL"/>
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<point key="canvasLocation" x="147.10144927536234" y="130.91517857142856"/>
</tableViewCell>
</objects>
</document>
//
// EditProductViewController.swift
// ProductDetailViewController.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/5/11.
// 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,UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout{
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 isEdit:Bool = false
var selectIdx:IndexPath = IndexPath(item: 0, section: 0)
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 = "99"
var shangPinStatusArr = ["热销","爆款","新品","促销","外采","团购"]
var yunShuType = "99"
var yunShuTypeArr = ["冷链","常温","热链"]
//MARK:--保存按钮
@IBOutlet weak var bottomView: UIView!
@IBOutlet weak var listView: UITableView!
@IBOutlet weak var btmView: 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 = "商品详情"
navbar.rightImg = UIImage(named: "fenxiang")
self.view.addSubview(navbar)
SetTopFrameView(view: listView, btmView: btmView)
listView.separatorStyle = .none
listTbv.separatorStyle = .none
listTbv.snp.makeConstraints { (make) in
make.top.equalTo(NavCGRect.height)
make.left.right.equalTo(0)
make.bottom.equalTo(bottomView.snp_top)
}
listView.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFCell")
listView.register(UINib(nibName: "TitleAndSwitchCell", bundle: nil), forCellReuseIdentifier: "TitleAndSwitchCell")
listView.register(UINib(nibName: "ShangPinGguiGeCell", bundle: nil), forCellReuseIdentifier: "ShangPinGguiGeCell")
listView.register(UINib(nibName: "AddImgCell", bundle: nil), forCellReuseIdentifier: "AddImgCell")
listView.register(UINib(nibName: "EditProductImgCell", bundle: nil), forCellReuseIdentifier: "EditProductImgCell")
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
let titleArr = ["商品信息","商品图片","商品规格","预售设置","其它信息","商品详情"]
let spxxArr = ["商品名称","商品类型","商品分类","品牌","起卖数量","是否清真","是否询价"]
let sptpArr = ["商品封面图(限一张)","商品主图(限五张)"]
let qtxxArr = ["关键字","物流费用","国家","商品状态","运输方式"]
let spxxHolder = ["请输入商品名称","请选择商品类型","请选择商品分类","请选择品牌","请输入起卖数量","是否清真","是否询价"]
let qtxxHolder = ["请输入关键字","请输入物流费用","请选择国家","请选择商品状态","请选择运输方式"]
//MARK: - cell delegate
func numberOfSections(in tableView: UITableView) -> Int {
return 5
return 6
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
switch section {
case 0:return 7
case 0: return 7
case 1:return 2
case 2:return 1
case 3:return 5
case 3:return 4
case 4:return 5
default:return 2
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
switch indexPath.section {
case 0:
return 49
case 1:
return 148.5
case 2:
return 149
case 3:
return 49
default:
return 49
}
}
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: "TitleAndSwitchCell") as! TitleAndSwitchCell
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: "TitleAndTFCell") as! TitleAndTFCell
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtn") as! TitleAndBtnCell
cell.nameLbl.text = spxxArr[indexPath.row]
cell.textTF.placeholder = spxxHolder[indexPath.row]
cell.textTF.isUserInteractionEnabled = isEdit
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: "AddImgCell") as! AddImgCell
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:
let cell = tableView.dequeueReusableCell(withIdentifier: "ShangPinGguiGeCell") as! ShangPinGguiGeCell
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:
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
cell.nameLbl.text = qtxxArr[indexPath.row]
cell.textTF.isUserInteractionEnabled = isEdit
cell.textTF.placeholder = qtxxHolder[indexPath.row]
return cell
default:
if indexPath.row == 0 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
cell.nameLbl.text = "商品文案"
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
cell.textTF.placeholder = "请输入商品文案"
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "EditProductImgCell") as! EditProductImgCell
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? {
let view = UIView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39*glscale))
let lbl = UILabel(frame: CGRect(x: 15*glscale, y: 15*glscale, width: fullScreenWidth, height: 21*glscale))
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 {
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(39)
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.equalTo(0)
make.height.equalTo(39)
make.top.right.bottom.equalTo(0)
make.width.equalTo(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)
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 {
return 81
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*glscale))
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 {
return 10*glscale
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: 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 != "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 3
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
......@@ -195,7 +644,8 @@ class EditProductViewController: BaseViewController,UITableViewDelegate,UITableV
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectIdx = indexPath
//刷新cell
print("selectItem",selectIdx?.item)
listTbv.reloadData()
collectionView.reloadData()
}
}
......@@ -10,8 +10,8 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="EditProductViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<connections>
<outlet property="btmView" destination="Hef-2C-dpL" id="WXp-fR-eCV"/>
<outlet property="listView" destination="zO1-i9-3W0" id="D4J-3v-H8z"/>
<outlet property="bottomView" destination="eFg-iG-awf" id="UXR-sY-RHK"/>
<outlet property="listTbv" destination="8Fv-Ss-fcb" id="xab-1c-WUC"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......@@ -20,47 +20,47 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="CCz-KF-dNw">
<rect key="frame" x="0.0" y="812" width="414" height="1"/>
<color key="backgroundColor" name="灰色分界线"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="F0s-Wh-OEd"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Hef-2C-dpL">
<rect key="frame" x="0.0" y="812" width="414" height="84"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="drN-vh-kV3">
<rect key="frame" x="0.0" y="813" width="414" height="83"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
</view>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" translatesAutoresizingMaskIntoConstraints="NO" id="zO1-i9-3W0">
<rect key="frame" x="0.0" y="44" width="414" height="768"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="eFg-iG-awf">
<rect key="frame" x="0.0" y="813" width="414" height="49"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="Yga-Ec-b4a"/>
</constraints>
</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">
<rect key="frame" x="0.0" y="44" width="414" height="769"/>
<color key="backgroundColor" name="白色背景色"/>
<connections>
<outlet property="dataSource" destination="-1" id="PZm-Wn-Pzt"/>
<outlet property="delegate" destination="-1" id="GzF-hc-T4S"/>
<outlet property="dataSource" destination="-1" id="UML-aq-eZJ"/>
<outlet property="delegate" destination="-1" id="LEW-Yi-wxv"/>
</connections>
</tableView>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="zO1-i9-3W0" secondAttribute="trailing" id="2Nb-pb-HRv"/>
<constraint firstItem="Hef-2C-dpL" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="5GE-8U-XuF"/>
<constraint firstItem="Hef-2C-dpL" firstAttribute="top" secondItem="CCz-KF-dNw" secondAttribute="top" id="5b2-d0-S4n"/>
<constraint firstAttribute="bottom" secondItem="Hef-2C-dpL" secondAttribute="bottom" id="7ca-jf-iJU"/>
<constraint firstItem="CCz-KF-dNw" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="8g4-28-X0f"/>
<constraint firstItem="zO1-i9-3W0" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="Hhx-kG-9wz"/>
<constraint firstItem="zO1-i9-3W0" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="Mwt-MD-rim"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="CCz-KF-dNw" secondAttribute="trailing" id="NbZ-fZ-NUu"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Hef-2C-dpL" secondAttribute="trailing" id="iWW-R1-Kxq"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="CCz-KF-dNw" secondAttribute="bottom" constant="49" id="n7f-cH-hVx"/>
<constraint firstItem="CCz-KF-dNw" firstAttribute="top" secondItem="zO1-i9-3W0" secondAttribute="bottom" id="xtA-9H-wsx"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="drN-vh-kV3" secondAttribute="trailing" id="5Ua-1G-oDk"/>
<constraint firstItem="eFg-iG-awf" firstAttribute="top" secondItem="8Fv-Ss-fcb" secondAttribute="bottom" id="6nY-7j-452"/>
<constraint firstItem="8Fv-Ss-fcb" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="6vq-Th-6hv"/>
<constraint firstAttribute="bottom" secondItem="drN-vh-kV3" secondAttribute="bottom" id="EzG-9Q-6Cg"/>
<constraint firstItem="drN-vh-kV3" firstAttribute="top" secondItem="eFg-iG-awf" secondAttribute="top" id="PwX-Ue-uGH"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="8Fv-Ss-fcb" secondAttribute="trailing" id="WIB-ml-ERa"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="eFg-iG-awf" secondAttribute="trailing" id="b1W-KS-K4v"/>
<constraint firstItem="eFg-iG-awf" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="eBR-6r-zfV"/>
<constraint firstItem="8Fv-Ss-fcb" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="j0E-Bg-S0z"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="eFg-iG-awf" secondAttribute="bottom" id="nwH-n3-0GY"/>
<constraint firstItem="drN-vh-kV3" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="pa9-O7-nAr"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="131.8840579710145" y="131.91964285714286"/>
<point key="canvasLocation" x="131.8840579710145" y="130.58035714285714"/>
</view>
</objects>
<resources>
<namedColor name="灰色分界线">
<color red="0.92941176470588238" green="0.92941176470588238" blue="0.92941176470588238" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<namedColor name="白色背景色">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
......@@ -46,14 +46,11 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
var guiGeArr:NSMutableArray = []//根据规格资料数量控制右上角新增按钮是否显示
//
@IBOutlet weak var lgBtnLbl: UILabel!
@IBOutlet weak var btmView: UIView!
let btmTitleArr = ["编辑","入库","下架","删除"]
var isYuShouShangPin:Bool?
@objc func bottomBtnClick(sender:UIButton){
print(sender.titleLabel?.text)
}
var generalInfoModel : GeneralInfoModel? = nil
override func viewDidLoad() {
super.viewDidLoad()
......
......@@ -10,10 +10,9 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ProductDetailViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<connections>
<outlet property="btmView" destination="yIq-1z-cr8" id="bpj-Sz-E3q"/>
<outlet property="lgBtnLbl" destination="oKy-CJ-Gra" id="AfZ-bK-cby"/>
<outlet property="listTbv" destination="IHM-ED-ttx" id="Huh-Oq-0XN"/>
<outlet property="submitBtn" destination="6Jp-Xx-Q5Z" id="C6U-uz-2vx"/>
<outlet property="lgBtnLbl" destination="oKy-CJ-Gra" id="S78-zK-4bF"/>
<outlet property="listTbv" destination="IHM-ED-ttx" id="eEK-bu-GOf"/>
<outlet property="submitBtn" destination="6Jp-Xx-Q5Z" id="Qnx-Yx-zr5"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......@@ -26,14 +25,10 @@
<rect key="frame" x="0.0" y="44" width="414" height="769"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<connections>
<outlet property="dataSource" destination="-1" id="40h-ag-zwa"/>
<outlet property="delegate" destination="-1" id="OaC-hl-du0"/>
<outlet property="dataSource" destination="-1" id="asC-XB-hGM"/>
<outlet property="delegate" destination="-1" id="Zd9-EK-1hh"/>
</connections>
</tableView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="yIq-1z-cr8">
<rect key="frame" x="0.0" y="813" width="414" height="83"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="6Jp-Xx-Q5Z" customClass="LGButton" customModule="LGButton">
<rect key="frame" x="0.0" y="813" width="414" height="83"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
......@@ -47,7 +42,7 @@
<userDefinedRuntimeAttribute type="boolean" keyPath="gradientHorizontal" value="YES"/>
</userDefinedRuntimeAttributes>
<connections>
<action selector="submitAction:" destination="-1" eventType="touchUpInside" id="Miy-vj-Bgk"/>
<action selector="submitAction:" destination="-1" eventType="touchUpInside" id="dZJ-kb-T6Q"/>
</connections>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="oKy-CJ-Gra">
......@@ -69,16 +64,12 @@
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstItem="yIq-1z-cr8" firstAttribute="top" secondItem="oKy-CJ-Gra" secondAttribute="top" id="0Xn-em-QbP"/>
<constraint firstItem="6Jp-Xx-Q5Z" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" id="2wU-Pb-jkw"/>
<constraint firstItem="IHM-ED-ttx" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="Ijg-HN-jhj"/>
<constraint firstItem="yIq-1z-cr8" firstAttribute="trailing" secondItem="fnl-2z-Ty3" secondAttribute="trailing" id="Iur-5y-NVq"/>
<constraint firstItem="IHM-ED-ttx" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="JIK-LD-ec2"/>
<constraint firstAttribute="trailing" secondItem="6Jp-Xx-Q5Z" secondAttribute="trailing" id="QFT-HA-63W"/>
<constraint firstItem="oKy-CJ-Gra" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="YP4-j3-FFj"/>
<constraint firstItem="yIq-1z-cr8" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="cQE-LF-lPv"/>
<constraint firstItem="IHM-ED-ttx" firstAttribute="top" secondItem="fnl-2z-Ty3" secondAttribute="top" id="eh4-LD-K1H"/>
<constraint firstAttribute="bottom" secondItem="yIq-1z-cr8" secondAttribute="bottom" id="gLL-aE-Fps"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="oKy-CJ-Gra" secondAttribute="trailing" id="h6U-Oq-xig"/>
<constraint firstItem="6Jp-Xx-Q5Z" firstAttribute="top" secondItem="IHM-ED-ttx" secondAttribute="bottom" id="hzO-95-bIf"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="oKy-CJ-Gra" secondAttribute="bottom" id="lOJ-Tu-3fB"/>
......
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