This commit is contained in:
蔡同学
2025-08-25 11:20:35 +08:00
parent 25df08ec69
commit 6df8112e7b
251 changed files with 34346 additions and 0 deletions
+153
View File
@@ -0,0 +1,153 @@
<template>
<uni-popup type="bottom" ref="pointsyes" @maskClick="quxiao" :safe-area="false">
<view class="pointsyesbox">
<view class="flex" style="margin-bottom: 24rpx;justify-content: space-between;">
<view class="ft16 ftw500 cl-333">积分兑换金豆</view>
<view class="ft14 ftw500 cl-999" @click="quxiao">取消</view>
</view>
<view class="ft14 ftw500 cl-333">当前积分:<text style="color: #FFA100;">{{score}}</text></view>
<view class="uni-input" style="margin-top: 32rpx; margin-bottom: 12rpx;">
<input type="number" class="input" adjust-position @input="listeninginput" v-model="quantity"
placeholder="请输入积分数量" />
</view>
<view class="ft12 ftw500 cl-999" style="margin-bottom: 56rpx;">{{datas.jfdhsm}}</view>
<view class="ftw500 mb16" style="text-align: center; color: #FFA100;"> <text
style="font-size: 48rpx;">{{exchange || 0}}</text> <text style="font-size: 28rpx;">金豆</text> </view>
<view class="practices" @click="tijiao">提交</view>
</view>
</uni-popup>
</template>
<script>
export default {
data() {
return {
quantity: "",
score: "",
datas: "",
}
},
computed:{
exchange(){
return Math.floor((this.quantity * this.datas.jfdh) * 100) / 100 || 0;
}
},
methods: {
pointsyesshop() {
this.getuser()
this.$refs.pointsyes.open()
},
quxiao() {
this.quantity = ""
this.$refs.pointsyes.close()
},
//获取 用户积分
getuser() {
this.$httpRequest({
url: '/api/user/index',
methods: "POST",
}).then(res => {
console.log(res.data.score);
this.score = res.data.score
this.datas = res.data.config.site
}).catch(err => {})
},
listeninginput(e) {
console.log(e);
if (e.detail.value >= this.score) {
e.detail.value = this.score
console.log(123);
console.log(this.quantity);
console.log(this.score);
this.$forceUpdate()
}
},
listeninginput(e) {
const o = e.detail.value
const inputRule = /[^\d]/g
this.$nextTick(() => {
this.cargoNo = o.replace(inputRule, '');
if (this.cargoNo == '') {
return
} else {
//执行对应代码
if (e.detail.value >= this.score) {
this.quantity = this.score
}
}
})
},
tijiao() {
// this.quantity = parseInt(this.exchange) / this.datas.jfdh
// this.exchange = (this.quantity * this.datas.jfdh).toFixed(2)
if (this.quantity <= this.score) {
this.$httpRequest({
url: '/api/user/duihuan',
data: {
sum: this.quantity
},
methods: "POST",
}).then(res => {
console.log(res);
uni.showToast({
title: res.msg,
icon: 'none',
duration: 3000
})
this.$emit('success');
this.getuser();
}).catch(err => {})
} else {
uni.showToast({
title: '兑换积分大于拥有积分',
icon: 'none',
duration: 3000
})
}
}
}
}
</script>
<style>
.pointsyesbox {
width: 100%;
height: 600rpx;
background-color: #fff;
/* text-align: center; */
padding: 24rpx;
display: flex;
flex-direction: column;
border-radius: 24rpx 24rpx 0rpx 0rpx;
}
.uni-input {
width: 680rpx;
height: 88rpx;
border-radius: 12rpx;
border: 2rpx solid #D8D8D8;
padding-left: 36rpx;
}
.input {
height: 88rpx;
}
.practices {
height: 80rpx;
width: 100%;
border-radius: 40rpx;
background: linear-gradient(123deg, #00E075 0%, #09D89E 100%);
text-align: center;
line-height: 80rpx;
font-weight: 500;
font-size: 32rpx;
color: #FFFFFF;
}
</style>