oil-station/gasStation-uni/pagesMy/integral/integral.vue

274 lines
5.1 KiB
Vue
Raw Normal View History

2023-11-27 09:24:16 +08:00
<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>
2023-11-28 18:10:16 +08:00
<view class="my-icons">{{myPoints}}</view>
2023-11-27 09:24:16 +08:00
</view>
<!-- 顶部区域 -->
<view class="top-box">
<view class="b-box">
<view class="">
<view class="hui-size">我的积分</view>
2023-12-01 15:29:00 +08:00
<view class="lan-num">{{myPoints}}</view>
2023-11-27 09:24:16 +08:00
</view>
2023-12-05 13:33:30 +08:00
<view class="anniu" @click="sign" v-if="flag">
2023-12-01 15:29:00 +08:00
积分签到
2023-11-27 09:24:16 +08:00
</view>
2023-12-05 13:33:30 +08:00
<view class="anniu" v-if="!flag">
2023-12-11 09:21:21 +08:00
<span v-if="flag2">已签到</span>
<span v-if="!flag2">未开通签到</span>
2023-12-05 13:33:30 +08:00
</view>
2023-11-27 09:24:16 +08:00
</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>
2023-11-28 18:10:16 +08:00
<view class="xanniu" @click="comeOn">去加油</view>
2023-11-27 09:24:16 +08:00
</view>
<view class="dis-bt">
<view class="">
<view class="">油卡充值返积分</view>
<view class="hui-min">根据每次加油消费金额获得比例积分</view>
</view>
2023-11-28 18:10:16 +08:00
<view class="xanniu" @click="recharge">去充值</view>
2023-11-27 09:24:16 +08:00
</view>
</view>
</view>
</view>
</template>
<script>
2023-11-28 18:10:16 +08:00
import config from '@/config'
import request from '../../utils/request';
2023-11-27 09:24:16 +08:00
export default {
data() {
return {
title: '',
2023-12-01 15:29:00 +08:00
myPoints: 0, // 我的积分
2023-12-05 13:33:30 +08:00
flag: true,
2023-12-11 09:21:21 +08:00
flag2: true,
storeId: uni.getStorageSync('storeId'),
chainStoreId: uni.getStorageSync('chainStoreId'),
2023-11-27 09:24:16 +08:00
}
},
components: {
2023-12-01 15:29:00 +08:00
},
onShow() {
this.getUserInfoList();
2023-12-05 13:33:30 +08:00
this.getTodayIsSignIn();
2023-11-27 09:24:16 +08:00
},
2023-12-11 09:21:21 +08:00
// onLoad() {
// this.getUserInfoList();
// this.getTodayIsSignIn();
// },
2023-11-27 09:24:16 +08:00
methods: {
2023-11-28 18:10:16 +08:00
// 查询我的积分
2023-12-01 15:29:00 +08:00
getUserInfoList() {
2023-11-28 18:10:16 +08:00
request({
2023-12-01 15:29:00 +08:00
url: '/business/userManager/user/getByUniApp',
2023-11-28 18:10:16 +08:00
method: 'get',
2023-12-11 09:21:21 +08:00
params: {
chainStoreId: this.chainStoreId
}
2023-12-01 15:29:00 +08:00
}).then((res) => {
if (res.code == 200) {
this.myPoints = res.data.points
2023-11-28 18:10:16 +08:00
}
})
},
// 去加油
2023-12-14 13:38:01 +08:00
comeOn() {
uni.navigateTo({
url: '/pages/refuel/refuel'
})
},
2023-11-28 18:10:16 +08:00
// 去充值
2023-12-14 13:38:01 +08:00
recharge() {
uni.navigateTo({
url: '/pagesHome/oilRecharge/oilRecharge'
})
},
2023-12-01 15:29:00 +08:00
2023-11-27 09:24:16 +08:00
goback() {
uni.navigateBack()
2023-12-01 15:29:00 +08:00
},
2023-12-05 13:33:30 +08:00
getTodayIsSignIn() {
2023-12-01 15:29:00 +08:00
2023-12-05 13:33:30 +08:00
request({
url: 'business/integral/integralSettings/todayIsSignIn',
method: 'get',
params: {
2023-12-14 13:38:01 +08:00
storeId: this.storeId,
chainStoreId: this.chainStoreId
2023-12-05 13:33:30 +08:00
}
}).then((res) => {
if (res.code == 200) {
2023-12-14 13:38:01 +08:00
if (res.data == 0) {
2023-12-05 13:33:30 +08:00
this.flag = true
2023-12-14 13:38:01 +08:00
} else if (res.data == -2) {
this.flag = false
2023-12-11 09:21:21 +08:00
this.flag2 = true
} else {
2023-12-14 13:38:01 +08:00
this.flag = false
2023-12-11 09:21:21 +08:00
this.flag2 = false
2023-12-05 13:33:30 +08:00
}
}
})
},
// 先查询今天是否签到过
sign() {
let integralSettings = {
2023-12-14 13:38:01 +08:00
storeId: this.storeId,
chainStoreId: this.chainStoreId
2023-12-05 13:33:30 +08:00
}
request({
url: 'business/integral/integralSettings/signInFunction',
method: 'post',
data: integralSettings
}).then((res) => {
if (res.code == 200) {
// 签到成功
uni.showToast({
2023-12-14 13:38:01 +08:00
title: '签到成功',
2023-12-05 13:33:30 +08:00
duration: 2000
});
this.getUserInfoList();
this.getTodayIsSignIn();
}
})
2023-11-27 09:24:16 +08:00
}
}
}
</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>