You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

333 lines
7.5 KiB

  1. <template>
  2. <view class="task-detail">
  3. <!-- 任务头部信息 -->
  4. <view class="task-header">
  5. <view class="task-title">{{taskInfo.title}}</view>
  6. <view class="task-deadline">请于{{taskInfo.taskEndTime ? formatDate(taskInfo.taskEndTime) : ''}}之前上传任务超时将自动取消</view>
  7. </view>
  8. <!-- 任务进度 -->
  9. <view class="task-progress">
  10. <view class="progress-title">任务进度</view>
  11. <uni-steps :options="stepsList" :active="currentStep" active-icon="checkbox-filled" active-color="#ffaa48"></uni-steps>
  12. </view>
  13. <!-- 任务说明 -->
  14. <view class="task-instruction">
  15. <view class="instruction-header">
  16. <image class="instruction-icon" :src="taskInfo.taskIcon || 'https://catmdogf.oss-cn-shanghai.aliyuncs.com/CMDF/front/personal/index/point.png'"></image>
  17. <view class="instruction-title">{{taskInfo.taskName || '任务说明'}}</view>
  18. </view>
  19. <view class="instruction-content">
  20. <view class="instruction-main">
  21. <text>{{taskInfo.theme || '暂无任务说明'}}</text>
  22. </view>
  23. <!-- 审核未通过时显示驳回原因 -->
  24. <view class="requirement-section" v-if="taskInfo.examineState === 2">
  25. <view class="requirement-title">驳回原因</view>
  26. <view class="other-requirements">
  27. <view class="requirement-item">
  28. <view class="requirement-tag">!</view>
  29. <view class="requirement-text">{{taskInfo.examineText || '未提供驳回原因'}}</view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 任务图片 -->
  34. <view class="task-images" v-if="taskInfo.image">
  35. <image :src="taskInfo.image" mode="widthFix" style="width: 100%;"></image>
  36. </view>
  37. </view>
  38. </view>
  39. <!-- 底部按钮 -->
  40. <view class="footer-buttons">
  41. <u-button shape="circle" plain @click="cancelTask">取消</u-button>
  42. <u-button shape="circle" color="#ffaa48" v-if="taskInfo.taskState === 0 || taskInfo.examineState === 2" @click="uploadTask">{{taskInfo.examineState === 2 ? '重新上传' : '立即上传'}}</u-button>
  43. </view>
  44. </view>
  45. </template>
  46. <script>
  47. import {
  48. getTaskDetail
  49. } from "@/api/order/task.js"
  50. export default {
  51. data() {
  52. return {
  53. taskInfo: {
  54. id: 0,
  55. title: '',
  56. theme: '',
  57. taskEndTime: '',
  58. taskName: '',
  59. taskMoney: 0,
  60. taskState: 0,
  61. examineState: 0,
  62. examineText: '',
  63. image: '',
  64. taskIcon: ''
  65. },
  66. stepsList: [
  67. {
  68. title: '接受任务'
  69. },
  70. {
  71. title: '上传任务'
  72. },
  73. {
  74. title: '平台审核'
  75. },
  76. {
  77. title: '酬劳到账'
  78. }
  79. ],
  80. currentStep: 0
  81. }
  82. },
  83. onLoad(options) {
  84. if (options.id) {
  85. this.loadTaskDetail(options.id);
  86. }
  87. },
  88. methods: {
  89. loadTaskDetail(taskId) {
  90. getTaskDetail(taskId).then(res => {
  91. if (res && res.code === 200) {
  92. this.taskInfo = res.data;
  93. // 根据任务状态设置当前步骤
  94. this.updateCurrentStep();
  95. }
  96. });
  97. },
  98. updateCurrentStep() {
  99. // 根据任务状态和审核状态设置当前步骤
  100. if (this.taskInfo.status === 0) {
  101. this.currentStep = 0; // 待接受
  102. } else if (this.taskInfo.taskState === 0) {
  103. this.currentStep = 1; // 已接受,待上传
  104. } else if (this.taskInfo.taskState === 1) {
  105. if (this.taskInfo.examineState === 0) {
  106. this.currentStep = 2; // 已提交,待审核
  107. } else if (this.taskInfo.examineState === 1) {
  108. this.currentStep = 3; // 已审核通过
  109. } else if (this.taskInfo.examineState === 2) {
  110. this.currentStep = 1; // 审核未通过,重新上传
  111. }
  112. }
  113. },
  114. formatDate(dateStr) {
  115. if (!dateStr) return '';
  116. let date = new Date(dateStr);
  117. let year = date.getFullYear();
  118. let month = (date.getMonth() + 1).toString().padStart(2, '0');
  119. let day = date.getDate().toString().padStart(2, '0');
  120. return `${year}-${month}-${day}`;
  121. },
  122. cancelTask() {
  123. uni.showModal({
  124. title: '取消任务',
  125. content: '确定要取消此任务吗?',
  126. success: (res) => {
  127. if (res.confirm) {
  128. uni.navigateBack();
  129. }
  130. }
  131. });
  132. },
  133. uploadTask() {
  134. uni.navigateTo({
  135. url: `/pages_order/task/taskUpload?id=${this.taskInfo.id}&status=${this.taskInfo.examineState === 2 ? 'REJECTED' : 'ACCEPTED'}`
  136. });
  137. }
  138. }
  139. }
  140. </script>
  141. <style lang="scss">
  142. .task-detail {
  143. background-color: #f5f5f7;
  144. min-height: 100vh;
  145. padding-bottom: 120rpx;
  146. .task-header {
  147. background-color: #FFFFFF;
  148. padding: 30rpx;
  149. .task-title {
  150. font-size: 36rpx;
  151. font-weight: bold;
  152. color: #333;
  153. margin-bottom: 20rpx;
  154. }
  155. .task-deadline {
  156. font-size: 24rpx;
  157. color: #999;
  158. }
  159. }
  160. .task-progress {
  161. background-color: #FFFFFF;
  162. margin-top: 20rpx;
  163. padding: 30rpx;
  164. .progress-title {
  165. font-size: 30rpx;
  166. font-weight: bold;
  167. color: #333;
  168. margin-bottom: 30rpx;
  169. }
  170. }
  171. .task-instruction {
  172. background-color: #FFFFFF;
  173. margin-top: 20rpx;
  174. padding: 30rpx;
  175. .instruction-header {
  176. display: flex;
  177. align-items: center;
  178. margin-bottom: 30rpx;
  179. .instruction-icon {
  180. width: 60rpx;
  181. height: 60rpx;
  182. margin-right: 20rpx;
  183. }
  184. .instruction-title {
  185. font-size: 32rpx;
  186. font-weight: bold;
  187. color: #A94F20;
  188. }
  189. }
  190. .instruction-content {
  191. .instruction-main {
  192. padding: 20rpx 0;
  193. border-bottom: 1px solid #EEEEEE;
  194. margin-bottom: 20rpx;
  195. text {
  196. font-size: 28rpx;
  197. color: #666;
  198. line-height: 1.6;
  199. }
  200. }
  201. .requirement-section {
  202. margin-bottom: 30rpx;
  203. .requirement-title {
  204. font-size: 28rpx;
  205. font-weight: bold;
  206. color: #333;
  207. margin-bottom: 20rpx;
  208. }
  209. .requirement-content {
  210. padding: 20rpx;
  211. background-color: #FFF4E5;
  212. border-radius: 10rpx;
  213. text {
  214. display: block;
  215. font-size: 26rpx;
  216. color: #A94F20;
  217. line-height: 1.8;
  218. }
  219. }
  220. .title-examples {
  221. background-color: #FFF4E5;
  222. padding: 20rpx;
  223. border-radius: 10rpx;
  224. .example-item {
  225. display: flex;
  226. align-items: center;
  227. margin-bottom: 15rpx;
  228. .example-tag {
  229. width: 50rpx;
  230. height: 50rpx;
  231. background-color: #ffaa48;
  232. color: #FFFFFF;
  233. border-radius: 25rpx;
  234. display: flex;
  235. justify-content: center;
  236. align-items: center;
  237. font-size: 24rpx;
  238. margin-right: 20rpx;
  239. }
  240. .example-text {
  241. font-size: 26rpx;
  242. color: #A94F20;
  243. }
  244. }
  245. }
  246. .other-requirements {
  247. background-color: #FFF4E5;
  248. padding: 20rpx;
  249. border-radius: 10rpx;
  250. .requirement-item {
  251. display: flex;
  252. align-items: center;
  253. margin-bottom: 15rpx;
  254. .requirement-tag {
  255. width: 40rpx;
  256. height: 40rpx;
  257. color: #A94F20;
  258. display: flex;
  259. justify-content: center;
  260. align-items: center;
  261. font-size: 24rpx;
  262. margin-right: 20rpx;
  263. }
  264. .requirement-text {
  265. font-size: 26rpx;
  266. color: #A94F20;
  267. }
  268. }
  269. }
  270. }
  271. .note-text {
  272. text-align: center;
  273. margin-top: 20rpx;
  274. text {
  275. font-size: 24rpx;
  276. color: #FF5722;
  277. }
  278. }
  279. }
  280. }
  281. .footer-buttons {
  282. position: fixed;
  283. bottom: 0;
  284. left: 0;
  285. right: 0;
  286. background-color: #FFFFFF;
  287. padding: 20rpx 30rpx;
  288. display: flex;
  289. justify-content: space-around;
  290. align-items: center;
  291. box-shadow: 0 -2rpx 10rpx rgba(0,0,0,0.05);
  292. .u-button {
  293. width: 300rpx;
  294. height: 80rpx;
  295. font-size: 28rpx;
  296. }
  297. }
  298. }
  299. </style>