marketlists.vue 14 KB

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