demandDetail.vue 13 KB

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