Commit ccfaf5d1 by 许梦竹

add README

parents
File added
//
// AboutScreen.h
// ArcGis
//
// Created by Mac Book DQ02 on 16/3/25.
// Copyright © 2016年 Xu Mengzhu. All rights reserved.
//
#ifndef AboutScreen_h
#define AboutScreen_h
//定义一个weak self
#define WS(weakSelf) __weak __typeof(&*self)weakSelf = self;
//获取屏幕 宽度、高度
#define SCREEN_WIDTH ([UIScreen mainScreen].bounds.size.width)
#define SCREEN_HEIGHT ([UIScreen mainScreen].bounds.size.height)
//判断是否是3.5寸屏
#define IS_IPHONE4 SCREEN_HEIGHT==480?YES:NO
//判断是否是4寸屏
#define IS_IPHONE5 SCREEN_HEIGHT==568?YES:NO
//判断是否是6/6plus
#define IS_IPHONE6_UP (SCREEN_HEIGHT>667 | SCREEN_HEIGHT==667)?YES:NO
#define BTNOFFSET (IS_IPHONE6_UP?10:5)
#endif /* AboutScreen_h */
//
// ConfirmOrderVC.h
// PayDemo
//
// Created by Mac Book DQ02 on 16/6/20.
// Copyright © 2016年 Xu Mengzhu. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "Order.h"
#import <AlipaySDK/AlipaySDK.h>
@interface ConfirmOrderVC : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *receiverName;//收件人姓名
@property (weak, nonatomic) IBOutlet UITextField *receiverTel;//收件人电话
@property (weak, nonatomic) IBOutlet UITextField *receiverAddress;//收件人地址
@property (weak, nonatomic) IBOutlet UITextField *buyCountTF;//购买数量的文本框
@property (weak, nonatomic) IBOutlet UILabel *buyCountLab; //合集购买数量的标签
@property (weak, nonatomic) IBOutlet UILabel *totalPriceLab;//购买商品总价的标签
@end
//
// ConfirmOrderVC.m
// PayDemo
//
// Created by Mac Book DQ02 on 16/6/20.
// Copyright © 2016年 Xu Mengzhu. All rights reserved.
//
#import "ConfirmOrderVC.h"
@interface ConfirmOrderVC ()
@end
@implementation ConfirmOrderVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
self.navigationItem.title = @"确认订单";
//改变字体颜色
// [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"nav_bg"] forBarMetrics:(UIBarMetricsDefault)];
// NSMutableDictionary *textAttrs = [NSMutableDictionary dictionary];
// textAttrs[NSForegroundColorAttributeName] = [UIColor whiteColor];
// self.navigationController.navigationBar.titleTextAttributes = textAttrs;
[Manager setNavi:self.navigationController.navigationBar];
//设置导航栏左边按钮
// self.navigationItem.leftBarButtonItem = [Manager rightItemTarget:self img:@"nav_back" tag:1000000 action:@selector(leftBarButtonItemIsClicked:)];
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"nav_back"] landscapeImagePhone:nil style:UIBarButtonItemStylePlain target:self action:@selector(leftBarButtonItemClicked)];
self.navigationItem.leftBarButtonItem.tintColor = [UIColor whiteColor];
self.receiverTel.keyboardType = UIKeyboardTypePhonePad;
}
#pragma mark 返回按钮事件
-(void)leftBarButtonItemClicked
{
[self dismissViewControllerAnimated:NO completion:nil];
}
#pragma mark --加减号按钮事件,改变商品购买数量
- (IBAction)changBuyCountClicked:(UIButton *)sender {
if (sender.tag == 101) {
_buyCountTF.text = [NSString stringWithFormat:@"%d",[_buyCountTF.text intValue]+1];
}
else
{
if ([_buyCountTF.text intValue]<2) {
return;
}
_buyCountTF.text = [NSString stringWithFormat:@"%d",[_buyCountTF.text intValue]-1];
}
[self setFinalBuy];
}
#pragma mark --数量文本框手动编辑事件
- (IBAction)buyCountTFEndEdit:(id)sender {
[self setFinalBuy];
}
#pragma mark --设置最终购买数量和总价格标签内容
-(void)setFinalBuy
{
_buyCountLab.text = _buyCountTF.text;
_totalPriceLab.text = [NSString stringWithFormat:@"¥%.2f",[_buyCountTF.text intValue]*5.00];
}
#pragma mark --确认订单按钮事件
- (IBAction)orderConfirmBtnClicked:(id)sender {
if ([_receiverName.text isEqualToString:@""] || [_receiverTel.text isEqualToString:@""] || [_receiverAddress.text isEqualToString:@""]) {
UIAlertController *action = [UIAlertController alertControllerWithTitle:@"订单提交失败" message:@"请您完善信息!" preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ensure = [UIAlertAction actionWithTitle:@"好" style:UIAlertActionStyleDefault handler:nil];
[action addAction:ensure];
[self presentViewController:action animated:NO completion:nil];
return;
}
/*
*生成订单信息及签名
*/
//将商品信息赋予AlixPayOrder的成员变量
Order *order = [[Order alloc] init];
order.partner = @"2088021830678838";
order.sellerID = @"gaotingshan517@163.com";
order.outTradeNO = [self generateTradeNO]; //订单ID(由商家自行制定)
order.subject = @"登山卡"; //商品标题
order.body = @"登山卡"; //商品描述
// order.totalFee = [NSString stringWithFormat:@"%.2f",[_buyCountTF.text intValue] * 5.00]; //商品价格
order.totalFee = [NSString stringWithFormat:@"%.2f",0.01]; //商品价格
order.notifyURL = @"http://www.xxx.com"; //回调URL
order.service = @"mobile.securitypay.pay";
order.paymentType = @"1";
order.inputCharset = @"utf-8";
order.itBPay = @"30m";
order.showURL = @"m.alipay.com";
//将商品信息拼接成字符串
NSString *orderSpec = [order description];
NSLog(@"orderSpec = %@",orderSpec);
NSDictionary *parameterDic = [[NSDictionary alloc]initWithObjectsAndKeys:orderSpec,@"orderInfo", nil];
[Manager alipayRequest:parameterDic orderSpec:orderSpec flag:1];
}
#pragma mark -
#pragma mark ==============产生随机订单号==============
- (NSString *)generateTradeNO
{
static int kNumber = 15;
NSString *sourceStr = @"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
NSMutableString *resultStr = [[NSMutableString alloc] init];
srand((unsigned)time(0));
for (int i = 0; i < kNumber; i++)
{
unsigned index = rand() % [sourceStr length];
NSString *oneStr = [sourceStr substringWithRange:NSMakeRange(index, 1)];
[resultStr appendString:oneStr];
}
return resultStr;
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
//
// Order.h
// AlixPayDemo
//
// Created by 方彬 on 11/2/13.
//
//
#import <Foundation/Foundation.h>
@interface Order : NSObject
/*********************************支付四要素*********************************/
//商户在支付宝签约时,支付宝为商户分配的唯一标识号(以2088开头的16位纯数字)。
@property (nonatomic, copy) NSString *partner;
//卖家支付宝账号对应的支付宝唯一用户号(以2088开头的16位纯数字),订单支付金额将打入该账户,一个partner可以对应多个seller_id。
@property (nonatomic, copy) NSString *sellerID;
//商户网站商品对应的唯一订单号。
@property (nonatomic, copy) NSString *outTradeNO;
//该笔订单的资金总额,单位为RMB(Yuan)。取值范围为[0.01,100000000.00],精确到小数点后两位。
@property (nonatomic, copy) NSString *totalFee;
/*********************************商品相关*********************************/
//商品的标题/交易标题/订单标题/订单关键字等。
@property (nonatomic, copy) NSString *subject;
//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。
@property (nonatomic, copy) NSString *body;
/*********************************其他必传参数*********************************/
//接口名称,固定为mobile.securitypay.pay。
@property (nonatomic, copy) NSString *service;
//商户网站使用的编码格式,固定为utf-8。
@property (nonatomic, copy) NSString *inputCharset;
//支付宝服务器主动通知商户网站里指定的页面http路径。
@property (nonatomic, copy) NSString *notifyURL;
/*********************************可选参数*********************************/
//支付类型,1:商品购买。(不传情况下的默认值)
@property (nonatomic, copy) NSString *paymentType;
//具体区分本地交易的商品类型,1:实物交易; (不传情况下的默认值),0:虚拟交易; (不允许使用信用卡等规则)。
@property (nonatomic, copy) NSString *goodsType;
//支付时是否发起实名校验,F:不发起实名校验; (不传情况下的默认值),T:发起实名校验;(商户业务需要买家实名认证)
@property (nonatomic, copy) NSString *rnCheck;
//标识客户端。
@property (nonatomic, copy) NSString *appID;
//标识客户端来源。参数值内容约定如下:appenv=“system=客户端平台名^version=业务系统版本”
@property (nonatomic, copy) NSString *appenv;
//设置未付款交易的超时时间,一旦超时,该笔交易就会自动被关闭。当用户输入支付密码、点击确认付款后(即创建支付宝交易后)开始计时。取值范围:1m~15d,或者使用绝对时间(示例格式:2014-06-13 16:00:00)。m-分钟,h-小时,d-天,1c-当天(1c-当天的情况下,无论交易何时创建,都在0点关闭)。该参数数值不接受小数点,如1.5h,可转换为90m。
@property (nonatomic, copy) NSString *itBPay;
//商品地址
@property (nonatomic, copy) NSString *showURL;
//业务扩展参数,支付宝特定的业务需要添加该字段,json格式。 商户接入时和支付宝协商确定。
@property (nonatomic, strong) NSMutableDictionary *outContext;
@end
//
// Order.m
// AlixPayDemo
//
// Created by 方彬 on 11/2/13.
//
//
#import "Order.h"
@implementation Order
- (NSString *)description {
NSMutableString * discription = [NSMutableString string];
if (self.partner) {
[discription appendFormat:@"partner=\"%@\"", self.partner];
}
if (self.sellerID) {
[discription appendFormat:@"&seller_id=\"%@\"", self.sellerID];
}
if (self.outTradeNO) {
[discription appendFormat:@"&out_trade_no=\"%@\"", self.outTradeNO];
}
if (self.subject) {
[discription appendFormat:@"&subject=\"%@\"", self.subject];
}
if (self.body) {
[discription appendFormat:@"&body=\"%@\"", self.body];
}
if (self.totalFee) {
[discription appendFormat:@"&total_fee=\"%@\"", self.totalFee];
}
if (self.notifyURL) {
[discription appendFormat:@"&notify_url=\"%@\"", self.notifyURL];
}
if (self.service) {
[discription appendFormat:@"&service=\"%@\"",self.service];//mobile.securitypay.pay
}
if (self.paymentType) {
[discription appendFormat:@"&payment_type=\"%@\"",self.paymentType];//1
}
if (self.inputCharset) {
[discription appendFormat:@"&_input_charset=\"%@\"",self.inputCharset];//utf-8
}
if (self.itBPay) {
[discription appendFormat:@"&it_b_pay=\"%@\"",self.itBPay];//30m
}
if (self.showURL) {
[discription appendFormat:@"&show_url=\"%@\"",self.showURL];//m.alipay.com
}
if (self.appID) {
[discription appendFormat:@"&app_id=\"%@\"",self.appID];
}
for (NSString * key in [self.outContext allKeys]) {
[discription appendFormat:@"&%@=\"%@\"", key, [self.outContext objectForKey:key]];
}
return discription;
}
@end
//
// AppDelegate.h
// ArcGis
//
// Created by Mac Book DQ02 on 16/3/16.
// Copyright © 2016年 Xu Mengzhu. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GuideMapController.h"
#import "IntroduceViewController.h"
#import <MMDrawerController.h>
#import "LeftDrawerViewController.h"
#import <AFNetworking.h>
#import "Manager.h"
#import <IQKeyboardManager.h>
#import "Singleton.h"
#import "CustomTabBarController.h"
#import <AlipaySDK/AlipaySDK.h>
#import "WXApi.h"
#import "WXApiObject.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate,UITableViewDelegate,CLLocationManagerDelegate,UITabBarControllerDelegate,WXApiDelegate>
@property (strong, nonatomic) UIWindow *window;
@property (strong,nonatomic) MMDrawerController *drawerController;
@property (strong, nonatomic) CustomTabBarController *tabbarVC;
@property (strong, nonatomic) CLLocationManager *locationManager;//用于系统定位;
@property (strong, nonatomic) CLLocation *currentLocation;
@property (assign, nonatomic) long lastIndex;//记录上一次点击的索引
-(void)setMMDrawerController;
@end
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"filename" : "card.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "20x20",
"scale" : "3x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "58-58.png",
"scale" : "2x"
},
{
"size" : "29x29",
"idiom" : "iphone",
"filename" : "87-87.png",
"scale" : "3x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "80-80.png",
"scale" : "2x"
},
{
"size" : "40x40",
"idiom" : "iphone",
"filename" : "120-120.png",
"scale" : "3x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "120-121.png",
"scale" : "2x"
},
{
"size" : "60x60",
"idiom" : "iphone",
"filename" : "180-180.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ 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