选择身份证

This commit is contained in:
老叶
2021-07-15 14:55:19 +08:00
parent 7bbf300b44
commit 67e703a45e
3 changed files with 46 additions and 4 deletions
+1
View File
@@ -13,6 +13,7 @@
.bg-000-op50{background-color:rgba(0,0,0,.5);}
.bg-000-op60{background-color:rgba(0,0,0,.6);}
.bg-000-op80{background-color:rgba(0,0,0,.8);}
.bg-f00-op50{background-color:rgba(255,0,0,.5);}
.bg-fff-op20{background-color:rgba(255,255,255,.2);}
.bg-fff-op50{background-color:rgba(255,255,255,.5);}
+35
View File
@@ -19,6 +19,8 @@ Page({
yearsIndex:-1,//分期年限
money:'',//首付金额
submitFlag:false,
stempFront:'',
stempBack:'',
},
onLoad: function (options) {
for (let key in options) {
@@ -246,5 +248,38 @@ Page({
}
},
//选择图片
chooseImg(e) {
this.setData({
submitFlag: false,
})
let that = this
wx.chooseImage({
count: 1, // 默认9
sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有
success(res) {
console.log(res)
if(e.currentTarget.dataset.face == 'front'){
that.setData({
stempFront:res.tempFilePaths[0],
})
}
if(e.currentTarget.dataset.face == 'back'){
that.setData({
stempBack:res.tempFilePaths[0],
})
}
},
fail: res => {
wx.showToast({
title: '文件选择失败',
icon: 'none',
duration: 2000
})
}
})
},
})
+10 -4
View File
@@ -105,11 +105,17 @@
<i class="iconfont icon-kaipiao mr10"></i>开票信息
</view>
<view class="fn-flex mt30 text-center">
<view class="fn-flex-item relative mr10" bindtap="radioPicker">
<image class='wp100 img-h-200' lazy-load="{{true}}" mode="aspectFit" src="{{imgUrl}}order/defaultidcard-front.jpg"></image>
<view class="fn-flex-item relative mr10 ulib-r10 overflowhidden" bindtap="chooseImg" data-face="front">
<view class="absolute top-0 left-0 bottom-0 right-0 bg-f00-op50 z-index-4" wx:if="{{stempFront}}">
<view class="absolute left-0 right-0 box-middle pl20 pr20 font-22 color-fff"><i class="iconfont icon-jinggao"></i>系统识别失败请重新上传</view>
</view>
<image class='block wp100 bg-f8 img-h-200' lazy-load="{{true}}" mode="aspectFit" src="{{stempFront || imgUrl + 'order/defaultidcard-front.jpg'}}"></image>
</view>
<view class="fn-flex-item relative ml10 bg-f8 ulib-r10" bindtap="radioPicker">
<image class='wp100 img-h-200' lazy-load="{{true}}" mode="aspectFit" src="{{imgUrl}}order/defaultidcard-back.jpg"></image>
<view class="fn-flex-item relative ml10 ulib-r10 overflowhidden" bindtap="chooseImg" data-face="back">
<view class="absolute top-0 left-0 bottom-0 right-0 bg-f00-op50 z-index-4" wx:if="{{stempBack}}">
<view class="absolute left-0 right-0 box-middle pl20 pr20 font-22 color-fff"><i class="iconfont icon-jinggao"></i>系统识别失败请重新上传</view>
</view>
<image class='block wp100 bg-f8 img-h-200' lazy-load="{{true}}" mode="aspectFit" src="{{stempBack || imgUrl + 'order/defaultidcard-back.jpg'}}"></image>
</view>
</view>
</view>