Commit 0f0862f1 authored by lujunye's avatar lujunye

新增供应商

parent ec2f98eb
...@@ -276,6 +276,10 @@ ...@@ -276,6 +276,10 @@
<string>Distribution/getAllShop</string> <string>Distribution/getAllShop</string>
<key>供应商新增店铺</key> <key>供应商新增店铺</key>
<string>Distribution/supAddContract</string> <string>Distribution/supAddContract</string>
<key>分销商新增供应商</key>
<string>Distribution/dbtAddContract</string>
<key>获取供应商商店</key>
<string>Distribution/getSupShop</string>
<key>分销订单管理</key> <key>分销订单管理</key>
<string>Distribution/dbtOrderLis</string> <string>Distribution/dbtOrderLis</string>
<key>标记已人工结算</key> <key>标记已人工结算</key>
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import Foundation import Foundation
import ObjectMapper import ObjectMapper
//发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单,商品入库审核,商品入库,商品入库申请,商品出库,商品申请出库,商品审核出库,出库入库审核不通过,编辑地址,删除地址,新增采购单,审核采购单,撤销入库,采购单修改支付状态,供应商编辑,新增供应商,编辑客户,新增客户,应收账款收款,设为未收,取消采购单,修改采购订单,新增品牌,拒绝退款,确认用户退款到账,拒绝接单,审核同意退货退款,取消订单审核,确认收到退货,审核同意退货或退款,订单确认收货,取消运单,支付运费,选定地址添加收发货历史,取消货拉拉订单,货拉拉二次支付,货拉拉格利支付,发票消息短信通知,修改电子发票链接地址,分销分账设置,供应商新增店铺,标记已人工结算,铺货与取消铺货,终止合作,分销商品管理 //发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单,商品入库审核,商品入库,商品入库申请,商品出库,商品申请出库,商品审核出库,出库入库审核不通过,编辑地址,删除地址,新增采购单,审核采购单,撤销入库,采购单修改支付状态,供应商编辑,新增供应商,编辑客户,新增客户,应收账款收款,设为未收,取消采购单,修改采购订单,新增品牌,拒绝退款,确认用户退款到账,拒绝接单,审核同意退货退款,取消订单审核,确认收到退货,审核同意退货或退款,订单确认收货,取消运单,支付运费,选定地址添加收发货历史,取消货拉拉订单,货拉拉二次支付,货拉拉格利支付,发票消息短信通知,修改电子发票链接地址,分销分账设置,供应商新增店铺,标记已人工结算,铺货与取消铺货,终止合作,分销商品管理,分销商新增供应商
class UpDataModel: Mappable { class UpDataModel: Mappable {
......
...@@ -220,3 +220,30 @@ func supSetCommodity(_ params:[String:Any],success:@escaping (_ res:Any)->(),fai ...@@ -220,3 +220,30 @@ func supSetCommodity(_ params:[String:Any],success:@escaping (_ res:Any)->(),fai
failture(error) failture(error)
} }
} }
//MARK:-- 分销商新增供应商
/*
//params-key:user_token
shop_id
*/
func dbtAddContract(_ 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)
}
}
//MARK:-- 获取供应商商店
/*
//params-key:user_token
*/
func getSupShop(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("获取供应商商店", params, { (rep:DataResponse<getSupShopModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
...@@ -344,3 +344,31 @@ class supGoodsListResDataModel: Mappable { ...@@ -344,3 +344,31 @@ class supGoodsListResDataModel: Mappable {
is_dbt <- map["is_dbt"] is_dbt <- map["is_dbt"]
} }
} }
//MARK: - 获取供应商商店
class getSupShopModel: Mappable {
var code:Int?
var message : String?
var data :Array<getSupShopDataModel>?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class getSupShopDataModel: Mappable {
var shop_id:Int?
var shop_name : String?
required init?( map: Map) {
}
func mapping(map: Map) {
shop_id <- map["shop_id"]
shop_name <- map["shop_name"]
}
}
...@@ -11,7 +11,14 @@ import UIKit ...@@ -11,7 +11,14 @@ import UIKit
class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlertTbAddViewCellDelegate,TitleAndSelectCellDelegate{ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlertTbAddViewCellDelegate,TitleAndSelectCellDelegate{
var is_gys = false {
didSet{
if is_gys{
title_lbl.text = "新增供应商"
loadData()
}
}
}
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
func GLAlertTbAddViewCellBtnAction(target: String,tag:Int) { func GLAlertTbAddViewCellBtnAction(target: String,tag:Int) {
...@@ -31,7 +38,25 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert ...@@ -31,7 +38,25 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
func loadData(){ func loadData(){
print("1")
HUD.flash(.progress) HUD.flash(.progress)
if title_lbl.text == "新增供应商" {
print("2")
if gys_centers.count == 0 {
getSupShop(["user_token":UserToken as Any]) { (data) in
let model = data as! getSupShopModel
model.data?.forEach({ (item) in
self.gys_centers.append(item)
})
self.bottom_tableview.reloadData()
HUD.hide()
} failture: { (err) in
}
}
}else{
print("3")
if centers.count == 0 { if centers.count == 0 {
getDbtShop(["user_token":UserToken as Any]) { (data) in getDbtShop(["user_token":UserToken as Any]) { (data) in
let model = data as! getDbtShopModel let model = data as! getDbtShopModel
...@@ -45,7 +70,9 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert ...@@ -45,7 +70,9 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
} }
} }
} }
}
var centers:Array<getDbtShopDataModel> = [] var centers:Array<getDbtShopDataModel> = []
var gys_centers:Array<getSupShopDataModel> = []
var datas:Array<String> = [""] var datas:Array<String> = [""]
@IBOutlet weak var center_view_height: NSLayoutConstraint! @IBOutlet weak var center_view_height: NSLayoutConstraint!
...@@ -53,6 +80,9 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert ...@@ -53,6 +80,9 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
if tableView == list_tableview { if tableView == list_tableview {
return datas.count return datas.count
}else{ }else{
if title_lbl.text == "新增供应商" {
return gys_centers.count
}
return centers.count return centers.count
} }
} }
...@@ -79,6 +109,24 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert ...@@ -79,6 +109,24 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
} }
return cell return cell
}else{ }else{
if title_lbl.text == "新增供应商" {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSelectCell")! as! TitleAndSelectCell
cell.is_center_select = true
cell.delegate = self
let model = gys_centers[indexPath.row]
cell.titleLbl.text = model.shop_name
let str = datas[idx] as! String
if str.count > 0{
if cell.titleLbl.text == str {
cell.selectBtn.isSelected = true
}else{
cell.selectBtn.isSelected = false
}
}
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSelectCell")! as! TitleAndSelectCell let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndSelectCell")! as! TitleAndSelectCell
cell.is_center_select = true cell.is_center_select = true
cell.delegate = self cell.delegate = self
...@@ -99,8 +147,10 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert ...@@ -99,8 +147,10 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
} }
func scrollViewDidScroll(_ scrollView: UIScrollView) { func scrollViewDidScroll(_ scrollView: UIScrollView) {
if scrollView != bottom_tableview {
bottom_tableview.isHidden = true bottom_tableview.isHidden = true
} }
}
var idx:Int = 0 var idx:Int = 0
func GLAlertTbAddViewCellSelectAction(tag:Int) { func GLAlertTbAddViewCellSelectAction(tag:Int) {
...@@ -112,19 +162,21 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert ...@@ -112,19 +162,21 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if tableView == bottom_tableview { if tableView == bottom_tableview {
let str = datas[idx] as! String let str = datas[idx] as! String
tableView.visibleCells.forEach { (item) in tableView.visibleCells.forEach { (item) in
let cell = item as! TitleAndSelectCell let cell = item as! TitleAndSelectCell
cell.selectBtn.isSelected = false cell.selectBtn.isSelected = false
} }
if title_lbl.text == "新增供应商" {
bottom_tableview.isHidden = true let model = gys_centers[indexPath.row]
datas.insert(model.shop_name!, at: idx)
}else{
let model = centers[indexPath.row] let model = centers[indexPath.row]
datas.insert(model.shop_name!, at: idx) datas.insert(model.shop_name!, at: idx)
}
datas.remove(at: idx+1) datas.remove(at: idx+1)
list_tableview.reloadData() list_tableview.reloadData()
bottom_tableview.isHidden = true
} }
} }
...@@ -136,6 +188,26 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert ...@@ -136,6 +188,26 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
@IBAction func btnAction(_ sender: UIButton) { @IBAction func btnAction(_ sender: UIButton) {
if sender.tag == 0 { if sender.tag == 0 {
var shop_id = "" var shop_id = ""
if title_lbl.text == "新增供应商" {
for i in 0 ..< datas.count{
let str = datas[i]
gys_centers.forEach { (item) in
if item.shop_name == str {
if i < datas.count-1 {
shop_id += StringByInt(number: item.shop_id!) + ","
}else{
shop_id += StringByInt(number: item.shop_id!)
}
}
}
}
dbtAddContract(["user_token":UserToken as Any,"shop_id":shop_id as Any]) { (data) in
self.removeFromSuperview()
NotificationCenter.default.post(name: NSNotification.Name(rawValue: "haveAdd"), object: "fxsAdd")
} failture: { (err) in
}
return
}
for i in 0 ..< datas.count{ for i in 0 ..< datas.count{
let str = datas[i] let str = datas[i]
centers.forEach { (item) in centers.forEach { (item) in
...@@ -166,11 +238,13 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert ...@@ -166,11 +238,13 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
} }
} }
@IBOutlet weak var title_lbl: UILabel!
@IBOutlet weak var bottom_tableview: UITableView! @IBOutlet weak var bottom_tableview: UITableView!
@IBOutlet weak var list_tableview: UITableView! @IBOutlet weak var list_tableview: UITableView!
//初始化时将xib中的view添加进来 //初始化时将xib中的view添加进来
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
contentView = loadViewFromNib() contentView = loadViewFromNib()
addSubview(contentView) addSubview(contentView)
contentView.snp.makeConstraints { (make) in contentView.snp.makeConstraints { (make) in
...@@ -186,6 +260,7 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert ...@@ -186,6 +260,7 @@ class GLAlertTbAddView: UIView,UITableViewDelegate,UITableViewDataSource,GLAlert
// /初始化时将xib中的view添加进来 // /初始化时将xib中的view添加进来
required init?(coder aDecoder: NSCoder) { required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder) super.init(coder: aDecoder)
contentView = loadViewFromNib() contentView = loadViewFromNib()
addSubview(contentView) addSubview(contentView)
contentView.snp.makeConstraints { (make) in contentView.snp.makeConstraints { (make) in
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
<outlet property="bottom_tableview" destination="0V2-BU-sF9" id="iJ3-vo-ZiD"/> <outlet property="bottom_tableview" destination="0V2-BU-sF9" id="iJ3-vo-ZiD"/>
<outlet property="center_view_height" destination="9E4-JF-1gj" id="UwA-pb-rXY"/> <outlet property="center_view_height" destination="9E4-JF-1gj" id="UwA-pb-rXY"/>
<outlet property="list_tableview" destination="ai3-h9-DLi" id="3Wi-eZ-2xQ"/> <outlet property="list_tableview" destination="ai3-h9-DLi" id="3Wi-eZ-2xQ"/>
<outlet property="title_lbl" destination="oAF-vL-09z" id="Ovp-hk-HH6"/>
</connections> </connections>
</placeholder> </placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
......
...@@ -24,6 +24,7 @@ class GLAlertTbAddViewCell: UITableViewCell { ...@@ -24,6 +24,7 @@ class GLAlertTbAddViewCell: UITableViewCell {
@IBOutlet weak var actionBtn: UIButton! @IBOutlet weak var actionBtn: UIButton!
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
self.selectionStyle = .none
// Initialization code // Initialization code
} }
......
...@@ -47,6 +47,9 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U ...@@ -47,6 +47,9 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U
print("新增店铺")//GLAlertTbAddView print("新增店铺")//GLAlertTbAddView
let alertView = GLAlertTbAddView(frame: self.view.window!.bounds) let alertView = GLAlertTbAddView(frame: self.view.window!.bounds)
alertView.bottom_tableview.isHidden = true alertView.bottom_tableview.isHidden = true
if title_str != "分销商管理" {
alertView.is_gys = true
}
self.view.window?.addSubview(alertView) self.view.window?.addSubview(alertView)
} }
...@@ -62,8 +65,8 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U ...@@ -62,8 +65,8 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U
//MARK:--取消搜索代理 //MARK:--取消搜索代理
func clearSearchAction() { func clearSearchAction() {
print("取消搜索代理了--") print("取消搜索代理了--")
// keyword = "" // keyword = ""
// self.home_list_tbv.mj_header?.beginRefreshing() // self.home_list_tbv.mj_header?.beginRefreshing()
} }
func searchBarTextDidEndEditing(_ searchBar: UISearchBar) { func searchBarTextDidEndEditing(_ searchBar: UISearchBar) {
print("编辑即将结束了--") print("编辑即将结束了--")
...@@ -104,7 +107,7 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U ...@@ -104,7 +107,7 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
// title_str = "分销商管理" // title_str = "分销商管理"
SetTopFrame(view: search_view, height: 44) SetTopFrame(view: search_view, height: 44)
...@@ -115,8 +118,8 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U ...@@ -115,8 +118,8 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U
searchV = searchBr searchV = searchBr
var holder_str = "请输入供应商名称" var holder_str = "请输入供应商名称"
if title_str == "分销商管理" {
navbar.rightTitle = "新增店铺" navbar.rightTitle = "新增店铺"
if title_str == "分销商管理" {
holder_str = "请输入分销商名称" holder_str = "请输入分销商名称"
} }
...@@ -221,7 +224,6 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U ...@@ -221,7 +224,6 @@ class GYS_HZ_Vc: BaseViewController,UITableViewDelegate,UITableViewDataSource, U
} }
} }
cell.tag = indexPath.row cell.tag = indexPath.row
return cell return cell
} }
......
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