taskList.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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. }
  95. }
  96. }
  97. </script>
  98. <style lang="less">
  99. .content{
  100. width: 100%;
  101. padding: 0;
  102. // 弹框提示
  103. .lottery-content{
  104. display: flex;
  105. justify-content: center;
  106. height: 100%;
  107. position: relative;
  108. background: url(../../static/lottery_winbg1.png) no-repeat center top;
  109. background-size: 100% auto;
  110. .lottery-confrim-btn{
  111. width: 100%;
  112. display: flex;
  113. justify-content: center;
  114. position: absolute;
  115. bottom: 0;
  116. left: 0;
  117. color: #21d5c0;
  118. font-size: 32rpx;
  119. border-top: 1px solid #eee;
  120. padding: 30rpx 0;
  121. }
  122. .lottery-title{
  123. padding: 100rpx 50rpx;
  124. display: flex;
  125. text-align: center;
  126. image{
  127. width: 450rpx;
  128. height: 320rpx;
  129. }
  130. }
  131. }
  132. }
  133. .task-list{
  134. display: flex;
  135. align-items: center;
  136. padding: 20rpx 40rpx;
  137. border-bottom: 1px solid #eee;
  138. background-color: #FFFFFF;
  139. .task-l{
  140. width: 80%;
  141. display: flex;
  142. align-items: center;
  143. .task-l-info{
  144. flex-grow: 1;
  145. padding: 0 15rpx;
  146. .task-l-title{
  147. font-weight: bold;
  148. }
  149. .task-l-desc{
  150. display: flex;
  151. align-items: center;
  152. font-size: 24rpx;
  153. color: #666;
  154. margin-top: 5rpx;
  155. }
  156. }
  157. }
  158. .task-r{
  159. width: 20%;
  160. }
  161. }
  162. </style>