Commit d7b9155c authored by lujunye's avatar lujunye

打印功能优化

parent 1d858546
...@@ -43,6 +43,7 @@ class printOrder_data_res_model: Mappable { ...@@ -43,6 +43,7 @@ class printOrder_data_res_model: Mappable {
var district_id : Int?// 区id(order_res) var district_id : Int?// 区id(order_res)
var province :String?//省 var province :String?//省
var address_str:String?//详细地址
var city:String?//市 var city:String?//市
var district : String?//区 var district : String?//区
var mobile :String?//手机 var mobile :String?//手机
...@@ -66,6 +67,7 @@ class printOrder_data_res_model: Mappable { ...@@ -66,6 +67,7 @@ class printOrder_data_res_model: Mappable {
mobile <- map["mobile"] mobile <- map["mobile"]
consignee <- map["consignee"] consignee <- map["consignee"]
address_str <- map["address_str"]
} }
} }
......
...@@ -22,9 +22,9 @@ class WorkItemCollectionViewCell: UICollectionViewCell { ...@@ -22,9 +22,9 @@ class WorkItemCollectionViewCell: UICollectionViewCell {
override func layoutSubviews() { override func layoutSubviews() {
super.layoutSubviews() super.layoutSubviews()
if itemNameLbl.text!.count > 5 { if itemNameLbl.text!.count > 5 {
btm_margin.constant = 0 btm_margin.constant = 1
}else{ }else{
btm_margin.constant = 9 btm_margin.constant = 10
} }
} }
......
...@@ -12,23 +12,23 @@ ...@@ -12,23 +12,23 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/> <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="WorkItemCollectionViewCell" customModule="TestClass" customModuleProvider="target"> <collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="gTV-IL-0wX" customClass="WorkItemCollectionViewCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="100" height="91"/> <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center"> <view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="100" height="91"/> <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews> <subviews>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="pg3-lh-kp9"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="pg3-lh-kp9">
<rect key="frame" x="0.0" y="0.0" width="100" height="91"/> <rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
</imageView> </imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="item名称" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nZJ-9s-cJg"> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="item名称" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nZJ-9s-cJg">
<rect key="frame" x="0.0" y="77.5" width="100" height="13.5"/> <rect key="frame" x="0.0" y="86.5" width="100" height="13.5"/>
<fontDescription key="fontDescription" type="system" pointSize="11"/> <fontDescription key="fontDescription" type="system" pointSize="11"/>
<color key="textColor" name="标题字颜色"/> <color key="textColor" name="标题字颜色"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bianji" translatesAutoresizingMaskIntoConstraints="NO" id="qfI-0k-kQG"> <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="bianji" translatesAutoresizingMaskIntoConstraints="NO" id="qfI-0k-kQG">
<rect key="frame" x="27.5" y="8.5" width="45" height="45"/> <rect key="frame" x="27.5" y="13" width="45" height="45"/>
<constraints> <constraints>
<constraint firstAttribute="width" constant="45" id="AKt-O2-9tI"/> <constraint firstAttribute="width" constant="45" id="AKt-O2-9tI"/>
<constraint firstAttribute="height" constant="45" id="mL5-ZO-3vy"/> <constraint firstAttribute="height" constant="45" id="mL5-ZO-3vy"/>
......
...@@ -43,7 +43,7 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -43,7 +43,7 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
pc.printInfo = printInfo pc.printInfo = printInfo
pc.delegate = self pc.delegate = self
if userName != "不二制油" { //普通 if userName == "不二制油" { //普通
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":"" as Any, "remittance_account":"" as Any,
...@@ -67,6 +67,8 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -67,6 +67,8 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
}else{ }else{
let vc = viewControllers[selectIndex] let vc = viewControllers[selectIndex]
if selectIndex != 0 {
if vc.FM_str.count == 0 { if vc.FM_str.count == 0 {
HUD.flash(.label("请输入汇款账户"), delay: 1.2) HUD.flash(.label("请输入汇款账户"), delay: 1.2)
return return
...@@ -87,7 +89,9 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -87,7 +89,9 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
HUD.flash(.label("请填写联系人"), delay: 1.2) HUD.flash(.label("请填写联系人"), delay: 1.2)
return return
} }
}
var dic:Dictionary<String,Any> = Dictionary() var dic:Dictionary<String,Any> = Dictionary()
print("change == ",selectIndex)
if vc.isChange { if vc.isChange {
dic = ["user_token":UserToken as Any, dic = ["user_token":UserToken as Any,
"order_id":order_id as Any, "order_id":order_id as Any,
...@@ -97,7 +101,8 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -97,7 +101,8 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
"district_id":vc.areaDict["area_id"] as Any, "district_id":vc.areaDict["area_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 "address_str":vc.detail_adr_str as Any,
"print_type":vc.type as Any
] ]
}else{ }else{
dic = ["user_token":UserToken as Any, dic = ["user_token":UserToken as Any,
...@@ -108,7 +113,8 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -108,7 +113,8 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
"district_id":"" 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 "address_str":vc.detail_adr_str as Any,
"print_type":vc.type as Any
] ]
} }
printUrl(dic) { (data) in printUrl(dic) { (data) in
...@@ -117,24 +123,28 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -117,24 +123,28 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
let url = URL(string: urlStr!) let url = URL(string: urlStr!)
let request = URLRequest.init(url: url!, cachePolicy: .reloadRevalidatingCacheData, timeoutInterval: 10) let request = URLRequest.init(url: url!, cachePolicy: .reloadRevalidatingCacheData, timeoutInterval: 10)
self.web_vc.wkWebView.load(request) self.web_vc.wkWebView.load(request)
HUD.flash(.progress) HUD.flash(.progress, delay: 1.2)
self.isAlreadyClick = true
} failture: { (err) in } failture: { (err) in
} }
} }
} }
var isAlreadyClick = false
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!){ func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!){
print("页面加载完成...") print("页面加载完成...")
HUD.hide() if isAlreadyClick {
isAlreadyClick = false
delay(0.5) { [self] in
let formatter = webView.viewPrintFormatter() let formatter = webView.viewPrintFormatter()
pc.printFormatter = formatter pc.printFormatter = formatter
formatter.startPage = 0 formatter.startPage = 0
pc.present(animated: true) { (printer, result, err) in pc.present(animated: true) { (printer, result, err) in
print(result) print(result)
} }
}
}
} }
@IBOutlet weak var contentV: UIView! @IBOutlet weak var contentV: UIView!
...@@ -155,7 +165,9 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -155,7 +165,9 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
if printData?.consignee != nil { if printData?.consignee != nil {
vc.consignee_str = (printData?.consignee)! vc.consignee_str = (printData?.consignee)!
} }
if printData?.address_str != nil {
vc.detail_adr_str = (printData?.address_str)!
}
} }
} }
} }
...@@ -202,7 +214,7 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -202,7 +214,7 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
self.view.addSubview(navbar) self.view.addSubview(navbar)
SetTopFrameView(view: contentV, btmView: self.view) SetTopFrameView(view: contentV, btmView: self.view)
if userName != "不二制油" { if userName == "不二制油" {
normal_type_btn.isHidden = false normal_type_btn.isHidden = false
}else{ }else{
normal_type_btn.isHidden = true normal_type_btn.isHidden = true
...@@ -241,7 +253,6 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt ...@@ -241,7 +253,6 @@ class PrintListMgVc: BaseViewController, PagingViewControllerDelegate,UIPrintInt
guard let item = pagingItem as? PagingIndexItem else { return} guard let item = pagingItem as? PagingIndexItem else { return}
if selectIndex != item.index { if selectIndex != item.index {
selectIndex = item.index selectIndex = item.index
} }
} }
} }
......
...@@ -126,26 +126,17 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -126,26 +126,17 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat
return genderLbl return genderLbl
} }
var tempProvince_select = -1//临时省id
var tempCity_select = -1//临时市id
var tempProvince_select = 0//临时省id var tempArea_select = -1//临时区id
var tempCity_select = 0//临时市id
var tempArea_select = 0//临时区id
var isChange = false 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>
var cityDict:Dictionary<String,Any> = Dictionary()
var areaDict:Dictionary<String,Any> = Dictionary()
cityDict["area_id"] = "" cityDict["area_id"] = ""
areaDict["area_id"] = "" areaDict["area_id"] = ""
cityDict["area_name"] = "" cityDict["area_name"] = ""
...@@ -358,7 +349,7 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -358,7 +349,7 @@ 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 == "不二制油"{ if userName != "不二制油"{
get_location_id() get_location_id()
} }
} }
...@@ -406,6 +397,7 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat ...@@ -406,6 +397,7 @@ class PrintViewController: BaseViewController,UITableViewDelegate,UITableViewDat
"district_id":areaDict["area_id"] as Any, "district_id":areaDict["area_id"] as Any,
"mobile":phone_str as Any, "mobile":phone_str as Any,
"consignee":consignee_str as Any, "consignee":consignee_str as Any,
"address_str":detail_adr_str as Any,
"print_type":type as Any "print_type":type as Any
] ]
......
...@@ -175,7 +175,7 @@ ...@@ -175,7 +175,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="17" translatesAutoresizingMaskIntoConstraints="NO" id="jiF-F7-HDQ"> <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请填写地址" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="jiF-F7-HDQ">
<rect key="frame" x="15" y="219.5" width="283.5" height="34"/> <rect key="frame" x="15" y="219.5" width="283.5" height="34"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="34" id="zWI-Fs-mcz"/> <constraint firstAttribute="height" constant="34" id="zWI-Fs-mcz"/>
...@@ -209,7 +209,7 @@ ...@@ -209,7 +209,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="17" translatesAutoresizingMaskIntoConstraints="NO" id="1EG-8Y-For"> <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请填写电话" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="1EG-8Y-For">
<rect key="frame" x="15" y="297.5" width="283.5" height="34"/> <rect key="frame" x="15" y="297.5" width="283.5" height="34"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="34" id="gzm-O4-gYm"/> <constraint firstAttribute="height" constant="34" id="gzm-O4-gYm"/>
...@@ -243,7 +243,7 @@ ...@@ -243,7 +243,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="17" translatesAutoresizingMaskIntoConstraints="NO" id="SHz-wb-OzF"> <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="请填写联系人" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="SHz-wb-OzF">
<rect key="frame" x="15" y="375.5" width="283.5" height="34"/> <rect key="frame" x="15" y="375.5" width="283.5" height="34"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="34" id="ojX-2U-wGA"/> <constraint firstAttribute="height" constant="34" id="ojX-2U-wGA"/>
......
...@@ -1368,7 +1368,7 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa ...@@ -1368,7 +1368,7 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
} }
break break
case "打印": case "打印":
// orderId = 12445 // orderId = 12599
printOrder(["user_token":UserToken as Any,"order_id":orderId as Any]) { [self] (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()
......
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