| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429 |
- <template>
- <view class="container">
- <view class="fix">
- <view class="top"></view>
- <view class="head">
- <span class="cuIcon-back" @click="back"></span>
- <view class="case"> 申请提现 </view>
- </view>
- </view>
- <view class="form-card">
- <view class="section-input">
- <view class="label">提现金额 <i class="text-bg"></i></view>
- <view class="input-row">
- <text class="currency-symbol">¥</text>
- <u-input
- type="digit"
- height="80"
- placeholder="请输入提现金额"
- :customStyle="{
- fontSize: '42rpx',
- padding: '0 10rpx',
- marginTop: '10rpx',
- }"
- v-model="withdrawalAmount"
- @input="handleInput"
- ></u-input>
- </view>
- <view v-if="isExceeded" class="error">输入金额超过可提现余额</view>
- <view class="balance-info">
- <text>可提现余额{{ availableAmount }}元,</text>
- <text>手续费每笔{{ handlingFee }}元</text>
- <text class="all-withdraw-btn" @click="allWithdraw">全部提现</text>
- </view>
- </view>
- </view>
- <view class="form-card">
- <view class="label">账户信息 <i class="text-bg"></i></view>
- <view class="bank-info">
- <view class="bank-label">银行账户</view>
- <view class="u-flex">
- <u-image :src="bankCardInfo.bankLogo" width="42rpx" height="42rpx"></u-image>
- <view class="bank-number">{{ bankCardInfo.bankName }}({{ bankCardInfo.bankCardNumber }})</view>
- </view>
- </view>
- </view>
- <view class="form-card">
- <view class="u-flex justify-between">
- <view class="title">开票信息<i class="text-bg"></i></view>
- <view class="note">注:提现申请请上传开票凭证</view>
- </view>
- <view class="invoice-info">
- <text class="title">发票抬头</text>
- <text class="value">{{ invoiceInfo.companyName }}</text>
- </view>
- <view class="invoice-info">
- <text class="title">纳税人识别号</text>
- <text>{{ invoiceInfo.taxNo }}</text>
- </view>
- <view class="invoice-info">
- <text class="title">地址详情</text>
- <text class="value">{{ invoiceInfo.address }} {{ invoiceInfo.phone }}</text>
- </view>
- <view class="invoice-info last">
- <text class="title">开户银行及账号</text>
- <text class="value">{{ invoiceInfo.openingBank }} {{ invoiceInfo.bankAccount }}</text>
- </view>
- </view>
- <view class="form-card">
- <view class="label">上传发票 <i class="text-bg"></i></view>
- <u-upload
- ref="uUpload"
- :action="action"
- :file-list="billList"
- @on-success="handleSuccess"
- @on-remove="handleRemove"
- @on-choose-complete="onChooseComplete"
- max-count="5"
- multiple
- previewFullImage
- :auto-upload="true"
- customBtn
- width="146rpx"
- height="146rpx"
- >
- <template slot="addBtn">
- <image src="/static/coupon/upload.png" mode="widthFix" style="width: 146rpx; height: 146rpx"></image>
- </template>
- </u-upload>
- </view>
- <view class="footer-bar">
- <u-button
- type="primary"
- :disabled="!withdrawalAmount || parseFloat(withdrawalAmount) <= 0 || isExceeded"
- @click="applyWithdrawal"
- >提现</u-button
- >
- </view>
- </view>
- </template>
- <script>
- import api from '@/api/account';
- import configService from '@/common/service/config.service';
- import { formatAmount } from '@/common/util/util';
- export default {
- data() {
- return {
- formatAmount,
- action: configService.apiUrl + '/sys/common/upload',
- imageHttp: configService.apiUrl + '/',
- billList: [], //发票回显
- uploadedFiles: [], //已上传文件列表
- bankCard: {},
- availableAmount: '', // 当前可提现余额
- handlingFee: 0, // 手续费
- withdrawalAmount: '', // 提现金额输入框的值
- isExceeded: false, // 是否超过可提现余额
- bankCardInfo: {}, // 银行卡信息
- invoiceInfo: {}, // 开票信息
- };
- },
- watch: {
- withdrawalAmount(newVal, oldVal) {
- // 检查金额是否超过可提现余额
- if (parseFloat(newVal) > parseFloat(this.availableAmount)) {
- this.isExceeded = true;
- } else {
- this.isExceeded = false;
- }
- },
- },
- onShow() {
- this.init();
- },
- formatAmount,
- methods: {
- // 初始化提现数据
- async init() {
- const res = await api.initWithdrawalData();
- if (res.data.code === 200 && res.data.result) {
- const data = res.data.result;
- this.availableAmount = data.availableAmount;
- this.handlingFee = data.handlingFee;
- this.bankCardInfo = data.bankCardInfo;
- this.invoiceInfo = data.invoiceInfo;
- }
- },
- handleInput(val) {
- if (!val) {
- this.withdrawalAmount = '';
- return;
- }
- /// 保留2位小数
- val = val.replace(/(\.\d{2})\d+/g, '$1');
- // 处理前导0
- val = val.replace(/^0+(?=\d)/, '');
- this.$nextTick(() => {
- this.withdrawalAmount = val;
- });
- },
- // 上传发票
- handleSuccess(res) {
- if (res.code === 0) {
- this.uploadedFiles.push(this.imageHttp + res.message);
- console.log(this.uploadedFiles);
- } else {
- uni.showToast({
- title: '上传失败: ' + res.message,
- icon: 'none',
- });
- }
- },
- // 移除图片
- handleRemove(index) {
- this.uploadedFiles.splice(index, 1);
- },
- // 选择图片
- onChooseComplete(lists) {
- this.billList = lists;
- },
- // 全部提现
- allWithdraw() {
- this.withdrawalAmount = this.availableAmount;
- },
- // 申请提现
- applyWithdrawal() {
- // if (!this.uploadedFiles.length) {
- // uni.showToast({
- // title: '请上传发票',
- // icon: 'none',
- // });
- // return;
- // }
- uni.showLoading({ title: '提交中' });
- api
- .applyWithdrawal({
- applyAmount: this.withdrawalAmount,
- bankCardId: this.bankCardInfo.bankCardId,
- handlingFee: this.handlingFee,
- invoiceImgs: this.uploadedFiles,
- })
- .then((res) => {
- if (res.data.code === 200) {
- uni.hideLoading();
- uni.showToast({ title: '提现申请成功', icon: 'success' });
- setTimeout(() => {
- uni.navigateTo({
- url: '/pages/finance/submitted',
- });
- }, 1500);
- } else {
- uni.hideLoading();
- uni.showToast({ title: res.data.message, icon: 'none' });
- }
- });
- },
- back() {
- uni.navigateBack({
- delta: 1,
- });
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- .container {
- min-height: 100vh;
- background-color: #f7f8fc;
- font-family: Source Han Sans SC;
- font-weight: 400;
- padding-bottom: 120rpx;
- .fix {
- position: sticky;
- top: 0;
- z-index: 999;
- /*#ifdef APP-PLUS*/
- .top {
- width: 100%;
- height: var(--status-bar-height);
- background: #fff;
- }
- /*#endif*/
- .head {
- width: 100%;
- height: 112rpx;
- padding: 20rpx;
- display: flex;
- align-items: center;
- background: #fff;
- position: relative;
- border-bottom: 1rpx solid #eeeeee;
- .cuIcon-back {
- font-size: 40rpx;
- margin-right: 40rpx;
- }
- .case {
- position: absolute;
- left: 50%;
- transform: translateX(-50%);
- font-weight: 500;
- font-size: 38rpx;
- color: #333333;
- }
- }
- }
- .form-card {
- background-color: #fff;
- padding: 30rpx;
- margin-bottom: 30rpx;
- padding: 17rpx 31rpx 21rpx;
- box-shadow: 0rpx 2rpx 8rpx 0rpx rgba(214, 225, 237, 0.1);
- .label {
- font-size: 30rpx;
- color: #333333;
- margin-bottom: 21rpx;
- .text-bg {
- width: 120rpx;
- }
- }
- }
- }
- // 提现至:银行卡选择区域
- .section-item {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 30rpx 0;
- border-bottom: 1rpx solid #eee;
- .label {
- font-weight: 500;
- font-size: 31rpx;
- color: #333333;
- }
- .content {
- display: flex;
- align-items: center;
- }
- }
- // 提现金额输入区域
- .section-input {
- .input-row {
- display: flex;
- align-items: center;
- padding: 20rpx 0;
- border-bottom: 1rpx solid #eee;
- .currency-symbol {
- font-weight: bold;
- font-size: 54rpx;
- color: #333333;
- padding-right: 23rpx;
- }
- }
- .error {
- text-align: right;
- font-size: 25rpx;
- color: #e55e4f;
- }
- .balance-info {
- font-size: 26rpx;
- color: rgba(51, 51, 51, 0.6);
- margin-top: 16rpx;
- font-family: Source Han Sans CN;
- .all-withdraw-btn {
- font-size: 27rpx;
- color: #2d4d89;
- margin-left: 10rpx;
- &:active {
- opacity: 0.8;
- }
- }
- }
- }
- // 银行信息
- .bank-info {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 44rpx;
- .bank-label {
- font-size: 29rpx;
- color: #666666;
- }
- .bank-number {
- padding: 0 0 5rpx 2rpx;
- font-size: 31rpx;
- color: #333333;
- }
- }
- // 开票信息区域
- .note {
- font-size: 27rpx;
- color: #999999;
- margin-bottom: 26rpx;
- }
- .invoice-info {
- padding: 21rpx 0;
- display: flex;
- justify-content: space-between;
- border-bottom: 1rpx solid #eeeeee;
- .title {
- font-size: 29rpx;
- color: #666666;
- }
- .value {
- font-size: 31rpx;
- color: #333333;
- max-width: 450rpx;
- text-align: right;
- }
- }
- .last {
- border-bottom: none;
- }
- // 底部按钮
- .footer-bar {
- z-index: 999;
- ::v-deep .u-btn {
- width: 100%;
- height: 76rpx;
- border-radius: 54rpx;
- background: linear-gradient(90deg, #77b6ff 0%, #449aff 100%);
- &.u-btn--primary--disabled {
- background: #a0cfff;
- }
- }
- }
- ::v-deep {
- .u-delete-icon {
- background-color: rgba(0, 0, 0, 0.6) !important;
- }
- }
- </style>
|