Commit e0cd63b4 authored by lujunye's avatar lujunye

修复已完成不显示按钮bug

parent 126cc654
......@@ -46,7 +46,7 @@ class PurchaseOrderListDataModel: Mappable {
var ven_name : String? //供应商名
var goods_res :Array<PurchaseOrderListDataItemsModel>?
var purchase_time:Int?
var purchase_time:Double?
var remarks:String?
required init?( map: Map) {
......
......@@ -201,7 +201,7 @@ class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableVie
listView.reloadData()
}
var dayTimeStr = ""
var dayTime:Int?
var dayTime:Double?
@IBOutlet weak var btmLbl: UILabel!
......@@ -354,7 +354,7 @@ class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableVie
let timeInterval:TimeInterval = beginDate.timeIntervalSince1970
print(timeStr,"采购日期",timeInterval)
dayTimeStr = timeStr
dayTime = Int(timeInterval)
dayTime = Double(Int(timeInterval))
listView.reloadData()
}
......@@ -381,7 +381,7 @@ class XinCaiGouViewController: BaseViewController,UITableViewDelegate,UITableVie
cell.dayLbl.text = dayTimeStr
}else{
cell.dayLbl.text = getTimeDayNow()
dayTime = Date().timeStamp
dayTime = Double(Date().timeStamp)
}
return cell
}else{
......
......@@ -10,26 +10,39 @@ import UIKit
protocol CGDXQVcDelegate {
func CGDXQVcFinishAction()
}
class CGDXQVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,GLAlertSelectViewDelegate,GeliAlertTextViewDelegate,GeliAlertViewDelegate,NewRKVcDelegate {
class CGDXQVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,GLAlertSelectViewDelegate,GeliAlertTextViewDelegate,GeliAlertViewDelegate,NewRKVcDelegate, XinCaiGouViewControllerDelegate {
func XinCaiGouViewControllerFinish() {
loadData()
}
func NewRKVcFinish() {
loadData()
// delegate?.CGDXQVcFinishAction()
// self.navigationController?.popViewController(animated: false)
}
@IBOutlet weak var btmHeight: NSLayoutConstraint!
func sureGeliAlertViewAction(sender: UIButton) {
let dict = ["user_token":UserToken as Any,"po_id":po_id as Any]
backOut(dict, success: { (data) in
HUD.hide()
HUD.flash(.labeledSubSuccess(subtitle: "撤销成功"), delay: 1.2)
self.delegate?.CGDXQVcFinishAction()
self.navigationController?.popViewController(animated: true)
}) { (error) in
if isBackOut {
backOut(dict, success: { (data) in
HUD.hide()
HUD.flash(.labeledSubSuccess(subtitle: "撤销成功"), delay: 1.2)
self.delegate?.CGDXQVcFinishAction()
self.isBackOut = false
self.navigationController?.popViewController(animated: true)
}) { (error) in
}
}else{
cancelPurchaseOrder(dict, success: { (data) in
HUD.hide()
self.delegate?.CGDXQVcFinishAction()
self.isBackOut = false
self.navigationController?.popViewController(animated: true)
}) { (err) in
}
}
}
......@@ -100,7 +113,6 @@ class CGDXQVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,GLAl
listView.register(UINib(nibName: "TitleAndTFCell", bundle: nil), forCellReuseIdentifier: "TitleAndTFCell")
listView.register(UINib(nibName: "TitleAndBtnCell", bundle: nil), forCellReuseIdentifier: "TitleAndBtnCell")
listView.register(UINib(nibName: "CGDCell", bundle: nil), forCellReuseIdentifier: "CGDCell")
loadData()
}
......@@ -111,22 +123,70 @@ class CGDXQVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,GLAl
if btnTitle.count == 0 {
btmView.isHidden = true
btmColor.isHidden = true
btmHeight.constant = 0
btmColor.backgroundColor = UIColor(named: "app底色")
}else{
btmHeight.constant = 49
btmColor.backgroundColor = UIColor.white
let w = fullScreenWidth / CGFloat(btnTitle.count)
for i in 0 ..< btnTitle.count {
let btn = UIButton(frame: CGRect(x: CGFloat(i)*w, y: 0, width: w, height: 49))
btmView.addSubview(btn)
btn.setTitle(btnTitle[i], for: .normal)
btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
if btnTitle[i] == "修改信息"{
btn.backgroundColor = UIColor(named: "蓝色字体颜色")
btn.setTitleColor(UIColor.white, for: .normal)
}
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.addTarget(self, action: #selector(btmBtnClick(sender:)), for: .touchUpInside)
}
}
}
var isBackOut = false
@objc func btmBtnClick(sender:UIButton){
switch sender.titleLabel?.text {
case "取消":
let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self;
alertView.tishiLbl.text = ""
alertView.titileLbl.text = "是否取消?"
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确定"), for: .normal)
alertView.rightBtn.tag = model!.po_id!
self.view.window?.addSubview(alertView)
break
case "修改信息":
let vc = XinCaiGouViewController()
vc.delegate = self
vc.cgName = model?.purchaser!
vc.orderNum = model?.po_no!
vc.po_id = model?.po_id!
vc.ven_id = model?.ven_id!
vc.ven_name = model?.ven_name!
vc.dayTime = (model?.purchase_time!)!
vc.contentStr = model?.remarks! as! String
vc.typeSelect = (model?.type!)! - 1
model?.goods_res?.forEach({ (item) in
let dict = [
"goods_name":item.goods_name as Any,
"goods_id":item.goods_id as Any,
"sku_id":item.sku_id as Any,
"spec_str":item.sku_name as Any,
"unit":item.unit as Any,
"price":item.price as Any,
"target_Count":item.num as Any,
"target_Price":item.amount as Any,
"pog_id":item.pog_id as Any
] as [String : Any]
let mo = GetGoodsInfoDataModel(JSON: dict)
vc.datas.append(mo!)
vc.recordArr.append(mo!)
})
self.navigationController?.pushViewController(vc, animated: true)
break
case "入库","补录入库":
var rkDatas:Array<InputInitInfoGoodsInfoModel> = []
model!.goods_res?.forEach({ (item) in
......@@ -160,6 +220,7 @@ class CGDXQVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,GLAl
self.navigationController?.pushViewController(vc, animated: true)
break
case "撤销入库":
isBackOut = true
let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self;
alertView.tishiLbl.text = ""
......@@ -187,7 +248,6 @@ class CGDXQVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,GLAl
}
}
func loadData(){
print("test === ")
let dict = ["user_token":UserToken as Any,"po_id":po_id as Any]
purchaseOrderDetail(dict, success: { (data) in
let item = data as! PurchaseOrderDetailModel
......@@ -227,8 +287,11 @@ class CGDXQVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,GLAl
self.model = mo
switch self.model!.order_status {
case 1 :
self.btnTitle = ["取消","修改信息"]
break
//订单状态(1未审核,2审核通过,3审核不通过,4已撤销,5已完成)
case 2://入库状态(1未入库,2部分入库,3已入库)
case 2,5://入库状态(1未入库,2部分入库,3已入库)
switch self.model!.push_status {
case 1:
self.btnTitle = ["入库"]
......
......@@ -12,6 +12,7 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="CGDXQVc" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="btmColor" destination="XSf-8D-3tt" id="14B-Gc-l2f"/>
<outlet property="btmHeight" destination="nCB-Nc-mxK" id="x4S-1D-3xP"/>
<outlet property="btmView" destination="AfC-cy-CDK" id="OZa-qe-r81"/>
<outlet property="listView" destination="xUS-ih-bIA" id="8g9-zc-R5S"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
......
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