bankCard.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588
  1. <template>
  2. <view class="">
  3. <service-widget @btnClick="btn_click"></service-widget>
  4. <u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  5. <view class="page" v-if="cardPackList1.length>0 || cardPackList2.length>0 || cardPackList3.length>0">
  6. <view v-if="current==0" class="bankClass dis a-start f-c j-s" v-for="(item,index) in cardPackList1"
  7. :key="index" :style="{background:item.stylelist.background}">
  8. <image class="Backgroundimage" src="/static/image/bindBank/img1.png" mode="" style=""></image>
  9. <view class="dis j-s">
  10. <view class="dis">
  11. <view class="logo">
  12. <image :src="item.stylelist.logo" mode=""></image>
  13. </view>
  14. <view class="banktitle dis f-c j-s">
  15. <text>{{item.bankAccount}}</text>
  16. <text>储蓄卡</text>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="bank dis j-s a-c">
  21. <view v-for="(item,index) in item.bankArray" :key="index">{{item}}</view>
  22. </view>
  23. </view>
  24. <view v-if="current==1 && item.delFlag==0" class="bankClass dis a-start f-c j-s"
  25. v-for="(item,index) in cardPackList2" :key="index" :style="{background:item.stylelist.background}">
  26. <image class="Backgroundimage" src="/static/image/bindBank/img1.png" mode="" style=""></image>
  27. <view class="dis j-s">
  28. <view class="dis">
  29. <view class="logo">
  30. <image :src="item.stylelist.logo" mode=""></image>
  31. </view>
  32. <view class="banktitle dis f-c j-s">
  33. <text>{{item.bankAccount}}</text>
  34. <text>储蓄卡</text>
  35. </view>
  36. </view>
  37. <view class="dis ">
  38. <image class="tool" src="/static/image/bindBank/del.png" mode="" @click="del(item.id)">
  39. </image>
  40. </view>
  41. </view>
  42. <view class="bank dis j-s a-c">
  43. <view v-for="(item,index) in item.bankArray" :key="index">{{item}}</view>
  44. </view>
  45. </view>
  46. <view class="" v-if="current==2" v-for="(item,index) in cardPackList3" :key="index">
  47. <view class="rejectionReason dis a-start j-start">
  48. <view style="width: 5%;margin-top: 2px;">
  49. <image src="/static/image/bindBank/bohui.png" mode="" style="width: 14px;height: 14px;">
  50. </image>
  51. </view>
  52. <view style="width: 95%;">
  53. 驳回原因:{{item.remark?item.remark:'无'}}</view>
  54. </view>
  55. <view class="bankClass dis a-start f-c j-s" :style="{background:item.stylelist.background}">
  56. <image class="Backgroundimage" src="/static/image/bindBank/img1.png" mode="" style=""></image>
  57. <view class="dis j-s">
  58. <view class="dis">
  59. <view class="logo">
  60. <image :src="item.stylelist.logo" mode=""></image>
  61. </view>
  62. <view class="banktitle dis f-c j-s">
  63. <text>{{item.bankAccount}}</text>
  64. <text>储蓄卡</text>
  65. </view>
  66. </view>
  67. </view>
  68. <view class="bank dis j-s a-c">
  69. <view v-for="(item,index) in item.bankArray" :key="index">{{item}}</view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <u-empty text="暂无数据" mode="order" class="flexd" v-else></u-empty>
  75. <view class="fixed">
  76. <u-button type="primary" style="background-color:#0052FF ;font-weight: bold;" @tap="getbankCard">+
  77. 添加银行卡</u-button>
  78. </view>
  79. <u-modal v-model="deleteshow" :show-cancel-button='true' @confirm="delbankCard">
  80. <view class="slot-content dis a-c j-c" style="padding: 10px;">
  81. <span style="font-weight: bold;">点击确定解绑银行卡</span>
  82. </view>
  83. </u-modal>
  84. <u-popup mode="bottom" v-model="promptShow" width="100%" height="50%" border-radius="14" :closeable="true">
  85. <view style="padding: 16px;">
  86. <view class="binding dis f-c a-c ">
  87. <view class="title dis f-c a-c ">
  88. <text>修改银行卡信息</text>
  89. <text>请填写本人的银行卡信息</text>
  90. </view>
  91. <view class="formInfo">
  92. <u-field v-model="form.realUserName" :field-style="{textAlign:'right'}" label="本人姓名"
  93. placeholder="输入真实姓名">
  94. </u-field>
  95. <u-field v-model="form.bankNumber" @blur="validateBankCard" :field-style="{textAlign:'right'}"
  96. label="银行卡号" placeholder="请输入银行卡卡号">
  97. </u-field>
  98. <u-field @click="showAction" v-model="form.bankAccount" :field-style="{textAlign:'right'}"
  99. label="选择银行" placeholder="点击选择银行">
  100. </u-field>
  101. <u-field v-model="form.bankAddress" :field-style="{textAlign:'right'}" label="开户行"
  102. placeholder="输入开户行">
  103. </u-field>
  104. </view>
  105. <u-button class="mt-5" type="primary"
  106. style="background-color:#0052FF ;font-weight: bold;width: 100%;" @tap="updateSubmit">
  107. 点击修改</u-button>
  108. </view>
  109. </view>
  110. </u-popup>
  111. <u-select v-model="show" :list="bnklist" @confirm="confirm"></u-select>
  112. </view>
  113. </template>
  114. <script>
  115. export default {
  116. data() {
  117. return {
  118. show: false,
  119. bnklist: [{
  120. value: '1',
  121. label: '中国工商银行'
  122. },
  123. {
  124. value: '2',
  125. label: '中国农业银行'
  126. },
  127. {
  128. value: '3',
  129. label: '中国银行'
  130. },
  131. {
  132. value: '4',
  133. label: '中国建设银行'
  134. },
  135. {
  136. value: '5',
  137. label: '交通银行'
  138. },
  139. {
  140. value: '6',
  141. label: '中国邮政储蓄银行'
  142. },
  143. {
  144. value: '7',
  145. label: '招商银行'
  146. },
  147. {
  148. value: '8',
  149. label: '中信银行'
  150. },
  151. {
  152. value: '9',
  153. label: '中国光大银行'
  154. },
  155. {
  156. value: '10',
  157. label: '华夏银行'
  158. },
  159. {
  160. value: '11',
  161. label: '中国民生银行'
  162. },
  163. {
  164. value: '12',
  165. label: '广发银行'
  166. },
  167. {
  168. value: '13',
  169. label: '平安银行'
  170. },
  171. {
  172. value: '14',
  173. label: '上海浦东发展银行'
  174. },
  175. {
  176. value: '15',
  177. label: '兴业银行'
  178. },
  179. {
  180. value: '16',
  181. label: '浙商银行'
  182. },
  183. {
  184. value: '17',
  185. label: '渤海银行'
  186. },
  187. {
  188. value: '18',
  189. label: '恒丰银行'
  190. },
  191. {
  192. value: '19',
  193. label: '北京银行'
  194. },
  195. {
  196. value: '20',
  197. label: '上海银行'
  198. },
  199. {
  200. value: '21',
  201. label: '晋商银行'
  202. },
  203. {
  204. value: '22',
  205. label: '山西银行'
  206. },
  207. {
  208. value: '23',
  209. label: '农村商业银行'
  210. },
  211. ],
  212. form: {
  213. bankNumber: "",
  214. realUserName: "",
  215. bankAccount: "",
  216. bankAddress: "",
  217. },
  218. promptShow: false,
  219. id: "",
  220. deleteshow: false,
  221. list: [{
  222. name: '未审核'
  223. }, {
  224. name: '已审核'
  225. }, {
  226. name: '驳回',
  227. }],
  228. current: 1,
  229. validateBankCardStatus: false, //银行卡验证状态
  230. bankNumber: "",
  231. cardPackList1: [],
  232. cardPackList2: [],
  233. cardPackList3: [],
  234. bankList: [{
  235. bankName: "中国邮政储蓄银行",
  236. logo: "/static/image/bankLogo/youzheng.png",
  237. background: "linear-gradient(90deg, rgba(79, 136, 69, 0.7) 0%, #4f8845 100%)"
  238. },
  239. {
  240. bankName: "中国工商银行",
  241. logo: "/static/image/bankLogo/gongshang.png",
  242. background: "linear-gradient(90deg, rgba(177, 0, 13, 0.7) 0%, #b1000d 100%)"
  243. },
  244. {
  245. bankName: "中国农业银行",
  246. logo: "/static/image/bankLogo/nongye.png",
  247. background: "linear-gradient(90deg, rgba(86,152, 130, 0.7) 0%, #569882 100%)"
  248. },
  249. {
  250. bankName: "中国银行",
  251. logo: "/static/image/bankLogo/zhongguo.png",
  252. background: "linear-gradient(90deg, rgba(157, 32, 40, 0.7) 0%, #9d2028 100%)"
  253. },
  254. {
  255. bankName: "中国建设银行",
  256. logo: "/static/image/bankLogo/jianshe.png",
  257. background: "linear-gradient(90deg, rgba(6, 89, 159, 0.7) 0%, #06569F 100%)"
  258. },
  259. {
  260. bankName: "招商银行",
  261. logo: "/static/image/bankLogo/zhaoshang.png",
  262. background: "linear-gradient(90deg, rgba(197, 0, 25, 0.7) 0%, #c50019 100%)"
  263. },
  264. {
  265. bankName: "中国民生银行",
  266. logo: "/static/image/bankLogo/minsheng.png",
  267. background: "linear-gradient(90deg, rgba(84,149, 92, 0.7) 0%, #54955c 100%)"
  268. },
  269. {
  270. bankName: "中国光大银行",
  271. logo: "/static/image/bankLogo/guangda.png",
  272. background: "linear-gradient(90deg, rgba(93, 30, 131, 0.7) 0%, #5d1e83 100%)"
  273. },
  274. {
  275. bankName: "中信银行",
  276. logo: "/static/image/bankLogo/zhongxin.png",
  277. background: "linear-gradient(90deg, rgba(184, 0,22, 0.7) 0%, #b80016 100%)"
  278. },
  279. {
  280. bankName: "华夏银行",
  281. logo: "/static/image/bankLogo/huaxia.png",
  282. background: "linear-gradient(90deg, rgba(216, 12, 24, 0.7) 0%, #d80c18 100%)"
  283. },
  284. {
  285. bankName: "中国交通银行",
  286. logo: "/static/image/bankLogo/jiaotong.png",
  287. background: "linear-gradient(90deg, rgba(33, 58, 120, 0.7) 0%, #213a78 100%)"
  288. },
  289. {
  290. bankName: "晋商银行",
  291. logo: "/static/image/bankLogo/jinshang.png",
  292. background: "linear-gradient(90deg, rgba(224, 150, 165, 0.7) 0%, #e096a5 100%)"
  293. },
  294. {
  295. bankName: "山西银行",
  296. logo: "/static/image/bankLogo/shanxi.png",
  297. background: "linear-gradient(90deg, rgba(192, 19, 73, 0.7) 0%, #c01349 100%)"
  298. },
  299. {
  300. bankName: "农村商业银行",
  301. logo: "/static/image/bankLogo/nongcun.png",
  302. background: "linear-gradient(90deg, rgba(0, 155, 77, 0.7) 0%, #009b4d 100%)"
  303. },
  304. ],
  305. }
  306. },
  307. onShow() {
  308. this.getcardPack(); //获取卡包
  309. },
  310. watch: {
  311. "form.bankNumber": {
  312. handler(val) {
  313. if (val) {
  314. this.form.bankNumber = val.replace(/\s/g, "");
  315. }
  316. },
  317. },
  318. },
  319. onLoad() {
  320. this.$http.get('/sysMenuRecord/add?type=1&menuType=3')
  321. },
  322. methods: {
  323. btn_click() {
  324. uni.navigateTo({
  325. url: '/pages/chat/chat'
  326. })
  327. },
  328. async updateSubmit() {
  329. if (!this.form.bankNumber || !this.form.realUserName || !this.form.bankAccount || !this.form
  330. .bankAddress) {
  331. return uni.showToast({
  332. title: '信息不完整',
  333. duration: 2000,
  334. icon: "none"
  335. });
  336. }
  337. let res = await this.$http.put('/userBank/update', this.form);
  338. if (res.code == '200') {
  339. uni.showToast({
  340. title: res.msg,
  341. icon: "none"
  342. });
  343. this.promptShow = false;
  344. this.getcardPack();
  345. } else {
  346. uni.showToast({
  347. title: res.msg,
  348. icon: "none"
  349. });
  350. }
  351. },
  352. confirm(e) {
  353. this.form.bankAccount = e[0].label;
  354. },
  355. showAction() {
  356. this.show = true;
  357. },
  358. // 验证银行卡
  359. async validateBankCard() {
  360. var that = this;
  361. that.form.bankAccount = "";
  362. await bankBin.getBankBin(this.accountno)
  363. .then((data) => {
  364. that.form.bankAccount = data.bankName;
  365. that.validateBankCardStatus = true;
  366. return true;
  367. })
  368. .catch((err) => {
  369. that.validateBankCardStatus = false;
  370. return uni.showToast({
  371. title: err.split(":")[1],
  372. icon: "none"
  373. });
  374. })
  375. },
  376. change(index) {
  377. this.current = index;
  378. },
  379. async getcardPack() {
  380. let res = await this.$http.post('/userBank/getUserBankList', {
  381. auditStatus: "",
  382. });
  383. let list1 = [];
  384. let list2 = [];
  385. let list3 = [];
  386. if (res.code == '200' && res.data) {
  387. res.data.map(val => {
  388. let name = this.bankList.find(ele => ele.bankName === val.bankAccount || ele.bankName
  389. .includes(val.bankAccount))
  390. if (name) {
  391. val.stylelist = {
  392. ...name
  393. };
  394. } else {
  395. val.stylelist = {
  396. logo: "/static/image/bindBank/img1.png",
  397. background: 'linear-gradient(90deg, rgba(229, 166,0,0.7) 0%, #e5a600 100%)',
  398. }
  399. }
  400. const resultArray = [];
  401. for (let i = 0; i < val.bankNumber.length; i += 4) {
  402. resultArray.push(val.bankNumber.substring(i, i + 4));
  403. }
  404. val.bankArray = resultArray;
  405. switch (val.auditStatus) {
  406. case "0":
  407. list1.push(val);
  408. break;
  409. case "1":
  410. list2.push(val);
  411. break;
  412. case "2":
  413. list3.push(val);
  414. break;
  415. }
  416. })
  417. this.cardPackList1 = list1;
  418. this.cardPackList2 = list2;
  419. this.cardPackList3 = list3;
  420. }
  421. },
  422. getbankCard() {
  423. this.navigate({
  424. url: '/pages/wallet/bindBank',
  425. }, "navigateTo", true)
  426. },
  427. del(id) {
  428. this.id = id;
  429. this.deleteshow = true;
  430. },
  431. async delbankCard() {
  432. let res = await this.$http.post('/userBank/unbind', {
  433. id: this.id,
  434. delFlag: '1',
  435. });
  436. if (res.code == '200') {
  437. this.getcardPack();
  438. uni.showToast({
  439. title: res.msg,
  440. duration: 2000,
  441. icon: "success"
  442. });
  443. }
  444. }
  445. },
  446. }
  447. </script>
  448. <style lang="scss" scoped>
  449. .binding {
  450. padding: 16px;
  451. .title {
  452. font-size: 14px;
  453. color: #333333;
  454. text:first-child {
  455. font-size: 20px;
  456. font-weight: bold;
  457. }
  458. }
  459. .formInfo {
  460. margin-top: 18px;
  461. width: 100%;
  462. background: #FFFFFF;
  463. box-shadow: 0px 4px 10px 0px #DAE3F4;
  464. border-radius: 6px;
  465. }
  466. }
  467. .rejectionReason {
  468. width: 100%;
  469. height: auto;
  470. padding: 5px;
  471. background: rgba(255, 15, 0, 0.1);
  472. border-radius: 8px 8px 8px 8px;
  473. margin-bottom: 5px;
  474. >view {
  475. color: #DC0D00;
  476. font-size: 12px;
  477. }
  478. }
  479. page {
  480. background-color: #fff;
  481. }
  482. .page {
  483. padding: 10px 16px;
  484. }
  485. .fixed {
  486. position: fixed;
  487. bottom: 0;
  488. left: 0;
  489. width: 100%;
  490. height: 62px;
  491. background: #FFFFFF;
  492. box-shadow: 0px -4px 10px 0px rgba(0, 0, 0, 0.1);
  493. padding: 12px 16px;
  494. }
  495. .bankClass {
  496. width: 100%;
  497. height: 110px;
  498. border-radius: 6px;
  499. padding: 14px;
  500. position: relative;
  501. margin-bottom: 15px;
  502. .Backgroundimage {
  503. width: 94px;
  504. height: 86px;
  505. position: absolute;
  506. right: 0;
  507. bottom: 0;
  508. }
  509. >view {
  510. width: 100%;
  511. }
  512. .bank {
  513. font-size: 18px;
  514. color: #fff;
  515. line-height: 1;
  516. view {
  517. font-size: 18px;
  518. line-height: 1;
  519. }
  520. }
  521. .logo {
  522. width: 39px;
  523. height: 39px;
  524. background: #FFFFFF;
  525. border-radius: 6px;
  526. image {
  527. width: 100%;
  528. height: 100%;
  529. }
  530. }
  531. .tool {
  532. width: 20px;
  533. height: 20px;
  534. }
  535. .banktitle {
  536. margin-left: 12px;
  537. text:first-child {
  538. color: #fff;
  539. font-weight: bold;
  540. font-size: 16px;
  541. line-height: 1;
  542. }
  543. text:last-child {
  544. color: #fff;
  545. font-size: 12px;
  546. line-height: 1;
  547. }
  548. }
  549. }
  550. .flexd {
  551. position: fixed;
  552. top: 0;
  553. bottom: 0;
  554. left: 0;
  555. right: 0;
  556. z-index: -1;
  557. }
  558. </style>