Commit f40eb3e8 authored by 刘俊宏's avatar 刘俊宏

完成销售下单流程

parent 81bb2a0a
......@@ -4,6 +4,22 @@
<FileRef
location = "group:GeliBusinessPlatform.xcodeproj">
</FileRef>
<Group
location = "group:GeliBusinessPlatform/Model/../.."
name = "Products">
<FileRef
location = "build:GeliBusinessPlatform.app"
assignedFileDataType = "com.apple.application-bundle">
</FileRef>
<FileRef
location = "build:GeliBusinessPlatformTests.xctest"
assignedFileDataType = "com.apple.xcode.cfbundle">
</FileRef>
<FileRef
location = "build:GeliBusinessPlatformUITests.xctest"
assignedFileDataType = "com.apple.xcode.cfbundle">
</FileRef>
</Group>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
......
......@@ -256,9 +256,20 @@ func getDictionaryFromJSONString(jsonString:String) ->NSDictionary{
return dict as! NSDictionary
}
return NSDictionary()
}
//MARK:--字符串转字典
func getDicFromJSONString(jsonString:String) ->Dictionary<String,Any>{
let jsonData:Data = jsonString.data(using: .utf8)!
let dict = try? JSONSerialization.jsonObject(with: jsonData, options: .mutableContainers)
if dict != nil {
return dict as! Dictionary
}
return Dictionary()
}
//MARK:--字典转字符串
func dictChangeString(sender:Dictionary<String, String>) -> String{
func dictChangeString(sender:Dictionary<String, Any>) -> String{
var str = ""
do {
let json = JSON(sender)
......
......@@ -26,6 +26,8 @@ class GetGoodsInfoModel: Mappable {
class GetGoodsInfoDataModel: Mappable {
var sku_id:Int?//sku_id
var goods_id:Int?//goods_id
var goods_img : String?//商品缩略图
var goods_name : String?//商品名
var origin_number : Int?//起订量
......@@ -45,6 +47,7 @@ class GetGoodsInfoDataModel: Mappable {
}
func mapping(map: Map) {
sku_id <- map["sku_id"]
goods_id <- map["goods_id"]
goods_img <- map["goods_img"]
goods_name <- map["goods_name"]
origin_number <- map["origin_number"]
......
......@@ -94,7 +94,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate, UITabBarControllerDeleg
// Create the SwiftUI view that provides the window contents.
tabBarController.viewControllers = [v1, v2, v3, v4, v5]
// tabBarController.selectedIndex = 2
tabBarController.selectedIndex = 2
let contentView = tabBarController
......
......@@ -42,6 +42,8 @@ class XuanZeShangPinCell: UITableViewCell {
@IBOutlet weak var selectBtn: UIButton!
@IBOutlet weak var btmView: UIView!
@IBOutlet weak var btmViewHeight: NSLayoutConstraint!
var cellModel: GetGoodsInfoDataModel? = nil
override func awakeFromNib() {
super.awakeFromNib()
self.selectionStyle = .none
......
<?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="16097" 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"/>
......@@ -231,7 +231,7 @@
<nil key="highlightedColor"/>
</label>
<imageView hidden="YES" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="yushou" translatesAutoresizingMaskIntoConstraints="NO" id="Rub-Pk-cR7">
<rect key="frame" x="37" y="15" width="68" height="36"/>
<rect key="frame" x="71" y="15" width="34" height="18"/>
</imageView>
</subviews>
<constraints>
......
......@@ -21,6 +21,7 @@ class DaiKeXiaDanGouWuCell: UITableViewCell {
@IBOutlet weak var priceLbl: UILabel!
@IBOutlet weak var detailLbl: UILabel!
@IBOutlet weak var titleLbl: UILabel!
@IBOutlet weak var diLbl: UILabel!
@IBAction func delAction(_ sender: Any) {
delegate?.DaiKeXiaDanGouWuCellDelAction(cell: self)
}
......
<?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="16097" 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"/>
......@@ -114,16 +114,27 @@
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥51153.00" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JyG-Tf-6Jd">
<rect key="frame" x="291.5" y="60" width="63.5" height="18.5"/>
<constraints>
<constraint firstAttribute="height" constant="18.5" id="11o-H0-KIf"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstAttribute="trailing" secondItem="HYf-UQ-mHg" secondAttribute="trailing" constant="17" id="1et-A0-Mm7"/>
<constraint firstItem="4lb-rz-I6F" firstAttribute="centerY" secondItem="AWX-Qu-0ML" secondAttribute="centerY" id="6mE-8H-dPD"/>
<constraint firstAttribute="trailingMargin" secondItem="Rio-TZ-iyo" secondAttribute="trailing" id="Bgy-0b-yb6"/>
<constraint firstItem="4lb-rz-I6F" firstAttribute="centerX" secondItem="AWX-Qu-0ML" secondAttribute="centerX" id="DtW-X9-NRk"/>
<constraint firstItem="Rio-TZ-iyo" firstAttribute="top" secondItem="JyG-Tf-6Jd" secondAttribute="bottom" constant="5" id="H2a-ha-CdE"/>
<constraint firstItem="Rio-TZ-iyo" firstAttribute="bottom" secondItem="X1B-vl-mvy" secondAttribute="bottom" id="JcG-ly-QUv"/>
<constraint firstItem="AWX-Qu-0ML" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" constant="15" id="PkW-SQ-lMP"/>
<constraint firstItem="AWX-Qu-0ML" firstAttribute="centerY" secondItem="H2p-sc-9uM" secondAttribute="centerY" id="QkU-Fn-YVB"/>
<constraint firstItem="ftv-xQ-eXW" firstAttribute="trailing" secondItem="AWX-Qu-0ML" secondAttribute="trailing" constant="7.5" id="R1R-mm-RvM"/>
<constraint firstItem="JyG-Tf-6Jd" firstAttribute="trailing" secondItem="H2p-sc-9uM" secondAttribute="trailingMargin" id="SVb-FW-34b"/>
<constraint firstAttribute="trailingMargin" secondItem="LBB-wB-bMd" secondAttribute="trailing" constant="15" id="U69-j9-gAo"/>
<constraint firstItem="HYf-UQ-mHg" firstAttribute="top" secondItem="AWX-Qu-0ML" secondAttribute="top" id="UBt-NG-mg3"/>
<constraint firstAttribute="trailingMargin" secondItem="X1B-vl-mvy" secondAttribute="trailing" constant="15" id="ZfW-BJ-Tbo"/>
......@@ -149,6 +160,7 @@
<outlet property="delImg" destination="ftv-xQ-eXW" id="CON-aC-p5Y"/>
<outlet property="detailLbl" destination="LBB-wB-bMd" id="Z5L-Om-fG8"/>
<outlet property="detailLbl2" destination="X1B-vl-mvy" id="h0s-3d-jnl"/>
<outlet property="diLbl" destination="JyG-Tf-6Jd" id="loL-0t-j6w"/>
<outlet property="imgView" destination="AWX-Qu-0ML" id="BQH-fG-eL9"/>
<outlet property="priceLbl" destination="Rio-TZ-iyo" id="Ivg-2f-C6y"/>
<outlet property="titleLbl" destination="HYf-UQ-mHg" id="bMC-Ni-Yjv"/>
......
......@@ -9,7 +9,7 @@
import UIKit
import IQKeyboardManagerSwift
class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,UITableViewDelegate,DaiKeXiaDanFooterViewDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,DZGLViewControllerDelegate,XuanZeShangPinViewControllerDelegate,DaiKeXiaDanGouWuCellDelegate,GuanLianKehuVCDelegate{
class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,UITableViewDelegate,DaiKeXiaDanFooterViewDelegate,TitleAndBtnCellDelegate,GLAlertSelectViewDelegate,DZGLViewControllerDelegate,XuanZeShangPinViewControllerDelegate,DaiKeXiaDanGouWuCellDelegate,GuanLianKehuVCDelegate,XiuGaiYuShouJiaViewControllerDelegate,TitleAndTFCellDelegate{
let ddTypeArr = ["普通订单","预售下单"]
let zfTypeArr = ["未付款","欠款","月结","已付款"]
......@@ -29,6 +29,8 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
var cellDataArr:Array<XuanZeShangPinCell> = []//回调选择记录
var dj_payStatus = 0//定金支付状态
var dj_payWay = 0//定金支付方式
var logistics_price = ""//运费
var other_price = ""//其他费用
var orderType:Int? //订单类型
var adrData:GetAddrsInfoDataModel?//地址数据
......@@ -38,9 +40,51 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
@IBOutlet weak var listView: UITableView!
@IBOutlet weak var btmView: UILabel!
//MARK: - 提交订单
//MARK: - 提交订单-立即下单
@IBAction func submitAction(_ sender: Any) {
print("提交订单")
//暂时不做判断处理
//待补充
if cusModel == nil {
HUD.flash(.label("请选择关联客户"), delay: 1.2)
return
}
if orderType == nil{
HUD.flash(.label("请选择订单类型"), delay: 1.2)
return
}
if cellDataArr.count == 0 {
HUD.flash(.label("请添加商品"), delay: 1.2)
return
}
if tiHuoWay == 1 && adrData == nil{
HUD.flash(.label("请选择地址"), delay: 1.2)
return
}
let goods_info = getGoodsInfo()
let order_info = getOrderInfo()
var is_adsale = 0
if orderType == 1 {
is_adsale = 1
}
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let order = ["user_token":UserToken as Any,
"is_adsale":is_adsale as Any,
"goods_info":goods_info as Any,
"order_info":order_info as Any] as [String : Any]
print(order)
HUD.flash(.progress)
addOrder(order, success: { (data) in
let dataM = data as! UpDataModel
if dataM.code == 1 {
HUD.flash(.labeledSubSuccess(subtitle:"提交成功"),delay: 1.2)
}else{
HUD.hide()
}
}) { (error) in
}
}
override func viewDidLoad() {
......@@ -96,7 +140,17 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
print(cellData.countTF)
let countStr = cellData.countTF.text! as! NSString
cell.detailLbl2.text = \(priceStr.floatValue)x\(countStr.integerValue)"
if orderType == 1 {
cell.diLbl.isHidden = false
cell.diLbl.text = "定金:¥" + djTFstr
cell.totalPriceLbl.text = "尾款:¥" + wkTFstr
}else {
cell.totalPriceLbl.text = \(priceStr.floatValue * countStr.floatValue)"
cell.diLbl.isHidden = true
}
return cell
case 2:
let cell = tableView.dequeueReusableCell(withIdentifier: "TitleAndBtnCell") as! TitleAndBtnCell
......@@ -138,7 +192,8 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
if indexPath.row == 3 {
let cell = tableView.dequeueReusableCell(withIdentifier: "DKXDAdrCell") as! DKXDAdrCell
cell.nameLbl.text = p3Arr[indexPath.row]
cell.contentLbl.text = "\(adrData?.consignee) \(adrData?.mobile)"
cell.contentLbl.text = (adrData?.consignee)! + " " + (adrData?.mobile)!
cell.adrLbl.text = adrData?.addr_cn
cell.tag = indexPath.row
return cell
......@@ -159,13 +214,14 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
cell.textTF.layer.borderWidth = 1
cell.textTF.returnKeyType = .done
cell.textTF.layer.borderColor = UIColor(named: "灰色字体颜色")?.cgColor
cell.textTF.placeholder = "请输入运费"
cell.textTF.placeholder = "请输入费用"
cell.textTF.keyboardType = .numbersAndPunctuation
cell.textTF.textColor = UIColor(named: "蓝色字体颜色")
if indexPath.row == 5 {
cell.textTF.placeholder = "请输入费用"
cell.textTF.placeholder = "请输入运费"
}
cell.textTF.textAlignment = .center
cell.delegate = self
return cell
}
}
......@@ -290,9 +346,16 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
}
//MARK: - 跳转修改价格
var djTFstr:String = "";
var wkTFstr:String = "";
@objc func jumpToEditPrice(){
if orderType == 1 {//预售
let vc = XiuGaiYuShouJiaViewController()
vc.inputData = cellDataArr
vc.djTFstr = djTFstr
vc.wkTFstr = wkTFstr
vc.delegate = self
self.navigationController?.pushViewController(vc, animated: true)
}else{//普通
let vc = XuanZeShangPinViewController()
......@@ -319,6 +382,12 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
cellDataArr = inputData
listView.reloadData()
}
//MARK:-- 修改价格(预售)回调
func changeYuShouGoodsByData(sender: EditOGPAdDataModel?, djText: String, wkText: String) {
djTFstr = djText
wkTFstr = wkText
listView.reloadData()
}
//MARK: - glalertSelectViewSelect
func GLAlertSelectViewClick(selectNum: Int, view: GLAlertSelectView) {
......@@ -391,6 +460,10 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
}
//MARK: - 删除已选商品
func DaiKeXiaDanGouWuCellDelAction(cell: DaiKeXiaDanGouWuCell) {
if orderType == 1 {
djTFstr = ""
wkTFstr = ""
}
cellDataArr.remove(at: cell.tag)
listView.reloadData()
}
......@@ -572,4 +645,143 @@ class DaiKeXiaDanGouWuViewController: BaseViewController,UITableViewDataSource,U
glSelectView = nil
}
//MARK:--处理提交数据GoodsInfo
func getGoodsInfo() -> String {
var goodsInfo:String = ""
var goodsArr : Array<Any> = []
if orderType == 1{
cellDataArr.forEach { (cell) in
let priceStr = cell.priceTF.text! as NSString
let countStr = cell.countTF.text! as NSString
let subtoal = priceStr.floatValue * countStr.floatValue
let goods = ["goods_name":cell.cellModel?.goods_name as Any, //商品名称
"dj_amount":djTFstr as Any,// 定金金额【预售订单才传
"wk_amount":wkTFstr as Any,//尾款金额【预售订单才传】
"sku_attr":cell.cellModel?.sku_attr as Any,//规格
"adsale_inventory":cell.cellModel?.adsale_inventory as Any,//库存【预售订单才传】
"number":cell.countTF.text as Any,//购买数量
"unit":cell.cellModel?.unit as Any,//单位
"price":cell.cellModel?.price as Any,//价格
"r_price":cell.priceTF.text as Any,//售价
"is_gift":0,//是否搭赠,1是0非,现版本固定0
"subtotal":subtoal,//总价
"goods_id":cell.cellModel?.goods_id as Any,//商品ID
"sku_id":cell.cellModel?.sku_id as Any] as [String : Any]
goodsArr.append(goods)
}
}else{
cellDataArr.forEach { (cell) in
let priceStr = cell.priceTF.text! as NSString
let countStr = cell.countTF.text! as NSString
let subtoal = priceStr.floatValue * countStr.floatValue
let goods = ["goods_name":cell.cellModel?.goods_name as Any,
"sku_attr":cell.cellModel?.sku_attr as Any,
"inventory":cell.cellModel?.inventory as Any,//库存【普通订单才传】
"number":cell.countTF.text as Any,
"unit":cell.cellModel?.unit as Any,
"price":cell.cellModel?.price as Any,
"r_price":cell.priceTF.text as Any,
"is_gift":0,
"subtotal":subtoal,
"goods_id":cell.cellModel?.goods_id as Any,
"sku_id":cell.cellModel?.sku_id as Any] as [String : Any]
goodsArr.append(goods)
}
}
goodsInfo = dataChangeString(sender: goodsArr)
return goodsInfo
}
//MARK:--处理提交数据OrderInfo
func getOrderInfo() -> String {
var orderInfo:String = ""
var payType = 0
if zhiFuWay == 0 {
payType = zhiFuWay
}else if zhiFuWay == 1 {
payType = 7
}else{
payType = zhiFuWay + 7
}
var payStatus = 0
if zhiFuStatus == 2 {
payStatus = 10 //月结
}else if zhiFuStatus == 3 {
payStatus = 2 //已付款
}else{
payStatus = zhiFuStatus
}
var shipping_type = 0
if tiHuoWay == 0 {
shipping_type = 2
}else if tiHuoWay == 1 {
shipping_type = 1
}
var caddrId = 0
if shipping_type == 1 {
if adrData != nil {
caddrId = adrData?.caddr_id! as! Int
}
}
if orderType == 1 {
var djpayType = 0
if dj_payWay == 0 {
djpayType = dj_payWay
}else if dj_payWay == 1 {
djpayType = 7
}else{
djpayType = dj_payWay + 7
}
var djpayStatus = 0
if dj_payStatus == 2 {
djpayStatus = 10 //月结
}else if dj_payStatus == 3 {
djpayStatus = 2 //已付款
}else{
djpayStatus = dj_payStatus
}
let dic = ["cus_id":cusModel?.cus_id as Any, //客户ID
"dj_pay_type":djpayType as Any,//支付类型,0未支付7现金9转账(私)10转账(公)11转账(微信)12转账(支付宝)
"dj_pay_status":djpayStatus as Any,//支付状态,0未付款;1欠款;2已付款10月结
"wk_pay_type":payType as Any,
"wk_pay_status":payStatus as Any,
"need_check":0,//付款是否需要审核 1是 0否
"s_status":(chuHuoWay + 1) as Any,//是否出库 1 暂不出库 2直接出库
"shipping_type":shipping_type as Any, //提货方式 1派送 2自提
"caddr_id":caddrId as Any,//客户地址id,无地址填0,一定要根据客户获取这个地址ID
"logistics_price":logistics_price as Any,//运费
"other_price":other_price as Any] as [String : Any]
orderInfo = dictChangeString(sender: dic)
}else{
let dic = ["cus_id":cusModel?.cus_id as Any,
"pay_type":payType as Any,
"pay_status":payStatus as Any,
"need_check":0,
"s_status":(chuHuoWay + 1) as Any,
"shipping_type":shipping_type as Any,
"caddr_id":caddrId as Any,
"logistics_price":logistics_price as Any,
"other_price":other_price as Any] as [String : Any]
orderInfo = dictChangeString(sender: dic)
}
return orderInfo
}
//MARK:--运费 & 其他费用
func textFieldContent(content: String, cell: TitleAndTFCell) {
if cell.nameLbl.text == "运费" {
logistics_price = content
print(logistics_price)
}else if cell.nameLbl.text == "其他费用" {
other_price = content
print(other_price)
}
}
}
......@@ -146,6 +146,7 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.idx = indexPath
let model = datas[indexPath.row]
cell.nameLbl.text = model.goods_name
cell.cellModel = model
cell.detailLbl.text = "\(model.spec_str!)/\(model.unit!)"
cell.detailLbl2.text = "存储:\(model.inventory!)"
cell.iconImg.sd_setImage(with: URL(string: SERVERCE_ImageHost + model.goods_img!))
......
......@@ -32,10 +32,12 @@ class DZGLViewController: BaseViewController,UITableViewDelegate,UITableViewData
navbar.rightTitle = "新增"
self.view.addSubview(navbar)
HUD.flash(.progress)
let UserToken = UserDefaults.standard.value(forKey: "user_token")
getAddrsInfo(["user_token":UserToken,"cus_id":cus_id], success: { (data) in
self.adrInfo = data as! GetAddrsInfoModel
self.listView.reloadData()
HUD.hide()
}) { (error) in
}
......
......@@ -22,14 +22,25 @@ class GuanLianKehuVC: BaseViewController , UITableViewDelegate, UITableViewDataS
@IBAction func submitAction(_ sender: LGButton) {
print("确定")
if order_id == 0 {
//MARK:--代客下单流程的关联客服
self.delegate?.GuanLianKehuSelect(keHuData: self.dataArr[self.selectIdx!])
self.navigationController?.popViewController(animated: true)
return
}
if selectIdx != nil{
HUD.flash(.progress)
let model = self.dataArr[self.selectIdx!]
let UserToken = UserDefaults.standard.value(forKey: "user_token")
bindCus(["cus_id":model.cus_id as Any,"user_token":UserToken as Any,"order_id":order_id as Any], success: { (data) in
let dataM = data as! UpDataModel
if dataM.code == 1 {
self.delegate?.GuanLianKehuSelect(keHuData: self.dataArr[self.selectIdx!])
self.navigationController?.popViewController(animated: true)
}
}) { (error) in
}
......
......@@ -32,6 +32,7 @@ class ChangeGoodsPriceVC: BaseViewController , UITableViewDelegate, UITableView
//MARK:--确认修改价格
@IBAction func sureAction(_ sender: LGButton) {
let UserToken = UserDefaults.standard.value(forKey: "user_token")
var order_goodsArr:Array<Any>? = []
......
......@@ -9,13 +9,16 @@
import UIKit
import LGButton
protocol XiuGaiYuShouJiaViewControllerDelegate {
func changeYuShouGoodsByData(sender:EditOGPAdDataModel)
func changeYuShouGoodsByData(sender:EditOGPAdDataModel?,djText:String,wkText:String)
}
class XiuGaiYuShouJiaViewController: BaseViewController {
var dataModel : OrderDetailDataModel?
var orderID:Int? = 0
var delegate : XiuGaiYuShouJiaViewControllerDelegate?
var inputData:Array<XuanZeShangPinCell> = []
var djTFstr:String = "";
var wkTFstr:String = "";
@IBOutlet weak var firstView: UIView!
@IBOutlet weak var weiKuanTF: UITextField!
......@@ -39,6 +42,7 @@ class XiuGaiYuShouJiaViewController: BaseViewController {
make.left.right.equalTo(0)
make.height.equalTo(120*glscale)
}
if orderID != 0{
if (dataModel?.order_goods!.count)! > 0 {
let rowModel = dataModel?.order_goods![0]
titleLbl.text = rowModel!.goods_name
......@@ -47,12 +51,28 @@ class XiuGaiYuShouJiaViewController: BaseViewController {
dingJinTF.text = dataModel?.order_res?.sale_res?.dj_amount
weiKuanTF.text = dataModel?.order_res?.sale_res?.wk_amount
}
}else{
//MARK:--代客下单流程
if inputData.count > 0 {
let cell1 = inputData[0]
titleLbl.text = cell1.nameLbl.text
detailLbl.text = cell1.detailLbl.text
icomImg.sd_setImage(with: URL(string: cell1.imgUrlPath!))
countLbl.isHidden = true
dingJinTF.text = djTFstr
weiKuanTF.text = wkTFstr
}
}
}
@IBAction func submitACTION(_ sender: Any) {
print("预售返回上一级且提交了数据")
if orderID != 0 {
//MARK:--需要对输入是否为金额判断
let UserToken = UserDefaults.standard.value(forKey: "user_token")
let rowModel = dataModel?.order_goods![0]
......@@ -60,13 +80,19 @@ class XiuGaiYuShouJiaViewController: BaseViewController {
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
let dataM = data as! EditOGPAdModel
if dataM.code == 1 {
self.delegate?.changeYuShouGoodsByData(sender: dataM.data!)
self.delegate?.changeYuShouGoodsByData(sender: dataM.data!, djText: self.dingJinTF.text!, wkText: self.weiKuanTF.text!)
self.navigationController?.popViewController(animated: true)
}
}) { (error) in
}
}else{
//MARK:--代客下单流程
self.delegate?.changeYuShouGoodsByData(sender:nil, djText: dingJinTF.text!, wkText: weiKuanTF.text!)
self.navigationController?.popViewController(animated: true)
}
}
......
......@@ -235,15 +235,15 @@ class OrderDViewController: BaseViewController,UITableViewDelegate,UITableViewDa
}
//MARK:--修改价格(预售返回数据)
func changeYuShouGoodsByData(sender: EditOGPAdDataModel) {
func changeYuShouGoodsByData(sender: EditOGPAdDataModel?, djText: String, wkText: String) {
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()
self.dataMdoel?.order_res?.sale_res?.dj_amount = sender!.dj_amount
self.dataMdoel?.order_res?.sale_res?.wk_amount = sender!.wk_amount
// listView.reloadData()
loadData()
}
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
let view = UIView()
switch section {
......
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