Commit 42034f2a by houweibin

Merge branch 'master' of https://git.oschina.net/kollway-kollway/newcemarose

# Conflicts:
#	iCemarose.xcodeproj/project.pbxproj
parents 0670e2bb b142b254
......@@ -14,7 +14,8 @@ pod 'SAMKeychain'
pod 'RXCollections','~> 1.0'
pod 'TOWebViewController'
pod 'AFNetworking','~> 3.1'
#pod 'AFNetworking','~> 3.1'
pod 'PPNetworkHelper'
pod 'JSONModel','~> 1.2.0'
pod 'SDWebImage','~> 3.7.1'
pod 'SAMCategories', '~> 0.5.1'
......
......@@ -67,9 +67,14 @@
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 */; };
9B53D5D71EE94739005BA6F7 /* KWMValidateUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B53D5D61EE94739005BA6F7 /* KWMValidateUtil.m */; };
9B8298E31EF22BE200743438 /* KWMCurrencyUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8298E21EF22BE200743438 /* KWMCurrencyUtil.m */; };
9B8298E61EF237FC00743438 /* NSDecimalNumber+Currency.m in Sources */ = {isa = PBXBuildFile; fileRef = 9B8298E51EF237FC00743438 /* NSDecimalNumber+Currency.m */; };
9BE61CFB1ECD56E70031D21E /* KWMDictioaryResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE61CFA1ECD56E70031D21E /* KWMDictioaryResult.m */; };
9BE61CFE1ECD66BC0031D21E /* KWMShoppingCart.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE61CFD1ECD66BC0031D21E /* KWMShoppingCart.m */; };
9BE61D011ECD71610031D21E /* KWMCartResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 9BE61D001ECD71610031D21E /* KWMCartResult.m */; };
......@@ -410,13 +415,23 @@
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>"; };
9B166F501ED6DBCF003E9F03 /* KWMHttpUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMHttpUtil.m; sourceTree = "<group>"; };
9B18C11D1EF1270A001DD59B /* BUYProductVariant+Currency.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "BUYProductVariant+Currency.h"; sourceTree = "<group>"; };
9B18C11E1EF1270A001DD59B /* BUYProductVariant+Currency.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "BUYProductVariant+Currency.m"; sourceTree = "<group>"; };
9B53D5D51EE94739005BA6F7 /* KWMValidateUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMValidateUtil.h; sourceTree = "<group>"; };
9B53D5D61EE94739005BA6F7 /* KWMValidateUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMValidateUtil.m; sourceTree = "<group>"; };
9B58353B797587723B0E7515 /* Pods-iCemarose.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-iCemarose.debug.xcconfig"; path = "Pods/Target Support Files/Pods-iCemarose/Pods-iCemarose.debug.xcconfig"; sourceTree = "<group>"; };
9B8298E11EF22BE200743438 /* KWMCurrencyUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMCurrencyUtil.h; sourceTree = "<group>"; };
9B8298E21EF22BE200743438 /* KWMCurrencyUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMCurrencyUtil.m; sourceTree = "<group>"; };
9B8298E41EF237FC00743438 /* NSDecimalNumber+Currency.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDecimalNumber+Currency.h"; sourceTree = "<group>"; };
9B8298E51EF237FC00743438 /* NSDecimalNumber+Currency.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSDecimalNumber+Currency.m"; sourceTree = "<group>"; };
9BE61CF91ECD56E70031D21E /* KWMDictionaryResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMDictionaryResult.h; sourceTree = "<group>"; };
9BE61CFA1ECD56E70031D21E /* KWMDictioaryResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KWMDictioaryResult.m; sourceTree = "<group>"; };
9BE61CFC1ECD66BC0031D21E /* KWMShoppingCart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KWMShoppingCart.h; sourceTree = "<group>"; };
......@@ -889,6 +904,8 @@
children = (
807806851D7566DD00FD2841 /* NSString+PinYin.h */,
807806861D7566DD00FD2841 /* NSString+PinYin.m */,
9B8298E41EF237FC00743438 /* NSDecimalNumber+Currency.h */,
9B8298E51EF237FC00743438 /* NSDecimalNumber+Currency.m */,
);
path = Classify;
sourceTree = "<group>";
......@@ -1168,6 +1185,8 @@
C0CCB3BC1EEA589200BC2FB8 /* KWMFilter.m */,
C048B8E01EF3C04B000DA7AF /* KWMBeforePayData.h */,
C048B8E11EF3C04B000DA7AF /* KWMBeforePayData.m */,
9B18C11D1EF1270A001DD59B /* BUYProductVariant+Currency.h */,
9B18C11E1EF1270A001DD59B /* BUYProductVariant+Currency.m */,
);
path = Model;
sourceTree = "<group>";
......@@ -1215,6 +1234,8 @@
9B166F501ED6DBCF003E9F03 /* KWMHttpUtil.m */,
9B53D5D51EE94739005BA6F7 /* KWMValidateUtil.h */,
9B53D5D61EE94739005BA6F7 /* KWMValidateUtil.m */,
9B8298E11EF22BE200743438 /* KWMCurrencyUtil.h */,
9B8298E21EF22BE200743438 /* KWMCurrencyUtil.m */,
C03120AE1EF2B26B00E49EFA /* KWMPayUtil.h */,
C03120AF1EF2B26B00E49EFA /* KWMPayUtil.m */,
);
......@@ -1295,6 +1316,8 @@
C06665111D767A0A00F02EF4 /* KWMContactUsVC.m */,
C03A05041E35DC5800BAA889 /* KWMNewGiftCardVC.h */,
C03A05051E35DC5800BAA889 /* KWMNewGiftCardVC.m */,
9B0148891EF3B5330056D937 /* KWMSelectCurrencyVC.h */,
9B01488A1EF3B5330056D937 /* KWMSelectCurrencyVC.m */,
);
path = Mine;
sourceTree = "<group>";
......@@ -1698,6 +1721,8 @@
C05910911E34A729002990B3 /* KWMNewGiftCardCell.h */,
C05910921E34A729002990B3 /* KWMNewGiftCardCell.m */,
C05910931E34A729002990B3 /* KWMNewGiftCardCell.xib */,
9B01488C1EF3B8750056D937 /* KWMSelectCurrencyCell.h */,
9B01488D1EF3B8760056D937 /* KWMSelectCurrencyCell.m */,
);
path = Cell;
sourceTree = "<group>";
......@@ -1983,7 +2008,7 @@
TargetAttributes = {
C034E6891D6AEB12006EE129 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = 6HFG5LS2Y2;
DevelopmentTeam = 72Z44QQ9ZD;
ProvisioningStyle = Manual;
};
C034E6A21D6AEB13006EE129 = {
......@@ -2169,6 +2194,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 */,
......@@ -2182,6 +2208,7 @@
C0F5868F1E24F821001248E2 /* SVerticalView.m in Sources */,
801F87BC1DD1A9B90038FA4C /* KWMNewProducts.m in Sources */,
C0CC14061D7823B0007B5986 /* KWMShopCarCell.m in Sources */,
9B8298E31EF22BE200743438 /* KWMCurrencyUtil.m in Sources */,
C034E6951D6AEB12006EE129 /* ViewController.m in Sources */,
C0DD53231EE55062002D1E0C /* KWMCarCountView.m in Sources */,
C03943C01DD1FCE900141475 /* KWMProductType.m in Sources */,
......@@ -2216,6 +2243,7 @@
C034E8421D6B10A0006EE129 /* NSArray+Extend.m in Sources */,
C034E85B1D6B10A0006EE129 /* LFRoundProgressView.m in Sources */,
80F82E611D704E34008B470B /* KWMBrandCell.m in Sources */,
9B8298E61EF237FC00743438 /* NSDecimalNumber+Currency.m in Sources */,
C034E6F51D6AF197006EE129 /* KWMPickView.m in Sources */,
C034E8651D6B10A0006EE129 /* PhotoImageView.m in Sources */,
C034E6C81D6AED1F006EE129 /* KWMUser.m in Sources */,
......@@ -2300,11 +2328,13 @@
C034E86A1D6B10A0006EE129 /* EGORefreshTableFooterView.m in Sources */,
C034E84B1D6B10A0006EE129 /* UIImage+Cut.m in Sources */,
C0219A951DF53EB200711099 /* KWMExchangeRateResult.m in Sources */,
9B18C11F1EF1270A001DD59B /* BUYProductVariant+Currency.m in Sources */,
C034E85A1D6B10A0006EE129 /* SVProgressHUD.m in Sources */,
807AF4A81DC984950000A326 /* KWMSearchResult.m in Sources */,
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">
......
......@@ -43,7 +43,9 @@
shopCartModel.size = item[@"variant_title"];
shopCartModel.product_id = item[@"product_id"];
shopCartModel.quantity = [item[@"quantity"] integerValue];
shopCartModel.price = [item[@"discounted_price"] floatValue] / 100;
// shopCartModel.price = [item[@"discounted_price"] floatValue] / 100;
shopCartModel.price = [[NSDecimalNumber decimalNumberWithString:[item[@"discounted_price"] stringValue]] decimalNumberByDividingBy:[NSDecimalNumber decimalNumberWithDecimal:@(100).decimalValue]];
shopCartModel.line_price = [[NSDecimalNumber decimalNumberWithString:[item[@"line_price"] stringValue]] decimalNumberByDividingBy:[NSDecimalNumber decimalNumberWithDecimal:@(100).decimalValue]];
shopCartModel.imageStr = [KWMImageUtil getProductImageUrlByOriginalUrl:item[@"image"] ImageSize:NormalImage];
shopCartModel.shopCartDict = item;
[datas addObject:shopCartModel];
......
//
// NSDecimalNumber+Currency.h
// iCemarose
//
// Created by lee on 2017/6/15.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDecimalNumber (Currency)
- (NSString *) priceFormatted;
- (NSDecimalNumber *) priceValue;
- (NSString *) priceValueFormatted;
@end
@interface NSNumber (Currency)
- (NSString *) priceFormatted;
- (NSDecimalNumber *) priceValue;
- (NSString *) priceValueFormatted;
@end
//
// NSDecimalNumber+Currency.m
// iCemarose
//
// Created by lee on 2017/6/15.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "NSDecimalNumber+Currency.h"
#import "KWMCurrencyUtil.h"
@implementation NSDecimalNumber (Currency)
- (NSString *) priceFormatted {
return [[KWMCurrencyUtil sharedInstance] priceFormatted:self];
}
- (NSDecimalNumber *)priceValue {
return [[KWMCurrencyUtil sharedInstance] calcPriceByCurrencyCode:self];
}
- (NSString *)priceValueFormatted {
return [[KWMCurrencyUtil sharedInstance] priceFormatted:[self priceValue]];
}
@end
@implementation NSNumber (Currency)
- (NSString *)priceFormatted {
return [[KWMCurrencyUtil sharedInstance] priceFormatted:[NSDecimalNumber decimalNumberWithString:self.stringValue]];
}
- (NSDecimalNumber *)priceValue {
return [[KWMCurrencyUtil sharedInstance] calcPriceByCurrencyCode:[NSDecimalNumber decimalNumberWithString:self.stringValue]];
}
- (NSString *)priceValueFormatted {
return [[KWMCurrencyUtil sharedInstance] priceFormatted:[self priceValue]];
}
@end
......@@ -25,7 +25,6 @@
if (finalValue > KWM_MAX_PRODUCT_COUNT) {
finalValue = KWM_MAX_PRODUCT_COUNT;
}
// shopCartItem.quantity = finalValue;
[self saveAll];
}
......@@ -122,6 +121,7 @@
result.size = shopCartModel.size;
result.quantity = shopCartModel.quantity;
result.price = shopCartModel.price;
result.line_price = shopCartModel.line_price;
result.product_id = shopCartModel.product_id.stringValue;
result.shopCartDict = shopCartModel.shopCartDict;
}
......@@ -139,6 +139,7 @@
result.brand = shopCartItem.brand;
result.size = shopCartItem.size;
result.quantity = shopCartItem.quantity;
result.line_price = shopCartItem.line_price;
result.shopCartDict = shopCartItem.shopCartDict;
result.product_id = @(shopCartItem.product_id.integerValue);
return result;
......
......@@ -23,8 +23,9 @@ NS_ASSUME_NONNULL_BEGIN
@property (nullable, nonatomic, copy) NSString *size;
@property (nullable, nonatomic, copy) NSString *product_id;
@property (nonatomic) NSInteger quantity;
@property (nonatomic) float price;
@property (nonatomic) NSDecimalNumber *price;
@property (nullable, nonatomic, retain) NSDictionary *shopCartDict;
@property (nullable, nonatomic) NSDecimalNumber *line_price;
@end
......
......@@ -16,6 +16,10 @@
@property (nullable, nonatomic, copy) NSString *size;
@property (nullable, nonatomic, strong) NSNumber *product_id;
@property (nonatomic) NSInteger quantity;
@property (nonatomic) float price;
@property (nullable, nonatomic, strong) NSDecimalNumber *price;
@property (nullable, nonatomic, strong) NSDecimalNumber *line_price;
@property (nullable, nonatomic, retain) NSDictionary *shopCartDict;
- (NSString *_Nullable) totalPrice;
@end
......@@ -7,7 +7,15 @@
//
#import "KWMShopCartModel.h"
#import "KWMCurrencyUtil.h"
@implementation KWMShopCartModel
- (NSString *)totalPrice {
if (self.line_price) {
return [[KWMCurrencyUtil sharedInstance] priceFormattedByCurrencyCode:self.line_price];
}
return [[KWMCurrencyUtil sharedInstance] priceFormatted:[self.price.priceValue decimalNumberByMultiplyingBy:[NSDecimalNumber decimalNumberWithString:@(self.quantity).stringValue]]];
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="12141" systemVersion="16E195" minimumToolsVersion="Automatic" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
<model type="com.apple.IDECoreDataModeler.DataModel" documentVersion="1.0" lastSavedToolsVersion="12141" systemVersion="16F73" minimumToolsVersion="Automatic" sourceLanguage="Objective-C" userDefinedModelVersionIdentifier="">
<entity name="KWMShopCartItem" representedClassName="KWMShopCartItem" syncable="YES">
<attribute name="brand" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="identifier" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="imageStr" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="line_price" optional="YES" attributeType="Decimal" defaultValueString="0.0" syncable="YES"/>
<attribute name="name" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="price" optional="YES" attributeType="Float" defaultValueString="0.0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="price" optional="YES" attributeType="Decimal" defaultValueString="0.0" syncable="YES"/>
<attribute name="product_id" optional="YES" attributeType="String" syncable="YES"/>
<attribute name="quantity" optional="YES" attributeType="Integer 32" defaultValueString="0" usesScalarValueType="YES" syncable="YES"/>
<attribute name="shopCartDict" optional="YES" attributeType="Transformable" syncable="YES"/>
<attribute name="size" optional="YES" attributeType="String" syncable="YES"/>
</entity>
<elements>
<element name="KWMShopCartItem" positionX="-63" positionY="-18" width="128" height="180"/>
<element name="KWMShopCartItem" positionX="-63" positionY="-18" width="128" height="195"/>
</elements>
</model>
\ No newline at end of file
//
// BUYProductVariant+Currency.h
// iCemarose
//
// Created by lee on 2017/6/14.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <Mobile-Buy-SDK/Buy/BUYProductVariant.h>
@interface BUYProductVariant (Currency)
- (NSDecimalNumber *) compareAtPriceValue;
- (NSString *) compareAtPriceFormatted;
- (NSDecimalNumber *) priceValue;
- (NSString *) priceFormatted;
@end
//
// BUYProductVariant+Currency.m
// iCemarose
//
// Created by lee on 2017/6/14.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "BUYProductVariant+Currency.h"
#import "KWMUserDao.h"
#import <RegexKitLite/RegexKitLite.h>
#import "KWMCurrencyUtil.h"
@implementation BUYProductVariant (Currency)
- (NSString *)compareAtPriceFormatted {
return [[KWMCurrencyUtil sharedInstance] priceFormattedByCurrencyCode:self.compareAtPrice];
}
- (NSString *)priceFormatted {
return [[KWMCurrencyUtil sharedInstance] priceFormattedByCurrencyCode:self.price];
}
- (NSDecimalNumber *)compareAtPriceValue {
return [[KWMCurrencyUtil sharedInstance] calcPriceByCurrencyCode:self.compareAtPrice];
}
- (NSDecimalNumber *)priceValue {
return [[KWMCurrencyUtil sharedInstance] calcPriceByCurrencyCode:self.price];
}
@end
......@@ -18,6 +18,8 @@
*/
@interface KWMUserDao : NSObject
@property (nonatomic, strong) NSString *currencyCode;
+ (KWMUserDao *)shareDao;
- (BOOL)checkSession;
- (KWMUser *)loginUser;
......@@ -26,7 +28,7 @@
- (void)saveUser:(KWMUser *)user;
- (void)saveExchangeRate:(NSNumber *)exchangeRate;
- (NSNumber *)exchangeRate;
- (NSDecimalNumber *)exchangeRate;
- (void (^)(NSURLSessionDataTask *, KWMRequestResult *))getLoginSuccessCallback:(void (^)(NSURLSessionDataTask *, KWMRequestResult *))callback;
......
......@@ -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;
......@@ -209,10 +212,15 @@ static NSString *kwmKeySavedAccountPassword = @"savedAccountPassword";
[defaults synchronize];
}
- (NSNumber *)exchangeRate {
- (NSDecimalNumber *)exchangeRate {
NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
NSString *exchageRateString = [defaults objectForKey:kwmKeyExchangeRate];
return [KWMStringUtil stringToNumber:exchageRateString];
// NSNumber *rate = [KWMStringUtil stringToNumber:exchageRateString];
// return rate;
if ([KWMStringUtil isEmpty:exchageRateString]) {
return [NSDecimalNumber decimalNumberWithString:ExchangeRateString];
}
return [NSDecimalNumber decimalNumberWithString:exchageRateString];
}
-(void)saveCollectionCache:(NSArray *)products collectionId:(NSNumber *)collectionId tags:(NSArray *)tags{
......@@ -429,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
......@@ -12,6 +12,7 @@
- (void)kwm_clickBackBtn;
- (void)kwm_HitShopCartBtn;
- (void)kwm_hitSearchBtn;
@end
......
......@@ -68,6 +68,10 @@
}
}
- (IBAction)onClickSearchBtn:(id)sender {
[self.delegate kwm_hitSearchBtn];
}
- (IBAction)onClickBackBtn:(id)sender {
NSLog(@"点击了返回按钮");
if ([self.delegate respondsToSelector:@selector(kwm_clickBackBtn)]) {
......
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -20,14 +23,17 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="w07-X3-TZc">
<rect key="frame" x="0.0" y="0.0" width="375" height="20"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="I5b-cU-UJp"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LhU-hy-cgg">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="CAEAMEL" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="eLp-Fc-DGP">
<rect key="frame" x="50" y="11" width="78" height="22"/>
<constraints>
<constraint firstAttribute="height" constant="22" id="Bqy-qp-TtK"/>
<constraint firstAttribute="width" constant="90" id="vmB-ph-xU7"/>
......@@ -42,6 +48,7 @@
</variation>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="jot-my-Skn">
<rect key="frame" x="321" y="0.0" width="44" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="Se9-VU-U3c"/>
<constraint firstAttribute="width" constant="44" id="dQW-nU-NqO"/>
......@@ -52,6 +59,7 @@
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Qzz-HS-1ka" userLabel="back">
<rect key="frame" x="0.0" y="7" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="30" id="2zo-GE-glc"/>
<constraint firstAttribute="height" constant="30" id="dsr-NJ-Brr"/>
......@@ -62,6 +70,7 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ffN-14-C4W">
<rect key="frame" x="340" y="17" width="14" height="14"/>
<constraints>
<constraint firstAttribute="width" constant="14" id="JCv-Vl-bjz"/>
<constraint firstAttribute="height" constant="14" id="ni4-e6-xAG"/>
......@@ -70,6 +79,17 @@
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PaU-vd-maA">
<rect key="frame" x="269" y="0.0" width="44" height="44"/>
<constraints>
<constraint firstAttribute="height" constant="44" id="4KS-bk-nto"/>
<constraint firstAttribute="width" constant="44" id="ulA-Nm-ETK"/>
</constraints>
<state key="normal" image="btn_ nav_search"/>
<connections>
<action selector="onClickSearchBtn:" destination="-1" eventType="touchUpInside" id="FQi-ND-qmV"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
......@@ -78,8 +98,11 @@
<constraint firstItem="eLp-Fc-DGP" firstAttribute="centerY" secondItem="LhU-hy-cgg" secondAttribute="centerY" id="CYF-jt-pNn"/>
<constraint firstItem="ffN-14-C4W" firstAttribute="bottom" secondItem="jot-my-Skn" secondAttribute="bottom" constant="-13" id="FCE-d3-9F6"/>
<constraint firstItem="Qzz-HS-1ka" firstAttribute="centerY" secondItem="LhU-hy-cgg" secondAttribute="centerY" id="VW7-ru-rft"/>
<constraint firstItem="jot-my-Skn" firstAttribute="leading" secondItem="PaU-vd-maA" secondAttribute="trailing" constant="8" id="d18-gM-JWM"/>
<constraint firstItem="ffN-14-C4W" firstAttribute="trailing" secondItem="jot-my-Skn" secondAttribute="trailing" constant="-11" id="ddE-oR-ylC"/>
<constraint firstAttribute="trailing" secondItem="jot-my-Skn" secondAttribute="trailing" constant="10" id="ewH-at-Gll"/>
<constraint firstItem="jot-my-Skn" firstAttribute="centerY" secondItem="PaU-vd-maA" secondAttribute="centerY" id="sX1-bj-cl2"/>
<constraint firstItem="jot-my-Skn" firstAttribute="centerY" secondItem="PaU-vd-maA" secondAttribute="centerY" id="x6e-HO-bFW"/>
<constraint firstItem="Qzz-HS-1ka" firstAttribute="leading" secondItem="LhU-hy-cgg" secondAttribute="leading" id="zaO-mI-Gl2"/>
</constraints>
</view>
......@@ -106,6 +129,7 @@
</view>
</objects>
<resources>
<image name="btn_ nav_search" width="22" height="22"/>
<image name="btn_ nav_shop cart" width="21" height="22"/>
<image name="btn_nav_back" width="10" height="20"/>
</resources>
......
......@@ -196,7 +196,8 @@
compareAtPrice = @(0);
}
if( compareAtPrice.integerValue!=0 ){
NSString *oldString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:compareAtPrice]];
// NSString *oldString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:compareAtPrice]];
NSString *oldString = compareAtPrice.priceValueFormatted;
//中划线
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:oldString attributes:attribtDic];
......@@ -205,22 +206,26 @@
self.priceLeft.constant = -30;
self.lbDiscountLeft.hidden = NO;
self.lbPriceLeft.attributedText = attribtStr;
self.lbDiscountLeft.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:price]];
// self.lbDiscountLeft.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:price]];
self.lbDiscountLeft.text = price.priceValueFormatted;
}else{
self.priceRight.constant = -30;
self.lbDiscountRight.hidden = NO;
self.lbPriceRight.attributedText = attribtStr;
self.lbDiscountRight.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:price]];
// self.lbDiscountRight.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:price]];
self.lbDiscountRight.text = price.priceValueFormatted;
}
}else{
if (isLeft) {
self.priceLeft.constant = 0;
self.lbDiscountLeft.hidden = YES;
self.lbPriceLeft.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring: price]];
// self.lbPriceLeft.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring: price]];
self.lbPriceLeft.text = price.priceValueFormatted;
}else{
self.priceRight.constant = 0;
self.lbDiscountRight.hidden = YES;
self.lbPriceRight.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:price]];
// self.lbPriceRight.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:price]];
self.lbPriceRight.text = price.priceValueFormatted;
}
}
}
......
......@@ -11,6 +11,7 @@
@protocol KWMCarCountViewDelegate <NSObject>
- (void)kwm_touchShopCartBtn;
- (void)kwm_touchSearchBtn;
@end
@interface KWMCarCountView : UIView
......@@ -21,6 +22,7 @@
@property (weak, nonatomic) id<KWMCarCountViewDelegate> delegate;
- (IBAction)onClickShopCartBtn:(id)sender;
- (IBAction)onClickSearchBtn:(id)sender;
@end
......@@ -63,4 +63,8 @@
[self.delegate kwm_touchShopCartBtn];
}
}
- (void)onClickSearchBtn:(id)sender {
[self.delegate kwm_touchSearchBtn];
}
@end
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1004" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="12120" systemVersion="16F73" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="11161"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12088"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
......@@ -19,14 +22,17 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="jaQ-9K-pwB">
<rect key="frame" x="0.0" y="0.0" width="375" height="20"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="20" id="1db-NU-cyT"/>
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="k5I-0u-ww6">
<rect key="frame" x="0.0" y="20" width="375" height="44"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oya-px-46r">
<rect key="frame" x="321" y="0.0" width="44" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="44" id="EuD-IV-fdo"/>
<constraint firstAttribute="height" constant="44" id="pd0-mz-6I3"/>
......@@ -37,6 +43,7 @@
</connections>
</button>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="JyV-gT-W6k">
<rect key="frame" x="340" y="17" width="14" height="14"/>
<constraints>
<constraint firstAttribute="height" constant="14" id="6iD-hl-uNU"/>
<constraint firstAttribute="width" constant="14" id="WBS-Yd-LKE"/>
......@@ -46,15 +53,29 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="品牌" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Rt2-0b-5Qg">
<rect key="frame" x="171.5" y="12.5" width="32" height="19"/>
<fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="16"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="XCu-Vw-UbS">
<rect key="frame" x="269" y="0.0" width="44" height="44"/>
<constraints>
<constraint firstAttribute="width" constant="44" id="PPp-fS-VbO"/>
<constraint firstAttribute="height" constant="44" id="QxY-Op-FL8"/>
</constraints>
<state key="normal" image="btn_ nav_search"/>
<connections>
<action selector="onClickSearchBtn:" destination="-1" eventType="touchUpInside" id="NSH-6w-dmi"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="JyV-gT-W6k" firstAttribute="trailing" secondItem="oya-px-46r" secondAttribute="trailing" constant="-11" id="1ix-zq-Mor"/>
<constraint firstItem="oya-px-46r" firstAttribute="centerY" secondItem="XCu-Vw-UbS" secondAttribute="centerY" id="3Ys-1m-sUe"/>
<constraint firstAttribute="bottom" secondItem="oya-px-46r" secondAttribute="bottom" id="FAW-tW-q9a"/>
<constraint firstItem="oya-px-46r" firstAttribute="leading" secondItem="XCu-Vw-UbS" secondAttribute="trailing" constant="8" id="IsE-2T-b1e"/>
<constraint firstItem="Rt2-0b-5Qg" firstAttribute="centerY" secondItem="k5I-0u-ww6" secondAttribute="centerY" id="M7w-JU-b4j"/>
<constraint firstItem="Rt2-0b-5Qg" firstAttribute="centerX" secondItem="k5I-0u-ww6" secondAttribute="centerX" id="k5U-pP-UxB"/>
<constraint firstAttribute="height" constant="44" id="p0A-9X-4Pb"/>
......@@ -79,6 +100,7 @@
</view>
</objects>
<resources>
<image name="btn_ nav_search" width="22" height="22"/>
<image name="btn_ nav_shop cart" width="21" height="22"/>
</resources>
</document>
......@@ -41,7 +41,6 @@
- (IBAction)onClickSearchBtn:(id)sender;
- (IBAction)onClickACancelBtn:(id)sender;
- (IBAction)onClickBackBtn:(id)sender;
- (IBAction)tfValueChanged:(id)sender;
@end
......@@ -21,6 +21,7 @@
#import "KWMFilterVC.h"
#import "KWMShoppingCart.h"
#import <RXCollections/RXCollection.h>
#import "KWMSearchFeedbackVC.h"
@interface KWMBrandCaramelVC ()<UITableViewDelegate,UITableViewDataSource,KWMBrandCaramelCellDelegate>
@property (nonatomic) KWMBarandSelectView *barandSelectView;
......@@ -199,6 +200,12 @@ static NSString *idStr = @"KWMBrandCaramelCell";
[self.navigationController pushViewController:shopCartVC animated:YES];
}
- (void)kwm_hitSearchBtn {
KWMSearchFeedbackVC *vc = (KWMSearchFeedbackVC *)[KWMBaseVC findControllerBy:[KWMSearchFeedbackVC kwmTag] fromStoryboard:@"New"];
// vc.searchText = @"";
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark -- KWMFilterDelegate
-(void)kwm_onFilterFinish:(KWMFilterView *)filterView{
self.filterView.hidden = YES;
......
......@@ -19,6 +19,7 @@
#import "KWMBrandsTypeModel.h"
#import "UIColor+SAMAdditions.h"
#import "KWMShoppingCart.h"
#import "KWMSearchFeedbackVC.h"
@interface KWMBrandVC ()<KWMCarCountViewDelegate>
......@@ -124,6 +125,12 @@ static NSString *cellId = @"KWMBrandCell";
[self.navigationController pushViewController:ShopCartVC animated:YES];
}
- (void)kwm_touchSearchBtn {
KWMSearchFeedbackVC *vc = (KWMSearchFeedbackVC *)[KWMBaseVC findControllerBy:[KWMSearchFeedbackVC kwmTag] fromStoryboard:@"New"];
// vc.searchText = @"";
[self.navigationController pushViewController:vc animated:YES];
}
#pragma mark -- UICollectionViewDataSource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
return 1;
......
......@@ -11,7 +11,7 @@
#import "UIImageView+WebCache.h"
#import "UIColor+SAMAdditions.h"
#import "KWMStringUtil.h"
#import "KWMCurrencyUtil.h"
@implementation KWMOrderCell{
BOOL isShow;
......@@ -54,7 +54,8 @@
if (order != nil) {
_order = order;
_lbOrderNum.text = [NSString stringWithFormat:@"订单 %@",order.identifier ? order.identifier.stringValue:@""];
_lbTotalPrice.text = [NSString stringWithFormat:@"%@",[KWMStringUtil getEUR2CNYstring:order.totalPrice]];
// _lbTotalPrice.text = [NSString stringWithFormat:@"%@",[KWMStringUtil getEUR2CNYstring:order.totalPrice]];
_lbTotalPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormattedByCurrencyCode:order.totalPrice];
__block NSInteger fulfilledCount = 0;
[order.lineItems enumerateObjectsUsingBlock:^(BUYLineItem * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
......@@ -62,7 +63,6 @@
fulfilledCount += 1;
}
}];
// TODO: 加入取消订单的状态
NSString *orderStatus = order.cancelled ? @"已取消" : fulfilledCount == 0 ? @"待发货" : fulfilledCount == order.lineItems.count ? @"已发货" : @"部分发货";
self.lbOrderStatus.text = orderStatus;
}
......@@ -71,7 +71,8 @@
- (void)setLineItem:(BUYLineItem *)lineItem{
if (lineItem != nil) {
_lineItem = lineItem;
self.lbPrice.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:lineItem.price]];
// self.lbPrice.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:lineItem.price]];
self.lbPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormattedByCurrencyCode:lineItem.price];
self.lbName.text = lineItem.title;
self.lbSize.text = [NSString stringWithFormat:@"x%@/%@",lineItem.quantity,lineItem.variantTitle];
}
......
//
// 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;
......
......@@ -10,6 +10,7 @@
#import "UIImageView+WebCache.h"
#import "KWMImageUtil.h"
#import "KWMStringUtil.h"
#import "BUYProductVariant+Currency.h"
@implementation KWMCollectionCell
......@@ -39,7 +40,8 @@
NSString *priceString,*discountStr;
if (productVariant.compareAtPrice) {
priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.compareAtPrice]];
// priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.compareAtPrice]];
priceString = productVariant.compareAtPriceFormatted;
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:priceString attributes:attribtDic];
self.lbPrice.attributedText = attribtStr;
......@@ -48,8 +50,8 @@
self.discountLeft.constant = -28;
self.lbDiscount.textAlignment = NSTextAlignmentCenter;
}
discountStr = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.price]];
// discountStr = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.price]];
discountStr = productVariant.priceFormatted;
self.lbDiscount.text = discountStr;
}else{
self.lbBrand.text = @"";
......
......@@ -21,6 +21,8 @@
@property (weak, nonatomic) id<KWMProductDetailViewDelegate>delegate;
@property (weak, nonatomic) IBOutlet UIButton *sizeGuide;
-(void)setData:(BUYProduct *)product;
@end
......@@ -186,9 +186,11 @@
BUYProductVariant *productVariant= product.variants.firstObject;
NSAttributedString *detailAttr = [[NSAttributedString alloc] initWithData:[self.product.htmlDescription dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
self.lbDetail.attributedText = detailAttr;
self.lbPrice.text = [KWMStringUtil getEUR2CNYstring:productVariant.price];
// self.lbPrice.text = [KWMStringUtil getEUR2CNYstring:productVariant.price];
self.lbPrice.text = productVariant.price.priceValueFormatted;
if (productVariant.compareAtPrice) {
NSString *priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.compareAtPrice]];
// NSString *priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.compareAtPrice]];
NSString *priceString = productVariant.compareAtPrice.priceValueFormatted;
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:priceString attributes:attribtDic];
self.lbOldPrice.attributedText = attribtStr;
......@@ -196,12 +198,12 @@
self.lbOldPrice.hidden = YES;
}
UITapGestureRecognizer *priceTap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickPrice:)];
UITapGestureRecognizer *priceTap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickPrice:)];
UITapGestureRecognizer *priceTap3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickPrice:)];
[self.lbUnit addGestureRecognizer:priceTap1];
[self.lbPrice addGestureRecognizer:priceTap2];
[self.lbOldPrice addGestureRecognizer:priceTap3];
// UITapGestureRecognizer *priceTap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickPrice:)];
// UITapGestureRecognizer *priceTap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickPrice:)];
// UITapGestureRecognizer *priceTap3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickPrice:)];
// [self.lbUnit addGestureRecognizer:priceTap1];
// [self.lbPrice addGestureRecognizer:priceTap2];
// [self.lbOldPrice addGestureRecognizer:priceTap3];
self.lbUnit.userInteractionEnabled = YES;
self.lbPrice.userInteractionEnabled = YES;
self.lbOldPrice.userInteractionEnabled = YES;
......@@ -227,9 +229,11 @@
BUYProductVariant *productVariant= self.product.variants.firstObject;
if(self.isShowCNY){
self.lbUnit.text = @"¥";
self.lbPrice.text = [KWMStringUtil getEUR2CNYstring:productVariant.price];
// self.lbPrice.text = [KWMStringUtil getEUR2CNYstring:productVariant.price];
self.lbPrice.text = productVariant.price.priceValueFormatted;
if (productVariant.compareAtPrice) {
NSString *priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.compareAtPrice]];
// NSString *priceString = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:productVariant.compareAtPrice]];
NSString *priceString = productVariant.compareAtPrice.priceValueFormatted;
NSDictionary *attribtDic = @{NSStrikethroughStyleAttributeName: [NSNumber numberWithInteger:NSUnderlineStyleSingle]};
NSMutableAttributedString *attribtStr = [[NSMutableAttributedString alloc]initWithString:priceString attributes:attribtDic];
self.lbOldPrice.attributedText = attribtStr;
......
......@@ -20,6 +20,7 @@
<outlet property="lbPrice" destination="gpT-Sg-ghu" id="FGd-AA-Yiv"/>
<outlet property="lbUnit" destination="wfT-JC-g9d" id="MSn-kd-aQ2"/>
<outlet property="pageControl" destination="M6v-TN-2WE" id="QPe-TI-LdG"/>
<outlet property="sizeGuide" destination="EM9-Ay-Qxk" id="4Dh-eU-qhb"/>
<outlet property="vView" destination="iN0-l3-epB" id="TQD-W9-jEg"/>
</connections>
</placeholder>
......@@ -79,23 +80,20 @@
<color key="textColor" red="0.30588235294117649" green="0.30588235294117649" blue="0.30588235294117649" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<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="wfT-JC-g9d">
<label hidden="YES" opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="¥" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wfT-JC-g9d">
<rect key="frame" x="21" y="66" width="9" height="21"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="15"/>
<color key="textColor" red="0.94509803921568625" green="0.5725490196078431" blue="0.60392156862745094" alpha="1" colorSpace="calibratedRGB"/>
<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="gpT-Sg-ghu">
<rect key="frame" x="40" y="62" width="80.5" height="28"/>
<constraints>
<constraint firstAttribute="width" constant="80" id="0Pv-kq-UND"/>
</constraints>
<rect key="frame" x="20" y="62" width="27" height="28"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="20"/>
<color key="textColor" red="0.94509803921568625" green="0.5725490196078431" blue="0.60392156862745094" alpha="1" colorSpace="calibratedRGB"/>
<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="Mql-V1-hiE">
<rect key="frame" x="120.5" y="68.5" width="25.5" height="18.5"/>
<rect key="frame" x="55" y="68.5" width="25.5" height="18.5"/>
<fontDescription key="fontDescription" name="PingFangSC-Regular" family="PingFang SC" pointSize="13"/>
<color key="textColor" red="0.30588235294117649" green="0.30588235294117649" blue="0.30588235294117649" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
......@@ -140,7 +138,7 @@
</subviews>
<constraints>
<constraint firstItem="gpT-Sg-ghu" firstAttribute="bottom" secondItem="wfT-JC-g9d" secondAttribute="bottom" constant="3" id="0gt-hJ-gW7"/>
<constraint firstItem="Mql-V1-hiE" firstAttribute="leading" secondItem="gpT-Sg-ghu" secondAttribute="trailing" id="2kJ-k6-7uE"/>
<constraint firstItem="Mql-V1-hiE" firstAttribute="leading" secondItem="gpT-Sg-ghu" secondAttribute="trailing" constant="8" id="2kJ-k6-7uE"/>
<constraint firstAttribute="trailing" secondItem="DbC-Os-2e9" secondAttribute="trailing" constant="19" id="3Gy-6z-Jli"/>
<constraint firstAttribute="trailing" secondItem="s6N-a3-C4Z" secondAttribute="trailing" constant="21" id="BH6-4A-Psp"/>
<constraint firstItem="asI-Rf-ZXG" firstAttribute="centerY" secondItem="EM9-Ay-Qxk" secondAttribute="centerY" id="Bx2-7F-7xQ"/>
......@@ -156,7 +154,7 @@
<constraint firstItem="wfT-JC-g9d" firstAttribute="top" secondItem="SQm-rY-OyA" secondAttribute="bottom" constant="7.5" id="gcI-jU-lhJ"/>
<constraint firstAttribute="height" constant="130" id="nLX-8H-mni"/>
<constraint firstItem="SQm-rY-OyA" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="njb-yV-RRh"/>
<constraint firstItem="gpT-Sg-ghu" firstAttribute="leading" secondItem="wfT-JC-g9d" secondAttribute="trailing" constant="10" id="o9j-pp-GRZ"/>
<constraint firstItem="gpT-Sg-ghu" firstAttribute="leading" secondItem="wfT-JC-g9d" secondAttribute="trailing" constant="-10" id="o9j-pp-GRZ"/>
<constraint firstItem="asI-Rf-ZXG" firstAttribute="centerY" secondItem="RNK-se-cgR" secondAttribute="centerY" id="pfI-QQ-uu0"/>
<constraint firstItem="RNK-se-cgR" firstAttribute="top" secondItem="gpT-Sg-ghu" secondAttribute="bottom" constant="8" id="pjQ-9v-2rS"/>
<constraint firstItem="EM9-Ay-Qxk" firstAttribute="leading" secondItem="iJa-Oj-Sd2" secondAttribute="leading" constant="21" id="rJ1-DF-mLV"/>
......
......@@ -100,6 +100,7 @@ static NSString * idStr = @"KWMNewGoodsCell";
}
[_searchBar resumeView];
_vBackground.hidden = YES;
[self.tbvNewGoods reloadData];
}
- (void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
......
......@@ -27,6 +27,7 @@
#import <TOWebViewController/TOWebViewController.h>
#import <AFNetworking/AFNetworking.h>
#import <TOWebViewController/NJKWebViewProgress.h>
#import <PPNetworkHelper/PPNetworkHelper.h>
@interface KWMProductDetailVC ()<KWMBottomViewDelegate,KWMProductDetailViewDelegate,KWMSelectSizeVCDelegate,UIScrollViewDelegate>
......@@ -41,6 +42,8 @@
@property (nonatomic) BUYCollection *collectionSameBrand;
@property (nonatomic) NSString *typeTag;
@property (weak, nonatomic) IBOutlet UIButton *btnShopCart;
@property (weak, nonatomic) IBOutlet UIButton *btnShare;
......@@ -64,6 +67,16 @@
if(self.product && self.product.identifier && !self.product.JSONDictionary){
[self getProductBy:nil product:self.product];
}
NSArray *types = @[@"baby",@"girls",@"boys",@"shoes",@"newborn"];
for (NSString *tag in self.product.tags) {
if ([types containsObject:tag.lowercaseString]) {
self.typeTag = tag.lowercaseString;
break;
}
}
if (!self.typeTag) {
self.productDetailView.sizeGuide.hidden = YES;
}
}
- (BOOL)prefersStatusBarHidden {
......@@ -110,41 +123,61 @@
- (void)kwm_onClickSizeGuide {
NSString *brand = [self.product.vendor stringByReplacingOccurrencesOfRegex:@"\\s*\\W\\s*" withString:@"-"].lowercaseString;
NSString *type = @"";
NSArray *types = @[@"baby",@"girls",@"boys",@"shoes"];
for (NSString *tag in self.product.tags) {
if ([types containsObject:tag.lowercaseString]) {
type = tag.lowercaseString;
break;
}
}
// NSString *url= [NSString stringWithFormat:@"https://cemarose.myshopify.com/pages/%@-size-guide-%@",brand,type];
NSString *baseUrl = @"http://www.cemarose.cn/pages/";
NSString *url= [NSString stringWithFormat:@"%@%@-size-guide-%@",baseUrl,brand,type];
NSString *url= [NSString stringWithFormat:@"%@%@-size-guide-%@",baseUrl,brand,self.typeTag];
NSLog(@"size guide url: %@",url);
// TOWebViewController *wv = [[TOWebViewController alloc] initWithURLString:url];
TOWebViewController *wv = [[TOWebViewController alloc] init];
__unused id _ = wv.view;
wv.showPageTitles = NO;
wv.title = @"Size Guide";
wv.navigationButtonsHidden = YES;
AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
// manager.responseSerializer = [AFXMLParserResponseSerializer serializer];
manager.responseSerializer = [AFHTTPResponseSerializer serializer];
manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];
[manager GET:url parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
// NJKWebViewProgress *wvp = [vc valueForKeyPath:@"progressManager"];
// [wvp.progressDelegate webViewProgress:wvp updateProgress:downloadProgress.fractionCompleted];
} success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
NSString *body = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
body = [NSString stringWithFormat:@"<meta name='viewport' content='width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no'/><style type='text/css'>"
@".main-header-wrap,.main-footer,.doubly-float{display:none}"
// AFHTTPSessionManager *manager = [AFHTTPSessionManager manager];
//// manager.responseSerializer = [AFXMLParserResponseSerializer serializer];
// manager.responseSerializer = [AFHTTPResponseSerializer serializer];
// manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];
// [manager GET:url parameters:nil progress:^(NSProgress * _Nonnull downloadProgress) {
//// NJKWebViewProgress *wvp = [vc valueForKeyPath:@"progressManager"];
//// [wvp.progressDelegate webViewProgress:wvp updateProgress:downloadProgress.fractionCompleted];
// } success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
// NSString *body = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding];
// body = [body stringByReplacingOccurrencesOfRegex:@"<meta[\\w\\W]*?/?>" withString:@""];
// body = [body stringByReplacingOccurrencesOfRegex:@"<script[\\w\\W]*?</script>" withString:@""];
// body = [body stringByReplacingOccurrencesOfRegex:@"<header[\\w\\W]*?</header>" withString:@""];
// body = [body stringByReplacingOccurrencesOfRegex:@"<footer[\\w\\W]*?</footer>" withString:@""];
// body = [body stringByReplacingOccurrencesOfRegex:@"<head>" withString:@"<head><meta name=\"viewport\" content=\"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no\" /><style type='text/css'>"
// @".page-title h1.label{font-size:17px;}"
// @".rte.text-content td{padding-left:10px;}"
// @"</style>"];
// [wv.webView loadHTMLString:body baseURL:[NSURL URLWithString:baseUrl]];
// } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
// }];
void(^success)(id) = ^(id body){
if (!body) {
return;
}
body = [[NSString alloc] initWithData:body encoding:NSUTF8StringEncoding];
body = [body stringByReplacingOccurrencesOfRegex:@"<meta[\\w\\W]*?/?>" withString:@""];
body = [body stringByReplacingOccurrencesOfRegex:@"<script[\\w\\W]*?</script>" withString:@""];
body = [body stringByReplacingOccurrencesOfRegex:@"<header[\\w\\W]*?</header>" withString:@""];
body = [body stringByReplacingOccurrencesOfRegex:@"<footer[\\w\\W]*?</footer>" withString:@""];
body = [body stringByReplacingOccurrencesOfRegex:@"<head>" withString:@"<head><meta name=\"viewport\" content=\"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no\" /><style type='text/css'>"
@".page-title h1.label{font-size:17px;}"
@".rte.text-content td{padding-left:10px;}"
@"</style>%@",body];
@"</style>"];
[wv.webView loadHTMLString:body baseURL:[NSURL URLWithString:baseUrl]];
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
};
__weak typeof(self) this = self;
[PPNetworkHelper setAFHTTPSessionManagerProperty:^(AFHTTPSessionManager *sessionManager) {
sessionManager.responseSerializer = [AFHTTPResponseSerializer serializer];
sessionManager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"text/html", nil];
}];
[PPNetworkHelper GET:url parameters:nil responseCache:success success:success failure:^(NSError *error) {
[this showError:error];
}];
[self.navigationController pushViewController:wv animated:YES];
__unused id _ = wv.view;
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(200 * NSEC_PER_MSEC)), dispatch_get_main_queue(), ^{
NJKWebViewProgress *wvp = [wv valueForKeyPath:@"progressManager"];
[wvp.progressDelegate webViewProgress:wvp updateProgress:0.1];
......@@ -274,7 +307,8 @@
model.name = this.product.title;
model.brand = this.product.vendor;
model.size = variant.title;
model.price = variant.price.floatValue;
// model.price = variant.price.floatValue;
model.price = variant.price;
model.product_id = this.product.identifier;
}
if (!error) {
......
......@@ -37,6 +37,9 @@
[self.navigationController setNavigationBarHidden:YES];
self.vBackground.hidden = YES;
[self initHeardView];
if (!self.searchText) {
[self.vSearchFB.tfSearch becomeFirstResponder];
}
}
- (UITableView *)targetTableView{
......@@ -49,7 +52,7 @@
- (void)reLoadData{
[self getSearchProduct];
// [self getSearchProduct];
}
static NSString *idStr = @"KWMBrandCaramelCell";
- (void)viewDidLoad {
......@@ -64,8 +67,9 @@ static NSString *idStr = @"KWMBrandCaramelCell";
UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickBackgroundView:)];
[self.vBackground addGestureRecognizer:tapGesture];
[self getSearchProduct];
if (self.searchText) {
[self getSearchProduct];
}
}
- (void)onClickBackgroundView:(UITapGestureRecognizer *)tapGesture{
......
......@@ -8,6 +8,7 @@
#import "KWMShippingCell.h"
#import "KWMStringUtil.h"
#import "KWMCurrencyUtil.h"
@implementation KWMShippingCell
......@@ -38,7 +39,8 @@
}
self.shippingRate = shippingRate;
self.lbTitle.text = shippingRate.title;
self.lbPrice.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:shippingRate.price]];
// self.lbPrice.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:shippingRate.price]];
self.lbPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormattedByCurrencyCode:shippingRate.price];
}
@end
......@@ -30,8 +30,9 @@
_lbBrand.text = shopCartModel.brand;
_lbSize.text = shopCartModel.size;
_lbCount.text = [NSString stringWithFormat:@"%ld",(long)shopCartModel.quantity];
NSInteger totalPrice = shopCartModel.price*shopCartModel.quantity;
_lbPrice.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:@(totalPrice)]];
// NSInteger totalPrice = shopCartModel.price*shopCartModel.quantity;
// _lbPrice.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:@(totalPrice)]];
_lbPrice.text = shopCartModel.totalPrice;
NSURL *imageURL = [NSURL URLWithString: shopCartModel.imageStr];
[_ivImage sd_setImageWithURL:imageURL placeholderImage:[UIImage imageNamed:@"ic_loading"]];
}
......
......@@ -210,7 +210,8 @@
}
//总价
if(self.checkout!=nil){
self.lbTotalPrice.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:self.checkout.totalPrice]];
// self.lbTotalPrice.text = [NSString stringWithFormat:@"¥%@",[KWMStringUtil getEUR2CNYstring:self.checkout.totalPrice]];
self.lbTotalPrice.text = self.checkout.totalPrice.priceValueFormatted;
}
}
......
......@@ -84,6 +84,7 @@
BUYDiscount *discount = [self.client.modelManager discountWithCode:code];
self.checkout.discount = discount;
self.checkout.attributes = nil;
[self.client updateCheckout:self.checkout completion:^(NSDictionary *dictionary, BUYCheckout *checkout, NSError *error) {
[self hideLoading];
if (error == nil && checkout) {
......@@ -101,8 +102,13 @@
if(self.delegate != nil){
[self.delegate kwm_addedDiscount:self.checkout];
}
[self showToast:@"添加优惠码失败"];
[self showError:error];
// 八成是因为checkout是web生成的所以如果discount如果传的有问题返回的是500如果没问题的话是正常的
if ([@"Internal Server Error" isEqualToString:error.userInfo[@"errors"]]) {
[self showToast:@"您输入的优惠码有误"];
}else {
[self showError:error];
}
// [self showToast:@"添加优惠码失败"];
NSLog(@"Error applying checkout: %@", error);
}
}];
......
......@@ -15,6 +15,8 @@
#import "KWMLoginVC.h"
#import "KWMLoadingView.h"
#import "UIColor+SAMAdditions.h"
#import "BUYProductVariant+Currency.h"
#import "KWMCurrencyUtil.h"
@interface KWMSelectSizeVC ()
......@@ -177,7 +179,8 @@
- (void)initBySelectSize{
_shopCartModel.size = _selectSize.title;
_shopCartModel.price = _selectSize.price.integerValue;
// _shopCartModel.price = _selectSize.price.integerValue;
_shopCartModel.price = _selectSize.price;
_shopCartModel.identifier = [NSString stringWithFormat:@"%@",_selectSize.identifier];
_shopCartModel.quantity = _count;
}
......@@ -359,9 +362,10 @@
if (defalutSize.identifier.integerValue == self.selectSize.identifier.integerValue && isDefalut) {
self.count = defalutCount;
}
double price = self.selectSize.price.doubleValue * self.count;
self.lbPrice.text = [NSString stringWithFormat: @"¥ %@", [KWMStringUtil getEUR2CNYstring:@(price)]];
// double price = self.selectSize.price.doubleValue * self.count;
NSDecimalNumber *totalPrice = [self.selectSize.priceValue decimalNumberByMultiplyingBy:[NSDecimalNumber decimalNumberWithDecimal:@(self.count).decimalValue]];
// self.lbPrice.text = [NSString stringWithFormat: @"¥ %@", [KWMStringUtil getEUR2CNYstring:@(price)]];
self.lbPrice.text = [[KWMCurrencyUtil sharedInstance] priceFormatted:totalPrice];
}else{
self.lbCount.text = @"0";
self.lbPrice.text = @"¥ 0.00";
......
......@@ -188,7 +188,7 @@
tmp.size = variant.title;
tmp.brand = model.brand;
tmp.name = model.name;
tmp.price = variant.price.floatValue;
tmp.price = variant.price;
tmp.product_id = model.product_id;
}
success(error,cart);
......@@ -253,11 +253,19 @@
//计算总价格
- (void) setTotalPrice{
NSInteger price = 0;
// NSInteger price = 0;
NSDecimalNumber *total = [NSDecimalNumber decimalNumberWithDecimal:@(0).decimalValue];
for (KWMShopCartModel *model in _shopCartList) {
price += model.price * model.quantity;
if (model.line_price) {
// price += model.line_price.priceValue.integerValue;
total = [total decimalNumberByAdding:model.line_price.priceValue];
}else{
// price += [model.price.priceValue decimalNumberByMultiplyingBy:[NSDecimalNumber decimalNumberWithString:@(model.quantity).stringValue]].integerValue;
total = [total decimalNumberByAdding:[model.price.priceValue decimalNumberByMultiplyingBy:[NSDecimalNumber decimalNumberWithString:@(model.quantity).stringValue]]];
}
}
_lbTotalPrice.text = [NSString stringWithFormat: @"¥%@",[KWMStringUtil getEUR2CNYstring:@(price)]];
// _lbTotalPrice.text = [NSString stringWithFormat: @"¥%@",[KWMStringUtil getEUR2CNYstring:@(price)]];
_lbTotalPrice.text = total.priceFormatted;
}
@end
//
// KWNCurrencyUtil.h
// iCemarose
//
// Created by lee on 2017/6/15.
// Copyright © 2017年 kollway. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface KWMCurrencyUtil : NSObject
+ (instancetype) sharedInstance;
- (NSString *)priceFormatted:(NSDecimalNumber *) price;
- (NSString *)priceFormattedByCurrencyCode:(NSDecimalNumber *) pric;
- (NSString *)fixFormatted:(NSString *) price;
- (NSDecimalNumber *) calcPriceByCurrencyCode:(NSDecimalNumber *) price;
@end
//
// KWNCurrencyUtil.m
// iCemarose
//
// Created by lee on 2017/6/15.
// Copyright © 2017年 kollway. All rights reserved.
//
#import "KWMCurrencyUtil.h"
#import "KWMUserDao.h"
@interface KWMCurrencyUtil ()
@property (nonatomic, strong) NSNumberFormatter *numberFormatter;
@end
@implementation KWMCurrencyUtil
+ (instancetype) sharedInstance {
static KWMCurrencyUtil *instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [[super allocWithZone:NULL] init];
});
return instance;
}
+ (instancetype)allocWithZone:(struct _NSZone *)zone {
return [self sharedInstance];
}
- (NSNumberFormatter *) numberFormatter {
if (!_numberFormatter) {
_numberFormatter = [[NSNumberFormatter alloc] init];
_numberFormatter.numberStyle = NSNumberFormatterCurrencyStyle;
}
_numberFormatter.currencyCode = [self getCurrencyCode];
return _numberFormatter;
}
- (NSString *) getCurrencyCode {
// 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 [[KWMUserDao shareDao] currencyCode];
}
- (NSString *)priceFormattedByCurrencyCode:(NSDecimalNumber *) price {
// return [[[self numberFormatter] stringFromNumber:[self calcPriceByCurrencyCode:self.price]] stringByReplacingOccurrencesOfRegex:@"\\.00" withString:@""];
return [self fixFormatted:[[self numberFormatter] stringFromNumber:[self calcPriceByCurrencyCode:price]]];
}
- (NSString *)priceFormatted:(NSDecimalNumber *)price {
return [self fixFormatted:[[self numberFormatter] stringFromNumber:price]];
}
//- (NSString *)
- (NSString *)fixFormatted:(NSString *) price {
// 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 = [[rate decimalNumberByMultiplyingBy:price] decimalNumberByMultiplyingBy:[NSDecimalNumber decimalNumberWithString:@"1.03"]];
}
return price;
}
@end
......@@ -50,7 +50,7 @@
+ (NSString *)transform:(NSString *)chinese;
//欧元转人民币
+ (NSString *)getEUR2CNYstring:(NSNumber *)price;
//+ (NSString *)getEUR2CNYstring:(NSNumber *)price;
@end
......@@ -493,9 +493,9 @@ static NSString *kEnglishNum = @"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstu
return CNYstring;
}
float exchageRate = [[KWMUserDao shareDao] exchangeRate].floatValue;
if(exchageRate == 0){
exchageRate = ExchangeRate;
}
// if(exchageRate == 0){
// exchageRate = ExchangeRate;
// }
CNYstring = [NSString stringWithFormat:@"%.0f",price.floatValue * exchageRate];
// CNYstring = [NSString stringWithFormat:@"%.2f",price.floatValue];
......
......@@ -10,6 +10,7 @@
#import <Foundation/Foundation.h>
#import "KWMAPIManager.h"
#import <MagicalRecord/MagicalRecord.h>
#import "NSDecimalNumber+Currency.h"
#ifndef Header_Prefix_h
#define Header_Prefix_h
......@@ -92,7 +93,8 @@
#define BigImage 3
//默认欧元汇率,如果安装后第一次请求最新汇率数据失败,会使用该汇率显示价格
#define ExchangeRate 7.6625
//#define ExchangeRate 7.6625
#define ExchangeRateString @"7.6625"
//品牌图片url
#define Burberry @"https://cdn.shopify.com/s/files/1/1089/5284/collections/Burberry_Childrenswear_Campaign_July_2016_001.jpg?v=1473238213"
......
......@@ -38,6 +38,14 @@
<string>iCemarose</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLSchemes</key>
<array>
<string>cemarose</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>2017060917</string>
......
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