Commit 1746c0dc authored by 刘俊宏's avatar 刘俊宏

完善订单详情修改(待测试完善)

parent 728e2eae
......@@ -466,6 +466,7 @@
F9DDBE922457BFEC00A32CB2 /* HUDEXT.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9DDBE912457BFEC00A32CB2 /* HUDEXT.swift */; };
F9DDBE962457D3EC00A32CB2 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9DDBE942457D3EC00A32CB2 /* WebViewController.swift */; };
F9DDBE972457D3EC00A32CB2 /* WebViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F9DDBE952457D3EC00A32CB2 /* WebViewController.xib */; };
F9FF7BA124760DA9006E305E /* LogisticsCompanyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9FF7BA024760DA9006E305E /* LogisticsCompanyModel.swift */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
......@@ -1008,6 +1009,7 @@
F9DDBE912457BFEC00A32CB2 /* HUDEXT.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HUDEXT.swift; sourceTree = "<group>"; };
F9DDBE942457D3EC00A32CB2 /* WebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = "<group>"; };
F9DDBE952457D3EC00A32CB2 /* WebViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WebViewController.xib; sourceTree = "<group>"; };
F9FF7BA024760DA9006E305E /* LogisticsCompanyModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogisticsCompanyModel.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
......@@ -2219,6 +2221,7 @@
F93E31F624721C4200524DFC /* EditOGPAdModel.swift */,
F9A0E1DC246D198B00D7F26F /* CusListAllModel.swift */,
F9A0E1DE246D1B1E00D7F26F /* GetGoodsInfoModel.swift */,
F9FF7BA024760DA9006E305E /* LogisticsCompanyModel.swift */,
);
path = OrderManageModel;
sourceTree = "<group>";
......@@ -2888,6 +2891,7 @@
E0D197C22448431C002B080C /* BabyRhythm.m in Sources */,
F956D5A1246A2D9C003FF510 /* LMNToolBar.m in Sources */,
F950FDDC24518B9500C40530 /* FSCalendar.m in Sources */,
F9FF7BA124760DA9006E305E /* LogisticsCompanyModel.swift in Sources */,
E0206327246CD84A007A40C4 /* TitleAndLblView.swift in Sources */,
F942A7FD247500C300FDFC47 /* TestClass.swift in Sources */,
F950FDD824518B9500C40530 /* FSCalendarDelegationProxy.m in Sources */,
......
......@@ -68,6 +68,8 @@
<string>Order/orderReturnedGoodsAd</string>
<key>修改订单支付方式(状态)</key>
<string>Order/editPayType</string>
<key>获取物流公司信息</key>
<string>Order/logisticsCompany</string>
<key>获取客户信息</key>
<string>Customer/cusListAll</string>
<key>获取商品信息</key>
......
......@@ -254,3 +254,18 @@ func cusListAll(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture
failture(error)
}
}
//MARK:--获取物流公司信息
/**
params-key:
user_token(验证token)
*/
func logisticsCompany(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("获取物流公司信息", params, { (rep:DataResponse<LogisticsCompanyModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//
// LogisticsCompanyModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/5/21.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//获取物流公司信息
class LogisticsCompanyModel: Mappable {
var code:Int?
var message : String?
var data : Array<LogisticsCompanyDataModel>?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class LogisticsCompanyDataModel: Mappable {
var lc_id : Int? //物流公司id
var lc_name : String? //物流公司名
required init?( map: Map) {
}
func mapping(map: Map) {
lc_id <- map["lc_id"]
lc_name <- map["lc_name"]
}
}
......@@ -216,6 +216,9 @@
{
[self.textView exportHTML:^(BOOL succeed, NSString *html) {
NSLog(@"html:\n%@", [NSString stringWithFormat:@"<html>%@</html>",html]);
LMNWebViewController *vc = [[LMNWebViewController alloc]init];
vc.html = [NSString stringWithFormat:@"<html>%@</html>",html];
[self.navigationController pushViewController:vc animated:YES];
}];
}
......
......@@ -42,16 +42,16 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
}
//MARK:--loginVC
func addLoginVc (isAgain:Bool){
//
// let vc = LoginViewController()
// vc.delegate = self
// let contentView = vc
let vc = LoginViewController()
vc.delegate = self
let contentView = vc
let vc = LMNoteViewController()
//
let contentView = vc
// let vc = LMNoteViewController()
// //
// let contentView = vc
if let windowScene = sceneC as? UIWindowScene {
......@@ -98,7 +98,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
// Create the SwiftUI view that provides the window contents.
tabBarController.viewControllers = [v1, v2, v3, v4, v5]
tabBarController.selectedIndex = 1
// tabBarController.selectedIndex = 1
let contentView = tabBarController
......
......@@ -429,12 +429,7 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
if isTrue {
//"下架"
print("下架下架下架")
// editField(["user_token":"","function_id":"15","prval":"goods_id","value":"0",], success: { (data) in
// self.loadData()
// }) { (erro) in
//
// }
}else{
}else{
//"入库"
print("入库--入库")
......@@ -446,12 +441,7 @@ class GoodsManageListVC: BaseViewController, UICollectionViewDelegate, UICollect
}else{
//"上架"
print("上架上架上架上架")
// editField(["user_token":"","function_id":"15","prval":rowModel.goods_id,"value":"1",], success: { (data) in
// self.loadData()
// }) { (erro) in
//
// }
}
}
}
......
......@@ -46,10 +46,12 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
let order_goods = dataChangeString(sender: order_goodsArr!)
editOrderGoodsPrice(["user_token":UserToken as Any,"order_id":orderID as Any,"order_goods":order_goods], success: { (data) in
HUD.flash(.labeledSubSuccess(subtitle: "修改成功"), delay: 1.2)
self.delegate?.changeGoodsPriByData(sender: self.dataArr!)
self.navigationController?.popViewController(animated: true)
let dataM = data as! UpDataModel
if dataM.code == 1 {
self.delegate?.changeGoodsPriByData(sender: self.dataArr!)
self.navigationController?.popViewController(animated: true)
}
}) { (error) in
......
......@@ -10,6 +10,7 @@ import UIKit
import ViewAnimator
class ShowAlGoodsViewController: BaseViewController , UITableViewDelegate, UITableViewDataSource{
var order_goods:Array<OrderDetailGoodsModel>? = []
override func viewDidLoad() {
super.viewDidLoad()
......@@ -33,20 +34,23 @@ class ShowAlGoodsViewController: BaseViewController , UITableViewDelegate, UITa
tableV.dataSource = self
tableV.separatorStyle = .none
//不是这个cell-是跟订单详情里面的商品 一样
// tableV?.register(UINib(nibName: "ChangePriceNormalCell", bundle: nil), forCellReuseIdentifier: "ChangePriceNormalCell")
tableV?.register(UINib(nibName: "XuanZeShangPinCell", bundle: nil), forCellReuseIdentifier: "XuanZeShangPinCell")
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
return order_goods!.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "XuanZeShangPinCell") as! XuanZeShangPinCell
cell.selectBtn.isHidden = true
cell.detailLbl2.isHidden = true
let rowModel = order_goods![indexPath.row]
cell.nameLbl.text = rowModel.goods_name
cell.detailLbl.text = rowModel.goods_attr
cell.priceLbl.text = "¥" + (rowModel.goods_price!)
return cell
}
......
......@@ -58,12 +58,12 @@ class XiuGaiYuShouJiaViewController: BaseViewController {
let rowModel = dataModel?.order_goods![0]
editOrderGoodsPriceAd(["user_token":UserToken as Any,"order_id":orderID as Any,"og_id":rowModel?.og_id as Any,"dj_amount":dingJinTF.text as Any,"wk_amount":weiKuanTF.text as Any], success: { (data) in
HUD.flash(.labeledSubSuccess(subtitle: "修改成功"), delay: 1.2)
//MARK:--需要更改订单详情的对应数据(不做网络请求,减少加载)
let dataM = data as! EditOGPAdModel
self.delegate?.changeYuShouGoodsByData(sender: dataM.data!)
self.navigationController?.popViewController(animated: true)
if dataM.code == 1 {
self.delegate?.changeYuShouGoodsByData(sender: dataM.data!)
self.navigationController?.popViewController(animated: true)
}
}) { (error) in
}
......
......@@ -8,7 +8,7 @@
import UIKit
class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GuanLianKehuVCDelegate,OrderDViewFooterViewDelegate,TitleAndTFCellDelegate,GeliAlertViewDelegate,GLAlertSelectViewDelegate,XiuGaiYuShouJiaViewControllerDelegate,ChangeGoodsPriceVCDelegate{
class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GuanLianKehuVCDelegate,OrderDViewFooterViewDelegate,TitleAndTFCellDelegate,GeliAlertViewDelegate,GLAlertSelectViewDelegate,XiuGaiYuShouJiaViewControllerDelegate,ChangeGoodsPriceVCDelegate,GeliAlertTextFiledDelegate,GeliAlertTextViewDelegate{
func GLASClose(view: GLAlertSelectView, selectnum: Int, selectArr: Array<Int>) {
if selectnum != 10086 {
if view.titleLbl.text == "请选择支付方式" {
......@@ -50,7 +50,9 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
let zhiFuStatus = ["未付款","欠款","月结","已付款"]
var zhiFuStatusSelect:Int?//付款状态
let wuLiuFSArr = ["京东冷链","顺丰冷运","达达速运"]
// let wuLiuFSArr = ["京东冷链","顺丰冷运","达达速运"]
var wuLiuFSArr:Array<String> = []
var wuLiuSelect:Int?//物流选择
@IBOutlet weak var btmViewH: NSLayoutConstraint!
......@@ -222,10 +224,16 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
//MARK:--修改价格(普通商品返回数据)
func changeGoodsPriByData(sender: Array<OrderDetailGoodsModel>) {
print("修改价格(普通商品返回数据)\(sender)")
self.dataMdoel?.order_goods = sender
listView.reloadData()
}
//MARK:--修改价格(预售返回数据)
func changeYuShouGoodsByData(sender: EditOGPAdDataModel) {
print("修改价格(预售返回数据)--只更新datamodel,不请求网络\(sender)")
self.dataMdoel?.order_res?.sale_res?.dj_amount = sender.dj_amount
self.dataMdoel?.order_res?.sale_res?.wk_amount = sender.wk_amount
listView.reloadData()
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
......@@ -256,11 +264,45 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
if indexPath.section == 4 {
if indexPath.row == 5{
print("运单号")
let alterView = GeliAlertTextFiled(frame: self.view.window!.bounds)
alterView.delegate = self
self.view.window?.addSubview(alterView)
}
if indexPath.row == 9{
print("备注")
let alterView = GeliAlertTextView(frame: self.view.window!.bounds)
alterView.delegate = self
self.view.window?.addSubview(alterView)
}
}
}
//MARK:--编辑运单号回调数据
func sureGeliAlertTextFiledAction(sender: String) {
let UserToken = UserDefaults.standard.value(forKey: "user_token")
editField(["user_token":UserToken as Any,"function_id":"47","prval":orderId as Any,"value":sender as Any,], success: { (data) in
let dataM = data as! UpDataModel
if dataM.code == 1 {
self.dataMdoel?.order_res?.lwb_no = sender
self.listView.reloadData()
}
}) { (erro) in
}
}
//MARK:--编辑订单备注回调数据
func sureGeliAlertTextViewAction(sender: String) {
let UserToken = UserDefaults.standard.value(forKey: "user_token")
editField(["user_token":UserToken as Any,"function_id":"45","prval":orderId as Any,"value":sender as Any,], success: { (data) in
let dataM = data as! UpDataModel
if dataM.code == 1 {
self.dataMdoel?.order_res?.order_postscript = sender
self.listView.reloadData()
}
}) { (erro) in
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtnCell") as! TitleAndBtnCell
......@@ -310,10 +352,22 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
case 0:
print("预售定金")
print(self.dataMdoel?.order_res?.sale_res?.dj_amount)
cell.textTF.text = "¥" + (self.dataMdoel?.order_res?.sale_res?.dj_amount)!
if self.dataMdoel?.order_res?.sale_res?.dj_pay_status == 1 {
cell.textTF.text = "(已付)" + "¥" + (self.dataMdoel?.order_res?.sale_res?.dj_amount)!
}else{
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)!
if self.dataMdoel?.order_res?.sale_res?.wk_pay_status == 1 {
cell.textTF.text = "(已付)" + "¥" + (self.dataMdoel?.order_res?.sale_res?.wk_amount)!
}else{
cell.textTF.text = "¥" + (self.dataMdoel?.order_res?.sale_res?.wk_amount)!
}
break
case 2:
cell.textTF.text = "¥" + (self.dataMdoel?.order_res?.goods_amount)!
......@@ -398,9 +452,14 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
break
case 9:
cell.contentLbl.text = self.dataMdoel?.order_res?.order_postscript
if cell.contentLbl.text?.count == 0 {
cell.contentLbl.text = "请输入订单备注"
if self.dataMdoel?.order_res?.order_postscript == nil {
cell.contentLbl.text = "-"
}else{
if self.dataMdoel?.order_res?.order_postscript?.count == 0 {
cell.contentLbl.text = "请输入订单备注"
}
}
break
default:
break
......@@ -409,6 +468,8 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
}
if indexPath.row == 4 || indexPath.row == 6 || indexPath.row == 7 {
cell.nameLbl.text = YuShouPart3Arr[indexPath.row]
cell.arrowImg.isHidden = false
switch indexPath.row {
case 4:
cell.contentLbl.text = self.dataMdoel?.order_res?.lc_name
......@@ -418,6 +479,7 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
break
case 7:
cell.contentLbl.text = self.dataMdoel?.order_res?.pay_status_cn
cell.arrowImg.isHidden = true
break
default:
break
......@@ -465,6 +527,7 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
func OrderDViewFooterViewBtnClick() {
print("查看全部商品")
let vc = ShowAlGoodsViewController()
vc.order_goods = self.dataMdoel?.order_goods
self.navigationController?.pushViewController(vc, animated: true)
}
......@@ -478,22 +541,59 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
//暂时不刷新数据,只刷新视图
listView.reloadData()
}
//MARK:--请求物流公司信息
var lcModel : LogisticsCompanyModel? = nil
func btnClick(content: String, cell: TitleAndBtnCell) {
switch cell.nameLbl.text {
case "物流公司":
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.titleLbl.text = "请选择物流公司"
view.delegate = self
view.dataArr = wuLiuFSArr
if wuLiuSelect != nil {
view.selectNum = wuLiuSelect!
view.tempNum = view.selectNum
if lcModel == nil {
let UserToken = UserDefaults.standard.value(forKey: "user_token")
logisticsCompany(["user_token":UserToken as Any], success: { (data) in
let dataM = data as! LogisticsCompanyModel
if dataM.code == 1 {
self.lcModel = dataM
self.wuLiuFSArr.removeAll()
self.lcModel?.data?.forEach({ (md) in
self.wuLiuFSArr.append(md.lc_name!)
})
if self.glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.titleLbl.text = "请选择物流公司"
view.delegate = self
view.dataArr = self.wuLiuFSArr
if self.wuLiuSelect != nil {
view.selectNum = self.wuLiuSelect!
view.tempNum = view.selectNum
}
self.view.addSubview(view)
self.glSelectView = view
}
}
}) { (error) in
}
}else{
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.titleLbl.text = "请选择物流公司"
view.delegate = self
view.dataArr = wuLiuFSArr
if wuLiuSelect != nil {
view.selectNum = wuLiuSelect!
view.tempNum = view.selectNum
}
self.view.addSubview(view)
glSelectView = view
}
self.view.addSubview(view)
glSelectView = view
}
break
case "关联客户":
let vc = GuanLianKehuVC()
......@@ -520,19 +620,20 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
}
break
case "支付状态":
if glSelectView == nil {
let view = GLAlertSelectView(frame: self.view.bounds)
view.tag = cell.tag
view.titleLbl.text = "请选择支付状态"
view.delegate = self
view.dataArr = zhiFuStatus
if zhiFuStatusSelect != nil {
view.selectNum = zhiFuStatusSelect!
view.tempNum = view.selectNum
}
self.view.addSubview(view)
glSelectView = view
}
//无法修改支付状态的
// if glSelectView == nil {
// let view = GLAlertSelectView(frame: self.view.bounds)
// view.tag = cell.tag
// view.titleLbl.text = "请选择支付状态"
// view.delegate = self
// view.dataArr = zhiFuStatus
// if zhiFuStatusSelect != nil {
// view.selectNum = zhiFuStatusSelect!
// view.tempNum = view.selectNum
// }
// self.view.addSubview(view)
// glSelectView = view
// }
break
default:
break
......@@ -540,24 +641,69 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
}
func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
if view.titleLbl.text == "请选择支付方式" {
zhiFuSelect = selectNum
self.dataMdoel?.order_res?.pay_type_cn = zhiFuFangShiArr[selectNum]
//MARK:--选择支付方式回调
let UserToken = UserDefaults.standard.value(forKey: "user_token")
var is_adsale = 0
var amount_type = 0
if isYuShou {
is_adsale = 1
if self.dataMdoel?.order_res?.sale_res != nil {
if self.dataMdoel?.order_res?.sale_res?.dj_pay_status == 0 {
amount_type = 1
}else if self.dataMdoel?.order_res?.sale_res?.wk_pay_status == 0 {
amount_type = 2
}
}
}
var pay_type = 0
if selectNum == 1 {
pay_type = 7
}else if selectNum > 1 {
pay_type = selectNum + 7
}
editPayType(["user_token":UserToken as Any,"order_id":orderId as Any,"is_adsale":is_adsale as Any,"amount_type":amount_type,"pay_type":pay_type], success: { (data) in
let dataM = data as! UpDataModel
if dataM.code == 1 {
self.zhiFuSelect = selectNum
self.dataMdoel?.order_res?.pay_type_cn = self.zhiFuFangShiArr[selectNum]
self.listView.reloadData()
}
}) { (error) in
}
}else if view.titleLbl.text == "请选择物流公司"{
wuLiuSelect = selectNum
self.dataMdoel?.order_res?.lc_name = wuLiuFSArr[selectNum]
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let secltMd = self.lcModel?.data![selectNum]
editField(["user_token":UserToken as Any,"function_id":"46","prval":orderId as Any,"value":secltMd!.lc_id as Any,], success: { (data) in
let dataM = data as! UpDataModel
if dataM.code == 1 {
self.wuLiuSelect = selectNum
self.dataMdoel?.order_res?.lc_name = self.wuLiuFSArr[selectNum]
self.listView.reloadData()
}
}) { (erro) in
}
}else{
//MARK:--选择支付状态回调
zhiFuStatusSelect = selectNum
self.dataMdoel?.order_res?.pay_status_cn = zhiFuStatus[selectNum]
listView.reloadData()
}
glSelectView?.removeFromSuperview()
glSelectView = nil
listView.reloadData()
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
}
//MARK: - section delegate
func numberOfSections(in tableView: UITableView) -> Int {
if self.dataMdoel == nil {
......@@ -762,3 +908,4 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
}
}
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