瀏覽代碼

sell phone

xiaoxi 6 年之前
父節點
當前提交
7b0dbd56b0

+ 4 - 0
CAISHEN.xcodeproj/project.pbxproj

@@ -181,6 +181,7 @@
181 181
 		7061820C1FD0FBB3000473F2 /* KXCreditCardModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 7061820B1FD0FBB3000473F2 /* KXCreditCardModel.m */; };
182 182
 		707017D221A3A41A005BEBB6 /* huishou.html in Resources */ = {isa = PBXBuildFile; fileRef = 707017D121A3A41A005BEBB6 /* huishou.html */; };
183 183
 		707017D421A3AA26005BEBB6 /* KXSPWebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 707017D321A3AA26005BEBB6 /* KXSPWebViewController.swift */; };
184
+		707017D621A3EB70005BEBB6 /* KXSPOrderCombineModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 707017D521A3EB70005BEBB6 /* KXSPOrderCombineModel.swift */; };
184 185
 		7071561A1FD7883A0088BD33 /* KXCustomServiceViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 707156191FD7883A0088BD33 /* KXCustomServiceViewController.m */; };
185 186
 		707528D92112B7560016FEC3 /* KXSCManageViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 707528D82112B7560016FEC3 /* KXSCManageViewController.m */; };
186 187
 		707528DC2112CD210016FEC3 /* KXSCAddViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 707528DB2112CD210016FEC3 /* KXSCAddViewController.m */; };
@@ -858,6 +859,7 @@
858 859
 		7061820B1FD0FBB3000473F2 /* KXCreditCardModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KXCreditCardModel.m; sourceTree = "<group>"; };
859 860
 		707017D121A3A41A005BEBB6 /* huishou.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = huishou.html; sourceTree = "<group>"; };
860 861
 		707017D321A3AA26005BEBB6 /* KXSPWebViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KXSPWebViewController.swift; sourceTree = "<group>"; };
862
+		707017D521A3EB70005BEBB6 /* KXSPOrderCombineModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KXSPOrderCombineModel.swift; sourceTree = "<group>"; };
861 863
 		707156181FD7883A0088BD33 /* KXCustomServiceViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KXCustomServiceViewController.h; sourceTree = "<group>"; };
862 864
 		707156191FD7883A0088BD33 /* KXCustomServiceViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = KXCustomServiceViewController.m; sourceTree = "<group>"; };
863 865
 		707528D72112B7560016FEC3 /* KXSCManageViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = KXSCManageViewController.h; sourceTree = "<group>"; };
@@ -2588,6 +2590,7 @@
2588 2590
 		76593232219BF804004ACF20 /* Model */ = {
2589 2591
 			isa = PBXGroup;
2590 2592
 			children = (
2593
+				707017D521A3EB70005BEBB6 /* KXSPOrderCombineModel.swift */,
2591 2594
 			);
2592 2595
 			path = Model;
2593 2596
 			sourceTree = "<group>";
@@ -4306,6 +4309,7 @@
4306 4309
 				762EAEF421703AD000838CFC /* KXInvoiceHomeCollectionViewCell.m in Sources */,
4307 4310
 				C428940B1F43FFE000933509 /* KXNewsModel.m in Sources */,
4308 4311
 				D11C725D2074D293006BB8A5 /* NSArray+AvoidCrash.m in Sources */,
4312
+				707017D621A3EB70005BEBB6 /* KXSPOrderCombineModel.swift in Sources */,
4309 4313
 				40415B4B2150F82F007D69D9 /* KXTRecycleOrderCell.m in Sources */,
4310 4314
 				701BE2F01FD651AA005B2046 /* KXNewMainPageViewController.m in Sources */,
4311 4315
 				D17834221F4FB730004FB01F /* KXEventCollectionViewCell.m in Sources */,

二進制
CAISHEN.xcworkspace/xcuserdata/xiaoxi.xcuserdatad/UserInterfaceState.xcuserstate


+ 1 - 0
CAISHEN/CAISHEN-Bridging-Header.h

@@ -43,3 +43,4 @@
43 43
 #import "KXCustomWebViewController.h"
44 44
 #import "KXAboutUsViewController.h"
45 45
 #import "KXAdviceBackViewController.h"
46
+#import "KXAssessViewModel.h"

+ 2 - 1
CAISHEN/SellPhone2/Home/HomePage/Controller/KXSPHomeViewController.m

@@ -152,7 +152,8 @@ static NSString *cellID = @"cellID";
152 152
 
153 153
 #pragma mark - 点击最底部质检标准图片
154 154
 - (void)onClickBottomImage {
155
-    NSLog(@"你点击了我");
155
+    KXSPWebViewController *web = [[KXSPWebViewController alloc] init];
156
+    [self.navigationController pushViewController:web animated:YES];
156 157
 }
157 158
 
158 159
 @end

+ 14 - 2
CAISHEN/SellPhone2/Order/Controller/KXSPOrderDetailViewController.swift

@@ -25,6 +25,7 @@ class KXSPOrderDetailViewController: KXBaseViewController, UITableViewDelegate,
25 25
     
26 26
     lazy var tableView: UITableView = {
27 27
         let table: UITableView = UITableView.init(frame: CGRect.init(x: 12, y: 0, width: SCREEN_WIDTH-24, height: SCREEN_HEIGHT-NavHeight), style: .plain)
28
+        table.backgroundColor = UIColor.clear
28 29
         table.showsVerticalScrollIndicator = false
29 30
         table.showsHorizontalScrollIndicator = false
30 31
         table.delegate = self
@@ -43,18 +44,27 @@ class KXSPOrderDetailViewController: KXBaseViewController, UITableViewDelegate,
43 44
     }()
44 45
     
45 46
     lazy var tableFooterView: UIView = {
46
-        let view: UIView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: tableView.frame.width, height: Fitesize(122)))
47
+        let view: UIView = UIView.init(frame: CGRect.init(x: 0, y: 0, width: SCREEN_WIDTH-24, height: Fitesize(122)))
47 48
         let button: UIButton = UIButton.init(type: .custom)
