Commit fa4dcb5d authored by lujunye's avatar lujunye

打印订单输入逻辑修改完成

parent 8e65a429
...@@ -15,14 +15,27 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -15,14 +15,27 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
let web_vc = WebViewController() let web_vc = WebViewController()
@IBAction func check_detail(_ sender: UIButton) { @IBAction func check_detail(_ sender: UIButton) {
web_vc.titleStr = "打印预览" web_vc.titleStr = "打印预览"
web_vc.urlStr = "https://www.baidu.com" let dic = ["user_token":UserToken as Any,
self.navigationController?.pushViewController(web_vc, animated: true) "order_id":order_id as Any,
"remittance_account":"" as Any,
"province_id":"" as Any,
"city_id":"" as Any,
"district_id":"" as Any,
"mobile":"" as Any,
"consignee":"" as Any
]
printUrl(dic) { (data) in
let d = data as! printUrl_Model
self.web_vc.urlStr = d.data!
self.navigationController?.pushViewController(self.web_vc, animated: true)
} failture: { (err) in
} }
let pc = UIPrintInteractionController.shared
@IBAction func print_action(_ sender: LGButton) {
}
let pc = UIPrintInteractionController.shared
@IBAction func print_action(_ sender: LGButton) {
// 打印任务相关信息 // 打印任务相关信息
let printInfo = UIPrintInfo(dictionary:nil) let printInfo = UIPrintInfo(dictionary:nil)
printInfo.outputType = UIPrintInfo.OutputType.general printInfo.outputType = UIPrintInfo.OutputType.general
...@@ -38,7 +51,8 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -38,7 +51,8 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
"city_id":"" as Any, "city_id":"" as Any,
"district_id":"" as Any, "district_id":"" as Any,
"mobile":"" as Any, "mobile":"" as Any,
"consignee":"" as Any "consignee":"" as Any,
"print_type":1 as Any
] ]
printUrl(dic) { (data) in printUrl(dic) { (data) in
let d = data as! printUrl_Model let d = data as! printUrl_Model
...@@ -51,16 +65,50 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -51,16 +65,50 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
} }
}else{//不二 }else{//不二
let vc = viewControllers[selectIndex] let vc = viewControllers[selectIndex]
if vc.FM_str.count == 0 {
let dic = ["user_token":UserToken as Any, HUD.flash(.label("请输入汇款账户"), delay: 1.2)
return
}
if vc.dzStr.count == 0 && vc.type != 1 {
HUD.flash(.label("请选择区域"), delay: 1.2)
return
}
if vc.detail_adr_str.count == 0 {
HUD.flash(.label("请填写地址"), delay: 1.2)
return
}
if vc.phone_str.count == 0 {
HUD.flash(.label("请填写电话"), delay: 1.2)
return
}
if vc.consignee_str.count == 0 {
HUD.flash(.label("请填写联系人"), delay: 1.2)
return
}
var dic:Dictionary<String,Any> = Dictionary()
if vc.isChange {
dic = ["user_token":UserToken as Any,
"order_id":order_id as Any,
"remittance_account":vc.FM_str as Any,
"province_id":vc.province_id as Any,
"city_id":vc.city_id as Any,
"district_id":vc.area_id as Any,
"mobile":vc.phone_str as Any,
"consignee":vc.consignee_str as Any,
"print_type":selectIndex as Any
]
}else{
dic = ["user_token":UserToken as Any,
"order_id":order_id as Any, "order_id":order_id as Any,
"remittance_account":vc.FM_str as Any, "remittance_account":vc.FM_str as Any,
"province_id":vc.provinceIndex as Any, "province_id":"" as Any,
"city_id":vc.cityIndex as Any, "city_id":"" as Any,
"district_id":vc.areaIndex as Any, "district_id":"" as Any,
"mobile":vc.phone_str as Any, "mobile":vc.phone_str as Any,
"consignee":vc.consignee_str as Any "consignee":vc.consignee_str as Any,
"print_type":selectIndex as Any
] ]
}
printUrl(dic) { (data) in printUrl(dic) { (data) in
let d = data as! printUrl_Model let d = data as! printUrl_Model
let url = URL(string: d.data!) let url = URL(string: d.data!)
...@@ -135,6 +183,12 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -135,6 +183,12 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
super.viewDidLoad() super.viewDidLoad()
web_vc.wkWebView.navigationDelegate = self web_vc.wkWebView.navigationDelegate = self
let vc2 = viewControllers[1]
vc2.type = 2
let vc3 = viewControllers[2]
vc3.type = 3
navbar.title = "打印模版确认" navbar.title = "打印模版确认"
navbar.lineView.isHidden = true navbar.lineView.isHidden = true
self.view.addSubview(navbar) self.view.addSubview(navbar)
......
...@@ -12,6 +12,7 @@ import SwiftyJSON ...@@ -12,6 +12,7 @@ import SwiftyJSON
class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,print_bottom_cellDelegate, UIPickerViewDataSource, UIPickerViewDelegate{ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,print_bottom_cellDelegate, UIPickerViewDataSource, UIPickerViewDelegate{
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
var order_id = 0 var order_id = 0
var type = 1
let web_vc = WebViewController() let web_vc = WebViewController()
//MARK: - 地址选择 //MARK: - 地址选择
//选择的省索引 //选择的省索引
...@@ -21,6 +22,8 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -21,6 +22,8 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat
//选择的区(县)索引 //选择的区(县)索引
var areaIndex = 0 var areaIndex = 0
//选择器 //选择器
var pickerView:UIPickerView! var pickerView:UIPickerView!
//所以地址数据集合 //所以地址数据集合
...@@ -123,22 +126,50 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -123,22 +126,50 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat
return genderLbl return genderLbl
} }
var tempProvince_select = 0//临时省id
var tempCity_select = 0//临时市id
var tempArea_select = 0//临时区id
var isChange = false
var province_id = ""
var city_id = ""
var area_id = ""
@objc func adrSelectFinish(sender:UIButton){ @objc func adrSelectFinish(sender:UIButton){
var proName = "" var proName = ""
var cityName = "" var cityName = ""
var areaName = "" var areaName = ""
let proDict = addressArray[provinceIndex] as! Dictionary<String,Any> 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"] = ""
cityDict["area_name"] = ""
areaDict["area_name"] = ""
proName = proDict["area_name"] as! String proName = proDict["area_name"] as! String
if (proDict["city_list"] as! NSArray).count > 0 { if (proDict["city_list"] as! NSArray).count > 0 {
let cityDict = (proDict["city_list"] as! NSArray)[cityIndex] as! [String: AnyObject] cityDict = (proDict["city_list"] as! NSArray)[cityIndex] as! [String: AnyObject]
cityName = cityDict["area_name"] as! String cityName = cityDict["area_name"] as! String
if (cityDict["district_list"] as! NSArray).count > 0 { if (cityDict["district_list"] as! NSArray).count > 0 {
let areaDict = (cityDict["district_list"] as! NSArray)[areaIndex] as! Dictionary<String,Any> areaDict = (cityDict["district_list"] as! NSArray)[areaIndex] as! Dictionary<String,Any>
areaName = areaDict["area_name"] as! String areaName = areaDict["area_name"] as! String
} }
} }
if provinceIndex != tempProvince_select || cityIndex != tempCity_select || areaIndex != tempArea_select {
isChange = true
}else{
isChange = false
}
province_id = proDict["area_id"]! as! String
city_id = cityDict["area_id"]! as! String
area_id = areaDict["area_id"]! as! String
var selectAdr = proName var selectAdr = proName
if cityName.count > 0 { if cityName.count > 0 {
...@@ -148,6 +179,7 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -148,6 +179,7 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat
} }
} }
dzStr = selectAdr dzStr = selectAdr
bgBtn?.removeFromSuperview() bgBtn?.removeFromSuperview()
btmView?.subviews.forEach({ (view) in btmView?.subviews.forEach({ (view) in
...@@ -317,7 +349,7 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -317,7 +349,7 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat
} }
} }
let userName = UserDefaults.standard.string(forKey: "userName")
@IBOutlet weak var list_view: UITableView! @IBOutlet weak var list_view: UITableView!
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
...@@ -327,6 +359,28 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -327,6 +359,28 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat
list_view.separatorStyle = .none list_view.separatorStyle = .none
list_view.showsVerticalScrollIndicator = false list_view.showsVerticalScrollIndicator = false
getIndex() getIndex()
if userName == "不二制油"{
get_location_id()
}
}
func get_location_id(){
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! [String: AnyObject]
if (cityDict["district_list"] as! NSArray).count > 0 {
areaDict = (cityDict["district_list"] as! NSArray)[areaIndex] as! Dictionary<String,Any>
}
}
province_id = proDict["area_id"]! as! String
city_id = cityDict["area_id"]! as! String
area_id = areaDict["area_id"]! as! String
} }
//MARK:--VC 初始化 //MARK:--VC 初始化
convenience init(title: String) { convenience init(title: String) {
...@@ -344,8 +398,7 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -344,8 +398,7 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
if indexPath.row == 0 { if indexPath.row == 0 {
print("check print") print("预览")
print("ck = ",order_id)
let dic = ["user_token":UserToken as Any, let dic = ["user_token":UserToken as Any,
"order_id":order_id as Any, "order_id":order_id as Any,
"remittance_account":FM_str as Any, "remittance_account":FM_str as Any,
...@@ -353,7 +406,8 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -353,7 +406,8 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat
"city_id":cityIndex as Any, "city_id":cityIndex as Any,
"district_id":areaIndex as Any, "district_id":areaIndex as Any,
"mobile":phone_str as Any, "mobile":phone_str as Any,
"consignee":consignee_str as Any "consignee":consignee_str as Any,
"print_type":type as Any
] ]
printUrl(dic) { (data) in printUrl(dic) { (data) in
......
...@@ -1368,12 +1368,12 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa ...@@ -1368,12 +1368,12 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
} }
break break
case "打印": case "打印":
// dataMdoel?.order_res?.order_id orderId = 12445
printOrder(["user_token":UserToken as Any,"order_id":12445 as Any]) { (data) in printOrder(["user_token":UserToken as Any,"order_id":orderId as Any]) { [self] (data) in
let d = data as! printOrder_model let d = data as! printOrder_model
let vc = PrintListMgVc() let vc = PrintListMgVc()
vc.printData = d.data?.order_res vc.printData = d.data?.order_res
vc.order_id = 12445 vc.order_id = self.orderId!
self.navigationController?.pushViewController(vc, animated: true) self.navigationController?.pushViewController(vc, animated: true)
} failture: { (err) in } failture: { (err) in
......
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