task-item.vue 4.7 KB

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