shop_uniapp/bundle/pages/kamihexiao/kamihexiao.vue

162 lines
3.0 KiB
Vue

<!-- 提现 -->
<template>
<view class="user-withdraw">
<!-- 微信钱包 -->
<view class="withdraw-wechat m-t-20 bg-white">
<!-- Account -->
<u-field label-width="100" label="卡号" v-model="form.card_number" placeholder="请输入卡号" />
<!-- Name -->
<u-field label-width="100" label="密钥" v-model="form.card_secret" placeholder="请输入密钥" />
</view>
<!-- 确认提交 -->
<button class="withdraw-submit m-t-30 white br60" @tap="onSubmit" size="lg">立即核销</button>
</view>
</template>
<script>
import {
applyWithdraw,
getWithdrawConfig,
kamihexiao
} from "@/api/user";
import {
trottle
} from "@/utils/tools";
import {
baseURL
} from '@/config/app';
export default {
data() {
return {
action: baseURL + '/api/file/formimage',
currentTab: 0, // Tabs当前位置
// Tabs 列表
tabsList: [],
// Tabs滑块样式
styleTabsBarStyle: {
bottom: '12rpx',
width: '50rpx',
height: '6rpx',
background: 'green',
borderRadius: '50px',
backgroundImage: 'linear-gradient(to right, \#F79C0C, \#FF2C3C)'
},
// 表单数据
form: {
card_number: '', // 卡号
card_secret: '', // 密钥
},
widthDrawConfig: {}
}
},
onLoad() {
this.getWithdrawConfigFun();
this.onSubmit = trottle(this.onSubmit, 1000, this)
},
methods: {
// 改变当前的Tabs位置
changeTab(index) {
this.currentTab = index;
this.form = {
money: '',
account: '',
real_name: '',
money_qr_code: '',
remark: '',
bank: '',
subbank: ''
};
},
async getWithdrawConfigFun() {
const {
code,
data
} = await getWithdrawConfig()
if (code == 1) {
this.widthDrawConfig = data
this.tabsList = data.type
}
},
// 提交表单
onSubmit() {
const data = {
...this.form
}
kamihexiao(data).then(res => {
if (res.code == 1) {
this.$toast({
title: '核销成功'
}, {
url: '/pages/user/user'
});
}
});
},
onSuccess(e) {
console.log(e)
this.form.money_qr_code = e.data.base_uri
},
onRemove(index) {
this.form.money_qr_code = ""
},
},
computed: {
currentValue(val) {
const {currentTab, tabsList} = this
return tabsList[currentTab] ? tabsList[currentTab].value : ''
}
}
}
</script>
<style lang="scss" scoped>
.user-withdraw {
padding: 20rpx 30rpx;
.withdraw-tabs {
border-radius: 10px;
overflow: hidden;
}
.withdraw-money-wrap {
padding: 50rpx 66rpx;
border-radius: 10px;
.withdraw-money {
border-bottom: $-solid-border;
}
}
.withdraw-wechat,
.withdraw-alipay {
padding: 0 36rpx 20rpx;
border-radius: 10px;
}
.upload-image {
width: 142rpx;
height: 142rpx;
border: 2rpx dashed #CCCCCC;
border-radius: 5px;
}
.withdraw-submit {
background: linear-gradient(11deg, #F95F2F, #FF2C3C);
}
::v-deep .u-field {
padding: 26rpx 0;
}
}
</style>