addBankCard.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556
  1. <template>
  2. <view class="content">
  3. <view class="content3 flex s-row">
  4. <view class="title">上传银行卡卡号页</view>
  5. <view @click="uploadImg" class="picture picture3" v-if="!dataDetails.payeeAddressUrl">
  6. <image class="xj-image" src="@/static/images/mine/ic_shanchuan@2x.png"></image>
  7. <view class="text">上传银行卡卡号页</view>
  8. </view>
  9. <view v-if="dataDetails.payeeAddressUrl" @click.stop="uploadImg" class="preview-card-img picture">
  10. <!-- <image class="card-img" :src="dataDetails.cardAddressUrl"></image> -->
  11. <view @click.stop="delCard">
  12. <image class='del-card' src="@/static/images/common/quxiao@2x.png">
  13. </image>
  14. </view>
  15. <image class="" :src="dataDetails.payeeAddressUrl" mode="aspectFit"></image>
  16. </view>
  17. <view class="flex row">
  18. <view class="left-text">银行卡卡号</view>
  19. <view class="flex">
  20. <u--input placeholder="输入银行卡号码" inputAlign='left' border="none" v-model="dataDetails.bankCard">
  21. </u--input>
  22. </view>
  23. </view>
  24. <view class="flex row">
  25. <view class="left-text">开户行</view>
  26. <u--input placeholder="输入开户行" inputAlign='left' border="none" v-model="dataDetails.bankDeposit">
  27. </u--input>
  28. </view>
  29. <view class="flex row">
  30. <view class="left-text khzh-styel">开户支行</view>
  31. <view class="flex align-center" v-if="isShowManualInput">
  32. <u--input class="select-bankzh point" placeholder="输入开户支行" inputAlign='left' border="none"
  33. v-model="dataDetails.bankDepositBranch">
  34. </u--input>
  35. <view @click="manualInput" class="type">选择支行</view>
  36. </view>
  37. <view class="flex align-center" v-if="!isShowManualInput">
  38. <view :style="{'color':dataDetails.bankDepositBranch?'#000':'#C6CBD5'}" style='font-size:15px;'
  39. class="select-bankzh" @click="selectZhbank">
  40. {{dataDetails.bankDepositBranch?dataDetails.bankDepositBranch:'选择开户支行'}}
  41. </view>
  42. <view @click="manualInput" class="type">手动输入</view>
  43. </view>
  44. </view>
  45. <view class="flex row noborder">
  46. <view class="left-text">收款人</view>
  47. <view class="flex">
  48. <u--input placeholder="输入收款人姓名" inputAlign='left' border="none" v-model="dataDetails.payeeName">
  49. </u--input>
  50. </view>
  51. </view>
  52. <u-picker :show="isShowBank" :columns="columns" :closeOnClickOverlay='true' @close='zhBankClose'
  53. @cancel='zhBankClose' @confirm='confirmBank'></u-picker>
  54. </u-picker>
  55. <view class="" style="color: red;font-size: 26rpx;margin-top: 20rpx;">*收款人须为司机本人</view>
  56. </view>
  57. <u-toast ref="uToast"></u-toast>
  58. <view class="submit-btn" @click="$u.throttle(submit, 5000)">提交</view>
  59. <u-action-sheet :actions="$helper.imgTypeList" :title="$helper.imgType" :show="isShowimgType"
  60. @select="imgTypeSelect" :closeOnClickOverlay="true" :closeOnClickAction="true" @close="isShowimgType=false">
  61. </u-action-sheet>
  62. </view>
  63. </template>
  64. <script>
  65. import upload from '@/components/upload.vue';
  66. import uploadImage from '@/components/ossutil/uploadFile.js';
  67. import permision from "@/js_sdk/wa-permission/permission.js"
  68. var _this;
  69. import {
  70. mapState
  71. } from 'vuex';
  72. export default {
  73. components: {},
  74. data() {
  75. return {
  76. isShowimgType: false,
  77. dataDetails: {
  78. driverId: '',
  79. payeeAddressUrl: '',
  80. bankCard: '',
  81. bankDeposit: '',
  82. bankDepositBranch: '',
  83. payeeName: '',
  84. },
  85. imagesrc: '',
  86. columns: [],
  87. isShowBank: false,
  88. isShowManualInput: false,
  89. index: ''
  90. };
  91. },
  92. computed: {
  93. ...mapState(['hasLogin', 'userInfo']),
  94. },
  95. onLoad() {
  96. _this = this;
  97. this.get_camera_permission()
  98. this.dataDetails.driverId = this.userInfo.driverId ? this.userInfo.driverId : uni.getStorageSync(
  99. "firstAuthentication").id
  100. },
  101. methods: {
  102. async get_camera_permission() {
  103. var photol = await permision.requestAndroidPermission("android.permission.CAMERA")
  104. if (photol == false) {
  105. uni.showModal({
  106. title: '提示',
  107. content: '您已经关闭相册权限,去设置',
  108. success: function(res) {
  109. if (res.confirm) {
  110. permision.gotoAppPermissionSetting()
  111. // plus.runtime.openURL("app-settings:");
  112. } else if (res.cancel) {
  113. console.log('用户点击取消');
  114. }
  115. }
  116. });
  117. }
  118. },
  119. delCard() {
  120. _this.dataDetails.payeeAddressUrl = ''
  121. _this.$forceUpdate()
  122. },
  123. uploadImg(type, ) {
  124. this.uploadType = type
  125. this.isShowimgType = true
  126. },
  127. zhBankClose() {
  128. this.isShowBank = false
  129. },
  130. // 选择支行
  131. selectZhbank() {
  132. if (!this.dataDetails.payeeAddressUrl) {
  133. this.$refs.uToast.show({
  134. type: 'error',
  135. message: "请先上传银行卡!",
  136. })
  137. return true
  138. } else if (this.dataDetails.payeeAddressUrl && uni.$u.test.isEmpty(this.columns)) {
  139. this.$refs.uToast.show({
  140. type: 'error',
  141. message: "请选择手动输入开户支行!",
  142. })
  143. return true
  144. }
  145. this.isShowBank = true
  146. },
  147. confirmBank(e) {
  148. console.log(e)
  149. this.dataDetails.bankDepositBranch = e.value[0]
  150. this.isShowBank = false
  151. },
  152. manualInput() {
  153. if (this.isShowManualInput) {
  154. if (uni.$u.test.isEmpty(this.dataDetails.payeeAddressUrl)) {
  155. this.$refs.uToast.show({
  156. type: 'error',
  157. message: "请先上传银行卡!",
  158. })
  159. return true
  160. } else if (this.dataDetails.payeeAddressUrl && uni.$u.test.isEmpty(this.columns)) {
  161. this.$refs.uToast.show({
  162. type: 'error',
  163. message: "请选择手动输入开户支行!",
  164. })
  165. return true
  166. }
  167. this.isShowBank = true
  168. } else {
  169. this.isShowBank = false
  170. }
  171. this.isShowManualInput = !this.isShowManualInput
  172. },
  173. //设置图片
  174. setImage(e) {
  175. console.log(e);
  176. //显示在页面
  177. //this.imagesrc = e.path;
  178. if (e.dotype == 'idphoto') {
  179. _this.zjzClipper(e.path);
  180. } else if (e.dotype == 'watermark') {
  181. _this.watermark(e.path);
  182. } else {
  183. _this.savePhoto(e.path);
  184. }
  185. },
  186. //保存图片到相册,方便核查
  187. savePhoto(path) {
  188. this.imagesrc = path;
  189. uploadImage(path, 'appData/',
  190. result => {
  191. // 上传成功
  192. console.log('图片地址', result)
  193. }
  194. )
  195. //保存到相册
  196. // uni.saveImageToPhotosAlbum({
  197. // filePath: path,
  198. // success: () => {
  199. // uni.showToast({
  200. // title: '已保存至相册',
  201. // duration: 2000
  202. // });
  203. // }
  204. // });
  205. },
  206. uploadImg() {
  207. this.imgTypeSelect()
  208. // this.isShowimgType = true
  209. },
  210. imgTypeSelect(val) {
  211. console.log(val)
  212. // if (val.name == '相册') {
  213. uni.chooseImage({
  214. count: 1,
  215. sizeType: ['compressed'],
  216. // sourceType: this.$helper.chooseImage.sourceType,
  217. success: function(res) {
  218. console.log(JSON.stringify(res.tempFilePaths));
  219. uploadImage('image', res.tempFilePaths[0], 'appData/',
  220. result => {
  221. // 上传成功
  222. console.log('图片地址', result)
  223. _this.$request.baseRequest('get',
  224. '/driverInfo/bankShibie', {
  225. bankImg: result,
  226. }).then(res => {
  227. _this.dataDetails.bankDepositBranch = ''
  228. _this.dataDetails.payeeAddressUrl = result
  229. if (res.data.bankNo) {
  230. _this.dataDetails.bankCard = res.data.bankNo
  231. }
  232. if (res.data.bankName) {
  233. _this.dataDetails.bankDeposit = res.data.bankName
  234. }
  235. // 开户支行List
  236. _this.columns=[]
  237. if (res.data.bankNameZhihang) {
  238. _this.columns.push(res.data
  239. .bankNameZhihang)
  240. }
  241. _this.$forceUpdate()
  242. })
  243. .catch(res => {
  244. uni.$u.toast(res.message);
  245. });
  246. }
  247. )
  248. }
  249. });
  250. // } else {
  251. // uni.$u.route('/pages/mine/camera/idcard/idcard?dotype=bank');
  252. // }
  253. },
  254. validate() {
  255. // true 为校验不通过
  256. // if (uni.$u.test.isEmpty(this.dataDetails.payeeAddressUrl)) {
  257. // this.$refs.uToast.show({
  258. // type: 'error',
  259. // message: "请上传银行卡卡号页!",
  260. // })
  261. // return true
  262. // }
  263. if (uni.$u.test.isEmpty(this.dataDetails.bankCard)) {
  264. this.$refs.uToast.show({
  265. type: 'error',
  266. message: "银行卡卡号不能为空!",
  267. })
  268. return true
  269. }
  270. if (this.dataDetails.bankCard.length < 16 || this.dataDetails.bankCard.length > 20) {
  271. this.$refs.uToast.show({
  272. type: 'error',
  273. message: "银行卡号输入错误!",
  274. })
  275. return true
  276. }
  277. if (uni.$u.test.isEmpty(this.dataDetails.bankDeposit)) {
  278. this.$refs.uToast.show({
  279. type: 'error',
  280. message: "开户行不能为空!",
  281. })
  282. return true
  283. }
  284. if (this.dataDetails.bankDeposit.length < 4 || this.dataDetails.bankDeposit.length > 25) {
  285. this.$refs.uToast.show({
  286. type: 'error',
  287. message: "开户行输入错误!",
  288. })
  289. return true
  290. }
  291. if (uni.$u.test.isEmpty(this.dataDetails.bankDepositBranch)) {
  292. this.$refs.uToast.show({
  293. type: 'error',
  294. message: "开户支行不能为空!",
  295. })
  296. return true
  297. }
  298. if (this.dataDetails.bankDepositBranch.length < 4 || this.dataDetails.bankDepositBranch.length > 25) {
  299. this.$refs.uToast.show({
  300. type: 'error',
  301. message: "开户支行输入错误!",
  302. })
  303. return true
  304. }
  305. // if (uni.$u.test.isEmpty(this.dataDetails.cardholderName)) {
  306. // this.$refs.uToast.show({
  307. // type: 'error',
  308. // message: "持卡人姓名不能为空!",
  309. // })
  310. // return true
  311. // }
  312. if (uni.$u.test.isEmpty(this.dataDetails.payeeName)) {
  313. this.$refs.uToast.show({
  314. type: 'error',
  315. message: "收款人姓名不能为空!",
  316. })
  317. return true
  318. }
  319. // if (uni.$u.test.isEmpty(this.dataDetails.cardholderIdNumber)) {
  320. // this.$refs.uToast.show({
  321. // type: 'error',
  322. // message: "持卡人身份证号不能为空!",
  323. // })
  324. // return true
  325. // }
  326. },
  327. //身份证正面
  328. getImgUrl1(src) {
  329. // console.log(src)
  330. // console.log('------------res-----------')
  331. // let that = this;
  332. // that.id[0] = src
  333. // that.id1 = src
  334. // that.certificates = false
  335. // that.personImgs.personImg = that.id[0]
  336. // that.$api.doRequest('get', '/driverViewInfo/personShibie', that
  337. // .personImgs).then(res => {
  338. // if (res.data.data.recPerson != null) {
  339. // if (res.data.data.recPerson != "") {
  340. // that.$set(that.DriverViewInfo, 'driverName', res
  341. // .data.data.recPerson)
  342. // }
  343. // }
  344. // if (res.data.data.recPersonNo != null) {
  345. // if (res.data.data.recPersonNo != "") {
  346. // that.$set(that.DriverViewInfo, 'numberCard', res
  347. // .data.data.recPersonNo)
  348. // }
  349. // }
  350. // }).catch(res => {
  351. // uni.showToast({
  352. // title: res.data.message,
  353. // icon: 'none',
  354. // duration: 2000
  355. // })
  356. // })
  357. },
  358. submit() {
  359. var that = this
  360. // // 获取银行卡颜色
  361. // let _obj = {
  362. // "input":this.dataDetails.payeeAddressUrl
  363. // }
  364. // this.$request.baseRequest('post', '/ClothingColorController/recognition', _obj)
  365. // .then(res => {
  366. // if (res.code == '200') {
  367. // this.dataDetails.cardColor = res.data
  368. // } else {
  369. // uni.$u.toast(res.message);
  370. // }
  371. // })
  372. // .catch(res => {
  373. // uni.$u.toast(res.message);
  374. // });
  375. if (that.validate()) return
  376. if (this.dataDetails.payeeName != uni.getStorageSync("firstAuthentication").driverName) {
  377. this.$refs.uToast.show({
  378. type: 'error',
  379. message: "收款人须为司机本人!",
  380. })
  381. return
  382. } else {
  383. this.$request.baseRequest('get', '/driverPayeeInfo/bankCradShibie', {
  384. name: this.dataDetails.payeeName,
  385. idCard: uni.getStorageSync("firstAuthentication").numberCard,
  386. accountNo: this.dataDetails.bankCard
  387. }).then(
  388. res => {
  389. if (res.data.distinguishNum == "01") {
  390. this.dataDetails.commonId = this.userInfo.id
  391. this.$request.baseRequest('post', '/driverPayeeInfo/api/addInfo', this.dataDetails)
  392. .then(
  393. res => {
  394. if (res.code == '200') {
  395. let params = {
  396. type: 'success',
  397. message: "提交成功",
  398. }
  399. this.$refs.uToast.show({
  400. ...params
  401. })
  402. uni.navigateBack({
  403. delta: 1
  404. });
  405. // uni.$u.route('/pages/mine/manageBankCards/index');
  406. } else {
  407. uni.$u.toast(res.message);
  408. }
  409. })
  410. .catch(res => {
  411. uni.$u.toast(res.message);
  412. });
  413. } else {
  414. uni.$u.toast(res.message);
  415. }
  416. })
  417. }
  418. },
  419. },
  420. };
  421. </script>
  422. <style scoped lang="scss">
  423. .row4-img {
  424. width: 32rpx;
  425. height: 32rpx;
  426. }
  427. .content {
  428. padding: 20rpx;
  429. padding-bottom: 50rpx;
  430. height: 100vh;
  431. }
  432. .content3 {
  433. background: white;
  434. padding: 20rpx;
  435. box-sizing: border-box;
  436. .left-text {
  437. // background: red;
  438. width: 290rpx;
  439. color: #333333;
  440. display: flex;
  441. align-items: center;
  442. }
  443. .row {
  444. border-bottom: 1px solid #EEEEEE;
  445. padding-bottom: 28rpx;
  446. margin-top: 26rpx;
  447. .ch-style {}
  448. }
  449. .row-ch {
  450. padding-right: 180rpx;
  451. box-sizing: border-box;
  452. }
  453. }
  454. .title {
  455. color: #999999;
  456. margin: 20rpx 0;
  457. }
  458. .picture {
  459. margin-top: 20rpx;
  460. background: #F5F6FA;
  461. border-radius: 10rpx;
  462. display: flex;
  463. flex-direction: column;
  464. justify-content: center;
  465. align-items: center;
  466. color: #6A7282;
  467. width: 100%;
  468. height: 440rpx;
  469. position: relative;
  470. .text {
  471. margin-top: 20rpx;
  472. }
  473. }
  474. .xj-image {
  475. width: 100rpx;
  476. height: 100rpx;
  477. }
  478. .picture3 {
  479. background: url(../../../static/images/mine/yhkzm.png);
  480. background-size: 100% 100%;
  481. }
  482. .select-bankzh {
  483. width: 230rpx;
  484. // height: 48rpx;
  485. }
  486. .type {
  487. background: #F5BA3C;
  488. border-radius: 10rpx;
  489. color: white;
  490. box-sizing: border-box;
  491. padding: 4rpx 10rpx;
  492. font-size: 26rpx;
  493. display: flex;
  494. justify-content: center;
  495. align-items: center;
  496. height: 68rpx;
  497. margin-left: 26rpx;
  498. }
  499. .submit-btn {
  500. position: fixed;
  501. bottom: 40rpx;
  502. width: 90%;
  503. background: #F5BA3C;
  504. color: white;
  505. text-align: center;
  506. margin: 2%;
  507. padding: 30rpx 0;
  508. border-radius: 50rpx;
  509. }
  510. .del-card {
  511. position: absolute;
  512. top: -10rpx;
  513. right: -6rpx;
  514. width: 80rpx;
  515. height: 80rpx;
  516. z-index: 9;
  517. }
  518. .preview-card-img {
  519. // /deep/uni-image>div, uni-image>img {
  520. // transform: scale(1.5) rotate(-90deg);
  521. // }
  522. }
  523. </style>