taskList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. <template>
  2. <view class="content">
  3. <view class="task-list" v-for="(item,index) in list" :key="index">
  4. <view class="task-l">
  5. <u-image width="80rpx" height="80rpx" :src="`/static/${item.taskCode}.png`"></u-image>
  6. <view class="task-l-info">
  7. <view class="task-l-title">{{item.taskCodeDictValue}}</view>
  8. <view class="task-l-desc">赚<text>{{item.giveTimes}}</text>次抽奖 <u-image width="22rpx" height="22rpx" src="/static/zpIcon.png"></u-image></view>
  9. </view>
  10. </view>
  11. <view class="task-r">
  12. <u-button size="medium" v-if="item.state==1||item.taskCode=='NEW_CUSTOMER'" :custom-style="{padding:'6px 10px',width:'100%',background:'#989898',color:'#ffffff'}">已完成</u-button>
  13. <u-button size="medium" v-else-if="item.state==0 && item.taskCode=='SHARE_FRIEND'" open-type="share" :custom-style="{padding:'6px 10px',width:'100%',background:'#02c9b2',color:'#ffffff'}">立即分享</u-button>
  14. <u-button size="medium" v-else @click="showYdao" :custom-style="{padding:'6px 10px',width:'100%',background:'#02c9b2',color:'#ffffff'}">立即前往</u-button>
  15. </view>
  16. </view>
  17. <u-popup v-model="showYd" mode="center" close-icon-color="#ffffff" closeable :border-radius="30" width="500rpx" height="550rpx">
  18. <view class="lottery-content">
  19. <view class="lottery-title">
  20. <image src="/static/tdsm.jpg"></image>
  21. </view>
  22. <view @click="toViewZn" class="lottery-confrim-btn">
  23. 查看使用指南
  24. </view>
  25. </view>
  26. </u-popup>
  27. </view>
  28. </template>
  29. <script>
  30. import { findCustomerTask, doTask } from '@/api/luckyDraw.js'
  31. export default {
  32. data() {
  33. return {
  34. showYd: false,
  35. list: [], // 任务列表
  36. luckDraw: null,
  37. id:''
  38. }
  39. },
  40. onLoad(option) {
  41. if(option.id) {
  42. this.id = option.id
  43. }
  44. this.luckDraw = this.$store.state.vuex_LuckDraw
  45. },
  46. onShow() {
  47. this.getTaskList()
  48. },
  49. methods: {
  50. // 获取任务列表
  51. getTaskList () {
  52. findCustomerTask({id:this.id}).then(res =>{
  53. if(res.status == 200) {
  54. console.log(res)
  55. this.list = res.data
  56. } else {
  57. this.list = []
  58. }
  59. })
  60. },
  61. showYdao(){
  62. this.showYd = true
  63. },
  64. toViewZn(){
  65. uni.redirectTo({
  66. url: '/pages/userCenter/zhinan'
  67. })
  68. },
  69. // 做任务
  70. toDoTask(taskCode){
  71. doTask({luckyDrawNo:this.luckDraw.luckyDrawNo,taskCode:taskCode}).then(res => {
  72. if(res.status == 200){
  73. uni.showToast({
  74. icon: 'none',
  75. title: '分享成功'
  76. })
  77. }
  78. })
  79. }
  80. },
  81. onShareAppMessage() {
  82. this.toDoTask('SHARE_FRIEND')
  83. return {
  84. title: '[乐色管家]参与垃圾分类,让城市更美丽!好运等你转出来!',
  85. path: '/pagesA/luckDraw/luckDraw',
  86. imageUrl:'/static/zpthumbr.jpg'
  87. }
  88. },
  89. onShareTimeline() {
  90. this.toDoTask('SHARE_FRIEND')
  91. return {
  92. title: '[乐色管家]参与垃圾分类,让城市更美丽!好运等你转出来!',
  93. imageUrl:'/static/zpthumbr.jpg',
  94. query: 'fromType=timeline'
  95. }
  96. }
  97. }
  98. </script>
  99. <style lang="less">
  100. .content{
  101. width: 100%;
  102. padding: 0;
  103. // 弹框提示
  104. .lottery-content{
  105. display: flex;
  106. justify-content: center;
  107. height: 100%;
  108. position: relative;
  109. background: url(../../static/lottery_winbg1.png) no-repeat center top;
  110. background-size: 100% auto;
  111. .lottery-confrim-btn{
  112. width: 100%;
  113. display: flex;
  114. justify-content: center;
  115. position: absolute;
  116. bottom: 0;
  117. left: 0;
  118. color: #21d5c0;
  119. font-size: 32rpx;
  120. border-top: 1px solid #eee;
  121. padding: 30rpx 0;
  122. }
  123. .lottery-title{
  124. padding: 100rpx 50rpx;
  125. display: flex;
  126. text-align: center;
  127. image{
  128. width: 450rpx;
  129. height: 320rpx;
  130. }
  131. }
  132. }
  133. }
  134. .task-list{
  135. display: flex;
  136. align-items: center;
  137. padding: 20rpx 40rpx;
  138. border-bottom: 1px solid #eee;
  139. background-color: #FFFFFF;
  140. .task-l{
  141. width: 80%;
  142. display: flex;
  143. align-items: center;
  144. .task-l-info{
  145. flex-grow: 1;
  146. padding: 0 15rpx;
  147. .task-l-title{
  148. font-weight: bold;
  149. }
  150. .task-l-desc{
  151. display: flex;
  152. align-items: center;
  153. font-size: 24rpx;
  154. color: #666;
  155. margin-top: 5rpx;
  156. }
  157. }
  158. }
  159. .task-r{
  160. width: 20%;
  161. }
  162. }
  163. </style>