You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

365 lines
7.9 KiB

<template>
<view class="main">
<!-- nav -->
<navigation>{{ i18n.conFirmInfo }}</navigation>
<!-- #ifdef APP-PLUS -->
<view class="content">
<!-- #endif -->
<!-- #ifdef H5 -->
<view class="contentH5">
<!-- #endif -->
<u--form class="form" :model="bankInfo" :rules="rules" ref="uForm" errorType="toast">
<view class="inputBody">
<view class="title" v-if="bankInfo.auditStatus">{{ i18n.infoStatus }}</view>
<view class="" style="margin-bottom: 20rpx;" v-if="bankInfo.auditStatus">
{{bankInfo.auditStatus=='apply'?i18n.apply:bankInfo.auditStatus=='agree'?i18n.agree:i18n.reject}}
</view>
<view class="title" v-if="bankInfo.auditStatus=='reject'">{{ i18n.Reasonforrejection }}</view>
<view class="" style="word-break: break-all;margin-bottom: 20rpx;"
v-if="bankInfo.auditStatus=='reject'">
{{bankInfo.auditReason}}
</view>
<view class="title">{{ i18n.FirstName }}</view>
<view class="input-item">
<u-form-item class="input-item" prop="name" ref="item1">
<u-input class="input" v-model="bankInfo.name" color="#fff" fontSize="32rpx"
border="none" :placeholder="i18n.enterName">
</u-input>
</u-form-item>
</view>
<view class="title">{{ i18n.idNumber }}</view>
<view class="input-item">
<u-form-item class="input-item" prop="certId" ref="item1">
<u-input class="input" v-model="bankInfo.certId" color="#fff" fontSize="32rpx"
border="none" :placeholder="i18n.enterIdNumber">
</u-input>
</u-form-item>
</view>
<view class="title" v-show="bankInfo.auditStatus!='agree'">{{ i18n.IDcard }}</view>
<u-upload v-show="bankInfo.auditStatus!='agree'" :fileList="fileList1" @afterRead="afterRead"
@delete="deletePic" name="1" multiple :maxCount="1">
<image class="add" src="/static/home/id.png" mode="aspectFit"
v-if="!bankInfo.certFrontImgPath"></image>
<image :src="baseURL+bankInfo.certFrontImgPath" mode="" class="add"
v-if="bankInfo.certFrontImgPath"></image>
</u-upload>
</view>
</u--form>
<u-button class="button" color="#00E8A2" :throttleTime="500" @click="bank" v-if="!hideButton">
{{ i18n.Confirm }}
</u-button>
</view>
</view>
</template>
<script>
import api from '@/utils/api'
import constant from '@/utils/constant.js';
import {
pathToBase64,
base64ToPath
} from 'image-tools'
export default {
name: "withdrawalRecord",
data() {
return {
language: '',
ticket: '',
hideButton: false,
baseURL: '',
fileList1: [],
rules: {
name: {
type: 'string',
required: true,
message: this.$t('withdrawal').enterName,
trigger: ['blur', 'change'],
},
certId: {
type: 'string',
required: true,
message: this.$t('withdrawal').enterIdNumber,
trigger: ['blur', 'change']
},
},
bankInfo: {
name: null,
certId: null,
certFrontImgPath: null
},
pageState: 'addBank', // 页面状态,是添加还是编辑银行卡
objData: {},
};
},
computed: {
i18n() {
return this.$t("withdrawal");
},
btnIsCanClick() {
if (this.bankInfo.name && this.bankInfo.certId) {
return false
} else {
return true
}
}
},
onLoad(option) {
this.language = uni.getStorageSync("language") || 'en_US';
this.ticket = uni.getStorageSync('ticket')
this.getBank()
this.baseURL = constant.BASE_URL
},
onShow() {},
methods: {
// 删除图片
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
this.bankInfo.certFrontImgPath = null;
},
// 新增图片
async afterRead(event) {
uni.showLoading({
title: this.$t("withdrawal").shang,
mask: true,
})
// 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
let lists = [].concat(event.file)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
...item,
// status: 'uploading',
// message: '上传中'
})
})
for (let i = 0; i < lists.length; i++) {
const result = await this.uploadFilePromise(lists[i].url)
let item = this[`fileList${event.name}`][fileListLen]
this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
status: 'success',
message: '',
url: result
}))
fileListLen++
}
},
uploadFilePromise(url) {
console.log(url)
return new Promise((resolve, reject) => {
let a = uni.uploadFile({
url: this.baseURL + '/api/user/uploadImg1', // 仅为示例,非真实的接口地址
filePath: url,
name: 'file',
formData: {
ticket: this.ticket,
lang: this.language,
},
success: (res) => {
setTimeout(() => {
uni.hideLoading()
let data = JSON.parse(res.data)
this.bankInfo.certFrontImgPath = data.data
}, 1000)
},
failed(res) {
uni.hideLoading()
console.log(res)
}
});
})
},
// 获取实名信息
getBank() {
api.certificationInfo().then(res => {
this.bankInfo = res;
this.bankInfo.certFrontImgPath = res.certFrontImg
if (this.bankInfo.auditStatus == 'agree' || this.bankInfo.auditStatus == 'apply') {
this.hideButton = true
}
})
},
// 修改或添加实名信息
bank() {
if (!this.bankInfo.certFrontImgPath) {
uni.$u.toast(this.$t("withdrawal").enterIdCard)
return;
}
this.$refs.uForm.validate().then(res => {
let bankInfo = {
name: this.bankInfo.name,
certId: this.bankInfo.certId,
certFrontImgPath: this.bankInfo.certFrontImgPath
}
api.certification(bankInfo).then(res => {
uni.$u.toast(this.$t("me").addSuccessfully)
this.getBank()
})
}).catch(errors => {
console.log('err')
})
},
},
}
</script>
<style lang="scss" scoped>
/deep/ .uicon-camera-fill {
display: none !important;
}
/deep/ .u-upload {
position: relative;
.add {
width: 620rpx !important;
height: 360rpx !important;
}
}
/deep/ .u-upload__wrap__preview__image {
width: 620rpx !important;
height: 360rpx !important;
}
/deep/ .u-icon__icon {
font-size: 32rpx !important;
}
/deep/ .u-upload__button {
width: 620rpx !important;
height: 360rpx !important;
background-color: #323045 !important;
}
/deep/ .u-form-item__body {
padding: 0 0;
}
.main {
.content {
margin-top: 200rpx;
padding: 32rpx;
.inputBody {
overflow: hidden;
background: #211F32;
border-radius: 32rpx;
padding: 32rpx;
margin-bottom: 32rpx;
.title {
font-size: 32rpx;
color: #A1A0A8;
margin-bottom: 20rpx;
}
.input-item {
height: 112rpx;
background: #323045;
border-radius: 32rpx;
padding-left: 40rpx;
margin-bottom: 20rpx;
.input {
height: 112rpx;
}
}
}
.button {
position: fixed;
bottom: 40rpx;
width: 686rpx;
box-sizing: border-box;
height: 112rpx;
background: #00E8A2;
border-radius: 32rpx;
font-weight: 700;
font-size: 32rpx;
color: #15141F !important;
}
}
.contentH5 {
margin-top: 100rpx;
padding: 32rpx;
.inputBody {
overflow: hidden;
background: #211F32;
border-radius: 32rpx;
padding: 32rpx;
margin-bottom: 32rpx;
.title {
font-size: 32rpx;
color: #A1A0A8;
margin-bottom: 20rpx;
}
.input-item {
height: 112rpx;
background: #323045;
border-radius: 32rpx;
padding-left: 40rpx;
margin-bottom: 20rpx;
.input {
height: 112rpx;
}
}
}
.button {
position: fixed;
bottom: 40rpx;
width: 686rpx;
box-sizing: border-box;
height: 112rpx;
background: #00E8A2;
border-radius: 32rpx;
font-weight: 700;
font-size: 32rpx;
color: #15141F !important;
}
}
}
</style>