移动端
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

335 строки
9.8 KiB

  1. <template>
  2. <div class="app-container">
  3. <van-search v-model="value" placeholder="请输入搜索关键词" @search="onSearch"/>
  4. <van-tabs v-model="active" type="card" color="#0DBCAA" title-active-color="#ffffff" @change="tabChange">
  5. <van-tab title="供应项目">
  6. <van-dropdown-menu active-color="#0EB8A4">
  7. <van-dropdown-item v-model="value1" :options="projectTypeOption" @change="getList('search')"/>
  8. <van-dropdown-item v-model="value2" :title="value2" ref="item">
  9. <van-tree-select
  10. :active-id.sync="activeId"
  11. :items="deptListOption"
  12. :main-active-index.sync="activeIndex"
  13. :max="1"
  14. @click-item="clickItem"
  15. @click-nav="clickNav"
  16. />
  17. </van-dropdown-item>
  18. <van-dropdown-item v-model="value3" :options="option3" @change="getList('search')"/>
  19. </van-dropdown-menu>
  20. <van-list v-model="loading" :finished="finished" finished-text="没有更多了" @load="getList">
  21. <router-link :to="{path:'project/projectDetail',query:{id:item.id}}" v-for="(item,index) in infoList" :key="index">
  22. <van-card :thumb="item.fileUrl?'/api'+item.fileUrl:'../../static/images/zwtpxw.jpg'" >
  23. <template #tags>
  24. <p class="title">【{{item.rollout}}】{{item.projectName}}</p>
  25. <p class="type">{{ item.projectShowStatus }}</p>
  26. <p class="timeEnd">报名结束 {{ item.signupStopTime }}</p>
  27. <p class="timeEnd">竞价结束 {{ item.biddingStopSetime }}</p>
  28. <van-row>
  29. <van-col span="12" class="money"><span>{{ item.price }}</span>{{ item.unit }}</van-col>
  30. <van-col span="8" offset="4" class="time">{{ item.projectReleaseTime }}</van-col>
  31. </van-row>
  32. </template>
  33. </van-card>
  34. </router-link>
  35. </van-list>
  36. </van-tab>
  37. <van-tab title="需求项目">
  38. <van-dropdown-menu>
  39. <van-dropdown-item v-model="value1" :options="projectTypeOption" @change="getNeedProjectList"/>
  40. <van-dropdown-item :value="value2" :title="value2" ref="item">
  41. <van-tree-select
  42. :active-id.sync="activeId"
  43. :items="deptListOption"
  44. :main-active-index.sync="activeIndex"
  45. :max="1"
  46. @click-item="clickItem"
  47. @click-nav="clickNav"
  48. />
  49. </van-dropdown-item>
  50. </van-dropdown-menu>
  51. <van-list v-model="loading1" :finished="finished1" @load="getNeedProjectList" finished-text="没有更多了">
  52. <router-link :to="{path:'project/projectNeedsDetail',query:{id:item.id}}" v-for="(item,index) in infoList1" :key="index">
  53. <van-card :thumb="item.fileUrl?'/api'+item.fileUrl:'../../static/images/zwtpxw.jpg'" >
  54. <template #tags>
  55. <p class="title">{{ item.projectName }}</p>
  56. <p class="type" style="margin-top: 7px;">{{ item.needname }}</p>
  57. <p class="timeEnd" style="margin-top: 7px;">需求开始时间 {{ item.needStartTime }}</p>
  58. <p class="timeEnd" style="margin-top: 7px;">需求结束时间 {{ item.needStopTime }}</p>
  59. </template>
  60. </van-card>
  61. </router-link>
  62. </van-list>
  63. </van-tab>
  64. </van-tabs>
  65. </div>
  66. </template>
  67. <script>
  68. import { getOutProjectList , getDeptList , needProjectList } from "@/api/project/index" ;
  69. export default {
  70. name: "project",
  71. data() {
  72. return {
  73. active:0,
  74. value1: '',
  75. value2: '标的物位置',
  76. activeId: this.global.deptId,
  77. activeIndex: 0,
  78. value3: '',
  79. value:"",
  80. //是否显示加载
  81. loading: false,
  82. //是否滚动到底部
  83. finished: false,
  84. //是否显示加载
  85. loading1: false,
  86. //是否滚动到底部
  87. finished1: false,
  88. option1: [
  89. ],
  90. option2: [
  91. ],
  92. option3: [
  93. { text: '竞价状态', value: '' },
  94. { text: '正在报名', value: '正在报名' },
  95. { text: '等待竞价', value: '等待竞价' },
  96. { text: '正在竞价', value: '正在竞价' },
  97. { text: '等待成交', value: '等待成交' },
  98. { text: '已经成交', value: '已经成交' },
  99. ],
  100. //标的物类型
  101. projectTypeOption:[{text:'标的物类型',value:''}],
  102. //标的物所在地
  103. deptListOption: [
  104. ],
  105. input: '',
  106. infoList:[],
  107. infoList1:[],
  108. queryDatas : {
  109. deptId: this.activeId,
  110. projectNumber:this.value1,
  111. projectShowStatus:this.value3,
  112. pageNum:1,
  113. pageSize:10
  114. },
  115. queryNeedDatas : {
  116. deptId: this.activeId,
  117. projectNumber:this.value1,
  118. pageNum:1,
  119. pageSize:10
  120. }
  121. };
  122. },
  123. created() {
  124. clearInterval();
  125. this.getDicts("project_type").then(response => {
  126. console.log(response)
  127. response.data.map(item => {
  128. this.projectTypeOption.push({ value:item.dictValue, text: item.dictLabel});
  129. });
  130. });
  131. getDeptList().then(response => {
  132. response.data.map(item => {
  133. this.deptListOption.push({text: item.deptName,children: [],id:item.deptId})
  134. });
  135. console.log(this.deptListOption)
  136. if(response.data.length > 0){
  137. getDeptList(response.data[0].deptId).then(res => {
  138. let list = []
  139. res.data.map(i =>{
  140. list.push({text:i.deptName,children:[],id:i.deptId})
  141. })
  142. if(list.length==0){
  143. list.push({text:response.data[0].deptName,id:response.data[0].deptId})
  144. }else{
  145. this.$set(this.deptListOption[0], "children", list);
  146. }
  147. });
  148. }
  149. });
  150. this.getList();
  151. },
  152. mounted(){},
  153. methods: {
  154. tabChange(e){
  155. console.log(e)
  156. if (e == 0){
  157. this.getList();
  158. }else{
  159. this.getNeedProjectList()
  160. }
  161. },
  162. onSearch(val) {
  163. this.loading = true;
  164. if(this.infoList.length>0){
  165. let newList = []
  166. for(let j = 0 ;j<this.infoList.length;j++){
  167. if(this.infoList[j].projectName.indexOf(val)>-1){
  168. newList.push(this.infoList[j]);
  169. }
  170. }
  171. this.infoList = newList
  172. }
  173. if(val==""){
  174. this.getList()
  175. }
  176. this.loading = false;
  177. },
  178. getList(type){
  179. console.log(this.queryDatas)
  180. console.log(this.value1)
  181. console.log(this.value3)
  182. if (type == 'search'){
  183. this.queryDatas.pageNum = 1;
  184. this.infoList=[];
  185. this.finished = false;
  186. }
  187. this.loading = true;
  188. this.queryDatas.deptId = this.activeId;
  189. this.queryDatas.projectNumber = this.value1;
  190. this.queryDatas.projectShowStatus = this.value3;
  191. getOutProjectList(this.queryDatas).then(response =>{
  192. // console.log(response)
  193. // this.infoList = response.rows
  194. // if(this.infoList.length>0){
  195. // let newList = []
  196. // for(let j = 0 ;j<this.infoList.length;j++){
  197. // if(this.infoList[j].projectName.indexOf(this.value)>-1){
  198. // newList.push(this.infoList[j]);
  199. // }
  200. // }
  201. // this.infoList = newList
  202. // console.log(this.infoList)
  203. // }
  204. response.rows.forEach(res=>{
  205. this.infoList.push(res);
  206. })
  207. if(this.infoList.length >= response.total){
  208. this.finished = true;
  209. return;
  210. }else{
  211. this.loading = false;
  212. this.queryDatas.pageNum += 1 ;
  213. }
  214. });
  215. },
  216. getNeedProjectList(){
  217. this.loading1 = true;
  218. needProjectList(this.queryNeedDatas).then(response =>{
  219. response.rows.forEach(res=>{
  220. this.infoList1.push(res);
  221. })
  222. if(this.infoList1.length >= response.total){
  223. this.finished1 = true;
  224. return;
  225. }else{
  226. this.loading1 = false;
  227. this.queryNeedDatas.pageNum += 1 ;
  228. }
  229. });
  230. },
  231. clickNav(index){
  232. console.log(index)
  233. getDeptList(this.deptListOption[index].id).then(res => {
  234. let list = []
  235. res.data.map(i =>{
  236. list.push({text:i.deptName,children:[],id:i.deptId})
  237. })
  238. if(list.length==0){
  239. list.push({text:this.deptListOption[index].deptName,id:this.deptListOption[index].id})
  240. }else{
  241. this.$set(this.deptListOption[index], "children", list);
  242. }
  243. });
  244. },
  245. clickItem(data){
  246. console.log('clickItem')
  247. if(data.text==this.value2){
  248. this.activeId=1
  249. this.value2='标的物位置'
  250. }else{
  251. this.value2=data.text
  252. }
  253. this.getList('search')
  254. this.$refs.item.toggle();
  255. },
  256. },
  257. };
  258. </script>
  259. <style scoped lang="scss">
  260. .app-container {
  261. height: calc(100vh - 70PX) ;
  262. background: #F4F8FB;
  263. overflow-y: scroll;
  264. }
  265. .van-search{
  266. background: linear-gradient(to bottom right,#91E1CA,#E0F4E4);
  267. }
  268. /deep/ .van-tab{
  269. border-radius: 100PX!important;
  270. background: #ffffff;
  271. border: none;
  272. }
  273. /deep/ .van-tabs--card>.van-tabs__wrap{
  274. padding: 1vh 0;
  275. height: auto;
  276. }
  277. /deep/ .van-tabs__nav{
  278. background: transparent;
  279. border: none;
  280. .van-tab{
  281. &:nth-child(1){
  282. margin-right: 20PX;
  283. }
  284. }
  285. }
  286. .title{
  287. font-size: 0.4rem;
  288. display: -webkit-box;
  289. -webkit-box-orient: vertical;
  290. -webkit-line-clamp: 1;
  291. word-break: break-all;
  292. overflow: hidden;
  293. }
  294. .type{
  295. font-size: 0.35rem;
  296. color: #E7851C;
  297. margin-top: 5PX;
  298. }
  299. .timeEnd{
  300. color: #9A9A9A;
  301. margin-top: 5PX;
  302. font-size: 12PX;
  303. }
  304. .money{
  305. color: #FA5B5C;
  306. line-height: 0.5rem;
  307. margin-top: 5PX;
  308. }
  309. .money span{
  310. /*font-size: 0.35rem;*/
  311. }
  312. .time{
  313. color: #9A9A9A;
  314. line-height: 0.6rem;
  315. margin-top: 5PX;
  316. }
  317. /deep/ .van-card{
  318. width: 94%;
  319. margin: 3vw auto 0;
  320. border-radius: 10PX;
  321. box-shadow: 0 0 10px rgba(0,0,0,.1);
  322. }
  323. </style>