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.

421 lines
13 KiB

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