网站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

1098 lines
53 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", 'swiper', 'itemsApi', 'swiper'], function ($, template, Tools ,Swiper) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //焦点图数据
  9. focusListTop: [],
  10. showImgInformationDetail:'',
  11. loginNow:'',
  12. isFirst:'',
  13. timer:null,
  14. timer2:null,
  15. biddinglistInformationDetailLength:-1,
  16. biddingTimeType:0,
  17. biddinglistInformationDetail:[],
  18. timeConfig:0.00
  19. },
  20. };
  21. var tools = new Tools();
  22. module.init = function (page) {
  23. //获取焦点图信息
  24. tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
  25. //底部友情链接
  26. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  27. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  28. tools.getWebConfig();
  29. module.data.loginNow = tools.getCookie('Admin-Token');
  30. //浏览次数
  31. tools.doGet(outProject, {id:getQueryVariable('id')}, module.projectNum,true);
  32. setTimeout(function(){//项目基本信息
  33. tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
  34. },100)
  35. //焦点图
  36. setTimeout(function () {
  37. module.swiperBanner();
  38. },5000)
  39. setTimeout(function(){//项目基本信息
  40. tools.doGet(showImg + '/'+getQueryVariable('id'), {}, module.showImgInformation,true);
  41. },100)
  42. tools.doGet(webConfig, {}, module.webConfigInformation, true)
  43. };
  44. //焦点图数据
  45. module.focusNewsTop = function (data) {
  46. if (data.code == 200) {
  47. let focusArray = [];
  48. if(data.data.length<1){
  49. focusArray.push({
  50. picUrl:'../../../static/images/banner1.png'
  51. },{
  52. picUrl:'../../../static/images/banner2.png'
  53. },{
  54. picUrl:'../../../static/images/banner3.png'
  55. })
  56. }else{
  57. data.data.forEach(res=>{
  58. focusArray.push({
  59. picUrl:'/api'+res.picUrl
  60. })
  61. })
  62. }
  63. module.data.focusListTop = focusArray;
  64. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  65. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  66. new Swiper('#bannerFocusWrapTop', {
  67. paginationClickable: true,
  68. autoplay : 4000,
  69. loop:true
  70. })
  71. }
  72. }
  73. //获取地址栏参数
  74. function getQueryVariable(variable){
  75. var query = window.location.search.substring(1);
  76. var vars = query.split("&");
  77. for (var i=0;i<vars.length;i++) {
  78. var pair = vars[i].split("=");
  79. if(pair[0] == variable){return pair[1];}
  80. }
  81. return(false);
  82. }
  83. //网站配置信息
  84. module.webConfigInformation = function (data) {
  85. if (data.code == 200) {
  86. var content = data.data;
  87. console.log(content)
  88. //document.getElementById('time').innerHTML = '延时周期:'+content[8].configValue+content[8].remark+'<i class="wh">?</i>'
  89. module.data.timeConfig = parseFloat(content[8].configValue);
  90. module.data.titleConfig = content[9].configValue;
  91. module.data.importantTitle = content[7].configName+':'+ content[7].configValue.substr(3).substr(0,(content[7].configValue.substr(3).length-4));
  92. module.data.know = content[6].configValue;
  93. $("#know").html(content[6].configValue);
  94. // + '<span style="margin-left: 10px;"></span>' + content[6].configValue
  95. }
  96. }
  97. //底部友情链接
  98. module.bottomFriendsLinks = function (data) {
  99. if (data.code == 200) {
  100. var content = data.data;
  101. console.log(content)
  102. module.data.friendsLinksList = content;
  103. var friendsLinksData = template('friendsLinksData', module.data);
  104. $("#friendsLinksContent").html(friendsLinksData);
  105. }
  106. }
  107. module.dataCompare = function(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime){
  108. // console.log('aaaaaaaaaaa')
  109. var signupStartTime = signupStartTime;
  110. var signupStopTime = signupStopTime;
  111. var biddingStartTime = biddingStartTime;
  112. var biddingStopTime = biddingStopTime;
  113. var nowTime = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")));
  114. // console.log(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")))
  115. var beginTimes=signupStartTime.substring(0,10).split('-');
  116. var endTimes=signupStopTime.substring(0,10).split('-');
  117. var biddingBeginTimes=biddingStartTime.substring(0,10).split('-');
  118. var biddingEndTimes=biddingStopTime.substring(0,10).split('-');
  119. signupStartTime=beginTimes[1]+'/'+beginTimes[2]+'/'+beginTimes[0]+' '+signupStartTime.substring(10,19);
  120. signupStopTime=endTimes[1]+'/'+endTimes[2]+'/'+endTimes[0]+' '+signupStopTime.substring(10,19);
  121. biddingStartTime=biddingBeginTimes[1]+'/'+biddingBeginTimes[2]+'/'+biddingBeginTimes[0]+' '+biddingStartTime.substring(10,19);
  122. biddingStopTime=biddingEndTimes[1]+'/'+biddingEndTimes[2]+'/'+biddingEndTimes[0]+' '+biddingStopTime.substring(10,19);
  123. //时间差
  124. var leftTime = Date.parse(biddingStopTime)-nowTime;
  125. //报名开始时间差
  126. var signupLeftTime = Date.parse(signupStartTime)-nowTime;
  127. //报名结束时间差
  128. var signDownLeftTime = Date.parse(signupStopTime)-nowTime;
  129. //定义变量 d,h,m,s保存倒计时的时间
  130. var d,h,m,s;
  131. if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){
  132. //正在竞价
  133. // console.log('正在竞价')
  134. module.data.biddingTimeType = 1;
  135. if(module.data.outProjectInformationDetail.biddingType == '自由竞价'){
  136. document.getElementById('biddingTable').style.display = 'none';
  137. document.getElementById('biddingTitle').style.display = 'block';
  138. document.getElementById('biddingTitle').innerHTML = '竞价进行中...';
  139. }
  140. // document.getElementById('swiperType').style.display = 'block';
  141. d = Math.floor(leftTime/1000/60/60/24);
  142. h = Math.floor(leftTime/1000/60/60%24);
  143. m = Math.floor(leftTime/1000/60%60);
  144. s = Math.floor(leftTime/1000%60);
  145. // console.log('<span>距竞价结束还有:'+d+'</span>天<span>'+h+'</span>时<span>'+m+'</span>分<span>'+s+'</span>秒')
  146. $('#countType').html('竞价中')
  147. $('#countDown').html('<span>距竞价结束还有:'+d+'</span>天<span>'+h+'</span>时<span>'+m+'</span>分<span>'+s+'</span>秒')
  148. }else if (nowTime>Date.parse(biddingStopTime)){
  149. //竞价结束
  150. $('#countType').html('')
  151. $('#countDown').html('竞价结束')
  152. // document.getElementById('swiperType').style.display = 'none';
  153. document.getElementById('biddingTable').style.display = 'table';
  154. document.getElementById('biddingTitle').style.display = 'none';
  155. module.data.biddingTimeType = 2;
  156. }else if (nowTime<Date.parse(biddingStartTime)){
  157. leftTime = Date.parse(biddingStartTime)-nowTime;
  158. d = Math.floor(leftTime/1000/60/60/24);
  159. h = Math.floor(leftTime/1000/60/60%24);
  160. m = Math.floor(leftTime/1000/60%60);
  161. s = Math.floor(leftTime/1000%60);
  162. $('#countType').html('未开始')
  163. $('#countDown').html('<span>距竞价开始还有:'+d+'</span>天<span>'+h+'</span>时<span>'+m+'</span>分<span>'+s+'</span>秒')
  164. //竞价暂未开始
  165. document.getElementById('biddingTitle').innerHTML = '竞价暂未开始...';
  166. module.data.biddingTimeType = 3;
  167. }
  168. if(Date.parse(signupStartTime)<nowTime&&nowTime<Date.parse(signupStopTime)){
  169. //正在报名
  170. module.data.signupTimeType = 1;
  171. // document.getElementById('swiperType').style.display = 'block';
  172. d = Math.floor(signDownLeftTime/1000/60/60/24);
  173. h = Math.floor(signDownLeftTime/1000/60/60%24);
  174. m = Math.floor(signDownLeftTime/1000/60%60);
  175. s = Math.floor(signDownLeftTime/1000%60);
  176. $('#countType').html('报名中')
  177. $('#countDown').html('<span>距报名结束还有:'+d+'</span>天<span>'+h+'</span>时<span>'+m+'</span>分<span>'+s+'</span>秒')
  178. }else if (nowTime>Date.parse(signupStopTime)){
  179. //报名结束
  180. module.data.signupTimeType = 2;
  181. }else if (nowTime<Date.parse(signupStartTime)){
  182. //报名暂未开始
  183. module.data.signupTimeType = 3;
  184. d = Math.floor(signupLeftTime/1000/60/60/24);
  185. h = Math.floor(signupLeftTime/1000/60/60%24);
  186. m = Math.floor(signupLeftTime/1000/60%60);
  187. s = Math.floor(signupLeftTime/1000%60);
  188. $('#countType').html('未开始')
  189. $('#countDown').html('<span>距报名开始还有:'+d+'</span>天<span>'+h+'</span>时<span>'+m+'</span>分<span>'+s+'</span>秒')
  190. }
  191. //moneyText:出价输入框
  192. //moneyBtn:出价按钮
  193. //signYes:已报名显示文字
  194. //signNo:未报名显示文字
  195. //signBtn:已登录但未报名跳转报名按钮
  196. //signBtn2:未登录跳转登录按钮
  197. //noAction:未开始显示文字
  198. if(module.data.loginNow){ //判断是否登录(已登录)
  199. if(module.data.signup == 1){ //判断是否报名(已报名)
  200. if( module.data.biddingTimeType == 1 ){ //判断当前竞价状态(竞价中)
  201. document.getElementById('signYes').style.display = 'none';
  202. document.getElementById('signNo').style.display = 'none';
  203. document.getElementById('signBtn').style.display = 'none';
  204. document.getElementById('signBtn2').style.display = 'none';
  205. document.getElementById('noAction').style.display = 'none';
  206. document.getElementById('moneyText').style.display = 'table-row';
  207. document.getElementById('moneyBtn').style.display = 'flex';
  208. }else if( module.data.biddingTimeType == 3 ){ //判断当前竞价状态(竞价未开始)
  209. document.getElementById('moneyText').style.display = 'none';
  210. document.getElementById('moneyBtn').style.display = 'none';
  211. document.getElementById('signNo').style.display = 'none';
  212. document.getElementById('signBtn').style.display = 'none';
  213. document.getElementById('signBtn2').style.display = 'none';
  214. document.getElementById('noAction').style.display = 'none';
  215. document.getElementById('signYes').style.display = 'block';
  216. }else{ //判断当前竞价状态(竞价结束)
  217. $('.swiperInput').css('display','none');
  218. $('#timeDown').css('display','none');
  219. clearInterval(module.data.timeDown)
  220. }
  221. }else{ //判断是否报名(未报名)
  222. if( module.data.signupTimeType == 1 ){ //判断当前报名状态(正在报名)
  223. document.getElementById('moneyText').style.display = 'none';
  224. document.getElementById('moneyBtn').style.display = 'none';
  225. document.getElementById('signNo').style.display = 'none';
  226. document.getElementById('signBtn2').style.display = 'none';
  227. document.getElementById('noAction').style.display = 'none';
  228. document.getElementById('signYes').style.display = 'none';
  229. document.getElementById('signBtn').style.display = 'block';
  230. }else if( module.data.signupTimeType == 3 ){ //判断当前报名状态(报名未开始)
  231. document.getElementById('moneyText').style.display = 'none';
  232. document.getElementById('moneyBtn').style.display = 'none';
  233. document.getElementById('signBtn2').style.display = 'none';
  234. document.getElementById('signYes').style.display = 'none';
  235. document.getElementById('signBtn').style.display = 'none';
  236. document.getElementById('signNo').style.display = 'none';
  237. document.getElementById('noAction').style.display = 'block';
  238. }else{ //判断当前报名状态(报名结束)
  239. document.getElementById('moneyText').style.display = 'none';
  240. document.getElementById('moneyBtn').style.display = 'none';
  241. document.getElementById('signBtn2').style.display = 'none';
  242. document.getElementById('noAction').style.display = 'none';
  243. document.getElementById('signYes').style.display = 'none';
  244. document.getElementById('signBtn').style.display = 'none';
  245. document.getElementById('signNo').style.display = 'block';
  246. }
  247. }
  248. }else{ //判断是否登录(未登录)
  249. if( module.data.biddingTimeType == 2 ){//判断当前竞价状态(竞价结束)
  250. $('.swiperInput').css('display','none')
  251. }else{
  252. document.getElementById('signBtn2').style.display = 'block';
  253. }
  254. }
  255. if(module.data.outProjectInformationDetail.biddingType != '自由竞价' && module.data.biddingTimeType != 2){
  256. document.getElementById('biddingTable').style.display = 'table';
  257. document.getElementById('biddingTitle').style.display = 'none';
  258. }
  259. }
  260. module.projectNum = function(data){
  261. console.log(data)
  262. }
  263. module.signup = function(data){
  264. console.log(data)
  265. module.data.signup = data.data;
  266. module.data.isFirst = data.signup.isFirst;
  267. var outProjectInformationData = template('outProjectInformationData', module.data);
  268. $("#outProjectInformationContent").html(outProjectInformationData);
  269. }
  270. goBond = function(){
  271. var nowTime = Date.parse(new Date());
  272. var signupStopTime = Date.parse(module.data.outProjectInformationDetail.signupStopTime)
  273. if (nowTime>signupStopTime){
  274. tools.initError('报名已结束!');
  275. return;
  276. }
  277. if (module.data.signHistory == 1){
  278. tools.initError('已报名,请耐心等待审核结果!');
  279. return;
  280. }
  281. tools.doGet(userData, {}, module.userData);
  282. }
  283. module.userData = function(data){
  284. if (data.code == 200) {
  285. var content = data.user;
  286. //console.log(content)
  287. module.data.userId = content.userId;
  288. tools.doGet(userMember + '/' + content.userId, {}, module.userMember);//memberType 1个人 2单位
  289. }
  290. }
  291. module.userMember = function(data){
  292. if (data.code == 200) {
  293. var content = data.data;
  294. if (content.auditStatus == 'Y'){
  295. tools.skip('bond.html?id='+getQueryVariable('id'))
  296. }else{
  297. tools.initError("交易中心审核注册信息后方可进行报名!");
  298. }
  299. }
  300. }
  301. //项目基本信息
  302. module.outProjectInformation = function (data) {
  303. if (data.code == 200) {
  304. var content = data.data;
  305. module.data.biddingStopTime = content.biddingStopTime;
  306. for(var i = 0 ; i < content.fileUrlList.length ; i++){
  307. content.fileUrlList[i].fileUrl = serverApi+content.fileUrlList[i].fileUrl;
  308. }
  309. module.data.outProjectInformationDetail = content;
  310. setTimeout(function(){
  311. var outProjectInformationData = template('outProjectInformationData', module.data);
  312. $("#outProjectInformationContent").html(outProjectInformationData);
  313. var timName = document.getElementById('timeDown');
  314. if(timName){
  315. var t = 3;
  316. module.data.timeDown = setInterval(function(){
  317. // console.log($('#countType').html())
  318. // if ($('#countType').html()!='竞价中'){
  319. // clearInterval(module.data.timeDown)
  320. // document.getElementById('timeDown').style.display = 'none';
  321. // return;
  322. // }
  323. timName.innerHTML = t+'<b style="color: #666666">秒后自动刷新</b>';
  324. t--;
  325. document.getElementById('timeDown').style.display = 'inline-block';
  326. if(t<0){
  327. t = 3;
  328. let biddingStartTime = content.biddingStartTime;
  329. let biddingStopTime = content.biddingStopTime;
  330. var nowTime = Date.parse(new Date());
  331. // if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){
  332. //正在竞价
  333. //交易项目竞价记录
  334. tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
  335. // }
  336. }
  337. }, 1000)
  338. }
  339. },2000)
  340. $("#know").html(module.data.know);
  341. //挂牌价格字典
  342. tools.doGet(Dictionaries+'/price_unit', {}, module.unitDictionaries,true);
  343. //经济类型字典
  344. tools.doGet(Dictionaries+'/economic_type', {}, module.economicTypeDictionaries,true);
  345. //项目类型字典
  346. tools.doGet(Dictionaries+'/project_type', {}, module.projectNumberDictionaries,true);
  347. //农地性质字典
  348. // tools.doGet(Dictionaries+'/sub_object_type', {}, module.projectTypeDictionaries,true);
  349. //前次转出方式
  350. tools.doGet(Dictionaries+'/rollout_type', {}, module.oneoutDictionaries,true);
  351. //面积单位字典
  352. tools.doGet(Dictionaries+'/area_unit', {}, module.areaDictionaries,true);
  353. //支付方式字典
  354. tools.doGet(Dictionaries+'/payment_type', {}, module.paymentTypeDictionaries,true);
  355. //缴纳形式字典
  356. tools.doGet(Dictionaries+'/deposit_payment_type', {}, module.depositPaymentTypeDictionaries,true);
  357. //交易方式字典
  358. tools.doGet(Dictionaries+'/deal_type', {}, module.transactionDictionaries,true);
  359. //竞价方式字典
  360. tools.doGet(Dictionaries+'/bidding_type', {}, module.biddingTypeDictionaries,true);
  361. //期满处理字典
  362. tools.doGet(Dictionaries+'/expire_type', {}, module.expireTypeDictionaries,true);
  363. //期满处理字典
  364. tools.doGet(Dictionaries+'/bidding_direct', {}, module.biddingDirectDictionaries,true);
  365. //交易项目竞价记录
  366. tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
  367. //倒计时
  368. module.data.timer = setInterval(function(){
  369. // '2023-05-17 14:56:00'
  370. let signupStartTime = module.data.outProjectInformationDetail.signupStartTime;
  371. let signupStopTime = module.data.outProjectInformationDetail.signupStopTime;
  372. let biddingStartTime = module.data.outProjectInformationDetail.biddingStartTime;
  373. let biddingStopTime = module.data.outProjectInformationDetail.biddingStopTime;
  374. var nowTime = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")));
  375. var difference = Date.parse(biddingStopTime)-nowTime;
  376. // var centerTime = module.data.timeConfig * 60 * 1000
  377. var centerTime = content.delayPeriod * 1000
  378. if ( 0 <= difference&&difference <= centerTime){
  379. // console.log("竞价最后两分钟")
  380. //正在竞价
  381. var m,s;
  382. if(module.data.outProjectInformationDetail.biddingType == '自由竞价'){
  383. document.getElementById('biddingTable').style.display = 'none';
  384. document.getElementById('biddingTitle').style.display = 'block';
  385. document.getElementById('biddingTitle').innerHTML = '竞价进行中...';
  386. }
  387. // document.getElementById('swiperType').style.display = 'block';
  388. module.data.biddingTimeType = 1;
  389. m = Math.floor(difference/1000/60%60);
  390. s = Math.floor(difference/1000%60);
  391. $('#countType').html('竞价中')
  392. $('#countDown').html('<span>距竞价结束还有:0</span>天<span>0</span>时<span>'+m+'</span>分<span>'+s+'</span>秒')
  393. if(module.data.loginNow){ //判断是否登录(已登录)
  394. if(module.data.signup == 1){ //判断是否报名(已报名)
  395. if( module.data.biddingTimeType == 1 ){ //判断当前竞价状态(竞价中)
  396. document.getElementById('signYes').style.display = 'none';
  397. document.getElementById('signNo').style.display = 'none';
  398. document.getElementById('signBtn').style.display = 'none';
  399. document.getElementById('signBtn2').style.display = 'none';
  400. document.getElementById('noAction').style.display = 'none';
  401. document.getElementById('moneyText').style.display = 'table-row';
  402. document.getElementById('moneyBtn').style.display = 'flex';
  403. }else if( module.data.biddingTimeType == 3 ){ //判断当前竞价状态(竞价未开始)
  404. document.getElementById('moneyText').style.display = 'none';
  405. document.getElementById('moneyBtn').style.display = 'none';
  406. document.getElementById('signNo').style.display = 'none';
  407. document.getElementById('signBtn').style.display = 'none';
  408. document.getElementById('signBtn2').style.display = 'none';
  409. document.getElementById('noAction').style.display = 'none';
  410. document.getElementById('signYes').style.display = 'block';
  411. }else{ //判断当前竞价状态(竞价结束)
  412. $('.swiperInput').css('display','none');
  413. $('#timeDown').css('display','none');
  414. clearInterval(module.data.timeDown)
  415. }
  416. }else{ //判断是否报名(未报名)
  417. if( module.data.signupTimeType == 1 ){ //判断当前报名状态(正在报名)
  418. document.getElementById('moneyText').style.display = 'none';
  419. document.getElementById('moneyBtn').style.display = 'none';
  420. document.getElementById('signNo').style.display = 'none';
  421. document.getElementById('signBtn2').style.display = 'none';
  422. document.getElementById('noAction').style.display = 'none';
  423. document.getElementById('signYes').style.display = 'none';
  424. document.getElementById('signBtn').style.display = 'block';
  425. }else if( module.data.signupTimeType == 3 ){ //判断当前报名状态(报名未开始)
  426. document.getElementById('moneyText').style.display = 'none';
  427. document.getElementById('moneyBtn').style.display = 'none';
  428. document.getElementById('signBtn2').style.display = 'none';
  429. document.getElementById('signYes').style.display = 'none';
  430. document.getElementById('signBtn').style.display = 'none';
  431. document.getElementById('signNo').style.display = 'none';
  432. document.getElementById('noAction').style.display = 'block';
  433. }else{ //判断当前报名状态(报名结束)
  434. document.getElementById('moneyText').style.display = 'none';
  435. document.getElementById('moneyBtn').style.display = 'none';
  436. document.getElementById('signBtn2').style.display = 'none';
  437. document.getElementById('noAction').style.display = 'none';
  438. document.getElementById('signYes').style.display = 'none';
  439. document.getElementById('signBtn').style.display = 'none';
  440. document.getElementById('signNo').style.display = 'block';
  441. }
  442. }
  443. }else{ //判断是否登录(未登录)
  444. if( module.data.biddingTimeType == 2 ){//判断当前竞价状态(竞价结束)
  445. $('.swiperInput').css('display','none')
  446. }else{
  447. document.getElementById('signBtn2').style.display = 'block';
  448. }
  449. }
  450. console.log(s+'-------------'+m)
  451. if (s < 1 && m < 1){
  452. console.log("竞价结束22222222222")
  453. tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, function(data){
  454. if (data.code == 200) {
  455. var nowDate = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")));
  456. module.data.outProjectInformationDetail.biddingStopTime = data.data
  457. let timeNew = Date.parse(data.data) + 0 - nowDate;
  458. if (timeNew > 0) {
  459. module.data.outProjectInformationDetail.biddingStopTime = data.data;
  460. // module.dataCompare(signupStartTime,signupStopTime,biddingStartTime,data.data);
  461. }else{
  462. $('#countType').html('')
  463. $('#countDown').html('竞价结束')
  464. // document.getElementById('swiperType').style.display = 'none';
  465. document.getElementById('biddingTable').style.display = 'table';
  466. document.getElementById('biddingTitle').style.display = 'none';
  467. module.data.biddingTimeType = 2;
  468. return;
  469. }
  470. }
  471. },true);
  472. }else if(s%2 == 0&&centerTime!=0){
  473. tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, module.getBiddingStopTime,true);
  474. }
  475. }else{
  476. if (!signupStartTime){console.log('缺失报名开始时间');return;}
  477. if (!signupStopTime){console.log('缺失报名结束时间');return;}
  478. if (!biddingStartTime){console.log('缺失竞价开始时间');return;}
  479. if (!biddingStopTime){console.log('缺失竞价结束时间');return;}
  480. module.dataCompare(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime);
  481. }
  482. if(module.data.outProjectInformationDetail.biddingType == '自由竞价' && module.data.biddingTimeType != 2){
  483. document.getElementById('biddingTable').style.display = 'none';
  484. document.getElementById('biddingTitle').style.display = 'block';
  485. }
  486. },1000)
  487. //倒计时
  488. // module.data.timer2 = setInterval(function(){
  489. // //交易项目竞价记录
  490. // tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformationNew,true);
  491. //
  492. // },10000)
  493. if(module.data.loginNow){
  494. //判断是否报名
  495. tools.doGet(signup, {projectId:getQueryVariable('id'),depositStatus:'1',memberId:tools.getCookie('memberId')}, module.signup);
  496. tools.doGet(signup, {projectId:getQueryVariable('id'),memberId:tools.getCookie('memberId')}, module.signup2);
  497. }
  498. }
  499. }
  500. module.getBiddingStopTime = function(data){
  501. if (data.code == 200) {
  502. $('#stopTime').html(data.data)
  503. module.data.outProjectInformationDetail.biddingStopTime = data.data
  504. }
  505. }
  506. module.signup2 = function(data){
  507. if (data.code == 200) {
  508. module.data.signHistory = data.data
  509. }
  510. }
  511. //标的物图片
  512. module.showImgInformation = function (data) {
  513. if (data.code == 200) {
  514. var content = data.data;
  515. console.log(content)
  516. var contentList = [];
  517. for(var i = 0 ; i < content.length ; i++){
  518. contentList[i] = serverApi+content[i].fileUrl;
  519. }
  520. module.data.showImgInformationDetail = contentList;
  521. console.log(contentList)
  522. var showImgInformationData = template('showImgInformationData', module.data);
  523. $("#tabDetail2").html(showImgInformationData);
  524. }
  525. }
  526. //竞价记录
  527. module.biddinglistInformation = function (data) {
  528. if (data.code == 200) {
  529. var content = data.rows;
  530. if(module.data.biddinglistInformationDetailLength == content.length){
  531. return;
  532. }
  533. console.log(module.data.outProjectInformationDetail.biddingDirect)
  534. console.log(module.data.outProjectInformationDetail.biddingType)
  535. setTimeout(function(){
  536. if(module.data.outProjectInformationDetail.biddingType == '阶梯竞价'||module.data.outProjectInformationDetail.biddingType == '2'){
  537. if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'||module.data.outProjectInformationDetail.biddingDirect == '2'){
  538. if (content.length>0){
  539. let money = $('#money').val()?$('#money').val():content[0].money
  540. if(content[0].money<=money) {
  541. document.getElementById('money').value = parseFloat(parseFloat(content[0].money) - parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2);
  542. }
  543. }else{
  544. document.getElementById('money').value = parseFloat(parseFloat(module.data.outProjectInformationDetail.price)).toFixed(2);
  545. // + parseFloat(module.data.outProjectInformationDetail.ladderPrice)
  546. }
  547. }else{
  548. if (content.length>0){
  549. let money = $('#money').val()?$('#money').val():content[0].money
  550. if(content[0].money>=money){
  551. document.getElementById('money').value = parseFloat(parseFloat(content[0].money) + parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2);
  552. }
  553. }else{
  554. document.getElementById('money').value = parseFloat(parseFloat(module.data.outProjectInformationDetail.price)).toFixed(2);
  555. // + parseFloat(module.data.outProjectInformationDetail.ladderPrice)
  556. }
  557. }
  558. }
  559. },2000)
  560. module.data.biddinglistInformationDetail = content;
  561. module.data.biddinglistInformationDetailLength = content.length;
  562. var biddinglistInformationData = template('biddinglistInformationData', module.data);
  563. $("#tabDetail4").html(biddinglistInformationData);
  564. if (content.length>0){$("#nowMoney").html(content[0].money);}
  565. }
  566. }
  567. //竞价记录
  568. module.biddinglistInformationNew = function (data) {
  569. if (data.code == 200) {
  570. var content = data.rows;
  571. console.log(module.data.biddinglistInformationDetail.length+'----------------------'+content.length)
  572. if (module.data.biddinglistInformationDetailLength<content.length){
  573. let time = new Date(Date.parse(new Date())+(2 * 60 * 1000));
  574. const Y = time.getFullYear()
  575. const M = time.getMonth() + 1 < 10 ? '0'+(time.getMonth()+1) : time.getMonth()+1
  576. const D = time.getDate()
  577. const H = time.getHours() // 小时
  578. const m = time.getMinutes() // 分钟
  579. const S = time.getSeconds() // 秒
  580. module.data.biddingStopTime = Y+'-'+M+'-'+D+' '+H+':'+m+':'+S;
  581. module.data.biddinglistInformationDetailLength = content.length;
  582. }
  583. }
  584. }
  585. //焦点图滚动
  586. module.swiperBanner = function (type) {
  587. console.log('aaaa')
  588. var viewSwiper = new Swiper('.view .swiper-container', {
  589. onSlideChangeStart: function() {
  590. updateNavPosition()
  591. }
  592. })
  593. $('.view .arrow-left,.preview .arrow-left').on('click', function(e) {
  594. console.log('abc')
  595. e.preventDefault()
  596. if (viewSwiper.activeIndex == 0) {
  597. viewSwiper.swipeTo(viewSwiper.slides.length - 1, 1000);
  598. return
  599. }
  600. viewSwiper.swipePrev()
  601. })
  602. $('.view .arrow-right,.preview .arrow-right').on('click', function(e) {
  603. console.log('abc')
  604. e.preventDefault()
  605. if (viewSwiper.activeIndex == viewSwiper.slides.length - 1) {
  606. viewSwiper.swipeTo(0, 1000);
  607. return
  608. }
  609. viewSwiper.swipeNext()
  610. })
  611. var previewSwiper = new Swiper('.preview .swiper-container', {
  612. visibilityFullFit: true,
  613. slidesPerView: 'auto',
  614. onlyExternal: true,
  615. onSlideClick: function() {
  616. viewSwiper.swipeTo(previewSwiper.clickedSlideIndex)
  617. }
  618. })
  619. function updateNavPosition() {
  620. $('.preview .active-nav').removeClass('active-nav')
  621. var activeNav = $('.preview .swiper-slide').eq(viewSwiper.activeIndex).addClass('active-nav')
  622. if (!activeNav.hasClass('swiper-slide-visible')) {
  623. if (activeNav.index() > previewSwiper.activeIndex) {
  624. var thumbsPerNav = Math.floor(previewSwiper.width / activeNav.width()) - 1
  625. previewSwiper.swipeTo(activeNav.index() - thumbsPerNav)
  626. } else {
  627. previewSwiper.swipeTo(activeNav.index())
  628. }
  629. }
  630. }
  631. }
  632. //切换
  633. tabClick = function(type){
  634. //标的物介绍
  635. for (var i = 0 ; i < 4 ; i++){
  636. document.getElementById('tabDetail'+(i+1)).style.display = 'none';
  637. document.getElementById('tab'+(i+1)).classList = '';
  638. }
  639. document.getElementById('tabDetail'+type).style.display = 'block';
  640. document.getElementById('tab'+type).classList = 'active';
  641. }
  642. //挂牌价格
  643. module.unitDictionaries = function (data) {
  644. if (data.code == 200) {
  645. var content = data.data;
  646. var unit = content[(module.data.outProjectInformationDetail.unit-1)].dictLabel;
  647. module.data.outProjectInformationDetail.unit = unit;
  648. var outProjectInformationData = template('outProjectInformationData', module.data);
  649. $("#outProjectInformationContent").html(outProjectInformationData);
  650. }
  651. }
  652. //出价
  653. module.biddingSubmitMethod = function (data2) {
  654. let newMoney;
  655. if (data2.data&&data2.code==200){
  656. console.log(data2)
  657. newMoney = data2.data;
  658. }else{
  659. newMoney = module.data.outProjectInformationDetail.price;
  660. }
  661. if ($('#money').val()<=0){
  662. tools.initError('请正常出价!');
  663. return;
  664. }
  665. if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'){
  666. //判断用户出价不能高于挂牌价
  667. if(module.data.outProjectInformationDetail.price<$('#money').val()){
  668. tools.initError('出价不能高于挂牌价');
  669. return;
  670. }else{
  671. //判断当前竞价方式
  672. if (module.data.outProjectInformationDetail.biddingType=='阶梯竞价' || module.data.outProjectInformationDetail.biddingType=='公开竞价'){
  673. //判断当前是否有人出价
  674. if (data2.data){
  675. //判断用户出价不能高于当前出价最低价格
  676. if(newMoney <= $('#money').val()){
  677. tools.initError('不能高于当前最低价格!');
  678. return;
  679. }
  680. }
  681. }
  682. }
  683. }else{
  684. if(module.data.outProjectInformationDetail.price>$('#money').val()){
  685. tools.initError('出价不能低于挂牌价');
  686. return;
  687. }else{
  688. //判断当前竞价方式
  689. if (module.data.outProjectInformationDetail.biddingType=='阶梯竞价' || module.data.outProjectInformationDetail.biddingType=='公开竞价'){
  690. //判断当前是否有人出价
  691. if (data2.data){
  692. //判断用户出价不能低于当前出价最高价格
  693. if(newMoney >= $('#money').val()){
  694. tools.initError('不能低于当前最高价格!');
  695. return;
  696. }
  697. }
  698. }
  699. }
  700. }
  701. var data = {};
  702. var projectId = getQueryVariable('id');
  703. var memberId = tools.getCookie('memberId');
  704. var userId = tools.getCookie('userId');
  705. var userAccount = tools.getCookie('phone');
  706. var userName = tools.getCookie('userName');
  707. var money = parseFloat($('#money').val());
  708. var loginTime = Date.now($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date"));
  709. data['projectId'] = projectId;
  710. data['memberId'] = memberId;
  711. data['userId'] = userId;
  712. data['userAccount'] = userAccount;
  713. data['userName'] = userName;
  714. data['money'] = money;
  715. data['loginTime'] = loginTime;
  716. tools.doPost(biddingSubmit, data, module.biddingSubmitOpen);
  717. }
  718. module.biddingSubmitOpen = function(){
  719. tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, function(data){
  720. if (data.code == 200) {
  721. var nowDate = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")));
  722. module.data.outProjectInformationDetail.biddingStopTime = data.data
  723. let timeNew = Date.parse(data.data) + 0 - nowDate;
  724. if (timeNew > 0) {
  725. module.data.outProjectInformationDetail.biddingStopTime = data.data;
  726. module.dataCompare(
  727. module.data.outProjectInformationDetail.signupStartTime,
  728. module.data.outProjectInformationDetail.signupStopTime,
  729. module.data.outProjectInformationDetail.biddingStartTime,data.data);
  730. }else{
  731. $('#countType').html('')
  732. $('#countDown').html('竞价结束')
  733. // document.getElementById('swiperType').style.display = 'none';
  734. document.getElementById('biddingTable').style.display = 'table';
  735. document.getElementById('biddingTitle').style.display = 'none';
  736. module.data.biddingTimeType = 2;
  737. return;
  738. }
  739. }
  740. },true);
  741. tools.initError('出价成功');
  742. // $('#money').val(0)
  743. }
  744. //经济类型
  745. module.economicTypeDictionaries = function (data) {
  746. if (data.code == 200 && module.data.outProjectInformationDetail.economicType!='') {
  747. var content = data.data;
  748. if(content[(module.data.outProjectInformationDetail.economicType-1)] != undefined){
  749. var economicType = content[(module.data.outProjectInformationDetail.economicType-1)].dictLabel;
  750. module.data.outProjectInformationDetail.economicType = economicType;
  751. var outProjectInformationData = template('outProjectInformationData', module.data);
  752. $("#outProjectInformationContent").html(outProjectInformationData);
  753. }
  754. }
  755. }
  756. //项目类型
  757. module.projectNumberDictionaries = function (data) {
  758. if (data.code == 200 && module.data.outProjectInformationDetail.projectNumber!='') {
  759. var content = data.data;
  760. var projectNumber = content.filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.projectNumber; })[0].dictLabel;
  761. module.data.outProjectInformationDetail.projectNumber = projectNumber;
  762. var outProjectInformationData = template('outProjectInformationData', module.data);
  763. $("#outProjectInformationContent").html(outProjectInformationData);
  764. }
  765. }
  766. //农地性质
  767. module.projectTypeDictionaries = function (data) {
  768. if (data.code == 200 && module.data.outProjectInformationDetail.projectType!='') {
  769. var content = data.data;
  770. console.log(content)
  771. console.log((module.data.outProjectInformationDetail.projectType-1))
  772. var projectType = content[(module.data.outProjectInformationDetail.projectType-1)].dictLabel;
  773. module.data.outProjectInformationDetail.projectType = projectType;
  774. var outProjectInformationData = template('outProjectInformationData', module.data);
  775. $("#outProjectInformationContent").html(outProjectInformationData);
  776. }
  777. }
  778. //前次转出方式
  779. module.oneoutDictionaries = function (data) {
  780. if (data.code == 200 && module.data.outProjectInformationDetail.oneout!='') {
  781. var content = data.data;
  782. if(module.data.outProjectInformationDetail.oneout == 0){
  783. module.data.outProjectInformationDetail.oneout = '无';
  784. }else{
  785. var oneout = content[(module.data.outProjectInformationDetail.oneout-1)].dictLabel;
  786. module.data.outProjectInformationDetail.oneout = oneout;
  787. }
  788. var rollout = content[(module.data.outProjectInformationDetail.rollout-1)].dictLabel;
  789. module.data.outProjectInformationDetail.rollout = rollout;
  790. var outProjectInformationData = template('outProjectInformationData', module.data);
  791. $("#outProjectInformationContent").html(outProjectInformationData);
  792. }
  793. }
  794. //面积单位
  795. module.areaDictionaries = function (data) {
  796. if (data.code == 200 && module.data.outProjectInformationDetail.allCountUnit!='') {
  797. var content = data.data;
  798. var allCountUnit = content[(module.data.outProjectInformationDetail.allCountUnit-1)].dictLabel;
  799. module.data.outProjectInformationDetail.allCountUnit = allCountUnit;
  800. if(module.data.outProjectInformationDetail.subjectList.length>0){
  801. for(var i = 0 ; i < module.data.outProjectInformationDetail.subjectList.length ; i++){
  802. module.data.outProjectInformationDetail.subjectList[i].areaUnit = content[(module.data.outProjectInformationDetail.subjectList[i].areaUnit-1)].dictLabel;
  803. }
  804. }
  805. var outProjectInformationData = template('outProjectInformationData', module.data);
  806. $("#outProjectInformationContent").html(outProjectInformationData);
  807. }
  808. }
  809. //支付方式
  810. module.paymentTypeDictionaries = function (data) {
  811. if (data.code == 200 && module.data.outProjectInformationDetail.paymentType!='') {
  812. var content = data.data;
  813. var paymentType = content[(module.data.outProjectInformationDetail.paymentType-1)].dictLabel;
  814. module.data.outProjectInformationDetail.paymentType = paymentType;
  815. var outProjectInformationData = template('outProjectInformationData', module.data);
  816. $("#outProjectInformationContent").html(outProjectInformationData);
  817. }
  818. }
  819. //缴纳形式
  820. module.depositPaymentTypeDictionaries = function (data) {
  821. if (data.code == 200 && module.data.outProjectInformationDetail.depositPaymentType!='') {
  822. var content = data.data;
  823. var depositPaymentType = content[(module.data.outProjectInformationDetail.depositPaymentType-1)].dictLabel;
  824. module.data.outProjectInformationDetail.depositPaymentType = depositPaymentType;
  825. var outProjectInformationData = template('outProjectInformationData', module.data);
  826. $("#outProjectInformationContent").html(outProjectInformationData);
  827. }
  828. }
  829. //交易方式
  830. module.transactionDictionaries = function (data) {
  831. if (data.code == 200 && module.data.outProjectInformationDetail.dealType!='') {
  832. var content = data.data;
  833. var dealType = content[(module.data.outProjectInformationDetail.dealType-1)].dictLabel;
  834. module.data.outProjectInformationDetail.dealType = dealType;
  835. var outProjectInformationData = template('outProjectInformationData', module.data);
  836. $("#outProjectInformationContent").html(outProjectInformationData);
  837. }
  838. }
  839. //竞价方式
  840. module.biddingTypeDictionaries = function (data) {
  841. if (data.code == 200 && module.data.outProjectInformationDetail.biddingType!='') {
  842. var content = data.data;
  843. var biddingType = content[(module.data.outProjectInformationDetail.biddingType-1)].dictLabel;
  844. module.data.outProjectInformationDetail.biddingType = biddingType;
  845. var outProjectInformationData = template('outProjectInformationData', module.data);
  846. $("#outProjectInformationContent").html(outProjectInformationData);
  847. }
  848. }
  849. //系统是否
  850. module.expireTypeDictionaries = function (data) {
  851. if (data.code == 200 && module.data.outProjectInformationDetail.expire!='') {
  852. var content = data.data;
  853. var expire = content[(module.data.outProjectInformationDetail.expire-1)].dictLabel;
  854. module.data.outProjectInformationDetail.expire = expire;
  855. var outProjectInformationData = template('outProjectInformationData', module.data);
  856. $("#outProjectInformationContent").html(outProjectInformationData);
  857. }
  858. }
  859. //系统是否
  860. module.biddingDirectDictionaries = function (data) {
  861. if (data.code == 200 && module.data.outProjectInformationDetail.biddingDirect!='') {
  862. var content = data.data;
  863. var biddingDirect = content[(module.data.outProjectInformationDetail.biddingDirect-1)].dictLabel;
  864. module.data.outProjectInformationDetail.biddingDirect = biddingDirect;
  865. var outProjectInformationData = template('outProjectInformationData', module.data);
  866. $("#outProjectInformationContent").html(outProjectInformationData);
  867. }
  868. }
  869. changeProMoney = function(){
  870. tools.doGet(projectNewBidMoney+getQueryVariable('id'), {}, module.biddingSubmitMethod);
  871. }
  872. changeProMoneyFirst = function(){
  873. tools.doGet(projectNewBidMoney+getQueryVariable('id'), {}, module.biddingSubmitMethodFirst);
  874. }
  875. module.biddingSubmitMethodFirst = function (data) {
  876. if (data.code == 200) {
  877. let newMoney;
  878. if (data.data){
  879. newMoney = data.data;
  880. }else{
  881. newMoney = module.data.outProjectInformationDetail.price;
  882. }
  883. console.log(newMoney);
  884. var data = {};
  885. var projectId = getQueryVariable('id');
  886. var memberId = tools.getCookie('memberId');
  887. var userId = tools.getCookie('userId');
  888. var userAccount = tools.getCookie('phone');
  889. var userName = tools.getCookie('userName');
  890. var money = parseFloat(newMoney);
  891. // var loginTime = tools.getNowFormatDate();
  892. var loginTime = Date.now($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date"));
  893. data['projectId'] = projectId;
  894. data['memberId'] = memberId;
  895. data['userId'] = userId;
  896. data['userAccount'] = userAccount;
  897. data['userName'] = userName;
  898. data['money'] = money;
  899. data['loginTime'] = loginTime;
  900. tools.doPost(biddingSubmit, data, module.biddingSubmitOpen);
  901. }
  902. }
  903. //向上加价
  904. upMoney = function(){
  905. if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'){
  906. if (module.data.biddinglistInformationDetail.length<1){
  907. if(module.data.outProjectInformationDetail.price <= $('#money').val()){
  908. tools.initError('出价不能高于挂牌价格');
  909. return;
  910. }
  911. }else{
  912. if(module.data.biddinglistInformationDetail[0].money <= (parseFloat($('#money').val())+parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2)){
  913. tools.initError('出价不能高于当前出价最低价格');
  914. return;
  915. }
  916. }
  917. }else{
  918. if (module.data.biddinglistInformationDetail.length<1){
  919. if(module.data.outProjectInformationDetail.price>$('#money').val()){
  920. tools.initError('出价不能低于挂牌价格');
  921. return;
  922. }
  923. }else{
  924. if(module.data.biddinglistInformationDetail[0].money>=$('#money').val()){
  925. tools.initError('出价不能低于当前出价最高价格');
  926. return;
  927. }
  928. }
  929. }
  930. $('#money').val() == null||$('#money').val() == ''?$('#money').val(0):'';
  931. console.log($('#money').val())
  932. module.data.outProjectInformationDetail.ladderPrice?$('#money').val((parseFloat($('#money').val())+parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2)):document.getElementById('money').value += 1
  933. }
  934. //向下降价
  935. downMoney = function(){
  936. if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'){
  937. if (module.data.biddinglistInformationDetail.length<1){
  938. if(module.data.outProjectInformationDetail.price<$('#money').val()){
  939. tools.initError('出价不能高于挂牌价格');
  940. return;
  941. }
  942. }else{
  943. if(module.data.biddinglistInformationDetail[0].money<$('#money').val()){
  944. tools.initError('出价不能高于当前出价最低价格');
  945. return;
  946. }
  947. }
  948. }else{
  949. if (module.data.biddinglistInformationDetail.length<1){
  950. if(module.data.outProjectInformationDetail.price>=$('#money').val()){
  951. tools.initError('出价不能低于挂牌价格');
  952. return;
  953. }
  954. }else{
  955. if(module.data.biddinglistInformationDetail[0].money>=(parseFloat($('#money').val())-parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2)){
  956. tools.initError('出价不能低于当前出价最高价格');
  957. return;
  958. }
  959. }
  960. }
  961. $('#money').val() == null?$('#money').val(0):'';
  962. if ($('#money').val() == 0)return;
  963. module.data.outProjectInformationDetail.ladderPrice?$('#money').val((parseFloat($('#money').val())-parseFloat(module.data.outProjectInformationDetail.ladderPrice)).toFixed(2)):document.getElementById('money').value -= 1
  964. }
  965. moneyChange = function(){
  966. if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'){
  967. if(module.data.outProjectInformationDetail.price<$('#money').val()){
  968. $('#money').val(module.data.outProjectInformationDetail.price-1);
  969. }
  970. }
  971. }
  972. //登陆跳转
  973. goLogin = function(){
  974. tools.initDialog('登陆提示', '登陆后可参与竞价,是否登录?', function () {
  975. tools.skip('../login/login.html')
  976. }, '登录', function () { }, "取消")
  977. }
  978. return module;
  979. });