48 49
         button.frame = CGRect.init(x: Fitesize(40), y: Fitesize(74), width: view.frame.width-Fitesize(80), height: Fitesize(48))
49 50
         button.layer.cornerRadius = 24
50 51
         button.titleLabel?.font = UIFont.init(name: "PingFangSC-Light", size: Fitesize(17))
52
+        button.backgroundColor = UIColor.gradientWidth(from: UIColor.kxColor(withHex: 0xAD63FF), to: UIColor.kxColor(withHex: 0xDB8DFF), withWidth: Int32(button.frame.width))
51 53
         button.setTitleColor(UIColor.white, for: .normal)
54
+        button.setTitle("取消订单", for: .normal)
52 55
         button.addTarget(self, action: #selector(nextButtonAction(sender:)), for: .touchUpInside)
56
+        view.addSubview(button)
53 57
         return view
54 58
     }()
55 59
     
56 60
     @objc fileprivate func nextButtonAction(sender: UIButton) -> Void {
57
-        
61
+        let model: KXSPOrderCombineModel = dataSource[0] as! KXSPOrderCombineModel
62
+        let urlString: String = KXURL + "/recycle/delRecycle"
63
+        KXHTTP.post(urlString, params: ["id": model.id], success: { (json) in
64
+            self.navigationController?.popViewController(animated: true)
65
+        }) { (error) in
66
+            
67
+        }
58 68
     }
59 69
 
60 70
     func numberOfSections(in tableView: UITableView) -> Int {
@@ -67,6 +77,8 @@ class KXSPOrderDetailViewController: KXBaseViewController, UITableViewDelegate,
67 77
     
68 78
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
69 79
         let cell: KXSPOrderTableViewCell = tableView.dequeueReusableCell(withIdentifier: "KXSPOrderTableViewCell", for: indexPath) as! KXSPOrderTableViewCell
80
+        let model: KXSPOrderCombineModel = dataSource[indexPath.row] as! KXSPOrderCombineModel
81
+        cell.configTableViewCell(model: model, indexPath: indexPath as NSIndexPath)
70 82
         return cell
71 83
     }
72 84
     

+ 89 - 4
CAISHEN/SellPhone2/Order/Controller/KXSPOrderViewController.swift

@@ -20,6 +20,11 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
20 20
         setUpUI()
21 21
     }
22 22
     
