task-details.vue 11 KB

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