123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717 |
- /*if (navigator.userAgent.toLowerCase().match(/MicroMessenger/i) != 'micromessenger' && navigator.userAgent.toLowerCase().match(/Windows Phone/i) != 'windows phone') {
- window.location.href = '/';
- }*/
- function GetQueryString(name)
- {
- var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
- //window.location
- var r = location.search.substr(1).match(reg);
- if(r!=null)return unescape(r[2]); return null;
- }
- KISSY.use('node,io', function(S, Node, IO) {
- var $ = Node.all;
- function loadImages(sources, callback) {
- var count = 0,
- images = {},
- imgNum = 0;
- for (src in sources) {
- imgNum++;
- }
- for (src in sources) {
- images[src] = new Image();
- images[src].onload = function() {
- if (++count >= imgNum) {
- callback(images);
- }
- }
- images[src].src = sources[src];
- }
- }
- loadImages(['tpl/www/images/bg-loader.jpg', 'tpl/www/images/ico-logo.png', 'tpl/www/images/sales-bg-loader.jpg', 'tpl/www/images/ico-sales-logo.png', 'tpl/www/images/recommend-tips.png', 'tpl/www/images/recommend-submit.png', 'tpl/www/images/recommend-logo.png', 'tpl/www/images/icon-jjr.png', 'tpl/www/images/icon-prize.png', 'tpl/www/images/gift_11.png', 'tpl/www/images/gift_01.png'], function() {
- setTimeout(function() {
- $('.loader').addClass('fadeOut').hide();
- $('.user-loader').addClass('fadeOut').hide();
- $('.main-box').addClass('fadeIn');
- $('#loading-style').remove();
- }, 1000);
- });
- var REG = {
- name: /^[a-zA-Z\u4e00-\u9fa5]{2,12}$/,
- phone: /(^(([0\+]\d{2,3}-)?(0\d{2,3})-)(\d{7,8})(-(\d{3,}))?$)|(^0{0,1}1[3|4|5|6|7|8|9][0-9]{9}$)/,
- wxid: /^[a-zA-Z][a-zA-Z0-9_-]{5,19}$/,
- number: /^[+\-]?\d+(\.\d+)?$/,
- idCard:/(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/
- }
- var userStatus={0:'无效', 1: '新客户',2:'已跟进',3:'到访',4 :'认筹',5:'认购',6:'签约', 7:'回款',8: '导入客户'}
- //经纪人注册
- var submit_broker = $('#J_submitReg');
- var companyName = $('.company-name');
- var name = $('#username');
- var phone = $('#phone');
- var job = $('#job');
- var password=$('#password');
- var company = $('#company');
- var agree = $('#agree');
- var DATA = {}
- if (job.val() == 'ZJGS' || job.val() == 'DLGS' || job.val() == 'HZHB' || job.val() == 'HZSP') {
- companyName.show();
- } else {
- companyName.hide();
- }
- job.on('change', function() {
- if (job.val() == 'ZJGS' || job.val() == 'DLGS' || job.val() == 'HZHB' || job.val() == 'HZSP') {
- companyName.show();
- } else {
- companyName.hide();
- }
- });
- submit_broker.on('click', function() {
- //姓名
- if (name.length == 1) {
- var nv = S.trim(name.val());
- if (nv == '') {
- alert('姓名不能为空!');
- return false;
- } else if (name.length > 6) {
- alert('姓名不能超过6个字!');
- return false;
- } else if (!REG.name.test(nv)) {
- alert('请填写正确的姓名!');
- return false;
- }
- }
- //手机
- if (phone.length == 1) {
- var pv = S.trim(phone.val());
- if (pv == '') {
- alert('手机号不能为空!');
- return false;
- } else if (!REG.phone.test(pv)) {
- alert('请填写正确的手机号!');
- return false;
- }
- }
- //密码
- if(password.length==1){
- var psw=S.trim(password.val());
- if(psw==''){
- alert('密码不能为空!');
- return false;
- }else if(psw.length<6 || psw.length>8 || !REG.number.test(psw)){
- alert('密码必须为6到8个数字!');
- return false;
- }
- }
- //职业
- if (job.length == 1) {
- var prv = job.val();
- var prCompany=S.trim(company.val());
- if (prv == 0) {
- alert('请选择您的职业');
- return false;
- }else if (prv == 'ZJGS' || prv == 'DLGS' || prv == 'HZHB' || prv == 'HZSP') {
- if(prCompany==''){
- alert('公司名称不能为空!');
- return false;
- }
- }
- }
- //注册协议
- if (agree.prop('checked') == false) {
- alert('请同意注册协议');
- return false;
- }
-
- var urlUid=GetQueryString("uid");
- if(isNaN(urlUid)||urlUid==null)
- {
- urlUid=0;
- }
- IO.post('index.php?c=register&f=checkphone&phone='+pv+'',function(data) {
- if (data == 0) {
- IO.post('index.php?c=register&f=setok&name='+nv+'&phone='+pv+'&password='+psw+'&job='+prv+'&company='+prCompany+'&ruid='+urlUid,function(data) {
- if (data == 1) {
- alert("注册成功");
- window.location.href = './index.php?c=index';
- } else {
- alert(data);
- }
- });
- } else {
- if (data == 1) {
- alert('手机号为空或已被使用');
- } else {
- alert('参数有误或系统异常,请稍后重试!');
- }
- }
- });
- });
- //在登录页跳转到注册页
- var J_Gotologin = $('#J_GotoReg');
- J_Gotologin.on('click', function() {
- window.location.href = './index.php?c=register';
- });
-
- //经纪人登录
- var J_login = $('#J_login');
- var userpsw=$('#userpsw');
- J_login.on('click', function() {
- if (phone.length == 1) {
- var pv = S.trim(phone.val());
- if (pv == '') {
- alert('手机号不能为空!');
- return false;
- } else if (!REG.phone.test(pv)) {
- alert('请填写正确的手机号!');
- return false;
- }
-
- }
- //密码
- if(userpsw.length==1){
- var ups=S.trim(userpsw.val());
- if(ups==''){
- alert('密码不能为空!');
- return false;
- }else if(ups.length<6 || ups.length>8 || !REG.number.test(ups)){
- alert('密码必须为6到8个数字!');
- return false;
- }
- }
- IO.post('index.php?c=login&f=ok&phone='+pv+'&password='+ups+'', function(data) {
- if (data == 1) {
- window.location.href = './index.php?c=index';
- } else {
- alert(data);
- }
- });
- });
- //个人中心登录
- var J_login_my = $('#J_login_my');
- var username=$('#user-name');
- var userPsw=$('#user-psw');
- J_login_my.on('click', function() {
- if(username.length==1){
- var username=S.trim(username.val());
- if(username==''){
- alert('手机不能为空!');
- return false;
- }
- DATA.username=username;
- }
- //密码
- if(userPsw.length==1){
- var psw=S.trim(userPsw.val());
- if(psw==''){
- alert('密码不能为空!');
- return false;
- }else if(psw.length<6 || psw.length>8 || !REG.number.test(psw)){
- alert('密码必须为6到8个数字!');
- return false;
- }
- DATA.password=psw;
- }
- IO.post('./index.php?c=login', DATA, function(data) {
- if (data.status == 200) {
- location.href = data.url;
- } else {
- alert('密码错误');
- }
- }, 'json');
- });
- //我要推荐提交
- var submitRec = $('#J_submitRec');
- var floor = $('#floor');
- var selorderTime = $('#selorderTime');
- var selorderTime2 = $('#selorderTime2');
- var remark = $('#remark');
- submitRec.on('click', function() {
- //姓名
- if (name.length == 1) {
- var nv = S.trim(name.val());
- if (nv == '') {
- alert('姓名不能为空!');
- return false;
- } else if (name.length > 6) {
- alert('姓名不能超过6个字!');
- return false;
- } else if (!REG.name.test(nv)) {
- alert('请填写正确的姓名!');
- return false;
- }
- }
- //手机
- if (phone.length == 1) {
- var pv = S.trim(phone.val());
- if (pv == '') {
- alert('手机号不能为空!');
- return false;
- } else if (!REG.phone.test(pv)) {
- alert('请填写正确的手机号!');
- return false;
- }
- }
- //意向楼盘
- if (floor.length == 1) {
- var prv = S.trim(floor.val());
- if (prv == 0) {
- alert('请选择您的意向');
- return false;
- }
- }
- //意向楼盘
- if (selorderTime.length == 1) {
- var st = S.trim(selorderTime.val());
- if (st == 0) {
- alert('请输入预约日期');
- return false;
- }
- }
- //意向楼盘
- if (selorderTime2.length == 1) {
- var st2 = selorderTime2.val();
- if (st2 == 0) {
- alert('请选择预约时段');
- return false;
- }
- }
- if (remark.length == 1) {
- var pre = S.trim(remark.val());
- if (pre.length > 50) {
- alert('备注不能超过50个字');
- return false;
- }
- }
- var myDate = new Date();
- var strDate=myDate.getFullYear()+"-"+myDate.getMonth()+"-"+myDate.getDate();
- var strTime=myDate.getHours()+":"+myDate.getMinutes();
- //请求
- IO.post('index.php?c=recommend&f=save&username='+nv+'&cellphone='+pv+'&proname='+prv+'&selorderTime='+strDate+'&selorderTime2='+strTime+'&remark='+pre+'', function(data) {
- if (data == 1) {
- $('.recommend-pop').show();
- $('.pop-bg').show();
- } else {
- alert(data);
- }
- });
- });
- var dialogs = $('#dialog');
- var ad = $('.ad');
- dialogs.on('click', function() {
- ad.addClass('adshow');
- });
- ad.on('click', function() {
- ad.remove('adshow');
- });
- //保存银行卡信息
- var saveCard = $('#J_saveCard');
- var accountName=$('#bankAccount');
- var card = $('#cardCode');
- var bank = $('#bankName');
- saveCard.on('click', function() {
- //户名
- if(accountName.length==1){
- var account=S.trim(accountName.val());
- if(account==''){
- alert('户名不能为空!');
- return false;
- } else if (!REG.name.test(account)) {
- alert('请填写正确的户名!');
- return false;
- }
- }
- //银行卡号
- if (card.length == 1) {
- var num = S.trim(card.val());
- if (num == '') {
- alert('银行卡号不能为空!');
- return false;
- } else if (!REG.number.test(num)) {
- alert('请填写正确的银行号!');
- return false;
- }
- }
- //银行卡名称
- if (bank.length == 1) {
- var name = S.trim(bank.val());
- if (name == '') {
- alert('银行名称不能为空!');
- return false;
- }
- }
- //请求
- IO.post('index.php?c=usercp&f=savebank&bankAccount='+account+'&cardCode='+num+'&bankName='+name+'', function(data) {
- if (data == 1) {
- window.location.href = './index.php?c=commission';
- } else {
- alert(data);
- }
- });
- });
- //佣金提现
- var WJTXSave=$('#J_WJTX_save');
- WJTXSave.on('click',function(){
- var money=$('#txmoney').val();
- var ktxmoney=$('#ktxmoney').val();
- if(ktxmoney==0)
- {
- alert("您还没有可提现金额,需要努力哟!");
- return;
- }
-
- if(isNaN(money)||!REG.number.test(money))
- {
- alert("请输入正确的金额!");
- return;
- }
-
-
- if(parseFloat(ktxmoney)<parseFloat(money)){
- alert("您输入的提现金额“"+money+"”大于当前可提现金额“"+ktxmoney+"”");
- return;
- }
- //请求
- IO.post('index.php?c=commissiontx&f=checkmoney&money='+money+'',function(data) {
- if (data == 0) {
- IO.post('index.php?c=commissiontx&f=txwjok&money='+money+'',function(data){
- if(data==1){
- alert('提现申请成功!');
- window.location.href = './index.php?c=commission';
- }else{
- alert("提现失败:"+data);
- }
- });
- } else {
- if (data == 1) {
- alert('可提现金额不足');
- } else {
- alert('参数有误或系统异常,请稍后重试!'+data);
- }
- }
- });
-
- })
- //编辑个人资料
- var editSave=$('#J_edit_save');
- editSave.on('click',function(){
- //姓名
- if (name.length == 1) {
- var nv = S.trim(name.val());
- if (nv == '') {
- alert('姓名不能为空!');
- return false;
- } else if (name.length > 6) {
- alert('姓名不能超过6个字!');
- return false;
- } else if (!REG.name.test(nv)) {
- alert('请填写正确的姓名!');
- return false;
- }
- }
- //手机
- if (phone.length == 1) {
- var pv = S.trim(phone.val());
- if (pv == '') {
- alert('手机号不能为空!');
- return false;
- } else if (!REG.phone.test(pv)) {
- alert('请填写正确的手机号!');
- return false;
- }
- }
-
- //职业
- if (job.length == 1) {
- var prv = job.val();
- var prCompany=S.trim(company.val());
- if (prv == 0) {
- alert('请选择您的职业');
- return false;
- }else if (job.val() == 'ZJGS' || job.val() == 'DLGS' || job.val() == 'HZHB' || job.val() == 'HZSP') {
- if(prCompany==''){
- alert('公司名称不能为空!');
- return false;
- }
- }
- }
- //请求
- IO.post('index.php?c=usercp&f=ok&name='+nv+'&job='+prv+'&company='+prCompany+'',function(data){
- if(data==1){
- alert('修改成功!');
- }else{
- alert(data);
- }
- });
- })
- //初始化页面高度
- var v_h = null; //记录设备的高度
- function init_pageH(){
- var fn_h = function() {
- if(document.compatMode == 'BackCompat')
- var Node = document.body;
- else
- var Node = document.documentElement;
- return Math.max(Node.scrollHeight,Node.clientHeight);
- }
- var page_h = fn_h();
- // //设置各种模块页面的高度,扩展到整个屏幕高度
- $('.gift').height(page_h);
- $('.regift-page').height(page_h);
- };
- init_pageH();
- //注册有礼添加动画
- setTimeout(function(){
- $('.gift-box').addClass('animated tada');
- },200);
- setTimeout(function(){
- $('.gift-text').addClass('animated fadeInUp');
- },500);
- setTimeout(function(){
- $('.gift-open').addClass('animated fadeInDown');
- },600);
- setTimeout(function(){
- $('.gift-flash-1').addClass('animated flash');
- $('.gift-flash-2').addClass('animated flash');
- $('.gift-flash-3').addClass('animated flash');
- $('.gift-flash-4').addClass('animated flash');
- $('.gift-flash-5').addClass('animated flash');
- },1200);
-
- //打开奖品
- var gift=$('.gift-amount');
- var prize=$('.prize');
- gift.on('click',function(){
- prize.removeClass('animated zoomOut');
- prize.addClass('animated zoomInPrice');
- bg.show();
- })
- //关闭奖品
- var prizeClose=$('.prize-close');
- prizeClose.on('click',function(){
- prize.removeClass('animated zoomInPrice');
- prize.addClass('animated zoomOut');
- bg.hide();
- })
- //分享朋友圈提示
- var share=$('.J_share');
- share.on('click',function(){
- if($('.share-tips').length==0){
- $('body').append('<div class="share-tips"><a href="javascript:;" class="close">关闭</a><img src="/tpl/www/bg-guide.png" alt="" /></div>');
- }
- $('.share-tips').on('click',function(){
- $('.share-tips,.share-tips .close,.share-tips img').remove();
- });
- });
- //案场经理全选
- var checkAll=$('.checkbox-all');
- var checkOne=$('.checkbox-btn .regular-checkbox');
- checkAll.on('click',function(){
- var is_pitch=$(this).prop('checked');
- if(is_pitch){
- checkOne.each(function(){
- $(this).prop('checked',true);
- });
- }else{
- checkOne.each(function(){
- $(this).prop('checked',false);
- });
- }
- });
- //案场经理点击checkbox
- var clients=$('.checkbox-btn');
- clients.on('click',function(){
- checkAll.prop('checked',checkOne.length==checkOne.filter(':checked').length);
- });
- //置业顾问注销
- var logOut=$('.J_logout');
- var ok_delete=$('.J_ok_delete');
- var logoutBox=$('.logout-box');
- var logoutUrl = $('#logoutUrl').val();
- var uid = $('#uid').val();
- logOut.on('click',function(){
- logoutBox.show();
- });
- ok_delete.on('click',function(){
- IO.post(logoutUrl, {uid:uid}, function(data) {
- if (data.status == 200) {
- location.href = data.teamUrl;
- } else {
- alert("注销失败");
- }
- }, 'json');
- });
- //关闭置业顾问注销弹出层
- var Cons_cancel=$('.Cons_cancel');
- Cons_cancel.on('click',function(){
- logoutBox.hide();
- });
- //经纪人信息显示隐藏
- var jjrTitle=$('.jjr-title');
- var jjrHide=$('.jjr-hide');
- var iconDown=$('.icon-down-open-big');
- jjrTitle.on('click',function(){
- jjrHide.toggle();
- iconDown.toggleClass('icon-down-transform');
- });
- //案场经理修改客户状态操作
- var J_save_status = $('.J_save_status');
- var cid = $('#cid').val();
- var zid = $('#zid').val();
- var statusUrl = $('#statusUrl').val();
- J_save_status.on('click', function() {
- var now_status = $('#now_status').val();
- var updated_status = $('#updated_status').val();
- var number_status = updated_status - now_status;
- if (number_status == 1) {
- var DATA = {};
- DATA.customer_id = cid;
- DATA.zid = zid;
- DATA.waid = waid;
- if (updated_status==2) { //已跟进(有意向无意向)
- DATA.status = 2;
- DATA.intent = $('#intent').val();
- //请求
- IO.post(statusUrl, DATA, function(data) {
- if (data.status == 200) {
- $('#now_status').val(data.now_status);
- location.href = data.url;
- } else {
- alert('操作失败');
- }
- }, 'json');
- } else if (updated_status==6) {//签约
- DATA.intent = 1;
- DATA.price = $('#price').val();
- DATA.status = 6;
- IO.post(statusUrl, DATA, function(data) {
- if (data.status == 200) {
- $("#now_status").val(data.now_status);
- location.href = data.url;
- } else {
- alert('操作失败');
- }
- }, 'json');
- }else{
- var DATA = {};
- DATA.customer_id = cid;
- DATA.zid = zid;
- DATA.waid = waid;
- DATA.intent = 1;
- DATA.status = updated_status;
- IO.post(statusUrl, DATA, function(data) {
- if (data.status == 200) {
- $("#now_status").val(data.now_status);
- location.href = data.url;
- } else {
- alert('操作失败');
- }
- }, 'json');
- }
- } else {
- alert('请先确认上步操作')
- }
- });
- });
- function direct(url,frameid,isparent)
- {
- url = url.replace(/&/g,"&");
- if(!isparent || isparent == "" || isparent == "undefined")
- {
- if(frameid)
- {
- window.frames[frameid].location.href = url;
- }
- else
- {
- window.location.href=url;
- }
- }
- else
- {
- if(!frameid || frameid == "" || frameid == "undefined")
- {
- parent.window.location.href = url;
- }
- else
- {
- window.parent.frames[frameid].location.href = url;
- }
- }
- }
- //设定多长时间运行脚本
- //参数 time 是时间单位是毫秒,为0时表示直接运行 大于0小于10毫秒将自动*1000
- //参数 js 要运行的脚本
- function eval_js(time,js)
- {
- time = parseFloat(time);
- if(time < 0.01)
- {
- eval(js);
- }
- else
- {
- if(time < 10)
- {
- time = time*1000;
- }
- window.setTimeout(js,time);
- }
- }
- //编码网址
- function url_encode(str)
- {
- return transform(str);
- }
|