Commit 346d3d08 authored by lujunye's avatar lujunye

补充规格填写售价,重量输入格式错误提醒

parent 680fd596
......@@ -22,9 +22,7 @@ class TitleAndTFCell: UITableViewCell {
// Initialization code
}
@objc func textEditing(sender:UITextField){
// if sender.text!.count > 0 {
delegate?.textFieldContent?(content: sender.text!, cell: self)
// }
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
......
......@@ -237,18 +237,31 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
func textFieldDidEndEditing(_ textField: UITextField) {
switch textField.tag {
case 0:
if isPurnNumber(str: textField.text!) {
textField.text = formatShowNumber(value: textField.text!)
price = textField.text!
}else{
HUD.flash(.label("请输入正确的价格"), delay: 1.2)
textField.text = ""
price = textField.text!
}
break
case 2:
if isPurnNumber(str: textField.text!) {
textField.text = formatShowNumber(value: textField.text!)
weight = textField.text!
}else{
HUD.flash(.label("请输入正确的重量"), delay: 1.2)
textField.text = ""
price = textField.text!
}
break
default:
break
}
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
switch textField.tag {
case 1:
guiGe = textField.text!
......@@ -257,19 +270,19 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
break
}
return true
}
func PuTongJieTiClickDone() {
}
func PuTongJieTiClickDone() {
IQKeyboardManager.shared.resignFirstResponder()
}
//MARK: - cell delegate
func numberOfSections(in tableView: UITableView) -> Int {
}
//MARK: - cell delegate
func numberOfSections(in tableView: UITableView) -> Int {
if (navbar.title?.contains("编辑"))! {
return 4
}else{
return 3
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if section == 0 {
return titleArray.count
......@@ -282,9 +295,9 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
return 1
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
if indexPath.row < 3 {
......@@ -419,8 +432,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if isAllEditing == false {
return
}
......@@ -437,8 +450,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
self.navigationController?.popViewController(animated: true)
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 1 {
if isOpenYSSetting {
return 184.5
......@@ -455,10 +468,10 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
return 49
}
}
//header
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
//header
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
if section == 2 {//阶梯价设置
if isYuShouSetting {//预售阶梯价
......@@ -482,8 +495,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
if section != 0 {
if section == 2 {
if isYuShouSetting{
......@@ -494,9 +507,9 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
return 10
}
return 0.01
}
//footer
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
}
//footer
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
if section == 2 {
if barTitle?.contains("查看") == false {
if isJieTiOpen && selectYuShou == false{
......@@ -513,8 +526,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
let view = UIView()
return view
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
if section == 2 {
if isJieTiOpen && selectYuShou == false {
return 49
......@@ -524,16 +537,16 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
return 0.01
}
//MARK: - NEW CELL DELEGATE
}
//MARK: - NEW CELL DELEGATE
func YuShouCellTFContent(Price: NSString) {
func YuShouCellTFContent(Price: NSString) {
let arr = Price.components(separatedBy: "_")
yuShouPrice = arr[0]
ysKuCun = arr[1]
DJBiLi = arr[2]
}
func textFieldContent(content: String, cell: TitleAndTFCell) {
}
func textFieldContent(content: String, cell: TitleAndTFCell) {
switch cell.tag {
case 0:
price = content
......@@ -545,8 +558,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
weight = content
break
}
}
func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
}
func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
let cell = listTbv.cellForRow(at: IndexPath(row: view.tag, section: 0)) as! TitleAndBtnCell
if view.tag == 3 {
tempSelect = selectNum
......@@ -561,15 +574,15 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
selectView?.removeFromSuperview()
selectView = nil
}
}
var tempSelect:Int?
var itemDanWeiSelect:Int?
var tempSelect:Int?
var itemDanWeiSelect:Int?
func btnClick(content: String, cell: TitleAndBtnCell) {
func btnClick(content: String, cell: TitleAndBtnCell) {
if cell.tag == 3 {
if selectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
......@@ -602,18 +615,18 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
}
}
func switchStatus(sender: UISwitch) {//阶梯价设置
func switchStatus(sender: UISwitch) {//阶梯价设置
if sender.tag == 99 {
isYsJieTiOpen = sender.isOn
}else{
isJieTiOpen = sender.isOn
}
listTbv.reloadData()
}
}
func switchClick(content: UISwitch, cell: TitleAndSwitchCell) {
func switchClick(content: UISwitch, cell: TitleAndSwitchCell) {
//控制
if cell.tag == 5{
let idxPath = IndexPath(row: 0, section: 1)
......@@ -624,15 +637,15 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
}
}
func newCreateSwitchStatus(sender: UISwitch) {
}
func newCreateSwitchStatus(sender: UISwitch) {
//打开switch 阶梯价设置
// isJieTiJiaSetting = sender.isOn
isJieTiOpen = sender.isOn
listTbv.reloadData()
}
}
func footerClickAction() {
func footerClickAction() {
if isAllEditing == false {
return
}
......@@ -643,14 +656,14 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
jieTiArr.append("")
}
listTbv.reloadData()
}
func YuShouCellSwitchStatus(sender: UISwitch) {
}
func YuShouCellSwitchStatus(sender: UISwitch) {
//控制
// isYuShouSetting = sender.isOn
isOpenYSSetting = sender.isOn
listTbv.reloadData()
}
func PuTongJieTiDelAction(sender: PuTongJieTiCell) {
}
func PuTongJieTiDelAction(sender: PuTongJieTiCell) {
if selectYuShou {
specalArr.remove(at: sender.tag)
listTbv.reloadData()
......@@ -659,35 +672,35 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
listTbv.reloadData()
}
}
func PuTongJieTiContentSp(price: String, count: String, cell: PuTongJieTiCell) {
}
func PuTongJieTiContentSp(price: String, count: String, cell: PuTongJieTiCell) {
specalArr.insert("\(price)_\(count)", at: cell.tag)
specalArr.remove(at: cell.tag+1)
}
func PuTongJieTiContent(price: String, count: String, cell: PuTongJieTiCell) {
}
func PuTongJieTiContent(price: String, count: String, cell: PuTongJieTiCell) {
jieTiArr.insert("\(price)_\(count)", at: cell.tag)
jieTiArr.remove(at: cell.tag+1)
}
}
func selectYuShou(sender: UIButton) {
func selectYuShou(sender: UIButton) {
if sender.tag == 0 {
selectYuShou = false
}else{
selectYuShou = true
}
listTbv.reloadData()
}
//MARK: - COLLECTIONVIEW DELEGATE
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
}
//MARK: - COLLECTIONVIEW DELEGATE
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat {
return 0
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return datasArr.count
}
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "ItemCell", for: indexPath)
as! ItemCell
cell.tag = indexPath.item
......@@ -701,8 +714,8 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
}
return cell
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
selectIdx = indexPath
//刷新cell
let dataDict = datasArr[selectIdx!.item]
......@@ -722,5 +735,5 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
selectYuShou = dataDict.selectYuShou
listTbv.reloadData()
collectionView.reloadData()
}
}
}
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