addBankCard.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  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" 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" 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>
  57. <u-toast ref="uToast"></u-toast>
  58. <view class="submit-btn" @click="submit">提交</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. 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.dataDetails.driverId = this.userInfo.driverId
  98. },
  99. methods: {
  100. delCard() {
  101. _this.dataDetails.payeeAddressUrl = ''
  102. _this.$forceUpdate()
  103. },
  104. uploadImg(type, ) {
  105. this.uploadType = type
  106. this.isShowimgType = true
  107. },
  108. zhBankClose() {
  109. this.isShowBank = false
  110. },
  111. // 选择支行
  112. selectZhbank() {
  113. if (uni.$u.test.isEmpty(this.columns)) {
  114. this.$refs.uToast.show({
  115. type: 'error',
  116. message: "请先上传银行卡!",
  117. })
  118. return true
  119. }
  120. this.isShowBank = true
  121. },
  122. confirmBank(e) {
  123. console.log(e)
  124. this.dataDetails.bankDepositBranch = e.value[0]
  125. this.isShowBank = false
  126. },
  127. manualInput() {
  128. if (this.isShowManualInput) {
  129. if (uni.$u.test.isEmpty(this.bankType)) {
  130. this.$refs.uToast.show({
  131. type: 'error',
  132. message: "请先上传银行卡!",
  133. })
  134. return true
  135. }
  136. this.isShowBank = true
  137. } else {
  138. this.isShowBank = false
  139. }
  140. this.isShowManualInput = !this.isShowManualInput
  141. },
  142. //设置图片
  143. setImage(e) {
  144. console.log(e);
  145. //显示在页面
  146. //this.imagesrc = e.path;
  147. if (e.dotype == 'idphoto') {
  148. _this.zjzClipper(e.path);
  149. } else if (e.dotype == 'watermark') {
  150. _this.watermark(e.path);
  151. } else {
  152. _this.savePhoto(e.path);
  153. }
  154. },
  155. //保存图片到相册,方便核查
  156. savePhoto(path) {
  157. this.imagesrc = path;
  158. uploadImage(path, 'appData/',
  159. result => {
  160. // 上传成功
  161. console.log('图片地址', result)
  162. }
  163. )
  164. //保存到相册
  165. // uni.saveImageToPhotosAlbum({
  166. // filePath: path,
  167. // success: () => {
  168. // uni.showToast({
  169. // title: '已保存至相册',
  170. // duration: 2000
  171. // });
  172. // }
  173. // });
  174. },
  175. uploadImg() {
  176. this.isShowimgType = true
  177. },
  178. imgTypeSelect(val) {
  179. console.log(val)
  180. if (val.name == '相册') {
  181. uni.chooseImage({
  182. count: 1,
  183. sourceType: this.$helper.chooseImage.sourceType,
  184. success: function(res) {
  185. console.log(JSON.stringify(res.tempFilePaths));
  186. uploadImage(res.tempFilePaths[0], 'appData/',
  187. result => {
  188. // 上传成功
  189. console.log('图片地址', result)
  190. _this.$request.baseRequest('get',
  191. '/driverInfo/bankShibie', {
  192. bankImg: result,
  193. }).then(res => {
  194. console.log(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. this.$request.baseRequest('post', '/driverPayeeInfo/api/addInfo', this.dataDetails).then(
  268. res => {
  269. if (res.code == '200') {
  270. let params = {
  271. type: 'success',
  272. message: "提交成功",
  273. }
  274. this.$refs.uToast.show({
  275. ...params
  276. })
  277. uni.$u.route('/pages/mine/manageBankCards/index');
  278. } else {
  279. uni.$u.toast(res.message);
  280. }
  281. })
  282. .catch(res => {
  283. uni.$u.toast(res.message);
  284. });
  285. },
  286. },
  287. };
  288. </script>
  289. <style scoped lang="scss">
  290. .row4-img {
  291. width: 32rpx;
  292. height: 32rpx;
  293. }
  294. .content {
  295. padding: 20rpx;
  296. }
  297. .content3 {
  298. background: white;
  299. padding: 20rpx;
  300. box-sizing: border-box;
  301. .left-text {
  302. // background: red;
  303. width: 290rpx;
  304. color: #333333;
  305. display: flex;
  306. align-items: center;
  307. }
  308. .row {
  309. border-bottom: 1px solid #EEEEEE;
  310. padding-bottom: 28rpx;
  311. margin-top: 26rpx;
  312. .ch-style {}
  313. }
  314. .row-ch {
  315. padding-right: 180rpx;
  316. box-sizing: border-box;
  317. }
  318. }
  319. .title {
  320. color: #999999;
  321. margin: 20rpx 0;
  322. }
  323. .picture {
  324. margin-top: 20rpx;
  325. background: #F5F6FA;
  326. border-radius: 10rpx;
  327. display: flex;
  328. flex-direction: column;
  329. justify-content: center;
  330. align-items: center;
  331. color: #6A7282;
  332. width: 100%;
  333. height: 440rpx;
  334. position: relative;
  335. .text {
  336. margin-top: 20rpx;
  337. }
  338. }
  339. .xj-image {
  340. width: 100rpx;
  341. height: 100rpx;
  342. }
  343. .picture3 {
  344. background: url(../../../static/images/mine/yhkzm.png);
  345. background-size: 100% 100%;
  346. }
  347. .select-bankzh {
  348. width: 230rpx;
  349. height: 48rpx;
  350. }
  351. .type {
  352. background: #2772FB;
  353. border-radius: 10rpx;
  354. color: white;
  355. box-sizing: border-box;
  356. padding: 4rpx 10rpx;
  357. font-size: 26rpx;
  358. display: flex;
  359. justify-content: center;
  360. align-items: center;
  361. }
  362. .submit-btn {
  363. position: fixed;
  364. bottom: 40rpx;
  365. width: 90%;
  366. background: #2772FB;
  367. color: white;
  368. text-align: center;
  369. margin-left: 5%;
  370. padding: 30rpx 0;
  371. border-radius: 50rpx;
  372. }
  373. .del-card {
  374. position: absolute;
  375. top: -10rpx;
  376. right: -6rpx;
  377. width: 80rpx;
  378. height: 80rpx;
  379. z-index: 9;
  380. }
  381. .preview-card-img {
  382. // /deep/uni-image>div, uni-image>img {
  383. // transform: scale(1.5) rotate(-90deg);
  384. // }
  385. }
  386. </style>