chore: 暂时保存

This commit is contained in:
2026-01-05 11:22:38 +08:00
parent b24f77be1a
commit be51b30fb4
48 changed files with 381 additions and 355 deletions

View File

@@ -0,0 +1,194 @@
<template>
<view class="balance" :style="themeColor">
<!-- #ifdef MP-WEIXIN -->
<view class="custom-navbar" :style="{
'padding-top': menuButtonBounding.top + 'px',
'height': menuButtonBounding.height + 'px'
}">
<view class="navbar-wrap">
<text class="iconfont icon-back_light back" @click="$util.redirectTo('/pages/member/index')"></text>
<view class="navbar-title">
账户余额
</view>
</view>
</view>
<!-- #endif -->
<view class="head-wrap"
:style="{ background: 'url(' + $util.img('public/uniapp/balance/balance-bg.png') + ')', backgroundSize: '100% 100%' }">
<!-- <view class="head-wrap" :style="{ background: 'url(' + $util.img('public/uniapp/balance/balance-bg.png') + ') no-repeat right bottom/ auto 380rpx, linear-gradient(314deg, #FE7849 0%, #FF1959 100%)' }"> -->
<view class="title">账户余额</view>
<view class="balance price-font">{{ (parseFloat(balanceInfo.balance) +
parseFloat(balanceInfo.balance_money)).toFixed(2) }}</view>
<!-- <view class="flex-box">
<view class="flex-item">
<view class="num price-font">{{ balanceInfo.balance_money|moneyFormat }}</view>
<view class="font-size-tag">现金余额</view>
</view>
<view class="flex-item">
<view class="num price-font">{{ balanceInfo.balance|moneyFormat }}</view>
<view class="font-size-tag">储值余额</view>
</view>
</view> -->
<view class="btns">
<view class="cash btn" @click="toWithdrawal">提现</view>
<view class="recharge btn" @click="toList">充值</view>
</view>
</view>
<view class="menu-wrap">
<view class="menu-item" @click="toApply" style="border-bottom: 0.5px solid #f2f2f2;">
<view class="icon">
<text class="iconfont icon-yuemingxi"></text>
</view>
<text class="title">提现记录</text>
<text class="iconfont icon-right"></text>
</view>
<view class="menu-item" @click="toBalanceDetail" style="border-bottom: 0.5px solid #f2f2f2;">
<view class="icon">
<text class="iconfont icon-yuemingxi"></text>
</view>
<text class="title">余额明细</text>
<text class="iconfont icon-right"></text>
</view>
<!-- <view class="menu-item" @click="toOrderList">
<view class="icon">
<text class="iconfont icon-chongzhijilu"></text>
</view>
<text class="title">充值记录</text>
<text class="iconfont icon-right"></text>
</view> -->
</view>
<!-- <view class="action">
<view @click="toList" class="recharge-withdraw" v-if="addonIsExist.memberrecharge && memberrechargeConfig && memberrechargeConfig.is_use">
{{ $lang('recharge') }}
</view>
<view class="withdraw" v-if="addonIsExist.memberwithdraw && withdrawConfig && withdrawConfig.is_use" @click="toWithdrawal">
{{ $lang('withdrawal') }}
</view>
</view> -->
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
export default {
components: {
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue')
},
data() {
return {
balanceInfo: {
balance: 0,
balance_money: 0
},
withdrawConfig: null,
memberrechargeConfig: null,
menuButtonBounding: {} // 小程序胶囊属性
};
},
async onShow() {
this.getWithdrawConfig();
this.getMemberrechargeConfig();
if (!this.storeToken) {
this.$nextTick(() => {
this.$refs.login.open('/pages_tool/member/balance');
});
} else {
this.getUserInfo();
}
},
onLoad() {
// #ifdef MP
this.menuButtonBounding = uni.getMenuButtonBoundingClientRect();
// #endif
},
methods: {
toWithdrawal() {
this.$util.redirectTo('/pages_tool/member/apply_withdrawal');
},
toOrderList() {
this.$util.redirectTo('/pages_tool/recharge/order_list');
},
toBalanceDetail() {
this.$util.redirectTo('/pages_tool/member/balance_detail');
},
toApply() {
this.$util.redirectTo('/pages_tool/member/withdrawal');
},
toList() {
this.$util.redirectTo('/pages_tool/recharge/list');
},
//获取余额信息
getUserInfo() {
this.$api.sendRequest({
url: '/api/memberaccount/info',
data: {
account_type: 'balance,balance_money'
},
success: res => {
if (res.data) {
this.balanceInfo = res.data;
} else {
this.$util.showToast({
title: res.message
});
}
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: res => {
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
/**
* 获取余额提现配置
*/
getWithdrawConfig() {
this.$api.sendRequest({
url: '/api/memberwithdraw/config',
success: res => {
if (res.code >= 0 && res.data) {
this.withdrawConfig = res.data;
}
}
});
},
/**
* 获取充值提现配置
*/
getMemberrechargeConfig() {
this.$api.sendRequest({
url: '/memberrecharge/api/memberrecharge/config',
success: res => {
if (res.code >= 0 && res.data) {
this.memberrechargeConfig = res.data;
}
}
});
}
},
onBackPress(options) {
if (options.from === 'navigateBack') {
return false;
}
this.$util.redirectTo('/pages/member/index', {}, 'reLaunch');
return true;
},
watch: {
storeToken: function (nVal, oVal) {
if (nVal) {
this.getUserInfo();
}
}
}
};
</script>
<style lang="scss">
@import '@/pages_tool/member/public/css/balance.scss';
</style>

View File

@@ -0,0 +1,371 @@
<template>
<view :style="themeColor">
<!-- <scroll-view id="tab-bar" class="order-nav" :scroll-x="true" :show-scrollbar="false" :scroll-into-view="scrollInto">
<view v-for="(statusItem, statusIndex) in statusList" :key="statusIndex" class="uni-tab-item" :id="statusItem.id" :data-current="statusIndex" @click="ontabtap">
<text class="uni-tab-item-title" :class="statusIndex == orderStatus ? 'uni-tab-item-title-active' : ''">{{ statusItem.name }}</text>
</view>
</scroll-view> -->
<!-- <view class="tab color-bg">
<view class="tab-left">
<picker mode="date" :value="searchType.date" @change="bindDateChange" fields="month">
<view class="uni-input">
{{ date }}
<text class="iconfont icon-iconangledown"></text>
</view>
</picker>
</view>
<view class="tab-right">
<picker @change="bindPickerChange" :value="balanceIndex" :range="balanceType" class="picker" range-key="label">
<text class="desc uni-input">{{ balanceType[balanceIndex].label }}</text>
<text class="iconfont icon-iconangledown"></text>
</picker>
</view>
</view> -->
<mescroll-uni @getData="getData" ref="mescroll">
<block slot="list">
<!-- 明细列表 -->
<block v-if="dataList.length > 0">
<view class="detailed-wrap">
<view class="balances" v-for="(item, index) in dataList" :key="index">
<image :src="$util.img('public/uniapp/balance/recharge.png')" class="balances-img"
v-if="item.account_data > 0"></image>
<image v-else :src="$util.img('public/uniapp/balance/shopping.png')" mode="widthFix">
</image>
<view class="balances-info" @click="toFromDetail(item)">
<text class="title">{{ item.remark }}</text>
<!-- <text>{{ item.remark }}</text> -->
<text>{{ $util.timeStampTurnTime(item.create_time) }}</text>
</view>
<view class="balances-num">
<text :class="item.account_data > 0 ? 'color-base-text' : ''">{{ item.account_data > 0 ?
'+' + item.account_data : item.account_data }}</text>
</view>
</view>
</view>
</block>
<block v-else><ns-empty :isIndex="false" text="暂无余额明细"></ns-empty></block>
<!-- 无明细列表 -->
</block>
</mescroll-uni>
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
export default {
components: {
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
// #ifdef MP-WEIXIN
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
// #endif
},
data() {
const currentDate = this.getDate({
format: true
});
return {
dataList: [],
statusList: [{
name: '全部',
id: '0'
}, {
name: '收入',
id: '1'
}, {
name: '支出',
id: '2'
}],
scrollInto: '',
orderStatus: '0',
date: currentDate,
searchType: {
from_type: 0,
date: ''
},
balanceType: [{
label: '全部',
value: '0'
}], //积分类型
balanceIndex: 0,
related_id: 0
};
},
onLoad(option) {
if (option.group_id) this.related_id = option.group_id ? option.group_id : 0;
if (option.from_type) this.searchType.from_type = option.from_type;
if (option.related_id) this.related_id = option.related_id ? option.related_id : 0;
if (option.status) this.orderStatus = option.status;
this.getbalanceType();
},
onShow() {
if (!this.storeToken) {
this.$nextTick(() => {
this.$refs.login.open('/pages_tool/member/balance');
});
}
},
methods: {
bindDateChange: function (e) {
var temp = e.target.value;
var tempArr = temp.split('-');
this.date = tempArr[0] + '年' + tempArr[1] + '月';
this.searchType.date = e.target.value;
this.$refs.mescroll.refresh();
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}${month}`;
},
bindPickerChange(e) {
this.balanceIndex = e.detail.value;
this.searchType.from_type = this.balanceType[this.balanceIndex].value;
this.$refs.mescroll.refresh();
},
//获取分类类型
getbalanceType() {
this.$api.sendRequest({
url: '/api/memberaccount/fromType',
success: res => {
let balanceType = Object.assign(res.balance, res.balance_money),
typeArr = [{
label: '全部',
value: '0'
}];
for (var index in balanceType) {
typeArr.push({
label: balanceType[index].type_name,
value: index
})
}
this.balanceType = typeArr;
}
});
},
ontabtap(e) {
let index = e.currentTarget.dataset.current;
this.orderStatus = this.statusList[index].id;
this.$refs.mescroll.refresh();
},
getData(mescroll) {
this.$api.sendRequest({
url: '/api/memberaccount/page',
data: {
page_size: mescroll.size,
page: mescroll.num,
account_type: 'balance,balance_money',
from_type: this.searchType.from_type,
date: this.searchType.date,
related_id: this.related_id
},
success: res => {
let newArr = [];
let msg = res.message;
if (res.code == 0 && res.data) {
newArr = res.data.list;
} else {
this.$util.showToast({
title: msg
});
}
mescroll.endSuccess(newArr.length);
//设置列表数据
if (mescroll.num == 1) {
this.dataList = []; //如果是第一页需手动制空列表
this.related_id = 0;
}
this.dataList = this.dataList.concat(newArr); //追加新数据
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: res => {
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
toFromDetail(item) {
if (item.from_type == 'order' && !isNaN(parseInt(item.type_tag))) {
this.$util.redirectTo('/pages_order/detail/detail', {
order_id: item.type_tag
});
} else if (item.from_type == 'refund' && parseInt(item.type_tag) != 0) {
this.$util.redirectTo('/pages_order/detail/detail', {
order_id: item.type_tag
});
}
}
}
};
</script>
<style lang="scss">
.detailed-wrap {
padding-top: 20rpx;
margin: 24rpx;
}
.tab {
position: fixed;
top: 0;
width: 100%;
z-index: 10;
display: flex;
justify-content: space-between;
height: 80rpx;
background-color: $color-bg;
view {
flex: 1;
text-align: center;
line-height: 80rpx;
text {
margin-left: 10rpx;
font-size: $font-size-base;
}
}
.tab-left {
display: flex;
padding-left: 46rpx;
}
.tab-right {
display: flex;
justify-content: flex-end;
padding-right: 26rpx;
}
}
.order-nav {
width: 100vw;
height: 70rpx;
display: flex;
flex-direction: row;
/* #ifndef APP-PLUS */
white-space: nowrap;
/* #endif */
background: #fff;
border-bottom-left-radius: 24rpx;
border-bottom-right-radius: 24rpx;
padding-bottom: 30rpx;
position: fixed;
left: 0;
z-index: 998;
.uni-tab-item {
width: 33.33%;
text-align: center;
/* #ifndef APP-PLUS */
display: inline-block;
/* #endif */
flex-wrap: nowrap;
}
.uni-tab-item-title {
color: #555;
font-size: $font-size-base;
display: block;
height: 64rpx;
line-height: 64rpx;
border-bottom: 4rpx solid #fff;
padding: 0 10rpx;
flex-wrap: nowrap;
/* #ifndef APP-PLUS */
white-space: nowrap;
/* #endif */
}
.uni-tab-item-title-active {
display: block;
height: 64rpx;
padding: 0 10rpx;
}
::-webkit-scrollbar {
width: 0;
height: 0;
color: transparent;
}
}
.balances {
padding: $margin-both 24rpx;
// margin: 0 $margin-both;
box-sizing: border-box;
display: flex;
align-items: flex-start;
border-bottom: 2rpx solid $color-line;
background: #fff;
margin-bottom: 20rpx;
border-radius: 24rpx;
image {
width: 54rpx;
height: 54rpx;
border-radius: 50%;
padding-top: 10rpx;
}
.balances-info {
flex: 1;
margin-left: 16rpx;
display: flex;
flex-direction: column;
text {
font-size: $font-size-toolbar;
line-height: 1;
&:last-child {}
&:nth-child(2) {
margin-top: $margin-updown;
font-size: $font-size-activity-tag;
color: $color-tip;
}
&:nth-child(3) {
font-size: $font-size-activity-tag;
margin-top: $margin-updown;
color: $color-tip;
}
}
}
.balances-num {
text {
line-height: 1;
font-size: $font-size-toolbar;
font-weight: 500;
color: #09c15f;
font-weight: 700;
}
}
}
.empty {
width: 100%;
height: 500rpx;
display: flex;
justify-content: center;
flex-direction: column;
align-items: center;
}
</style>

View File

@@ -0,0 +1,280 @@
<template>
<view :style="themeColor" class="container">
<view class="tips" v-if="step != 0">请输入6位支付密码建议不要使用重复或连续数字</view>
<view class="tips" v-else>验证码已发送至{{ memberInfo.mobile | mobile }}请在下方输入4位数字验证码</view>
<view class="password-wrap">
<myp-one :maxlength="step == 0 ? 4 : 6" :is-pwd="step != 0" @input="input" ref="input"
:auto-focus="true"></myp-one>
<view v-show="step == 0" class="dynacode"
:class="dynacodeData.seconds == 120 ? 'color-base-text' : 'color-tip'" @click="sendMobileCode">
{{ dynacodeData.codeText }}
</view>
<view class="action-tips" v-show="step == 0">输入短信验证码</view>
<view class="action-tips" v-show="step == 1">请设置支付密码</view>
<view class="action-tips" v-show="step == 2">请再次输入</view>
<view class="btn color-base-bg color-base-border" :class="{ disabled: !isClick }" @click="confirm">确认</view>
</view>
</view>
</template>
<script>
export default {
components: {
mypOne: () => import('@/components/myp-one/myp-one.vue')
},
data() {
return {
isClick: false,
step: 1,
key: '', // 短信key
code: '', // 动态码
password: '', // 密码
repassword: '', // 重复密码
isSub: false, // 防重复提交
back: '', // 返回页
dynacodeData: {
seconds: 120,
timer: null,
codeText: '获取验证码',
isSend: false
}
};
},
onLoad(option) {
if (option.back) this.back = option.back;
// 判断登录
if (!this.storeToken) {
this.$util.redirectTo('/pages_tool/login/login');
} else {
if (this.memberInfo.mobile == '') {
uni.showModal({
title: '提示',
content: '设置支付密码需要先绑定手机号,是否立即绑定?',
success: res => {
if (res.confirm) {
this.$util.redirectTo('/pages_tool/member/info', {
action: 'mobile',
back: this.back
}, 'redirectTo');
} else {
if (this.back) this.$util.redirectTo(this.back);
else this.$util.redirectTo('/pages/member/index');
}
}
});
} else {
this.step = 0;
this.sendMobileCode();
}
}
},
methods: {
input(val) {
if (this.step == 0) {
if (val.length == 4) {
this.isClick = true;
this.code = val;
} else {
this.isClick = false;
}
} else if (this.step == 1) {
if (val.length == 6) {
this.isClick = true;
this.password = val;
} else {
this.isClick = false;
}
} else {
if (val.length == 6) {
this.isClick = true;
this.repassword = val;
} else {
this.isClick = false;
}
}
},
confirm() {
if (this.isClick) {
if (this.step == 0) {
this.$api.sendRequest({
url: '/api/member/verifypaypwdcode',
data: {
code: this.code,
key: this.key
},
success: res => {
if (res.code == 0) {
this.$refs.input.clear();
this.isClick = false;
this.step = 1;
} else {
this.$util.showToast({
title: res.message
});
}
}
});
} else if (this.step == 1) {
this.$refs.input.clear();
this.isClick = false;
this.step = 2;
} else {
if (this.password == this.repassword) {
if (this.isSub) return;
this.isSub = true;
this.$api.sendRequest({
url: '/api/member/modifypaypassword',
data: {
key: this.key,
code: this.code,
password: this.password
},
success: res => {
if (res.code >= 0) {
this.$util.showToast({
title: '修改成功'
});
setTimeout(() => {
if (this.back) this.$util.redirectTo(this.back, {},
'redirectTo');
else this.$util.redirectTo('/pages/member/index');
}, 2000);
} else {
this.initInfo();
this.$util.showToast({
title: res.message
});
}
}
});
} else {
this.$util.showToast({
title: '两次输入的密码不一致',
success: res => {
this.initInfo();
}
});
}
}
}
},
initInfo() {
this.isClick = false;
this.step = 1;
this.password = '';
this.repassword = '';
this.oldpassword = '';
this.isSub = false;
this.$refs.input.clear();
},
/**
* 发送手机动态码
*/
sendMobileCode() {
if (this.dynacodeData.seconds != 120) return;
if (this.dynacodeData.isSend) return;
this.dynacodeData.isSend = true;
this.$api.sendRequest({
url: '/api/member/paypwdcode',
success: res => {
this.dynacodeData.isSend = false;
if (res.code >= 0) {
this.key = res.data.key;
if (this.dynacodeData.seconds == 120 && this.dynacodeData.timer == null) {
this.dynacodeData.timer = setInterval(() => {
this.dynacodeData.seconds--;
this.dynacodeData.codeText = this.dynacodeData.seconds + 's后可重新获取';
}, 1000);
}
} else {
this.$util.showToast({
title: res.message
});
}
},
fail: () => {
this.$util.showToast({
title: 'request:fail'
});
this.dynacodeData.isSend = false;
}
});
}
},
filters: {
mobile(mobile) {
return mobile.substring(0, 4 - 1) + '****' + mobile.substring(6 + 1);
}
},
watch: {
'dynacodeData.seconds': {
handler(newValue, oldValue) {
if (newValue == 0) {
clearInterval(this.dynacodeData.timer);
this.dynacodeData = {
seconds: 120,
timer: null,
codeText: '获取动态码',
isSend: false
};
}
},
immediate: true,
deep: true
}
}
};
</script>
<style lang="scss">
.container {
width: 100vw;
height: 100vh;
background: #fff;
.tips {
width: 60%;
margin: 0 auto;
text-align: center;
padding-top: 100rpx;
}
.password-wrap {
width: 80%;
margin: 0 auto;
margin-top: 40rpx;
.action-tips {
text-align: center;
font-weight: 600;
margin-top: 80rpx;
}
.dynacode {
line-height: 1;
margin-top: 20rpx;
font-size: $font-size-tag;
}
.btn {
margin: 0 auto;
margin-top: 30rpx;
height: 80rpx;
line-height: 80rpx;
border-radius: $border-radius;
color: #fff;
text-align: center;
&.disabled {
background: #ccc !important;
border-color: #ccc !important;
color: #fff;
}
}
}
}
</style>

View File

@@ -0,0 +1,165 @@
<template>
<view :style="themeColor" class="point">
<!-- #ifdef MP-WEIXIN -->
<view class="custom-navbar" :style="{
'padding-top': menuButtonBounding.top + 'px',
'height': menuButtonBounding.height + 'px'
}">
<view class="navbar-wrap">
<text class="iconfont icon-back_light back" @click="$util.redirectTo('/pages/member/index')"></text>
<view class="navbar-title">
我的积分
</view>
</view>
</view>
<!-- #endif -->
<view class="head-wrap"
:style="{ background: 'url(' + $util.img('public/uniapp/point/point_bg.png') + ') no-repeat right bottom/ auto 340rpx, linear-gradient(314deg, #F16914 0%, #FEAA4C 100%)' }">
<view class="point price-font">{{ pointInfo.point }}</view>
<view class="title">当前积分</view>
<view class="flex-box">
<view class="flex-item">
<view class="num price-font">{{ pointInfo.totalPoint }}</view>
<view class="font-size-tag">累计积分</view>
</view>
<view class="flex-item">
<view class="num price-font">{{ pointInfo.totalConsumePoint }}</view>
<view class="font-size-tag">累计消费</view>
</view>
<view class="flex-item">
<view class="num price-font">{{ pointInfo.todayPoint }}</view>
<view class="font-size-tag">今日获得</view>
</view>
</view>
</view>
<view class="menu-wrap">
<view class="menu-item" @click="$util.redirectTo('/pages_tool/member/point_detail')">
<view class="icon">
<image :src="$util.img('public/uniapp/point/point_detail_icon.png')" mode="widthFix"></image>
</view>
<text class="title">积分明细</text>
</view>
<view class="menu-item" @click="$util.redirectTo('/pages_promotion/point/list')">
<view class="icon">
<image :src="$util.img('public/uniapp/point/point_shop.png')" mode="widthFix"></image>
</view>
<text class="title">积分商城</text>
</view>
</view>
<!--
<view class="task-wrap">
<view class="title">做任务赚积分</view>
<view class="task-item" @click="toSign">
<view class="icon"><text class="iconfont icon-qiandao1"></text></view>
<view class="wrap">
<view class="title">每日签到</view>
<view class="desc color-tip font-size-tag">连续签到可获得更多积分</view>
</view>
<view class="btn">去签到</view>
</view>
<view class="task-item" @click="$util.redirectTo('/pages/index/index')">
<view class="icon"><text class="iconfont icon-shangpin"></text></view>
<view class="wrap">
<view class="title">购买商品</view>
<view class="desc color-tip font-size-tag">购买商品可获得积分</view>
</view>
<view class="btn">去下单</view>
</view>
</view> -->
<ns-login ref="login"></ns-login>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
export default {
components: {
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
},
data() {
return {
pointInfo: {
point: 0,
totalPoint: 0,
totalConsumePoint: 0,
todayPoint: 0
},
menuButtonBounding: {} // 小程序胶囊属性
};
},
onShow() {
if (!this.storeToken) {
this.$nextTick(() => {
this.$refs.login.open('/pages_tool/member/point');
});
} else {
this.getMemberPoint();
}
},
onLoad() {
// #ifdef MP
this.menuButtonBounding = uni.getMenuButtonBoundingClientRect();
// #endif
},
methods: {
toSign() {
this.$util.redirectTo('/pages_tool/member/signin');
},
getMemberPoint() {
this.$api.sendRequest({
url: '/api/memberaccount/point',
data: {
},
success: res => {
if (res.code == 0) {
this.pointInfo.point = parseInt(res.data.point);
this.pointInfo.totalPoint = parseInt(res.data.point_all);
this.pointInfo.totalConsumePoint = parseInt(res.data.point_use);
this.pointInfo.todayPoint = parseInt(res.data.point_today);
}
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: res => {
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
},
/**
* 获取充值提现配置
*/
getMemberrechargeConfig() {
this.$api.sendRequest({
url: '/memberrecharge/api/memberrecharge/config',
success: res => {
if (res.code >= 0 && res.data) {
this.memberrechargeConfig = res.data;
}
}
});
}
},
onBackPress(options) {
if (options.from === 'navigateBack') {
return false;
}
this.$util.redirectTo('/pages/member/index', {}, 'reLaunch');
return true;
},
watch: {
storeToken: function (nVal, oVal) {
if (nVal) {
this.getMemberPoint();
}
}
}
};
</script>
<style lang="scss">
@import '@/pages_tool/member/public/css/point.scss';
</style>

View File

@@ -0,0 +1,355 @@
<template>
<view :style="themeColor">
<!-- <view class="tab color-bg">
<view class="tab-left">
<picker mode="date" :value="searchType.date" @change="bindDateChange" fields="month">
<view class="uni-input">
{{ date }}
<text class="iconfont icon-iconangledown"></text>
</view>
</picker>
</view>
<view class="tab-right">
<picker @change="bindPickerChange" :value="pointIndex" :range="pointType" class="picker" range-key="label">
<text class="desc uni-input">{{ pointType[pointIndex].label }}</text>
<text class="iconfont icon-iconangledown"></text>
</picker>
</view>
</view> -->
<mescroll-uni @getData="getData" class="member-point" ref="mescroll">
<view slot="list">
<block v-if="dataList.length">
<view class="detailed-wrap">
<view class="cont">
<view class="detailed-item" v-for="(item, index) in dataList" :key="index">
<view class="info" @click="toFromDetail(item)">
<view class="event">{{ item.type_name }}</view>
<view class="time-box">
<text class="time color-tip">{{ $util.timeStampTurnTime(item.create_time)
}}</text>
</view>
</view>
<view class="num color-base-text" v-if="item.account_data > 0">+{{
parseInt(item.account_data) }}</view>
<view class="num " v-else>{{ parseInt(item.account_data) }}</view>
</view>
</view>
</view>
</block>
<block v-else>
<view class="cart-empty"><ns-empty></ns-empty></view>
</block>
</view>
</mescroll-uni>
<loading-cover ref="loadingCover"></loading-cover>
</view>
</template>
<script>
export default {
components: {
nsEmpty: () => import('@/components/ns-empty/ns-empty.vue'),
nsLogin: () => import('@/components/ns-login/ns-login.vue'),
loadingCover: () => import('@/components/loading-cover/loading-cover.vue'),
MescrollUni: () => import('@/components/mescroll/my-list-mescroll.vue'),
// #ifdef MP-WEIXIN
privacyPopup: () => import('@/components/wx-privacy-popup/privacy-popup.vue'),
// #endif
},
data() {
const currentDate = this.getDate({
format: true
});
return {
memberAccount: {
point: 0
},
dataList: [],
date: currentDate,
searchType: {
from_type: 0,
date: ''
},
pointType: [
{
label: '全部',
value: '0'
}
], //积分类型
pointIndex: 0,
related_id: 0
};
},
onShow() {
if (!this.storeToken) {
this.$util.redirectTo(
'/pages_tool/login/login',
{
back: '/pages_tool/member/point'
},
'redirectTo'
);
}
},
onLoad(option) {
if (option.related_id) this.related_id = option.related_id ? option.related_id : 0;
if (option.from_type) this.searchType.from_type = option.from_type;
this.getPointType();
},
methods: {
bindDateChange: function (e) {
var temp = e.target.value;
var tempArr = temp.split('-');
this.date = tempArr[0] + '年' + tempArr[1] + '月';
this.searchType.date = e.target.value;
this.$refs.mescroll.refresh();
},
getDate(type) {
const date = new Date();
let year = date.getFullYear();
let month = date.getMonth() + 1;
let day = date.getDate();
if (type === 'start') {
year = year - 60;
} else if (type === 'end') {
year = year + 2;
}
month = month > 9 ? month : '0' + month;
day = day > 9 ? day : '0' + day;
return `${year}${month}`;
},
bindPickerChange(e) {
this.pointIndex = e.detail.value;
this.searchType.from_type = this.pointType[this.pointIndex].value;
this.$refs.mescroll.refresh();
},
//获取分类类型
getPointType() {
var temp = [],
that = this;
this.$api.sendRequest({
url: '/api/memberaccount/fromType',
success: res => {
for (var index in res.point) {
var obg = {};
obg.label = res.point[index].type_name;
obg.value = index;
that.pointType.push(obg);
}
}
});
},
toList() {
this.$util.redirectTo('/pages_promotion/point/list');
},
toOrderList() {
this.$util.redirectTo('/pages_promotion/point/order_list');
},
toFromDetail(item) {
if (item.from_type == 'pointexchange') {
this.$api.sendRequest({
url: '/pointexchange/api/order/info',
data: {
order_id: item.type_tag
},
success: res => {
if (res.code >= 0) {
var data = res.data;
if (data.type == 1 && data.relate_order_id) {
switch (data.delivery_type) {
case 'store':
this.$util.redirectTo('/pages_order/detail/detail_pickup', {
order_id: data.relate_order_id
});
break;
case 'local':
this.$util.redirectTo('/pages_order/detail/detail_local_delivery', {
order_id: data.relate_order_id
});
break;
default:
this.$util.redirectTo('/pages_order/detail/detail', {
order_id: data.relate_order_id
});
}
} else {
this.$util.redirectTo('/pages_order/detail/detail_point', {
order_id: data.order_id
});
}
}
}
});
} else if (item.from_type == 'pointcash') {
this.$util.redirectTo('/pages_order/detail/detail', {
order_id: item.type_tag
});
} else if (item.from_type == 'memberconsume') {
// this.$util.redirectTo('/pages_order/detail', {
// order_id: item.type_tag
// });
} else if (item.from_type == 'pointexchangerefund' && parseInt(item.type_tag) != 0) {
this.$util.redirectTo('/pages_order/detail/detail_point', {
order_id: item.type_tag
});
} else if (item.from_type == 'refund' && parseInt(item.type_tag) != 0) {
this.$util.redirectTo('/pages_order/detail/detail', {
order_id: item.type_tag
});
}
},
//获得列表数据
getData(mescroll) {
this.$api.sendRequest({
url: '/api/memberaccount/page',
data: {
page_size: mescroll.size,
page: mescroll.num,
account_type: 'point',
from_type: this.searchType.from_type,
date: this.searchType.date,
related_id: this.related_id
},
success: res => {
let newArr = [];
let msg = res.message;
if (res.code == 0 && res.data) {
newArr = res.data.list;
} else {
this.$util.showToast({
title: msg
});
}
mescroll.endSuccess(newArr.length);
//设置列表数据
if (mescroll.num == 1) {
this.dataList = []; //如果是第一页需手动制空列表
this.related_id = 0;
}
this.dataList = this.dataList.concat(newArr); //追加新数据
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
},
fail: res => {
mescroll.endErr();
if (this.$refs.loadingCover) this.$refs.loadingCover.hide();
}
});
}
}
};
</script>
<style lang="scss">
/deep/ .fixed {
position: relative;
top: 0;
}
.tab {
position: fixed;
top: 0;
width: 100%;
z-index: 10;
display: flex;
justify-content: space-between;
height: 80rpx;
background-color: $color-bg;
view {
flex: 1;
text-align: center;
line-height: 80rpx;
text {
margin-left: 10rpx;
font-size: $font-size-base;
}
}
.tab-left {
display: flex;
padding-left: 30rpx;
}
.tab-right {
display: flex;
justify-content: flex-end;
padding-right: 40rpx;
}
}
.cart-empty {
margin-top: 208rpx !important;
}
.detailed-wrap {
background: #fff;
position: relative;
z-index: 9;
padding-top: 20rpx;
.head {
display: flex;
height: 90rpx;
&>view {
flex: 1;
text-align: left;
padding: 0 $padding;
line-height: 90rpx;
}
}
.cont {
background: #fff;
width: 100%;
margin: 0 auto;
.detailed-item {
padding: 30rpx 0 32rpx;
margin: 0 32rpx;
border-bottom: 2rpx solid $color-line;
position: relative;
box-sizing: border-box;
&:last-of-type {
border-bottom: none;
}
.info {
padding-right: 180rpx;
.event {
font-size: $font-size-base;
line-height: 1.3;
font-weight: 500;
}
.time-box {
line-height: 1;
margin-top: 24rpx;
}
.time {
font-size: $font-size-activity-tag;
color: $color-tip;
}
}
.num {
width: 160rpx;
position: absolute;
right: 17rpx;
top: 50%;
transform: translateY(-50%);
text-align: right;
font-size: $font-size-toolbar;
font-weight: 500;
}
}
}
}
</style>