task-details.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. <template>
  2. <view class="">
  3. <navbar :config="config" backColor="#999999"></navbar>
  4. <view class="task-details-box" v-if="taskInfo">
  5. <view class="details-content">
  6. <view class="task-title">
  7. {{taskInfo.title || taskInfo.taskTitle}}
  8. </view>
  9. <view class="task-explain">
  10. {{taskInfo.remark}}
  11. </view>
  12. <share :sharePoster="taskInfo.sharePoster" :taskId="taskInfo.taskId" />
  13. <taskContent>
  14. <view class="task-info-item">
  15. <text class="task-info-title">任务时间:</text>
  16. <text class="task-info-val">{{taskInfo.startTime}} - {{taskInfo.endTime}}</text>
  17. </view>
  18. <view class="task-info-item">
  19. <text class="task-info-title">任务领取后完成时间:</text>
  20. <text class="task-info-val">{{taskInfo.completionDays}}天</text>
  21. </view>
  22. <view class="task-info-item">
  23. <text class="task-info-title">任务奖励:</text>
  24. <text class="task-info-val task-info-integral">{{taskInfo.rewardPoints}}积分</text>
  25. </view>
  26. </taskContent>
  27. </view>
  28. <template v-if="taskInfo.taskType === 1">
  29. <!-- 存在子任务 -->
  30. <view class="gap"></view>
  31. <view class="task-sublevel">
  32. <view class="sublevel-title">
  33. <!-- completeSort -->
  34. 任务过程:<text> ({{ taskInfo.completeSort === 1 ? '顺序完成' : '随机完成'}}) </text>
  35. </view>
  36. <view class="sublevel-list">
  37. <view class="sublevel-item" v-for="(item , index) in taskInfo.childTaskVoList">
  38. <view class="sublevel-item-num">
  39. {{item.location || item.childTaskLocation}}
  40. </view>
  41. <view class="sublevel-item-content">
  42. <view class="sublevel-item-title zw-one-row">
  43. <text class="title-name zw-one-row">{{item.title || item.childTaskTitle}}</text>
  44. <template v-if="receiveTaskId">
  45. <tag class="sublevel-status" v-if="item.checkStatus === 0" bgColor="#edfcfd"
  46. color="#3CB7D2" :tag-name="$TaskStatusText(item.checkStatus)" />
  47. <tag class="sublevel-status" v-if="item.checkStatus === 1" bgColor="#FDFAED"
  48. color="#FFB300" :tag-name="$TaskStatusText(item.checkStatus)" />
  49. <tag class="sublevel-status" v-if="item.checkStatus === 2" bgColor="#FDEDED"
  50. color="#FF0000" :tag-name="$TaskStatusText(item.checkStatus)" />
  51. <tag class="sublevel-status" v-if="item.checkStatus === 3" bgColor="#EDFDF2"
  52. color="#00B819" :tag-name="$TaskStatusText(item.checkStatus)" />
  53. </template>
  54. </view>
  55. <view class="sublevel-item-text">
  56. <view class="content-text">
  57. {{item.remark || item.childTaskRemark}}
  58. </view>
  59. <!-- checkStatus 审状态(0未提交,1待审核,2驳回,3审核通过),可用值:NOT_SUBMIT,PASS,REJECT,WAIT -->
  60. <!-- 驳回 - 去提交 / 审核中 -- 去查看 / 进行中 -- 去提交 / 已完成 -- 去查看 -->
  61. <template v-if="receiveTaskId">
  62. <view class="content-btn" v-if="[0, 2].includes(item.checkStatus)"
  63. @click.stop="onSubmit( 1, index , false , 'submitDetails')">
  64. 去提交
  65. </view>
  66. <view class="content-btn" v-if="[1, 3].includes(item.checkStatus)"
  67. @click.stop="onSubmit( 1, index , true , 'taskAuditDetails')">
  68. 去查看
  69. </view>
  70. </template>
  71. </view>
  72. <view class="reject-cause" v-if="receiveTaskId && item.checkStatus === 2">
  73. <text class="reject-title">驳回原因:</text>
  74. <text class="reject-hint">{{ item.rejectReason }}</text>
  75. </view>
  76. </view>
  77. </view>
  78. </view>
  79. </view>
  80. </template>
  81. </view>
  82. <template v-if="taskInfo">
  83. <!-- 任务大厅进来领取 -->
  84. <taskBottomBtn v-if="taskId" pageBgc="#f5f5f5" :paddTop="5"
  85. :btnColor="taskInfo.publishedStatus === 0 ? '#ccc' : '' " @onClick="onReceive" btn-name="领取任务" />
  86. <!-- 我的任务 - 单任务提交 -->
  87. <taskBottomBtn v-if="receiveTaskId && taskInfo.taskType === 0"
  88. @onClick="onSubmit(0, 0 , false , 'submitDetails')" btn-name="去提交" />
  89. </template>
  90. </view>
  91. </template>
  92. <script>
  93. import {
  94. getTaskInfo_Api,
  95. getrReceiveTask_Api,
  96. getMyTaskInfo_Api,
  97. onSubmitCheck_Api
  98. } from "@/api/task.js"
  99. import share from "./components/share.vue"
  100. import taskContent from "./components/task-content.vue"
  101. import taskBottomBtn from "./components/task-bottom-btn.vue"
  102. import tag from "./components/tag.vue"
  103. import {
  104. onSubmint_val
  105. } from "./task_common.js"
  106. export default {
  107. name: 'yige-task-details',
  108. components: {
  109. share,
  110. taskContent,
  111. taskBottomBtn,
  112. tag
  113. },
  114. data() {
  115. return {
  116. taskId: null,
  117. receiveTaskId: null,
  118. taskType: null, // // 任务类型:1:任务大厅 - 领取任务; 2:我的任务 - 提交任务
  119. config: {
  120. back: true,
  121. title: '任务详情',
  122. color: 'black',
  123. backgroundColor: [1, '#fff'],
  124. statusBarFontColor: 'black'
  125. },
  126. taskInfo: null
  127. }
  128. },
  129. onLoad(opt) {
  130. this.taskType = Number(opt.taskType) || null;
  131. this.taskId = opt.taskId;
  132. this.receiveTaskId = opt.receiveTaskId;
  133. this.init()
  134. },
  135. methods: {
  136. init() {
  137. if (this.taskId) {
  138. // 大厅任务详情
  139. this.getTaskInfo()
  140. }
  141. if (this.receiveTaskId) {
  142. this.getMyTaskInfo();
  143. }
  144. },
  145. // 任务大厅进来
  146. getTaskInfo() {
  147. getTaskInfo_Api(this.taskId).then(res => {
  148. this.taskInfo = res.data || null
  149. })
  150. },
  151. // 任务领取
  152. onReceive() {
  153. if (!this.taskInfo.publishedStatus) {
  154. uni.showToast({
  155. title: '当前任务未开放',
  156. icon: 'none'
  157. });
  158. return
  159. };
  160. getrReceiveTask_Api(this.taskId).then(res => {
  161. uni.showToast({
  162. title: '领取成功',
  163. icon: 'none'
  164. })
  165. })
  166. },
  167. // 我的任务列表进来 - 单任务详情
  168. getMyTaskInfo() {
  169. getMyTaskInfo_Api(this.receiveTaskId).then(res => {
  170. this.taskInfo = res.data || null
  171. })
  172. },
  173. // 去查看
  174. // task-examine
  175. // onExamine() {
  176. // let path = '/pages/task/submit-task';
  177. // if (type === 0) {
  178. // // 单任务提交
  179. // path = `${path}?receiveTaskId=${this.receiveTaskId}`
  180. // } else {
  181. // // 多任务下子任务提交
  182. // path = `${path}?receiveChildTaskId=${receiveChildTaskId}`
  183. // };
  184. // uni.navigateTo({
  185. // url: path
  186. // })
  187. // },
  188. //
  189. /**
  190. * 提交 / 查看
  191. *
  192. * type: 0: 单任务 , 1: 多任务
  193. *
  194. * checkPage 是否查看: false: 提交 , true: 查看
  195. *
  196. */
  197. onSubmit(type = 0, index = 0, checkPage = false, page) {
  198. const taskInfo = this.taskInfo.childTaskVoList[index];
  199. onSubmint_val(type, taskInfo, checkPage, page)
  200. },
  201. // onSubmit_more(type , index ){
  202. // const taskInfo = this.taskInfo.childTaskVoList[0];
  203. // onSubmint_val(type, taskInfo, checkPage)
  204. // }
  205. }
  206. }
  207. </script>
  208. <style lang="scss" scoped>
  209. @import "./common.scss";
  210. .task-details-box {
  211. width: 100%;
  212. .details-content {
  213. padding: 0 30rpx 30rpx;
  214. }
  215. .task-sublevel {
  216. width: 100%;
  217. .sublevel-title {
  218. width: 100%;
  219. height: 91rpx;
  220. padding: 0 30rpx;
  221. border-bottom: 1rpx solid #e6e6e6;
  222. line-height: 90rpx;
  223. font-size: 30rpx;
  224. // font-family: .PingFang SC, .PingFang SC-Semibold;
  225. font-weight: 500;
  226. text-align: left;
  227. color: #1a1a1a;
  228. // letter-spacing: -0.6px;
  229. text {
  230. font-size: 30rpx;
  231. // font-family: .PingFang SC, .PingFang SC-Light;
  232. font-weight: 300;
  233. // text-align: left;
  234. color: #1a1a1a;
  235. // letter-spacing: -0.6px;
  236. }
  237. }
  238. .sublevel-list {
  239. width: 100%;
  240. padding: 0 30rpx;
  241. .sublevel-item {
  242. padding: 20rpx 0 15rpx;
  243. display: flex;
  244. flex-direction: row;
  245. justify-content: flex-start;
  246. border-bottom: 1rpx solid #e6e6e6;
  247. .sublevel-item-num {
  248. width: 57rpx;
  249. height: 57rpx;
  250. border-radius: 50%;
  251. background: linear-gradient(180deg, #45c7d5, #3eb8d0);
  252. text-align: center;
  253. line-height: 57rpx;
  254. font-size: 30rpx;
  255. font-family: PingFang SC, PingFang SC-Bold;
  256. font-weight: 700;
  257. text-align: center;
  258. color: #ffffff;
  259. }
  260. .sublevel-item-content {
  261. width: calc(100% - 57rpx);
  262. padding-left: 13rpx;
  263. .sublevel-item-title {
  264. width: 100%;
  265. height: 57rpx;
  266. line-height: 57rpx;
  267. font-size: 28rpx;
  268. // font-family: PingFang SC, PingFang SC-Bold;
  269. font-weight: Light;
  270. color: #1a1a1a;
  271. display: flex;
  272. flex-direction: row;
  273. align-items: center;
  274. .title-name {
  275. padding-right: 20rpx;
  276. }
  277. .sublevel-status {
  278. flex-shrink: 0;
  279. }
  280. }
  281. .sublevel-item-text {
  282. font-size: 26rpx;
  283. // font-family: .PingFang SC, .PingFang SC-Light;
  284. font-weight: Light;
  285. color: #808080;
  286. line-height: 38rpx;
  287. display: flex;
  288. flex-direction: row;
  289. align-items: center;
  290. justify-content: space-between;
  291. .content-btn {
  292. flex-shrink: 0;
  293. margin-left: 20rpx;
  294. width: 135rpx;
  295. height: 54rpx;
  296. background: linear-gradient(75deg, #3cb7d2 10%, #46c8d5 89%);
  297. border-radius: 27rpx;
  298. font-size: 24rpx;
  299. font-family: PingFang SC, PingFang SC-Regular;
  300. font-weight: Regular;
  301. text-align: center;
  302. color: #ffffff;
  303. line-height: 54rpx;
  304. }
  305. // content-btn
  306. }
  307. .reject-cause {
  308. width: 100%;
  309. padding-top: 20rpx;
  310. // text-align: center;
  311. font-size: 26rpx;
  312. display: flex;
  313. font-weight: Regular;
  314. align-items: stretch;
  315. .reject-title {
  316. flex-shrink: 0;
  317. font-weight: 500;
  318. }
  319. }
  320. }
  321. }
  322. }
  323. }
  324. }
  325. .task-btn-box {
  326. width: 100%;
  327. height: 150rpx;
  328. .task-btn {
  329. width: 100%;
  330. height: 150rpx;
  331. position: fixed;
  332. left: 0;
  333. right: 0;
  334. bottom: 0;
  335. z-index: 1;
  336. .task-text {
  337. margin: 20rpx auto;
  338. width: 690rpx;
  339. height: 80rpx;
  340. background: linear-gradient(92deg, #3cb7d2 2%, #44c5d5 98%);
  341. border-radius: 40rpx;
  342. text-align: center;
  343. line-height: 80rpx;
  344. font-size: 32rpx;
  345. font-family: PingFang SC, PingFang SC-Regular;
  346. font-weight: Regular;
  347. color: #ffffff;
  348. }
  349. }
  350. }
  351. .gap {
  352. width: 100%;
  353. height: 10rpx;
  354. background: #f5f5f5;
  355. }
  356. </style>