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.

429 lines
9.8 KiB

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