xmdj.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. <template>
  2. <div id="xmdj">
  3. <el-row>
  4. <el-col :span="24" class="main">
  5. <el-col :span="24" class="one">
  6. <div class="w_1200">
  7. <el-col :span="20" class="left">
  8. <el-col :span="24" class="leftone">
  9. <span>科技成果展洽会</span>
  10. <span>欢迎您</span>
  11. </el-col>
  12. <el-col :span="24" class="lefttwo">
  13. SCIENTIFIC AND TECHNOLOGICAL ACHIEVEEMENTS EXHIBITION
  14. </el-col>
  15. </el-col>
  16. <el-col :span="4" class="right">
  17. <el-link :underline="false">帮助中心</el-link>
  18. </el-col>
  19. </div>
  20. </el-col>
  21. <el-col :span="24" class="two">
  22. <div class="w_1200">
  23. <el-col :span="24" class="twotop">
  24. <el-col :span="18" class="left">
  25. <p>{{ dockInfo.title }}</p>
  26. <el-image :src="two1"></el-image>
  27. </el-col>
  28. <el-col :span="6" class="right">
  29. <el-image :src="two2"></el-image>
  30. <p>{{ dockInfo.start_time }}</p>
  31. <p>距离展会结束还有</p>
  32. <p>{{ djs }}</p>
  33. </el-col>
  34. </el-col>
  35. <el-col :span="24" class="twocen">
  36. <el-col :span="15" class="left"> <span>主办单位:</span>{{ dockInfo.sponsor }} </el-col>
  37. <el-col :span="8" class="right">
  38. <el-button class="btn1" @click="$router.push({ path: '/halltwo/directTwo', query: { id: dockInfo.id } })">返回展会进行页</el-button>
  39. <el-button class="btn2" @click="$router.push({ path: '/halltwo/detail', query: { dock_id: dockInfo.id } })">进入展会总结页</el-button>
  40. </el-col>
  41. </el-col>
  42. </div>
  43. </el-col>
  44. <el-col :span="24" class="three">
  45. <div class="w_1200">
  46. <el-col :span="24" class="threeinfo">
  47. <el-col :span="4" class="left">
  48. <el-col
  49. :span="24"
  50. v-for="(item, index) in menuList"
  51. :key="index"
  52. @click.native="changeMenu(item.name, index)"
  53. :class="menuIndex == index ? 'indexClass' : ''"
  54. class="menuList"
  55. >
  56. <i :class="item.url"></i>
  57. <span>{{ item.name }}</span>
  58. </el-col>
  59. </el-col>
  60. <el-col :span="20" class="right">
  61. <span v-if="menuIndex == '0'">
  62. <span v-if="type == '0'">
  63. <xmdjtechol :detailInfo="detailInfo"></xmdjtechol>
  64. </span>
  65. <span v-else-if="type == '1'">
  66. <xmdjachieve :detailInfo="detailInfo"></xmdjachieve>
  67. </span>
  68. <span v-else-if="type == '2'">
  69. 商务信息
  70. </span>
  71. <span v-else>
  72. <xmdjaexpert :detailInfo="detailInfo"></xmdjaexpert>
  73. </span>
  74. </span>
  75. <span v-else-if="menuIndex == '1'">
  76. <el-col :span="12" class="productImage" v-for="(item, index) in detailInfo.image" :key="index">
  77. <el-image :src="item.url"></el-image>
  78. </el-col>
  79. </span>
  80. <span v-else>
  81. <xmdjchat v-if="room.id" :room="room" @onSubmit="onSubmit"></xmdjchat>
  82. </span>
  83. </el-col>
  84. </el-col>
  85. </div>
  86. </el-col>
  87. <el-col :span="24" class="four">
  88. <div class="w_1200">
  89. <ywlx></ywlx>
  90. </div>
  91. </el-col>
  92. </el-col>
  93. <div class="pz_down">
  94. <live-foot></live-foot>
  95. </div>
  96. </el-row>
  97. </div>
  98. </template>
  99. <script>
  100. import ywlx from './parts/ywlx.vue';
  101. import liveFoot from '@/layout/live/foot.vue';
  102. import xmdjtechol from './parts/xmdjtechol.vue';
  103. import xmdjachieve from './parts/xmdjachieve.vue';
  104. import xmdjaexpert from './parts/xmdjaexpert.vue';
  105. import xmdjchat from './parts/xmdjchat.vue';
  106. import { mapState, createNamespacedHelpers } from 'vuex';
  107. const { mapActions: dock } = createNamespacedHelpers('dock');
  108. const { mapActions: transaction } = createNamespacedHelpers('transaction');
  109. const { mapActions: expertsuser } = createNamespacedHelpers('expertsuser');
  110. const { mapActions: personalRoom } = createNamespacedHelpers('personalroom');
  111. var moment = require('moment');
  112. export default {
  113. metaInfo() {
  114. return { title: this.$route.meta.title };
  115. },
  116. name: 'xmdj',
  117. props: {},
  118. components: {
  119. liveFoot,
  120. ywlx,
  121. // 技术对接
  122. xmdjtechol,
  123. // 成果对接
  124. xmdjachieve,
  125. // 对接聊天,
  126. xmdjchat,
  127. // 专家对接
  128. xmdjaexpert,
  129. },
  130. data: function() {
  131. return {
  132. two1: require('@a/sy_04.png'),
  133. two2: require('@a/dock2.png'),
  134. // 展會詳情
  135. dockInfo: {},
  136. // 指导单位
  137. erweima: require('@a/二维码.jpg'),
  138. // 产品列表
  139. productList: [],
  140. // 产品详情
  141. detailInfo: {},
  142. // 显示按钮
  143. displayBtn: true,
  144. // 倒计时
  145. djs: '',
  146. // 菜单列表
  147. menuList: [
  148. {
  149. url: 'el-icon-reading',
  150. name: '项目内容',
  151. },
  152. {
  153. url: 'el-icon-picture-outline',
  154. name: '项目图片',
  155. },
  156. {
  157. url: 'el-icon-chat-dot-square',
  158. name: '项目对接',
  159. },
  160. ],
  161. menuIndex: '0',
  162. // 对接聊天
  163. room: {},
  164. };
  165. },
  166. async created() {
  167. await this.searchInfo();
  168. },
  169. methods: {
  170. ...dock({ dockQuery: 'query', dockFetch: 'fetch', goodsquery: 'goodsquery' }),
  171. ...transaction({ buyProduct: 'create' }),
  172. ...expertsuser(['fetch']),
  173. ...personalRoom(['create', 'countDelete']),
  174. async searchInfo() {
  175. // 查询展会详情
  176. if (this.dock_id) {
  177. let res = await this.dockFetch(this.dock_id);
  178. if (this.$checkRes(res)) {
  179. this.$set(this, `dockInfo`, res.data);
  180. if (this.type == '3') {
  181. this.searchExpert();
  182. } else {
  183. // 查询产品
  184. let czxm = res.data.apply.map(item => item.goodsList);
  185. czxm = _.flattenDeep(czxm);
  186. let czxmNew = czxm.filter(item => item.dockStatus == '1');
  187. this.$set(this, `productList`, czxmNew);
  188. this.searchProduct();
  189. }
  190. }
  191. }
  192. },
  193. seachtime() {
  194. // 倒计时
  195. this.timer = setInterval(() => {
  196. this.setTime(this.dockInfo.start_time);
  197. }, 1000);
  198. },
  199. // 倒计时
  200. setTime(end) {
  201. let now = moment().format('YYYY-MM-DD HH:mm:ss');
  202. // let now = moment().format('2020-11-20 08:00:00');
  203. if (end == now) {
  204. clearInterval(this.timer);
  205. this.$set(this, `djs`, '展会开始');
  206. } else {
  207. let sec = moment(end).diff(now, 'seconds');
  208. let day = _.floor(sec / 60 / 60 / 24);
  209. let hour = _.floor(Math.abs(day * 24 - sec / 60 / 60));
  210. let dayhour = day * 24;
  211. let minute = _.floor(Math.abs(day * 24 * 60 + hour * 60 - sec / 60));
  212. let second = _.floor(Math.abs(day * 24 * 60 * 60 + hour * 60 * 60 + minute * 60 - sec));
  213. let str = `${hour + dayhour}小时${minute}分${second}秒`;
  214. this.$set(this, `djs`, str);
  215. }
  216. },
  217. // 查找产品详情
  218. searchProduct() {
  219. let productInfo = this.productList.find(i => i._id == this.id);
  220. if (productInfo) {
  221. this.$set(this, `detailInfo`, productInfo);
  222. }
  223. },
  224. // 查找专家详情
  225. async searchExpert() {
  226. let res = await this.fetch(this.id);
  227. if (res.errcode === 0) {
  228. this.$set(this, `detailInfo`, res.data);
  229. }
  230. },
  231. // 选择菜单
  232. changeMenu(name, index) {
  233. this.menuIndex = index;
  234. if (name == '项目对接') {
  235. this.btnPhone();
  236. }
  237. },
  238. // 聊天
  239. async btnPhone() {
  240. if (!this.room.id) {
  241. //TODO 请求房间号
  242. let obj = {};
  243. if (!this.user.uid) {
  244. // this.$message.error('游客身份无法与卖家对话,请先注册');
  245. this.$message({
  246. dangerouslyUseHTMLString: true,
  247. message: '<strong><a href="http://free.liaoningdoupo.com/platlive/webLogin" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
  248. type: 'error',
  249. });
  250. return;
  251. } else {
  252. obj.buyer_id = this.user.uid;
  253. obj.buyer_name = this.user.name;
  254. }
  255. if (!this.detailInfo.userid) {
  256. this.$message.error('缺少卖家信息,请联系卖家或管理员');
  257. return;
  258. } else {
  259. obj.seller_id = this.detailInfo.userid;
  260. obj.seller_name = this.detailInfo.contacts || this.detailInfo.name;
  261. }
  262. console.log(obj);
  263. let res = await this.create(obj);
  264. if (this.$checkRes(res)) {
  265. this.$set(this, `room`, res.data);
  266. }
  267. }
  268. },
  269. // 洽谈
  270. async onSubmit() {
  271. let data = this.detailInfo;
  272. let form = {};
  273. if (this.type == '3') {
  274. form = {
  275. userid: this.user.uid,
  276. username: this.user.name,
  277. product_id: data.id,
  278. product_name: data.name,
  279. market_userid: data.id,
  280. market_username: data.name,
  281. status: '0',
  282. type: '1',
  283. };
  284. } else {
  285. form = {
  286. userid: this.user.uid,
  287. username: this.user.name,
  288. product_id: data._id,
  289. product_name: data.name,
  290. market_userid: data.userid,
  291. market_username: data.contacts,
  292. status: '0',
  293. type: '1',
  294. };
  295. }
  296. if (!this.user.uid) {
  297. // this.$message.error('游客身份无法与卖家对话,请先注册');
  298. this.$message({
  299. dangerouslyUseHTMLString: true,
  300. message: '<strong><a href="http://free.liaoningdoupo.com/platlive/webLogin" style="color:red;">游客身份无法与卖家对话,请先注册</a></strong>',
  301. type: 'error',
  302. });
  303. return;
  304. } else {
  305. let res = await this.buyProduct(form);
  306. this.$checkRes(res, '购买申请成功', res.errmsg || '购买申请失败');
  307. }
  308. },
  309. },
  310. computed: {
  311. ...mapState(['user']),
  312. dock_id() {
  313. return this.$route.query.dock_id;
  314. },
  315. id() {
  316. return this.$route.query.id;
  317. },
  318. type() {
  319. return this.$route.query.type;
  320. },
  321. },
  322. watch: {
  323. dockInfo: {
  324. immediate: true,
  325. deep: true,
  326. handler(val) {
  327. this.seachtime();
  328. },
  329. },
  330. },
  331. };
  332. </script>
  333. <style lang="less" scoped>
  334. .main {
  335. .one {
  336. height: 100px;
  337. .left {
  338. height: 100px;
  339. .leftone {
  340. margin: 15px 0 0 0;
  341. span:nth-child(1) {
  342. font-size: 35px;
  343. color: #535353;
  344. font-weight: bold;
  345. font-family: cursive;
  346. }
  347. span:nth-child(2) {
  348. font-size: 15px;
  349. padding: 0 10px;
  350. color: #535353;
  351. }
  352. }
  353. .lefttwo {
  354. font-size: 12px;
  355. color: #535353;
  356. }
  357. }
  358. .right {
  359. height: 100px;
  360. line-height: 100px;
  361. text-align: right;
  362. }
  363. }
  364. .two {
  365. height: 610px;
  366. background: url('~@/assets/bj1.jpg');
  367. padding: 20px 0;
  368. .twotop {
  369. margin: 0 0 10px 0;
  370. .left {
  371. height: 357px;
  372. margin: 0 10px 0 0;
  373. background: url('~@/assets/dock1.png');
  374. p {
  375. float: left;
  376. width: 79%;
  377. font-size: 43px;
  378. color: #fff;
  379. font-weight: bold;
  380. padding: 13% 0 0 20px;
  381. }
  382. .el-image {
  383. float: left;
  384. width: 153px;
  385. height: 94px;
  386. margin: 4% 0 0 0;
  387. }
  388. }
  389. .right {
  390. background-color: #ffffff;
  391. width: 24%;
  392. height: 357px;
  393. text-align: center;
  394. padding: 0 10px;
  395. .el-image {
  396. width: 120px;
  397. height: 48px;
  398. margin: 50px 0 0px 0;
  399. }
  400. p:nth-child(2) {
  401. font-size: 18px;
  402. margin: 30px 0 5px 0;
  403. }
  404. p:nth-child(3) {
  405. font-size: 22px;
  406. font-weight: bold;
  407. margin-bottom: 30px;
  408. }
  409. p:nth-child(4) {
  410. background: #f5f5f5;
  411. padding: 20px 0px;
  412. border-radius: 5px;
  413. font-size: 30px;
  414. }
  415. }
  416. .right:hover {
  417. cursor: pointer;
  418. p:nth-child(3) {
  419. color: #535353;
  420. }
  421. }
  422. }
  423. .twocen {
  424. height: 130px;
  425. overflow: hidden;
  426. line-height: 130px;
  427. background-color: #fff;
  428. margin: 0 0 35px 0;
  429. .left {
  430. font-size: 18px;
  431. margin: 0 0 0 30px;
  432. span {
  433. font-size: 22px;
  434. font-weight: bold;
  435. }
  436. }
  437. .right {
  438. .btn1 {
  439. font-size: 16px;
  440. color: #fff;
  441. background: red;
  442. border: none;
  443. font-weight: bold;
  444. }
  445. .btn2 {
  446. font-size: 16px;
  447. color: #ff0000;
  448. border: 1px solid #ff0000;
  449. font-weight: bold;
  450. }
  451. }
  452. }
  453. }
  454. .three {
  455. min-height: 700px;
  456. overflow: hidden;
  457. position: relative;
  458. top: -50px;
  459. z-index: 999;
  460. .threeinfo {
  461. min-height: 700px;
  462. overflow: hidden;
  463. background-color: #fff;
  464. padding: 50px 15px 0 15px;
  465. box-shadow: 0 5px 15px rgba(33, 82, 203, 0.35);
  466. .left {
  467. .menuList {
  468. height: 50px;
  469. border-radius: 5px;
  470. background-color: #bccbef;
  471. color: #2152cb;
  472. margin: 0 0 30px 0;
  473. padding: 0 0 0 30px;
  474. i {
  475. font-size: 35px;
  476. padding: 6px 0;
  477. }
  478. span {
  479. position: relative;
  480. top: -8px;
  481. font-size: 18px;
  482. left: 6px;
  483. }
  484. }
  485. .indexClass {
  486. background: #2152cb;
  487. color: #fff;
  488. i {
  489. color: #fff;
  490. }
  491. }
  492. .menuList:hover {
  493. cursor: pointer;
  494. background: #2152cb;
  495. color: #fff;
  496. i {
  497. color: #fff;
  498. }
  499. }
  500. }
  501. .right {
  502. min-height: 650px;
  503. padding: 0 0 0 15px;
  504. .productImage {
  505. width: 48%;
  506. margin: 0 15px 15px 0;
  507. .el-image {
  508. width: 100%;
  509. border-radius: 10px;
  510. }
  511. }
  512. }
  513. }
  514. }
  515. .four {
  516. border-top: 2px solid #305798;
  517. height: 250px;
  518. .info {
  519. .left {
  520. h1 {
  521. padding: 15px 0;
  522. font-weight: bold;
  523. color: #4d4d4d;
  524. }
  525. p {
  526. font-size: 16px;
  527. color: #4d4d4d;
  528. padding: 5px 0;
  529. }
  530. }
  531. .right {
  532. text-align: center;
  533. }
  534. }
  535. }
  536. }
  537. </style>