提现优化更新

This commit is contained in:
GaoHao
2025-01-07 15:28:42 +08:00
parent f82c31084d
commit 419f308802
11 changed files with 817 additions and 14 deletions

11
api/me/message.js Normal file
View File

@@ -0,0 +1,11 @@
import http from '@/http/http.js'
/**
* 获取消息列表
*/
export const selectMessageByUserId = (data) => {
return http.request({
url: '/message/selectMessageByUserId',
data: data,
})
}

63
api/me/withdraw.js Normal file
View File

@@ -0,0 +1,63 @@
import http from '@/http/http.js'
/**
* 获取提现金额
*/
export const selectUserMoney = (data) => {
return http.request({
url: '/moneyDetails/selectUserMoney',
})
}
/**
* 获取提现记录
*/
export const selectPayDetails = (data) => {
return http.request({
url: '/cash/selectPayDetails',
data: data
})
}
/**
* 修改提现账号
*/
export const updateUser = (data) => {
return http.request({
url: '/user/updateUser',
params: data
})
}
/**
* 获取看广告状态
*/
export const canCash = (data) => {
return http.request({
url: '/cash/canCash',
})
}
/**
* 广告状态修改
*/
export const state = (data) => {
return http.request({
url: '/ad/state',
data: data,
})
}
/**
* 广告状态修改
*/
export const withdraw = (data) => {
return http.request({
url: '/cash/withdraw',
data: data,
})
}

View File

