tcwm-uniapp-qsd/pages/riderMy/myAccount/Txmoney/Txmoney.vue

633 lines
15 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="content" v-if="XCXIsSelect !='否'">
<view class="part_one">
<view class="one_title">可提现金额</view>
<view class="one_price">¥{{mayMoney}}</view>
</view>
<view class="part_two">
<view class="two_title">提现金额
<text>提现最低额度{{minMoney}}元</text>
</view>
<view class="two_box">
¥
<u-input v-model="money" type="number" :clearable="false" :border="border" placeholder="请输入提现金额" />
</view>
<view class="beizhu">*注单笔限制提现最低额度{{minMoney}}元,最大提现额度为{{manMoney}}元,单笔提现手续费{{shouxufei*100}}%</view>
</view>
<view class="part_three">
<view class="three_name">兑换方式</view>
<view class="btn">
<view class="btn_left" :class="current==2?'btna':''" @click="bindToindex(2)">
<image src="../../../../static/my/weixin.png"></image>
<text>微信</text>
</view>
<view class="btn_right" :class="current==1?'btna':''" @click="bindToindex(1)">
<image src="../../../../static/my/zhifubao.png"></image>
<text>支付宝</text>
</view>
</view>
</view>
<view class="part_four">
<view class="submit" @click="getOut()">立即提现</view>
<view class="four_box">
<view class="box_left" @click="goZhifuBao">
提现账户
</view>
<view class="box_right" @click="list">
提现记录
</view>
<view class="box_right" @click="isShow">
微信收款码
</view>
</view>
</view>
<!-- 微信收款码弹框 -->
<u-popup v-model="show" mode="center">
<view class="padding">
<view class="text-center text-lg text-bold flex justify-between">
<view></view>
<view>添加微信收款码</view>
<view @click="show=false">X</view>
</view>
<!-- <view class="text-center padding-top-sm padding-bottom-lg" style="color: #999999;">请提交微信号和微信二维码
</view> -->
<view style="width: 80%;margin: 0 auto;">
<view class="margin-top" @click.stop="weixin"
style="border: 4rpx solid #010101;border-radius: 16rpx;overflow: hidden;">
<image v-if="!wximg" src="../../../../static/image/erweima.png"></image>
<image v-else :src="wximg" mode=""></image>
</view>
</view>
<!-- <view class="text-center margin-top-sm " @click="submit"
style="border-radius: 10rpx;background-color: #7E59FF;color: #fff;height: 80rpx;line-height: 80rpx;">保存</view> -->
</view>
</u-popup>
</view>
</template>
<script>
import { showToast } from '../../../../common/queue';
export default {
data() {
return {
show: false,
current: '1',
// value: 10,
money: '',
zhifubaoName: '',
zhifubao: '',
shouxufei: 0.01,
minMoney: '10',
manMoney: '200',
mayMoney: '',
XCXIsSelect: '否',
wximg: '',
values: ''
}
},
onLoad() {
this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
if (this.XCXIsSelect == '否') {
uni.setNavigationBarTitle({
title: '隐私政策'
});
} else {
uni.setNavigationBarTitle({
title: '余额提现'
});
}
},
onShow() {
this.getMoney()
//最低可提现金额度
this.$Request.getT('/app/common/type/112').then(res => {
if (res.code === 0) {
this.minMoney = res.data.value
}
});
//最高可提现金额度
this.$Request.getT('/app/common/type/153').then(res => {
if (res.code === 0) {
this.manMoney = res.data.value
}
});
//手续费
this.$Request.getT('/app/common/type/114').then(res => {
if (res.code === 0) {
this.shouxufei = res.data.value
}
});
this.$Request.getT('/app/common/type/290').then(res => { //判断微信提现方式
if (res.code == 0) {
if (res.data && res.data.value) {
this.values = res.data.value
}
}
})
},
methods: {
//用户收款码弹框
isShow() {
this.getMoney()
this.show = true
},
//微信 支付宝提现选择
bindToindex(e) {
this.current = e
console.log(e, this.current)
},
list() {
uni.navigateTo({
url: '/pages/riderMy/myAccount/AcontMoney/cashList'
});
},
goZhifuBao() {
uni.navigateTo({
url: '/pages/riderMy/myAccount/AcontMoney/zhifubao'
});
},
getMoney() {
let that = this;
let token = this.$queue.getData('token');
let userId = this.$queue.getData('userId');
if (token) {
//this.$queue.showLoading("加载中...");
//可以提现金额查询预估收入查询
that.$Request.getT("/app/userinfo/findUserInfoById").then(res => {
if (res.code === 0 && res.data) {
that.mayMoney = res.data.balance;
that.zhifubao = res.data.zhiFuBao;
that.zhifubaoName = res.data.zhiFuBaoName;
that.wximg = res.data.cashQrCode
} else if (res.code === -102) {
that.$queue.showToast(res.msg);
that.$queue.logout();
// uni.navigateTo({
// url: '/pages/public/login'
// });
} else {
that.mayMoney = '0';
//this.$queue.showToast(res.msg);
}
});
}
},
getOut() {
let that = this;
let token = that.$queue.getData('token');
let userId = that.$queue.getData('userId');
if (token) {
if (that.current == 1) {
if (!that.zhifubao || !that.zhifubaoName) {
uni.navigateTo({
url: '/pages/riderMy/myAccount/AcontMoney/zhifubao'
});
return
}
if (!/^\d+$/.test(that.money)) {
// uni.showToast({
// icon: 'none',
// title: '请输入正确金额,不能包含中文,英文,特殊字符和小数'
// });
that.$queue.showToast('请输入正确金额,不能包含中文,英文,特殊字符和小数')
return;
}
if (Number(that.money) < Number(that.minMoney)) {
uni.showToast({
icon: 'none',
title: '提现金额不能小于' + that.minMoney + '元'
});
return;
}
if (Number(that.money) > Number(that.manMoney)) {
uni.showToast({
icon: 'none',
title: '提现金额不能大于' + that.manMoney + '元'
});
return;
}
uni.showModal({
title: '提现申请提示',
content: '请仔细确认收款人信息\n姓名:' + that.zhifubaoName + '\n提现金额:' + that.money + '\n提现手续费:' +
parseFloat(that.money * that.shouxufei).toFixed(2) + '元' + '\n收款账号' + that.zhifubao + '',
success: e => {
if (e.confirm) {
that.$queue.showLoading('提现中...');
that.$Request.getT('/app/cash/cashMoney?classify=' + that.current +
'&money=' + that.money).then(res => {
if (res.code === 0) {
that.$queue.showToast('提现申请成功,预计三个工作日到账');
that.getMoney();
that.mayMoney = ''
} else {
uni.showModal({
title: '温馨提示',
content: res.msg,
showCancel: false,
cancelText: '取消',
confirmText: '确认'
});
}
uni.hideLoading();
});
}
}
});
} else if (that.current == 2) {
if (!/^\d+$/.test(that.money)) {
// uni.showToast({
// icon: 'none',
// title: '请输入正确金额,不能包含中文,英文,特殊字符和小数'
// });
that.$queue.showToast('请输入正确金额,不能包含中文,英文,特殊字符和小数')
return;
}
if (Number(that.money) < Number(that.minMoney)) {
uni.showToast({
icon: 'none',
title: '提现金额不能小于' + that.minMoney + '元'
});
return;
}
if (Number(that.money) > Number(that.manMoney)) {
uni.showToast({
icon: 'none',
title: '提现金额不能大于' + that.manMoney + '元'
});
return;
}
if (that.values == 2) {
that.$Request.getT('/app/userinfo/findUserInfoById').then(res => {
if (res.code === 0) {
let wxImg = res.data.cashQrCode;
if (!wxImg) {
uni.showModal({
title: '提现提示',
content: '请上传微信收款码',
showCancel: true,
cancelText: '取消',
confirmText: '上传',
success: res => {
if (res.confirm) {
that.show = true
}
},
fail: () => {},
complete: () => {}
});
return;
}
if (that.money * 1 >= that.minMoney * 1) {
uni.showModal({
title: '提现申请提示',
content: '金额:' + that.money + '元' + ',' + '手续费:' + (that
.money * that.shouxufei).toFixed(2),
success: e => {
if (e.confirm) {
that.$queue.showLoading('提现中...');
let data = {
money: that.money,
classify: 2
}
that.$Request.getT('/app/cash/cashMoney',
data).then(
res => {
if (res.code === 0) {
setTimeout(function() {
that.$queue.showToast(
'提现申请成功,预计三个工作日到账'
);
}, 1000)
that.getMoney();
that.money = ''
} else {
uni.showModal({
title: '温馨提示',
content: res.msg,
showCancel: false,
cancelText: '取消',
confirmText: '确认'
});
}
uni.hideLoading();
});
}
}
});
} else {
setTimeout(function() {
that.$queue.showToast('提现金额必须大于或等于' + that.minMoney + '元才可提现');
}, 1000)
}
} else {
that.$queue.showToast('网络状态不好,请刷新后重试!');
}
});
} else {
if (!/^\d+$/.test(that.money)) {
// uni.showToast({
// icon: 'none',
// title: '请输入正确金额,不能包含中文,英文,特殊字符和小数'
// });
that.$queue.showToast('请输入正确金额,不能包含中文,英文,特殊字符和小数')
return;
}
if (parseFloat(that.money).toFixed(1) >= that.minMoney) {
uni.showModal({
title: '提现申请提示',
content: '金额:' + that.money + '元' + ',' + '手续费:' + parseFloat(that
.money * that.shouxufei).toFixed(2),
success: e => {
if (e.confirm) {
that.$queue.showLoading('提现中...');
let data = {
money: that.money,
classify: 2,
type: 3
}
that.$Request.getT('/shop/shopmoney/shopCashMoney', data).then(
res => {
if (res.code === 0) {
setTimeout(function() {
that.$queue.showToast(
'提现申请成功,预计三个工作日到账');
}, 1000)
that.getMoney();
that.money =''
} else {
uni.showModal({
title: '温馨提示',
content: res.msg,
showCancel: false,
cancelText: '取消',
confirmText: '确认'
});
that.getMoney();
}
uni.hideLoading();
});
}
}
});
} else {
that.$queue.showToast('提现金额必须大于或等于' + that.minMoney + '元才可提现');
}
}
}
} else {
uni.showToast({
title: '提现失败'
})
}
},
weixin() {
let that = this
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], //从相册选择
success: (res) => {
that.$queue.showLoading("上传中...");
for (let i = 0; i < 1; i++) {
uni.uploadFile({ // 上传接口
url: 'https://tcwm.xianmaxiong.com/sqx_fast/alioss/upload', //真实的接口地址
filePath: res.tempFilePaths[i],
name: 'file',
success: (uploadFileRes) => {
let img = JSON.parse(uploadFileRes.data).data
let userId = that.$queue.getData('userId');
let data = {
cashQrCode: img
}
that.$Request.postJson('/app/user/updateUser',
data).then(
res => {
if (res.code == 0) {
that.getMoney()
setTimeout(function() {
that.$queue.showToast('上传成功')
}, 1000)
}
});
uni.hideLoading();
// that.show = false
}
});
}
}
});
},
}
}
</script>
<style>
body {
background: #F5F5F5;
}
.content {
width: 100%;
}
.part_one {
width: 90%;
margin: 0 auto;
background: #FFFFFF;
margin-top: 20rpx;
border-radius: 20rpx;
height: 170rpx;
}
.one_title {
width: 90%;
margin: 0 auto;
font-size: 32rpx;
letter-spacing: 1rpx;
padding-top: 30rpx;
}
.one_price {
width: 90%;
margin: 0 auto;
margin-top: 20rpx;
font-size: 47rpx;
font-weight: bold;
}
.part_two {
width: 90%;
margin: 0 auto;
background: #FFFFFF;
margin-top: 20rpx;
border-radius: 20rpx;
}
.two_title {
width: 90%;
margin: 0 auto;
line-height: 95rpx;
font-size: 34rpx;
}
.two_title text {
font-size: 27rpx;
margin-left: 34rpx;
}
.two_box {
width: 90%;
margin: 0 auto;
display: flex;
align-items: center;
font-size: 32rpx;
font-weight: bold;
}
.u-input__input {
font-size: 50rpx !important;
color: #747474 !important;
border-bottom: 1rpx solid #cccccc;
}
.tit {
width: 90%;
margin: 0 auto;
font-size: 31rpx;
margin-top: 10rpx;
color: black;
}
.beizhu {
width: 90%;
margin: 0 auto;
line-height: 55rpx;
color: red;
letter-spacing: 1rpx;
}
.part_three {
width: 90%;
margin: 0 auto;
background: #FFFFFF;
margin-top: 20rpx;
border-radius: 20rpx;
}
.three_name {
width: 90%;
margin: 0 auto;
font-size: 33rpx;
color: black;
line-height: 80rpx;
}
.btn {
width: 96%;
margin: 0 auto;
display: flex;
padding-bottom: 30rpx;
}
.btn_left {
flex: 1;
height: 90rpx;
border: 1rpx solid #ccc;
border-radius: 20rpx;
margin-right: 10rpx;
display: flex;
justify-content: center;
align-items: center;
}
.btn_right {
flex: 1;
/* width: 240rpx; */
height: 90rpx;
border: 1rpx solid #ccc;
border-radius: 20rpx;
margin-left: 10rpx;
display: flex;
justify-content: center;
align-items: center;
}
.btna {
border: 1rpx solid #E34B21 !important;
}
.btn_left image {
width: 50rpx;
height: 50rpx;
margin-right: 12rpx;
}
.btn_right image {
width: 50rpx;
height: 50rpx;
margin-right: 12rpx;
}
.part_four {
width: 90%;
margin: 0 auto;
/* background: #FFFFFF; */
margin-top: 20rpx;
border-radius: 20rpx;
}
.submit {
width: 100%;
height: 90rpx;
background: #F8501F;
color: #F8EBD2;
text-align: center;
line-height: 90rpx;
font-size: 37rpx;
border-radius: 12rpx;
}
.four_box {
width: 90%;
margin: 0 auto;
height: 125rpx;
display: flex;
color: #838383;
}
.box_left {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
}
.box_right {
flex: 1;
display: flex;
justify-content: center;
align-items: center;
}
</style>