feat: 优化

This commit is contained in:
2026-07-23 13:59:35 +08:00
parent 268207b01b
commit 3f335074ea
13 changed files with 614 additions and 580 deletions
+180 -168
View File
@@ -6,111 +6,114 @@
<view class="top-view">
<view class="top-left">
<text class="text-bold text-52 text-white">
{{amount}}
{{ amount }}
</text>
<text class="text-20 text-white" style="font-weight: 100;">可用余额</text>
</view>
<view class="top-right">
<text class="text-bold text-36 text-white">
{{noAmount}}
{{ noAmount }}
</text>
<text class="text-20 text-white" style="font-weight: 100;">不可用余额</text>
</view>
</view>
<view class="mid-view">
<text class="text-gray text-32">{{type == 0 ? '提现' : '充值'}}方式</text>
<text class="text-gray text-32">{{ type == 0 ? '提现' : '充值' }}方式</text>
<view class="item-view" @click="onSelect('0')" v-if="!isWeb || type != 0">
<image src="https://static.tbmall.xin/static/new/wx.png"></image>
<text class="text-gray text-32 " style="margin-left:20rpx;">微信</text>
<view class="right-icon-view" v-if="type == 1">
<u-radio-group v-model="curSelect">
<u-radio name="0" activeColor="#7934F6"></u-radio>
<u-radio name="0" activeColor="#7934F6"></u-radio>
</u-radio-group>
</view>
<view class="right-icon-view" v-else>
<text class="text-32 text-gray" style="margin-right:12rpx" v-if="selectVal && curSelect == '0'">{{selectVal.name + '/' + selectVal.account}}</text>
<u-icon size="14" name="arrow-right" color="#333" ></u-icon>
<text class="text-32 text-gray" style="margin-right:12rpx"
v-if="selectVal && curSelect == '0'">{{ selectVal.name + '/' + selectVal.account }}</text>
<u-icon size="14" name="arrow-right" color="#333"></u-icon>
</view>
</view>
<view class="item-view" @click="onSelect('1')" style="border-width: 0;" >
<view class="item-view" @click="onSelect('1')" style="border-width: 0;">
<image src="https://static.tbmall.xin/static/new/zfb.png"></image>
<text class="text-gray text-32 " style="margin-left:20rpx;">支付宝</text>
<view class="right-icon-view" v-if="type == 1">
<u-radio-group v-model="curSelect">
<u-radio name="1" activeColor="#7934F6"></u-radio>
<u-radio name="1" activeColor="#7934F6"></u-radio>
</u-radio-group>
</view>
<view class="right-icon-view" v-else>
<text class="text-32 text-gray" style="margin-right:12rpx" v-if="selectVal && curSelect == '1'">{{selectVal.name + '/' + selectVal.account}}</text>
<u-icon size="14" name="arrow-right" color="#333" ></u-icon>
<text class="text-32 text-gray" style="margin-right:12rpx"
v-if="selectVal && curSelect == '1'">{{ selectVal.name + '/' + selectVal.account }}</text>
<u-icon size="14" name="arrow-right" color="#333"></u-icon>
</view>
</view>
</view>
<view class="mid-view">
<view class="flex-r-lr">
<text class="text-gray text-32">{{type == 0 ? '提现' : '充值'}}金额</text>
<text class="text-gray text-32">{{ type == 0 ? '提现' : '充值' }}金额</text>
<text class="text-fu1 text-28" v-if="type == 0" style="font-weight:400">每日仅限提现1次</text>
</view>
<view class="input-view">
<text class="text-52 text-zu text-bold">¥</text>
<input style="background: #fff;margin-top:10rpx;"
:placeholder="type == 0 ? '请输入提现金额(0.3-2000)' : '输入充值金额'"
placeholder-style="color:#999;font-weight:400"
@input="onInput"
border="0" v-model="money" :customStyle="inputCss"></input>
<input style="background: #fff;margin-top:10rpx;"
:placeholder="type == 0 ? '请输入提现金额(0.3-2000)' : '输入充值金额'"
placeholder-style="color:#999;font-weight:400" @input="onInput" border="0" v-model="money"
:customStyle="inputCss"></input>
</view>
</view>
<view class="zhu-view" v-if="selectVal">
<u-icon size="12" style="margin-top:5rpx;margin-right:12rpx" name="error-circle" color="#7934F6"></u-icon>
<text class="text-24 text-zi" style="font-weight: 400;">通过支付宝或微信提现时,将由支付宝/微信官方收取0.6%的费用,本平台不收取任何费用。</text>
</view>
<view class="zhu-view" v-if="selectVal">
<u-icon size="12" style="margin-top:5rpx;margin-right:12rpx" name="error-circle"
color="#7934F6"></u-icon>
<text class="text-24 text-zi"
style="font-weight: 400;">通过支付宝或微信提现时,将由支付宝/微信官方收取0.6%的费用,本平台不收取任何费用。</text>
</view>
</view>
<view class="bottom-btn">
<MyBtn :text="bottomText" @ok="onAdd"></MyBtn>
</view>
<SelectItem :itemData="dataList" @close="onClose" @ok="onOk" @add="onAddBack"
:type="curSelect" :itemShow="selectShow"></SelectItem>
<CodeItem @ti="onTi" @close="onClose" :codeShow="codeShow" :phone="userInfo ? userInfo.mobile :''"></CodeItem>
<SelectItem :itemData="dataList" @close="onClose" @ok="onOk" @add="onAddBack" :type="curSelect"
:itemShow="selectShow"></SelectItem>
<CodeItem @ti="onTi" @close="onClose" :codeShow="codeShow" :phone="userInfo ? userInfo.mobile : ''"></CodeItem>
<up-toast ref="uToastRef"></up-toast>
</view>
</template>
<script>
import { getWithdraw,sendWithdraw } from '@/api/common.js';
import { getUserInfo,updateName,deleteAccount } from '@/api/auth.js';
import { getWithdraw, sendWithdraw } from '@/api/common.js';
import { getUserInfo, updateName, deleteAccount } from '@/api/auth.js';
import Header from '@/components/common/header.vue';
import TopSafe from '@/components/common/top-safe.nvue'
import MyBtn from '@/components/common/my-btn.vue'
import func from '@/utils/func.js';
import SelectItem from './components/select-item.vue'
import CodeItem from './components/code-item.vue'
import {uniPlatform} from '@/components/common/global.js'
import { recharge,getAcctBalance } from '@/api/finance.js';
import { uniPlatform } from '@/components/common/global.js'
import { recharge, getAcctBalance } from '@/api/finance.js';
import { appWxpayFun, zfbPayFun } from '@/utils/payUtils.js'
// #ifdef APP-PLUS
import {requestMerchantTransfer} from "@/uni_modules/uni-requestMerchantTransfer"
import { requestMerchantTransfer } from "@/uni_modules/uni-requestMerchantTransfer"
// #endif
export default {
components: { Header, TopSafe,MyBtn,SelectItem,CodeItem },
components: { Header, TopSafe, MyBtn, SelectItem, CodeItem },
data() {
return {
isWeb:false,
topText:'',
type:0,
amount:'',
money:'',
noAmount:'',
account:'',
bottomText:'',
curSelect:'0',
selectShow:false,
codeShow:false,
name:'',
isWeb: false,
topText: '',
type: 0,
amount: '',
money: '',
noAmount: '',
account: '',
bottomText: '',
curSelect: '0',
selectShow: false,
codeShow: false,
name: '',
inputCss: {
"height": '80rpx',
"background": "#F3F3F3FF",
@@ -118,22 +121,22 @@ export default {
"border": "0rpx",
"padding-left": "12rpx",
},
dataList:[
dataList: [
],
selectVal:null,
userInfo:null,
selectVal: null,
userInfo: null,
};
},
onShow(){
if(uniPlatform == 'web'){
onShow() {
if (uniPlatform == 'web') {
this.isWeb = true;
}else{
} else {
this.isWeb = false;
}
},
onLoad(option) {
if(option && option.type){
if (option && option.type) {
this.type = Number(option.type);
this.init();
}
@@ -146,33 +149,33 @@ export default {
}
})
},
onInput(e){
onInput(e) {
this.$nextTick(() => {
this.money = func.checkInputPrice(e.detail.value);
})
},
onOk(val){
this.selectVal = this.dataList.filter(i=>i.id == val)[0];
onOk(val) {
this.selectVal = this.dataList.filter(i => i.id == val)[0];
this.onClose();
},
onAddBack(){
onAddBack() {
this.onClose();
uni.navigateTo({
url:'/pages/rwa_package/account/index?id=' + this.curSelect
url: '/pages/rwa_package/account/index?id=' + this.curSelect
})
},
onClose(){
onClose() {
this.selectShow = false;
this.codeShow = false;
},
getList(val){
getList(val) {
let params = {
platform:this.curSelect == '0' ? 2 : 1
platform: this.curSelect == '0' ? 2 : 1
}
getWithdraw(params).then(res=>{
getWithdraw(params).then(res => {
if (res.bizcode === 100) {
this.dataList = res.data;
this.dataList.forEach(item=>{
this.dataList.forEach(item => {
item.name = item.accountName;
item.account = item.accountNumber;
})
@@ -186,9 +189,9 @@ export default {
}
})
},
onSelect(val){
onSelect(val) {
this.curSelect = val;
if(this.type == 0){
if (this.type == 0) {
this.selectVal = null;
this.getList();
}
@@ -199,8 +202,8 @@ export default {
let data = [];
if (resp && resp.bizcode === 100) {
data = resp.data || [];
data.forEach(item=>{
if("balance" == item.categoty){
data.forEach(item => {
if ("balance" == item.categoty) {
this.noAmount = item.lockAmount;
this.amount = item.curAmount;
}
@@ -210,69 +213,69 @@ export default {
this.balanceLoading = false;
},
init() {
if(this.type == 0 ){
if (this.type == 0) {
this.topText = '现金余额提现';
this.bottomText = '提现';
}else if(this.type == 1){
} else if (this.type == 1) {
this.topText = '现金余额充值';
this.bottomText = '充值';
}
this.userinfo();
this.getAcctBalance();
},
onAdd(){
if(this.type == 0){
if(!this.money){
onAdd() {
if (this.type == 0) {
if (!this.money) {
this.$refs.uToastRef.show({
type: "error",
message: "请输入金额",
type: "error",
message: "请输入金额",
});
return;
}
if(Number(this.money) < 0.3){
if (Number(this.money) < 0.3) {
this.$refs.uToastRef.show({
type: "error",
message: "提现金额不能低于0.3元",
type: "error",
message: "提现金额不能低于0.3元",
});
return;
}
if(Number(this.money) > 2000){
if (Number(this.money) > 2000) {
this.$refs.uToastRef.show({
type: "error",
message: "提现金额不能大于2000元",
type: "error",
message: "提现金额不能大于2000元",
});
return;
}
if(Number(this.money)> Number(this.amount)){
if (Number(this.money) > Number(this.amount)) {
this.$refs.uToastRef.show({
type: "error",
message: "输入金额大于可用余额",
type: "error",
message: "输入金额大于可用余额",
});
return;
}
if(this.type == 0 && !this.selectVal){
if (this.type == 0 && !this.selectVal) {
this.$refs.uToastRef.show({
type: "error",
message: "请选择提现方式",
type: "error",
message: "请选择提现方式",
});
return;
}
console.log('onAdd',this.curSelect)
console.log('onAdd', this.curSelect)
this.codeShow = true;
}else{
if(!this.money){
} else {
if (!this.money) {
this.$refs.uToastRef.show({
type: "error",
message: "请输入金额",
type: "error",
message: "请输入金额",
});
return;
}
let params = {
amount:this.money,
category:'balance',
payway:this.curSelect == '0' ? 'wechat' : 'alipay'
amount: this.money,
category: 'balance',
payway: this.curSelect == '0' ? 'wechat' : 'alipay'
}
recharge(params).then(result=>{
recharge(params).then(result => {
if (result && result.bizcode === 100) {
const item = result.data;
if (item.wechat && Object.keys(item.wechat).length !== 0) {
@@ -284,12 +287,12 @@ export default {
type: 'error',
message: "充值失败",
});
}
}
})
}
},
async appWxpay(alipay, orderId, orderNum) {
try {
@@ -311,52 +314,52 @@ export default {
console.error('支付失败', error);
// 处理支付失败后的逻辑,如提示用户等
}
},
onTi(code){
onTi(code) {
let params = {
verificationCode:code,
bindId:this.selectVal.id,
amount:Number(this.money),
accountType:this.curSelect == '0' ? 1 : 2
verificationCode: code,
bindId: this.selectVal.id,
amount: Number(this.money),
accountType: this.curSelect == '0' ? 1 : 2
}
let _this = this;
sendWithdraw(params).then(res=>{
console.log('absc',res)
sendWithdraw(params).then(res => {
console.log('absc', res)
if (res && res.bizcode == 100) {
console.log('absc1111111111',res,this.curSelect)
console.log('absc1111111111', res, this.curSelect)
// data = resp.data || [];
if(this.curSelect == '1'){
this.qing();
if(res.data.alResponse.msg == 'Success'){
if (this.curSelect == '1') {
this.qing();
if (res.data.alResponse.msg == 'Success') {
uni.navigateTo({
url:'/pages/rwa_package/account/success?money=' + params.amount
url: '/pages/rwa_package/account/success?money=' + params.amount
})
}else{
setTimeout(()=>{
} else {
setTimeout(() => {
_this.$refs.uToastRef.show({
type: 'error',
message: res.data.alResponse.subMsg,
});
},400)
}, 400)
}
}else{
console.log('开始提现',res,this.curSelect)
} else {
console.log('开始提现', res, this.curSelect)
// #ifdef APP-PLUS
requestMerchantTransfer({
// uni.requestMerchantTransfer({
// uni.requestMerchantTransfer({
"mchId": "1725999656",
"appId": "wx7a5902cd556d9396",
"package": res.data.wxResponse.packageInfo,
success: (res) => {
this.qing();
uni.navigateTo({
url:'/pages/rwa_package/account/success?money=' + params.amount
url: '/pages/rwa_package/account/success?money=' + params.amount
})
},
fail: (res) => {
_this.$refs.uToastRef.show({
@@ -364,17 +367,17 @@ export default {
message: '提现失败',
});
},
})
// #endif
}
}
})
},
qing(){
qing() {
this.money = '';
this.curSelect = '0';
this.selectVal = null;
@@ -385,17 +388,18 @@ export default {
</script>
<style lang="scss" scoped>
.bottom-btn{
.bottom-btn {
width: 100%;
margin-bottom:92rpx;
margin-bottom: 92rpx;
display: flex;
flex-direction: column;
align-items: center;
padding: 0 32rpx;
box-sizing: border-box;
position: relative;
}
.setting-view {
width: 100%;
height: calc(100% - 88rpx - 92rpx - 88rpx - var(--status-bar-height));
@@ -406,49 +410,54 @@ export default {
padding: 0 32rpx;
box-sizing: border-box;
position: relative;
.top-view{
width:100%;
margin-top:40rpx;
height:188rpx;
min-height:188rpx;
.top-view {
width: 100%;
margin-top: 40rpx;
height: 188rpx;
min-height: 188rpx;
display: flex;
background:linear-gradient( 270deg, #B164FB 0%, #7934F6 100%);
background: linear-gradient(270deg, #B164FB 0%, #7934F6 100%);
padding: 36rpx 32rpx;
box-sizing: border-box;
flex-direction: row;
justify-content: space-between;
align-items: center;
border-radius: 16rpx;
.top-left{
.top-left {
display: flex;
flex-direction: column;
justify-content: space-between;
height:108rpx;
height: 108rpx;
}
.top-right{
.top-right {
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-end;
height:108rpx;
height: 108rpx;
}
}
.zhu-view{
width:100%;
.zhu-view {
width: 100%;
display: flex;
margin-top:32rpx;
margin-top: 32rpx;
flex-direction: row;
justify-content: flex-start;
align-items: flex-start;
padding: 16rpx;
box-sizing: border-box;
background: rgba(121, 52, 246, 0.05);
border-radius:8rpx ;
border-radius: 8rpx;
}
.mid-view{
width:100%;
.mid-view {
width: 100%;
display: flex;
flex-direction: column;
overflow-y: auto;
@@ -456,42 +465,45 @@ export default {
background-color: #fff;
border-radius: 16rpx;
padding: 32rpx;
padding-bottom:0 ;
margin-top:24rpx;
.item-view{
width:100%;
height:110rpx;
min-height:110rpx;
padding-bottom: 0;
margin-top: 24rpx;
.item-view {
width: 100%;
height: 110rpx;
min-height: 110rpx;
display: flex;
flex-direction: row;
position: relative;
align-items: center;
border-bottom: 2rpx solid #ececec;
.right-icon-view{
.right-icon-view {
position: absolute;
right:0;
right: 0;
display: flex;
}
image{
width:48rpx;
height:48rpx;
image {
width: 48rpx;
height: 48rpx;
}
}
.input-view{
width:100%;
height:100rpx;
.input-view {
width: 100%;
height: 100rpx;
border-radius: 20rpx;
margin:32rpx 0 ;
margin: 32rpx 0;
display: flex;
flex-direction: row;
align-items: center;
}
}
}
</style>