xiaoxi 5 年 前
コミット
67c01dd719

BIN
CAISHEN.xcworkspace/xcuserdata/xiaoxi.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 1
CAISHEN/AppDelegate/KXBaseViewController.m

@@ -20,7 +20,7 @@
20 20
     [super viewDidLoad];
21 21
     // Do any additional setup after loading the view.
22 22
     self.automaticallyAdjustsScrollViewInsets=NO;
23
-    self.view.backgroundColor= [UIColor KXColorWithRed:239 green:239 blue:244];
23
+    self.view.backgroundColor= [UIColor KXColorWithHex:0xf5f5f5];
24 24
     [self createTitleLabel];
25 25
     [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(reach:) name:KXNETREACHABLE object:nil];
26 26
     [self checkReach];

+ 10 - 0
CAISHEN/SellPhone2/Mine/Controller/KXSPMineViewController.swift

@@ -16,6 +16,7 @@ class KXSPMineViewController: KXBaseViewController, UITableViewDelegate, UITable
16 16
 
17 17
     override func viewDidLoad() {
18 18
         super.viewDidLoad()
19
+        setNav()
19 20
         setUpUI()
20 21
     }
21 22
     
@@ -29,6 +30,15 @@ class KXSPMineViewController: KXBaseViewController, UITableViewDelegate, UITable
29 30
         view.addSubview(tableView)
30 31
     }
31 32
     
33
+    func setNav() -> Void {
34
+        navigationController?.navigationBar.shadowImage = UIImage()
35
+        navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
36
+        navigationController?.navigationBar.barTintColor = UIColor.gradientHeight(from: UIColor.kxColor(withHex: 0xDB8DFF), to: UIColor.kxColor(withHex: 0xE9C4FA), withHeight: Int32(NavHeight))
37
+        let navView: UIView = UIView(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 44))
38
+        navView.backgroundColor = UIColor.gradientHeight(from: UIColor.kxColor(withHex: 0xE9C4FA), to: UIColor.kxColor(withHex: 0xf5f5f5), withHeight: 44)
39
+        view.addSubview(navView)
40
+    }
41
+    
32 42
     lazy var tableView: UITableView = {
33 43
         let table: UITableView = UITableView.init(frame: CGRect.init(x: 12, y: 0, width: SCREEN_WIDTH-24, height: SCREEN_HEIGHT-NavHeight-TabbarHeight), style: .plain)
34 44
         table.backgroundColor = UIColor.clear

+ 7 - 0
CAISHEN/SellPhone2/Order/Controller/KXSPOrderDetailViewController.swift

@@ -14,6 +14,7 @@ class KXSPOrderDetailViewController: KXBaseViewController, UITableViewDelegate,
14 14
     
15 15
     override func viewDidLoad() {
16 16
         super.viewDidLoad()
17
+        setNav()
17 18
         addBackBtn()
18 19
         setUpUI()
19 20
     }
@@ -23,6 +24,12 @@ class KXSPOrderDetailViewController: KXBaseViewController, UITableViewDelegate,
23 24
         view.addSubview(tableView)
24 25
     }
25 26
     
27
+    func setNav() -> Void {
28
+        let navView: UIView = UIView(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 44))
29
+        navView.backgroundColor = UIColor.gradientHeight(from: UIColor.kxColor(withHex: 0xE9C4FA), to: UIColor.kxColor(withHex: 0xf5f5f5), withHeight: 44)
30
+        view.addSubview(navView)
31
+    }
32
+    
26 33
     lazy var tableView: UITableView = {
27 34
         let table: UITableView = UITableView.init(frame: CGRect.init(x: 12, y: 0, width: SCREEN_WIDTH-24, height: SCREEN_HEIGHT-NavHeight), style: .plain)
28 35
         table.backgroundColor = UIColor.clear

+ 74 - 35
CAISHEN/SellPhone2/Order/Controller/KXSPOrderViewController.swift

@@ -17,6 +17,7 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
17 17
     
18 18
     override func viewDidLoad() {
19 19
         super.viewDidLoad()
20
+        setNav()
20 21
         setUpUI()
21 22
     }
22 23
     
@@ -25,6 +26,15 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
25 26
         tableView.mj_header.beginRefreshing()
26 27
     }
27 28
     
