main
fanfan 7 months ago
parent 4926abaeed
commit ad957b2868
  1. 751
      pages/dealer/withdraw/apply.vue
  2. 2
      pages/news/user/withdrawal.vue

@ -1,361 +1,410 @@
<template> <template>
<view v-if="!isLoading" class="container b-f"> <view v-if="!isLoading" class="container b-f">
<!-- 头部背景图 --> <!-- 头部背景图 -->
<view class="dealer-bg"> <view class="dealer-bg">
<image class="image" mode="widthFix" :src="background"></image> <image class="image" mode="widthFix" :src="background"></image>
</view> </view>
<view class="widget-body"> <view class="widget-body">
<form @submit="handleSubmit"> <form @submit="handleSubmit">
<!-- 提现佣金 --> <!-- 提现佣金 -->
<view class="widget widget__capital m-top20 b-f dis-flex flex-dir-column"> <view class="widget widget__capital m-top20 b-f dis-flex flex-dir-column">
<view class="capital__item dis-flex flex-x-between flex-y-center"> <view class="capital__item dis-flex flex-x-between flex-y-center">
<view class="item__left">{{ words.capital.value }}</view> <view class="item__left">{{ words.capital.value }}</view>
<view class="item__right c-violet"> <view class="item__right c-violet">
<text class="f-24"></text> <text class="f-24"></text>
<text class="f-34">{{ dealer.money }}</text> <text class="f-34">{{ dealer.money }}</text>
</view> </view>
</view> </view>
<view class="capital__item dis-flex flex-y-center"> <view class="capital__item dis-flex flex-y-center">
<view class="item__left">{{ words.money.value }}</view> <view class="item__left">{{ words.money.value }}</view>
<view class="item__right flex-box"> <view class="item__right flex-box">
<input class="input" name="money" :placeholder="words.money_placeholder.value" /> <input class="input" type="digit" name="money" @input="wordsAmount"
</view> :placeholder="words.money_placeholder.value" />
</view> </view>
</view> </view>
<!-- 最低提现金额 --> </view>
<view class="capital__lowest m-top20 col-7 t-r"> <!-- 最低提现金额 -->
{{ words.min_money.value }}{{ settlement.min_money }} <view class="capital__lowest m-top20 col-7 t-r">
</view> {{ words.min_money.value }}{{ settlement.min_money }}
</view>
<!-- 提现方式 -->
<view class="widget widget__form m-top20 b-f dis-flex flex-dir-column"> <!-- 提现方式 -->
<view class="form__title f-28">提现方式</view> <view class="widget widget__form m-top20 b-f dis-flex flex-dir-column">
<view class="form__box"> <view class="form__title f-28">提现方式</view>
<block v-for="(item, index) in settlement.pay_type" :key="index"> <view class="form__box">
<block v-if="item == PayTypeEnum.WECHAT.value"> <block v-for="(item, index) in settlement.pay_type" :key="index">
<!-- 微信支付 --> <block v-if="item == PayTypeEnum.WECHAT.value">
<view class="form__field dis-flex flex-y-center"> <!-- 微信支付 -->
<view class="form__radio dis-flex flex-y-center" @click="handleChecked(PayTypeEnum.WECHAT.value)"> <view class="form__field dis-flex flex-y-center">
<text class="radio__icon iconfont icon-radio" <view class="form__radio dis-flex flex-y-center"
:class="[payment == PayTypeEnum.WECHAT.value ? 'c-violet' : 'col-bb']"></text> @click="handleChecked(PayTypeEnum.WECHAT.value)">
<text class="f-28">{{ PayTypeEnum.WECHAT.name }}</text> <text class="radio__icon iconfont icon-radio"
</view> :class="[payment == PayTypeEnum.WECHAT.value ? 'c-violet' : 'col-bb']"></text>
</view> <text class="f-28">{{ PayTypeEnum.WECHAT.name }}</text>
</block> </view>
<block v-if="item == PayTypeEnum.ALIPAY.value"> </view>
<!-- 支付宝 --> </block>
<view class="form__field dis-flex flex-y-center"> <block v-if="item == PayTypeEnum.ALIPAY.value">
<view class="form__radio dis-flex flex-y-center" @click="handleChecked(PayTypeEnum.ALIPAY.value)"> <!-- 支付宝 -->
<text class="radio__icon iconfont icon-radio" <view class="form__field dis-flex flex-y-center">
:class="[payment == PayTypeEnum.ALIPAY.value ? 'c-violet' : 'col-bb']"></text> <view class="form__radio dis-flex flex-y-center"
<text class="f-28">{{ PayTypeEnum.ALIPAY.name }}</text> @click="handleChecked(PayTypeEnum.ALIPAY.value)">
</view> <text class="radio__icon iconfont icon-radio"
</view> :class="[payment == PayTypeEnum.ALIPAY.value ? 'c-violet' : 'col-bb']"></text>
<block v-if="payment == PayTypeEnum.ALIPAY.value"> <text class="f-28">{{ PayTypeEnum.ALIPAY.name }}</text>
<view class="form__field"> </view>
<view class="field-input"> </view>
<input class="input" name="alipay_name" placeholder="请输入真实姓名" /> <block v-if="payment == PayTypeEnum.ALIPAY.value">
</view> <view class="form__field">
</view> <view class="field-input">
<view class="form__field"> <input class="input" name="alipay_name" placeholder="请输入真实姓名" />
<view class="field-input"> </view>
<input class="input" name="alipay_account" placeholder="请输入支付宝账号" /> </view>
</view> <view class="form__field">
</view> <view class="field-input">
</block> <input class="input" name="alipay_account" placeholder="请输入支付宝账号" />
</block> </view>
<block v-if="item == PayTypeEnum.BANK_CARD.value"> </view>
<!-- 银行卡 --> </block>
<view class="form__field dis-flex flex-y-center"> </block>
<view class="form__radio dis-flex flex-y-center" @click="handleChecked(PayTypeEnum.BANK_CARD.value)"> <block v-if="item == PayTypeEnum.BANK_CARD.value">
<text class="radio__icon iconfont icon-radio" <!-- 银行卡 -->
:class="[payment == PayTypeEnum.BANK_CARD.value ? 'c-violet' : 'col-bb']"></text> <view class="form__field dis-flex flex-y-center">
<text class="f-28">{{ PayTypeEnum.BANK_CARD.name }}</text> <view class="form__radio dis-flex flex-y-center"
</view> @click="handleChecked(PayTypeEnum.BANK_CARD.value)">
</view> <text class="radio__icon iconfont icon-radio"
<block v-if="payment == PayTypeEnum.BANK_CARD.value"> :class="[payment == PayTypeEnum.BANK_CARD.value ? 'c-violet' : 'col-bb']"></text>
<view class="form__field"> <text class="f-28">{{ PayTypeEnum.BANK_CARD.name }}</text>
<view class="field-input"> </view>
<input class="input" name="bank_name" placeholder="请输入真实姓名" /> </view>
</view> <block v-if="payment == PayTypeEnum.BANK_CARD.value">
</view> <view class="form__field">
<view class="form__field"> <view class="field-input">
<view class="field-input"> <input class="input" name="bank_name" placeholder="请输入真实姓名" />
<input class="input" name="bank_account" placeholder="请输入开户行名称/地址" /> </view>
</view> </view>
</view> <view class="form__field">
<view class="form__field"> <view class="field-input">
<view class="field-input"> <input class="input" name="bank_account" placeholder="请输入开户行名称/地址" />
<input class="input" name="bank_card" placeholder="请输入银行卡号" /> </view>
</view> </view>
</view> <view class="form__field">
</block> <view class="field-input">
</block> <input class="input" name="bank_card" placeholder="请输入银行卡号" />
</block> </view>
</view> </view>
</view> </block>
<!-- 提交申请 --> </block>
<view class="form-submit dis-flex flex-x-center"> </block>
<button formType="submit" :disabled="disabled">{{ words.submit.value }}</button> </view>
</view> </view>
</form> <!-- 提交申请 -->
</view> <view class="form-submit dis-flex flex-x-center">
</view> <button formType="submit" :disabled="disabled">{{ words.submit.value }}</button>
</view>
</form>
</view>
</view>
</template> </template>
<script> <script>
import * as DealerApi from '@/api/dealer' import * as DealerApi from '@/api/dealer'
import * as WithdrawApi from '@/api/dealer/withdraw' import * as WithdrawApi from '@/api/dealer/withdraw'
import SettingModel from '@/common/model/dealer/Setting' import SettingModel from '@/common/model/dealer/Setting'
import { PayTypeEnum } from '@/common/enum/dealer/withdraw' import {
PayTypeEnum
export default { } from '@/common/enum/dealer/withdraw'
data() {
return { export default {
// data() {
PayTypeEnum, return {
// //
isLoading: true, PayTypeEnum,
// //
dealer: undefined, isLoading: true,
// () //
payment: undefined, dealer: undefined,
// // ()
settlement: undefined, payment: undefined,
// //
words: undefined, settlement: undefined,
// //
background: undefined, words: undefined,
// //
disabled: false background: undefined,
} //
}, disabled: false
}
/** },
* 生命周期函数--监听页面加载
*/ /**
onLoad(options) { * 生命周期函数--监听页面加载
this.getSetting() */
this.getDealer() onLoad(options) {
}, this.getSetting()
this.getDealer()
methods: { },
// methods: {
getSetting() { wordsAmount(e) {
const app = this console.log(this.words.money)
SettingModel.data() let amount = e.detail.value
.then(setting => { let num = null
// num = amount.replace(new RegExp('^(\\d+\\.\\d{2}).+'), '$1')
app.payment = setting.settlement.pay_type[0] const startPoint = /^\./g
app.settlement = setting.settlement if (startPoint.test(num)) {
app.words = setting.words.withdraw_apply.words num = amount.replace(startPoint, '0.')
app.background = setting.background.withdraw_apply }
// if (num && !num.includes('.') && num !== '0') {
app.setPageTitle(setting.words.withdraw_apply.title) num = +num
}) }
}, const morePoint = /\.+(\d*|\.+)\./g
if (morePoint.test(num)) {
// num = amount
getDealer() { .replace(/\.{2,}/g, ".")
const app = this .replace(".", "$#$")
app.isLoading = true .replace(/\./g, "")
DealerApi.user() .replace("$#$", ".")
.then(result => app.dealer = result.data.dealer) }
.finally(() => app.isLoading = false) if (num > Number(this.settlement.min_money)) { // value100, 100100
}, uni.showToast({
title: this.settlement.min_money > 0 ? `最多可用${Number(this.settlement.min_money)}元, 请重新输入` : '暂无可提现金额',
// icon: 'none',
setPageTitle(title) { duration: 2000
uni.setNavigationBarTitle({ title: title.value }) })
}, // this.words.money = this.settlement.min_money > 0 ? this.settlement.min_money : ''
this.$forceUpdate();
// } else {
handleChecked(value) { if (!num) { // value,amount0,
this.payment = value this.words.money = ''
}, this.$forceUpdate();
} else {
// // this.words.money = num
handleSubmit({ detail }) { this.$forceUpdate();
const app = this }
// }
if (!app.onValidation(detail.value)) { },
return false //
} getSetting() {
// const app = this
uni.showModal({ SettingModel.data()
title: '友情提示', .then(setting => {
content: '确定提交提现申请吗?请确认填写无误', //
showCancel: true, app.payment = setting.settlement.pay_type[0]
success(res) { app.settlement = setting.settlement
if (res.confirm) { app.words = setting.words.withdraw_apply.words
app.onSubmit(detail.value) app.background = setting.background.withdraw_apply
} else if (res.cancel) { //
app.disabled = false app.setPageTitle(setting.words.withdraw_apply.title)
} })
} },
})
}, //
getDealer() {
// const app = this
onSubmit(data) { app.isLoading = true
const app = this DealerApi.user()
app.disabled = true .then(result => app.dealer = result.data.dealer)
data.pay_type = app.payment .finally(() => app.isLoading = false)
WithdrawApi.submit({ form: data }) },
.then(result => {
app.$toast(result.message) //
setTimeout(() => uni.navigateBack(), 1200) setPageTitle(title) {
}) uni.setNavigationBarTitle({
.finally(() => app.disabled = false) title: title.value
}, })
},
//
onValidation(data) { //
const app = this handleChecked(value) {
const words = app.words this.payment = value
// },
if (app.dealer.money <= 0) {
app.$error('当前没有' + words.capital.value) //
return false handleSubmit({
} detail
// }) {
if (!data.money || data.money.length < 1) { const app = this
app.$error('请填写' + words.money.value) //
return false if (!app.onValidation(detail.value)) {
} return false
return true }
} //
uni.showModal({
} title: '友情提示',
} content: '确定提交提现申请吗?请确认填写无误',
showCancel: true,
success(res) {
if (res.confirm) {
app.onSubmit(detail.value)
} else if (res.cancel) {
app.disabled = false
}
}
})
},
//
onSubmit(data) {
const app = this
app.disabled = true
data.pay_type = app.payment
WithdrawApi.submit({
form: data
})
.then(result => {
app.$toast(result.message)
setTimeout(() => uni.navigateBack(), 1200)
})
.finally(() => app.disabled = false)
},
//
onValidation(data) {
const app = this
const words = app.words
//
if (app.dealer.money <= 0) {
app.$error('当前没有' + words.capital.value)
return false
}
//
if (!data.money || data.money.length < 1) {
app.$error('请填写' + words.money.value)
return false
}
return true
}
}
}
</script> </script>
<style> <style>
page { page {
background: #fff; background: #fff;
} }
</style> </style>
<style lang="scss" scoped> <style lang="scss" scoped>
.input { .input {
display: block; display: block;
} }
.c-violet { .c-violet {
color: #786cff; color: #786cff;
} }
.col-bb { .col-bb {
color: #bbb; color: #bbb;
} }
.dealer-bg { .dealer-bg {
.image { .image {
width: 100%; width: 100%;
} }
} }
.widget-body { .widget-body {
position: relative; position: relative;
width: 88%; width: 88%;
margin: 0 auto; margin: 0 auto;
.widget { .widget {
box-sizing: border-box; box-sizing: border-box;
box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.11); box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.11);
border-radius: 12rpx; border-radius: 12rpx;
} }
} }
// //
.widget__capital { .widget__capital {
padding: 10rpx 0; padding: 10rpx 0;
margin-top: -60rpx; margin-top: -60rpx;
.capital__item { .capital__item {
height: 80rpx; height: 80rpx;
padding: 10rpx 35rpx; padding: 10rpx 35rpx;
font-size: 28rpx; font-size: 28rpx;
border-bottom: 1rpx solid #e7e7e7; border-bottom: 1rpx solid #e7e7e7;
box-sizing: border-box; box-sizing: border-box;
&:last-child { &:last-child {
border-bottom: none; border-bottom: none;
} }
.item__left { .item__left {
margin-right: 20rpx; margin-right: 20rpx;
} }
.item__right { .item__right {
.input { .input {
font-size: 28rpx; font-size: 28rpx;
text-align: right; text-align: right;
} }
} }
} }
} }
.capital__lowest { .capital__lowest {
padding-right: 20rpx; padding-right: 20rpx;
box-sizing: border-box; box-sizing: border-box;
font-size: 26rpx; font-size: 26rpx;
} }
// //
.widget__form { .widget__form {
padding: 10rpx 0 20rpx 0; padding: 10rpx 0 20rpx 0;
.form__title { .form__title {
padding: 16rpx 35rpx; padding: 16rpx 35rpx;
border-bottom: 1rpx solid #f3f3f3; border-bottom: 1rpx solid #f3f3f3;
} }
.form__box { .form__box {
padding: 20rpx 35rpx; padding: 20rpx 35rpx;
} }
.form__field { .form__field {
height: 80rpx; height: 80rpx;
padding: 0; padding: 0;
box-sizing: border-box; box-sizing: border-box;
font-size: 28rpx; font-size: 28rpx;
margin-bottom: 10rpx; margin-bottom: 10rpx;
.radio__icon { .radio__icon {
font-size: 38rpx; font-size: 38rpx;
margin-right: 12rpx; margin-right: 12rpx;
} }
.field-input { .field-input {
.input { .input {
background-color: #f9f9f9; background-color: #f9f9f9;
padding: 16rpx 20rpx; padding: 16rpx 20rpx;
font-size: 28rpx; font-size: 28rpx;
} }
} }
} }
} }
// //
.form-submit { .form-submit {
margin-top: 40rpx; margin-top: 40rpx;
button { button {
font-size: 30rpx; font-size: 30rpx;
background: #786cff; background: #786cff;
border: 1rpx solid #786cff; border: 1rpx solid #786cff;
color: white; color: white;
border-radius: 50rpx; border-radius: 50rpx;
padding: 0 120rpx; padding: 0 120rpx;
} }
button[disabled] { button[disabled] {
background: #8e84fc; background: #8e84fc;
border-color: #8e84fc; border-color: #8e84fc;
color: white; color: white;
} }
} }
</style> </style>

@ -306,7 +306,6 @@
.replace(/\./g, "") .replace(/\./g, "")
.replace("$#$", ".") .replace("$#$", ".")
} }
console.log(num)
if (num > Number(this.balance)) { // value100, 100100 if (num > Number(this.balance)) { // value100, 100100
uni.showToast({ uni.showToast({
title: this.balance > 0 ? `最多可用${Number(this.balance)}元, 请重新输入` : '暂无可提现金额', title: this.balance > 0 ? `最多可用${Number(this.balance)}元, 请重新输入` : '暂无可提现金额',
@ -324,7 +323,6 @@
this.$forceUpdate(); this.$forceUpdate();
} }
} }
}, },
allMoeny() { // allMoeny() { //
this.obj.money = this.balance this.obj.money = this.balance

Loading…
Cancel
Save