Commit abd517a0 authored by lujunye's avatar lujunye

代客下单cell更新

parent a6760a9e
...@@ -47,6 +47,7 @@ class GetGoodsInfoDataModel: Mappable { ...@@ -47,6 +47,7 @@ class GetGoodsInfoDataModel: Mappable {
var target_Count:Int?//目标数量 var target_Count:Int?//目标数量
var target_Price:String?//目标价格 var target_Price:String?//目标价格
var remark = ""//备注
var pog_id = 0 var pog_id = 0
var edit_status = 1 var edit_status = 1
...@@ -76,6 +77,7 @@ class GetGoodsInfoDataModel: Mappable { ...@@ -76,6 +77,7 @@ class GetGoodsInfoDataModel: Mappable {
target_Price <- map["target_Price"] target_Price <- map["target_Price"]
pog_id <- map["pog_id"] pog_id <- map["pog_id"]
edit_status <- map["edit_status"] edit_status <- map["edit_status"]
remark <- map["remark"]
} }
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16097.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/> <device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies> <dependencies>
<deployment identifier="iOS"/> <deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
<capability name="Named colors" minToolsVersion="9.0"/> <capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/> <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......
...@@ -9,10 +9,13 @@ ...@@ -9,10 +9,13 @@
import UIKit import UIKit
protocol DaiKeXiaDanGouWuCellDelegate { protocol DaiKeXiaDanGouWuCellDelegate {
func DaiKeXiaDanGouWuCellDelAction(cell:DaiKeXiaDanGouWuCell) func DaiKeXiaDanGouWuCellDelAction(cell:DaiKeXiaDanGouWuCell)
func DaiKeXiaDanGouWuCellRemarkChange(cell:DaiKeXiaDanGouWuCell)
} }
class DaiKeXiaDanGouWuCell: UITableViewCell { class DaiKeXiaDanGouWuCell: UITableViewCell,UITextViewDelegate {
var delegate:DaiKeXiaDanGouWuCellDelegate? var delegate:DaiKeXiaDanGouWuCellDelegate?
@IBOutlet weak var bz_lbl: UILabel!
@IBOutlet weak var changeBtn: UIButton! @IBOutlet weak var changeBtn: UIButton!
@IBOutlet weak var count_lbl: UILabel!
@IBOutlet weak var btmLIneWidth: NSLayoutConstraint! @IBOutlet weak var btmLIneWidth: NSLayoutConstraint!
@IBOutlet weak var detailLbl2: UILabel! @IBOutlet weak var detailLbl2: UILabel!
@IBOutlet weak var delBtn: UIButton! @IBOutlet weak var delBtn: UIButton!
...@@ -22,17 +25,37 @@ class DaiKeXiaDanGouWuCell: UITableViewCell { ...@@ -22,17 +25,37 @@ class DaiKeXiaDanGouWuCell: UITableViewCell {
@IBOutlet weak var detailLbl: UILabel! @IBOutlet weak var detailLbl: UILabel!
@IBOutlet weak var titleLbl: UILabel! @IBOutlet weak var titleLbl: UILabel!
@IBOutlet weak var diLbl: UILabel! @IBOutlet weak var diLbl: UILabel!
var isDetail = false{
didSet{
if isDetail {
bz_lbl.isHidden = false
content_tv.isUserInteractionEnabled = false
edit_img.isHidden = true
}
}
}
@IBAction func delAction(_ sender: Any) { @IBAction func delAction(_ sender: Any) {
delegate?.DaiKeXiaDanGouWuCellDelAction(cell: self) delegate?.DaiKeXiaDanGouWuCellDelAction(cell: self)
} }
@IBOutlet weak var content_tv: UITextView!
@IBOutlet weak var edit_img: UIImageView!
@IBOutlet weak var holder_lbl: UILabel!
@IBOutlet weak var imgView: UIImageView! @IBOutlet weak var imgView: UIImageView!
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
self.selectionStyle = .none self.selectionStyle = .none
content_tv.delegate = self
// Initialization code // Initialization code
} }
func textViewDidChange(_ textView: UITextView) {
if textView.text.count > 0 {
holder_lbl.isHidden = true
}else{
holder_lbl.isHidden = false
}
delegate?.DaiKeXiaDanGouWuCellRemarkChange(cell: self)
}
override func setSelected(_ selected: Bool, animated: Bool) { override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated) super.setSelected(selected, animated: animated)
......
...@@ -10,6 +10,12 @@ import UIKit ...@@ -10,6 +10,12 @@ import UIKit
import IQKeyboardManagerSwift import IQKeyboardManagerSwift
class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,UITableViewDelegate,DaiKeXiaDanFooterViewDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,DZGLViewControllerDelegate,XuanZeShangPinViewControllerDelegate,DaiKeXiaDanGouWuCellDelegate,GuanLianKehuVCDelegate,XiuGaiYuShouJiaViewControllerDelegate,TitleAndTFCellDelegate, GeliAlertViewDelegate,UITextFieldDelegate{ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,UITableViewDelegate,DaiKeXiaDanFooterViewDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,DZGLViewControllerDelegate,XuanZeShangPinViewControllerDelegate,DaiKeXiaDanGouWuCellDelegate,GuanLianKehuVCDelegate,XiuGaiYuShouJiaViewControllerDelegate,TitleAndTFCellDelegate, GeliAlertViewDelegate,UITextFieldDelegate{
func DaiKeXiaDanGouWuCellRemarkChange(cell: DaiKeXiaDanGouWuCell) {
let data = cellDataArr[cell.tag]
data.remark = cell.content_tv.text
print(data.remark)
}
let ddTypeArr = ["普通订单","预售下单"] let ddTypeArr = ["普通订单","预售下单"]
let zfTypeArr = ["未付款","欠款","月结","已付款"] let zfTypeArr = ["未付款","欠款","月结","已付款"]
...@@ -175,8 +181,11 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U ...@@ -175,8 +181,11 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
let cellData = cellDataArr[indexPath.row] let cellData = cellDataArr[indexPath.row]
cell.imgView.sd_setImage(with: URL(string:SERVERCE_ImageHost + cellData.goods_img!)) cell.imgView.sd_setImage(with: URL(string:SERVERCE_ImageHost + cellData.goods_img!))
cell.titleLbl.text = cellData.goods_name cell.titleLbl.text = cellData.goods_name
cell.count_lbl.text = "数量:\(cellData.target_Count!)件"
cell.detailLbl.text = "\(cellData.spec_str!)/\(cellData.unit!)" cell.detailLbl.text = "\(cellData.spec_str!)/\(cellData.unit!)"
cell.detailLbl2.text = "¥" + cellData.target_Price! + "x\(cellData.target_Count!)" let pStr = cellData.target_Price as! NSString
let p = pStr.floatValue * Float(cellData.target_Count!)
cell.detailLbl2.text = "小计:¥" + String(format: "%.2f", p)
let priceStr = cellData.target_Price?.replacingOccurrences(of: "", with: ",") as! NSString let priceStr = cellData.target_Price?.replacingOccurrences(of: "", with: ",") as! NSString
let totalP = priceStr.floatValue * Float(cellData.target_Count!) let totalP = priceStr.floatValue * Float(cellData.target_Count!)
cell.totalPriceLbl.text = "\(totalP)" cell.totalPriceLbl.text = "\(totalP)"
...@@ -674,7 +683,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U ...@@ -674,7 +683,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if indexPath.section == 1 { if indexPath.section == 1 {
return 120 return 243
} }
if indexPath.section == 2 {//新增预售 if indexPath.section == 2 {//新增预售
if orderType == 1 { if orderType == 1 {
...@@ -750,6 +759,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U ...@@ -750,6 +759,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
if orderType == 1{ if orderType == 1{
cellDataArr.forEach { (item) in cellDataArr.forEach { (item) in
print(item.remark)
let priceStr = item.target_Price! as NSString let priceStr = item.target_Price! as NSString
let subtoal = priceStr.floatValue * Float(item.target_Count!) let subtoal = priceStr.floatValue * Float(item.target_Count!)
let goods = ["goods_name":item.goods_name as Any, //商品名称 let goods = ["goods_name":item.goods_name as Any, //商品名称
...@@ -764,12 +774,16 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U ...@@ -764,12 +774,16 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
"is_gift":0,//是否搭赠,1是0非,现版本固定0 "is_gift":0,//是否搭赠,1是0非,现版本固定0
"subtotal":subtoal,//总价 "subtotal":subtoal,//总价
"goods_id":item.goods_id as Any,//商品ID "goods_id":item.goods_id as Any,//商品ID
"remark":item.remark as Any,
"sku_id":item.sku_id as Any] as [String : Any] "sku_id":item.sku_id as Any] as [String : Any]
goodsArr.append(goods) goodsArr.append(goods)
} }
}else{ }else{
cellDataArr.forEach { (item) in cellDataArr.forEach { (item) in
print(item.remark)
let priceStr = item.target_Price! as NSString let priceStr = item.target_Price! as NSString
let subtoal = priceStr.floatValue * Float(item.target_Count!) let subtoal = priceStr.floatValue * Float(item.target_Count!)
let goods = ["goods_name":item.goods_name as Any, let goods = ["goods_name":item.goods_name as Any,
...@@ -782,6 +796,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U ...@@ -782,6 +796,7 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
"is_gift":0, "is_gift":0,
"subtotal":subtoal, "subtotal":subtoal,
"goods_id":item.goods_id as Any, "goods_id":item.goods_id as Any,
"remark":item.remark as Any,
"sku_id":item.sku_id as Any] as [String : Any] "sku_id":item.sku_id as Any] as [String : Any]
goodsArr.append(goods) goodsArr.append(goods)
......
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