addBankCard.vue 9.5 KB

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