网站
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 

305 righe
12 KiB

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