bankCard.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  1. <template>
  2. <view class="">
  3. <u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
  4. <view class="page" v-if="cardPackList1.length>0 || cardPackList2.length>0 || cardPackList3.length>0">
  5. <view v-if="current==0" class="bankClass dis a-start f-c j-s" v-for="(item,index) in cardPackList1"
  6. :key="index" :style="{background:item.stylelist.background}">
  7. <image class="Backgroundimage" src="/static/image/bindBank/img1.png" mode="" style=""></image>
  8. <view class="dis j-s">
  9. <view class="dis">
  10. <view class="logo">
  11. <image :src="item.stylelist.logo" mode=""></image>
  12. </view>
  13. <view class="banktitle dis f-c j-s">
  14. <text>{{item.bankAccount}}</text>
  15. <text>储蓄卡</text>
  16. </view>
  17. </view>
  18. <image class="tool" src="/static/image/bindBank/tool.png" mode="" @click="del(item.id)">
  19. </image>
  20. </view>
  21. <view class="bank dis j-s a-c">
  22. <view>****</view>
  23. <view>****</view>
  24. <view>****</view>
  25. <text>{{item.bankNumber.slice(-4)}}</text>
  26. </view>
  27. </view>
  28. <view v-if="current==1" class="bankClass dis a-start f-c j-s" v-for="(item,index) in cardPackList2"
  29. :key="index" :style="{background:item.stylelist.background}">
  30. <image class="Backgroundimage" src="/static/image/bindBank/img1.png" mode="" style=""></image>
  31. <view class="dis j-s">
  32. <view class="dis">
  33. <view class="logo">
  34. <image :src="item.stylelist.logo" mode=""></image>
  35. </view>
  36. <view class="banktitle dis f-c j-s">
  37. <text>{{item.bankAccount}}</text>
  38. <text>储蓄卡</text>
  39. </view>
  40. </view>
  41. <image class="tool" src="/static/image/bindBank/tool.png" mode="" @click="del(item.id)">
  42. </image>
  43. </view>
  44. <view class="bank dis j-s a-c">
  45. <view>****</view>
  46. <view>****</view>
  47. <view>****</view>
  48. <text>{{item.bankNumber.slice(-4)}}</text>
  49. </view>
  50. </view>
  51. <view v-if="current==2" class="bankClass dis a-start f-c j-s" v-for="(item,index) in cardPackList3"
  52. :key="index" :style="{background:item.stylelist.background}">
  53. <image class="Backgroundimage" src="/static/image/bindBank/img1.png" mode="" style=""></image>
  54. <view class="dis j-s">
  55. <view class="dis">
  56. <view class="logo">
  57. <image :src="item.stylelist.logo" mode=""></image>
  58. </view>
  59. <view class="banktitle dis f-c j-s">
  60. <text>{{item.bankAccount}}</text>
  61. <text>储蓄卡</text>
  62. </view>
  63. </view>
  64. <image class="tool" src="/static/image/bindBank/tool.png" mode="" @click="del(item.id)">
  65. </image>
  66. </view>
  67. <view class="bank dis j-s a-c">
  68. <view>****</view>
  69. <view>****</view>
  70. <view>****</view>
  71. <text>{{item.bankNumber.slice(-4)}}</text>
  72. </view>
  73. </view>
  74. </view>
  75. <u-empty text="暂无数据" mode="order" class="flexd" v-else></u-empty>
  76. <view class="fixed">
  77. <u-button type="primary" style="background-color:#0052FF ;font-weight: bold;" @tap="getbankCard">+
  78. 添加银行卡</u-button>
  79. </view>
  80. <u-modal v-model="deleteshow" :show-cancel-button='true' @confirm="delbankCard">
  81. <view class="slot-content dis a-c j-c" style="padding: 10px;">
  82. <span style="font-weight: bold;">点击确认删除银行卡</span>
  83. </view>
  84. </u-modal>
  85. </view>
  86. </template>
  87. <script>
  88. export default {
  89. data() {
  90. return {
  91. id: "",
  92. deleteshow: false,
  93. list: [{
  94. name: '未审核'
  95. }, {
  96. name: '已审核'
  97. }, {
  98. name: '驳回',
  99. }],
  100. current: 1,
  101. bankNumber: "",
  102. cardPackList1: [],
  103. cardPackList2: [],
  104. cardPackList3: [],
  105. bankList: [{
  106. bankName: "中国邮政储蓄银行",
  107. logo: "/static/image/bankLogo/youzheng.png",
  108. background: "linear-gradient(90deg, rgba(79, 136, 69, 0.7) 0%, #4f8845 100%)"
  109. },
  110. {
  111. bankName: "中国工商银行",
  112. logo: "/static/image/bankLogo/gongshang.png",
  113. background: "linear-gradient(90deg, rgba(177, 0, 13, 0.7) 0%, #b1000d 100%)"
  114. },
  115. {
  116. bankName: "中国农业银行",
  117. logo: "/static/image/bankLogo/nongye.png",
  118. background: "linear-gradient(90deg, rgba(86,152, 130, 0.7) 0%, #569882 100%)"
  119. },
  120. {
  121. bankName: "中国银行",
  122. logo: "/static/image/bankLogo/zhongguo.png",
  123. background: "linear-gradient(90deg, rgba(157, 32, 40, 0.7) 0%, #9d2028 100%)"
  124. },
  125. {
  126. bankName: "中国建设银行",
  127. logo: "/static/image/bankLogo/jianshe.png",
  128. background: "linear-gradient(90deg, rgba(6, 89, 159, 0.7) 0%, #06569F 100%)"
  129. },
  130. {
  131. bankName: "招商银行",
  132. logo: "/static/image/bankLogo/zhaoshang.png",
  133. background: "linear-gradient(90deg, rgba(197, 0, 25, 0.7) 0%, #c50019 100%)"
  134. },
  135. {
  136. bankName: "中国民生银行",
  137. logo: "/static/image/bankLogo/minsheng.png",
  138. background: "linear-gradient(90deg, rgba(84,149, 92, 0.7) 0%, #54955c 100%)"
  139. },
  140. {
  141. bankName: "中国光大银行",
  142. logo: "/static/image/bankLogo/guangda.png",
  143. background: "linear-gradient(90deg, rgba(93, 30, 131, 0.7) 0%, #5d1e83 100%)"
  144. },
  145. {
  146. bankName: "中信银行",
  147. logo: "/static/image/bankLogo/zhongxin.png",
  148. background: "linear-gradient(90deg, rgba(184, 0,22, 0.7) 0%, #b80016 100%)"
  149. },
  150. {
  151. bankName: "华夏银行",
  152. logo: "/static/image/bankLogo/huaxia.png",
  153. background: "linear-gradient(90deg, rgba(216, 12, 24, 0.7) 0%, #d80c18 100%)"
  154. },
  155. {
  156. bankName: "中国交通银行",
  157. logo: "/static/image/bankLogo/jiaotong.png",
  158. background: "linear-gradient(90deg, rgba(33, 58, 120, 0.7) 0%, #213a78 100%)"
  159. },
  160. {
  161. bankName: "晋商银行",
  162. logo: "/static/image/bankLogo/jinshang.png",
  163. background: "linear-gradient(90deg, rgba(224, 150, 165, 0.7) 0%, #e096a5 100%)"
  164. },
  165. ],
  166. }
  167. },
  168. onShow() {
  169. this.getcardPack(); //获取卡包
  170. },
  171. onLoad() {},
  172. methods: {
  173. change(index) {
  174. this.current = index;
  175. },
  176. async getcardPack() {
  177. let res = await this.$http.post('/userBank/getUserBankList', {
  178. auditStatus: "",
  179. });
  180. let list1 = [];
  181. let list2 = [];
  182. let list3 = [];
  183. if (res.code == '200' && res.data) {
  184. res.data.map(val => {
  185. let name = this.bankList.find(ele => ele.bankName === val.bankAccount)
  186. if (name) {
  187. val.stylelist = {
  188. ...name
  189. };
  190. } else {
  191. val.stylelist = {
  192. logo: "/static/image/bindBank/img1.png",
  193. background: 'linear-gradient(90deg, rgba(229, 166,0,0.7) 0%, #e5a600 100%)',
  194. }
  195. }
  196. switch (val.auditStatus) {
  197. case "0":
  198. list1.push(val);
  199. break;
  200. case "1":
  201. list2.push(val);
  202. break;
  203. case "2":
  204. list3.push(val);
  205. break;
  206. }
  207. })
  208. this.cardPackList1 = list1;
  209. this.cardPackList2 = list2;
  210. this.cardPackList3 = list3;
  211. }
  212. },
  213. getbankCard() {
  214. this.navigate({
  215. url: '/pages/wallet/bindBank',
  216. }, "navigateTo", true)
  217. },
  218. del(id) {
  219. this.id = id;
  220. this.deleteshow = true;
  221. },
  222. async delbankCard() {
  223. let res = await this.$http.delete('/userBank/' + this.id);
  224. if (res.code == '200') {
  225. this.getcardPack();
  226. uni.showToast({
  227. title: res.msg,
  228. duration: 2000,
  229. icon: "success"
  230. });
  231. }
  232. }
  233. },
  234. }
  235. </script>
  236. <style lang="scss" scoped>
  237. page {
  238. background-color: #fff;
  239. }
  240. .page {
  241. padding: 10px 16px;
  242. }
  243. .fixed {
  244. position: fixed;
  245. bottom: 0;
  246. left: 0;
  247. width: 100%;
  248. height: 62px;
  249. background: #FFFFFF;
  250. box-shadow: 0px -4px 10px 0px rgba(0, 0, 0, 0.1);
  251. padding: 12px 16px;
  252. }
  253. .bankClass {
  254. width: 100%;
  255. height: 110px;
  256. border-radius: 6px;
  257. padding: 14px;
  258. position: relative;
  259. margin-bottom: 15px;
  260. .Backgroundimage {
  261. width: 94px;
  262. height: 86px;
  263. position: absolute;
  264. right: 0;
  265. bottom: 0;
  266. }
  267. >view {
  268. width: 100%;
  269. }
  270. .bank {
  271. font-size: 18px;
  272. color: #fff;
  273. line-height: 1;
  274. view {
  275. font-size: 18px;
  276. line-height: 1;
  277. margin-top: 6px;
  278. }
  279. }
  280. .logo {
  281. width: 39px;
  282. height: 39px;
  283. background: #FFFFFF;
  284. border-radius: 6px;
  285. image {
  286. width: 100%;
  287. height: 100%;
  288. }
  289. }
  290. .tool {
  291. width: 28px;
  292. height: 20px;
  293. }
  294. .banktitle {
  295. margin-left: 12px;
  296. text:first-child {
  297. color: #fff;
  298. font-weight: bold;
  299. font-size: 16px;
  300. line-height: 1;
  301. }
  302. text:last-child {
  303. color: #fff;
  304. font-size: 12px;
  305. line-height: 1;
  306. }
  307. }
  308. }
  309. .flexd {
  310. position: fixed;
  311. top: 0;
  312. bottom: 0;
  313. left: 0;
  314. right: 0;
  315. z-index: -1;
  316. }
  317. </style>