123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774 |
- <template>
- <view class="center">
- <view>
- <!-- 上传银行卡正面 -->
- <upload class="upload" :file-list='payeeAddressUrlList[0]' ref="upload" :action="action" :max-size="maxSize"
- :max-count="1" :size-type="['compressed']" @on-success="getImgUrl" @on-remove="onRemove"
- delIconSize='30' delBgColor='rgba(0,0,0,0.4)' delIcon="trash"
- @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions"
- :custom="uploadCustom"></upload>
- <!-- 上传银行卡反面 -->
- <upload class="upload" :file-list='payeeAddressUrlList[1]' ref="upload" :action="action" :max-size="maxSize"
- :max-count="1" :size-type="['compressed']" @on-success="getImgUrl1" @on-remove="onRemove"
- delIconSize='30' delBgColor='rgba(0,0,0,0.4)' delIcon="trash"
- @on-uploaded="isAdd = true" :before-upload="filterFileType" :options="uploadOptions1"
- :custom="uploadCustom"></upload>
- </view>
- <view class="person-info">
- <view class="c-row b-b">
- <text class="tit">银行卡号</text>
- <view class="con-list">
- <input type='number' placeholder="请填写银行卡号" name="input"
- v-model="identityAuthenticationInfo.bankCard"></input>
- </view>
- </view>
- <view class="c-row b-b">
- <text class="tit">开户行</text>
- <view class="con-list">
- <input placeholder="请填写开户行" name="input" v-model="identityAuthenticationInfo.bankDeposit"></input>
- </view>
- </view>
- <view class="c-row b-b">
- <text class="tit">开户支行</text>
- <view v-if="zhihangStatus" class="con-list">
- <picker @change="bankChange" :value="bankIndex" :range="bankType" class="con-list">
- <view class="con-list">
- {{bankIndex>-1?bankType[bankIndex]:'请选择开户支行'}}
- </view>
- </picker>
- </view>
- <view v-else class="con-list">
- <input placeholder="请填写" name="input" v-model="identityAuthenticationInfo.bankDepositBranch"></input>
- </view>
- <button v-if="zhihangStatus" class='cu-btn bg-green shadow' @click="changeZhihang">填写</button>
- <button v-else class='cu-btn bg-green shadow' @click="changeZhihang">识别</button>
- </view>
- <view class="c-row b-b">
- <text class="tit_red">*</text>
- <text class="tit">手机号</text>
- <view class="con-list">
- <input placeholder="请填写手机号" @input='phoneinput' type="number" maxlength="11"
- v-model="identityAuthenticationInfo.customerPhone"></input>
- </view>
- </view>
- <view style='width:100%;border-bottom:1px solid #E8E9ED;padding:10px;' class="flex">
- <button :class='codestatus&&!sendDisabled?"active":""' @click='obtain' class='getcode'>{{sendText}}</button>
- <view class="con-list" style='position:relative;'>
- <input style='text-align:right;' v-model='verifyCode' placeholder="请输入验证码" type="number" maxlength="6">
- </view>
- </view>
- <!-- <view class="c-row b-b" v-if="identityAuthenticationInfo.customerTypeFlag == 2">
- <text class="tit">公司地址</text>
- <view class="con-list">
- <input placeholder="请填写公司地址" name="input" v-model="identityAuthenticationInfo.compAddress"></input>
- </view>
- </view>
- <view class="c-row b-b" v-if="identityAuthenticationInfo.customerTypeFlag == 1">
- <text class="tit">联系地址</text>
- <view class="con-list">
- <input placeholder="请填写联系地址" name="input" v-model="identityAuthenticationInfo.compAddress"></input>
- </view>
- </view> -->
- <view class="c-row b-b" >
- <text class="tit">供应商姓名</text>
- <view class="con-list">
- <input placeholder="请填写供应商姓名" name="input" v-model="identityAuthenticationInfo.supplier"></input>
- </view>
- </view>
- <view class="c-row b-b" >
- <text class="tit">供应商电话</text>
- <view class="con-list">
- <input placeholder="请填写供应商电话" name="input"
- v-model="identityAuthenticationInfo.supplierPhone"></input>
- </view>
- </view>
- </view>
-
- <button class="btns btn" @click="commit">提交</button>
- </view>
- </template>
- <script>
- import upload from '@/components/upload.vue';
- import {
- mapState
- } from 'vuex';
- export default {
- components: {
- upload
- },
- name: "buy",
- data() {
- return {
- action: this.$uploadUrl,
- maxSize: 50 * 1024 * 1024, //限制文件大小 50M
- btnLoading: false, //防止重复点击
- isAdd: true,
- imgUrls: [],
- uploadCustom: true,
- uploadCustom1: true,
- uploadOptions: {
- "text": "上传银行卡正面",
- "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/bankup%282%29.png"
- },
- uploadOptions1: {
- "text": "上传银行卡反面",
- "bgc": "https://taohaoliang.oss-cn-beijing.aliyuncs.com/app/tmp/banklow%282%29.png"
- },
- // bank1: "../../static/img/authentication/bankup(3).png",
- // bank2: "../../static/img/authentication/banklow(3).png",
- bankid: [],
- consentStatus: true,
- consentStatus1: false,
- codestatus: false,
- verifyCode: null,
- inputStatus: 'none',
- sendText: '获取验证码',
- platform: '',
- sendDisabled: false,
- identityAuthenticationInfo: {},
- bankImgs1: {},
- bankIndex: -1,
- bankType: [],
- certificates: true,
- certificatesTwo: true,
- zhihangStatus: true,
- verification: true,
- identityAuthenticationInfos: {},
- payeeAddressUrlList: []
- }
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo'])
- },
- onLoad(options) {
- this.identityAuthenticationInfo = JSON.parse(options.identityAuthenticationInfo)
- if (this.identityAuthenticationInfo.customerTypeFlag == 1) {
- this.identityAuthenticationInfo.payeeName = this.identityAuthenticationInfo.customerName
- this.identityAuthenticationInfo.payeeNumberCard = this.identityAuthenticationInfo.customerNumberCard
- }
- if (this.identityAuthenticationInfo.payeeAddressUrl) {
- let _lsit = []
- _lsit = this.identityAuthenticationInfo.payeeAddressUrl.split(',')
- this.payeeAddressUrlList[0] = [{
- url: _lsit[0]
- }]
- this.payeeAddressUrlList[1] = [{
- url: _lsit[0]
- }]
- }
- },
- methods: {
- filterFileType(index, lists) {
- if (lists[index].fileType != 'jpg' && lists[index].fileType != 'png' && lists[index].fileType != 'gif') {
- lists.splice(index, 1);
- // 当前文件不支持
- uni.showModal({
- title: '暂不支持当前图片类型',
- showCancel: false
- });
- } else {
- this.isAdd = false;
- }
- },
- getImgUrl(res) {
- console.log(res)
- console.log('------------res-----------')
- let that = this
- that.bankid[0] = res
- that.bank1 = res
- that.certificates = false
- that.bankImgs1.bankImg = res
- that.$api.doRequest('get', '/driverViewInfo/bankShibie', that
- .bankImgs1).then(res => {
- if (res.data.data.bankNo != null) {
- if (res.data.data.bankNo != "") {
- that.$set(that.identityAuthenticationInfo,
- 'bankCard', res.data.data.bankNo)
- }
- }
- if (res.data.data.bankName != null) {
- if (res.data.data.bankName != "") {
- that.$set(that.identityAuthenticationInfo,
- 'bankDeposit', res.data.data.bankName)
- }
- }
- if (res.data.data.bankNameZhihang.length != 0) {
- that.bankType = res.data.data.bankNameZhihang
- }
- }).catch(res => {
- uni.showToast({
- title: res.data.message,
- icon: 'none',
- duration: 2000
- })
- })
- },
- getImgUrl1(res) {
- console.log(res)
- console.log('------------res-----------')
- let that = this
- that.bankid[1] = res
- that.bank2 = res
- that.certificatesTwo = false
- that.bankImgs1.bankImg = res
- // that.$api.doRequest('get', '/driverViewInfo/bankShibie', that
- // .bankImgs1).then(res => {
- // if (res.data.data.bankNo != null) {
- // if (res.data.data.bankNo != "") {
- // that.$set(that.identityAuthenticationInfo,
- // 'bankCard', res.data.data.bankNo)
- // }
- // }
- // if (res.data.data.bankName != null) {
- // if (res.data.data.bankName != "") {
- // that.$set(that.identityAuthenticationInfo,
- // 'bankDeposit', res.data.data.bankName)
- // }
- // }
- // if (res.data.data.bankNameZhihang != null) {
- // that.bankType = res.data.data.bankNameZhihang
- // }
- // }).catch(res => {
- // uni.showToast({
- // title: res.data.message,
- // icon: 'none',
- // duration: 2000
- // })
- // })
- },
- onError(error) {
- // alert(error)
- console.log('------------error-----------')
- console.log(error)
- },
- onProgress(e) {
- console.log(e)
- },
- onRemove(index) {
- this.imgUrls.splice(index, 1);
- },
- obtain() {
- if (this.sendText == "获取验证码") {
- this.getcode()
- }
- },
- bankChange(e) {
- this.bankIndex = e.detail.value
- this.Model = this.bankType[this.bankIndex];
- this.identityAuthenticationInfo.bankDepositBranch = this.bankType[this.bankIndex];
- },
- changeZhihang() {
- this.zhihangStatus = !this.zhihangStatus
- },
- commit() {
- var that = this
- if (this.bankid[0] == '' || this.bankid[0] == null) {
- this.$api.msg('请上传银行卡正面')
- return
- }
- // if (this.bankid[1] == '' || this.bankid[1] == null) {
- // this.$api.msg('请上传银行卡反面')
- // return
- // }
- if (!this.identityAuthenticationInfo.bankCard) {
- this.$api.msg('银行卡号不能为空')
- return
- }
- if (this.identityAuthenticationInfo.bankCard.length < 16 || this.identityAuthenticationInfo.bankCard
- .length > 19) {
- this.$api.msg('银行卡号输入错误')
- return
- }
- if (!this.identityAuthenticationInfo.bankDeposit) {
- this.$api.msg('开户行不能为空')
- return
- }
- if (this.identityAuthenticationInfo.bankDeposit.length < 4 || this.identityAuthenticationInfo.bankDeposit
- .length > 15) {
- this.$api.msg('开户行输入错误')
- return
- }
- if (!this.identityAuthenticationInfo.bankDepositBranch) {
- this.$api.msg('开户支行不能为空')
- return
- }
- if (this.identityAuthenticationInfo.bankDepositBranch.length < 4 || this.identityAuthenticationInfo
- .bankDepositBranch.length > 30) {
- this.$api.msg('开户支行输入错误')
- return
- }
- if (!this.identityAuthenticationInfo.customerPhone) {
- this.$api.msg('手机号不能为空')
- return
- }
- if (this.identityAuthenticationInfo.customerPhone.length != 11) {
- this.$api.msg('手机号填写不正确')
- return
- }
- if (!this.verifyCode) {
- this.$api.msg('请填写验证码')
- return
- }
- if (this.identityAuthenticationInfo.customerTypeFlag == 1) {
- if (!this.identityAuthenticationInfo.payeeName) {
- this.$api.msg('收款人姓名不能为空')
- return
- }
- if (this.identityAuthenticationInfo.payeeName < 2 || this.identityAuthenticationInfo.payeeName > 10) {
- this.$api.msg('收款人姓名输入错误')
- return
- }
- if (!this.identityAuthenticationInfo.payeeNumberCard) {
- this.$api.msg('收款人身份证号不能为空')
- return
- }
- if (this.identityAuthenticationInfo.payeeNumberCard.length != 18) {
- this.$api.msg('收款人身份证号输入错误')
- return
- }
- // if (!this.identityAuthenticationInfo.compAddress) {
- // this.$api.msg('联系地址不能为空')
- // return
- // }
- // if (this.identityAuthenticationInfo.compAddress.length < 2 || this.identityAuthenticationInfo
- // .compAddress.length > 40) {
- // this.$api.msg('联系地址输入错误')
- // return
- // }
- } else if (this.identityAuthenticationInfo.customerTypeFlag == 2) {
- if (!this.identityAuthenticationInfo.compAddress) {
- this.$api.msg('公司地址不能为空')
- return
- }
- if (this.identityAuthenticationInfo.compAddress.length < 2 || this.identityAuthenticationInfo
- .compAddress.length > 20) {
- this.$api.msg('公司地址输入错误')
- return
- }
- }
- this.amendprice()
- },
- phoneinput(e) {
- console.log(e.detail.value.length)
- if (e.detail.value.length == 11) {
- this.codestatus = true
- }
- },
- amendprice() {
- var that = this
- uni.showModal({
- content: "粮商身份信息审核通过后不可修改,是否确定提交?",
- showCancel: true,
- confirmText: '确定',
- success: function(res) {
- if (res.confirm) {
- uni.showLoading({
- title: "正在提交",
- mask: true
- })
- that.$api.doRequest('get', '/commonUser/loginVerifyCode', {
- phone: that.identityAuthenticationInfo.customerPhone,
- verifyCode: that.verifyCode
- }).then(res => {
- if (res.data.code == 200) {
- if (that.userInfo) {
- that.identityAuthenticationInfo.commonId = that.userInfo.id
- } else {
- that.identityAuthenticationInfo.commonId = res.data.data.id
- }
- that.identityAuthenticationInfo.payeeAddressUrl = that.bankid.toString()
- // that.identityAuthenticationInfo.compId = "2710b21efc1e4393930c5dc800010dc4"
- that.identityAuthenticationInfos.customerPhone = that
- .identityAuthenticationInfo.customerPhone
- that.$api.doRequest('get',
- '/identityAuthenticationInfo/selectPhone', that
- .identityAuthenticationInfos)
- .then(res => {
- if (res.data.code == '11018') {
- uni.showModal({
- title: '提示',
- content: '该手机号已认证过个人粮商,再次认证将覆盖之前的认证信息,是否确定认证?',
- success: function(res) {
- if (res.confirm) {
- if (that
- .identityAuthenticationInfo
- .id) {
- that.$api.doRequest(
- 'post',
- '/identityAuthenticationInfo/api/editIdentityAuthenticationInfo',
- that
- .identityAuthenticationInfo,
- 'application/json;charset=UTF-8'
- ).then(res => {
- console
- .log(
- "成功连接"
- )
- if (!that
- .identityAuthenticationInfo
- .goodsName
- ) {
- that.$api
- .msg(
- '修改成功!'
- )
- uni.navigateTo({
- url: `/pages/attestation/index`
- })
- return
- }
- })
- .catch(res => {
- if (res
- .errmsg
- ) {
- uni.showToast({
- title: res
- .errmsg,
- icon: 'none',
- duration: 2000
- })
- } else {
- uni.showToast({
- title: "系统异常,请联系管理员",
- icon: 'none',
- duration: 2000
- })
- }
- });
- } else {
- that.$api.doRequest(
- 'post',
- '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo',
- that
- .identityAuthenticationInfo
- )
- .then(res => {
- if (res.data.code ==200) {
- uni.showToast({
- title: '提交成功',
- icon: 'none',
- duration: 2000
- })
- //判断是不是从邀请页面进来的,如果是邀请进来的就直接邀请成功!
- if(that.identityAuthenticationInfo.invitation || that.identityAuthenticationInfo.inviteCompany){
- that.$api.doRequest('get', '/identityAuthenticationInfo/saveCompanyIdentity', {
- id: res.data.data,
- compId: that.identityAuthenticationInfo.inviteCompany,
- }, 'application/json;charset=UTF-8').then(res => {
- if (res.data.code == 200) {
- // this.getList()
- }
- })
- .catch(res => {
- if (res.message) {
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- } else {
- uni.showToast({
- title: "接受邀请失败,请稍后再试。",
- icon: 'none',
- duration: 2000
- })
- }
- });
- }
- setTimeout(() => {
- uni.navigateBack({
- delta: 3
- })
- },
- 2000
- );
-
- }
- })
- }
- }
- }
- });
- } else if (res.data.code == 200) {
- if (that.identityAuthenticationInfo.id) {
- that.$api.doRequest('post',
- '/identityAuthenticationInfo/api/editIdentityAuthenticationInfo',
- that.identityAuthenticationInfo,
- 'application/json;charset=UTF-8').then(
- res => {
- console.log("成功连接")
- if (!that
- .identityAuthenticationInfo
- .goodsName) {
- that.$api.msg('修改成功!')
- uni.navigateTo({
- url: `/pages/attestation/index`
- })
- return
- }
- })
- .catch(res => {
- if (res.errmsg) {
- uni.showToast({
- title: res.errmsg,
- icon: 'none',
- duration: 2000
- })
- } else {
- uni.showToast({
- title: "系统异常,请联系管理员",
- icon: 'none',
- duration: 2000
- })
- }
- });
- } else {
- that.$api.doRequest('post',
- '/identityAuthenticationInfo/api/addIdentityAuthenticationInfo',
- that.identityAuthenticationInfo)
- .then(res => {
- console.log(
- "addIdentityAuthenticationInfo:",
- res)
- if (res.data.code == 200) {
- uni.showToast({
- title: '提交成功',
- icon: 'none',
- duration: 2000
- })
- //判断是不是从邀请页面进来的,如果是邀请进来的就直接邀请成功!
- if(that.identityAuthenticationInfo.invitation || that.identityAuthenticationInfo.inviteCompany){
- that.$api.doRequest('get', '/identityAuthenticationInfo/saveCompanyIdentity', {
- id: res.data.data,
- compId: that.identityAuthenticationInfo.inviteCompany,
- }, 'application/json;charset=UTF-8').then(res => {
- if (res.data.code == 200) {
- // this.getList()
- }
- })
- .catch(res => {
- if (res.message) {
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- } else {
- uni.showToast({
- title: "接受邀请失败,请稍后再试。",
- icon: 'none',
- duration: 2000
- })
- }
- });
- }
- setTimeout(() => {
- uni.navigateBack({
- delta: 3
- })
- }, 2000);
- } else {
- console.log("异常1:", res)
- uni.showToast({
- title: "系统异常,请联系管理员",
- icon: 'none',
- duration: 2000
- })
- }
- })
- }
- }
- uni.hideLoading()
- }).catch(res => {
- console.log("异常:", res)
- uni.showToast({
- title: "系统异常,请联系管理员",
- icon: 'none',
- duration: 2000
- })
- uni.hideLoading()
- })
- } else {
- that.verification = false
- uni.showToast({
- title: res.data.message,
- icon: 'none',
- duration: 2000
- })
- uni.hideLoading()
- return false
- }
- })
- .catch(res => {
- that.verification = false
- uni.showToast({
- title: res.data.message,
- icon: 'none',
- duration: 2000
- })
- uni.hideLoading()
- return false
- });
- } else if (res.cancel) {
- // console.log('用户点击取消');
- }
- }
- })
-
- },
- getcode() {
- var that = this
- if (/^0?1[3|4|5|6|7|8][0-9]\d{8}$/.test(this.identityAuthenticationInfo.customerPhone)) {
- this.$api.doRequest('get', '/commonUser/sendVerifyCode', {
- phone: this.identityAuthenticationInfo.customerPhone
- }).then(res => {
- if (res.data.code == 200) {
- that.sendDisabled = true
- let sec = 60
- let interval = setInterval(() => {
- sec--;
- that.sendText = sec + 's后重发'
- if (sec <= 0) {
- that.sendDisabled = false
- that.sendText = "获取验证码"
- clearInterval(interval)
- }
- }, 1000)
- } else {
- uni.showToast({
- title: res.data.message,
- icon: 'none',
- duration: 2000
- })
- return
- }
- })
- .catch(res => {
- uni.showToast({
- title: res.data.message,
- icon: 'none',
- duration: 2000
- })
- return
- });
- } else {
- uni.showToast({
- title: '请输入正确的手机号',
- icon: 'none',
- duration: 2000
- })
- }
- },
- }
- }
- </script>
- <style>
- .center {
- padding: 10px 20px;
- background-color: #F5F6FA;
- }
- .c-row {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- padding: 20rpx 30rpx;
- position: relative;
- font-size: 14px;
- }
- .con-list {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- flex: 1;
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -webkit-flex-direction: column;
- flex-direction: column;
- color: #303133;
- line-height: 40rpx;
- text-align: right;
- padding-right: 20rpx;
- font-size: 12px;
- }
- .btn {
- margin-top: 10px;
- background-color: #FFFFFF;
- border-radius: 25px;
- border: none;
- }
- .btns {
- background-color: #22C572;
- color: white;
- }
- .picture {
- width: 100%;
- height: 220px;
- text-align: center;
- margin-top: 10px;
- }
- .getcode {
- font-size: 14px;
- color: #AFB3BF;
- background: #F5F6F9;
- height: 30px;
- line-height: 30px;
- }
- .getcode.active {
- background: #22C572;
- color: #fff;
- }
- .words {
- font-size: 18px;
- font-weight: 600;
- color: #617E8B;
- }
- .floats {
- position: relative;
- top: -150px;
- text-align: center;
- }
- .upload {
- margin: 20rpx 0;
- }
- .tit_red {
- color: #E54D42;
- }
- .person-info{
- background: white;
- padding: 20rpx;
- border-radius: 20rpx;
- margin-bottom: 50rpx;
- }
- </style>
|