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

代客下单完成

parent 768f0820
......@@ -10,6 +10,7 @@ import UIKit
class DKXDAdrCell: UITableViewCell {
@IBOutlet weak var contentLblRightOffset: NSLayoutConstraint!
@IBOutlet weak var adrLbl: UILabel!
@IBOutlet weak var contentLbl: UILabel!
@IBOutlet weak var nameLbl: UILabel!
......
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" 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"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......@@ -23,7 +23,7 @@
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QvD-ve-9Fp">
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="QvD-ve-9Fp">
<rect key="frame" x="325" y="14" width="18" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="18" id="K4r-yw-iY5"/>
......@@ -51,7 +51,7 @@
<constraint firstAttribute="width" constant="7" id="rEc-Do-HBZ"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="寄" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="r5M-d4-Eze">
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="寄" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="r5M-d4-Eze">
<rect key="frame" x="297" y="14" width="18" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="18" id="0h9-G0-bSR"/>
......@@ -73,7 +73,7 @@
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="内容" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dVC-Xx-6Hy">
<rect key="frame" x="260" y="15" width="27" height="16"/>
<rect key="frame" x="315" y="15" width="27" height="16"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
......@@ -93,7 +93,7 @@
</view>
</subviews>
<constraints>
<constraint firstItem="r5M-d4-Eze" firstAttribute="leading" secondItem="dVC-Xx-6Hy" secondAttribute="trailing" constant="10" id="22v-tZ-ib5"/>
<constraint firstItem="r5M-d4-Eze" firstAttribute="leading" secondItem="dVC-Xx-6Hy" secondAttribute="trailing" constant="-45" id="22v-tZ-ib5"/>
<constraint firstItem="5kw-XG-gZD" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="9VS-AY-U3V"/>
<constraint firstItem="dVC-Xx-6Hy" firstAttribute="centerY" secondItem="5kw-XG-gZD" secondAttribute="centerY" id="D7X-Vs-1Cy"/>
<constraint firstItem="VnT-fQ-1Wc" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="Edw-XO-oDA"/>
......@@ -114,6 +114,7 @@
<connections>
<outlet property="adrLbl" destination="hiB-wE-OIe" id="FK3-AL-t6u"/>
<outlet property="contentLbl" destination="dVC-Xx-6Hy" id="gtL-Pj-o6B"/>
<outlet property="contentLblRightOffset" destination="22v-tZ-ib5" id="GHU-md-LZu"/>
<outlet property="nameLbl" destination="5kw-XG-gZD" id="UV4-nX-ceM"/>
<outlet property="status1" destination="QvD-ve-9Fp" id="vJC-ZC-Cxd"/>
<outlet property="status2" destination="r5M-d4-Eze" id="yE5-x7-b6e"/>
......
......@@ -9,12 +9,14 @@
import UIKit
@objc protocol XuanZeShangPinCellDelegate {
@objc optional func XuanZeShangPinCellBtnClick(index:IndexPath)
@objc optional func XuanZeShangPinCellTextChange(index:IndexPath)
@objc optional func XuanZeShangPinCellTextChange(index:IndexPath,sender:XuanZeShangPinCell)
}
class XuanZeShangPinCell: UITableViewCell {
class XuanZeShangPinCell: UITableViewCell{
var imgUrlPath:String?
var sku_id:Int?
var model:GetGoodsInfoDataModel?
var maxNum :Int? = 0
@IBOutlet weak var iconImg: UIImageView!
@IBOutlet weak var priceLbl: UILabel!
@IBOutlet weak var yuShouImg: UIImageView!
......@@ -27,10 +29,20 @@ class XuanZeShangPinCell: UITableViewCell {
@IBAction func addOrDelAction(_ sender: UIButton) {
let str = countTF.text as! NSString
if sender.tag == 0 {//加
countTF.text = "\(str.integerValue + 1)"
if maxNum! > 0 {
if (str.integerValue + 1) > maxNum! {
let maxStr = StringByInt(number: maxNum!)
HUD.flash(.label("不可超过最大数量" + maxStr),delay: 1.2)
countTF.text = StringByInt(number: maxNum!)
}else{
countTF.text = "\(str.integerValue + 1)"
}
}else{
countTF.text = "\(str.integerValue + 1)"
}
}else {
if str.integerValue > 0 {
countTF.text = "\(str.integerValue - 1)"
if str.integerValue > 1 {
countTF.text = "\(str.integerValue - 1)"
}
}
}
......@@ -50,14 +62,27 @@ class XuanZeShangPinCell: UITableViewCell {
self.selectionStyle = .none
priceTF.addTarget(self, action: #selector(textChange(sender:)), for: .allEditingEvents)
countTF.addTarget(self, action: #selector(textChange(sender:)), for: .allEditingEvents)
// Initialization code
}
@objc func textChange(sender:UITextField){
delegate?.XuanZeShangPinCellTextChange?(index: idx!)
let num = sender.text as! NSString
let maxStr = StringByInt(number: maxNum!)
if sender == countTF{
if num.integerValue > maxNum! {
HUD.flash(.label("不可超过最大数量" + maxStr),delay: 1.2)
countTF.text = maxStr
}
}
delegate?.XuanZeShangPinCellTextChange?(index: idx!,sender:self)
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
......
......@@ -23,6 +23,14 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
//XuanZeShangPinCell
@IBAction func submitAction(_ sender: Any) {
print("submit")
for item in inputData{
if item.priceTF.text!.count == 0 {
HUD.flash(.label("请输入商品单价"),delay: 1.2)
return
}
}
if barTitle == "修改价格"{
delegate?.XuanZeShangPinViewControllerEdit(inputData:inputData)
}else{
......@@ -47,6 +55,8 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
var selectArr:Array<GetGoodsInfoDataModel> = []
var selectIdxArr:Array<IndexPath> = []
var inputData:Array<XuanZeShangPinCell> = []
var isSearch:Bool = false
var seacrchArr:Array<GetGoodsInfoDataModel> = [] //搜索数据
override func viewDidLoad() {
super.viewDidLoad()
navbar.title = barTitle
......@@ -90,8 +100,8 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
make.height.equalTo(30)
}
searchV = searchBr
searchBr.placeholderStr = "请输入品牌名称/商品编码"
searchBr.cornerRadius = 30*0.5
searchBr.placeholderStr = "请输入商品名称"
searchBr.cornerRadius = 35/2.0
searchBr.delegate = self
searchBr.delegateL = self
......@@ -99,12 +109,44 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
}
func clearSearchAction() {
print("清楚搜索文字")
isSearch = false
listView.reloadData()
}
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
print("点击搜索进行--")
isSearch = true
getSearch(sender: searchBar.text!)
listView.reloadData()
searchBar.resignFirstResponder()
}
func getSearch(sender:String) {
seacrchArr.removeAll()
datas.forEach { (md) in
if md.goods_name!.contains(sender) {
seacrchArr.append(md)
}
}
}
//MARK: - textfield编辑结束
func textFieldDidEndEditing(_ textField: UITextField) {
let idx = IndexPath(row: textField.tag, section: 0)
let cell = listView.cellForRow(at: idx) as! XuanZeShangPinCell
let num = textField.text as! NSString
if textField == cell.countTF {
if num.integerValue < 1 {
HUD.flash(.label("数量不得低于1"),delay: 1.2)
cell.countTF.text = "1"
}
}
if textField == cell.priceTF {
if num.floatValue <= 0 {
HUD.flash(.label("请输入商品单价"),delay: 1.2)
}
}
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
if barTitle == "修改价格"{
......@@ -176,7 +218,7 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.priceTF.keyboardType = .decimalPad
cell.priceTF.returnKeyType = .done
cell.countTF.returnKeyType = .done
if barTitle == "修改价格"{
let cell1 = inputData[indexPath.row]
cell.sku_id = cell1.sku_id
......@@ -207,7 +249,16 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.priceTF.text = model.price!
if isYuShou {//预售
if idx == indexPath {
cell.maxNum = model.adsale_inventory
var isSelectByData = false
selectArr.forEach { (md) in
if md.sku_id == model.sku_id {
isSelectByData = true
}
}
if isSelectByData {
cell.selectBtn.isSelected = true
cell.btmView.isHidden = false
cell.btmViewHeight.constant = 89
......@@ -217,27 +268,36 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.btmViewHeight.constant = 0
}
}else{//非预售
cell.maxNum = model.inventory
cell.selectBtn.isSelected = false
cell.btmView.isHidden = true
cell.btmViewHeight.constant = 0
for idx in selectIdxArr {
if idx == indexPath{
cell.selectBtn.isSelected = true
cell.btmView.isHidden = false
cell.btmViewHeight.constant = 89
}
var isSelectByData = false
selectArr.forEach { (md) in
if md.sku_id == model.sku_id {
isSelectByData = true
}
}
if isSelectByData {
cell.selectBtn.isSelected = true
cell.btmView.isHidden = false
cell.btmViewHeight.constant = 89
}
}
}
return cell
}
func XuanZeShangPinCellTextChange(index: IndexPath) {
let cell = listView.cellForRow(at: index) as! XuanZeShangPinCell
func XuanZeShangPinCellTextChange(index: IndexPath,sender:XuanZeShangPinCell) {
for i in 0 ..< inputData.count{
let item = inputData[i]
if cell.sku_id == item.sku_id{
inputData.insert(cell, at: i)
if sender.sku_id == item.sku_id{
inputData.insert(sender, at: i)
inputData.remove(at: i+1)
}
}
......@@ -266,11 +326,21 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
func XuanZeShangPinCellBtnClick(index:IndexPath) {
let cell = listView.cellForRow(at: index) as! XuanZeShangPinCell
if isYuShou{//预售
let model = datas[index.row]
if model.adsale_inventory == 0 {
HUD.flash(.label("库存为0,无法下单"),delay: 1.2)
return
}
idx = index
inputData.removeAll()
inputData.append(cell)
}else{//非预售
let data = datas[index.row]
if data.inventory == 0 {
HUD.flash(.label("库存为0,无法下单"),delay: 1.2)
return
}
let idx = selectArr.firstIndex { (model) -> Bool in
return (data.sku_id == model.sku_id)
}
......@@ -296,8 +366,12 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
if barTitle == "修改价格"{
return inputData.count
}
if isSearch {
return seacrchArr.count
}
return datas.count
}
}
......@@ -34,7 +34,7 @@ class GYSListViewController: BaseViewController,UITableViewDataSource,UITableVie
}
searchV = searchBr
searchBr.placeholderStr = "供应商名称/联系人/电话号码"
searchBr.cornerRadius = 30*0.5
searchBr.cornerRadius = 35/2.0
searchBr.delegate = self
searchBr.delegateL = self
......
......@@ -667,7 +667,7 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
break
case "物流费用":
cell.textTF.text = wuLiuPrice
cell.textTF.keyboardType = .numbersAndPunctuation
cell.textTF.keyboardType = .decimalPad
break
default:
break
......
......@@ -419,7 +419,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
break
case "物流费用":
cell.textTF.text = wuLiuPrice
cell.textTF.keyboardType = .numbersAndPunctuation
cell.textTF.keyboardType = .decimalPad
break
default:
break
......
......@@ -244,7 +244,7 @@ class SJMapViewController: UIViewController,AMapLocationManagerDelegate,MAMapVie
}
searchV = searchBr
searchBr.placeholderStr = "搜索地点"
searchBr.cornerRadius = 30*0.5
searchBr.cornerRadius = 35/2.0
searchBr.delegate = self
searchBr.delegateL = self
}
......
......@@ -29,7 +29,7 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
override func viewDidLoad() {
super.viewDidLoad()
navbar.title = "地址管理"
navbar.rightTitle = "新增"
// navbar.rightTitle = "新增"
self.view.addSubview(navbar)
HUD.flash(.progress)
......
<?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">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097" 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"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......@@ -10,7 +10,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="DiZhiGuanLiCell" customModule="GeliBusinessPlatform" customModuleProvider="target">
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="DiZhiGuanLiCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="79"/>
<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">
......@@ -30,7 +30,7 @@
<color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="寄" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jf6-0X-5eB">
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="寄" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jf6-0X-5eB">
<rect key="frame" x="189" y="15.5" width="18" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="18" id="KUq-24-4Xw"/>
......@@ -51,7 +51,7 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mWp-V0-KaZ">
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mWp-V0-KaZ">
<rect key="frame" x="217" y="15.5" width="18" height="18"/>
<constraints>
<constraint firstAttribute="width" constant="18" id="Yz5-IC-luF"/>
......
......@@ -34,7 +34,7 @@ class BingDingKeHuViewController: BaseViewController,UITableViewDelegate,UITable
}
searchV = searchBr
searchBr.placeholderStr = "客户名称/联系人/电话号码"
searchBr.cornerRadius = 30*0.5
searchBr.cornerRadius = 35/2.0
searchBr.delegate = self
searchBr.delegateL = self
......
......@@ -46,7 +46,7 @@ class KeHuListViewController: BaseViewController,UITableViewDelegate,UITableView
}
searchV = searchBr
searchBr.placeholderStr = "客户名称/联系人/电话号码"
searchBr.cornerRadius = 30*0.5
searchBr.cornerRadius = 35/2.0
searchBr.delegate = self
searchBr.delegateL = self
......
......@@ -39,7 +39,7 @@ class YingFuZKListViewController: BaseViewController,UISearchBarDelegate,SearchB
}
searchV = searchBr
searchBr.placeholderStr = "请输入品牌名称/商品编码"
searchBr.cornerRadius = 30*0.5
searchBr.cornerRadius = 35/2.0
searchBr.delegate = self
searchBr.delegateL = self
......
......@@ -31,7 +31,7 @@ class PuTongJieTiCell: UITableViewCell,UITextFieldDelegate {
priceTF.tag = 0
countTF.tag = 1
countTF.keyboardType = .numberPad
priceTF.keyboardType = .numbersAndPunctuation
priceTF.keyboardType = .decimalPad
priceTF.returnKeyType = .done
priceTF.delegate = self
// Initialization code
......
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