
/**
 * 顺网util的js，返回业务数据
 */
var IspUtil={
	/**
	 * 上下问路径
	 */
	contextPath:'../',
	/**
	 * 返回
	 */
	getLeagueStateItem:function(){
		return [
			{text:"未确认",value:0},
			{text:"正常",value:1},
			{text:"已过期",value:2}
			
		];
	},
		
	/**
	 * 取回当前用户
	 */
	getCurUser:function(){
		
		return Action.getObjByUrl(IspUtil.contextPath +'curUserUtil_logined.do');
	},
	
	getCustomerInfoAction:function(){
		return Action.getObjByUrl(IspUtil.contextPath +'customerInfo_frontall.do');
	},
	/**
	 * 取回当前加盟商
	 */
	getCurLeague:function(){
		var result=Action.getObjByUrl(IspUtil.contextPath +'currLeague_league.do'); 
		return result.currLeague;
	},
	/**
	 * 返回当前用户的所在区域
	 */
	getCurUserCity:function(){
		return Action.getObjByUrl(IspUtil.contextPath + 'list_currentUserZone_logined.do').citys;
	},
	/**
	 * 得到城市数据
	 */
	getCityData:function(){
		return Action.getData(IspUtil.contextPath + 'zone.js');
	},
	/**
	 * 得到省份数据
	 */
	getProvinceData:function(){
		return Action.getData(IspUtil.contextPath + 'province_backuser.do?rp=0');
	},
	/**
	 * 得到未有大区设置的省份数据
	 */
	getZoneProvinceData:function(){
		return Action.getData(IspUtil.contextPath + 'province_backuser.do?rp=0&zoneUsed=false');
	},
	/**
	 * 得到后台用户
	 */
	getBackUser:function(){
		return Action.getData(IspUtil.contextPath + 'backUser_backuser.do?rp=0');
	},
	getBanks:function(){
		return Action.getData(IspUtil.contextPath + 'bank_backuser.do?rp=0');
	},
	/**
	 * 以item返回当前用户的所在区域
	 */
	getCurUserCityItems:function(){
		var ret = IspUtil.getCurUserCity();
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cityName;
			item.value = ret[i].cityId;
			items.push(item);
		}
		return items;
	},
		/**
	 * 以item返回当前用户的代理区域
	 */
	getExclusiveCityItems:function(){
		var items = new Array;
		var ret = Action.getData(IspUtil.contextPath + 'listExclusiveCitys_passport.do?rp=0');
		for(var j=0;j<ret.length;j++){
			var citys = ret[j].cell.exclusiveCitys;
			for(var i=0;i<citys.length;i++){
				var item={};
				item.text = citys[i].cityName;
				item.value = citys[i].cityId;
				items.push(item);
			}
		}
		return items;
	},
	/**
	 * 以item返回当前用户的代理区域
	 */
	getExclusiveGoodsItems:function(){
		var goodses = Action.getData("../listExclusiveGoods_passport.do?rp=0");
		var goodsItems = new Array;
		for(var i=0;i<goodses.length;i++){
			var item = {};
			item['value'] = goodses[i].cell["gid"];
			item['text'] = goodses[i].cell["name"];
			item.data=goodses[i].cell;
			goodsItems.push(item);
		}
		return goodsItems;
	},
	/**
	 * 返回存钱的类型
	 */
	getStoredType:function(){
		var items = [{text:"银行转帐",value:0},
					{text:"28收益",value:1}
//					{text:"特殊储值",value:2}
					
//					{text:"支付宝",value:3}
 					];
 		var value = Action.getObjByUrl(IspUtil.contextPath + "listCheckAccountRecType_passport.do?schType=4");
 		if(value.hasType)
 			items.push({text:"返利储值",value:4});
		return items;
	},
	
	getBusinessProcessInfo:function(){
		var ret = Action.getData(IspUtil.contextPath + 'listProcessInfo_backuser.do?rp=0&type=0');
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cell.name;
			item.value = ret[i].cell.bpiId;
			items.push(item);
		}
		return items;
	},
	/**
	 * 得到回访原因
	 */
	getVisitReasonItems:function(){
		var ret = Action.getData(IspUtil.contextPath + 'listProcessInfo_backuser.do?rp=0&type=1');
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cell.name;
			item.value = ret[i].cell.bpiId;
			items.push(item);
		}
		return items;
	},
	/**
	 * 回访结果类型
	 */
	getVisitResultItems:function(schVrtId){
		var ret = Action.getData(IspUtil.contextPath + 'listVisitResult_backuser.do?rp=0&isdel=false&schVrtId='+schVrtId);
		var items = new Array;
		var defItem={text:'---请选择---',value:''};
		items.push(defItem);
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cell.vrName;
			item.value = ret[i].cell.vrId;
			items.push(item);
		}
		return items;
	},
	/**
	 * 回访结果类别
	 */
	getVisitResultTypeItems:function(){
		var ret = Action.getData(IspUtil.contextPath + 'listVisitResultType_backuser.do?rp=0&isdel=false');
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cell.typeName;
			item.value = ret[i].cell.vrtId;
			items.push(item);
		}
		return items;
	},
	/**
	 * 回访状态
	 */
	getVisitStateItems:function(){
		var items = [{text:"待回访",value:1}
					,{text:"技术支持",value:2}
					,{text:"业务支持",value:3}
					,{text:"待确认",value:4}
					,{text:"回访结束",value:5}];
		return items;
	},
	/**
	 * 返回所有忠诚度级别
	 */
	getLoyaltyItem:function(){
		var ret = Action.getData('listLoyaltyLevel_backuser.do?isdel=false');
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item = {};
			item['value'] = ret[i].cell['levelId'];
			item['text'] = ret[i].cell['levelId']+'';
			item.data=ret[i].cell;
			items.push(item);
		}
		return items
		//return Action.getItemsByUrl('listLoyaltyLevel_backuser.do?isdel=false','levelId','levelId');
	},
	/**
	 * 得到回访专员列表
	 */
	getVisitorItems:function(){
		var ret = Action.getData(IspUtil.contextPath + 'backUser_backuser.do?rp=0');//&role=VISITOR
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cell.realName;
			item.value = ret[i].cell.userName;
			items.push(item);
		}
		return items;

	},
	
	getBankRemittancesRecState:function(){
		var items = [{text:"财务未登记",value:2}
					,{text:"财务未审核",value:1}
					,{text:"财务已审核",value:0}];
		return items;
	},
	getStoredRecState:function(){
		var items = [{text:"未审核",value:1}
					,{text:"已审核",value:0}];
		return items;
	},
	/**
	 * 加盟商加盟级别
	 */
    getLeagueLev:function(){
		var items = [{text:'--请选择--',value:""}
		            ,{text:"小普通加盟商",value:10}
					,{text:"普通加盟商",value:11}
					,{text:"小银牌加盟商",value:20}
					,{text:"银牌加盟商",value:21}
					,{text:"小金牌加盟商",value:30}
					,{text:"金牌加盟商",value:31}
					,{text:"小白金加盟商",value:40}
					,{text:"白金加盟商",value:41}
					,{text:"小钻石加盟商",value:50}
					,{text:"钻石加盟商",value:51}
					];
		return items;
	},
	/**
	 * 银行的数据
	 */
	getBanksSelect:function(){
		var ret = IspUtil.getBanks();
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cell.bankName;
			item.value = ret[i].cell.bid;
			items.push(item);
		}
		return items;
		

	},
	/**
	 * 返回菜单数据
	 */
	getUserMenu:function(){
		var menus = Action.getObjByUrl(IspUtil.contextPath + "listUserMenu_backuser.do");
		
		return menus.userMenu;
		

	},
	/**
	 * 以item返回后台用户
	 */
	getBackUserSelect:function(){
		var ret = IspUtil.getBackUser();
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cell.realName;
			item.value = ret[i].cell.userName;
			items.push(item);
		}
		return items;

	},
	
	/**
	 * 以item返回业务员
	 */
	getSellerUserItem:function(){
		var ret = Action.getData(IspUtil.contextPath + 'backUser_backuser.do?rp=0&role=SALES');
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cell.realName;
			item.value = ret[i].cell.userName;
			items.push(item);
		}
		return items;

	},
	/**
	 * 以item返回省份
	 */
	getProvinceSelect:function(){
		var ret = IspUtil.getProvinceData();
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cell.proName;
			item.value = ret[i].cell.proId;
			item.width="80px";
			items.push(item);
		}
		return items;

	},
	/**
	 * 以item返回未有大区设置的省份
	 */
	getZoneProvinceSelect:function(){
		var ret = IspUtil.getZoneProvinceData();
		var items = new Array;
		for(var i=0;i<ret.length;i++){
			var item={};
			item.text = ret[i].cell.proName;
			item.value = ret[i].cell.proId;
			items.push(item);
		}
		return items;

	},
		
	/**
	 * 返回OEM
	 */
	getOemItems:function(){
		return Action.getItemsByUrl(IspUtil.contextPath + 'oem_backuser.do',
			'oemId',
			'name');
	},
	/**
	 * 返回加盟商品
	 */
	getJoinGoodsItem:function(){

		return Action.getItemsByUrl(IspUtil.contextPath + 'listGoods_backuser.do?beanName=joinGoods&rp=0&schShow=true',

			'gid',
			'name');
	},
	/**
	 * 返回升级商品
	 */
	getLevelUpGoodsItem:function(){
		return Action.getItemsByUrl(IspUtil.contextPath + 'listGoods_backuser.do?beanName=levelUpGoods&rp=0',
			'gid',
			'name');
	},
	/**
	 * 返回所有商品的item
	 */
	getGoodsItem:function(){
		return Action.getItemsByUrl(IspUtil.contextPath + 'listGoods_backuser.do?beanName=goods&schShow=true&rp=0',
			'gid',
			'name');
	},
	/**
	 * 返回所有商品的item
	 */
	getFrontGoodsItem:function(){
		return Action.getItemsByUrl(IspUtil.contextPath + 'listGoods_passport.do?beanName=goods&schShow=true&rp=0',
			'gid',
			'name');
	},
	/**
	 * 返回所有显示的
	 */
	getShowGoods:function(){

		return Action.getData(IspUtil.contextPath + 'listGoods_backuser.do?rp=0&beanName=goods&schShow=true');

	},
	/**
	 * 返回
	 */
	getGiftApplyStateItem:function(){
		var items = new Array;
		items.push({text:'待审核',value:0});
		items.push({text:'已审核',value:1});
		items.push({text:'已使用',value:2});
		items.push({text:'已作废',value:3});
		items.push({text:'已过期',value:4});
		return items;
	},
	/**
	 * 返回商品
	 */
	getGiftItem:function(){
		var datas = Action.getData(IspUtil.contextPath + 'listGift_backuser.do?rp=0&schShow=true');
		var items = new Array;
		for(var i=0;i<datas.length;i++){
			var data= datas[i].cell;
			var item = {};
			item.text = data.giftName;
			item.value = data.giftId;
			item.goodsName = data.goodsName;
			item.expDay =data.expDay;
			item.percentName = data.percentName;
			items.push(item); 		
		}
		return items;
	},
	
	/**
	 * 根据商品返回礼包
	 */
	getGiftItemByGoods:function(gid){
		var datas = Action.getData(IspUtil.contextPath + 'listExclusiveGift_passport.do?rp=0&schShow=true&schGid='+gid);
		var items = new Array;
		for(var i=0;i<datas.length;i++){
			var data= datas[i].cell;
			var item = {};
			item.text = data.giftName;
			item.value = data.giftId;
			item.goodsName = data.goodsName;
			item.expDay =data.expDay;
			item.percentName = data.percentName;
			items.push(item); 		
		}
		return items;
	},
	
	
	getUSerSWMoney:function(){
		return Action.getObjByUrl(IspUtil.contextPath + 'listUserSWMoney_frontall.do');;	
	},
	/**
	 * 获取当前通行证账户信息
	 */
	getPassportSWMoney:function(){
		  return Action.getObjByUrl(IspUtil.contextPath + 'account_passport.do');	
	},
	/**
	 * 根据通行证ID查看通行证账户信息
	 */
	getPassportSWMoneyById:function(passportId){
		  return Action.getObjByUrl(IspUtil.contextPath + 'accountbById_backuser.do?schPassportId='+passportId);	
	},
	/**
	 * 根据加盟商ID查看加盟商28账户信息
	 */
	getLeagueAdAccountById:function(leagueId){
		  return Action.getObjByUrl(IspUtil.contextPath + 'schLeagueAdAccount_backuser.do?schLeagueId='+leagueId);	
	},
	/**
	 * 根据城市和商品的id得到礼包的id
	 */
	getGoodsUsedGift:function(cityId,gid){
		return Action.getData(IspUtil.contextPath + 'listgoodsUsedGift_passport.do?cityId='
			+ cityId +'&gid=' + gid);
	},
	/**
	 * 判断加盟商是否存在
	 */
	isLeagueExist:function(userName){
		return Action.getObjByUrl(IspUtil.contextPath + 'isLeagueExist_frontall.do?userName='+ userName).exist;
	},
	/**
	 * 串号区域状态（已保护，未保护）
	 */
	getServiseAreaState:function(){
		var items = [{text:"已保护",value:1}
					,{text:"未保护",value:0}];
		return items;
	},
	/**
	 * 处理串号网吧状态（已指定，未指定）
	 */
	getReceiveState:function(){
		var items = [{text:"未指定",value:0}
					,{text:"已指定",value:1}];
		return items;
	},
	/**
	 * 串号处理类型（已指定，未指定）
	 */
	getProcessType:function(){
		var items = [{text:"转移托管关系",value:3}
					,{text:"加入白名单",value:1}
					,{text:"修改IP",value:2}
					,{text:"窜号处理",value:4}];
		return items;
	},
	/**
	 * 返回后台用户状态
	 */
	getBackUserState:function(){
		var items = [{text:"禁用",value:0}
					,{text:"启用",value:1}];
		return items;
	},
	/**
	 * 判断当前的用户是不是独家
	 */
	isPassportExclusive:function(){
		return Action.getObjByUrl(IspUtil.contextPath + 'listcurUserExclusive_passport.do').exclusive;
	},
	getLeagueInfo:function(leagueId){
		if(leagueId==""||leagueId==undefined||leagueId==null)
			return null;
		var datas = Action.getData(IspUtil.contextPath + 'leagueInfo_passport.do?leagueId='+leagueId);
		var data= datas[0].cell;
		var item = {};
		item.leagueId = data.leagueId;
		item.company = data.company;
		item.realName = data.realName;
		item.mobile =data.mobile;	
		return item;
	},
	getPassportInfo:function(passportId){
		if(passportId==""||passportId==undefined||passportId==null)
			return null;
		var datas = Action.getData(IspUtil.contextPath + 'passportInfo_passport.do?passportId='+passportId);

		
		var data= datas[0].cell;
		var item = {};
		item.passportId = data.passportId;
		item.company = data.company;
		item.realName = data.realName;
		item.mobile =data.mobile;
		item.leagueCount =data.leagueCount;
		item.licNum =data.licNum;
		item.barCount =data.barCount;	
		return item;	
		
		
	},
	/**
	 * 返回返点申请人
	 */
	getRewardApplyerItem:function(){
		return Action.getItemsByUrl(IspUtil.contextPath + 'backUser_backuser.do?forBackWardAppler=true&rp=0',
			'userName',
			'realName');
	},
	/**
	 * 返回返点审核人
	 */
	getRewardAuditerrItem:function(){
		return Action.getItemsByUrl(IspUtil.contextPath + 'backUser_backuser.do?forBackWardAuditer=true&rp=0',
			'userName',
			'realName');
	},
	/**
	 * 返回分成IE首页
	 */
	getIEHomePageAllocateItem:function(){
		var datas = Action.getData(IspUtil.contextPath + 'listIEHomepageAllocateSch_all.do?rp=0');
		var items = new Array;
		for(var i=0;i<datas.length;i++){
			var data= datas[i].cell;
			var item = {};
			item.text = data.homepageName;
			item.value = ""+data.homepageId;
			items.push(item); 		
		}
		return items;
	},
	/**
	 * 返回搜索引擎（引用BHO）
	 */
	getBHOSearchInfoItem:function(){
		var datas = Action.getData(IspUtil.contextPath + 'listBHOSearchInfoSch_backuser.do?rp=0');
		var items = new Array;
		for(var i=0;i<datas.length;i++){
			var data= datas[i].cell;
			var item = {};
			item.text = data.company;
			item.value = ""+data.searchid;
			items.push(item); 		
		}
		return items;
	},
	/**
	 * 返回计费ID（引用BHO）
	 */
	getBHOSearchIcafeItem:function(searchId){
		var datas = Action.getData(IspUtil.contextPath + 'listBHOSearchIcafeSch_backuser.do?rp=0&schSearchId='+searchId);
		var items = new Array;
		var item = {};
		item.text = "---请选择---";
		item.value = "";
		items.push(item);
		for(var i=0;i<datas.length;i++){
			var data= datas[i].cell;
			item = {};
			item.text = data.icafe;
			item.value = ""+data.icafe;
			items.push(item); 		
		}
		return items;
	},
	
	isIEHomepageLeague:function(){
		return Action.getObjByUrl(IspUtil.contextPath + 'isIEHomepageLeague_league.do').isIEHomepageLeague;
		
	},
	isIEHomepageBar:function(){
		return Action.getObjByUrl(IspUtil.contextPath + 'listIEBarLeague_bar.do').isIEHomepageBar;
		

	},
	/**
	 * 返回链接名称
	 */
	getLinkNameItem:function(){
		return Action.getItemsByUrl(IspUtil.contextPath + 'commendBarLink_backuser.do?isOpen=false&rp=0','commendId','linkName');
	},
	/**
	 * 用户统计状态
	 */
	getStatStateItems:function(){
		var items = [{text:"测试用户",value:"Test"}
					,{text:"免费用户",value:"Free"}
					,{text:"VIP用户",value:"Vip"}
					,{text:"正式用户",value:"Formal"}
					,{text:"活跃用户",value:"Active"}
					,{text:"休眠用户",value:"Sleep"}];
		return items;
	}
}