29
+    func setNav() -> Void {
30
+        navigationController?.navigationBar.shadowImage = UIImage()
31
+        navigationController?.navigationBar.setBackgroundImage(UIImage(), for: UIBarMetrics.default)
32
+        navigationController?.navigationBar.barTintColor = UIColor.gradientHeight(from: UIColor.kxColor(withHex: 0xDB8DFF), to: UIColor.kxColor(withHex: 0xE9C4FA), withHeight: Int32(NavHeight))
33
+        let navView: UIView = UIView(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 44))
34
+        navView.backgroundColor = UIColor.gradientHeight(from: UIColor.kxColor(withHex: 0xE9C4FA), to: UIColor.kxColor(withHex: 0xf5f5f5), withHeight: 44)
35
+        view.addSubview(navView)
36
+    }
37
+    
28 38
     override func setUpUI() {
29 39
         name = "订单"
30 40
         view.addSubview(segView)
@@ -32,7 +42,7 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
32 42
     }
33 43
     
34 44
     lazy var segView: UISegmentedControl = {
35
-        let seg: UISegmentedControl = UISegmentedControl.init(items: ["手机","平板","电脑"])
45
+        let seg: UISegmentedControl = UISegmentedControl.init(items: ["手机","电脑","平板"])
36 46
         seg.frame = CGRect.init(x: 12, y: 0, width: SCREEN_WIDTH-24, height: Fitesize(48))
37 47
         seg.layer.cornerRadius = 8
38 48
         seg.setTitleTextAttributes([NSAttributedString.Key.font: UIFont.init(name: "PingFangSC-Light", size: Fitesize(17))!], for: .normal)
@@ -48,10 +58,10 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
48 58
             module = "phone"
49 59
             tableView.mj_header.beginRefreshing()
50 60
         case 1:
51
-            module = "pad"
61
+            module = "computer"
52 62
             tableView.mj_header.beginRefreshing()
53 63
         case 2:
54
-            module = "computer"
64
+            module = "pad"
55 65
             tableView.mj_header.beginRefreshing()
56 66
         default:
57 67
             break
@@ -59,7 +69,7 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
59 69
     }
60 70
     
61 71
     lazy var tableView: UITableView = {
62
-        let table: UITableView = UITableView.init(frame: CGRect.init(x: 12, y: Fitesize(48), width: SCREEN_WIDTH-24, height: SCREEN_HEIGHT-NavHeight-Fitesize(48)), style: .grouped)
72
+        let table: UITableView = UITableView.init(frame: CGRect.init(x: 12, y: Fitesize(48), width: SCREEN_WIDTH-24, height: SCREEN_HEIGHT-NavHeight-Fitesize(48)-TabbarHeight), style: .grouped)
63 73
         table.showsVerticalScrollIndicator = false
64 74
         table.showsHorizontalScrollIndicator = false
65 75
         table.delegate = self
@@ -70,6 +80,8 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
70 80
         table.estimatedSectionHeaderHeight = 0
71 81
         table.estimatedSectionFooterHeight = 0
72 82
         table.separatorStyle = .none
83
+        table.tableHeaderView = UIView(frame: CGRect(x: 0, y: 0, width: table.frame.width, height: 0.1))
84
+        table.tableFooterView = UIView(frame: CGRect(x: 0, y: 0, width: table.frame.width, height: 0.1))
73 85
         let header = MJRefreshNormalHeader.init()
74 86
         header.setRefreshingTarget(self, refreshingAction: #selector(refreshWithHeader(header:)))
75 87
         table.mj_header = header
@@ -97,33 +109,35 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
97 109
     }
98 110
     
99 111
     func requestDataSourceWithPage(Page : Int) -> Void {
100
-        let urlString: String = KXURL + "/recycle/getList"
101
-        KXHTTP.post(urlString, params: ["page": Page, "module": module], success: { (json) in
102
-            let response: NSDictionary = json as! NSDictionary
103
-            let arr: NSArray = response["data"] as! [NSDictionary] as NSArray
104
-            if Page == 1 {
105
-                self.dataSource.removeAllObjects()
106
-            }
107
-            arr.enumerateObjects({ (obj, index, bool) in
108
-                var dict = obj as! Dictionary<String, Any>
109
-                let jsonString: String = dict["content"] as! String
110
-                let jssonData: Data = jsonString.data(using: .utf8)!
111
-                let jsonDict = try? JSONSerialization.jsonObject(with: jssonData, options: .mutableContainers)
112
-                let mo: KXAssessViewModel = KXAssessViewModel.yy_model(withJSON: jsonDict!)!
113
-                dict["content"] = mo
114
-                let combineMo: KXSPOrderCombineModel = KXSPOrderCombineModel.yy_model(withJSON: dict)!
115
-                self.dataSource.add(combineMo)
116
-            })
117
-            self.tableView.mj_header.endRefreshing()
118
-            self.tableView.mj_footer.endRefreshing()
119
-            self.tableView.reloadData()
120
-        }) { (error) in
121
-            if Page == 1 {
122
-                self.dataSource.removeAllObjects()
112
+        if KXLoginManager.shareInstance()?.isLogin() == true {
113
+            let urlString: String = KXURL + "/recycle/getList"
114
+            KXHTTP.post(urlString, params: ["page": Page, "module": module], success: { (json) in
115
+                let response: NSDictionary = json as! NSDictionary
116
+                let arr: NSArray = response["data"] as! [NSDictionary] as NSArray
117
+                if Page == 1 {
118
+                    self.dataSource.removeAllObjects()
119
+                }
120
+                arr.enumerateObjects({ (obj, index, bool) in
121
+                    var dict = obj as! Dictionary<String, Any>
122
+                    let jsonString: String = dict["content"] as! String
123
+                    let jssonData: Data = jsonString.data(using: .utf8)!
124
+                    let jsonDict = try? JSONSerialization.jsonObject(with: jssonData, options: .mutableContainers)
125
+                    let mo: KXAssessViewModel = KXAssessViewModel.yy_model(withJSON: jsonDict!)!
126
+                    dict["content"] = mo
127
+                    let combineMo: KXSPOrderCombineModel = KXSPOrderCombineModel.yy_model(withJSON: dict)!
128
+                    self.dataSource.add(combineMo)
129
+                })
130
+                self.tableView.mj_header.endRefreshing()
131
+                self.tableView.mj_footer.endRefreshing()
132
+                self.tableView.reloadData()
133
+            }) { (error) in
134
+                if Page == 1 {
135
+                    self.dataSource.removeAllObjects()
136
+                }
137
+                self.tableView.mj_header.endRefreshing()
138
+                self.tableView.mj_footer.endRefreshing()
139
+                self.tableView.reloadData()
123 140
             }
124
-            self.tableView.mj_header.endRefreshing()
125
-            self.tableView.mj_footer.endRefreshing()
126
-            self.tableView.reloadData()
127 141
         }
128 142
         
129 143
     }
@@ -150,6 +164,22 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
150 164
         navigationController?.pushViewController(detail, animated: true)
151 165
     }
152 166
     
167
+    func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
168
+        return UIView()
169
+    }
170
+    
171
+    func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
172
+        return 10
173
+    }
174
+    
175
+    func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
176
+        return UIView()
177
+    }
178
+    
179
+    func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
180
+        return 0.1
181
+    }
182
+    
153 183
 }
