bank_card.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <template>
  2. <view class="main">
  3. <view class="u-margin-left-20 u-margin-right-20 body_style">
  4. <u-form :model="form" ref="uForm">
  5. <u-form-item label="真实姓名" label-width="125" :border-bottom="true">
  6. <u-input placeholder="请输入您的真实姓名" v-model="form.real_name" />
  7. </u-form-item>
  8. <u-form-item label="开户行" label-width="125" :border-bottom="true">
  9. <u-input placeholder="请输入您的开户行" v-model="form.bank_name" />
  10. </u-form-item>
  11. <u-form-item label="银行卡号" label-width="125" :border-bottom="true">
  12. <u-input placeholder="请输入您的银行卡号" v-model="form.bank_card" />
  13. </u-form-item>
  14. <u-form-item label="预留手机" label-width="125" :border-bottom="true">
  15. <u-input placeholder="请输入银行预留的手机号" v-model="form.bank_phone" />
  16. </u-form-item>
  17. </u-form>
  18. <u-button shape="circle" @click="submit_bank" hover-class="none"
  19. :custom-style="{...customStyle,width:'500rpx',height:'66rpx'}" throttle-time="1000">提交</u-button>
  20. </view>
  21. </view>
  22. </template>
  23. <script>
  24. export default {
  25. data() {
  26. return {
  27. form: {
  28. real_name: '',
  29. bank_name: '',
  30. bank_card: '',
  31. bank_phone: ''
  32. },
  33. customStyle: {
  34. width: '214rpx',
  35. height: '52rpx',
  36. color: '#fff',
  37. background: '#FBC600',
  38. border: 'none',
  39. marginTop: '30rpx'
  40. },
  41. }
  42. },
  43. onLoad() {
  44. if (this.vuex_user.real_name != null) {
  45. this.form.real_name = this.vuex_user.real_name
  46. this.form.bank_card = this.vuex_user.bank_card
  47. this.form.bank_name = this.vuex_user.bank_name
  48. this.form.bank_phone = this.vuex_user.bank_phone
  49. }
  50. },
  51. methods: {
  52. async submit_bank() {
  53. if (!this.$u.test.chinese(this.form.real_name)) {
  54. uni.showToast({
  55. title: "请输入正确的姓名",
  56. icon: "none",
  57. })
  58. return false
  59. }
  60. if (!this.$u.test.chinese(this.form.bank_name)) {
  61. uni.showToast({
  62. title: "请输入正确的开户行",
  63. icon: "none",
  64. })
  65. return false
  66. }
  67. if (this.form.bank_card == '') {
  68. uni.showToast({
  69. title: "请输入正确的银行卡号",
  70. icon: "none",
  71. })
  72. return false
  73. }
  74. if (!this.$u.test.mobile(this.form.bank_phone)) {
  75. uni.showToast({
  76. title: "请输入正确的手机号",
  77. icon: "none",
  78. })
  79. return false
  80. }
  81. let res = await this.$u.post('manager/updateBank', {
  82. ...this.form
  83. })
  84. if (res.code == 200) {
  85. this.$u.vuex('vuex_user.real_name',this.form.real_name)
  86. this.$u.vuex('vuex_user.bank_card',this.form.bank_card)
  87. this.$u.vuex('vuex_user.bank_name',this.form.bank_name)
  88. this.$u.vuex('vuex_user.bank_phone',this.form.bank_phone)
  89. console.log(this.vuex_user)
  90. uni.showToast({
  91. title: "绑定成功",
  92. icon: "none",
  93. duration: 1000
  94. })
  95. setTimeout(() => {
  96. uni.navigateBack()
  97. }, 1000)
  98. }
  99. }
  100. }
  101. }
  102. </script>
  103. <style>
  104. .main {
  105. min-height: 100vh;
  106. padding-top: 40rpx;
  107. }
  108. .body_style {
  109. background: #fff;
  110. border-radius: 16rpx;
  111. padding: 10rpx 30rpx;
  112. /* margin-top: 20rpx; */
  113. box-shadow: 6rpx 6rpx 10rpx rgba(122, 122, 122, 0.2);
  114. padding-bottom: 30rpx;
  115. }
  116. </style>