marketlists.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479
  1. <template>
  2. <div id="marketlists">
  3. <el-col :span="24" class="main">
  4. <el-col :span="24">
  5. <el-col :span="5" class="menu">
  6. <el-image :src="squareImage"></el-image>
  7. <span>Menu</span>
  8. <el-col class="menuList" :span="24" v-for="(item, index) in menuList" :key="index">
  9. <p @click="changeMenu(item.name, index)" :style="`color:${menuIndex == index ? menuColor : ''}`">{{ item.name }}</p>
  10. </el-col>
  11. </el-col>
  12. <el-col :span="19" class="info" v-if="display == '1'">
  13. <el-col v-if="menuIndex == '0'" class="leftInfo">
  14. <el-col :span="24" class="leftTop">
  15. <span>|</span> <span>{{ menuName }}</span>
  16. </el-col>
  17. <el-col class="infoLeftList" :span="24" v-for="(item, index) in zhuantiList" :key="index">
  18. <p>{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</p>
  19. <p>
  20. <span class="textOver" @click="clickshanpin(item.id)">{{ item.name }} </span><span></span>
  21. <span>{{ item.introduction }}</span>
  22. </p>
  23. </el-col>
  24. </el-col>
  25. <el-col v-if="menuIndex == '1'" class="leftInfo">
  26. <el-col :span="24" class="leftTop">
  27. <span>|</span> <span>{{ menuName }}</span>
  28. </el-col>
  29. <el-col class="infoRightList" :span="24" v-for="(item, index) in jishuList" :key="index">
  30. <p>
  31. <span class="textOver" @click="clickjishu(item.id)">{{ item.name }}</span>
  32. <span class="textOver">{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</span>
  33. </p>
  34. </el-col>
  35. </el-col>
  36. <el-col v-if="menuIndex == '2'" class="leftInfo">
  37. <el-col :span="24" class="leftTop">
  38. <span>|</span> <span>{{ menuName }}</span>
  39. </el-col>
  40. <el-col class="infoRightList" :span="24" v-for="(item, index) in hangyeList" :key="index">
  41. <p>
  42. <span class="textOver" @click="clickfuwu(item.id)">{{ item.name }}</span>
  43. <span class="textOver">{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</span>
  44. </p>
  45. </el-col>
  46. </el-col>
  47. <el-col v-if="menuIndex == '3'" class="leftInfo">
  48. <el-col :span="24" class="leftTop">
  49. <span>|</span> <span>{{ menuName }}</span>
  50. </el-col>
  51. <el-col class="infoLeftList" :span="24" v-for="(item, index) in jiaoyuList" :key="index">
  52. <p>{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</p>
  53. <p>
  54. <span class="textOver" @click="clickzhuanjia(item.id)">{{ item.name }}</span>
  55. <span>{{ item.resume }}</span>
  56. </p>
  57. </el-col>
  58. </el-col>
  59. <el-col class="page">
  60. <el-pagination
  61. background
  62. @current-change="handleCurrentChange"
  63. :current-page.sync="currentPage"
  64. :page-size="pageSize"
  65. layout="total,prev, pager, next, jumper"
  66. :total="pageTotal"
  67. >
  68. </el-pagination>
  69. </el-col>
  70. <el-col :span="24" class="marketPublish" @click.native="fabu()"> <span @click="fabu()">我要发布</span></el-col>
  71. </el-col>
  72. <el-col :span="19" v-else-if="display == '2'" class="info">
  73. <context :detailInfo="detailInfo" @onSubmit="onSubmit"></context>
  74. </el-col>
  75. <el-col :span="19" v-else-if="display == '3'" class="info">
  76. <zhuanjia :zhuanjiainfo="zhuanjiainfo"></zhuanjia>
  77. </el-col>
  78. </el-col>
  79. </el-col>
  80. </div>
  81. </template>
  82. <script>
  83. import _ from 'lodash';
  84. import { mapState, createNamespacedHelpers } from 'vuex';
  85. const { mapActions: product } = createNamespacedHelpers('enterpriseproject');
  86. const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
  87. const { mapActions: transaction } = createNamespacedHelpers('transaction');
  88. const { mapActions: tranaudit } = createNamespacedHelpers('tranaudit');
  89. import zhuanjia from '@/layout/market/zhuanjia.vue';
  90. import context from '@/layout/market/context.vue';
  91. export default {
  92. name: 'marketlists',
  93. props: {},
  94. components: {
  95. context,
  96. zhuanjia,
  97. },
  98. data: () => ({
  99. squareImage: require('@/assets/live/square_big.png'),
  100. menuList: [{ name: '科技产品' }, { name: '技术供求' }, { name: '服务供求' }, { name: '专家供求' }],
  101. menuIndex: '0',
  102. menuName: '科技产品',
  103. menuColor: 'rgb(254, 149, 14)',
  104. currentPage: 1,
  105. pageTotal: 0,
  106. pageSize: 10,
  107. limit: 10,
  108. zhuantiList: [],
  109. jishuList: [],
  110. hangyeList: [],
  111. jiaoyuList: [],
  112. display: '1',
  113. detailInfo: {},
  114. zhuanjiainfo: {},
  115. }),
  116. created() {
  117. this.searchList();
  118. this.search();
  119. console.log(this.$route.query.display);
  120. },
  121. computed: {
  122. ...mapState(['user']),
  123. dispaly() {
  124. return this.$route.query.display;
  125. },
  126. id() {
  127. return this.$route.query.id;
  128. },
  129. pageTitle() {
  130. return `${this.$route.meta.title}`;
  131. },
  132. totaltype() {
  133. return this.$route.query.totaltype;
  134. },
  135. },
  136. metaInfo() {
  137. return { title: this.$route.meta.title };
  138. },
  139. methods: {
  140. ...product({ list: 'newquery', newfetch: 'newfetch' }),
  141. ...expertsuser({ lists: 'query', fetch: 'fetch' }),
  142. ...transaction({ transactioncreate: 'create', transactionfetch: 'fetch' }),
  143. ...tranaudit({ tranauditcreate: 'create' }),
  144. async searchList({ skip = 0, limit = 10, ...info } = {}) {
  145. if (this.$route.query.column_name == '科技产品') {
  146. this.display = '1';
  147. this.changeMenu(this.$route.query.column_name, 0);
  148. } else if (this.$route.query.column_name == '技术供求') {
  149. this.display = '1';
  150. this.changeMenu(this.$route.query.column_name, 1);
  151. } else if (this.$route.query.column_name == '服务供求') {
  152. this.display = '1';
  153. this.changeMenu(this.$route.query.column_name, 2);
  154. } else if (this.$route.query.column_name == '专家供求') {
  155. this.display = '1';
  156. this.changeMenu(this.$route.query.column_name, 3);
  157. }
  158. },
  159. async changeMenu(name, index) {
  160. console.log(index, name);
  161. this.menuIndex = index;
  162. this.menuColor = 'rgb(254, 149, 14)';
  163. this.menuName = name;
  164. this.initList({ name });
  165. },
  166. async initList({ name, skip = 0, limit = 10, ...info } = {}) {
  167. this.display = '1';
  168. let res = [];
  169. this.pageSize = 5;
  170. if (name == '科技产品') {
  171. let totaltype = '1';
  172. console.log(totaltype);
  173. res = await this.list({ skip, limit, totaltype, status: 1, ...info });
  174. this.$set(this, `zhuantiList`, res.data);
  175. } else if (name == '技术供求') {
  176. let totaltype = '0';
  177. console.log(totaltype);
  178. res = await this.list({ skip, limit, totaltype, status: 1, ...info });
  179. this.$set(this, `jishuList`, res.data);
  180. } else if (name == '服务供求') {
  181. let totaltype = '2';
  182. console.log(totaltype);
  183. res = await this.list({ skip, limit, totaltype, status: 1, ...info });
  184. this.$set(this, `hangyeList`, res.data);
  185. } else if (name == '专家供求') {
  186. let totaltype = this.totaltype;
  187. res = await this.lists({ skip, limit, ...info });
  188. this.$set(this, `jiaoyuList`, res.data);
  189. }
  190. this.$set(this, `pageTotal`, res.total);
  191. },
  192. handleCurrentChange(val) {
  193. const name = this.menuName;
  194. if (name == '科技产品' || name == '专家供求') {
  195. this.limit = 5;
  196. }
  197. this.initList({ name: name, skip: (val - 1) * this.limit, limit: this.limit });
  198. },
  199. async clickshanpin(id) {
  200. this.display = '2';
  201. console.log(id);
  202. const res = await this.newfetch(id);
  203. console.log(res.data);
  204. this.$set(this, `detailInfo`, res.data);
  205. },
  206. async clickjishu(id) {
  207. this.display = '2';
  208. console.log(id);
  209. const res = await this.newfetch(id);
  210. console.log(res.data);
  211. this.$set(this, `detailInfo`, res.data);
  212. },
  213. async search() {
  214. this.display = this.$route.query.display;
  215. console.log(this.display);
  216. if (this.display == '2') {
  217. console.log(this.id);
  218. const res = await this.newfetch(this.id);
  219. console.log(res.data);
  220. this.$set(this, `detailInfo`, res.data);
  221. }
  222. // else if (this.dispaly == '1') {
  223. // const res = await this.newquery(this.id);
  224. // console.log(res.data);
  225. // this.$set(this, `detailInfo`, res.data);
  226. // }
  227. else if (this.dispaly == '3') {
  228. const res = await this.fetch(this.id);
  229. console.log(res.data);
  230. this.$set(this, `zhuanjiainfo`, res.data);
  231. }
  232. },
  233. async clickfuwu(id) {
  234. this.display = '2';
  235. console.log(id);
  236. const res = await this.newfetch(id);
  237. console.log(res.data);
  238. this.$set(this, `detailInfo`, res.data);
  239. },
  240. async clickzhuanjia(id) {
  241. this.display = '3';
  242. const res = await this.fetch(id);
  243. console.log(res.data);
  244. this.$set(this, `zhuanjiainfo`, res.data);
  245. },
  246. fabu() {
  247. if (this.user.role == '2' || this.user.role == '3') {
  248. this.$router.push({ path: '/market/marketfabu' });
  249. } else if (this.user.uid == undefined) {
  250. this.$router.push({ path: '/login' });
  251. } else {
  252. }
  253. },
  254. async onSubmit() {
  255. // console.log(this.user.uid);
  256. // let form = {};
  257. // form.userid = this.user.uid;
  258. // form.username = this.user.name;
  259. // form.product_id = this.detailInfo.id;
  260. // form.product_name = this.detailInfo.name;
  261. // form.market_userid = this.detailInfo.userid;
  262. // form.market_username = this.detailInfo.contact_user;
  263. // form.status = '0';
  264. // console.log(form);
  265. // let res = await this.transactioncreate(form);
  266. // this.$checkRes(res, '发起洽谈交易成功', '交易失败');
  267. // let shenhe = {};
  268. // shenhe.result = '0';
  269. // console.log(res.data.id);
  270. // shenhe.transaction_id = res.data.id;
  271. // shenhe.userid = this.detailInfo.userid;
  272. // shenhe.product_id = this.detailInfo.userid;
  273. // console.log(shenhe);
  274. // let ress = await this.tranauditcreate(shenhe);
  275. this.$router.push({ path: '/live/hall/dock/dockDetail', query: { id: this.detailInfo.id } });
  276. },
  277. },
  278. };
  279. </script>
  280. <style lang="less" scoped>
  281. .main {
  282. width: 80%;
  283. margin: 0 auto;
  284. float: none;
  285. }
  286. .menu {
  287. float: left;
  288. min-height: 600px;
  289. width: 20%;
  290. background: no-repeat bottom right;
  291. background-image: url(../../assets/live/menu_back.jpg);
  292. margin: 30px 0;
  293. padding: 10px 0 0 10px;
  294. box-sizing: border-box;
  295. box-shadow: 0 0 10px #bbbaba;
  296. }
  297. .menu .el-image {
  298. width: 30px;
  299. display: inline-table;
  300. margin: 10px 5px;
  301. }
  302. .menu span {
  303. font-size: 24px;
  304. color: #92959a;
  305. font-weight: 600;
  306. margin-left: 3px;
  307. position: relative;
  308. top: 10px;
  309. }
  310. .menuList p {
  311. line-height: 60px;
  312. font-size: 18px;
  313. cursor: pointer;
  314. border-bottom: 1px solid #2d64b3;
  315. color: #044b79;
  316. font-weight: 600;
  317. }
  318. .info {
  319. width: 77%;
  320. float: right;
  321. margin: 30px 0 30px 2px;
  322. min-height: 600px;
  323. box-shadow: 0 0 10px #2d64b3;
  324. overflow: hidden;
  325. right: 0px;
  326. background: #ffffff;
  327. }
  328. .leftInfo {
  329. height: 500px;
  330. overflow: hidden;
  331. }
  332. .leftTop {
  333. font-size: 18px;
  334. width: 96%;
  335. height: 41px;
  336. line-height: 35px;
  337. border-bottom: 1px solid #e5e5e5;
  338. position: relative;
  339. bottom: 1px;
  340. margin: 10px;
  341. font-weight: 600;
  342. color: #22529a;
  343. }
  344. .infoLeftList {
  345. float: left;
  346. width: 95%;
  347. border-bottom: 1px dashed #ccc;
  348. padding: 10px 0 10px 10px;
  349. height: 87px;
  350. margin: 0 0 0 5px;
  351. }
  352. .infoLeftList:hover p:last-child span:first-child {
  353. -webkit-transform: translateY(-3px);
  354. -ms-transform: translateY(-3px);
  355. transform: translateY(-3px);
  356. -webkit-box-shadow: 0 0 6px #999;
  357. box-shadow: 0 0 6px #999;
  358. -webkit-transition: all 0.5s ease-out;
  359. transition: all 0.5s ease-out;
  360. color: #005293;
  361. cursor: pointer;
  362. }
  363. .infoLeftList p:first-child {
  364. float: left;
  365. width: 20%;
  366. font-size: 15px;
  367. background: #044b79;
  368. text-align: center;
  369. color: #fff;
  370. font-weight: bold;
  371. padding: 4px 0px;
  372. margin: 0 0 0 5px;
  373. }
  374. .infoLeftList p:last-child {
  375. float: right;
  376. width: 70%;
  377. padding: 0 0 0 10px;
  378. }
  379. .infoLeftList p:last-child span:first-child {
  380. float: left;
  381. width: 90%;
  382. font-size: 18px;
  383. margin: 0 0 20px 0;
  384. }
  385. .infoLeftList p:last-child span:last-child {
  386. float: left;
  387. width: 90%;
  388. font-size: 16px;
  389. overflow: hidden;
  390. text-overflow: ellipsis;
  391. -webkit-line-clamp: 2;
  392. word-break: break-all;
  393. display: -webkit-box;
  394. -webkit-box-orient: vertical;
  395. margin: -20px 0 0 0;
  396. color: #666;
  397. }
  398. .page {
  399. text-align: center;
  400. margin: 10px 0;
  401. }
  402. .infoRightList {
  403. float: left;
  404. width: 95%;
  405. padding: 7px 0;
  406. margin: 0 0 0 5px;
  407. }
  408. .infoRightList:nth-child(6) {
  409. border-bottom: 1px solid #ccc;
  410. padding: 0 0 17px 0;
  411. }
  412. .infoRightList:nth-child(7) {
  413. padding: 15px 0 0 0;
  414. }
  415. .infoRightList:nth-child(11) {
  416. border-bottom: 1px solid #ccc;
  417. padding: 0 0 15px 0;
  418. }
  419. .infoRightList:hover p span:first-child {
  420. -webkit-transform: translateY(-3px);
  421. -ms-transform: translateY(-3px);
  422. transform: translateY(-3px);
  423. -webkit-box-shadow: 0 0 6px #999;
  424. box-shadow: 0 0 6px #999;
  425. -webkit-transition: all 0.5s ease-out;
  426. transition: all 0.5s ease-out;
  427. color: #005293;
  428. cursor: pointer;
  429. }
  430. .infoRightList p {
  431. font-size: 18px;
  432. }
  433. .infoRightList p span:first-child {
  434. display: inline-block;
  435. width: 70%;
  436. margin: 0 20px 0 10px;
  437. }
  438. .infoRightList p span:last-child {
  439. display: inline-block;
  440. width: 21%;
  441. text-align: center;
  442. font-size: 16px;
  443. }
  444. .marketPublish {
  445. position: fixed;
  446. background: #0279d5;
  447. width: 100px;
  448. height: 100px;
  449. z-index: 999;
  450. left: 2%;
  451. top: 80%;
  452. border-radius: 20px;
  453. box-shadow: 2px 2px 2px #055c9f;
  454. text-align: center;
  455. line-height: 100px;
  456. font-size: 20px;
  457. color: #fff;
  458. font-weight: bold;
  459. }
  460. .marketPublish:hover {
  461. background: #f60;
  462. cursor: pointer;
  463. }
  464. </style>