pull/15/head
parent
607e13f266
commit
7536516a37
4 changed files with 226 additions and 11 deletions
@ -0,0 +1,18 @@ |
||||
import request from '@/utils/request' |
||||
|
||||
export default { |
||||
|
||||
getByPage(data) { |
||||
return request({ |
||||
url: '/oil-finance/oilCustomerIntegralRecord/getByPage', |
||||
method: 'post', |
||||
data: data |
||||
}) |
||||
}, |
||||
getByCustomerId(customerId) { |
||||
return request({ |
||||
url: `/oil-finance/oilCustomerIntegralAccount/getByCustomerId/${customerId}`, |
||||
method: 'get' |
||||
}) |
||||
}, |
||||
} |
@ -0,0 +1,167 @@ |
||||
<template> |
||||
<view class="container"> |
||||
<cu-custom class="main-totextbar bg-main-oil" :isBack="true" bgColor="bg-main-oil"> |
||||
<block slot="backText">返回</block> |
||||
<block slot="content">积分记录</block> |
||||
</cu-custom> |
||||
<view class="banner"> |
||||
<view>{{balance}}</view> |
||||
<view>当前积分</view> |
||||
</view> |
||||
<!-- <view class="list"> --> |
||||
<scroll-view class="list" :scroll-y="true" @scrolltolower="lower"> |
||||
<view class="item" v-for="item,index in recodeList" :key="index"> |
||||
<view>{{typeEnum[item.type]}}</view> |
||||
<view>{{item.createTime}}</view> |
||||
<view>{{(item.type == 1 ||item.type == 3) ? '+' : '-'}}{{item.occurAmount}}</view> |
||||
</view> |
||||
</scroll-view> |
||||
|
||||
<view class="occupy"></view> |
||||
</view> |
||||
</template> |
||||
|
||||
<script> |
||||
import serve from '@/api/integral.js' |
||||
export default { |
||||
data() { |
||||
return { |
||||
parameter: { |
||||
currentPage: 1, |
||||
pageSize: 20, |
||||
params: { |
||||
customerId: uni.getStorageSync('user').id |
||||
}, |
||||
}, |
||||
balance: 0, |
||||
recodeList: [], |
||||
typeEnum: { |
||||
1: '加油收入', |
||||
2: '加油退款', |
||||
3: '商品兑换', |
||||
4: '商品兑换退款' |
||||
}, |
||||
} |
||||
}, |
||||
created() { |
||||
this.getByCustomerId() |
||||
this.getByPage() |
||||
}, |
||||
methods: { |
||||
getByPage() { |
||||
serve.getByPage(this.parameter).then(res => { |
||||
if (res.code === 20000) { |
||||
if (!res.data.list.length) { |
||||
uni.showToast({ |
||||
title: '没有更多数据了~', |
||||
icon: 'none' |
||||
}) |
||||
return |
||||
} |
||||
this.recodeList = this.recodeList.concat(res.data.list) |
||||
} |
||||
}) |
||||
}, |
||||
getByCustomerId() { |
||||
serve.getByCustomerId(this.parameter.params.customerId).then(res => { |
||||
if (res.code === 20000) { |
||||
this.balance = res.data.balance |
||||
} |
||||
}) |
||||
}, |
||||
lower() { |
||||
this.parameter.currentPage += 1 |
||||
this.getByPage() |
||||
console.log('到底了') |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style lang="scss" scoped> |
||||
.container { |
||||
background: #F2F2F2; |
||||
|
||||
height: 100vh; |
||||
display: flex; |
||||
flex-direction: column; |
||||
|
||||
.banner { |
||||
margin: 37rpx auto 0; |
||||
padding-top: 105rpx; |
||||
width: 684rpx; |
||||
height: 337rpx; |
||||
background: url('https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/integral-background.png') 100%/100% no-repeat; |
||||
border-radius: 10rpx; |
||||
|
||||
>view { |
||||
text-align: center; |
||||
color: #fff; |
||||
|
||||
&:nth-of-type(1) { |
||||
font-size: 64rpx; |
||||
} |
||||
|
||||
&:nth-of-type(2) { |
||||
margin-top: 10rpx; |
||||
font-size: 26rpx |
||||
} |
||||
} |
||||
} |
||||
|
||||
.list { |
||||
flex: 1; |
||||
overflow-y: hidden; |
||||
|
||||
margin: 37rpx auto 0; |
||||
padding-bottom: 10rpx; |
||||
width: 684rpx; |
||||
background: #FFF; |
||||
border-radius: 10rpx; |
||||
|
||||
.item { |
||||
position: relative; |
||||
padding: 25rpx 30rpx 0 30rpx; |
||||
width: 100%; |
||||
height: 125rpx; |
||||
|
||||
>view { |
||||
&:nth-of-type(1) { |
||||
font-size: 28rpx; |
||||
color: #333; |
||||
} |
||||
|
||||
&:nth-of-type(2) { |
||||
margin-top: 15rpx; |
||||
font-size: 22rpx; |
||||
color: #999; |
||||
} |
||||
|
||||
&:nth-of-type(3) { |
||||
position: absolute; |
||||
top: 50%; |
||||
transform: translateY(-50%); |
||||
right: 30rpx; |
||||
font-size: 28rpx; |
||||
color: #666; |
||||
} |
||||
} |
||||
|
||||
&::after { |
||||
content: ''; |
||||
position: absolute; |
||||
left: 50%; |
||||
transform: translateX(-50%); |
||||
bottom: 0; |
||||
width: 632rpx; |
||||
height: 1rpx; |
||||
background: #f6f6f6; |
||||
} |
||||
} |
||||
} |
||||
|
||||
.occupy { |
||||
height: 50rpx; |
||||
} |
||||
} |
||||
</style> |
Loading…
Reference in new issue