23
+    override func viewDidAppear(_ animated: Bool) {
24
+        super.viewDidAppear(animated)
25
+        tableView.mj_header.beginRefreshing()
26
+    }
27
+    
23 28
     override func setUpUI() {
24 29
         name = "订单"
25 30
         view.addSubview(segView)
@@ -31,10 +36,28 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
31 36
         seg.frame = CGRect.init(x: 12, y: 0, width: SCREEN_WIDTH-24, height: Fitesize(48))
32 37
         seg.layer.cornerRadius = 8
33 38
         seg.setTitleTextAttributes([NSAttributedString.Key.font: UIFont.init(name: "PingFangSC-Light", size: Fitesize(17))!], for: .normal)
34
-        seg.tintColor = UIColor.base()
39
+        seg.tintColor = UIColor.kxColor(withHex: 0xAD63FF)
40
+        seg.addTarget(self, action: #selector(segViewClick(sender:)), for: UIControl.Event.valueChanged)
41
+        seg.selectedSegmentIndex = 0
35 42
         return seg
36 43
     }()
37 44
     
45
+    @objc func segViewClick(sender: UISegmentedControl) -> Void {
46
+        switch sender.selectedSegmentIndex {
47
+        case 0:
48
+            module = "phone"
49
+            tableView.mj_header.beginRefreshing()
50
+        case 1:
51
+            module = "pad"
52
+            tableView.mj_header.beginRefreshing()
53
+        case 2:
54
+            module = "computer"
55
+            tableView.mj_header.beginRefreshing()
56
+        default:
57
+            break
58
+        }
59
+    }
60
+    
38 61
     lazy var tableView: UITableView = {
39 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)
40 63
         table.showsVerticalScrollIndicator = false
@@ -47,9 +70,32 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
47 70
         table.estimatedSectionHeaderHeight = 0
48 71
         table.estimatedSectionFooterHeight = 0
49 72
         table.separatorStyle = .none
73
+        let header = MJRefreshNormalHeader.init()
74
+        header.setRefreshingTarget(self, refreshingAction: #selector(refreshWithHeader(header:)))
75
+        table.mj_header = header
76
+        
77
+        let footer : MJRefreshBackNormalFooter = MJRefreshBackNormalFooter.init()
78
+        footer.setRefreshingTarget(self, refreshingAction: #selector(refreshFooter(footer:)))
79
+        table.mj_footer = footer
80
+        
81
+        header.stateLabel.font = FontSize(14)
82
+        header.stateLabel.textColor = UIColor.detailTitle()
83
+        header.lastUpdatedTimeLabel.font = FontSize(14)
84
+        header.lastUpdatedTimeLabel.textColor = UIColor.detailTitle()
85
+        footer.stateLabel.textColor = UIColor.detailTitle()
50 86
         return table
51 87
     }()
52 88
     
89
+    @objc fileprivate func refreshWithHeader(header : MJRefreshHeader) {
90
+        page = 1
91
+        requestDataSourceWithPage(Page: page)
92
+    }
93
+    
94
+    @objc fileprivate func refreshFooter (footer : MJRefreshAutoFooter) {
95
+        page += 1
96
+        requestDataSourceWithPage(Page: page)
97
+    }
98
+    
53 99
     func requestDataSourceWithPage(Page : Int) -> Void {
54 100
         let urlString: String = KXURL + "/recycle/getList"
55 101
         KXHTTP.post(urlString, params: ["page": Page, "module": module], success: { (json) in
@@ -58,9 +104,26 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
58 104
             if Page == 1 {
59 105
                 self.dataSource.removeAllObjects()
60 106
             }
61
-            self.dataSource.addObjects(from: arr as! [Any])
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()
62 120
         }) { (error) in
63
-            
121
+            if Page == 1 {
122
+                self.dataSource.removeAllObjects()
123
+            }
124
+            self.tableView.mj_header.endRefreshing()
125
+            self.tableView.mj_footer.endRefreshing()
126
+            self.tableView.reloadData()
64 127
         }
65 128
         
66 129
     }
@@ -75,9 +138,18 @@ class KXSPOrderViewController: KXBaseViewController, UITableViewDelegate, UITabl
75 138
     
76 139
     func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
77 140
         let cell: KXSPOrderTableViewCell = tableView.dequeueReusableCell(withIdentifier: "KXSPOrderTableViewCell", for: indexPath) as! KXSPOrderTableViewCell
141
+        let model: KXSPOrderCombineModel = dataSource[indexPath.row] as! KXSPOrderCombineModel
142
+        cell.configTableViewCell(model: model, indexPath: indexPath as NSIndexPath)
78 143
         return cell
79 144
     }
80 145
     
146
+    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
147
+        let detail: KXSPOrderDetailViewController = KXSPOrderDetailViewController()
148
+        let model: KXSPOrderCombineModel = dataSource[indexPath.row] as! KXSPOrderCombineModel
149
+        detail.dataSource = NSMutableArray.init(object: model)
150
+        navigationController?.pushViewController(detail, animated: true)
151
+    }
152
+    
81 153
 }
