网站
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.
 
 
 

372 lines
14 KiB

  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "biddingApi", "itemsApi", "paging",'dateTime', 'swiper'], function ($, template, Tools ) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. //焦点图数据
  9. focusListTop: [],
  10. //标的物类型
  11. deptTypeList:[],
  12. //标的物所在地
  13. deptLocationList:[],
  14. //竞价大厅列表
  15. biddingInformationList:'',
  16. //页码
  17. pageNum: 1,
  18. //页码集合
  19. pageList: [],
  20. //每页数量
  21. pageSize: 50,
  22. //总页数
  23. pageCount:0,
  24. //标的物选中项id
  25. deptId:'100',
  26. //标的所在地选中
  27. secondDeptId:'',
  28. //标的物类型ID
  29. projectNumber:'',
  30. //项目状态
  31. projectShowStatus:'',
  32. //报名开始时间
  33. signupStartTime:'',
  34. //报名结束时间
  35. signupStopTime:'',
  36. //竞价开始时间
  37. biddingStartTime:'',
  38. //竞价结束时间
  39. biddingStopTime:'',
  40. form:{
  41. deptId:100,
  42. projectNumber:'',
  43. projectShowStatus:'',
  44. // signupStartTime:'',
  45. // signupStopTime:'',
  46. // biddingStartTime:'',
  47. // biddingStopTime:'',
  48. pageNum:1,
  49. pageSize:1,
  50. }
  51. },
  52. };
  53. var tools = new Tools();
  54. module.init = function (page) {
  55. //获取焦点图信息
  56. tools.doGet(websitePicture, {picType:1,status:0,orderByColumn:'picSort',isAsc:'desc'}, module.focusNewsTop , true);
  57. //底部友情链接
  58. tools.doGet(friendsLinks, {}, module.bottomFriendsLinks, true);
  59. //新闻资讯
  60. tools.doGet(biddingList, {deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.biddingList,true);
  61. //标的物类型
  62. tools.doGet(webDeptType+"/project_type", {}, module.deptType,true);
  63. //标的物所在地
  64. tools.doGet(webDept, {deptId:''}, module.deptLocation, true);
  65. //网站配置信息(网站名称 底部联系方式 公安备案号 网站备案号)
  66. tools.getWebConfig();
  67. $("#signStartTimeStr").datetime({
  68. type: "date",
  69. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  70. success: function (res) {
  71. console.log(res)
  72. }
  73. })
  74. $("#signEndTimeStr").datetime({
  75. type: "date",
  76. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  77. success: function (res) {
  78. console.log(res)
  79. }
  80. })
  81. $("#auctionStartTimeStr").datetime({
  82. type: "date",
  83. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  84. success: function (res) {
  85. console.log(res)
  86. }
  87. })
  88. $("#endTimeStr").datetime({
  89. type: "date",
  90. value: [new Date().getFullYear(),new Date().getMonth()+1,new Date().getDate()],
  91. success: function (res) {
  92. console.log(res)
  93. }
  94. })
  95. setTimeout(function(){
  96. //主题图片切换
  97. module.switchTheme();
  98. },500)
  99. };
  100. //焦点图数据
  101. module.focusNewsTop = function (data) {
  102. if (data.code == 200) {
  103. let focusArray = [];
  104. if(data.data.length<1){
  105. focusArray.push({
  106. picUrl:'../../../static/images/banner1.png'
  107. },{
  108. picUrl:'../../../static/images/banner2.png'
  109. },{
  110. picUrl:'../../../static/images/banner3.png'
  111. })
  112. }else{
  113. data.data.forEach(res=>{
  114. focusArray.push({
  115. picUrl:'/api'+res.picUrl
  116. })
  117. })
  118. }
  119. module.data.focusListTop = focusArray;
  120. var bannerFocusDataTop = template('bannerFocusDataTop', module.data);
  121. $("#bannerFocusTopContent").html(bannerFocusDataTop);
  122. new Swiper('#bannerFocusWrapTop', {
  123. paginationClickable: true,
  124. autoplay : 4000,
  125. loop:true
  126. })
  127. }
  128. }
  129. //主题图片切换
  130. module.switchTheme = function(){
  131. if(themeColor == 'red'){
  132. document.getElementById('bannerBottom').src = '../../static/images/bannerBottom_red.jpg'
  133. }else if(themeColor == 'green'){
  134. document.getElementById('bannerBottom').src = '../../static/images/bannerBottom.jpg'
  135. }
  136. }
  137. //挂牌项目列表
  138. module.biddingList = function (data) {
  139. if (data.code == 200) {
  140. console.log(data)
  141. var content = data.rows;
  142. var pageCount = (data.total/module.data.pageSize).toFixed(0);
  143. if (pageCount < 1){
  144. pageCount = 1;
  145. }
  146. if(module.data.biddingInformationList == ''){
  147. // 初始化 分页器
  148. var page_s1=createPage('.page_s1');
  149. // 设置分页
  150. setPage(page_s1,{
  151. pageTotal: data.total, // 数据总条数
  152. pageSize: module.data.pageSize, // 每页显示条数
  153. pageCurrent: 1, // 当前页
  154. maxBtnNum: 5, // 最多按钮个数 (最少5个)
  155. })
  156. $('#page_s1').html('共'+pageCount+'页')
  157. }
  158. module.data.pageCount = pageCount;
  159. for(var i = 0 ; i < content.length ; i++){
  160. if(content[i].biddingStopTime == null || content[i].biddingStartTime == null){continue;}
  161. var endTimes=content[i].biddingStopTime.substring(0,10).split('-');
  162. var biddingStopTime=endTimes[1]+'/'+endTimes[2]+'/'+endTimes[0]+' '+content[i].biddingStopTime.substring(10,19);
  163. var startTimes=content[i].biddingStartTime.substring(0,10).split('-');
  164. var biddingStartTime=startTimes[1]+'/'+startTimes[2]+'/'+startTimes[0]+' '+content[i].biddingStartTime.substring(10,19);
  165. var nowTime = Date.parse(new Date());
  166. var leftTime = Date.parse(biddingStopTime)-nowTime;
  167. var rightTime = Date.parse(biddingStartTime)-nowTime;
  168. console.log(biddingStopTime)
  169. console.log(leftTime)
  170. if(leftTime>0){
  171. console.log('进行中')
  172. content[i].timeType = '进行中'
  173. }
  174. if(leftTime<0){
  175. console.log('已结束')
  176. content[i].timeType = '已结束'
  177. }
  178. if(rightTime>0){
  179. console.log('未开始')
  180. content[i].timeType = '未开始'
  181. }
  182. }
  183. module.data.biddingInformationList = content;
  184. var biddingInformationData = template('biddingInformationData', module.data);
  185. $("#biddingInformationContent").html(biddingInformationData);
  186. }
  187. }
  188. //标的物类型
  189. module.deptType = function (data) {
  190. console.log(data)
  191. if (data.code == 200) {
  192. var content = data.data ;
  193. module.data.deptTypeList = content;
  194. var deptTypeData = template('deptTypeData', module.data);
  195. $("#deptTypeContent").html(deptTypeData);
  196. }
  197. }
  198. //标的物所在地
  199. module.deptLocation = function (data) {
  200. if (data.code == 200) {
  201. var content = data.data ;
  202. module.data.deptLocationList = content;
  203. var deptLocationData = template('deptLocationData', module.data);
  204. $("#deptLocationContent").html(deptLocationData);
  205. }
  206. }
  207. //标的物所在地(二级)
  208. module.deptSecondLocation = function (data) {
  209. if ( data.data.length == 0){
  210. document.getElementById('secondDept').style.display = 'none';
  211. return;
  212. }else{
  213. document.getElementById('secondDept').style.display = 'block';
  214. }
  215. if (data.code == 200) {
  216. console.log(data)
  217. var content = data.data;
  218. module.data.deptSecondLocationList = content;
  219. var deptSecondLocationData = template('deptSecondLocationData', module.data);
  220. $("#secondDept").html(deptSecondLocationData);
  221. console.log(module.data.deptId)
  222. }
  223. }
  224. tabCheck = function (deptId) {
  225. module.data.deptId = deptId;
  226. $('#locInfoall').attr("class","auction_hall_table_tab auction_loc");
  227. $("#deptLocationContent div").attr("class","auction_hall_table_tab auction_loc");
  228. if(deptId == ''){
  229. $('#locInfoall').addClass('auction_hall_table_tab_select');
  230. document.getElementById('secondDept').style.display = 'none';
  231. }else{
  232. $('#locInfoall'+deptId).addClass('auction_hall_table_tab_select');
  233. tools.doGet(webDept, {deptId:deptId}, module.deptSecondLocation, true);
  234. }
  235. }
  236. secondCheck = function(id,secondDeptId){
  237. $('#locInfoSecondall').attr("class","auction_hall_table_tab auction_loc");
  238. $("#secondDept div").attr("class","auction_hall_table_tab auction_loc");
  239. if(id == '' && secondDeptId == ''){
  240. $('#locInfoSecondall').addClass('auction_hall_table_tab_select');
  241. module.data.deptId = $('#deptLocationContent div.auction_hall_table_tab_select').attr("data");
  242. }else{
  243. $('#locInfoall'+id).addClass('auction_hall_table_tab_select');
  244. module.data.deptId = secondDeptId;
  245. }
  246. }
  247. allDept = function (){
  248. module.data.deptSize = 30
  249. document.getElementById('allDept').innerHTML = "<i class='sanjiao-top'></i>";
  250. document.getElementById('allDept').onclick = upDept;
  251. tools.doGet(webDept + '/0', {}, module.deptLocation, true);
  252. }
  253. turnThePage = function (pageNum) {
  254. module.data.pageNum = pageNum ;
  255. tools.doGet(biddingList, {deptId:100,pageNum:module.data.pageNum,pageSize:module.data.pageSize}, module.itemList,true);
  256. }
  257. typeCheck = function(id,projectNumber){
  258. if(projectNumber==undefined){
  259. // projectNumber为undefined时,置空(直接传递给后台接口导致搜索问题)
  260. projectNumber = "";
  261. }
  262. module.data.projectNumber = projectNumber;//标的物类型ID
  263. document.getElementById('standardTypeAll').className = 'auction_hall_table_tab';
  264. if(id == ''){
  265. id = 'All';
  266. }
  267. if(projectNumber == undefined){
  268. module.data.projectNumber = '';
  269. }
  270. for (var i = 0 ; i < module.data.deptTypeList.length ; i++){
  271. document.getElementById('standardType'+(i+1)).className = 'auction_hall_table_tab';
  272. }
  273. document.getElementById('standardType'+id).className = 'auction_hall_table_tab auction_hall_table_tab_select';
  274. }
  275. selectedStatus = function(id,projectShowStatus){
  276. module.data.projectShowStatus = projectShowStatus;
  277. document.getElementById('statusall').className = 'auction_hall_table_tab'
  278. for (var i = 0 ; i < 5 ; i++){
  279. document.getElementById('status'+(1+i)).className = 'auction_hall_table_tab'
  280. }
  281. document.getElementById('status'+id).className = 'auction_hall_table_tab auction_hall_table_tab_select'
  282. }
  283. //底部友情链接
  284. module.bottomFriendsLinks = function (data) {
  285. if (data.code == 200) {
  286. var content = data.data;
  287. console.log(content)
  288. module.data.friendsLinksList = content;
  289. var friendsLinksData = template('friendsLinksData', module.data);
  290. $("#friendsLinksContent").html(friendsLinksData);
  291. }
  292. }
  293. goSearch = function(){
  294. module.data.itemsInformationList = '';
  295. $('.page_s1').html('')
  296. $('#page_s1').html('')
  297. module.data.form.deptId = module.data.deptId;
  298. module.data.form.projectNumber = module.data.projectNumber;
  299. module.data.form.projectShowStatus= module.data.projectShowStatus;
  300. // module.data.form.signupStartTime= $('#signStartTimeStr').val();
  301. // module.data.form.signupStopTime= $('#signEndTimeStr').val();
  302. // module.data.form.biddingStartTime= $('#auctionStartTimeStr').val();
  303. // module.data.form.biddingStopTime= $('#endTimeStr').val();
  304. module.data.form.pageNum= module.data.pageNum;
  305. module.data.form.pageSize= module.data.pageSize;
  306. if (module.data.form.signupStartTime){
  307. delete module.data.form.signupStartTime;
  308. }
  309. if (module.data.form.signupStopTime){
  310. delete module.data.form.signupStopTime;
  311. }
  312. if (module.data.form.biddingStartTime){
  313. delete module.data.form.biddingStartTime;
  314. }
  315. if (module.data.form.biddingStopTime){
  316. delete module.data.form.biddingStopTime;
  317. }
  318. if ($('#signStartTimeStr').val()!=''){
  319. module.data.form.signupStartTime = $('#signStartTimeStr').val();
  320. }
  321. if ($('#signEndTimeStr').val()!=''){
  322. module.data.form.signupStopTime = $('#signEndTimeStr').val();
  323. }
  324. if ($('#auctionStartTimeStr').val()!=''){
  325. module.data.form.biddingStartTime = $('#auctionStartTimeStr').val();
  326. }
  327. if ($('#endTimeStr').val()!=''){
  328. module.data.form.biddingStopTime = $('#endTimeStr').val();
  329. }
  330. console.log(module.data.form)
  331. tools.doGet(biddingList, module.data.form, module.biddingList, true);
  332. }
  333. goDetail = function (id) {
  334. tools.skip('../listingItems/itemsDetail.html?id='+id);
  335. }
  336. return module;
  337. });