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

完成新增商品对接(缺商品详情)

parent 64d44745
...@@ -156,6 +156,27 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -156,6 +156,27 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
//MARK:---新增商品接口 //MARK:---新增商品接口
let UserToken = UserDefaults.standard.value(forKey: "user_token") let UserToken = UserDefaults.standard.value(forKey: "user_token")
var goods_type = ""
for i in 1..<itemTypeArr!.count {
let num = itemTypeArr![i]
if num != 99 {
switch i {
case 1:
goods_type = "1"
break
case 2:
goods_type = "3"
break
case 3:
goods_type = "4"
break
default:
break
}
}
}
var is_qz = 0 var is_qz = 0
if shiFouQZ { if shiFouQZ {
is_qz = 1 is_qz = 1
...@@ -165,13 +186,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -165,13 +186,21 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
is_inquiry = 1 is_inquiry = 1
} }
var is_adsale = 0 var is_adsale = 0
var need_check = 0
if isYuShouShangPin! { if isYuShouShangPin! {
is_adsale = 1 is_adsale = 1
}
var need_check = 0
if shiFouSH { if shiFouSH {
need_check = 1 need_check = 1
} }
}else{
faHuoTime = ""
dj_time_start = 0
dj_time_end = 0
wk_time_start = 0
wk_time_end = 0
}
var gs_id = 1 var gs_id = 1
if self.shangPinStatusArr!.count > 0 { if self.shangPinStatusArr!.count > 0 {
let model = self.shangPinStatusArr![shangPinStatus!] let model = self.shangPinStatusArr![shangPinStatus!]
...@@ -198,7 +227,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -198,7 +227,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
"brand_id":selectPinPaiData?.brand_id as Any, // 品牌ID "brand_id":selectPinPaiData?.brand_id as Any, // 品牌ID
"goods_name":itemName, //商品名称 "goods_name":itemName, //商品名称
"is_qz":is_qz as Any, //是否清真商品,1是0非 "is_qz":is_qz as Any, //是否清真商品,1是0非
"goods_type":"", //商品类型,普通2现货3期货4团购 "goods_type":goods_type, //商品类型,普通2现货3期货4团购
"is_adsale":is_adsale as Any, //商品类型字段,预售专用,选定”预售”则值为1,否则值为0 "is_adsale":is_adsale as Any, //商品类型字段,预售专用,选定”预售”则值为1,否则值为0
"is_inquiry":is_inquiry as Any, //是否询价:1是0非 "is_inquiry":is_inquiry as Any, //是否询价:1是0非
"origin_number":qiMaiShuLiang as Any, //起购数量 "origin_number":qiMaiShuLiang as Any, //起购数量
...@@ -222,11 +251,11 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -222,11 +251,11 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
"sku_info":sku_info as Any] "sku_info":sku_info as Any]
print(dic) print(dic)
//MARK:--新增商品接口 //MARK:--新增商品接口
goodsAdd(dic, success: { (data) in // goodsAdd(dic, success: { (data) in
//
}) { (error) in // }) { (error) in
//
} // }
} }
@IBOutlet weak var submitBtn: LGButton! @IBOutlet weak var submitBtn: LGButton!
...@@ -1077,6 +1106,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -1077,6 +1106,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
} }
} }
//预售价 //预售价
var is_adsale_tiered = 0 var is_adsale_tiered = 0
var adsale_tiered_pri:Dictionary<String, String> = [:] var adsale_tiered_pri:Dictionary<String, String> = [:]
...@@ -1113,7 +1143,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -1113,7 +1143,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
} }
let pack_attr = ["l":"0","w":"0","h":"0","w":md.weight,"v":"0"] let pack_attr = ["l":"0","w":"0","h":"0","wg":md.weight,"v":"0"]
var is_open_adsale = 0 var is_open_adsale = 0
var adsale_pri = "" var adsale_pri = ""
...@@ -1126,9 +1156,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -1126,9 +1156,7 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
adsale_inventory = md.ysKuCun adsale_inventory = md.ysKuCun
pct = md.DJBiLi pct = md.DJBiLi
} }
var sku = ["sku_sn":"",
let sku = ["sku_sn":"",
"spec_id":"1", "spec_id":"1",
"attr":md.guiGe, "attr":md.guiGe,
"pack_attr":pack_attr, "pack_attr":pack_attr,
...@@ -1136,13 +1164,24 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl ...@@ -1136,13 +1164,24 @@ class ProductDetailViewController: BaseViewController,UITableViewDelegate,UITabl
"unit":md.danWei, "unit":md.danWei,
"price":md.price, "price":md.price,
"is_tiered":is_tiered, "is_tiered":is_tiered,
"tiered_pri":tiered_pri,
"is_open_adsale":is_open_adsale, "is_open_adsale":is_open_adsale,
"adsale_pri":adsale_pri, "adsale_pri":adsale_pri,
"adsale_inventory":adsale_inventory, "adsale_inventory":adsale_inventory,
"pct":pct, "pct":pct,
"adsale_tiered_pri":adsale_tiered_pri,
"is_adsale_tiered":is_adsale_tiered] as [String : Any] "is_adsale_tiered":is_adsale_tiered] as [String : Any]
if tiered_pri.keys.count > 0{
sku.updateValue(tiered_pri, forKey: "tiered_pri")
}else{
sku.updateValue("", forKey: "tiered_pri")
}
if adsale_tiered_pri.keys.count > 0 {
sku.updateValue(adsale_tiered_pri, forKey: "adsale_tiered_pri")
}else{
sku.updateValue("", forKey: "adsale_tiered_pri")
}
skuArr.append(sku) skuArr.append(sku)
} }
......
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