82 154
 
83 155
 class KXSPOrderTableViewCell: UITableViewCell {
@@ -156,7 +228,19 @@ class KXSPOrderTableViewCell: UITableViewCell {
156 228
     }
157 229
     
158 230
     override func configTableViewCell(model: AnyObject, indexPath: NSIndexPath) {
159
-        
231
+        let mo: KXSPOrderCombineModel = model as! KXSPOrderCombineModel
232
+        iconImageView.image = UIImage(named: "icon_check_" + mo.module + "_" + mo.content.type)
233
+        let att: NSMutableAttributedString = NSMutableAttributedString()
234
+        att.append(NSAttributedString(string: "预估计:", attributes: [NSAttributedString.Key.foregroundColor: UIColor.kxColor(withHex: 0x666666), NSAttributedString.Key.font: UIFont(name: "PingFangSC-Regular", size: Fitesize(14))!]))
235
+        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
239
+        neicun.text = "内存:" + mo.content.memory
240
+        yanse.text = "颜色:" + mo.content.color
241
+        shijian.text = "购买时间:" + mo.content.time
242
+        chengse.text = "新旧成色:" + mo.content.quality
243
+        weixiu.text = "维修:" + mo.content.maintain
160 244
     }
161 245
     
162 246
     lazy var iconImageView: UIImageView = {
@@ -181,6 +265,7 @@ class KXSPOrderTableViewCell: UITableViewCell {
181 265
         let label: UILabel = UILabel()
182 266
         label.font = UIFont.init(name: "PingFangSC-Regular", size: Fitesize(14))
183 267
         label.textColor = UIColor.kxColor(withHex: 0x666666)
268
+        label.text = "订单状态:进行中···"
184 269
         return label
185 270
     }()
186 271
     

+ 20 - 0
CAISHEN/SellPhone2/Order/Model/KXSPOrderCombineModel.swift

@@ -0,0 +1,20 @@
1
+//
2
+//  KXSPOrderCombineModel.swift
3
+//  CAISHEN
4
+//
5
+//  Created by xiaoxi on 2018/11/20.
6
+//  Copyright © 2018 kuxuan. All rights reserved.
7
+//
8
+
9
+import UIKit
10
+
11
+class KXSPOrderCombineModel: NSObject, YYModel {
12
+    @objc var id: String = ""
13
+    @objc var content: KXAssessViewModel = KXAssessViewModel()
14
+    @objc var module: String = ""
15
+    @objc var user_id: String = ""
16
+    
17
+    static func modelContainerPropertyGenericClass() -> [String : Any]? {
18
+        return ["content": KXAssessViewModel.self]
19
+    }
20
+}

+ 4 - 7
CAISHEN/SellPhone2/huishou.html

@@ -7,8 +7,8 @@
7 7
             html,
8 8
             body,
9 9
             p {
10
-                margin: 0;
11
-                padding: 0;
10
+                margin: 0.10rem;
11
+                padding: 0.10rem;
12 12
             }
13 13
         
14 14
             .content {
@@ -16,21 +16,18 @@
16 16
             }
17 17
         
18 18
             h {
19
-                margin: 0;
19
+                margin: 0.10rem;
20
+                padding: 0.10rem;
20 21
             }
21 22
         
22 23
             h {
23 24
                 font-size: 16px;
24 25
                 color: #333;
25
-                padding-top: 0.10rem;
26
-                padding-bottom: 4px;
27 26
             }
28 27
         
29 28
             p {
30 29
                 font-size: 14px;
31 30
                 color: #444;
32
-                padding-top: 4px;
33
-                padding-bottom: 4px;
34 31
             }
35 32
         </style>
36 33
     </head>