addBankCard.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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. debugger
  195. console.log(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. this.$request.baseRequest('post', '/driverPayeeInfo/api/addInfo', this.dataDetails).then(res => {
  254. if (res.code == '200') {
  255. let params = {
  256. type: 'success',
  257. message: "提交成功",
  258. }
  259. this.$refs.uToast.show({
  260. ...params
  261. })
  262. uni.$u.route('/pages/mine/manageBankCards/index');
  263. } else {
  264. uni.$u.toast(res.message);
  265. }
  266. })
  267. .catch(res => {
  268. uni.$u.toast(res.message);
  269. });
  270. },
  271. },
  272. };
  273. </script>
  274. <style scoped lang="scss">
  275. .row4-img {
  276. width: 32rpx;
  277. height: 32rpx;
  278. }
  279. .content {
  280. padding: 20rpx;
  281. }
  282. .content3 {
  283. background: white;
  284. padding: 20rpx;
  285. box-sizing: border-box;
  286. .left-text {
  287. // background: red;
  288. width: 290rpx;
  289. color: #333333;
  290. display: flex;
  291. align-items: center;
  292. }
  293. .row {
  294. border-bottom: 1px solid #EEEEEE;
  295. padding-bottom: 28rpx;
  296. margin-top: 26rpx;
  297. .ch-style {}
  298. }
  299. .row-ch {
  300. padding-right: 180rpx;
  301. box-sizing: border-box;
  302. }
  303. }
  304. .title {
  305. color: #999999;
  306. margin: 20rpx 0;
  307. }
  308. .picture {
  309. margin-top: 20rpx;
  310. background: #F5F6FA;
  311. border-radius: 10rpx;
  312. display: flex;
  313. flex-direction: column;
  314. justify-content: center;
  315. align-items: center;
  316. color: #6A7282;
  317. width: 100%;
  318. height: 440rpx;
  319. position: relative;
  320. .text {
  321. margin-top: 20rpx;
  322. }
  323. }
  324. .xj-image {
  325. width: 100rpx;
  326. height: 100rpx;
  327. }
  328. .picture3 {
  329. background: url(../../../static/images/mine/yhkzm.png);
  330. background-size: 100% 100%;
  331. }
  332. .select-bankzh {
  333. width: 230rpx;
  334. height: 48rpx;
  335. }
  336. .type {
  337. background: #2772FB;
  338. border-radius: 10rpx;
  339. color: white;
  340. box-sizing: border-box;
  341. padding: 4rpx 10rpx;
  342. font-size: 26rpx;
  343. display: flex;
  344. justify-content: center;
  345. align-items: center;
  346. }
  347. .submit-btn {
  348. position: fixed;
  349. bottom: 40rpx;
  350. width: 90%;
  351. background: #2772FB;
  352. color: white;
  353. text-align: center;
  354. margin-left: 5%;
  355. padding: 30rpx 0;
  356. border-radius: 50rpx;
  357. }
  358. .del-card {
  359. position: absolute;
  360. top: -10rpx;
  361. right: -6rpx;
  362. width: 80rpx;
  363. height: 80rpx;
  364. z-index: 9;
  365. }
  366. .preview-card-img {
  367. // /deep/uni-image>div, uni-image>img {
  368. // transform: scale(1.5) rotate(-90deg);
  369. // }
  370. }
  371. </style>