123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729 |
- <template>
- <view class="content">
- <view class="content2 content-other">
- <view class="title">上传身份证人像面</view>
- <view @click.stop="uploadImg(1,index)" class="picture picture1" v-if="!dataDetails.cardAddressUrl">
- <image class="xj-image" src="@/static/mine/ic_shanchuan@2x.png"></image>
- <view class="text">上传身份证人像面</view>
- </view>
- <view v-if="dataDetails.cardAddressUrl" @click.stop="uploadImg(1,index)" class="preview-card-img picture">
- <view @click.stop="delCard(1)">
- <image class='del-card' src="@/static/images/common/quxiao@2x.png">
- </image>
- </view>
- <image class="" :src="dataDetails.cardAddressUrl" mode="aspectFit" style=""></image>
- </view>
- <view class="title">上传身份证国徽面</view>
- <view @click="uploadImg(2,index)" class="picture picture2" v-if="!dataDetails.cardBackAddressUrl">
- <image class="xj-image" src="@/static/mine/ic_shanchuan@2x.png"></image>
- <view class="text">上传身份证国徽面</view>
- </view>
- <view v-if="dataDetails.cardBackAddressUrl" @click.stop="uploadImg(2,index)"
- class="preview-card-img picture">
- <!-- <image class="card-img" :src="dataDetails.cardAddressUrl"></image> -->
- <view @click.stop="delCard(2)">
- <image class='del-card' src="@/static/images/common/quxiao@2x.png">
- </image>
- </view>
- <image class="" :src="dataDetails.cardBackAddressUrl" mode="aspectFit"></image>
- </view>
- <view style='border-bottom:1px solid #eee;' class="flex row flex-space-between width100">
- <view class="left-text" style='font-size:14px;'>姓名</view>
- <view style='padding-right:10px;' class="flex">
- <u--input @input='nameinput' placeholder="输入姓名" inputAlign='right' border="none"
- v-model="dataDetails.name">
- </u--input>
- </view>
- </view>
- <view class="flex row flex-space-between" style='border-bottom:1px solid #eee;'>
- <view class="left-text" style='font-size:14px;'>性别</view>
- <view>
- <u-radio-group v-model="dataDetails.sex" placement="row">
- <u-radio :customStyle="radioCustomStyle" v-for="(item, index) in radiolist1" :key="index"
- :label="item.name" :name="item.name" @change="radioChange">
- </u-radio>
- </u-radio-group>
- </view>
- </view>
- <view style='margin-top:10px;padding-bottom:11px;' class="flex row flex-space-between">
- <view class="left-text" style='font-size:14px;'>称呼</view>
- <view style='padding-right:10px;' class='flex flex-space-between'>
- <view style="width: 160rpx;">
- <u--input style='padding-right:4px;' placeholder="输入姓氏" class="ch-style" inputAlign='right'
- border="none" v-model="dataDetails.call">
- </u--input>
- </view>
- <view style='position:relative;top:0px;font-size:15px;' class="flex align-center"
- v-if="dataDetails.sex=='男'">先生</view>
- <view style='position:relative;top:0px;font-size:15px;' class="flex align-center" v-else>女士</view>
- </view>
- </view>
- <view style='border-bottom:1px solid #eee;margin-top:10px;padding-bottom:11px;'
- class="flex row width100 flex-space-between">
- <view class="left-text" style='font-size:14px;'>联系电话</view>
- <view style='padding-right:10px;' class="flex">
- <u--input disabledColor='#fff' disabled placeholder="输入联系电话" inputAlign='right' border="none"
- v-model="dataDetails.phone" maxlength="11">
- </u--input>
- </view>
- </view>
- <view style='padding-right:10px;margin-top:10px;padding-bottom:11px;' class="flex row">
- <view class="left-text">身份证号</view>
- <u--input :disabled='dataDetails.id&&firstAuthentication.passOnce?true:false' placeholder="请输入身份证号"
- inputAlign='right' border="none" v-model="dataDetails.cardNumber" maxlength="18">
- </u--input>
- </view>
- <view style='padding-right:10px;' class="flex flex-space-between row noborder">
- <view class="left-text">身份证截止日期</view>
- <view style='font-size:16px;align-items: center;' class='flex' @click="selectValidityPeriod">
- <view :style="{'color':dataDetails.cardValidityDate ? '#000':'#C6CBD5'}">
- {{dataDetails.cardValidityDate?dataDetails.cardValidityDate:'选择身份证截止日期'}}
- </view>
- <!-- <image class='right' src="@/static/mine/right.png" mode=""></image> -->
- <u-icon name="arrow-right" color="#333333" size="16"></u-icon>
- </view>
- </view>
- <view class="bz">注:个人信息审核通过后自动认证成为个人货主。</view>
- <itmister-date-picker :overdueContent="'身份证已过期'" :dateStatus="1" :periodOfValidity="true" :futureYear="30"
- :checkYear="year" :checkMonth="month" :checkDay="day" ref="dateValidityPeriod"
- @dateConfirm="confirmValidityPeriod"></itmister-date-picker>
- </view>
- <view class="content4">
- <view style='margin:0 0 18px;font-size:12px;color:#999;' class='flex items-center'>
- <u--image style='margin-right:5px;margin-top: 4rpx;' @click='consent'
- :src="checked?'../../../static/mine/duihao@2x.png':'../../../static/mine/wxz.png'" width="12px"
- height="12px"></u--image>
- 我已阅读并同意全部细则
- </view>
- <view class='line'></view>
- <view class="next-btn" @click="$u.throttle(submit(), 1000)">
- 提交
- </view>
- </view>
- <!-- <view class="flex flex-space-between width100">
- <view>收款人</view>
- <view class="flex">
- <u--input placeholder="输入收款人姓名" inputAlign='right' border="none" v-model="dataDetails.name">
- </u--input>
- </view>
- </view> -->
- <u-action-sheet :actions="$helper.imgTypeList" :title="$helper.imgType" :show="isShowimgType"
- @select="imgTypeSelect" @cancel='isShowimgType=false' :closeOnClickOverlay="true" :closeOnClickAction="true"
- @close="isShowimgType=false">
- </u-action-sheet>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- import upload from '@/components/upload.vue';
- import permision from "@/js_sdk/wa-permission/permission.js"
- import uploadImage from '@/components/ossutil/uploadFile.js';
- var _this;
- export default {
- components: {},
- data() {
- return {
- radioCustomStyle: {
- margin: '0 20rpx 0 0'
- },
- submitstatus: false,
- radiolist1: [{
- name: '男',
- disabled: false
- },
- {
- name: '女',
- disabled: false
- },
- ],
- year: '',
- month: '',
- day: '',
- uploadType: '',
- isShowimgType: false,
- dataDetails: {
- name: '',
- phone: '',
- sex: '男',
- commonId: '',
- cardNumber: '',
- cardAddressUrl: '',
- cardBackAddressUrl: '',
- cardValidityDate: '',
- driverSex: '男',
- cardValidityDate: "",
- },
- checked: false,
- isShowcardValidity: false,
- imagesrc: '',
- validityPeriod: [],
- isShowimgType: false,
- index: '',
- firstAuthentication: {}
- };
- },
- onLoad(options) {
- // this.get_camera_permission()
- var _this = this;
- // console.log(options)
- if (JSON.stringify(options) != "{}") {
- this.dataDetails = options
- if (this.dataDetails.cardValidityDate && this.dataDetails.cardValidityDate != '长期') {
- const arr = this.dataDetails.cardValidityDate.split('-')
- this.year = arr[0]
- this.month = arr[1]
- this.day = arr[2]
- }
- if (this.dataDetails.cardValidityDate == '长期') {
- this.year = '长期'
- }
- }
- this.dataDetails.phone = this.userInfo.phone
- this.dataDetails.commonId = this.userInfo.id
- },
- onShow() {
- this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', {
- phone: this.userInfo.phone
- }).then(res => {
- uni.setStorageSync("firstAuthentication", res.data)
- this.firstAuthentication = res.data
- })
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- methods: {
- async get_camera_permission() {
- var photol = await permision.requestAndroidPermission("android.permission.CAMERA")
- if (photol == false) {
- uni.showModal({
- title: '提示',
- content: '您已经关闭相机权限,去设置',
- success: function(res) {
- if (res.confirm) {
- permision.gotoAppPermissionSetting()
- // plus.runtime.openURL("app-settings:");
- } else if (res.cancel) {
- console.log('用户点击取消');
- }
- }
- });
- }
- },
- nameinput() {
- this.dataDetails.call = this.dataDetails.name[0]
- },
- // 性别切换
- radioChange(n) {
- console.log('radioChange', n);
- this.dataDetails.sex = n
- this.$forceUpdate()
- console.log(this.dataDetails.sex)
- },
- consent() {
- this.checked = !this.checked
- },
- selectValidityPeriod() {
- this.$refs.dateValidityPeriod.show();
- // this.isShowcardValidity = true
- },
- //设置图片
- setImage(e) {
- //
- console.log(e);
- //显示在页面
- //this.imagesrc = e.path;
- if (e.dotype == 'idphoto') {
- _this.zjzClipper(e.path);
- } else if (e.dotype == 'watermark') {
- _this.watermark(e.path);
- } else {
- _this.savePhoto(e.path);
- }
- },
- delCard(status) {
- if (status == 1) {
- this.dataDetails.cardAddressUrl = ''
- this.$forceUpdate()
- } else {
- this.dataDetails.cardBackAddressUrl = ''
- this.$forceUpdate()
- }
- },
- //保存图片到相册,方便核查
- savePhoto(path) {
- //
- this.imagesrc = path;
- uploadImage(path, 'appData/',
- result => {
- // 上传成功
- console.log('图片地址', result)
- }
- )
- //保存到相册
- // uni.saveImageToPhotosAlbum({
- // filePath: path,
- // success: () => {
- // uni.showToast({
- // title: '已保存至相册',
- // duration: 2000
- // });
- // }
- // });
- },
- changeHandler(e) {
- const {
- columnIndex,
- value,
- values,
- index,
- picker = this.$refs.uPicker
- } = e
- // if (columnIndex === 0) {
- //
- // if (e.index != 0) {
- // picker.setColumnValues(1, this.validityPeriod[1].shift())
- // }
- // } else if (columnIndex === 1) {
- // if (e.index != 0) {
- // picker.setColumnValues(2, this.validityPeriod[2].shift())
- // }
- // }
- },
- confirmValidityPeriod(date) {
- this.dataDetails.cardValidityDate = date.date
- },
- uploadImg(type, index) {
- this.get_camera_permission()
- this.uploadType = type
- this.index = index
- this.imgTypeSelect()
- // this.isShowimgType = true
- },
- validate() {
- if (uni.$u.test.isEmpty(this.dataDetails.name)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "姓名不能为空!",
- })
- return true
- }
- if (this.dataDetails.name.length < 2 || this.dataDetails.name.length > 10) {
- this.$refs.uToast.show({
- type: 'error',
- message: "姓名输入错误!",
- })
- return true
- }
- if (this.dataDetails.call.length == 0) {
- this.$refs.uToast.show({
- type: 'error',
- message: "称呼不能为空!",
- })
- return true
- }
- if (this.dataDetails.call.length > 4) {
- this.$refs.uToast.show({
- type: 'error',
- message: "称呼输入错误!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataDetails.cardValidityDate)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请选择身份证截止日期!",
- })
- return true
- }
- if (this.dataDetails.cardValidityDate != '长期') {
- var arr = this.dataDetails.cardValidityDate.split('-')
- if (!this.$helper.periodOfValidity(arr[0], arr[1], arr[2])) {
- this.$refs.uToast.show({
- type: 'error',
- message: "身份证已过期!",
- })
- return true
- }
- }
- if (uni.$u.test.isEmpty(this.dataDetails.cardNumber)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "身份证号不能为空!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataDetails.cardAddressUrl)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请上传身份证人像面!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataDetails.cardBackAddressUrl)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请上传身份证国徽面!",
- })
- return true
- }
- if (this.dataDetails.cardNumber.length != 18) {
- this.$refs.uToast.show({
- type: 'error',
- message: "身份证号输入错误!",
- })
- return true
- }
- if (!this.checked) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请勾选细则!",
- })
- return true
- }
- },
- submit() {
- if (this.validate()) return
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- var _this = this
- delete _this.dataDetails.hyCargoOwnerCompInfoList
- _this.dataDetails.accountNumber = uni.getStorageSync("userInfo").phone
- _this.$request.baseRequest('post', '/cargoOwnerInfo/api/editCargoOwner', _this.dataDetails).then(res => {
- // console.log(res)
- // uni.$u.route('/pages/mine/cargoowner/cargoowner')
- uni.hideLoading()
- uni.$u.toast('提交成功')
- uni.navigateBack({
- delta: 1
- })
- })
- .catch(res => {
- console.log(res)
- uni.hideLoading()
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- });
- },
- photograph() {
- console.log('拍照')
- let that = this;
- uni.chooseImage({
- sizeType: ['compressed'],
- count: 1,
- success: function(res) {
- console.log(JSON.stringify(res.tempFilePaths));
- uploadImage(res.tempFilePaths[0], 'appData/',
- result => {
- // 上传成功
- console.log('图片地址', result)
- }
- )
- }
- });
- },
- imgTypeSelect(val) {
- let that = this
- uni.chooseImage({
- count: 1,
- success: function(res) {
- console.log(JSON.stringify(res.tempFilePaths));
- uploadImage("image", res.tempFilePaths[0], 'appData/',
- result => {
- // 上传成功回调函数
- console.log('图片地址', result)
- switch (that.uploadType) {
- // 身份正面
- case 1:
- that.dataDetails.cardAddressUrl = result
- // 识别
- that.$request.baseRequest('get',
- '/driverInfo/personShibie', {
- personImg: result,
- flag: 1
- }).then(res => {
- // if(!that.dataDetails.id){
- if (res.data.recPersonNo) {
- that.dataDetails.cardNumber = res.data.recPersonNo
- .replace(/\s*/g, "")
- if (that.dataDetails.cardNumber[16] % 2 == 0) {
- that.dataDetails.sex = '女'
- } else {
- that.dataDetails.sex = '男'
- }
- }
- if (res.data.recPerson) {
- that.dataDetails.name = res.data.recPerson
- that.dataDetails.call = that.dataDetails.name[0]
- }
- // }
- that.$forceUpdate()
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- break
- // 身份反面
- case 2:
- that.dataDetails.cardBackAddressUrl = result
- // 识别
- that.$request.baseRequest('get',
- '/driverInfo/personShibie', {
- personImg: result,
- flag: 2
- }).then(res => {
- if (res.data.idCardValidity) {
- let date = res.data.idCardValidity.split("-")[1]
- that.dataDetails.cardValidityDate = date.replace(
- '.', '-').replace('.', '-')
- }
- that.$forceUpdate()
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- break
- }
- }
- )
- }
- });
- // switch (this.uploadType) {
- // case 1:
- // uni.$u.route('/pages/mine/camera/idcard/idcard?dotype=idcardface');
- // console.log('身份正面')
- // break
- // case 2:
- // uni.$u.route('/pages/mine/camera/idcard/idcard?dotype=badge');
- // console.log('身份反面')
- // break
- },
- //身份证正面
- getImgUrl1(src) {
- // console.log(src)
- // console.log('------------res-----------')
- // let that = this;
- // that.id[0] = src
- // that.id1 = src
- // that.certificates = false
- // that.personImgs.personImg = that.id[0]
- // that.$api.doRequest('get', '/driverViewInfo/personShibie', that
- // .personImgs).then(res => {
- // if (res.data.data.recPerson != null) {
- // if (res.data.data.recPerson != "") {
- // that.$set(that.DriverViewInfo, 'driverName', res
- // .data.data.recPerson)
- // }
- // }
- // if (res.data.data.recPersonNo != null) {
- // if (res.data.data.recPersonNo != "") {
- // that.$set(that.DriverViewInfo, 'numberCard', res
- // .data.data.recPersonNo)
- // }
- // }
- // }).catch(res => {
- // uni.showToast({
- // title: res.data.message,
- // icon: 'none',
- // duration: 2000
- // })
- // })
- },
- },
- };
- </script>
- <style lang="scss" scoped>
- // .preview-card-img {
- // /deep/uni-image>div, uni-image>img {
- // transform: scale(1.5) rotate(-90deg);
- // }
- // }
- /deep/.uni-input-input:disabled {
- background: #fff;
- }
- .picture {
- margin-top: 20rpx;
- background: #F5F6FA;
- width: 212rpx;
- height: 212rpx;
- border-radius: 20rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- color: #6A7282;
- }
- .content1 {
- background: white;
- margin: 20rpx;
- padding: 20rpx;
- border-radius: 20rpx;
- .row-ch {
- padding-right: 180rpx;
- box-sizing: border-box;
- // background-color: red;
- }
- }
- .content2 {
- margin: 10px 0 95px 0;
- .left-text {
- // background: red;
- width: 290rpx;
- color: #333333;
- display: flex;
- align-items: center;
- font-size: 14px;
- }
- .row {
- border-bottom: 1px solid #EEEEEE;
- padding-bottom: 28rpx;
- margin-top: 26rpx;
- .ch-style {
- text-align: left;
- }
- }
- .row-ch {
- padding-right: 180rpx;
- box-sizing: border-box;
- // background-color: red;
- }
- }
- .content2,
- .content3 {
- .del-bank {
- position: absolute;
- top: 0;
- right: 0;
- width: 80rpx;
- height: 80rpx;
- }
- .picture {
- width: 100%;
- height: 440rpx;
- position: relative;
- .text {
- margin-top: 20rpx;
- }
- }
- .picture1 {
- background: url(../../../static/mine/zm.png);
- background-size: 100% 100%;
- }
- .picture2 {
- background: url(../../../static/mine/gh.png);
- background-size: 100% 100%;
- }
- .picture3 {
- background: url(../../../static/mine/yhkzm.png);
- background-size: 100% 100%;
- }
- .xj-image {
- width: 100rpx;
- height: 100rpx;
- }
- .title {
- color: #999999;
- margin: 20rpx 0;
- font-size: 14px;
- }
- }
- .u-input {
- font-size: 16px;
- }
- .content4 {
- position: fixed;
- bottom: 0;
- background: white;
- width: 100%;
- text-align: center;
- left: 0;
- box-sizing: border-box;
- ;
- padding: 10px 15px;
- .line {
- position: absolute;
- left: 0;
- margin-top: -9px;
- border-top: 1px solid #eee;
- width: 100%;
- }
- .next-btn {
- background: #2772FB;
- width: 85%;
- padding: 20rpx 20rpx;
- text-align: center;
- color: white;
- border-radius: 50rpx;
- margin: 0 auto;
- margin-top: 10px;
- }
- }
- .del-card {
- position: absolute;
- top: -10rpx;
- right: -6rpx;
- width: 80rpx;
- height: 80rpx;
- z-index: 9;
- }
- .bz {
- font-size: 28rpx;
- }
- .right {
- width: 16px;
- height: 16px;
- position: relative;
- top: 1px;
- }
- </style>
|