开发积分兑换

This commit is contained in:
田岩
2025-11-19 20:31:44 +08:00
parent 66c257e138
commit b395322d3e
4 changed files with 62 additions and 22 deletions
+8 -2
View File
@@ -35,12 +35,18 @@
<!-- 显示当前选中的徽章 -->
<view class="dan" @click="common.navigateTo('/pages/pointsAndRank/rank')">
<view class="dan_img">
<image
<!-- <image
class="img_100"
:src="`/static/images/me/${badgeList[currentIndex].png}`"
mode="heightFix"
alt="当前徽章"
></image>
></image> -->
<image-preview
class="img_100"
:src="statistics_data['currentRankAddr']"
mode="heightFix"
alt="当前徽章"
></image-preview>
</view>
</view>
<view class="fl1"></view>
+50 -17
View File
@@ -14,7 +14,7 @@
<view class="back_div" @click="common.navigateBack()">
<view class="back-icon"></view>
</view>
<view>积分明细</view>
<view>{{data.actName}}</view>
</view>
<view class="fl1"></view>
</view>
@@ -28,8 +28,9 @@
class="send_evaluate"
color="#0066FF"
:throttleTime="100"
text="20积分兑换"
loadingText="正在加载错题"
:text="buttonText"
:loading="buttonLoading"
loadingText="正在兑换中"
:custom-style="customStyle"
></uv-button>
</template>
@@ -38,7 +39,7 @@
<script setup>
// 竞赛列表
import { ref, reactive, watch, onMounted } from 'vue';
import { ref, reactive, watch, onMounted, computed } from 'vue';
import { onLoad, onUnload } from '@dcloudio/uni-app';
import useZpaging from '@/composables/useZpaging.js';
import common from '@/common/common';
@@ -46,14 +47,37 @@
const customStyle = {
borderRadius: '12rpx'
};
const startVal = ref(0);
const endVal = ref(0);
const countToRef = ref(null);
const buttonText = computed(() => {
if(data.actStatus === 'Y') {
return data.excPoints + "积分兑换"
} else if(data.actStatus === 'N') {
return data.actStatusText || '正在获取'
}
})
const buttonLoading = ref(false)
const data = reactive({
actId:'', // ID
actName:'', // 活动名称
ossAddr:'', // 图片
excPoints:0, // 兑换所需积分
actEvent:'', // 活动介绍
remainingCnt:'', // 剩余数量,库存
itemTyp:'', // 物品类型 0 虚拟 1实体
actStatus:'N', // 是否可以兑换 Y 可以 N不能
actStatusText:'', // 不可以兑换提示的内容
});
const fetchFunction = (params) => {
queryPointsActivityDetail({
actId:"TRAPOINTSACTIVITY02501812207220251113142216000003456"
actId:data.actId
}).then(({ body }) => {
console.log('body', body);
data.actName = body.actName
data.ossAddr = body.ossAddr
data.excPoints = body.excPoints
data.actEvent = body.actEvent
data.remainingCnt = body.remainingCnt
data.itemTyp = body.itemTyp
data.actStatus = body.actStatus
data.actStatusText = body.actStatusText
});
};
@@ -61,14 +85,23 @@
const { pagingRef, queryList, data_list } = useZpaging({
fetchFunction
});
const buttonClick = () => {};
onLoad(() => {
const points_data = common.getValue('points_data');
if (points_data) {
startVal.value = points_data.currentPoints; // 徽章数
endVal.value = points_data.currentPoints; // 徽章数
}
const buttonClick = () => {
buttonLoading.value = true
addPointsExchange({
actId:data.actId,
recAddr:data.recAddr??'地址',
changeValue:data.excPoints,
}).then(({ body }) => {
data.actStatus = body.actStatus
data.actStatusText = body.actStatusText
common.msg(body.result)
}).finally(() => {
buttonLoading.value =false
})
};
onLoad((e) => {
data.actId = e.actId ?? 'TRAPOINTSACTIVITY02501812207220251113142216000003456'
});
onUnload(() => {});
</script>
+1
View File
@@ -22,6 +22,7 @@
</uv-cell>
<uv-cell title="性别" @click="sexPicker.open()" :isLink="true" :value="showGenderText"></uv-cell>
<uv-cell title="百禄形象" @click="gotoMascot()" :isLink="true" :border="false" :value="mascotName"></uv-cell>
<uv-cell title="性别" @click="sexPicker.open()" :isLink="true" :value="showGenderText"></uv-cell>
</uv-cell-group>
</view>
<avatar-cropper