newcompany.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <view class="container" style='padding-bottom: 190rpx;'>
  3. <view>
  4. <view class="cu-form-group">
  5. <radio-group name="" @change='radioChange'>
  6. <label v-for='(item,index) in list' class="radio">
  7. <radio :value="item.value" :checked='item.value==status' style="transform:scale(0.7);color:#000;" /><text>{{item.name}}</text>
  8. </label>
  9. </radio-group>
  10. </view>
  11. <view v-if='status==0' class="cu-form-group">
  12. <view class="title">公司名称</view>
  13. <input placeholder="请填写" name="input" v-model='data.companyName' @input='companyNameinput'></input>
  14. </view>
  15. <view v-if='status==0' class="cu-form-group">
  16. <view class="title">纳税人识别号</view>
  17. <input placeholder="请填写" name="input" v-model='data.identificationNo' @input='identificationNoinput'></input>
  18. </view>
  19. <view class="cu-bar bg-white">
  20. <view class="action">
  21. 身份证(正、反面)上传
  22. </view>
  23. </view>
  24. <view class="cu-form-group">
  25. <view class="grid col-2 grid-square flex-sub">
  26. <view class="bg-img" v-if="data.personNoImg != ''" @tap="ViewImage" :data-url="data.personNoImg">
  27. <image :src="data.personNoImg" mode="aspectFit"></image>
  28. <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="0">
  29. <text class='cuIcon-close'></text>
  30. </view>
  31. </view>
  32. <view class="bg-img" v-if="data.personNoImg1 != ''" @tap="ViewImage" :data-url="data.personNoImg1">
  33. <image :src="data.personNoImg1" mode="aspectFit"></image>
  34. <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="1">
  35. <text class='cuIcon-close'></text>
  36. </view>
  37. </view>
  38. <view class="solids" @tap="ChooseImagePerson" v-if="data.personNoImg == '' || data.personNoImg1 == ''">
  39. <text class='cuIcon-cameraadd'></text>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="cu-form-group">
  44. <text class="tit">姓名</text>
  45. <view class="con-list">
  46. <input placeholder="请填写" name="input" v-model="data.personName" ></input>
  47. </view>
  48. </view>
  49. <view class="cu-form-group">
  50. <text class="tit">身份证号</text>
  51. <view class="con-list">
  52. <input placeholder="请填写" name="input" v-model="data.personNo" ></input>
  53. </view>
  54. </view>
  55. <view class="cu-bar bg-white">
  56. <view class="action">
  57. 银行卡(正、反面)上传
  58. </view>
  59. </view>
  60. <view class="cu-form-group">
  61. <view class="grid col-2 grid-square flex-sub">
  62. <view class="bg-img" v-if="data.bankImg != ''" @tap="ViewImage" :data-url="data.bankImg">
  63. <image :src="data.bankImg" mode="aspectFit"></image>
  64. <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="2">
  65. <text class='cuIcon-close'></text>
  66. </view>
  67. </view>
  68. <view class="bg-img" v-if="data.bankImg1 != ''" @tap="ViewImage" :data-url="data.bankImg1">
  69. <image :src="data.bankImg1" mode="aspectFit"></image>
  70. <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="3">
  71. <text class='cuIcon-close'></text>
  72. </view>
  73. </view>
  74. <view class="solids" @tap="ChooseImageBank" v-if="data.bankImg == '' || data.bankImg1 == ''">
  75. <text class='cuIcon-cameraadd'></text>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="cu-form-group">
  80. <text class="tit">开户行</text>
  81. <view class="con-list">
  82. <input placeholder="请填写" name="input" v-model="data.companyBank" @input="bankAccountInput"></input>
  83. </view>
  84. </view>
  85. <view class="cu-form-group">
  86. <text class="tit">银行卡号</text>
  87. <view class="con-list">
  88. <input placeholder="请填写" name="input" v-model="data.accountNo" @input="bankNoInput"></input>
  89. </view>
  90. </view>
  91. <view class="cu-form-group">
  92. <text class="tit">开户支行</text>
  93. <view v-if="zhihangStatus" style='width:56%;' class="con-list">
  94. <picker @change="bankNameChange" :value="bankNameIndex" :range="bankNameList">
  95. <view class="picker">
  96. {{bankNameIndex>-1?bankNameList[bankNameIndex]:'点击选择支行'}}
  97. </view>
  98. </picker>
  99. </view>
  100. <view v-else class="con-list">
  101. <input placeholder="请填写" name="input" v-model="bankNameZhihang" @input="bankNameZhihangInput"></input>
  102. </view>
  103. <button v-if="zhihangStatus" class='cu-btn bg-green shadow' @click="changeZhihang">手动填写</button>
  104. <button v-else class='cu-btn bg-green shadow' @click="changeZhihang">自动识别</button>
  105. </view>
  106. <!-- <view class="cu-form-group">
  107. <view class="title">公司开户行</view>
  108. <input placeholder="请填写" name="input" v-model='data.companyBank' @input='companyBankinput'></input>
  109. </view>
  110. <view class="cu-form-group">
  111. <view class="title">公司账户</view>
  112. <input placeholder="请填写" name="input" v-model='data.accountNo' @input='accountNoinput'></input>
  113. </view> -->
  114. <view v-if='status==0' class="cu-form-group">
  115. <view class="title">公司电话</view>
  116. <input placeholder="请填写" name="input" v-model='data.companyPhone' @input='companyPhoneinput'></input>
  117. </view>
  118. <view v-else class="cu-form-group">
  119. <view class="title">电话</view>
  120. <input placeholder="请填写" name="input" v-model='data.companyPhone' @input='companyPhoneinput'></input>
  121. </view>
  122. <view v-if='status==1' class="cu-form-group">
  123. <view class="title">收款人姓名</view>
  124. <input placeholder="请填写" name="input" v-model='data.collectName' @input='collectNameinput'></input>
  125. </view>
  126. <view class="cu-form-group">
  127. <view class="title">验证码</view>
  128. <input type="mobile" value="" placeholder="6位验证码" maxlength="6"
  129. data-key="verifyCode" @input="verifyCodeInput" style="width: 60%;"></input>
  130. <button class='cu-btn bg-green shadow':disabled="sendDisabled" @click="doGetVerify">{{sendText}}</button>
  131. </view>
  132. <view v-if='status==0' class="cu-form-group">
  133. <view class="title">公司地址</view>
  134. <input placeholder="请填写" name="input" v-model='data.companyPlace' @input='companyPlaceinput'></input>
  135. </view>
  136. <view v-else class="cu-form-group">
  137. <view class="title">地址</view>
  138. <input placeholder="请填写" name="input" v-model='data.companyPlace' @input='companyPlaceinput'></input>
  139. </view>
  140. </view>
  141. <view class="page-bottom">
  142. <view class="action-btn-group">
  143. <button type="primary" class=" action-btn no-border buy-now-btn" style='width:50%;' @click="Company()">完成</button>
  144. </view>
  145. </view>
  146. </view>
  147. </template>
  148. <script>
  149. import uploadImage from '@/components/ossutil/uploadFile.js';
  150. import {
  151. mapState
  152. } from 'vuex';
  153. export default {
  154. data() {
  155. return {
  156. data:{
  157. accountNo: "",
  158. companyBank: "",
  159. companyName: "",
  160. personName:"",
  161. personNo:"",
  162. personNoImg:"",
  163. personNoImg1:"",
  164. bankImg:"",
  165. bankImg1:"",
  166. companyPhone: "",
  167. collectName:"",
  168. companyPlace: "",
  169. identificationNo: "",
  170. id:'',
  171. personNoImg:'',
  172. personNoImg1:'',
  173. personName:'',
  174. personNo:'',
  175. renown:0,
  176. bankImg:'',
  177. bankImg1:'',
  178. bankNameZhi:''
  179. },
  180. list:[
  181. {name:'公司',value:0},
  182. {name:'个人',value:1}
  183. ],
  184. status:0,
  185. verifyCode:'',
  186. sendText:'获取验证码',
  187. sendDisabled: false,
  188. requeststatus:0,
  189. bankAccount:'',
  190. bankNo:'',
  191. bankNameList:'',
  192. bankPhone:'',
  193. driver:'',
  194. driverNo:'',
  195. zhihangStatus:true,
  196. bankNameZhihang:'',
  197. bankNameIndex:-1
  198. }
  199. },
  200. computed: {
  201. },
  202. onShow() {
  203. },
  204. onLoad(options) {
  205. if(JSON.stringify(options)!='{}'){
  206. this.data.accountNo=options.accountNo
  207. this.data.companyBank=options.companyBank
  208. this.data.companyName=options.companyName
  209. this.data.companyPhone=options.companyPhone
  210. this.data.companyPlace=options.companyPlace
  211. this.data.identificationNo=options.identificationNo
  212. this.data.personNoImg=options.personNoImg
  213. this.data.personNoImg1=options.personNoImg1
  214. this.data.personName=options.personName
  215. this.data.personNo=options.personNo
  216. this.data.bankImg=options.bankImg
  217. this.data.bankImg1=options.bankImg1
  218. this.data.bankNameZhi=options.bankNameZhi
  219. this.data.id=options.id
  220. this.requeststatus='updateCompany'
  221. }else{
  222. this.requeststatus='addCompany'
  223. }
  224. },
  225. onReady(){
  226. },
  227. methods: {
  228. verifyCodeInput(e){
  229. this.verifyCode = e.detail.value
  230. },
  231. radioChange(e){
  232. this.data.renown=e.detail.value
  233. this.status=e.detail.value
  234. },
  235. changeZhihang(){
  236. this.zhihangStatus = !this.zhihangStatus
  237. },
  238. bankNameChange(e) {
  239. this.bankNameIndex = e.detail.value
  240. this.data.bankNameZhi = this.bankNameList[this.bankNameIndex]
  241. },
  242. DelImg(e) {
  243. uni.showModal({
  244. title: '提示',
  245. content: '确定要删除该照片吗?',
  246. cancelText: '取消',
  247. confirmText: '确定',
  248. success: res => {
  249. if (res.confirm) {
  250. if(e.currentTarget.dataset.index == 0){
  251. this.data.personNoImg = "";
  252. }
  253. else if(e.currentTarget.dataset.index == 1){
  254. this.data.personNoImg1 = "";
  255. }
  256. else if(e.currentTarget.dataset.index == 2){
  257. this.data.bankImg = "";
  258. }
  259. else if(e.currentTarget.dataset.index == 3){
  260. this.data.bankImg1= "";
  261. }
  262. else if(e.currentTarget.dataset.index == 4){
  263. this.data.otherImg = "";
  264. }
  265. else if(e.currentTarget.dataset.index == 5){
  266. this.data.poundImg = "";
  267. }
  268. }
  269. }
  270. })
  271. },
  272. doGetVerify() {
  273. const that = this
  274. var phone = this.data.companyPhone;
  275. if (!phone || phone.length != 11) {
  276. uni.showToast({
  277. title:'请输入正确手机号!',
  278. icon:'none'
  279. })
  280. return
  281. }
  282. that.$api.request('user', 'sendVerifyCode', {
  283. phone: phone,
  284. }).then(res => {
  285. that.sendDisabled = true
  286. let sec = 60
  287. let interval = setInterval(() => {
  288. sec--;
  289. that.sendText = sec + 's后重发'
  290. if (sec <= 0) {
  291. that.sendDisabled = false
  292. that.sendText = "获取验证码"
  293. clearInterval(interval)
  294. }
  295. }, 1000)
  296. })
  297. },
  298. companyNameinput(e){
  299. this.data.companyName = e.detail.value
  300. },
  301. companyBankinput(e){
  302. this.data.companyBank = e.detail.value
  303. },
  304. accountNoinput(e){
  305. this.data.accountNo = e.detail.value
  306. },
  307. companyPhoneinput(e){
  308. this.data.companyPhone = e.detail.value
  309. },
  310. collectNameinput(e){
  311. this.data.collectName = e.detail.value
  312. },
  313. companyPlaceinput(e){
  314. this.data.companyPlace = e.detail.value
  315. },
  316. identificationNoinput(e){
  317. this.data.identificationNo = e.detail.value
  318. },
  319. ViewImage(e) {
  320. var img = [];
  321. img = e.currentTarget.dataset.url.split(' ')
  322. uni.previewImage({
  323. current:0,
  324. urls: img
  325. });
  326. },
  327. ChooseImageBank() {
  328. var that = this
  329. uni.showLoading({
  330. title: '正在识别',
  331. mask:true
  332. })
  333. uni.chooseImage({
  334. count: 1, //默认9
  335. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  336. sourceType: ['album','camera'], //从相册选择
  337. success: (res) => {
  338. //上传图片
  339. uploadImage(res.tempFilePaths[0], 'bankImg/',
  340. result => {
  341. if(that.data.bankImg == undefined){
  342. that.data.bankImg = ''
  343. }
  344. if (that.data.bankImg.length != 0) {
  345. that.data.bankImg1 = result
  346. uni.hideLoading()
  347. } else {
  348. that.data.bankImg = result
  349. that.$api.request('tran', 'bankShibie', {
  350. bankImg: result
  351. }, failres => {
  352. that.$api.msg(failres.errmsg)
  353. uni.hideLoading()
  354. }).then(res => {
  355. that.data.companyBank = res.data.bankName
  356. that.data.accountNo = res.data.bankNo
  357. that.bankNameList = res.data.bankNameZhihang
  358. console.log(that.bankNameList)
  359. that.bankPhone = res.data.bankPhone
  360. that.$api.msg('请核对开户行、支行和银行卡号')
  361. uni.hideLoading()
  362. })
  363. }
  364. }
  365. )
  366. }
  367. });
  368. },
  369. ChooseImagePerson() {
  370. const that = this
  371. uni.showLoading({
  372. title: '正在识别',
  373. mask:true
  374. })
  375. uni.chooseImage({
  376. count: 1, //默认9
  377. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  378. sourceType: ['album','camera'], //从相册选择
  379. success: (res) => {
  380. //上传图片
  381. //图片路径可自行修改
  382. uploadImage(res.tempFilePaths[0], 'personNoImg/',
  383. result => {
  384. if (this.data.personNoImg.length != 0) {
  385. this.data.personNoImg1 = result
  386. uni.hideLoading()
  387. } else {
  388. this.data.personNoImg = result
  389. that.$api.request('tran', 'personShibie', {
  390. personImg: result,
  391. type:"driver"
  392. }, failres => {
  393. that.$api.msg(failres.errmsg)
  394. uni.hideLoading()
  395. }).then(res => {
  396. that.data.personName = res.data.driver
  397. that.data.personNo = res.data.driverNo
  398. that.$api.msg('请核对身份信息')
  399. uni.hideLoading()
  400. })
  401. }
  402. }
  403. )
  404. }
  405. })
  406. },
  407. Company(item){
  408. var that = this
  409. if (!that.data.companyName&&that.status==0) {
  410. that.$api.msg('请填写公司名称');
  411. return
  412. }
  413. if (!that.data.identificationNo&&that.status==0) {
  414. that.$api.msg('请填写纳税人识别号');
  415. return
  416. }
  417. if (!that.data.companyBank) {
  418. that.$api.msg('请填写开户行')
  419. return
  420. }
  421. if(!that.data.accountNo){
  422. this.$api.msg('请填写账户');
  423. return;
  424. }
  425. if (!that.data.companyPhone) {
  426. that.$api.msg('请填写电话')
  427. return
  428. }
  429. if (!that.verifyCode) {
  430. that.$api.msg('请填写验证码')
  431. return
  432. }
  433. if(!that.data.personName){
  434. this.$api.msg('请填写姓名');
  435. return;
  436. }
  437. if (!that.data.personNo) {
  438. that.$api.msg('请填写身份证号')
  439. return
  440. }
  441. if (!that.data.collectName&&that.status==1) {
  442. that.$api.msg('请填写收款人姓名');
  443. return
  444. }
  445. var data=JSON.stringify(that.data)
  446. this.$api.request('company', that.requeststatus, {
  447. CompanyDo:data,
  448. verifyCode:that.verifyCode
  449. }, failres => {
  450. that.$api.msg(failres.errmsg)
  451. uni.hideLoading()
  452. }).then(res => {
  453. if(res.data.code=='SUCCESS'){
  454. if(that.requeststatus=='updateCompany'){
  455. that.$api.msg('修改成功')
  456. }else{
  457. that.$api.msg('添加成功')
  458. }
  459. uni.hideLoading()
  460. setTimeout(()=>{uni.navigateBack()},1000);
  461. }else{
  462. that.$api.msg(res.data.code)
  463. uni.hideLoading()
  464. }
  465. })
  466. },
  467. },
  468. }
  469. </script>
  470. <style>
  471. </style>