Commit e190d86e authored by lujunye's avatar lujunye

代客下单逻辑补充

parent 20e6b0bd
......@@ -25,6 +25,9 @@ import IQKeyboardManagerSwift
}
class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleAndSelectCellDelegate,KuWeiCellCellDelegate,UITextFieldDelegate{
var deSelectArr:Array<Int> = []
var isMultipleS:Bool = false
var contentView:UIView!
var delegate:GLAlertSelectViewDelegate?
......@@ -175,12 +178,12 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
cell.delegate = self
cell.tag = indexPath.row
let model = kuWeiArr[indexPath.row] as! ShopWarehouseDetailDataPositionModel
print("3",model.p_name)
cell.nameTF.text = model.p_name
cell.nameTF.delegate = self
cell.nameTF.isUserInteractionEnabled = false
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "selectTbvCell") as! TitleAndSelectCell
cell.titleLbl.text = dataArr[indexPath.row] as! String
cell.delegate = self
......@@ -200,6 +203,15 @@ class GLAlertSelectView: UIView,UITableViewDelegate,UITableViewDataSource,TitleA
cell.selectBtn.isSelected = true
}
}
print("deSelectArr.count",deSelectArr.count)
if deSelectArr.count > 0 {
for i in deSelectArr {
if i == indexPath.row {
cell.titleLbl.textColor = UIColor(named: "灰色字体颜色")
cell.selectBtn.isUserInteractionEnabled = false
}
}
}
return cell
}
@IBAction func submitClick(_ sender: Any) {
......
......@@ -10,6 +10,8 @@ import UIKit
import IQKeyboardManagerSwift
class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,UITableViewDelegate,DaiKeXiaDanFooterViewDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,DZGLViewControllerDelegate,XuanZeShangPinViewControllerDelegate,DaiKeXiaDanGouWuCellDelegate{
func DaiKeXiaDanGouWuCellDelAction(cell: DaiKeXiaDanGouWuCell) {
itemArr.remove(at: cell.tag)
listView.reloadData()
......@@ -41,17 +43,22 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
var itemArr:Array<Any> = []
var yuShouData:String?
var zhiFuType = 0
var zhiFuWay = 0
var zhiFuStatus = 0 //普通支付状态 & 尾款支付状态
var zhiFuWay = 0//普通支付方式 & 尾款支付方式
var tiHuoWay = 0
var chuHuoWay = 0
var dj_payStatus = 0//定金支付状态
var dj_payWay = 0//定金支付方式
var orderType:Int? //订单类型
var adrData:String?//地址数据
var glSelectView:GLAlertSelectView? = nil
var holderArr = ["未支付","未付款","自提","","暂不出库","0","0"]
let p3Arr = ["支付状态","支付方式","提货方式","选择地址","出货状态","运费","其他费用"]
var holderArr = ["未付款","未支付","自提","","暂不出库","0","0"]
let p2Arr = ["定金支付方式","定金支付状态"]
var holder2Arr = ["未付款","未支付"]
var p3Arr = ["支付方式","支付状态","提货方式","选择地址","出货状态","运费","其他费用"]
var footerView:DaiKeXiaDanFooterView?
@IBAction func submitAction(_ sender: Any) {
......@@ -68,6 +75,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
make.left.right.equalTo(0)
make.bottom.equalTo(btmView.snp_top)
}
listView.separatorStyle = .none
listView.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtnCell")
listView.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFCell")
......@@ -88,10 +96,10 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
}
let vc = XuanZeShangPinViewController()
vc.delegate = self
vc.barTitle = "选择商品"
if orderType == 1 {
vc.isYuShou = true
}
self.navigationController?.pushViewController(vc, animated: true)
}
//footer
......@@ -125,6 +133,21 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
make.bottom.right.equalTo(0)
make.left.equalTo(15)
}
if itemArr.count > 0 {
let btn = UIButton()
btn.setTitle("修改价格", for: .normal)
btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.addTarget(self, action: #selector(jumpToEditPrice), for: .touchUpInside)
view.addSubview(btn)
btn.snp.makeConstraints { (make) in
make.top.equalTo(9)
make.right.equalTo(0)
make.height.equalTo(30)
make.width.equalTo(82)
}
}
return view
}
return UIView()
......@@ -134,6 +157,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
switch section {
case 0:return 2
case 1:return itemArr.count
case 2: return 2
default:return p3Arr.count
}
}
......@@ -141,7 +165,14 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
if indexPath.section == 1 {
return 120
}
if indexPath.section == 2{
if indexPath.section == 2 {//新增预售
if orderType == 1 {
return 49
}else{
return 0.001
}
}
if indexPath.section == 3{
if indexPath.row == 3 {
if tiHuoWay != 1 {
return 0.001
......@@ -157,24 +188,50 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
switch view.tag {
case 1011:
dj_payWay = selectNum
holder2Arr.insert(zfWayArr[selectNum], at: 0)
holder2Arr.remove(at:1)
if dj_payWay != 0{
dj_payStatus = 3
holder2Arr.insert(zfTypeArr[dj_payStatus], at: 1)
holder2Arr.remove(at: 2)
}
break
case 1021:
dj_payStatus = selectNum
holder2Arr.insert(zfTypeArr[selectNum], at: 1)
holder2Arr.remove(at: 2)
break
case 100:
orderType = selectNum
if orderType == 1 {
if itemArr.count > 1{
itemArr.removeAll()
listView.reloadData()
}
}
zhiFuWay = 0
zhiFuStatus = 0
holderArr.insert("未付款", at: 0)
holderArr.remove(at: 1)
holderArr.insert("未支付", at: 1)
holderArr.remove(at: 2)
listView.reloadData()
break
case 101:
zhiFuType = selectNum
holderArr.insert(zfTypeArr[selectNum], at: 0)
holderArr.remove(at: 1)
zhiFuWay = selectNum
holderArr.insert(zfWayArr[selectNum], at: 0)
holderArr.remove(at:1)
if zhiFuWay != 0{
zhiFuStatus = 3
holderArr.insert(zfTypeArr[zhiFuStatus], at: 1)
holderArr.remove(at: 2)
}
break
case 102:
zhiFuWay = selectNum
holderArr.insert(zfWayArr[selectNum], at: 1)
holderArr.remove(at:2)
zhiFuStatus = selectNum
holderArr.insert(zfTypeArr[selectNum], at: 1)
holderArr.remove(at: 2)
break
case 103:
tiHuoWay = selectNum
......@@ -216,12 +273,40 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
cell.tag = indexPath.row
cell.delegate = self
return cell
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtnCell") as! TitleAndBtnCell
cell.btn.isUserInteractionEnabled = false
cell.delegate = self
cell.nameLbl.text = p2Arr[indexPath.row]
cell.contentLbl.text = holder2Arr[indexPath.row]
cell.tag = indexPath.row
return cell
default:
if indexPath.row < 5 {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtnCell") as! TitleAndBtnCell
cell.btn.isUserInteractionEnabled = false
cell.delegate = self
cell.nameLbl.text = p3Arr[indexPath.row]
if indexPath.row == 0 {
if orderType == 1 {
cell.nameLbl.text = "尾款支付方式"
}else{
cell.nameLbl.text = "支付方式"
}
p3Arr.insert(cell.nameLbl.text!, at: 0)
p3Arr.remove(at: 1)
}
if indexPath.row == 1 {
if orderType == 1 {
cell.nameLbl.text = "尾款支付状态"
}else{
cell.nameLbl.text = "支付状态"
}
p3Arr.insert(cell.nameLbl.text!, at: 1)
p3Arr.remove(at: 2)
}
cell.contentLbl.text = holderArr[indexPath.row]
cell.tag = indexPath.row
if adrData != nil {
......@@ -265,7 +350,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
return 0.01
}
func numberOfSections(in tableView: UITableView) -> Int {
return 3
return 4
}
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
......@@ -275,11 +360,19 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
}
return 220
}
if section == 2 {
return 0.001
}
return 10
}
//MARK: - didselectRow
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if orderType == nil && indexPath.section != 0{
HUD.flash(.label("请选择订单类型"), delay: 1.2)
return
}
switch indexPath.section {
case 0:
if indexPath.row == 0 {
......@@ -302,6 +395,37 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
}
break
case 2:
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.delegate = self
if indexPath.row == 0{
view.tag = 1011
view.selectNum = dj_payWay
if dj_payStatus == 3 {
view.deSelectArr = [0]
}
view.tempNum = view.selectNum
view.titleLbl.text = "请选择\(p2Arr[indexPath.row])"
view.dataArr = zfWayArr
}
if indexPath.row == 1 {
view.tag = 102
if dj_payWay == 0{
view.deSelectArr = [3]
}else{
dj_payStatus = 3
view.deSelectArr = [0,1,2]
}
view.selectNum = dj_payStatus
view.tempNum = view.selectNum
view.titleLbl.text = "请选择\(p2Arr[indexPath.row])"
view.dataArr = zfTypeArr
}
self.view.addSubview(view)
glSelectView = view
}
break
case 3:
if indexPath.row == 3 || indexPath.row > 4{
if indexPath.row == 3 {
let vc = DZGLViewController()
......@@ -315,19 +439,29 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
let view = GLAlertSelectView(frame: self.view.bounds)
view.delegate = self
switch indexPath.row {
case 0://支付状态
case 0://支付方式
view.tag = 101
view.selectNum = zhiFuType
view.selectNum = zhiFuWay
if zhiFuStatus == 3 {
view.deSelectArr = [0]
}
view.tempNum = view.selectNum
view.titleLbl.text = "请选择\(p3Arr[indexPath.row])"
view.dataArr = zfTypeArr
view.dataArr = zfWayArr
break
case 1://支付方式
case 1://支付状态
view.tag = 102
view.selectNum = zhiFuWay
if zhiFuWay == 0{
view.deSelectArr = [3]
}else{
zhiFuStatus = 3
view.deSelectArr = [0,1,2]
}
view.selectNum = zhiFuStatus
view.tempNum = view.selectNum
view.titleLbl.text = "请选择\(p3Arr[indexPath.row])"
view.dataArr = zfWayArr
view.dataArr = zfTypeArr
break
case 2://提货方式
view.tag = 103
......@@ -357,7 +491,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
func GLASClose(view: GLAlertSelectView, selectnum: Int, selectArr: Array<Int>) {
if selectnum != 10086 {
if view.titleLbl.text == "请选择支付状态" {
zhiFuType = selectnum
zhiFuStatus = selectnum
}
if view.titleLbl.text == "请选择支付方式" {
zhiFuWay = selectnum
......@@ -373,5 +507,18 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
view.removeFromSuperview()
glSelectView = nil
}
func XuanZeShangPinViewControllerEdit(datas: Array<Any>) {
print(datas)
}
@objc func jumpToEditPrice(){
if orderType == 1 {//预售
let vc = XiuGaiYuShouJiaViewController()
self.navigationController?.pushViewController(vc, animated: true)
}else{//普通
let vc = XuanZeShangPinViewController()
vc.delegate = self
vc.barTitle = "修改价格"
self.navigationController?.pushViewController(vc, animated: true)
}
}
}
......@@ -11,6 +11,8 @@ import UIKit
protocol XuanZeShangPinViewControllerDelegate {
func XuanZeShangPinViewControllerSubmitAction(datas:Array<Any>)
func XuanZeShangPinViewControllerYuShou(YuShouData:String)
func XuanZeShangPinViewControllerEdit(datas:Array<Any>)
}
class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,XuanZeShangPinCellDelegate,UISearchBarDelegate,SearchBarViewDelegate{
......@@ -21,14 +23,20 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
//XuanZeShangPinCell
@IBAction func submitAction(_ sender: Any) {
print("submit")
if barTitle == "修改价格"{
delegate?.XuanZeShangPinViewControllerEdit(datas:["返回","数据"])
}else{
if isYuShou {
delegate?.XuanZeShangPinViewControllerYuShou(YuShouData: "abc")
}else{
delegate?.XuanZeShangPinViewControllerSubmitAction(datas: selectIdxArr)
}
}
self.navigationController?.popViewController(animated: true)
}
var barTitle:String?//
@IBOutlet weak var btmLbl: UILabel!
@IBOutlet weak var listView: UITableView!
@IBOutlet weak var topView: UIView!
......@@ -40,7 +48,7 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
override func viewDidLoad() {
super.viewDidLoad()
navbar.title = "选择商品"
navbar.title = barTitle
self.view.addSubview(navbar)
listView.separatorStyle = .none
......@@ -80,6 +88,11 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
let cell = tableView.dequeueReusableCell(withIdentifier: "XuanZeShangPinCell") as! XuanZeShangPinCell
cell.delegate = self
cell.idx = indexPath
if barTitle == "修改价格"{
cell.selectBtn.isHidden = true
cell.btmView.isHidden = false
cell.btmViewHeight.constant = 89
}else{
if isYuShou {//预售
if idx == indexPath {
cell.selectBtn.isSelected = true
......@@ -102,9 +115,13 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
}
}
}
}
return cell
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if barTitle == "修改价格"{
return 210
}
if idx != nil {
if indexPath == idx {
return 210
......
......@@ -8,7 +8,7 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="XuanZeShangPinViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="XuanZeShangPinViewController" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="btmLbl" destination="5Kt-Ig-zbb" id="fUx-No-8SV"/>
<outlet property="listView" destination="YuT-X7-ecw" id="wKf-Ej-i9r"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<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="16087"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<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"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ChangeGoodsPriceVC" customModule="GeliBusinessPlatform" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ChangeGoodsPriceVC" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="sureBtn" destination="u6y-CU-3oP" id="jeI-hQ-epr"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<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="16087"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<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"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="XiuGaiYuShouJiaViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="XiuGaiYuShouJiaViewController" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="color" destination="af6-Wa-4Sy" id="gC1-9R-E1C"/>
<outlet property="countLbl" destination="nUd-42-xVV" id="HNp-gi-Qb7"/>
......
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