demandDetail.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442
  1. <template>
  2. <custom-layout class="main">
  3. <el-col :span="24" class="one">
  4. <div class="w_1300">
  5. <div class="info_1"></div>
  6. <div class="info_2">
  7. <div class="area">
  8. <el-icon color="#0085f5"><Location /></el-icon>
  9. <span>{{ getArea(info.area) }}</span>
  10. </div>
  11. <div class="info_title">
  12. <div class="name">{{ info.name || '暂无' }}</div>
  13. <div class="collect iscollect" @click="toCollect" v-if="info.is_collection">
  14. <el-icon :size="24" color="#1073ff"><StarFilled /></el-icon>
  15. <span>已收藏</span>
  16. </div>
  17. <div class="collect" v-else @click="toCollect">
  18. <el-icon :size="24"><Star /></el-icon>
  19. <span>收藏</span>
  20. </div>
  21. </div>
  22. <div class="other">
  23. <span class="other_1">{{ getDict(info.urgent, 'urgent') || '暂无' }}</span>
  24. <div class="other_2">
  25. <p>
  26. 资金预算:<span class="moeny">{{ info.money || '面议' }}</span>
  27. </p>
  28. <p>
  29. 应用行业:<span>{{ info.field || '暂无' }} </span>
  30. </p>
  31. <p>
  32. 截止时间:<span class="time">{{ getTime(info.time) || '暂无' }}</span>
  33. </p>
  34. <p>
  35. 所属地区 :<span> {{ getArea(info.area) || '暂无' }}</span>
  36. </p>
  37. <p>
  38. 所属企业 :<span>{{ info.company || '暂无' }}</span>
  39. </p>
  40. <p v-if="user && user.id">
  41. 联 系 人 :<span>{{ info.contacts || '暂无' }}</span>
  42. </p>
  43. <!-- <p v-if="user && user.id">
  44. 联系电话:<span>{{ info.tel || '暂无' }}</span>
  45. </p> -->
  46. </div>
  47. </div>
  48. <div class="state">待解决</div>
  49. </div>
  50. <div class="title"><i></i>预约对接</div>
  51. <div class="infoButton">
  52. <div class="button" @click="toChat">预约对接</div>
  53. </div>
  54. <div class="title"><i></i>需求描述</div>
  55. <div class="info_3">
  56. <p>{{ info.brief || '暂无' }}</p>
  57. </div>
  58. <div class="title"><i></i>相关需求</div>
  59. <div class="info_4">
  60. <div class="list" v-for="(item, index) in list" :key="index" @click="toView(item)">
  61. <h2 class="name textMore">
  62. <span>{{ item.name || '暂无' }}</span>
  63. </h2>
  64. <div class="other">
  65. <span class="other_1">{{ getDict(item.urgent, 'urgent') || '暂无' }}</span>
  66. <div class="other_2">
  67. <span>应用行业:</span>
  68. {{ item.field || '暂无' }}
  69. </div>
  70. <div class="other_2">
  71. <span>资金预算:</span>
  72. {{ item.money || '面议' }}
  73. </div>
  74. <div class="other_2 textOne">
  75. <el-icon color="#0085f5"><Location /></el-icon>
  76. {{ getArea(item.area) }}
  77. <span class="state">{{ getDict(item.status, 'status') || '未解决' }}</span>
  78. </div>
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </el-col>
  84. </custom-layout>
  85. </template>
  86. <script setup>
  87. import { get } from 'lodash-es'
  88. import { DictDataStore } from '@/store/api/system/dictData'
  89. import { ContactApplyStore } from '@/store/api/user/contactApply'
  90. import { DemandStore } from '@/store/api/platform/demand'
  91. const store = DemandStore()
  92. const dictDataStore = DictDataStore()
  93. const contactApplyStore = ContactApplyStore()
  94. // 收藏
  95. import moment from 'moment'
  96. import { CollectionStore } from '@/store/api/platform/collection'
  97. const collectionStore = CollectionStore()
  98. import { UserStore } from '@/store/user'
  99. const userStore = UserStore()
  100. const user = computed(() => userStore.user)
  101. const $checkRes = inject('$checkRes')
  102. // 加载中
  103. const loading = ref(false)
  104. // 路由
  105. const route = useRoute()
  106. const router = useRouter()
  107. const info = ref({})
  108. const list = ref([])
  109. // 字典表
  110. const fieldList = ref([])
  111. const attributeList = ref([])
  112. const matureList = ref([])
  113. const sellList = ref([])
  114. const technologyList = ref([])
  115. const urgentList = ref([])
  116. const statusList = ref([])
  117. // 请求
  118. onMounted(async () => {
  119. loading.value = true
  120. await searchOther()
  121. await search()
  122. await searchAchieve()
  123. loading.value = false
  124. })
  125. const search = async () => {
  126. let id = route.query.id
  127. if (id) {
  128. let res = await store.detail(id)
  129. if (res.errcode == '0') info.value = res.data
  130. }
  131. }
  132. const searchAchieve = async () => {
  133. const data = {
  134. skip: 0,
  135. limit: 3,
  136. is_use: '0',
  137. status: '1',
  138. field: info.value.field
  139. }
  140. const res = await store.list(data)
  141. if (res.errcode == '0') list.value = res.data
  142. }
  143. const searchOther = async () => {
  144. let result
  145. // // 成熟度
  146. // result = await dictDataStore.query({ code: 'mature', is_use: '0' })
  147. // if ($checkRes(result)) matureList.value = result.data
  148. // // 出让方式
  149. // result = await dictDataStore.query({ code: 'sell', is_use: '0' })
  150. // if ($checkRes(result)) sellList.value = result.data
  151. // // 技术领域
  152. // result = await dictDataStore.query({ code: 'field', is_use: '0' })
  153. // if ($checkRes(result)) fieldList.value = result.data
  154. // // 属性
  155. // result = await dictDataStore.query({ code: 'attribute', is_use: '0' })
  156. // if ($checkRes(result)) attributeList.value = result.data
  157. // // 技术分类
  158. // result = await dictDataStore.query({ code: 'technology', is_use: '0' })
  159. // if ($checkRes(result)) technologyList.value = result.data
  160. // 需求紧急度
  161. result = await dictDataStore.query({ code: 'urgent', is_use: '0' })
  162. if ($checkRes(result)) urgentList.value = result.data
  163. // 状态
  164. result = await dictDataStore.query({ code: 'examStatus', is_use: '0' })
  165. if ($checkRes(result)) statusList.value = result.data
  166. }
  167. // 字典数据转换
  168. const getDict = (data, model) => {
  169. let res
  170. if (model == 'mature') res = matureList.value.find((f) => f.value == data)
  171. else if (model == 'status') res = statusList.value.find((f) => f.value == data)
  172. else if (model == 'sell') res = sellList.value.find((f) => f.value == data)
  173. else if (model == 'field') res = fieldList.value.find((f) => f.value == data)
  174. else if (model == 'attribute') res = attributeList.value.find((f) => f.value == data)
  175. else if (model == 'technology') res = technologyList.value.find((f) => f.value == data)
  176. else if (model == 'urgent') res = urgentList.value.find((f) => f.value == data)
  177. return get(res, 'label')
  178. }
  179. // 地区
  180. const getArea = (data) => {
  181. if (data) return data.join('-')
  182. else return '暂无地区'
  183. }
  184. // 时间
  185. const getTime = (data) => {
  186. if (data) return data.join('-')
  187. else return '暂无'
  188. }
  189. // 查看详情
  190. const toView = (item) => {
  191. router.push({ path: '/demand/detail', query: { id: item.id || item._id } }).then(() => {
  192. // 重新刷新页面
  193. location.reload()
  194. })
  195. }
  196. const toCollect = async () => {
  197. if (user.value.id) {
  198. info.value.is_collection = !info.value.is_collection
  199. let res
  200. let message
  201. const data = {
  202. user: user.value.id,
  203. source: info.value.id,
  204. type: 'demand',
  205. time: moment().format('YYYY-MM-DD')
  206. }
  207. if (info.value.is_collection) {
  208. message = '收藏成功'
  209. res = await collectionStore.create(data)
  210. } else {
  211. message = '取消收藏成功'
  212. res = await collectionStore.cancel(data)
  213. }
  214. if (res.errcode === 0) {
  215. ElMessage({ message, type: 'success' })
  216. await search()
  217. }
  218. } else ElMessage({ message: '未登录!', type: 'error' })
  219. }
  220. const toChat = () => {
  221. if (user.value.id) {
  222. ElMessageBox.confirm(`您确认要预约对接?`, '提示', { confirmButtonText: '确定', cancelButtonText: '取消', type: 'warning' })
  223. .then(async () => {
  224. let source_id = route.query.id
  225. let source = 'demand'
  226. let apply_user = user.value.id
  227. const obj = { source_id, source, apply_user }
  228. const res = await contactApplyStore.create(obj)
  229. $checkRes(res,`预约对接成功等待消息通知`,res.errmsg)
  230. })
  231. .catch(() => {})
  232. } else ElMessage({ message: '未登录!', type: 'error' })
  233. }
  234. </script>
  235. <style scoped lang="scss">
  236. .main {
  237. .one {
  238. background: url(/images/bg-need-detail.jpg) no-repeat;
  239. background-position: center top;
  240. padding-bottom: 30px;
  241. .info_1 {
  242. padding: 30px 0;
  243. }
  244. .info_2 {
  245. position: relative;
  246. padding: 0 40px;
  247. background-color: #fff;
  248. box-shadow: 0 0 13px 0 rgba(5, 88, 219, 0.18);
  249. .area {
  250. display: flex;
  251. align-items: center;
  252. justify-content: flex-end;
  253. padding-top: 15px;
  254. font-size: $global-font-size-16;
  255. span {
  256. margin: 0 0 0 5px;
  257. }
  258. }
  259. .info_title {
  260. display: flex;
  261. justify-content: space-between;
  262. align-items: center;
  263. .name {
  264. margin-top: 15px;
  265. font-size: $global-font-size-24;
  266. width: 90%;
  267. line-height: 36px;
  268. color: #2b2b2b;
  269. }
  270. .collect {
  271. display: flex;
  272. align-items: center;
  273. justify-content: flex-end;
  274. width: 10%;
  275. font-size: $global-font-size-20;
  276. color: #929292;
  277. cursor: default;
  278. span {
  279. margin: 0 0 0 5px;
  280. }
  281. }
  282. .iscollect {
  283. color: #1073ff;
  284. }
  285. }
  286. .other {
  287. margin-top: 25px;
  288. .other_1 {
  289. padding: 0 10px;
  290. height: 25px;
  291. background-color: #e6f2fd;
  292. border-radius: 2px;
  293. border: solid 1px #cae0f5;
  294. font-size: $global-font-size-14;
  295. line-height: 25px;
  296. color: #0085f5;
  297. }
  298. .other_2 {
  299. margin: 20px 0 0 0;
  300. display: flex;
  301. align-items: center;
  302. flex-wrap: wrap;
  303. p {
  304. margin-right: 20px;
  305. width: 45%;
  306. font-size: $global-font-size-18;
  307. color: #666;
  308. .moeny {
  309. font-family: keyifont;
  310. color: #f60;
  311. }
  312. span {
  313. color: #2b2b2b;
  314. }
  315. }
  316. }
  317. }
  318. .state {
  319. background: url(/images/icon-hzxq-state2.png);
  320. position: absolute;
  321. left: -36px;
  322. top: 0;
  323. padding: 17px 10px 0;
  324. width: 36px;
  325. height: 94px;
  326. color: #fff;
  327. font-size: $global-font-size-16;
  328. }
  329. }
  330. .infoButton {
  331. margin: 10px 0 0 0;
  332. .button {
  333. cursor: default;
  334. justify-content: center;
  335. display: flex;
  336. align-items: center;
  337. width: 136px;
  338. height: 44px;
  339. color: #fff;
  340. font-size: $global-font-size-16;
  341. background-image: linear-gradient(90deg, #0455da 0%, #378cff 100%), linear-gradient(#0455da, #0455da);
  342. background-blend-mode: normal, normal;
  343. border-radius: 4px;
  344. }
  345. }
  346. .title {
  347. margin-top: 30px;
  348. font-size: $global-font-size-20;
  349. line-height: 26px;
  350. color: #333;
  351. i {
  352. display: inline-block;
  353. vertical-align: middle;
  354. margin-right: 20px;
  355. width: 7px;
  356. height: 22px;
  357. background-color: #0085f5;
  358. border-radius: 3px;
  359. }
  360. }
  361. .info_3 {
  362. margin-top: 20px;
  363. padding: 40px;
  364. background-color: #fff;
  365. border: solid 1px #dedede;
  366. font-size: $global-font-size-16;
  367. line-height: 30px;
  368. color: #333;
  369. }
  370. .info_4 {
  371. display: flex;
  372. margin-top: 20px;
  373. .list {
  374. position: relative;
  375. margin-right: 30px;
  376. width: 380px;
  377. height: 233px;
  378. box-shadow: 0 0 13px 0 rgba(5, 88, 219, 0.18);
  379. .name {
  380. padding: 10px 20px;
  381. width: 380px;
  382. height: 71px;
  383. background-color: #dce5ff;
  384. font-size: 16px;
  385. line-height: 24px;
  386. color: #0d0d0d;
  387. display: flex;
  388. align-items: center;
  389. }
  390. .other {
  391. height: 162px;
  392. padding: 10px 20px 0 20px;
  393. .other_1 {
  394. padding: 0 10px;
  395. height: 25px;
  396. background-color: #e6f2fd;
  397. border-radius: 2px;
  398. border: solid 1px #cae0f5;
  399. font-size: $global-font-size-14;
  400. line-height: 25px;
  401. color: #0085f5;
  402. }
  403. .other_2 {
  404. display: flex;
  405. align-items: center;
  406. margin-top: 15px;
  407. font-size: $global-font-size-16;
  408. span {
  409. color: #909090;
  410. }
  411. .state {
  412. position: absolute;
  413. right: 20px;
  414. bottom: 15px;
  415. display: inline-block;
  416. vertical-align: middle;
  417. padding: 0 20px;
  418. height: 30px;
  419. line-height: 30px;
  420. background-image: linear-gradient(90deg, #ff8a00 0, #ff5a00 100%), linear-gradient(#ff7800, #ff7800);
  421. background-blend-mode: normal, normal;
  422. border-radius: 14px;
  423. border: solid 1px #e5e5e5;
  424. color: #fff;
  425. }
  426. }
  427. }
  428. }
  429. .list:hover {
  430. box-shadow: 0 0 5px 0 $global-color-107;
  431. .name {
  432. background-color: $global-color-107;
  433. color: $global-color-fff;
  434. }
  435. }
  436. }
  437. }
  438. }
  439. </style>