任务修改,会员权益修改

This commit is contained in:
GaoHao
2024-12-25 17:10:05 +08:00
parent 3960ff7586
commit 28bab311d3
12 changed files with 255 additions and 69 deletions

View File

@@ -1,7 +1,7 @@
<!-- 任务中心 -->
<template>
<view class="container">
<u-navbar :background="background" :is-back="true" :title="title" :border-bottom="false"></u-navbar>
<u-navbar :background="background" :is-back="true" :title="title" :border-bottom="false" style="position: absolute;"></u-navbar>
<view class="task_bg u-relative">
<u-image class="task_bg" src="../../static/images/task/member_bg.png" ></u-image>
<view class="title ">每月打卡免费领</view>
@@ -15,12 +15,32 @@
</view>
<view class="cell flex justify-between" v-for="(item,index) in list" :key="index" >
<view class="cell_left flex">
<image class="cell_icon" :src="item.url"></image>
<image class="cell_icon" :src="item.img"></image>
<view class="cell_title flex">
<view class="u-font-28 text-bold title">{{ item.name}}</view>
<!-- <view class="u-font-24 tip">{{ item.rewardDetail }}</view> -->
<view class="u-font-24 tip">{{ item.rewardDetail }}</view>
</view>
</view>
<view class="cell_right" v-if="standard=='true'">
<viwe v-if="!receive">
<view class="btn" @click="taskReceive(item)">领取</view>
</viwe>
<view v-else>
<view v-if="item.disabled" >
<view class="btn disabled" >领取</view>
</view>
<view v-else>
<view v-if="!item.targetId" class="btn" @click="toDuiHuan(item)">去兑换</view>
<view v-else class="btn receive" >已兑换</view>
<u-image v-if="!item.targetId" class="icon" src="../../static/images/task/receive2.png"></u-image>
</view>
</view>
</view>
<view class="standard" v-else>
<u-image class="icon" src="../../static/images/task/receive1.png"></u-image>
</view>
</view>
</view>
@@ -37,7 +57,14 @@
background: {
backgroundImage: 'transparent',
},
query: {
taskId: null,
},
list: [],
standard: true,
receive: null,
record: null,
source: null,
}
},
@@ -46,21 +73,75 @@
if ( options.source ) {
this.source = options.source
}
this.getList()
if ( options.standard ) {
this.standard = options.standard
}
if ( options.taskId ) {
this.query.taskId = options.taskId
}
},
onShow() {
this.getList()
},
methods: {
/**
* 去兑换
* @param {Object} item
*/
toDuiHuan(item){
uni.navigateTo({
url:`/me/gift/duihuan?id=${this.record}&foreignType=task`
})
},
/**
* 获取列表
*/
getList() {
this.$Request.getT('app/discSpinning/selectDiscSpinning', {source:this.source}).then(res => {
this.$Request.getT('app/taskCenterReward/selectTaskCenterUserReward', this.query).then(res => {
if (res.code == 0 ) {
this.list = res.data.records
this.list = res.data
this.list.map(item=>{
item.disabled = true
})
this.receive = res.receive
this.record = res.record
if ( this.receive ) {
this.list.map(item=>{
if ( item.id == this.receive ) {
item.disabled = false
}
})
}
console.log(this.list)
}
})
},
/**
* 领取
*/
taskReceive(item) {
let data = {
taskId: this.query.taskId,
sourceId: item.id
}
this.$Request.postT('app/taskCenter/receiveGoods', data).then(res => {
if (res.code == 0) {
uni.showToast({
title: '领取成功',
icon: 'none'
})
this.getList()
} else {
uni.showToast({
title: res.msg,
icon: 'none'
})
}
})
},
}
}
</script>
@@ -120,6 +201,17 @@
border-radius: 8rpx 8rpx 8rpx 8rpx;
margin-bottom: 32rpx;
padding: 32rpx 28rpx;
position: relative;
.standard{
width: 100%;
height: 100%;
background: rgba(43,43,43,0.19);
border-radius: 8rpx 8rpx 8rpx 8rpx;
position: absolute;
right: 0;
bottom: 0;
}
.cell_left{
flex-direction: row;
align-items: center;
@@ -147,7 +239,7 @@
}
}
.cell_right{
.cell_right{
flex-direction: column;
align-items: center;
flex-shrink: 0;
@@ -163,6 +255,8 @@
font-size: 24rpx;
color: #FFFFFF;
border: 2rpx solid transparent;
position: relative;
z-index: 99;
}
.opt{
@@ -179,6 +273,13 @@
color: #6DA9F7;
}
}
.icon{
width: 132rpx!important;
height: 136rpx!important;
position: absolute;
right: 0;
bottom: 0;
}
}
.cell:last-child{