Commit 3894a2ff authored by 曹云霄's avatar 曹云霄

添加分享订单功能,待测试

parent 61cd6341
...@@ -200,7 +200,7 @@ ...@@ -200,7 +200,7 @@
{ {
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil]; UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"StoryboardwithCYX" bundle:nil];
OrderdetailsViewController *orderdetails = [storyboard instantiateViewControllerWithIdentifier:@"orderdetails"]; OrderdetailsViewController *orderdetails = [storyboard instantiateViewControllerWithIdentifier:@"orderdetails"];
TOOrderEntity *model = [[self.datasArray objectAtIndex_opple:indexPath.row] order]; TOOrderEntity *model = (TOOrderEntity *)[[self.datasArray objectAtIndex_opple:indexPath.row] order];
orderdetails.orderCode = model.orderNumber; orderdetails.orderCode = model.orderNumber;
orderdetails.sectionTitle = @[@"订单信息",@"客户信息",@"收货信息",@"商品信息",@"附件信息"]; orderdetails.sectionTitle = @[@"订单信息",@"客户信息",@"收货信息",@"商品信息",@"附件信息"];
orderdetails.isShowattachment = YES; orderdetails.isShowattachment = YES;
......
...@@ -209,6 +209,7 @@ ...@@ -209,6 +209,7 @@
if ([Name isEqualToString:@"体验中心"]) { if ([Name isEqualToString:@"体验中心"]) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"FollowHeartVC" object:nil]; [[NSNotificationCenter defaultCenter] postNotificationName:@"FollowHeartVC" object:nil];
return;
}else if ([Name isEqualToString:@"场景库"]) }else if ([Name isEqualToString:@"场景库"])
{ {
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#import "AdditionalTableViewCell.h" #import "AdditionalTableViewCell.h"
#import <QuickLook/QuickLook.h> #import <QuickLook/QuickLook.h>
#import "PDFViewController.h" #import "PDFViewController.h"
#import "ShareGoodsViewController.h"
@interface OrderdetailsViewController ()<UITableViewDelegate,UITableViewDataSource,QLPreviewControllerDataSource> @interface OrderdetailsViewController ()<UITableViewDelegate,UITableViewDataSource,QLPreviewControllerDataSource>
...@@ -147,6 +148,18 @@ ...@@ -147,6 +148,18 @@
printButton.layer.cornerRadius = kCornerRadius; printButton.layer.cornerRadius = kCornerRadius;
printButton.backgroundColor = kMainBlueColor; printButton.backgroundColor = kMainBlueColor;
[headerView addSubview:printButton]; [headerView addSubview:printButton];
//分享
UIButton *shareButton = [UIButton buttonWithType:UIButtonTypeSystem];
shareButton.frame = CGRectMake(ScreenWidth-50-350, 15, 150, 30);
[shareButton setTitle:@"分享" forState:UIControlStateNormal];
[shareButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
shareButton.titleLabel.font = [UIFont systemFontOfSize:12];
[shareButton addTarget:self action:@selector(ShareButtonClick:) forControlEvents:UIControlEventTouchUpInside];
shareButton.layer.masksToBounds = YES;
shareButton.layer.cornerRadius = kCornerRadius;
shareButton.backgroundColor = kMainBlueColor;
[headerView addSubview:shareButton];
} }
//横线 //横线
...@@ -493,23 +506,25 @@ ...@@ -493,23 +506,25 @@
return self.PDFpath; return self.PDFpath;
} }
#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.
}
- (BOOL)prefersStatusBarHidden - (BOOL)prefersStatusBarHidden
{ {
return YES; return YES;
} }
- (void)didReceiveMemoryWarning { #pragma mark - 分享订单
[super didReceiveMemoryWarning]; - (void)ShareButtonClick:(UIButton *)sender
// Dispose of any resources that can be recreated. {
ShareGoodsViewController *shareController = [[ShareGoodsViewController alloc]init];
shareController.isShareOrderbill = YES;
shareController.orderBillNumber = self.orderCode;
shareController.preferredContentSize = CGSizeMake(290, 120);
shareController.modalPresentationStyle = UIModalPresentationPopover;
UIPopoverPresentationController *popover = shareController.popoverPresentationController;
popover.permittedArrowDirections = UIPopoverArrowDirectionUp;
popover.barButtonItem = [[UIBarButtonItem alloc]initWithCustomView:sender];
[self presentViewController:shareController animated:YES completion:nil];
} }
@end @end
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.inputRebateTextField.placeholder = [NSString stringWithFormat:@"当前可提现:%@",self.rebateAmount];
} }
- (IBAction)rebateButtonClickAction:(UIButton *)sender { - (IBAction)rebateButtonClickAction:(UIButton *)sender {
......
...@@ -75,12 +75,16 @@ ...@@ -75,12 +75,16 @@
@implementation RebateViewController @implementation RebateViewController
- (void)viewWillAppear:(BOOL)animated
{
[self getRebateDatasFromUser];
}
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
[self setupChildViewController]; [self setupChildViewController];
[self uiConfigAction]; [self uiConfigAction];
[self getRebateDatasFromUser];
} }
#pragma mark - UI #pragma mark - UI
......
...@@ -627,6 +627,7 @@ ...@@ -627,6 +627,7 @@
29834EC11CDF768C001A484F /* XXuserController */, 29834EC11CDF768C001A484F /* XXuserController */,
2962D06E1CD1A56B0058829D /* RIghtVC */, 2962D06E1CD1A56B0058829D /* RIghtVC */,
2962D06A1CD1A3FE0058829D /* MyClient */, 2962D06A1CD1A3FE0058829D /* MyClient */,
29808A611CFEC287001D1020 /* Experiencecentre */,
2928F83F1CD0AB830036D761 /* Shoppingcart */, 2928F83F1CD0AB830036D761 /* Shoppingcart */,
2928F8251CD09BC10036D761 /* Tabbar */, 2928F8251CD09BC10036D761 /* Tabbar */,
0447085B1CD7C06B00555827 /* Login */, 0447085B1CD7C06B00555827 /* Login */,
...@@ -640,7 +641,6 @@ ...@@ -640,7 +641,6 @@
children = ( children = (
2916A7451D7039F600644C8C /* Uiview+category */, 2916A7451D7039F600644C8C /* Uiview+category */,
29498C511D050DB3004FA79B /* UIImagePickerController */, 29498C511D050DB3004FA79B /* UIImagePickerController */,
29808A611CFEC287001D1020 /* Experiencecentre */,
29F14B931CF6A4B50005D3E5 /* Scanner */, 29F14B931CF6A4B50005D3E5 /* Scanner */,
2902E1301CF2907200268161 /* RefreshHeader */, 2902E1301CF2907200268161 /* RefreshHeader */,
294CF0E91CEDCF250055F1D8 /* PromptinformationView */, 294CF0E91CEDCF250055F1D8 /* PromptinformationView */,
...@@ -954,6 +954,7 @@ ...@@ -954,6 +954,7 @@
29808A651CFED6E5001D1020 /* Scene */, 29808A651CFED6E5001D1020 /* Scene */,
); );
name = Experiencecentre; name = Experiencecentre;
path = ../Tools;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
29808A651CFED6E5001D1020 /* Scene */ = { 29808A651CFED6E5001D1020 /* Scene */ = {
......
...@@ -2788,10 +2788,10 @@ ...@@ -2788,10 +2788,10 @@
<rect key="frame" x="27" y="16" width="63" height="21"/> <rect key="frame" x="27" y="16" width="63" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/> <fontDescription key="fontDescription" type="system" weight="medium" pointSize="15"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
<textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" placeholder="当前可提现:1202" textAlignment="natural" minimumFontSize="17" id="feT-lo-Gzz"> <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" textAlignment="natural" minimumFontSize="17" id="feT-lo-Gzz">
<rect key="frame" x="103" y="11" width="345" height="30"/> <rect key="frame" x="103" y="11" width="345" height="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/> <fontDescription key="fontDescription" type="system" pointSize="14"/>
...@@ -2855,7 +2855,7 @@ ...@@ -2855,7 +2855,7 @@
<rect key="frame" x="288" y="101" width="192" height="21"/> <rect key="frame" x="288" y="101" width="192" height="21"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/> <fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/> <color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/> <nil key="highlightedColor"/>
</label> </label>
</subviews> </subviews>
......
...@@ -103,10 +103,15 @@ ...@@ -103,10 +103,15 @@
#define RESETORDER @"/order/updateOrderState/" #define RESETORDER @"/order/updateOrderState/"
/** /**
* 分享 * 分享商品
*/ */
#define SHARE @"/system/shareGoods" #define SHARE @"/system/shareGoods"
/**
* 分享订单
*/
#define SHAREORDERBILL @"/order/OrderShare"
/** /**
* 产品筛选 * 产品筛选
*/ */
......
...@@ -57,5 +57,16 @@ ...@@ -57,5 +57,16 @@
*/ */
@property (nonatomic,assign) id<SharePicturedelegate> delegate; @property (nonatomic,assign) id<SharePicturedelegate> delegate;
/**
* 分享订单、分享商品
*/
@property (nonatomic,assign) BOOL isShareOrderbill;
/**
* 订单ID
*/
@property (nonatomic,copy) NSString *orderBillNumber;
@end @end
...@@ -26,7 +26,29 @@ ...@@ -26,7 +26,29 @@
#pragma mark -分享 #pragma mark -分享
- (IBAction)ShareWeiChatAntWeiboAction:(UIButton *)sender { - (IBAction)ShareWeiChatAntWeiboAction:(UIButton *)sender {
WS(weakSelf);
if (self.isShareOrderbill) {//分享订单
[weakSelf CreateMBProgressHUDLoding];
NSString *shareOrderString = [NSString stringWithFormat:@"%@/%@",SHAREORDERBILL,self.orderBillNumber];
[[NetworkRequestClassManager Manager] NetworkWithDictionaryRequestWithURL:SERVERREQUESTURL(shareOrderString) WithRequestType:0 WithParameter:nil WithReturnValueBlock:^(id returnValue) {
[weakSelf RemoveMBProgressHUDLoding];
if ([returnValue[@"code"] isEqualToNumber:@0]) {
[weakSelf callSharePlatform:returnValue[@"data"][@"url"] withPlatformTag:sender];
}else
{
[weakSelf SHOWPrompttext:returnValue[@"message"]];
}
} WithErrorCodeBlock:^(id errorCodeValue) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf SHOWPrompttext:NETWORK];
} WithFailureBlock:^(NSError *error) {
[weakSelf RemoveMBProgressHUDLoding];
[weakSelf SHOWPrompttext:error.localizedDescription];
}];
}else//分享商品
{
[self dismissViewControllerAnimated:YES completion:nil]; [self dismissViewControllerAnimated:YES completion:nil];
NSData *imageData = UIImageJPEGRepresentation(self.shareImage, 0.5); NSData *imageData = UIImageJPEGRepresentation(self.shareImage, 0.5);
NSString *goodsID = [self.goodsIds substringToIndex:[self.goodsIds length]-1]; NSString *goodsID = [self.goodsIds substringToIndex:[self.goodsIds length]-1];
...@@ -37,6 +59,48 @@ ...@@ -37,6 +59,48 @@
if ([returnValue[@"code"] isEqualToNumber:@0]) { if ([returnValue[@"code"] isEqualToNumber:@0]) {
NSString *shareWeb = returnValue[@"data"][@"url"]; NSString *shareWeb = returnValue[@"data"][@"url"];
[weakSelf callSharePlatform:shareWeb withPlatformTag:sender];
}else
{
if ([weakSelf.delegate respondsToSelector:@selector(CodeNotEqualZero:)]) {
[weakSelf.delegate CodeNotEqualZero:returnValue[@"message"]];
}
}
}WithprogressBlock:^(double progress) {
if (progress >= 1) {
if ([weakSelf.delegate respondsToSelector:@selector(UploadImageSuccess)]) {
[weakSelf.delegate UploadImageSuccess];
}
}else
{
if ([weakSelf.delegate respondsToSelector:@selector(UploadImageProgress:)]) {
[weakSelf.delegate UploadImageProgress:progress];
}
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(NSError *error) {
if ([weakSelf.delegate respondsToSelector:@selector(UploadImageFailue)]) {
[weakSelf.delegate UploadImageFailue];
}
[weakSelf ErrorMBProgressView:error.localizedDescription];
}];
}
}
#pragma mark - 调用分享
- (void)callSharePlatform:(NSString *)shareWeb withPlatformTag:(UIButton *)sender
{
switch (sender.tag) { switch (sender.tag) {
case 100: //微信好友 case 100: //微信好友
{//自定义样式 {//自定义样式
...@@ -81,43 +145,7 @@ ...@@ -81,43 +145,7 @@
default: default:
break; break;
} }
}else
{
if ([self.delegate respondsToSelector:@selector(CodeNotEqualZero:)]) {
[self.delegate CodeNotEqualZero:returnValue[@"message"]];
}
}
}WithprogressBlock:^(double progress) {
if (progress >= 1) {
if ([self.delegate respondsToSelector:@selector(UploadImageSuccess)]) {
[self.delegate UploadImageSuccess];
}
}else
{
if ([self.delegate respondsToSelector:@selector(UploadImageProgress:)]) {
[self.delegate UploadImageProgress:progress];
}
}
} WithErrorCodeBlock:^(id errorCodeValue) {
} WithFailureBlock:^(NSError *error) {
if ([self.delegate respondsToSelector:@selector(UploadImageFailue)]) {
[self.delegate UploadImageFailue];
}
[self ErrorMBProgressView:error.localizedDescription];
}];
} }
@end @end
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES"> <document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15G31" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies> <dependencies>
<deployment identifier="iOS"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="10085"/>
</dependencies> </dependencies>
<objects> <objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ShareGoodsViewController"> <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ShareGoodsViewController">
......
from optparse import OptionParser
import subprocess
import requests
#configuration for iOS build setting
CODE_SIGN_IDENTITY = "iPhone Distribution: Shanghai Gomore Information Technology Co.,Ltd"
PROVISIONING_PROFILE = "10361169-d429-4810-90f6-528335fe4062"
CONFIGURATION = "Release"
SDK = "iphoneos"
# configuration for pgyer
PGYER_UPLOAD_URL = "http://www.pgyer.com/apiv1/app/upload"
DOWNLOAD_BASE_URL = "http://www.pgyer.com"
USER_KEY = "a6283ec42bbaf9efc5b6f01a750299f3"
API_KEY = "f9aefb343ecc7959f8e216ed08db1c83"
def cleanBuildDir(buildDir):
cleanCmd = "rm -r %s" %(buildDir)
process = subprocess.Popen(cleanCmd, shell = True)
process.wait()
print "cleaned buildDir: %s" %(buildDir)
def parserUploadResult(jsonResult):
resultCode = jsonResult['code']
if resultCode == 0:
downUrl = DOWNLOAD_BASE_URL +"/"+jsonResult['data']['appShortcutUrl']
print "Upload Success"
print "DownUrl is:" + downUrl
else:
print "Upload Fail!"
print "Reason:"+jsonResult['message']
def uploadIpaToPgyer(ipaPath):
print "ipaPath:"+ipaPath
files = {'file': open(ipaPath, 'rb')}
headers = {'enctype':'multipart/form-data'}
payload = {'uKey':USER_KEY,'_api_key':API_KEY,'publishRange':'2','isPublishToPublic':'2', 'password':''}
print "uploading...."
r = requests.post(PGYER_UPLOAD_URL, data = payload ,files=files,headers=headers)
if r.status_code == requests.codes.ok:
result = r.json()
parserUploadResult(result)
else:
print 'HTTPError,Code:'+r.status_code
def buildProject(project, target, output):
buildCmd = 'xcodebuild -project %s -target %s -sdk %s -configuration %s build CODE_SIGN_IDENTITY="%s" PROVISIONING_PROFILE="%s"' %(project, target, SDK, CONFIGURATION, CODE_SIGN_IDENTITY, PROVISIONING_PROFILE)
process = subprocess.Popen(buildCmd, shell = True)
process.wait()
signApp = "./build/%s-iphoneos/%s.app" %(CONFIGURATION, target)
signCmd = "xcrun -sdk %s -v PackageApplication %s -o %s" %(SDK, signApp, output)
process = subprocess.Popen(signCmd, shell=True)
(stdoutdata, stderrdata) = process.communicate()
uploadIpaToPgyer(output)
cleanBuildDir("./build")
def buildWorkspace(workspace, scheme, output):
process = subprocess.Popen("pwd", stdout=subprocess.PIPE)
(stdoutdata, stderrdata) = process.communicate()
buildDir = stdoutdata.strip() + '/build'
print "buildDir: " + buildDir
buildCmd = 'xcodebuild -workspace %s -scheme %s -sdk %s -configuration %s build CODE_SIGN_IDENTITY="%s" PROVISIONING_PROFILE="%s" SYMROOT=%s' %(workspace, scheme, SDK, CONFIGURATION, CODE_SIGN_IDENTITY, PROVISIONING_PROFILE, buildDir)
process = subprocess.Popen(buildCmd, shell = True)
process.wait()
signApp = "./build/%s-iphoneos/%s.app" %(CONFIGURATION, scheme)
signCmd = "xcrun -sdk %s -v PackageApplication %s -o %s" %(SDK, signApp, output)
process = subprocess.Popen(signCmd, shell=True)
(stdoutdata, stderrdata) = process.communicate()
uploadIpaToPgyer(output)
cleanBuildDir(buildDir)
def xcbuild(options):
project = options.project
workspace = options.workspace
target = options.target
scheme = options.scheme
output = options.output
if project is None and workspace is None:
pass
elif project is not None:
buildProject(project, target, output)
elif workspace is not None:
buildWorkspace(workspace, scheme, output)
def main():
parser = OptionParser()
parser.add_option("-w", "--workspace", help="Build the workspace name.xcworkspace.", metavar="name.xcworkspace")
parser.add_option("-p", "--project", help="Build the project name.xcodeproj.", metavar="name.xcodeproj")
parser.add_option("-s", "--scheme", help="Build the scheme specified by schemename. Required if building a workspace.", metavar="schemename")
parser.add_option("-t", "--target", help="Build the target specified by targetname. Required if building a project.", metavar="targetname")
parser.add_option("-o", "--output", help="specify output filename", metavar="output_filename")
(options, args) = parser.parse_args()
print "options: %s, args: %s" % (options, args)
xcbuild(options)
if __name__ == '__main__':
main()
\ No newline at end of file
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