Commit 0afe6076 authored by 刘俊宏's avatar 刘俊宏

订单详情待完善

parent a55b3ec7
......@@ -16,6 +16,7 @@
import UIKit
import SwiftDate //日期处理库
import SwiftyJSON
//版本号
let systemVersion = (UIDevice.current.systemVersion as String)
......@@ -231,3 +232,17 @@ func dayByDouble (sender : Double ) -> String {
return dformatter.string(from: data)
}
//MARK:--数组转字符串
func dataChangeString(sender:Array<Any>) -> String{
var str = ""
do {
let json = JSON(sender)
let data = try! JSONEncoder().encode(json)
str = String(data: data, encoding: .utf8)!
}catch {
str = ""
}
return str
}
......@@ -67,6 +67,8 @@ class OrderDetailResModel: Mappable {
var order_type : Int?//订单类型 1普通2期货3团购4预售
var order_status : Int?//订单状态
var order_status_d : Int?//订单详细状态
var shipping_type : Int?//配送方式:1派送,2自提
var sale_res : OrderDetailSaleResModel?//订单预售详情(不是预售订单为空数组,无key=>value)
required init?( map: Map) {
......@@ -101,6 +103,8 @@ class OrderDetailResModel: Mappable {
order_status_d <- map["order_status_d"]
logistics_price <- map["logistics_price"]
other_price <- map["other_price"]
shipping_type <- map["shipping_type"]
sale_res <- map["sale_res"]
}
}
......@@ -109,7 +113,6 @@ func orderStatusStrByInt(statusNumber:Int) -> String? {
switch statusNumber {
case 0:
str = "未确定"
break
//待付款
case 1:
......@@ -140,7 +143,48 @@ func orderStatusStrByInt(statusNumber:Int) -> String? {
}
return str
}
class OrderDetailSaleResModel: Mappable {
var id:Int?
var order_id : Int?
var need_check : Int?
var dj_time_start : Double? //定金开始支付时间
var dj_time_end : Double? //定金截止支付时间
var dj_pay_time : Double?
var wk_time_start : Double?
var wk_time_end : Double? //尾款开始支付时间
var wk_pay_time : Double? //尾款截止支付时间
var set_time : Int?
var dj_amount : String? //定金金额
var dj_pay_type : Int?
var dj_pay_status : Int? //定金支付状态:0未付款; 1已付款 2退款
var wk_amount : String? //尾款金额
var wk_pay_type : Int?
var wk_pay_status : Int? //尾款支付状态:0未付款; 1已付款 2退款
required init?( map: Map) {
}
func mapping(map: Map) {
id <- map["id"]
order_id <- map["order_id"]
need_check <- map["need_check"]
dj_time_start <- map["dj_time_start"]
dj_time_end <- map["dj_time_end"]
dj_pay_time <- map["dj_pay_time"]
wk_time_start <- map["wk_time_start"]
wk_time_end <- map["wk_time_end"]
wk_pay_time <- map["wk_pay_time"]
set_time <- map["set_time"]
dj_amount <- map["dj_amount"]
dj_pay_type <- map["dj_pay_type"]
dj_pay_status <- map["dj_pay_status"]
wk_amount <- map["wk_amount"]
wk_pay_type <- map["wk_pay_type"]
wk_pay_status <- map["wk_pay_status"]
}
}
class OrderDetailGoodsModel: Mappable {
var og_id:Int? //订单商品号
......
......@@ -9,6 +9,11 @@
import UIKit
class ChangePriceNormalCell: UITableViewCell {
@IBOutlet weak var priceTf: UITextField!
@IBOutlet weak var goodsImgVire: UIImageView!
@IBOutlet weak var goodsNameLbl: UILabel!
@IBOutlet weak var attrrLbl: UILabel!
@IBOutlet weak var detailLbl: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......@@ -123,6 +123,13 @@
</constraints>
</tableViewCellContentView>
<viewLayoutGuide key="safeArea" id="njF-e1-oar"/>
<connections>
<outlet property="attrrLbl" destination="M0a-4J-sX5" id="lmf-mw-WuZ"/>
<outlet property="detailLbl" destination="O9n-cz-Xp6" id="2yG-Gh-aIr"/>
<outlet property="goodsImgVire" destination="FVu-j5-tnp" id="BWQ-5E-7Z3"/>
<outlet property="goodsNameLbl" destination="DBa-5v-4sS" id="rVw-o4-1uV"/>
<outlet property="priceTf" destination="82B-G7-MGb" id="VgF-Z2-XBG"/>
</connections>
<point key="canvasLocation" x="131.15942028985509" y="122.54464285714285"/>
</tableViewCell>
</objects>
......
......@@ -18,12 +18,22 @@ class GuanLianKehuVC: BaseViewController , UITableViewDelegate, UITableViewDataS
var selectIdx:Int? = nil//暂代关联客户数据
var order_id:Int? = 0
@IBAction func submitAction(_ sender: LGButton) {
print("确定")
if selectIdx != nil{
HUD.flash(.progress)
let model = self.dataArr[self.selectIdx!]
let UserToken = UserDefaults.standard.value(forKey: "user_token")
self.delegate?.GuanLianKehuSelect(keHuData: self.dataArr[selectIdx!])
bindCus(["cus_id":model.cus_id as Any,"user_token":UserToken as Any,"order_id":order_id as Any], success: { (data) in
self.delegate?.GuanLianKehuSelect(keHuData: self.dataArr[self.selectIdx!])
self.navigationController?.popViewController(animated: true)
}) { (error) in
}
}else{
HUD.flash(.label("请选择关联客户"), delay: 1.2)
}
......
......@@ -8,9 +8,11 @@
import UIKit
import ViewAnimator
import LGButton
class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableViewDataSource {
class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableViewDataSource,UITextFieldDelegate {
var orderID:Int? = 0
var dataArr : Array<OrderDetailGoodsModel>? = []
override func viewDidLoad() {
super.viewDidLoad()
......@@ -18,6 +20,24 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
self.view.addSubview(navbar)
setTabv()
}
@IBOutlet weak var sureBtn: LGButton!
//MARK:--确认修改价格
@IBAction func sureAction(_ sender: LGButton) {
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let order_goods = dataChangeString(sender: [""])
editOrderGoodsPrice(["user_token":UserToken as Any,"order_id":orderID as Any,"order_goods":order_goods], success: { (data) in
}) { (error) in
}
}
var tableV :UITableView!
private let animations = [AnimationType.from(direction: .bottom, offset: 150*glscale)]
......@@ -25,8 +45,9 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
tableV = UITableView()
view.addSubview(tableV);
tableV.snp.makeConstraints { (make) in
make.left.right.bottom.equalToSuperview()
make.left.right.equalToSuperview()
make.top.equalTo(navbar.snp_bottom)
make.bottom.equalTo(sureBtn.snp_top)
}
tableV.backgroundColor = UIColor.init(named: "白色背景色")
tableV.delegate = self
......@@ -37,12 +58,22 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
return 20
// return dataArr!.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "ChangePriceNormalCell") as! ChangePriceNormalCell
let rowModel = dataArr![indexPath.row]
//图片暂不处理
// cell.imageView?.kf.setImage(with: <#T##Resource?#>)
// cell.goodsNameLbl.text = rowModel.goods_name
// cell.attrrLbl.text = rowModel.goods_attr
// cell.priceTf.text = rowModel.goods_price
// cell.detailLbl.isHidden = true
cell.priceTf.delegate = self
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ChangeGoodsPriceVC" customModuleProvider="target">
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ChangeGoodsPriceVC" customModule="GeliBusinessPlatform" customModuleProvider="target">
<connections>
<outlet property="sureBtn" destination="u6y-CU-3oP" id="jeI-hQ-epr"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="u6y-CU-3oP" customClass="LGButton" customModule="LGButton">
<rect key="frame" x="0.0" y="813" width="414" height="83"/>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="gradientStartColor">
<color key="value" name="按钮渐变色上"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="gradientEndColor">
<color key="value" name="按钮渐变色下,字体颜色"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="sureAction:" destination="-1" eventType="touchUpInside" id="dQU-Ds-dPq"/>
</connections>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" usesAttributedText="YES" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Jwf-MV-g9X">
<rect key="frame" x="0.0" y="813" width="414" height="49"/>
<constraints>
<constraint firstAttribute="height" constant="49" id="QaX-zk-pCO"/>
</constraints>
<attributedString key="attributedText">
<fragment content="确定">
<attributes>
<color key="NSColor" name="白色背景色"/>
<font key="NSFont" size="17" name="PingFangSC-Medium"/>
<paragraphStyle key="NSParagraphStyle" alignment="center" lineBreakMode="wordWrapping" baseWritingDirection="natural" tighteningFactorForTruncation="0.0"/>
</attributes>
</fragment>
</attributedString>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="u6y-CU-3oP" firstAttribute="top" secondItem="Jwf-MV-g9X" secondAttribute="top" id="5Yi-pA-FXO"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="bottom" secondItem="Jwf-MV-g9X" secondAttribute="bottom" id="UCr-zS-np2"/>
<constraint firstItem="u6y-CU-3oP" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="X8V-91-hcU"/>
<constraint firstAttribute="bottom" secondItem="u6y-CU-3oP" secondAttribute="bottom" id="dKk-I3-KQD"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="u6y-CU-3oP" secondAttribute="trailing" id="fJG-aG-A6R"/>
<constraint firstItem="Jwf-MV-g9X" firstAttribute="leading" secondItem="fnl-2z-Ty3" secondAttribute="leading" id="s0Y-gq-QBf"/>
<constraint firstItem="fnl-2z-Ty3" firstAttribute="trailing" secondItem="Jwf-MV-g9X" secondAttribute="trailing" id="s4G-5u-agd"/>
</constraints>
<viewLayoutGuide key="safeArea" id="fnl-2z-Ty3"/>
<point key="canvasLocation" x="132" y="119"/>
</view>
</objects>
<resources>
<namedColor name="按钮渐变色上">
<color red="0.3880000114440918" green="0.62400001287460327" blue="0.90200001001358032" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="按钮渐变色下,字体颜色">
<color red="0.27843137254901962" green="0.5607843137254902" blue="0.8901960784313725" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
<namedColor name="白色背景色">
<color red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</namedColor>
</resources>
</document>
......@@ -10,6 +10,8 @@ import UIKit
import LGButton
class XiuGaiYuShouJiaViewController: BaseViewController {
var dataModel : OrderDetailDataModel?
var orderID:Int? = 0
@IBOutlet weak var firstView: UIView!
@IBOutlet weak var weiKuanTF: UITextField!
......@@ -33,12 +35,20 @@ class XiuGaiYuShouJiaViewController: BaseViewController {
make.left.right.equalTo(0)
make.height.equalTo(120*glscale)
}
// Do any additional setup after loading the view.
if (dataModel?.order_goods!.count)! > 0 {
let rowModel = dataModel?.order_goods![0]
titleLbl.text = rowModel!.goods_name
detailLbl.text = rowModel?.goods_attr
countLbl.isHidden = true
dingJinTF.text = dataModel?.order_res?.sale_res?.dj_amount
weiKuanTF.text = dataModel?.order_res?.sale_res?.wk_amount
}
}
@IBAction func submitACTION(_ sender: Any) {
@IBAction func submitACTION(_ sender: Any) {
print("预售返回上一级且提交了数据")
}
/*
// MARK: - Navigation
......
......@@ -8,12 +8,13 @@
import UIKit
class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GuanLianKehuVCDelegate,OrderDViewFooterViewDelegate,TitleAndTFCellDelegate,CommendCellDelegate{
class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GuanLianKehuVCDelegate,OrderDViewFooterViewDelegate,TitleAndTFCellDelegate,CommendCellDelegate,GeliAlertViewDelegate{
var orderId:Int? //订单编号
var isYuShou:Bool = false //是否预售
var dataArr:Array<Any> = ["a","b"] //订单产品数据
var btmBtnsTitleArr:Array<Any> = ["修改价格","打印","确认订单"]//底栏按钮数据
var dataArr:NSArray = ["a","b"] //订单产品数据
var btmBtnsTitleArr:Array<String> = []//底栏按钮数据
let yuShouTitleArr = ["定金:","尾款:","商品合计:","物流费用:","其它费用:"]
let nonYuShouTitleArr = ["商品合计:","物流费用:","其它费用:"]
......@@ -23,6 +24,7 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
@IBOutlet weak var btmViewH: NSLayoutConstraint!
@IBOutlet weak var bottomView: UIView!
@IBOutlet weak var listView: UITableView!
@IBOutlet weak var bottomBgView: UIView!
var cell4Height = 18.5
var cell5Height = 18.5
......@@ -44,8 +46,36 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
self.isYuShou = false
}
self.btmBtnsTitleArr.removeAll()
self.bottomView.subviews.forEach { (view) in
view.removeFromSuperview()
}
//MARK:--底部视图,根据数据显示
self.btmBtnsTitleArr = self.getOrderBottomBtnTitleStrByStatus(status: (self.dataMdoel?.order_res?.order_status)!)
if self.btmBtnsTitleArr.count == 0 {
self.btmViewH.constant = 0
self.bottomView.isHidden = true
self.bottomBgView.isHidden = true
}else{
self.bottomView.isHidden = false
self.bottomBgView.isHidden = false
for i in 0 ..< self.btmBtnsTitleArr.count{
let title = self.btmBtnsTitleArr[i]
let width = fullScreenWidth / CGFloat(self.btmBtnsTitleArr.count)
let btn = UIButton(frame: CGRect(x: CGFloat(i) * width, y: 0, width: width, height: self.bottomView.bounds.size.height))
btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
btn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 13)
btn.setTitle(title, for: .normal)
btn.addTarget(self, action: #selector(self.bottomBtnClick(sender:)), for: .touchUpInside)
self.bottomView.addSubview(btn)
}
}
self.listView.reloadData()
}) { (error) in
}
......@@ -65,25 +95,98 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
listView.register(UINib(nibName: "XuanZeShangPinCell", bundle: nil), forCellReuseIdentifier: "XuanZeShangPinCell")
listView.register(UINib(nibName: "CommendCell", bundle: nil), forCellReuseIdentifier: "CommendCell")
if btmBtnsTitleArr.count == 0 {
btmViewH.constant = 0
}
//MARK: - 底部自定义方法
@objc func bottomBtnClick(sender:UIButton){
let UserToken = UserDefaults.standard.value(forKey: "user_token")
switch sender.titleLabel?.text {
case "修改价格":
if isYuShou {
let vc = XiuGaiYuShouJiaViewController()
vc.dataModel = self.dataMdoel
vc.orderID = self.orderId
self.navigationController?.pushViewController(vc, animated: true)
}else{
for i in 0 ..< btmBtnsTitleArr.count{
let title = btmBtnsTitleArr[i] as! String
let width = fullScreenWidth / CGFloat(btmBtnsTitleArr.count)
let vc = ChangeGoodsPriceVC()
vc.dataArr = self.dataMdoel?.order_goods
vc.orderID = self.orderId
self.navigationController?.pushViewController(vc, animated: true)
}
break
case "打印":
//暂无
print("暂无")
break
case "确认订单":
isSrueOrder = true
let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self;
alertView.tishiLbl.text = ""
alertView.titileLbl.text = "是否确认订单?"
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确认"), for: .normal)
self.view.window?.addSubview(alertView)
break
case "取消订单":
isSrueOrder = false
let alertView = GeliAlertView(frame: self.view.window!.bounds)
alertView.delegate = self;
alertView.tishiLbl.text = ""
alertView.titileLbl.text = "是否确认取消订单?"
alertView.rightBtn.setAttributedTitle(NSAttributedString(string: "确认"), for: .normal)
self.view.window?.addSubview(alertView)
break
case "直接发货":
HUD.flash(.progress)
if isYuShou {
sendOutAd(["user_token":UserToken as Any,"order_id" : self.dataMdoel?.order_res?.order_id as Any], success: { (data) in
HUD.flash(.labeledSubSuccess(subtitle: "提交成功"),delay: 1.2)
self.loadData()
}) { (error) in
let btn = UIButton(frame: CGRect(x: CGFloat(i) * width, y: 0, width: width, height: bottomView.bounds.size.height))
btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
btn.titleLabel?.font = UIFont.boldSystemFont(ofSize: 13)
btn.setTitle(title, for: .normal)
btn.addTarget(self, action: #selector(bottomBtnClick(sender:)), for: .touchUpInside)
bottomView.addSubview(btn)
}
}else{
sendOut(["user_token":UserToken as Any,"order_id" : self.dataMdoel?.order_res?.order_id as Any], success: { (data) in
HUD.flash(.labeledSubSuccess(subtitle: "提交成功"),delay: 1.2)
self.loadData()
}) { (error) in
}
}
//MARK: - 底部自定义方法
@objc func bottomBtnClick(sender:UIButton){
print(sender.titleLabel?.text)
break
case "退款":
HUD.flash(.progress)
orderRefund(["user_token":UserToken as Any,"order_id" : self.dataMdoel?.order_res?.order_id as Any], success: { (data) in
HUD.flash(.labeledSubSuccess(subtitle: "提交成功"),delay: 1.2)
self.loadData()
}) { (error) in
}
break
case "退货":
HUD.flash(.progress)
if isYuShou {
orderReturnedGoodsAd(["user_token":UserToken as Any,"order_id" : self.dataMdoel?.order_res?.order_id as Any], success: { (data) in
HUD.flash(.labeledSubSuccess(subtitle: "提交成功"),delay: 1.2)
self.loadData()
}) { (error) in
}
}else{
orderReturnedGoods(["user_token":UserToken as Any,"order_id" : self.dataMdoel?.order_res?.order_id as Any], success: { (data) in
HUD.flash(.labeledSubSuccess(subtitle: "提交成功"),delay: 1.2)
self.loadData()
}) { (error) in
}
}
break
default:
break
}
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......@@ -94,7 +197,7 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
if (self.dataMdoel?.order_goods?.count)! > 2 {
let view = OrderDViewFooterView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 33.5))
view.delegate = self
view.nameLbl.text = "查看全部(共\(self.dataMdoel?.order_goods?.count)个商品)"
view.nameLbl.text = "查看全部(共" + StringByInt(number: (self.dataMdoel?.order_goods!.count)!) + "个商品)"
return view
}
}
......@@ -118,7 +221,7 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
if self.dataMdoel?.order_res?.cus_id != 0 {
cell.contentLbl.text = self.dataMdoel?.order_res?.cus_name
}else{
//如果不刷新请求,那么就更新本地,建议还是刷新
//如果不刷新请求,那么就更新本地,建议还是刷新,暂不刷
cell.contentLbl.text = "请选择关联客户"
}
......@@ -151,11 +254,36 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
cell.nameLbl.text = yuShouTitleArr[indexPath.row]
cell.textTF.text = yuShouTitleArr[indexPath.row]
cell.delegate = self
//MARK:--预售商品,定金,尾款,合计,物流费用,其他费用 cell
switch indexPath.row {
case 0:
print("预售定金")
print(self.dataMdoel?.order_res?.sale_res?.dj_amount)
cell.textTF.text = "¥" + (self.dataMdoel?.order_res?.sale_res?.dj_amount)!
break
case 1:
cell.textTF.text = "¥" + (self.dataMdoel?.order_res?.sale_res?.wk_amount)!
break
case 2:
cell.textTF.text = "¥" + (self.dataMdoel?.order_res?.goods_amount)!
break
case 3:
cell.textTF.text = "¥" + (self.dataMdoel?.order_res?.logistics_price)!
break
case 4:
cell.textTF.text = "¥" + (self.dataMdoel?.order_res?.other_price)!
break
default:
break
}
if indexPath.row == yuShouTitleArr.count - 1 {
cell.line.isHidden = true
}
}else{
//MARK:--商品合计,物流费用,其他费用 cell
//MARK:--普通商品合计,物流费用,其他费用 cell
cell.nameLbl.text = nonYuShouTitleArr[indexPath.row]
switch indexPath.row {
case 0:
......@@ -178,49 +306,14 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
}
return cell
case 3:
if isYuShou {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
cell.textTF.isUserInteractionEnabled = false
cell.nameLbl.text = YuShouPart3Arr[indexPath.row]
cell.textTF.text = YuShouPart3Arr[indexPath.row]
return cell
}else{
if indexPath.row == 4 || indexPath.row == 5 || indexPath.row == 9 {
let cell = tableView.dequeueReusableCell(withIdentifier: "CommendCell") as! CommendCell
cell.tag = indexPath.row
cell.delegate = self
cell.titleLbl.text = YuShouPart3Arr[indexPath.row]
switch indexPath.row {
case 4:cell.placeLbl.text = "请输入物流单号"
break
case 5:cell.placeLbl.text = "请输入物流公司"
break
case 9:cell.placeLbl.text = "请输入留言信息"
break
default:
break
}
return cell
}
if indexPath.row == 6 || indexPath.row == 7 {
cell.nameLbl.text = YuShouPart3Arr[indexPath.row]
switch indexPath.row {
case 6:
cell.contentLbl.text = "未支付"
break
case 7:
cell.contentLbl.text = "未付款"
break
default:
break
}
return cell
}
//MARK:--收货人信息cell
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
cell.textTF.isUserInteractionEnabled = false
cell.nameLbl.text = nonYuShouPart3Arr[indexPath.row]
if self.dataMdoel?.receiving == nil {
cell.textTF.text = "-"
}else{
switch indexPath.row {
case 0:
cell.textTF.text = (self.dataMdoel?.receiving?.consignee)!
......@@ -233,22 +326,37 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
break
default:
break
}
return cell
}
return cell
case 4:
//MARK:--订单信息cell
if indexPath.row == 4 || indexPath.row == 5 || indexPath.row == 9 {
let cell = tableView.dequeueReusableCell(withIdentifier: "CommendCell") as! CommendCell
cell.delegate = self
cell.tag = indexPath.row
cell.titleLbl.text = YuShouPart3Arr[indexPath.row]
switch indexPath.row {
case 4:cell.placeLbl.text = "请输入物流单号"
case 4:
cell.placeLbl.text = self.dataMdoel?.order_res?.lwb_no
if self.dataMdoel?.order_res?.lwb_no == nil {
cell.placeLbl.text = "-"
}else if cell.placeLbl.text?.count == 0 {
cell.placeLbl.text = "请输入物流单号"
}
break
case 5:cell.placeLbl.text = "请输入物流公司"
case 5:
cell.placeLbl.text = self.dataMdoel?.order_res?.lc_name
if cell.placeLbl.text?.count == 0 {
cell.placeLbl.text = "请输入物流公司"
}
break
case 9:cell.placeLbl.text = "请输入留言信息"
case 9:
cell.placeLbl.text = self.dataMdoel?.order_res?.order_postscript
if cell.placeLbl.text?.count == 0 {
cell.placeLbl.text = "请输入留言信息"
}
break
default:
break
......@@ -259,10 +367,10 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
cell.nameLbl.text = YuShouPart3Arr[indexPath.row]
switch indexPath.row {
case 6:
cell.contentLbl.text = "未支付"
cell.contentLbl.text = self.dataMdoel?.order_res?.pay_type_cn
break
case 7:
cell.contentLbl.text = "未付款"
cell.contentLbl.text = self.dataMdoel?.order_res?.pay_status_cn
break
default:
break
......@@ -272,7 +380,33 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndTFCell") as! TitleAndTFCell
cell.textTF.isUserInteractionEnabled = false
cell.nameLbl.text = YuShouPart3Arr[indexPath.row]
cell.textTF.text = YuShouPart3Arr[indexPath.row]
switch indexPath.row {
case 0:
cell.textTF.text = self.dataMdoel?.order_res?.order_sn
break
case 1:
cell.textTF.text = TimeByDouble(sender: (self.dataMdoel?.order_res?.add_time!)!)
break
case 2:
cell.textTF.text = self.dataMdoel?.order_res?.from_cn
break
case 3:
if self.dataMdoel?.order_res?.shipping_type == 1 {
cell.textTF.text = "派送"
}else{
cell.textTF.text = "自提"
}
break
case 8:
cell.textTF.text = self.dataMdoel?.order_res?.postscript
break
default:
break
}
if cell.textTF.text?.count == 0 {
cell.textTF.text = "-"
}
return cell
default:
break
......@@ -282,25 +416,28 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
func CommendCellSendStr(content: String,cell:CommendCell) {
print("CommendCellSendStr")
}
//MARK:--查看全部商品
func OrderDViewFooterViewBtnClick() {
print("查看全部商品")
let vc = ShowAlGoodsViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
//MARK:--选择的关联客户返回数据
var selectKeHuData:CusListAllDataModel? = nil
func GuanLianKehuSelect(keHuData: CusListAllDataModel) {
print("选择的关联客户",keHuData)
self.selectKeHuData = keHuData
self.dataMdoel?.order_res?.cus_id = self.selectKeHuData?.cus_id
self.dataMdoel?.order_res?.cus_name = self.selectKeHuData?.cus_name
//暂时不刷新数据,只刷新视图
listView.reloadData()
}
func btnClick(content: String, cell: TitleAndBtnCell) {
switch cell.nameLbl.text {
case "关联客户":
let vc = GuanLianKehuVC()
vc.delegate = self
vc.order_id = self.orderId
if self.dataMdoel?.order_res?.cus_id != 0 {
vc.cus_id = self.dataMdoel?.order_res?.cus_id
}
......@@ -322,12 +459,8 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
if self.dataMdoel == nil {
return 0
}
if isYuShou {
return 4
}else{
return 5
}
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if self.dataMdoel == nil {
......@@ -357,44 +490,18 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
return 3
}
case 3:
if isYuShou{
return 10
}else{
if self.dataMdoel?.order_res?.shipping_type == 1{
return 3
}
return 0
case 4:
return 10
default:
return 10
return 0
}
}
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
switch section {
case 1:
let view = TitleAndLblView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 49))
view.nameLbl.text = "订单状态"
//订单状态
view.contentLbl.text = orderStatusStrByInt(statusNumber: (self.dataMdoel?.order_res?.order_status)!)
return view
case 3:
let view = HeaderOnlyTitleView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39))
if isYuShou {
view.nameLbl.text = "订单信息"
}else{
view.nameLbl.text = "收货信息"
}
return view
case 4:
let view = HeaderOnlyTitleView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39))
view.nameLbl.text = "订单信息"
return view
default:
break
}
return view
}
//MARK: - footer delegate
func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
switch section {
......@@ -410,6 +517,10 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
}
case 2:
return 59
case 3:
if self.dataMdoel?.order_res?.shipping_type != 1 {
return 0.01
}
default:
break
}
......@@ -449,6 +560,28 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
}
//MARK: - header delegate
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
let view = UIView()
switch section {
case 1:
let view = TitleAndLblView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 49))
view.nameLbl.text = "订单状态"
//订单状态
view.contentLbl.text = orderStatusStrByInt(statusNumber: (self.dataMdoel?.order_res?.order_status)!)
return view
case 3:
let view = HeaderOnlyTitleView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39))
view.nameLbl.text = "收货信息"
return view
case 4:
let view = HeaderOnlyTitleView(frame: CGRect(x: 0, y: 0, width: fullScreenWidth, height: 39))
view.nameLbl.text = "订单信息"
return view
default:
break
}
return view
}
func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
switch section {
case 1:
......@@ -456,7 +589,11 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
case 2:
return 1
case 3:
if self.dataMdoel?.order_res?.shipping_type == 1{
return 39
}else{
return 0.01
}
case 4:
return 39
default:
......@@ -482,4 +619,68 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
listView.beginUpdates()
listView.endUpdates()
}
//MARK:--根据数据获取底部按钮操作
func getOrderBottomBtnTitleStrByStatus(status:Int) -> Array<String> {
var titleArr: Array<String> = []
switch status {
case 0,1:
// str = "未确定" "待付款"
titleArr = ["修改价格","打印","确认订单","取消订单"]
break
case 6:
// str = "待发货"
titleArr = ["直接发货","打印","退款"]
break
case 7:
// str = "待收货"
titleArr = ["退货","打印","退款"]
break
//订单完成
case 5:
// str = "订单完成"
titleArr = ["打印","退款"]
break
//订单关闭
case 8,2:
// str = "订单关闭"str = "已取消" //用户取消(预售
titleArr = []
break
default:
break
}
return titleArr
}
//MARK:--确认和取消订单
var isSrueOrder = false
//MARK:--弹窗代理 --还有其他弹窗,根据tag分类
func sureAction(sender: UIButton) {
if isSrueOrder {
HUD.flash(.progress)
let UserToken = UserDefaults.standard.value(forKey: "user_token")
orderConfirm(["user_token":UserToken as Any,"order_id" : self.dataMdoel?.order_res?.order_id as Any], success: { (data) in
HUD.flash(.labeledSubSuccess(subtitle: "确认成功"),delay: 1.2)
self.loadData()
}) { (error) in
}
}else{
HUD.flash(.progress)
let UserToken = UserDefaults.standard.value(forKey: "user_token")
orderCancel(["user_token":UserToken as Any,"order_id" : self.dataMdoel?.order_res?.order_id as Any], success: { (data) in
HUD.flash(.labeledSubSuccess(subtitle: "取消成功"),delay: 1.2)
self.loadData()
}) { (error) in
}
}
}
}
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="16096" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
<device id="retina6_1" orientation="portrait" appearance="light"/>
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="16087"/>
<capability name="Named colors" minToolsVersion="9.0"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
......@@ -10,6 +10,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="OrderDViewController" customModule="GeliBusinessPlatform" customModuleProvider="target">
<connections>
<outlet property="bottomBgView" destination="n9R-tn-hVY" id="eSi-Ty-uFr"/>
<outlet property="bottomView" destination="uzE-Ha-UZM" id="KNM-2q-cr7"/>
<outlet property="btmViewH" destination="Scu-he-Peb" id="6AX-79-BBC"/>
<outlet property="listView" destination="Ynh-hV-MLH" id="c3b-QY-jsW"/>
......
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