nurseWeChatAppletUI/pages/integral/integral.vue

418 lines
8.2 KiB
Vue
Raw Normal View History

2023-02-24 14:35:29 +08:00
<template>
<view class="app">
<view class="vacancies">
<image src="../../static/jifenbeij.png" mode=""></image>
<view class="lefttext">
积分余额
</view>
<view class="righttext">
2023-03-02 11:22:01 +08:00
<!-- <image src="../../static/jfgz.png" mode=""></image>
2023-02-24 14:35:29 +08:00
<view class="">
积分规则
2023-03-02 11:22:01 +08:00
</view> -->
2023-02-24 14:35:29 +08:00
</view>
<view class="title">
2023-03-02 11:22:01 +08:00
{{integral}}
2023-02-24 14:35:29 +08:00
</view>
<view class="centertext">
2023-03-02 11:22:01 +08:00
<!-- 20积分将于2022.01.01过期 -->
2023-02-24 14:35:29 +08:00
</view>
<view class="bottombutton" @tap='gainshow=true'>
获取积分
</view>
</view>
<view class="titles">
积分兑换
</view>
<view class="items">
2023-03-02 11:22:01 +08:00
<view class="item" v-for="(item,index) in goodslist" :key="index">
<image :src="item.goodsPictureUrl" mode=""></image>
2023-02-24 14:35:29 +08:00
<view class="title">
2023-03-02 11:22:01 +08:00
{{item.goodsName}}
</view>
<view class="text">
{{item.attributeDetailsName}}
2023-02-24 14:35:29 +08:00
</view>
<view class="jifen">
2023-03-02 11:22:01 +08:00
需使用
<span style='padding: 0 5rpx;'> {{item.integralExchangeSill}}</span>
积分兑换
2023-02-24 14:35:29 +08:00
</view>
<view class="btn">
立即兑换
</view>
</view>
</view>
<u-mask :show="gainshow" @tap="gainshow = false">
<view class="mask" @click.stop="">
<view class="title">
获取方式
</view>
<view class="maskitems">
<view class="item">
<image src="../../static/qiandao.png" mode=""></image>
<view class="titletext">
2023-03-02 11:22:01 +08:00
累计签到
<span style='padding: 0 5rpx;'> {{list.totalSignInDays}}</span>
(当前签到
<span style='padding: 0 5rpx;'> {{list.patientSignInCount}}</span>)
2023-02-24 14:35:29 +08:00
</view>
<view class="text">
2023-03-02 11:22:01 +08:00
<span style='padding: 0 5rpx;'> {{list.signInCount}}</span>积分
2023-02-24 14:35:29 +08:00
</view>
2023-03-02 11:22:01 +08:00
<view class="btn" @tap='signIninfo' v-if='list.todaySignInCount==0'>
2023-02-24 14:35:29 +08:00
签到
</view>
2023-03-02 11:22:01 +08:00
<view class="btn" v-if='list.todaySignInCount==1'>
已签到
</view>
2023-02-24 14:35:29 +08:00
</view>
<view class="item" style="background-color: #F44B2F;">
<image src="../../static/yaoqing.png" mode=""></image>
<view class="titletext">
2023-03-02 11:22:01 +08:00
每邀请
<span style='padding: 0 5rpx;'> 1</span>
位好友
2023-02-24 14:35:29 +08:00
</view>
<view class="text">
2023-03-02 11:22:01 +08:00
<span style='padding: 0 5rpx;'> {{list.inviteFriends}}</span>积分
2023-02-24 14:35:29 +08:00
</view>
2023-03-02 11:22:01 +08:00
<view class="btn" style="color: #F44B2F;" @tap="yaoqingshowtrue">
2023-02-24 14:35:29 +08:00
去完成
</view>
</view>
</view>
</view>
</u-mask>
2023-03-02 11:22:01 +08:00
<u-mask :show="yaoqingshow" @tap="yaoqingshowfalse">
<view class="masks" @click.stop="">
<r-canvas ref="rCanvas"></r-canvas>
</view>
</u-mask>
<u-toast ref="uToast" />
2023-02-24 14:35:29 +08:00
</view>
</template>
<script>
2023-03-02 11:22:01 +08:00
import {
signIn,
selectPatientSignIn,
selectExchangeGoods
} from '@/api/integral/index.js'
import {
inviteFriends
} from '@/api/Personal/Personal.js';
import baseurl from '../../api/baseurl';
2023-02-24 14:35:29 +08:00
export default {
2023-03-02 11:22:01 +08:00
2023-02-24 14:35:29 +08:00
data() {
return {
2023-03-02 11:22:01 +08:00
integral: 0,
2023-02-24 14:35:29 +08:00
gainshow: false,
2023-03-02 11:22:01 +08:00
yaoqingshow: false,
patientId: null,
list: null,
inviteimg: null,
pageNum: 1,
pageSize: 10,
goodstotal: 0,
goodslist: null,
2023-02-24 14:35:29 +08:00
};
},
2023-03-02 11:22:01 +08:00
onReady() {
},
onLoad(options) {
this.integral = options.integral
var that = this
this.selectExchangeGoodsinfo();
const value = uni.getStorageSync('patientId');
if (value) {
that.patientId = value
that.selectPatientSignInifo();
inviteFriends(value).then(res => {
that.inviteimg = res.msg
})
}
},
methods: {
yaoqingshowfalse() {},
//可兑换商品
selectExchangeGoodsinfo() {
selectExchangeGoods(this.pageNum, this.pageSize).then(res => {
res.rows.forEach(e => {
e.goodsPictureUrl = baseurl + e.goodsPictureUrl
})
this.goodslist = res.rows
this.goodstotal = res.total
})
},
//积分
selectPatientSignInifo() {
selectPatientSignIn(this.patientId).then(res => {
this.list = res.data
})
},
//点击签到
signIninfo() {
signIn(this.patientId).then(res => {
if (res.code == 200) {
this.$refs.uToast.show({
title: '今日签到成功',
type: 'success',
duration: '1000',
})
this.selectPatientSignInifo();
}
})
},
},
onReachBottom() { //下滑加载
if (this.goodslist.length >= this.goodstotal) {} else {
this.pageNum++;
selectExchangeGoods(this.pageNum, this.pageSize).then(res => {
res.rows.forEach(e => {
e.goodsPictureUrl = baseurl + e.goodsPictureUrl
this.goodslist.push(e)
})
})
}
},
onPullDownRefresh() { //下拉刷新
this.pageNum = 1;
this.selectExchangeGoodsinfo();
setTimeout(function() {
uni.stopPullDownRefresh();
}, 1000);
},
2023-02-24 14:35:29 +08:00
}
</script>
<style lang="scss">
.app {
2023-03-02 11:22:01 +08:00
.masks {
margin: 50rpx auto 0;
height: 1100rpx;
width: 620rpx;
::v-deep .r-canvas {
height: 1100rpx !important;
width: 620rpx !important;
margin: 0 auto;
}
::v-deep .r-canvas-component {
height: 1100rpx !important;
width: 620rpx !important;
margin: 0 auto;
}
}
2023-02-24 14:35:29 +08:00
.mask {
position: fixed;
bottom: 0;
height: 600rpx;
width: 100%;
background-color: #fff;
.maskitems {
color: #fff;
width: 90%;
2023-03-02 11:22:01 +08:00
margin: 60rpx auto 0;
2023-02-24 14:35:29 +08:00
.item {
background: #557BC2;
width: 100%;
margin: 0 auto 20rpx;
height: 150rpx;
position: relative;
font-size: 26rpx;
.btn {
text-align: center;
width: 121rpx;
height: 44rpx;
background: #FFFFFF;
border-radius: 22rpx;
position: absolute;
right: 30rpx;
top: 58rpx;
line-height: 44rpx;
font-size: 22rpx;
color: #557BC2;
}
.text {
position: absolute;
left: 150rpx;
top: 90rpx;
}
.titletext {
position: absolute;
left: 150rpx;
top: 48rpx;
}
image {
margin: 49rpx 0 0 43rpx;
width: 66rpx;
height: 66rpx;
}
}
}
.title {
padding-top: 10rpx;
font-size: 38rpx;
font-weight: 600;
text-align: center;
width: 100%;
}
}
.items {
margin-top: 30rpx;
.item {
width: 92%;
margin: 0 auto 12rpx;
background-color: #FFFFFF;
height: 220rpx;
position: relative;
2023-03-02 11:22:01 +08:00
.text {
font-size: 24rpx;
position: absolute;
left: 220rpx;
top: 90rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
}
2023-02-24 14:35:29 +08:00
.btn {
position: absolute;
right: 40rpx;
2023-03-02 11:22:01 +08:00
top: 140rpx;
2023-02-24 14:35:29 +08:00
width: 139rpx;
height: 44rpx;
background: #557BC2;
border-radius: 22rpx;
color: #fff;
text-align: center;
font-size: 22rpx;
color: #FFFFFF;
line-height: 44rpx;
}
.jifen {
position: absolute;
left: 220rpx;
top: 140rpx;
font-size: 26rpx;
color: #666666;
}
.title {
2023-03-02 11:22:01 +08:00
width: 460rpx;
2023-02-24 14:35:29 +08:00
font-size: 34rpx;
font-weight: 600;
position: absolute;
left: 220rpx;
2023-03-02 11:22:01 +08:00
top: 25rpx;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis
2023-02-24 14:35:29 +08:00
}
image {
margin: 15rpx 0 0 15rpx;
width: 180rpx;
height: 180rpx;
}
}
}
.titles {
margin: 38rpx 0 0 31rpx;
font-size: 30rpx;
}
.vacancies {
width: 92%;
height: 330rpx;
margin: 0 auto;
position: relative;
color: #fff;
.bottombutton {
position: absolute;
top: 230rpx;
left: 50%;
font-size: 32rpx;
color: #557BC2;
line-height: 72rpx;
text-align: center;
transform: translateX(-50%);
width: 440rpx;
height: 72rpx;
background: #FFFFFF;
border-radius: 36rpx;
}
.centertext {
position: absolute;
top: 160rpx;
width: 100%;
text-align: center;
font-size: 28rpx;
opacity: 0.8;
}
.title {
position: absolute;
left: 50%;
2023-03-02 11:22:01 +08:00
font-size: 70rpx;
top: 90rpx;
2023-02-24 14:35:29 +08:00
transform: translateX(-50%);
}
.righttext {
position: absolute;
top: 32rpx;
right: 31rpx;
font-size: 24rpx;
line-height: 28rpx;
width: 130rpx;
height: 28rpx;
image {
position: absolute;
left: 0;
width: 28rpx;
height: 28rpx;
}
view {
opacity: 0.6;
position: absolute;
right: 0;
}
}
.lefttext {
position: absolute;
top: 32rpx;
left: 33rpx;
font-size: 30rpx;
line-height: 33rpx;
}
image {
width: 100%;
height: 100%;
}
}
}
</style>