Demand.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. <template>
  2. <div class="demand">
  3. <el-tabs v-model="form.activeName" class="demo-tabs" @tab-click="handleClick">
  4. <el-tab-pane v-for="tab in tabs" :key="tab.name" :label="$t(tab.label)" :name="tab.name">
  5. <ul class="demand-list">
  6. <li v-for="(item, index) in list" :key="index">
  7. <div class="flex-center-between">
  8. <div class="flex-align-center">
  9. <div v-if="form.activeName == 1" class="tag" :class="{'tag_red':item.applyStatus == 2}">{{ item.applyStatus == 1 ? '报名中' : '已结束' }}{{ item.applyStatus }}</div>
  10. <div class="title">{{ item.title }}</div>
  11. </div>
  12. <div class="price">¥{{ item.budgetMin }}-{{ item.budgetMax }}</div>
  13. </div>
  14. <div class="flex-align-center content">
  15. <div class="flex-align-center">
  16. <!-- <el-button type="primary" size="small" plain>{{ item.categoryName1 }}</el-button> -->
  17. <!-- <el-button type="primary" size="small" plain>{{ item.categoryName2 }}</el-button> -->
  18. <el-button type="primary" size="small" plain>{{ item.categoryName3 }}</el-button>
  19. </div>
  20. <ul class="flex-align-center list">
  21. <div class="li">
  22. <img src="/src/assets/imgs/yuangong.png" alt="">
  23. <div class="">{{ item.questApplyCount || 0 }}{{ $t('common.renbaoming') }}</div>
  24. </div>
  25. <div class="li">
  26. <img src="/src/assets/imgs/rili.png" alt="">
  27. <div class="">{{ $t('common.signUpDeadline') }}:{{ item.deadline }}</div>
  28. </div>
  29. </ul>
  30. </div>
  31. <div class="description">{{ item.requirements }}</div>
  32. <div class="info">
  33. <div class="info-left">
  34. <el-avatar :size="30" :src="item.userAvatar || appStore.avatarDefault" />
  35. <div class="name">{{ item.nickName }}</div>
  36. <div class="date">{{ item.publishTime }} {{ $t('common.publish') }}</div>
  37. </div>
  38. <div class="info-right flex-align-center">
  39. <template v-if="form.activeName === 0">
  40. <div class="btn" @click="changeItem(item, index, 0)">
  41. <img src="/src/assets/imgs/my/jilu@2x.png" alt="">
  42. <div>{{ $t('personalCenter.viewSignUpRecord') }}</div>
  43. </div>
  44. <template v-if="item.applyStatus == 1">
  45. <div class="btn" @click="changeItem(item, index, 1)">
  46. <img src="/src/assets/imgs/my/bianji@2x.png" alt="">
  47. <div>{{ $t('common.edit') }}</div>
  48. </div>
  49. <div class="btn" @click="changeItem(item, index, 2)">
  50. <img src="/src/assets/imgs/my/guanbi@2x.png" alt="">
  51. <div class="red">{{ $t('personalCenter.endActivity') }}</div>
  52. </div>
  53. </template>
  54. <div class="btn" @click="changeItem(item, index, 3)">
  55. <img src="/src/assets/imgs/my/shanchu@2x.png" alt="">
  56. <div class="red">{{ $t('common.delete') }}</div>
  57. </div>
  58. </template>
  59. <div class="btn" v-else @click="changeItem(item, index, 4)">
  60. <img src="/src/assets/imgs/my/quxiao@2x.png" alt="">
  61. <div class="red">{{ $t('personalCenter.cancelSignUp') }}</div>
  62. </div>
  63. </div>
  64. </div>
  65. </li>
  66. </ul>
  67. </el-tab-pane>
  68. </el-tabs>
  69. <template v-if="list.length">
  70. <Pagination :total="form.total" :page-size="form.pageSize" :current-page="form.pageNum"
  71. @page-change="handlePageChange" />
  72. </template>
  73. <el-empty v-else :description="$t('common.empty')" />
  74. <el-dialog v-model="dialogVisible" :title="$t('personalCenter.viewSignUpRecord')" width="1138">
  75. <div class="detail">
  76. <div class="detail-top">
  77. <div class="flex-center-between">
  78. <div class="flex-align-center">
  79. <div class="tag" :class="{'tag_red':itemData.applyStatus == '2'}">{{ itemData.applyStatus == 1 ? '报名中' : '已结束' }}</div>
  80. <div class="name">{{ itemData.title }}</div>
  81. </div>
  82. <div class="price">¥{{ itemData.budgetMin }}-{{ itemData.budgetMax }}</div>
  83. </div>
  84. <div class="flex-align-center content">
  85. <div class="flex-align-center">
  86. <!-- <el-button type="primary" size="small" plain>一级分类名称</el-button> -->
  87. <el-button type="primary" size="small" plain>{{ itemData.categoryName3 }}</el-button>
  88. </div>
  89. <ul class="flex-align-center list">
  90. <div class="li">
  91. <img src="/src/assets/imgs/yuangong.png" alt="">
  92. <div class="">{{ itemData.questApplyCount || 0 }}{{ $t('common.renbaoming') }}</div>
  93. </div>
  94. <div class="li">
  95. <img src="/src/assets/imgs/rili.png" alt="">
  96. <div class="">{{ $t('common.signUpDeadline') }}:{{ itemData.deadline }}</div>
  97. </div>
  98. </ul>
  99. </div>
  100. <div class="desc">{{ itemData.requirements }}
  101. </div>
  102. <div class="time">{{ itemData.publishTime }} {{ $t('common.publish') }}</div>
  103. </div>
  104. <div class="detail-txt">{{ $t('personalCenter.baomiliang') }}({{ itemData.questApplyCount || 0 }} {{ $t('personalCenter.ren') }})</div>
  105. <ul class="detail-list">
  106. <li v-for="(item, index) in recordList" :key="index">
  107. <div class="flex-align-center detail-list-left">
  108. <el-avatar :size="20" :src="''" />
  109. <div class="">花花</div>
  110. <div class="">13176012742</div>
  111. </div>
  112. <div class="detail-list-number">{{ $t('personalCenter.gongzuoliuliang') }}:15</div>
  113. <div class="flex-align-center detail-list-right">
  114. <div class="lex-align-center btn green">
  115. <img src="/src/assets/imgs/my/dui@2x.png" alt="">
  116. <div class="">{{ $t('common.agree') }}</div>
  117. </div>
  118. <div class="lex-align-center btn red">
  119. <img src="/src/assets/imgs/my/quxiao@2x.png" alt="">
  120. <div class="">{{ $t('common.reject') }}</div>
  121. </div>
  122. <div class="lex-align-center btn blue">
  123. <img src="/src/assets/imgs/my/jilu@2x.png" alt="">
  124. <div class="">{{ $t('common.viewHomepage') }}</div>
  125. </div>
  126. </div>
  127. </li>
  128. </ul>
  129. </div>
  130. <template #footer>
  131. <div class="dialog-footer flex-center">
  132. <el-button @click="dialogVisible = false">{{ $t('common.cancel') }}</el-button>
  133. <el-button type="primary" class="gradient" @click="dialogVisible = false">
  134. {{ $t('common.confirm') }}
  135. </el-button>
  136. </div>
  137. </template>
  138. </el-dialog>
  139. </div>
  140. </template>
  141. <script lang="ts" setup>
  142. import { ref, onMounted } from 'vue'
  143. import { useAppStore } from '@/pinia/appStore'
  144. import type { TabsPaneContext } from 'element-plus'
  145. import Pagination from '@/components/Pagination.vue'
  146. import { getWorkflowApplyByUserId, userQuestList, appliList, updateQuestStatus, delectQuest, cancelApply } from '@/api/my.js'
  147. import { useRoute, useRouter } from 'vue-router'
  148. import DGTMessage from '@/utils/message'
  149. import { ElMessageBox } from 'element-plus'
  150. import { useI18n } from 'vue-i18n'
  151. const { t } = useI18n()
  152. const appStore = useAppStore();
  153. const route = useRoute()
  154. const router = useRouter()
  155. const tabs = ref([
  156. { label: 'personalCenter.publishDemandRecord', name: 0 },
  157. { label: 'personalCenter.myDemandRecord', name: 1 }
  158. ])
  159. const dialogVisible = ref(false)
  160. const list = ref([])
  161. const form = ref({
  162. pageNum: 1,
  163. pageSize: 10,
  164. total: 0,
  165. activeName: 0
  166. })
  167. const itemData = ref({})
  168. const recordList = ref([])//报名记录
  169. const changeItem = async (item, index, type) => {
  170. itemData.value = item;
  171. if (type == 0) {
  172. let res = await appliList({ questId: item.questId })
  173. console.log(res)
  174. recordList.value = res.rows;
  175. dialogVisible.value = true;
  176. } else if (type == 1) {
  177. router.push({ path: `/workflow-trade/workflow-trade-add`, query: { id: item.questId } });
  178. } else if (type == 2) {
  179. ElMessageBox.confirm(
  180. 'proxy will permanently delete the file. Continue?',
  181. 'Warning1',
  182. {
  183. confirmButtonText: 'OK',
  184. cancelButtonText: t('common.cancel'),
  185. type: 'warning',
  186. }
  187. )
  188. .then(async () => {
  189. let res = await updateQuestStatus({
  190. questId: item.questId
  191. })
  192. if (res.code === 200) {
  193. getList()
  194. DGTMessage.success(`${t('common.success')}`)
  195. }
  196. })
  197. .catch(() => {
  198. })
  199. } else if (type == 3) {
  200. ElMessageBox.confirm(
  201. 'proxy will permanently delete the file. Continue?',
  202. 'Warning',
  203. {
  204. confirmButtonText: 'OK',
  205. cancelButtonText: t('common.cancel'),
  206. type: 'warning',
  207. }
  208. )
  209. .then(async () => {
  210. let res = await delectQuest(item.questId)
  211. if (res.code === 200) {
  212. getList()
  213. DGTMessage.success(`${t('common.delete')}${t('common.success')}`)
  214. }
  215. })
  216. .catch(() => {
  217. })
  218. } else if (type == 4) {
  219. ElMessageBox.confirm(
  220. 'proxy will permanently delete the file. Continue?',
  221. 'Warning',
  222. {
  223. confirmButtonText: 'OK',
  224. cancelButtonText: t('common.cancel'),
  225. type: 'warning',
  226. }
  227. )
  228. .then(async () => {
  229. let res = await cancelApply(item.id)
  230. if (res.code === 200) {
  231. getList()
  232. DGTMessage.success(`${t('common.cancel')}${t('common.success')}`)
  233. }
  234. })
  235. .catch(() => {
  236. })
  237. }
  238. }
  239. const handleClick = (tab: TabsPaneContext) => {
  240. list.value = []
  241. form.value.pageNum = 1;
  242. form.value.activeName = tab.props.name;
  243. getList()
  244. }
  245. // 获取列表
  246. const getList = async () => {
  247. let res = await (form.value.activeName === 0 ? userQuestList(form.value) : getWorkflowApplyByUserId(form.value))
  248. list.value = res.rows || [];
  249. form.value.total = res.total;
  250. }
  251. const handlePageChange = (page) => {
  252. list.value = []
  253. form.value.pageNum = page;
  254. getList()
  255. }
  256. onMounted(() => {
  257. getList()
  258. })
  259. </script>
  260. <style scoped lang="scss">
  261. .demand {
  262. padding-bottom: 20px;
  263. div {
  264. line-height: 1;
  265. }
  266. .demand-list {
  267. li {
  268. padding: 16px;
  269. margin-bottom: 16px;
  270. background: #F5F7FA;
  271. border-radius: 16px;
  272. &:last-child {
  273. margin-bottom: 0;
  274. }
  275. .title {
  276. font-size: 18px;
  277. font-weight: bold;
  278. color: #333333;
  279. }
  280. .tag {
  281. padding: 0 12px;
  282. line-height: 30px;
  283. color: #FFFFFF;
  284. font-size: 14px;
  285. background: #2D71FF;
  286. border-radius: 4px;
  287. margin-right: 8px;
  288. }
  289. .tag_red {
  290. background: #E43434;
  291. }
  292. .description {
  293. font-size: 16px;
  294. color: #666666;
  295. line-height: 24px;
  296. margin: 8px 0;
  297. }
  298. .info {
  299. display: flex;
  300. justify-content: space-between;
  301. align-items: center;
  302. .info-left {
  303. display: flex;
  304. align-items: center;
  305. .name {
  306. font-size: 16px;
  307. margin: 0 8px;
  308. }
  309. .date {
  310. font-size: 14px;
  311. color: #666666;
  312. }
  313. }
  314. .info-right {
  315. .btn {
  316. height: 32px;
  317. display: flex;
  318. align-items: center;
  319. padding: 0px 16px;
  320. background: #FFFFFF;
  321. border-radius: 4px;
  322. cursor: pointer;
  323. margin-left: 8px;
  324. img {
  325. width: 14px;
  326. height: 14px;
  327. margin-right: 4px;
  328. }
  329. div {
  330. font-size: 14px;
  331. color: #2D71FF;
  332. }
  333. .red {
  334. color: #E43434;
  335. }
  336. }
  337. }
  338. }
  339. .price {
  340. font-size: 24px;
  341. color: #FD5F3C;
  342. }
  343. }
  344. }
  345. }
  346. .content {
  347. margin-top: 8px;
  348. .list {
  349. .li {
  350. display: flex;
  351. align-items: center;
  352. img {
  353. width: 16px;
  354. height: 16px;
  355. margin-right: 4px;
  356. }
  357. margin-left: 8px;
  358. div {
  359. font-size: 12px;
  360. }
  361. }
  362. }
  363. }
  364. .detail {
  365. padding: 16px;
  366. border-top: 1px solid #EBEEF5;
  367. .detail-top {
  368. padding: 16px;
  369. background: #F5F7FA;
  370. border-radius: 16px;
  371. border: 1px solid #FFFFFF;
  372. .tag {
  373. padding: 0 12px;
  374. line-height: 30px;
  375. font-size: 14px;
  376. color: #FFFFFF;
  377. background: #2D71FF;
  378. border-radius: 4px;
  379. }
  380. .tag_red {
  381. background: #E43434;
  382. }
  383. .name {
  384. font-size: 18px;
  385. font-weight: bold;
  386. color: #333333;
  387. margin-left: 8px;
  388. }
  389. .price {
  390. color: #FD5F3C;
  391. font-size: 24px;
  392. }
  393. .desc {
  394. margin: 8px 0;
  395. line-height: 24px;
  396. font-size: 16px;
  397. color: #666666;
  398. }
  399. .time {
  400. font-size: 14px;
  401. color: #666666;
  402. }
  403. }
  404. .detail-txt {
  405. line-height: 58px;
  406. font-size: 18px;
  407. font-weight: bold;
  408. }
  409. .detail-list {
  410. li {
  411. display: flex;
  412. padding: 0 16px;
  413. align-items: center;
  414. justify-content: space-between;
  415. margin-bottom: 16px;
  416. height: 64px;
  417. background: #F5F7FA;
  418. border-radius: 8px;
  419. &:last-child {
  420. margin-bottom: 0;
  421. }
  422. .detail-list-left {
  423. div {
  424. color: #666666;
  425. font-size: 14px;
  426. &:nth-child(2) {
  427. margin: 0 8px;
  428. font-size: 16px;
  429. color: #333333;
  430. }
  431. }
  432. }
  433. .detail-list-number {
  434. font-size: 14px;
  435. color: #333333;
  436. }
  437. .detail-list-right {
  438. .btn {
  439. display: flex;
  440. margin-left: 8px;
  441. align-items: center;
  442. cursor: pointer;
  443. padding: 0px 16px;
  444. height: 32px;
  445. border-radius: 4px;
  446. font-size: 14px;
  447. &:hover {
  448. opacity: 0.7;
  449. }
  450. img {
  451. width: 14px;
  452. height: 14px;
  453. margin-right: 4px;
  454. }
  455. }
  456. .green {
  457. background: #E9F7EF;
  458. div {
  459. color: #1FB362;
  460. }
  461. }
  462. .red {
  463. background: #FCEBEB;
  464. div {
  465. color: #E43434;
  466. }
  467. }
  468. .blue {
  469. background: #EAF0FF;
  470. div {
  471. color: #2D71FF;
  472. }
  473. }
  474. }
  475. }
  476. }
  477. }
  478. </style>