Feat(积分):接口数据对接
This commit is contained in:
+15
@@ -539,3 +539,18 @@ export function getRechargeApi() {
|
||||
export function getUserCenterBanner() {
|
||||
return request.get("userCenterBanner");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 用户积分信息
|
||||
*/
|
||||
export function getUserPointInfo(param) {
|
||||
return request.get('/user/points/info', param, { login: true })
|
||||
}
|
||||
|
||||
/*
|
||||
* 用户积分记录
|
||||
*/
|
||||
export function getUserPointBill(param) {
|
||||
return request.get('/user/points/bill', param, { login: true })
|
||||
}
|
||||
|
||||
+9
-3
@@ -358,6 +358,12 @@
|
||||
"style": {
|
||||
"navigationBarTitleText": "我的喜欢"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/user/Points/index",
|
||||
"style": {
|
||||
"navigationBarTitleText": "积分"
|
||||
}
|
||||
}
|
||||
],
|
||||
"subPackages": [
|
||||
@@ -827,7 +833,7 @@
|
||||
{
|
||||
"name": "商品详情",
|
||||
"path": "pages/shop/GoodsCon/index",
|
||||
"query": "id=277"
|
||||
"query": "id=588"
|
||||
},
|
||||
{
|
||||
"name": "店铺详情",
|
||||
@@ -865,8 +871,8 @@
|
||||
"query": ""
|
||||
},
|
||||
{
|
||||
"name": "特色礼品",
|
||||
"path": "pkg_product/views/giftList",
|
||||
"name": "积分",
|
||||
"path": "pages/user/Points/index",
|
||||
"query": ""
|
||||
}
|
||||
]
|
||||
|
||||
@@ -0,0 +1,334 @@
|
||||
<template>
|
||||
<view class="point-page">
|
||||
<view v-if="isLoad">
|
||||
<view class="rule-btn" @click="showHidePopup(true)">
|
||||
积分规则
|
||||
</view>
|
||||
<view class="tab-wrap">
|
||||
<view
|
||||
:class="query.pm === 1 ? 'curr' : ''"
|
||||
class="tab-item"
|
||||
@click="tabItemClick(1)"
|
||||
>
|
||||
<view class="txt">当前总积分</view>
|
||||
<view class="number">
|
||||
<image
|
||||
v-if="query.pm === 1"
|
||||
:src="webUrl + '/page/my/coin.png'"
|
||||
class="icon"
|
||||
/>
|
||||
{{ point.currentPoints }}
|
||||
</view>
|
||||
</view>
|
||||
<view
|
||||
:class="query.pm === 0 ? 'curr' : ''"
|
||||
class="tab-item"
|
||||
@click="tabItemClick(0)"
|
||||
>
|
||||
<view class="txt">已使用积分</view>
|
||||
<view class="number">
|
||||
<image
|
||||
v-if="query.pm === 0"
|
||||
:src="webUrl + '/page/my/coin.png'"
|
||||
class="icon"
|
||||
/>
|
||||
{{ point.totalUsedPoints }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="list-wrap">
|
||||
<view
|
||||
v-for="(item, index) in list"
|
||||
:key="index"
|
||||
class="item"
|
||||
>
|
||||
<view v-if="item.orderId" class="order">
|
||||
<view class="title">
|
||||
<view class="img">
|
||||
<image :src="item.src" class="img" />
|
||||
</view>
|
||||
<view class="name more-t">
|
||||
<view class="more-t">
|
||||
{{ item.title }}
|
||||
</view>
|
||||
<view class="number">
|
||||
{{ item.number }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom" @click="goOrderDetails(item)">
|
||||
<view class="txt">
|
||||
点击查看详情 >>
|
||||
</view>
|
||||
<text class="iconfont icon-jiantou"></text>
|
||||
</view>
|
||||
</view>
|
||||
<view v-else class="lottery">
|
||||
<view class="one-t title">
|
||||
{{ item.title }}
|
||||
</view>
|
||||
<view class="number">
|
||||
{{ item.number }}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<goo-skeleton
|
||||
v-if="isLoading"
|
||||
:show-avatar="false"
|
||||
/>
|
||||
<view v-else>
|
||||
<view v-if="list.length === 0" class="no-data">
|
||||
暂无数据
|
||||
</view>
|
||||
<u-loadmore
|
||||
v-if="query.page >= totalPage"
|
||||
:line="true"
|
||||
status="nomore"
|
||||
nomore-text="到底了"
|
||||
/>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<goo-skeleton
|
||||
v-else
|
||||
:show-avatar="false"
|
||||
/>
|
||||
<u-popup
|
||||
:show="show"
|
||||
mode="center"
|
||||
round="10"
|
||||
closeable
|
||||
@close="showHidePopup(false)"
|
||||
>
|
||||
<view class="popup-body">
|
||||
<view class="title bold">积分规则</view>
|
||||
<view class="content">
|
||||
<rich-text :nodes="point.pointsRule" />
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
<script>
|
||||
import {
|
||||
getUserPointInfo,
|
||||
getUserPointBill
|
||||
} from '@/api/user'
|
||||
export default {
|
||||
name: 'UserPoints',
|
||||
props: {},
|
||||
data: function() {
|
||||
return {
|
||||
webUrl: this.$VUE_APP_RESOURCES_URL,
|
||||
query: {
|
||||
pm: 1, // 0-支出,1-收入
|
||||
page: 1,
|
||||
limit: 10
|
||||
},
|
||||
isLoading: false,
|
||||
list: [],
|
||||
totalPage: 1,
|
||||
isLoad: false,
|
||||
point: {
|
||||
currentPoints: 0, // 当前总积分
|
||||
totalUsedPoints: 0, // 累计使用积分
|
||||
pointsRule: ''
|
||||
},
|
||||
show: false
|
||||
}
|
||||
},
|
||||
created() {
|
||||
this.getInfo()
|
||||
},
|
||||
onReachBottom() {
|
||||
if (this.isLoading || this.query.page >= this.totalPage) {
|
||||
return
|
||||
}
|
||||
this.query.page++
|
||||
this.getList()
|
||||
},
|
||||
methods: {
|
||||
tabItemClick(type) {
|
||||
if (this.query.pm === type) {
|
||||
return
|
||||
}
|
||||
this.query.pm = type
|
||||
this.query.page = 1
|
||||
this.list = []
|
||||
this.getList()
|
||||
},
|
||||
getInfo() {
|
||||
getUserPointInfo().then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.isLoad = true
|
||||
this.point = data
|
||||
this.getList()
|
||||
}
|
||||
})
|
||||
},
|
||||
getList() {
|
||||
this.isLoading = true
|
||||
getUserPointBill(this.query).then(res => {
|
||||
const { success, data } = res
|
||||
if (success) {
|
||||
this.totalPage = data.pages
|
||||
if (data.records.length > 0) {
|
||||
data.records.map(item => {
|
||||
this.list.push(item)
|
||||
})
|
||||
}
|
||||
}
|
||||
}).finally(() => {
|
||||
this.isLoading = false
|
||||
})
|
||||
},
|
||||
goOrderDetails(order) {
|
||||
this.$yrouter.push({
|
||||
path: '/pages/order/OrderDetails/index',
|
||||
query: {
|
||||
id: order.orderId
|
||||
}
|
||||
})
|
||||
},
|
||||
showHidePopup(value) {
|
||||
this.show = value
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.point-page {
|
||||
padding: 30rpx;
|
||||
.rule-btn {
|
||||
position: fixed;
|
||||
right: 0;
|
||||
top: 260rpx;
|
||||
z-index: 9;
|
||||
height: 30rpx;
|
||||
padding: 20rpx 30rpx 20rpx 40rpx;
|
||||
border-top-left-radius: 35rpx;
|
||||
border-bottom-left-radius: 35rpx;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
line-height: 30rpx;
|
||||
background-color: #C51919;
|
||||
}
|
||||
.tab-wrap {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.tab-item {
|
||||
flex: 1;
|
||||
justify-content: center;
|
||||
padding: 20rpx;
|
||||
border-radius: 15rpx;
|
||||
background-color: #fff;
|
||||
.txt {
|
||||
width: 100px;
|
||||
height: 36px;
|
||||
padding: 0 20rpx;
|
||||
margin: 0 auto;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #C51919;
|
||||
line-height: 36px;
|
||||
text-align: center;
|
||||
color: #C51919;
|
||||
font-size: 16px;
|
||||
}
|
||||
.number {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
margin: 20rpx 0 0 0;
|
||||
font-size: 20px;
|
||||
color: #333;
|
||||
font-weight: bold;
|
||||
line-height: 26px;
|
||||
.icon {
|
||||
width: 40rpx;
|
||||
height: 40rpx;
|
||||
margin: 0 20rpx 0 0;
|
||||
}
|
||||
}
|
||||
&.curr {
|
||||
padding: 35rpx 20rpx;
|
||||
background-color: #C51919;
|
||||
.txt {
|
||||
border-color: #fff;
|
||||
color: #fff;
|
||||
}
|
||||
.number {
|
||||
font-size: 26px;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.list-wrap {
|
||||
.item {
|
||||
margin: 30rpx 0 0 0;
|
||||
border-radius: 8px;
|
||||
background-color: #fff;
|
||||
.order {
|
||||
.title {
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
.img {
|
||||
display: block;
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
margin: 0 20rpx 0 0;
|
||||
background-color: #f6f6f6;
|
||||
}
|
||||
.name {
|
||||
width: calc(100% - 140rpx);
|
||||
color: #333;
|
||||
}
|
||||
.number {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
.bottom {
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
border-top: 1rpx solid #f6f6f6;
|
||||
font-size: 12px;
|
||||
color: #666;
|
||||
.txt {
|
||||
flex: 1;
|
||||
color: #FD5749;
|
||||
}
|
||||
.iconfont {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
.lottery {
|
||||
display: flex;
|
||||
padding: 20rpx;
|
||||
.title {
|
||||
width: calc(100% - 160rpx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
.no-data {
|
||||
line-height: 200rpx;
|
||||
text-align: center;
|
||||
font-size: 16px;
|
||||
color: #999;
|
||||
}
|
||||
.popup-body {
|
||||
.title {
|
||||
line-height: 80rpx;
|
||||
text-align: center;
|
||||
}
|
||||
.content {
|
||||
max-height: 70vh;
|
||||
padding: 30rpx;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
余额
|
||||
</view>
|
||||
</view>
|
||||
<view class="item">
|
||||
<view class="item" @click="linkTo('/pages/user/Points/index')">
|
||||
<view class="number">
|
||||
{{ userInfo.integral || 0 }}
|
||||
</view>
|
||||
|
||||
Reference in New Issue
Block a user