task-item.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <template>
  2. <view>
  3. <view class="task-body m-lr20 m-t20">
  4. <view class="row-c page-box-bg-fff m-b20 r-30 box-shadow-197" v-for="(item,index) in taskList" :key="index"
  5. @click="onTaskDetails(item)">
  6. <view class="main_string" :style="{background:lineColor[0]}"></view>
  7. <view class="row-c flex p-30">
  8. <image class="wh-80" :src="item.product_icon" mode=""></image>
  9. <view class="flex m-l20">
  10. <view class="row-justify-sb center flex">
  11. <text class="text-color-333 sys-weight-600">{{item.product_name}}</text>
  12. <view class="row-c line-40">
  13. <text class="size-26 text-color-333">{{item.name}}</text>
  14. <image class="wh-30 m-l16" src="/static/img/task/task-phone.png" mode=""></image>
  15. </view>
  16. </view>
  17. <view
  18. class="p-tb14 p-lr30 m-tb20 r-100 row-justify-sb center size-24 text-color-12 sys-from-background-color"
  19. style="line-height: 40rpx;">
  20. <text class="size-28 text-color-E21 sys-weight-600">{{item.quota}}万</text>
  21. <text>{{item.stage_name}}</text>
  22. <text>{{item.use_date}}用款</text>
  23. </view>
  24. <view class="row-justify-sb center" style="line-height: 40rpx;">
  25. <text class="size-24 text-color-999 flex">{{item.created_date}}</text>
  26. <image style="width: 65rpx;height: 32rpx;" :src="getIconStatus(iconStatus)"
  27. v-if="type === 1">
  28. </image>
  29. <button class="button-background en_button sys-weight-500 text-color-fff size-28 r-100"
  30. style="width: 200rpx;height: 70rpx;line-height: 70rpx;" type="default"
  31. hover-class="is-hover" v-else-if="type === 2"
  32. @click.stop="takeTask(index)">领取任务</button>
  33. <button class="button-background en_button sys-weight-500 text-color-fff size-28 r-100"
  34. style="width: 200rpx;height: 70rpx;line-height: 70rpx;" type="default"
  35. hover-class="is-hover" v-else-if="type === 4">去处理</button>
  36. <view class="row-c" v-else-if="type === 3">
  37. <button
  38. class="button-backgroun en_buttond left_button sys-weight-500 button_color-008FD6 size-26 r-100 m-r20"
  39. type="default" hover-class="is-hover">核算</button>
  40. <button
  41. class="button-background en_button left_button right_button sys-weight-500 button_color-008FD6 size-26 r-100"
  42. type="default" hover-class="is-hover">客户分类</button>
  43. </view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="placeholder sys-list-background-color" v-if="is_bottom && taskList.length"></view>
  49. </view>
  50. <en-blank v-if="taskList.length<=0"></en-blank>
  51. </view>
  52. </template>
  53. <script>
  54. import EnButton from "@/components/en-utils/en-button/en-button.vue";
  55. import {
  56. takeTask
  57. } from "@/api/task";
  58. import tools from "@/service/tools";
  59. import EnBlank from "@/components/en-utils/en-blank/en-blank.vue";
  60. export default {
  61. components: {
  62. EnBlank,
  63. EnButton
  64. },
  65. props: {
  66. type: {
  67. type: Number,
  68. default: 1
  69. },
  70. taskList: {
  71. type: Array,
  72. default: () => []
  73. },
  74. iconStatus: {
  75. type: Number,
  76. default: 1
  77. },
  78. leftImgStatus: {
  79. type: Number,
  80. default: 0
  81. },
  82. opacity: {
  83. type: Number,
  84. default: 0
  85. },
  86. back: {
  87. type: Boolean,
  88. default: false
  89. },
  90. is_bottom: {
  91. type: Boolean,
  92. default: false
  93. },
  94. },
  95. data() {
  96. return {
  97. leftImg: ['task-house', 'task-business', 'task-repayment'],
  98. iconList: ['task-audit', 'task-do', 'task-stay'],
  99. lineColor: ['#DE5847', '#EF8F27', '#0FB160'],
  100. isAjax: false
  101. }
  102. },
  103. methods: {
  104. takeTask(index) {
  105. if (this.isAjax) {
  106. return;
  107. }
  108. this.isAjax = true;
  109. takeTask({
  110. 'id': this.taskList[index].id
  111. }).then((res) => {
  112. this.isAjax = false
  113. if (res.code === 1) {
  114. tools.success(res.msg)
  115. // this.taskList.splice(index, 1)
  116. this.$emit('takeTask', index)
  117. } else {
  118. tools.error(res.msg)
  119. }
  120. })
  121. },
  122. getIconStatus() {
  123. return `/static/img/task/${this.iconList[this.iconStatus]}.png`
  124. },
  125. getLeftImg() {
  126. return `/static/img/task/${this.leftImg[this.leftImgStatus]}.png`
  127. },
  128. onTaskDetails(item) {
  129. uni.navigateTo({
  130. url: '/page_task/task_details/task_details?taskId=' + item.id
  131. })
  132. }
  133. }
  134. }
  135. </script>
  136. <style lang="scss" scoped>
  137. .en_button {
  138. border: none;
  139. }
  140. .task-body {
  141. height: 100%;
  142. }
  143. .left_button {
  144. width: 122rpx;
  145. height: 56rpx;
  146. color: #008FD6;
  147. line-height: 56rpx;
  148. background: #FFFFFF;
  149. border: 1rpx solid #008FD6;
  150. border-radius: 100rpx;
  151. }
  152. .right_button {
  153. width: 160rpx;
  154. }
  155. .placeholder {
  156. height: 40rpx;
  157. }
  158. .main_string {
  159. width: 6rpx;
  160. height: 60rpx;
  161. border-radius: 100rpx;
  162. background: red;
  163. }
  164. button::after {
  165. border: none;
  166. }
  167. </style>