account.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. <template>
  2. <view class="content">
  3. <!-- <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  5. </view> -->
  6. <view class="row b-b">
  7. <text class="tit">姓名</text>
  8. <input class="input" v-model="name" type="text" placeholder="请输入姓名" placeholder-class="placeholder" />
  9. </view>
  10. <view class="row b-b">
  11. <text class="tit">银行卡号</text>
  12. <input class="input" v-model="payment" type="text" placeholder="请输入银行卡号" placeholder-class="placeholder" />
  13. </view>
  14. <view class="row b-b">
  15. <text class="tit">手机号码</text>
  16. <input class="input" v-model="phone" type="text" placeholder="请输入手机号码" placeholder-class="placeholder" />
  17. </view>
  18. <view class="row b-b">
  19. <text class="tit">所属银行</text>
  20. <input class="input" v-model="bank" type="text" placeholder="请输入所属银行" placeholder-class="placeholder" />
  21. </view>
  22. <view class="row b-b">
  23. <text class="tit">所属支行</text>
  24. <input class="input" v-model="bank_name" type="text" placeholder="请输入所属支行" placeholder-class="placeholder" />
  25. </view>
  26. <button class="add-btn up" @click="confirm">提 交 保 存</button>
  27. </view>
  28. </template>
  29. <script>
  30. import { setBankInfo, getBank } from '@/api/wallet.js';
  31. export default {
  32. data() {
  33. return {
  34. type: 3,
  35. payment: '',
  36. name: '',
  37. bank: '',
  38. phone: '',
  39. bank_name: '',
  40. loading: false
  41. };
  42. },
  43. onLoad(options) {
  44. this.getBank();
  45. },
  46. methods: {
  47. // 提交保存
  48. confirm() {
  49. let obj = this;
  50. if (obj.loading) {
  51. return;
  52. }
  53. if (obj.name == '') {
  54. return obj.$api.msg('请输入姓名');
  55. }
  56. if (obj.payment == '') {
  57. return obj.$api.msg('请输入银行卡号');
  58. }
  59. if (obj.phone == '') {
  60. return obj.$api.msg('请输入手机号');
  61. }
  62. if (obj.bank == '') {
  63. return obj.$api.msg('请输入所属银行');
  64. }
  65. if (obj.bank_name == '') {
  66. return obj.$api.msg('请输入所属支行');
  67. }
  68. obj.loading = true;
  69. setBankInfo({
  70. type: obj.type,
  71. name: obj.name,
  72. phone: obj.phone,
  73. payment: obj.payment,
  74. bank: obj.bank,
  75. bank_name: obj.bank_name
  76. })
  77. .then(res => {
  78. obj.loading = false;
  79. uni.showToast({
  80. title: '修改成功',
  81. duration: 2000,
  82. position: 'top'
  83. });
  84. console.log('修改成功');
  85. obj.$api.prePage().dataUp();
  86. setTimeout(() => {
  87. uni.navigateBack();
  88. }, 1500);
  89. })
  90. .catch(err => {
  91. obj.loading = false;
  92. this.$api.msg(err);
  93. });
  94. },
  95. getBank() {
  96. let obj = this;
  97. getBank().then(res => {
  98. if (res.data.bank.length == 0) {
  99. console.log('没有填信息');
  100. } else {
  101. let bank = res.data.bank;
  102. obj.name = bank.name;
  103. obj.phone = bank.phone;
  104. obj.payment = bank.payment;
  105. obj.bank = bank.bank;
  106. obj.bank_name = bank.bank_name;
  107. }
  108. });
  109. }
  110. }
  111. };
  112. </script>
  113. <style lang="scss">
  114. .row {
  115. display: flex;
  116. align-items: center;
  117. position: relative;
  118. padding: 0 30rpx;
  119. height: 110rpx;
  120. background: #fff;
  121. .tit {
  122. flex-shrink: 0;
  123. width: 200rpx;
  124. font-size: 30rpx;
  125. color: $font-color-dark;
  126. }
  127. .input {
  128. flex: 1;
  129. font-size: 30rpx;
  130. color: $font-color-dark;
  131. }
  132. .iconlocation {
  133. font-size: 36rpx;
  134. color: $font-color-light;
  135. }
  136. }
  137. page,
  138. .content {
  139. background: $page-color-base;
  140. height: 100%;
  141. }
  142. .swiper-box {
  143. height: 750rpx;
  144. }
  145. .navbar {
  146. display: flex;
  147. height: 40px;
  148. padding: 0 5px;
  149. background: #fff;
  150. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  151. position: relative;
  152. z-index: 10;
  153. .nav-item {
  154. flex: 1;
  155. display: flex;
  156. justify-content: center;
  157. align-items: center;
  158. height: 100%;
  159. font-size: 15px;
  160. color: $font-color-dark;
  161. position: relative;
  162. &.current {
  163. color: $base-color;
  164. &:after {
  165. content: '';
  166. position: absolute;
  167. left: 50%;
  168. bottom: 0;
  169. transform: translateX(-50%);
  170. width: 44px;
  171. height: 0;
  172. border-bottom: 2px solid $base-color;
  173. }
  174. }
  175. }
  176. }
  177. .add-btn {
  178. &.up {
  179. background-color: #e93323;
  180. color: #fff;
  181. }
  182. display: flex;
  183. align-items: center;
  184. justify-content: center;
  185. width: 690rpx;
  186. height: 80rpx;
  187. margin: 0 auto;
  188. margin-top: 30rpx;
  189. font-size: $font-lg;
  190. border-radius: 10rpx;
  191. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  192. }
  193. </style>