addbank.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <block>
  3. <view class="tip1">添加银行卡</view>
  4. <view class="tip2">请绑定本人常用银行卡</view>
  5. <view :style="'width:' + widths + ';overflow-x:hidden;'">
  6. <view class="step1">
  7. <view class="info">
  8. <view class="info-label info-content flex-row">
  9. <!-- <view class="info-left flex-y-center required">收件人</view> -->
  10. <view class="info-left flex-y-center">持卡人:</view>
  11. <view class="info-right flex-row flex-y-center">
  12. <input :value="name" class="name-input" @input="inputChange" data-name="name" placeholder="持卡人姓名" />
  13. </view>
  14. </view>
  15. <view class="info-label info-content flex-row">
  16. <view class="info-left flex-y-center ">联系电话:</view>
  17. <view class="info-right flex-row flex-y-center">
  18. <input :value="mobile" class="mobile-input" data-name="mobile" @input="inputChange" placeholder="请输入您的手机号码" type="number"></input>
  19. </view>
  20. </view>
  21. <view class="info-label info-content flex-row">
  22. <view class="info-left flex-y-center">卡号:</view>
  23. <view class="info-right flex-row flex-y-center">
  24. <input :value="card" class="name-input" @input="inputChange" data-name="card" placeholder="持卡人本人银行卡号" />
  25. <!-- <textarea auto-height :value="addressDetail" class="name-input" @input="inputChange" data-name="card_no" placeholder="持卡人本人银行卡号"></textarea> -->
  26. </view>
  27. </view>
  28. <view class="info-label info-content flex-row">
  29. <view class="info-left flex-y-center">银行:</view>
  30. <view class="info-right flex-row flex-y-center">
  31. <input :value="bank" class="mobile-input" @input="inputChange" data-name="bank" placeholder="请输入开户行" />
  32. </view>
  33. </view>
  34. <!-- <view class="info-label info-content flex-row">
  35. <view class="info-left flex-y-center">银行</view>
  36. <view class="info-right flex-row flex-y-center">
  37. <picker bindchange="bindPickerChange" value="{{index}}" range="{{array}}">
  38. <view class="mobile-input {{title?'':'c999'}}">
  39. {{title?title:"请选择开户行"}}
  40. </view>
  41. </picker>
  42. </view>
  43. </view> -->
  44. <!-- <view class="switch">
  45. <view>设置默认银行卡:</view>
  46. <switch :checked="switch1Checked" @change="switch1Change" color="#1479FF" />
  47. </view> -->
  48. </view>
  49. </view>
  50. </view>
  51. <view class="addAddress" @tap="confirm">保存</view>
  52. </block>
  53. </template>
  54. <script>
  55. var app = getApp(); // a = app.requirejs('core');
  56. var loading = false; // var b = app.requirejs("api/index");
  57. // import { request } from '../../../utils/request.js';
  58. export default {
  59. data() {
  60. return {
  61. name: '',
  62. mobile: '',
  63. card: '',
  64. bank: '',
  65. // phone: "",
  66. // title: "",
  67. // array: ['农业银行', '赣州银行', '中国银行', '交通银行'],
  68. // index: 0,
  69. switch1Checked: false,
  70. widths: '',
  71. };
  72. },
  73. onLoad: function (e) {
  74. // this.setData(e);
  75. },
  76. onPullDownRefresh: function () {},
  77. onReachBottom: function () {},
  78. methods: {
  79. bindPickerChange(e) {
  80. console.log('picker发送选择改变,携带值为', e.detail.value);
  81. this.setData({
  82. index: e.detail.value,
  83. title: this.array[e.detail.value]
  84. });
  85. },
  86. switch1Change(e) {
  87. this.setData({
  88. switch1Checked: e.detail.value
  89. });
  90. },
  91. async confirm () {
  92. if (loading) {
  93. return;
  94. }
  95. var that = this;
  96. if (that.name == '') {
  97. uni.showToast({
  98. title: '请填写持卡人姓名',
  99. icon: 'none'
  100. });
  101. return false;
  102. }
  103. if (that.mobile == '') {
  104. uni.showToast({
  105. title: '请填写手机号码',
  106. icon: 'none'
  107. });
  108. return false;
  109. }
  110. if (that.card == '') {
  111. uni.showToast({
  112. title: '请填写银行卡号',
  113. icon: 'none'
  114. });
  115. return false;
  116. }
  117. if (that.bank == '') {
  118. uni.showToast({
  119. title: '请填写银行卡姓名',
  120. icon: 'none'
  121. });
  122. return false;
  123. }
  124. let result = await this.$api.request('/bank/add', 'POST', {name:that.name,mobile:that.mobile,card:that.card,bank:that.bank});
  125. if (result) {
  126. this.$api.msg('添加成功');
  127. setTimeout(function () {
  128. uni.navigateBack({
  129. delta:1
  130. })
  131. }, 1000);
  132. }
  133. // var r = this.type == 1 ? 'agent.cash.add_bank' : 'fenxiao.cash.add_bank';
  134. // loading = true;
  135. // request({
  136. // method: 'get',
  137. // data: {
  138. // r,
  139. // account: that.account,
  140. // card_no: that.card_no,
  141. // bank_name: that.bank_name,
  142. // is_default: that.switch1Checked ? 1 : 0
  143. // }
  144. // }).then((res) => {
  145. // console.log(res);
  146. // if (res.error == 0) {
  147. // uni.showToast({
  148. // title: '添加成功',
  149. // icon: 'none'
  150. // });
  151. // setTimeout(function () {
  152. // uni.navigateTo({
  153. // url: '/pages/backstage/bankList/bankList?type=' + that.type
  154. // });
  155. // }, 1000);
  156. // } else {
  157. // uni.showToast({
  158. // title: res.message,
  159. // icon: 'none'
  160. // });
  161. // }
  162. // });
  163. },
  164. inputChange(e) {
  165. var name = e.currentTarget.dataset.name;
  166. this[name] = e.detail.value;
  167. }
  168. }
  169. };
  170. </script>
  171. <style>
  172. .step1 .info {
  173. background-color: #ffffff;
  174. border-bottom: 1rpx #e4e5ee solid;
  175. padding: 0 30rpx;
  176. }
  177. .info .info-label {
  178. width: 100%;
  179. height: 100rpx;
  180. border-bottom: 1rpx #e3e3e3 solid;
  181. color: #353535;
  182. }
  183. .info .info-label:last-child {
  184. border-bottom: none;
  185. }
  186. .info .info-label .info-red {
  187. color: #ff5200;
  188. }
  189. .info .info-label .info-gray {
  190. color: #666666;
  191. }
  192. .info .info-label.info-content {
  193. height: 100rpx;
  194. padding-left: 10rpx;
  195. }
  196. .info-label .info-left {
  197. width: 176rpx;
  198. font-size: 28rpx;
  199. }
  200. .info-left {
  201. width: 176rpx;
  202. }
  203. .info-label .info-left.required::after {
  204. content: '*';
  205. color: #ff5200;
  206. }
  207. .info-label .info-agree {
  208. font-size: 10pt;
  209. }
  210. .info-btn {
  211. padding: 24rpx;
  212. background-color: #f7f7f7;
  213. }
  214. .info-btn .info-btn-content {
  215. background-color: #e94443;
  216. color: #ffffff;
  217. font-weight: bold;
  218. height: 100rpx;
  219. line-height: 100rpx;
  220. width: 100%;
  221. }
  222. .info-label .info-icon {
  223. width: 60rpx;
  224. height: 60rpx;
  225. margin-right: 24rpx;
  226. }
  227. .info .bold {
  228. font-weight: bold;
  229. }
  230. .info .info-label.info-height {
  231. height: auto;
  232. }
  233. .textarea {
  234. flex: 1;
  235. min-height: 200rpx;
  236. }
  237. .info .info-label .info-block {
  238. padding: 24rpx 0;
  239. }
  240. .info-block .info-top {
  241. margin-bottom: 16rpx;
  242. }
  243. .info-block .info-bottom {
  244. font-size: 9pt;
  245. }
  246. .step2 .info {
  247. padding: 48rpx 24rpx;
  248. text-align: center;
  249. }
  250. .step2 .info .info-title {
  251. width: 100%;
  252. padding: 40rpx 0;
  253. }
  254. .info-title .info-images {
  255. width: 80rpx;
  256. height: 80rpx;
  257. }
  258. .step2 .info-btn1 {
  259. margin-top: 88rpx;
  260. width: 100%;
  261. }
  262. .step2 .info-btn1 .btn {
  263. width: 100%;
  264. background-color: #820000;
  265. color: #ffffff;
  266. font-weight: bold;
  267. height: 100rpx;
  268. line-height: 100rpx;
  269. border-radius: 10rpx;
  270. }
  271. .name-input {
  272. /* padding: 12rpx 0; */
  273. width: 100%;
  274. }
  275. .flex {
  276. display: -webkit-box;
  277. display: -webkit-flex;
  278. display: flex;
  279. }
  280. .flex-row {
  281. display: -webkit-box;
  282. display: -webkit-flex;
  283. display: flex;
  284. -webkit-box-orient: horizontal;
  285. flex-direction: row;
  286. }
  287. .flex-col {
  288. display: -webkit-box;
  289. display: -webkit-flex;
  290. display: flex;
  291. -webkit-box-orient: vertical;
  292. flex-direction: column;
  293. }
  294. .flex-grow-0 {
  295. min-width: 0;
  296. -webkit-box-flex: 0;
  297. -ms-flex-positive: 0;
  298. flex-grow: 0;
  299. -ms-flex-negative: 0;
  300. flex-shrink: 0;
  301. }
  302. .flex-grow-1 {
  303. min-width: 0;
  304. -webkit-box-flex: 1;
  305. -ms-flex-positive: 1;
  306. flex-grow: 1;
  307. -ms-flex-negative: 1;
  308. flex-shrink: 1;
  309. }
  310. .flex-x-center {
  311. display: -webkit-box;
  312. display: -webkit-flex;
  313. display: flex;
  314. -webkit-box-pack: center;
  315. -ms-flex-pack: center;
  316. justify-content: center;
  317. flex: 1;
  318. }
  319. .flex-y-center {
  320. display: -webkit-box;
  321. display: -webkit-flex;
  322. display: flex;
  323. -webkit-box-align: center;
  324. -ms-flex-align: center;
  325. -ms-grid-row-align: center;
  326. align-items: center;
  327. }
  328. .info-right {
  329. flex: 1;
  330. }
  331. .flex-y-bottom {
  332. display: -webkit-box;
  333. display: -webkit-flex;
  334. display: flex;
  335. -webkit-box-align: end;
  336. -ms-flex-align: end;
  337. -ms-grid-row-align: flex-end;
  338. align-items: flex-end;
  339. }
  340. .c999 {
  341. color: #777;
  342. }
  343. .addAddress {
  344. width: 670rpx;
  345. height: 80rpx;
  346. display: flex;
  347. justify-content: center;
  348. align-items: center;
  349. color: #fff;
  350. background: linear-gradient(to right,#F8A52B,#F8C657);
  351. border-radius: 50rpx;
  352. font-size: 30rpx;
  353. position: fixed;
  354. bottom: 80rpx;
  355. left: 50%;
  356. transform: translate(-50%, 0);
  357. font-weight: 700;
  358. }
  359. .heng {
  360. height: 20rpx;
  361. background: #efefef;
  362. }
  363. textarea {
  364. width: 480rpx;
  365. }
  366. .tip1 {
  367. margin-top: 60rpx;
  368. font-weight: 700;
  369. font-size: 40rpx;
  370. text-align: center;
  371. }
  372. .tip2 {
  373. font-size: 28rpx;
  374. text-align: center;
  375. margin: 35rpx 0 100rpx;
  376. }
  377. .switch {
  378. height: 100rpx;
  379. padding: 0 10rpx;
  380. border-bottom: 1px solid #e3e3ee;
  381. display: flex;
  382. align-items: center;
  383. justify-content: space-between;
  384. }
  385. .switch > view {
  386. color: #353535;
  387. font-size: 28rpx;
  388. }
  389. </style>