123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593 |
- <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">
- <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 class="" @click="uploadImg">
- <image src="../../../static/images/xiangji-2.png" mode=""
- style="width: 40rpx ;height: 40rpx;margin-top: 10rpx;"></image>
- </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">
- <!-- <u--input @click="selectZhbank" placeholder="选择开户支行" inputAlign='left' border="none" disabled>
- </u--input> -->
- <!-- <u--input class="select-bankzh point" placeholder="选择开户支行" inputAlign='left' border="none"
- v-model="dataDetails.bankDepositBranch">
- </u--input> -->
- <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 v-if='!disabled' placeholder="输入持卡人姓名" inputAlign='left' border="none"
- v-model="dataDetails.cardholderName">
- </u--input>
- <view v-else>
- {{dataDetails.cardholderName}}
- </view>
- </view>
- </view>
- <view class="flex row noborder">
- <view class="left-text">持卡人身份证号</view>
- <view class="flex">
- <u--input v-if='!disabled' placeholder="输入持卡人身份证号" inputAlign='left' border="none"
- v-model="dataDetails.cardholderIdNumber" maxlength="18">
- </u--input>
- <view v-else>
- {{dataDetails.cardholderIdNumber}}
- </view>
- </view>
- </view>
- <view class="flex row noborder" v-if="enterpriseShow">
- <view class="left-text">企业名称</view>
- <view class="flex">
- <u--input placeholder="输入企业名称" inputAlign='left' border="none" v-model="dataDetails.companyName"
- maxlength="18">
- </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, 1000)">提交</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 permision from "@/js_sdk/wa-permission/permission.js"
- import uploadImage from '@/components/ossutil/uploadFile.js';
- var _this;
- import {
- mapState
- } from 'vuex';
- export default {
- components: {},
- data() {
- return {
- isShowimgType: false,
- dataDetails: {
- commonId: '',
- // payeeAddressUrl: '',
- bankCard: '',
- bankDeposit: '',
- bankDepositBranch: '',
- },
- disabled: false,
- imagesrc: '',
- submitstatus: false,
- columns: [
- ],
- isShowBank: false,
- isShowManualInput: false,
- index: '',
- id: "", //司机身份证号
- name: "", //司机姓名
- enterpriseShow: false, //判断是否有企业
- enterprise: ""
- };
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo', 'firstAuthentication']),
- },
- onLoad(options) {
- if (options && options.enterprise) { //判断是否是从企业页面进来的(有则是)
- this.enterprise = options.enterprise
- }
- console.log(this.firstAuthentication.enterpriseOwner)
- if (this.firstAuthentication.enterpriseOwner && this.firstAuthentication.enterpriseOwner == 1 && this
- .enterprise) {
- this.enterpriseShow = true
- }
- this.get_camera_permission()
- _this = this;
- // this.dataDetails.driverId = this.userInfo.driverId
- _this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', { //查身份证号
- phone: uni.getStorageSync("userInfo").phone
- }).then(res => {
- if (res.data.authenticationStatus == '已认证') {
- this.id = res.data.cardNumber
- this.name = res.data.name
- this.dataDetails.cardholderIdNumber = res.data.cardNumber
- this.dataDetails.cardholderName = res.data.name
- this.disabled = true
- }
- })
- },
- 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 (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)) {
- if (this.dataDetails.bankCard) {
- this.$refs.uToast.show({
- type: 'error',
- message: "请手动输入开户支行!",
- })
- return true
- } else {
- 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.dataDetails.bankDepositBranch = ''
- this.imgTypeSelect()
- // this.isShowimgType = true
- },
- 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 (uni.$u.test.rangeLength(this.dataDetails.bankCard, [16, 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 (uni.$u.test.rangeLength(this.dataDetails.bankDeposit, [4, 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 (uni.$u.test.rangeLength(this.dataDetails.bankDepositBranch, [4, 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.cardholderIdNumber)) {
- this.$refs.uToast.show({
- type: 'error',
- message: "持卡人身份证号不能为空!",
- })
- return true
- }
- },
- imgTypeSelect(val) {
- console.log(val)
- // if (val.name == '相册') {
- uni.chooseImage({
- sizeType: ['compressed'],
- count: 1,
- // 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 => {
- console.log(res)
- _this.dataDetails.payeeAddressUrl = result
- _this.columns = []
- if (res.data.bankNo) {
- _this.dataDetails.bankCard = res.data.bankNo
- }
- if (res.data.bankName) {
- _this.dataDetails.bankDeposit = res.data.bankName
- }
- // 开户支行LIst
- 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');
- // }
- },
- submit() {
- let 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);
- // });
- console.log(this.name)
- if (that.validate()) return //校验 511303198809243079
- if (!this.submitstatus) {
- this.submitstatus = true
- if (that.dataDetails.cardholderName != this.name && this.name != '') {
- that.$refs.uToast.show({
- type: 'error',
- message: "收款人须为货主本人!",
- })
- return
- } else {
- uni.showLoading({
- title: '加载中',
- mask: true
- })
- that.$request.baseRequest('get', '/driverPayeeInfo/bankCradShibie', { //三要素验证
- name: that.dataDetails.cardholderName, //持卡人姓名
- idCard: this.id, //货主身份证号
- accountNo: that.dataDetails.bankCard //卡号
- }).then(response => {
- if (response.data.distinguishNum == "01") {
- that.dataDetails.commonId = uni.getStorageSync("userInfo").id
- delete that.dataDetails.payeeAddressUrl
- that.$request.baseRequest('post', '/hyCargoOwnerPayeeInfo/api/addPayee',
- that.dataDetails).then(res => {
- uni.hideLoading()
- if (res.code == '200') {
- let params = {
- type: 'success',
- message: "提交成功",
- }
- this.submitstatus = false
- that.$refs.uToast.show({
- ...params
- })
- //uni.$u.route('/pages/mine/manageBankCards/index');
- uni.navigateBack({
- delta: 1
- });
- } else {
- this.submitstatus = false
- uni.$u.toast(res.message);
- }
- })
- .catch(res => {
- uni.hideLoading()
- this.submitstatus
- uni.$u.toast(res.message);
- });
- } else {
- uni.hideLoading()
- this.submitstatus = false
- uni.$u.toast(response.data.distinguish);
- }
- })
- }
- }
- },
- },
- };
- </script>
- <style scoped lang="scss">
- .row4-img {
- width: 32rpx;
- height: 32rpx;
- }
- .content {
- padding: 20rpx;
- height: calc(100vh - 23vh);
- }
- .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;
- }
- .submit-btn {
- position: fixed;
- bottom: 40rpx;
- width: 90%;
- background: #2772FB;
- color: white;
- text-align: center;
- margin-left: 5%;
- 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>
|