account.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247
  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. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  7. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  8. <view class="row b-b">
  9. <text class="tit">姓名</text>
  10. <input class="input" v-model="tabItem.orderList.name" type="text" placeholder="提款人姓名" placeholder-class="placeholder" />
  11. </view>
  12. <view class="row b-b">
  13. <text class="tit">{{ tabIndex == 0 ? '账号' : '银行卡号' }}</text>
  14. <input class="input" v-model="tabItem.orderList.code" type="text" placeholder="请输入账号" placeholder-class="placeholder" />
  15. </view>
  16. <view class="row b-b">
  17. <text class="tit">手机号</text>
  18. <input class="input" v-model="tabItem.orderList.phone" type="text" placeholder="请输入手机号" placeholder-class="placeholder" />
  19. </view>
  20. <!-- <view class="row b-b" v-if="tabIndex == 1">
  21. <text class="tit">所属银行</text>
  22. <input class="input" v-model="tabItem.orderList.bankName" type="text" placeholder="请输入账号" placeholder-class="placeholder" />
  23. </view> -->
  24. </swiper-item>
  25. </swiper>
  26. <button class="add-btn up" @click="confirm">提交申请</button>
  27. </view>
  28. </template>
  29. <script>
  30. import { aliInfo, bankInfo, setAliInfo, setBankInfo } from '@/api/wallet.js';
  31. export default {
  32. data() {
  33. return {
  34. tabCurrentIndex: 0,
  35. navList: [
  36. {
  37. state: 0,
  38. text: '支付宝',
  39. loadingType: 'more',
  40. orderList: {
  41. name: '',
  42. code: '',
  43. phone:''
  44. }
  45. },
  46. {
  47. state: 1,
  48. text: '银行卡',
  49. loadingType: 'more',
  50. orderList: {
  51. name: '',
  52. code: '',
  53. bankName: '',
  54. phone:''
  55. }
  56. }
  57. ]
  58. };
  59. },
  60. onLoad(options) {
  61. this.tabCurrentIndex = +options.state || 0;
  62. this.loadAli();
  63. this.loadBank();
  64. },
  65. methods: {
  66. //加载数据
  67. loadAli(source) {
  68. aliInfo({}).then(({data}) => {
  69. console.log(data,'2232323');
  70. let order = this.navList[0].orderList;
  71. this.$set(order,'name',data.zfb.name)
  72. this.$set(order,'code',data.zfb.payment)
  73. this.$set(order,'phone',data.zfb.phone)
  74. });
  75. },
  76. loadBank() {
  77. bankInfo({}).then(({data}) => {
  78. let order = this.navList[1].orderList;
  79. this.$set(order,'name',data.fullname);
  80. this.$set(order,'code',data.bankno);
  81. this.$set(order,'bankName',data.bank);
  82. this.$set(order,'id',data.id)
  83. });
  84. },
  85. //swiper 切换
  86. changeTab(e) {
  87. this.tabCurrentIndex = e.target.current;
  88. },
  89. //顶部tab点击
  90. tabClick(index) {
  91. this.tabCurrentIndex = index;
  92. },
  93. // 提交保存
  94. confirm() {
  95. let obj = this;
  96. let arr = obj.navList[obj.tabCurrentIndex].orderList;
  97. if (obj.tabCurrentIndex == 1) {
  98. obj.setBankInfo({
  99. fullname: arr.name,
  100. bank: arr.bankName,
  101. bankno: arr.code,
  102. id:arr.id
  103. });
  104. }
  105. if (obj.tabCurrentIndex == 0) {
  106. obj.setAliInfo({
  107. // fullname: arr.name,
  108. // alino: arr.code,
  109. phone:arr.phone,
  110. type:2,
  111. payment:arr.code,
  112. name:arr.name
  113. });
  114. }
  115. },
  116. /* 保存银行卡详细 */
  117. setBankInfo(obj) {
  118. setBankInfo(obj)
  119. .then(e => {
  120. uni.showToast({
  121. title: '修改成功',
  122. duration: 2000,
  123. position: 'top'
  124. });
  125. this.$api.prePage().dataUp()
  126. setTimeout(() => {
  127. uni.navigateBack()
  128. },1500)
  129. })
  130. .catch(e => {
  131. console.log(e);
  132. });
  133. },
  134. // 修改支付宝信息
  135. setAliInfo(obj) {
  136. setAliInfo(obj)
  137. .then(e => {
  138. uni.showToast({
  139. title: '修改成功',
  140. duration: 2000,
  141. position: 'top'
  142. });
  143. setTimeout(() => {
  144. uni.navigateBack({
  145. url:'pages/user/shopJf'
  146. })
  147. },1500)
  148. this.$api.prePage().dataUp()
  149. })
  150. .catch(e => {
  151. console.log(e);
  152. });
  153. },
  154. }
  155. };
  156. </script>
  157. <style lang="scss">
  158. .row {
  159. display: flex;
  160. align-items: center;
  161. position: relative;
  162. padding: 0 30rpx;
  163. height: 110rpx;
  164. background: #fff;
  165. .tit {
  166. flex-shrink: 0;
  167. width: 120rpx;
  168. font-size: 30rpx;
  169. color: $font-color-dark;
  170. }
  171. .input {
  172. flex: 1;
  173. font-size: 30rpx;
  174. color: $font-color-dark;
  175. }
  176. .iconlocation {
  177. font-size: 36rpx;
  178. color: $font-color-light;
  179. }
  180. }
  181. page,
  182. .content {
  183. background: $page-color-base;
  184. height: 100%;
  185. }
  186. .swiper-box {
  187. height: 750rpx;
  188. }
  189. .navbar {
  190. display: flex;
  191. height: 40px;
  192. padding: 0 5px;
  193. background: #fff;
  194. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  195. position: relative;
  196. z-index: 10;
  197. .nav-item {
  198. flex: 1;
  199. display: flex;
  200. justify-content: center;
  201. align-items: center;
  202. height: 100%;
  203. font-size: 15px;
  204. color: $font-color-dark;
  205. position: relative;
  206. &.current {
  207. color: $base-color;
  208. &:after {
  209. content: '';
  210. position: absolute;
  211. left: 50%;
  212. bottom: 0;
  213. transform: translateX(-50%);
  214. width: 44px;
  215. height: 0;
  216. border-bottom: 2px solid $base-color;
  217. }
  218. }
  219. }
  220. }
  221. .add-btn {
  222. &.up {
  223. background-color: $base-color;
  224. color: #fff;
  225. }
  226. display: flex;
  227. align-items: center;
  228. justify-content: center;
  229. width: 690rpx;
  230. height: 80rpx;
  231. margin: 0 auto;
  232. // margin-top: 30rpx;
  233. font-size: $font-lg;
  234. border-radius: 10rpx;
  235. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  236. }
  237. </style>