| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620 |
- //
- // OrderVC.m
- // IBOSSmini
- //
- // Created by guan hong hou on 2018/1/24.
- // Copyright © 2018年 elongtian. All rights reserved.
- //
- #import "NewOrderVC.h"
- #import "DragItemInfo.h"
- #import "EditSortVC.h"
- #import "BRDatePickerView.h"
- @interface NewOrderVC (){
- UIScrollView *_scrollView;
- Boolean isExpand;
- }
- @property(strong)BRDatePickerView *brDatePicker;
- @end
- @implementation NewOrderVC
- - (void)viewDidLoad {
- [super viewDidLoad];
-
- _departmentDataList=[[NSMutableArray alloc]init];
- _salesmanDataList=[[NSMutableArray alloc]init];
- _intermediateCustomerList=[[NSMutableArray alloc]init];
- _earnestAmountList=[[NSMutableArray alloc]init];
- _feesAmountList=[[NSMutableArray alloc]init];
- [self initData];
- [self initUI];
- [self initDynamicLayout:_topDataList dynamicView:_vTop topFlag:YES];
- [self initDynamicLayout:_bottomDataList dynamicView:_vBottom topFlag:NO];
-
- if(!_editFLag){
- _installDate=[DateFormat getCurrentDate];
- _deliveryDate=[DateFormat getCurrentDate];
- _lblInstallDate.text=_installDate;
- _lblDeliveryDate.text=_deliveryDate;
- // _channelId=kkChannelId;
- // _channelName=kkChannelName;
- // _staffId=kkStaffId;
- // _staffName=kkStaffName;
- _mainDepartmentCommission=@"100";
- _mainSalesManCommission=@"100";
- // _customerAreaId=kkCustomerAreaId;
- // _customerAreaName=kkCustomerAreaName;
- // if(_organizationName!=nil){
- // _lblOrganizationName.text=_organizationName;
- // }
- // if(_customerAreaName!=nil){
- // _lblCustomerArea.text=_customerAreaName;
- // }
- // if(_channelName!=nil){
- // _lblChannel.text=kkChannelName;
- // }
- // if(_staffName!=nil){
- // _lblStaff.text=_staffName;
- // }
- }
- _vBottom.hidden=YES;
- _vBottom.frame=CGRectMake(0, CGRectGetMaxY(_separator2.frame),Screen_Width, 0);
- _vBody.frame=CGRectMake(0,0,Screen_Width, CGRectGetMaxY(_vBottom.frame));
- [self updateScrollView];
-
-
- }
- /**
- 修改:2017-9-25
- 适配机型
- 安全区视图发生变化
- */
- -(void)viewSafeAreaInsetsDidChange{
- _scrollView.frame = CGRectMake(0, 0, Screen_Width, self.view.superview.frame.size.height );
-
- [super viewSafeAreaInsetsDidChange];
- }
- -(void)loadEarnestDataSource{
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetEarnestAmountDataAndroid" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- _downManager = [[ASIDownManager alloc] init];
- [self startLoading];
- _downManager.delegate = self;
- _downManager.onRequestSuccess = @selector(onEarnestLoadFinish:);
- _downManager.onRequestFail = @selector(onEarnestLoadFail:);
- [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
- }
- -(void)loadFeeAmountDataSource{
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetFeeItemInfo" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- _downManager = [[ASIDownManager alloc] init];
- [self startLoading];
- _downManager.delegate = self;
- _downManager.onRequestSuccess = @selector(onFeesAmountLoadFinish:);
- _downManager.onRequestFail = @selector(onFeesAmountLoadFail:);
- [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
- }
- -(void) loadIntermediateCustomer{
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetDataSource" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [dict setObject:@"IntCustomerStaff"forKey:@"DataSourceCode"];
- [dict setObject:@""forKey:@"FatherCustomerID"];
- _downManager = [[ASIDownManager alloc] init];
- [self startLoading];
- _downManager.delegate = self;
- _downManager.onRequestSuccess = @selector(onIntermediateCustomerLoadFinish:);
- _downManager.onRequestFail = @selector(onIntermediateCustomerLoadFail:);
- [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
- }
- -(void)loadSalesManData{
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetStaffDataSource" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [dict setObject:@""forKey:@"StaffCode"];
- [dict setObject:@""forKey:@"StaffName"];
- _downManager = [[ASIDownManager alloc] init];
- [self startLoading];
- _downManager.delegate = self;
- _downManager.onRequestSuccess = @selector(onSalesmanLoadFinish:);
- _downManager.onRequestFail = @selector(onSalesmanLoadFail:);
- [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
- }
- -(void)loadBusinessDepartmentData{
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetOrganizationDataSource" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [dict setObject:@""forKey:@"OrganizationName"];
- [dict setObject:@""forKey:@"OrganizationCode"];
- [dict setObject:@"true"forKey:@"IsOnlyDisplayEnd"];
- _downManager = [[ASIDownManager alloc] init];
- [self startLoading];
- _downManager.delegate = self;
- _downManager.onRequestSuccess = @selector(onDepartmentLoadFinish:);
- _downManager.onRequestFail = @selector(onDepartmentLoadFail:);
- [_downManager postHttpRequest:ServerURL dic:dict path:nil fileName:nil];
- }
- /**
- 日期
- */
- - (void)showDeliveryDate:(UITapGestureRecognizer *)gesture{
- __weak typeof(self) weakself=self;
- [weakself.view endEditing:YES];
- _brDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_brDatePicker configureSelectionBlock:^(NSString *date){
- _deliveryDate=date;
- } andCompletionBlock:^(void){
- _lblDeliveryDate.text=_deliveryDate;
- } andCancelBlock:^(void){
-
- if([_lblDeliveryDate.text isEqualToString:@"请选择配送日期"]){
- self->_deliveryDate=@"";
- }
- }];
- [_brDatePicker show];
- }
- - (void)showInstallDate:(UITapGestureRecognizer *)gesture{
- __weak typeof(self) weakself=self;
- [weakself.view endEditing:YES];
- _brDatePicker = [BRDatePickerView PickerAlertWithTitle:@""];
- [_brDatePicker configureSelectionBlock:^(NSString *date){
- _installDate=date;
- } andCompletionBlock:^(void){
- _lblInstallDate.text= _installDate;
- } andCancelBlock:^(void){
-
- if([_lblDeliveryDate.text isEqualToString:@"请选择安装日期"]){
- _deliveryDate=@"";
- }
- }];
- [_brDatePicker show];
- }
- // scrollView 开始拖动
- - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
- {
- [self.homeVC.view endEditing:YES];
- }
- -(void)onEarnestLoadFinish:(ASIDownManager *)sender{
- NSDictionary *dic = [sender.mWebStr JSONValue];
- [self cancel];
- // 服务器返回数据是否正确
- if (dic && [dic isKindOfClass:[NSDictionary class]]) {
- // 服务器返回数据状态值
- int iStatus = [[dic objectForKey:@"Status"] intValue];
- // 服务器返回数据消息
- NSString *message=[dic objectForKey:@"Message"];
- // 服务器返回数据状态值正确
- if (iStatus == 0) {
- NSArray * infoArr=[dic objectForKey:@"Result"];
- if(infoArr!=nil&& infoArr.count>0)
- {
- for (int i = 0; i < infoArr.count; i++) {
- NSDictionary *dic=infoArr[i];
- EarnestModel *earnestModel=[EarnestModel new];
- [earnestModel parseDic:dic ];
- [_earnestAmountList addObject:earnestModel];
- }
- }
- }
-
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
- [self showReLoginDialog:message];
- }
- else{
-
- [self showAlertViewText:message];
- }
- [self loadFeeAmountDataSource];
- }
- }
- -(void)onEarnestLoadFail:(ASIDownManager *)sender{
- [self cancel];
- [self showAlertViewText:@"加载失败"];
- }
- -(void)onFeesAmountLoadFinish:(ASIDownManager *)sender{
- NSDictionary *dic = [sender.mWebStr JSONValue];
- [self cancel];
- // 服务器返回数据是否正确
- if (dic && [dic isKindOfClass:[NSDictionary class]]) {
- // 服务器返回数据状态值
- int iStatus = [[dic objectForKey:@"Status"] intValue];
- // 服务器返回数据消息
- NSString *message=[dic objectForKey:@"Message"];
- // 服务器返回数据状态值正确
- if (iStatus == 0) {
- NSArray * infoArr=[dic objectForKey:@"Result"];
- if(infoArr!=nil&& infoArr.count>0)
- {
- for (int i = 0; i < infoArr.count; i++) {
- NSDictionary *dic=infoArr[i];
- FeeAmountModel *feeModel=[FeeAmountModel new];
- int feeItemIdValue= [[dic objectForKey:@"FeeItemID"]intValue];
- NSString *feeItemId= [NSString stringWithFormat:@"%d",feeItemIdValue] ;
-
- NSString *feeItemName=[dic objectForKey:@"FeeItemName"];
- [feeModel setFeeItemId:feeItemId];
- [feeModel setFeeItemName:feeItemName];
- [feeModel setFeeItemSum:@"0"];
- [_feesAmountList addObject:feeModel];
- }
- }
- }
-
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
- [self showReLoginDialog:message];
- }
- else{
-
- [self showAlertViewText:message];
- }
-
-
- }
-
-
- }
- -(void)onFeesAmountLoadFail:(ASIDownManager *)sender{
- [self cancel];
- [self showAlertViewText:@"加载失败"];
- }
- -(void)onIntermediateCustomerLoadFinish:(ASIDownManager *)sender{
- NSDictionary *dic = [sender.mWebStr JSONValue];
- [self cancel];
- // 服务器返回数据是否正确
- if (dic && [dic isKindOfClass:[NSDictionary class]]) {
- // 服务器返回数据状态值
- int iStatus = [[dic objectForKey:@"Status"] intValue];
- // 服务器返回数据消息
- NSString *message=[dic objectForKey:@"Message"];
- // 服务器返回数据状态值正确
- if (iStatus == 0) {
- NSArray * infoArr=[dic objectForKey:@"Result"];
- if(infoArr!=nil&& infoArr.count>0)
- {
- for (int i = 0; i < infoArr.count; i++) {
- NSDictionary * dic=infoArr[i];
- IntermediateCustomerModel *model=[IntermediateCustomerModel new];
- [model parseDic:dic];
- IntermediateCustomerFrame *intermediateCustomerFrame=[IntermediateCustomerFrame new];
- [intermediateCustomerFrame setIntermediateCustomerFrame:model];
- [_intermediateCustomerList addObject:intermediateCustomerFrame];
- }
-
- if(_editFLag){
- for (IntermediateCustomerFrame *intermediateCustomerFrame in _intermediateCustomerList){
- IntermediateCustomerModel *intermediateCustomerModel= intermediateCustomerFrame.intermediateCustomerModel;
- if(_originalIntermediateCustomerList!=nil&&_originalIntermediateCustomerList.count>0){
- for(IntermediateCustomerFrame *originalIntermediateCustomerFrame in _originalIntermediateCustomerList){
- IntermediateCustomerModel *originalCustomerModel=originalIntermediateCustomerFrame.intermediateCustomerModel;
- if(intermediateCustomerModel.intermediateCustomerStaffId==originalCustomerModel.intermediateCustomerStaffId){
- intermediateCustomerModel.commission=originalCustomerModel.commission;
- intermediateCustomerModel.isCheckedStatus=YES;
-
- }
- }
- }
- }
- }
- }
-
- }
- // 服务器返回数据状态值异常
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
-
- [self showReLoginDialog:message];
- }
- else{
-
- [self showAlertViewText:message];
- }
- [self loadEarnestDataSource];
- }
- }
- /**
- 加载总数数据失败回调
-
- @param sender <#sender description#>
- */
- - (void)onIntermediateCustomerLoadFail:(ASIDownManager *)sender {
- [self cancel];
- [self showAlertViewText:@"加载失败"];
- }
- - (void)onDepartmentLoadFinish:(ASIDownManager *)sender {
- NSDictionary *dic = [sender.mWebStr JSONValue];
- [self cancel];
- // 服务器返回数据是否正确
- if (dic && [dic isKindOfClass:[NSDictionary class]]) {
- // 服务器返回数据状态值
- int iStatus = [[dic objectForKey:@"Status"] intValue];
-
- // 服务器返回数据消息
- NSString *message=[dic objectForKey:@"Message"];
- // 服务器返回数据状态值正确
- if (iStatus == 0) {
- NSArray * infoArr=[dic objectForKey:@"Result"];
- // 返回结果
- if(infoArr!=nil&& infoArr.count>0)
- {
- for (int i = 0; i < infoArr.count; i++) {
- NSDictionary * dic=infoArr[i];
- BusinessDepartmentModel *departmentModel=[[BusinessDepartmentModel alloc]init];
- [departmentModel parseDic:dic];
- DepartmentFrame *frame=[DepartmentFrame new];
- [frame setBusinessDepartmentFrame:departmentModel];
- [_departmentDataList addObject:frame];
- }
- if(_editFLag){
- for(DepartmentFrame *frame in _departmentDataList){
- BusinessDepartmentModel *departmentModel=frame.departmentModel;
- if(_originalMainDepartmentModel!=nil){
- if(departmentModel.organizationId==_originalMainDepartmentModel.organizationId){
- departmentModel.commission=_originalMainDepartmentModel.commission;
- departmentModel.isMainDepartmentStatus=YES;
- departmentModel.isCheckedStatus=YES;
- }
- }
-
- if(_originalSecondaryDepartmentList!=nil&&_originalSecondaryDepartmentList.count>0){
- for(DepartmentFrame *originalFrame in _originalSecondaryDepartmentList ){
- BusinessDepartmentModel *originalDepartmentModel= originalFrame.departmentModel;
- if(departmentModel.organizationId==originalDepartmentModel.organizationId){
- departmentModel.commission=originalDepartmentModel.commission;
- departmentModel.isMainDepartmentStatus=NO;
- departmentModel.isCheckedStatus=YES;
- }
- }
- }
- }
- }
- else{
- if(_organizationId!=nil&&_organizationCode!=nil&&_organizationName!=nil){
- _mainDepartmentModel=[BusinessDepartmentModel new];
- _mainDepartmentModel.organizationId=[_organizationId integerValue] ;
- _mainDepartmentModel.organizationCode=_organizationCode;
- _mainDepartmentModel.organizationName=_organizationName;
- _mainDepartmentModel.commission=@"100";
- _mainDepartmentModel.isCheckedStatus=YES;
- _mainDepartmentModel.isMainDepartmentStatus=YES;
-
- for(DepartmentFrame *frame in _departmentDataList){
- BusinessDepartmentModel *departmentModel=frame.departmentModel;
- if(_mainDepartmentModel.organizationId==departmentModel.organizationId){
- departmentModel.commission=@"100";
- departmentModel.isCheckedStatus=YES;
- departmentModel.isMainDepartmentStatus=YES;
- }
- }
- }
- }
-
- }
-
- }
- // 服务器返回数据状态值异常
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
-
- [self showReLoginDialog:message];
- }
- else{
-
- [self showAlertViewText:message];
- }
- [self loadSalesManData];
-
- }
- }
- /**
- 加载总数数据失败回调
-
- @param sender <#sender description#>
- */
- - (void)onDepartmentLoadFail:(ASIDownManager *)sender
- {
- [self cancel];
- [self showAlertViewText:@"加载失败"];
- }
- - (void)onSalesmanLoadFinish:(ASIDownManager *)sender
- {
- NSDictionary *dic = [sender.mWebStr JSONValue];
- [self cancel];
- // 服务器返回数据是否正确
- if (dic && [dic isKindOfClass:[NSDictionary class]]) {
- // 服务器返回数据状态值
- int iStatus = [[dic objectForKey:@"Status"] intValue];
-
- // 服务器返回数据消息
- NSString *message=[dic objectForKey:@"Message"];
- // 服务器返回数据状态值正确
- if (iStatus == 0)
-
- {
- NSArray * infoArr=[dic objectForKey:@"Result"];
- // 返回结果
- if(infoArr!=nil&& infoArr.count>0)
- {
- for (int i = 0; i < infoArr.count; i++) {
- NSDictionary * dic=infoArr[i];
- SalesManModel *salesmanModel=[[SalesManModel alloc]init];
- [salesmanModel parseDic:dic];
- SalesManFrame *frame=[SalesManFrame new];
- [frame setSalesManFrame:salesmanModel];
- [_salesmanDataList addObject:frame];
- }
-
- if(_editFLag)
- {
- for(SalesManFrame *salesmanFrame in _salesmanDataList){
- SalesManModel *salesmanModel=salesmanFrame.salesmanModel;
- if(_originalMainSalesMan!=nil){
- if(salesmanModel.staffId==_originalMainSalesMan.staffId){
- salesmanModel.commission=_originalMainSalesMan.commission;
- salesmanModel.isMainSalesManStatus=YES;
- salesmanModel.isCheckedStatus=YES;
- }
- }
- if(_originalSecondaryStaffList!=nil&&_originalSecondaryStaffList.count>0){
- for(SalesManFrame *originalSalesmanFrame in _originalSecondaryStaffList){
- SalesManModel *originalSalesmanModel= originalSalesmanFrame.salesmanModel;
- if(salesmanModel.staffId==originalSalesmanModel.staffId){
- salesmanModel.commission=@"100";
- salesmanModel.isMainSalesManStatus=YES;
- salesmanModel.isCheckedStatus=YES;
- }
- }
- }
- }
- }
- else{
- if(_staffId!=nil&&_staffName!=nil){
- _mainSalesMan=[SalesManModel new];
- _mainSalesMan.staffId=[_staffId integerValue];
- _mainSalesMan.staffName=_staffName;
- for(SalesManFrame *salesmanFrame in _salesmanDataList ){
- SalesManModel *salesmanModel= salesmanFrame.salesmanModel;
- if(_mainSalesMan.staffId==salesmanModel.staffId){
- salesmanModel.commission=@"100";
- salesmanModel.isMainSalesManStatus=YES;
- salesmanModel.isCheckedStatus=YES;
- }
- }
- }
-
- }
- }
- }
- // 服务器返回数据状态值异常
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
-
- [self showReLoginDialog:message];
- }
- else{
-
- [self showAlertViewText:message];
- }
- [self loadIntermediateCustomer];
- }
- }
- /**
- 加载总数数据失败回调
-
- @param sender <#sender description#>
- */
- - (void)onSalesmanLoadFail:(ASIDownManager *)sender {
- [self cancel];
- [self showAlertViewText:@"加载失败"];
- }
- -(void)allListeners{
-
- UITapGestureRecognizer *tapRecognizerPerformanceAccountingCategory=[[UITapGestureRecognizer alloc] initWithTarget:self
- action:@selector(goPerformanceAccountingCategory)];
- [_lblPerformanceAccountingCategory addGestureRecognizer:tapRecognizerPerformanceAccountingCategory];
-
-
-
- UITapGestureRecognizer *tapRecognizerIntermediateCustomer=[[UITapGestureRecognizer alloc] initWithTarget:self
- action:@selector(goIntermediateCustomer:)];
- [_lblIntermediateCustomer addGestureRecognizer:tapRecognizerIntermediateCustomer];
-
- UITapGestureRecognizer *tapRecognizerPayment=[[UITapGestureRecognizer alloc] initWithTarget:self
- action:@selector(goPayment:)];
- [_lblPayment addGestureRecognizer:tapRecognizerPayment];
-
- UITapGestureRecognizer *tapRecognizerDecorationProgress=[[UITapGestureRecognizer alloc] initWithTarget:self
- action:@selector(goDecorationProgress:)];
- [_lblDecorationProgress addGestureRecognizer:tapRecognizerDecorationProgress];
-
- UITapGestureRecognizer *tapRecognizerFloors=[[UITapGestureRecognizer alloc] initWithTarget:self
- action:@selector(goFloors:)];
- [_lblFloor addGestureRecognizer:tapRecognizerFloors];
-
- UITapGestureRecognizer *tapRecognizerDeliveryDate=[[UITapGestureRecognizer alloc] initWithTarget:self
- action:@selector(showDeliveryDate:)];
- [_lblDeliveryDate addGestureRecognizer:tapRecognizerDeliveryDate];
-
- UITapGestureRecognizer *tapRecognizerInstallDate=[[UITapGestureRecognizer alloc] initWithTarget:self
- action:@selector(showInstallDate:)];
- [_lblInstallDate addGestureRecognizer:tapRecognizerInstallDate];
-
- UITapGestureRecognizer *tapRecognizerFeesAmount=[[UITapGestureRecognizer alloc] initWithTarget:self
- action:@selector(showFeesAmount:)];
- [_lblFeesAmount addGestureRecognizer:tapRecognizerFeesAmount];
- }
- -(void)initData{
- NSData *encodeTopObject = [[NSUserDefaults standardUserDefaults] objectForKey:@"topList"];
- _topDataList = [NSKeyedUnarchiver unarchiveObjectWithData:encodeTopObject];
-
- NSData *encodeBottomObject = [[NSUserDefaults standardUserDefaults] objectForKey:@"bottomList"];
- _bottomDataList = [NSKeyedUnarchiver unarchiveObjectWithData:encodeBottomObject];
- if((_topDataList==nil||_topDataList.count==0)&&(_bottomDataList==nil||_bottomDataList.count==0)){
- _topDataList=[[NSMutableArray alloc]init];
- _bottomDataList=[[NSMutableArray alloc]init];
-
- DragItemInfo *topInfo;
- topInfo =[DragItemInfo new];
- [topInfo setComponentId:1000];
- [topInfo setComponentName:@"客户地址"];
- [_topDataList addObject:topInfo];
- topInfo =[DragItemInfo new];
- [topInfo setComponentId:1001];
- [topInfo setComponentName:@"备 注"];
- [_topDataList addObject:topInfo];
-
-
- DragItemInfo *bottomItemInfo;
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1002;
- bottomItemInfo.componentName = @"业绩核算类别";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1003;
- bottomItemInfo.componentName = @"定金金额";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1004;
- bottomItemInfo.componentName = @"中间客户";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1005;
- bottomItemInfo.componentName = @"货物总额";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1006;
- bottomItemInfo.componentName = @"合计总额";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1007;
- bottomItemInfo.componentName = @"合同号";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1008;
- bottomItemInfo.componentName = @"联系人";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1009;
- bottomItemInfo.componentName = @"联系方式";
- [_bottomDataList addObject:bottomItemInfo];
-
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1010;
- bottomItemInfo.componentName = @"整单折扣";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1011;
- bottomItemInfo.componentName = @"转销售金额";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1012;
- bottomItemInfo.componentName = @"安装日期";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1013;
- bottomItemInfo.componentName = @"配送日期";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1014;
- bottomItemInfo.componentName = @"楼层";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1015;
- bottomItemInfo.componentName = @"装修进度";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1016;
- bottomItemInfo.componentName = @"重量";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1017;
- bottomItemInfo.componentName = @"总体积";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1018;
- bottomItemInfo.componentName = @"定金比率";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1019;
- bottomItemInfo.componentName = @"标价总额";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1020;
- bottomItemInfo.componentName = @"订单单号";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1021;
- bottomItemInfo.componentName = @"费用金额";
- [_bottomDataList addObject:bottomItemInfo];
-
- bottomItemInfo = [DragItemInfo new];
- bottomItemInfo.componentId = 1022;
- bottomItemInfo.componentName = @"总平米";
- [_bottomDataList addObject:bottomItemInfo];
-
- }
- }
- -(void)setTextEnabled:(Boolean)enabled{
- _vChannel.userInteractionEnabled=enabled;
- _vCustomerType.userInteractionEnabled=enabled;
- _txtCustomerName.enabled=enabled;
- }
- /**
- 隐藏键盘
- */
- - (void)hideKey{
- [self.view endEditing:YES];
- }
- - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate{
- //CGFloat contentOffset = scrollView.contentOffset.y;
- if(!isExpand){
- _vBottom.hidden=NO;
- isExpand=YES;
- [self performSelector:@selector(delayMethod) withObject:nil afterDelay:0.1];
-
- }
-
- }
- -(void)delayMethod{
- [self initDynamicLayout:_bottomDataList dynamicView:_vBottom topFlag:NO];
- }
- -(void)initUI{
- [self.view setBackgroundColor:[UIColor whiteColor]];
- _scrollView=[UIScrollView new];
- _scrollView.frame=CGRectMake(0, 0, CGRectGetWidth(self.view.frame), SCREENHEIGHT-rectNavHeight-rectStatusHeight-80-55);
-
- [self.view addSubview:_scrollView];
- _vBody=[UIView new];
- _vBody.frame=CGRectZero;
- [_scrollView addSubview:_vBody];
- _scrollView.delegate=self;
- UITapGestureRecognizer* gesture=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(hideKey)];
-
- [self.view addGestureRecognizer:gesture];
- UIView *topSeparatorView = [UIView new];
- topSeparatorView.frame=CGRectMake(0,3, Screen_Width, 10);
- topSeparatorView.backgroundColor = LineBackgroundColor;
- [_vBody addSubview:topSeparatorView];
- if(_vCustomerCode==nil){
- _vCustomerCode = [UIView new];
- }
- _vCustomerCode.frame=CGRectMake(0,CGRectGetMaxY(topSeparatorView.frame),Screen_Width, 51);
- [_vBody addSubview:_vCustomerCode];
- UILabel *lblCustomerCode = [UILabel new];
- lblCustomerCode.frame=CGRectMake(15,16, 100, 25);
- lblCustomerCode.text = @"客户编码";
- lblCustomerCode.textColor=[UIColor redColor];
- lblCustomerCode.font= [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [_vCustomerCode addSubview:lblCustomerCode];
- _txtCustomerCode = [UITextField new];
- _txtCustomerCode.frame=CGRectMake(CGRectGetMaxX(lblCustomerCode.frame)+10,16, 150, 25);
- _txtCustomerCode.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
- _txtCustomerCode.placeholder = @"请输入客户编码";
- _txtCustomerCode.delegate=self;
- [_txtCustomerCode addTarget:self action:@selector(searchOnlyByCustomerCode) forControlEvents:UIControlEventEditingDidEnd];
- _txtCustomerCode.tag=1301;
- [_vCustomerCode addSubview:_txtCustomerCode];
- _btnCustomerCode = [UIButton buttonWithType:UIButtonTypeCustom];
- _btnCustomerCode.frame=CGRectMake(Screen_Width-50,10,32,30);
- UIImageView *customerCodeImg = [[UIImageView alloc]initWithFrame:CGRectMake(25,9,7, 12)];
- [customerCodeImg setImage:[UIImage imageNamed:@"rightarrow"]];
- customerCodeImg.userInteractionEnabled=NO;
- [ _btnCustomerCode addSubview:customerCodeImg];
- [_btnCustomerCode addTarget:self action:@selector(searchCustomerCode) forControlEvents:UIControlEventTouchUpInside];
-
- [_vCustomerCode addSubview:_btnCustomerCode];
- [_btnCustomerCode addTarget:self action:@selector(loadMoreInfo) forControlEvents:UIControlEventTouchUpInside];
- UIView *separator = [UIView new];
- separator.backgroundColor=LineBackgroundColor;
- separator.frame=CGRectMake(CGRectGetMaxX(lblCustomerCode.frame)+10,CGRectGetMaxY(_txtCustomerCode.frame)+10,Screen_Width-CGRectGetMaxX(lblCustomerCode.frame)+10, 1);
- [_vCustomerCode addSubview:separator];
-
- if(_vCustomerName==nil){
- _vCustomerName = [UIView new];
- }
- _vCustomerName.frame=CGRectMake(0,CGRectGetMaxY(_vCustomerCode.frame),Screen_Width, 51);
- [_vBody addSubview:_vCustomerName];
- _txtCustomerName= [self getTextField:_vCustomerName labelText:@"客户名称" hintText:@"请输入客户名称" labelColor:[UIColor redColor] tag:901];
- _txtCustomerName.delegate=self;
-
- if(_vTelephone==nil){
- _vTelephone = [UIView new];
- }
- _vTelephone.frame=CGRectMake(0,CGRectGetMaxY(_vCustomerName.frame),Screen_Width, 51);
- [_vBody addSubview:_vTelephone];
- _txtTelephone= [self getTextField:_vTelephone labelText:@"联系电话" hintText:@"请输入联系电话" labelColor:[UIColor redColor] tag:902];
- _txtTelephone.delegate=self;
-
- if(_vDepartment==nil){
- _vDepartment = [UIView new];
- }
- _vDepartment.frame=CGRectMake(0,CGRectGetMaxY(_vTelephone.frame),Screen_Width, 51);
- [_vBody addSubview:_vDepartment];
-
- if(_lblOrganizationName==nil){
- _lblOrganizationName= [self getUILabel:_vDepartment labelText:@"业务部门" hintText:@"请选择业务部门" labelColor:[UIColor redColor] isHaveRightArrow:YES tag:903];
-
- }
- UITapGestureRecognizer *tapGesture=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(goDepartment:)];
- [_lblOrganizationName addGestureRecognizer:tapGesture];
- [tapGesture setNumberOfTapsRequired:1];
- // if(!_editFLag){
- // _lblOrganizationName.text=_organizationName;
- // }
- if(_vStaff==nil){
- _vStaff = [UIView new];
- }
- _vStaff.frame=CGRectMake(0,CGRectGetMaxY(_vDepartment.frame),Screen_Width, 51);
- [_vBody addSubview:_vStaff];
- if(_lblStaff==nil){
- _lblStaff = [self getUILabel:_vStaff labelText:@"业 务 员" hintText:@"请选择业务员" labelColor:[UIColor redColor] isHaveRightArrow:YES tag:904];
- }
- UITapGestureRecognizer *tapRecognizerStaff=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goStaff:)];
- _lblStaff.userInteractionEnabled=YES;
- [_lblStaff addGestureRecognizer:tapRecognizerStaff];
-
- _vChannel = [UIView new];
- _vChannel.frame=CGRectMake(0,CGRectGetMaxY(_vStaff.frame),Screen_Width, 51);
- [_vBody addSubview:_vChannel];
-
-
- if(_lblChannel==nil){
- _lblChannel=[self getUILabel:_vChannel labelText:@"渠 道" hintText:@"请选择渠道" labelColor:[UIColor redColor] isHaveRightArrow:YES tag:905];
- }
-
- UITapGestureRecognizer *tapRecognizerChannel=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goChannel:)];
- [_lblChannel addGestureRecognizer:tapRecognizerChannel];
-
- _vCustomerArea = [UIView new];
- _vCustomerArea.frame=CGRectMake(0,CGRectGetMaxY(_vChannel.frame),Screen_Width, 51);
- [_vBody addSubview:_vCustomerArea];
-
-
- if(_lblCustomerArea==nil){
- _lblCustomerArea= [self getUILabel:_vCustomerArea labelText:@"客户区域" hintText:@"请选择客户区域" labelColor:[UIColor redColor] isHaveRightArrow:YES tag:906];
- }
-
- UITapGestureRecognizer *tapRecognizerCustomerArea=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goCustomerArea:)];
- _lblCustomerArea.userInteractionEnabled=YES;
- [_lblCustomerArea addGestureRecognizer:tapRecognizerCustomerArea];
-
-
- _vCustomerType = [UIView new];
- _vCustomerType.frame=CGRectMake(0,CGRectGetMaxY(_vCustomerArea.frame),Screen_Width, 51);
- [_vBody addSubview:_vCustomerType];
-
-
- if(_lblCustomerType==nil){
- _lblCustomerType= [self getUILabel:_vCustomerType labelText:@"客户性质" hintText:@"请选择客户性质" labelColor:[UIColor redColor] isHaveRightArrow:YES tag:907];
- }
-
- UITapGestureRecognizer *tapRecognizerCustomerType=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goCustomerType:)];
- _lblCustomerType.userInteractionEnabled=YES;
- [_lblCustomerType addGestureRecognizer:tapRecognizerCustomerType];
-
- _vTop=[UIView new];
- _vTop.frame=CGRectMake(0,CGRectGetMaxY(_vCustomerType.frame),Screen_Width,0);
- [_vBody addSubview:_vTop];
-
-
- _vTop.frame=CGRectMake(0, CGRectGetMaxY(_vCustomerType.frame), Screen_Width, CGRectGetMaxY(_vCustomerType.frame));
- _separator1 = [UIView new];
- _separator1.backgroundColor=LineBackgroundColor;
- _separator1.frame=CGRectMake(0,CGRectGetMaxY(_vTop.frame)+10,Screen_Width, 10);
- [_vBody addSubview:_separator1];
- _vOperation = [UIView new];
- _vOperation.frame=CGRectMake(0,CGRectGetMaxY(_separator1.frame),Screen_Width, 51);
- [_vBody addSubview:_vOperation];
- _vOperation.userInteractionEnabled=YES;
- UIButton *moreInfoBtn=[UIButton buttonWithType:UIButtonTypeCustom];
- moreInfoBtn.frame=CGRectMake(Screen_Width-80, 16, 70, 25);
- [moreInfoBtn setTitle:@"更多信息" forState:UIControlStateNormal];
- [moreInfoBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
- moreInfoBtn.titleLabel.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
-
- [_vOperation addSubview:moreInfoBtn];
-
- [moreInfoBtn addTarget:self action:@selector(loadMoreInfo) forControlEvents:UIControlEventTouchUpInside];
-
- UIButton *editSortBtn=[UIButton buttonWithType:UIButtonTypeCustom];
- editSortBtn.frame=CGRectMake(Screen_Width-160, 16, 70, 25);
- [editSortBtn setTitle:@"编辑排序" forState:UIControlStateNormal];
- [editSortBtn addTarget:self action:@selector(editSort) forControlEvents:UIControlEventTouchUpInside];
- [editSortBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
- editSortBtn.titleLabel.font = [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [_vOperation addSubview:editSortBtn];
- _separator2 = [UIView new];
- _separator2.backgroundColor=LineBackgroundColor;
- _separator2.frame=CGRectMake(0,CGRectGetMaxY(_vOperation.frame),Screen_Width, 10);
- [_vBody addSubview:_separator2];
- _vBottom=[UIView new];
- _vBottom.frame=CGRectMake(0, CGRectGetMaxY(_separator2.frame),Screen_Width, 0);
- [_vBody addSubview:_vBottom];
-
- _vBody.frame=CGRectMake(0,0,Screen_Width, CGRectGetMaxY(_vBottom.frame));
-
- [self updateScrollView];
-
- }
- - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
- {
- NSInteger existedLength = textField.text.length;
- NSInteger selectedLength = range.length;
- NSInteger replaceLength = string.length;
- if (textField == self.txtCustomerCode) {
- if (string.length == 0){
- return YES;
- }
-
- if (existedLength - selectedLength + replaceLength > 100) {
- return NO;
- }
- }
-
- if(textField==self.txtCustomerName){
- if (string.length == 0){
- return YES;
- }
-
- if (existedLength - selectedLength + replaceLength > 50) {
- return NO;
- }
- }
-
- if(textField==self.txtTelephone){
- if (string.length == 0){
- return YES;
- }
-
- if (existedLength - selectedLength + replaceLength >12) {
- return NO;
- }
- }
-
- if(textField==self.txtContactPerson){
- if (string.length == 0){
- return YES;
- }
-
- if (existedLength - selectedLength + replaceLength >50) {
- return NO;
- }
- }
-
- if(textField==self.txtContactWay){
- if (string.length == 0){
- return YES;
- }
-
- if (existedLength - selectedLength + replaceLength >100) {
- return NO;
- }
- }
-
- if(textField==self.txtContractNo){
- if (string.length == 0){
- return YES;
- }
-
- if (existedLength - selectedLength + replaceLength >50) {
- return NO;
- }
- }
-
- if(textField==self.txtCustomerAddress){
- if (string.length == 0){
- return YES;
- }
-
- if (existedLength - selectedLength + replaceLength >500) {
- return NO;
- }
- }
-
- if(textField==self.txtContractNo){
- if (string.length == 0){
- return YES;
- }
-
- if (existedLength - selectedLength + replaceLength >50) {
- return NO;
- }
- }
-
- if(textField==self.txtRemarks){
- if (string.length == 0){
- return YES;
- }
-
- if (existedLength - selectedLength + replaceLength >200) {
- return NO;
- }
- }
-
-
- return YES;
- }
- -(void)goDecorationProgress:(UITapGestureRecognizer *)gesture{
- self.hidesBottomBarWhenPushed=YES;
- CustomerReportTextVC *tc=[[CustomerReportTextVC alloc] init];
- tc.delegate = self;
- tc.dataSourceCode=@"DecorationProcess";
- tc.showDialogViewTag=ReportCumstomerDecorationProgress;
- [self.orderNav pushViewController:tc animated:YES];
-
- }
- - (void)goDepartment:(UITapGestureRecognizer *)gesture {
- self.hidesBottomBarWhenPushed = YES;
- SalesOrderBusinessDepartmentVC *departmentVC=[[ SalesOrderBusinessDepartmentVC alloc] init];
- _businessDepartmentTempList=[[NSMutableArray alloc] initWithArray:_departmentDataList copyItems:YES];
-
- departmentVC.departmentDelegate=self;
- if(_departmentDataList!=nil&&_departmentDataList.count>0){
- departmentVC.departmentList=_departmentDataList;
- }
- [self.orderNav pushViewController:departmentVC animated:YES];
- }
- -(void)goChannel:(UITapGestureRecognizer *)gesture{
- self.hidesBottomBarWhenPushed = YES;
- CustomerReportTextVC *tc=[[CustomerReportTextVC alloc] init];
- tc.delegate=self;
- tc.dataSourceCode=@"T_MST_Channel";
- tc.showDialogViewTag=ReportCumstomerChannel;
- [self.orderNav pushViewController:tc animated:YES];
- }
- -(void)goStaff:(UITapGestureRecognizer *)gesture{
- if(_salesmanDataList!=nil&&_salesmanDataList.count>0){
- self.hidesBottomBarWhenPushed = YES;
-
- _salesmanTempList=[[NSMutableArray alloc] initWithArray:_salesmanDataList copyItems:YES];
- SalesManVC *salesmanVc=[[SalesManVC alloc]init];
- salesmanVc.salesmanDelegate=self;
- salesmanVc.editFlag=_editFLag;
- salesmanVc.originalSecondarySalesmanList=_originalSecondaryStaffList;
- salesmanVc.originalMainSalesManModel=_originalMainSalesMan;
- salesmanVc.salesmanList=_salesmanDataList;
- [self.orderNav pushViewController:salesmanVc animated:YES];
- }
- }
- -(void)goCustomerArea:(UITapGestureRecognizer *)gesture{
- self.hidesBottomBarWhenPushed = YES;
- CustomerReportTextVC *tc=[[CustomerReportTextVC alloc] init];
- tc.delegate=self;
- tc.dataSourceCode=@"T_MST_District";
- tc.showDialogViewTag=ReportCustomerAero;
- [self.orderNav pushViewController:tc animated:YES];
-
- }
- -(void)goFloors:(UITapGestureRecognizer *)gesture{
- self.hidesBottomBarWhenPushed = YES;
- CustomerReportTextVC *tc=[[CustomerReportTextVC alloc] init];
- tc.delegate=self;
- tc.showDialogViewTag=ReportFloors;
- [self.orderNav pushViewController:tc animated:YES];
- }
- -(void)goIntermediateCustomer:(UITapGestureRecognizer *)gesture{
- self.hidesBottomBarWhenPushed = YES;
- IntermediateCustomerVC *customerVc=[[IntermediateCustomerVC alloc]init];
- _intermediateCustomerTempList= [[NSMutableArray alloc] initWithArray:_intermediateCustomerList copyItems:YES];
-
- customerVc.intermediateCustomerDelegate=self;
- customerVc.intermediateCustomerList=_intermediateCustomerList;
- [self.orderNav pushViewController:customerVc animated:YES];
- }
- -(void)recoveryData{
- if(_businessDepartmentTempList!=nil&&_businessDepartmentTempList.count>0){
- _departmentDataList=[[NSMutableArray alloc] initWithArray:_businessDepartmentTempList copyItems:YES];
- }
-
- if(_salesmanTempList!=nil&&_salesmanTempList.count>0){
- _salesmanDataList=[[NSMutableArray alloc] initWithArray:_salesmanTempList copyItems:YES];
- }
- if(_intermediateCustomerTempList!=nil&&_intermediateCustomerTempList.count>0){
- _intermediateCustomerList= [[NSMutableArray alloc] initWithArray:_intermediateCustomerTempList copyItems:YES];;
- }
- }
- /**
- 客户性质
- */
- - (void)goCustomerType:(UITapGestureRecognizer *)gesture{
- self.hidesBottomBarWhenPushed = YES;
- CustomerReportTextVC *tc=[[CustomerReportTextVC alloc] init];
- tc.delegate=self;
- tc.dataSourceCode=@"CustomerType";
- tc.showDialogViewTag=ReportOrderCumstomerType;
- [self.orderNav pushViewController:tc animated:YES];
- }
- -(void)goPerformanceAccountingCategory
- {
- self.hidesBottomBarWhenPushed = YES;
- CustomerReportTextVC *tc=[[CustomerReportTextVC alloc] init];
- tc.delegate=self;
- tc.showDialogViewTag=ReportPerformanceAccountingCategory;
- [self.orderNav pushViewController:tc animated:YES];
- }
- -(void)goPayment:(UITapGestureRecognizer *)gesture{
- self.hidesBottomBarWhenPushed = YES;
- EarnestAmountVC *earnestVc=[[EarnestAmountVC alloc]init];
- earnestVc.paymentDelegate=self;
- earnestVc.earnestList=_earnestAmountList;
- [self.orderNav pushViewController:earnestVc animated:YES];
-
- }
- -(void)showFeesAmount:(UITapGestureRecognizer *)gesture{
- self.hidesBottomBarWhenPushed = YES;
- FeeAmountVC *feeVc=[[FeeAmountVC alloc]init];
- feeVc.feeAmountDelegate=self;
- feeVc.feeList=_feesAmountList;
- [self.orderNav pushViewController:feeVc animated:YES];
-
- }
- /**
- 渠道,区域,客户性质,级别等返回回调
-
- @param model <#model description#>
- @param cr <#cr description#>
- */
- - (void)customerReportTextDoneDatas:(CustomerReportTextInfoModel *)model CustomerReport:(CustomerReport)cr
- {
- if (model==nil) {
- return;
- }
- //渠道返回值
- if(cr==ReportCumstomerChannel){
- _channelId=model.idCode;
- _channelName=model.name;
- _lblChannel.text=self.channelName;
- }
- //客户性质返回值
- if(cr==ReportOrderCumstomerType){
- _customerTypeId=model.idCode;
- _customerTypeName=model.name;
- _lblCustomerType.text=@"";
- _lblCustomerType.text=_customerTypeName;
- }
- //客户区域返回值
- if(cr==ReportCustomerAero){
- _customerAreaId=model.idCode;
- _customerAreaName=model.name;
- _lblCustomerArea.text=_customerAreaName;
- }
-
- if(cr==ReportCumstomerDecorationProgress){
- _decorationProgressId=model.idCode;
- _decorationProgressName=model.name;
- _lblDecorationProgress.text=_decorationProgressName;
- }
- if(cr==ReportFloors){
- _floorsId=model.idCode;
- _floorsName=model.name;
- _lblFloor.text=_floorsName;
- }
- if(cr==ReportPerformanceAccountingCategory)
- {
- _performanceAccountingId=model.idCode;
- _performanceAccountingName=model.name;
- _lblPerformanceAccountingCategory.text=_performanceAccountingName;
- }
-
- if(cr==ReportFloors)
- {
- _floorsId=model.idCode;
- _floorsName=model.name;
- _lblFloor.text=_floorsName;
-
- }
- }
- -(void)showDepartmentInfo:(NSMutableArray*)departmentList
- {
- _departmentCheckedList=departmentList;
- _mainDepartmentModel=[self getMainBusinessDepartment:_departmentCheckedList];
- _secondaryDepartmentList=[self getSecondaryDepartmentList:_departmentCheckedList];
- if(_editFLag){
- if(_mainDepartmentModel.organizationId==_originalMainDepartmentModel.organizationId){
- _mainDepartmentModel.commission=_originalMainDepartmentModel.commission;
- }
- else{
- _mainDepartmentModel.commission=@"100";
- }
-
- for(DepartmentFrame *departmentFrame in _secondaryDepartmentList){
- BusinessDepartmentModel *departmentModel= departmentFrame.departmentModel;
- if(_originalSecondaryDepartmentList!=nil&&_originalSecondaryDepartmentList.count>0){
- for(DepartmentFrame *originalDepartmentFrame in _originalSecondaryDepartmentList){
- BusinessDepartmentModel *originalDepartmentModel=originalDepartmentFrame.departmentModel;
- if(departmentModel.organizationId==originalDepartmentModel.organizationId){
- departmentModel.commission=originalDepartmentModel.commission;
- }
- }
- Boolean existsFlag=[self isExistsBusinessDepartment:departmentModel departmentList:_originalSecondaryDepartmentList];
- if(!existsFlag){
- departmentModel.commission=@"100";
- }
-
- }
- else{
- departmentModel.commission=@"100";
- }
- }
-
- }
- _mainDepartmentCommission=_mainDepartmentModel.commission;
- NSString *departmentStr=@"";
- departmentStr=[NSString stringWithFormat:@"%@%@",_mainDepartmentModel.organizationName,@","];
- for(DepartmentFrame *frame in _secondaryDepartmentList){
- BusinessDepartmentModel *model=frame.departmentModel;
- departmentStr= [NSString stringWithFormat:@"%@%@%@",departmentStr,model.organizationName,@","];
- }
- _organizationId=[NSString stringWithFormat:@"%ld", _mainDepartmentModel.organizationId];
- _organizationCode=_mainDepartmentModel.organizationCode;
-
- departmentStr=[departmentStr substringToIndex:departmentStr.length-1];
- _lblOrganizationName.text=departmentStr;
- }
- -(Boolean)isExistsBusinessDepartment:(BusinessDepartmentModel*)departmentModel departmentList:(NSMutableArray*)departmentList{
- Boolean flag=NO;
- for(DepartmentFrame *departmentFrame in departmentList){
- if(departmentModel.organizationId==departmentFrame.departmentModel.organizationId){
- flag=YES;
- break;
- }
- }
-
- return flag;
- }
- -(void)showEarnestInfo:(NSMutableArray*)earnestList{
- double sum = 0;
- _earnestCheckedList=[[NSMutableArray alloc]init];
- for(EarnestModel *model in earnestList){
- NSString *earnestSum=model.earnestSum;
- double earnestSumValue=[earnestSum doubleValue];
- if(earnestSumValue>0){
- sum+=earnestSumValue;
- [_earnestCheckedList addObject:model];
- }
- }
- NSString *sumStr=[NSString stringWithFormat:@"%.4f",sum];
- _paymentAmount=sumStr;
- _lblPayment.text=sumStr;
- [self.homeVC calculate:@"orderDetail"];
-
-
- }
- -(void)showIntermediateCustomerInfo:(NSMutableArray*)intermediateCustomerList{
- if(intermediateCustomerList.count == 0){
- return;
- }
- _intermediateCustomerCheckedList=intermediateCustomerList;
-
- if(_editFLag){
- if(_intermediateCustomerCheckedList!=nil&&_intermediateCustomerCheckedList.count>0){
- for(IntermediateCustomerFrame *intemediateCustomerFrame in _intermediateCustomerCheckedList){
- IntermediateCustomerModel *intermediateCustomerModel= intemediateCustomerFrame.intermediateCustomerModel;
- if(_originalIntermediateCustomerList!=nil&&_originalIntermediateCustomerList.count>0){
- for(IntermediateCustomerFrame *originalIntermediateCustomerFrame in _originalIntermediateCustomerList){
- if(intermediateCustomerModel.intermediateCustomerStaffId==originalIntermediateCustomerFrame.intermediateCustomerModel.intermediateCustomerStaffId){
- intermediateCustomerModel.commission=originalIntermediateCustomerFrame.intermediateCustomerModel.commission;
- }
- }
- Boolean existsFlag=[self isExistsIntermediateCustomer:intermediateCustomerModel intermediateCustomerList:_originalIntermediateCustomerList];
- if(!existsFlag){
- intermediateCustomerModel.commission=@"100";
- }
-
- }
- else{
- intermediateCustomerModel.commission=@"100";
- }
- }
- }
- }
- NSString *intermediateCustomerStr=@"";
- for(IntermediateCustomerFrame *frame in _intermediateCustomerCheckedList){
- IntermediateCustomerModel *model=frame.intermediateCustomerModel;
- intermediateCustomerStr= [NSString stringWithFormat:@"%@%@%@",intermediateCustomerStr,model.intermediateCustomerStaffName,@","];
- }
-
- intermediateCustomerStr=[intermediateCustomerStr substringToIndex:intermediateCustomerStr.length-1];
- _lblIntermediateCustomer.text=intermediateCustomerStr;
- }
-
- -(Boolean)isExistsIntermediateCustomer:(IntermediateCustomerModel*)customerModel intermediateCustomerList:(NSMutableArray*)intermediateCustomerList{
-
- Boolean flag=NO;
- for(IntermediateCustomerFrame *intermediateCustomerFrame in intermediateCustomerList )
- {
- if(customerModel.intermediateCustomerStaffId==intermediateCustomerFrame.intermediateCustomerModel.intermediateCustomerStaffId){
- flag=YES;
- break;
-
- }
- }
- return flag;
- }
- -(BusinessDepartmentModel*)getMainBusinessDepartment:(NSMutableArray*)departmentList{
- BusinessDepartmentModel *mainDepartmentModel;
- for(DepartmentFrame *frame in departmentList){
- if(frame.departmentModel.isMainDepartmentStatus){
- mainDepartmentModel=frame.departmentModel;
- break;
- }
- }
- return mainDepartmentModel;
- }
- -(NSMutableArray*)getSecondaryDepartmentList:(NSMutableArray*)departmentList{
- NSMutableArray *secondaryDepartmentList=[[NSMutableArray alloc]init];
- for(DepartmentFrame *frame in departmentList){
- if(!frame.departmentModel.isMainDepartmentStatus){
- [secondaryDepartmentList addObject:frame];
-
- }
- }
- return secondaryDepartmentList;
- }
- //文本回调
- - (void)textEnd:(id)sender customerCode:(NSString*)code
- customerId:(NSString*)customerId customerName:(NSString*)customerName
- {
- UIButton *btn=(UIButton *)sender;
- if(code!=nil){
- _txtCustomerCode.text=code;
- }
- if(btn.tag==1301) //客户编码
- {
-
- if(_txtCustomerCode.text.length==0){
- return;
- }
- [self setTextEnable:YES];
- [self searchCustomerInfo:_txtCustomerCode.text];
-
- }
-
- }
- -(void)searchOnlyByCustomerCode
- {
- if(_txtCustomerCode.text.length==0)
- {
- return;
- }
- [self setTextEnable:YES];
- [self searchCustomerInfo:_txtCustomerCode.text];
- }
- -(void)showSaleManInfo:(SalesManModel*)mainSalesMan secondarySalesMan:(NSMutableArray*)secondarySalesManList salesmanSelectedList:(NSMutableArray*)salesmanSelectedList{
- _mainSalesMan=mainSalesMan;
- _secondarySalesManList=secondarySalesManList;
-
- _salesManCheckedList=salesmanSelectedList;
- _mainSalesManCommission=_mainSalesMan.commission;
- NSString *salesmanStr=@"";
- salesmanStr=[NSString stringWithFormat:@"%@%@",_mainSalesMan.staffName,@","];
- for(SalesManFrame *frame in _secondarySalesManList){
- SalesManModel *model=frame.salesmanModel;
- salesmanStr= [NSString stringWithFormat:@"%@%@%@",salesmanStr,model.staffName,@","];
- }
-
- salesmanStr=[salesmanStr substringToIndex:salesmanStr.length-1];
- _lblStaff.text=salesmanStr;
- _staffName=_mainSalesMan.staffName;
- _staffId=[NSString stringWithFormat:@"%d",_mainSalesMan.staffId];
- }
- -(Boolean) isExistsSalsman:(SalesManModel*)salesmanModel salesmanList:(NSMutableArray*)salesmanList{
- Boolean flag=NO;
- for(SalesManFrame *salesmanFrame in salesmanList){
- if(salesmanModel.staffId==salesmanFrame.salesmanModel.staffId){
- flag=YES;
- break;
- }
- }
- return flag;
-
- }
- -(void)searchCustomerInfo:(NSString *)code
- {
- NSString *urlStr = ServerURL;
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"SearchCustomerAndroid" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [dict setObject:code forKey:@"CustomerCode"];
-
- self.mDownManager = [[ASIDownManager alloc] init];
- _mDownManager.delegate = self;
- _mDownManager.onRequestSuccess = @selector(onCustomerCodeLoadFinish:);
- _mDownManager.onRequestFail = @selector(onCustomerCodeLoadFail:);
- [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
-
- }
- //进度条取消函数
- - (void)cancel {
- [self stopLoading];
- }
- //客户编码查询成功接口
- - (void)onCustomerCodeLoadFinish:(ASIDownManager *)sender {
-
- NSDictionary *dic = [sender.mWebStr JSONValue];
- [self cancel];
- if (dic && [dic isKindOfClass:[NSDictionary class]]) {
- int iStatus = [[dic objectForKey:@"Status"] intValue];
- NSString *message=[dic objectForKey:@"Message"];
- if (iStatus == 0) {
- NSArray * approvArr=[dic objectForKey:@"Result"];
- if(approvArr!=nil&&approvArr.count>0)
- {
- _orderSearchList=[[NSMutableArray alloc]init];
- for(int i=0;i<approvArr.count;i++){
- NSDictionary *dic=approvArr[0];
- NSInteger fillingId=[[dic objectForKey:@"FilingID"]integerValue];
- NSInteger customerId=[[dic objectForKey:@"CustomerID"]integerValue];
- NSString *customerCode=[dic objectForKey:@"CustomerCode"];
- NSString *customerName=[dic objectForKey:@"CustomerName"];
- NSString *channelName=[dic objectForKey:@"ChannelName"];
- NSInteger channelId=[[dic objectForKey:@"ChannelID"]integerValue];
- NSString *telephone=[dic objectForKey:@"Telephone"];
- NSString *address=[dic objectForKey:@"Address"];
- NSString *staffName=[dic objectForKey:@"StaffName"];
- NSInteger staffId=[[dic objectForKey:@"StaffID"]integerValue];
- NSInteger customerTypeId=[[dic objectForKey:@"CustomerType"]integerValue];
- NSString *customerTypeName=[dic objectForKey:@"CustomerTypeName"];
- NSInteger organizationId=[[dic objectForKey:@"OrganizationID"]integerValue];
- NSString *organizationName=[dic objectForKey:@"OrganizationName"];
- NSString *organizationCode=[dic objectForKey:@"OrganizationCode"];
- NSInteger purviewFlag=[[dic objectForKey:@"PurviewFlag"]integerValue];
- NSInteger districtId=[[dic objectForKey:@"DistrictID"]integerValue];
- NSString* districtCode=[dic objectForKey:@"DistrictCode"];
- NSString *districtName=[dic objectForKey:@"DistrictName"];
- CustomerCodeSearchModel *searchModel=[CustomerCodeSearchModel new];
- searchModel.filingId=fillingId;
- searchModel.customerId=customerId;
- searchModel.customerCode=customerCode;
- searchModel.customerName=customerName;
- searchModel.channelId=channelId;
- searchModel.channelName=channelName;
- searchModel.telephone=telephone;
- searchModel.address=address;
- searchModel.staffId=staffId;
- searchModel.staffName=staffName;
- searchModel.districtId=districtId;
- searchModel.districtCode=districtCode;
- searchModel.districtName=districtName;
- searchModel.customerTypeId=customerTypeId;
- searchModel.customerTypeName=customerTypeName;
- searchModel.organizationId=organizationId;
- searchModel.organizationCode=organizationCode;
- searchModel.organizationName=organizationName;
- searchModel.purviewFlag=purviewFlag;
- [_orderSearchList addObject:searchModel];
- }
- int totalCount = 0;
- for(int i=0;i<_orderSearchList.count;i++){
- CustomerCodeSearchModel *searchModel1= [_orderSearchList objectAtIndex:i];
- NSInteger purviewFlag=searchModel1.purviewFlag;
- if(purviewFlag==0){
- ++totalCount;
- }
- }
-
- if(totalCount==_orderSearchList.count){
- [self showAlertViewText:@"此客户编码无访问权限"];
- return;
- }
- CustomerCodeSearchModel *customerCodeSearchModel=[self getSearchInfoModel:_orderSearchList];
- if(customerCodeSearchModel!=nil){
- [self showData:customerCodeSearchModel];
- [self setTextEnabled:NO];
- }
- }
-
- }
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue)
- {
- [self showReLoginDialog:message];
- [self setTextEnabled:YES];
- return;
- }
-
- else {
-
- // [self showAlertViewText:message];
- [self setTextEnabled:YES];
-
- }
-
- }
- }
- //客户编码查询失败接口
- - (void)onCustomerCodeLoadFail:(ASIDownManager *)sender {
- [self cancel];
- [self setTextEnabled:YES];
- [self showAlertViewText:@"加载失败"];
- }
- //客户编码列表查询
- -(void)searchCustomerCode{
-
- self.hidesBottomBarWhenPushed = YES;
- CustomerCodeSearchVC *customerCodeVC=[[ CustomerCodeSearchVC alloc] init];
- customerCodeVC.orderDelegate=self;
- customerCodeVC.subview=YES;
- customerCodeVC.flag=@"salesOrder";
-
- [self.orderNav pushViewController:customerCodeVC animated:YES];
- }
- -(void)refreshEditStatus{
- if(_editStatus==5||_editStatus==4){
- _txtCustomerName.enabled=NO;
- _txtCustomerCode.enabled=NO;
- _btnCustomerCode.enabled=NO;
- _txtTelephone.enabled=NO;
- _lblOrganizationName.userInteractionEnabled=NO;
- _lblStaff.userInteractionEnabled=NO;
- _lblChannel.userInteractionEnabled=NO;
- _lblPayment.userInteractionEnabled=NO;
- _lblIntermediateCustomer.userInteractionEnabled=NO;
- _txtContractNo.enabled=NO;
-
- }
- else if(_editStatus==7){
- _btnCustomerCode.enabled=NO;
- _txtCustomerName.enabled=NO;
- _txtCustomerCode.enabled=NO;
- _txtTelephone.enabled=NO;
- _lblOrganizationName.userInteractionEnabled=NO;
- _lblStaff.userInteractionEnabled=NO;
- _lblChannel.userInteractionEnabled=NO;
-
- _lblCustomerArea.userInteractionEnabled=NO;
- _txtCustomerAddress.enabled=NO;
- // _orderGoodsDetailVC.btnSearch.enabled=NO;
- _lblCustomerType.userInteractionEnabled=NO;
- _lblPayment.userInteractionEnabled=NO;
- _lblIntermediateCustomer.userInteractionEnabled=NO;
- _txtContractNo.enabled=NO;
- _txtContactPerson.enabled=NO;
- _txtContactWay.enabled=NO;
- _lblInstallDate.userInteractionEnabled=NO;
- _lblDeliveryDate.userInteractionEnabled=NO;
- _lblFloor.userInteractionEnabled=NO;
- _lblDecorationProgress.userInteractionEnabled=NO;
-
- }
- else if(_editStatus==10){
- _txtCustomerName.enabled=NO;
- _txtCustomerCode.enabled=NO;
- _btnCustomerCode.enabled=NO;
- _txtTelephone.enabled=NO;
- _lblOrganizationName.userInteractionEnabled=NO;
- _lblStaff.userInteractionEnabled=NO;
- _lblChannel.userInteractionEnabled=NO;
- _lblCustomerArea.userInteractionEnabled=NO;
- _txtCustomerAddress.enabled=NO;
- _txtRemarks.enabled=NO;
- _lblCustomerType.userInteractionEnabled=NO;
- _lblPayment.userInteractionEnabled=NO;
- _lblIntermediateCustomer.userInteractionEnabled=NO;
- _txtContractNo.enabled=NO;
- _txtContactPerson.enabled=NO;
- _txtContactWay.enabled=NO;
- // _orderGoodsDetailVC.btnSearch.enabled=NO;
- _lblInstallDate.userInteractionEnabled=NO;
- _lblDeliveryDate.userInteractionEnabled=NO;
- _lblFloor.userInteractionEnabled=NO;
- _lblDecorationProgress.userInteractionEnabled=NO;
- }
- }
- -(void)setTextEnable:(Boolean) enabled{
- _lblChannel.userInteractionEnabled=enabled;
- _lblCustomerType.userInteractionEnabled=enabled;
- _txtCustomerName.enabled=enabled;
- }
- -(void)getCustomerOrder:(CustomerCodeSearchModel*)searchModel{
- [self showData:searchModel];
- [self setTextEnabled:NO];
-
- }
- -(void)showData:(CustomerCodeSearchModel*)searchModel{
- _channelId=[NSString stringWithFormat:@"%ld",(long)searchModel.channelId];
- _channelName=searchModel.channelName;
- _lblChannel.text=_channelName;
- NSInteger organizationIdValue= searchModel.organizationId;
- _organizationId =[NSString stringWithFormat:@"%d",organizationIdValue] ;
- _organizationCode = [searchModel organizationCode];
- _organizationName = [searchModel organizationName];
-
- _customerCode=searchModel.customerCode;
- _telephone=searchModel.telephone;
- _txtTelephone.text=_telephone;
- _filingId=[NSString stringWithFormat:@"%ld",(long)searchModel.filingId];
- if (_customerCode==nil||[_customerCode isEqualToString:@""]) {
- _txtCustomerCode.text=_telephone;
- } else {
- _txtCustomerCode.text=_customerCode;
- }
- _customerName=searchModel.customerName;
- _txtCustomerName.text=_customerName;
- _address=searchModel.address;
- _txtCustomerAddress.text=_address;
- _customerTypeId=[NSString stringWithFormat:@"%ld",(long)searchModel.customerTypeId];
- _customerId=[NSString stringWithFormat:@"%ld",(long)searchModel.customerId];
- _customerAreaId=[NSString stringWithFormat:@"%ld",(long)searchModel.districtId];
- _customerAreaName=searchModel.districtName;
- _lblCustomerArea.text=_customerAreaName;
- _customerTypeName=searchModel.customerTypeName;
- _lblCustomerType.text=_customerTypeName;
- _staffId=[NSString stringWithFormat:@"%ld",(long)searchModel.staffId];
- _staffName=searchModel.staffName;
- _mainDepartmentModel=[BusinessDepartmentModel new];
- _mainDepartmentModel.organizationId=[_organizationId integerValue];
- _mainDepartmentModel.organizationCode=_organizationCode;
- _mainDepartmentModel.organizationName=_organizationName;
- _mainDepartmentModel.commission=@"100";
- _mainDepartmentModel.isCheckedStatus=YES;
- _mainDepartmentModel.isMainDepartmentStatus=YES;
- if(!_editFLag){
- if(_departmentDataList!=nil&&_departmentDataList.count>0){
- for(DepartmentFrame *departmentFrame in _departmentDataList){
- if(_mainDepartmentModel.organizationId==departmentFrame.departmentModel.organizationId){
- departmentFrame.departmentModel.isCheckedStatus=YES;
- departmentFrame.departmentModel.isMainDepartmentStatus=YES;
- departmentFrame.departmentModel.commission=@"100";
- }
- else{
- departmentFrame.departmentModel.isCheckedStatus=NO;
- departmentFrame.departmentModel.isMainDepartmentStatus=NO;
- departmentFrame.departmentModel.commission=@"100";
- }
- }
- }
-
- }
- else{
- if(_mainDepartmentModel.organizationId==_originalMainDepartmentModel.organizationId){
- _mainDepartmentModel.commission=_originalMainDepartmentModel.commission;
- }
- else{
- _mainDepartmentModel.commission=@"100";
- }
- for(DepartmentFrame *departmentFrame in _departmentDataList){
- if(_mainDepartmentModel.organizationId==departmentFrame.departmentModel.organizationId){
- departmentFrame.departmentModel.isCheckedStatus=YES;
- departmentFrame.departmentModel.isMainDepartmentStatus=YES;
- departmentFrame.departmentModel.commission=_mainDepartmentModel.commission;
-
- }
- else{
- departmentFrame.departmentModel.isCheckedStatus=NO;
- departmentFrame.departmentModel.isMainDepartmentStatus=NO;
- }
- }
- }
-
- _lblOrganizationName.text=_organizationName;
-
- _mainDepartmentCommission=_mainDepartmentModel.commission;
- _mainSalesMan=[SalesManModel new];
- _mainSalesMan.staffId=[_staffId integerValue];
- _mainSalesMan.staffName=_staffName;
-
- if(!_editFLag){
- if(_salesmanDataList!=nil&&_salesmanDataList.count>0){
- for(SalesManFrame *salesmanFrame in _salesmanDataList){
- if(_mainSalesMan.staffId==salesmanFrame.salesmanModel.staffId){
- salesmanFrame.salesmanModel.isMainSalesManStatus=YES;
- salesmanFrame.salesmanModel.commission=@"100";
- salesmanFrame.salesmanModel.isCheckedStatus=YES;
- }
- else{
- salesmanFrame.salesmanModel.isMainSalesManStatus=NO;
- salesmanFrame.salesmanModel.commission=@"100";
- salesmanFrame.salesmanModel.isCheckedStatus=NO;
- }
- }
- }
- }
-
- else{
- if(_mainSalesMan.staffId==_originalMainSalesMan.staffId){
- _mainSalesMan.commission=_originalMainSalesMan.commission;
- }
- else{
- _mainSalesMan.commission=@"100";
- }
-
- if(_salesmanDataList!=nil&&_salesmanDataList.count>0){
- for(SalesManFrame *salesmanFrame in _salesmanDataList){
- if(_mainSalesMan.staffId==salesmanFrame.salesmanModel.staffId){
- salesmanFrame.salesmanModel.isMainSalesManStatus=YES;
- salesmanFrame.salesmanModel.commission=_mainSalesMan.commission;
- salesmanFrame.salesmanModel.isCheckedStatus=YES;
- }
- else{
- salesmanFrame.salesmanModel.isMainSalesManStatus=NO;
- salesmanFrame.salesmanModel.isCheckedStatus=NO;
- }
- }
- }
-
- }
-
-
- _lblStaff.text=_staffName;
- _mainSalesManCommission=_mainSalesMan.commission;
- if(_secondaryDepartmentList!=nil&&_secondaryDepartmentList.count>0){
- [_secondaryDepartmentList removeAllObjects];
- }
-
- if(_secondarySalesManList!=nil &&_secondarySalesManList.count>0){
- [_secondarySalesManList removeAllObjects];
- }
-
- if((_orderGoodsDetailVC.inventoryGoodsDetailList!=nil&&_orderGoodsDetailVC.inventoryGoodsDetailList.count==0)||_orderGoodsDetailVC.inventoryGoodsDetailList==nil){
- return;
- }
- [self setTextEnable:NO];
- [self updateMarkedPrice];
- }
- /**
- 更新商品售价
- */
- - (void)updateGoodsSalePrice
- {
- // [self startLoading];
- NSString *urlStr = ServerURL;
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetOrderPriceIphone" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [dict setObject:_organizationId forKey:@"OrganizationID"];
- [dict setObject:_organizationCode forKey:@"OrganizationCode"];
- [dict setObject:_organizationCode forKey:@"OrganizationCode"];
- [dict setObject:(_channelId==nil?@"":_channelId) forKey:@"ChannelID"];
-
- NSString * orderDetail=[self checkedSalePriceJSON];
- [dict setObject:orderDetail forKey:@"OrderDetail"];
- self.mDownManager = [[ASIDownManager alloc] init];
- _mDownManager.delegate = self;
- _mDownManager.onRequestSuccess = @selector(onSalesPriceLoadFinish:);
- _mDownManager.onRequestFail = @selector(onSalesPriceLoadFail:);
- [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
- }
- - (void)onSalesPriceLoadFinish:(ASIDownManager *)sender {
- [self cancel];
- // 服务器返回数据
- RequestResultModel *resultModel = [RequestResultModel dk_modelWithJSON:sender.mWebStr];
- // 服务器返回数据状态值
- int iStatus = resultModel.status;
- // 服务器返回数据消息
- NSString *message = resultModel.message;
- // 服务器返回数据状态值正确
- if (iStatus == 0) {
- // 服务器返回数据结果
- NSArray * approvArr = (NSArray *)resultModel.result;
- if(approvArr != nil && approvArr.count > 0)
- {
- NSMutableArray *orderPriceList=[[NSMutableArray alloc]init];
- for(int i=0;i<approvArr.count;i++)
- {
- NSDictionary *orderDic=[approvArr objectAtIndex:i];
- int codeId=[[orderDic objectForKey:@"CodeID"]intValue];
- int gradeId=[[orderDic objectForKey:@"GradeID"]intValue];
- double orderPrice;
- if([[orderDic allKeys]containsObject:@"OrderPrice"])
- {
- orderPrice=[[orderDic objectForKey:@"OrderPrice"]doubleValue];
-
- }
- else{
- orderPrice=0;
- }
- InventoryListModel *goodsModel=[InventoryListModel new];
- [goodsModel setCodeId:codeId];
- [goodsModel setGradeId:gradeId];
- [goodsModel setSalesPrice:[NSString stringWithFormat:@"%.lf",orderPrice]];
- [orderPriceList addObject:goodsModel];
- }
-
- for(int i=0;i<orderPriceList.count;i++)
- {
- InventoryListModel *inventoryModel=[orderPriceList objectAtIndex:i];
-
- if(_orderGoodsDetailVC.inventoryGoodsDetailList!=nil&&_orderGoodsDetailVC.inventoryGoodsDetailList.count>0)
- {
- for(int i=0;i<_orderGoodsDetailVC.inventoryGoodsDetailList.count;i++)
- {
- InventoryListModel *goodsModel=[_orderGoodsDetailVC.inventoryGoodsDetailList objectAtIndex:i];
- if(goodsModel.circulateType==1&&goodsModel.acreageFlag)
- {
- double orderPrice=[goodsModel.acreagePrice doubleValue]*goodsModel.acreage;
- [goodsModel setSalesPrice:[NSString stringWithFormat:@"%.6f",orderPrice]];
-
- }
- else
- {
- if(goodsModel.promotionDetailId==nil||[goodsModel.promotionDetailId isEqualToString:@""])
- {
- if((inventoryModel.codeId==goodsModel.codeId)&&(inventoryModel.gradeId==goodsModel.gradeId))
- {
- [goodsModel setSalesPrice:inventoryModel.salesPrice];
- }
- }
- }
- }
- }
- }
-
-
- [self updateMarkedPrice];
-
-
- }
- }
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue){
- [self showReLoginDialog:message];
- return;
- }else {
- [self showAlertViewText:message];
- }
- }
- /**
- 产品价格加载失败接口
- @param sender
- */
- - (void)onSalesPriceLoadFail:(ASIDownManager *)sender {
- [self cancel];
- [self showAlertViewText:@"网络异常"];
- }
- -(void)updateMarkedPrice{
- // [self startLoading];
- NSString *urlStr = ServerURL;
- NSMutableDictionary *dict = [NSMutableDictionary dictionary];
- [dict setObject:@"GetMarkedPriceIphone" forKey:@"Action"];
- [dict setObject:[NSString stringWithFormat:@"%@",kkAccountCode]forKey:@"AccountCode"];
- [dict setObject:kkUserCode forKey:@"UserCode"];
- [dict setObject:kkUserPwd forKey:@"UserPassword"];
- [dict setObject:kkSessionKey forKey:@"SessionKey"];
- [dict setObject: _organizationCode forKey:@"OrganizationCode"];
- [dict setObject:(_channelId==nil?@"":_channelId) forKey:@"ChannelID"];
-
- NSString * orderDetail=[self checkedSalePriceJSON];
- [dict setObject:orderDetail forKey:@"OrderDetail"];
- SBJsonWriter *write = [[SBJsonWriter alloc] init];
- NSString *value = [write stringWithObject:dict];
-
- self.mDownManager = [[ASIDownManager alloc] init];
- _mDownManager.delegate = self;
- _mDownManager.onRequestSuccess = @selector(onMarkedPriceLoadFinish:);
- _mDownManager.onRequestFail = @selector(onMarkedPriceLoadFail:);
- [_mDownManager postHttpRequest:urlStr dic:dict path:nil fileName:nil];
-
- }
- //获得选中的商品的JSON数据,用于获取商品售价
- -(NSString *)checkedSalePriceJSON
- {
-
- NSMutableArray *finalArr=[NSMutableArray new];
- if(_orderGoodsDetailVC.inventoryGoodsDetailList!=nil&&_orderGoodsDetailVC.inventoryGoodsDetailList.count>0){
- for(InventoryListModel *inventoryModel in _orderGoodsDetailVC.inventoryGoodsDetailList){
- NSInteger codeIdValue= inventoryModel.codeId;
- NSInteger gradeIdValue=inventoryModel.gradeId;
- NSString *gradeID=[NSString stringWithFormat:@"%ld",gradeIdValue];
-
- NSString *codeId=[NSString stringWithFormat:@"%ld",codeIdValue];
- if(codeId!=nil&&gradeID!=nil){
- [finalArr addObject:@{@"CodeID": codeId,@"GradeID":gradeID}];
- }
- }
- }
-
- if(_orderGiftDetailVC.inventoryGiftDetailList!=nil&&_orderGiftDetailVC.inventoryGiftDetailList.count>0)
- {
- for(InventoryListModel *inventoryModel in _orderGiftDetailVC.inventoryGiftDetailList){
- NSInteger codeIdValue= inventoryModel.codeId;
- NSString *codeId=[NSString stringWithFormat:@"%ld",codeIdValue];
- NSInteger gradeIdValue=inventoryModel.gradeId;
- NSString *gradeID=[NSString stringWithFormat:@"%ld",gradeIdValue];
- if(codeId!=nil&&gradeID!=nil){
- [finalArr addObject:@{@"CodeID": codeId,@"GradeID":gradeID}];
- }
- }
- }
-
- SBJsonWriter *write = [[SBJsonWriter alloc] init];
- NSString *value = [write stringWithObject:finalArr];
- return value;
- }
- //客户编码查询成功接口
- - (void)onMarkedPriceLoadFinish:(ASIDownManager *)sender {
-
- NSDictionary *dic = [sender.mWebStr JSONValue];
- [self cancel];
- if (dic && [dic isKindOfClass:[NSDictionary class]]) {
- int iStatus = [[dic objectForKey:@"Status"] intValue];
- NSString *message=[dic objectForKey:@"Message"];
- if (iStatus == 0) {
- NSArray * approvArr=[dic objectForKey:@"Result"];
- if(approvArr!=nil&&approvArr.count>0){
- [self updateGoodsMarkedPrice:approvArr];
-
- }
- }
- else if(iStatus == ActionResultStatusAuthError
- ||iStatus == ActionResultStatusNoLogin
- ||iStatus == ActionResultStatusLogined||iStatus==ActionResultSessionOverdue)
- {
- [self showReLoginDialog:message];
- return;
- }
- else {
-
- [self showAlertViewText:message];
-
-
- }
- }
- }
- //客户编码查询失败接口
- - (void)onMarkedPriceLoadFail:(ASIDownManager *)sender {
- [self cancel];
- [self showAlertViewText:@"加载失败"];
- }
- //更新商品标价
- -(void)updateGoodsMarkedPrice :(NSArray *)priceArr;
- {
- for(NSDictionary *dic in priceArr){
-
- //渠道价格
- NSString * channelPrice = [dic objectForKey:@"ChannelPrice"];
- //策略价格
- NSString * basePrice = [dic objectForKey:@"BasePrice"];
- //基础标价
- NSString * standardPrice = [dic objectForKey:@"StandardPrice"];
- NSString *codeId = [NSString stringWithFormat:@"%@",[dic objectForKey:@"CodeID"]];
- NSString *gradeId = [NSString stringWithFormat:@"%@",[dic objectForKey:@"GradeID"]];
- for( InventoryListModel *inventoryModel in _orderGoodsDetailVC.inventoryGoodsDetailList){
- if([[NSString stringWithFormat:@"%ld",inventoryModel.codeId] isEqualToString:codeId]&&[[NSString stringWithFormat:@"%ld",inventoryModel.gradeId] isEqualToString:gradeId]){
- //标价取值顺序: 渠道价格->策略价格->基础标价->0
- if(channelPrice != nil)
- {
- inventoryModel.markedPrice=[NSString stringWithFormat:@"%lf",[channelPrice doubleValue]];
- }
- else if(basePrice != nil){
- inventoryModel.markedPrice=[NSString stringWithFormat:@"%lf",[basePrice doubleValue]];
- }
- else if(standardPrice != nil){
- inventoryModel.markedPrice=[NSString stringWithFormat:@"%lf",[standardPrice doubleValue]];
- }
-
- else{
- inventoryModel.markedPrice=@"0.00";
- }
- // 2017-7-26 关宏厚 end
- if(inventoryModel.salesPrice == nil||[inventoryModel.salesPrice isEqualToString:@"0"]||[inventoryModel.salesPrice isEqualToString:@"(null)"]){
- inventoryModel.salesPrice = [inventoryModel.markedPrice copy];
- }
-
- double markedPrice=[inventoryModel.markedPrice doubleValue];
- if(inventoryModel.circulateType==1&&inventoryModel.acreageFlag)
- {
- if(markedPrice>0)
- {
- double discount=[inventoryModel.acreagePrice doubleValue]*100/markedPrice;
- [inventoryModel setDiscount:[NSString stringWithFormat:@"%.2f",discount]];
-
- }
- else
- {
- [inventoryModel setDiscount:@"100"];
- }
- }
- else
- {
- if(markedPrice>0)
- {
- double orderPrice=[inventoryModel.salesPrice doubleValue];
- double discount=orderPrice*100/markedPrice;
- [inventoryModel setDiscount:[NSString stringWithFormat:@"%.2f",discount]];
- }
- else
- {
- [inventoryModel setDiscount:@"100"];
- }
- }
-
- }
- }
-
- for(InventoryListModel *inventoryModel in _orderGiftDetailVC.inventoryGiftDetailList)
- {
- if([[NSString stringWithFormat:@"%ld",inventoryModel.codeId] isEqualToString:codeId]&&[[NSString stringWithFormat:@"%ld",inventoryModel.gradeId] isEqualToString:gradeId]){
- //标价取值顺序: 渠道价格->策略价格->基础标价->0
- if(channelPrice != nil)
- {
- inventoryModel.markedPrice=[NSString stringWithFormat:@"%lf",[channelPrice doubleValue]];
- }
- else if(basePrice != nil){
- inventoryModel.markedPrice=[NSString stringWithFormat:@"%lf",[basePrice doubleValue]];
- }
- else if(standardPrice != nil){
- inventoryModel.markedPrice=[NSString stringWithFormat:@"%lf",[standardPrice doubleValue]];
- }
-
- else{
- inventoryModel.markedPrice=@"0.00";
- }
- }
- }
-
- }
-
- [_homeVC calculate:@"orderDetail"];
-
- [_orderGoodsDetailVC.vDetailTableView reloadData];
- [_orderGiftDetailVC.vDetailTableView reloadData];
- }
- -(CustomerCodeSearchModel*)getSearchInfoModel:(NSMutableArray*)searchInfoList{
- CustomerCodeSearchModel *searchModel=nil;
- for(CustomerCodeSearchModel *search in searchInfoList){
- if(search.purviewFlag==1){
- searchModel=search;
- break;
- }
- }
- return searchModel;
- }
- -(void)editSort{
- self.hidesBottomBarWhenPushed = YES;
- EditSortVC *sortVc = [[EditSortVC alloc] init];
- sortVc.topDataList=_topDataList;
- sortVc.bottomDataList=_bottomDataList;
- sortVc.refreshDelegate=self;
- sortVc.orderNav=self.orderNav;
- [self.orderNav pushViewController:sortVc animated:YES];
- }
- -(void)loadMoreInfo{
- _vBottom.hidden=NO;
- if(!isExpand){
- isExpand=YES;
-
- [self initDynamicLayout:_bottomDataList dynamicView:_vBottom topFlag:NO];
- }
- else{
- isExpand=NO;
- [_vBottom removeFromSuperview];
- _vBottom=[UIView new];
- _vBottom.frame=CGRectMake(0, CGRectGetMaxY(_separator2.frame),Screen_Width, 0);
- [_vBody addSubview:_vBottom];
- _vBottom.frame=CGRectMake(0, CGRectGetMaxY(_separator2.frame),Screen_Width, 0);
-
- _vBody.frame=CGRectMake(0,0,Screen_Width, CGRectGetMaxY(_vBottom.frame));
- [self updateScrollView];
- }
- }
- -(void)initDynamicLayout:(NSMutableArray *)dataList dynamicView:(UIView*)dynamicView topFlag:(Boolean) topFlag{
- if(dataList!=nil&&dataList.count>0){
- for(int i=0;i<dataList.count;i++){
- DragItemInfo *info= dataList[i];
- NSInteger componentId=info.componentId;
- switch (componentId) {
- case 1000:
- if(_vCustomerAddress==nil){
- _vCustomerAddress=[UIView new];
-
- }
- [dynamicView addSubview:_vCustomerAddress];
- _vCustomerAddress.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_txtCustomerAddress==nil){
- _txtCustomerAddress= [self getTextField:_vCustomerAddress labelText:@"客户地址" hintText:@"请输入客户地址" labelColor:[UIColor blackColor] tag:1000];
- _txtCustomerAddress.delegate=self;
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
-
- break;
- case 1001:
- if(_vRemarks==nil){
- _vRemarks=[UIView new];
- }
- [dynamicView addSubview:_vRemarks];
- _vRemarks.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_txtRemarks==nil){
- _txtRemarks= [self getTextField:_vRemarks labelText:@"备注" hintText:@"请输入备注" labelColor:[UIColor blackColor] tag:1001];
- _txtRemarks.delegate=self;
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
-
- break;
- case 1002:
- if(_vPerformanceAccountingCategory==nil){
- _vPerformanceAccountingCategory=[UIView new];
-
- }
- [dynamicView addSubview:_vPerformanceAccountingCategory];
- _vPerformanceAccountingCategory.frame=CGRectMake(0,51*i,Screen_Width, 51);
-
- if(_lblPerformanceAccountingCategory==nil){
- _lblPerformanceAccountingCategory=[self getUILabel:_vPerformanceAccountingCategory labelText:@"业绩核算类别" hintText:@"请选择业绩核算类别" labelColor:[UIColor blackColor] isHaveRightArrow:YES tag:1002];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- [self allListeners];
- break;
-
- case 1003:
- if(_vPayment==nil){
- _vPayment=[UIView new];
-
- }
- [dynamicView addSubview:_vPayment];
- _vPayment.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblPayment==nil){
- _lblPayment=[self getUILabel:_vPayment labelText:@"定金金额" hintText:@"请选择定金金额" labelColor:[UIColor blackColor] isHaveRightArrow:YES tag:1003];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- [self allListeners];
- break;
-
- case 1004:
- if(_vIntermediateCustomer==nil){
- _vIntermediateCustomer=[UIView new];
-
- }
- [dynamicView addSubview:_vIntermediateCustomer];
-
- _vIntermediateCustomer.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblIntermediateCustomer==nil){
- _lblIntermediateCustomer=[self getUILabel:_vIntermediateCustomer labelText:@"中间客户" hintText:@"请选择中间客户" labelColor:[UIColor blackColor] isHaveRightArrow:YES tag:1004];
- }
-
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- [self allListeners];
- break;
- case 1005:
- if(_vGoodsAmount==nil){
- _vGoodsAmount=[UIView new];
-
- }
- [dynamicView addSubview:_vGoodsAmount];
- _vGoodsAmount.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblGoodsAmount==nil){
- _lblGoodsAmount=[self getUILabel:_vGoodsAmount labelText:@"货物总额" hintText:@"" labelColor:[UIColor blackColor] isHaveRightArrow:NO tag:1005];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- break;
-
- case 1006:
- if(_vTotalAmount==nil){
- _vTotalAmount=[UIView new];
-
- }
- [dynamicView addSubview:_vTotalAmount];
- _vTotalAmount.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblTotalAmount==nil){
- _lblTotalAmount=[self getUILabel:_vTotalAmount labelText:@"合计总额" hintText:@"" labelColor:[UIColor blackColor] isHaveRightArrow:NO tag:1006];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- break;
-
- case 1007:
- if(_vContractNo==nil){
- _vContractNo=[UIView new];
-
- }
- [dynamicView addSubview:_vContractNo];
- _vContractNo.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_txtContractNo==nil){
- _txtContractNo=[self getTextField:_vContractNo labelText:@"合同号" hintText:@"请输入合同号" labelColor:[UIColor blackColor] tag:1007];
- _txtContractNo.delegate=self;
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- break;
-
- case 1008:
- if(_vContactPerson==nil){
- _vContactPerson=[UIView new];
-
- }
- [dynamicView addSubview:_vContactPerson];
- _vContactPerson.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_txtContactPerson==nil){
- _txtContactPerson=[self getTextField:_vContactPerson labelText:@"联系人" hintText:@"请输入联系人" labelColor:[UIColor blackColor] tag:1008];
- _txtContactPerson.delegate=self;
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- break;
-
- case 1009:
- if(_vContactWay==nil){
- _vContactWay=[UIView new];
-
- }
- [dynamicView addSubview:_vContactWay];
- _vContactWay.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_txtContactWay==nil){
- _txtContactWay=[self getTextField:_vContactWay labelText:@"联系方式" hintText:@"请输入联系方式" labelColor:[UIColor blackColor] tag:1009];
- _txtContactWay.delegate=self;
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- break;
-
- case 1010:
- if(_vFullDiscount==nil){
- _vFullDiscount=[UIView new];
-
- }
- [dynamicView addSubview:_vFullDiscount];
- _vFullDiscount.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblFullDiscount==nil){
- _lblFullDiscount=[self getUILabel:_vFullDiscount labelText:@"整单折扣" hintText:@"" labelColor:[UIColor blackColor] isHaveRightArrow:NO tag:1010];
- }
-
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- break;
- case 1011:
- if(_vToSalesAmount==nil){
- _vToSalesAmount=[UIView new];
-
- }
- [dynamicView addSubview:_vToSalesAmount];
- _vToSalesAmount.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblToSalesAmount==nil){
-
- _lblToSalesAmount=[self getUILabel:_vToSalesAmount labelText:@"转销售金额" hintText:@"" labelColor:[UIColor blackColor] isHaveRightArrow:NO tag:1011];
-
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- break;
-
- case 1012:
- if(_vInstallDate==nil){
- _vInstallDate=[UIView new];
-
- }
-
- [dynamicView addSubview:_vInstallDate];
- _vInstallDate.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblInstallDate==nil){
- _lblInstallDate=[self getUILabel:_vInstallDate labelText:@"安装日期" hintText:@"请选择安装日期" labelColor:[UIColor blackColor] isHaveRightArrow:YES tag:1012];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- [self allListeners];
- break;
-
- case 1013:
- if(_vDeliveryDate==nil){
- _vDeliveryDate=[UIView new];
-
- }
- [dynamicView addSubview:_vDeliveryDate];
- _vDeliveryDate.frame=CGRectMake(0,51*i,Screen_Width, 51);
-
- if(_lblDeliveryDate==nil){
- _lblDeliveryDate=[self getUILabel:_vDeliveryDate labelText:@"配送日期" hintText:@"请选择配送日期" labelColor:[UIColor blackColor] isHaveRightArrow:YES tag:1013];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- [self allListeners];
- break;
-
- case 1014:
- if(_vFloor==nil){
- _vFloor=[UIView new];
-
- }
- [dynamicView addSubview:_vFloor];
- _vFloor.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblFloor==nil){
- _lblFloor=[self getUILabel:_vFloor labelText:@"楼层" hintText:@"请选择楼层" labelColor:[UIColor blackColor] isHaveRightArrow:YES tag:1014];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- [self allListeners];
- break;
-
- case 1015:
- if(_vDecorationProgress==nil){
- _vDecorationProgress=[UIView new];
-
- }
- [dynamicView addSubview:_vDecorationProgress];
- _vDecorationProgress.frame=CGRectMake(0,51*i,Screen_Width, 51);
-
- if(_lblDecorationProgress==nil){
- _lblDecorationProgress=[self getUILabel:_vDecorationProgress labelText:@"装修进度" hintText:@"请选择装修进度" labelColor:[UIColor blackColor] isHaveRightArrow:YES tag:1015];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- [self allListeners];
- break;
-
- case 1016:
- if(_vWeight==nil){
- _vWeight=[UIView new];
-
- }
- [dynamicView addSubview:_vWeight];
- _vWeight.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblWeight==nil){
- _lblWeight=[self getUILabel:_vWeight labelText:@"重量" hintText:@"" labelColor:[UIColor blackColor] isHaveRightArrow:NO tag:1016];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- break;
-
- case 1017:
- if(_vVolume==nil){
- _vVolume=[UIView new];
-
- }
- [dynamicView addSubview:_vVolume];
- _vVolume.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblVolume==nil){
- _lblVolume=[self getUILabel:_vVolume labelText:@"总体积" hintText:@"" labelColor:[UIColor blackColor] isHaveRightArrow:NO tag:1017];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- break;
-
- case 1018:
- if(_vPaymentRate==nil){
- _vPaymentRate=[UIView new];
-
- }
- [dynamicView addSubview:_vPaymentRate];
- _vPaymentRate.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblPaymentRate==nil){
- _lblPaymentRate=[self getUILabel:_vPaymentRate labelText:@"定金比率" hintText:@"" labelColor:[UIColor blackColor] isHaveRightArrow:NO tag:1017];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
-
- break;
-
- case 1019:
- if(_vMarkPriceAmount==nil){
- _vMarkPriceAmount=[UIView new];
-
- }
- [dynamicView addSubview:_vMarkPriceAmount];
- _vMarkPriceAmount.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblMarkPriceAmount==nil){
- _lblMarkPriceAmount=[self getUILabel:_vMarkPriceAmount labelText:@"标价总额" hintText:@"" labelColor:[UIColor blackColor] isHaveRightArrow:NO tag:1017];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
-
- break;
-
- case 1020:
- if(_vOrderNo==nil){
- _vOrderNo=[UIView new];
-
- }
- [dynamicView addSubview:_vOrderNo];
- _vOrderNo.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblOrderNo==nil){
- _lblOrderNo=[self getUILabel:_vOrderNo labelText:@"订单单号" hintText:@"" labelColor:[UIColor blackColor] isHaveRightArrow:NO tag:1017];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
-
- break;
-
- case 1021:
- if(_vFeesAmount==nil){
- _vFeesAmount=[UIView new];
-
- }
- [dynamicView addSubview:_vFeesAmount];
- _vFeesAmount.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblFeesAmount==nil){
- _lblFeesAmount=[self getUILabel:_vFeesAmount labelText:@"费用金额" hintText:@"请选择费用金额" labelColor:[UIColor blackColor] isHaveRightArrow:YES tag:1021];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
- [self allListeners];
- break;
-
- case 1022:
-
- if(_vTotalM2==nil){
- _vTotalM2=[UIView new];
-
- }
- [dynamicView addSubview:_vTotalM2];
- _vTotalM2.frame=CGRectMake(0,51*i,Screen_Width, 51);
- if(_lblTotalM2==nil){
- _lblTotalM2=[self getUILabel:_vTotalM2 labelText:@"总平米" hintText:@"" labelColor:[UIColor blackColor] isHaveRightArrow:NO tag:1022];
- }
- [self updateScrollView:topFlag dynamicView:dynamicView count:i];
-
- break;
-
-
- default:
- break;
- }
- }
- }
-
- }
- -(void)updateScrollView:(Boolean)topFlag dynamicView:(UIView*)dynamicView count:(NSInteger) count{
- if(topFlag){
- dynamicView.frame=CGRectMake(0,CGRectGetMaxY(_vCustomerType.frame),Screen_Width,51*(count+1));
- _separator1.frame=CGRectMake(0,CGRectGetMaxY(dynamicView.frame)+10,Screen_Width, 10);
- _vOperation.frame=CGRectMake(0,CGRectGetMaxY(_separator1.frame),Screen_Width, 51);
- _separator2.frame=CGRectMake(0,CGRectGetMaxY(_vOperation.frame),Screen_Width, 10);
-
- _vBody.frame=CGRectMake(0,0,Screen_Width, CGRectGetMaxY(_separator2.frame));
- [self updateScrollView];
-
- }
- else{
- dynamicView.frame=CGRectMake(0, CGRectGetMaxY(_separator2.frame),Screen_Width, 51*(count+1));
-
- _vBody.frame=CGRectMake(0,0,Screen_Width, CGRectGetMaxY(dynamicView.frame));
- [self updateScrollView];
- }
- }
- -(UITextField *)getTextField:(UIView*)v labelText:(NSString*)labelTitle hintText:(NSString*)hint labelColor:(UIColor*) color tag:(NSInteger) tag {
-
- UILabel *lblCustomer = [UILabel new];
- lblCustomer.frame=CGRectMake(15,16, 100, 25);
- lblCustomer.text = labelTitle;
- lblCustomer.textColor=color;
- lblCustomer.font= [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [v addSubview:lblCustomer];
- UITextField *txtCustomer = [UITextField new];
- txtCustomer.frame=CGRectMake(CGRectGetMaxX(lblCustomer.frame)+10,16, 200, 25);
- txtCustomer.tag=tag;
- txtCustomer.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
- txtCustomer.placeholder = hint;
- [v addSubview:txtCustomer];
-
- UIView *separator = [UIView new];
- separator.backgroundColor=LineBackgroundColor;
- separator.frame=CGRectMake(CGRectGetMaxX(lblCustomer.frame)+10,CGRectGetMaxY(txtCustomer.frame)+10,Screen_Width-CGRectGetMaxX(lblCustomer.frame)+10, 1);
- [v addSubview:separator];
-
-
- return txtCustomer;
- }
- -(UILabel *)getUILabel:(UIView*)v labelText:(NSString*)labelTitle hintText:(NSString*)hint labelColor:(UIColor*) color isHaveRightArrow:(Boolean)rightArrowFlag tag:(NSInteger) tag{
-
- UILabel *lblTitleCustomer = [UILabel new];
- lblTitleCustomer.frame=CGRectMake(15,16, 100, 25);
- lblTitleCustomer.text = labelTitle;
- lblTitleCustomer.textColor=color;
- lblTitleCustomer.font= [UIFont systemFontOfSize: LabelAndTextFontOfSize];
- [v addSubview:lblTitleCustomer];
- UILabel *lblCustomer = [UILabel new];
- lblCustomer.frame=CGRectMake(CGRectGetMaxX(lblTitleCustomer.frame)+10,16, 200, 25);
- lblCustomer.font=[UIFont systemFontOfSize: LabelAndTextFontOfSize];
- lblCustomer.userInteractionEnabled=YES;
- lblCustomer.text=hint;
- lblCustomer.tag=tag;
- [v addSubview:lblCustomer];
-
- UIView *separator = [UIView new];
- separator.backgroundColor=LineBackgroundColor;
- separator.frame=CGRectMake(CGRectGetMaxX(lblTitleCustomer.frame)+10,CGRectGetMaxY(lblCustomer.frame)+10,Screen_Width-CGRectGetMaxX(lblTitleCustomer.frame)+10, 1);
- [v addSubview:separator];
- if(rightArrowFlag){
- UIButton *btnRightArrow = [UIButton buttonWithType:UIButtonTypeCustom];
- btnRightArrow.frame=CGRectMake(Screen_Width-50,10,32,30);
- UIImageView *rightArrowImg = [[UIImageView alloc]initWithFrame:CGRectMake(25,9,7, 12)];
- [rightArrowImg setImage:[UIImage imageNamed:@"rightarrow"]];
- [ btnRightArrow addSubview:rightArrowImg];
- rightArrowImg.userInteractionEnabled=NO;
- [v addSubview:btnRightArrow];
- }
- return lblCustomer;
- }
- -(void)refreshData:(NSMutableArray*)topDataList bottomDataList:(NSMutableArray*)bottomData{
- _vBottom.hidden=NO;
- _topDataList=topDataList;
- _bottomDataList=bottomData;
- [_vTop removeFromSuperview];
- _vTop=[UIView new];
- _vTop.frame=CGRectMake(0,CGRectGetMaxY(_vCustomerType.frame),Screen_Width,0);
- [_vBody addSubview:_vTop];
- _separator1.frame=CGRectMake(0,CGRectGetMaxY(_vTop.frame)+10,Screen_Width, 10);
- _vOperation.frame=CGRectMake(0,CGRectGetMaxY(_separator1.frame),Screen_Width, 51);
- _separator2.frame=CGRectMake(0,CGRectGetMaxY(_vOperation.frame),Screen_Width, 10);
- [_vBottom removeFromSuperview];
- _vBottom=[UIView new];
- _vBottom.frame=CGRectMake(0, CGRectGetMaxY(_separator2.frame),Screen_Width, 0);
- [_vBody addSubview:_vBottom];
-
- _vBody.frame=CGRectMake(0,0,Screen_Width, CGRectGetMaxY(_vBottom.frame));
- [self updateScrollView];
- [self initDynamicLayout:_topDataList dynamicView:_vTop topFlag:YES];
- [self initDynamicLayout:_bottomDataList dynamicView:_vBottom topFlag:NO];
-
- }
- -(void)callbackDepositAmount:(NSMutableArray *) arry
- {
- _feesAmountCheckedList=[[NSMutableArray alloc]init];
- double sum=0;
- for(int i=0;i<arry.count;i++)
- {
- FeeAmountModel *depositModel= [arry objectAtIndex:i];
- NSString *feeItemSum= depositModel.feeItemSum;
- if(feeItemSum!=nil&&![feeItemSum isEqualToString:@""])
- {
- double feeItemSumValue=[feeItemSum doubleValue];
- if(feeItemSumValue>0)
- {
- sum+=feeItemSumValue;
- [_feesAmountCheckedList addObject:depositModel];
- }
-
- }
- }
-
- _feeAmount =[NSString stringWithFormat:@"%.4f",sum];
-
- _lblFeesAmount.text=_feeAmount;
-
-
- }
- /**
- 更新ScrollView
- */
- -(void)updateScrollView{
- _scrollView.contentSize = CGSizeMake(self.view.frame.size.width, CGRectGetMaxY(_vBody.frame)+rectStatusHeight+rectNavHeight+40);
-
- }
- - (void)didReceiveMemoryWarning {
- [super didReceiveMemoryWarning];
-
- }
- @end
|