Commit 13d1d668add097896093e7e7958f2f8d53c87a0a

Authored by 张旭
1 parent 095bdd4e

商品管理-新增商品model

metaCode.xcodeproj/project.pbxproj
... ... @@ -16,6 +16,11 @@
16 16 19565EC22AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC12AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift */; };
17 17 19565EC52AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */; };
18 18 19565EC72AF8AD38007D6727 /* CNLiveShopNewProductController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC62AF8AD38007D6727 /* CNLiveShopNewProductController.swift */; };
  19 + 19565EC92AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565EC82AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift */; };
  20 + 19565ECB2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565ECA2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift */; };
  21 + 19565ECD2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565ECC2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift */; };
  22 + 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565ECE2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift */; };
  23 + 19565ED42AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19565ED32AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift */; };
19 24 19BB1FDF2AEA3A450094D962 /* CNSlideBaseNavigationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */; };
20 25 19BB1FE12AEB5C220094D962 /* CNLiveShopConsoleController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */; };
21 26 19BB1FE32AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */; };
... ... @@ -163,6 +168,11 @@
163 168 19565EC12AF616CA007D6727 /* CNLiveShopDetailOrderAssetCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopDetailOrderAssetCell.swift; sourceTree = "<group>"; };
164 169 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopProductManagerController.swift; sourceTree = "<group>"; };
165 170 19565EC62AF8AD38007D6727 /* CNLiveShopNewProductController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopNewProductController.swift; sourceTree = "<group>"; };
  171 + 19565EC82AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopGoodListViewModel.swift; sourceTree = "<group>"; };
  172 + 19565ECA2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopGoodsListModel.swift; sourceTree = "<group>"; };
  173 + 19565ECC2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopGoodsListClassifyView.swift; sourceTree = "<group>"; };
  174 + 19565ECE2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopGoodsListCell.swift; sourceTree = "<group>"; };
  175 + 19565ED32AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopAddEditGoodsModel.swift; sourceTree = "<group>"; };
166 176 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNSlideBaseNavigationController.swift; sourceTree = "<group>"; };
167 177 19BB1FE02AEB5C220094D962 /* CNLiveShopConsoleController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleController.swift; sourceTree = "<group>"; };
168 178 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CNLiveShopConsoleViewModel.swift; sourceTree = "<group>"; };
... ... @@ -321,18 +331,45 @@
321 331 /* End PBXFrameworksBuildPhase section */
322 332  
323 333 /* Begin PBXGroup section */
324   - 19565EC32AF8ACC2007D6727 /* 商品管理 */ = {
  334 + 19565EC32AF8ACC2007D6727 /* GoodsManager */ = {
325 335 isa = PBXGroup;
326 336 children = (
327 337 19565EC42AF8AD1F007D6727 /* CNLiveShopProductManagerController.swift */,
328 338 19565EC62AF8AD38007D6727 /* CNLiveShopNewProductController.swift */,
329 339 );
330   - path = "商品管理";
  340 + path = GoodsManager;
  341 + sourceTree = "<group>";
  342 + };
  343 + 19565ED02AF8D904007D6727 /* GoodsList */ = {
  344 + isa = PBXGroup;
  345 + children = (
  346 + 19565ECC2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift */,
  347 + 19565ECE2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift */,
  348 + );
  349 + path = GoodsList;
  350 + sourceTree = "<group>";
  351 + };
  352 + 19565ED12AF9FE56007D6727 /* GoodsManager */ = {
  353 + isa = PBXGroup;
  354 + children = (
  355 + 19565EC82AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift */,
  356 + );
  357 + path = GoodsManager;
  358 + sourceTree = "<group>";
  359 + };
  360 + 19565ED22AF9FE67007D6727 /* GoodsManager */ = {
  361 + isa = PBXGroup;
  362 + children = (
  363 + 19565ECA2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift */,
  364 + 19565ED32AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift */,
  365 + );
  366 + path = GoodsManager;
331 367 sourceTree = "<group>";
332 368 };
333 369 19BB1FE42AEB93850094D962 /* Model */ = {
334 370 isa = PBXGroup;
335 371 children = (
  372 + 19565ED22AF9FE67007D6727 /* GoodsManager */,
336 373 1926C2902AE0FD4500C71DC3 /* CNLiveDownSlideModel.swift */,
337 374 19BB1FE52AEB93B80094D962 /* CNLiveShopUserInfoModel.swift */,
338 375 19BB1FE72AECAD060094D962 /* CNLiveShopConsoleModel.swift */,
... ... @@ -689,6 +726,7 @@
689 726 7C83B43C2A52B899004BF4A4 /* ViewModel */ = {
690 727 isa = PBXGroup;
691 728 children = (
  729 + 19565ED12AF9FE56007D6727 /* GoodsManager */,
692 730 7C83B43D2A52B8BA004BF4A4 /* CNHomePageViewModel.swift */,
693 731 1926C28E2AE0D76C00C71DC3 /* CNLiveDownSlideViewModel.swift */,
694 732 19BB1FE22AEB8B7C0094D962 /* CNLiveShopConsoleViewModel.swift */,
... ... @@ -713,6 +751,7 @@
713 751 7CD675232A26F8F8008354C1 /* View */ = {
714 752 isa = PBXGroup;
715 753 children = (
  754 + 19565ED02AF8D904007D6727 /* GoodsList */,
716 755 7CD675372A2740B0008354C1 /* CNUpSlideViewRemindView.swift */,
717 756 7CD6753B2A2740B0008354C1 /* CNDownSlideView.swift */,
718 757 7CD675382A2740B0008354C1 /* CNMainView.swift */,
... ... @@ -739,7 +778,7 @@
739 778 7CD6754D2A2840B9008354C1 /* Controller */ = {
740 779 isa = PBXGroup;
741 780 children = (
742   - 19565EC32AF8ACC2007D6727 /* 商品管理 */,
  781 + 19565EC32AF8ACC2007D6727 /* GoodsManager */,
743 782 19BB1FDE2AEA3A450094D962 /* CNSlideBaseNavigationController.swift */,
744 783 7CD6754E2A2840B9008354C1 /* CNMetaCodeHomePageController.swift */,
745 784 19123FC02ABC11170075C883 /* CNWebViewController.swift */,
... ... @@ -1055,6 +1094,7 @@
1055 1094 isa = PBXSourcesBuildPhase;
1056 1095 buildActionMask = 2147483647;
1057 1096 files = (
  1097 + 19565EC92AF8BEC6007D6727 /* CNLiveShopGoodListViewModel.swift in Sources */,
1058 1098 19BB1FE82AECAD060094D962 /* CNLiveShopConsoleModel.swift in Sources */,
1059 1099 19BB1FEE2AF0E1EC0094D962 /* CNLiveShopDetailViewModel.swift in Sources */,
1060 1100 19F1C2332AB5728B0083D06C /* CNIDCardView.swift in Sources */,
... ... @@ -1066,6 +1106,7 @@
1066 1106 7989B5C72A4BDC7200A19B10 /* CNLiveMineEarnListViewController.swift in Sources */,
1067 1107 79396EF12A31C21B0053E1AF /* CNLiveInfoShowViewController.swift in Sources */,
1068 1108 192336EB2AD9224300D47CD4 /* CNUpSlideViewController.swift in Sources */,
  1109 + 19565ECB2AF8C59C007D6727 /* CNLiveShopGoodsListModel.swift in Sources */,
1069 1110 7963989D2A260E6200D045EB /* CNLiveBaseViewController.swift in Sources */,
1070 1111 798A44FB2A30999900815935 /* CNLiveAlertTool.swift in Sources */,
1071 1112 19565EC02AF4DE0E007D6727 /* CNLiveShopDetailBtnsCell.swift in Sources */,
... ... @@ -1075,8 +1116,10 @@
1075 1116 19D2CE632AE8B65D00691757 /* CNLiveDownSlideTool.swift in Sources */,
1076 1117 790B1FB82A41B6A60074CF00 /* CNLiveMineMessageViewController.swift in Sources */,
1077 1118 19BB202B2AF382150094D962 /* CNLiveAdaptTool.swift in Sources */,
  1119 + 19565ECD2AF8D256007D6727 /* CNLiveShopGoodsListClassifyView.swift in Sources */,
1078 1120 798A44F22A30674200815935 /* CNLiveMineSubBodyListView.swift in Sources */,
1079 1121 799172382AF090CD00DC01A8 /* CNLiveShopBodyListView.swift in Sources */,
  1122 + 19565ED42AF9FEB4007D6727 /* CNLiveShopAddEditGoodsModel.swift in Sources */,
1080 1123 790D01822A2D88FC00C5978D /* CNLiveConfigMacro.swift in Sources */,
1081 1124 19CC4D4B2ADD086F00308E2A /* CNUpSlideDetailViewController.swift in Sources */,
1082 1125 7C83B4402A52BB2B004BF4A4 /* CNGlobalEnum.swift in Sources */,
... ... @@ -1167,6 +1210,7 @@
1167 1210 7C4931292A2D8BA8000E44B4 /* CNLiveBaseTabBarViewController.swift in Sources */,
1168 1211 79F4B1162A32B96B00993C03 /* CNLiveMineInfoViewController.swift in Sources */,
1169 1212 7CD6753F2A2740B0008354C1 /* CNDownSlideViewRemindView.swift in Sources */,
  1213 + 19565ECF2AF8D8F6007D6727 /* CNLiveShopGoodsListCell.swift in Sources */,
1170 1214 7CD6753C2A2740B0008354C1 /* CNUpSlideViewRemindView.swift in Sources */,
1171 1215 19BB1FEC2AF0AB8E0094D962 /* CNLiveDownShopDetailController.swift in Sources */,
1172 1216 798A44E82A30134400815935 /* CNLiveMineHeaderView.swift in Sources */,
... ...
metaCode/Classes/Environment/CNLiveEnvironment.swift
... ... @@ -31,8 +31,6 @@ let APPBaseWjjUrl: String = CNLiveEnvironmentManager.shared.base_wjj_url
31 31 let APPBaseWjjBUrl: String = CNLiveEnvironmentManager.shared.base_wjj_b_url
32 32 /// 网家家内电商接口
33 33 let APPBaseWjjShopUrl: String = CNLiveEnvironmentManager.shared.base_mjj_shop_url
34   -/// 商家版电商接口
35   -let APPBaseShopUrl: String = CNLiveEnvironmentManager.shared.base_shop_url
36 34 /// cms接口
37 35 let APPBaseCMSUrl: String = CNLiveEnvironmentManager.shared.base_cms_url
38 36 ///当前APP的环境
... ... @@ -80,8 +78,6 @@ class CNLiveEnvironmentManager: NSObject{
80 78 var img_token_url: String
81 79 /// 网家家电商域名请求
82 80 var base_mjj_shop_url: String
83   - /// 电商域名请求
84   - var base_shop_url: String
85 81 /// 元码webViewUA设置
86 82 var base_web_UA: String = "yuanma"
87 83 /// cms域名请求
... ... @@ -105,7 +101,6 @@ class CNLiveEnvironmentManager: NSObject{
105 101 self.base_wjj_url = ""
106 102 self.base_wjj_b_url = ""
107 103 self.base_mjj_shop_url = ""
108   - self.base_shop_url = ""
109 104 self.base_cms_url = ""
110 105 self.currentEnvironment = .development
111 106 }
... ... @@ -148,7 +143,6 @@ class CNLiveEnvironmentManager: NSObject{
148 143 self.base_wjj_b_url = "https://managemall.cnlive.com:8080"
149 144 self.base_wjj_url = "https://apiwjj.cnlive.com"
150 145 self.base_mjj_shop_url = "https://manageshop.cnlive.com"
151   - self.base_shop_url = "https://managemall.cnlive.com:8080"
152 146 self.base_cms_url = "https://cmsapi.cnlive.com"
153 147 }
154 148 //testFlight 环境配置
... ... @@ -166,7 +160,6 @@ class CNLiveEnvironmentManager: NSObject{
166 160 self.base_wjj_b_url = "https://managemall.cnlive.com:8080"
167 161 self.base_wjj_url = "https://apiwjj.cnlive.com"
168 162 self.base_mjj_shop_url = "https://manageshop.cnlive.com"
169   - self.base_shop_url = "https://managemall.cnlive.com:8080"
170 163 self.base_cms_url = "https://cmsapi.cnlive.com"
171 164 }
172 165 //production 生产环境配置
... ... @@ -184,7 +177,6 @@ class CNLiveEnvironmentManager: NSObject{
184 177 self.base_wjj_b_url = "https://managemall.cnlive.com:8080"
185 178 self.base_wjj_url = "https://apiwjj.cnlive.com"
186 179 self.base_mjj_shop_url = "https://manageshop.cnlive.com"
187   - self.base_shop_url = "https://managemall.cnlive.com:8080"
188 180 self.base_cms_url = "https://cmsapi.cnlive.com"
189 181 }
190 182  
... ...
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopNewProductController.swift 0 → 100644
  1 +//
  2 +// CNLiveShopNewProductController.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/11/6.
  6 +// 新增商品
  7 +
  8 +import Foundation
  9 +
  10 +///
  11 +enum CNLiveShopGoodsAddEditType{
  12 +
  13 + /// 新增商品
  14 + case add
  15 + /// 编辑商品
  16 + case edit
  17 +}
  18 +
  19 +class CNLiveShopNewProductController:CNLiveBaseViewController{
  20 +
  21 + var type:CNLiveShopGoodsAddEditType = .add
  22 + lazy var bgScrollView :UIScrollView = {
  23 + let bgScrollView = UIScrollView(frame: CGRect(x: 0, y: KNavigationHeight, width: KSreenWidth, height: KSreenHeight-KNavigationHeight-KTabBarHeight))
  24 + bgScrollView.showsVerticalScrollIndicator = false
  25 + return bgScrollView
  26 + }()
  27 +
  28 + lazy var dataModel: CNLiveShopAddEditGoodsModel = {
  29 + let dataModel = CNLiveShopAddEditGoodsModel()
  30 + return dataModel
  31 + }()
  32 +
  33 + override func viewDidLoad() {
  34 + super.viewDidLoad()
  35 + self.setUI()
  36 + self.bgScrollView.backgroundColor = .red
  37 + self.view.addSubview(self.bgScrollView)
  38 + self.type = .add
  39 + }
  40 + func setUI(){
  41 + navigationBarHidden = false
  42 + titleName = "新增商品"
  43 +
  44 + }
  45 + func initBgScrollViewContentView(){
  46 + if self.type == .add{
  47 + self.dataModel.initDataSource()
  48 + self.dataModel.list
  49 + }else if self.type == .edit{
  50 +
  51 + }else{
  52 +
  53 + }
  54 +
  55 + }
  56 +
  57 +}
... ...
metaCode/Classes/Main/HomePage/Controller/GoodsManager/CNLiveShopProductManagerController.swift 0 → 100644
  1 +//
  2 +// CNLiveShopProductManagerController.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/11/6.
  6 +// 商品管理
  7 +
  8 +import Foundation
  9 +
  10 +class CNLiveShopProductManagerController:CNLiveBaseViewController, UITableViewDataSource, UITableViewDelegate{
  11 +
  12 + let kCNLiveShopGoodsListCellIdentifier = "kCNLiveShopGoodsListCellIdentifier"
  13 +
  14 +
  15 + // MARK: - 懒加载
  16 + ///数据源
  17 + lazy var dataArray: NSMutableArray = {
  18 + var dataArray = NSMutableArray()
  19 + return dataArray
  20 + }()
  21 +
  22 + lazy var classifyView: CNLiveShopGoodsListClassifyView = {
  23 + let classifyView = CNLiveShopGoodsListClassifyView(frame: CGRect(x: 0, y: KNavigationHeight, width: KSreenWidth, height: 44))
  24 + classifyView.backgroundColor = .white
  25 + return classifyView
  26 + }()
  27 + lazy var addBtn: UIButton = {
  28 + let addBtn = UIButton(type: .custom)
  29 + addBtn.frame = CGRect(x: 0, y: 0, width: 100, height:KNavigationHeight-KStatusBarHeight )
  30 + addBtn.addTarget(self, action: #selector(addBtnAction), for: .touchUpInside)
  31 + addBtn.setTitle("新增商品", for: .normal)
  32 + addBtn.setTitleColor(HexColor("#666666"), for: .normal)
  33 + return addBtn
  34 + }()
  35 + lazy var tableView : UITableView = {
  36 + let tableView = UITableView(frame: .zero, style: .plain)
  37 + tableView.dataSource = self
  38 + tableView.delegate = self
  39 + tableView.separatorStyle = .none
  40 + tableView.rowHeight = 167
  41 + tableView.register(CNLiveShopGoodsListCell.self, forCellReuseIdentifier: kCNLiveShopGoodsListCellIdentifier)
  42 + return tableView
  43 + }()
  44 +
  45 + override func viewDidLoad() {
  46 + super.viewDidLoad()
  47 + self.setUI()
  48 + self.getGoodsListApi(page: "1")
  49 + }
  50 + func setUI(){
  51 + navigationBarHidden = false
  52 + titleName = "商品管理"
  53 + rightNavBtns = [self.addBtn]
  54 + self.view.addSubview(self.classifyView)
  55 + self.view.addSubview(tableView)
  56 + tableView.frame = CGRect(x: 0, y:self.classifyView.bottom , width: KSreenWidth, height: KSreenHeight - self.classifyView.bottom)
  57 + }
  58 +
  59 + // MARK: - UITableViewDelegate
  60 + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
  61 + return self.dataArray.count
  62 + }
  63 +
  64 + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
  65 + let goodsModel = self.dataArray[indexPath.row] as! CNLiveShopGoodsListModel
  66 + guard let cell = tableView.dequeueReusableCell(withIdentifier: kCNLiveShopGoodsListCellIdentifier) as? CNLiveShopGoodsListCell
  67 + else {
  68 + let cell = CNLiveShopGoodsListCell()
  69 + cell.goodsModel = goodsModel
  70 + return cell
  71 + }
  72 +
  73 + cell.goodsModel = goodsModel
  74 + return cell
  75 + }
  76 + func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
  77 +
  78 + let goodsModel = self.dataArray[indexPath.row] as! CNLiveShopGoodsListModel
  79 +
  80 + }
  81 + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
  82 + return 167
  83 + }
  84 +
  85 + // MARK: - BtnAction
  86 + @objc func addBtnAction(){
  87 +
  88 + currentViewController()?.navigationController?.pushViewController(CNLiveShopNewProductController(), animated: true)
  89 + }
  90 +
  91 + //MARK: - 网络请求获取商品列表
  92 + func getGoodsListApi(page:String)
  93 + {
  94 + showLoading(message: "")
  95 + CNLiveShopGoodListViewModel.requestGoodsList(shopId: DSUserInfoManager.shared.dsUserInfo.id, sortType: "1", page: page) { result, status in
  96 + hiddenLoading()
  97 + if status == .success{
  98 + self.dataArray.addObjects(from: result as! [CNLiveShopGoodsListModel])
  99 + let newDataArray = NSMutableArray()
  100 + for goodsModel in self.dataArray {
  101 + if let model = goodsModel as? CNLiveShopGoodsListModel{
  102 + newDataArray.add(model)
  103 + }
  104 + }
  105 + self.dataArray.removeAllObjects()
  106 + self.dataArray.addObjects(from: newDataArray as! [Any])
  107 +
  108 + self.tableView.reloadData()
  109 + }else if (status == .failed){
  110 +// self.NetApiStatus = .apiError
  111 + }else if (status == .noNetwork){
  112 +
  113 +// self.NetApiStatus = .notNetwork
  114 + }
  115 + }
  116 +//
  117 + }
  118 +}
... ...
metaCode/Classes/Main/HomePage/Controller/商品管理/CNLiveShopNewProductController.swift deleted 100644 → 0
1   -//
2   -// CNLiveShopNewProductController.swift
3   -// metaCode
4   -//
5   -// Created by zx on 2023/11/6.
6   -// 新增商品
7   -
8   -import Foundation
9   -
10   -class CNLiveShopNewProductController:CNLiveBaseViewController{
11   -
12   -}
metaCode/Classes/Main/HomePage/Controller/商品管理/CNLiveShopProductManagerController.swift deleted 100644 → 0
1   -//
2   -// CNLiveShopProductManagerController.swift
3   -// metaCode
4   -//
5   -// Created by zx on 2023/11/6.
6   -// 商品管理
7   -
8   -import Foundation
9   -
10   -class CNLiveShopProductManagerController:CNLiveBaseViewController{
11   -
12   -// lazy var navView: UIView = {
13   -// let navView = UIView(frame: CGRect(x: 0, y: 0, width: KSreenWidth, height: KNavigationHeight))
14   -// navView.backgroundColor = .white
15   -// return navView
16   -// }()
17   -// lazy var titleLbl: UILabel = {
18   -// let titleLbl = UILabel(frame: CGRect(x: KSreenWidth*0.5-100, y: KStatusBarHeight, width: 200, height: KNavigationHeight-KStatusBarHeight))
19   -// titleLbl.text = "商品管理"
20   -// titleLbl.font = Font_18
21   -// titleLbl.textAlignment = .center
22   -// titleLbl.textColor = HexColor("#333333")
23   -// return titleLbl
24   -// }()
25   -
26   - lazy var addBtn: UIButton = {
27   - let addBtn = UIButton(type: .custom)
28   - addBtn.frame = CGRect(x: 0, y: 0, width: 100, height:KNavigationHeight-KStatusBarHeight )
29   - addBtn.addTarget(self, action: #selector(addBtnAction), for: .touchUpInside)
30   - addBtn.setTitle("新增商品", for: .normal)
31   - addBtn.setTitleColor(HexColor("#666666"), for: .normal)
32   - return addBtn
33   - }()
34   -
35   - override func viewDidLoad() {
36   - super.viewDidLoad()
37   - self.setUI()
38   - }
39   - func setUI(){
40   - navigationBarHidden = false
41   - titleName = "商品管理"
42   - rightNavBtns = [self.addBtn]
43   - }
44   -
45   - // MARK: - BtnAction
46   - @objc func addBtnAction(){
47   -
48   - }
49   -}
metaCode/Classes/Main/HomePage/View/GoodsList/CNLiveShopGoodsListCell.swift 0 → 100644
  1 +//
  2 +// CNLiveShopGoodsListCell.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/11/6.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +class CNLiveShopGoodsListCell: UITableViewCell {
  11 +
  12 + //goodsModel
  13 + var _goodsModel : CNLiveShopGoodsListModel?
  14 + var goodsModel : CNLiveShopGoodsListModel? {
  15 + get{
  16 + _goodsModel
  17 + }
  18 + set{
  19 + _goodsModel = newValue!
  20 + setupNewUI(model: _goodsModel!)
  21 + }
  22 + }
  23 + //MARK: - 懒加载
  24 + lazy var iconImgView :UIImageView = {
  25 + let iconImgView = UIImageView(frame: CGRect(x: 15, y: 15, width: 90, height: 90))
  26 + return iconImgView
  27 + }()
  28 + ///编辑按钮
  29 + lazy var editBtn: UIButton = {
  30 + let editBtn = UIButton(type: .custom)
  31 + editBtn.frame = CGRect(x: KSreenWidth-15*2-28, y: 0, width: 15*2+28, height: 15*2+20)
  32 + editBtn.setTitle("编辑", for: .normal)
  33 + editBtn.setTitleColor(HexColor("#333333"), for: .normal)
  34 + editBtn.titleLabel?.font = Font_15
  35 + editBtn.addTarget(self, action: #selector(editBtnAction), for: .touchUpInside)
  36 + return editBtn
  37 + }()
  38 + ///标题
  39 + lazy var titleLabel: UILabel = {
  40 + let titleLabel = UILabel.init(frame: CGRectMake(self.iconImgView.right+15, 15, self.editBtn.left-self.iconImgView.right-15*2, 21))
  41 + titleLabel.textColor = HexColor("#333333")
  42 + titleLabel.textAlignment = .left
  43 + titleLabel.font = Font_15
  44 + titleLabel.adjustsFontSizeToFitWidth=true
  45 + titleLabel.text = "啊啊啊啊啊"
  46 + return titleLabel
  47 + }()
  48 + ///副标题
  49 + lazy var subTitleLabel: UILabel = {
  50 + let subTitleLabel = UILabel.init(frame: CGRectMake(self.iconImgView.right+15, self.editBtn.bottom, KSreenWidth-self.iconImgView.right-15*2, 18))
  51 + subTitleLabel.textColor = HexColor("#999999")
  52 + subTitleLabel.textAlignment = .left
  53 + subTitleLabel.font = Font_13
  54 + subTitleLabel.adjustsFontSizeToFitWidth=true
  55 + subTitleLabel.text = "啊啊啊啊"
  56 + return subTitleLabel
  57 + }()
  58 + ///价格
  59 + lazy var priceLabel: UILabel = {
  60 + let priceLabel = UILabel.init(frame: CGRectMake(self.iconImgView.right+15, self.subTitleLabel.bottom+19, KSreenWidth-80-17-15*2-self.iconImgView.right, 27))
  61 + priceLabel.textColor = HexColor("#FF3355")
  62 + priceLabel.textAlignment = .left
  63 + priceLabel.font = Font_19
  64 + priceLabel.adjustsFontSizeToFitWidth=true
  65 + priceLabel.text = "10000.00"
  66 + return priceLabel
  67 + }()
  68 + ///底部line
  69 + lazy var bottomLineView :UIView = {
  70 + let bottomLineView = UIView(frame: CGRect(x: 0, y: 167-5, width: KSreenWidth, height: 5))
  71 + bottomLineView.backgroundColor = UIColor(hue:0.00, saturation:0.00, brightness:0.98, alpha:1.00)
  72 + return bottomLineView
  73 + }()
  74 + ///库存
  75 + lazy var countLabel: UILabel = {
  76 + let countLabel = UILabel.init(frame: CGRectMake(15, self.iconImgView.bottom+15, KSreenWidth-58-15-15*2, self.bottomLineView.top-self.iconImgView.bottom-15))
  77 + countLabel.textColor = HexColor("#333333")
  78 + countLabel.textAlignment = .left
  79 + countLabel.font = Font_15
  80 + countLabel.adjustsFontSizeToFitWidth=true
  81 + countLabel.text = "库存:10000"
  82 + return countLabel
  83 + }()
  84 + ///编辑库存按钮
  85 + lazy var editCountBtn: UIButton = {
  86 + let editCountBtn = UIButton(type: .custom)
  87 + editCountBtn.frame = CGRect(x: KSreenWidth-15-58, y: self.countLabel.top, width: 58, height: self.countLabel.height)
  88 + editCountBtn.setTitle("编辑库存", for: .normal)
  89 + editCountBtn.setTitleColor(HexColor("#61C464"), for: .normal)
  90 + editCountBtn.titleLabel?.font = Font_14
  91 + editCountBtn.addTarget(self, action: #selector(editCountBtnAction), for: .touchUpInside)
  92 + return editCountBtn
  93 + }()
  94 +
  95 + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
  96 + super.init(style: style, reuseIdentifier: reuseIdentifier)
  97 + self.selectionStyle = .none
  98 + contentView.backgroundColor = .white
  99 + contentView.addSubview(self.iconImgView)
  100 + contentView.addSubview(self.editBtn)
  101 + contentView.addSubview(self.titleLabel)
  102 + contentView.addSubview(self.subTitleLabel)
  103 + contentView.addSubview(self.priceLabel)
  104 + contentView.addSubview(self.bottomLineView)
  105 + contentView.addSubview(self.countLabel)
  106 + contentView.addSubview(self.editCountBtn)
  107 +
  108 + }
  109 +
  110 + required init?(coder: NSCoder) {
  111 + fatalError("init(coder:) has not been implemented")
  112 + }
  113 +
  114 + func setupNewUI(model:CNLiveShopGoodsListModel){
  115 + self.iconImgView.kf.setImage(with: URL(string: model.simg ?? ""))
  116 + self.titleLabel.text = model.title ?? ""
  117 + self.subTitleLabel.text = model.ads ?? ""
  118 + self.priceLabel.text = "¥"+(model.price ?? "0.00")
  119 + if model.state == 2{
  120 + //设置 上架
  121 + }else{
  122 + //设置 下架
  123 + }
  124 + self.countLabel.text = "库存: "+(model.count ?? "0")
  125 + }
  126 +
  127 + // MARK: - BtnAction
  128 + @objc func editBtnAction(){
  129 +
  130 + }
  131 + @objc func editCountBtnAction(){
  132 +
  133 + }
  134 +
  135 +}
... ...
metaCode/Classes/Main/HomePage/View/GoodsList/CNLiveShopGoodsListClassifyView.swift 0 → 100644
  1 +//
  2 +// CNLiveShopGoodsListClassifyView.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/11/6.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +class CNLiveShopGoodsListClassifyView: UIView {
  11 +
  12 + //最新
  13 + lazy var lastestBtn: UIButton = {
  14 + let lastestBtn = UIButton(type: .custom)
  15 + lastestBtn.frame = CGRect(x: 0, y: 0, width: KSreenWidth*0.5, height: self.height)
  16 + lastestBtn.setTitle("最新", for: .normal)
  17 + lastestBtn.setTitle("最新", for: .selected)
  18 + lastestBtn.titleLabel?.font = Font_14
  19 + lastestBtn.setTitleColor(HexColor("#999999"), for: .normal)
  20 + lastestBtn.setTitleColor(HexColor("#FC1541"), for: .selected)
  21 + lastestBtn.addTarget(self, action: #selector(lastestBtnAction), for: .touchUpInside)
  22 + return lastestBtn
  23 + }()
  24 +
  25 + //价格 后面再完善
  26 + lazy var priceBtn: UIButton = {
  27 + let priceBtn = UIButton(type: .custom)
  28 + priceBtn.frame = CGRect(x: KSreenWidth*0.5, y: 0, width: KSreenWidth*0.5, height: self.height)
  29 + priceBtn.setTitle("价格", for: .normal)
  30 + priceBtn.setTitle("价格", for: .selected)
  31 + priceBtn.titleLabel?.font = Font_14
  32 + priceBtn.setTitleColor(HexColor("#999999"), for: .normal)
  33 + priceBtn.setTitleColor(HexColor("#FC1541"), for: .selected)
  34 + priceBtn.addTarget(self, action: #selector(priceBtnAction), for: .touchUpInside)
  35 + return priceBtn
  36 + }()
  37 +
  38 + override init(frame: CGRect) {
  39 + super.init(frame: frame)
  40 + self.setUI()
  41 + }
  42 +
  43 + func setUI(){
  44 + self.addSubview(self.lastestBtn)
  45 + self.addSubview(self.priceBtn)
  46 + self.lastestBtn.isSelected = true
  47 + }
  48 +
  49 + required init?(coder: NSCoder) {
  50 + fatalError("init(coder:) has not been implemented")
  51 + }
  52 +
  53 + @objc func priceBtnAction(){
  54 + self.priceBtn.isSelected = true
  55 + self.lastestBtn.isSelected = false
  56 + }
  57 + @objc func lastestBtnAction(){
  58 + self.lastestBtn.isSelected = true
  59 + self.priceBtn.isSelected = false
  60 + }
  61 +}
  62 +
... ...
metaCode/Classes/Main/HomePage/ViewModel/CNLiveShopConsoleViewModel.swift
... ... @@ -17,7 +17,8 @@ class CNLiveShopConsoleViewModel: NSObject {
17 17 param.setValue(UserInfoManager.shared.userInfo.uid, forKey: "uid")
18 18 CNLiveNetworking.setAllowRequestDefaultArgument(true)
19 19 CNLiveNetworking.setupShowDataResult(false)
20   - CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseShopUrl+"/api/v1/isSellerNew", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  20 + CNLiveNetworking.setupDSRequest(true)
  21 + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/isSellerNew", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
21 22 hiddenLoading()
22 23 if (error == nil) {
23 24 let resp = result as! NSDictionary
... ...
metaCode/Classes/Main/HomePage/ViewModel/CNLiveShopDetailViewModel.swift
... ... @@ -20,7 +20,8 @@ class CNLiveShopDetailViewModel:NSObject{
20 20  
21 21 CNLiveNetworking.setAllowRequestDefaultArgument(true)
22 22 CNLiveNetworking.setupShowDataResult(false)
23   - CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseShopUrl+"/api/v1/index", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  23 + CNLiveNetworking.setupDSRequest(true)
  24 + CNLiveNetworking.requestNetwork(with: .POST, urlString: APPBaseWjjBUrl+"/api/v1/index", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
24 25 hiddenLoading()
25 26 if (error == nil) {
26 27 let resp = result as! NSDictionary
... ...
metaCode/Classes/Main/HomePage/ViewModel/GoodsManager/CNLiveShopGoodListViewModel.swift 0 → 100644
  1 +//
  2 +// CNLiveShopGoodListViewModel.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/11/6.
  6 +//
  7 +
  8 +import Foundation
  9 +import CNLiveRequestBastKit
  10 +
  11 +class CNLiveShopGoodListViewModel:NSObject{
  12 + /// 商品列表获取
  13 + /// - Parameters:
  14 + /// - shopId:id
  15 + /// - sortType:排序类型 1新品 2价格从底到高 3 价格从高到底
  16 + /// - page:页数 1
  17 + static func requestGoodsList(shopId:String?,sortType:String?,page:String?,resultBlock: @escaping downSlideResultBlock) {
  18 + let param = NSMutableDictionary()
  19 + param.setValue(shopId, forKey: "shop_id")
  20 + param.setValue(sortType ?? "1", forKey: "type")
  21 + param.setValue("0", forKey: "state")
  22 + param.setValue("", forKey: "category_id")
  23 + param.setValue("", forKey: "keyword")
  24 + param.setValue(page ?? "1", forKey: "page")
  25 +
  26 +
  27 + CNLiveNetworking.setAllowRequestDefaultArgument(true)
  28 + CNLiveNetworking.setupShowDataResult(false)
  29 + CNLiveNetworking.setupDSRequest(true)
  30 + CNLiveNetworking.requestNetwork(with: .GET, urlString: APPBaseWjjBUrl+"/api/v1/getGoodsList", param: param as! [String : String], cacheType: .networkOnly) { task, result, error in
  31 + hiddenLoading()
  32 + if (error == nil) {
  33 + let resp = result as! NSDictionary
  34 + var dataArr:[BaseModel] = []
  35 + let respArr = resp["data"] as! NSArray
  36 + for dic in respArr{
  37 + let dataDic = dic as! NSDictionary
  38 + let goodsListModel = newDictionaryToModel(dataDic as! [String : Any], CNLiveShopGoodsListModel.self)
  39 + dataArr.append(goodsListModel)
  40 + }
  41 + resultBlock(dataArr,.success)
  42 + }else{
  43 + resultBlock(NSNull(),.failed)
  44 + }
  45 + }
  46 + }
  47 +}
... ...
metaCode/Classes/Main/Model/GoodsManager/CNLiveShopAddEditGoodsModel.swift 0 → 100644
  1 +//
  2 +// CNLiveShopAddEditGoodsModel.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/11/7.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +class CNLiveShopAddEditGoodsModel: BaseModel {
  11 + ///列表
  12 + var list = [CNLiveShopAddEditGoodsListModel]()
  13 + func initDataSource(){
  14 + var dataSource =
  15 + [ ["style":"1","isHaveTo":true,"title":"商品分类","contentType":"2"],
  16 + ["style":"1","isHaveTo":true,"title":"店铺分类","contentType":"2"],
  17 + ["style":"2","title":"基本信息"],
  18 + ["style":"3","isHaveTo":true,"title":"商品轮播","isDisplayLine":true,"isAbleSelectVideo":true,"isAbleSelectCover":true,"maxSelectImageCount":"7"],
  19 + ["style":"1","isHaveTo":true,"title":"商品名称","isDisplayLine":true,"contentType":"1"],
  20 + ["style":"4","isHaveTo":false,"title":"商品副标题","isDisplayLine":true,"placeholder":"请在此输入..."],
  21 + ["style":"1","isHaveTo":true,"title":"本店售价","subtitle":"(实际售价)","isDisplayLine":true,"contentTextFieldkeyboardType":"2","decimalLength":"2","contentTextColor":"0xFC1541","contentType":"1"],
  22 + ["style":"1","isHaveTo":true,"title":"市场售价","isDisplayLine":true,"contentTextFieldkeyboardType":"2","decimalLength":"2","contentType":"1"],
  23 + ["style":"1","isHaveTo":false,"title":"商品重量","subtitle":"(kg)","isDisplayLine":true,"contentTextFieldkeyboardType":"2","decimalLength":"3","contentType":"1"],
  24 + ["style":"5","isHaveTo":false,"title":"最低起售","subtitle":"(件)","isDisplayLine":true,"desc":"如起售数超出库存买家无法购买","decimalLength":"3","contentType":"4"],
  25 + ["style":"1","isHaveTo":false,"title":"上架","contentType":"3"],
  26 + ["style":"2","title":"通用信息"],
  27 + ["style":"3","isHaveTo":true,"title":"商品详情图","isDisplayLine":true,"maxSelectImageCount":"9"],
  28 + ["style":"1","isHaveTo":false,"title":"商品运费","subtitle":"(0为包邮)","isDisplayLine":true,"contentTextFieldkeyboardType":"2","decimalLength":"2","contentType":"1"],
  29 + ["style":"1","isHaveTo":false,"title":"是否支持退货","isDisplayLine":true,"contentType":"3"],
  30 + ["style":"1","isHaveTo":false,"title":"商品单位","contentTextFieldkeyboardType":"1","isDisplayLine":true,"contentType":"1"],
  31 + ["style":"2","title":"通用参数(*为必填)","touchSubtitle":"添加通用参数"],
  32 + ["style":"1","isHaveTo":true,"title":"品名","isDisplayLine":true,"contentType":"1"],
  33 + ["style":"1","isHaveTo":true,"title":"规格","isDisplayLine":true,"contentType":"1"],
  34 + ["style":"4","isHaveTo":true,"title":"寄送区域","isDisplayLine":true,"contentType":"1","placeholder":"请填写不配送**地区、仅配送**地区或全国包邮"],
  35 + ["style":"1","isHaveTo":true,"title":"发货时效","isDisplayLine":true,"contentType":"1"],
  36 + ["style":"1","isHaveTo":false,"title":"口味","contentTextFieldkeyboardType":"1","isDisplayLine":true,"contentType":"1","isDelect":true],
  37 + ["style":"1","isHaveTo":false,"title":"产地","contentTextFieldkeyboardType":"1","isDisplayLine":true,"contentType":"1","isDelect":true],
  38 + ["style":"1","isHaveTo":false,"title":"存储方式及期限","contentTextFieldkeyboardType":"1","isDisplayLine":true,"contentType":"1","isDelect":true]
  39 + ]
  40 +
  41 + for dic in dataSource{
  42 + let mdl = newDictionaryToModel(dic, CNLiveShopAddEditGoodsListModel.self)
  43 + list.append(mdl as! CNLiveShopAddEditGoodsListModel)
  44 +
  45 + }
  46 + }
  47 +}
  48 +
  49 +
  50 +class CNLiveShopAddEditGoodsListModel: BaseModel {
  51 + /// 商品id
  52 + var id: String?
  53 + /// 样式4中 二是标题 三是选取图片 四是输入框 五添加起售数量
  54 + var style:Int = 0
  55 + /// 是否必须
  56 + var isHaveTo: Bool?
  57 + /// 标题
  58 + var title: String?
  59 + /// 副标题
  60 + var subtitle: String?
  61 + /// 对主标题下方进行说明文字
  62 + var desc: String?
  63 + /// 自定义规格内容输入
  64 + var content: String?
  65 + /// 副标题点击样式
  66 + var touchSubtitle: String?
  67 + /// style=4 占位标识
  68 + var placeholder: String?
  69 + /// 是否显示底部的线
  70 + var isDisplayLine: Bool?
  71 + /// 样式一属性 内容输入框键盘类型 1默认类型 2数字类型带小数点
  72 + var contentTextFieldkeyboardType:Int = 0
  73 + /// 样式一属性 小数点位数
  74 + var decimalLength:Int = 0
  75 + /// 样式一属性 内容输入框颜色 默认0x787878
  76 + var contentTextColor: String?
  77 + /// 样式一属性 1输入框 2选择 3开关 4可以增加数量
  78 + var contentType:Int = 0
  79 + /// 样式一属性 是不是显示输入框右边删除按钮
  80 + var isDelect: Bool?
  81 + /// 样式三属性 是否可以选择视频
  82 + var isAbleSelectVideo: Bool?
  83 + /// 样式三属性 是否可以选择主页
  84 + var isAbleSelectCover: Bool?
  85 + /// 样式三属性 最多可以选取多少张图片
  86 + var maxSelectImageCount:Int = 0
  87 +}
... ...
metaCode/Classes/Main/Model/GoodsManager/CNLiveShopGoodsListModel.swift 0 → 100644
  1 +//
  2 +// CNLiveShopGoodsListModel.swift
  3 +// metaCode
  4 +//
  5 +// Created by zx on 2023/11/6.
  6 +//
  7 +
  8 +import Foundation
  9 +
  10 +class CNLiveShopGoodsListModel:BaseModel{
  11 + ///商品id
  12 + var id: String?
  13 + ///商品名称
  14 + var title: String?
  15 + ///商品图片
  16 + var simg: String?
  17 +// var img: String?
  18 + ///商品价格
  19 + var price: String?
  20 + ///商品介绍
  21 + var ads: String?
  22 + ///商品分类
  23 + var groupid: String?
  24 + ///店铺id
  25 + var shopid: String?
  26 +// var shop_id: String?
  27 + ///店铺分类id
  28 + var category_id: String?
  29 + ///1下架 2上架
  30 + var state: Int?
  31 + ///库存
  32 + var count: String?
  33 + ///1普通商品 2文创商品
  34 + var shop_type: String?
  35 + ///排序
  36 + var ord: String?
  37 + ///商品是否被选中(本地标记)
  38 + var select: Bool?
  39 + ///最小购买数量
  40 + var min_buy_num: String?
  41 +}
... ...