154 184
 
155 185
 class KXSPOrderTableViewCell: UITableViewCell {
@@ -230,17 +260,26 @@ class KXSPOrderTableViewCell: UITableViewCell {
230 260
     override func configTableViewCell(model: AnyObject, indexPath: NSIndexPath) {
231 261
         let mo: KXSPOrderCombineModel = model as! KXSPOrderCombineModel
232 262
         iconImageView.image = UIImage(named: "icon_check_" + mo.module + "_" + mo.content.type)
263
+        nameLabel.text = mo.content.type
233 264
         let att: NSMutableAttributedString = NSMutableAttributedString()
234 265
         att.append(NSAttributedString(string: "预估计:", attributes: [NSAttributedString.Key.foregroundColor: UIColor.kxColor(withHex: 0x666666), NSAttributedString.Key.font: UIFont(name: "PingFangSC-Regular", size: Fitesize(14))!]))
235 266
         att.append(NSAttributedString(string: mo.content.price, attributes: [NSAttributedString.Key.foregroundColor: UIColor.kxColor(withHex: 0xAD63FF), NSAttributedString.Key.font: UIFont(name: "PingFangSC-Medium", size: Fitesize(18))!]))
236
-        nameLabel.text = mo.content.type
237
-        xinghao.text = "手机型号:" + mo.content.type
238
-        priceLabel.text = "预估计:" + mo.content.price
267
+        priceLabel.attributedText = att
268
+        xinghao.text = "型号:" + mo.content.type
239 269
         neicun.text = "内存:" + mo.content.memory
240
-        yanse.text = "颜色:" + mo.content.color
241
-        shijian.text = "购买时间:" + mo.content.time
242 270
         chengse.text = "新旧成色:" + mo.content.quality
243 271
         weixiu.text = "维修:" + mo.content.maintain
272
+        if mo.module == "phone" {
273
+            yanse.text = "颜色:" + mo.content.color
274
+            shijian.text = "购买时间:" + mo.content.time
275
+        } else if mo.module == "pad" {
276
+            yanse.text = "网络模式:" + mo.content.netModel
277
+            shijian.text = "购买时间:" + mo.content.time
278
+        } else {
279
+            yanse.text = "硬盘:" + mo.content.hardDisk
280
+            shijian.text = "处理器:" + mo.content.cpu
281
+        }
282
+        
244 283
     }
245 284
     
246 285
     lazy var iconImageView: UIImageView = {