Commit 16ca2918 authored by lujunye's avatar lujunye

修改小数位保留2位小数

parent f12608a5
...@@ -3685,7 +3685,7 @@ ...@@ -3685,7 +3685,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = GeliBusinessPlatform/GeliBusinessPlatform.entitlements; CODE_SIGN_ENTITLEMENTS = GeliBusinessPlatform/GeliBusinessPlatform.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.27; CURRENT_PROJECT_VERSION = 1.28;
DEFINES_MODULE = NO; DEFINES_MODULE = NO;
DEVELOPMENT_ASSET_PATHS = "\"GeliBusinessPlatform/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"GeliBusinessPlatform/Preview Content\"";
DEVELOPMENT_TEAM = K48346UACH; DEVELOPMENT_TEAM = K48346UACH;
...@@ -3814,7 +3814,7 @@ ...@@ -3814,7 +3814,7 @@
CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = GeliBusinessPlatform/GeliBusinessPlatform.entitlements; CODE_SIGN_ENTITLEMENTS = GeliBusinessPlatform/GeliBusinessPlatform.entitlements;
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1.27; CURRENT_PROJECT_VERSION = 1.28;
DEFINES_MODULE = NO; DEFINES_MODULE = NO;
DEVELOPMENT_ASSET_PATHS = "\"GeliBusinessPlatform/Preview Content\""; DEVELOPMENT_ASSET_PATHS = "\"GeliBusinessPlatform/Preview Content\"";
DEVELOPMENT_TEAM = K48346UACH; DEVELOPMENT_TEAM = K48346UACH;
......
...@@ -31,27 +31,27 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView ...@@ -31,27 +31,27 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
}) })
let wl = wlPrice as NSString let wl = wlPrice as NSString
let qt = qtPrice as NSString let qt = qtPrice as NSString
btnTitle.text = "确定(合计¥\(total + wl.floatValue + qt.floatValue))" btnTitle.text = String(format: "确定(合计¥%.2f)", total + wl.floatValue + qt.floatValue)
tableV.reloadData() tableV.reloadData()
} }
var orderID:Int? = 0 var orderID:Int? = 0
var delegate:ChangeGoodsPriceVCDelegate? var delegate:ChangeGoodsPriceVCDelegate?
var dataArr : Array<OrderDetailGoodsModel>? = [] var dataArr : Array<OrderDetailGoodsModel>? = []
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
navbar.title = "修改价格" navbar.title = "修改价格"
self.view.addSubview(navbar) self.view.addSubview(navbar)
setTabv() setTabv()
var total = Float(0) var total = Float(0)
dataArr?.forEach({ (item) in dataArr?.forEach({ (item) in
let price = item.goods_subtotal as! NSString let price = item.goods_subtotal as! NSString
total += price.floatValue total += price.floatValue
}) })
let wl = wlPrice as NSString let wl = wlPrice as NSString
let qt = qtPrice as NSString let qt = qtPrice as NSString
btnTitle.text = "确定(合计¥\(total + wl.floatValue + qt.floatValue))" btnTitle.text = String(format: "确定(合计¥%.2f)", total + wl.floatValue + qt.floatValue)
} }
...@@ -61,8 +61,8 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView ...@@ -61,8 +61,8 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
@IBOutlet weak var sureBtn: LGButton! @IBOutlet weak var sureBtn: LGButton!
//MARK:--确认修改价格 //MARK:--确认修改价格
@IBAction func sureAction(_ sender: LGButton) { @IBAction func sureAction(_ sender: LGButton) {
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
var order_goodsArr:Array<Any>? = [] var order_goodsArr:Array<Any>? = []
...@@ -75,22 +75,23 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView ...@@ -75,22 +75,23 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
order_goodsArr?.append(dic) order_goodsArr?.append(dic)
}) })
let order_goods = dataChangeString(sender: order_goodsArr!) let order_goods = dataChangeString(sender: order_goodsArr!)
editOrderGoodsPrice(["user_token":UserToken as Any,"order_id":orderID as Any,"order_goods":order_goods as Any,"logistics_price":wlPrice as Any,"other_price":qtPrice as Any], success: { (data) in editOrderGoodsPrice(["user_token":UserToken as Any,"order_id":orderID as Any,"order_goods":order_goods as Any,"logistics_price":wlPrice as Any,"other_price":qtPrice as Any], success: { (data) in
let dataM = data as! UpDataModel let dataM = data as! UpDataModel
if dataM.code == 1 { if dataM.code == 1 {
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "orderChange"), object: nil) NotificationCenter.default.post(name: NSNotification.Name(rawValue: "orderChange"), object: nil)
self.delegate?.changeGoodsPriByData(sender: self.dataArr!) self.delegate?.changeGoodsPriByData(sender: self.dataArr!)
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
}) { (error) in }) { (error) in
} }
} }
deinit { deinit {
NotificationCenter.default.removeObserver(self) NotificationCenter.default.removeObserver(self)
} }
...@@ -114,10 +115,11 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView ...@@ -114,10 +115,11 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
} }
let wl = wlPrice as NSString let wl = wlPrice as NSString
let qt = qtPrice as NSString let qt = qtPrice as NSString
btnTitle.text = "确定(合计¥\(total + wl.floatValue + qt.floatValue))" btnTitle.text = String(format: "确定(合计¥%.2f)", total + wl.floatValue + qt.floatValue)
self.tableV.reloadData() self.tableV.reloadData()
} }
var tableV :UITableView! var tableV :UITableView!
...@@ -166,16 +168,16 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView ...@@ -166,16 +168,16 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
} }
let cell = tableView.dequeueReusableCell(withIdentifier: "ChangePriceNormalCell") as! ChangePriceNormalCell let cell = tableView.dequeueReusableCell(withIdentifier: "ChangePriceNormalCell") as! ChangePriceNormalCell
let rowModel = dataArr![indexPath.row] let rowModel = dataArr![indexPath.row]
cell.goodsImgVire.sd_setImage(with: URL(string:SERVERCE_ImageHost + rowModel.goods_thumb!)) cell.goodsImgVire.sd_setImage(with: URL(string:SERVERCE_ImageHost + rowModel.goods_thumb!))
cell.goodsNameLbl.text = rowModel.goods_name cell.goodsNameLbl.text = rowModel.goods_name
if rowModel.goods_attr != nil { if rowModel.goods_attr != nil {
cell.attrrLbl.text = rowModel.goods_attr cell.attrrLbl.text = rowModel.goods_attr
}else{ }else{
cell.attrrLbl.text = "-" cell.attrrLbl.text = "-"
} }
cell.priceTf.text = rowModel.goods_price cell.priceTf.text = rowModel.goods_price
cell.detailLbl.isHidden = true cell.detailLbl.isHidden = true
......
...@@ -48,10 +48,10 @@ class XiuGaiYuShouJiaViewController: BaseViewController, UITextFieldDelegate { ...@@ -48,10 +48,10 @@ class XiuGaiYuShouJiaViewController: BaseViewController, UITextFieldDelegate {
titleLbl.text = rowModel!.goods_name titleLbl.text = rowModel!.goods_name
if rowModel?.goods_attr != nil { if rowModel?.goods_attr != nil {
detailLbl.text = "规格:" + (rowModel?.goods_attr)! detailLbl.text = "规格:" + (rowModel?.goods_attr)!
}else{ }else{
detailLbl.text = "规格:" + "-" detailLbl.text = "规格:" + "-"
} }
dingJinTF.text = dataModel?.order_res?.sale_res?.dj_amount dingJinTF.text = dataModel?.order_res?.sale_res?.dj_amount
weiKuanTF.text = dataModel?.order_res?.sale_res?.wk_amount weiKuanTF.text = dataModel?.order_res?.sale_res?.wk_amount
...@@ -79,22 +79,22 @@ class XiuGaiYuShouJiaViewController: BaseViewController, UITextFieldDelegate { ...@@ -79,22 +79,22 @@ class XiuGaiYuShouJiaViewController: BaseViewController, UITextFieldDelegate {
weiKuanTF.tag = 1002 weiKuanTF.tag = 1002
dingJinTF.keyboardType = .decimalPad dingJinTF.keyboardType = .decimalPad
weiKuanTF.keyboardType = .decimalPad weiKuanTF.keyboardType = .decimalPad
} }
func textFieldDidEndEditing(_ textField: UITextField) { func textFieldDidEndEditing(_ textField: UITextField) {
if textField.tag == 1001 { if textField.tag == 1001 {
// print(dingJinTF.text) // print(dingJinTF.text)
let dingj = dingJinTF.text! as NSString let dingj = dingJinTF.text! as NSString
if isPurnNumber(str: dingJinTF.text!) { if isPurnNumber(str: dingJinTF.text!) {
// if dingj.floatValue > (totalPrice! * 0.2) { // if dingj.floatValue > (totalPrice! * 0.2) {
// HUD.flash(.label("定金不得高于总价20%"),delay: 1.2) // HUD.flash(.label("定金不得高于总价20%"),delay: 1.2)
// dingJinTF.text = String(format: "%.2f", (totalPrice! * 0.2)) // dingJinTF.text = String(format: "%.2f", (totalPrice! * 0.2))
// }else{ // }else{
dingJinTF.text = String(format: "%.2f", dingj.floatValue) dingJinTF.text = String(format: "%.2f", dingj.floatValue)
// } // }
// let lastDj = dingJinTF.text! as NSString // let lastDj = dingJinTF.text! as NSString
// let weiku = totalPrice! - lastDj.floatValue // let weiku = totalPrice! - lastDj.floatValue
// weiKuanTF.text = String(format: "%.2f",weiku) // weiKuanTF.text = String(format: "%.2f",weiku)
}else{ }else{
HUD.flash(.label("请填写正确的定金数值"),delay: 1.2) HUD.flash(.label("请填写正确的定金数值"),delay: 1.2)
dingJinTF.text = "" dingJinTF.text = ""
...@@ -102,50 +102,52 @@ class XiuGaiYuShouJiaViewController: BaseViewController, UITextFieldDelegate { ...@@ -102,50 +102,52 @@ class XiuGaiYuShouJiaViewController: BaseViewController, UITextFieldDelegate {
}else if textField.tag == 1002{ }else if textField.tag == 1002{
let weiku = weiKuanTF.text! as NSString let weiku = weiKuanTF.text! as NSString
if isPurnNumber(str: weiKuanTF.text!) { if isPurnNumber(str: weiKuanTF.text!) {
// if weiku.floatValue > totalPrice! { // if weiku.floatValue > totalPrice! {
// HUD.flash(.label("尾款不得高于总价"),delay: 1.2) // HUD.flash(.label("尾款不得高于总价"),delay: 1.2)
// weiKuanTF.text = String(format: "%.2f", totalPrice!) // weiKuanTF.text = String(format: "%.2f", totalPrice!)
// }else if weiku.floatValue < (totalPrice! * 0.8){ // }else if weiku.floatValue < (totalPrice! * 0.8){
// HUD.flash(.label("尾款不得低于总价的80%"),delay: 1.2) // HUD.flash(.label("尾款不得低于总价的80%"),delay: 1.2)
// weiKuanTF.text = String(format: "%.2f", (totalPrice! * 0.8)) // weiKuanTF.text = String(format: "%.2f", (totalPrice! * 0.8))
// }else{ // }else{
weiKuanTF.text = String(format: "%.2f", weiku.floatValue) weiKuanTF.text = String(format: "%.2f", weiku.floatValue)
// } // }
// let lastWeiku = weiKuanTF.text! as NSString // let lastWeiku = weiKuanTF.text! as NSString
// let dingj = totalPrice! - lastWeiku.floatValue // let dingj = totalPrice! - lastWeiku.floatValue
// dingJinTF.text = String(format: "%.2f",dingj) // dingJinTF.text = String(format: "%.2f",dingj)
}else{ }else{
HUD.flash(.label("请填写正确的尾款数值"),delay: 1.2) HUD.flash(.label("请填写正确的尾款数值"),delay: 1.2)
weiKuanTF.text = "" weiKuanTF.text = ""
} }
} }
} }
@IBAction func submitACTION(_ sender: Any) { @IBAction func submitACTION(_ sender: Any) {
print("预售返回上一级且提交了数据") print("预售返回上一级且提交了数据")
// let weiku = weiKuanTF.text! as NSString // let weiku = weiKuanTF.text! as NSString
// let dingj = dingJinTF.text! as NSString // let dingj = dingJinTF.text! as NSString
// if (weiku.floatValue + dingj.floatValue) // if (weiku.floatValue + dingj.floatValue)
// != totalPrice { // != totalPrice {
// let total = String(format: "%.2f", totalPrice!) // let total = String(format: "%.2f", totalPrice!)
// HUD.flash(.label("填写的定金和尾款总价应为" + total),delay: 1.2) // HUD.flash(.label("填写的定金和尾款总价应为" + total),delay: 1.2)
// return; // return;
// } // }
if orderID != 0 { if orderID != 0 {
//MARK:--需要对输入是否为金额判断 //MARK:--需要对输入是否为金额判断
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
let rowModel = dataModel?.order_goods![0] let rowModel = dataModel?.order_goods![0]
editOrderGoodsPriceAd(["user_token":UserToken as Any,"order_id":orderID as Any,"og_id":rowModel?.og_id as Any,"dj_amount":dingJinTF.text as Any,"wk_amount":weiKuanTF.text as Any], success: { (data) in editOrderGoodsPriceAd(["user_token":UserToken as Any,"order_id":orderID as Any,"og_id":rowModel?.og_id as Any,"dj_amount":dingJinTF.text as Any,"wk_amount":weiKuanTF.text as Any], success: { (data) in
let dataM = data as! EditOGPAdModel let dataM = data as! EditOGPAdModel
if dataM.code == 1 { if dataM.code == 1 {
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "orderChange"), object: nil)
self.delegate?.changeYuShouGoodsByData(sender: dataM.data!, djText: self.dingJinTF.text!, wkText: self.weiKuanTF.text!) self.delegate?.changeYuShouGoodsByData(sender: dataM.data!, djText: self.dingJinTF.text!, wkText: self.weiKuanTF.text!)
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
}) { (error) in }) { (error) in
} }
...@@ -154,8 +156,10 @@ class XiuGaiYuShouJiaViewController: BaseViewController, UITextFieldDelegate { ...@@ -154,8 +156,10 @@ class XiuGaiYuShouJiaViewController: BaseViewController, UITextFieldDelegate {
self.delegate?.changeYuShouGoodsByData(sender:nil, djText: dingJinTF.text!, wkText: weiKuanTF.text!) self.delegate?.changeYuShouGoodsByData(sender:nil, djText: dingJinTF.text!, wkText: weiKuanTF.text!)
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
} }
} }
deinit {
NotificationCenter.default.removeObserver(self)
}
} }
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