Initial commit

This commit is contained in:
ifish
2017-08-15 16:59:01 +08:00
commit bdc83e07ef
5766 changed files with 423223 additions and 0 deletions
@@ -0,0 +1,16 @@
//
// IfishShopEditeNewViewController.h
// Ifish
//
// Created by imac on 17/2/15.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "WhiteNavBaseViewController.h"
#import "CertificationShopModel.h"
//最新商铺编辑界面 原为ShopEditViewController
@interface IfishShopEditeNewViewController : WhiteNavBaseViewController
@property(nonatomic,strong) CertificationShopModel *shopInfo;
@end
@@ -0,0 +1,818 @@
//
// IfishShopEditeNewViewController.m
// Ifish
//
// Created by imac on 17/2/15.
// Copyright © 2017年 lianlian. All rights reserved.
//
#import "IfishShopEditeNewViewController.h"
#import "ChinaPlckerView.h"
#import "UITextField+KeyBordDoneView.h"
#import <BaiduMapAPI_Location/BMKLocationService.h>
#import <BaiduMapAPI_Search/BMKSearchComponent.h>
#import <BaiduMapAPI_Utils/BMKUtilsComponent.h>
#import "UIImageView+WebCache.h"
#import "IfishShopEdite1Cell.h"
#import "IfishShopEdite2ViewCell.h"
#import "IfishSHopEdite3ViewCell.h"
#import "IfishSHopEdite4ViewCell.h"
#import "IfishSHopEdite5VCell.h"
#import "IfishSHopEdite6ViewCell.h"
#define CELL1_TAG 100000001
#define CELL2_TAG 100000002
#define CELL3_TAG 100000003
#define CELL4_TAG 100000004
#define CELL5_TAG 100000005
#define CELL6_TAG 100000006
#define CELL7_TAG 100000007
#define CELLIMG_TAG 100000008
#import "WFPhotosViewController.h"
#import "WFTailoringViewController.h"
static const CGFloat rectWidth = 300;
static const CGFloat rectHeight = 168;
#import "CusomeCameraViewController.h"
@interface IfishShopEditeNewViewController ()<UITableViewDelegate,
UITableViewDataSource,
UITextFieldDelegate,
UIImagePickerControllerDelegate,
UIActionSheetDelegate,
UINavigationControllerDelegate,
ChinaPlckerViewDelegate,
BMKLocationServiceDelegate,
BMKGeoCodeSearchDelegate,
UIGestureRecognizerDelegate>
{
BMKGeoCodeSearch*_geocodesearch;
BOOL _isUpdate;
}
@property(nonatomic,strong)UITableView *tableView;
@property(nonatomic,strong) NSArray *titles;
@property(nonatomic,strong) NSString *address;
@property(nonatomic)BMKLocationService*locService;
@property(nonatomic,strong) NSString *privence;
@property(nonatomic,strong) NSString *city;
@property(nonatomic,strong) NSString *area;
@property(nonatomic,strong)UIActionSheet*photosheet;
@property (nonatomic)NSTimer *getInfTimer;
@end
@implementation IfishShopEditeNewViewController
- (void)viewDidLoad {
[super viewDidLoad];
_isUpdate = NO;
[self addTitleViewWithTitle:@"店铺管理"];
// Do any additional setup after loading the view.
self.address =self.shopInfo.shopsAddress;
self.privence = self.shopInfo.shopsProvince;
self.city = self.shopInfo.shopsCity;
self.area = self.shopInfo.shopsArea;
[self creatTab];
UIBarButtonItem*rightItem=[[UIBarButtonItem alloc]initWithTitle:@"提交" style: UIBarButtonItemStyleDone target:self action:@selector(tiJiaoClick)];
rightItem.tintColor=[UIColor blackColor];
[rightItem setTitleTextAttributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15]} forState:UIControlStateNormal];
self.navigationItem.rightBarButtonItem=rightItem;
}
-(void)initData{
}
#pragma mark 定位
-(void)getLocation{
//初始化BMKLocationService
_locService=[[BMKLocationService alloc]init];
_locService.delegate=self;
//启动LocationService
[_locService startUserLocationService];
_geocodesearch=[[BMKGeoCodeSearch alloc]init];
}
//处理方向变更信息
- (void)didUpdateUserHeading:(BMKUserLocation *)userLocation
{
//NSLog(@"heading is %@",userLocation.heading);
}
//处理位置坐标更新
- (void)didUpdateBMKUserLocation:(BMKUserLocation *)userLocation
{
//NSLog(@"didUpdateUserLocation lat %f,long %f",userLocation.location.coordinate.latitude,userLocation.location.coordinate.longitude);
[self reverseGeoCodeWithlatitude:userLocation.location.coordinate.latitude addlongitude:userLocation.location.coordinate.longitude];
// static dispatch_once_t disOnce;
// dispatch_once(&disOnce, ^ {
//
// [self reverseGeoCodeWithlatitude:userLocation.location.coordinate.latitude addlongitude:userLocation.location.coordinate.longitude];
// });
}
/**
* 地理反编码
*/
-(void)reverseGeoCodeWithlatitude:(CLLocationDegrees)latitude addlongitude:(CLLocationDegrees)longitude{
CLLocationCoordinate2D pt=(CLLocationCoordinate2D){latitude,longitude};
BMKReverseGeoCodeOption *reverseGeocodeSearchOption = [[BMKReverseGeoCodeOption alloc]init];
reverseGeocodeSearchOption.reverseGeoPoint=pt;
BOOL flag = [_geocodesearch reverseGeoCode:reverseGeocodeSearchOption];
if(flag)
{
NSLog(@"反geo检索发送成功");
}
else
{
NSLog(@"反geo检索发送失败");
}
}
-(void)dealloc{
if (_geocodesearch!=nil) {
_geocodesearch=nil;
}
}
#pragma mark BMKGeoCodeSearchDelegate
-(void)onGetReverseGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKReverseGeoCodeResult *)result errorCode:(BMKSearchErrorCode)error{
NSLog(@"address%@",result.address);
self.address = result.address;
// IfishSHopEdite3ViewCell *cell = [self.view viewWithTag:CELL6_TAG];
// if (cell) {
// cell.addressFiled.text= self.address;
// }
// static dispatch_once_t disOnce;
// dispatch_once(&disOnce, ^ {
// [self.tableView reloadData];
// });
}
- (void)onGetGeoCodeResult:(BMKGeoCodeSearch *)searcher result:(BMKGeoCodeResult *)result errorCode:(BMKSearchErrorCode)error{
}
-(void)goBackAction{
if (_isUpdate) {
[self.navigationController popViewControllerAnimated:YES];
return;
}
//IOS 8
UIAlertController*ac=[UIAlertController alertControllerWithTitle:@"" message:@"是否放弃当前操作" preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:ac animated:YES completion:nil];
[ac addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction*action){
}]];
[ac addAction:[UIAlertAction actionWithTitle:@"放弃" style:UIAlertActionStyleDefault handler:^(UIAlertAction*action){
[self.navigationController popViewControllerAnimated:YES];
}]];
}
-(void)viewWillAppear:(BOOL)animated{
[super viewWillAppear:animated];
_geocodesearch.delegate=self;// 此处记得不用的时候需要置nil,
_locService.delegate=self;
}
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
// 禁用 iOS7 返回手势
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = NO;
}
}
-(void)viewWillDisappear:(BOOL)animated{
[super viewWillDisappear:animated];
_locService.delegate=nil;
// 开启
if ([self.navigationController respondsToSelector:@selector(interactivePopGestureRecognizer)]) {
self.navigationController.interactivePopGestureRecognizer.enabled = YES;
}
}
-(void)creatTab{
self.tableView=[[UITableView alloc]initWithFrame:CGRectMake(0,0, self.view.frame.size.width,self.view.frame.size.height) style:UITableViewStyleGrouped];
self.tableView.delegate = self;
self.tableView.dataSource = self;
self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
self.tableView.showsVerticalScrollIndicator = NO;
self.tableView.backgroundColor = TABLE_BACKGROUD_COLOR;
[self.view addSubview:self.tableView];
// UITapGestureRecognizer*tabGestrueRecognizer=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tabViewGestrue)];
//tabGestrueRecognizer.delegate =self;
// [self.tableView addGestureRecognizer:tabGestrueRecognizer];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section ==0) {
return 7;
}
return 1;
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section ==0 && indexPath.row ==0) {
IfishShopEdite1Cell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishShopEdite1Cell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishShopEdite1Cell" owner:self options:nil]lastObject];
}
cell.ShopName.text = self.shopInfo.shopsName;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.tag = CELL1_TAG;
return cell;
}else if (indexPath.section ==0 && indexPath.row ==1){
IfishShopEdite2ViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishShopEdite2ViewCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishShopEdite2ViewCell" owner:self options:nil]lastObject];
}
cell.titleName.text = @"微信账号";
cell.infoFiled.placeholder = @"请输入微信账号";
cell.infoFiled.text = self.shopInfo.wechat;
[cell.infoFiled keybordViewAddDoneView];
cell.tag = CELL2_TAG;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}else if (indexPath.section ==0 && indexPath.row ==2){
IfishShopEdite2ViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishShopEdite2ViewCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishShopEdite2ViewCell" owner:self options:nil]lastObject];
}
cell.titleName.text = @"联系电话";
cell.infoFiled.keyboardType= UIKeyboardTypeNumberPad;
cell.infoFiled.placeholder = @"请输入联系电话";
cell.tag = CELL3_TAG;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.infoFiled.text = self.shopInfo.shopsPhone;
[cell.infoFiled keybordViewAddDoneView];
return cell;
}else if (indexPath.section ==0 && indexPath.row ==3){
IfishShopEdite2ViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishShopEdite2ViewCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishShopEdite2ViewCell" owner:self options:nil]lastObject];
}
cell.titleName.text = @"网店地址";
cell.infoFiled.placeholder = @"请输入网店地址";
cell.tag = CELL4_TAG;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.infoFiled.text = self.shopInfo.shoplink;
[cell.infoFiled keybordViewAddDoneView];
return cell;
}else if (indexPath.section ==0 && indexPath.row ==4){
IfishSHopEdite6ViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishSHopEdite6ViewCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishSHopEdite6ViewCell" owner:self options:nil]lastObject];
}
cell.locationLab.text = [NSString stringWithFormat:@"%@%@%@",self.privence,self.city,self.area];
cell.tag = CELL5_TAG;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
}else if (indexPath.section ==0 && indexPath.row ==5){
IfishSHopEdite3ViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishSHopEdite3ViewCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishSHopEdite3ViewCell" owner:self options:nil]lastObject];
}
cell.tag = CELL6_TAG;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.addressFiled.text = self.address;
[cell.addressFiled keybordViewAddDoneView];
return cell;
}else if (indexPath.section ==0 && indexPath.row ==6){
IfishSHopEdite4ViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishSHopEdite4ViewCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishSHopEdite4ViewCell" owner:self options:nil]lastObject];
}
[cell.LocationBtn addTarget:self action:@selector(userloactionAction) forControlEvents:UIControlEventTouchUpInside];
cell.tag = CELL7_TAG;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
}else if (indexPath.section ==1 && indexPath.row ==0){
IfishSHopEdite5VCell *cell = [tableView dequeueReusableCellWithIdentifier:@"IfishSHopEdite5VCell"];
if (!cell) {
cell = [[[NSBundle mainBundle]loadNibNamed:@"IfishSHopEdite5VCell" owner:self options:nil]lastObject];
}
cell.tag = CELLIMG_TAG;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
cell.shopImg.userInteractionEnabled = YES;
if (self.shopInfo.picture4) {
if (![self.shopInfo.picture4 isEqualToString:@""]) {
//获取系统当前的时间戳
NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];
NSTimeInterval time=[dat timeIntervalSince1970]*1000;
NSString *timeString = [NSString stringWithFormat:@"%.0f",time];
NSString * imgUrl = [NSString stringWithFormat:@"%@/shops/%@/%@?time=%@",JIEKOUPORTHTTP,self.shopInfo.userId,self.shopInfo.picture4,timeString];
[cell.shopImg sd_setImageWithURL:[NSURL URLWithString:imgUrl]];
}
}
[cell.changeImgBtn addTarget:self action:@selector(changeImgBtnAction) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
return nil;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section ==0 &&indexPath.row==0) {
return 44;
}else if (indexPath.section ==0 &&indexPath.row==1){
return 44;
}else if (indexPath.section ==0 &&indexPath.row==2){
return 44;
}else if (indexPath.section ==0 &&indexPath.row==3){
return 44;
}else if (indexPath.section ==0 &&indexPath.row==4){
return 44;
}
else if (indexPath.section ==0 &&indexPath.row==5){
return 61;
}else if (indexPath.section ==0 &&indexPath.row==6){
return 46;
}else if (indexPath.section ==1 &&indexPath.row==0){
//return 227;
return self.view.frame.size.width * 0.56;
}
return 0;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
if (section==0) {
return 5;
}else{
return 10 + 44;
}
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 0.1;
}
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
if (section==0) {
UIView *back=[[UIView alloc] init];
back.backgroundColor = TABLE_HEADER_COLOR;
return back;
}else{
UIView *back=[[UIView alloc] init];
back.frame = CGRectMake(0, 0,self.view.frame.size.width, 10+44);
back.backgroundColor = TABLE_HEADER_COLOR;
UIView *whiteback =[[UIView alloc] initWithFrame:CGRectMake(0, 10, self.view.frame.size.width, 43)];
whiteback.backgroundColor = [UIColor whiteColor];
[back addSubview:whiteback];
UILabel *labe = [[UILabel alloc] initWithFrame:CGRectMake(15,15, 200, 20)];
labe.text = @"店铺门面";
labe.font = [UIFont systemFontOfSize:15];
[whiteback addSubview:labe];
return back;
}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.section ==0 && indexPath.row ==4) {
//选择城市
[self xuanzeAddress];
}
}
#pragma mark- 省市区选择器
-(void)xuanzeAddress{
[ChinaPlckerView customChinaPicker:self superView:self.view];
}
#pragma mark - ChinaPlckerViewDelegate
- (void)chinaPlckerViewDelegateChinaModel:(ChinaArea *)chinaModel{
// CertifyListViewFirstCell *cell =[self.view viewWithTag:CERTYVIEW_CELLTAGROW3];
//
//
// cell.infoDetailTextfeild.text = [NSString stringWithFormat:@"%@%@%@",chinaModel.provinceModel.NAME,chinaModel.cityModel.NAME,chinaModel.areaModel.NAME];
self.privence = chinaModel.provinceModel.NAME;
self.city = chinaModel.cityModel.NAME;
self.area = chinaModel.areaModel.NAME;
[self.tableView reloadData];
}
#pragma mark -使用定位地址
-(void)userloactionAction{
IfishSHopEdite3ViewCell *lactioncell = [self.view viewWithTag:CELL6_TAG];
lactioncell.addressFiled.text = self.address;
NSIndexPath *indepath =[NSIndexPath indexPathForRow:5 inSection:0];
NSArray *arr = @[indepath];
[self.tableView reloadRowsAtIndexPaths:arr withRowAnimation:UITableViewRowAnimationNone];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - 修改门面
-(void)changeImgBtnAction{
[self picImgHandler];
}
-(void)picImgHandler{
self.photosheet=[[UIActionSheet alloc]initWithTitle:@"获取图片" delegate:self cancelButtonTitle:@"取消" destructiveButtonTitle:nil otherButtonTitles:@"拍照",@"从相册选择", nil];
[self.photosheet showInView:self.view];
}
#pragma mark--UIActionSheetDelegate IOS7
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
if (actionSheet==self.photosheet) {
if (buttonIndex==actionSheet.cancelButtonIndex) {
return;
}
//自定义
switch (buttonIndex) {
case 0:
{
CusomeCameraViewController *customVc= [[CusomeCameraViewController alloc] init]
;
customVc.tailoredImage = ^ (UIImage *image){
IfishSHopEdite5VCell *cell = [self.view viewWithTag:CELLIMG_TAG];
cell.shopImg.image = image;
};
[self.navigationController presentViewController:customVc animated:YES completion:^{
}];
}
break;
case 1:
{
UIImageWriteToSavedPhotosAlbum([[UIImage alloc] init], nil, nil, nil);
WFPhotosViewController *photosVC = [[WFPhotosViewController alloc] init];
UINavigationController *naviVC = [[UINavigationController alloc] initWithRootViewController:photosVC];
photosVC.tailoredImage = ^ (UIImage *image){
IfishSHopEdite5VCell *cell = [self.view viewWithTag:CELLIMG_TAG];
cell.shopImg.image = image;
};
[self presentViewController:naviVC animated:YES completion:nil];
}
break;
default:
break;
}
}
}
//裁剪图片,此处裁剪为125*125大的图,即为我们的缩略图
- (UIImage *)wf_thumbnailsCutfullPhoto:(UIImage*)image
{
CGSize newSize;
CGImageRef imageRef = nil;
if ((image.size.width / image.size.height) < (rectWidth / rectHeight)) {
newSize.width = image.size.width;
newSize.height = image.size.width * rectHeight / rectWidth;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(0, fabs(image.size.height - newSize.height) / 2, newSize.width, newSize.height));
} else {
newSize.height = image.size.height;
newSize.width = image.size.height * rectWidth / rectHeight;
imageRef = CGImageCreateWithImageInRect([image CGImage], CGRectMake(fabs(image.size.width - newSize.width) / 2, 0, newSize.width, newSize.height));
}
UIImage *img = [UIImage imageWithCGImage:imageRef];
CGImageRelease(imageRef);
return img;
}
#pragma mark --选取完成后调用方法
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{
//裁剪后的图片
IfishSHopEdite5VCell *cell = [self.view viewWithTag:CELLIMG_TAG];
UIImage *image = [info objectForKey:UIImagePickerControllerEditedImage];
cell.shopImg.contentMode = UIViewContentModeScaleToFill;
cell.shopImg.image = [self wf_thumbnailsCutfullPhoto:image];
[self dismissViewControllerAnimated:YES completion:nil];
}
//取消按钮的回调
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker{
[self dismissViewControllerAnimated:YES completion:^{
}];
}
- (UIImage *) scaleFromImage: (UIImage *) image toSize: (CGSize) size
{
UIGraphicsBeginImageContext(size);
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];
UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
- (UIImage *)thumbnailWithImageWithoutScale:(UIImage *)image size:(CGSize)asize
{
UIImage *newimage;
if (nil == image) {
newimage = nil;
}
else{
CGSize oldsize = image.size;
CGRect rect;
if (asize.width/asize.height > oldsize.width/oldsize.height) {
rect.size.width = asize.width*oldsize.height/oldsize.width;
// rect.size.height = asize.height*oldsize.height/oldsize.width;
rect.size.height = asize.width*oldsize.height/oldsize.width;
rect.origin.x = (asize.width - rect.size.width)/2;
rect.origin.y = 0;
}
else{
//rect.size.width = asize.width;
rect.size.width = asize.height*oldsize.width/oldsize.height;
rect.size.height = asize.height*oldsize.width/oldsize.height;
rect.origin.x = 0;
rect.origin.y = (asize.height - rect.size.height)/2;
}
UIGraphicsBeginImageContext(asize);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [[UIColor clearColor] CGColor]);
UIRectFill(CGRectMake(0, 0, asize.width, asize.height));//clear background
[image drawInRect:rect];
newimage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
return newimage;
}
#pragma mark- 提交
-(void)tiJiaoClick{
IfishShopEdite2ViewCell *weichatcell =[self.view viewWithTag:CELL2_TAG];
IfishShopEdite2ViewCell *phonecell =[self.view viewWithTag:CELL3_TAG];
IfishShopEdite2ViewCell *shopLinkcell =[self.view viewWithTag:CELL4_TAG];
IfishSHopEdite5VCell *Imgcell = [self.view viewWithTag:CELLIMG_TAG];
if (phonecell.infoFiled.text.length ==0) {
[self.view makeToast:@"请正确输入正确的手机号或电话"];
return;
}
IfishSHopEdite3ViewCell *addersscell =[self.view viewWithTag:CELL6_TAG];
if (addersscell.addressFiled.text.length>20){
[self.view makeToast:@"详细地址不能超过20个字"];
return;
}
if (addersscell.addressFiled.text.length==0){
[self.view makeToast:@"详细地址不能为空"];
return;
}
IfishSHopEdite6ViewCell *loactioncell = [self.view viewWithTag:CELL5_TAG];
if (loactioncell.locationLab.text.length == 0) {
[self.view makeToast:@"请选择省市区"];
return;
}
[self.view makeToastActivity];
if (self.privence==nil) {
self.privence = @"";
}
if (self.city==nil) {
self.city = @"";
}
if (self.area ==nil) {
//有省份无地区
self.area =@"";
}
UIImage* imgdata=Imgcell.shopImg.image;
NSString *url = IfishUpdateBaseShopsInfoV3;
NSDictionary *paras = @{
@"shopsId":self.shopInfo.shopsId,
@"shopsPhone":phonecell.infoFiled.text,
@"shopsProvince":self.privence,
@"shopsCity":self.city,
@"shopsArea":self.area,
@"shopsAddress":addersscell.addressFiled.text,
@"file4":@"png",
@"weixinCode":weichatcell.infoFiled.text,
@"shopLink":shopLinkcell.infoFiled.text
};
[AFHttpTool updateBaseShopsInfo:paras formatImg:imgdata requsetUrl:url success:^(id response) {
NSDictionary*resultDic=[NSJSONSerialization JSONObjectWithData:response options:NSJSONReadingMutableContainers error:nil];
NSLog(@"result:%@",resultDic[@"result"]);
[self.view hideToastActivity];
_isUpdate = YES;
if ([resultDic[@"result"] isEqualToString:@"100"]) {
[self.view makeToast:@"提交成功"];
NSDictionary*shopsInfoDic= resultDic[@"data"];
CertificationShopModel *shopInfo=[[CertificationShopModel alloc] init];
shopInfo.picture1 = shopsInfoDic[@"picture1"];
shopInfo.picture2 = shopsInfoDic[@"picture2"];
shopInfo.picture3 = shopsInfoDic[@"picture3"];
shopInfo.picture4 = shopsInfoDic[@"picture4"];
shopInfo.reason = shopsInfoDic[@"reason"];
shopInfo.shopsAddress = shopsInfoDic[@"shopsAddress"];
shopInfo.shopsArea = shopsInfoDic[@"shopsArea"];
shopInfo.shopsCity = shopsInfoDic[@"shopsCity"];
shopInfo.shopsId = shopsInfoDic[@"shopsId"];
shopInfo.shopsName = shopsInfoDic[@"shopsName"];
shopInfo.shopsPhone = shopsInfoDic[@"shopsPhone"];
shopInfo.shopsProvince = shopsInfoDic[@"shopsProvince"];
shopInfo.status = shopsInfoDic[@"status"];
shopInfo.userId = shopsInfoDic[@"userId"];
shopInfo.userName = shopsInfoDic[@"userName"];
shopInfo.userImg = shopsInfoDic[@"userImg"];
shopInfo.wechat = shopsInfoDic[@"weixinCode"];
shopInfo.shoplink = shopsInfoDic[@"shopLink"];
shopInfo.remark = shopsInfoDic[@"remark"];
[[DataCenter defaultDtacenter]setValue:shopInfo forKey:@"ShopsInfo"];
_getInfTimer = [NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(delayDissMiss) userInfo:nil repeats:NO];
;
}else if ([resultDic[@"result"] isEqualToString:@"101"]){
[self.view makeToast:@"提交失败错误码101"];
}
} failure:^(NSError *err) {
[self.view makeToast:@"提交失败,请检查网络"];
}];
}
-(void)delayDissMiss
{
[_getInfTimer invalidate];
_getInfTimer = nil;
[self.navigationController popViewControllerAnimated: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