123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556 |
- <template>
- <view class="content">
- <view class="content3 flex s-row">
- <view class="title">上传银行卡卡号页</view>
- <view @click="uploadImg" class="picture picture3" v-if="!dataDetails.payeeAddressUrl">
- <image class="xj-image" src="@/static/images/mine/ic_shanchuan@2x.png"></image>
- <view class="text">上传银行卡卡号页</view>
- </view>
- <view v-if="dataDetails.payeeAddressUrl" @click.stop="uploadImg" class="preview-card-img picture">
- <!-- <image class="card-img" :src="dataDetails.cardAddressUrl"></image> -->
- <view @click.stop="delCard">
- <image class='del-card' src="@/static/images/common/quxiao@2x.png">
- </image>
- </view>
- <image class="" :src="dataDetails.payeeAddressUrl" mode="aspectFit"></image>
- </view>
- <view class="flex row">
- <view class="left-text">银行卡卡号</view>
- <view class="flex">
- <u--input placeholder="输入银行卡号码" inputAlign='left' border="none" v-model="dataDetails.bankCard">
- </u--input>
- </view>
- </view>
- <view class="flex row">
- <view class="left-text">开户行</view>
- <u--input placeholder="输入开户行" inputAlign='left' border="none" v-model="dataDetails.bankDeposit">
- </u--input>
- </view>
- <view class="flex row">
- <view class="left-text khzh-styel">开户支行</view>
- <view class="flex align-center" v-if="isShowManualInput">
- <u--input class="select-bankzh point" placeholder="输入开户支行" inputAlign='left' border="none"
- v-model="dataDetails.bankDepositBranch">
- </u--input>
- <view @click="manualInput" class="type">选择支行</view>
- </view>
- <view class="flex align-center" v-if="!isShowManualInput">
- <view :style="{'color':dataDetails.bankDepositBranch?'#000':'#C6CBD5'}" style='font-size:15px;'
- class="select-bankzh" @click="selectZhbank">
- {{dataDetails.bankDepositBranch?dataDetails.bankDepositBranch:'选择开户支行'}}
- </view>
- <view @click="manualInput" class="type">手动输入</view>
- </view>
- </view>
- <view class="flex row noborder">
- <view class="left-text">收款人</view>
- <view class="flex">
- <u--input placeholder="输入收款人姓名" inputAlign='left' border="none" v-model="dataDetails.payeeName">
- </u--input>
- </view>
- </view>
- <u-picker :show="isShowBank" :columns="columns" :closeOnClickOverlay='true' @close='zhBankClose'
- @cancel='zhBankClose' @confirm='confirmBank'></u-picker>
- </u-picker>
- <view class="" style="color: red;font-size: 26rpx;margin-top: 20rpx;">*收款人须为司机本人</view>
- </view>
- <u-toast ref="uToast"></u-toast>
- <view class="submit-btn" @click="$u.throttle(submit, 5000)">提交</view>
- <u-action-sheet :actions="$helper.imgTypeList" :title="$helper.imgType" :show="isShowimgType"
- @select="imgTypeSelect" :closeOnClickOverlay="true" :closeOnClickAction="true" @close="isShowimgType=false">
- </u-action-sheet>
- </view>
- </template>
- <script>
- import upload from '@/components/upload.vue';
- import uploadImage from '@/components/ossutil/uploadFile.js';
- import permision from "@/js_sdk/wa-permission/permission.js"
- var _this;
- import {
- mapState
- } from 'vuex';
- export default {
- components: {},
- data() {
- return {
- isShowimgType: false,
- dataDetails: {
- driverId: '',
- payeeAddressUrl: '',
- bankCard: '',
- bankDeposit: '',
- bankDepositBranch: '',
- payeeName: '',
- },
- imagesrc: '',
- columns: [],
- isShowBank: false,
- isShowManualInput: false,
- index: ''
- };
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- onLoad() {
- _this = this;
- this.get_camera_permission()
- this.dataDetails.driverId = this.userInfo.driverId ? this.userInfo.driverId : uni.getStorageSync(
- "firstAuthentication").id
- },
- 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('用户点击取消');
- }
- }
- });
- }
- },
- delCard() {
- _this.dataDetails.payeeAddressUrl = ''
- _this.$forceUpdate()
- },
- uploadImg(type, ) {
- this.uploadType = type
- this.isShowimgType = true
- },
- zhBankClose() {
- this.isShowBank = false
- },
- // 选择支行
- selectZhbank() {
- if (!this.dataDetails.payeeAddressUrl) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请先上传银行卡!",
- })
- return true
- } else if (this.dataDetails.payeeAddressUrl && uni.$u.test.isEmpty(this.columns)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请选择手动输入开户支行!",
- })
- return true
- }
- this.isShowBank = true
- },
- confirmBank(e) {
- console.log(e)
- this.dataDetails.bankDepositBranch = e.value[0]
- this.isShowBank = false
- },
- manualInput() {
- if (this.isShowManualInput) {
- if (uni.$u.test.isEmpty(this.dataDetails.payeeAddressUrl)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请先上传银行卡!",
- })
- return true
- } else if (this.dataDetails.payeeAddressUrl && uni.$u.test.isEmpty(this.columns)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请选择手动输入开户支行!",
- })
- return true
- }
- this.isShowBank = true
- } else {
- this.isShowBank = false
- }
- this.isShowManualInput = !this.isShowManualInput
- },
- //设置图片
- 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);
- }
- },
- //保存图片到相册,方便核查
- savePhoto(path) {
- this.imagesrc = path;
- uploadImage(path, 'appData/',
- result => {
- // 上传成功
- console.log('图片地址', result)
- }
- )
- //保存到相册
- // uni.saveImageToPhotosAlbum({
- // filePath: path,
- // success: () => {
- // uni.showToast({
- // title: '已保存至相册',
- // duration: 2000
- // });
- // }
- // });
- },
- uploadImg() {
- this.imgTypeSelect()
- // this.isShowimgType = true
- },
- imgTypeSelect(val) {
- console.log(val)
- // if (val.name == '相册') {
- uni.chooseImage({
- count: 1,
- sizeType: ['compressed'],
- // sourceType: this.$helper.chooseImage.sourceType,
- success: function(res) {
- console.log(JSON.stringify(res.tempFilePaths));
- uploadImage('image', res.tempFilePaths[0], 'appData/',
- result => {
- // 上传成功
- console.log('图片地址', result)
- _this.$request.baseRequest('get',
- '/driverInfo/bankShibie', {
- bankImg: result,
- }).then(res => {
- _this.dataDetails.bankDepositBranch = ''
- _this.dataDetails.payeeAddressUrl = result
- if (res.data.bankNo) {
- _this.dataDetails.bankCard = res.data.bankNo
- }
- if (res.data.bankName) {
- _this.dataDetails.bankDeposit = res.data.bankName
- }
- // 开户支行List
- _this.columns=[]
- if (res.data.bankNameZhihang) {
- _this.columns.push(res.data
- .bankNameZhihang)
- }
- _this.$forceUpdate()
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- }
- )
- }
- });
- // } else {
- // uni.$u.route('/pages/mine/camera/idcard/idcard?dotype=bank');
- // }
- },
- validate() {
- // true 为校验不通过
- // if (uni.$u.test.isEmpty(this.dataDetails.payeeAddressUrl)) {
- // this.$refs.uToast.show({
- // type: 'error',
- // message: "请上传银行卡卡号页!",
- // })
- // return true
- // }
- if (uni.$u.test.isEmpty(this.dataDetails.bankCard)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "银行卡卡号不能为空!",
- })
- return true
- }
- if (this.dataDetails.bankCard.length < 16 || this.dataDetails.bankCard.length > 20) {
- this.$refs.uToast.show({
- type: 'error',
- message: "银行卡号输入错误!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataDetails.bankDeposit)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "开户行不能为空!",
- })
- return true
- }
- if (this.dataDetails.bankDeposit.length < 4 || this.dataDetails.bankDeposit.length > 25) {
- this.$refs.uToast.show({
- type: 'error',
- message: "开户行输入错误!",
- })
- return true
- }
- if (uni.$u.test.isEmpty(this.dataDetails.bankDepositBranch)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "开户支行不能为空!",
- })
- return true
- }
- if (this.dataDetails.bankDepositBranch.length < 4 || this.dataDetails.bankDepositBranch.length > 25) {
- this.$refs.uToast.show({
- type: 'error',
- message: "开户支行输入错误!",
- })
- return true
- }
- // if (uni.$u.test.isEmpty(this.dataDetails.cardholderName)) {
- // this.$refs.uToast.show({
- // type: 'error',
- // message: "持卡人姓名不能为空!",
- // })
- // return true
- // }
- if (uni.$u.test.isEmpty(this.dataDetails.payeeName)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "收款人姓名不能为空!",
- })
- return true
- }
- // if (uni.$u.test.isEmpty(this.dataDetails.cardholderIdNumber)) {
- // this.$refs.uToast.show({
- // type: 'error',
- // message: "持卡人身份证号不能为空!",
- // })
- // return true
- // }
- },
- //身份证正面
- 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
- // })
- // })
- },
- submit() {
- var that = this
- // // 获取银行卡颜色
- // let _obj = {
- // "input":this.dataDetails.payeeAddressUrl
- // }
- // this.$request.baseRequest('post', '/ClothingColorController/recognition', _obj)
- // .then(res => {
- // if (res.code == '200') {
- // this.dataDetails.cardColor = res.data
- // } else {
- // uni.$u.toast(res.message);
- // }
- // })
- // .catch(res => {
- // uni.$u.toast(res.message);
- // });
- if (that.validate()) return
- if (this.dataDetails.payeeName != uni.getStorageSync("firstAuthentication").driverName) {
- this.$refs.uToast.show({
- type: 'error',
- message: "收款人须为司机本人!",
- })
- return
- } else {
- this.$request.baseRequest('get', '/driverPayeeInfo/bankCradShibie', {
- name: this.dataDetails.payeeName,
- idCard: uni.getStorageSync("firstAuthentication").numberCard,
- accountNo: this.dataDetails.bankCard
- }).then(
- res => {
- if (res.data.distinguishNum == "01") {
- this.dataDetails.commonId = this.userInfo.id
- this.$request.baseRequest('post', '/driverPayeeInfo/api/addInfo', this.dataDetails)
- .then(
- res => {
- if (res.code == '200') {
- let params = {
- type: 'success',
- message: "提交成功",
- }
- this.$refs.uToast.show({
- ...params
- })
- uni.navigateBack({
- delta: 1
- });
- // uni.$u.route('/pages/mine/manageBankCards/index');
- } else {
- uni.$u.toast(res.message);
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- } else {
- uni.$u.toast(res.message);
- }
- })
- }
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .row4-img {
- width: 32rpx;
- height: 32rpx;
- }
- .content {
- padding: 20rpx;
- padding-bottom: 50rpx;
- height: 100vh;
- }
- .content3 {
- background: white;
- padding: 20rpx;
- box-sizing: border-box;
- .left-text {
- // background: red;
- width: 290rpx;
- color: #333333;
- display: flex;
- align-items: center;
- }
- .row {
- border-bottom: 1px solid #EEEEEE;
- padding-bottom: 28rpx;
- margin-top: 26rpx;
- .ch-style {}
- }
- .row-ch {
- padding-right: 180rpx;
- box-sizing: border-box;
- }
- }
- .title {
- color: #999999;
- margin: 20rpx 0;
- }
- .picture {
- margin-top: 20rpx;
- background: #F5F6FA;
- border-radius: 10rpx;
- display: flex;
- flex-direction: column;
- justify-content: center;
- align-items: center;
- color: #6A7282;
- width: 100%;
- height: 440rpx;
- position: relative;
- .text {
- margin-top: 20rpx;
- }
- }
- .xj-image {
- width: 100rpx;
- height: 100rpx;
- }
- .picture3 {
- background: url(../../../static/images/mine/yhkzm.png);
- background-size: 100% 100%;
- }
- .select-bankzh {
- width: 230rpx;
- // height: 48rpx;
- }
- .type {
- background: #2772FB;
- border-radius: 10rpx;
- color: white;
- box-sizing: border-box;
- padding: 4rpx 10rpx;
- font-size: 26rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- height: 68rpx;
- margin-left: 26rpx;
- }
- .submit-btn {
- position: fixed;
- bottom: 40rpx;
- width: 90%;
- background: #2772FB;
- color: white;
- text-align: center;
- margin: 2%;
- padding: 30rpx 0;
- border-radius: 50rpx;
- }
- .del-card {
- position: absolute;
- top: -10rpx;
- right: -6rpx;
- width: 80rpx;
- height: 80rpx;
- z-index: 9;
- }
- .preview-card-img {
- // /deep/uni-image>div, uni-image>img {
- // transform: scale(1.5) rotate(-90deg);
- // }
- }
- </style>
|