Commit 804f9118 authored by lujunye's avatar lujunye

完善代客下单(购物)

parent afb6857c
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
E02C88272456B24F00925766 /* WuLiuGenZongViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E02C88252456B24F00925766 /* WuLiuGenZongViewController.xib */; }; E02C88272456B24F00925766 /* WuLiuGenZongViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = E02C88252456B24F00925766 /* WuLiuGenZongViewController.xib */; };
E02C882A2456B4BA00925766 /* WLGZCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02C88282456B4BA00925766 /* WLGZCell.swift */; }; E02C882A2456B4BA00925766 /* WLGZCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02C88282456B4BA00925766 /* WLGZCell.swift */; };
E02C882B2456B4BA00925766 /* WLGZCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E02C88292456B4BA00925766 /* WLGZCell.xib */; }; E02C882B2456B4BA00925766 /* WLGZCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = E02C88292456B4BA00925766 /* WLGZCell.xib */; };
E02D586B2477A1480065A9EB /* GetAddrsInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02D586A2477A1480065A9EB /* GetAddrsInfoModel.swift */; };
E02D586D2477A2D90065A9EB /* EditFtNumberModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02D586C2477A2D90065A9EB /* EditFtNumberModel.swift */; };
E02DDD83244FD15B00ABB707 /* TitleAndSwitchHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E02DDD82244FD15B00ABB707 /* TitleAndSwitchHeaderView.xib */; }; E02DDD83244FD15B00ABB707 /* TitleAndSwitchHeaderView.xib in Resources */ = {isa = PBXBuildFile; fileRef = E02DDD82244FD15B00ABB707 /* TitleAndSwitchHeaderView.xib */; };
E02DDD85244FDC6A00ABB707 /* TitleAndSwitchHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02DDD84244FDC6A00ABB707 /* TitleAndSwitchHeaderView.swift */; }; E02DDD85244FDC6A00ABB707 /* TitleAndSwitchHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E02DDD84244FDC6A00ABB707 /* TitleAndSwitchHeaderView.swift */; };
E02DDD8B244FE17400ABB707 /* NewCreateFooter.xib in Resources */ = {isa = PBXBuildFile; fileRef = E02DDD8A244FE17400ABB707 /* NewCreateFooter.xib */; }; E02DDD8B244FE17400ABB707 /* NewCreateFooter.xib in Resources */ = {isa = PBXBuildFile; fileRef = E02DDD8A244FE17400ABB707 /* NewCreateFooter.xib */; };
...@@ -543,6 +545,8 @@ ...@@ -543,6 +545,8 @@
E02C88252456B24F00925766 /* WuLiuGenZongViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WuLiuGenZongViewController.xib; sourceTree = "<group>"; }; E02C88252456B24F00925766 /* WuLiuGenZongViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WuLiuGenZongViewController.xib; sourceTree = "<group>"; };
E02C88282456B4BA00925766 /* WLGZCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WLGZCell.swift; sourceTree = "<group>"; }; E02C88282456B4BA00925766 /* WLGZCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WLGZCell.swift; sourceTree = "<group>"; };
E02C88292456B4BA00925766 /* WLGZCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WLGZCell.xib; sourceTree = "<group>"; }; E02C88292456B4BA00925766 /* WLGZCell.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = WLGZCell.xib; sourceTree = "<group>"; };
E02D586A2477A1480065A9EB /* GetAddrsInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetAddrsInfoModel.swift; sourceTree = "<group>"; };
E02D586C2477A2D90065A9EB /* EditFtNumberModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditFtNumberModel.swift; sourceTree = "<group>"; };
E02DDD82244FD15B00ABB707 /* TitleAndSwitchHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndSwitchHeaderView.xib; sourceTree = "<group>"; }; E02DDD82244FD15B00ABB707 /* TitleAndSwitchHeaderView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TitleAndSwitchHeaderView.xib; sourceTree = "<group>"; };
E02DDD84244FDC6A00ABB707 /* TitleAndSwitchHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleAndSwitchHeaderView.swift; sourceTree = "<group>"; }; E02DDD84244FDC6A00ABB707 /* TitleAndSwitchHeaderView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TitleAndSwitchHeaderView.swift; sourceTree = "<group>"; };
E02DDD8A244FE17400ABB707 /* NewCreateFooter.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NewCreateFooter.xib; sourceTree = "<group>"; }; E02DDD8A244FE17400ABB707 /* NewCreateFooter.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = NewCreateFooter.xib; sourceTree = "<group>"; };
...@@ -2227,6 +2231,8 @@ ...@@ -2227,6 +2231,8 @@
F9A0E1DC246D198B00D7F26F /* CusListAllModel.swift */, F9A0E1DC246D198B00D7F26F /* CusListAllModel.swift */,
F9A0E1DE246D1B1E00D7F26F /* GetGoodsInfoModel.swift */, F9A0E1DE246D1B1E00D7F26F /* GetGoodsInfoModel.swift */,
F9FF7BA024760DA9006E305E /* LogisticsCompanyModel.swift */, F9FF7BA024760DA9006E305E /* LogisticsCompanyModel.swift */,
E02D586A2477A1480065A9EB /* GetAddrsInfoModel.swift */,
E02D586C2477A2D90065A9EB /* EditFtNumberModel.swift */,
); );
path = OrderManageModel; path = OrderManageModel;
sourceTree = "<group>"; sourceTree = "<group>";
...@@ -2780,12 +2786,14 @@ ...@@ -2780,12 +2786,14 @@
E0B946272456775000FBEC9A /* DaiKeXiaDanGouWuCell.swift in Sources */, E0B946272456775000FBEC9A /* DaiKeXiaDanGouWuCell.swift in Sources */,
E0206333246CE450007A40C4 /* HeaderOnlyTitleView.swift in Sources */, E0206333246CE450007A40C4 /* HeaderOnlyTitleView.swift in Sources */,
F950FDDB24518B9500C40530 /* FSCalendarStickyHeader.m in Sources */, F950FDDB24518B9500C40530 /* FSCalendarStickyHeader.m in Sources */,
E02D586D2477A2D90065A9EB /* EditFtNumberModel.swift in Sources */,
F95A9EE924558B8800867849 /* ShowAlGoodsViewController.swift in Sources */, F95A9EE924558B8800867849 /* ShowAlGoodsViewController.swift in Sources */,
E09B03C32445BD9500211A51 /* NavViewController.swift in Sources */, E09B03C32445BD9500211A51 /* NavViewController.swift in Sources */,
F950FDD924518B9500C40530 /* FSCalendarDelegationFactory.m in Sources */, F950FDD924518B9500C40530 /* FSCalendarDelegationFactory.m in Sources */,
E0A2E82B24555D8600D6DB34 /* KuCunXiangQingCell.swift in Sources */, E0A2E82B24555D8600D6DB34 /* KuCunXiangQingCell.swift in Sources */,
F933F6C22452C68B00189561 /* PKHUDAnimating.swift in Sources */, F933F6C22452C68B00189561 /* PKHUDAnimating.swift in Sources */,
E00E48C62457C99900F16545 /* KuCunShangPinXQViewController.swift in Sources */, E00E48C62457C99900F16545 /* KuCunShangPinXQViewController.swift in Sources */,
E02D586B2477A1480065A9EB /* GetAddrsInfoModel.swift in Sources */,
F9531F3C2465108800724BEE /* JXPhotoBrowserSmoothZoomAnimator.swift in Sources */, F9531F3C2465108800724BEE /* JXPhotoBrowserSmoothZoomAnimator.swift in Sources */,
F9531F402465108800724BEE /* JXPhotoBrowserZoomAnimator.swift in Sources */, F9531F402465108800724BEE /* JXPhotoBrowserZoomAnimator.swift in Sources */,
E0337EED2464EED000952EF4 /* PinPaiListViewController.swift in Sources */, E0337EED2464EED000952EF4 /* PinPaiListViewController.swift in Sources */,
......
...@@ -4,22 +4,6 @@ ...@@ -4,22 +4,6 @@
<FileRef <FileRef
location = "group:GeliBusinessPlatform.xcodeproj"> location = "group:GeliBusinessPlatform.xcodeproj">
</FileRef> </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 <FileRef
location = "group:Pods/Pods.xcodeproj"> location = "group:Pods/Pods.xcodeproj">
</FileRef> </FileRef>
......
...@@ -74,6 +74,8 @@ ...@@ -74,6 +74,8 @@
<string>Customer/cusListAll</string> <string>Customer/cusListAll</string>
<key>获取商品信息</key> <key>获取商品信息</key>
<string>Adminorder/getGoodsInfo</string> <string>Adminorder/getGoodsInfo</string>
<key>根据客户获取地址信息</key>
<string>Customer/getAddrsInfo</string>
<key>商家仓库列表</key> <key>商家仓库列表</key>
<string>Warehouse/shopWarehouseList</string> <string>Warehouse/shopWarehouseList</string>
<key>商家仓库添加</key> <key>商家仓库添加</key>
...@@ -84,5 +86,9 @@ ...@@ -84,5 +86,9 @@
<string>Warehouse/shopWarehouseDel</string> <string>Warehouse/shopWarehouseDel</string>
<key>商家仓库详情</key> <key>商家仓库详情</key>
<string>Warehouse/shopWarehouseDetail</string> <string>Warehouse/shopWarehouseDetail</string>
<key>修改购买商品数量</key>
<string>Adminorder/editFtNumber</string>
<key>提交下单</key>
<string>Adminorder/addOrder</string>
</dict> </dict>
</plist> </plist>
...@@ -269,3 +269,73 @@ func logisticsCompany(_ params:[String:Any],success:@escaping (_ res:Any)->(),fa ...@@ -269,3 +269,73 @@ func logisticsCompany(_ params:[String:Any],success:@escaping (_ res:Any)->(),fa
failture(error) failture(error)
} }
} }
//MARK: --获取商品信息
/**
params-key:
user_token(验证token)
is_adsale(是否预售,1是0非)
*/
func getGoodsInfo(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) { NetworkRequest.sharedInstance.postRequest("获取商品信息", params, { (rep:DataResponse<GetGoodsInfoModel>) in
}, success: { (data) in
success(data)
}) { (error) in
}
}
//MARK: --根据客户获取地址信息
/**
params-key:
user_token(验证token)
cus_id(客户id)
*/
func getAddrsInfo(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) { NetworkRequest.sharedInstance.postRequest("根据客户获取地址信息", params, { (rep:DataResponse<GetAddrsInfoModel>) in
}, success: { (data) in
success(data)
}) { (error) in
}
}
//MARK: --修改购买商品数量
/**
params-key:
user_token(验证token)
is_adsale(是否预售,1是0非)
sku_id (商品sku_id)
number(商品数量 )
*/
func editFtNumber(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) { NetworkRequest.sharedInstance.postRequest("修改购买商品数量", params, { (rep:DataResponse<EditFtNumberModel>) in
}, success: { (data) in
success(data)
}) { (error) in
}
}
//MARK: --提交下单
/**
params-key:
user_token(验证token)
is_adsale(是否预售,1是0非)
goods_info (商品信息,数组,转为json格式)
order_info(订单信息,数组,转为json格式)
*/
func addOrder(_ params:[String:Any],success:@escaping (_ res:Any)->(),failture:@escaping(_ error:Error)->()) { NetworkRequest.sharedInstance.postRequest("提交下单", params, { (rep:DataResponse<UpDataModel>) in
}, success: { (data) in
success(data)
}) { (error) in
}
}
//
// EditFtNumberModel.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/5/22.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//修改购买商品数量
class EditFtNumberModel: Mappable {
var code:Int?
var message : String?
var data : Array<EditFtNumberDataModel>?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class EditFtNumberDataModel: Mappable {
var number:String?
var price : String?
required init?( map: Map) {
}
func mapping(map: Map) {
number <- map["number"]
price <- map["price"]
}
}
//
// GetAddrsInfoModel.swift
// GeliBusinessPlatform
//
// Created by junye lu on 2020/5/22.
// Copyright © 2020 junye lu. All rights reserved.
//
import Foundation
import ObjectMapper
//根据客户获取地址信息
class GetAddrsInfoModel: Mappable {
var code:Int?
var message : String?
var data : Array<GetAddrsInfoDataModel>?
required init?( map: Map) {
}
func mapping(map: Map) {
code <- map["code"]
message <- map["message"]
data <- map["data"]
}
}
class GetAddrsInfoDataModel: Mappable {
var caddr_id:Int?//客户地址id
var cus_id : Int?//客户id
var consignee : String?//联系人姓名
var province:Int?//
var city : Int?//
var district : Int?//
var street: Int?//
var address:String?
var mobile:String? //联系方式
var is_default:Int?
var addr_cn:String? //联系人详细地址
required init?( map: Map) {
}
func mapping(map: Map) {
caddr_id <- map["caddr_id"]
cus_id <- map["cus_id"]
consignee <- map["consignee"]
province <- map["province"]
city <- map["city"]
district <- map["district"]
street <- map["street"]
address <- map["address"]
mobile <- map["mobile"]
is_default <- map["is_default"]
addr_cn <- map["addr_cn"]
}
}
...@@ -13,9 +13,9 @@ class GetGoodsInfoModel: Mappable { ...@@ -13,9 +13,9 @@ class GetGoodsInfoModel: Mappable {
var code:Int? var code:Int?
var message : String? var message : String?
var data : Array<GetGoodsInfoDataModel>? var data : Array<GetGoodsInfoDataModel>?
required init?( map: Map) { required init?( map: Map) {
} }
func mapping(map: Map) { func mapping(map: Map) {
code <- map["code"] code <- map["code"]
...@@ -25,14 +25,40 @@ class GetGoodsInfoModel: Mappable { ...@@ -25,14 +25,40 @@ class GetGoodsInfoModel: Mappable {
} }
class GetGoodsInfoDataModel: Mappable { class GetGoodsInfoDataModel: Mappable {
var sku_id:Int?//sku_id
var goods_img : String?//商品缩略图
var goods_name : String?//商品名
var origin_number : Int?//起订量
var need_check : Int?
var brand_name : String?//品牌名
var inventory : Int?//可售库存
var warehouse_inventory : Int?
var adsale_inventory : Int?//预售库存(预售下单时用)
var spec_str : String?//规格
var unit : String?//单位
var sku_attr : String?
var price:String?//售价
var tiered_pri:String?//阶梯价
var adsale_tiered_pri:String?//预售阶梯价
required init?( map: Map) { required init?( map: Map) {
} }
func mapping(map: Map) { func mapping(map: Map) {
sku_id <- map["sku_id"]
goods_img <- map["goods_img"]
} goods_name <- map["goods_name"]
origin_number <- map["origin_number"]
need_check <- map["need_check"]
brand_name <- map["brand_name"]
inventory <- map["inventory"]
warehouse_inventory <- map["warehouse_inventory"]
adsale_inventory <- map["adsale_inventory"]
spec_str <- map["spec_str"]
unit <- map["unit"]
sku_attr <- map["sku_attr"]
price <- map["price"]
tiered_pri <- map["tiered_pri"]
adsale_tiered_pri <- map["adsale_tiered_pri"]
}
} }
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
import Foundation import Foundation
import ObjectMapper import ObjectMapper
//发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除 //发送验证码,验证短信验证码,修改登录密码,绑定、更换绑定格利支付账号,简单通用操作接口,普通订单发货,预售订单发货,订单绑定/更换绑定客户,确认订单,订单取消,修改订单商品价格,订单退款,普通订单退货,预售订单退货,修改订单支付方式(状态),商家仓库添加,商家仓库修改,商家仓库删除,提交下单
class UpDataModel: Mappable { class UpDataModel: Mappable {
var code:Int? var code:Int?
......
...@@ -9,8 +9,11 @@ ...@@ -9,8 +9,11 @@
import UIKit import UIKit
@objc protocol XuanZeShangPinCellDelegate { @objc protocol XuanZeShangPinCellDelegate {
@objc optional func XuanZeShangPinCellBtnClick(index:IndexPath) @objc optional func XuanZeShangPinCellBtnClick(index:IndexPath)
@objc optional func XuanZeShangPinCellTextChange(index:IndexPath)
} }
class XuanZeShangPinCell: UITableViewCell { class XuanZeShangPinCell: UITableViewCell {
var imgUrlPath:String?
var sku_id:Int?
@IBOutlet weak var iconImg: UIImageView! @IBOutlet weak var iconImg: UIImageView!
@IBOutlet weak var priceLbl: UILabel! @IBOutlet weak var priceLbl: UILabel!
@IBOutlet weak var yuShouImg: UIImageView! @IBOutlet weak var yuShouImg: UIImageView!
...@@ -42,10 +45,13 @@ class XuanZeShangPinCell: UITableViewCell { ...@@ -42,10 +45,13 @@ class XuanZeShangPinCell: UITableViewCell {
override func awakeFromNib() { override func awakeFromNib() {
super.awakeFromNib() super.awakeFromNib()
self.selectionStyle = .none self.selectionStyle = .none
priceTF.addTarget(self, action: #selector(textChange(sender:)), for: .allEditingEvents)
countTF.addTarget(self, action: #selector(textChange(sender:)), for: .allEditingEvents)
// Initialization code // Initialization code
} }
@objc func textChange(sender:UITextField){
delegate?.XuanZeShangPinCellTextChange?(index: idx!)
}
override func setSelected(_ selected: Bool, animated: Bool) { override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated) super.setSelected(selected, animated: animated)
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<objects> <objects>
<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"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="XuanZeShangPinCell" customModule="GeliBusinessPlatform" customModuleProvider="target"> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="XuanZeShangPinCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="120"/> <rect key="frame" x="0.0" y="0.0" width="375" height="120"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
......
...@@ -17,9 +17,14 @@ class DaiKeXiaDanFooterView: UIView { ...@@ -17,9 +17,14 @@ class DaiKeXiaDanFooterView: UIView {
@IBAction func btnClick(_ sender: Any) { @IBAction func btnClick(_ sender: Any) {
delegate?.addAction!() delegate?.addAction!()
} }
@IBOutlet weak var btnH: NSLayoutConstraint!
@IBOutlet weak var topViewHeight: NSLayoutConstraint! @IBOutlet weak var topViewHeight: NSLayoutConstraint!
@IBOutlet weak var priceLbl: UILabel! @IBOutlet weak var priceLbl: UILabel!
@IBOutlet weak var countLbl: NSLayoutConstraint!
@IBOutlet weak var totalPriceLbl: UILabel!
@IBOutlet weak var countLbl: UILabel!
@IBOutlet weak var img: UIImageView!
//初始化时将xib中的view添加进来 //初始化时将xib中的view添加进来
override init(frame: CGRect) { override init(frame: CGRect) {
super.init(frame: frame) super.init(frame: frame)
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<objects> <objects>
<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"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="DaiKeXiaDanGouWuCell" customModule="GeliBusinessPlatform" customModuleProvider="target"> <tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="DaiKeXiaDanGouWuCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="120"/> <rect key="frame" x="0.0" y="0.0" width="375" height="120"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM"> <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="KGk-i7-Jjw" id="H2p-sc-9uM">
......
...@@ -9,27 +9,27 @@ ...@@ -9,27 +9,27 @@
import UIKit import UIKit
protocol XuanZeShangPinViewControllerDelegate { protocol XuanZeShangPinViewControllerDelegate {
func XuanZeShangPinViewControllerSubmitAction(datas:Array<Any>) func XuanZeShangPinViewControllerSubmitAction(inputData:Array<XuanZeShangPinCell>)
func XuanZeShangPinViewControllerYuShou(YuShouData:String) func XuanZeShangPinViewControllerYuShou(YuShouData:Array<XuanZeShangPinCell>)
func XuanZeShangPinViewControllerEdit(datas:Array<Any>) func XuanZeShangPinViewControllerEdit(inputData:Array<XuanZeShangPinCell>)
} }
class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,XuanZeShangPinCellDelegate,UISearchBarDelegate,SearchBarViewDelegate{ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITableViewDataSource,XuanZeShangPinCellDelegate,UISearchBarDelegate,SearchBarViewDelegate,UITextFieldDelegate{
var searchV : SearchBarView? = nil var searchV : SearchBarView? = nil
var delegate:XuanZeShangPinViewControllerDelegate? var delegate:XuanZeShangPinViewControllerDelegate?
var is_adsale:Int?
//XuanZeShangPinCell //XuanZeShangPinCell
@IBAction func submitAction(_ sender: Any) { @IBAction func submitAction(_ sender: Any) {
print("submit") print("submit")
if barTitle == "修改价格"{ if barTitle == "修改价格"{
delegate?.XuanZeShangPinViewControllerEdit(datas:["返回","数据"]) delegate?.XuanZeShangPinViewControllerEdit(inputData:inputData)
}else{ }else{
if isYuShou { if isYuShou {
delegate?.XuanZeShangPinViewControllerYuShou(YuShouData: "abc") delegate?.XuanZeShangPinViewControllerYuShou(YuShouData: inputData)
}else{ }else{
delegate?.XuanZeShangPinViewControllerSubmitAction(datas: selectIdxArr) delegate?.XuanZeShangPinViewControllerSubmitAction(inputData: inputData)
} }
} }
self.navigationController?.popViewController(animated: true) self.navigationController?.popViewController(animated: true)
...@@ -43,14 +43,26 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab ...@@ -43,14 +43,26 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
var idx:IndexPath? var idx:IndexPath?
//是否预售 //是否预售
var isYuShou = false var isYuShou = false
var datas:Array<Any> = []//数据 var datas:Array<GetGoodsInfoDataModel> = []//数据
var selectArr:Array<GetGoodsInfoDataModel> = []
var selectIdxArr:Array<IndexPath> = [] var selectIdxArr:Array<IndexPath> = []
var inputData:Array<XuanZeShangPinCell> = []
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
navbar.title = barTitle navbar.title = barTitle
self.view.addSubview(navbar) self.view.addSubview(navbar)
let UserToken = UserDefaults.standard.value(forKey: "user_token")
if barTitle != "修改价格"{
getGoodsInfo(["user_token":UserToken,"is_adsale":is_adsale], success: { (data) in
let model = data as! GetGoodsInfoModel
self.datas = model.data!
self.listView.reloadData()
}) { (error) in
}
}
listView.separatorStyle = .none listView.separatorStyle = .none
SetTopFrame(view: topView, height: 44) SetTopFrame(view: topView, height: 44)
...@@ -79,20 +91,68 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab ...@@ -79,20 +91,68 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
searchBar.resignFirstResponder() searchBar.resignFirstResponder()
} }
//MARK: - cell delegate func textFieldShouldReturn(_ textField: UITextField) -> Bool {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { textField.resignFirstResponder()
return 8 let idx = IndexPath(row: textField.tag, section: 0)
let cell = listView.cellForRow(at: idx) as! XuanZeShangPinCell
if cell.priceTF.text != "0" {
let data = datas[cell.tag]
if data.tiered_pri! != nil && data.tiered_pri!.count > 0 {
let dict = getDictionaryFromJSONString(jsonString: data.tiered_pri!)
let arr = dict.allKeys
var strArr:Array<Int>? = []
for item in arr {
let str = item as! NSString
strArr?.append(str.integerValue)
}
let new = strArr?.sorted(by: { (num1, num2) -> Bool in
return num1 > num2 ? true : false
})
let countStr = cell.countTF.text as! NSString
for i in 0 ..< new!.count{
if countStr.integerValue > new![i]{
cell.priceTF.text = dict["\(new![i])"] as! String
break
}else{
cell.priceTF.text = data.price
}
}
}
}
return true
} }
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "XuanZeShangPinCell") as! XuanZeShangPinCell let cell = tableView.dequeueReusableCell(withIdentifier: "XuanZeShangPinCell") as! XuanZeShangPinCell
cell.delegate = self cell.delegate = self
cell.priceTF.delegate = self
cell.countTF.delegate = self
cell.idx = indexPath cell.idx = indexPath
cell.countTF.returnKeyType = .done
cell.countTF.tag = indexPath.row
if barTitle == "修改价格"{ if barTitle == "修改价格"{
let cell1 = inputData[indexPath.row]
cell.sku_id = cell1.sku_id
cell.nameLbl.text = cell1.nameLbl.text
cell.detailLbl.text = cell1.detailLbl.text
cell.detailLbl2.text = cell1.detailLbl2.text
cell.iconImg.sd_setImage(with: URL(string: cell1.imgUrlPath!))
cell.imgUrlPath = cell1.imgUrlPath
cell.countTF.text = cell1.countTF.text
cell.priceTF.text = cell1.priceTF.text
cell.selectBtn.isHidden = true cell.selectBtn.isHidden = true
cell.btmView.isHidden = false cell.btmView.isHidden = false
cell.btmViewHeight.constant = 89 cell.btmViewHeight.constant = 89
}else{ }else{
cell.idx = indexPath
let model = datas[indexPath.row]
cell.nameLbl.text = model.goods_name
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!))
cell.imgUrlPath = SERVERCE_ImageHost + model.goods_img!
cell.countTF.returnKeyType = .done
cell.countTF.tag = indexPath.row
cell.sku_id = model.sku_id
if isYuShou {//预售 if isYuShou {//预售
if idx == indexPath { if idx == indexPath {
cell.selectBtn.isSelected = true cell.selectBtn.isSelected = true
...@@ -107,6 +167,7 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab ...@@ -107,6 +167,7 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.selectBtn.isSelected = false cell.selectBtn.isSelected = false
cell.btmView.isHidden = true cell.btmView.isHidden = true
cell.btmViewHeight.constant = 0 cell.btmViewHeight.constant = 0
for idx in selectIdxArr { for idx in selectIdxArr {
if idx == indexPath{ if idx == indexPath{
cell.selectBtn.isSelected = true cell.selectBtn.isSelected = true
...@@ -114,10 +175,27 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab ...@@ -114,10 +175,27 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.btmViewHeight.constant = 89 cell.btmViewHeight.constant = 89
} }
} }
for item in inputData{
if item.idx?.row == indexPath.row {
cell.selectBtn.isSelected = true
}
}
} }
} }
return cell return cell
} }
func XuanZeShangPinCellTextChange(index: IndexPath) {
let cell = listView.cellForRow(at: index) as! XuanZeShangPinCell
for i in 0 ..< inputData.count{
let item = inputData[i]
if cell.sku_id == item.sku_id{
inputData.insert(cell, at: i)
inputData.remove(at: i+1)
}
}
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
if barTitle == "修改价格"{ if barTitle == "修改价格"{
return 210 return 210
...@@ -139,17 +217,40 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab ...@@ -139,17 +217,40 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
func XuanZeShangPinCellBtnClick(index:IndexPath) { func XuanZeShangPinCellBtnClick(index:IndexPath) {
let cell = listView.cellForRow(at: index) as! XuanZeShangPinCell
if isYuShou{ if isYuShou{
idx = index idx = index
inputData.removeAll()
inputData.append(cell)
}else{ }else{
if selectIdxArr.contains(index) { let data = datas[index.row]
let idx = selectArr.firstIndex { (model) -> Bool in
return (data.sku_id == model.sku_id)
}
if idx != nil {
selectArr.remove(at: idx!)
}else{
selectArr.append(data)
}
if selectIdxArr.contains(index){
let idx = selectIdxArr.index(of: index) let idx = selectIdxArr.index(of: index)
selectIdxArr.remove(at: idx!) selectIdxArr.remove(at: idx!)
inputData.remove(at: idx!)
}else{ }else{
selectIdxArr.append(index) selectIdxArr.append(index)
inputData.append(cell)
} }
} }
listView.reloadData() listView.reloadData()
} }
//MARK: - cell delegate
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if barTitle == "修改价格"{
return inputData.count
}
return datas.count
}
} }
...@@ -94,10 +94,12 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD ...@@ -94,10 +94,12 @@ class WorkCViewController: BaseViewController, UITableViewDelegate, UITableViewD
} }
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
print("点中cell--\(indexPath.row)") print("点中cell--\(indexPath.row)")
if indexPath.row == 1 { // if indexPath.row == 1 {
let vc = EditWorkCViewController() // let vc = EditWorkCViewController()
self.navigationController?.pushViewController(vc, animated: true) // self.navigationController?.pushViewController(vc, animated: true)
} // }
let vc = DaiKeXiaDanGouWuViewController()
self.navigationController?.pushViewController(vc, animated: true)
} }
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
......
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