@@ -89,6 +89,30 @@
"style": {
"navigationBarTitleText": "服务协议"
}
}, {
"path": "pages/me/message",
"style": {
"navigationBarTitleText": "消息中心"
}
}, {
"path": "pages/me/withdraw/index",
"style": {
"navigationBarTitleText": "申请提现",
"navigationBarTextStyle": "#fff",
"navigationBarBackgroundColor": "rgb(255, 117, 129)",
"titleNView": {
"buttons": [{
"text": "规则",
"fontSize": "30rpx",
"onclick": "onNavigationBarButtonTap"
}]
}
}
}, {
"path": "pages/me/withdraw/alipay",
"style": {
"navigationBarTitleText": "提现账号"
}
},
{
"path": "pages/index/search/index",

View File

@@ -130,17 +130,19 @@
})
console.log(res)
uni.setStorageSync('token', res.token)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('userName', res.user.userName)
uni.setStorageSync('avatar', res.user.avatar ? res.user.avatar : '../../static/default/avatar.png')
uni.setStorageSync('phone', res.user.phone)
uni.setStorageSync('invitationCode', res.user.invitationCode)
uni.setStorageSync('sex', res.user.sex)
uni.setStorageSync('userId', res.user.userId)
uni.setStorageSync('userInfo', res.user)
// uni.setStorageSync('userId', res.user.userId)
// uni.setStorageSync('userName', res.user.userName)
// uni.setStorageSync('avatar', res.user.avatar ? res.user.avatar : '../../static/default/avatar.png')
// uni.setStorageSync('phone', res.user.phone)
// uni.setStorageSync('invitationCode', res.user.invitationCode)
// uni.setStorageSync('sex', res.user.sex)
// uni.setStorageSync('userId', res.user.userId)
//设置渠道码
if (res.user.qdCode) {
uni.setStorageSync('qdCode', res.user.qdCode)
}
// if (res.user.qdCode) {
// uni.setStorageSync('qdCode', res.user.qdCode)
// }
uni.hideLoading();
uni.showToast({
title: '登录成功',

View File

@@ -11,8 +11,6 @@
<script setup>
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import config from '@/commons/config.js';
import {selectUserById} from '@/api/user/user.js';
import {commonType} from '@/api/init.js';
let data = reactive({

100
pages/me/message.vue Normal file
View File

@@ -0,0 +1,100 @@
<!-- 消息中心 -->
<template>
<view class="container">
<view v-if="data.msgList.length" class="list" v-for="(item,index) in data.msgList"
:key='index'>
<image class="icon" src="@/static/me/message.png" mode="aspectFit"></image>
<view class="item-right">
<view class="top">
<view class="title">{{item.title}}</view>
<view class="text-gray">{{item.createAt}}</view>
</view>
<view class="text-gray">{{item.content}}</view>
</view>
</view>
</view>
</template>
<script setup>
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import { selectMessageByUserId } from '@/api/me/message.js';
let data = reactive({
page: 1,
limit: 10,
msgList: []
})
onLoad(() => {
getMsg()
})
async function getMsg() {
uni.showLoading({
title: '加载中'
})
let params = {
page: data.page,
limit: data.limit,
state: 5
}
let res = await selectMessageByUserId(params)
console.log(res)
uni.hideLoading()
uni.stopPullDownRefresh();
if (data.page === 1) {
data.msgList = res.list
uni.stopPullDownRefresh();
return
}
data.msgList = [...data.msgList, ...res.list]
}
// function onReachBottom () {
// data.page = data.page + 1;
// getMsg()
// }
// function onPullDownRefresh () {
// data.page = 1;
// // this.msgList = []
// getMsg()
// }
</script>
<style lang="scss" scoped>
page {
background-color: white;
}
.container{
padding: 0 30rpx;
}
.list{
display: flex;
padding: 20rpx 0;
border-bottom: 1rpx solid #e4e7ed;
.icon{
width: 85rpx;
height: 85rpx;
}
.item-right{
width: 100%;
display: flex;
flex-direction: column;
margin-left: 30rpx;
font-size: 28rpx;
color: #333;
.top{
display: flex;
justify-content: space-between;
.title{
font-size: 32rpx;
font-weight: bold;
color: #333;
}
}
}
}
</style>

View File

@@ -11,8 +11,6 @@
<script setup>
import { reactive } from 'vue';
import { onLoad } from '@dcloudio/uni-app'
import config from '@/commons/config.js';
import {selectUserById} from '@/api/user/user.js';
import {commonType} from '@/api/init.js';
let data = reactive({

View File

@@ -0,0 +1,145 @@
<template>
<view class="containerView">
<up-cell-group>
<up-cell title="收款人姓名">
<template #right-icon> <up-input border="none" v-model="data.zhiFuBaoName" placeholder="请输入支付宝收款人姓名"></up-input> </template>
</up-cell>
<up-cell title="支付宝账号">
<template #right-icon> <up-input border="none" v-model="data.zhiFuBao" placeholder="请输入要绑定的支付宝手机号"></up-input> </template>
</up-cell>
<up-cell title="身份证号码">
<template #right-icon> <up-input border="none" v-model="data.certNum" placeholder="请输入要绑定身份证号码"></up-input> </template>
</up-cell>
</up-cell-group>
<button :class="data.zhiFuBao&&data.zhiFuBaoName?'confirm-btn':'confirm-btn1'" @click="toLogin"
:disabled="logining">绑定账户</button>
<view style="font-size: 24upx;color: #999999;padding: 0 64rpx;margin-top: 32rpx;margin-bottom: 10rpx;">请正确填写收款人的支付宝账户和真实的收款人姓名</view>
<view style="font-size: 24upx;color: #999999;padding: 0 64rpx;;margin-bottom: 10rpx;">身份证姓名需与支付宝姓名一致</view>
<view style="font-size: 24upx;color: #999999;padding: 0 64rpx;;margin-bottom: 10rpx;">身份证信息仅可使用一次</view>
<view style="font-size: 24upx;color: #999999;padding: 0 64rpx">否则将无法正常收款请须知</view>
</view>
</template>
<script setup>
import { reactive, nextTick, ref } from 'vue';
import { onReady,onLoad,onShow } from '@dcloudio/uni-app'
import { updateUser } from '@/api/me/withdraw.js';
import { commonType } from '@/api/init.js';
let data = reactive({
zhiFuBao: '',
zhiFuBaoName: '',
certNum: '',
logining: false
})
onLoad(() => {
this.zhiFuBao = uni.getStorageSync('userInfo').zhiFuBao;
this.zhiFuBaoName = uni.getStorageSync('userInfo').zhiFuBaoName;
this.certNum = uni.getStorageSync('userInfo').certNo;
})
function inputChange(e) {
const key = e.currentTarget.dataset.key;
data[key] = e.detail.value;
}
async function toLogin() {
console.log(data.zhiFuBaoName)
console.log(data.zhiFuBao)
console.log(data.certNum)
if (!data.zhiFuBaoName) {
uni.showToast({
title: '请设置收款人姓名',
icon: 'none'
})
} else if (!data.zhiFuBao) {
uni.showToast({
title: '请设置收款人支付宝账号',
icon: 'none'
})
} else if (!data.certNum) {
uni.showToast({
title: '请设置收款人身份证账号',
icon: 'none'
})
} else {
data.logining = true
let res = await updateUser({
zhiFuBao: data.zhiFuBao,
certName: data.zhiFuBaoName,
certNum: data.certNum,
})
if( res) {
data.logining = false
let userInfo = uni.getStorageSync('userInfo')
userInfo.zhiFuBao = data.zhiFuBao
userInfo.zhiFuBaoName = data.zhiFuBaoName
userInfo.certNo = data.certNum
uni.setStorageSync('userInfo', userInfo)
uni.showToast({
title: '修改成功',
icon: 'none',
complete() {
setTimeout(function() {
// uni.navigateBack();
}, 1000)
}
})
}
}
}
</script>
<style lang='scss'>
page {
background: #FFFFFF;
}
.containerView {
padding-top: 32upx;
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
background: #ffffff;
}
.confirm-btn1 {
width: 300px;
height: 42px;
line-height: 42px;
border-radius: 30px;
margin-top: 70upx;
/* background: whitesmoke; */
background: #ff7581;
color: #FFFFFF;
font-size: 32rpx;
&:after {
border-radius: 60px;
}
}
.confirm-btn {
width: 300px;
height: 42px;
line-height: 42px;
border-radius: 30px;
margin-top: 70upx;
background: #ff7581;
color: #ffffff;
font-size: 32rpx;
&:after {
border-radius: 60px;
}
}
</style>

462
pages/me/withdraw/index.vue Normal file
View File

@@ -0,0 +1,462 @@
<template>
<view class="cash">
<view class=""
style="background-color: #ff7581;height: 400upx;border-bottom-right-radius: 40upx;border-bottom-left-radius: 40upx;">
<view style="font-size: 32upx;color: #FFFFFF;padding-top: 100upx;">可提现总额</view>
<view style="font-size: 40upx;color: #FFFFFF;padding-top: 20upx;">¥ {{ data.mayMoney }}</view>
<view
style="width: 90%;height: max-content;margin-left: 40upx;background-color: #FFFFFF;box-shadow: rgba(183, 183, 183, 0.3) 0px 1px 10px;margin-top: 50upx;border-radius: 20upx;">
<view style="display: flex;flex-direction: row;padding: 20upx;">
<view style="font-size: 32upx;color: #333333;">提现金额
</view>
</view>
<view
style="display: flex;flex-direction: row;padding: 20upx;justify-content: space-between;align-items: center;">
<view style="display: flex;align-items: center;">
<view style="font-size: 40upx;color: #333333;">¥</view>
<input type="number" v-model="data.money" placeholder="请输入金额" @input="moneyInput"
style="font-size: 40upx;color: #333333;text-align: left;margin-left: 10upx;width: 80%;" />
</view>
<view @click="setAllMoney" style="font-size: 30rpx;color: #333333;background: #ff7581;color: white;border-radius: 10rpx;padding: 7rpx 15rpx;flex-shrink: 0;">
全部
</view>
</view>
<view style="background: #E6E6E6;width: 100%;height: 1upx;"></view>
</view>
<view @click="goWithdraw" style="margin: 32upx;font-size: 18px;background: #ff7581;color: white;border-radius: 10px;height: 40px;line-height: 40px;">
{{!data.isWithdraw?'观看广告提现':'立即提现'}}
</view>
<view style="display: flex;width: 100%;justify-content: space-around;width: 100%;">
<view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;" @click="navTo('/pages/me/withdraw/alipay')">
提现账号
</view>
<view class="u-flex-1" style="color: grey;padding-bottom: 30px;padding-top: 20upx;" @click="navTo('')">
红包明细
</view>
<!-- <view style="color: grey;padding-bottom: 30px;padding-top: 20upx;width: 33%;" @click="gojilu">提现记录
</view> -->
</view>
<view style="text-align: left" class="moneyList u-p-b-30">
<view v-if="data.list.length" v-for="(item, index) in data.list" :key="index" class="item">
<view>
<view style="margin-bottom: 8upx;text-align: right;">
<text style="margin-bottom: 8upx;color: green" v-if="item.state===1"> 提现成功</text>
<text style="margin-bottom: 8upx;color: green" v-if="item.state===0||item.state==3">
提现中</text>
<text style="margin-bottom: 8upx;color: #FD6416" v-if="item.state===-1||item.state===2">
提现失败
</text>
</view>
<view style="color: #999999;font-size: 28upx;">
<view style="margin-bottom: 8upx"> 收款人账号{{ item.zhifubao }}</view>
<view style="margin-bottom: 8upx"> 收款人姓名{{ item.zhifubaoName }}</view>
<view style="margin-bottom: 8upx"> 发起时间{{ item.createAt }}</view>
<view style="margin-bottom: 8upx" v-if="item.state===1">成功时间 {{ item.outAt }}</view>
<view style="margin-bottom: 8upx;color: #FD6416" v-if="item.state===-1||item.state===2">
失败原因{{ item.refund }}
</view>
<view style="margin-bottom: 8upx;text-align: right;">
<!-- 提现金额 -->
<text style="color: #FD6416;font-size: 32upx;font-weight: 600"> {{ item.money }}</text>
</view>
</view>
</view>
</view>
<view class="page-box" v-if="!data.list.length">
<view class="centre">
<!-- <image src="../../static/images/learn/none.png" mode=""></image> -->
<view class="tips">
暂无记录
</view>
</view>
</view>
</view>
</view>
<up-modal :show="data.ruleShow" confirm-text="知道了" title="规则说明" :title-style="{fontWeight:'700'}" @confirm="data.ruleShow=false" confirm-color="rgb(255, 117, 129)">
<view class="u-p-30 u-text-left">
<scroll-view scroll-y="true" style="max-height: 50vh;" >
<rich-text class="color-666" :nodes="data.ruleInfo"></rich-text>
</scroll-view>
</view>
</up-modal>
<!-- 激励视频广告 -->
<!-- <ad-rewarded-video v-if="data.adRewardedVideo" ref="adRewardedVideo" adpid="1531580352" :loadnext="true" v-slot:default="{loading, error}"
:url-callback="data.urlCallback" @load="onadload" @close="onadclose" @error="onaderror">
<view class="ad-error" v-if="error">{{error}}</view>
</ad-rewarded-video> -->
</view>
</template>
<script setup>
import { reactive, nextTick, ref } from 'vue';
import { onReady,onLoad,onShow } from '@dcloudio/uni-app'
import { selectUserMoney, selectPayDetails, canCash, state, withdraw } from '@/api/me/withdraw.js';
import { commonType } from '@/api/init.js';
let data = reactive({
ruleShow: true,
ruleInfo: `
用户在平台中对奖励提现的,适用以下规则:
<br/>
<br/>
1用户的收益达到最低提现金额要求后可以申请提现。每日发起前10笔提现为自动到账超出则需第二个工作日后到账。
<br/>
2用户需要通过支付宝提现需按照要求绑定支付宝账号并填写提现金额或其他提现所需信息请确保提供的信息准确无误以免提现失败。
<br/>
3如果用户发现显示「提现失败」需确认当前填写或绑定的支付宝账号或银行卡账号是否正确以及支付宝账号是否可用。如果用户发现显示「提现成功」但没到账
<br/>
(1)如果用户有多个支付宝账号,请检查用户是否提现到了其他支付宝账号。
<br/>
(2)高峰期提现人数多会导致网络拥堵显示提现成功之后72小时内属于正常现象请耐心等候。
<br/>
4每日23:00至次日11:00为系统维护时间活动的对应奖励可能延迟到账。提现通常会在72小时内到账如遇双休日、节假日提现到账时间可能会延长。活动高峰期间由于网络拥堵用户可能存在短时间内无法提现的情况。平台将尽最大努力及时恢复提现功能但无需因此承担任何责任。
<br/>`,
money: '',
mayMoney: '0',
list: [],
page: 1,
limit: 10,
totalCount: 0,
cashMoney: 0,
urlCallback: null,
adRewardedVideo: true,
adRewardedVideoloadNum: 0,
isWithdraw: false,
})
const adRewardedVideo = ref(null);
onLoad(() => {
getExtractFei();
getMoneyDetail();
})
onShow(() => {
console.log(uni.getStorageSync('userInfo'))
getcashMoney()
})
onReady(() => {
nextTick(()=>{
data.adRewardedVideoloadNum = 0
adRewardedVideo.value.load();
})
getCanCash()
})
// onReachBottom: function() {
// if (this.page * this.limit < this.totalCount) {
// this.page = this.page + 1;
// this.getMoneyDetail();
// }
// },
// onPullDownRefresh: function() {
// this.page = 1;
// // that.list = []
// this.getMoneyDetail();
// },
/**
* 获取看广告状态
*/
async function getCanCash() {
canCash().then(res => {
data.isWithdraw = res;
})
}
/**
* 广告数据加载成功回调
* @param {Object} e
*/
function onadload(e) {
data.adRewardedVideo = true;
console.log('广告数据加载成功');
}
/**
* 广告加载失败回调
* @param {Object} e
*/
function onaderror(e) {
if ( data.adRewardedVideoloadNum >=3 ) {
data.adRewardedVideo = false;
return
}
data.adRewardedVideoloadNum++
setTimeout(() => {
adRewardedVideo.value.load();
}, 1000); // 10
console.log("广告加载失败")
}
/**
* 广告播放成功回调
* @param {Object} e
*/
async function onadclose(e) {
const detail = e.detail
if (detail && detail.isEnded) {
// 正常播放结束
let res = await state({
extraKey: data.urlCallback.extra
})
getCanCash()
} else {
// 播放中途退出
}
}
function onNavigationBarButtonTap() {
console.log(1)
data.ruleShow = true
}
/**
* 提现触发
*/
function goWithdraw() {
if ( !data.isWithdraw ) {
data.urlCallback = {
userId: uni.getStorageSync('userInfo').userId,
extra: 'cash:'+uni.getStorageSync('userInfo').userId + "" + new Date().getTime(),
}
adRewardedVideo.value.show();
} else {
getOut()
}
}
function moneyInput(e) {
data.money = e.detail.value.match(/^\d*(\.?\d{0,2})/g)[0] || null;
}
/**
* 全部提现赋值
*/
function setAllMoney() {
data.money = data.mayMoney.toFixed(2)
}
/**
* 获取提现记录
*/
function getMoneyDetail() {
selectPayDetails({
page: data.page,
limit: data.limit
}).then(res => {
data.totalCount = res.totalCount;
if (res.list.length > 0) {
data.list = [...data.list, ...res.list];
}
})
}
/**
* 获取最低提现金额
*/
function getExtractFei() {
commonType(112).then(res => {
if (res && res.value) {
data.cashMoney = res.value;
}
});
}
/**
* 可提现金额
*/
function getcashMoney() {
selectUserMoney().then(res => {
console.log(res)
data.mayMoney = res.amount || 0
})
}
/**
* 跳转
* @param {Object} url
*/
function navTo(url) {
uni.navigateTo({
url: url
});
}
function getMoney() {
let data =
uni.showLoading({
title: '提现中'
});
withdraw({
amount: data.money
}).then(res => {
data.money = ''
setTimeout(function() {
getcashMoney()
}, 1500)
}).catch(res =>{
if (res.code == 9991) {
uni.showToast({
title: res.msg,
icon: 'none'
})
setTimeout(function() {
uni.navigateTo({
url: '/me/invite/zhifubao'
});
}, 1500)
}
})
}
function getOut() {
if (uni.getStorageSync('userInfo').zhiFuBao && uni.getStorageSync('userInfo').zhiFuBaoName && uni.getStorageSync('userInfo').certNo) {
if (!/^\d+(\.\d{1,2})?$/.test(data.money)) {
uni.showToast({
icon: 'none',
title: '请输入正确金额,不能包含中文,英文,特殊字符和小数'
});
return;
}
if (parseFloat(data.mayMoney).toFixed(2) >= parseFloat(data.money)) {
if (parseFloat(data.money).toFixed(2) >= parseFloat(data.cashMoney)) {
uni.showModal({
title: "提现申请提示",
content: '请仔细确认收款人信息\n\n收款人姓名:' + uni.getStorageSync('userInfo').zhiFuBaoName + '\n\n提现金额:' + data
.money + '元\n\n收款人账号' + uni.getStorageSync('userInfo').zhiFuBao + '',
success: (e) => {
if (e.confirm) {
getMoney();
getMoneyDetail();
}
}
});
} else {
uni.showToast({
icon: 'none',
title: "提现金额必须大于或等于" + data.cashMoney + "元才可提现"
});
}
} else {
uni.showToast({
icon: 'none',
title: "您的余额不足"
});
}
} else {
uni.navigateTo({
url: "/me/invite/zhifubao"
})
}
}
</script>
<style lang="scss" scoped>
// @import '../../static/css/index.css';
.rule-btn {
font-size: 16px;
// padding: 2rpx 10rpx;
// border: 1px solid rgba(255, 255, 255, .8);
// border-radius: 4rpx;
}
.view2-view-text {
font-size: 14px;
color: #000000;
margin-left: 20upx;
width: 80%;
}
.view2-view-image-right {
width: 18upx;
height: 30upx;
margin-left: 50upx;
}
.cash {
text-align: center;
background: white;
height: 100%;
position: absolute;
width: 100%;
.cash-top {
padding: 32upx 32upx 50upx 32upx;
/* border-bottom: 1px solid gainsboro; */
background: #5074FF;
}
.leiji {
font-size: 14px;
color: #ffffff;
margin-bottom: 10px;
}
}
.moneyList {
.item {
background: white;
padding: 32rpx;
margin: 32rpx;
font-size: 28rpx;
box-shadow: 7px 9px 34px rgba(0, 0, 0, 0.1);
border-radius: 16upx;
}
.item:first-child {
margin-top: 0;
}
}
.centre {
text-align: center;
padding: 200rpx 0;
font-size: 32rpx;
box-sizing: border-box;
image {
width: 360rpx;
height: 360rpx;
// margin-bottom: 20rpx;
margin: 0 auto 20rpx;
// border: 1px dotted #000000;
}
.tips {
font-size: 34rpx;
color: #999999;
margin-top: 20rpx;
}
.btn {
margin: 80rpx auto;
width: 600rpx;
border-radius: 32rpx;
line-height: 90rpx;
color: #ffffff;
font-size: 34rpx;
background: #ff7581;
}
}
</style>

BIN
static/me/jifen.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

BIN
static/me/message.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB