marketlists.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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" @zjsubmit="zjsubmit"></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 zjsubmit() {
  255. console.log(this.zhuanjiainfo);
  256. let form = {};
  257. form.userid = this.user.uid;
  258. form.username = this.user.name;
  259. form.product_id = this.zhuanjiainfo.id;
  260. form.product_name = this.zhuanjiainfo.name;
  261. form.market_userid = this.zhuanjiainfo.id;
  262. form.market_username = this.zhuanjiainfo.name;
  263. form.status = '0';
  264. let res = await this.transactioncreate(form);
  265. this.$checkRes(res, '购买申请成功', res.errmsg || '购买申请失败');
  266. },
  267. async onSubmit() {
  268. let form = {};
  269. form.userid = this.user.uid;
  270. form.username = this.user.name;
  271. form.product_id = this.detailInfo.id;
  272. form.product_name = this.detailInfo.name;
  273. form.market_userid = this.detailInfo.userid;
  274. form.market_username = this.detailInfo.contact_user;
  275. form.status = '0';
  276. let res = await this.transactioncreate(form);
  277. this.$checkRes(res, '购买申请成功', res.errmsg || '购买申请失败');
  278. // console.log(this.user.uid);
  279. // let form = {};
  280. // form.userid = this.user.uid;
  281. // form.username = this.user.name;
  282. // form.product_id = this.detailInfo.id;
  283. // form.product_name = this.detailInfo.name;
  284. // form.market_userid = this.detailInfo.userid;
  285. // form.market_username = this.detailInfo.contact_user;
  286. // form.status = '0';
  287. // console.log(form);
  288. // let res = await this.transactioncreate(form);
  289. // this.$checkRes(res, '发起洽谈交易成功', '交易失败');
  290. // let shenhe = {};
  291. // shenhe.result = '0';
  292. // console.log(res.data.id);
  293. // shenhe.transaction_id = res.data.id;
  294. // shenhe.userid = this.detailInfo.userid;
  295. // shenhe.product_id = this.detailInfo.userid;
  296. // console.log(shenhe);
  297. // let ress = await this.tranauditcreate(shenhe);
  298. // this.$router.push({ path: '/live/hall/dock/dockDetail', query: { id: this.detailInfo.id } });
  299. },
  300. },
  301. };
  302. </script>
  303. <style lang="less" scoped>
  304. .main {
  305. width: 80%;
  306. margin: 0 auto;
  307. float: none;
  308. }
  309. .menu {
  310. float: left;
  311. min-height: 600px;
  312. width: 20%;
  313. background: no-repeat bottom right;
  314. background-image: url(../../assets/live/menu_back.jpg);
  315. margin: 30px 0;
  316. padding: 10px 0 0 10px;
  317. box-sizing: border-box;
  318. box-shadow: 0 0 10px #bbbaba;
  319. }
  320. .menu .el-image {
  321. width: 30px;
  322. display: inline-table;
  323. margin: 10px 5px;
  324. }
  325. .menu span {
  326. font-size: 24px;
  327. color: #92959a;
  328. font-weight: 600;
  329. margin-left: 3px;
  330. position: relative;
  331. top: 10px;
  332. }
  333. .menuList p {
  334. line-height: 60px;
  335. font-size: 18px;
  336. cursor: pointer;
  337. border-bottom: 1px solid #2d64b3;
  338. color: #044b79;
  339. font-weight: 600;
  340. }
  341. .info {
  342. width: 77%;
  343. float: right;
  344. margin: 30px 0 30px 2px;
  345. min-height: 600px;
  346. box-shadow: 0 0 10px #2d64b3;
  347. overflow: hidden;
  348. right: 0px;
  349. background: #ffffff;
  350. }
  351. .leftInfo {
  352. height: 500px;
  353. overflow: hidden;
  354. }
  355. .leftTop {
  356. font-size: 18px;
  357. width: 96%;
  358. height: 41px;
  359. line-height: 35px;
  360. border-bottom: 1px solid #e5e5e5;
  361. position: relative;
  362. bottom: 1px;
  363. margin: 10px;
  364. font-weight: 600;
  365. color: #22529a;
  366. }
  367. .infoLeftList {
  368. float: left;
  369. width: 95%;
  370. border-bottom: 1px dashed #ccc;
  371. padding: 10px 0 10px 10px;
  372. height: 87px;
  373. margin: 0 0 0 5px;
  374. }
  375. .infoLeftList:hover p:last-child span:first-child {
  376. -webkit-transform: translateY(-3px);
  377. -ms-transform: translateY(-3px);
  378. transform: translateY(-3px);
  379. -webkit-box-shadow: 0 0 6px #999;
  380. box-shadow: 0 0 6px #999;
  381. -webkit-transition: all 0.5s ease-out;
  382. transition: all 0.5s ease-out;
  383. color: #005293;
  384. cursor: pointer;
  385. }
  386. .infoLeftList p:first-child {
  387. float: left;
  388. width: 20%;
  389. font-size: 15px;
  390. background: #044b79;
  391. text-align: center;
  392. color: #fff;
  393. font-weight: bold;
  394. padding: 4px 0px;
  395. margin: 0 0 0 5px;
  396. }
  397. .infoLeftList p:last-child {
  398. float: right;
  399. width: 70%;
  400. padding: 0 0 0 10px;
  401. }
  402. .infoLeftList p:last-child span:first-child {
  403. float: left;
  404. width: 90%;
  405. font-size: 18px;
  406. margin: 0 0 20px 0;
  407. }
  408. .infoLeftList p:last-child span:last-child {
  409. float: left;
  410. width: 90%;
  411. font-size: 16px;
  412. overflow: hidden;
  413. text-overflow: ellipsis;
  414. -webkit-line-clamp: 2;
  415. word-break: break-all;
  416. display: -webkit-box;
  417. -webkit-box-orient: vertical;
  418. margin: -20px 0 0 0;
  419. color: #666;
  420. }
  421. .page {
  422. text-align: center;
  423. margin: 10px 0;
  424. }
  425. .infoRightList {
  426. float: left;
  427. width: 95%;
  428. padding: 7px 0;
  429. margin: 0 0 0 5px;
  430. }
  431. .infoRightList:nth-child(6) {
  432. border-bottom: 1px solid #ccc;
  433. padding: 0 0 17px 0;
  434. }
  435. .infoRightList:nth-child(7) {
  436. padding: 15px 0 0 0;
  437. }
  438. .infoRightList:nth-child(11) {
  439. border-bottom: 1px solid #ccc;
  440. padding: 0 0 15px 0;
  441. }
  442. .infoRightList:hover p span:first-child {
  443. -webkit-transform: translateY(-3px);
  444. -ms-transform: translateY(-3px);
  445. transform: translateY(-3px);
  446. -webkit-box-shadow: 0 0 6px #999;
  447. box-shadow: 0 0 6px #999;
  448. -webkit-transition: all 0.5s ease-out;
  449. transition: all 0.5s ease-out;
  450. color: #005293;
  451. cursor: pointer;
  452. }
  453. .infoRightList p {
  454. font-size: 18px;
  455. }
  456. .infoRightList p span:first-child {
  457. display: inline-block;
  458. width: 70%;
  459. margin: 0 20px 0 10px;
  460. }
  461. .infoRightList p span:last-child {
  462. display: inline-block;
  463. width: 21%;
  464. text-align: center;
  465. font-size: 16px;
  466. }
  467. .marketPublish {
  468. position: fixed;
  469. background: #0279d5;
  470. width: 100px;
  471. height: 100px;
  472. z-index: 999;
  473. left: 2%;
  474. top: 80%;
  475. border-radius: 20px;
  476. box-shadow: 2px 2px 2px #055c9f;
  477. text-align: center;
  478. line-height: 100px;
  479. font-size: 20px;
  480. color: #fff;
  481. font-weight: bold;
  482. }
  483. .marketPublish:hover {
  484. background: #f60;
  485. cursor: pointer;
  486. }
  487. </style>