addBankCard.vue 12 KB

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