Commit e7d9e1173942047c0f2d750ef50c7fef3604aa1e
1 parent
dedcbc4f
修改部分UIbug
Showing
6 changed files
with
78 additions
and
77 deletions
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveCreateShopClassifyViewController.swift
| ... | ... | @@ -31,7 +31,7 @@ class CNLiveCreateShopClassifyViewController:CNLiveBaseViewController, UITableVi |
| 31 | 31 | let kCNLiveShopClassilyIconTableViewCellID = "kCNLiveShopClassilyIconTableViewCellID" |
| 32 | 32 | |
| 33 | 33 | /// 编辑状态 |
| 34 | - var isEdite:Bool? | |
| 34 | + var isEdite:Bool = false | |
| 35 | 35 | /// 编辑的数据 |
| 36 | 36 | var shopClassifyModel:CNLiveShopClassifyModel? |
| 37 | 37 | /// 表 |
| ... | ... | @@ -150,7 +150,7 @@ class CNLiveCreateShopClassifyViewController:CNLiveBaseViewController, UITableVi |
| 150 | 150 | return cell |
| 151 | 151 | } |
| 152 | 152 | self.titleField = cell.textFiled |
| 153 | - if self.isEdite!{ | |
| 153 | + if self.isEdite == true{ | |
| 154 | 154 | cell.textFiled.text = self.shopClassifyModel?.title |
| 155 | 155 | } |
| 156 | 156 | return cell |
| ... | ... | @@ -164,7 +164,7 @@ class CNLiveCreateShopClassifyViewController:CNLiveBaseViewController, UITableVi |
| 164 | 164 | cell.uploadImageSuceessBlock = {imageUrl in |
| 165 | 165 | self.shopClassifyModel?.simg = imageUrl |
| 166 | 166 | } |
| 167 | - if self.isEdite!{ | |
| 167 | + if self.isEdite{ | |
| 168 | 168 | if self.shopClassifyModel?.simg?.count ?? 0 > 0{ |
| 169 | 169 | cell.selectUploadImageView?.networkImageArr = [self.shopClassifyModel?.simg ?? ""] |
| 170 | 170 | } | ... | ... |
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveGoodsCategoryController.swift
| ... | ... | @@ -25,9 +25,9 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 25 | 25 | |
| 26 | 26 | // MARK: - 属性 |
| 27 | 27 | //开始输入前的文本 |
| 28 | - var firCategoryId:String? | |
| 29 | - var secCategoryId:String? | |
| 30 | - var thiCategoryId:String? | |
| 28 | + var firCategoryId:Int = 0 | |
| 29 | + var secCategoryId:Int = 0 | |
| 30 | + var thiCategoryId:Int = 0 | |
| 31 | 31 | var firCategoryName:String? |
| 32 | 32 | var secCategoryName:String? |
| 33 | 33 | var thiCategoryName:String? |
| ... | ... | @@ -116,7 +116,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 116 | 116 | }else{ |
| 117 | 117 | return |
| 118 | 118 | } |
| 119 | - if (_temp_selectFirCategoryModel?.id!.count)! > 0{ | |
| 119 | + if _temp_selectFirCategoryModel?.id ?? 0 > 0{ | |
| 120 | 120 | self.firCategoryBtn?.setTitle(_temp_selectFirCategoryModel?.title, for: .normal) |
| 121 | 121 | }else{ |
| 122 | 122 | self.firCategoryBtn?.setTitle("请选择", for: .normal) |
| ... | ... | @@ -135,7 +135,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 135 | 135 | }else{ |
| 136 | 136 | return |
| 137 | 137 | } |
| 138 | - if (_temp_selectSecCategoryModel?.id?.count)! > 0{ | |
| 138 | + if _temp_selectSecCategoryModel?.id ?? 0 > 0{ | |
| 139 | 139 | self.secCategoryBtn?.setTitle(_temp_selectSecCategoryModel?.title, for: .normal) |
| 140 | 140 | self.secCategoryBtn?.setTitleColor(HexColor("#333333"), for: .normal) |
| 141 | 141 | }else{ |
| ... | ... | @@ -160,7 +160,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 160 | 160 | }else{ |
| 161 | 161 | return |
| 162 | 162 | } |
| 163 | - if _temp_selectThiCategoryModel!.id!.count > 0{ | |
| 163 | + if _temp_selectThiCategoryModel!.id > 0{ | |
| 164 | 164 | self.thiCategoryBtn?.setTitle(_temp_selectThiCategoryModel?.title, for: .normal) |
| 165 | 165 | self.thiCategoryBtn?.setTitleColor(HexColor("#333333"), for: .normal) |
| 166 | 166 | }else{ |
| ... | ... | @@ -180,18 +180,18 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 180 | 180 | self.view.backgroundColor = .clear |
| 181 | 181 | self.topNavView.removeFromSuperview() |
| 182 | 182 | self.initUI() |
| 183 | - if self.firCategoryId == "0" || self.firCategoryId?.count == 0{ | |
| 184 | - self.secCategoryId = "0" | |
| 185 | - self.thiCategoryId = "0" | |
| 186 | - }else if self.secCategoryId == "0" || self.secCategoryId?.count == 0{ | |
| 187 | - self.thiCategoryId = "0" | |
| 183 | + if self.firCategoryId == 0{ | |
| 184 | + self.secCategoryId = 0 | |
| 185 | + self.thiCategoryId = 0 | |
| 186 | + }else if self.secCategoryId == 0 || self.secCategoryId == 0{ | |
| 187 | + self.thiCategoryId = 0 | |
| 188 | 188 | } |
| 189 | 189 | if self.categoryType == .goods{ |
| 190 | 190 | self.postDataWithPid(pid: "0", level: 1) { |
| 191 | - if self.secCategoryId?.count ?? 0 > 0 && self.secCategoryId != "0"{ | |
| 192 | - self.postDataWithPid(pid: self.firCategoryId ?? "", level: 2) { | |
| 193 | - if self.thiCategoryId?.count ?? 0 > 0 && self.thiCategoryId != "0"{ | |
| 194 | - self.postDataWithPid(pid: self.secCategoryId ?? "", level: 3) { | |
| 191 | + if self.secCategoryId > 0{ | |
| 192 | + self.postDataWithPid(pid:String(format: "%d", self.firCategoryId), level: 2) { | |
| 193 | + if self.thiCategoryId > 0{ | |
| 194 | + self.postDataWithPid(pid:String(format: "%d",self.secCategoryId), level: 3) { | |
| 195 | 195 | } |
| 196 | 196 | } |
| 197 | 197 | } |
| ... | ... | @@ -353,14 +353,14 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 353 | 353 | if self.categoryType == .goods{ |
| 354 | 354 | if self.displayLevel == 1{ |
| 355 | 355 | let model = self.firCategoryDataArr[indexPath.row] as! CNLiveShopGoodsManageDetailsGoodsCategoryModel |
| 356 | - self.postDataWithPid(pid: model.id!, level: 2) { | |
| 356 | + self.postDataWithPid(pid: String(format: "%d", model.id), level: 2) { | |
| 357 | 357 | self.temp_selectFirCategoryModel = model |
| 358 | 358 | self.temp_selectSecCategoryModel = nil |
| 359 | 359 | self.temp_selectThiCategoryModel = nil |
| 360 | 360 | } |
| 361 | 361 | }else if (self.displayLevel == 2) { |
| 362 | 362 | let model = self.secCategoryDataArr[indexPath.row] as! CNLiveShopGoodsManageDetailsGoodsCategoryModel |
| 363 | - self.postDataWithPid(pid: model.id!, level: 3) { | |
| 363 | + self.postDataWithPid(pid: String(format: "%d", model.id), level: 3) { | |
| 364 | 364 | self.temp_selectSecCategoryModel = model |
| 365 | 365 | self.temp_selectThiCategoryModel = nil |
| 366 | 366 | } |
| ... | ... | @@ -373,7 +373,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 373 | 373 | if (self.displayLevel == 1) { |
| 374 | 374 | let model = self.firCategoryDataArr[indexPath.row] as! CNLiveShopClassifyModel |
| 375 | 375 | let tempFirMdl = CNLiveShopGoodsManageDetailsGoodsCategoryModel() |
| 376 | - tempFirMdl.id = model.id | |
| 376 | + tempFirMdl.id = Int(model.id ?? "0")! | |
| 377 | 377 | tempFirMdl.title = model.title |
| 378 | 378 | self.temp_selectFirCategoryModel = tempFirMdl |
| 379 | 379 | self.temp_selectSecCategoryModel = nil |
| ... | ... | @@ -387,7 +387,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 387 | 387 | }else if (self.displayLevel == 2){ |
| 388 | 388 | let model = self.secCategoryDataArr[indexPath.row] as! CNLiveShopClassifyModel |
| 389 | 389 | let tempFirMdl = CNLiveShopGoodsManageDetailsGoodsCategoryModel() |
| 390 | - tempFirMdl.id = model.id | |
| 390 | + tempFirMdl.id = Int(model.id ?? "0")! | |
| 391 | 391 | tempFirMdl.title = model.title |
| 392 | 392 | self.temp_selectSecCategoryModel = tempFirMdl |
| 393 | 393 | self.tableView.reloadData() |
| ... | ... | @@ -420,11 +420,11 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 420 | 420 | } |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - self.firCategoryId = self.temp_selectFirCategoryModel?.id | |
| 423 | + self.firCategoryId = self.temp_selectFirCategoryModel?.id ?? 0 | |
| 424 | 424 | self.firCategoryName = self.temp_selectFirCategoryModel?.title |
| 425 | - self.secCategoryId = self.temp_selectSecCategoryModel?.id | |
| 425 | + self.secCategoryId = self.temp_selectSecCategoryModel?.id ?? 0 | |
| 426 | 426 | self.secCategoryName = self.temp_selectSecCategoryModel?.title |
| 427 | - self.thiCategoryId = self.temp_selectThiCategoryModel?.id | |
| 427 | + self.thiCategoryId = self.temp_selectThiCategoryModel?.id ?? 0 | |
| 428 | 428 | self.thiCategoryName = self.temp_selectThiCategoryModel?.title |
| 429 | 429 | self.finishBlock!() |
| 430 | 430 | self.hide() |
| ... | ... | @@ -509,7 +509,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 509 | 509 | self.temp_selectThiCategoryModel = nil |
| 510 | 510 | self.secCategoryDataArr.removeAllObjects() |
| 511 | 511 | self.thiCategoryDataArr.removeAllObjects() |
| 512 | - if self.firCategoryId?.count ?? 0 > 0 && self.firCategoryId != "0"{ | |
| 512 | + if self.firCategoryId > 0{ | |
| 513 | 513 | |
| 514 | 514 | let tempDataArr = Array(self.firCategoryDataArr) |
| 515 | 515 | for (_,mdl) in tempDataArr.enumerated() { |
| ... | ... | @@ -525,7 +525,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 525 | 525 | self.temp_selectSecCategoryModel = nil |
| 526 | 526 | self.temp_selectThiCategoryModel = nil |
| 527 | 527 | self.thiCategoryDataArr.removeAllObjects() |
| 528 | - if self.secCategoryId?.count ?? 0 > 0 && self.secCategoryId != "0"{ | |
| 528 | + if self.secCategoryId > 0{ | |
| 529 | 529 | let tempDataArr = Array(self.thiCategoryDataArr) |
| 530 | 530 | for (_,mdl) in tempDataArr.enumerated() { |
| 531 | 531 | let model = mdl as! CNLiveShopGoodsManageDetailsGoodsCategoryModel |
| ... | ... | @@ -540,7 +540,7 @@ class CNLiveGoodsCategoryController: CNLiveBaseViewController, UITableViewDataSo |
| 540 | 540 | }else if (level == 3) { |
| 541 | 541 | self.thiCategoryDataArr = NSMutableArray(array: dataArr) |
| 542 | 542 | self.temp_selectThiCategoryModel = nil |
| 543 | - if self.thiCategoryId?.count ?? 0 > 0 && self.thiCategoryId != "0"{ | |
| 543 | + if self.thiCategoryId > 0{ | |
| 544 | 544 | let tempDataArr = Array(self.thiCategoryDataArr) |
| 545 | 545 | for (_,mdl) in tempDataArr.enumerated() { |
| 546 | 546 | let model = mdl as! CNLiveShopGoodsManageDetailsGoodsCategoryModel | ... | ... |
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopNewProductController.swift
| ... | ... | @@ -280,6 +280,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 280 | 280 | self.addChild(vc) |
| 281 | 281 | vc.view.frame = CGRect(x: 0, y: 0, width: self.view.width, height: self.view.height) |
| 282 | 282 | vc.didMove(toParent: self) |
| 283 | + self.view.addSubview(vc.view) | |
| 283 | 284 | self.selectCategoryVC = vc |
| 284 | 285 | } |
| 285 | 286 | self.selectCategoryVC?.display() |
| ... | ... | @@ -369,13 +370,13 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 369 | 370 | showMessage(message: "请选择商品详情图") |
| 370 | 371 | return |
| 371 | 372 | } |
| 372 | - else if (self.selectShopClassifyVC.firCategoryId!.count == 0) { | |
| 373 | + else if (self.selectShopClassifyVC.firCategoryId == 0) { | |
| 373 | 374 | showMessage(message: "请选择店铺分类") |
| 374 | 375 | return |
| 375 | 376 | } |
| 376 | 377 | |
| 377 | 378 | let goodsDetailsModel = CNLiveShopGoodsDetailsModel() |
| 378 | - var bannerImage = NSMutableArray() | |
| 379 | + let bannerImage = NSMutableArray() | |
| 379 | 380 | for imageUrl in bannersSelectImageUrls { |
| 380 | 381 | let model = CNLiveShopGoodsDetailsModel() |
| 381 | 382 | model.simg = imageUrl |
| ... | ... | @@ -396,19 +397,19 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 396 | 397 | goodsDetailsModel.prices = singleView8.contentTextField.text |
| 397 | 398 | goodsDetailsModel.category_id = self.selectShopClassifyVC.firCategoryId |
| 398 | 399 | goodsDetailsModel.category_id2 = self.selectShopClassifyVC.secCategoryId |
| 399 | - var contentDetailsImage = NSMutableArray() | |
| 400 | + let contentDetailsImage = NSMutableArray() | |
| 400 | 401 | for imageUrl in contentDetailsSelectImageUrls{ |
| 401 | 402 | let model = CNLiveGoodsDetailsContentModel() |
| 402 | 403 | model.simg = imageUrl |
| 403 | 404 | contentDetailsImage.add(model) |
| 404 | 405 | } |
| 405 | 406 | goodsDetailsModel.detail_img = Array(contentDetailsImage) as! [CNLiveGoodsDetailsContentModel] |
| 406 | - var kvArray = NSMutableArray() | |
| 407 | + let kvArray = NSMutableArray() | |
| 407 | 408 | kvArray.add(["k":"品名","v":singleView18.contentTextField.text]) |
| 408 | 409 | kvArray.add(["k":"规格","v":singleView19.contentTextField.text]) |
| 409 | 410 | kvArray.add(["k":"寄送区域","v":singleView20.contentTextField.text]) |
| 410 | 411 | kvArray.add(["k":"发货时效","v":singleView21.contentTextField.text]) |
| 411 | - var tempArray = NSMutableArray(array: self.bgScrollView.subviews) | |
| 412 | + let tempArray = NSMutableArray(array: self.bgScrollView.subviews) | |
| 412 | 413 | |
| 413 | 414 | let subArr = tempArray.subarray(with: NSRange(location: 0, length: tempArray.index(of: singleView19))) |
| 414 | 415 | tempArray.removeObjects(in: subArr) |
| ... | ... | @@ -464,7 +465,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 464 | 465 | let singleView21 = self.bgScrollView.viewWithTag(21) as! CNLiveShopAddGoodsSingleView |
| 465 | 466 | let bannersSelectImageUrls = singleView4.uploadImageView.getCurrentSelectImageUrls() |
| 466 | 467 | |
| 467 | - var bannerImage = NSMutableArray() | |
| 468 | + let bannerImage = NSMutableArray() | |
| 468 | 469 | for imageUrl in bannersSelectImageUrls{ |
| 469 | 470 | bannerImage.add(["img":imageUrl,"ord":"99"]) |
| 470 | 471 | } |
| ... | ... | @@ -480,7 +481,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 480 | 481 | |
| 481 | 482 | let bannerSelectVideoUrl = singleView4.uploadImageView.getCurrentSelectVideoUrl() |
| 482 | 483 | let contentDetailsSelectImageUrls = singleView13.uploadImageView.getCurrentSelectImageUrls() |
| 483 | - var contentDetailsImage = NSMutableArray() | |
| 484 | + let contentDetailsImage = NSMutableArray() | |
| 484 | 485 | for imageUrl in contentDetailsSelectImageUrls{ |
| 485 | 486 | contentDetailsImage.add(["img":imageUrl,"ord":"99"]) |
| 486 | 487 | } |
| ... | ... | @@ -493,10 +494,10 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 493 | 494 | contentDetailsImageStr = contentDetailsImageStr.replacingOccurrences(of: "\\", with: "") |
| 494 | 495 | contentDetailsImageStr = contentDetailsImageStr.replacingOccurrences(of: " ", with: "") |
| 495 | 496 | } catch _ {} |
| 496 | - if self.type == .add && self.selectCategoryVC?.thiCategoryId?.count == 0{ | |
| 497 | + if self.type == .add && self.selectCategoryVC?.thiCategoryId == 0{ | |
| 497 | 498 | showMessage(message: "请选择商品分类") |
| 498 | 499 | return |
| 499 | - }else if self.selectShopClassifyVC.firCategoryId == nil || self.selectShopClassifyVC.firCategoryId?.count == 0 || self.selectShopClassifyVC.firCategoryId == "0"{ | |
| 500 | + }else if self.selectShopClassifyVC.firCategoryId == 0{ | |
| 500 | 501 | showMessage(message: "请选择店铺分类") |
| 501 | 502 | return |
| 502 | 503 | }else if bannersSelectImageUrls.count == 0 && bannerSelectVideoUrl.count == 0{ |
| ... | ... | @@ -542,7 +543,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 542 | 543 | showMessage(message: "请输入发货时效") |
| 543 | 544 | return |
| 544 | 545 | } |
| 545 | - var kvArray = NSMutableArray() | |
| 546 | + let kvArray = NSMutableArray() | |
| 546 | 547 | kvArray.add(["k":"品名","v":singleView18.contentTextField.text]) |
| 547 | 548 | kvArray.add(["k":"规格","v":singleView19.contentTextField.text]) |
| 548 | 549 | kvArray.add(["k":"寄送区域","v":singleView20.contentTextView.text]) |
| ... | ... | @@ -563,7 +564,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 563 | 564 | if i == 11 || i == 16{ |
| 564 | 565 | continue |
| 565 | 566 | } |
| 566 | - var singleView = self.bgScrollView.viewWithTag(i) as! CNLiveShopAddGoodsSingleView | |
| 567 | + let singleView = self.bgScrollView.viewWithTag(i) as! CNLiveShopAddGoodsSingleView | |
| 567 | 568 | let content = (singleView.contentTextField.text?.isEmpty == true ? singleView.contentTextField.text : singleView.contentTextView.text) ?? "" |
| 568 | 569 | if self.stringContainsEmoji(string: content){ |
| 569 | 570 | showMessage(message: "参数不能添加表情") |
| ... | ... | @@ -582,15 +583,15 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 582 | 583 | return |
| 583 | 584 | } |
| 584 | 585 | } |
| 585 | - var category_id = "" | |
| 586 | - if self.selectShopClassifyVC.secCategoryId?.isEmpty == false { | |
| 587 | - category_id = self.selectShopClassifyVC.secCategoryId! | |
| 586 | + var category_id = 0 | |
| 587 | + if self.selectShopClassifyVC.secCategoryId != 0 { | |
| 588 | + category_id = self.selectShopClassifyVC.secCategoryId | |
| 588 | 589 | }else{ |
| 589 | - category_id = self.selectShopClassifyVC.firCategoryId! | |
| 590 | + category_id = self.selectShopClassifyVC.firCategoryId | |
| 590 | 591 | } |
| 591 | 592 | showLoading(message: "") |
| 592 | 593 | if self.type == .add{ |
| 593 | - CNLiveShopGoodListViewModel.postGoodsAddWithUid(uid: DSUserInfoManager.shared.dsUserInfo.uid!, groupid3: self.selectCategoryVC?.thiCategoryId ?? "", bannerImg: bannerImageStr, simg: bannersSelectImageUrls.first!, video: bannerSelectVideoUrl, title: singleView5.contentTextField.text ?? "", ads: singleView6.contentTextView.text, price: singleView7.contentTextField.text ?? "", prices: singleView8.contentTextField.text ?? "", kg: singleView9.contentTextField.text ?? "", unit: singleView16.contentTextField.text ?? "", state: singleView11.contentSwitch.isOn ? "2" : "1", storage:self.dicArrayToJson(kvArray as! [Dictionary<String, Any>]), infoImg: contentDetailsImageStr, yunfei: singleView14.contentTextField.text ?? "", min_count: singleView10.countTF.text ?? "", isRefund: "0", category_id: category_id) { result, status in | |
| 594 | + CNLiveShopGoodListViewModel.postGoodsAddWithUid(uid: DSUserInfoManager.shared.dsUserInfo.uid!, groupid3: self.selectCategoryVC?.thiCategoryId != 0 ? String(format: "%d", self.selectCategoryVC?.thiCategoryId ?? 0) : "", bannerImg: bannerImageStr, simg: bannersSelectImageUrls.first!, video: bannerSelectVideoUrl, title: singleView5.contentTextField.text ?? "", ads: singleView6.contentTextView.text, price: singleView7.contentTextField.text ?? "", prices: singleView8.contentTextField.text ?? "", kg: singleView9.contentTextField.text ?? "", unit: singleView16.contentTextField.text ?? "", state: singleView11.contentSwitch.isOn ? "2" : "1", storage:self.dicArrayToJson(kvArray as! [Dictionary<String, Any>]), infoImg: contentDetailsImageStr, yunfei: singleView14.contentTextField.text ?? "", min_count: singleView10.countTF.text ?? "", isRefund: "0", category_id: String(format: "%d", category_id)) { result, status in | |
| 594 | 595 | hiddenLoading() |
| 595 | 596 | if status == .failed{ |
| 596 | 597 | showMessage(message: "发布失败") |
| ... | ... | @@ -600,7 +601,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 600 | 601 | showMessage(message: "发布成功") |
| 601 | 602 | NotificationCenter.default.post(name: NSNotification.Name.ShopGoodsManage.kDSGoodsManageAddNotification, object: nil) |
| 602 | 603 | for i in 0..<self.dataModel.list.count{ |
| 603 | - var singleView = self.view.viewWithTag(i+1) as! CNLiveShopAddGoodsSingleView | |
| 604 | + let singleView = self.view.viewWithTag(i+1) as! CNLiveShopAddGoodsSingleView | |
| 604 | 605 | if singleView.addEditGoodsListModel?.style == "3"{ |
| 605 | 606 | singleView.uploadImageView.deleteReplaceImageUrlAfterSuccessUploadThings() |
| 606 | 607 | } |
| ... | ... | @@ -609,7 +610,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 609 | 610 | } |
| 610 | 611 | } |
| 611 | 612 | }else{ |
| 612 | - CNLiveShopGoodListViewModel.postGoodsAddWithUid(uid: DSUserInfoManager.shared.dsUserInfo.uid!, groupid3: self.selectCategoryVC?.thiCategoryId ?? "", bannerImg: bannerImageStr, simg: bannersSelectImageUrls.first!, video: bannerSelectVideoUrl, title: singleView5.contentTextField.text ?? "", ads: singleView6.contentTextView.text ?? "", price: singleView7.contentTextField.text ?? "", prices: singleView8.contentTextField.text ?? "", kg: singleView9.contentTextField.text ?? "", unit: singleView16.contentTextField.text ?? "", state: singleView11.contentSwitch.isOn ? "2" : "1", storage: self.dicArrayToJson(kvArray as! [Dictionary<String, Any>]), infoImg: contentDetailsImageStr, yunfei: singleView14.contentTextField.text ?? "", min_count: singleView10.countTF.text ?? "", isRefund: "0", category_id: category_id) { result, status in | |
| 613 | + CNLiveShopGoodListViewModel.postGoodsAddWithUid(uid: DSUserInfoManager.shared.dsUserInfo.uid!, groupid3:self.selectCategoryVC?.thiCategoryId != 0 ? String(format: "%d", self.selectCategoryVC?.thiCategoryId ?? 0) : "" , bannerImg: bannerImageStr, simg: bannersSelectImageUrls.first!, video: bannerSelectVideoUrl, title: singleView5.contentTextField.text ?? "", ads: singleView6.contentTextView.text ?? "", price: singleView7.contentTextField.text ?? "", prices: singleView8.contentTextField.text ?? "", kg: singleView9.contentTextField.text ?? "", unit: singleView16.contentTextField.text ?? "", state: singleView11.contentSwitch.isOn ? "2" : "1", storage: self.dicArrayToJson(kvArray as! [Dictionary<String, Any>]), infoImg: contentDetailsImageStr, yunfei: singleView14.contentTextField.text ?? "", min_count: singleView10.countTF.text ?? "", isRefund: "0", category_id: String(format: "%d", category_id)) { result, status in | |
| 613 | 614 | hiddenLoading() |
| 614 | 615 | if status == .failed{ |
| 615 | 616 | showMessage(message: "修改失败") |
| ... | ... | @@ -619,7 +620,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 619 | 620 | showMessage(message: "修改成功") |
| 620 | 621 | NotificationCenter.default.post(name: NSNotification.Name.ShopGoodsManage.kDSGoodsManageEditNotification, object: nil, userInfo: (result as! Dictionary)) |
| 621 | 622 | for i in 0..<self.dataModel.list.count{ |
| 622 | - var singleView = self.view.viewWithTag(i+1) as! CNLiveShopAddGoodsSingleView | |
| 623 | + let singleView = self.view.viewWithTag(i+1) as! CNLiveShopAddGoodsSingleView | |
| 623 | 624 | if singleView.addEditGoodsListModel?.style == "3"{ |
| 624 | 625 | singleView.uploadImageView.deleteReplaceImageUrlAfterSuccessUploadThings() |
| 625 | 626 | } |
| ... | ... | @@ -681,43 +682,43 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 681 | 682 | let model = result as! CNLiveShopGoodsDetailsModel |
| 682 | 683 | self.shopGoodsDetailsModel = model |
| 683 | 684 | //商品分类 |
| 684 | - var singleView1 = self.bgScrollView.viewWithTag(1) as! CNLiveShopAddGoodsSingleView | |
| 685 | + let singleView1 = self.bgScrollView.viewWithTag(1) as! CNLiveShopAddGoodsSingleView | |
| 685 | 686 | //店铺分类 |
| 686 | - var singleView2 = self.bgScrollView.viewWithTag(2) as! CNLiveShopAddGoodsSingleView | |
| 687 | + let singleView2 = self.bgScrollView.viewWithTag(2) as! CNLiveShopAddGoodsSingleView | |
| 687 | 688 | //商品轮播 |
| 688 | - var singleView4 = self.bgScrollView.viewWithTag(4) as! CNLiveShopAddGoodsSingleView | |
| 689 | + let singleView4 = self.bgScrollView.viewWithTag(4) as! CNLiveShopAddGoodsSingleView | |
| 689 | 690 | //商品名称 |
| 690 | - var singleView5 = self.bgScrollView.viewWithTag(5) as! CNLiveShopAddGoodsSingleView | |
| 691 | + let singleView5 = self.bgScrollView.viewWithTag(5) as! CNLiveShopAddGoodsSingleView | |
| 691 | 692 | //商品副标题 |
| 692 | - var singleView6 = self.bgScrollView.viewWithTag(6) as! CNLiveShopAddGoodsSingleView | |
| 693 | + let singleView6 = self.bgScrollView.viewWithTag(6) as! CNLiveShopAddGoodsSingleView | |
| 693 | 694 | //本店售价 |
| 694 | - var singleView7 = self.bgScrollView.viewWithTag(7) as! CNLiveShopAddGoodsSingleView | |
| 695 | + let singleView7 = self.bgScrollView.viewWithTag(7) as! CNLiveShopAddGoodsSingleView | |
| 695 | 696 | //市场售价 |
| 696 | - var singleView8 = self.bgScrollView.viewWithTag(8) as! CNLiveShopAddGoodsSingleView | |
| 697 | + let singleView8 = self.bgScrollView.viewWithTag(8) as! CNLiveShopAddGoodsSingleView | |
| 697 | 698 | //商品重量 |
| 698 | - var singleView9 = self.bgScrollView.viewWithTag(9) as! CNLiveShopAddGoodsSingleView | |
| 699 | + let singleView9 = self.bgScrollView.viewWithTag(9) as! CNLiveShopAddGoodsSingleView | |
| 699 | 700 | //最低起售 |
| 700 | - var singleView10 = self.bgScrollView.viewWithTag(10) as! CNLiveShopAddGoodsSingleView | |
| 701 | + let singleView10 = self.bgScrollView.viewWithTag(10) as! CNLiveShopAddGoodsSingleView | |
| 701 | 702 | //上架 |
| 702 | - var singleView11 = self.bgScrollView.viewWithTag(11) as! CNLiveShopAddGoodsSingleView | |
| 703 | + let singleView11 = self.bgScrollView.viewWithTag(11) as! CNLiveShopAddGoodsSingleView | |
| 703 | 704 | //商品详情图 |
| 704 | - var singleView13 = self.bgScrollView.viewWithTag(13) as! CNLiveShopAddGoodsSingleView | |
| 705 | + let singleView13 = self.bgScrollView.viewWithTag(13) as! CNLiveShopAddGoodsSingleView | |
| 705 | 706 | //商品运费 |
| 706 | - var singleView14 = self.bgScrollView.viewWithTag(14) as! CNLiveShopAddGoodsSingleView | |
| 707 | + let singleView14 = self.bgScrollView.viewWithTag(14) as! CNLiveShopAddGoodsSingleView | |
| 707 | 708 | //是否支持退货 |
| 708 | - var singleView15 = self.bgScrollView.viewWithTag(15) as! CNLiveShopAddGoodsSingleView | |
| 709 | + let singleView15 = self.bgScrollView.viewWithTag(15) as! CNLiveShopAddGoodsSingleView | |
| 709 | 710 | //商品单位 |
| 710 | - var singleView16 = self.bgScrollView.viewWithTag(16) as! CNLiveShopAddGoodsSingleView | |
| 711 | + let singleView16 = self.bgScrollView.viewWithTag(16) as! CNLiveShopAddGoodsSingleView | |
| 711 | 712 | //品名 |
| 712 | - var singleView18 = self.bgScrollView.viewWithTag(18) as! CNLiveShopAddGoodsSingleView | |
| 713 | + let singleView18 = self.bgScrollView.viewWithTag(18) as! CNLiveShopAddGoodsSingleView | |
| 713 | 714 | //规格 |
| 714 | - var singleView19 = self.bgScrollView.viewWithTag(19) as! CNLiveShopAddGoodsSingleView | |
| 715 | + let singleView19 = self.bgScrollView.viewWithTag(19) as! CNLiveShopAddGoodsSingleView | |
| 715 | 716 | //寄送区域 |
| 716 | - var singleView20 = self.bgScrollView.viewWithTag(20) as! CNLiveShopAddGoodsSingleView | |
| 717 | + let singleView20 = self.bgScrollView.viewWithTag(20) as! CNLiveShopAddGoodsSingleView | |
| 717 | 718 | //发货时效 |
| 718 | - var singleView21 = self.bgScrollView.viewWithTag(21) as! CNLiveShopAddGoodsSingleView | |
| 719 | + let singleView21 = self.bgScrollView.viewWithTag(21) as! CNLiveShopAddGoodsSingleView | |
| 719 | 720 | |
| 720 | - var tempArray = NSMutableArray(array: self.shopGoodsDetailsModel.storageArray) | |
| 721 | + let tempArray = NSMutableArray(array: self.shopGoodsDetailsModel.storageArray) | |
| 721 | 722 | for dic in self.shopGoodsDetailsModel.storageArray{ |
| 722 | 723 | let dict = dic as NSDictionary |
| 723 | 724 | if dict.object(forKey: "k") as! String == "品名"{ |
| ... | ... | @@ -747,7 +748,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 747 | 748 | singleView2.contentTextField.text = self.shopGoodsDetailsModel.cate_name |
| 748 | 749 | singleView2.layoutSubviews() |
| 749 | 750 | |
| 750 | - var bannerImageUrls = NSMutableArray() | |
| 751 | + let bannerImageUrls = NSMutableArray() | |
| 751 | 752 | for model in self.shopGoodsDetailsModel.image{ |
| 752 | 753 | bannerImageUrls.add(model.simg ?? "") |
| 753 | 754 | } |
| ... | ... | @@ -765,9 +766,9 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 765 | 766 | singleView11.contentSwitch.isOn = self.shopGoodsDetailsModel.state == 2 ? true : false |
| 766 | 767 | singleView10.subtractBtn.setImage(UIImage(named: Int(self.shopGoodsDetailsModel.min_buy_num ?? "0")! > 1 ? "DS_main_unadd_count" : "DS_main_unadd_count_n"), for: .normal) |
| 767 | 768 | |
| 768 | - var contentDetailsImageUrls = NSMutableArray() | |
| 769 | + let contentDetailsImageUrls = NSMutableArray() | |
| 769 | 770 | for model in self.shopGoodsDetailsModel.detail_img{ |
| 770 | - contentDetailsImageUrls.add(model.simg) | |
| 771 | + contentDetailsImageUrls.add(model.simg as Any) | |
| 771 | 772 | } |
| 772 | 773 | singleView13.uploadImageView.networkImageArr = contentDetailsImageUrls as! Array<String> |
| 773 | 774 | if let array = contentDetailsImageUrls as? [String] { |
| ... | ... | @@ -779,7 +780,7 @@ class CNLiveShopNewProductController:CNLiveBaseViewController{ |
| 779 | 780 | singleView4.uploadImageView.deleteImage = UIImage.imageWithColor(color: .clear, size: singleView4.uploadImageView.size) |
| 780 | 781 | singleView13.uploadImageView.deleteImage = UIImage.imageWithColor(color: .clear, size: singleView13.uploadImageView.size) |
| 781 | 782 | if tempArray.count > 0{ |
| 782 | - var array = NSMutableArray(array: self.dataModel.list) | |
| 783 | + let array = NSMutableArray(array: self.dataModel.list) | |
| 783 | 784 | for i in 0..<tempArray.count{ |
| 784 | 785 | let dict = tempArray.object(at: i) as! NSDictionary |
| 785 | 786 | let paramDict = ["style":1,"isHaveTo":false,"title":dict.object(forKey: "k"),"contentTextFieldkeyboardType":1,"isDisplayLine":true,"contentType":1,"isDelect":true,"content":dict.object(forKey: "v")] | ... | ... |
metaCode/Classes/Main/HomePage/View/GoodsManager/CNLiveShopAddGoodsSingleView.swift
| ... | ... | @@ -354,7 +354,7 @@ class CNLiveShopAddGoodsSingleView: UIView, UITextFieldDelegate, UITextViewDeleg |
| 354 | 354 | |
| 355 | 355 | @objc func textDidChange(sender:UITextField) { |
| 356 | 356 | if (sender == self.countTF) { |
| 357 | - if (self.countTF.text?.count ?? 0 > 0 && (self.countTF.text?.isPurnInt() == false)) { | |
| 357 | + if (self.countTF.text?.count ?? 0 > 0 && (self.countTF.text?.isPurnInt() == true)) { | |
| 358 | 358 | let count:Int = (self.countTF.text! as NSString).integerValue |
| 359 | 359 | if (count <= 1) { |
| 360 | 360 | self.subtractBtn.setImage(UIImage(named: "DS_main_unadd_count_n"), for: .normal) | ... | ... |
metaCode/Classes/Main/Model/GoodsDetail/CNLiveShopGoodsDetailsModel.swift
| ... | ... | @@ -114,11 +114,11 @@ class CNLiveShopGoodsDetailsModel:BaseModel{ |
| 114 | 114 | /** |
| 115 | 115 | 店铺商品分类id,一级分类id |
| 116 | 116 | */ |
| 117 | - var category_id:String? | |
| 117 | + var category_id:Int = 0 | |
| 118 | 118 | /** |
| 119 | 119 | 店铺商品分类id,二级分类id |
| 120 | 120 | */ |
| 121 | - var category_id2:String? | |
| 121 | + var category_id2:Int = 0 | |
| 122 | 122 | /** |
| 123 | 123 | 店铺商品分类名 |
| 124 | 124 | */ |
| ... | ... | @@ -126,15 +126,15 @@ class CNLiveShopGoodsDetailsModel:BaseModel{ |
| 126 | 126 | /** |
| 127 | 127 | 平台分类id 1级 |
| 128 | 128 | */ |
| 129 | - var groupid:String? | |
| 129 | + var groupid:Int = 0 | |
| 130 | 130 | /** |
| 131 | 131 | 平台分类id 2级 |
| 132 | 132 | */ |
| 133 | - var groupid2:String? | |
| 133 | + var groupid2:Int = 0 | |
| 134 | 134 | /** |
| 135 | 135 | 平台分类id 3级 |
| 136 | 136 | */ |
| 137 | - var groupid3:String? | |
| 137 | + var groupid3:Int = 0 | |
| 138 | 138 | /** |
| 139 | 139 | 1/2/3级分类名称合并 |
| 140 | 140 | */ | ... | ... |
metaCode/Classes/Main/Model/GoodsManager/CNLiveShopGoodsManageDetailsGoodsCategoryModel.swift