From e820dc53309ece7fa01d4c182d2e8203d33d228d Mon Sep 17 00:00:00 2001 From: huliyong <2783385703@qq.com> Date: Fri, 30 May 2025 21:47:36 +0800 Subject: [PATCH] 1 --- pages.json | 9 ++ pages_order/task/taskDetail.vue | 214 +++++++++++++++++++++++++++++----------- pages_order/task/taskList.vue | 100 +++++++++++-------- utils/getUrl.js | 5 +- 4 files changed, 224 insertions(+), 104 deletions(-) diff --git a/pages.json b/pages.json index ad0f776..2a7c5ed 100644 --- a/pages.json +++ b/pages.json @@ -1,4 +1,13 @@ { + "easycom": { + "autoscan": true, + // 注意一定要放在custom里,否则无效,https://ask.dcloud.net.cn/question/131175 + "custom": { + "^u--(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue", + "^up-(.*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue", + "^u-([^-].*)": "@/uni_modules/uview-ui/components/u-$1/u-$1.vue" + } + }, "pages": [{ "path": "pages/index", "style": { diff --git a/pages_order/task/taskDetail.vue b/pages_order/task/taskDetail.vue index 8a869c1..39aa17d 100644 --- a/pages_order/task/taskDetail.vue +++ b/pages_order/task/taskDetail.vue @@ -2,30 +2,41 @@ - {{taskInfo.title}} - 请于{{taskInfo.taskEndTime ? formatDate(taskInfo.taskEndTime) : ''}}之前上传任务,超时将自动取消 + + + {{ getStatusText() }} + {{taskInfo.taskName || ''}} + 酬劳 ¥{{taskInfo.taskMoney}} + + 请于 + {{taskInfo.taskEndTime ? formatDate(taskInfo.taskEndTime) : ''}} + 之前上传任务,超时将自动取消 + - + 任务进度 - + - + - - + + - + + - + + - + 取消 - {{taskInfo.examineState === 2 ? '重新上传' : '立即上传'}} + + 接受任务 + + {{taskInfo.examineState === 2 ? '重新上传' : '立即上传'}} @@ -54,6 +70,10 @@ import { getTaskDetail } from "@/api/order/task.js" + import { + getTaskList, + acceptTask + } from "@/api/order/task.js" export default { data() { return { @@ -70,8 +90,7 @@ image: '', taskIcon: '' }, - stepsList: [ - { + stepsList: [{ title: '接受任务' }, { @@ -84,15 +103,38 @@ title: '酬劳到账' } ], - currentStep: 0 + currentStep: 0, + id : 0, } }, onLoad(options) { if (options.id) { + this.id = options.id this.loadTaskDetail(options.id); } }, methods: { + acceptTaskHandler(task) { + // 接受任务 + uni.showModal({ + title: '接受任务', + content: `确定接受任务: ${task.title}?`, + success: res => { + if (res.confirm) { + acceptTask({id : task.id}).then(res => { + if (res && res.code === 200) { + uni.showToast({ + title: '任务接受成功', + icon: 'success' + }); + // 刷新任务 + this.loadTaskDetail(this.id); + } + }); + } + } + }); + }, loadTaskDetail(taskId) { getTaskDetail(taskId).then(res => { if (res && res.code === 200) { @@ -141,6 +183,22 @@ uni.navigateTo({ url: `/pages_order/task/taskUpload?id=${this.taskInfo.id}&status=${this.taskInfo.examineState === 2 ? 'REJECTED' : 'ACCEPTED'}` }); + }, + getStatusText() { + if (this.taskInfo.status === 0) { + return '待接受'; + } else if (this.taskInfo.taskState === 0) { + return '待上传'; + } else if (this.taskInfo.taskState === 1) { + if (this.taskInfo.examineState === 0) { + return '待审核'; + } else if (this.taskInfo.examineState === 1) { + return '审核通过'; + } else if (this.taskInfo.examineState === 2) { + return '审核未通过'; + } + } + return ''; } } } @@ -151,29 +209,66 @@ background-color: #f5f5f7; min-height: 100vh; padding-bottom: 120rpx; - + .task-header { background-color: #FFFFFF; padding: 30rpx; - - .task-title { - font-size: 36rpx; - font-weight: bold; - color: #333; - margin-bottom: 20rpx; - } - - .task-deadline { - font-size: 24rpx; - color: #999; + margin: 20rpx; + border-radius: 20rpx; + background: linear-gradient(to bottom, #FFE4BB66, #fff, #fff, #fff); + + .header-content { + .header-top-row { + display: flex; + align-items: center; + justify-content: space-between; + margin-bottom: 20rpx; + + .task-title { + font-size: 30rpx; + flex-shrink: 0; + font-weight: 900; + } + + .task-type { + color: #C68C5B; + font-size: 26rpx; + background-color: #FFE4BB; + padding: 10rpx 30rpx; + border-radius: 30rpx; + text-align: center; + margin: 0 10rpx; + width: fit-content; + } + + .task-reward { + font-size: 26rpx; + color: #333; + flex-shrink: 0; + margin-left: auto; + + text { + color: #FF5722; + font-weight: bold; + margin-left: 10rpx; + font-size: 30rpx; + } + } + } + + .task-deadline { + font-size: 24rpx; + color: #999; + } } } - + .task-progress { background-color: #FFFFFF; - margin-top: 20rpx; + margin: 20rpx; + border-radius: 20rpx; padding: 30rpx; - + .progress-title { font-size: 30rpx; font-weight: bold; @@ -181,58 +276,59 @@ margin-bottom: 30rpx; } } - + .task-instruction { background-color: #FFFFFF; - margin-top: 20rpx; + margin: 20rpx; + border-radius: 20rpx; padding: 30rpx; - + .instruction-header { display: flex; align-items: center; margin-bottom: 30rpx; - + .instruction-icon { width: 60rpx; height: 60rpx; margin-right: 20rpx; } - + .instruction-title { font-size: 32rpx; font-weight: bold; color: #A94F20; } } - + .instruction-content { .instruction-main { padding: 20rpx 0; border-bottom: 1px solid #EEEEEE; margin-bottom: 20rpx; - + text { font-size: 28rpx; color: #666; line-height: 1.6; } } - + .requirement-section { margin-bottom: 30rpx; - + .requirement-title { font-size: 28rpx; font-weight: bold; color: #333; margin-bottom: 20rpx; } - + .requirement-content { padding: 20rpx; background-color: #FFF4E5; border-radius: 10rpx; - + text { display: block; font-size: 26rpx; @@ -240,17 +336,17 @@ line-height: 1.8; } } - + .title-examples { background-color: #FFF4E5; padding: 20rpx; border-radius: 10rpx; - + .example-item { display: flex; align-items: center; margin-bottom: 15rpx; - + .example-tag { width: 50rpx; height: 50rpx; @@ -263,24 +359,24 @@ font-size: 24rpx; margin-right: 20rpx; } - + .example-text { font-size: 26rpx; color: #A94F20; } } } - + .other-requirements { background-color: #FFF4E5; padding: 20rpx; border-radius: 10rpx; - + .requirement-item { display: flex; align-items: center; margin-bottom: 15rpx; - + .requirement-tag { width: 40rpx; height: 40rpx; @@ -291,7 +387,7 @@ font-size: 24rpx; margin-right: 20rpx; } - + .requirement-text { font-size: 26rpx; color: #A94F20; @@ -299,11 +395,11 @@ } } } - + .note-text { text-align: center; margin-top: 20rpx; - + text { font-size: 24rpx; color: #FF5722; @@ -311,7 +407,7 @@ } } } - + .footer-buttons { position: fixed; bottom: 0; @@ -322,8 +418,8 @@ display: flex; justify-content: space-around; align-items: center; - box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.05); - + box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.05); + .u-button { width: 300rpx; height: 80rpx; diff --git a/pages_order/task/taskList.vue b/pages_order/task/taskList.vue index cfc940a..62cce56 100644 --- a/pages_order/task/taskList.vue +++ b/pages_order/task/taskList.vue @@ -1,24 +1,28 @@