Commit b1e798bc authored by lujunye's avatar lujunye

阿萨德法师法师打算复读

parent 3fcb1bbd
......@@ -625,8 +625,9 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
return
case 134: //分销商管理
// HUD.flash(.label("敬请期待"),delay: 1.2)
let vc = GYS_HZ_Vc()
vc.title_str = "分销商管理"
// let vc = GYS_HZ_Vc()
// vc.title_str = "分销商管理"
let vc = DZGL_VC()
self.navigationController?.pushViewController(vc, animated: true)
return
case 133: //供应商管理
......
......@@ -8,12 +8,20 @@
import UIKit
class DZSHViewController: BaseViewController, UITableViewDelegate, UITableViewDataSource {
class DZSHViewController: BaseViewController, UITableViewDelegate, UITableViewDataSource, DZSH_Detail_ViewController_Delegate {
func DZSH_Detail_ViewController_refresh() {
listView.mj_header?.beginRefreshing()
}
//MARK: - 跳转详情
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let model = dataArr[indexPath.row]
let vc = DZSH_Detail_ViewController()
vc.delegate = self
vc.title_str = "信息审核"
vc.type = type!
vc.action = model.vendor_audit_status!
vc.shop_id = model.shop_id!
vc.user_token = UserToken as! String
self.navigationController?.pushViewController(vc, animated: true)
......
......@@ -9,16 +9,25 @@
import UIKit
import Photos
import SwiftyJSON
import LGButton
protocol DZSH_Detail_ViewController_Delegate {
func DZSH_Detail_ViewController_refresh()
}
class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource, GeliAlertTextViewDelegate ,DZSH_Two_Btn_Cell_Delegate, Location_Cell_Delegate, DZSH_UPLOAD_IMG_CELL_Delegate, UIPickerViewDataSource, UIPickerViewDelegate, DZSH_Date_Cell_Delegate, GLAlertSelectViewDelegate, OnlyTimeSelectView_Delegate,DZSH_Upload_Cer_Cell_Delegate, TitleAndTFCellDelegate, CLLocationManagerDelegate{
@IBOutlet weak var btm_title_lbl: UILabel!
var delegate:DZSH_Detail_ViewController_Delegate?
@IBOutlet weak var btm_h: NSLayoutConstraint!
var shop_id = -1
var user_token = ""
var part0 = ["是否清真","用户类型","店铺类型",""]
var is_qz = false
var kd = true
var shop_type = 9//类型
var type_arr:Array<String> = []
var kd = false
var shop_type = 0//类型
var type_arr:Array<shop_type_model> = []
var shop_longitude = ""
var shop_latitude = ""
......@@ -29,7 +38,10 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
var show_abbre = true//显示简称 1是 0否
var abbreviation = ""//简称1
var sparea_ids = ""//关联专区
var show_logo = true
var sparea_select = -1
var is_logo = true
var logo_word = ""//简称2
var business_week_start = 1
......@@ -51,7 +63,7 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
var contacts_name = "" //联系人
var shop_email = ""//电子邮箱
var shops_sparea:Array<shops_sparea_model> = []
var part4 = ["营业执照号","法定经营范围","负责人身份证","入驻协议","营业执照电子版","流通许可证"]
var business_licence_number = ""//执照号
......@@ -62,6 +74,7 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
var agreement = ""//入驻连接
var type = -1
var action = -1 //1为审核通过,2为审核不通过,3为审核通过待补齐资料
var manger:CLLocationManager = CLLocationManager()
func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
......@@ -117,6 +130,10 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
case 0:
shop_type = selectNum
break
case 12:
sparea_select = selectNum
sparea_ids = shops_sparea[sparea_select].sparea_name!
break
case 22:
business_week_start = selectNum
break
......@@ -136,9 +153,9 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
glSelectView = nil
}
var date_arr = ["星期天","星期一","星期二","星期三","星期四","星期五","星期六"]
var date_arr = ["星期一","星期二","星期三","星期四","星期五","星期六","星期天"]
var glSelectView:GLAlertSelectView?
var timeSelect_view:OnlyTimeSelectView?
func DZSH_Date_Cell_SelectAction(sender: UIButton, cell: DZSH_Date_Cell) {
......@@ -203,7 +220,7 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
abbreviation = str
}
if cell.tag == 21 {//公司简称/logo
abbreviation = str
logo_word = str
}
}
......@@ -216,9 +233,9 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
}
if cell.tag == 21 {//公司简称/logo
show_logo = true
is_logo = true
if select == 0 {
show_logo = false
is_logo = false
}
}
list_view.reloadData()
......@@ -239,23 +256,27 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
func DZSH_Two_Btn_Cell_Click_Action(select: Int, cell: DZSH_Two_Btn_Cell) {
if cell.tag == 0 {
is_qz = true
if select == 0 {
is_qz = false
is_qz = false
if select == 1 {
is_qz = true
}
}else{
kd = true
if select == 0 {
kd = false
kd = false
if select == 1 {
kd = true
}
}
}
@IBAction func submit_action(_ sender: Any) {
print("submit")
let alterView = GeliAlertTextView(frame: self.view.window!.bounds)
alterView.delegate = self
alterView.tag = 99
self.view.window?.addSubview(alterView)
action = 1
alterView.titleLbl.text = "请填写通过原因"
alterView.placerLbl.text = "请填写通过原因"
}
//view
@IBOutlet weak var btm_action_view: UIView!
......@@ -289,7 +310,9 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
var title_str = ""
@IBOutlet weak var save_btn: LGButton!
var hourArr:Array<String> = []
@IBOutlet weak var lbl_top: NSLayoutConstraint!
var minArr:Array<String> = []
override func viewDidLoad() {
super.viewDidLoad()
......@@ -299,6 +322,21 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
manger.requestAlwaysAuthorization()
manger.requestWhenInUseAuthorization()
if title_str == "店铺信息" {
btm_action_view.removeFromSuperview()
btm_action_bg.removeFromSuperview()
}else{
if type == 2 {//已审核
btm_action_view.removeFromSuperview()
btm_action_bg.removeFromSuperview()
if action != 3 {
btm_h.constant = 0
lbl_top.constant = 0
btm_title_lbl.isHidden = true
save_btn.isHidden = true
}
}
}
hourArr.removeAll()
minArr.removeAll()
......@@ -336,9 +374,90 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
let dataModel = data as! storeInfo_model
let model = dataModel.data
type_arr.removeAll()
model?.shop_type?.forEach({ (item) in
type_arr.append(item)
})
is_qz = true
if model?.shop_info?.is_qz == 0 {
is_qz = false
}
kd = true
if model?.shop_info?.kd == 0 {
kd = false
}
shop_type = (model?.shop_info?.shop_type)!
shop_longitude = (model?.shop_info?.shop_longitude)!
shop_longitude = (model?.shop_info?.shop_latitude)!
shop_name = (model?.shop_info?.shop_name)!
show_abbre = false
if model?.shop_info?.show_abbre == 1 {
show_abbre = true
}
abbreviation = (model?.shop_info?.abbreviation)!
logo_word = (model?.shop_info?.logo_word)!
sparea_ids = (model?.shop_info?.sparea_ids)!
provinceIndex = (model?.shop_info?.province)!
cityIndex = (model?.shop_info?.city)!
areaIndex = (model?.shop_info?.district)!
adr_str = (model?.shop_info?.address)!
is_logo = true
if model?.shop_info?.is_logo == 0 {
is_logo = false
}
shop_img = (model?.shop_info?.shop_img)!
logo_word = (model?.shop_info?.logo_word)!
business_week_start = (model?.shop_info?.business_week_start)!-1
if business_week_start < 0 {
business_week_start = 1
}
business_week_end = (model?.shop_info?.business_week_end)!-1
if business_week_end < 0 {
business_week_end = 5
}
business_hours = (model?.shop_info?.business_hours)!
if business_hours.count == 0 {
business_hours = "09:00-18:00"
}
pickup_start_day = (model?.shop_info?.pickup_start_day)!-1
if pickup_start_day < 0 {
pickup_start_day = 1
}
pickup_end_day = (model?.shop_info?.pickup_end_day)!-1
if pickup_end_day < 0 {
pickup_end_day = 5
}
pickup_hours = (model?.shop_info?.pickup_hours)!
if pickup_hours.count == 0 {
pickup_hours = "09:00-18:00"
}
pickup_phone = (model?.shop_info?.pickup_phone)!
pickup_address = (model?.shop_info?.pickup_address)!
shop_tel = (model?.shop_info?.shop_tel)!
shop_scale = (model?.shop_info?.shop_scale)!
shop_intro = (model?.shop_info?.shop_intro)!
contacts_name = (model?.shop_info?.contacts_name)!
shop_email = (model?.shop_info?.shop_email)!
business_licence_number = (model?.shop_info?.business_licence_number)!
business_sphere = (model?.shop_info?.business_sphere)!
identity_card_front = (model?.shop_info?.identity_card_front)!
agreement = (model?.shop_info?.agreement)!
zhizhao = (model?.shop_info?.zhizhao)!
food_production_license = (model?.shop_info?.food_production_license)!
shops_sparea.removeAll()
model?.shops_sparea?.forEach({ (item) in
shops_sparea.append(item)
})
getIndex()
self.list_view.reloadData()
list_view.reloadData()
} failture: { (err ) in
......@@ -383,7 +502,7 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
}
case 2:
if indexPath.row == 0 {
if show_logo {
if is_logo {
return 237
}else{
return 95
......@@ -431,8 +550,8 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
cell.rightBtn.isSelected = true
}
}else{
cell.leftBtn.setTitle(" 个人", for: .normal)
cell.rightBtn.setTitle(" 企业", for: .normal)
cell.leftBtn.setTitle(" 企业", for: .normal)
cell.rightBtn.setTitle(" 个人", for: .normal)
if kd {
cell.leftBtn.isSelected = true
cell.rightBtn.isSelected = false
......@@ -445,7 +564,10 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtnCell") as! TitleAndBtnCell
cell.nameLbl.text = part0[indexPath.row]
cell.contentLbl.text = type_arr[shop_type]
if type_arr.count > 0 {
let mo = type_arr[shop_type]
cell.contentLbl.text = mo.type_name
}
cell.btn.isUserInteractionEnabled = false
return cell
default:
......@@ -480,7 +602,8 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtnCell") as! TitleAndBtnCell
cell.nameLbl.text = part1[indexPath.row]
cell.contentLbl.text = "11"
cell.contentLbl.text = sparea_ids
cell.btn.isUserInteractionEnabled = false
return cell
default:
break
......@@ -519,7 +642,7 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
cell.leftBtn.isSelected = false
cell.rightBtn.isSelected = true
cell.titleLbl.text = "店铺简称"
if show_logo {
if is_logo {
cell.titleLbl.text = "店铺logo"
cell.leftBtn.isSelected = true
cell.rightBtn.isSelected = false
......@@ -533,7 +656,7 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
}
}
cell.input_tf.placeholder = "请输入店铺简称"
cell.input_tf.text = abbreviation
cell.input_tf.text = logo_word
return cell
}
if indexPath.row == 1 {
......@@ -685,7 +808,11 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
view.tag = 0
view.titleLbl.text = "请选择店铺类型"
view.delegate = self
view.dataArr = type_arr
var arr:Array<String> = []
type_arr.forEach { (item) in
arr.append(item.type_name!)
}
view.dataArr = arr
view.is_center_select = true
view.selectNum = shop_type
self.view.addSubview(view)
......@@ -694,6 +821,25 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
}
break
case 1:
if indexPath.row == 2 {
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = 12
view.titleLbl.text = "请选择关联专区"
view.delegate = self
var arr:Array<String> = []
shops_sparea.forEach { (item) in
arr.append(item.sparea_name!)
}
view.dataArr = arr
view.is_center_select = true
if sparea_select != -1 {
view.selectNum = sparea_select
}
self.view.addSubview(view)
glSelectView = view
}
}
if indexPath.row == 3 {
print_bottom_cell_select_place_action()
}
......@@ -732,22 +878,74 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
//MARK: - 不通过原因
func sureGeliAlertTextViewAction(sender: String, view: GeliAlertTextView) {
var qz = 1
if is_qz == false {
qz = 0
}
var k = 1
if kd == false {
k = 0
}
var show_name = 0
if show_abbre {
show_name = 1
}
var show_logo = 0
if is_logo {
show_logo = 1
}
let proDict = addressArray[provinceIndex] as! Dictionary<String,Any>
var cityDict:Dictionary<String,Any> = Dictionary()
var areaDict:Dictionary<String,Any> = Dictionary()
cityDict["area_id"] = ""
areaDict["area_id"] = ""
if (proDict["city_list"] as! NSArray).count > 0 {
cityDict = (proDict["city_list"] as! NSArray)[cityIndex] as! Dictionary<String, Any>
if (cityDict["district_list"] as! NSArray).count > 0 {
areaDict = (cityDict["district_list"] as! NSArray)[areaIndex] as! Dictionary<String,Any>
}
}
let shops = [
"shop_id":shop_id as Any,
"is_qz":qz as Any,
"kd":k as Any,
"shop_type":type_arr[shop_type].shop_type as Any,
"shop_longitude":shop_longitude as Any,
"shop_latitude":shop_latitude as Any,
"shop_name":shop_name as Any,
"shop_img":shop_img as Any,
"show_abbre":show_name as Any,
"abbreviation":abbreviation as Any,
"sparea_ids":sparea_ids as Any,
"province":proDict["area_id"] as Any,
"city":cityDict["area_id"] as Any,
"district":areaDict["area_id"] as Any,
"address":adr_str as Any,
"is_logo":show_logo as Any,
"shop_img":shop_img as Any,
"logo_word":logo_word as Any,
"business_week_start":business_week_start + 1 as Any,
"business_week_end":business_week_end + 1 as Any,
"business_hours":business_hours as Any,
"pickup_start_day":pickup_start_day + 1 as Any,
"pickup_end_day":pickup_end_day + 1 as Any,
"pickup_hours":pickup_hours as Any,
"pickup_phone":pickup_phone as Any,
"pickup_address":pickup_address as Any,
"shop_tel":shop_tel as Any,
"shop_intro":shop_intro as Any,
"shop_scale":shop_scale as Any,
"shop_intro":shop_intro as Any,
"contacts_name":contacts_name as Any,
"identity_card_front":identity_card_front as Any,
"agreement":agreement as Any,
"shop_email":shop_email as Any,
"business_licence_number":business_licence_number as Any,
"business_sphere":business_sphere as Any,
"identity_card_front":identity_card_front as Any,
"agreement":agreement as Any,
"zhizhao":zhizhao as Any,
"food_production_license":food_production_license as Any
"food_production_license":food_production_license as Any,
"shop_id":shop_id as Any
]
let shops_info = dictChangeString(sender:shops)
let dic = ["user_token":user_token as Any,
"action":action as Any,
......@@ -759,7 +957,9 @@ class DZSH_Detail_ViewController: BaseViewController,UITableViewDelegate,UITable
switch view.tag {
case 99://通过,补齐资料
storeExamineOperation(dic) { (data) in
HUD.flash(.success, delay: 1.2)
self.navigationController?.popViewController(animated: true)
self.delegate?.DZSH_Detail_ViewController_refresh()
} failture: { (err) in
}
......
......@@ -14,7 +14,11 @@
<connections>
<outlet property="btm_action_bg" destination="CZj-xH-82j" id="M7S-ek-C6P"/>
<outlet property="btm_action_view" destination="ZZe-yd-lSO" id="F5v-Ri-4nr"/>
<outlet property="btm_h" destination="pdL-Mg-Muo" id="ppn-pA-twG"/>
<outlet property="btm_title_lbl" destination="sCd-fT-s0A" id="4Fv-qe-RVU"/>
<outlet property="lbl_top" destination="C3P-7Y-z6s" id="O0t-TV-Fo6"/>
<outlet property="list_view" destination="kaX-Nj-dzM" id="YBY-Lo-0Y8"/>
<outlet property="save_btn" destination="tlo-ih-Itu" id="9nu-TH-5R8"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......@@ -51,7 +55,7 @@
<rect key="frame" x="0.0" y="813" width="414" height="83"/>
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="确认修改" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sCd-fT-s0A">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="保存" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sCd-fT-s0A">
<rect key="frame" x="0.0" y="813" width="414" height="49"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="pdL-Mg-Muo"/>
......@@ -138,7 +142,7 @@
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
<constraints>
<constraint firstItem="tlo-ih-Itu" firstAttribute="top" secondItem="sCd-fT-s0A" secondAttribute="top" id="5xQ-JM-oQa"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="sCd-fT-s0A" secondAttribute="bottom" id="C3P-7Y-z6s"/>
<constraint firstAttribute="bottom" secondItem="sCd-fT-s0A" secondAttribute="bottom" constant="34" id="C3P-7Y-z6s"/>
<constraint firstAttribute="bottom" secondItem="CZj-xH-82j" secondAttribute="bottom" id="EZ2-fG-iuy"/>
<constraint firstAttribute="bottom" secondItem="tlo-ih-Itu" secondAttribute="bottom" id="GCx-fS-5co"/>
<constraint firstItem="tlo-ih-Itu" firstAttribute="top" secondItem="ZZe-yd-lSO" secondAttribute="top" id="HK2-48-cv4"/>
......
......@@ -34,7 +34,7 @@ class OnlyTimeSelectView: UIView,UIPickerViewDelegate,UIPickerViewDataSource {
var titleStr = "" {
didSet{
let arr = titleStr.components(separatedBy: "~")
let arr = titleStr.components(separatedBy: "-")
let startArr = arr.first?.components(separatedBy: ":") as! Array<NSString>
start_hour = startArr.first!.integerValue
start_min = startArr.last!.integerValue
......
......@@ -105,8 +105,8 @@
<color key="textColor" name="个人中心灰色字体"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="254-Ff-3p7">
<rect key="frame" x="80" y="98.5" width="33" height="19"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="合作中" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="254-Ff-3p7">
<rect key="frame" x="80" y="98.5" width="39" height="19"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<color key="textColor" name="个人中心灰色字体"/>
<nil key="highlightedColor"/>
......
......@@ -8,13 +8,70 @@
import UIKit
class DZGL_VC: BaseViewController, UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate ,DZGL_Cell_Delegate{
class DZGL_VC: BaseViewController, UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate, SearchBarViewDelegate ,DZGL_Cell_Delegate,GeliAlertViewDelegate,DZSH_Detail_ViewController_Delegate {
func DZSH_Detail_ViewController_refresh() {
tableView.mj_header?.beginRefreshing()
}
func rightBtnClick() {
print("新增店铺")//GLAlertTbAddView
loadCenterData()
}
var centers:Array<getAllShopDataModel> = []
func loadCenterData(){
HUD.flash(.progress)
if centers.count == 0 {
getAllShop(["user_token":UserToken as Any]) { (data) in
let model = data as! getAllShopModel
model.data?.forEach({ (item) in
self.centers.append(item)
})
let alertView = GLAlertTbAddView(frame: self.view.bounds)
alertView.bottom_tableview.isHidden = true
alertView.centers = self.centers
alertView.is_gys = false
self.view.addSubview(alertView)
HUD.hide()
} failture: { (err) in
}
}else{
let alertView = GLAlertTbAddView(frame: self.view.bounds)
alertView.bottom_tableview.isHidden = true
alertView.centers = self.centers
alertView.is_gys = false
self.view.addSubview(alertView)
}
}
func sureGeliAlertViewAction(sender: UIButton) {
let model = dbt_datas[sender.tag]
stopContract(["user_token":UserToken as Any,"dbt_id":model.dbt_id]) { (data) in
HUD.flash(.label("删除成功~"), delay: 1.2)
self.tableView.mj_header?.beginRefreshing()
} failture: { (err) in}
}
func DZGL_Cell_Del_Action(cell: DZGL_Cell) {
print("Del",cell.tag)
let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self;
alertView.tishiLbl.text = ""
let model = dbt_datas[cell.tag]
alertView.titileLbl.text = "确定删除 ‘\(model.shop_name!)’?"
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确定"), for: .normal)
alertView.rightBtn.tag = cell.tag
self.view.window?.addSubview(alertView)
}
func DZGL_Cell_Edit_Action(cell: DZGL_Cell) {
print("Edit",cell.tag)
let model = dbt_datas[cell.tag]
let vc = DZSH_Detail_ViewController()
vc.delegate = self
vc.title_str = "店铺信息"
vc.shop_id = model.dbt_id!
vc.user_token = UserToken as! String
self.navigationController?.pushViewController(vc, animated: true)
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
......@@ -26,11 +83,17 @@ class DZGL_VC: BaseViewController, UITableViewDelegate, UITableViewDataSource, U
@IBOutlet weak var cover_btn: UIButton!
@IBOutlet weak var select_list: UITableView!
var dbt_datas:Array<dbtListDataModel> = []
@IBAction func close_action(_ sender: UIButton) {
cover_btn.isHidden = true
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
if tableView.tag == 2 {
return 3
}
return dbt_datas.count
}
var select_num = 0
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
......@@ -39,7 +102,7 @@ class DZGL_VC: BaseViewController, UITableViewDelegate, UITableViewDataSource, U
select_list.isHidden = true
cover_btn.isHidden = true
type_lbl.text = type_arr[select_num]
// self.tableView.mj_header?.beginRefreshing()
self.tableView.mj_header?.beginRefreshing()
}
}
......@@ -53,11 +116,25 @@ class DZGL_VC: BaseViewController, UITableViewDelegate, UITableViewDataSource, U
cell?.textLabel?.font = UIFont.systemFont(ofSize:13)
}
cell?.textLabel?.text = type_arr[indexPath.row]
cell?.textLabel?.textColor = UIColor.black
return cell!
}
let cell = tableView.dequeueReusableCell(withIdentifier: "DZGL_Cell") as! DZGL_Cell
cell.delegate = self
cell.tag = indexPath.row
let model = dbt_datas[indexPath.row]
cell.name_lbl.text = model.shop_name
cell.img_view.sd_setImage(with:URL(string:SERVERCE_ImageHost + model.shop_img_thumb!))
cell.adr_lbl.text = model.address
cell.time_lbl.text = model.create_time
var status = "一对多"
cell.del_Btn.isHidden = false
if model.is_shopowner == 1 {
status = "一对一"
cell.del_Btn.isHidden = true
}
cell.relation_lbl.text = status
return cell
}
......@@ -149,21 +226,74 @@ class DZGL_VC: BaseViewController, UITableViewDelegate, UITableViewDataSource, U
tableView.showsVerticalScrollIndicator = false
headerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadData))
tableView.mj_header = self.headerMJ
// tableView.mj_header?.beginRefreshing()
tableView.mj_header?.beginRefreshing()
self.footerMJ.setRefreshingTarget(self, refreshingAction: #selector(loadMoreData))
tableView.mj_footer = self.footerMJ
tableView.register(UINib(nibName: "DZGL_Cell", bundle: nil), forCellReuseIdentifier: "DZGL_Cell")
NotificationCenter.default.addObserver(self, selector: #selector(getNoti(noti:)), name: NSNotification.Name(rawValue: "haveAdd"), object: nil)
}
deinit {
/// 移除通知
NotificationCenter.default.removeObserver(self)
}
@objc func getNoti(noti:Notification){
tableView.mj_header?.beginRefreshing()
}
var is_shopowner = 100
@objc func loadData(){
switch select_num {
case 0:
is_shopowner = 100
break
case 1:
is_shopowner = 1
break
default:
is_shopowner = 0
break
}
page = 1
isUpData = true
dbtList(["page":page as Any,"user_token":UserToken as Any,"is_shopowner":is_shopowner as Any,"keyword":keyword as Any]) { (data) in
self.dbt_datas.removeAll()
let model = data as! dbtListModel
model.data?.forEach({ (item) in
self.dbt_datas.append(item)
})
self.tableView.reloadData()
self.tableView?.mj_header?.endRefreshing()
if model.data?.count == 0 {
self.tableView?.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.tableView?.mj_footer?.endRefreshing()
}
self.page = 2
} failture: { (err) in
self.tableView?.mj_header?.endRefreshing()
}
}
@objc func loadMoreData(){
dbtList(["page":page as Any,"user_token":UserToken as Any,"is_shopowner":is_shopowner as Any,"keyword":keyword as Any]){ (data) in
let dataM = data as! dbtListModel
if dataM.data?.count == 0 {
self.tableView.mj_footer?.endRefreshingWithNoMoreData()
}else{
self.page += 1
dataM.data?.forEach({ (model) in
self.dbt_datas.append(model)
})
self.tableView.reloadData()
self.tableView.mj_footer?.endRefreshing()
}
} failture: { (error) in
self.tableView.mj_footer?.endRefreshing()
}
}
}
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