271 lines
5.1 KiB
Vue
271 lines
5.1 KiB
Vue
<template>
|
||
<view class="content">
|
||
<view class="container">
|
||
<view class="my-header">
|
||
<view class="my-icons" @click="goback"> <uni-icons type="left" color="#ffffff" size="16"></uni-icons>
|
||
</view>
|
||
<view class="my-text">我的积分</view>
|
||
<view class="my-icons">{{myPoints}}</view>
|
||
</view>
|
||
<!-- 顶部区域 -->
|
||
<view class="top-box">
|
||
<view class="b-box">
|
||
<view class="">
|
||
<view class="hui-size">我的积分</view>
|
||
<view class="lan-num">{{myPoints}}</view>
|
||
</view>
|
||
<view class="anniu" @click="sign" v-if="flag">
|
||
积分签到
|
||
</view>
|
||
<view class="anniu" v-if="!flag">
|
||
<span v-if="flag2">已签到</span>
|
||
<span v-if="!flag2">未开通签到</span>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
|
||
<view class="bai-box">
|
||
<view class="box-title">积分任务</view>
|
||
<view class="dis-bt">
|
||
<view class="">
|
||
<view class="">加油返回积分</view>
|
||
<view class="hui-min">根据每次加油消费金额,获得比例积分</view>
|
||
</view>
|
||
<view class="xanniu" @click="comeOn">去加油</view>
|
||
</view>
|
||
<view class="dis-bt">
|
||
<view class="">
|
||
<view class="">油卡充值返积分</view>
|
||
<view class="hui-min">根据每次加油消费金额,获得比例积分</view>
|
||
</view>
|
||
<view class="xanniu" @click="recharge">去充值</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
import config from '@/config'
|
||
import request from '../../utils/request';
|
||
export default {
|
||
data() {
|
||
return {
|
||
title: '',
|
||
myPoints: 0, // 我的积分
|
||
flag: true,
|
||
flag2: true,
|
||
storeId: uni.getStorageSync('storeId'),
|
||
chainStoreId: uni.getStorageSync('chainStoreId'),
|
||
}
|
||
},
|
||
|
||
components: {
|
||
|
||
},
|
||
onShow() {
|
||
this.getUserInfoList();
|
||
this.getTodayIsSignIn();
|
||
},
|
||
|
||
// onLoad() {
|
||
// this.getUserInfoList();
|
||
// this.getTodayIsSignIn();
|
||
// },
|
||
methods: {
|
||
// 查询我的积分
|
||
getUserInfoList() {
|
||
request({
|
||
url: '/business/userManager/user/getByUniApp',
|
||
method: 'get',
|
||
params: {
|
||
chainStoreId: this.chainStoreId
|
||
}
|
||
}).then((res) => {
|
||
if (res.code == 200) {
|
||
this.myPoints = res.data.points
|
||
}
|
||
})
|
||
},
|
||
// 去加油
|
||
comeOn() {
|
||
uni.navigateTo({
|
||
url: '/pages/refuel/refuel'
|
||
})
|
||
},
|
||
// 去充值
|
||
recharge() {
|
||
uni.navigateTo({
|
||
url: '/pagesHome/oilRecharge/oilRecharge?id=0'
|
||
})
|
||
},
|
||
|
||
goback() {
|
||
uni.navigateBack()
|
||
},
|
||
|
||
getTodayIsSignIn() {
|
||
|
||
request({
|
||
url: 'business/integral/integralSettings/todayIsSignIn',
|
||
method: 'get',
|
||
params: {
|
||
storeId: this.storeId,
|
||
chainStoreId: this.chainStoreId
|
||
}
|
||
}).then((res) => {
|
||
if (res.code == 200) {
|
||
if (res.data == 0) {
|
||
this.flag = true
|
||
} else if (res.data == -2) {
|
||
this.flag = false
|
||
this.flag2 = true
|
||
} else {
|
||
this.flag = false
|
||
this.flag2 = false
|
||
|
||
}
|
||
}
|
||
})
|
||
},
|
||
// 先查询今天是否签到过
|
||
sign() {
|
||
let integralSettings = {
|
||
storeId: this.storeId,
|
||
chainStoreId: this.chainStoreId
|
||
}
|
||
request({
|
||
url: 'business/integral/integralSettings/signInFunction',
|
||
method: 'post',
|
||
data: integralSettings
|
||
}).then((res) => {
|
||
if (res.code == 200) {
|
||
// 签到成功
|
||
uni.showToast({
|
||
title: '签到成功',
|
||
duration: 2000
|
||
});
|
||
this.getUserInfoList();
|
||
this.getTodayIsSignIn();
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style scoped lang="scss">
|
||
.content {
|
||
background: #f4f5f6;
|
||
}
|
||
|
||
.container {
|
||
width: 100%;
|
||
height: 100vh;
|
||
box-sizing: border-box;
|
||
padding-top: 88px;
|
||
}
|
||
|
||
.my-header {
|
||
width: 100%;
|
||
height: 88px;
|
||
background: #1678ff;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
color: #ffffff;
|
||
box-sizing: border-box;
|
||
padding: 0px 15px;
|
||
padding-top: 40px;
|
||
|
||
.my-icons {
|
||
width: 20px;
|
||
}
|
||
|
||
position: fixed;
|
||
top: 0px;
|
||
}
|
||
|
||
.top-box {
|
||
width: 100%;
|
||
height: 100px;
|
||
background: #1678ff;
|
||
box-sizing: border-box;
|
||
padding: 1px;
|
||
}
|
||
|
||
.b-box {
|
||
width: 90%;
|
||
height: 100px;
|
||
background: #ffffff;
|
||
border-radius: 6px;
|
||
margin: 10px auto;
|
||
margin-top: 25px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
box-sizing: border-box;
|
||
padding: 10px;
|
||
}
|
||
|
||
.anniu {
|
||
box-sizing: border-box;
|
||
padding: 5px 10px;
|
||
border-radius: 50px;
|
||
background: linear-gradient(90deg, #65bfff 0%, #0483ff 100%);
|
||
color: white;
|
||
|
||
}
|
||
|
||
.hui-size {
|
||
color: #999999;
|
||
}
|
||
|
||
.lan-num {
|
||
font-weight: bold;
|
||
font-size: 30px;
|
||
color: #1678ff;
|
||
}
|
||
|
||
.bai-box {
|
||
width: 90%;
|
||
margin: 20px auto;
|
||
background-color: #ffffff;
|
||
box-sizing: border-box;
|
||
padding: 10px;
|
||
margin-top: 40px;
|
||
border-radius: 8px;
|
||
|
||
}
|
||
|
||
.dis-bt {
|
||
display: flex;
|
||
width: 100%;
|
||
justify-content: space-between;
|
||
margin-bottom: 15px;
|
||
|
||
}
|
||
|
||
.hui-min {
|
||
width: 90%;
|
||
font-size: 12px;
|
||
color: #999999;
|
||
}
|
||
|
||
.xanniu {
|
||
box-sizing: border-box;
|
||
height: 40px;
|
||
width: 80px;
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
border-radius: 50px;
|
||
background: linear-gradient(90deg, #65bfff 0%, #0483ff 100%);
|
||
color: white;
|
||
}
|
||
|
||
.box-title {
|
||
font-size: 20px;
|
||
margin-bottom: 10px;
|
||
}
|
||
</style> |