Commit 531412ff authored by lujunye's avatar lujunye

分销商品设置完成

parent 54391001
...@@ -292,5 +292,9 @@ ...@@ -292,5 +292,9 @@
<string>Distribution/dbtList</string> <string>Distribution/dbtList</string>
<key>终止合作</key> <key>终止合作</key>
<string>Distribution/stopContract</string> <string>Distribution/stopContract</string>
<key>获取分销商品管理页面信息</key>
<string>Distribution/supGoodsList</string>
<key>分销商品管理</key>
<string>Distribution/supSetCommodity</string>
</dict> </dict>
</plist> </plist>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import Foundation import Foundation
import ObjectMapper import ObjectMapper
//发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单,商品入库审核,商品入库,商品入库申请,商品出库,商品申请出库,商品审核出库,出库入库审核不通过,编辑地址,删除地址,新增采购单,审核采购单,撤销入库,采购单修改支付状态,供应商编辑,新增供应商,编辑客户,新增客户,应收账款收款,设为未收,取消采购单,修改采购订单,新增品牌,拒绝退款,确认用户退款到账,拒绝接单,审核同意退货退款,取消订单审核,确认收到退货,审核同意退货或退款,订单确认收货,取消运单,支付运费,选定地址添加收发货历史,取消货拉拉订单,货拉拉二次支付,货拉拉格利支付,发票消息短信通知,修改电子发票链接地址,分销分账设置,供应商新增店铺,标记已人工结算,铺货与取消铺货,终止合作 //发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单,商品入库审核,商品入库,商品入库申请,商品出库,商品申请出库,商品审核出库,出库入库审核不通过,编辑地址,删除地址,新增采购单,审核采购单,撤销入库,采购单修改支付状态,供应商编辑,新增供应商,编辑客户,新增客户,应收账款收款,设为未收,取消采购单,修改采购订单,新增品牌,拒绝退款,确认用户退款到账,拒绝接单,审核同意退货退款,取消订单审核,确认收到退货,审核同意退货或退款,订单确认收货,取消运单,支付运费,选定地址添加收发货历史,取消货拉拉订单,货拉拉二次支付,货拉拉格利支付,发票消息短信通知,修改电子发票链接地址,分销分账设置,供应商新增店铺,标记已人工结算,铺货与取消铺货,终止合作,分销商品管理
class UpDataModel: Mappable { class UpDataModel: Mappable {
......
...@@ -130,7 +130,7 @@ func getDbtShop(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture ...@@ -130,7 +130,7 @@ func getDbtShop(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture
//MARK:-- 铺货与取消铺货 //MARK:-- 铺货与取消铺货
/* /*
//params-key:user_token //params-key:user_token
//goods_id:商品id //sku_id
action 操作(1为铺货,2为取消铺货) action 操作(1为铺货,2为取消铺货)
shop_id 商店id shop_id 商店id
*/ */
...@@ -184,3 +184,39 @@ func stopContract(_ params:[String:Any],success:@escaping (_ res:Any)->(),failtu ...@@ -184,3 +184,39 @@ func stopContract(_ params:[String:Any],success:@escaping (_ res:Any)->(),failtu
failture(error) failture(error)
} }
} }
//MARK:-- 获取分销商品管理页面信息
/*
//params-key:user_token
keyword 关键字
goods_type 下拉框 1为全部商品,2为不参与分销商品,3参与分销商品,4佣金比例商品,5绝对额比例商品
is_show 上下架 (1为上架,0为下架,2全部)
page 页数
*/
func supGoodsList(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("获取分销商品管理页面信息", params, { (rep:DataResponse<supGoodsListModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:-- 分销商品管理
/*
//params-key:user_token
operation_type 1参与分销 2不参与分销
sku_id
dbt_price 分销价
commission_type 佣金类型 1百分比 2固定值
commission_per 佣金百分比
commission_val 佣金
*/
func supSetCommodity(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("分销商品管理", params, { (rep:DataResponse<UpDataModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
...@@ -141,7 +141,7 @@ class supSpreadGoodsModel: Mappable { ...@@ -141,7 +141,7 @@ class supSpreadGoodsModel: Mappable {
} }
} }
class supSpreadGoodsTotalModel: Mappable { class supSpreadGoodsTotalModel: Mappable {
var sum_dbt_goods:Int?//已铺商品总和
var sum_goods : Int?//可铺商品总和 var sum_goods : Int?//可铺商品总和
var res :Array<supSpreadGoodsDataModel>? var res :Array<supSpreadGoodsDataModel>?
...@@ -149,7 +149,6 @@ class supSpreadGoodsTotalModel: Mappable { ...@@ -149,7 +149,6 @@ class supSpreadGoodsTotalModel: Mappable {
} }
func mapping(map: Map) { func mapping(map: Map) {
sum_dbt_goods <- map["sum_dbt_goods"]
sum_goods <- map["sum_goods"] sum_goods <- map["sum_goods"]
res <- map["res"] res <- map["res"]
} }
...@@ -158,23 +157,23 @@ class supSpreadGoodsDataModel: Mappable { ...@@ -158,23 +157,23 @@ class supSpreadGoodsDataModel: Mappable {
var goods_thumb:String?//缩略图 var goods_thumb:String?//缩略图
var goods_name : String?//商品名称 var goods_name : String?//商品名称
var dbt_sale :Int?//销量 var dbt_sale :Int?//销量
var goods_number:Int?//库存 var inventory:Int?//库存
var shop_price : String?//价格 var shop_price : String?//价格
var dbt_price :String?//分销价 var dbt_price :String?//分销价
var commission_type:Int?//佣金类型 1百分比 2固定值 var commission_type:Int?//佣金类型 1百分比 2固定值
var commission_per:Int?//佣金百分比(0为初始值) var commission_per:Int?//佣金百分比(0为初始值)
var goods_id:Int?//商品id var sku_id:Int?//sku_id
required init?( map: Map) { required init?( map: Map) {
} }
func mapping(map: Map) { func mapping(map: Map) {
goods_id <- map["goods_id"] sku_id <- map["sku_id"]
commission_type <- map["commission_type"] commission_type <- map["commission_type"]
commission_per <- map["commission_per"] commission_per <- map["commission_per"]
goods_thumb <- map["goods_thumb"] goods_thumb <- map["goods_thumb"]
goods_name <- map["goods_name"] goods_name <- map["goods_name"]
dbt_sale <- map["dbt_sale"] dbt_sale <- map["dbt_sale"]
goods_number <- map["goods_number"] inventory <- map["inventory"]
shop_price <- map["shop_price"] shop_price <- map["shop_price"]
dbt_price <- map["dbt_price"] dbt_price <- map["dbt_price"]
} }
...@@ -282,3 +281,66 @@ class dbtListDataModel: Mappable { ...@@ -282,3 +281,66 @@ class dbtListDataModel: Mappable {
address <- map["address"] address <- map["address"]
} }
} }
//获取分销商品管理页面信息
class supGoodsListModel: Mappable {
var code:Int?
var message : String?
var data :supGoodsListDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class supGoodsListDataModel: Mappable {
var count:Int?
var res : Array<supGoodsListResDataModel>?
required init?( map: Map) {
}
func mapping(map: Map) {
count <- map["count"]
res <- map["res"]
}
}
class supGoodsListResDataModel: Mappable {
var goods_name:String?//商品名称
var goods_id : Int?//商品id
var goods_thumb:String?//缩略图
var price : String? //价格
var inventory:Int?//库存
var sku_id:Int?//sku的id
var dbt_price : String? //分销价
var dbt_sale:Int? //销售量
var commission_per :Int?//佣金百分比
var commission_type:Int?//佣金类型 1百分比 2固定值
var commission_val :String?//佣金
var is_dbt:Int?//分销商品的id,为0的话说明未设置分销
required init?( map: Map) {
}
func mapping(map: Map) {
goods_name <- map["goods_name"]
goods_id <- map["goods_id"]
goods_thumb <- map["goods_thumb"]
price <- map["price"]
inventory <- map["inventory"]
sku_id <- map["sku_id"]
dbt_price <- map["dbt_price"]
dbt_sale <- map["dbt_sale"]
commission_per <- map["commission_per"]
commission_type <- map["commission_type"]
commission_val <- map["commission_val"]
is_dbt <- map["is_dbt"]
}
}
...@@ -7,15 +7,26 @@ ...@@ -7,15 +7,26 @@
// //
import UIKit import UIKit
protocol DistributorSettingAlertViewDelegate {
func DistributorSettingAlertViewSubmitAction(tag:Int,operation_type:Int,dbt_price:String,commission_type:Int,commission_per:String,commission_val:String,view:DistributorSettingAlertView)
}
class DistributorSettingAlertView: UIView { class DistributorSettingAlertView: UIView {
var is_all_select_mode = false
var delegate:DistributorSettingAlertViewDelegate?
@IBOutlet weak var canYuBtn: UIButton! @IBOutlet weak var canYuBtn: UIButton!
@IBAction func canyuAction(_ sender: UIButton) { @IBAction func canyuAction(_ sender: UIButton) {
//参与 //参与
canYuBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal) canYuBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal)
nonCanYuBtn .setImage(UIImage.init(named: "daixuan"), for: .normal) nonCanYuBtn .setImage(UIImage.init(named: "daixuan"), for: .normal)
canYuBtn.isSelected = true
nonCanYuBtn.isSelected = false
contentVheight.constant = 300 contentVheight.constant = 300
if is_all_select_mode {
cover_view.isHidden = false
}
} }
@IBOutlet weak var nonCanYuBtn: UIButton! @IBOutlet weak var nonCanYuBtn: UIButton!
...@@ -24,6 +35,9 @@ class DistributorSettingAlertView: UIView { ...@@ -24,6 +35,9 @@ class DistributorSettingAlertView: UIView {
canYuBtn .setImage(UIImage.init(named: "daixuan"), for: .normal) canYuBtn .setImage(UIImage.init(named: "daixuan"), for: .normal)
nonCanYuBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal) nonCanYuBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal)
contentVheight.constant = 150 contentVheight.constant = 150
canYuBtn.isSelected = false
nonCanYuBtn.isSelected = true
cover_view.isHidden = true
} }
@IBOutlet weak var moneyTx: UITextField! @IBOutlet weak var moneyTx: UITextField!
...@@ -36,23 +50,65 @@ class DistributorSettingAlertView: UIView { ...@@ -36,23 +50,65 @@ class DistributorSettingAlertView: UIView {
@IBAction func payAction(_ sender: UIButton) { @IBAction func payAction(_ sender: UIButton) {
//佣金比例 //佣金比例
payBiBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal)
payJueBtn .setImage(UIImage.init(named: "daixuan"), for: .normal)
payBiBtn.isSelected = true
payJueBtn.isSelected = false
payNumTypelbl.text = "%"
payTF.placeholder = "请输入比例"
} }
@IBAction func payJueAction(_ sender: UIButton) { @IBAction func payJueAction(_ sender: UIButton) {
//绝对值 //绝对值
payBiBtn .setImage(UIImage.init(named: "daixuan"), for: .normal)
payJueBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal)
payBiBtn.isSelected = false
payJueBtn.isSelected = true
payNumTypelbl.text = "元"
payTF.placeholder = "请输入数值"
} }
@IBOutlet weak var payTF: UITextField! @IBOutlet weak var payTF: UITextField!
@IBOutlet weak var payNumTypelbl: UILabel! @IBOutlet weak var payNumTypelbl: UILabel!
@IBAction func cancelAction(_ sender: Any) { @IBAction func cancelAction(_ sender: Any) {
//取消 //取消
self.removeFromSuperview()
} }
@IBAction func sureAction(_ sender: UIButton) { @IBAction func sureAction(_ sender: UIButton) {
//确定 //确定
var operation_type = 1
if nonCanYuBtn.isSelected {
operation_type = 2
}
var commission_type = 2
var commission_per = ""
var commission_val = ""
if payJueBtn.isSelected {
commission_type = 1
commission_val = payTF.text!
}else{
commission_per = payTF.text!
}
delegate?.DistributorSettingAlertViewSubmitAction(tag: self.tag, operation_type: operation_type, dbt_price: moneyTx.text!, commission_type: commission_type, commission_per: commission_per, commission_val: commission_val,view:self)
} }
@IBOutlet weak var cover_view: UIView!
var contentView:UIView! var contentView:UIView!
override func layoutSubviews() {
super.layoutSubviews()
if is_all_select_mode {
cover_view.isHidden = false
moneyTx.isUserInteractionEnabled = false
payBiBtn .setImage(UIImage.init(named: "daixuan"), for: .normal)
payJueBtn .setImage(UIImage.init(named: "yuxuan"), for: .normal)
payBiBtn.isUserInteractionEnabled = false
payJueBtn.isUserInteractionEnabled = false
payNumTypelbl.text = "元"
payTF.placeholder = "请输入数值"
}
}
//初始化时将xib中的view添加进来 //初始化时将xib中的view添加进来
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
...@@ -61,6 +117,7 @@ class DistributorSettingAlertView: UIView { ...@@ -61,6 +117,7 @@ class DistributorSettingAlertView: UIView {
contentView.snp.makeConstraints { (make) in contentView.snp.makeConstraints { (make) in
make.left.top.right.bottom.equalToSuperview() make.left.top.right.bottom.equalToSuperview()
} }
} }
// /初始化时将xib中的view添加进来 // /初始化时将xib中的view添加进来
required init?(coder aDecoder: NSCoder) { required init?(coder aDecoder: NSCoder) {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<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="17126"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17125"/>
<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="System colors in document resources" minToolsVersion="11.0"/> <capability name="System colors in document resources" minToolsVersion="11.0"/>
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
<connections> <connections>
<outlet property="canYuBtn" destination="f2v-Db-np2" id="tfN-y7-awg"/> <outlet property="canYuBtn" destination="f2v-Db-np2" id="tfN-y7-awg"/>
<outlet property="contentVheight" destination="COR-sP-gvF" id="FpO-6n-mdq"/> <outlet property="contentVheight" destination="COR-sP-gvF" id="FpO-6n-mdq"/>
<outlet property="cover_view" destination="QMk-dx-2zr" id="ofI-Ie-Xaa"/>
<outlet property="moneyTx" destination="hmc-1R-guq" id="8WT-Ji-Vvv"/> <outlet property="moneyTx" destination="hmc-1R-guq" id="8WT-Ji-Vvv"/>
<outlet property="nonCanYuBtn" destination="f0i-Vm-UAy" id="2lM-2d-f4v"/> <outlet property="nonCanYuBtn" destination="f0i-Vm-UAy" id="2lM-2d-f4v"/>
<outlet property="payBiBtn" destination="qLO-Gc-A3W" id="Poc-fE-chE"/> <outlet property="payBiBtn" destination="qLO-Gc-A3W" id="Poc-fE-chE"/>
...@@ -68,7 +69,7 @@ ...@@ -68,7 +69,7 @@
<color key="textColor" name="标题字颜色"/> <color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder=" 请输入数值" textAlignment="natural" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="hmc-1R-guq"> <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入数值" textAlignment="center" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="hmc-1R-guq">
<rect key="frame" x="86" y="60" width="90" height="35"/> <rect key="frame" x="86" y="60" width="90" height="35"/>
<color key="backgroundColor" name="搜索框背景色"/> <color key="backgroundColor" name="搜索框背景色"/>
<constraints> <constraints>
...@@ -77,7 +78,7 @@ ...@@ -77,7 +78,7 @@
</constraints> </constraints>
<color key="textColor" name="灰色字体颜色"/> <color key="textColor" name="灰色字体颜色"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/> <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<textInputTraits key="textInputTraits"/> <textInputTraits key="textInputTraits" keyboardType="decimalPad"/>
<userDefinedRuntimeAttributes> <userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius"> <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="3"/> <real key="value" value="3"/>
...@@ -106,7 +107,7 @@ ...@@ -106,7 +107,7 @@
<action selector="payAction:" destination="-1" eventType="touchUpInside" id="cSJ-1X-kkE"/> <action selector="payAction:" destination="-1" eventType="touchUpInside" id="cSJ-1X-kkE"/>
</connections> </connections>
</button> </button>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder=" 请输入比例" textAlignment="natural" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="Ysc-L7-nMy"> <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请输入比例" textAlignment="center" minimumFontSize="13" translatesAutoresizingMaskIntoConstraints="NO" id="Ysc-L7-nMy">
<rect key="frame" x="86" y="155" width="90" height="35"/> <rect key="frame" x="86" y="155" width="90" height="35"/>
<color key="backgroundColor" name="搜索框背景色"/> <color key="backgroundColor" name="搜索框背景色"/>
<constraints> <constraints>
...@@ -115,7 +116,7 @@ ...@@ -115,7 +116,7 @@
</constraints> </constraints>
<color key="textColor" name="灰色字体颜色"/> <color key="textColor" name="灰色字体颜色"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/> <fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<textInputTraits key="textInputTraits"/> <textInputTraits key="textInputTraits" keyboardType="decimalPad"/>
<userDefinedRuntimeAttributes> <userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius"> <userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="3"/> <real key="value" value="3"/>
...@@ -138,6 +139,18 @@ ...@@ -138,6 +139,18 @@
<action selector="payJueAction:" destination="-1" eventType="touchUpInside" id="3xK-vK-PMl"/> <action selector="payJueAction:" destination="-1" eventType="touchUpInside" id="3xK-vK-PMl"/>
</connections> </connections>
</button> </button>
<view hidden="YES" alpha="0.40000000000000002" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="QMk-dx-2zr">
<rect key="frame" x="10" y="52.5" width="275" height="50"/>
<color key="backgroundColor" name="9A9A9A"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="HYH-pP-Jk8"/>
</constraints>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="5"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</view>
</subviews> </subviews>
<color key="backgroundColor" name="白色背景色"/> <color key="backgroundColor" name="白色背景色"/>
<constraints> <constraints>
...@@ -157,10 +170,13 @@ ...@@ -157,10 +170,13 @@
<constraint firstItem="qLO-Gc-A3W" firstAttribute="leading" secondItem="o0f-Uf-X61" secondAttribute="trailing" constant="15" id="Orv-1C-dcV"/> <constraint firstItem="qLO-Gc-A3W" firstAttribute="leading" secondItem="o0f-Uf-X61" secondAttribute="trailing" constant="15" id="Orv-1C-dcV"/>
<constraint firstItem="hmc-1R-guq" firstAttribute="leading" secondItem="jKn-y5-ixC" secondAttribute="trailing" constant="15" id="VPd-Lb-Ogv"/> <constraint firstItem="hmc-1R-guq" firstAttribute="leading" secondItem="jKn-y5-ixC" secondAttribute="trailing" constant="15" id="VPd-Lb-Ogv"/>
<constraint firstItem="Ysc-L7-nMy" firstAttribute="leading" secondItem="hmc-1R-guq" secondAttribute="leading" id="Zwa-28-Egt"/> <constraint firstItem="Ysc-L7-nMy" firstAttribute="leading" secondItem="hmc-1R-guq" secondAttribute="leading" id="Zwa-28-Egt"/>
<constraint firstItem="QMk-dx-2zr" firstAttribute="leading" secondItem="xBK-zg-doj" secondAttribute="leading" constant="10" id="cHv-CU-hWE"/>
<constraint firstItem="NX8-9C-0fE" firstAttribute="bottom" secondItem="hmc-1R-guq" secondAttribute="bottom" id="ch8-To-233"/> <constraint firstItem="NX8-9C-0fE" firstAttribute="bottom" secondItem="hmc-1R-guq" secondAttribute="bottom" id="ch8-To-233"/>
<constraint firstItem="Ysc-L7-nMy" firstAttribute="top" secondItem="qLO-Gc-A3W" secondAttribute="bottom" constant="15" id="eLA-n9-Wzc"/> <constraint firstItem="Ysc-L7-nMy" firstAttribute="top" secondItem="qLO-Gc-A3W" secondAttribute="bottom" constant="15" id="eLA-n9-Wzc"/>
<constraint firstAttribute="trailing" secondItem="QMk-dx-2zr" secondAttribute="trailing" constant="10" id="ecH-CC-gfR"/>
<constraint firstItem="f2v-Db-np2" firstAttribute="centerY" secondItem="9SL-t2-xg8" secondAttribute="centerY" id="f3X-gx-xEz"/> <constraint firstItem="f2v-Db-np2" firstAttribute="centerY" secondItem="9SL-t2-xg8" secondAttribute="centerY" id="f3X-gx-xEz"/>
<constraint firstItem="jKn-y5-ixC" firstAttribute="leading" secondItem="xBK-zg-doj" secondAttribute="leading" constant="15" id="nSW-iI-EmW"/> <constraint firstItem="jKn-y5-ixC" firstAttribute="leading" secondItem="xBK-zg-doj" secondAttribute="leading" constant="15" id="nSW-iI-EmW"/>
<constraint firstItem="QMk-dx-2zr" firstAttribute="centerY" secondItem="jKn-y5-ixC" secondAttribute="centerY" id="p6G-o9-C86"/>
<constraint firstItem="qLO-Gc-A3W" firstAttribute="centerY" secondItem="o0f-Uf-X61" secondAttribute="centerY" id="pxP-3E-XFK"/> <constraint firstItem="qLO-Gc-A3W" firstAttribute="centerY" secondItem="o0f-Uf-X61" secondAttribute="centerY" id="pxP-3E-XFK"/>
<constraint firstItem="f0i-Vm-UAy" firstAttribute="leading" secondItem="f2v-Db-np2" secondAttribute="trailing" constant="25" id="qvK-eL-hk6"/> <constraint firstItem="f0i-Vm-UAy" firstAttribute="leading" secondItem="f2v-Db-np2" secondAttribute="trailing" constant="25" id="qvK-eL-hk6"/>
</constraints> </constraints>
...@@ -293,6 +309,9 @@ ...@@ -293,6 +309,9 @@
<resources> <resources>
<image name="daixuan" width="19" height="19"/> <image name="daixuan" width="19" height="19"/>
<image name="yuxuan" width="19" height="19"/> <image name="yuxuan" width="19" height="19"/>
<namedColor name="9A9A9A">
<color red="0.60392156862745094" green="0.60392156862745094" blue="0.60392156862745094" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="提示视图背景色"> <namedColor name="提示视图背景色">
<color red="0.1803921568627451" green="0.1803921568627451" blue="0.1803921568627451" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/> <color red="0.1803921568627451" green="0.1803921568627451" blue="0.1803921568627451" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor> </namedColor>
......
...@@ -22,7 +22,7 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS ...@@ -22,7 +22,7 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
intro = "取消成功~" intro = "取消成功~"
} }
let dic = ["user_token":UserToken as Any, let dic = ["user_token":UserToken as Any,
"goods_id":model.goods_id as Any, "sku_id":model.sku_id as Any,
"shop_id":shop_id as Any, "shop_id":shop_id as Any,
"action":action] "action":action]
spreadGoods(dic) { (data) in spreadGoods(dic) { (data) in
...@@ -206,15 +206,10 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS ...@@ -206,15 +206,10 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
self.home_list_tbv?.mj_header?.endRefreshing() self.home_list_tbv?.mj_header?.endRefreshing()
self.page = 2 self.page = 2
self.count_lbl.text = "0" self.count_lbl.text = "0"
if look_type == 1{
if model.data?.sum_dbt_goods != nil {
self.count_lbl.text = StringByInt(number: (model.data?.sum_dbt_goods!)!)
}
}else{
if model.data?.sum_goods != nil { if model.data?.sum_goods != nil {
self.count_lbl.text = StringByInt(number: (model.data?.sum_goods!)!) self.count_lbl.text = StringByInt(number: (model.data?.sum_goods!)!)
} }
}
if model.data?.res?.count == 0 { if model.data?.res?.count == 0 {
self.home_list_tbv?.mj_footer?.endRefreshingWithNoMoreData() self.home_list_tbv?.mj_footer?.endRefreshingWithNoMoreData()
...@@ -280,7 +275,7 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS ...@@ -280,7 +275,7 @@ class GYS_FX_Product_VC: BaseViewController,UITableViewDelegate,UITableViewDataS
let model = datas[indexPath.row] let model = datas[indexPath.row]
cell.title_Lbl.text = model.goods_name cell.title_Lbl.text = model.goods_name
cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!) cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!)
cell.store_lbl.text = StringByInt(number: model.goods_number!) cell.store_lbl.text = StringByInt(number: model.inventory!)
if model.commission_type == 1 { if model.commission_type == 1 {
cell.FX_Percent_Lbl.text = StringByInt(number: model.commission_per!) + "%" cell.FX_Percent_Lbl.text = StringByInt(number: model.commission_per!) + "%"
cell.FX_Percent_Lbl.isHidden = false cell.FX_Percent_Lbl.isHidden = false
......
...@@ -19,7 +19,7 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -19,7 +19,7 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl
intro = "取消成功~" intro = "取消成功~"
} }
let dic = ["user_token":UserToken as Any, let dic = ["user_token":UserToken as Any,
"goods_id":model.goods_id as Any, "sku_id":model.sku_id as Any,
"shop_id":shop_id as Any, "shop_id":shop_id as Any,
"action":action] "action":action]
spreadGoods(dic) { (data) in spreadGoods(dic) { (data) in
...@@ -173,7 +173,7 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -173,7 +173,7 @@ class GYS_FX_SearchViewController: BaseViewController,UITableViewDelegate,UITabl
cell.tag = indexPath.row cell.tag = indexPath.row
cell.title_Lbl.text = model.goods_name cell.title_Lbl.text = model.goods_name
cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!) cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!)
cell.store_lbl.text = StringByInt(number: model.goods_number!) cell.store_lbl.text = StringByInt(number: model.inventory!)
if model.commission_type == 1 { if model.commission_type == 1 {
cell.FX_Percent_Lbl.text = StringByInt(number: model.commission_per!) + "%" cell.FX_Percent_Lbl.text = StringByInt(number: model.commission_per!) + "%"
cell.FX_Percent_Lbl.isHidden = false cell.FX_Percent_Lbl.isHidden = false
......
...@@ -8,14 +8,77 @@ ...@@ -8,14 +8,77 @@
import UIKit import UIKit
class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,GYS_FX_ProductCellDelegate ,SelectContentViewDelegate,HeaderSelectViewDelegate{ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate,GYS_FX_ProductCellDelegate ,SelectContentViewDelegate,HeaderSelectViewDelegate,DistributorSettingAlertViewDelegate{
func GYS_FX_ProductCellTableViewCellBtnAction(idx: Int) {
@IBAction func select_mode_Action(_ sender: UIButton) {
let vc = DistributorSettingAlertView(frame: self.view.bounds)
vc.delegate = self
vc.is_all_select_mode = is_Edit
self.view.addSubview(vc)
}
func DistributorSettingAlertViewSubmitAction(tag: Int, operation_type: Int, dbt_price: String, commission_type: Int, commission_per: String, commission_val: String,view:DistributorSettingAlertView) {
if is_Edit {
var sku_id = ""
for i in 0 ..< selectItem.count {
let model = datas[i]
if i < selectItem.count-1{
sku_id += StringByInt(number: model.sku_id!) + ","
}else{
sku_id += StringByInt(number: model.sku_id!)
}
}
let dic = ["user_token":UserToken as Any,
"operation_type":operation_type as Any,
"sku_id":sku_id as Any,
"dbt_price":dbt_price as Any,
"commission_type":commission_type as Any,
"commission_per":commission_per as Any,
"commission_val":commission_val as Any]
supSetCommodity(dic) { (data) in
HUD.flash(.label("设置成功~"), delay: 1.2)
view.removeFromSuperview()
self.navbar.rightTitle = "编辑商品"
self.is_Edit = false
self.edit_bottom_view_H.constant = 49
self.selectItem.removeAll()
self.home_list_tbv.mj_header?.beginRefreshing()
} failture: { (err) in
}
return
}
let model = datas[tag]
let dic = ["user_token":UserToken as Any,
"operation_type":operation_type as Any,
"sku_id":model.sku_id as Any,
"dbt_price":dbt_price as Any,
"commission_type":commission_type as Any,
"commission_per":commission_per as Any,
"commission_val":commission_val as Any]
supSetCommodity(dic) { (data) in
HUD.flash(.label("设置成功~"), delay: 1.2)
view.removeFromSuperview()
self.home_list_tbv.mj_header?.beginRefreshing()
} failture: { (err) in
}
} }
func GYS_FX_ProductCellTableViewCellBtnAction(idx: Int) {
let vc = DistributorSettingAlertView(frame: self.view.bounds)
vc.tag = idx
vc.delegate = self
self.view.addSubview(vc)
}
var datas:Array<supGoodsListResDataModel> = []
var selectIndexArr = [0,0] var selectIndexArr = [0,0]
var showSelectvIndex = 0 var showSelectvIndex = 0
var page : Int = 0
var isUpData = false
let UserToken = UserDefaults.standard.value(forKey: "user_token")
weak var showSelectV: SelectContentView! = nil weak var showSelectV: SelectContentView! = nil
func didselectCell(sender: Int) { func didselectCell(sender: Int) {
selectIndexArr[showSelectvIndex] = sender selectIndexArr[showSelectvIndex] = sender
...@@ -28,7 +91,7 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -28,7 +91,7 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
arr.append(arr2[sender]) arr.append(arr2[sender])
} }
selectV.colseBytitleArr(arr: arr, index:showSelectvIndex) selectV.colseBytitleArr(arr: arr, index:showSelectvIndex)
home_list_tbv.mj_header?.beginRefreshing()
} }
func selectContentvRemoveForSup() { func selectContentvRemoveForSup() {
...@@ -84,11 +147,12 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -84,11 +147,12 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
print("点击搜索进行--") print("点击搜索进行--")
searchBar.resignFirstResponder() searchBar.resignFirstResponder()
keyword = searchBar.text! keyword = searchBar.text!
home_list_tbv.mj_header?.beginRefreshing()
} }
//MARK:--取消搜索代理 //MARK:--取消搜索代理
func clearSearchAction() { func clearSearchAction() {
print("取消搜索代理了--") print("取消搜索代理了--")
home_list_tbv.mj_header?.beginRefreshing()
} }
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
print("编辑即将结束了--") print("编辑即将结束了--")
...@@ -193,12 +257,19 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -193,12 +257,19 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
home_list_tbv.register(UINib(nibName: "GYS_FX_ProductCellTableViewCell", bundle: nil), forCellReuseIdentifier: "GYS_FX_ProductCellTableViewCell") home_list_tbv.register(UINib(nibName: "GYS_FX_ProductCellTableViewCell", bundle: nil), forCellReuseIdentifier: "GYS_FX_ProductCellTableViewCell")
home_list_tbv.separatorStyle = .none home_list_tbv.separatorStyle = .none
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
//下拉刷新相关设置
self.headerMJ.setRefreshingTarget(self, refreshingAction: #selector(self.loadData))
self.home_list_tbv.mj_header = self.headerMJ
self.home_list_tbv.mj_header?.beginRefreshing()
//上拉加载相关设置
self.footerMJ.setRefreshingTarget(self, refreshingAction: #selector(self.loadMoreData))
self.home_list_tbv.mj_footer = self.footerMJ
} }
//MARK: - tableview_delegate //MARK: - tableview_delegate
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 30 return datas.count
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
...@@ -227,6 +298,21 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -227,6 +298,21 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
cell.left_btn.isUserInteractionEnabled = false cell.left_btn.isUserInteractionEnabled = false
cell.select_Img.isHidden = true cell.select_Img.isHidden = true
} }
let model = datas[indexPath.row]
cell.new_price_Lbl.text = model.dbt_price
cell.old_price_Lbl.text = model.price
if model.commission_type == 1{
cell.FX_Percent_Lbl.isHidden = false
cell.FX_Percent_Lbl.text = StringByInt(number: model.commission_per!) + "%"
}else{
cell.FX_Percent_Lbl.isHidden = true
}
cell.title_Lbl.text = model.goods_name
if model.dbt_sale != nil {
cell.sell_total_Lbl.text = StringByInt(number: model.dbt_sale!)
}
cell.store_lbl.text = StringByInt(number: model.inventory!)
cell.item_Icon_Img.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.goods_thumb!))
return cell return cell
} }
...@@ -249,4 +335,72 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -249,4 +335,72 @@ class FX_Product_GuanLiVC: BaseViewController,UITableViewDelegate,UITableViewDat
} }
var is_show = 2
var goods_type = 1
//MARK:--加载数据
@objc func loadData(){
print("加载数据")
page = 1
isUpData = true
goods_type = selectIndexArr.first! + 1
switch selectIndexArr.last {
case 0:
is_show = 2
break
case 1:
is_show = 1
break
default:
is_show = 0
break
}
let dic = ["user_token":UserToken as Any,"keyword":keyword as Any,"page":page as Any,"goods_type":goods_type as Any,"is_show":is_show as Any]
supGoodsList(dic) { (data) in
let model = data as! supGoodsListModel
self.datas.removeAll()
self.count_lbl.text = StringByInt(number: model.data!.count!)
model.data?.res?.forEach({ (item) in
self.datas.append(item)
})
self.home_list_tbv.reloadData()
self.home_list_tbv?.mj_header?.endRefreshing()
self.page = 2
self.count_lbl.text = "0"
if model.data?.res?.count == 0 {
self.home_list_tbv?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.home_list_tbv?.mj_footer?.endRefreshing()
}
} failture: { (err) in
self.home_list_tbv?.mj_header?.endRefreshing()
}
}
//MARK:--加载更多数据
@objc func loadMoreData(){
print("加载更多数据")
let dic = ["user_token":UserToken as Any,"keyword":keyword as Any,"page":page as Any,"goods_type":goods_type as Any,"is_show":is_show as Any]
supGoodsList(dic, success: { (data) in
let model = data as! supGoodsListModel
if model.data?.res?.count == 0 {
self.home_list_tbv?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.page += 1
model.data?.res?.forEach({ (item) in
self.datas.append(item)
})
self.home_list_tbv.reloadData()
self.home_list_tbv?.mj_footer?.endRefreshing()
}
}) { (error) in
self.home_list_tbv?.mj_footer?.endRefreshing()
}
}
} }
...@@ -174,6 +174,9 @@ ...@@ -174,6 +174,9 @@
<color key="value" name="按钮背景颜色"/> <color key="value" name="按钮背景颜色"/>
</userDefinedRuntimeAttribute> </userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes> </userDefinedRuntimeAttributes>
<connections>
<action selector="select_mode_Action:" destination="-1" eventType="touchUpInside" id="gbp-fe-96c"/>
</connections>
</button> </button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="60k-Z3-oI0"> <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="60k-Z3-oI0">
<rect key="frame" x="15" y="15" width="56" height="19"/> <rect key="frame" x="15" y="15" width="56" height="19"/>
......
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