bztang-h5/src/views/member/weight_value/legumes/center_home.vue

409 lines
9.4 KiB
Vue

<template>
<div id="member_balance_v2">
<c-title :hide="false" text="文创豆中心" tolink="detailed"></c-title>
<div class="background_box"></div>
<div class="contenbox">
<template>
<div class="detail">
<div class="txt">我的文创豆</div>
<div class="balance">{{ hold_number }}</div>
<div class="detailBox">
<div class="detailBox_btn transfer" @click="goToPage('legumes_center_transfer')">转赠</div>
<div class="detailBox_btn transfer" @click="goToPage('legumes_center_withdrawal')">提现</div>
</div>
</div>
<div class="balanceDetail">
<div class="title">
<div :class="['title-tab',{'title-active': (selected_tab === 'transfer')}]" @click="changeTab('transfer')">转赠记录</div>
<div :class="['title-tab',{'title-active': (selected_tab === 'withdrawal')}]" @click="changeTab('withdrawal')">提现记录</div>
</div>
<div class="balanceDetail_lis" v-for="(item, index) in list" :key="index">
<div class="balanceDetail_lis_top">
<div class="balanceDetail_lis_top_left">{{ item.good_name }}</div>
<div class="price">{{ item.change_type == 1 ? "-" : "+" }}{{ item.voucher_number }}</div>
</div>
<div class="balanceDetail_lis_bottom">
<div class="time">{{ item.created_at }}</div>
</div>
</div>
</div>
</template>
</div>
</div>
</template>
<script>
export default {
data() {
return {
page_params: {},
hold_number: 0.000000,
// 下面的记录
selected_tab: 'transfer',
list: [],
page: 1,
total_page: 0,
isLoadMore: true,
};
},
activated() {
let _this = this;
_this.page_params = Object.assign(_this.$route.params, _this.$route.query);
this.getData();
this.getChangeRecord();
},
methods: {
// 数据获取
getData() {
let _this = this;
$http.get("plugin.cultural-space.api.index.legumes-hold", {}, "加载中...").then(
(response) => {
if (response.result == 1) _this.hold_number = response.data.voucher_number;
else _this.$dialog.alert({ message: response.msg });
},
function(response) {
_this.$dialog.alert({ message: response.msg });
}
);
},
// 获取记录
getChangeRecord() {
let _this = this;
$http.get("plugin.cultural-space.api.index.legumesChangeRecord", {change_source: _this.selected_tab}, "加载中...")
.then((response) => {
if (response.result === 1) {
_this.isLoadMore = true;
let data = response.data;
if(parseInt(data.current_page) === 1){
_this.total_page = data.last_page;
_this.list = data.data;
}else{
if(Object.values(data.data).length > 0) _this.list = Object.values(_this.list).concat(Object.values(data.data));
}
} else {
_this.isLoadMore = false; // 防止多次请求分页数据
_this.list = [];
}
})
.catch(error => {
console.log(error);
});
},
// 分页获取数据
getMoreData() {
let _this = this;
if (!_this.isLoadMore) return;
_this.isLoadMore = false; // 防止多次请求分页数据
if (_this.page >= _this.total_page) {
return;
} else {
_this.page += 1;
_this.getList();
}
},
// 切换tab
changeTab(type){
this.selected_tab = type;
this.list = [];
this.page = 1;
this.total_page = 0;
this.getChangeRecord();
},
// 跳转页面
goToPage(key, json = {}) {
let _this = this;
_this.$router.push(_this.fun.getUrl(key, json));
},
}
};
</script>
<style lang="scss" scoped>
.van-dialog__message{
padding: 0 !important;
}
.icon-balance_p {
color: #f15353;
}
.icon-balance_a {
color: #6cbf6a;
}
.icon-balance_b {
color: #fac337;
}
.icon-balance_c {
color: #069ce7;
}
.background_box {
color: #382c0a;
background-color: #fff;
background-image: -webkit-gradient(linear, left top, left bottom, from(var(--themeBaseColor)), to(#f5f5f5));
background-image: -webkit-linear-gradient(var(--themeBaseColor), #f5f5f5);
background-image: linear-gradient(var(--themeBaseColor), #f5f5f5);
min-height: 12.125rem;
padding: 1.5938rem 1.0938rem 0 1.0938rem;
}
.contenbox {
padding: 0 0.625rem;
.dataStatistics {
padding: 0.75rem;
background: #fff;
margin-top: 0.5rem;
.title {
font-weight: bold;
font-size: 1rem;
text-align: left;
margin-bottom: 1.4375rem;
}
.navDateList {
display: flex;
justify-content: flex-start;
align-items: center;
margin-bottom: 0.5rem;
.lis {
font-size: 0.75rem;
line-height: 1.03rem;
margin-right: 2rem;
padding: 0.25rem 0.75rem;
}
.lis:last-child {
margin-right: 0;
}
.isDay {
border-radius: 0.78rem;
background: var(--themeBaseColor);
color: #fff;
}
}
.list {
height: 3rem;
border-bottom: 1px solid #e7e7e7;
display: flex;
align-items: center;
justify-content: space-between;
.left {
width: 50%;
font-size: 0.81rem;
font-weight: 500;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: left;
}
.right {
width: 50%;
font-size: 0.81rem;
font-weight: bold;
color: #f20606;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-align: right;
}
}
.list:last-child {
border-bottom: none;
}
}
.rests {
min-height: 6.875rem;
background: #fff;
border-radius: 0.625rem;
margin-top: 0.625rem;
padding: 0.9688rem 0.9063rem;
.title {
font-weight: bold;
font-size: 1rem;
text-align: left;
margin-bottom: 1.4375rem;
}
.lis {
display: flex;
flex-wrap: wrap;
.restslis {
width: 25%;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.image_name {
width: 2.75rem;
height: 2.75rem;
margin-bottom: 0.7188rem;
img {
width: 100%;
height: 100%;
}
}
.image {
width: 1.5938rem;
height: 1.4688rem;
margin-bottom: 0.7188rem;
img {
width: 100%;
height: 100%;
}
}
.txt {
width: 100%;
}
}
}
}
.balanceDetail {
margin-top: 0.625rem;
border-radius: 0.625rem;
background: #fff;
padding: 0.9375rem 0.875rem;
.balanceDetail_lis {
border-top: 1px solid #f6f6f6;
padding: 0.9375rem 0;
.balanceDetail_lis_top,
.balanceDetail_lis_bottom {
display: flex;
justify-content: space-between;
}
.balanceDetail_lis_bottom {
margin-top: 0.625rem;
}
.balanceTxt {
font-weight: 400;
color: #666;
font-size: 0.6875rem;
}
.time {
color: #999;
font-size: 0.6875rem;
}
.balanceDetail_lis_top_left {
font-size: 0.8125rem;
font-weight: 500;
}
.price {
font-weight: 500;
color: #f20606;
font-size: 0.8125rem;
}
}
.title {
width: 100%;
height: 35px;
display: inline-flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-around;
align-items: center;
.title-tab{
font-size: 15px;
font-weight: 600;
width: 40%;
height: 35px;
line-height: 35px;
position: relative;
}
.title-active{
color: #1c24c8;
}
.title-active:after{
content: "";
position: absolute;
bottom: 0;
left: 25%;
width: 50%;
height: 2px;
background: #1c24c8;
}
}
}
.detail {
margin-top: -8rem;
background: #fff;
border-radius: 0.625rem;
// min-height: 11.25rem;
display: flex;
flex-direction: column;
align-items: center;
padding: 1.25rem 1.4063rem 0.625rem 1.4063rem;
.txt {
font-size: 0.8125rem;
color: #666;
}
.balance {
font-size: 1.375rem;
font-weight: bold;
color: #333;
}
.activityTxt {
width: 100%;
text-align: left;
font-weight: 400;
color: #f20606;
font-size: 0.625rem;
margin-top: 0.9063rem;
display: flex;
flex-wrap: wrap;
}
.detailBox {
display: flex;
width: 100%;
margin-top: 2.4rem;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-around;
.detailBox_btn {
padding: 0.625rem 1.9375rem;
border-radius: 0.3125rem;
font-size: 0.75rem;
font-weight: 400;
}
.recharge {
border: 1px solid var(--themeBaseColor);
color: var(--themeBaseColor);
margin-right: 1.5rem;
}
.transfer {
border: 1px solid #b3b3b3;
color: #262626;
}
.withdraw {
background: var(--themeBaseColor);
color: #fff;
}
}
}
}
</style>