index.vue 4.7 KB

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