Commit 1a254d63 authored by 刘俊宏's avatar 刘俊宏

完善修改订单详情的修改价格逻辑

parent c708a8a8
......@@ -319,6 +319,7 @@
F933F6CE2452C68B00189561 /* PKHUDSquareBaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6BD2452C68B00189561 /* PKHUDSquareBaseView.swift */; };
F933F6CF2452C68B00189561 /* PKHUDErrorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6BE2452C68B00189561 /* PKHUDErrorView.swift */; };
F933F6D22452DAE100189561 /* TabBarContentClassView.swift in Sources */ = {isa = PBXBuildFile; fileRef = F933F6D12452DAE000189561 /* TabBarContentClassView.swift */; };
F93E31F724721C4200524DFC /* EditOGPAdModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F93E31F624721C4200524DFC /* EditOGPAdModel.swift */; };
F94A314724624E9500FEC38E /* GetGelipayInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F94A314624624E9500FEC38E /* GetGelipayInfoModel.swift */; };
F94A314924624FA400FEC38E /* ShopAdministratorInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F94A314824624FA400FEC38E /* ShopAdministratorInfoModel.swift */; };
F94A314B246250DB00FEC38E /* GoodsDetailModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = F94A314A246250DB00FEC38E /* GoodsDetailModel.swift */; };
......@@ -800,6 +801,7 @@
F933F6BE2452C68B00189561 /* PKHUDErrorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PKHUDErrorView.swift; sourceTree = "<group>"; };
F933F6BF2452C68B00189561 /* PKHUD.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PKHUD.h; sourceTree = "<group>"; };
F933F6D12452DAE000189561 /* TabBarContentClassView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TabBarContentClassView.swift; sourceTree = "<group>"; };
F93E31F624721C4200524DFC /* EditOGPAdModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditOGPAdModel.swift; sourceTree = "<group>"; };
F94A314624624E9500FEC38E /* GetGelipayInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetGelipayInfoModel.swift; sourceTree = "<group>"; };
F94A314824624FA400FEC38E /* ShopAdministratorInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ShopAdministratorInfoModel.swift; sourceTree = "<group>"; };
F94A314A246250DB00FEC38E /* GoodsDetailModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoodsDetailModel.swift; sourceTree = "<group>"; };
......@@ -2141,6 +2143,7 @@
children = (
F956D5B6246A3255003FF510 /* OrderListModel.swift */,
F956D5BF246A3789003FF510 /* OrderDetailModel.swift */,
F93E31F624721C4200524DFC /* EditOGPAdModel.swift */,
F9A0E1DC246D198B00D7F26F /* CusListAllModel.swift */,
F9A0E1DE246D1B1E00D7F26F /* GetGoodsInfoModel.swift */,
);
......@@ -2872,6 +2875,7 @@
F94A314D2462582F00FEC38E /* GeneralInfoModel.swift in Sources */,
E02DDD8D244FE43900ABB707 /* NewCreateFooter.swift in Sources */,
E0D197CF24485649002B080C /* BluetoothConnectViewController.swift in Sources */,
F93E31F724721C4200524DFC /* EditOGPAdModel.swift in Sources */,
F94A31642462B21700FEC38E /* EditWorkCViewController.swift in Sources */,
F956D59B246A2D9C003FF510 /* LMNTextView.m in Sources */,
F94A315F24629DDD00FEC38E /* WorkBannerTableViewCell.swift in Sources */,
......
......@@ -59,6 +59,8 @@
<string>Order/orderCancel</string>
<key>修改订单商品价格</key>
<string>Order/editOrderGoodsPrice</string>
<key>修改预售订单商品价格</key>
<string>Order/editOrderGoodsPriceAd</string>
<key>订单退款</key>
<string>Order/orderRefund</string>
<key>普通订单退货</key>
......
......@@ -152,6 +152,26 @@ func editOrderGoodsPrice(_ params:[String:Any],success:@escaping (_ res:Any)->()
failture(error)
}
}
//MARK:--修改预售订单商品价格
/**
params-key:
user_token(验证token)
order_id(订单ID)
og_id(订单商品id)
dj_amount(定金金额)
wk_amount(尾款金额)
*/
func editOrderGoodsPriceAd(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) {
NetworkRequest.sharedInstance.postRequest("修改预售订单商品价格", params, { (rep:DataResponse<EditOGPAdModel>) in
}, success: { (data) in
success(data)
}) { (error) in
failture(error)
}
}
//MARK:--订单退款
/**
params-key:
......
//
// EditOGPAdModel.swift
// GeliBusinessPlatform
//
// Created by 刘俊宏 on 2020/5/18.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//修改预售订单商品价格
class EditOGPAdModel: Mappable {
var code:Int?
var message : String?
var data : EditOGPAdDataModel?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class EditOGPAdDataModel: Mappable {
var sum_amount : String? //修改后订单金额
var dj_amount : String? //定金金额
var wk_amount : String? //尾款金额
var goods_price : String? //商品价格
required init?( map: Map) {
}
func mapping(map: Map) {
sum_amount <- map["sum_amount"]
dj_amount <- map["dj_amount"]
wk_amount <- map["wk_amount"]
goods_price <- map["goods_price"]
}
}
......@@ -7,3 +7,32 @@
//
import Foundation
import ObjectMapper
//获取商品信息
class GetGoodsInfoModel: Mappable {
var code:Int?
var message : String?
var data : Array<GetGoodsInfoDataModel>?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class GetGoodsInfoDataModel: Mappable {
required init?( map: Map) {
}
func mapping(map: Map) {
}
}
......@@ -197,6 +197,7 @@ class OrderDetailGoodsModel: Mappable {
var goods_subtotal : String? //商品小计
var goods_thumb : String? //商品缩略图
var warehouse_inventory : String? //商品库存
var is_edit : Int? = 0 //订单商品是否有修改,1是0非--前端自主添加的字段
required init?( map: Map) {
......@@ -212,6 +213,7 @@ class OrderDetailGoodsModel: Mappable {
goods_subtotal <- map["goods_subtotal"]
goods_thumb <- map["goods_thumb"]
warehouse_inventory <- map["warehouse_inventory"]
is_edit <- map["is_edit"]
}
}
......
......@@ -12,7 +12,7 @@ import LGButton
import IQKeyboardManagerSwift
protocol ChangeGoodsPriceVCDelegate {
func ChangeGoodsPriceVCKeyboardDone(str:String)
func changeGoodsPriByData(sender:Array<OrderDetailGoodsModel>)
}
class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableViewDataSource,UITextFieldDelegate {
......@@ -25,6 +25,8 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
navbar.title = "修改价格"
self.view.addSubview(navbar)
setTabv()
}
@IBOutlet weak var sureBtn: LGButton!
//MARK:--确认修改价格
......@@ -32,10 +34,22 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let order_goods = dataChangeString(sender: [""])
var order_goodsArr:Array<Any>? = []
dataArr?.forEach({ (md) in
var dic:[String:Any] = [:]
dic.updateValue(md.og_id as Any, forKey: "og_id")
dic.updateValue(md.cart_number as Any, forKey: "cart_number")
dic.updateValue(md.goods_price as Any, forKey: "goods_price")
dic.updateValue(md.is_edit as Any, forKey: "is_edit")
order_goodsArr?.append(dic)
})
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)
}) { (error) in
......@@ -44,7 +58,15 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
IQKeyboardManager.shared.resignFirstResponder()
delegate?.ChangeGoodsPriceVCKeyboardDone(str: textField.text!)
//MARK:--输入点确定后,修改数据
for i in 0..<dataArr!.count {
if i == textField.tag {
let md = dataArr![i]
md.goods_price = textField.text
//记录哪个更改了
md.is_edit = 1
}
}
return true
}
......@@ -68,22 +90,23 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 20
// return dataArr!.count
// 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]
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.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
cell.priceTf.returnKeyType = .done
cell.priceTf.tag = indexPath.row
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
......@@ -96,5 +119,6 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
}
func scrollViewDidScroll(_ scrollView: UIScrollView) {
IQKeyboardManager.shared.resignFirstResponder()
//MARK:--滚动不修改数据
}
}
......@@ -8,10 +8,14 @@
import UIKit
import LGButton
protocol XiuGaiYuShouJiaViewControllerDelegate {
func changeYuShouGoodsByData(sender:EditOGPAdDataModel)
}
class XiuGaiYuShouJiaViewController: BaseViewController {
var dataModel : OrderDetailDataModel?
var orderID:Int? = 0
var delegate : XiuGaiYuShouJiaViewControllerDelegate?
@IBOutlet weak var firstView: UIView!
@IBOutlet weak var weiKuanTF: UITextField!
......@@ -49,15 +53,21 @@ class XiuGaiYuShouJiaViewController: BaseViewController {
@IBAction func submitACTION(_ sender: Any) {
print("预售返回上一级且提交了数据")
}
/*
// MARK: - Navigation
//MARK:--需要对输入是否为金额判断
let UserToken = UserDefaults.standard.value(forKey: "user_token")
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
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
HUD.flash(.labeledSubSuccess(subtitle: "修改成功"), delay: 1.2)
//MARK:--需要更改订单详情的对应数据(不做网络请求,减少加载)
let dataM = data as! EditOGPAdModel
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{
class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,TitleAndBtnCellDelegate,GuanLianKehuVCDelegate,OrderDViewFooterViewDelegate,TitleAndTFCellDelegate,GeliAlertViewDelegate,GLAlertSelectViewDelegate,XiuGaiYuShouJiaViewControllerDelegate,ChangeGoodsPriceVCDelegate{
func GLASClose(view: GLAlertSelectView, selectnum: Int, selectArr: Array<Int>) {
if selectnum != 10086 {
if view.titleLbl.text == "请选择支付方式" {
......@@ -65,7 +65,7 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
func loadData() {
HUD.flash(.progress)
let UserToken = UserDefaults.standard.value(forKey: "user_token")
orderDetail(["user_token":"RQdwz5QKpeg=","order_id":"11570"], success: { (data) in
orderDetail(["user_token":UserToken as Any,"order_id":orderId as Any], success: { (data) in
HUD.hide(animated: true)
let dataM = data as! OrderDetailModel
self.dataMdoel = dataM.data
......@@ -135,6 +135,7 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
case "修改价格":
if isYuShou {
let vc = XiuGaiYuShouJiaViewController()
vc.delegate = self
vc.dataModel = self.dataMdoel
vc.orderID = self.orderId
......@@ -143,6 +144,7 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
let vc = ChangeGoodsPriceVC()
vc.dataArr = self.dataMdoel?.order_goods
vc.orderID = self.orderId
vc.delegate = self
self.navigationController?.pushViewController(vc, animated: true)
}
break
......@@ -217,6 +219,14 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
break
}
}
//MARK:--修改价格(普通商品返回数据)
func changeGoodsPriByData(sender: Array<OrderDetailGoodsModel>) {
print("修改价格(普通商品返回数据)\(sender)")
}
//MARK:--修改价格(预售返回数据)
func changeYuShouGoodsByData(sender: EditOGPAdDataModel) {
print("修改价格(预售返回数据)--只更新datamodel,不请求网络\(sender)")
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
......
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