Browse Source

合并

master
j1ack 3 years ago
parent
commit
2bebed2642
  1. 150
      pages/me/confirmInfo.vue
  2. 2
      utils/api.js
  3. 2
      utils/axios.js

150
pages/me/confirmInfo.vue

@ -18,7 +18,8 @@
<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'">
<view class="" style="word-break: break-all;margin-bottom: 20rpx;"
v-if="bankInfo.auditStatus=='reject'">
{{bankInfo.auditReason}}
</view>
@ -42,14 +43,15 @@
<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">
<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 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>
<image :src="baseURL+bankInfo.certFrontImgPath" mode="" class="add"
v-if="bankInfo.certFrontImgPath"></image>
</u-upload>
@ -61,7 +63,7 @@
</u--form>
<u-button class="button" color="#00E8A2" :throttleTime="500" @click="bank" v-if="!hideButton">
<u-button class="button" color="#00E8A2" :throttleTime="500" @click="bank" v-if="!hideButton">
{{ i18n.Confirm }}
</u-button>
</view>
@ -79,7 +81,9 @@
name: "withdrawalRecord",
data() {
return {
hideButton:false,
language: '',
ticket: '',
hideButton: false,
baseURL: '',
fileList1: [],
rules: {
@ -100,7 +104,7 @@
bankInfo: {
name: null,
certId: null,
certFrontImgPath:null
certFrontImgPath: null
},
pageState: 'addBank', // ,
@ -120,6 +124,8 @@
}
},
onLoad(option) {
this.language = uni.getStorageSync("language") || 'en_US';
this.ticket = uni.getStorageSync('ticket')
this.getBank()
this.baseURL = constant.BASE_URL
},
@ -128,6 +134,7 @@
//
deletePic(event) {
this[`fileList${event.name}`].splice(event.index, 1)
this.bankInfo.certFrontImgPath = null;
},
//
@ -138,7 +145,6 @@
})
// mutiple true , file
let lists = [].concat(event.file)
console.log(event)
let fileListLen = this[`fileList${event.name}`].length
lists.map((item) => {
this[`fileList${event.name}`].push({
@ -160,84 +166,45 @@
},
uploadFilePromise(url) {
// #ifdef APP-PLUS
console.log(url)
pathToBase64(url)
.then(path => {
console.log(path)
let res=path
res = res.split(',')[1]
console.log(res,'res')
return new Promise((resolve, reject) => {
api.uploadImg({
img: res
}).then(res => {
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()
this.bankInfo.certFrontImgPath=res
})
})
})
.catch(error => {
uni.hideLoading()
console.error(error)
})
// #endif
// #ifdef H5
const image = new Image() // imgDOM)
//blob:http://localhost:8080/b878edea-e649-4f8d-b723-c3f25454141b
image.src = url;
image.onload = () => {
const canvas = document.createElement('canvas')
canvas.width = image.width
canvas.height = image.height
const context = canvas.getContext('2d')
context.drawImage(image, 0, 0, image.width, image.height);
let imgUrl = canvas.toDataURL() //base64
imgUrl = imgUrl.split(',')[1]
return new Promise((resolve, reject) => {
api.uploadImg({
img: imgUrl
}).then(res => {
this.bankInfo.certFrontImgPath=res
console.log(res)
console.log(this.bankInfo.certFrontImgPath)
})
})
}
// #endif
let data = JSON.parse(res.data)
this.bankInfo.certFrontImgPath = data.data
}, 1000)
},
failed(res) {
uni.hideLoading()
console.log(res)
}
});
})
},
getBase64(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = () => resolve(reader.result)
reader.onerror = (error) => reject(error)
//
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
}
})
},
//
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){
if (!this.bankInfo.certFrontImgPath) {
uni.$u.toast(this.$t("withdrawal").enterIdCard)
return;
}
@ -248,8 +215,8 @@
certFrontImgPath: this.bankInfo.certFrontImgPath
}
api.certification(bankInfo).then(res => {
uni.$u.toast(this.$t("me").addSuccessfully)
this.getBank()
uni.$u.toast(this.$t("me").addSuccessfully)
this.getBank()
})
}).catch(errors => {
@ -261,20 +228,21 @@
</script>
<style lang="scss" scoped>
/deep/ .uicon-camera-fill{
display:none !important;
/deep/ .uicon-camera-fill {
display: none !important;
}
/deep/ .u-upload{
position:relative;
.add{
width: 620rpx !important;
height: 360rpx !important;
/deep/ .u-upload {
position: relative;
.add {
width: 620rpx !important;
height: 360rpx !important;
}
}
/deep/ .u-upload__wrap__preview__image {
width: 620rpx !important;
width: 620rpx !important;
height: 360rpx !important;
}

2
utils/api.js

@ -6,7 +6,7 @@ const api = {
rechargeAddress: (params) => Vue.prototype.$axios.post('/api/recharge/rechargeAddress',params),//获取对应数字币种的充值地址
recharge: (params) => Vue.prototype.$axios.post('/api/recharge/recharge',params),//法币在线充值下单
rechargeList: (params) => Vue.prototype.$axios.post('/api/recharge/rechargeList',params),//充值记录
uploadImg: (params) => Vue.prototype.$axios.post('/api/user/uploadImg',params),//充值记录
uploadImg: (params) => Vue.prototype.$axios.post('/api/user/uploadImg1',params),//充值记录
//--------------------------------- withdraw提现 ---------------------------------

2
utils/axios.js

@ -29,7 +29,7 @@ service.interceptors.request.use(
// mask: true
// })
}
console.log(config.url)
console.log(config.data)
if (config.url.indexOf("/api/index/register") !== -1 ||
config.url.indexOf("/api/user/login") !== -1 ||
config.url.indexOf("/api/user/forgotPassword") !== -1 ||

Loading…
Cancel
Save