Commit a4abb3b3 authored by Sandy's avatar Sandy

订单接口调通、添加商品按钮状态改变、bug fix

parent e5d8c074
This diff is collapsed.
{
"images" : [
{
"idiom" : "universal",
"filename" : "commodityShop_gray.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "commodityShop_gray@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
//
// JavenOrderModel.h
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JavenGoodsDetails.h"
#import "JavenConsumer.h"
#import "JavenAddress.h"
@class JavenReseller, JavenLastModifyInfo, JavenTicket, JavenShop, JavenCreateInfo, JavenConsumer, JavenAddress;
@interface JavenOrderModel : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSArray<JavenGoodsDetails *> *goodsDetails;
@property (nonatomic, assign) id shipTrackingNumber;
@property (nonatomic, assign) double total;
@property (nonatomic, assign) double tax;
@property (nonatomic, assign) double commissions;
@property (nonatomic, strong) JavenReseller *reseller;
@property (nonatomic, assign) id shipType;
@property (nonatomic, strong) NSString *billNumber;
@property (nonatomic, assign) id billNumberEx;
@property (nonatomic, assign) double goodsCount;
@property (nonatomic, assign) double discount;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, assign) id payMethod;
@property (nonatomic, strong) JavenLastModifyInfo *lastModifyInfo;
@property (nonatomic, strong) JavenTicket *ticket;
@property (nonatomic, assign) double version;
@property (nonatomic, strong) NSString *state;
@property (nonatomic, strong) NSString *domain;
@property (nonatomic, strong) NSString *ownerBillNumber;
@property (nonatomic, assign) double freight;
@property (nonatomic, strong) JavenShop *shop;
@property (nonatomic, strong) JavenCreateInfo *createInfo;
@property (nonatomic, strong) JavenConsumer *consumer;
@property (nonatomic, assign) double goodsAmount;
@property (nonatomic, assign) id remark;
@property (nonatomic, strong) JavenAddress *address;
@property (nonatomic, assign) id shkjtNo;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
This diff is collapsed.
......@@ -19,7 +19,8 @@
<constraint firstAttribute="height" constant="52" id="bjA-ch-dNH"/>
<constraint firstAttribute="width" constant="34" id="f5i-GA-SX2"/>
</constraints>
<state key="normal" image="commodityShop"/>
<state key="normal" image="commodityShop_gray"/>
<state key="selected" image="commodityShop"/>
<variation key="default">
<mask key="constraints">
<exclude reference="MEe-J1-sOo"/>
......@@ -122,6 +123,7 @@
<resources>
<image name="Earphones-microphone" width="41" height="69"/>
<image name="commodityShop" width="41" height="69"/>
<image name="commodityShop_gray" width="41" height="69"/>
<image name="shareCommodity" width="295" height="70"/>
</resources>
</document>
......@@ -7,8 +7,12 @@
//
#import <UIKit/UIKit.h>
#import "JavenGoodsDetails.h"
@interface OrderCellView : UIView
@property (weak, nonatomic) IBOutlet UILabel *labelTitle;
- (void)setupViewWithModel:(JavenGoodsDetails *)model;
@end
......@@ -7,9 +7,26 @@
//
#import "OrderCellView.h"
#import "JavenGoods.h"
@interface OrderCellView ()
@property (weak, nonatomic) IBOutlet UIImageView *imgCommdity;
@property (weak, nonatomic) IBOutlet UILabel *labelSpecName;
@property (weak, nonatomic) IBOutlet UILabel *labelCount;
@property (weak, nonatomic) IBOutlet UILabel *labelPrice;
@end
@implementation OrderCellView
- (void)setupViewWithModel:(JavenGoodsDetails *)model {
JavenGoods *goods = model.goods;
[self.imgCommdity sd_setImageWithURL:[NSURL URLWithString:goods.cover] placeholderImage:kPlaceHolderImage];
self.labelTitle.text = goods.name;
self.labelPrice.text = [NSString stringWithFormat:@"¥%.2f",goods.price];
self.labelCount.text = [NSString stringWithFormat:@"X%.0f", model.count];
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
......
......@@ -9,10 +9,10 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view contentMode="scaleToFill" id="iN0-l3-epB" customClass="OrderCellView">
<rect key="frame" x="0.0" y="0.0" width="320" height="110"/>
<rect key="frame" x="0.0" y="0.0" width="320" height="111"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="commodityManagementImage" translatesAutoresizingMaskIntoConstraints="NO" id="gvZ-Yx-Ujy">
<imageView userInteractionEnabled="NO" contentMode="scaleAspectFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" image="commodityManagementImage" translatesAutoresizingMaskIntoConstraints="NO" id="gvZ-Yx-Ujy">
<rect key="frame" x="8" y="8" width="90" height="94"/>
<constraints>
<constraint firstAttribute="width" constant="90" id="92I-IA-f2F"/>
......@@ -32,23 +32,23 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="96粒" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bGv-K4-Dnw">
<rect key="frame" x="106" y="70" width="38" height="21"/>
<rect key="frame" x="106" y="71" width="38" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="x3" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="OR2-4k-rSi">
<rect key="frame" x="152" y="70" width="20" height="22"/>
<rect key="frame" x="144" y="71" width="20" height="22"/>
<fontDescription key="fontDescription" type="system" pointSize="18"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥178" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vW8-v5-AfH">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="¥178" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="vW8-v5-AfH">
<rect key="frame" x="225" y="70" width="45" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="acf-qI-3N1">
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="acf-qI-3N1">
<rect key="frame" x="8" y="108" width="304" height="1"/>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
......@@ -56,7 +56,7 @@
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="1" id="Z3D-fb-vaB"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="售价:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jpi-l7-Qzv">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="售价:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jpi-l7-Qzv">
<rect key="frame" x="186" y="70" width="39" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
......@@ -78,7 +78,7 @@
<constraint firstItem="gvZ-Yx-Ujy" firstAttribute="top" secondItem="iN0-l3-epB" secondAttribute="topMargin" id="Wka-bt-cZs"/>
<constraint firstItem="vW8-v5-AfH" firstAttribute="leading" secondItem="bGv-K4-Dnw" secondAttribute="leading" id="Wps-v8-DZG"/>
<constraint firstItem="acf-qI-3N1" firstAttribute="leading" secondItem="iN0-l3-epB" secondAttribute="leading" constant="8" id="XW2-I5-FBt"/>
<constraint firstItem="OR2-4k-rSi" firstAttribute="leading" secondItem="bGv-K4-Dnw" secondAttribute="trailing" constant="8" id="ZRX-DE-Tgo"/>
<constraint firstItem="OR2-4k-rSi" firstAttribute="leading" secondItem="bGv-K4-Dnw" secondAttribute="trailing" id="ZRX-DE-Tgo"/>
<constraint firstAttribute="bottomMargin" secondItem="gvZ-Yx-Ujy" secondAttribute="bottom" id="cJq-F0-J8w"/>
<constraint firstAttribute="bottom" secondItem="bGv-K4-Dnw" secondAttribute="bottom" constant="19" id="dv6-Vw-b6i"/>
<constraint firstItem="dhI-dB-05Q" firstAttribute="top" secondItem="gvZ-Yx-Ujy" secondAttribute="top" id="g7A-BG-g7x"/>
......@@ -95,9 +95,13 @@
</mask>
</variation>
<connections>
<outlet property="labelTitle" destination="dhI-dB-05Q" id="bF1-FF-LUO"/>
<outlet property="imgCommdity" destination="gvZ-Yx-Ujy" id="UD2-gV-1lJ"/>
<outlet property="labelCount" destination="OR2-4k-rSi" id="ygD-6n-fa8"/>
<outlet property="labelPrice" destination="vW8-v5-AfH" id="rmd-od-wsL"/>
<outlet property="labelSpecName" destination="bGv-K4-Dnw" id="w1t-ni-pLb"/>
<outlet property="labelTitle" destination="dhI-dB-05Q" id="1ha-3d-73w"/>
</connections>
<point key="canvasLocation" x="237" y="336"/>
<point key="canvasLocation" x="237" y="336.5"/>
</view>
</objects>
<resources>
......
......@@ -7,11 +7,13 @@
//
#import <UIKit/UIKit.h>
#import "JavenOrderModel.h"
@interface OrderDetailBottomView : UIView
@property (weak, nonatomic) IBOutlet UILabel *laberRemark;
@property (weak, nonatomic) IBOutlet UILabel *labelRemark;
@property (weak, nonatomic) IBOutlet UIView *viewRemark;
- (void)updateHeight;
- (void)viewWithModel:(JavenOrderModel *)order;
@end
......@@ -8,16 +8,29 @@
#import "OrderDetailBottomView.h"
@implementation OrderDetailBottomView
@interface OrderDetailBottomView ()
- (void)setString:(NSString *)string {
self.laberRemark.text = string;
[self layoutIfNeeded];
self.height = self.viewRemark.bottom;
CLog(@"%f", self.height);
}
@property (weak, nonatomic) IBOutlet UILabel *labelPrice;
@property (weak, nonatomic) IBOutlet UILabel *labelFreight;
@property (weak, nonatomic) IBOutlet UILabel *labelTax;
@property (weak, nonatomic) IBOutlet UILabel *labelTotal;
@property (weak, nonatomic) IBOutlet UILabel *labelCommission;
@end
@implementation OrderDetailBottomView
- (void)viewWithModel:(JavenOrderModel *)order {
self.labelPrice.text = [NSString stringWithFormat:@"¥%.2f", order.goodsAmount];
self.labelFreight.text = [NSString stringWithFormat:@"¥%.2f", order.freight];
self.labelTax.text = [NSString stringWithFormat:@"¥%.2f", order.tax];
self.labelTotal.text = [NSString stringWithFormat:@"¥%.2f", order.total];
self.labelCommission.text = [NSString stringWithFormat:@"¥%.2f", order.commissions];
self.labelRemark.text = order.remark;
}
- (void)updateHeight {
self.height = self.viewRemark.bottom + 163;
......
......@@ -98,6 +98,7 @@
<constraint firstItem="Dfr-K5-NeA" firstAttribute="top" secondItem="CoV-Us-WDw" secondAttribute="top" constant="4" id="tGd-OM-w2n"/>
<constraint firstItem="Dfr-K5-NeA" firstAttribute="leading" secondItem="ufG-kV-Uns" secondAttribute="trailing" constant="3" id="wvv-Rf-cc8"/>
<constraint firstAttribute="trailing" secondItem="Dfr-K5-NeA" secondAttribute="trailing" constant="8" id="xqB-61-As0"/>
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="ufG-kV-Uns" secondAttribute="bottom" constant="8" id="yNs-1t-7kP"/>
</constraints>
<variation key="default">
<mask key="constraints">
......@@ -286,10 +287,15 @@
</constraints>
<freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
<connections>
<outlet property="laberRemark" destination="Dfr-K5-NeA" id="GK4-H5-9pu"/>
<outlet property="labelCommission" destination="A7h-to-ZFP" id="dVK-Vu-NQy"/>
<outlet property="labelFreight" destination="7hy-IY-Wba" id="nfX-3j-EO5"/>
<outlet property="labelPrice" destination="20G-Ig-3ql" id="wQl-yh-zLx"/>
<outlet property="labelRemark" destination="Dfr-K5-NeA" id="mNv-De-Xcz"/>
<outlet property="labelTax" destination="wye-4u-nVq" id="tph-ep-8hW"/>
<outlet property="labelTotal" destination="VEX-fb-el0" id="AbW-N5-hm8"/>
<outlet property="viewRemark" destination="CoV-Us-WDw" id="JZe-Oc-FgW"/>
</connections>
<point key="canvasLocation" x="370" y="34.5"/>
<point key="canvasLocation" x="281" y="-58.5"/>
</view>
</objects>
</document>
......@@ -8,7 +8,10 @@
#import <UIKit/UIKit.h>
#import "OrderCellView.h"
#import "JavenGoodsDetails.h"
@interface OrderDetailTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet OrderCellView *cellTopView;
@property (weak, nonatomic) IBOutlet UIImageView *imgCommdity;
- (void)cellWithModel:(JavenGoodsDetails *)model;
@end
......@@ -7,13 +7,28 @@
//
#import "OrderDetailTableViewCell.h"
#import "JavenGoods.h"
@interface OrderDetailTableViewCell ()
@property (weak, nonatomic) IBOutlet UILabel *labelSpecName;
@property (weak, nonatomic) IBOutlet UILabel *labelCount;
@property (weak, nonatomic) IBOutlet UILabel *labelPrice;
@property (weak, nonatomic) IBOutlet UILabel *labelTitle;
@end
@implementation OrderDetailTableViewCell
- (void)awakeFromNib {
// Initialization code
}
- (void)cellWithModel:(JavenGoodsDetails *)model {
JavenGoods *goods = model.goods;
[self.imgCommdity sd_setImageWithURL:[NSURL URLWithString:goods.cover] placeholderImage:kPlaceHolderImage];
self.labelTitle.text = goods.name;
self.labelPrice.text = [NSString stringWithFormat:@"¥%.2f",goods.price];
self.labelCount.text = [NSString stringWithFormat:@"%.0f", model.count];
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
......@@ -94,9 +94,9 @@
</constraints>
<variation key="default">
<mask key="constraints">
<exclude reference="Lse-c0-ldA"/>
<exclude reference="WcB-SJ-J9P"/>
<exclude reference="a7S-Rv-SpR"/>
<exclude reference="Lse-c0-ldA"/>
</mask>
</variation>
<connections>
......@@ -112,6 +112,13 @@
<constraint firstAttribute="trailing" secondItem="r5S-Ro-8VU" secondAttribute="trailing" id="r2Z-Ef-iF5"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="imgCommdity" destination="Mc7-h2-x4c" id="Hrf-qi-Rdi"/>
<outlet property="labelCount" destination="tF6-Uj-hrX" id="i7U-mM-zq6"/>
<outlet property="labelPrice" destination="dJx-Eq-r4u" id="kTf-xt-V25"/>
<outlet property="labelSpecName" destination="8kn-MT-U4g" id="upB-kq-DEs"/>
<outlet property="labelTitle" destination="cAt-eD-6vx" id="fPl-kM-pCN"/>
</connections>
<point key="canvasLocation" x="233.5" y="296"/>
</tableViewCell>
</objects>
......
......@@ -7,6 +7,8 @@
//
#import <UIKit/UIKit.h>
#import "MBLabelWithFontAdapter.h"
#import "JavenOrderModel.h"
typedef NS_ENUM(NSInteger, ORDERTOPTYPE)
{
ORDERTOPTYPE_NOPAYMENT,//代支付
......@@ -18,10 +20,13 @@ typedef NS_ENUM(NSInteger, ORDERTOPTYPE)
@interface OrderDetailTopView : UIView
@property (nonatomic, assign) ORDERTOPTYPE orderType;
@property (weak, nonatomic) IBOutlet UILabel *labelAddress;
@property (weak, nonatomic) IBOutlet UIView *bottomView;
@property (weak, nonatomic) IBOutlet MBLabelWithFontAdapter *labelExpress;
@property (weak, nonatomic) IBOutlet UILabel *labelExpressTime;
@property (weak, nonatomic) IBOutlet UILabel *labelName;
@property (weak, nonatomic) IBOutlet UILabel *labelPhoneNumber;
@property (weak, nonatomic) IBOutlet UILabel *labelAddress;
@property (weak, nonatomic) IBOutlet UIView *bottomView;
......@@ -29,4 +34,6 @@ typedef NS_ENUM(NSInteger, ORDERTOPTYPE)
- (void)updateByOrderType;
- (void)updateHeight;
- (void)viewWithModel:(JavenOrderModel *)model;
@end
......@@ -31,6 +31,12 @@
self.height = self.bottomView.bottom;
}
- (void)viewWithModel:(JavenOrderModel *)model {
self.labelName = model.consumer.name;
JavenAddress *address = model.address;
self.labelAddress.text = [NSString stringWithFormat:@"%@%@%@%@", address.nation ? address.nation : @"", address.city, address.country, address.address];
self.labelPhoneNumber.text = model.consumer.code;
}
- (IBAction)actionCall:(id)sender {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"tel://%@", self.labelPhoneNumber.text]]];
......
......@@ -11,32 +11,32 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="402"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9kH-LK-wk8">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="9kH-LK-wk8">
<rect key="frame" x="0.0" y="212" width="320" height="138"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="收货人:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xru-fq-ja3">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="收货人:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Xru-fq-ja3">
<rect key="frame" x="45" y="22" width="68" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="谢德彬" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="J01-8B-y5r">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="谢德彬" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="J01-8B-y5r">
<rect key="frame" x="115" y="22" width="51" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="手机号:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6Vh-Et-vJt">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="手机号:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="6Vh-Et-vJt">
<rect key="frame" x="45" y="51" width="68" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" white="0.33333333333333331" alpha="1" colorSpace="calibratedWhite"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="18321155536" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v7R-er-zaD">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="18321155536" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="v7R-er-zaD">
<rect key="frame" x="115" y="51" width="105" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" ambiguous="YES" misplaced="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Yca-8a-HcF">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Yca-8a-HcF">
<rect key="frame" x="262" y="22" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="2su-RU-ZJh"/>
......@@ -46,14 +46,14 @@
<action selector="actionCall:" destination="-1" eventType="touchUpInside" id="2Q6-do-hGR"/>
</connections>
</button>
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" ambiguous="YES" misplaced="YES" image="icon_order_address" translatesAutoresizingMaskIntoConstraints="NO" id="OeX-RE-d2m">
<imageView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFit" image="icon_order_address" translatesAutoresizingMaskIntoConstraints="NO" id="OeX-RE-d2m">
<rect key="frame" x="4" y="92" width="30" height="23"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="eth-Xe-EGH"/>
<constraint firstAttribute="height" constant="23" id="yMF-z8-J4m"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" misplaced="YES" text="上海市 上海市 闵行区 鹤坡南路55弄2号232室上海市 上海市 闵行区 鹤坡南路55弄2号232室" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rM9-W2-1PT">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="上海市 上海市 闵行区 鹤坡南路55弄2号232室上海市 上海市 闵行区 鹤坡南路55弄2号232室" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="rM9-W2-1PT">
<rect key="frame" x="45" y="76" width="267" height="54"/>
<fontDescription key="fontDescription" type="system" pointSize="15"/>
<nil key="highlightedColor"/>
......@@ -92,10 +92,10 @@
</mask>
</variation>
</view>
<view contentMode="scaleToFill" ambiguous="YES" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kMe-iN-q0b">
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="kMe-iN-q0b">
<rect key="frame" x="0.0" y="358" width="320" height="29"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" ambiguous="YES" text="商品信息" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nUT-vO-b28">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="商品信息" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nUT-vO-b28">
<rect key="frame" x="15" y="4" width="68" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
......@@ -209,6 +209,8 @@
<connections>
<outlet property="bottomView" destination="kMe-iN-q0b" id="RF7-79-dgV"/>
<outlet property="labelAddress" destination="rM9-W2-1PT" id="Vpk-og-XdW"/>
<outlet property="labelExpress" destination="qgd-cT-Y2S" id="qkY-uL-Ys8"/>
<outlet property="labelExpressTime" destination="KAE-q5-yVI" id="mUx-78-qVY"/>
<outlet property="labelName" destination="J01-8B-y5r" id="jwt-aT-2P0"/>
<outlet property="labelPhoneNumber" destination="v7R-er-zaD" id="jiO-J8-KxV"/>
<outlet property="viewExpress" destination="9bs-ar-XXb" id="rCv-CW-UTd"/>
......
......@@ -7,10 +7,12 @@
//
#import <UIKit/UIKit.h>
#import "JavenGoodsDetails.h"
#import "JavenOrderModel.h"
@interface OrderExpressTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIButton *checkExpress;
- (void)cellWithViewNumber:(NSInteger)number;
- (void)setState:(NSString *)orderState;
- (void)cellWithModel:(JavenOrderModel *)model;
@end
......@@ -8,11 +8,15 @@
#import "OrderExpressTableViewCell.h"
#import "OrderCellView.h"
#import "JavenConsumer.h"
#import "JavenCreateInfo.h"
@interface OrderExpressTableViewCell ()
@property (nonatomic, strong) NSMutableArray *arrCellView;
@property (weak, nonatomic) IBOutlet UILabel *labelState;
@property (weak, nonatomic) IBOutlet UILabel *labelBuyer;
@property (weak, nonatomic) IBOutlet UILabel *labelDate;
@property (weak, nonatomic) IBOutlet UILabel *labelTotal;
@property (weak, nonatomic) IBOutlet UILabel *labelCommission;
@end
@implementation OrderExpressTableViewCell
- (void)awakeFromNib {
......@@ -21,6 +25,34 @@
self.selectionStyle = UITableViewCellSelectionStyleNone;
}
- (void)cellWithModel:(JavenOrderModel *)model {
NSArray *arr = model.goodsDetails;
for (OrderCellView *cellView in self.arrCellView) {
[cellView removeFromSuperview];
}
for (NSInteger i = 0; i < arr.count; i++) {
OrderCellView *cellView = [OrderCellView viewWithNibName:@"OrderCellView"];
cellView.frame = CGRectMake(0, 74 + 120 * i, self.width, 120);
[cellView setupViewWithModel:arr[i]];
[self.arrCellView addObject:cellView];
[self.contentView addSubview:cellView];
}
self.labelTotal.text = [NSString stringWithFormat:@"%.2f", model.total];
self.labelCommission.text = [NSString stringWithFormat:@"%.2f", model.commissions];
JavenConsumer *consumer = model.consumer;
self.labelBuyer.text = consumer.code;
self.labelDate.text = [(JavenCreateInfo *)model.createInfo time];
}
- (void)cellWithViewNumber:(NSInteger)number {
for (OrderCellView *cellView in self.arrCellView) {
[cellView removeFromSuperview];
......
......@@ -62,32 +62,32 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="NKY-p0-eZH">
<rect key="frame" x="0.0" y="100" width="345" height="44"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="应付:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NSP-00-fgb">
<rect key="frame" x="105" y="15" width="39" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="应付:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="NSP-00-fgb">
<rect key="frame" x="119" y="15" width="39" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.50823958329999996" green="0.50823958329999996" blue="0.50823958329999996" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="¥837" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Ga-eZ-C09">
<rect key="frame" x="152" y="15" width="48" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥837" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="8Ga-eZ-C09">
<rect key="frame" x="166" y="15" width="48" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="应付:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iCY-t9-oeZ">
<rect key="frame" x="226" y="15" width="39" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="应付:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iCY-t9-oeZ">
<rect key="frame" x="240" y="15" width="39" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.50823958329999996" green="0.50823958329999996" blue="0.50823958329999996" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" text="¥83.7" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iIr-bn-6Cs">
<rect key="frame" x="273" y="15" width="52" height="21"/>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥83.7" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="iIr-bn-6Cs">
<rect key="frame" x="287" y="15" width="52" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="1" green="0.3921568627" blue="0.3921568627" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<view contentMode="scaleToFill" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VUV-c7-npe">
<rect key="frame" x="8" y="43" width="315" height="1"/>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="VUV-c7-npe">
<rect key="frame" x="8" y="43" width="329" height="1"/>
<color key="backgroundColor" red="0.91271875000000002" green="0.91271875000000002" blue="0.91271875000000002" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Vsr-k9-3yO"/>
......@@ -170,7 +170,11 @@
</tableViewCellContentView>
<connections>
<outlet property="checkExpress" destination="ajs-cQ-mp9" id="k8g-tC-4fW"/>
<outlet property="labelBuyer" destination="jog-1Q-NME" id="2M7-iU-uLr"/>
<outlet property="labelCommission" destination="iIr-bn-6Cs" id="yto-6o-bne"/>
<outlet property="labelDate" destination="7Ck-1t-J8c" id="iLQ-QO-c7p"/>
<outlet property="labelState" destination="J5p-Wx-HPf" id="JJ8-KI-3gH"/>
<outlet property="labelTotal" destination="8Ga-eZ-C09" id="bYY-6D-BNL"/>
</connections>
<point key="canvasLocation" x="149.5" y="349"/>
</tableViewCell>
......
......@@ -7,10 +7,10 @@
//
#import <UIKit/UIKit.h>
#import "JavenGoodsDetails.h"
#import "JavenOrderModel.h"
@interface OrderTableViewCell : UITableViewCell
- (void)cellWithViewNumber:(NSInteger)number;
- (void)setState:(NSString *)orderState;
- (void)cellWithModel:(JavenOrderModel *)model;
@end
......@@ -8,10 +8,15 @@
#import "OrderTableViewCell.h"
#import "OrderCellView.h"
#import "JavenConsumer.h"
#import "JavenCreateInfo.h"
@interface OrderTableViewCell ()
@property (nonatomic, strong) NSMutableArray *arrCellView;
@property (weak, nonatomic) IBOutlet UILabel *labelState;
@property (weak, nonatomic) IBOutlet UILabel *labelBuyer;
@property (weak, nonatomic) IBOutlet UILabel *labelDate;
@property (weak, nonatomic) IBOutlet UILabel *labelTotal;
@property (weak, nonatomic) IBOutlet UILabel *labelCommission;
@end
@implementation OrderTableViewCell
......@@ -22,19 +27,30 @@
self.selectionStyle = UITableViewCellSelectionStyleNone;
}
- (void)cellWithViewNumber:(NSInteger)number {
- (void)cellWithModel:(JavenOrderModel *)model {
NSArray *arr = model.goodsDetails;
for (OrderCellView *cellView in self.arrCellView) {
[cellView removeFromSuperview];
}
for (NSInteger i = 0; i < number; i++) {
OrderCellView *cellView = [OrderCellView viewWithNibName:@"OrderCellView"];
cellView.frame = CGRectMake(0, 74 + 120 * i, self.width, 120);
[self.arrCellView addObject:cellView];
[self.contentView addSubview:cellView];
}
for (NSInteger i = 0; i < arr.count; i++) {
OrderCellView *cellView = [OrderCellView viewWithNibName:@"OrderCellView"];
cellView.frame = CGRectMake(0, 74 + 120 * i, self.width, 120);
[cellView setupViewWithModel:arr[i]];
[self.arrCellView addObject:cellView];
[self.contentView addSubview:cellView];
}
self.labelTotal.text = [NSString stringWithFormat:@"¥%.2f", model.total];
self.labelCommission.text = [NSString stringWithFormat:@"¥%.2f", model.commissions];
JavenConsumer *consumer = model.consumer;
self.labelBuyer.text = consumer.code;
self.labelDate.text = [(JavenCreateInfo *)model.createInfo time];
}
- (void)setState:(NSString *)orderState {
......
......@@ -62,7 +62,7 @@
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="d6S-4w-qHp">
<rect key="frame" x="0.0" y="312" width="331" height="44"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="应付:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cc3-M1-4wO">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="总计:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="cc3-M1-4wO">
<rect key="frame" x="105" y="15" width="39" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.5082395833333333" green="0.5082395833333333" blue="0.5082395833333333" alpha="1" colorSpace="calibratedRGB"/>
......@@ -74,7 +74,7 @@
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="应付:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IC0-sm-vao">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="佣金:" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IC0-sm-vao">
<rect key="frame" x="226" y="15" width="39" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" red="0.50823958329999996" green="0.50823958329999996" blue="0.50823958329999996" alpha="1" colorSpace="calibratedRGB"/>
......@@ -137,7 +137,11 @@
</variation>
</tableViewCellContentView>
<connections>
<outlet property="labelBuyer" destination="hBw-pM-xt9" id="VQV-w4-AxI"/>
<outlet property="labelCommission" destination="iUL-cF-E4q" id="xFg-zm-HUX"/>
<outlet property="labelDate" destination="doj-PA-o3a" id="cNS-Hj-kGc"/>
<outlet property="labelState" destination="C8f-Oc-X6g" id="zN3-gE-D8U"/>
<outlet property="labelTotal" destination="GFV-0S-gMx" id="fcL-hm-4eX"/>
</connections>
<point key="canvasLocation" x="-48.5" y="435.5"/>
</tableViewCell>
......
......@@ -30,14 +30,43 @@
[self.view addSubview:self.bottomView];
self.bottomView.userInteractionEnabled = NO;
//添加点击事件
kButtonAddAction(self.bottomView.buttonShop, addCommodity)
kButtonAddAction(self.bottomView.buttonShare, shareAction)
kButtonAddAction(self.topView.buttonBack, backAction)
kButtonAddAction(self.topView.buttonHome, homeAction)
kButtonAddAction(self.bottomView.buttonShop, addCommodity);
kButtonAddAction(self.bottomView.buttonShare, shareAction);
kButtonAddAction(self.topView.buttonBack, backAction);
kButtonAddAction(self.topView.buttonHome, homeAction);
[self checkIsFavorite];
}
/** 检查是否收藏 */
- (void)checkIsFavorite {
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"shop/shopGoodsExists" parameters:[self getCheckParams] success:^(NSURLSessionDataTask *task, id responseObject) {
if ([responseObject[@"code"] isEqualToNumber:@0]) {
BOOL select = [responseObject[@"value"] boolValue];
weakSelf.bottomView.buttonShop.selected = select;
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (NSDictionary *)getCheckParams {
NSDictionary *myDictionary = @{@"operCtx" : @{@"time" : @0,
@"domain" : @"string",
@"operator" : @{@"id" : [UserInfo shareInstance].uuid,
@"fullName" : [UserInfo shareInstance].name}},
@"goodsUuid" : self.model.uuid,
@"shopUuid" : [UserInfo shareInstance].shop.uuid};
return myDictionary;
}
#pragma mark - action
- (void)backAction {
[self.navigationController popViewControllerAnimated:YES];
}
......@@ -47,9 +76,36 @@
[self.navigationController popToRootViewControllerAnimated:YES];
}
#pragma mark - 添加商品
- (void)addCommodity {
CLog(@"添加商品");
NSString *postUrl;
NSString *commpleteInfo;
NSDictionary *params;
if (self.bottomView.buttonShop.isSelected) {
postUrl = @"shop/removeGoods";
commpleteInfo = @"移除成功!";
params = [self getRemoveGoodsParams];
}else{
postUrl = @"shop/addGoods";
commpleteInfo = @"添加成功!";
params = [self getGoodsParams];
}
WS(weakSelf)
[[HTTPCilent shareCilent] POST:postUrl parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
if ([responseObject[@"code"] isEqualToNumber: @0]) {
[MBProgressHUD Javen_showSuccess:commpleteInfo onView:weakSelf.view delay:0.7 complete:nil];
[weakSelf checkIsFavorite];
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (NSDictionary *)getGoodsParams {
UserInfo *info = [UserInfo shareInstance];
NSDictionary *param = @{
......@@ -64,32 +120,27 @@
@"shopUuid": info.shop.uuid,
@"goodsUuid":self.model.uuid
};
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"shop/addGoods" parameters:param success:^(NSURLSessionDataTask *task, id responseObject) {
if ([responseObject[@"code"] isEqualToNumber: @0]) {
[weakSelf addSUccess];
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
return param;
}
- (void)addSUccess {
//添加成功提示框
MBProgressHUD *hud = [[MBProgressHUD alloc] initWithView:self.view.window];
[self.view.window addSubview:hud];
hud.animationType = MBProgressHUDAnimationFade;
hud.removeFromSuperViewOnHide = YES;
hud.labelText = @"添加成功!";
hud.mode = MBProgressHUDModeText;
[hud show:YES];
[hud hide:YES afterDelay:1];
- (NSDictionary *)getRemoveGoodsParams {
UserInfo *info = [UserInfo shareInstance];
NSDictionary *param = @{
@"operCtx": @{
@"time": [[NSDate date] timeStampNumber],
@"domain": info.domain,
@"operator": @{
@"id": info.uuid,
@"fullName": info.name
}
},
@"shopUuid": info.shop.uuid,
@"listGoodsUuid": @[self.model.uuid]
};
return param;
}
- (void)setUpWebView {
UserInfo *userInfo = [UserInfo shareInstance];
NSString *urlStr = [NSString stringWithFormat:@"%@Wap/detail/shop_id/%@/id/%@/hastbar/1/.html", userInfo.webShopBaseUrl, userInfo.shop.uuid, self.model.uuid];
......
......@@ -95,9 +95,9 @@
for (NSDictionary *dic in responseObject[@"queryResult"]) {
CommotityListModel *model = [CommotityListModel modelObjectWithDictionary:dic];
[weakSelf.arrItemDatas addObject:model];
[weakSelf.collectionView reloadData];
}
[weakSelf.collectionView reloadData];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
......
......@@ -35,6 +35,7 @@
[super viewDidLoad];
self.direction = @"desc";
self.field = @"";
self.searchText = @"";
[self setUpSearchBar];
[self setUpSortView];
[self setUpCollectionView];
......@@ -214,6 +215,9 @@
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
CommodityDetailViewController *detailVC = [[CommodityDetailViewController alloc] init];
detailVC.model = self.arrItemDatas[indexPath.row];
CommodityListCollectionViewCell *cell = (CommodityListCollectionViewCell *)[collectionView cellForItemAtIndexPath:indexPath];
detailVC.image = cell.imageViewTop.image;
[self.navigationController pushViewController:detailVC animated:YES];
}
......
......@@ -50,10 +50,7 @@
//跳转添加商品在CommodityManagementTopView里面跳转,注意看一下
- (void)viewDidLoad {
[super viewDidLoad];
self.condition = @"shop online only";
self.searchText = @"";
self.field = @"";
self.direction = @"desc";
[self setDefaults];
[self setUpNavigationbar];
[self setUpViews];
[self setUpSearchBar];
......@@ -63,6 +60,15 @@
}
- (void)setDefaults {
self.condition = @"shop online only";
self.searchText = @"";
self.field = @"";
self.direction = @"desc";
self.isLeft = YES;
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self resetReloadData];
......@@ -284,6 +290,8 @@
manageVC.arrCellData = [self.arrItemDatas mutableCopy];
manageVC.isLeft = self.isLeft;
manageVC.row = self.row;
manageVC.condition = self.condition;
manageVC.field = self.field;
[self.navigationController pushViewController:manageVC animated:YES];
......
......@@ -20,9 +20,12 @@
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) JavenSortView *sortView;
@property (nonatomic, strong) NSMutableArray *arrCellData;
@property (nonatomic, strong) NSArray *results;
@property (nonatomic, copy) NSString *field; //排序的字段
@property (nonatomic, copy) NSString *direction; //排序的顺序 升序或降序
@property (nonatomic, copy) NSString *customerCreateDate;
@end
@implementation CustomerManagementViewController
......@@ -31,7 +34,9 @@
[super viewDidLoad];
self.field = @"commission";
self.direction = @"desc";
self.customerCreateDate = @"2011-04-09 00:00:00";
self.view.backgroundColor = kBacroundColor;
[self setUpSearchBar];
[self setUpSortView];
[self setUptableView];
......@@ -50,17 +55,20 @@
NSDictionary *params = @{@"defintion" : @{@"conditions" : @[@{@"operation" : @"domain equals",
@"parameter" : @{@"operation" : @"string"},
@"parameters" : @[[UserInfo shareInstance].domain]},
@{@"operation" : @"reseller uuid equals",
@"parameter" : @{@"operation" : @"string"},
@"parameters" : @[[UserInfo shareInstance].uuid]}],
@"orders" : @[@{@"field" : self.field,
@"direction" : self.direction}],
@"pageSize" : kPageSize,
@"page" : @0,
@"probePages" : @0},
@"fetchParts" : @[@"string"]};
@"parameter" : @{@"operation" : @"string"},
@"parameters" : @[[UserInfo shareInstance].domain]},
@{@"operation" : @"createInfo.time between",
@"parameter" : @{@"operation" : @"string"},
@"parameters" : @[self.customerCreateDate, [NSNull null]]},
@{@"operation" : @"reseller uuid equals",
@"parameter" : @{@"operation" : @"string"},
@"parameters" : @[[UserInfo shareInstance].uuid]}],
@"orders" : @[@{@"field" : self.field,
@"direction" : self.direction}],
@"pageSize" : kPageSize,
@"page" : @0,
@"probePages" : @0},
@"fetchParts" : @[@""]};
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"reseller/customer/query" parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
if ([responseObject[@"code"] isEqualToNumber:@0]) {
......@@ -154,25 +162,27 @@
{
self.field = @"commission";
self.direction = @"desc";
self.customerCreateDate = @"2011-04-09 00:00:00";
}
break;
case 1://价格 高-低
case 1://今日新增
{
self.field = @"consumer create time";
NSDateFormatter *f = [[NSDateFormatter alloc] init];
[f setDateFormat:@"yyyy-MM-dd"];
[f setDateFormat:@"yyyy-MM-dd 00:00:00"];
NSString *dateStr = [f stringFromDate:[NSDate date]];
NSString *appendStr = [dateStr stringByAppendingString:@" 00:00:00"];
self.direction = appendStr;
self.customerCreateDate = dateStr;
}
break;
case 2://价格 低-高
case 2://本周新增
{
self.field = @" spec price";
self.direction = @"asc";
NSDate *aweekBefore = [NSDate dateWithTimeIntervalSinceNow:-24*60*60*7];
NSDateFormatter *f = [[NSDateFormatter alloc] init];
[f setDateFormat:@"yyyy-MM-dd 00:00:00"];
NSString *dateStr = [f stringFromDate:aweekBefore];
self.customerCreateDate = dateStr;
}
break;
......@@ -198,13 +208,20 @@
#pragma mark =========== tableview delegate ===========
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return self.arrCellData.count;
return self.searchBar.isFirstResponder ? self.results.count : self.arrCellData.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
CustomerTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
[cell cellwithModel:self.arrCellData[indexPath.row]];
if (self.searchBar.isFirstResponder) {
[cell cellwithModel:self.results[indexPath.row]];
}else{
[cell cellwithModel:self.arrCellData[indexPath.row]];
}
return cell;
}
......@@ -225,13 +242,17 @@
- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText
{
NSPredicate *pred = [NSPredicate predicateWithFormat:@"consumer.mobilephone contains [cd] %@", searchText];
self.results = [self.arrCellData filteredArrayUsingPredicate:pred];
[self.tableView reloadData];
}
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar
{
self.sortView.userInteractionEnabled = YES;
self.searchBar.text = @"";
[self.searchBar endEditing:YES];
[self.tableView reloadData];
}
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
......
......@@ -9,6 +9,7 @@
#import "InvitePartnerViewController.h"
@interface InvitePartnerViewController ()
@property (weak, nonatomic) IBOutlet UIButton *btnInvite;
@end
......@@ -16,12 +17,21 @@
- (void)viewDidLoad {
[super viewDidLoad];
NSString *inviteWebUrl = [NSString stringWithFormat:@"%@Wap/visit.html", [UserInfo shareInstance].webShopBaseUrl];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:inviteWebUrl]];
UIWebView *webView = [UIWebView new];
[webView loadRequest:request];
[self.view addSubview:webView];
// webView.scrollView.contentInset = UIEdgeInsetsMake(30, 0, 0, 0);
webView.sd_layout.topSpaceToView(self.view, 0).leftSpaceToView(self.view, 0).rightSpaceToView(self.view, 0).bottomSpaceToView(self.btnInvite, 0);
// Do any additional setup after loading the view from its nib.
}
- (IBAction)invitePartner:(id)sender {
NSString *urlStr = [NSString stringWithFormat:@"%@ShopUser/gpregister/invitationCode/%@.html", [UserInfo shareInstance].webShopBaseUrl, [UserInfo shareInstance].invitationCode];
[[ShareInstance shareInstace] showWithTitle:@"Aland" content:@"大伙加入,共同致富!" url:urlStr image:[UIImage imageNamed:@"Camera"]];
[[ShareInstance shareInstace] showWithTitle:@"Aland" content:@"大伙加入,共同致富!" url:urlStr image:[UIImage appIcon]];
}
......
......@@ -7,6 +7,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="InvitePartnerViewController">
<connections>
<outlet property="btnInvite" destination="DOU-lM-mk6" id="Azt-OA-YBq"/>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
......
......@@ -29,13 +29,12 @@
- (void)viewDidLoad {
[super viewDidLoad];
self.field = @"";
self.direction = @"desc";
self.condition = @"";
self.navigationItem.title = @"批量管理";
[self setUpViews];
// Do any additional setup after loading the view.
}
......@@ -62,8 +61,6 @@
_tableView.editing = YES;
_tableView.allowsMultipleSelectionDuringEditing = YES;
_bottomView = [CommodityMutipleSelectBottomView viewWithNibName:@"CommodityMutipleSelectBottomView"];
_bottomView.frame = CGRectMake(0, kHeight - 64 - 70, kWidth, 70 + 64);
[_bottomView addTarget:self delete:@selector(multipleACtion:) online:@selector(multipleACtion:) offline:@selector(multipleACtion:)];
......@@ -81,7 +78,7 @@
}
- (void)leftSelectCodtition:(NSInteger)row {
[self.bottomView deselectAll];
switch (row) {
case 0:
{
......@@ -104,7 +101,7 @@
- (void)rightSelectCondition:(NSInteger)row {
[self.bottomView deselectAll];
switch (row) {
case 0:
{
......@@ -159,7 +156,6 @@
CommotityListModel *model = [CommotityListModel modelObjectWithDictionary:dic];
[weakSelf.arrCellData addObject:model];
}
[weakSelf.tableView reloadData];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
......@@ -263,6 +259,14 @@
#pragma mark =========== 删除、上架、下架 ===========
- (void)multipleACtion:(UIButton *)btn
{
NSArray *arrGoodsUuid = self.dicSelectIds.allKeys;
if (arrGoodsUuid.count == 0) {
[MBProgressHUD Javen_showError:@"请至少选择一件商品" onView:self.view delay:0.6 complete:nil];
return;
}
NSString *questUrl;
switch (btn.tag) {
case ActionTypeDelete:
......@@ -273,12 +277,20 @@
break;
case ActionTypeOnline:
{
if ([self.condition isEqualToString: @"shop online only"] ) {
[MBProgressHUD Javen_showError:@"不能重复上架!" onView:self.view delay:0.5 complete:nil];
return;
}
questUrl = @"shop/onlineGoods";
CLog(@"online");
}
break;
case ActionTypeOffline:
{
if (![self.condition isEqualToString: @"shop online only"] ) {
[MBProgressHUD Javen_showError:@"不能重复下架!" onView:self.view delay:0.5 complete:nil];
return;
}
questUrl = @"shop/offlineGoods";
CLog(@"offline");
}
......@@ -288,29 +300,19 @@
break;
}
NSArray *arrGoodsUuid = self.dicSelectIds.allKeys;
if (arrGoodsUuid.count == 0) {
[MBProgressHUD Javen_showError:@"请至少选择一件商品" onView:self.view delay:0.6 complete:nil];
}else{
NSDictionary *params = @{@"operCtx" : @{@"time" : [[NSDate date] timeStampNumber],
@"domain" : [UserInfo shareInstance].domain,
@"operator" : @{@"id" : [UserInfo shareInstance].uuid,
@"fullName" : [UserInfo shareInstance].name}},
@"shopUuid" : [UserInfo shareInstance].shop.uuid,
@"listGoodsUuid" : arrGoodsUuid};
NSDictionary *params = @{@"operCtx" : @{@"time" : [[NSDate date] timeStampNumber],
@"domain" : [UserInfo shareInstance].domain,
@"operator" : @{@"id" : [UserInfo shareInstance].uuid,
@"fullName" : [UserInfo shareInstance].name}},
@"shopUuid" : [UserInfo shareInstance].shop.uuid,
@"listGoodsUuid" : arrGoodsUuid};
WS(weakSelf)
[[HTTPCilent shareCilent] POST:questUrl parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
[weakSelf unparseData:responseObject];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
WS(weakSelf)
[[HTTPCilent shareCilent] POST:questUrl parameters:params success:^(NSURLSessionDataTask *task, id responseObject) {
[weakSelf unparseData:responseObject];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
}];
}
......@@ -321,7 +323,6 @@
[MBProgressHUD Javen_showSuccess:@"操作成功!" onView:self.view delay:0.7 complete:nil];
[self.dicSelectIds removeAllObjects];
[self.sorView defaultSelectISLeft:YES row:0];
[self resetReloadData];
}else{
[MBProgressHUD Javen_showError:@"未知错误!" onView:self.view delay:0.7 complete:nil];
......
......@@ -10,11 +10,17 @@
#import "OrderTableViewCell.h"
#import "OrderDetailViewController.h"
#import "OrderExpressTableViewCell.h"
#import "JavenOrderModel.h"
#import "JavenGoodsDetails.h"
#define kExpressCell @"OrderExpressTableViewCell.h"
#define kCellId @"OrderTableViewCell.h"
#define kPageSize @10
@interface NoPaymentTableViewController ()
@property (nonatomic, strong) NSArray *array;
@property (nonatomic, assign) NSInteger page;
@property (nonatomic, strong) NSMutableArray *arrDatas;
@end
@implementation NoPaymentTableViewController
......@@ -26,21 +32,79 @@
[self.tableView registerNib:[UINib nibWithNibName:@"OrderExpressTableViewCell" bundle:nil] forCellReuseIdentifier:kExpressCell];
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, 64, 0);
[self setUpData];
}
- (NSMutableArray *)arrDatas {
if (!_arrDatas) {
_arrDatas = [NSMutableArray array];
}
return _arrDatas;
}
- (void)setUpData {
WS(weakSelf)
[[HTTPCilent shareCilent] POST:@"order/query" parameters:[self getParams] success:^(NSURLSessionDataTask *task, id responseObject) {
for (NSDictionary *dic in responseObject[@"queryResult"]) {
JavenOrderModel *model = [JavenOrderModel modelObjectWithDictionary:dic];
[weakSelf.arrDatas addObject:model];
[weakSelf.tableView reloadData];
}
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
}
- (NSDictionary *)getParams {
NSString *orderState;
if ([self.orderTag isEqualToString:@"待支付"]) {
orderState = @"toBePaid";
}else if([self.orderTag isEqualToString:@"待发货"]){
orderState = @"toBeShipped";
}else if ([self.orderTag isEqualToString:@"已发货"]){
orderState = @"shipped";
}else if ([self.orderTag isEqualToString:@"已完成"]){
orderState = @"paid";
}else if ([self.orderTag isEqualToString:@"已取消"]){
orderState = @"cancelled";
}
NSDictionary *myDictionary = @{@"defintion" : @{@"conditions" : @[@{@"operation" : @"domain equals",
@"parameter" : @{@"operation" : @"string"},
@"parameters" : @[[UserInfo shareInstance].domain]},
@{@"operation" : @"reseller uuid equals",
@"parameter" : @{@"operation" : @"string"},
@"parameters" : @[[UserInfo shareInstance].uuid]},
@{@"operation" : @"order state equals",
@"parameter" : @{@"operation" : @"string"},
@"parameters" : @[orderState]}],
@"orders" : @[@{@"field" : @"reseller",
@"direction" : @"desc"}],
@"pageSize" : kPageSize,
@"page" : @0,
@"probePages" : @0},
@"fetchParts" : @[@"string"]};
return myDictionary;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([self.orderTag isEqualToString:@"支付"]) {
if ([self.orderTag isEqualToString:@"支付"]) {
}else if([self.orderTag isEqualToString:@"待发货"]){
}else if ([self.orderTag isEqualToString:@"已发货"]){
return 170 + 120 * [self.array[indexPath.row] integerValue];
return 170 + 120 * [self.arrDatas[indexPath.row] goodsDetails].count;
}else if ([self.orderTag isEqualToString:@"已完成"]){
return 170 + 120 * [self.array[indexPath.row] integerValue];
return 170 + 120 * [self.arrDatas[indexPath.row] goodsDetails].count;
}else if ([self.orderTag isEqualToString:@"已取消"]){
}
return 115 + 120 * [self.array[indexPath.row] integerValue];
return 115 + 120 * [self.arrDatas[indexPath.row] goodsDetails].count;
}
......@@ -58,7 +122,7 @@
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
return self.array.count;
return self.arrDatas.count;
}
......@@ -66,7 +130,7 @@
if ([self.orderTag isEqualToString:@"已发货"] || [self.orderTag isEqualToString:@"已完成"]) {
OrderExpressTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kExpressCell forIndexPath:indexPath];
[cell cellWithViewNumber: [self.array[indexPath.row] integerValue]];
[cell cellWithModel:self.arrDatas[indexPath.row]];
[cell setState:_orderTag];
cell.checkExpress.hidden = NO;
return cell;
......@@ -75,11 +139,8 @@
OrderTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
// Configure the cell...
[cell cellWithViewNumber: [self.array[indexPath.row] integerValue]];
[cell cellWithModel:self.arrDatas[indexPath.row]];
[cell setState:_orderTag];
// cell.checkExpress.hidden = NO;
return cell;
}
......@@ -101,7 +162,7 @@
}
orderDetailVC.isShowNavigationBar = YES;
orderDetailVC.model = self.arrDatas[indexPath.row];
[self.navigationController pushViewController:orderDetailVC animated:YES];
}
......
......@@ -8,9 +8,11 @@
#import "IBTUIViewController.h"
#import "OrderDetailTopView.h"
#import "JavenGoodsDetails.h"
#import "JavenOrderModel.h"
@interface OrderDetailViewController : IBTUIViewController
@property (nonatomic, strong) OrderDetailTopView *topView;
@property (nonatomic, assign) ORDERTOPTYPE orderType;
@property (nonatomic, strong) JavenOrderModel *model;
@end
......@@ -12,12 +12,15 @@
#import "UITableView+Category.h"
#import "SeeLogistics.h"
#import "OrderDetailBottomView.h"
#import "CommodityDetailViewController.h"
#import "CommodityListModel/CommotityListModel.h"
#define kCellId @"OrderDetailTableViewCell.h"
@interface OrderDetailViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) OrderDetailBottomView *bottomView;
@property (nonatomic, strong) OrderDetailTopView *atopView;
@end
@implementation OrderDetailViewController
......@@ -39,13 +42,13 @@
OrderDetailTopView *topView = [OrderDetailTopView viewWithNibName:@"OrderDetailTopView"];
self.atopView = topView;
self.atopView.orderType = self.orderType;
self.atopView.labelAddress.text = [NSString randomTestText];
[self.atopView viewWithModel:self.model];
[self.tableView addSubview:topView];
[self.atopView updateByOrderType];
self.bottomView = [OrderDetailBottomView viewWithNibName:@"OrderDetailBottomView"];
self.bottomView.laberRemark.text = [NSString randomTestText];
[self.bottomView viewWithModel:self.model];
self.tableView.tableFooterView = self.bottomView;
......@@ -87,15 +90,28 @@
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 3;
return self.model.goodsDetails.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
OrderDetailTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellId forIndexPath:indexPath];
[cell cellWithModel:self.model.goodsDetails[indexPath.row]];
return cell;
}
- (void)setUpTableView {
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
JavenGoodsDetails *details = self.model.goodsDetails[indexPath.row];
CommodityDetailViewController *detailVC = [[CommodityDetailViewController alloc] init];
CommotityListModel *model = [[CommotityListModel alloc] init];
model.uuid = details.goods.uuid;
model.name = details.goods.name;
OrderDetailTableViewCell *cell = (OrderDetailTableViewCell *)[tableView cellForRowAtIndexPath:indexPath];
detailVC.image = cell.imgCommdity.image;
detailVC.model = model;
[self.navigationController pushViewController:detailVC animated:YES];
}
......
......@@ -45,18 +45,22 @@
- (void)setUpView {
NSArray *arrTitle = @[@"支付",@"待发货",@"已发货",@"已完成",@"已取消"];
NSArray *arrTitle = @[@"支付",@"待发货",@"已发货",@"已完成",@"已取消"];
NSMutableArray *arrVC = [NSMutableArray array];
for (int i; i < arrTitle.count; i++) {
for (int i = 0; i < arrTitle.count; i++) {
NSLog(@"-----%ld", (long)i);
NoPaymentTableViewController *noPayMentVC = [[NoPaymentTableViewController alloc] init];
noPayMentVC.orderTag = arrTitle[i];
[arrVC addObject:noPayMentVC];
}
_viewMutiple = [[JavenMultipleViewWithHeader alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight)
views:arrVC
titles: arrTitle
titles:arrTitle
target:self
selectTextColor:kCustomGreenColor
selectBackgroundColor:kBacroundColor
......
......@@ -84,8 +84,15 @@
<constraint firstAttribute="width" constant="10" id="CPa-fC-cp8"/>
</constraints>
<state key="normal" image="bac"/>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hUK-HQ-XXe">
<rect key="frame" x="0.0" y="13" width="46" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="46" id="LY8-iA-fHO"/>
<constraint firstAttribute="height" constant="44" id="Wot-ZA-PZb"/>
</constraints>
<connections>
<action selector="actionBack:" destination="-1" eventType="touchUpInside" id="ByM-CS-SM8"/>
<action selector="actionBack:" destination="-1" eventType="touchUpInside" id="yqn-yV-Y7U"/>
</connections>
</button>
</subviews>
......@@ -98,11 +105,13 @@
<constraint firstItem="PBT-3w-ecp" firstAttribute="leading" secondItem="cCx-iM-GxW" secondAttribute="leading" constant="17" id="FHo-h0-wOl"/>
<constraint firstAttribute="height" constant="149" id="GV2-1Q-Ijp"/>
<constraint firstItem="Iih-6D-NVq" firstAttribute="top" secondItem="cCx-iM-GxW" secondAttribute="top" constant="20" id="JXO-eW-nEm"/>
<constraint firstItem="hUK-HQ-XXe" firstAttribute="leading" secondItem="cCx-iM-GxW" secondAttribute="leading" id="Jwj-Yj-2V1"/>
<constraint firstItem="4Yy-CO-HtC" firstAttribute="leading" secondItem="PBT-3w-ecp" secondAttribute="trailing" constant="8" id="NfU-92-PXZ"/>
<constraint firstItem="PBT-3w-ecp" firstAttribute="leading" secondItem="cCx-iM-GxW" secondAttribute="leading" constant="17" id="Ntd-9j-am9"/>
<constraint firstItem="PBT-3w-ecp" firstAttribute="leading" secondItem="cCx-iM-GxW" secondAttribute="leading" constant="18" id="Php-3h-4HB"/>
<constraint firstItem="PBT-3w-ecp" firstAttribute="leading" secondItem="cCx-iM-GxW" secondAttribute="leading" constant="17" id="QXy-R3-P0b"/>
<constraint firstItem="R3l-SJ-mVe" firstAttribute="leading" secondItem="4Yy-CO-HtC" secondAttribute="trailing" constant="1" id="XEe-Qm-ii1"/>
<constraint firstItem="hUK-HQ-XXe" firstAttribute="top" secondItem="cCx-iM-GxW" secondAttribute="top" constant="13" id="Yek-FD-W0b"/>
<constraint firstAttribute="bottom" secondItem="4Yy-CO-HtC" secondAttribute="bottom" constant="57" id="cby-QI-yPW"/>
<constraint firstAttribute="bottom" secondItem="PBT-3w-ecp" secondAttribute="bottom" constant="14" id="kiK-Uy-3cZ"/>
<constraint firstItem="asy-i8-hFm" firstAttribute="leading" secondItem="PBT-3w-ecp" secondAttribute="trailing" constant="8" id="mGi-eg-U9m"/>
......@@ -517,7 +526,7 @@
<constraint firstItem="09j-gr-hzZ" firstAttribute="top" secondItem="Pg9-CX-6W2" secondAttribute="bottom" constant="20" id="zAG-Wh-JeV"/>
</constraints>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
<point key="canvasLocation" x="326.5" y="424.5"/>
<point key="canvasLocation" x="124.5" y="355.5"/>
</view>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="9HI-NP-GLS">
<rect key="frame" x="0.0" y="0.0" width="46" height="30"/>
......
//
// AgreementViewController.h
// ALand
//
// Created by Z on 16/5/9.
// Copyright © 2016年 Z. All rights reserved.
//
#import "IBTUIViewController.h"
@interface AgreementViewController : IBTUIViewController
@end
//
// AgreementViewController.m
// ALand
//
// Created by Z on 16/5/9.
// Copyright © 2016年 Z. All rights reserved.
//
#import "AgreementViewController.h"
@interface AgreementViewController ()
@end
@implementation AgreementViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"经营者入驻协议";
WS(weakSelf)
[[HTTPCilent shareCilent] GET:[NSString stringWithFormat:@"app/getAppConfig/%@", kDomain] parameters:nil success:^(NSURLSessionDataTask *task, id responseObject) {
[weakSelf setUpWebView:responseObject[@"webShopBaseUrl"]];
} failure:^(NSURLSessionDataTask *task, NSError *error) {
}];
// Do any additional setup after loading the view from its nib.
}
- (void)setUpWebView:(NSString *)url {
NSString *inviteWebUrl = [NSString stringWithFormat:@"%@Wap/visitorXy.html", url];
NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:inviteWebUrl]];
UIWebView *webView = [UIWebView new];
[webView loadRequest:request];
[self.view addSubview:webView];
webView.scrollView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
webView.sd_layout.topSpaceToView(self.view, 0).leftSpaceToView(self.view, 0).rightSpaceToView(self.view, 0).bottomSpaceToView(self.view, 0);
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -10,6 +10,7 @@
#import "UIButton+countDown.h"
#import "AFNetworking.h"
#import "ToLoginViewController.h"
#import "AgreementViewController.h"
@interface RigistViewController ()
@property (weak, nonatomic) IBOutlet UIButton *sendCodeBtn;
@property (weak, nonatomic) IBOutlet UIButton *setPasswordVisible;
......@@ -36,7 +37,9 @@
- (IBAction)toAgreement:(UIButton *)sender {
AgreementViewController *agreementVC = [[AgreementViewController alloc] init];
agreementVC.isShowNavigationBar = YES;
[self.navigationController pushViewController:agreementVC animated:YES];
}
- (IBAction)setPasswordVisible:(UIButton *)sender {
......
......@@ -240,7 +240,7 @@
<exclude reference="NUC-qR-WA5"/>
</mask>
</variation>
<point key="canvasLocation" x="402.5" y="392.5"/>
<point key="canvasLocation" x="367.5" y="418.5"/>
</view>
</objects>
<resources>
......
//
// FeedBackViewController.h
// ALand
//
// Created by Z on 16/5/9.
// Copyright © 2016年 Z. All rights reserved.
//
#import "IBTUIViewController.h"
@interface FeedBackViewController : IBTUIViewController
@end
//
// FeedBackViewController.m
// ALand
//
// Created by Z on 16/5/9.
// Copyright © 2016年 Z. All rights reserved.
//
#import "FeedBackViewController.h"
@interface FeedBackViewController ()
@end
@implementation FeedBackViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"帮助与反馈";
// Do any additional setup after loading the view from its nib.
}
- (IBAction)actionSubmit:(id)sender {
WS(weakSelf)
[MBProgressHUD Javen_showSuccess:@"反馈成功,感谢您的反馈!" onView:self.view delay:1 complete:^{
[weakSelf.navigationController popViewControllerAnimated:YES];
}];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="FeedBackViewController">
<connections>
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
</connections>
</placeholder>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="Ejg-MZ-VMp">
<rect key="frame" x="20" y="30" width="335" height="200"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="200" id="bBS-uq-a0x"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="uus-VA-DS3">
<rect key="frame" x="32" y="300" width="311" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="fLr-4J-ZHc"/>
<constraint firstAttribute="width" constant="300" id="kiu-gI-Knq"/>
</constraints>
<fontDescription key="fontDescription" type="system" pointSize="22"/>
<state key="normal" title="提交" backgroundImage="rigist_btn_bg">
<color key="titleColor" red="0.97254901959999995" green="0.97254901959999995" blue="0.97254901959999995" alpha="1" colorSpace="calibratedRGB"/>
</state>
<variation key="default">
<mask key="constraints">
<exclude reference="kiu-gI-Knq"/>
</mask>
</variation>
<connections>
<action selector="actionSubmit:" destination="-1" eventType="touchUpInside" id="hw4-9E-pTb"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="0.94901960780000005" green="0.94901960780000005" blue="0.94901960780000005" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstItem="Ejg-MZ-VMp" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="20" id="FDE-sc-8VJ"/>
<constraint firstItem="Ejg-MZ-VMp" firstAttribute="top" secondItem="i5M-Pr-FkT" secondAttribute="top" constant="30" id="Hoo-Uw-R2n"/>
<constraint firstAttribute="trailing" secondItem="uus-VA-DS3" secondAttribute="trailing" constant="32" id="VFL-dP-SPM"/>
<constraint firstItem="uus-VA-DS3" firstAttribute="leading" secondItem="i5M-Pr-FkT" secondAttribute="leading" constant="32" id="Z65-Sm-D12"/>
<constraint firstAttribute="trailing" secondItem="Ejg-MZ-VMp" secondAttribute="trailing" constant="20" id="d81-PW-ykZ"/>
<constraint firstItem="uus-VA-DS3" firstAttribute="top" secondItem="Ejg-MZ-VMp" secondAttribute="bottom" constant="70" id="lXh-Vq-bAe"/>
</constraints>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina47"/>
</view>
</objects>
<resources>
<image name="rigist_btn_bg" width="490" height="65"/>
</resources>
</document>
......@@ -10,6 +10,8 @@
#import "SettingViewController.h"
#import "MyAcountViewController.h"
#import "MyBandCardViewController.h"
#import "FeedBackViewController.h"
#import "UIImage+Helper.h"
@interface MineViewController ()
@end
......@@ -40,11 +42,23 @@
[self.navigationController pushViewController:myBankCardVC animated:YES];
}
- (IBAction)invitePartner:(id)sender {
NSString *urlStr = [NSString stringWithFormat:@"%@ShopUser/gpregister/invitationCode/%@.html", [UserInfo shareInstance].webShopBaseUrl, [UserInfo shareInstance].invitationCode];
[[ShareInstance shareInstace] showWithTitle:@"Aland" content:@"大伙加入,共同致富!" url:urlStr image:[UIImage appIcon]];
}
- (IBAction)actionFeedBack:(id)sender {
FeedBackViewController *feedbackVC = [[FeedBackViewController alloc] init];
feedbackVC.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:feedbackVC animated:YES];
}
//设置
- (IBAction)actionSetting:(id)sender {
SettingViewController *settingVC = [[SettingViewController alloc] init];
settingVC.isShowNavigationBar = YES;
settingVC.hidesBottomBarWhenPushed = YES;
[self.navigationController pushViewController:settingVC animated:YES];
......
......@@ -246,6 +246,9 @@
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mvO-Ay-NPe">
<rect key="frame" x="0.0" y="0.0" width="344" height="54"/>
<connections>
<action selector="invitePartner:" destination="-1" eventType="touchUpInside" id="r2F-wQ-fNA"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
......@@ -301,6 +304,9 @@
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="rom-DH-Dmr">
<rect key="frame" x="0.0" y="0.0" width="375" height="55"/>
<connections>
<action selector="actionFeedBack:" destination="-1" eventType="touchUpInside" id="zxh-6W-IFx"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
......
......@@ -53,4 +53,11 @@
*/
- (UIImage *)scaledToWidth:(NSInteger)newWidth;
/**
* 获取APPIcon
*
* @return appIcon
*/
+ (UIImage *)appIcon;
@end
......@@ -221,4 +221,10 @@ typedef enum {
UIGraphicsEndImageContext();
return scaledImage;
}
+ (UIImage *)appIcon {
NSDictionary *infoPlist = [[NSBundle mainBundle] infoDictionary];
NSString *icon = [[infoPlist valueForKeyPath:@"CFBundleIcons.CFBundlePrimaryIcon.CFBundleIconFiles"]lastObject];
return [UIImage imageNamed:icon];
}
@end
......@@ -46,7 +46,7 @@
NSDictionary *dic = responseObject;
CLog(@"POST success!-------->%@", [dic JSONString]);
CLog(@"POST success!-------->\n%@", [dic JSONString]);
success(task, responseObject);
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
......
......@@ -15,9 +15,10 @@ typedef void (^selectedRow)(NSInteger);
@property (nonatomic, copy) selectedRow rightTableSelect;
@property (nonatomic, copy) selectedRow leftTableSelect;
+ (instancetype)sortViewLeftTitles:(NSArray *)leftTitles rightTitles:(NSArray *)rightTitles;
+ (instancetype)sortViewLeftTitles:(NSArray *)leftTitles rightTitles:(NSArray *)rightTitles;
- (void)hide;;
- (void)defaultSelectISLeft:(BOOL)isLeft row:(NSInteger)row;
- (NSArray *)getCurrentTitles;
@end
......@@ -171,7 +171,7 @@
if (self.arrTitles == self.arrLeft) {
space = @"left";
[self leftAction:nil];
[self setLeftBtnTitle:self.arrTitles[indexPath.row]];
[self setBtn:self.leftBtn Title:self.arrTitles[indexPath.row]];
CLog(@"%@", self.arrTitles[indexPath.row]);
[self.leftBtn setTitleColor:kCustomGreenColor forState:UIControlStateNormal];
[self.rightBtn setTitleColor:kTextColorBlack forState:UIControlStateNormal];
......@@ -180,7 +180,7 @@
}else{
space = @"right";
[self rightBtnAction];
[self.rightBtn setTitle:[NSString stringWithFormat:@"%@ ",self.arrTitles[indexPath.row]] forState:UIControlStateNormal];
[self setBtn:self.rightBtn Title:self.arrTitles[indexPath.row]];
[self.leftBtn setTitleColor:kTextColorBlack forState:UIControlStateNormal];
[self.rightBtn setTitleColor:kCustomGreenColor forState:UIControlStateNormal];
self.rightTableSelect(indexPath.row);
......@@ -213,17 +213,23 @@
return cell;
}
- (void)setLeftBtnTitle:(NSString *)str {
- (void)setBtn:(UIButton *)btn Title:(NSString *)str {
//只是为了让标题位置正确
[self.leftBtn setTitle:[NSString stringWithFormat:@"%@ ",str] forState:UIControlStateNormal];
if (str.length > 4) {
self.leftBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 130, 0, 0);
self.leftBtn.titleEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
[btn setTitle:[NSString stringWithFormat:@"%@ ",str] forState:UIControlStateNormal];
if (str.length > 6) {
btn.imageEdgeInsets = UIEdgeInsetsMake(0, 135, 0, 0);
btn.titleEdgeInsets = UIEdgeInsetsMake(0, -20, 0, 0);
}else if (str.length > 4) {
btn.imageEdgeInsets = UIEdgeInsetsMake(0, 130, 0, 0);
btn.titleEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0);
}else{
self.leftBtn.imageEdgeInsets = UIEdgeInsetsMake(0, 115, 0, 0);
self.leftBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
btn.imageEdgeInsets = UIEdgeInsetsMake(0, 115, 0, 0);
btn.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
}
NSLog(@"%f", self.leftBtn.titleLabel.frame.size.width);
}
- (void)leftAction:(UIButton *)btn {
......@@ -327,7 +333,7 @@
if (isLeft) {
self.isLeft = YES;
self.arrTitles = self.arrLeft;
[self setLeftBtnTitle:self.arrTitles[row]];
[self setBtn:self.leftBtn Title:self.arrTitles[row]];
[self.leftBtn setTitleColor:kCustomGreenColor forState:UIControlStateNormal];
[self.rightBtn setTitleColor:kTextColorBlack forState:UIControlStateNormal];
......@@ -335,7 +341,7 @@
}else{
self.isLeft = NO;
self.arrTitles = self.arrRight;
[self.rightBtn setTitle:[NSString stringWithFormat:@"%@ ",self.arrTitles[row]] forState:UIControlStateNormal];
[self setBtn:self.rightBtn Title:self.arrTitles[row]];
[self.leftBtn setTitleColor:kTextColorBlack forState:UIControlStateNormal];
[self.rightBtn setTitleColor:kCustomGreenColor forState:UIControlStateNormal];
self.isLeft = NO;
......@@ -343,6 +349,11 @@
}
}
- (NSArray *)getCurrentTitles {
NSArray *array = [NSArray arrayWithArray:self.arrTitles];
return array;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
......
//
// JavenAddress.h
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class JavenIdCard;
@interface JavenAddress : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *address;
@property (nonatomic, strong) NSString *cityCode;
@property (nonatomic, strong) NSString *country;
@property (nonatomic, strong) NSString *city;
@property (nonatomic, strong) JavenIdCard *idCard;
@property (nonatomic, strong) NSString *nation;
@property (nonatomic, assign) id zip;
@property (nonatomic, strong) NSString *telephone;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *province;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenAddress.m
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenAddress.h"
#import "JavenIdCard.h"
NSString *const kJavenAddressAddress = @"address";
NSString *const kJavenAddressCityCode = @"cityCode";
NSString *const kJavenAddressCountry = @"country";
NSString *const kJavenAddressCity = @"city";
NSString *const kJavenAddressIdCard = @"idCard";
NSString *const kJavenAddressNation = @"nation";
NSString *const kJavenAddressZip = @"zip";
NSString *const kJavenAddressTelephone = @"telephone";
NSString *const kJavenAddressName = @"name";
NSString *const kJavenAddressProvince = @"province";
@interface JavenAddress ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenAddress
@synthesize address = _address;
@synthesize cityCode = _cityCode;
@synthesize country = _country;
@synthesize city = _city;
@synthesize idCard = _idCard;
@synthesize nation = _nation;
@synthesize zip = _zip;
@synthesize telephone = _telephone;
@synthesize name = _name;
@synthesize province = _province;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.address = [self objectOrNilForKey:kJavenAddressAddress fromDictionary:dict];
self.cityCode = [self objectOrNilForKey:kJavenAddressCityCode fromDictionary:dict];
self.country = [self objectOrNilForKey:kJavenAddressCountry fromDictionary:dict];
self.city = [self objectOrNilForKey:kJavenAddressCity fromDictionary:dict];
self.idCard = [JavenIdCard modelObjectWithDictionary:[dict objectForKey:kJavenAddressIdCard]];
self.nation = [self objectOrNilForKey:kJavenAddressNation fromDictionary:dict];
self.zip = [self objectOrNilForKey:kJavenAddressZip fromDictionary:dict];
self.telephone = [self objectOrNilForKey:kJavenAddressTelephone fromDictionary:dict];
self.name = [self objectOrNilForKey:kJavenAddressName fromDictionary:dict];
self.province = [self objectOrNilForKey:kJavenAddressProvince fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.address forKey:kJavenAddressAddress];
[mutableDict setValue:self.cityCode forKey:kJavenAddressCityCode];
[mutableDict setValue:self.country forKey:kJavenAddressCountry];
[mutableDict setValue:self.city forKey:kJavenAddressCity];
[mutableDict setValue:[self.idCard dictionaryRepresentation] forKey:kJavenAddressIdCard];
[mutableDict setValue:self.nation forKey:kJavenAddressNation];
[mutableDict setValue:self.zip forKey:kJavenAddressZip];
[mutableDict setValue:self.telephone forKey:kJavenAddressTelephone];
[mutableDict setValue:self.name forKey:kJavenAddressName];
[mutableDict setValue:self.province forKey:kJavenAddressProvince];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.address = [aDecoder decodeObjectForKey:kJavenAddressAddress];
self.cityCode = [aDecoder decodeObjectForKey:kJavenAddressCityCode];
self.country = [aDecoder decodeObjectForKey:kJavenAddressCountry];
self.city = [aDecoder decodeObjectForKey:kJavenAddressCity];
self.idCard = [aDecoder decodeObjectForKey:kJavenAddressIdCard];
self.nation = [aDecoder decodeObjectForKey:kJavenAddressNation];
self.zip = [aDecoder decodeObjectForKey:kJavenAddressZip];
self.telephone = [aDecoder decodeObjectForKey:kJavenAddressTelephone];
self.name = [aDecoder decodeObjectForKey:kJavenAddressName];
self.province = [aDecoder decodeObjectForKey:kJavenAddressProvince];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_address forKey:kJavenAddressAddress];
[aCoder encodeObject:_cityCode forKey:kJavenAddressCityCode];
[aCoder encodeObject:_country forKey:kJavenAddressCountry];
[aCoder encodeObject:_city forKey:kJavenAddressCity];
[aCoder encodeObject:_idCard forKey:kJavenAddressIdCard];
[aCoder encodeObject:_nation forKey:kJavenAddressNation];
[aCoder encodeObject:_zip forKey:kJavenAddressZip];
[aCoder encodeObject:_telephone forKey:kJavenAddressTelephone];
[aCoder encodeObject:_name forKey:kJavenAddressName];
[aCoder encodeObject:_province forKey:kJavenAddressProvince];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenAddress *copy = [[JavenAddress alloc] init];
if (copy) {
copy.address = [self.address copyWithZone:zone];
copy.cityCode = [self.cityCode copyWithZone:zone];
copy.country = [self.country copyWithZone:zone];
copy.city = [self.city copyWithZone:zone];
copy.idCard = [self.idCard copyWithZone:zone];
copy.nation = [self.nation copyWithZone:zone];
copy.zip = [self.zip copyWithZone:zone];
copy.telephone = [self.telephone copyWithZone:zone];
copy.name = [self.name copyWithZone:zone];
copy.province = [self.province copyWithZone:zone];
}
return copy;
}
@end
//
// JavenBrand.h
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JavenBrand : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) NSString *code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenBrand.m
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenBrand.h"
NSString *const kJavenBrandName = @"name";
NSString *const kJavenBrandUuid = @"uuid";
NSString *const kJavenBrandCode = @"code";
@interface JavenBrand ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenBrand
@synthesize name = _name;
@synthesize uuid = _uuid;
@synthesize code = _code;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.name = [self objectOrNilForKey:kJavenBrandName fromDictionary:dict];
self.uuid = [self objectOrNilForKey:kJavenBrandUuid fromDictionary:dict];
self.code = [self objectOrNilForKey:kJavenBrandCode fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.name forKey:kJavenBrandName];
[mutableDict setValue:self.uuid forKey:kJavenBrandUuid];
[mutableDict setValue:self.code forKey:kJavenBrandCode];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.name = [aDecoder decodeObjectForKey:kJavenBrandName];
self.uuid = [aDecoder decodeObjectForKey:kJavenBrandUuid];
self.code = [aDecoder decodeObjectForKey:kJavenBrandCode];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_name forKey:kJavenBrandName];
[aCoder encodeObject:_uuid forKey:kJavenBrandUuid];
[aCoder encodeObject:_code forKey:kJavenBrandCode];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenBrand *copy = [[JavenBrand alloc] init];
if (copy) {
copy.name = [self.name copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
copy.code = [self.code copyWithZone:zone];
}
return copy;
}
@end
......@@ -12,7 +12,7 @@
@interface JavenCategory : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign) id code;
@property (nonatomic, strong) NSString *code;
@property (nonatomic, strong) NSString *uuid;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
......
//
// JavenGoods.h
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@class JavenCategory, JavenBrand;
@interface JavenGoods : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *uuid;
@property (nonatomic, strong) JavenCategory *category;
@property (nonatomic, assign) double salesVolume;
@property (nonatomic, assign) double visited;
@property (nonatomic, strong) JavenBrand *brand;
@property (nonatomic, assign) id engName;
@property (nonatomic, strong) NSString *pictures;
@property (nonatomic, assign) double price;
@property (nonatomic, assign) double originalPrice;
@property (nonatomic, strong) NSString *specName;
@property (nonatomic, assign) double favorited;
@property (nonatomic, strong) NSString *cover;
@property (nonatomic, assign) double commission;
@property (nonatomic, strong) NSString *tranferType;
@property (nonatomic, assign) double inv;
@property (nonatomic, strong) NSString *name;
@property (nonatomic, assign) double score;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenGoods.m
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenGoods.h"
#import "JavenCategory.h"
#import "JavenBrand.h"
NSString *const kJavenGoodsUuid = @"uuid";
NSString *const kJavenGoodsCategory = @"category";
NSString *const kJavenGoodsSalesVolume = @"salesVolume";
NSString *const kJavenGoodsVisited = @"visited";
NSString *const kJavenGoodsBrand = @"brand";
NSString *const kJavenGoodsEngName = @"engName";
NSString *const kJavenGoodsPictures = @"pictures";
NSString *const kJavenGoodsPrice = @"price";
NSString *const kJavenGoodsOriginalPrice = @"originalPrice";
NSString *const kJavenGoodsSpecName = @"specName";
NSString *const kJavenGoodsFavorited = @"favorited";
NSString *const kJavenGoodsCover = @"cover";
NSString *const kJavenGoodsCommission = @"commission";
NSString *const kJavenGoodsTranferType = @"tranferType";
NSString *const kJavenGoodsInv = @"inv";
NSString *const kJavenGoodsName = @"name";
NSString *const kJavenGoodsScore = @"score";
@interface JavenGoods ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenGoods
@synthesize uuid = _uuid;
@synthesize category = _category;
@synthesize salesVolume = _salesVolume;
@synthesize visited = _visited;
@synthesize brand = _brand;
@synthesize engName = _engName;
@synthesize pictures = _pictures;
@synthesize price = _price;
@synthesize originalPrice = _originalPrice;
@synthesize specName = _specName;
@synthesize favorited = _favorited;
@synthesize cover = _cover;
@synthesize commission = _commission;
@synthesize tranferType = _tranferType;
@synthesize inv = _inv;
@synthesize name = _name;
@synthesize score = _score;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.uuid = [self objectOrNilForKey:kJavenGoodsUuid fromDictionary:dict];
self.category = [JavenCategory modelObjectWithDictionary:[dict objectForKey:kJavenGoodsCategory]];
self.salesVolume = [[self objectOrNilForKey:kJavenGoodsSalesVolume fromDictionary:dict] doubleValue];
self.visited = [[self objectOrNilForKey:kJavenGoodsVisited fromDictionary:dict] doubleValue];
self.brand = [JavenBrand modelObjectWithDictionary:[dict objectForKey:kJavenGoodsBrand]];
self.engName = [self objectOrNilForKey:kJavenGoodsEngName fromDictionary:dict];
self.pictures = [self objectOrNilForKey:kJavenGoodsPictures fromDictionary:dict];
self.price = [[self objectOrNilForKey:kJavenGoodsPrice fromDictionary:dict] doubleValue];
self.originalPrice = [[self objectOrNilForKey:kJavenGoodsOriginalPrice fromDictionary:dict] doubleValue];
self.specName = [self objectOrNilForKey:kJavenGoodsSpecName fromDictionary:dict];
self.favorited = [[self objectOrNilForKey:kJavenGoodsFavorited fromDictionary:dict] doubleValue];
self.cover = [self objectOrNilForKey:kJavenGoodsCover fromDictionary:dict];
self.commission = [[self objectOrNilForKey:kJavenGoodsCommission fromDictionary:dict] doubleValue];
self.tranferType = [self objectOrNilForKey:kJavenGoodsTranferType fromDictionary:dict];
self.inv = [[self objectOrNilForKey:kJavenGoodsInv fromDictionary:dict] doubleValue];
self.name = [self objectOrNilForKey:kJavenGoodsName fromDictionary:dict];
self.score = [[self objectOrNilForKey:kJavenGoodsScore fromDictionary:dict] doubleValue];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.uuid forKey:kJavenGoodsUuid];
[mutableDict setValue:[self.category dictionaryRepresentation] forKey:kJavenGoodsCategory];
[mutableDict setValue:[NSNumber numberWithDouble:self.salesVolume] forKey:kJavenGoodsSalesVolume];
[mutableDict setValue:[NSNumber numberWithDouble:self.visited] forKey:kJavenGoodsVisited];
[mutableDict setValue:[self.brand dictionaryRepresentation] forKey:kJavenGoodsBrand];
[mutableDict setValue:self.engName forKey:kJavenGoodsEngName];
[mutableDict setValue:self.pictures forKey:kJavenGoodsPictures];
[mutableDict setValue:[NSNumber numberWithDouble:self.price] forKey:kJavenGoodsPrice];
[mutableDict setValue:[NSNumber numberWithDouble:self.originalPrice] forKey:kJavenGoodsOriginalPrice];
[mutableDict setValue:self.specName forKey:kJavenGoodsSpecName];
[mutableDict setValue:[NSNumber numberWithDouble:self.favorited] forKey:kJavenGoodsFavorited];
[mutableDict setValue:self.cover forKey:kJavenGoodsCover];
[mutableDict setValue:[NSNumber numberWithDouble:self.commission] forKey:kJavenGoodsCommission];
[mutableDict setValue:self.tranferType forKey:kJavenGoodsTranferType];
[mutableDict setValue:[NSNumber numberWithDouble:self.inv] forKey:kJavenGoodsInv];
[mutableDict setValue:self.name forKey:kJavenGoodsName];
[mutableDict setValue:[NSNumber numberWithDouble:self.score] forKey:kJavenGoodsScore];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.uuid = [aDecoder decodeObjectForKey:kJavenGoodsUuid];
self.category = [aDecoder decodeObjectForKey:kJavenGoodsCategory];
self.salesVolume = [aDecoder decodeDoubleForKey:kJavenGoodsSalesVolume];
self.visited = [aDecoder decodeDoubleForKey:kJavenGoodsVisited];
self.brand = [aDecoder decodeObjectForKey:kJavenGoodsBrand];
self.engName = [aDecoder decodeObjectForKey:kJavenGoodsEngName];
self.pictures = [aDecoder decodeObjectForKey:kJavenGoodsPictures];
self.price = [aDecoder decodeDoubleForKey:kJavenGoodsPrice];
self.originalPrice = [aDecoder decodeDoubleForKey:kJavenGoodsOriginalPrice];
self.specName = [aDecoder decodeObjectForKey:kJavenGoodsSpecName];
self.favorited = [aDecoder decodeDoubleForKey:kJavenGoodsFavorited];
self.cover = [aDecoder decodeObjectForKey:kJavenGoodsCover];
self.commission = [aDecoder decodeDoubleForKey:kJavenGoodsCommission];
self.tranferType = [aDecoder decodeObjectForKey:kJavenGoodsTranferType];
self.inv = [aDecoder decodeDoubleForKey:kJavenGoodsInv];
self.name = [aDecoder decodeObjectForKey:kJavenGoodsName];
self.score = [aDecoder decodeDoubleForKey:kJavenGoodsScore];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_uuid forKey:kJavenGoodsUuid];
[aCoder encodeObject:_category forKey:kJavenGoodsCategory];
[aCoder encodeDouble:_salesVolume forKey:kJavenGoodsSalesVolume];
[aCoder encodeDouble:_visited forKey:kJavenGoodsVisited];
[aCoder encodeObject:_brand forKey:kJavenGoodsBrand];
[aCoder encodeObject:_engName forKey:kJavenGoodsEngName];
[aCoder encodeObject:_pictures forKey:kJavenGoodsPictures];
[aCoder encodeDouble:_price forKey:kJavenGoodsPrice];
[aCoder encodeDouble:_originalPrice forKey:kJavenGoodsOriginalPrice];
[aCoder encodeObject:_specName forKey:kJavenGoodsSpecName];
[aCoder encodeDouble:_favorited forKey:kJavenGoodsFavorited];
[aCoder encodeObject:_cover forKey:kJavenGoodsCover];
[aCoder encodeDouble:_commission forKey:kJavenGoodsCommission];
[aCoder encodeObject:_tranferType forKey:kJavenGoodsTranferType];
[aCoder encodeDouble:_inv forKey:kJavenGoodsInv];
[aCoder encodeObject:_name forKey:kJavenGoodsName];
[aCoder encodeDouble:_score forKey:kJavenGoodsScore];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenGoods *copy = [[JavenGoods alloc] init];
if (copy) {
copy.uuid = [self.uuid copyWithZone:zone];
copy.category = [self.category copyWithZone:zone];
copy.salesVolume = self.salesVolume;
copy.visited = self.visited;
copy.brand = [self.brand copyWithZone:zone];
copy.engName = [self.engName copyWithZone:zone];
copy.pictures = [self.pictures copyWithZone:zone];
copy.price = self.price;
copy.originalPrice = self.originalPrice;
copy.specName = [self.specName copyWithZone:zone];
copy.favorited = self.favorited;
copy.cover = [self.cover copyWithZone:zone];
copy.commission = self.commission;
copy.tranferType = [self.tranferType copyWithZone:zone];
copy.inv = self.inv;
copy.name = [self.name copyWithZone:zone];
copy.score = self.score;
}
return copy;
}
@end
//
// JavenGoodsDetails.h
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "JavenGoods.h"
@class JavenGoods;
@interface JavenGoodsDetails : NSObject <NSCoding, NSCopying>
@property (nonatomic, assign) double order;
@property (nonatomic, assign) double tax;
@property (nonatomic, assign) double count;
@property (nonatomic, assign) double price;
@property (nonatomic, assign) double commission;
@property (nonatomic, strong) JavenGoods *goods;
@property (nonatomic, strong) NSString *uuid;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenGoodsDetails.m
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenGoodsDetails.h"
NSString *const kJavenGoodsDetailsOrder = @"order";
NSString *const kJavenGoodsDetailsTax = @"tax";
NSString *const kJavenGoodsDetailsCount = @"count";
NSString *const kJavenGoodsDetailsPrice = @"price";
NSString *const kJavenGoodsDetailsCommission = @"commission";
NSString *const kJavenGoodsDetailsGoods = @"goods";
NSString *const kJavenGoodsDetailsUuid = @"uuid";
@interface JavenGoodsDetails ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenGoodsDetails
@synthesize order = _order;
@synthesize tax = _tax;
@synthesize count = _count;
@synthesize price = _price;
@synthesize commission = _commission;
@synthesize goods = _goods;
@synthesize uuid = _uuid;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.order = [[self objectOrNilForKey:kJavenGoodsDetailsOrder fromDictionary:dict] doubleValue];
self.tax = [[self objectOrNilForKey:kJavenGoodsDetailsTax fromDictionary:dict] doubleValue];
self.count = [[self objectOrNilForKey:kJavenGoodsDetailsCount fromDictionary:dict] doubleValue];
self.price = [[self objectOrNilForKey:kJavenGoodsDetailsPrice fromDictionary:dict] doubleValue];
self.commission = [[self objectOrNilForKey:kJavenGoodsDetailsCommission fromDictionary:dict] doubleValue];
self.goods = [JavenGoods modelObjectWithDictionary:[dict objectForKey:kJavenGoodsDetailsGoods]];
self.uuid = [self objectOrNilForKey:kJavenGoodsDetailsUuid fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:[NSNumber numberWithDouble:self.order] forKey:kJavenGoodsDetailsOrder];
[mutableDict setValue:[NSNumber numberWithDouble:self.tax] forKey:kJavenGoodsDetailsTax];
[mutableDict setValue:[NSNumber numberWithDouble:self.count] forKey:kJavenGoodsDetailsCount];
[mutableDict setValue:[NSNumber numberWithDouble:self.price] forKey:kJavenGoodsDetailsPrice];
[mutableDict setValue:[NSNumber numberWithDouble:self.commission] forKey:kJavenGoodsDetailsCommission];
[mutableDict setValue:[self.goods dictionaryRepresentation] forKey:kJavenGoodsDetailsGoods];
[mutableDict setValue:self.uuid forKey:kJavenGoodsDetailsUuid];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.order = [aDecoder decodeDoubleForKey:kJavenGoodsDetailsOrder];
self.tax = [aDecoder decodeDoubleForKey:kJavenGoodsDetailsTax];
self.count = [aDecoder decodeDoubleForKey:kJavenGoodsDetailsCount];
self.price = [aDecoder decodeDoubleForKey:kJavenGoodsDetailsPrice];
self.commission = [aDecoder decodeDoubleForKey:kJavenGoodsDetailsCommission];
self.goods = [aDecoder decodeObjectForKey:kJavenGoodsDetailsGoods];
self.uuid = [aDecoder decodeObjectForKey:kJavenGoodsDetailsUuid];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeDouble:_order forKey:kJavenGoodsDetailsOrder];
[aCoder encodeDouble:_tax forKey:kJavenGoodsDetailsTax];
[aCoder encodeDouble:_count forKey:kJavenGoodsDetailsCount];
[aCoder encodeDouble:_price forKey:kJavenGoodsDetailsPrice];
[aCoder encodeDouble:_commission forKey:kJavenGoodsDetailsCommission];
[aCoder encodeObject:_goods forKey:kJavenGoodsDetailsGoods];
[aCoder encodeObject:_uuid forKey:kJavenGoodsDetailsUuid];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenGoodsDetails *copy = [[JavenGoodsDetails alloc] init];
if (copy) {
copy.order = self.order;
copy.tax = self.tax;
copy.count = self.count;
copy.price = self.price;
copy.commission = self.commission;
copy.goods = [self.goods copyWithZone:zone];
copy.uuid = [self.uuid copyWithZone:zone];
}
return copy;
}
@end
......@@ -12,7 +12,7 @@
@interface JavenIdCard : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *idType;
@property (nonatomic, assign) id idNum;
@property (nonatomic, strong) NSString *idNum;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
......
//
// JavenTicket.h
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface JavenTicket : NSObject <NSCoding, NSCopying>
@property (nonatomic, strong) NSString *type;
@property (nonatomic, strong) NSString *content;
@property (nonatomic, assign) id title;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict;
- (instancetype)initWithDictionary:(NSDictionary *)dict;
- (NSDictionary *)dictionaryRepresentation;
@end
//
// JavenTicket.m
//
// Created by Z on 16/5/9
// Copyright (c) 2016 __MyCompanyName__. All rights reserved.
//
#import "JavenTicket.h"
NSString *const kJavenTicketType = @"type";
NSString *const kJavenTicketContent = @"content";
NSString *const kJavenTicketTitle = @"title";
@interface JavenTicket ()
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict;
@end
@implementation JavenTicket
@synthesize type = _type;
@synthesize content = _content;
@synthesize title = _title;
+ (instancetype)modelObjectWithDictionary:(NSDictionary *)dict
{
return [[self alloc] initWithDictionary:dict];
}
- (instancetype)initWithDictionary:(NSDictionary *)dict
{
self = [super init];
// This check serves to make sure that a non-NSDictionary object
// passed into the model class doesn't break the parsing.
if(self && [dict isKindOfClass:[NSDictionary class]]) {
self.type = [self objectOrNilForKey:kJavenTicketType fromDictionary:dict];
self.content = [self objectOrNilForKey:kJavenTicketContent fromDictionary:dict];
self.title = [self objectOrNilForKey:kJavenTicketTitle fromDictionary:dict];
}
return self;
}
- (NSDictionary *)dictionaryRepresentation
{
NSMutableDictionary *mutableDict = [NSMutableDictionary dictionary];
[mutableDict setValue:self.type forKey:kJavenTicketType];
[mutableDict setValue:self.content forKey:kJavenTicketContent];
[mutableDict setValue:self.title forKey:kJavenTicketTitle];
return [NSDictionary dictionaryWithDictionary:mutableDict];
}
- (NSString *)description
{
return [NSString stringWithFormat:@"%@", [self dictionaryRepresentation]];
}
#pragma mark - Helper Method
- (id)objectOrNilForKey:(id)aKey fromDictionary:(NSDictionary *)dict
{
id object = [dict objectForKey:aKey];
return [object isEqual:[NSNull null]] ? nil : object;
}
#pragma mark - NSCoding Methods
- (id)initWithCoder:(NSCoder *)aDecoder
{
self = [super init];
self.type = [aDecoder decodeObjectForKey:kJavenTicketType];
self.content = [aDecoder decodeObjectForKey:kJavenTicketContent];
self.title = [aDecoder decodeObjectForKey:kJavenTicketTitle];
return self;
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_type forKey:kJavenTicketType];
[aCoder encodeObject:_content forKey:kJavenTicketContent];
[aCoder encodeObject:_title forKey:kJavenTicketTitle];
}
- (id)copyWithZone:(NSZone *)zone
{
JavenTicket *copy = [[JavenTicket alloc] init];
if (copy) {
copy.type = [self.type copyWithZone:zone];
copy.content = [self.content copyWithZone:zone];
copy.title = [self.title copyWithZone:zone];
}
return copy;
}
@end
......@@ -15,6 +15,14 @@
@implementation IBTUIViewController
#pragma mark - Life Cycle
- (instancetype)init {
self = [super init];
if (self) {
self.isShowNavigationBar = YES;
}
return self;
}
- (void)viewDidLoad {
[super viewDidLoad];
......@@ -57,12 +65,9 @@
[self addLeftBarBtnItemWithName:_cancelButtonName action:@selector(disMissSelf)];
}
if (self.isShowNavigationBar == YES) {
[self.navigationController setNavigationBarHidden:NO animated:YES];
}else if (self.isShowNavigationBar == NO){
[self.navigationController setNavigationBarHidden:YES animated:YES];
}
[self.navigationController setNavigationBarHidden:!self.isShowNavigationBar animated:YES];
}
- (void)viewDidAppear:(BOOL)animated {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment