Commit b142b254 by lee

add currency select

parent 68a4164f
......@@ -67,6 +67,8 @@
80F82E611D704E34008B470B /* KWMBrandCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 80F82E5F1D704E34008B470B /* KWMBrandCell.m */; };
80F82E621D704E34008B470B /* KWMBrandCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 80F82E601D704E34008B470B /* KWMBrandCell.xib */; };
80FBF7E18C063DB9E8DC7502 /* libPods-iCemarose.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 450DA8BB947651E9A9B38BEB /* libPods-iCemarose.a */; };
9B01488B1EF3B5330056D937 /* KWMSelectCurrencyVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B01488A1EF3B5330056D937 /* KWMSelectCurrencyVC.m */; };
9B01488E1EF3B8760056D937 /* KWMSelectCurrencyCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B01488D1EF3B8760056D937 /* KWMSelectCurrencyCell.m */; };
9B0F56B81ECD3424009FC5FE /* UIViewController+AppearLog.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B0F56B71ECD3424009FC5FE /* UIViewController+AppearLog.m */; };
9B166F511ED6DBCF003E9F03 /* KWMHttpUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B166F501ED6DBCF003E9F03 /* KWMHttpUtil.m */; };
9B18C11F1EF1270A001DD59B /* BUYProductVariant+Currency.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B18C11E1EF1270A001DD59B /* BUYProductVariant+Currency.m */; };
......@@ -412,6 +414,10 @@
80F82E5E1D704E34008B470B /* KWMBrandCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMBrandCell.h; sourceTree = "<group>"; };
80F82E5F1D704E34008B470B /* KWMBrandCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMBrandCell.m; sourceTree = "<group>"; };
80F82E601D704E34008B470B /* KWMBrandCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = KWMBrandCell.xib; sourceTree = "<group>"; };
9B0148891EF3B5330056D937 /* KWMSelectCurrencyVC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMSelectCurrencyVC.h; sourceTree = "<group>"; };
9B01488A1EF3B5330056D937 /* KWMSelectCurrencyVC.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMSelectCurrencyVC.m; sourceTree = "<group>"; };
9B01488C1EF3B8750056D937 /* KWMSelectCurrencyCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMSelectCurrencyCell.h; sourceTree = "<group>"; };
9B01488D1EF3B8760056D937 /* KWMSelectCurrencyCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMSelectCurrencyCell.m; sourceTree = "<group>"; };
9B0F56B61ECD3424009FC5FE /* UIViewController+AppearLog.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+AppearLog.h"; sourceTree = "<group>"; };
9B0F56B71ECD3424009FC5FE /* UIViewController+AppearLog.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+AppearLog.m"; sourceTree = "<group>"; };
9B166F4F1ED6DBCF003E9F03 /* KWMHttpUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMHttpUtil.h; sourceTree = "<group>"; };
......@@ -1305,6 +1311,8 @@
C06665111D767A0A00F02EF4 /* KWMContactUsVC.m */,
C03A05041E35DC5800BAA889 /* KWMNewGiftCardVC.h */,
C03A05051E35DC5800BAA889 /* KWMNewGiftCardVC.m */,
9B0148891EF3B5330056D937 /* KWMSelectCurrencyVC.h */,
9B01488A1EF3B5330056D937 /* KWMSelectCurrencyVC.m */,
);
path = Mine;
sourceTree = "<group>";
......@@ -1708,6 +1716,8 @@
C05910911E34A729002990B3 /* KWMNewGiftCardCell.h */,
C05910921E34A729002990B3 /* KWMNewGiftCardCell.m */,
C05910931E34A729002990B3 /* KWMNewGiftCardCell.xib */,
9B01488C1EF3B8750056D937 /* KWMSelectCurrencyCell.h */,
9B01488D1EF3B8760056D937 /* KWMSelectCurrencyCell.m */,
);
path = Cell;
sourceTree = "<group>";
......@@ -2179,6 +2189,7 @@
C0F5867A1E24F820001248E2 /* KWMDoubleTitleView.m in Sources */,
8091DFBB1D6EC1DD0020519C /* KWMThreeView.m in Sources */,
C0DD53371EE55190002D1E0C /* KWMLoadingView.m in Sources */,
9B01488E1EF3B8760056D937 /* KWMSelectCurrencyCell.m in Sources */,
C03120B01EF2B26B00E49EFA /* KWMPayUtil.m in Sources */,
9BE61CFB1ECD56E70031D21E /* KWMDictioaryResult.m in Sources */,
C034E6D81D6AEF1B006EE129 /* KWMImageUtil.m in Sources */,
......@@ -2317,6 +2328,7 @@
C0DD533B1EE55190002D1E0C /* KWMSuperLoadingView.m in Sources */,
C034E85D1D6B10A0006EE129 /* PBConst.m in Sources */,
C0CCB3D11EEA765B00BC2FB8 /* KWMNormalFilterTab.m in Sources */,
9B01488B1EF3B5330056D937 /* KWMSelectCurrencyVC.m in Sources */,
C0CC140F1D7926DF007B5986 /* KWMBeforePayVC.m in Sources */,
C034E8441D6B10A0006EE129 /* NSObject+Extend.m in Sources */,
80A611B21D6DB0EC00709E09 /* KWMShopCartVC.m in Sources */,
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16E195" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="n8p-We-k4e">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="n8p-We-k4e">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
......@@ -245,7 +246,7 @@
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="wXS-V2-TqO">
<rect key="frame" x="60" y="59" width="315" height="1"/>
<color key="backgroundColor" red="0.84705882352941175" green="0.85882352941176465" blue="0.87058823529411766" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<color key="backgroundColor" red="0.80000000000000004" green="0.80000000000000004" blue="0.80000000000000004" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="Xow-hA-06D"/>
</constraints>
......@@ -291,16 +292,26 @@
<constraint firstAttribute="height" constant="13" id="sFW-tE-VEF"/>
</constraints>
</imageView>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mjU-gr-Y4Y">
<rect key="frame" x="60" y="59" width="315" height="1"/>
<color key="backgroundColor" red="0.80000000000000004" green="0.80000000000000004" blue="0.80000000000000004" alpha="1" colorSpace="calibratedRGB"/>
<constraints>
<constraint firstAttribute="height" constant="1" id="wSt-87-Bfb"/>
</constraints>
</view>
</subviews>
<color key="backgroundColor" red="0.95686274510000002" green="0.96078431369999995" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="trailing" secondItem="4ec-Cr-06B" secondAttribute="trailing" constant="20" id="2S5-rp-1Hc"/>
<constraint firstAttribute="bottom" secondItem="mjU-gr-Y4Y" secondAttribute="bottom" id="4Tg-yO-odZ"/>
<constraint firstItem="2xL-Ue-j1U" firstAttribute="centerY" secondItem="hXm-vK-Gyb" secondAttribute="centerY" id="6Gs-cl-2E6"/>
<constraint firstItem="2xL-Ue-j1U" firstAttribute="leading" secondItem="hXm-vK-Gyb" secondAttribute="leading" constant="20" id="FDH-Vq-Ff9"/>
<constraint firstItem="4ec-Cr-06B" firstAttribute="centerY" secondItem="hXm-vK-Gyb" secondAttribute="centerY" id="VIB-bV-Rge"/>
<constraint firstAttribute="height" constant="60" id="Xh0-kX-DHp"/>
<constraint firstItem="fon-DU-W2x" firstAttribute="centerY" secondItem="hXm-vK-Gyb" secondAttribute="centerY" id="cWx-Vj-z2v"/>
<constraint firstItem="fon-DU-W2x" firstAttribute="leading" secondItem="2xL-Ue-j1U" secondAttribute="trailing" constant="20" id="jw1-ji-Ls8"/>
<constraint firstAttribute="trailing" secondItem="mjU-gr-Y4Y" secondAttribute="trailing" id="oGX-DU-hwl"/>
<constraint firstItem="mjU-gr-Y4Y" firstAttribute="leading" secondItem="hXm-vK-Gyb" secondAttribute="leading" constant="60" id="urB-6i-Wun"/>
</constraints>
<connections>
<outletCollection property="gestureRecognizers" destination="hgo-Kr-ZsN" appends="YES" id="5Xd-tn-Uo3"/>
......@@ -350,6 +361,45 @@
<outletCollection property="gestureRecognizers" destination="DED-9F-c8a" appends="YES" id="xc2-YF-AFB"/>
</connections>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Bnj-mM-yOg" userLabel="vCurrency">
<rect key="frame" x="0.0" y="340" width="375" height="60"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="ic_mine_list_contact us" translatesAutoresizingMaskIntoConstraints="NO" id="XYm-BY-baw">
<rect key="frame" x="20" y="20" width="20" height="20"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="Jgv-nE-nFl"/>
<constraint firstAttribute="width" constant="20" id="sON-73-XnY"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="货币" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="MQV-ul-qVa">
<rect key="frame" x="60" y="20" width="30" height="21"/>
<fontDescription key="fontDescription" name="PingFangSC-Medium" family="PingFang SC" pointSize="15"/>
<color key="textColor" red="0.22352941179999999" green="0.22352941179999999" blue="0.22352941179999999" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="button_mine_more" translatesAutoresizingMaskIntoConstraints="NO" id="jUq-il-D4i">
<rect key="frame" x="349" y="24" width="6" height="13"/>
<constraints>
<constraint firstAttribute="height" constant="13" id="fEf-fz-rDT"/>
<constraint firstAttribute="width" constant="6" id="vI4-hL-gx4"/>
</constraints>
</imageView>
</subviews>
<color key="backgroundColor" red="0.95686274510000002" green="0.96078431369999995" blue="0.96862745100000003" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
<constraints>
<constraint firstAttribute="height" constant="60" id="8Zc-Py-Lm2"/>
<constraint firstItem="XYm-BY-baw" firstAttribute="centerY" secondItem="Bnj-mM-yOg" secondAttribute="centerY" id="Dib-dO-Kz5"/>
<constraint firstItem="MQV-ul-qVa" firstAttribute="centerY" secondItem="Bnj-mM-yOg" secondAttribute="centerY" id="K3m-ek-ane"/>
<constraint firstItem="XYm-BY-baw" firstAttribute="leading" secondItem="Bnj-mM-yOg" secondAttribute="leading" constant="20" id="O5g-PV-GDL"/>
<constraint firstItem="MQV-ul-qVa" firstAttribute="leading" secondItem="XYm-BY-baw" secondAttribute="trailing" constant="20" id="Uol-8T-QGw"/>
<constraint firstItem="jUq-il-D4i" firstAttribute="centerY" secondItem="Bnj-mM-yOg" secondAttribute="centerY" id="bvw-Bx-1yz"/>
<constraint firstAttribute="trailing" secondItem="jUq-il-D4i" secondAttribute="trailing" constant="20" id="uwa-dY-WvT"/>
</constraints>
<connections>
<outletCollection property="gestureRecognizers" destination="tns-4h-lSH" appends="YES" id="QS2-bx-jBg"/>
</connections>
</view>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<gestureRecognizers/>
......@@ -362,6 +412,8 @@
<constraint firstItem="gq6-eo-S0I" firstAttribute="leading" secondItem="ls4-qX-r5H" secondAttribute="leading" id="RbJ-Cr-Phj"/>
<constraint firstItem="8Gq-gg-k4w" firstAttribute="leading" secondItem="ls4-qX-r5H" secondAttribute="leading" id="WXh-Oz-KTE"/>
<constraint firstItem="eGQ-6R-Q7T" firstAttribute="leading" secondItem="ls4-qX-r5H" secondAttribute="leading" id="adJ-MI-GXX"/>
<constraint firstAttribute="trailing" secondItem="Bnj-mM-yOg" secondAttribute="trailing" id="fM2-mR-kTs"/>
<constraint firstItem="Bnj-mM-yOg" firstAttribute="top" secondItem="hXm-vK-Gyb" secondAttribute="bottom" id="h5O-eL-Ass"/>
<constraint firstAttribute="trailing" secondItem="hXm-vK-Gyb" secondAttribute="trailing" id="mgl-Sf-gbJ"/>
<constraint firstItem="8Gq-gg-k4w" firstAttribute="top" secondItem="ZJV-Hx-p4h" secondAttribute="bottom" id="mql-P3-Pjj"/>
<constraint firstAttribute="trailing" secondItem="pPH-sX-qFu" secondAttribute="trailing" id="mvu-bw-d26"/>
......@@ -371,6 +423,7 @@
<constraint firstItem="hXm-vK-Gyb" firstAttribute="top" secondItem="8Gq-gg-k4w" secondAttribute="bottom" id="tqk-oN-Nqc"/>
<constraint firstAttribute="trailing" secondItem="gq6-eo-S0I" secondAttribute="trailing" id="u8j-D5-u3j"/>
<constraint firstAttribute="trailing" secondItem="eGQ-6R-Q7T" secondAttribute="trailing" id="uLD-sI-IkP"/>
<constraint firstItem="Bnj-mM-yOg" firstAttribute="leading" secondItem="ls4-qX-r5H" secondAttribute="leading" id="wBZ-2w-KJd"/>
<constraint firstItem="hXm-vK-Gyb" firstAttribute="leading" secondItem="ls4-qX-r5H" secondAttribute="leading" id="wnw-43-awO"/>
</constraints>
</view>
......@@ -397,6 +450,7 @@
<outlet property="btnLogin" destination="01m-8h-W1G" id="yA3-CO-lGz"/>
<outlet property="loginBottom" destination="O2b-N3-TYT" id="ol0-4b-t9g"/>
<outlet property="vIconHeight" destination="q43-hS-hog" id="QhN-yA-t1z"/>
<segue destination="nM6-S9-y8d" kind="show" identifier="MeToCurrency" id="byr-UQ-zZJ"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="clP-Bb-lVh" userLabel="First Responder" sceneMemberID="firstResponder"/>
......@@ -425,8 +479,56 @@
<action selector="onClickLogout:" destination="A2m-KK-eBc" id="hpr-Fq-OuG"/>
</connections>
</tapGestureRecognizer>
<tapGestureRecognizer id="tns-4h-lSH" userLabel="tagCurrency">
<connections>
<action selector="onClickCurrency:" destination="A2m-KK-eBc" id="WTc-vn-J0q"/>
</connections>
</tapGestureRecognizer>
</objects>
<point key="canvasLocation" x="1800.8" y="1360.569715142429"/>
</scene>
<!--选择货币-->
<scene sceneID="7Fr-zi-C3H">
<objects>
<tableViewController title="选择货币" hidesBottomBarWhenPushed="YES" id="nM6-S9-y8d" customClass="KWMSelectCurrencyVC" sceneMemberID="viewController">
<tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="nTh-Tn-SBH">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="CurrencyCell" id="g3m-K0-TGN" customClass="KWMSelectCurrencyCell">
<rect key="frame" x="0.0" y="55.5" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="g3m-K0-TGN" id="HOS-yS-sfc">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="人民币" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="pZz-bg-jHD">
<rect key="frame" x="38" y="11.5" width="52" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<constraints>
<constraint firstItem="pZz-bg-jHD" firstAttribute="leading" secondItem="HOS-yS-sfc" secondAttribute="leadingMargin" constant="30" id="gBS-AF-axH"/>
<constraint firstItem="pZz-bg-jHD" firstAttribute="centerY" secondItem="HOS-yS-sfc" secondAttribute="centerY" id="sD6-x1-CrA"/>
</constraints>
</tableViewCellContentView>
<connections>
<outlet property="title" destination="pZz-bg-jHD" id="DHX-7S-HTB"/>
</connections>
</tableViewCell>
</prototypes>
<connections>
<outlet property="dataSource" destination="nM6-S9-y8d" id="Xf4-2H-4vW"/>
<outlet property="delegate" destination="nM6-S9-y8d" id="Npl-kO-nfW"/>
</connections>
</tableView>
</tableViewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="KeZ-vG-t6k" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="1801" y="1361"/>
<point key="canvasLocation" x="1801" y="2213"/>
</scene>
<!--信息VC-->
<scene sceneID="Hkk-bs-JDt">
......
......@@ -18,6 +18,8 @@
*/
@interface KWMUserDao : NSObject
@property (nonatomic, strong) NSString *currencyCode;
+ (KWMUserDao *)shareDao;
- (BOOL)checkSession;
- (KWMUser *)loginUser;
......
......@@ -26,6 +26,7 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
@interface KWMUserDao ()
@end
@implementation KWMUserDao {
......@@ -40,6 +41,8 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
BOOL isLogingChat;
}
@synthesize currencyCode = _currencyCode;
+ (KWMUserDao *)shareDao {
static KWMUserDao *_userDao = nil;
static dispatch_once_t oncePredicate;
......@@ -434,5 +437,20 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
}
}
-(NSString *)currencyCode {
if (!_currencyCode) {
_currencyCode = [[NSUserDefaults standardUserDefaults] stringForKey:@"_current_currency_code"];
if (!_currencyCode) {
_currencyCode = [@"zh" isEqualToString:[[NSLocale currentLocale] languageCode]] ? @"CNY" : @"EUR";
}
}
return _currencyCode;
}
-(void)setCurrencyCode:(NSString *)currencyCode {
_currencyCode = currencyCode;
[[NSUserDefaults standardUserDefaults] setObject:currencyCode forKey:@"_current_currency_code"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@end
//
// KWMSelectCurrencyCell.h
// iCemarose
//
// Created by lee on 2017/6/16.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KWMSelectCurrencyCell : UITableViewCell
- (void) fillData:(NSString *) name;
@end
//
// KWMSelectCurrencyCell.m
// iCemarose
//
// Created by lee on 2017/6/16.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMSelectCurrencyCell.h"
@interface KWMSelectCurrencyCell ()
@property (nonatomic, weak) IBOutlet UILabel *title;
@end
@implementation KWMSelectCurrencyCell
- (void)awakeFromNib {
[super awakeFromNib];
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
-(void)fillData:(NSString *)name {
self.title.text = name;
}
@end
......@@ -81,6 +81,10 @@
self.title = @"我的";
}
-(IBAction)onClickCurrency:(id)sender {
[self performSegueWithIdentifier:@"MeToCurrency" sender:nil];
}
-(void)onClickOrder:(id)sender{
if (!_user.status) {
//登录
......
//
// KWMSelectCurrencyVC.h
// iCemarose
//
// Created by lee on 2017/6/16.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KWMSelectCurrencyVC : UITableViewController
@end
//
// KWMSelectCurrencyVC.m
// iCemarose
//
// Created by lee on 2017/6/16.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMSelectCurrencyVC.h"
#import "KWMSelectCurrencyCell.h"
#import "KWMUserDao.h"
@interface KWMSelectCurrencyVC ()
@property (nonatomic, strong) NSArray *titles;
@property (nonatomic, strong) NSArray *codes;
@end
@implementation KWMSelectCurrencyVC
- (void)viewDidLoad {
[super viewDidLoad];
_titles = @[@"人民币",@"Euro"];
_codes = @[@"CNY",@"EUR"];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.titles.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
KWMSelectCurrencyCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CurrencyCell" forIndexPath:indexPath];
[cell fillData:self.titles[indexPath.row]];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[[KWMUserDao shareDao] setCurrencyCode:self.codes[indexPath.row]];
[self.navigationController popViewControllerAnimated:YES];
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
} else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
/*
#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 "Buy/Buy.h"
@interface KWMCollectionCell : UICollectionViewCell
@property (weak, nonatomic) IBOutlet UIImageView *ivCollectionCell;
@property (weak, nonatomic) IBOutlet UILabel *lbBrand;
@property (weak, nonatomic) IBOutlet UILabel *lbDiscount;
......
......@@ -100,6 +100,7 @@ static NSString * idStr = @"KWMNewGoodsCell";
}
[_searchBar resumeView];
_vBackground.hidden = YES;
[self.tbvNewGoods reloadData];
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
......
......@@ -44,7 +44,8 @@
// NSString *language = [[NSLocale preferredLanguages] objectAtIndex:0];
// return [language isEqualToString:@"zh-CN"] ? @"CNY" : @"EUR"; // @"EUR"
// TODO: 这里应该写到设置中 设置中来设置CurrencyCode
return [@"zh" isEqualToString:[[NSLocale currentLocale] languageCode]] ? @"CNY" : @"EUR";
// return [@"zh" isEqualToString:[[NSLocale currentLocale] languageCode]] ? @"CNY" : @"EUR";
return [[KWMUserDao shareDao] currencyCode];
}
- (NSString *)priceFormattedByCurrencyCode:(NSDecimalNumber *) price {
......@@ -59,14 +60,15 @@
//- (NSString *)
- (NSString *)fixFormatted:(NSString *) price {
return [price stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@00",[self numberFormatter].currencyDecimalSeparator] withString:@""];
// return [price stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@00",[self numberFormatter].currencyDecimalSeparator] withString:@""];
return price;
}
- (NSDecimalNumber *) calcPriceByCurrencyCode:(NSDecimalNumber *) price {
if ([[self getCurrencyCode] isEqualToString:@"CNY"]) {
NSDecimalNumber *rate = [[KWMUserDao shareDao] exchangeRate];
price = [NSDecimalNumber decimalNumberWithString:@(ceil([[rate decimalNumberByMultiplyingBy:price] decimalNumberByMultiplyingBy:[NSDecimalNumber decimalNumberWithString:@"1.03"]].doubleValue)).stringValue];
price = [[rate decimalNumberByMultiplyingBy:price] decimalNumberByMultiplyingBy:[NSDecimalNumber decimalNumberWithString:@"1.03"]];
}
return price;
}
......
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