Commit 16ca2918 authored by lujunye's avatar lujunye

修改小数位保留2位小数

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