taskList.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. }
  38. },
  39. onLoad(option) {
  40. if(option.id) {
  41. this.getTaskList(option.id)
  42. }
  43. this.luckDraw = this.$store.state.vuex_LuckDraw
  44. },
  45. methods: {
  46. // 获取任务列表
  47. getTaskList (id) {
  48. findCustomerTask({id:id}).then(res =>{
  49. if(res.status == 200) {
  50. console.log(res)
  51. this.list = res.data
  52. } else {
  53. this.list = []
  54. }
  55. })
  56. },
  57. showYdao(){
  58. this.showYd = true
  59. },
  60. toViewZn(){
  61. uni.redirectTo({
  62. url: '/pages/userCenter/zhinan'
  63. })
  64. },
  65. // 做任务
  66. toDoTask(taskCode){
  67. doTask({luckyDrawNo:this.luckDraw.luckyDrawNo,taskCode:taskCode}).then(res => {
  68. if(res.status == 200){
  69. uni.showToast({
  70. icon: 'none',
  71. title: '分享成功'
  72. })
  73. }
  74. })
  75. }
  76. },
  77. onShareAppMessage() {
  78. this.toDoTask('SHARE_FRIEND')
  79. return {
  80. title: '[乐色管家]年末活动来袭,幸福大转盘, 精彩好礼等你来抽!',
  81. path: '/pagesA/luckDraw/luckDraw',
  82. imageUrl:'/static/zpthumbr.jpg'
  83. }
  84. },
  85. onShareTimeline() {
  86. this.toDoTask('SHARE_FRIEND')
  87. return {
  88. title: '[乐色管家]年末活动来袭,幸福大转盘, 精彩好礼等你来抽!',
  89. imageUrl:'/static/zpthumbr.jpg'
  90. }
  91. }
  92. }
  93. </script>
  94. <style lang="less">
  95. .content{
  96. width: 100%;
  97. padding: 0;
  98. // 弹框提示
  99. .lottery-content{
  100. display: flex;
  101. justify-content: center;
  102. height: 100%;
  103. position: relative;
  104. background: url(../../static/lottery_winbg1.png) no-repeat center top;
  105. background-size: 100% auto;
  106. .lottery-confrim-btn{
  107. width: 100%;
  108. display: flex;
  109. justify-content: center;
  110. position: absolute;
  111. bottom: 0;
  112. left: 0;
  113. color: #21d5c0;
  114. font-size: 32rpx;
  115. border-top: 1px solid #eee;
  116. padding: 30rpx 0;
  117. }
  118. .lottery-title{
  119. padding: 100rpx 50rpx;
  120. display: flex;
  121. text-align: center;
  122. image{
  123. width: 450rpx;
  124. height: 320rpx;
  125. }
  126. }
  127. }
  128. }
  129. .task-list{
  130. display: flex;
  131. align-items: center;
  132. padding: 20rpx 40rpx;
  133. border-bottom: 1px solid #eee;
  134. background-color: #FFFFFF;
  135. .task-l{
  136. width: 80%;
  137. display: flex;
  138. align-items: center;
  139. .task-l-info{
  140. flex-grow: 1;
  141. padding: 0 15rpx;
  142. .task-l-title{
  143. font-weight: bold;
  144. }
  145. .task-l-desc{
  146. display: flex;
  147. align-items: center;
  148. font-size: 24rpx;
  149. color: #666;
  150. margin-top: 5rpx;
  151. }
  152. }
  153. }
  154. .task-r{
  155. width: 20%;
  156. }
  157. }
  158. </style>