Commit 3409e38f authored by lujunye's avatar lujunye

9

parent 102ba083
......@@ -7,12 +7,22 @@
//
import UIKit
protocol XY_FX_Setting_View_Delegate {
func XY_FX_Setting_View_action(view:XY_FX_Setting_View)
}
class XY_FX_Setting_View: UIView {
var delegate:XY_FX_Setting_View_Delegate?
@IBOutlet weak var commission_tf: UITextField!
@IBOutlet weak var high_tf: UITextField!
@IBOutlet weak var low_tf: UITextField!
@IBOutlet weak var fxj_tf: UITextField!
@IBOutlet weak var ghj_tf: UITextField!
@IBOutlet weak var fxj_btn: UIButton!
@IBOutlet weak var ghj_btn: UIButton!
@IBOutlet weak var btm_view: UIView!
@IBAction func submit_action(_ sender: UIButton) {
delegate?.XY_FX_Setting_View_action(view: self)
}
@IBAction func select_action(_ sender: UIButton) {
view_height.constant = 255
btm_view.isHidden = true
......
......@@ -13,8 +13,13 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="XY_FX_Setting_View" customModule="TestClass" customModuleProvider="target">
<connections>
<outlet property="btm_view" destination="cRc-ys-fPa" id="0Zq-n6-F6N"/>
<outlet property="commission_tf" destination="fxJ-PE-9nX" id="IsK-xd-ajX"/>
<outlet property="fxj_btn" destination="PiL-Yh-c2W" id="exg-Me-ls2"/>
<outlet property="fxj_tf" destination="Lfk-ju-DTe" id="Dd6-qV-Iu2"/>
<outlet property="ghj_btn" destination="D4A-T8-JFU" id="MAV-1E-crV"/>
<outlet property="ghj_tf" destination="kmY-s9-3Hj" id="rwd-Bh-fDa"/>
<outlet property="high_tf" destination="i3w-cD-JWh" id="gvw-v2-aeA"/>
<outlet property="low_tf" destination="TKW-7l-Js3" id="6QU-XK-z8R"/>
<outlet property="view_height" destination="lgV-T9-cLV" id="a1v-bH-08y"/>
</connections>
</placeholder>
......@@ -132,6 +137,9 @@
<state key="normal" title="取消">
<color key="titleColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</state>
<connections>
<action selector="close_action:" destination="-1" eventType="touchUpInside" id="i19-Ci-Ebm"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Gml-Xr-K85">
<rect key="frame" x="169.5" y="212" width="168.5" height="43"/>
......@@ -139,6 +147,9 @@
<state key="normal" title="确定">
<color key="titleColor" red="0.2784313725" green="0.56078431370000004" blue="0.89019607840000003" alpha="1" colorSpace="calibratedRGB"/>
</state>
<connections>
<action selector="submit_action:" destination="-1" eventType="touchUpInside" id="eB4-sK-BNY"/>
</connections>
</button>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="center" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="fxJ-PE-9nX">
<rect key="frame" x="142" y="164" width="161" height="35"/>
......
......@@ -9,7 +9,34 @@
import UIKit
class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,SelectContentViewDelegate,HeaderSelectViewDelegate, New_Fx_Cell_Delegate, FXSZ_View_Delegate{
class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,SelectContentViewDelegate,HeaderSelectViewDelegate, New_Fx_Cell_Delegate, FXSZ_View_Delegate, XY_FX_Setting_View_Delegate{
func XY_FX_Setting_View_action(view: XY_FX_Setting_View) {
var price_type = 0
if view.ghj_btn.isSelected == true {
price_type = 1
}
let model = dbt_datas[view.tag]
let dict = ["user_token":UserToken as Any,
"goods_id":model.goods_id as Any,
"sku_id":model.sku_id as Any,
"price_type":price_type as Any,
"dbt_price":view.fxj_tf.text as Any,
"commission_val":view.commission_tf.text as Any,
"supply_price":view.ghj_tf.text as Any,
"floor_price":view.low_tf.text as Any,
"ceiling_price":view.high_tf.text as Any
]
HUD.show(.progress)
setDbtGoodsAgent(dict) { (data) in
view.removeFromSuperview()
HUD.flash(.label("设置成功~"), delay: 1.2)
self.home_list_tbv.mj_header?.beginRefreshing()
} failture: { (err) in
}
}
var titleStr = ""
var dbt_goods_type = 100
func FXSZ_View_submitAction(tag: Int, price: String, commission: String,view:FXSZ_View) {
......@@ -84,11 +111,53 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
if titleStr.contains("代理") == true {
switch idx {
case 0:
let model = dbt_datas[cell.tag]
let dict = ["user_token":UserToken as Any,
"sku_id":model.sku_id as Any,
]
delDbtInfo(dict) { (data) in
HUD.flash(.label("取消成功~"), delay: 1.2)
self.home_list_tbv.mj_header?.beginRefreshing()
} failture: { (err) in
}
break
case 1:
var action = 2
if cell.btn2.titleLabel?.text?.contains("上") == true {
action = 1
}
print("action == ",action)
let model = dbt_datas[cell.tag]
let dict = ["user_token":UserToken as Any,
"action":action as Any,
"sku_id":model.sku_id as Any,
]
setGoodsAttr(dict) { (data) in
HUD.flash(.label("设置成功~"), delay: 1.2)
self.home_list_tbv.mj_header?.beginRefreshing()
} failture: { (err) in
}
break
default:
let model = dbt_datas[cell.tag]
let view = XY_FX_Setting_View(frame: self.view.bounds)
view.delegate = self
view.tag = cell.tag
view.fxj_btn.isSelected = true
view.fxj_tf.text = model.dbt_price
view.commission_tf.text = model.commission_val
if model.price_type == 1 {
view.fxj_tf.text = ""
view.commission_tf.text = ""
view.ghj_btn.isSelected = true
view.fxj_btn.isSelected = false
view.ghj_tf.text = model.supply_price
view.low_tf.text = model.floor_price
view.high_tf.text = model.ceiling_price
}
self.view.addSubview(view)
break
}
......@@ -125,7 +194,7 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
return
}
let model = datas[idx]
let model = datas[cell.tag]
let dic = ["user_token":UserToken as Any,
"operation_type":0 as Any,
"sku_id":model.sku_id as Any,
......
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