123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519 |
- <template>
- <view class="apply-box">
- <Navbar title="提出" background-color="#fff" color="#333"></Navbar>
- <view class="container">
- <view class="withdraw">
- <!-- <view class="service-charge">
- {{charges || ""}}
- </view> -->
- <view class="title">请输入金额(元)每日可提1次,每次最低100。</view>
- <view class="num">
- <!-- <image :src="static ? static + 'diamonds.png' : ''" class="img" mode="widthFix"></image> -->
- <input type="number" class="input" placeholder="点击输入" v-model="num">
- </view>
- <view class="total">
- <view class="left">
- 可提出金额:{{balance}}元
- </view>
- <view class="right" @click="handleAll">
- 全部
- </view>
- </view>
- </view>
- <view class="type">
- <view class="left">收款账户</view>
- <view class="right" @click="handleSelect">
- {{currentType ? typeMap[currentType] : '未选择'}}
- <IconText :code="`\ue84a`" color="#999" class="icon" :size="12"></IconText>
- </view>
- </view>
- <!-- <view class="code" v-if="currentType === 1 || currentType === 2">
- <view class="top">
- 收款人姓名<view class="text" @click="toCode">{{name || '未录入'}}
- <Icon :code="`\ue75d`" color="#999" class="icon" :size="12"></Icon>
- </view>
- </view>
- <image v-if="codePic" :src="codePic" class="img" mode="widthFix"></image>
- <view class="empty-img" v-else>
- </view>
- </view>
- <view class="card" v-if="currentType === 3">
- <view class="add" @click="toCard" v-if="!datumInfo.bank_card">
- <Icon :code="`\ue64e`" color="#333" class="icon" :size="40"></Icon>
- 添加提现银行卡
- </view>
- <view class="card-info" v-else>
- <view class="top">
- <text>{{datumInfo.bank}}</text>
- <text>{{datumInfo.bank_card | cardFormat}}</text>
- </view>
- <view class="bottom">
- <view class="update" @click="updateCard">
- <Icon :code="`\ue6c3`" color="#333" class="icon" :size="40"></Icon>
- 更换
- </view>
- </view>
- </view>
- </view> -->
- <!-- <view class="record" @click="toRecord">
- 寄售记录
- </view> -->
- </view>
- <view class="bottom-btn-box">
- <view class="bottom-btn" @click="handleWithdraw">确认提交</view>
- </view>
- <uni-popup ref="type" type="center">
- <view class="select-type">
- <view class="title">
- 选择寄售方式
- </view>
- <view class="type-list">
- <view class="item" v-for="item in typeList" :key="item.value" @click="changeType(item.value)">
- {{item.label}}
- <!-- <view class="" v-if="item.value === type"> -->
- <Icon :code="`\ue754`" :color="item.value === type ? '#FFDE4C' : '#DEDEDE'" class="icon"
- :size="16"></Icon>
- <!-- </view> -->
- </view>
- </view>
- <view class="btn-box" @click="confirmSelect">
- 确定
- </view>
- </view>
- </uni-popup>
- <Password ref="password" @finish="passwordFinish"></Password>
- </view>
- </template>
- <script lang="ts">
- import {
- Component,
- Prop,
- Vue
- } from 'vue-property-decorator';
- import {
- OSS_STATIC
- } from '@/common/constants';
- import {
- namespace,
- } from 'vuex-class';
- import {
- types
- } from '@/common/store';
- const baseModule = namespace('base');
- @Component({
- filters: {
- cardFormat(val: any) {
- if (!+val) return '****';
- let format = val.substring(val.length - 4);
- return '****' + format;
- }
- }
- })
- export default class Apply extends Vue {
- @baseModule.Mutation(types.SET_USERINFO) setUserInfo: any;
- @baseModule.Getter('_userInfo') userInfo: any;
- static: string = OSS_STATIC;
- num: any = null;
- type: any = null;
- codePic: string = "";
- name: string = "";
- datumInfo: any = {};
- currentType: any = null;
- charges: any = 0;
- typeList: any = [{
- label: '微信收款',
- value: 1,
- },
- {
- label: '支付宝收款',
- value: 2,
- },
- {
- label: '银行卡收款',
- value: 3,
- }
- ];
- typeMap: any = {
- 1: '微信收款',
- 2: '支付宝收款',
- 3: '银行卡收款'
- };
- balance: any = null;
- onLoad() {
- uni.setNavigationBarColor({
- frontColor: '#000000', //文字颜色
- backgroundColor: '#000000' //底部背景色
- });
- }
- onShow() {
- this.currentType = +uni.getStorageSync('currentType') || null;
- this.getUserInfo();
- this.getBalance();
- }
- getUserInfo() {
- uni.showLoading({
- title: '加载中',
- });
- this.$http.get({
- url: this.$api.getUserInfo,
- data: {}
- }).then((res: any) => {
- uni.hideLoading();
- this.setUserInfo({
- ...res,
- ...res.info
- });
- })
- }
- getBalance() {
- uni.showLoading({
- title: '加载中',
- });
- this.$http.get({
- url: this.$api.getBalance,
- data: {}
- }).then((res: any) => {
- this.balance = res.balance;
- this.setInfo(this.type);
- uni.hideLoading();
- })
- }
- handleAll() {
- this.num = this.balance;
- }
- changeType(type: any) {
- this.type = type;
- }
- setInfo(type: any) {
- if (type === 1) {
- this.name = this.datumInfo.wx_name;
- this.codePic = this.datumInfo.wx_pic;
- } else if (type === 2) {
- this.name = this.datumInfo.zfb_name;
- this.codePic = this.datumInfo.zfb_pic;
- } else {
- this.name = "";
- this.codePic = "";
- }
- }
- confirmSelect() {
- this.currentType = this.type;
- this.setInfo(this.currentType);
- (this.$refs.type as any).close();
- }
- handleSelect() {
- // this.type = this.currentType;
- // (this.$refs.type as any).open('bottom');
- this.$Router.push({
- path: '/packages/user/fund/withdraw-type',
- })
- }
- handleWithdraw() {
- if (!this.num) {
- uni.showToast({
- icon: 'none',
- title: '请填写金额'
- })
- return;
- }
- if (!this.currentType) {
- uni.showToast({
- icon: 'none',
- title: '请先选择方式'
- })
- return;
- }
- (this.$refs.password as any).open();
- }
- passwordFinish(val: any) {
- this.withDraw(val);
- }
- withDraw(safe: any) {
- uni.showLoading({
- title: '加载中',
- });
- this.$http.post({
- url: this.$api.withdraw,
- data: {
- balance: +this.num,
- way: this.currentType,
- safe: safe,
- }
- }).then(() => {
- uni.hideLoading();
- uni.showToast({
- icon: 'none',
- title: '申请成功'
- });
- })
- }
- toRecord() {
- this.$Router.push({
- path: '/pages/withdraw/record',
- })
- }
- toCard() {
- this.$Router.push({
- path: '/pages/withdraw/card',
- })
- }
- updateCard() {
- this.$Router.push({
- path: '/pages/withdraw/card',
- query: {
- card: this.datumInfo.bank_card,
- bank: this.datumInfo.bank,
- name: this.datumInfo.bank_name
- }
- })
- }
- toCode() {
- this.$Router.push({
- path: '/pages/withdraw/code',
- query: {
- type: this.currentType,
- name: this.name,
- pic: this.codePic
- }
- })
- }
- }
- </script>
- <style lang="scss" scoped>
- .apply-box {
- background: #F8F8F8;
- min-height: 100vh;
- padding-bottom: vw(80);
- box-sizing: border-box;
- .container {
- width: 100%;
- padding: 0 vw(10);
- @include flex-y();
- box-sizing: border-box;
- }
- .withdraw {
- width: 100%;
- background: #fff;
- margin-top: vw(10);
- border-radius: vw(10);
- overflow: hidden;
-
- .service-charge{
- height: vw(24);
- @include flex-x(center);
- background: linear-gradient(115.71deg, rgba(219, 230, 252, 1) 0%, rgba(250, 237, 250, 1) 100%);
- @include word-vw(12, #F07F90);
- }
- .title {
- height: vw(40);
- line-height: vw(40);
- padding: 0 vw(14);
- @include word-vw(12, #333);
- }
- .num {
- height: vw(80);
- border-top: vw(1) solid #F8F8F8;
- border-bottom: vw(1) solid #F8F8F8;
- @include flex-x(flex-start, center);
- padding: 0 vw(8);
- .img {
- width: vw(32);
- }
- .input {
- font-size: vw(20);
- margin-left: vw(20);
- }
- }
- .total {
- height: vw(40);
- line-height: vw(40);
- padding: 0 vw(14);
- @include flex-x(space-between);
- .left {
- @include word-vw(13, #B0ACAC);
- }
- .right {
- @include word-vw(13, #FA6C28);
- }
- }
- }
- .type {
- height: vw(64);
- width: 100%;
- margin-top: vw(10);
- background: #fff;
- border-radius: vw(5);
- padding: 0 vw(14);
- box-sizing: border-box;
- @include flex-x(space-between);
- .left {
- @include word-vw(16, #333);
- font-weight: 600;
- }
- .right {
- @include word-vw(16, #999);
- @include flex-x();
- .icon {
- margin-left: vw(3);
- }
- }
- }
- .code {
- width: 100%;
- height: vw(280);
- background: #fff;
- @include flex-y(center);
- margin-top: vw(1);
- .top {
- @include word-vw(14, #333);
- @include flex-x();
- .text {
- @include word-vw(14, #999);
- margin-left: vw(8);
- @include flex-x();
- .icon {
- margin-left: vw(1);
- }
- }
- }
- .img {
- width: vw(148);
- height: vw(148);
- margin-top: vw(24);
- }
- .empty-img {
- width: vw(148);
- height: vw(148);
- margin-top: vw(24);
- background: #E8E8E8;
- }
- }
- .card {
- width: 100%;
- height: vw(180);
- background: linear-gradient(115.71deg, rgba(219, 230, 252, 1) 0%, rgba(250, 237, 250, 1) 100%);
- border-radius: vw(8);
- margin-top: vw(10);
- @include flex-x(center);
- .add {
- @include word-vw(14, #333);
- @include flex-y();
- .icon {
- margin-bottom: vw(8);
- }
- }
- .card-info {
- height: 100%;
- width: 100%;
- padding: vw(12) vw(24);
- box-sizing: border-box;
- @include flex-y(space-between);
- .top {
- width: 100%;
- @include flex-x(space-between);
- }
- .bottom {
- width: 100%;
- @include flex-x(flex-end);
- .update {
- @include flex-y(space-between);
- .icon {
- margin-bottom: vw(8);
- }
- }
- }
- }
- }
- .record {
- width: 100%;
- text-align: center;
- @include word-vw(12, #807E7E);
- margin-top: vw(20);
- text-decoration: underline;
- }
- .bottom-btn-box {
- height: vw(70);
- width: 100%;
- background: #fff;
- @include flex-x(center);
- position: fixed;
- bottom: 0;
- .bottom-btn {
- width: vw(335);
- height: vw(50);
- background: $btn-color;
- border-radius: vw(10);
- @include word-vw(16, #fff);
- @include flex-x(center);
- }
- }
- }
- .select-type {
- height: vw(280);
- background: #fff;
- border-top-left-radius: vw(10);
- border-top-right-radius: vw(10);
- @include flex-y();
- .title {
- height: vw(54);
- line-height: vw(54);
- text-align: center;
- @include word-vw(14, #999);
- }
- .type-list {
- flex: 1;
- width: 100%;
- @include flex-y(center);
- .item {
- height: vw(48);
- width: 100%;
- padding: 0 vw(24);
- box-sizing: border-box;
- @include flex-x(space-between);
- }
- }
- .btn-box {
- width: 100%;
- height: vw(56);
- @include flex-x(center);
- border-top: vw(1) solid #DEDEDE;
- }
- }
- </style>
|