123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481 |
- <template>
- <view class="container" style='padding-bottom: 190rpx;'>
- <view>
- <view class="cu-form-group">
- <radio-group name="" @change='radioChange'>
- <label v-for='(item,index) in list' class="radio">
- <radio :value="item.value" :checked='item.value==status' style="transform:scale(0.7);color:#000;" /><text>{{item.name}}</text>
- </label>
- </radio-group>
- </view>
- <view v-if='status==0' class="cu-form-group">
- <view class="title">公司名称</view>
- <input placeholder="请填写" name="input" v-model='data.companyName' @input='companyNameinput'></input>
- </view>
- <view v-if='status==0' class="cu-form-group">
- <view class="title">纳税人识别号</view>
- <input placeholder="请填写" name="input" v-model='data.identificationNo' @input='identificationNoinput'></input>
- </view>
- <view class="cu-bar bg-white">
- <view class="action">
- 身份证(正、反面)上传
- </view>
- </view>
- <view class="cu-form-group">
- <view class="grid col-2 grid-square flex-sub">
- <view class="bg-img" v-if="data.personNoImg != ''" @tap="ViewImage" :data-url="data.personNoImg">
- <image :src="data.personNoImg" mode="aspectFit"></image>
- <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="0">
- <text class='cuIcon-close'></text>
- </view>
- </view>
- <view class="bg-img" v-if="data.personNoImg1 != ''" @tap="ViewImage" :data-url="data.personNoImg1">
- <image :src="data.personNoImg1" mode="aspectFit"></image>
- <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="1">
- <text class='cuIcon-close'></text>
- </view>
- </view>
- <view class="solids" @tap="ChooseImagePerson" v-if="data.personNoImg == '' || data.personNoImg1 == ''">
- <text class='cuIcon-cameraadd'></text>
- </view>
- </view>
- </view>
- <view class="cu-form-group">
- <text class="tit">姓名</text>
- <view class="con-list">
- <input placeholder="请填写" name="input" v-model="data.personName" ></input>
- </view>
- </view>
- <view class="cu-form-group">
- <text class="tit">身份证号</text>
- <view class="con-list">
- <input placeholder="请填写" name="input" v-model="data.personNo" ></input>
- </view>
- </view>
- <view class="cu-bar bg-white">
- <view class="action">
- 银行卡(正、反面)上传
- </view>
- </view>
- <view class="cu-form-group">
- <view class="grid col-2 grid-square flex-sub">
- <view class="bg-img" v-if="data.bankImg != ''" @tap="ViewImage" :data-url="data.bankImg">
- <image :src="data.bankImg" mode="aspectFit"></image>
- <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="2">
- <text class='cuIcon-close'></text>
- </view>
- </view>
- <view class="bg-img" v-if="data.bankImg1 != ''" @tap="ViewImage" :data-url="data.bankImg1">
- <image :src="data.bankImg1" mode="aspectFit"></image>
- <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="3">
- <text class='cuIcon-close'></text>
- </view>
- </view>
- <view class="solids" @tap="ChooseImageBank" v-if="data.bankImg == '' || data.bankImg1 == ''">
- <text class='cuIcon-cameraadd'></text>
- </view>
- </view>
- </view>
- <view class="cu-form-group">
- <text class="tit">开户行</text>
- <view class="con-list">
- <input placeholder="请填写" name="input" v-model="data.companyBank" @input="bankAccountInput"></input>
- </view>
- </view>
- <view class="cu-form-group">
- <text class="tit">银行卡号</text>
- <view class="con-list">
- <input placeholder="请填写" name="input" v-model="data.accountNo" @input="bankNoInput"></input>
- </view>
- </view>
- <view class="cu-form-group">
- <text class="tit">开户支行</text>
- <view v-if="zhihangStatus" style='width:56%;' class="con-list">
- <picker @change="bankNameChange" :value="bankNameIndex" :range="bankNameList">
- <view class="picker">
- {{bankNameIndex>-1?bankNameList[bankNameIndex]:'点击选择支行'}}
- </view>
- </picker>
- </view>
- <view v-else class="con-list">
- <input placeholder="请填写" name="input" v-model="bankNameZhihang" @input="bankNameZhihangInput"></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="cu-form-group">
- <view class="title">公司开户行</view>
- <input placeholder="请填写" name="input" v-model='data.companyBank' @input='companyBankinput'></input>
- </view>
- <view class="cu-form-group">
- <view class="title">公司账户</view>
- <input placeholder="请填写" name="input" v-model='data.accountNo' @input='accountNoinput'></input>
- </view> -->
- <view v-if='status==0' class="cu-form-group">
- <view class="title">公司电话</view>
- <input placeholder="请填写" name="input" v-model='data.companyPhone' @input='companyPhoneinput'></input>
- </view>
- <view v-else class="cu-form-group">
- <view class="title">电话</view>
- <input placeholder="请填写" name="input" v-model='data.companyPhone' @input='companyPhoneinput'></input>
- </view>
- <view v-if='status==1' class="cu-form-group">
- <view class="title">收款人姓名</view>
- <input placeholder="请填写" name="input" v-model='data.collectName' @input='collectNameinput'></input>
- </view>
- <view class="cu-form-group">
- <view class="title">验证码</view>
- <input type="mobile" value="" placeholder="6位验证码" maxlength="6"
- data-key="verifyCode" @input="verifyCodeInput" style="width: 60%;"></input>
- <button class='cu-btn bg-green shadow':disabled="sendDisabled" @click="doGetVerify">{{sendText}}</button>
- </view>
- <view v-if='status==0' class="cu-form-group">
- <view class="title">公司地址</view>
- <input placeholder="请填写" name="input" v-model='data.companyPlace' @input='companyPlaceinput'></input>
- </view>
- <view v-else class="cu-form-group">
- <view class="title">地址</view>
- <input placeholder="请填写" name="input" v-model='data.companyPlace' @input='companyPlaceinput'></input>
- </view>
- </view>
- <view class="page-bottom">
- <view class="action-btn-group">
- <button type="primary" class=" action-btn no-border buy-now-btn" style='width:50%;' @click="Company()">完成</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import uploadImage from '@/components/ossutil/uploadFile.js';
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- data:{
- accountNo: "",
- companyBank: "",
- companyName: "",
- personName:"",
- personNo:"",
- personNoImg:"",
- personNoImg1:"",
- bankImg:"",
- bankImg1:"",
- companyPhone: "",
- collectName:"",
- companyPlace: "",
- identificationNo: "",
- id:'',
- personNoImg:'',
- personNoImg1:'',
- personName:'',
- personNo:'',
- renown:0,
- bankImg:'',
- bankImg1:'',
- bankNameZhi:''
-
- },
- list:[
- {name:'公司',value:0},
- {name:'个人',value:1}
- ],
- status:0,
- verifyCode:'',
- sendText:'获取验证码',
- sendDisabled: false,
- requeststatus:0,
-
- bankAccount:'',
- bankNo:'',
- bankNameList:'',
- bankPhone:'',
-
- driver:'',
- driverNo:'',
- zhihangStatus:true,
- bankNameZhihang:'',
- bankNameIndex:-1
- }
- },
- computed: {
- },
- onShow() {
- },
- onLoad(options) {
- if(JSON.stringify(options)!='{}'){
- this.data.accountNo=options.accountNo
- this.data.companyBank=options.companyBank
- this.data.companyName=options.companyName
- this.data.companyPhone=options.companyPhone
- this.data.companyPlace=options.companyPlace
- this.data.identificationNo=options.identificationNo
- this.data.personNoImg=options.personNoImg
- this.data.personNoImg1=options.personNoImg1
- this.data.personName=options.personName
- this.data.personNo=options.personNo
- this.data.bankImg=options.bankImg
- this.data.bankImg1=options.bankImg1
- this.data.bankNameZhi=options.bankNameZhi
- this.data.id=options.id
- this.requeststatus='updateCompany'
- }else{
- this.requeststatus='addCompany'
- }
- },
- onReady(){
-
- },
- methods: {
- verifyCodeInput(e){
- this.verifyCode = e.detail.value
- },
- radioChange(e){
- this.data.renown=e.detail.value
- this.status=e.detail.value
- },
- changeZhihang(){
- this.zhihangStatus = !this.zhihangStatus
- },
- bankNameChange(e) {
- this.bankNameIndex = e.detail.value
- this.data.bankNameZhi = this.bankNameList[this.bankNameIndex]
- },
- DelImg(e) {
- uni.showModal({
- title: '提示',
- content: '确定要删除该照片吗?',
- cancelText: '取消',
- confirmText: '确定',
- success: res => {
- if (res.confirm) {
- if(e.currentTarget.dataset.index == 0){
- this.data.personNoImg = "";
- }
- else if(e.currentTarget.dataset.index == 1){
- this.data.personNoImg1 = "";
- }
- else if(e.currentTarget.dataset.index == 2){
- this.data.bankImg = "";
- }
- else if(e.currentTarget.dataset.index == 3){
- this.data.bankImg1= "";
- }
- else if(e.currentTarget.dataset.index == 4){
- this.data.otherImg = "";
- }
- else if(e.currentTarget.dataset.index == 5){
- this.data.poundImg = "";
- }
-
-
- }
- }
- })
- },
- doGetVerify() {
- const that = this
- var phone = this.data.companyPhone;
- if (!phone || phone.length != 11) {
- uni.showToast({
- title:'请输入正确手机号!',
- icon:'none'
- })
- return
- }
- that.$api.request('user', 'sendVerifyCode', {
- phone: phone,
- }).then(res => {
- 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)
- })
-
- },
- companyNameinput(e){
- this.data.companyName = e.detail.value
- },
- companyBankinput(e){
- this.data.companyBank = e.detail.value
- },
- accountNoinput(e){
- this.data.accountNo = e.detail.value
- },
- companyPhoneinput(e){
- this.data.companyPhone = e.detail.value
- },
- collectNameinput(e){
- this.data.collectName = e.detail.value
- },
- companyPlaceinput(e){
- this.data.companyPlace = e.detail.value
- },
- identificationNoinput(e){
- this.data.identificationNo = e.detail.value
- },
- ViewImage(e) {
- var img = [];
- img = e.currentTarget.dataset.url.split(' ')
- uni.previewImage({
- current:0,
- urls: img
- });
- },
- ChooseImageBank() {
- var that = this
- uni.showLoading({
- title: '正在识别',
- mask:true
- })
- uni.chooseImage({
- count: 1, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album','camera'], //从相册选择
- success: (res) => {
- //上传图片
- uploadImage(res.tempFilePaths[0], 'bankImg/',
- result => {
- if(that.data.bankImg == undefined){
- that.data.bankImg = ''
- }
- if (that.data.bankImg.length != 0) {
- that.data.bankImg1 = result
- uni.hideLoading()
- } else {
- that.data.bankImg = result
- that.$api.request('tran', 'bankShibie', {
- bankImg: result
- }, failres => {
- that.$api.msg(failres.errmsg)
- uni.hideLoading()
- }).then(res => {
- that.data.companyBank = res.data.bankName
- that.data.accountNo = res.data.bankNo
- that.bankNameList = res.data.bankNameZhihang
- console.log(that.bankNameList)
- that.bankPhone = res.data.bankPhone
- that.$api.msg('请核对开户行、支行和银行卡号')
- uni.hideLoading()
- })
- }
- }
- )
- }
- });
- },
- ChooseImagePerson() {
- const that = this
- uni.showLoading({
- title: '正在识别',
- mask:true
- })
- uni.chooseImage({
- count: 1, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album','camera'], //从相册选择
- success: (res) => {
- //上传图片
- //图片路径可自行修改
- uploadImage(res.tempFilePaths[0], 'personNoImg/',
- result => {
- if (this.data.personNoImg.length != 0) {
- this.data.personNoImg1 = result
- uni.hideLoading()
- } else {
- this.data.personNoImg = result
- that.$api.request('tran', 'personShibie', {
- personImg: result,
- type:"driver"
- }, failres => {
- that.$api.msg(failres.errmsg)
- uni.hideLoading()
- }).then(res => {
- that.data.personName = res.data.driver
- that.data.personNo = res.data.driverNo
- that.$api.msg('请核对身份信息')
- uni.hideLoading()
- })
- }
- }
- )
- }
- })
- },
- Company(item){
- var that = this
- if (!that.data.companyName&&that.status==0) {
- that.$api.msg('请填写公司名称');
- return
- }
- if (!that.data.identificationNo&&that.status==0) {
- that.$api.msg('请填写纳税人识别号');
- return
- }
- if (!that.data.companyBank) {
- that.$api.msg('请填写开户行')
- return
- }
- if(!that.data.accountNo){
- this.$api.msg('请填写账户');
- return;
- }
- if (!that.data.companyPhone) {
- that.$api.msg('请填写电话')
- return
- }
- if (!that.verifyCode) {
- that.$api.msg('请填写验证码')
- return
- }
- if(!that.data.personName){
- this.$api.msg('请填写姓名');
- return;
- }
- if (!that.data.personNo) {
- that.$api.msg('请填写身份证号')
- return
- }
- if (!that.data.collectName&&that.status==1) {
- that.$api.msg('请填写收款人姓名');
- return
- }
- var data=JSON.stringify(that.data)
- this.$api.request('company', that.requeststatus, {
- CompanyDo:data,
- verifyCode:that.verifyCode
- }, failres => {
- that.$api.msg(failres.errmsg)
- uni.hideLoading()
- }).then(res => {
- if(res.data.code=='SUCCESS'){
- if(that.requeststatus=='updateCompany'){
- that.$api.msg('修改成功')
- }else{
- that.$api.msg('添加成功')
- }
- uni.hideLoading()
- setTimeout(()=>{uni.navigateBack()},1000);
- }else{
- that.$api.msg(res.data.code)
- uni.hideLoading()
- }
- })
- },
- },
- }
- </script>
- <style>
- </style>
|