marketlists.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <div id="marketlists">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <div class="w_1200">
  6. <el-col :span="5" class="menu">
  7. <el-image :src="squareImage"></el-image>
  8. <span class="menuTitle">Menu</span>
  9. <el-col :span="24" class="menuList" v-for="(item, index) in menuList" :key="index">
  10. <p @click="changeMenu(item.name, index)" :style="`color:${menuIndex == index ? menuColor : ''}`">{{ item.name }}</p>
  11. </el-col>
  12. </el-col>
  13. <el-col :span="18" class="listInfo">
  14. <span v-if="display == 'list'">
  15. <el-col :span="24" class="listDown">
  16. <span v-if="column_name == '科技需求'">
  17. <technology
  18. :technologyList="technologyList"
  19. :column_name="column_name"
  20. :total="technologyTotal"
  21. @clickDetail="clickDetail"
  22. @searchData="searchData"
  23. ></technology>
  24. </span>
  25. <span v-else-if="column_name == '技术成果'">
  26. <achieve
  27. :achieveList="achieveList"
  28. :column_name="column_name"
  29. :total="achieveTotal"
  30. @clickDetail="clickDetail"
  31. @searchData="searchData"
  32. @changeCom="changeCom"
  33. :dropList="dropList"
  34. ></achieve>
  35. </span>
  36. <span v-else-if="column_name == '商务服务'">
  37. <business
  38. :businessList="businessList"
  39. :column_name="column_name"
  40. :total="businessTotal"
  41. @clickDetail="clickDetail"
  42. @searchData="searchData"
  43. ></business>
  44. </span>
  45. <span v-else-if="column_name == '专家智库'">
  46. <expert
  47. :expertList="expertList"
  48. :column_name="column_name"
  49. :total="expertTotal"
  50. @clickDetail="clickDetail"
  51. @searchData="searchData"
  52. @changeExpertCom="changeExpertCom"
  53. :dropList="expertdropList"
  54. ></expert>
  55. </span>
  56. </el-col>
  57. </span>
  58. <span v-else>
  59. <span v-if="column_name == '科技需求'">
  60. <el-col :span="24" style="text-align:right;">
  61. <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
  62. </el-col>
  63. <el-col :span="24">
  64. <techDetail :detailInfo="techDetail" @onSubmit="techSubmit" :displayBtn="displayBtn"></techDetail>
  65. </el-col>
  66. </span>
  67. <span v-else-if="column_name == '技术成果'">
  68. <el-col :span="24" style="text-align:right;">
  69. <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
  70. </el-col>
  71. <el-col :span="24">
  72. <achiDetail :detailInfo="achiDetail" @onSubmit="techSubmit" :displayBtn="displayBtn"></achiDetail>
  73. </el-col>
  74. </span>
  75. <span v-else-if="column_name == '商务服务'">
  76. <el-col :span="24" style="text-align:right;">
  77. <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
  78. </el-col>
  79. <el-col :span="24">
  80. <busiDetail :detailInfo="busiDetail" @onSubmit="techSubmit" :displayBtn="displayBtn"></busiDetail>
  81. </el-col>
  82. </span>
  83. <span v-else-if="column_name == '专家智库'">
  84. <el-col :span="24" style="text-align:right;">
  85. <el-button type="primary" size="mini" @click="display = 'list'">返回</el-button>
  86. </el-col>
  87. <el-col :span="24">
  88. <expeDetail :detailInfo="expeDetail" @onSubmit="expertSuubmit" :displayBtn="displayBtn"></expeDetail>
  89. </el-col>
  90. </span>
  91. </span>
  92. </el-col>
  93. </div>
  94. </el-col>
  95. </el-row>
  96. </div>
  97. </template>
  98. <script>
  99. // 列表
  100. import technology from './list/technology.vue';
  101. import achieve from './list/achieve.vue';
  102. import business from './list/business.vue';
  103. import expert from './list/expert.vue';
  104. // 详情
  105. import techDetail from './detail/techDetail.vue';
  106. import achiDetail from './detail/achiDetail.vue';
  107. import busiDetail from './detail/busiDetail.vue';
  108. import expeDetail from './detail/expeDetail.vue';
  109. import { mapState, createNamespacedHelpers } from 'vuex';
  110. const { mapActions: product } = createNamespacedHelpers('marketproduct');
  111. const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
  112. const { mapActions: transaction } = createNamespacedHelpers('transaction');
  113. const { mapActions: markettype } = createNamespacedHelpers('markettype');
  114. import _ from 'lodash';
  115. export default {
  116. name: 'marketlists',
  117. props: {},
  118. components: {
  119. // 科技需求
  120. technology,
  121. techDetail,
  122. // 技术成果
  123. achieve,
  124. achiDetail,
  125. // 商务服务
  126. business,
  127. busiDetail,
  128. // 专家智库
  129. expert,
  130. expeDetail,
  131. },
  132. data: function() {
  133. return {
  134. squareImage: require('@/assets/live/square_big.png'),
  135. // 菜单
  136. menuList: [{ name: '科技需求' }, { name: '技术成果' }, { name: '商务服务' }, { name: '专家智库' }],
  137. menuIndex: '0',
  138. menuColor: 'rgb(254, 149, 14)',
  139. // 右侧显示
  140. // list:列表,detail:详情
  141. display: 'list',
  142. // 右侧头部栏目
  143. column_name: '科技需求',
  144. // 搜索
  145. infoName: '',
  146. // 列表&詳情
  147. // 科技需求
  148. technologyList: [],
  149. technologyTotal: 0,
  150. techDetail: {},
  151. // 技术成果
  152. // 原数组
  153. priAchieve: [],
  154. priAchieveTotal: 0,
  155. // 显示数组
  156. achieveList: [],
  157. achieveTotal: 0,
  158. achiDetail: {},
  159. // 其他单位列表
  160. dropList: [],
  161. // 商务服务
  162. businessList: [],
  163. businessTotal: 0,
  164. busiDetail: {},
  165. // 专家信息
  166. // 原数组
  167. priExpert: [],
  168. priExpertTotal: 0,
  169. expertList: [],
  170. expertTotal: 0,
  171. expeDetail: {},
  172. // 单位列表
  173. expertdropList: [],
  174. // 显示按钮
  175. displayBtn: true,
  176. };
  177. },
  178. async created() {
  179. await this.searchColumn();
  180. await this.searchCom();
  181. this.$nextTick(() => {
  182. // 禁用右键
  183. document.oncontextmenu = new Function('event.returnValue=false');
  184. // 禁用选择
  185. document.onselectstart = new Function('event.returnValue=false');
  186. });
  187. },
  188. methods: {
  189. ...product({ productList: 'newquery', productFetch: 'newfetch' }),
  190. ...expertsuser({ expertsuserList: 'query', expertsuserFetch: 'fetch' }),
  191. ...transaction({ transactioncreate: 'create', transactionfetch: 'fetch' }),
  192. ...markettype({ markettypeList: 'query' }),
  193. // 查询栏目,列表,详情
  194. async searchColumn() {
  195. if (this.type == 0) {
  196. this.changeMenu(this.columnName, this.type);
  197. } else if (this.type == 1) {
  198. this.changeMenu(this.columnName, this.type);
  199. } else if (this.type == 2) {
  200. this.changeMenu(this.columnName, this.type);
  201. } else if (this.type == 3) {
  202. this.changeMenu(this.columnName, this.type);
  203. }
  204. if (this.id) {
  205. this.display = 'detail';
  206. // 查看详情
  207. this.searchDetail(this.columnName, this.id);
  208. } else {
  209. this.display = 'list';
  210. }
  211. },
  212. // 选择菜单
  213. changeMenu(columnName, index) {
  214. this.display = 'list';
  215. this.column_name = columnName;
  216. this.menuIndex = index;
  217. this.menuColor = 'rgb(254, 149, 14)';
  218. this.searchInfo({ columnName });
  219. },
  220. // 查看列表
  221. async searchInfo({ skip = 0, limit = 10, columnName, name, ...info } = {}) {
  222. if (name) info.name = name;
  223. if (columnName == '科技需求') {
  224. let res = await this.productList({ skip, type: '0', status: '1', ...info });
  225. if (this.$checkRes(res)) this.$set(this, `technologyList`, res.data);
  226. this.$set(this, `technologyTotal`, res.total);
  227. } else if (columnName == '技术成果') {
  228. let res = await this.productList({ skip, type: '1', status: '1', ...info });
  229. if (this.$checkRes(res)) this.$set(this, `priAchieve`, res.data);
  230. this.$set(this, `priAchieveTotal`, res.total);
  231. this.$set(this, `achieveList`, res.data);
  232. this.$set(this, `achieveTotal`, res.total);
  233. } else if (columnName == '商务服务') {
  234. let res = await this.productList({ skip, type: '2', status: '1', ...info });
  235. if (this.$checkRes(res)) this.$set(this, `businessList`, res.data);
  236. this.$set(this, `businessTotal`, res.total);
  237. } else if (columnName == '专家智库') {
  238. let res = await this.expertsuserList({ skip, ...info });
  239. if (this.$checkRes(res)) this.$set(this, `priExpert`, res.data);
  240. this.$set(this, `priExpertTotal`, res.total);
  241. this.$set(this, `expertList`, res.data);
  242. this.$set(this, `expertTotal`, res.total);
  243. }
  244. },
  245. // 查看详情
  246. async searchDetail(columnName, id) {
  247. if (columnName == '科技需求') {
  248. let res = await this.productFetch(id);
  249. if (this.$checkRes(res)) this.$set(this, `techDetail`, res.data);
  250. } else if (columnName == '技术成果') {
  251. let res = await this.productFetch(id);
  252. if (this.$checkRes(res)) this.$set(this, `achiDetail`, res.data);
  253. } else if (columnName == '商务服务') {
  254. let res = await this.productFetch(id);
  255. if (this.$checkRes(res)) this.$set(this, `busiDetail`, res.data);
  256. } else {
  257. let res = await this.expertsuserFetch(id);
  258. if (this.$checkRes(res)) this.$set(this, `expeDetail`, res.data);
  259. }
  260. },
  261. // 点击查看详情
  262. clickDetail({ column_name, id }) {
  263. this.$set(this, `column_name`, column_name);
  264. this.display = 'detail';
  265. this.searchDetail(column_name, id);
  266. },
  267. // 科技需求,技术成果,商务服务洽谈
  268. async techSubmit({ data }) {
  269. let form = {
  270. userid: this.user.uid,
  271. username: this.user.name,
  272. product_id: data.id,
  273. product_name: data.name,
  274. market_userid: data.userid,
  275. market_username: data.contacts,
  276. status: '0',
  277. };
  278. if (!this.user.uid) {
  279. this.$message({
  280. dangerouslyUseHTMLString: true,
  281. message: '<strong><a href="http://broadcast.waityou24.cn/platlive/webLogin" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
  282. type: 'error',
  283. });
  284. return;
  285. } else {
  286. let res = await this.transactioncreate(form);
  287. this.$checkRes(res, '购买申请成功', res.errmsg || '购买申请失败');
  288. }
  289. },
  290. // 专家智库
  291. async expertSuubmit({ data }) {
  292. let form = {
  293. userid: this.user.uid,
  294. username: this.user.name,
  295. product_id: data.id,
  296. product_name: data.name,
  297. market_userid: data.id,
  298. market_username: data.name,
  299. status: '0',
  300. type: '1',
  301. };
  302. if (!this.user.uid) {
  303. // this.$message.error('游客身份无法与卖家对话,请先注册');
  304. this.$message({
  305. dangerouslyUseHTMLString: true,
  306. message: '<strong><a href="http://broadcast.waityou24.cn/platlive/webLogin" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
  307. type: 'error',
  308. });
  309. return;
  310. } else {
  311. let res = await this.transactioncreate(form);
  312. this.$checkRes(res, '购买申请成功', res.errmsg || '购买申请失败');
  313. }
  314. },
  315. // 名字查询
  316. searchData({ name, columnName }) {
  317. this.searchInfo({ columnName, name });
  318. },
  319. // 查询成果单位,专家工作单位
  320. async searchCom() {
  321. // 成果单位
  322. let res = await this.markettypeList({ category: '05' });
  323. if (this.$checkRes(res)) {
  324. let newRes = res.data;
  325. newRes.push({ name: '其他' });
  326. this.$set(this, `dropList`, newRes);
  327. }
  328. // 专家工作单位
  329. res = await this.markettypeList({ category: '06' });
  330. if (this.$checkRes(res)) {
  331. let newRes = res.data;
  332. newRes.push({ name: '其他' });
  333. this.$set(this, `expertdropList`, newRes);
  334. }
  335. },
  336. // 成果选择单位
  337. async changeCom(data) {
  338. if (data) {
  339. if (data == '中科系') {
  340. let newRes = this.priAchieve.filter(
  341. i =>
  342. i.company == '中科院长春分院' ||
  343. i.company == '中国科学院东北地理与农业生态研究所' ||
  344. i.company == '中国科学院长春应用化学研究所' ||
  345. i.company == '中科院长春光学精密机械与物理研究所'
  346. );
  347. this.$set(this, `achieveList`, newRes);
  348. this.$set(this, `achieveTotal`, newRes.length);
  349. } else if (data == '其他') {
  350. let newRes = this.priAchieve.filter(
  351. i =>
  352. i.company != '中科院长春分院' &&
  353. i.company != '中国科学院东北地理与农业生态研究所' &&
  354. i.company != '中国科学院长春应用化学研究所' &&
  355. i.company != '中科院长春光学精密机械与物理研究所' &&
  356. i.company != '吉林大学' &&
  357. i.company != '长春工业大学'
  358. );
  359. this.$set(this, `achieveList`, newRes);
  360. this.$set(this, `achieveTotal`, newRes.length);
  361. } else {
  362. let newRes = this.priAchieve.filter(f => f.company.includes(data));
  363. if (newRes) {
  364. this.$set(this, `achieveList`, newRes);
  365. this.$set(this, `achieveTotal`, newRes.length);
  366. }
  367. }
  368. } else {
  369. this.$set(this, `achieveList`, this.priAchieve);
  370. this.$set(this, `achieveTotal`, this.priAchieve.length);
  371. }
  372. },
  373. // 专家选择单位
  374. async changeExpertCom(data) {
  375. if (data) {
  376. if (data == '中科系') {
  377. let newRes = this.priExpert.filter(
  378. i =>
  379. i.company == '中科院长春分院' ||
  380. i.company == '中国科学院东北地理与农业生态研究所' ||
  381. i.company == '中国科学院长春应用化学研究所' ||
  382. i.company == '中科院长春光学精密机械与物理研究所'
  383. );
  384. this.$set(this, `expertList`, newRes);
  385. this.$set(this, `expertTotal`, newRes.length);
  386. } else if (data == '其他') {
  387. let newRes = this.priExpert.filter(
  388. i =>
  389. i.company != '中科院长春分院' &&
  390. i.company != '中国科学院东北地理与农业生态研究所' &&
  391. i.company != '中国科学院长春应用化学研究所' &&
  392. i.company != '中科院长春光学精密机械与物理研究所' &&
  393. i.company != '吉林大学' &&
  394. i.company != '长春工业大学' &&
  395. i.company != '长春工程学院'
  396. );
  397. this.$set(this, `expertList`, newRes);
  398. this.$set(this, `expertTotal`, newRes.length);
  399. } else {
  400. let newRes = this.priExpert.filter(f => f.company.includes(data));
  401. if (newRes) {
  402. this.$set(this, `expertList`, newRes);
  403. this.$set(this, `expertTotal`, newRes.length);
  404. }
  405. }
  406. } else {
  407. this.$set(this, `expertList`, this.priExpert);
  408. this.$set(this, `expertTotal`, this.priExpert.legnth);
  409. }
  410. },
  411. },
  412. computed: {
  413. ...mapState(['user']),
  414. type() {
  415. return this.$route.query.type;
  416. },
  417. columnName() {
  418. return this.$route.query.column_name;
  419. },
  420. id() {
  421. return this.$route.query.id;
  422. },
  423. pageTitle() {
  424. return `${this.$route.meta.title}`;
  425. },
  426. },
  427. metaInfo() {
  428. return { title: this.$route.meta.title };
  429. },
  430. };
  431. </script>
  432. <style lang="less" scoped>
  433. .w_1200 {
  434. // width: 80%;
  435. width: 1200px;
  436. margin: 0 auto;
  437. }
  438. .main {
  439. margin: 15px 0;
  440. .menu {
  441. height: 600px;
  442. overflow: hidden;
  443. padding: 15px 10px;
  444. background: no-repeat 100% 100%;
  445. background-image: url('~@/assets/live/menu_back.jpg');
  446. box-sizing: border-box;
  447. box-shadow: 0 0 10px #bbbaba;
  448. .menuTitle {
  449. font-size: 24px;
  450. color: #92959a;
  451. font-weight: bold;
  452. position: relative;
  453. top: -10px;
  454. left: 10px;
  455. }
  456. .menuList {
  457. height: 60px;
  458. line-height: 60px;
  459. border-bottom: 1px solid #2d64b3;
  460. p {
  461. font-weight: bold;
  462. font-size: 18px;
  463. color: #044b79;
  464. }
  465. }
  466. .menuList:hover {
  467. cursor: pointer;
  468. }
  469. }
  470. .listInfo {
  471. float: right;
  472. width: 78%;
  473. min-height: 600px;
  474. overflow: hidden;
  475. box-shadow: 0 0 10px #2d64b3;
  476. padding: 10px;
  477. }
  478. }
  479. </style>