Commit 05156e59 authored by lujunye's avatar lujunye

修改代客下单

parent 718c3a47
......@@ -7,6 +7,8 @@
//
import UIKit
import WebKit
@objc protocol AddGuiGeCellDelegate {
@objc optional func AddGuiGeCellClick(cell:AddGuiGeCell)
}
......@@ -16,6 +18,9 @@ class AddGuiGeCell: UITableViewCell {
@IBAction func btnClick(_ sender: Any) {
delegate?.AddGuiGeCellClick?(cell: self)
}
@IBOutlet weak var webView: WKWebView!
@IBOutlet weak var imgBtn: UIButton!
override func awakeFromNib() {
super.awakeFromNib()
......
......@@ -9,7 +9,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="AddGuiGeCell" customModule="GeliBusinessPlatform" customModuleProvider="target">
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" id="KGk-i7-Jjw" customClass="AddGuiGeCell" customModule="TestClass" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="375" height="123.5"/>
<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">
......@@ -27,9 +27,21 @@
<action selector="btnClick:" destination="KGk-i7-Jjw" eventType="touchUpInside" id="f2z-zc-fd6"/>
</connections>
</button>
<wkWebView hidden="YES" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="CAr-OI-1ll">
<rect key="frame" x="0.0" y="0.0" width="375" height="123.5"/>
<color key="backgroundColor" red="0.36078431370000003" green="0.38823529410000002" blue="0.4039215686" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<wkWebViewConfiguration key="configuration">
<audiovisualMediaTypes key="mediaTypesRequiringUserActionForPlayback" none="YES"/>
<wkPreferences key="preferences"/>
</wkWebViewConfiguration>
</wkWebView>
</subviews>
<constraints>
<constraint firstItem="FpT-RN-ad7" firstAttribute="centerX" secondItem="H2p-sc-9uM" secondAttribute="centerX" id="CTD-cA-1jp"/>
<constraint firstItem="CAr-OI-1ll" firstAttribute="leading" secondItem="H2p-sc-9uM" secondAttribute="leading" id="ONc-Hx-udy"/>
<constraint firstAttribute="trailing" secondItem="CAr-OI-1ll" secondAttribute="trailing" id="TDz-Oa-TvQ"/>
<constraint firstItem="CAr-OI-1ll" firstAttribute="top" secondItem="H2p-sc-9uM" secondAttribute="top" id="YRm-tl-0No"/>
<constraint firstAttribute="bottom" secondItem="CAr-OI-1ll" secondAttribute="bottom" id="jKB-ok-a3G"/>
<constraint firstAttribute="bottom" secondItem="FpT-RN-ad7" secondAttribute="bottom" constant="50" id="log-wz-xog"/>
</constraints>
</tableViewCellContentView>
......@@ -37,8 +49,9 @@
<connections>
<outlet property="btmH" destination="log-wz-xog" id="axu-Jf-zWN"/>
<outlet property="imgBtn" destination="FpT-RN-ad7" id="DdI-mW-7wW"/>
<outlet property="webView" destination="CAr-OI-1ll" id="L9y-OD-5rY"/>
</connections>
<point key="canvasLocation" x="132" y="122"/>
<point key="canvasLocation" x="131.15942028985509" y="121.875"/>
</tableViewCell>
</objects>
<resources>
......
......@@ -14,6 +14,7 @@ import UIKit
class XuanZeShangPinCell: UITableViewCell {
var imgUrlPath:String?
var sku_id:Int?
var model:GetGoodsInfoDataModel?
@IBOutlet weak var iconImg: UIImageView!
@IBOutlet weak var priceLbl: UILabel!
@IBOutlet weak var yuShouImg: UIImageView!
......
......@@ -26,11 +26,11 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
if barTitle == "修改价格"{
delegate?.XuanZeShangPinViewControllerEdit(inputData:inputData)
}else{
if isYuShou {
delegate?.XuanZeShangPinViewControllerYuShou(YuShouData: inputData)
}else{
delegate?.XuanZeShangPinViewControllerSubmitAction(inputData: inputData)
}
if isYuShou {
delegate?.XuanZeShangPinViewControllerYuShou(YuShouData: inputData)
}else{
delegate?.XuanZeShangPinViewControllerSubmitAction(inputData: inputData)
}
}
self.navigationController?.popViewController(animated: true)
}
......@@ -56,7 +56,21 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
if barTitle != "修改价格"{
getGoodsInfo(["user_token":UserToken,"is_adsale":is_adsale], success: { (data) in
let model = data as! GetGoodsInfoModel
self.datas = model.data!
if self.inputData.count > 0 {
for item in self.inputData{
for mD in model.data! {
if mD.sku_id == item.model?.sku_id {
let idx = model.data?.firstIndex(where: { (m) -> Bool in
return (m.sku_id == item.model?.sku_id)
})
model.data?.remove(at: idx!)
}
}
}
self.datas = model.data!
}else{
self.datas = model.data!
}
self.listView.reloadData()
}) { (error) in
......@@ -93,12 +107,12 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
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!)
if barTitle == "修改价格"{
let idx = IndexPath(row: textField.tag, section: 0)
let cell = listView.cellForRow(at: idx) as! XuanZeShangPinCell
let data = inputData[textField.tag]
if data.model?.tiered_pri! != nil && data.model!.tiered_pri!.count > 0 {
let dict = getDictionaryFromJSONString(jsonString: (data.model?.tiered_pri!)!)
let arr = dict.allKeys
var strArr:Array<Int>? = []
for item in arr {
......@@ -114,11 +128,40 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.priceTF.text = dict["\(new![i])"] as! String
break
}else{
cell.priceTF.text = data.price
cell.priceTF.text = data.model!.price
}
}
}
}else{
let idx = IndexPath(row: textField.tag, section: 0)
let cell = listView.cellForRow(at: idx) as! XuanZeShangPinCell
let data = datas[textField.tag]
if cell.priceTF.text != "0" {
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 {
......@@ -127,6 +170,10 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.priceTF.delegate = self
cell.countTF.delegate = self
cell.idx = indexPath
cell.countTF.tag = indexPath.row
cell.priceTF.tag = indexPath.row
cell.priceTF.keyboardType = .numbersAndPunctuation
cell.priceTF.returnKeyType = .done
cell.countTF.returnKeyType = .done
cell.countTF.tag = indexPath.row
if barTitle == "修改价格"{
......@@ -139,20 +186,20 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.imgUrlPath = cell1.imgUrlPath
cell.countTF.text = cell1.countTF.text
cell.priceTF.text = cell1.priceTF.text
cell.model = cell1.model
cell.selectBtn.isHidden = true
cell.btmView.isHidden = false
cell.btmViewHeight.constant = 89
}else{
cell.idx = indexPath
let model = datas[indexPath.row]
cell.model = model
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!))
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 idx == indexPath {
......@@ -168,7 +215,6 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.selectBtn.isSelected = false
cell.btmView.isHidden = true
cell.btmViewHeight.constant = 0
for idx in selectIdxArr {
if idx == indexPath{
cell.selectBtn.isSelected = true
......@@ -176,25 +222,20 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
cell.btmViewHeight.constant = 89
}
}
for item in inputData{
if item.idx?.row == indexPath.row {
cell.selectBtn.isSelected = true
}
}
}
}
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)
}
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 {
......@@ -219,11 +260,11 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
func XuanZeShangPinCellBtnClick(index:IndexPath) {
let cell = listView.cellForRow(at: index) as! XuanZeShangPinCell
if isYuShou{
if isYuShou{//预售
idx = index
inputData.removeAll()
inputData.append(cell)
}else{
}else{//非预售
let data = datas[index.row]
let idx = selectArr.firstIndex { (model) -> Bool in
return (data.sku_id == model.sku_id)
......@@ -246,12 +287,12 @@ class XuanZeShangPinViewController: BaseViewController,UITableViewDelegate,UITab
listView.reloadData()
}
//MARK: - cell delegate
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if barTitle == "修改价格"{
return inputData.count
}
return datas.count
return datas.count
}
}
}
......@@ -628,7 +628,6 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
}
let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
cell.imgBtn.isUserInteractionEnabled = isAllEditing
cell.imgBtn.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside)
cell.imgBtn.setImage(UIImage(named: "xinzeng"), for: .normal)
return cell
......@@ -688,12 +687,17 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
}
default:
let cell = tableView.dequeueReusableCell(withIdentifier: "AddGuiGe") as! AddGuiGeCell
cell.imgBtn.setImage(UIImage(named: "XiaYunDanViewController"), for: .normal)
cell.delegate = self
cell.imgBtn.isUserInteractionEnabled = isAllEditing
cell.imgBtn.tag = indexPath.row
if goodsDesc.count > 0 {
cell.webView.isHidden = false
let request = URLRequest.init(url: URL(string: "https://m.baidu.com/")!)
cell.webView.load(request)
}
cell.imgBtn.setImage(UIImage(named: "tjxq"), for: .normal)
cell.btmH.constant = 25
return cell
}
}
......@@ -701,9 +705,18 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
//MARK: - 底部广告软文跳转
//MARK: - 底部广告软文跳转 && 编辑
@objc func editHtml(){
print("编辑软文")
let vc = LMNoteViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
func AddGuiGeCellClick(cell: AddGuiGeCell) {
print("底部广告软文跳转")
goodsDesc = "1"
listTbv.reloadData()
// let vc = LMNoteViewController()
// self.navigationController?.pushViewController(vc, animated: true)
}
//MARK: -- 点击按钮事件,跳转或者展示选择界面
......@@ -1106,7 +1119,8 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
}
//MARK: - 新增规格
@objc func addGuiGe(){
@objc func addGuiGe(sender:UIView){
print("新增规格")
let vc = CreatNewSpecsViewController()
vc.barTitle = "新增规格"
......@@ -1211,6 +1225,22 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
lbl.textColor = UIColor(named: "标题字颜色")
lbl.font = UIFont.boldSystemFont(ofSize: 15)
view.addSubview(lbl)
if section == 5 && goodsDesc.count > 0 {
let btn = UIButton()
btn.setTitle("编辑", for: .normal)
btn.isUserInteractionEnabled = isAllEditing
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
view.addSubview(btn)
btn.sizeToFit()
btn.snp.makeConstraints { (make) in
make.centerY.equalTo(lbl.snp_centerY)
make.right.equalTo(-15)
make.height.equalTo(btn.frame.size.height)
make.width.equalTo(btn.frame.size.width)
}
btn.addTarget(self, action: #selector(editHtml), for: .touchUpInside)
}
if section == 2 && guiGeArr.count > 0 && isAllEditing{
let btn = UIButton()
btn.setTitle(" 新增", for: .normal)
......@@ -1231,7 +1261,7 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
make.top.right.bottom.equalTo(0)
make.width.equalTo(80)
}
btn2.addTarget(self, action: #selector(addGuiGe), for: .touchUpInside)
btn2.addTarget(self, action: #selector(addGuiGe(sender:)), for: .touchUpInside)
if guiGeArr.count > 1 {
view.frame = CGRect(x: 0, y: 0, width: fullScreenWidth, height: 80)
let collectionView = UICollectionView(frame: CGRect(x: 0, y: 0, width: 0, height: 0), collectionViewLayout: layout)
......@@ -1287,6 +1317,9 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
}
case 4:return 49
default:
if goodsDesc.count > 0 {
return 250
}
return 98
}
......@@ -1390,7 +1423,7 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
let pack_attr = ["l":"0","w":"0","h":"0","wg":item.weight,"v":"0"]
let packAttrStr = dictChangeString(sender: pack_attr)
var is_open_adsale = 0
var adsale_pri = ""
var adsale_inventory = ""
......@@ -1556,7 +1589,11 @@ class EPViewController: BaseViewController,UITableViewDelegate,UITableViewDataSo
}
var goodsDesc = ""
func getHTMLByVc(_ model: String!) {
goodsDesc = model
}
}
......
......@@ -93,16 +93,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
HUD.flash(.label("请选择商品类型"), delay: 1.2)
return
}
//待补充
if itemName.count == 0 {
HUD.flash(.label("请输入商品名称"), delay: 1.2)
return
}
if itemTypeArr == [99,99,99,99] {
HUD.flash(.label("请选择商品类型"), delay: 1.2)
return
}
if selectGoodsClassModel == nil {
HUD.flash(.label("请选择商品分类"), delay: 1.2)
return
......@@ -111,10 +101,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
HUD.flash(.label("请选择品牌"), delay: 1.2)
return
}
if qiMaiShuLiang.count == 0 {
HUD.flash(.label("请输入起卖数量"), delay: 1.2)
return
}
if singleImgArr.count == 0 {
HUD.flash(.label("请选择商品封面图"), delay: 1.2)
......@@ -136,14 +122,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
return
}
}
if keyWord.count == 0 {
HUD.flash(.label("请输入关键字"), delay: 1.2)
return
}
if wuLiuPrice.count == 0 {
HUD.flash(.label("请输入物流费用"), delay: 1.2)
return
}
if countrySelect == nil {
HUD.flash(.label("请选择国家"), delay: 1.2)
return
......@@ -463,6 +442,11 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
cell.imgBtn.setImage(UIImage(named: "XiaYunDanViewController"), for: .normal)
cell.delegate = self
cell.imgBtn.tag = indexPath.row
if goodsDesc.count > 0 {
cell.webView.isHidden = false
let request = URLRequest.init(url: URL(string: "https://m.baidu.com/")!)
cell.webView.load(request)
}
cell.imgBtn.setImage(UIImage(named: "tjxq"), for: .normal)
cell.btmH.constant = 25
if goodsDesc.count > 0 {
......@@ -472,13 +456,26 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
return cell
}
}
func loadString(str:String){
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
}
//MARK: - 底部广告软文跳转
//MARK: - 底部广告软文跳转 && 编辑
@objc func editHtml(){
print("编辑软文")
let vc = LMNoteViewController()
self.navigationController?.pushViewController(vc, animated: true)
}
func AddGuiGeCellClick(cell: AddGuiGeCell) {
print("底部广告软文跳转")
goodsDesc = "1"
listTbv.reloadData()
return
let vc = LMNoteViewController()
vc.htmlStr = goodsDesc;
vc.delegatedata = self
......@@ -966,6 +963,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
return 10
}
//MARK: - tableview header
func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
if section == 3 {
......@@ -979,6 +977,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
lbl.textColor = UIColor(named: "标题字颜色")
lbl.font = UIFont.boldSystemFont(ofSize: 15)
view.addSubview(lbl)
if section == 5 && goodsDesc.count > 0 {
let btn = UIButton()
btn.setTitle("编辑", for: .normal)
btn.titleLabel?.font = UIFont.systemFont(ofSize: 13)
btn.setTitleColor(UIColor(named: "蓝色字体颜色"), for: .normal)
view.addSubview(btn)
btn.sizeToFit()
btn.snp.makeConstraints { (make) in
make.centerY.equalTo(lbl.snp_centerY)
make.right.equalTo(-15)
make.height.equalTo(btn.frame.size.height)
make.width.equalTo(btn.frame.size.width)
}
btn.addTarget(self, action: #selector(editHtml), for: .touchUpInside)
}
if section == 2 && guiGeArr.count > 0{
let btn = UIButton()
btn.setTitle(" 新增", for: .normal)
......@@ -1055,6 +1068,9 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
}
case 4:return 49
default:
if goodsDesc.count > 0 {
return 250
}
return 98
}
......@@ -1218,4 +1234,6 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
func getHTMLByVc(_ model: String!) {
goodsDesc = model
}
}
......@@ -348,6 +348,7 @@ class CreatNewSpecsViewController: BaseViewController,UITableViewDelegate,UITabl
let cell = tableView.dequeueReusableCell(withIdentifier: "YuShou") as! YuShouCell
cell.inputTF1.isUserInteractionEnabled = isAllEditing
cell.inputTF2.isUserInteractionEnabled = isAllEditing
cell.inputTF2.keyboardType = .numberPad
cell.inputTF3.isUserInteractionEnabled = isAllEditing
cell.tag = indexPath.row
cell.infoSw.isOn = isOpenYSSetting
......
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