dockDetail copy.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  1. <template>
  2. <div id="dockDetail">
  3. <el-row>
  4. <el-col :span="24" class="style">
  5. <el-image :src="beijingPic"></el-image>
  6. <el-col :span="24" class="info">
  7. <div class="w_1200">
  8. <el-col :span="24" class="top">
  9. <p>吉林省计算中心对接直播大厅</p>
  10. <p>主办方:吉林省计算中心</p>
  11. </el-col>
  12. <el-col :span="24" class="main">
  13. <el-col :span="6" class="btn">
  14. <el-col :span="24">
  15. <el-button type="primary" icon="el-icon-tickets" @click="btnInfo">项目信息</el-button>
  16. </el-col>
  17. <el-col :span="24" v-if="this.user.uid != productInfo.userid">
  18. <el-button type="danger" icon="el-icon-phone-outline" @click="btnPhone">对接</el-button>
  19. </el-col>
  20. <el-col :span="24" v-if="this.user.uid != productInfo.userid">
  21. <el-button type="success" icon="el-icon-check" @click="btnTrade">申请交易</el-button>
  22. </el-col>
  23. </el-col>
  24. <el-col :span="18" class="mainInfo">
  25. <el-col :span="24" v-if="display === '1'">
  26. <p class="name textOver">{{ productInfo.name }}</p>
  27. <div class="brief">
  28. <p>
  29. <span>应用领域:{{ productInfo.field || '暂无' }}</span>
  30. <span>服务范围:{{ productInfo.scope || '暂无' }}</span>
  31. </p>
  32. <p>
  33. <span>产品类型:{{ productInfo.product_type_name || '暂无' }}</span>
  34. <span>研发阶段:{{ productInfo.phase == 1 ? '阶段成果' : productInfo.phase == 2 ? '最终成果' : '暂无' }}</span>
  35. </p>
  36. <p>
  37. <span>{{
  38. productInfo.business == '0' ? '公用' : productInfo.business == '1' ? '转让' : productInfo.business == '2' ? '竞价' : '暂无'
  39. }}</span>
  40. <span>交易价格:{{ productInfo.price || '暂无' }}/{{ productInfo.priceunit || '暂无' }}</span>
  41. </p>
  42. </div>
  43. <p class="intro">
  44. <span><i class="el-icon-date"></i>项目简介</span>
  45. <span>{{ productInfo.introduction || '暂无' }}</span>
  46. </p>
  47. </el-col>
  48. <el-col :span="24" v-if="display === '2'" class="contact">
  49. <!-- <p>
  50. 联系人姓名:<span style="color:red;">{{ productInfo.contact_user }}</span>
  51. </p>
  52. <p>
  53. 联系人电话:<span style="color:red;">{{ productInfo.contact_tel }}</span>
  54. </p> -->
  55. <chat :room="room"></chat>
  56. </el-col>
  57. </el-col>
  58. </el-col>
  59. </div>
  60. </el-col>
  61. </el-col>
  62. </el-row>
  63. </div>
  64. </template>
  65. <script>
  66. import _ from 'lodash';
  67. import { mapState, createNamespacedHelpers } from 'vuex';
  68. import chat from './parts/chat.vue';
  69. const { mapActions: mapProduct } = createNamespacedHelpers('marketproduct');
  70. const { mapActions: personalRoom } = createNamespacedHelpers('personalroom');
  71. const { mapActions: transaction } = createNamespacedHelpers('transaction');
  72. export default {
  73. name: 'dockDetail',
  74. props: {},
  75. components: { chat }, //
  76. data: () => ({
  77. beijingPic: require('@a/live/top_3.png'),
  78. display: '1',
  79. productInfo: {},
  80. room: {},
  81. }),
  82. created() {
  83. if (this.$route.query.id) {
  84. this.searchInfo();
  85. }
  86. },
  87. methods: {
  88. ...mapProduct(['fetch']),
  89. ...personalRoom(['create', 'countDelete']),
  90. ...transaction({ buyProduct: 'create' }),
  91. async searchInfo() {
  92. let res = await this.fetch(this.$route.query.id);
  93. if (res.errcode === 0) {
  94. this.$set(this, `productInfo`, res.data);
  95. }
  96. },
  97. // 项目信息
  98. btnInfo() {
  99. this.display = '1';
  100. },
  101. // 线下对接
  102. async btnPhone() {
  103. if (!this.room.id) {
  104. //TODO 请求房间号
  105. let obj = {};
  106. if (!this.user.uid) {
  107. this.$message.error('游客身份无法与卖家对话,请先注册');
  108. return;
  109. } else {
  110. obj.buyer_id = this.user.uid;
  111. obj.buyer_name = this.user.name;
  112. }
  113. if (!this.productInfo.userid) {
  114. this.$message.error('缺少卖家信息,请联系卖家或管理员');
  115. return;
  116. } else {
  117. obj.seller_id = this.productInfo.userid;
  118. obj.seller_name = this.productInfo.contact_user;
  119. }
  120. let res = await this.create(obj);
  121. if (this.$checkRes(res)) {
  122. this.$set(this, `room`, res.data);
  123. }
  124. }
  125. this.display = '2';
  126. },
  127. async btnTrade() {
  128. let form = {};
  129. form.userid = this.user.uid;
  130. form.username = this.user.name;
  131. form.product_id = this.productInfo.id;
  132. form.product_name = this.productInfo.name;
  133. form.market_userid = this.productInfo.userid;
  134. form.market_username = this.productInfo.contact_user;
  135. form.status = '0';
  136. let res = await this.buyProduct(form);
  137. this.$checkRes(res, '购买申请成功', res.errmsg || '购买申请失败');
  138. },
  139. killTalk() {
  140. this.$alert('您确认对话已经可以结束了吗?');
  141. let room_id = _.get(this.room, 'id');
  142. if (room_id) {
  143. this.countDelete(room_id);
  144. }
  145. },
  146. },
  147. computed: {
  148. ...mapState(['user']),
  149. pageTitle() {
  150. return `${this.$route.meta.title}`;
  151. },
  152. },
  153. metaInfo() {
  154. return { title: this.$route.meta.title };
  155. },
  156. beforeDestroy() {
  157. this.killTalk();
  158. },
  159. beforeRouteLeave(to, from, next) {
  160. this.killTalk();
  161. next();
  162. },
  163. };
  164. </script>
  165. <style lang="less" scoped>
  166. .w_1200 {
  167. width: 1200px;
  168. margin: 0 auto;
  169. }
  170. p {
  171. padding: 0;
  172. margin: 0;
  173. }
  174. .style {
  175. height: 100vh;
  176. }
  177. .style .info {
  178. position: relative;
  179. top: -450px;
  180. }
  181. .style .top {
  182. position: relative;
  183. top: 0;
  184. width: 100%;
  185. text-align: center;
  186. z-index: 999;
  187. height: 230px;
  188. margin: 0 0 20px 0;
  189. }
  190. .style .top p:first-child {
  191. font-size: 50px;
  192. color: #fff;
  193. }
  194. .style .top p:last-child {
  195. font-size: 30px;
  196. color: #fff;
  197. position: absolute;
  198. width: 100%;
  199. top: 170px;
  200. }
  201. .style .main {
  202. height: 740px;
  203. border: 1px solid red;
  204. background: #fff;
  205. overflow: hidden;
  206. padding: 30px 20px;
  207. margin-bottom: 10px;
  208. }
  209. .main .btn div {
  210. padding: 30px 0 0px 0;
  211. }
  212. /deep/.main .btn .el-button {
  213. float: left;
  214. margin: 0 40px;
  215. width: 70%;
  216. }
  217. .main .mainInfo {
  218. border: 1px solid red;
  219. height: 680px;
  220. }
  221. .mainInfo .name {
  222. font-size: 25px;
  223. text-align: center;
  224. height: 90px;
  225. line-height: 90px;
  226. border-bottom: 2px solid red;
  227. margin: 0 60px;
  228. }
  229. .mainInfo .brief {
  230. float: left;
  231. padding: 0 88px 15px 88px;
  232. color: red;
  233. margin: 15px 20px 0 19px;
  234. width: 75%;
  235. border-bottom: 1px dashed red;
  236. }
  237. .mainInfo .brief p {
  238. float: left;
  239. width: 100%;
  240. padding: 0 0 15px 0;
  241. }
  242. .mainInfo .brief p span:first-child {
  243. float: left;
  244. width: 50%;
  245. }
  246. .mainInfo .intro {
  247. float: left;
  248. padding: 20px;
  249. width: 95%;
  250. }
  251. .mainInfo .intro span:first-child {
  252. display: inline-block;
  253. width: 100%;
  254. font-size: 20px;
  255. color: red;
  256. }
  257. .mainInfo .intro span:last-child {
  258. display: inline-block;
  259. line-height: 25px;
  260. color: #666;
  261. text-indent: 2rem;
  262. overflow: hidden;
  263. text-overflow: ellipsis;
  264. -webkit-line-clamp: 13;
  265. word-break: break-all;
  266. display: -webkit-box;
  267. -webkit-box-orient: vertical;
  268. }
  269. .mainInfo .contact {
  270. padding: 20px;
  271. font-size: 18px;
  272. }
  273. </style>