addBankCard.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555
  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;' class="select-bankzh" @click="selectZhbank">
  39. {{dataDetails.bankDepositBranch?dataDetails.bankDepositBranch:'选择开户支行'}}
  40. </view>
  41. <view @click="manualInput" class="type">手动输入</view>
  42. </view>
  43. </view>
  44. <view class="flex row noborder">
  45. <view class="left-text">收款人</view>
  46. <view class="flex">
  47. <u--input placeholder="输入收款人姓名" inputAlign='left' border="none" v-model="dataDetails.payeeName">
  48. </u--input>
  49. </view>
  50. </view>
  51. <u-picker :show="isShowBank" :columns="columns" :closeOnClickOverlay='true' @close='zhBankClose'
  52. @cancel='zhBankClose' @confirm='confirmBank'></u-picker>
  53. </u-picker>
  54. <view class="" style="color: red;font-size: 26rpx;margin-top: 20rpx;">*收款人须为司机本人</view>
  55. </view>
  56. <u-toast ref="uToast"></u-toast>
  57. <view class="submit-btn" @click="$u.throttle(submit, 5000)">提交</view>
  58. <u-action-sheet :actions="$helper.imgTypeList" :title="$helper.imgType" :show="isShowimgType"
  59. @select="imgTypeSelect" :closeOnClickOverlay="true" :closeOnClickAction="true" @close="isShowimgType=false">
  60. </u-action-sheet>
  61. </view>
  62. </template>
  63. <script>
  64. import upload from '@/components/upload.vue';
  65. import uploadImage from '@/components/ossutil/uploadFile.js';
  66. import permision from "@/js_sdk/wa-permission/permission.js"
  67. var _this;
  68. import {
  69. mapState
  70. } from 'vuex';
  71. export default {
  72. components: {},
  73. data() {
  74. return {
  75. isShowimgType: false,
  76. dataDetails: {
  77. driverId: '',
  78. payeeAddressUrl: '',
  79. bankCard: '',
  80. bankDeposit: '',
  81. bankDepositBranch: '',
  82. payeeName: '',
  83. },
  84. imagesrc: '',
  85. columns: [
  86. ],
  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. // sourceType: this.$helper.chooseImage.sourceType,
  216. success: function(res) {
  217. console.log(JSON.stringify(res.tempFilePaths));
  218. uploadImage('image', res.tempFilePaths[0], 'appData/',
  219. result => {
  220. // 上传成功
  221. console.log('图片地址', result)
  222. _this.$request.baseRequest('get',
  223. '/driverInfo/bankShibie', {
  224. bankImg: result,
  225. }).then(res => {
  226. _this.dataDetails.bankDepositBranch=''
  227. _this.dataDetails.payeeAddressUrl = result
  228. if (res.data.bankNo) {
  229. _this.dataDetails.bankCard = res.data.bankNo
  230. }
  231. if (res.data.bankName) {
  232. _this.dataDetails.bankDeposit = res.data.bankName
  233. }
  234. // 开户支行LIst
  235. if (res.data.bankNameZhihang) {
  236. _this.columns.push(res.data
  237. .bankNameZhihang)
  238. }
  239. _this.$forceUpdate()
  240. })
  241. .catch(res => {
  242. uni.$u.toast(res.message);
  243. });
  244. }
  245. )
  246. }
  247. });
  248. // } else {
  249. // uni.$u.route('/pages/mine/camera/idcard/idcard?dotype=bank');
  250. // }
  251. },
  252. validate() {
  253. // true 为校验不通过
  254. // if (uni.$u.test.isEmpty(this.dataDetails.payeeAddressUrl)) {
  255. // this.$refs.uToast.show({
  256. // type: 'error',
  257. // message: "请上传银行卡卡号页!",
  258. // })
  259. // return true
  260. // }
  261. if (uni.$u.test.isEmpty(this.dataDetails.bankCard)) {
  262. this.$refs.uToast.show({
  263. type: 'error',
  264. message: "银行卡卡号不能为空!",
  265. })
  266. return true
  267. }
  268. if (this.dataDetails.bankCard.length < 16 || this.dataDetails.bankCard.length > 20) {
  269. this.$refs.uToast.show({
  270. type: 'error',
  271. message: "银行卡号输入错误!",
  272. })
  273. return true
  274. }
  275. if (uni.$u.test.isEmpty(this.dataDetails.bankDeposit)) {
  276. this.$refs.uToast.show({
  277. type: 'error',
  278. message: "开户行不能为空!",
  279. })
  280. return true
  281. }
  282. if (this.dataDetails.bankDeposit.length < 4 || this.dataDetails.bankDeposit.length > 25) {
  283. this.$refs.uToast.show({
  284. type: 'error',
  285. message: "开户行输入错误!",
  286. })
  287. return true
  288. }
  289. if (uni.$u.test.isEmpty(this.dataDetails.bankDepositBranch)) {
  290. this.$refs.uToast.show({
  291. type: 'error',
  292. message: "开户支行不能为空!",
  293. })
  294. return true
  295. }
  296. if (this.dataDetails.bankDepositBranch.length < 4 || this.dataDetails.bankDepositBranch.length > 25) {
  297. this.$refs.uToast.show({
  298. type: 'error',
  299. message: "开户支行输入错误!",
  300. })
  301. return true
  302. }
  303. // if (uni.$u.test.isEmpty(this.dataDetails.cardholderName)) {
  304. // this.$refs.uToast.show({
  305. // type: 'error',
  306. // message: "持卡人姓名不能为空!",
  307. // })
  308. // return true
  309. // }
  310. if (uni.$u.test.isEmpty(this.dataDetails.payeeName)) {
  311. this.$refs.uToast.show({
  312. type: 'error',
  313. message: "收款人姓名不能为空!",
  314. })
  315. return true
  316. }
  317. // if (uni.$u.test.isEmpty(this.dataDetails.cardholderIdNumber)) {
  318. // this.$refs.uToast.show({
  319. // type: 'error',
  320. // message: "持卡人身份证号不能为空!",
  321. // })
  322. // return true
  323. // }
  324. },
  325. //身份证正面
  326. getImgUrl1(src) {
  327. // console.log(src)
  328. // console.log('------------res-----------')
  329. // let that = this;
  330. // that.id[0] = src
  331. // that.id1 = src
  332. // that.certificates = false
  333. // that.personImgs.personImg = that.id[0]
  334. // that.$api.doRequest('get', '/driverViewInfo/personShibie', that
  335. // .personImgs).then(res => {
  336. // if (res.data.data.recPerson != null) {
  337. // if (res.data.data.recPerson != "") {
  338. // that.$set(that.DriverViewInfo, 'driverName', res
  339. // .data.data.recPerson)
  340. // }
  341. // }
  342. // if (res.data.data.recPersonNo != null) {
  343. // if (res.data.data.recPersonNo != "") {
  344. // that.$set(that.DriverViewInfo, 'numberCard', res
  345. // .data.data.recPersonNo)
  346. // }
  347. // }
  348. // }).catch(res => {
  349. // uni.showToast({
  350. // title: res.data.message,
  351. // icon: 'none',
  352. // duration: 2000
  353. // })
  354. // })
  355. },
  356. submit() {
  357. var that = this
  358. // // 获取银行卡颜色
  359. // let _obj = {
  360. // "input":this.dataDetails.payeeAddressUrl
  361. // }
  362. // this.$request.baseRequest('post', '/ClothingColorController/recognition', _obj)
  363. // .then(res => {
  364. // if (res.code == '200') {
  365. // this.dataDetails.cardColor = res.data
  366. // } else {
  367. // uni.$u.toast(res.message);
  368. // }
  369. // })
  370. // .catch(res => {
  371. // uni.$u.toast(res.message);
  372. // });
  373. if (that.validate()) return
  374. if (this.dataDetails.payeeName != uni.getStorageSync("firstAuthentication").driverName) {
  375. this.$refs.uToast.show({
  376. type: 'error',
  377. message: "收款人须为司机本人!",
  378. })
  379. return
  380. } else {
  381. this.$request.baseRequest('get', '/driverPayeeInfo/bankCradShibie', {
  382. name: this.dataDetails.payeeName,
  383. idCard: uni.getStorageSync("firstAuthentication").numberCard,
  384. accountNo: this.dataDetails.bankCard
  385. }).then(
  386. res => {
  387. if (res.data.distinguishNum == "01") {
  388. this.dataDetails.commonId = this.userInfo.id
  389. this.$request.baseRequest('post', '/driverPayeeInfo/api/addInfo', this.dataDetails)
  390. .then(
  391. res => {
  392. if (res.code == '200') {
  393. let params = {
  394. type: 'success',
  395. message: "提交成功",
  396. }
  397. this.$refs.uToast.show({
  398. ...params
  399. })
  400. uni.navigateBack({
  401. delta: 1
  402. });
  403. // uni.$u.route('/pages/mine/manageBankCards/index');
  404. } else {
  405. uni.$u.toast(res.message);
  406. }
  407. })
  408. .catch(res => {
  409. uni.$u.toast(res.message);
  410. });
  411. } else {
  412. uni.$u.toast(res.message);
  413. }
  414. })
  415. }
  416. },
  417. },
  418. };
  419. </script>
  420. <style scoped lang="scss">
  421. .row4-img {
  422. width: 32rpx;
  423. height: 32rpx;
  424. }
  425. .content {
  426. padding: 20rpx;
  427. padding-bottom: 50rpx;
  428. height: 100vh;
  429. }
  430. .content3 {
  431. background: white;
  432. padding: 20rpx;
  433. box-sizing: border-box;
  434. .left-text {
  435. // background: red;
  436. width: 290rpx;
  437. color: #333333;
  438. display: flex;
  439. align-items: center;
  440. }
  441. .row {
  442. border-bottom: 1px solid #EEEEEE;
  443. padding-bottom: 28rpx;
  444. margin-top: 26rpx;
  445. .ch-style {}
  446. }
  447. .row-ch {
  448. padding-right: 180rpx;
  449. box-sizing: border-box;
  450. }
  451. }
  452. .title {
  453. color: #999999;
  454. margin: 20rpx 0;
  455. }
  456. .picture {
  457. margin-top: 20rpx;
  458. background: #F5F6FA;
  459. border-radius: 10rpx;
  460. display: flex;
  461. flex-direction: column;
  462. justify-content: center;
  463. align-items: center;
  464. color: #6A7282;
  465. width: 100%;
  466. height: 440rpx;
  467. position: relative;
  468. .text {
  469. margin-top: 20rpx;
  470. }
  471. }
  472. .xj-image {
  473. width: 100rpx;
  474. height: 100rpx;
  475. }
  476. .picture3 {
  477. background: url(../../../static/images/mine/yhkzm.png);
  478. background-size: 100% 100%;
  479. }
  480. .select-bankzh {
  481. width: 230rpx;
  482. // height: 48rpx;
  483. }
  484. .type {
  485. background: #2772FB;
  486. border-radius: 10rpx;
  487. color: white;
  488. box-sizing: border-box;
  489. padding: 4rpx 10rpx;
  490. font-size: 26rpx;
  491. display: flex;
  492. justify-content: center;
  493. align-items: center;
  494. height: 68rpx;
  495. margin-left: 26rpx;
  496. }
  497. .submit-btn {
  498. position: fixed;
  499. bottom: 40rpx;
  500. width: 90%;
  501. background: #2772FB;
  502. color: white;
  503. text-align: center;
  504. margin: 2%;
  505. padding: 30rpx 0;
  506. border-radius: 50rpx;
  507. }
  508. .del-card {
  509. position: absolute;
  510. top: -10rpx;
  511. right: -6rpx;
  512. width: 80rpx;
  513. height: 80rpx;
  514. z-index: 9;
  515. }
  516. .preview-card-img {
  517. // /deep/uni-image>div, uni-image>img {
  518. // transform: scale(1.5) rotate(-90deg);
  519. // }
  520. }
  521. </style>