addBankCard.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441
  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?this.userInfo.driverId:uni.getStorageSync("firstAuthentication").id
  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.imgTypeSelect()
  178. // this.isShowimgType = true
  179. },
  180. imgTypeSelect(val) {
  181. console.log(val)
  182. // if (val.name == '相册') {
  183. uni.chooseImage({
  184. count: 1,
  185. // sourceType: this.$helper.chooseImage.sourceType,
  186. success: function(res) {
  187. console.log(JSON.stringify(res.tempFilePaths));
  188. uploadImage('image', res.tempFilePaths[0], 'appData/',
  189. result => {
  190. // 上传成功
  191. console.log('图片地址', result)
  192. _this.$request.baseRequest('get',
  193. '/driverInfo/bankShibie', {
  194. bankImg: result,
  195. }).then(res => {
  196. _this.dataDetails.payeeAddressUrl = result
  197. if (res.data.bankNo) {
  198. _this.dataDetails.bankCard = res.data.bankNo
  199. }
  200. if (res.data.bankName) {
  201. _this.dataDetails.bankDeposit = res.data.bankName
  202. }
  203. // 开户支行LIst
  204. if (res.data.bankNameZhihang) {
  205. _this.columns.push(res.data
  206. .bankNameZhihang)
  207. }
  208. _this.$forceUpdate()
  209. })
  210. .catch(res => {
  211. uni.$u.toast(res.message);
  212. });
  213. }
  214. )
  215. }
  216. });
  217. // } else {
  218. // uni.$u.route('/pages/mine/camera/idcard/idcard?dotype=bank');
  219. // }
  220. },
  221. //身份证正面
  222. getImgUrl1(src) {
  223. // console.log(src)
  224. // console.log('------------res-----------')
  225. // let that = this;
  226. // that.id[0] = src
  227. // that.id1 = src
  228. // that.certificates = false
  229. // that.personImgs.personImg = that.id[0]
  230. // that.$api.doRequest('get', '/driverViewInfo/personShibie', that
  231. // .personImgs).then(res => {
  232. // if (res.data.data.recPerson != null) {
  233. // if (res.data.data.recPerson != "") {
  234. // that.$set(that.DriverViewInfo, 'driverName', res
  235. // .data.data.recPerson)
  236. // }
  237. // }
  238. // if (res.data.data.recPersonNo != null) {
  239. // if (res.data.data.recPersonNo != "") {
  240. // that.$set(that.DriverViewInfo, 'numberCard', res
  241. // .data.data.recPersonNo)
  242. // }
  243. // }
  244. // }).catch(res => {
  245. // uni.showToast({
  246. // title: res.data.message,
  247. // icon: 'none',
  248. // duration: 2000
  249. // })
  250. // })
  251. },
  252. submit() {
  253. // // 获取银行卡颜色
  254. // let _obj = {
  255. // "input":this.dataDetails.payeeAddressUrl
  256. // }
  257. // this.$request.baseRequest('post', '/ClothingColorController/recognition', _obj)
  258. // .then(res => {
  259. // if (res.code == '200') {
  260. // this.dataDetails.cardColor = res.data
  261. // } else {
  262. // uni.$u.toast(res.message);
  263. // }
  264. // })
  265. // .catch(res => {
  266. // uni.$u.toast(res.message);
  267. // });
  268. if(this.dataDetails.payeeName != uni.getStorageSync("firstAuthentication").driverName){
  269. this.$refs.uToast.show({
  270. type: 'error',
  271. message: "收款人须为司机本人!",
  272. })
  273. return
  274. }else{
  275. this.$request.baseRequest('get', '/driverPayeeInfo/bankCradShibie', {
  276. name: this.dataDetails.payeeName,
  277. idCard: uni.getStorageSync("firstAuthentication").numberCard,
  278. accountNo: this.dataDetails.bankCard
  279. }).then(
  280. res => {
  281. if(res.data.distinguishNum == "01"){
  282. this.dataDetails.commonId = this.userInfo.id
  283. this.$request.baseRequest('post', '/driverPayeeInfo/api/addInfo', this.dataDetails).then(
  284. res => {
  285. if (res.code == '200') {
  286. let params = {
  287. type: 'success',
  288. message: "提交成功",
  289. }
  290. this.$refs.uToast.show({
  291. ...params
  292. })
  293. uni.$u.route('/pages/mine/manageBankCards/index');
  294. } else {
  295. uni.$u.toast(res.message);
  296. }
  297. })
  298. .catch(res => {
  299. uni.$u.toast(res.message);
  300. });
  301. }else{
  302. uni.$u.toast(res.data.distinguish);
  303. }
  304. })
  305. }
  306. },
  307. },
  308. };
  309. </script>
  310. <style scoped lang="scss">
  311. .row4-img {
  312. width: 32rpx;
  313. height: 32rpx;
  314. }
  315. .content {
  316. padding: 20rpx;
  317. padding-bottom: 50rpx;
  318. }
  319. .content3 {
  320. background: white;
  321. padding: 20rpx;
  322. box-sizing: border-box;
  323. .left-text {
  324. // background: red;
  325. width: 290rpx;
  326. color: #333333;
  327. display: flex;
  328. align-items: center;
  329. }
  330. .row {
  331. border-bottom: 1px solid #EEEEEE;
  332. padding-bottom: 28rpx;
  333. margin-top: 26rpx;
  334. .ch-style {}
  335. }
  336. .row-ch {
  337. padding-right: 180rpx;
  338. box-sizing: border-box;
  339. }
  340. }
  341. .title {
  342. color: #999999;
  343. margin: 20rpx 0;
  344. }
  345. .picture {
  346. margin-top: 20rpx;
  347. background: #F5F6FA;
  348. border-radius: 10rpx;
  349. display: flex;
  350. flex-direction: column;
  351. justify-content: center;
  352. align-items: center;
  353. color: #6A7282;
  354. width: 100%;
  355. height: 440rpx;
  356. position: relative;
  357. .text {
  358. margin-top: 20rpx;
  359. }
  360. }
  361. .xj-image {
  362. width: 100rpx;
  363. height: 100rpx;
  364. }
  365. .picture3 {
  366. background: url(../../../static/images/mine/yhkzm.png);
  367. background-size: 100% 100%;
  368. }
  369. .select-bankzh {
  370. width: 230rpx;
  371. // height: 48rpx;
  372. }
  373. .type {
  374. background: #2772FB;
  375. border-radius: 10rpx;
  376. color: white;
  377. box-sizing: border-box;
  378. padding: 4rpx 10rpx;
  379. font-size: 26rpx;
  380. display: flex;
  381. justify-content: center;
  382. align-items: center;
  383. height: 68rpx;
  384. }
  385. .submit-btn {
  386. position: fixed;
  387. bottom: 40rpx;
  388. width: 90%;
  389. background: #2772FB;
  390. color: white;
  391. text-align: center;
  392. margin-left: 5%;
  393. padding: 30rpx 0;
  394. border-radius: 50rpx;
  395. }
  396. .del-card {
  397. position: absolute;
  398. top: -10rpx;
  399. right: -6rpx;
  400. width: 80rpx;
  401. height: 80rpx;
  402. z-index: 9;
  403. }
  404. .preview-card-img {
  405. // /deep/uni-image>div, uni-image>img {
  406. // transform: scale(1.5) rotate(-90deg);
  407. // }
  408. }
  409. </style>