/** * Created by Administrator on 2021/4/5. */ define(['jquery', "template", "Tools", 'swiper', 'itemsApi', 'swiper'], function ($, template, Tools ,Swiper) { //数据存储 var module = { data: { //焦点图数据 focusListTop: [], showImgInformationDetail:'', loginNow:'', isFirst:'', timer:null, timer2:null, biddinglistInformationDetailLength:-1, biddingTimeType:0, biddinglistInformationDetail:[], timeConfig:0.00 }, }; var tools = new Tools(); module.init = function (page) { //获取焦点图信息 tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true); //底部友情链接 tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true); //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号) tools.getWebConfig(); module.data.loginNow = tools.getCookie('Admin-Token'); //浏览次数 tools.doGet(outProject, {id:getQueryVariable('id')}, module.projectNum,true); setTimeout(function(){//项目基本信息 tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true); },100) //焦点图 setTimeout(function () { module.swiperBanner(); },5000) setTimeout(function(){//项目基本信息 tools.doGet(showImg + '/'+getQueryVariable('id'), {}, module.showImgInformation,true); },100) tools.doGet(webConfig, {}, module.webConfigInformation, true) }; //焦点图数据 module.focusNewsTop = function (data) { if (data.code == 200) { let focusArray = []; if(data.data.length<1){ focusArray.push({ picUrl:'../../../static/images/banner1.png' },{ picUrl:'../../../static/images/banner2.png' },{ picUrl:'../../../static/images/banner3.png' }) }else{ data.data.forEach(res=>{ focusArray.push({ picUrl:'/api'+res.picUrl }) }) } module.data.focusListTop = focusArray; var bannerFocusDataTop = template('bannerFocusDataTop', module.data); $("#bannerFocusTopContent").html(bannerFocusDataTop); new Swiper('#bannerFocusWrapTop', { paginationClickable: true, autoplay : 4000, loop:true }) } } //获取地址栏参数 function getQueryVariable(variable){ var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i?' module.data.timeConfig = parseFloat(content[8].configValue); module.data.titleConfig = content[9].configValue; module.data.importantTitle = content[7].configName+':'+ content[7].configValue.substr(3).substr(0,(content[7].configValue.substr(3).length-4)); module.data.know = content[6].configValue; $("#know").html(content[6].configValue); // + '' + content[6].configValue } } //底部友情链接 module.bottomFriendsLinks = function (data) { if (data.code == 200) { var content = data.data; console.log(content) module.data.friendsLinksList = content; var friendsLinksData = template('friendsLinksData', module.data); $("#friendsLinksContent").html(friendsLinksData); } } module.dataCompare = function(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime){ // console.log('aaaaaaaaaaa') var signupStartTime = signupStartTime; var signupStopTime = signupStopTime; var biddingStartTime = biddingStartTime; var biddingStopTime = biddingStopTime; var nowTime = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date"))); // console.log(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date"))) var beginTimes=signupStartTime.substring(0,10).split('-'); var endTimes=signupStopTime.substring(0,10).split('-'); var biddingBeginTimes=biddingStartTime.substring(0,10).split('-'); var biddingEndTimes=biddingStopTime.substring(0,10).split('-'); signupStartTime=beginTimes[1]+'/'+beginTimes[2]+'/'+beginTimes[0]+' '+signupStartTime.substring(10,19); signupStopTime=endTimes[1]+'/'+endTimes[2]+'/'+endTimes[0]+' '+signupStopTime.substring(10,19); biddingStartTime=biddingBeginTimes[1]+'/'+biddingBeginTimes[2]+'/'+biddingBeginTimes[0]+' '+biddingStartTime.substring(10,19); biddingStopTime=biddingEndTimes[1]+'/'+biddingEndTimes[2]+'/'+biddingEndTimes[0]+' '+biddingStopTime.substring(10,19); //时间差 var leftTime = Date.parse(biddingStopTime)-nowTime; //报名开始时间差 var signupLeftTime = Date.parse(signupStartTime)-nowTime; //报名结束时间差 var signDownLeftTime = Date.parse(signupStopTime)-nowTime; //定义变量 d,h,m,s保存倒计时的时间 var d,h,m,s; if(Date.parse(biddingStartTime)距竞价结束还有:'+d+'天'+h+''+m+''+s+'秒') $('#countType').html('竞价中') $('#countDown').html('距竞价结束还有:'+d+''+h+''+m+''+s+'秒') }else if (nowTime>Date.parse(biddingStopTime)){ //竞价结束 $('#countType').html('') $('#countDown').html('竞价结束') // document.getElementById('swiperType').style.display = 'none'; document.getElementById('biddingTable').style.display = 'table'; document.getElementById('biddingTitle').style.display = 'none'; module.data.biddingTimeType = 2; }else if (nowTime距竞价开始还有:'+d+'天'+h+''+m+''+s+'秒') //竞价暂未开始 document.getElementById('biddingTitle').innerHTML = '竞价暂未开始...'; module.data.biddingTimeType = 3; } if(Date.parse(signupStartTime)距报名结束还有:'+d+'天'+h+''+m+''+s+'秒') }else if (nowTime>Date.parse(signupStopTime)){ //报名结束 module.data.signupTimeType = 2; }else if (nowTime距报名开始还有:'+d+'天'+h+''+m+''+s+'秒') } //moneyText:出价输入框 //moneyBtn:出价按钮 //signYes:已报名显示文字 //signNo:未报名显示文字 //signBtn:已登录但未报名跳转报名按钮 //signBtn2:未登录跳转登录按钮 //noAction:未开始显示文字 if(module.data.loginNow){ //判断是否登录(已登录) if(module.data.signup == 1){ //判断是否报名(已报名) if( module.data.biddingTimeType == 1 ){ //判断当前竞价状态(竞价中) document.getElementById('signYes').style.display = 'none'; document.getElementById('signNo').style.display = 'none'; document.getElementById('signBtn').style.display = 'none'; document.getElementById('signBtn2').style.display = 'none'; document.getElementById('noAction').style.display = 'none'; document.getElementById('moneyText').style.display = 'table-row'; document.getElementById('moneyBtn').style.display = 'flex'; }else if( module.data.biddingTimeType == 3 ){ //判断当前竞价状态(竞价未开始) document.getElementById('moneyText').style.display = 'none'; document.getElementById('moneyBtn').style.display = 'none'; document.getElementById('signNo').style.display = 'none'; document.getElementById('signBtn').style.display = 'none'; document.getElementById('signBtn2').style.display = 'none'; document.getElementById('noAction').style.display = 'none'; document.getElementById('signYes').style.display = 'block'; }else{ //判断当前竞价状态(竞价结束) $('.swiperInput').css('display','none'); $('#timeDown').css('display','none'); clearInterval(module.data.timeDown) } }else{ //判断是否报名(未报名) if( module.data.signupTimeType == 1 ){ //判断当前报名状态(正在报名) document.getElementById('moneyText').style.display = 'none'; document.getElementById('moneyBtn').style.display = 'none'; document.getElementById('signNo').style.display = 'none'; document.getElementById('signBtn2').style.display = 'none'; document.getElementById('noAction').style.display = 'none'; document.getElementById('signYes').style.display = 'none'; document.getElementById('signBtn').style.display = 'block'; }else if( module.data.signupTimeType == 3 ){ //判断当前报名状态(报名未开始) document.getElementById('moneyText').style.display = 'none'; document.getElementById('moneyBtn').style.display = 'none'; document.getElementById('signBtn2').style.display = 'none'; document.getElementById('signYes').style.display = 'none'; document.getElementById('signBtn').style.display = 'none'; document.getElementById('signNo').style.display = 'none'; document.getElementById('noAction').style.display = 'block'; }else{ //判断当前报名状态(报名结束) document.getElementById('moneyText').style.display = 'none'; document.getElementById('moneyBtn').style.display = 'none'; document.getElementById('signBtn2').style.display = 'none'; document.getElementById('noAction').style.display = 'none'; document.getElementById('signYes').style.display = 'none'; document.getElementById('signBtn').style.display = 'none'; document.getElementById('signNo').style.display = 'block'; } } }else{ //判断是否登录(未登录) if( module.data.biddingTimeType == 2 ){//判断当前竞价状态(竞价结束) $('.swiperInput').css('display','none') }else{ document.getElementById('signBtn2').style.display = 'block'; } } if(module.data.outProjectInformationDetail.biddingType != '自由竞价' && module.data.biddingTimeType != 2){ document.getElementById('biddingTable').style.display = 'table'; document.getElementById('biddingTitle').style.display = 'none'; } } module.projectNum = function(data){ console.log(data) } module.signup = function(data){ console.log(data) module.data.signup = data.data; module.data.isFirst = data.signup.isFirst; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } goBond = function(){ var nowTime = Date.parse(new Date()); var signupStopTime = Date.parse(module.data.outProjectInformationDetail.signupStopTime) if (nowTime>signupStopTime){ tools.initError('报名已结束!'); return; } if (module.data.signHistory == 1){ tools.initError('已报名,请耐心等待审核结果!'); return; } tools.doGet(userData, {}, module.userData); } module.userData = function(data){ if (data.code == 200) { var content = data.user; //console.log(content) module.data.userId = content.userId; tools.doGet(userMember + '/' + content.userId, {}, module.userMember);//memberType 1个人 2单位 } } module.userMember = function(data){ if (data.code == 200) { var content = data.data; if (content.auditStatus == 'Y'){ tools.skip('bond.html?id='+getQueryVariable('id')) }else{ tools.initError("交易中心审核注册信息后方可进行报名!"); } } } //项目基本信息 module.outProjectInformation = function (data) { if (data.code == 200) { var content = data.data; module.data.biddingStopTime = content.biddingStopTime; for(var i = 0 ; i < content.fileUrlList.length ; i++){ content.fileUrlList[i].fileUrl = serverApi+content.fileUrlList[i].fileUrl; } module.data.outProjectInformationDetail = content; setTimeout(function(){ var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); var timName = document.getElementById('timeDown'); if(timName){ var t = 3; module.data.timeDown = setInterval(function(){ // console.log($('#countType').html()) // if ($('#countType').html()!='竞价中'){ // clearInterval(module.data.timeDown) // document.getElementById('timeDown').style.display = 'none'; // return; // } timName.innerHTML = t+'秒后自动刷新'; t--; document.getElementById('timeDown').style.display = 'inline-block'; if(t<0){ t = 3; let biddingStartTime = content.biddingStartTime; let biddingStopTime = content.biddingStopTime; var nowTime = Date.parse(new Date()); // if(Date.parse(biddingStartTime)距竞价结束还有:0天0'+m+''+s+'秒') if(module.data.loginNow){ //判断是否登录(已登录) if(module.data.signup == 1){ //判断是否报名(已报名) if( module.data.biddingTimeType == 1 ){ //判断当前竞价状态(竞价中) document.getElementById('signYes').style.display = 'none'; document.getElementById('signNo').style.display = 'none'; document.getElementById('signBtn').style.display = 'none'; document.getElementById('signBtn2').style.display = 'none'; document.getElementById('noAction').style.display = 'none'; document.getElementById('moneyText').style.display = 'table-row'; document.getElementById('moneyBtn').style.display = 'flex'; }else if( module.data.biddingTimeType == 3 ){ //判断当前竞价状态(竞价未开始) document.getElementById('moneyText').style.display = 'none'; document.getElementById('moneyBtn').style.display = 'none'; document.getElementById('signNo').style.display = 'none'; document.getElementById('signBtn').style.display = 'none'; document.getElementById('signBtn2').style.display = 'none'; document.getElementById('noAction').style.display = 'none'; document.getElementById('signYes').style.display = 'block'; }else{ //判断当前竞价状态(竞价结束) $('.swiperInput').css('display','none'); $('#timeDown').css('display','none'); clearInterval(module.data.timeDown) } }else{ //判断是否报名(未报名) if( module.data.signupTimeType == 1 ){ //判断当前报名状态(正在报名) document.getElementById('moneyText').style.display = 'none'; document.getElementById('moneyBtn').style.display = 'none'; document.getElementById('signNo').style.display = 'none'; document.getElementById('signBtn2').style.display = 'none'; document.getElementById('noAction').style.display = 'none'; document.getElementById('signYes').style.display = 'none'; document.getElementById('signBtn').style.display = 'block'; }else if( module.data.signupTimeType == 3 ){ //判断当前报名状态(报名未开始) document.getElementById('moneyText').style.display = 'none'; document.getElementById('moneyBtn').style.display = 'none'; document.getElementById('signBtn2').style.display = 'none'; document.getElementById('signYes').style.display = 'none'; document.getElementById('signBtn').style.display = 'none'; document.getElementById('signNo').style.display = 'none'; document.getElementById('noAction').style.display = 'block'; }else{ //判断当前报名状态(报名结束) document.getElementById('moneyText').style.display = 'none'; document.getElementById('moneyBtn').style.display = 'none'; document.getElementById('signBtn2').style.display = 'none'; document.getElementById('noAction').style.display = 'none'; document.getElementById('signYes').style.display = 'none'; document.getElementById('signBtn').style.display = 'none'; document.getElementById('signNo').style.display = 'block'; } } }else{ //判断是否登录(未登录) if( module.data.biddingTimeType == 2 ){//判断当前竞价状态(竞价结束) $('.swiperInput').css('display','none') }else{ document.getElementById('signBtn2').style.display = 'block'; } } console.log(s+'-------------'+m) if (s < 1 && m < 1){ console.log("竞价结束22222222222") tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, function(data){ if (data.code == 200) { var nowDate = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date"))); module.data.outProjectInformationDetail.biddingStopTime = data.data let timeNew = Date.parse(data.data) + 0 - nowDate; if (timeNew > 0) { module.data.outProjectInformationDetail.biddingStopTime = data.data; // module.dataCompare(signupStartTime,signupStopTime,biddingStartTime,data.data); }else{ $('#countType').html('') $('#countDown').html('竞价结束') // document.getElementById('swiperType').style.display = 'none'; document.getElementById('biddingTable').style.display = 'table'; document.getElementById('biddingTitle').style.display = 'none'; module.data.biddingTimeType = 2; return; } } },true); }else if(s%2 == 0&¢erTime!=0){ tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, module.getBiddingStopTime,true); } }else{ if (!signupStartTime){console.log('缺失报名开始时间');return;} if (!signupStopTime){console.log('缺失报名结束时间');return;} if (!biddingStartTime){console.log('缺失竞价开始时间');return;} if (!biddingStopTime){console.log('缺失竞价结束时间');return;} module.dataCompare(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime); } if(module.data.outProjectInformationDetail.biddingType == '自由竞价' && module.data.biddingTimeType != 2){ document.getElementById('biddingTable').style.display = 'none'; document.getElementById('biddingTitle').style.display = 'block'; } },1000) //倒计时 // module.data.timer2 = setInterval(function(){ // //交易项目竞价记录 // tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformationNew,true); // // },10000) if(module.data.loginNow){ //判断是否报名 tools.doGet(signup, {projectId:getQueryVariable('id'),depositStatus:'1',memberId:tools.getCookie('memberId')}, module.signup); tools.doGet(signup, {projectId:getQueryVariable('id'),memberId:tools.getCookie('memberId')}, module.signup2); } } } module.getBiddingStopTime = function(data){ if (data.code == 200) { $('#stopTime').html(data.data) module.data.outProjectInformationDetail.biddingStopTime = data.data } } module.signup2 = function(data){ if (data.code == 200) { module.data.signHistory = data.data } } //标的物图片 module.showImgInformation = function (data) { if (data.code == 200) { var content = data.data; console.log(content) var contentList = []; for(var i = 0 ; i < content.length ; i++){ contentList[i] = serverApi+content[i].fileUrl; } module.data.showImgInformationDetail = contentList; console.log(contentList) var showImgInformationData = template('showImgInformationData', module.data); $("#tabDetail2").html(showImgInformationData); } } //竞价记录 module.biddinglistInformation = function (data) { if (data.code == 200) { var content = data.rows; if(module.data.biddinglistInformationDetailLength == content.length){ return; } console.log(module.data.outProjectInformationDetail.biddingDirect) console.log(module.data.outProjectInformationDetail.biddingType) setTimeout(function(){ if(module.data.outProjectInformationDetail.biddingType == '阶梯竞价'||module.data.outProjectInformationDetail.biddingType == '2'){ if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'||module.data.outProjectInformationDetail.biddingDirect == '2'){ if (content.length>0){ let money = $('#money').val()?$('#money').val():content[0].money if(content[0].money<=money) { document.getElementById('money').value = parseFloat(parseFloat(content[0].money) - parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2); } }else{ document.getElementById('money').value = parseFloat(parseFloat(module.data.outProjectInformationDetail.price)).toFixed(2); // + parseFloat(module.data.outProjectInformationDetail.ladderPrice) } }else{ if (content.length>0){ let money = $('#money').val()?$('#money').val():content[0].money if(content[0].money>=money){ document.getElementById('money').value = parseFloat(parseFloat(content[0].money) + parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2); } }else{ document.getElementById('money').value = parseFloat(parseFloat(module.data.outProjectInformationDetail.price)).toFixed(2); // + parseFloat(module.data.outProjectInformationDetail.ladderPrice) } } } },2000) module.data.biddinglistInformationDetail = content; module.data.biddinglistInformationDetailLength = content.length; var biddinglistInformationData = template('biddinglistInformationData', module.data); $("#tabDetail4").html(biddinglistInformationData); if (content.length>0){$("#nowMoney").html(content[0].money);} } } //竞价记录 module.biddinglistInformationNew = function (data) { if (data.code == 200) { var content = data.rows; console.log(module.data.biddinglistInformationDetail.length+'----------------------'+content.length) if (module.data.biddinglistInformationDetailLength previewSwiper.activeIndex) { var thumbsPerNav = Math.floor(previewSwiper.width / activeNav.width()) - 1 previewSwiper.swipeTo(activeNav.index() - thumbsPerNav) } else { previewSwiper.swipeTo(activeNav.index()) } } } } //切换 tabClick = function(type){ //标的物介绍 for (var i = 0 ; i < 4 ; i++){ document.getElementById('tabDetail'+(i+1)).style.display = 'none'; document.getElementById('tab'+(i+1)).classList = ''; } document.getElementById('tabDetail'+type).style.display = 'block'; document.getElementById('tab'+type).classList = 'active'; } //挂牌价格 module.unitDictionaries = function (data) { if (data.code == 200) { var content = data.data; var unit = content[(module.data.outProjectInformationDetail.unit-1)].dictLabel; module.data.outProjectInformationDetail.unit = unit; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } //出价 module.biddingSubmitMethod = function (data2) { let newMoney; if (data2.data&&data2.code==200){ console.log(data2) newMoney = data2.data; }else{ newMoney = module.data.outProjectInformationDetail.price; } if ($('#money').val()<=0){ tools.initError('请正常出价!'); return; } if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'){ //判断用户出价不能高于挂牌价 if(module.data.outProjectInformationDetail.price<$('#money').val()){ tools.initError('出价不能高于挂牌价'); return; }else{ //判断当前竞价方式 if (module.data.outProjectInformationDetail.biddingType=='阶梯竞价' || module.data.outProjectInformationDetail.biddingType=='公开竞价'){ //判断当前是否有人出价 if (data2.data){ //判断用户出价不能高于当前出价最低价格 if(newMoney <= $('#money').val()){ tools.initError('不能高于当前最低价格!'); return; } } } } }else{ if(module.data.outProjectInformationDetail.price>$('#money').val()){ tools.initError('出价不能低于挂牌价'); return; }else{ //判断当前竞价方式 if (module.data.outProjectInformationDetail.biddingType=='阶梯竞价' || module.data.outProjectInformationDetail.biddingType=='公开竞价'){ //判断当前是否有人出价 if (data2.data){ //判断用户出价不能低于当前出价最高价格 if(newMoney >= $('#money').val()){ tools.initError('不能低于当前最高价格!'); return; } } } } } var data = {}; var projectId = getQueryVariable('id'); var memberId = tools.getCookie('memberId'); var userId = tools.getCookie('userId'); var userAccount = tools.getCookie('phone'); var userName = tools.getCookie('userName'); var money = parseFloat($('#money').val()); var loginTime = Date.now($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")); data['projectId'] = projectId; data['memberId'] = memberId; data['userId'] = userId; data['userAccount'] = userAccount; data['userName'] = userName; data['money'] = money; data['loginTime'] = loginTime; tools.doPost(biddingSubmit, data, module.biddingSubmitOpen); } module.biddingSubmitOpen = function(){ tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, function(data){ if (data.code == 200) { var nowDate = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date"))); module.data.outProjectInformationDetail.biddingStopTime = data.data let timeNew = Date.parse(data.data) + 0 - nowDate; if (timeNew > 0) { module.data.outProjectInformationDetail.biddingStopTime = data.data; module.dataCompare( module.data.outProjectInformationDetail.signupStartTime, module.data.outProjectInformationDetail.signupStopTime, module.data.outProjectInformationDetail.biddingStartTime,data.data); }else{ $('#countType').html('') $('#countDown').html('竞价结束') // document.getElementById('swiperType').style.display = 'none'; document.getElementById('biddingTable').style.display = 'table'; document.getElementById('biddingTitle').style.display = 'none'; module.data.biddingTimeType = 2; return; } } },true); tools.initError('出价成功'); // $('#money').val(0) } //经济类型 module.economicTypeDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.economicType!='') { var content = data.data; if(content[(module.data.outProjectInformationDetail.economicType-1)] != undefined){ var economicType = content[(module.data.outProjectInformationDetail.economicType-1)].dictLabel; module.data.outProjectInformationDetail.economicType = economicType; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } } //项目类型 module.projectNumberDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.projectNumber!='') { var content = data.data; var projectNumber = content.filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.projectNumber; })[0].dictLabel; module.data.outProjectInformationDetail.projectNumber = projectNumber; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } //农地性质 module.projectTypeDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.projectType!='') { var content = data.data; console.log(content) console.log((module.data.outProjectInformationDetail.projectType-1)) var projectType = content[(module.data.outProjectInformationDetail.projectType-1)].dictLabel; module.data.outProjectInformationDetail.projectType = projectType; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } //前次转出方式 module.oneoutDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.oneout!='') { var content = data.data; if(module.data.outProjectInformationDetail.oneout == 0){ module.data.outProjectInformationDetail.oneout = '无'; }else{ var oneout = content[(module.data.outProjectInformationDetail.oneout-1)].dictLabel; module.data.outProjectInformationDetail.oneout = oneout; } var rollout = content[(module.data.outProjectInformationDetail.rollout-1)].dictLabel; module.data.outProjectInformationDetail.rollout = rollout; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } //面积单位 module.areaDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.allCountUnit!='') { var content = data.data; var allCountUnit = content[(module.data.outProjectInformationDetail.allCountUnit-1)].dictLabel; module.data.outProjectInformationDetail.allCountUnit = allCountUnit; if(module.data.outProjectInformationDetail.subjectList.length>0){ for(var i = 0 ; i < module.data.outProjectInformationDetail.subjectList.length ; i++){ module.data.outProjectInformationDetail.subjectList[i].areaUnit = content[(module.data.outProjectInformationDetail.subjectList[i].areaUnit-1)].dictLabel; } } var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } //支付方式 module.paymentTypeDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.paymentType!='') { var content = data.data; var paymentType = content[(module.data.outProjectInformationDetail.paymentType-1)].dictLabel; module.data.outProjectInformationDetail.paymentType = paymentType; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } //缴纳形式 module.depositPaymentTypeDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.depositPaymentType!='') { var content = data.data; var depositPaymentType = content[(module.data.outProjectInformationDetail.depositPaymentType-1)].dictLabel; module.data.outProjectInformationDetail.depositPaymentType = depositPaymentType; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } //交易方式 module.transactionDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.dealType!='') { var content = data.data; var dealType = content[(module.data.outProjectInformationDetail.dealType-1)].dictLabel; module.data.outProjectInformationDetail.dealType = dealType; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } //竞价方式 module.biddingTypeDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.biddingType!='') { var content = data.data; var biddingType = content[(module.data.outProjectInformationDetail.biddingType-1)].dictLabel; module.data.outProjectInformationDetail.biddingType = biddingType; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } //系统是否 module.expireTypeDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.expire!='') { var content = data.data; var expire = content[(module.data.outProjectInformationDetail.expire-1)].dictLabel; module.data.outProjectInformationDetail.expire = expire; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } //系统是否 module.biddingDirectDictionaries = function (data) { if (data.code == 200 && module.data.outProjectInformationDetail.biddingDirect!='') { var content = data.data; var biddingDirect = content[(module.data.outProjectInformationDetail.biddingDirect-1)].dictLabel; module.data.outProjectInformationDetail.biddingDirect = biddingDirect; var outProjectInformationData = template('outProjectInformationData', module.data); $("#outProjectInformationContent").html(outProjectInformationData); } } changeProMoney = function(){ tools.doGet(projectNewBidMoney+getQueryVariable('id'), {}, module.biddingSubmitMethod); } changeProMoneyFirst = function(){ tools.doGet(projectNewBidMoney+getQueryVariable('id'), {}, module.biddingSubmitMethodFirst); } module.biddingSubmitMethodFirst = function (data) { if (data.code == 200) { let newMoney; if (data.data){ newMoney = data.data; }else{ newMoney = module.data.outProjectInformationDetail.price; } console.log(newMoney); var data = {}; var projectId = getQueryVariable('id'); var memberId = tools.getCookie('memberId'); var userId = tools.getCookie('userId'); var userAccount = tools.getCookie('phone'); var userName = tools.getCookie('userName'); var money = parseFloat(newMoney); // var loginTime = tools.getNowFormatDate(); var loginTime = Date.now($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")); data['projectId'] = projectId; data['memberId'] = memberId; data['userId'] = userId; data['userAccount'] = userAccount; data['userName'] = userName; data['money'] = money; data['loginTime'] = loginTime; tools.doPost(biddingSubmit, data, module.biddingSubmitOpen); } } //向上加价 upMoney = function(){ if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'){ if (module.data.biddinglistInformationDetail.length<1){ if(module.data.outProjectInformationDetail.price <= $('#money').val()){ tools.initError('出价不能高于挂牌价格'); return; } }else{ if(module.data.biddinglistInformationDetail[0].money <= (parseFloat($('#money').val())+parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2)){ tools.initError('出价不能高于当前出价最低价格'); return; } } }else{ if (module.data.biddinglistInformationDetail.length<1){ if(module.data.outProjectInformationDetail.price>$('#money').val()){ tools.initError('出价不能低于挂牌价格'); return; } }else{ if(module.data.biddinglistInformationDetail[0].money>=$('#money').val()){ tools.initError('出价不能低于当前出价最高价格'); return; } } } $('#money').val() == null||$('#money').val() == ''?$('#money').val(0):''; console.log($('#money').val()) module.data.outProjectInformationDetail.ladderPrice?$('#money').val((parseFloat($('#money').val())+parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2)):document.getElementById('money').value += 1 } //向下降价 downMoney = function(){ if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'){ if (module.data.biddinglistInformationDetail.length<1){ if(module.data.outProjectInformationDetail.price<$('#money').val()){ tools.initError('出价不能高于挂牌价格'); return; } }else{ if(module.data.biddinglistInformationDetail[0].money<$('#money').val()){ tools.initError('出价不能高于当前出价最低价格'); return; } } }else{ if (module.data.biddinglistInformationDetail.length<1){ if(module.data.outProjectInformationDetail.price>=$('#money').val()){ tools.initError('出价不能低于挂牌价格'); return; } }else{ if(module.data.biddinglistInformationDetail[0].money>=(parseFloat($('#money').val())-parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2)){ tools.initError('出价不能低于当前出价最高价格'); return; } } } $('#money').val() == null?$('#money').val(0):''; if ($('#money').val() == 0)return; module.data.outProjectInformationDetail.ladderPrice?$('#money').val((parseFloat($('#money').val())-parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2)):document.getElementById('money').value -= 1 } moneyChange = function(){ if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'){ if(module.data.outProjectInformationDetail.price<$('#money').val()){ $('#money').val(module.data.outProjectInformationDetail.price-1); } } } //登陆跳转 goLogin = function(){ tools.initDialog('登陆提示', '登陆后可参与竞价,是否登录?', function () { tools.skip('../login/login.html') }, '登录', function () { }, "取消") } return module; });