index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. <template>
  2. <view class="index-content" :style="{'--status-bar-': statusBarHeight}">
  3. <view class="index-content-info">
  4. <!-- 头部主要内容 开始 -->
  5. <view class="index-content-header">
  6. <customNavbar :title="title" bgColor="rgba(0,0,0,0)" :is-left="true" :customNavbarInfo='{}'>
  7. </customNavbar>
  8. </view>
  9. <!-- 头部主要内容 结束 -->
  10. <view>
  11. <u--form labelPosition="left" :model="form" :rules="rules" ref="uForm">
  12. <u-form-item label="真实姓名" prop="name" borderBottom ref="item1">
  13. <u--input v-model="form.name" border="none"></u--input>
  14. </u-form-item>
  15. <u-form-item label="开户行" prop="bankName" borderBottom ref="item1">
  16. <u--input v-model="form.bankName" border="none"></u--input>
  17. </u-form-item>
  18. <u-form-item label="银行卡号" prop="bankNo" borderBottom ref="item1">
  19. <u--input v-model="form.bankNo" border="none"></u--input>
  20. </u-form-item>
  21. <u-form-item label="开户行" prop="openBankName" borderBottom ref="item1">
  22. <u--input v-model="form.openBankName" border="none"></u--input>
  23. </u-form-item>
  24. </u--form>
  25. </view>
  26. <view>
  27. <u-button type="primary" @click="getRetailQrcode()" text="提交"></u-button>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. export default {
  34. data() {
  35. return {
  36. title: '我的银行卡',
  37. loading: false,
  38. statusBarHeight: 0, // 状态栏安全距离
  39. form: {
  40. "id": "",
  41. "name": "",
  42. "moblie": "",
  43. "bankName": "",
  44. "bankNo": "",
  45. "openBankName": ""
  46. },
  47. rules: {
  48. 'name': {
  49. type: 'string',
  50. required: true,
  51. message: '请输入姓名',
  52. trigger: ['blur', 'change']
  53. },
  54. 'moblie': {
  55. type: 'string',
  56. max: 1,
  57. required: true,
  58. message: '请输入手机号',
  59. trigger: ['blur', 'change']
  60. },
  61. 'bankName': {
  62. type: 'string',
  63. max: 1,
  64. required: true,
  65. message: '请输入银行名称',
  66. trigger: ['blur', 'change']
  67. },
  68. 'bankNo': {
  69. type: 'string',
  70. max: 1,
  71. required: true,
  72. message: '请输入银行卡号',
  73. trigger: ['blur', 'change']
  74. },
  75. 'openBankName': {
  76. type: 'string',
  77. max: 1,
  78. required: true,
  79. message: '请输入开户行',
  80. trigger: ['blur', 'change']
  81. },
  82. },
  83. }
  84. },
  85. onLoad() {
  86. },
  87. onShow() {
  88. this.statusBarHeight = getApp().globalData.statusBarHeight
  89. //this.load()
  90. },
  91. methods: {
  92. /**
  93. * 获取 我的银行卡
  94. */
  95. async getRetailQrcode() {
  96. try {
  97. uni.showLoading({
  98. title: "获取银行卡中..."
  99. })
  100. let res = await this.$u.api.getPersonsBankApi({
  101. userid: this.distribution_user_info.userId
  102. })
  103. uni.hideLoading()
  104. if (res && res.code === 200) {
  105. this.form = {
  106. "id": res.data.id,
  107. "name": res.data.name,
  108. "moblie": res.data.moblie,
  109. "bankName": res.data.bankName,
  110. "bankNo": res.data.bankNo,
  111. "openBankName": res.data.openBankName
  112. }
  113. }
  114. } catch (e) {
  115. //TODO handle the exception
  116. console.error("e===", e)
  117. uni.hideLoading()
  118. }
  119. },
  120. /**
  121. * 提交 我的银行卡
  122. */
  123. async getRetailQrcode() {
  124. this.$refs.uForm.validate().then(async res => {
  125. try {
  126. uni.showLoading({
  127. title: "提交数据中..."
  128. })
  129. let res = await this.$u.api.insertOrUpdateApi({...this.form})
  130. if (res && res.code === 200) {
  131. uni.hideLoading()
  132. uni.showToast({
  133. title: "绑定成功!!!"
  134. })
  135. this.getRetailQrcode()
  136. }
  137. this.loading = false
  138. } catch (e) {
  139. //TODO handle the exception
  140. console.error("e===", e)
  141. this.loading = false
  142. }
  143. }).catch(errors => {
  144. })
  145. },
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .index-content {
  151. display: flex;
  152. flex-direction: column;
  153. align-items: center;
  154. justify-content: center;
  155. box-sizing: border-box;
  156. --header-h: 170rpx;
  157. // background-color:
  158. .index-content-info {
  159. width: 100%;
  160. box-sizing: border-box;
  161. }
  162. }
  163. /** 头部主要内容 开始 */
  164. .index-content-header {
  165. width: 100%;
  166. height: var(--header-h);
  167. box-sizing: border-box;
  168. background-color: var(--gd-bgm-color);
  169. ::v-deep .u-search {
  170. padding: 0 30rpx !important;
  171. }
  172. ::v-deep .u-search__action {
  173. color: #fff !important;
  174. }
  175. }
  176. /** 头部主要内容 结束 **/
  177. </style>