addBankCard.vue 11 KB

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