123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607 |
- <template>
- <view :style="colorStyle">
- <view class='cash-withdrawal'>
- <view class='nav acea-row' v-if="navList.length>1">
- <view v-for="(item,index) in navList" :key="index" class='item fontcolor' @click="swichNav(item.id)">
- <view class='line bg-color' :class='currentTab==item.id ? "on":""'></view>
- <view class='iconfont' :class='item.icon+" "+(currentTab==item.id ? "on":"")'></view>
- <view>{{item.name}}</view>
- </view>
- </view>
- <view class='wrapper'>
- <view :hidden='currentTab != 0' class='list'>
- <form @submit="subCash">
- <view class='item acea-row row-between-wrapper'>
- <view class='name'>持卡人</view>
- <view class='input'><input placeholder='请输入持卡人姓名' placeholder-class='placeholder'
- name="name" onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;"></input></view>
- </view>
- <view class='item acea-row row-between-wrapper'>
- <view class='name'>卡号</view>
- <view class='input'><input type='number' placeholder='请填写卡号' placeholder-class='placeholder'
- name="cardnum"></input></view>
- </view>
- <view class='item acea-row row-between-wrapper'>
- <view class='name'>银行</view>
- <view class='input'>
- <picker @change="bindPickerChange" :value="index" :range="array">
- <text class='Bank'>{{array[index]}}</text>
- <text class='iconfont icon-qiepian38'></text>
- </picker>
- </view>
- </view>
- <view class='item acea-row row-between-wrapper'>
- <view class='name'>类型</view>
- <view class='input'>
- <picker @change="typePickerChange" :value="index" :range="typeMoney" range-key="name">
- <text class='Bank'>{{typeMoney[typeIndex].name}}</text>
- <text class='iconfont icon-qiepian38'></text>
- </picker>
- </view>
- </view>
- <view class='item acea-row row-top row-between'>
- <view class='name'>凭证</view>
- <view class="input acea-row">
- <view class="picEwm" v-if="qrcodeUrPZ">
- <image :src="qrcodeUrPZ"></image>
- <text class='iconfont icon-guanbi1 fontcolor' @click='DelPicP'></text>
- </view>
- <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic("P")'
- v-else>
- <text class='iconfont icon-icon25201'></text>
- <view>上传图片</view>
- </view>
- </view>
- </view>
- <view class='item acea-row row-between-wrapper'>
- <view class='name'>提取</view>
- <view class='input'><input v-model="allMoney" @input='inputNum' :maxlength="moneyMaxLeng" :placeholder='"最低提取金额:¥"+minPrice' placeholder-class='placeholder'
- name="money" type='digit'></input></view>
- </view>
- <view class='tip'>
- 当前可提取金额: <text
- class="price">¥{{userInfo.commissionCount}}</text>,冻结佣金:¥{{userInfo.broken_commission}}
- </view>
- <view class='tip'>
- 提取手续费: <text class="price">¥{{withdraw_fee}}</text>,实际到账:<text class="price">¥{{true_money}}</text>
- </view>
- <view class='tip'>
- 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提取
- </view>
- <button formType="submit" class='bnt bg-color'>提取</button>
- </form>
- </view>
- <view :hidden='currentTab != 1' class='list'>
- <form @submit="subCash">
- <view class='item acea-row row-between-wrapper' v-if="extract_wechat_type == 0">
- <view class='name'>账号</view>
- <view class='input'><input placeholder='请填写您的微信账号' placeholder-class='placeholder'
- name="name" onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;"></input></view>
- </view>
- <view class='item acea-row row-between-wrapper'>
- <view class='name'>提取</view>
- <view class='input'><input @input='inputNum' :maxlength="moneyMaxLeng" :placeholder='"最低提取金额:¥"+minPrice' placeholder-class='placeholder'
- name="money" type='digit'></input></view>
- </view>
- <view class='item acea-row row-top row-between' v-if="extract_wechat_type == 0">
- <view class='name'>收款码</view>
- <view class="input acea-row">
- <view class="picEwm" v-if="qrcodeUrlW">
- <image :src="qrcodeUrlW"></image>
- <text class='iconfont icon-guanbi1 fontcolor' @click='DelPicW'></text>
- </view>
- <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic("W")'
- v-else>
- <text class='iconfont icon-icon25201'></text>
- <view>上传图片</view>
- </view>
- </view>
- </view>
- <view class='tip'>
- 当前可提取金额: <text
- class="price">¥{{userInfo.commissionCount}}</text>,冻结佣金:¥{{userInfo.broken_commission}}
- </view>
- <view class='tip'>
- 提取手续费: <text class="price">¥{{withdraw_fee}}</text>,实际到账:<text class="price">¥{{true_money}}</text>
- </view>
- <view class='tip'>
- 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提取
- </view>
- <button formType="submit" class='bnt bg-color'>提取</button>
- </form>
- </view>
- <view :hidden='currentTab != 2' class='list'>
- <form @submit="subCash">
- <view class='item acea-row row-between-wrapper'>
- <view class='name'>账号</view>
- <view class='input'><input placeholder='请填写您的支付宝账号' placeholder-class='placeholder'
- name="name" onKeypress="javascript:if(event.keyCode == 32)event.returnValue = false;"></input></view>
- </view>
- <view class='item acea-row row-between-wrapper'>
- <view class='name'>提取</view>
- <view class='input'><input @input='inputNum' :maxlength="moneyMaxLeng" :placeholder='"最低提取金额:¥"+minPrice' placeholder-class='placeholder'
- name="money" type='digit'></input></view>
- </view>
- <view class='item acea-row row-top row-between'>
- <view class='name'>收款码</view>
- <view class="input acea-row">
- <view class="picEwm" v-if="qrcodeUrlZ">
- <image :src="qrcodeUrlZ"></image>
- <text class='iconfont icon-guanbi1 fontcolor' @click='DelPicZ'></text>
- </view>
- <view class='pictrue acea-row row-center-wrapper row-column' @click='uploadpic("Z")'
- v-else>
- <text class='iconfont icon-icon25201'></text>
- <view>上传图片</view>
- </view>
- </view>
- </view>
- <view class='tip'>
- 当前可提取金额: <text
- class="price">¥{{userInfo.commissionCount}}</text>,冻结佣金:¥{{userInfo.broken_commission}}
- </view>
- <view class='tip'>
- 提取手续费: <text class="price">¥{{withdraw_fee}}</text>,实际到账:<text class="price">¥{{true_money}}</text>
- </view>
- <view class='tip'>
- 说明: 每笔佣金的冻结期为{{userInfo.broken_day}}天,到期后可提取
- </view>
- <button formType="submit" class='bnt bg-color'>提取</button>
- </form>
- </view>
- </view>
- </view>
- <!-- #ifdef MP -->
- <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
- <!-- #endif -->
- <home v-if="navigation"></home>
- </view>
- </template>
- <script>
- import {
- extractCash,
- extractBank,
- getUserInfo
- } from '@/api/user.js';
- import {
- toLogin
- } from '@/libs/login.js';
-
- import {
- calculator,
- } from '@/api/new.js';
-
- import {
- mapGetters
- } from "vuex";
- import colors from '@/mixins/color.js';
- import home from '@/components/home';
- export default {
- components: {
- home
- },
- mixins:[colors],
- data() {
- return {
- navList: [],
- currentTab: '',
- index: 0,
- array: [], //提取银行
- typeIndex:0,
- typeMoney: [{
- name:'个人',
- value:0
- },{
- name:'企业',
- value:1
- }], //提取银行
- minPrice: 0.00, //最低提取金额
- userInfo: [],
- isClone: false,
- isAuto: false, //没有授权的不会自动授权
- isShowAuth: false, //是否隐藏授权
- qrcodeUrlW: "",
- qrcodeUrlZ: "",
- qrcodeUrPZ: "",
- prevent: true, //避免重复提交成功多次
- moneyMaxLeng: 8,
- withdraw_fee: '0',
- true_money: 0,
- extract_wechat_type:0,
- allMoney:'',//保存当前提取金额
- };
- },
- computed: mapGetters(['isLogin']),
- watch: {
- isLogin: {
- handler: function(newV, oldV) {
- if (newV) {
- this.getUserInfo();
- this.getUserExtractBank();
- }
- },
- deep: true
- }
- },
- onLoad() {
- if (this.isLogin) {
- this.getUserInfo();
- this.getUserExtractBank();
- } else {
- toLogin()
- }
- },
- onShow() {
- uni.removeStorageSync('form_type_cart');
- },
- methods: {
- inputNum: async function(e) {
- let val = e.detail.value;
- let dot = val.indexOf('.');
- if(dot>-1){
- this.moneyMaxLeng = dot+3;
- }else{
- this.moneyMaxLeng = 8
- }
- try{
- let money = await calculator({money:val,user_type:this.typeMoney[this.typeIndex].value});
- this.withdraw_fee = money.data.fee;
- this.true_money = val - this.withdraw_fee;
- }catch(e){
- uni.showToast({
- title: e,
- icon:"error"
- });
- //TODO handle the exception
- }
-
- },
- // uploadpicW(){
- // this.uploadpic(this.qrcodeUrlW);
- // },
- // uploadpicZ(){
- // this.uploadpic(this.qrcodeUrlZ);
- // },
- /**
- * 上传文件
- *
- */
- uploadpic: function(type) {
- let that = this;
- uni.showModal({
- title: "相机权限申请",
- content: "是否允许访问相机及存储空间用于上传凭证?",
- success(res) {
- if (res.confirm) {
- that.$util.uploadImageOne('upload/image', function(res) {
- if (type === 'W') {
- that.qrcodeUrlW = res.data.url;
- } else if(type=="Z"){
- that.qrcodeUrlZ = res.data.url;
- }else if(type=="P"){
- that.qrcodeUrPZ = res.data.url;
- }
- });
- }
- }
- })
- },
- /**
- * 删除图片
- *
- */
- DelPicW: function() {
- this.qrcodeUrlW = "";
- },
- DelPicZ: function() {
- this.qrcodeUrlZ = "";
- },
- DelPicP: function() {
- this.qrcodeUrPZ = "";
- },
- onLoadFun: function() {
- this.getUserInfo();
- this.getUserExtractBank();
- this.isShowAuth = false;
- },
- // 授权关闭
- authColse: function(e) {
- this.isShowAuth = e
- },
- getUserExtractBank: function() {
- let that = this;
- extractBank().then(res => {
- let array = res.data.extractBank;
- array.unshift("请选择银行");
- that.$set(that, 'array', array);
- that.minPrice = res.data.minPrice;
- that.extract_wechat_type = res.data.extract_wechat_type;
- });
- },
- /**
- * 获取个人用户信息
- */
- getUserInfo: function() {
- let that = this;
- getUserInfo().then(res => {
- that.userInfo = res.data;
- if(res.data.user_extract_bank_status){
- this.navList.push(
- {
- 'name': '银行卡',
- 'icon': 'icon-yinhangqia',
- 'id': 0
- }
- )
- }
- if(res.data.user_extract_wechat_status){
- this.navList.push(
- {
- 'name': '微信',
- 'icon': 'icon-weixin2',
- 'id': 1
- }
- )
- }
- if(res.data.user_extract_alipay_status){
- this.navList.push(
- {
- 'name': '支付宝',
- 'icon': 'icon-icon34',
- 'id': 2
- }
- )
- }
- this.currentTab = this.navList[0].id;
- })
- },
- swichNav: function(current) {
- this.currentTab = current;
- },
- bindPickerChange: function(e) {
- this.index = e.detail.value;
- },
- typePickerChange(e){
- this.typeIndex = e.detail.value;
- this.inputNum({detail:{value:this.allMoney}});
- },
- subCash: function(e) {
- let that = this,
- value = e.detail.value;
-
- if(!that.qrcodeUrPZ){
- that.$util.Tips({
- title: '请上传凭证'
- })
- return
- }
- value.image = that.qrcodeUrPZ;
-
- if (that.currentTab == 0) { //银行卡
- if (value.name.length == 0) return that.$util.Tips({
- title: '请填写持卡人姓名'
- });
- if (value.cardnum.length == 0) return that.$util.Tips({
- title: '请填写卡号'
- });
- if (that.index == 0) return that.$util.Tips({
- title: "请选择银行"
- });
- value.extract_type = 'bank';
- value.bankname = that.array[that.index];
- } else if (that.currentTab == 1) { //微信
- value.extract_type = 'weixin';
- if(that.extract_wechat_type == 0){
- if (value.name.length == 0) return that.$util.Tips({
- title: '请填写微信号'
- });
- if (that.qrcodeUrlW == '') return that.$util.Tips({
- title: '请上传图片'
- });
- value.weixin = value.name;
- value.qrcode_url = that.qrcodeUrlW;
- }
- } else if (that.currentTab == 2) { //支付宝
- value.extract_type = 'alipay';
- if (value.name.length == 0) return that.$util.Tips({
- title: '请填写账号'
- });
- if (that.qrcodeUrlZ == '') return that.$util.Tips({
- title: '请上传图片'
- });
- value.alipay_code = value.name;
- value.qrcode_url = that.qrcodeUrlZ;
- }
- if (value.money.length == 0) return that.$util.Tips({
- title: '请填写提取金额'
- });
- if (Number(value.money) < Number(that.minPrice)) return that.$util.Tips({
- title: '提取金额不能低于:¥' + that.minPrice
- });
- if (that.prevent) {
- that.prevent = false
- } else {
- return
- }
- extractCash({
- ...value,
- user_type:that.typeMoney[that.typeIndex].value
- }).then(res => {
- //that.getUserInfo();
- return this.$util.Tips({
- title: res.msg,
- icon: 'success'
- }, {
- url: '/pages/users/user_spread_user/index',
- tab: 2
- });
- }).catch(err => {
- setTimeout(e => {
- this.prevent = true
- }, 1500)
- return this.$util.Tips({
- title: err
- });
- });
- }
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: #fff !important;
- }
- .fontcolor{
- color: var(--view-theme) !important;
- }
- .cash-withdrawal .nav {
- height: 130rpx;
- box-shadow: 0 10rpx 10rpx #f8f8f8;
- }
- .cash-withdrawal .nav .item {
- font-size: 26rpx;
- flex: 1;
- text-align: center;
- }
- .cash-withdrawal .nav .item~.item {
- border-left: 1px solid #f0f0f0;
- }
- .cash-withdrawal .nav .item .iconfont {
- width: 40rpx;
- height: 40rpx;
- border-radius: 50%;
- border: 2rpx solid var(--view-theme);
- text-align: center;
- line-height: 37rpx;
- margin: 0 auto 6rpx auto;
- font-size: 22rpx;
- box-sizing: border-box;
- }
- .cash-withdrawal .nav .item .iconfont.on {
- background-color: var(--view-theme);
- color: #fff;
- border-color: var(--view-theme);
- }
- .cash-withdrawal .nav .item .line {
- width: 2rpx;
- height: 20rpx;
- margin: 0 auto;
- transition: height 0.3s;
- }
- .cash-withdrawal .nav .item .line.on {
- height: 39rpx;
- }
- .cash-withdrawal .wrapper .list {
- padding: 0 30rpx;
- }
- .cash-withdrawal .wrapper .list .item {
- border-bottom: 1rpx solid #eee;
- min-height: 28rpx;
- font-size: 30rpx;
- color: #333;
- padding: 39rpx 0;
- }
- .cash-withdrawal .wrapper .list .item .name {
- width: 130rpx;
- }
- .cash-withdrawal .wrapper .list .item .input {
- width: 505rpx;
- }
- .cash-withdrawal .wrapper .list .item .input .placeholder {
- color: #bbb;
- }
- .cash-withdrawal .wrapper .list .item .picEwm,
- .cash-withdrawal .wrapper .list .item .pictrue {
- width: 140rpx;
- height: 140rpx;
- border-radius: 3rpx;
- position: relative;
- margin-right: 23rpx;
- }
- .cash-withdrawal .wrapper .list .item .picEwm image {
- width: 100%;
- height: 100%;
- border-radius: 3rpx;
- }
- .cash-withdrawal .wrapper .list .item .picEwm .icon-guanbi1 {
- position: absolute;
- right: -14rpx;
- top: -16rpx;
- font-size: 40rpx;
- }
- .cash-withdrawal .wrapper .list .item .pictrue {
- border: 1px solid rgba(221, 221, 221, 1);
- font-size: 22rpx;
- color: #BBBBBB;
- }
- .cash-withdrawal .wrapper .list .item .pictrue .icon-icon25201 {
- font-size: 47rpx;
- color: #DDDDDD;
- margin-bottom: 3px;
- }
- .cash-withdrawal .wrapper .list .tip {
- font-size: 26rpx;
- color: #999;
- margin-top: 25rpx;
- }
- .cash-withdrawal .wrapper .list .bnt {
- font-size: 32rpx;
- color: #fff;
- width: 690rpx;
- height: 90rpx;
- text-align: center;
- border-radius: 50rpx;
- line-height: 90rpx;
- margin: 64rpx auto;
- }
- .cash-withdrawal .wrapper .list .tip2 {
- font-size: 26rpx;
- color: #999;
- text-align: center;
- margin: 44rpx 0 20rpx 0;
- }
- .cash-withdrawal .wrapper .list .value {
- height: 135rpx;
- line-height: 135rpx;
- border-bottom: 1rpx solid #eee;
- width: 690rpx;
- margin: 0 auto;
- }
- .cash-withdrawal .wrapper .list .value input {
- font-size: 80rpx;
- color: #282828;
- height: 135rpx;
- text-align: center;
- }
- .cash-withdrawal .wrapper .list .value .placeholder2 {
- color: #bbb;
- }
- .price {
- color: var(--view-priceColor);
- }
- </style>
|