BankForm.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <template><page-meta :root-font-size="fontSize+'px'"></page-meta>
  2. <member-base :show="false"><view class="div container member-bank-form">
  3. <view class="div common-header-wrap">
  4. <view :style="'height:'+navHeight+'px'"></view>
  5. <view class="common-header-holder"></view>
  6. <view class="common-header-fixed">
  7. <title-header />
  8. <uni-nav-bar :title="getTitle" class="common-header" left-icon="back" @clickLeft="goBack">
  9. </uni-nav-bar>
  10. </view>
  11. </view>
  12. <view class="div main-content">
  13. <flex-line :show-border="true">
  14. <text class="span">账户类型</text>
  15. <view class="div" slot="right">
  16. <radio-group @change="radioChange">
  17. <label v-for="(item, index) in memberbank_type_options" :key="index">
  18. <radio :value="item.value" :checked="bank_info.memberbank_type==item.value" />
  19. <text>{{item.label}}</text>
  20. </label>
  21. </radio-group>
  22. </view>
  23. </flex-line>
  24. <flex-line class="field-line" :show-border="true"><text class="span field-name">开户名</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="bank_info.memberbank_truename" /></view></flex-line>
  25. <flex-line v-if="bank_info.memberbank_type=='bank'" class="field-line" :show-border="true"><text class="span field-name">开户行</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="bank_info.memberbank_name" /></view></flex-line>
  26. <flex-line class="field-line" :show-border="true"><text class="span field-name">账号</text><view class="div field-line-right" slot="right"><input class="field-input" v-model="bank_info.memberbank_no" /></view></flex-line>
  27. <view class="div pt-10 pb-10"><view class="div common-btn ds-button-large" @click="submit">{{getSumitTitle}}</view></view>
  28. </view>
  29. </view></member-base>
  30. </template>
  31. <script>
  32. import {getFontSize} from '@/util/common'
  33. import TitleHeader from '../../TitleHeader'
  34. import MemberBase from '../MemberBase'
  35. import { getBankInfo, addBank, editBank } from '../../../api/memberBank'
  36. import flexLine from '../../flexLine'
  37. export default {
  38. components:{
  39. TitleHeader,
  40. MemberBase,
  41. flexLine,
  42. },
  43. computed:{
  44. fontSize(){
  45. return getFontSize()
  46. },
  47. isAddMode () {
  48. let mode = this.action
  49. // add: 添加地址,edit: 编辑地址
  50. if (mode === 'add') {
  51. return true
  52. } else {
  53. return false
  54. }
  55. },
  56. getTitle () {
  57. if (this.isAddMode) {
  58. return '新增提现账户'
  59. } else {
  60. return '修改提现账户'
  61. }
  62. },
  63. getSumitTitle () {
  64. return '保存'
  65. }
  66. },
  67. mounted(){
  68. // #ifdef MP-WEIXIN
  69. this.navHeight = uni.getMenuButtonBoundingClientRect().top
  70. // #endif
  71. },
  72. data(){
  73. return {
  74. navHeight: 0,
  75. action:'',
  76. memberbank_type_options: [
  77. {
  78. label: '银行',
  79. value: 'bank'
  80. },
  81. {
  82. label: '支付宝',
  83. value: 'alipay'
  84. }
  85. ],
  86. memberbank_id: 0,
  87. bank_info: {
  88. memberbank_type: 'bank',
  89. memberbank_truename: '',
  90. memberbank_name: '',
  91. memberbank_no: ''
  92. }
  93. }
  94. },
  95. onLoad: function (option) {
  96. this.action=option.action
  97. if (!this.isAddMode) {
  98. this.memberbank_id = option.memberbank_id
  99. getBankInfo(this.memberbank_id).then(res => {
  100. this.bank_info.memberbank_type = res.result.bank_info.memberbank_type
  101. this.bank_info.memberbank_truename = res.result.bank_info.memberbank_truename
  102. this.bank_info.memberbank_name = res.result.bank_info.memberbank_name
  103. this.bank_info.memberbank_no = res.result.bank_info.memberbank_no
  104. }).catch(function (error) {
  105. uni.showToast({icon:'none',title: error.message})
  106. })
  107. }
  108. },
  109. methods: {
  110. radioChange(e){
  111. this.bank_info.memberbank_type=e.detail.value
  112. },
  113. goBack () {
  114. uni.navigateBack({delta:1})
  115. },
  116. submit () {
  117. if (this.isAddMode) {
  118. uni.showLoading({ title: '加载中' })
  119. addBank(this.bank_info).then(
  120. (response) => {
  121. uni.hideLoading()
  122. uni.navigateTo({url:'/pages/member/bank/BankList'})
  123. }, (error) => {
  124. uni.hideLoading()
  125. uni.showToast({icon:'none',title: error.message})
  126. })
  127. } else {
  128. uni.showLoading({ title: '加载中' })
  129. editBank(this.bank_info, this.memberbank_id).then(
  130. (response) => {
  131. uni.hideLoading()
  132. uni.navigateTo({url:'/pages/member/bank/BankList'})
  133. }, (error) => {
  134. uni.hideLoading()
  135. uni.showToast({icon:'none',title: error.message})
  136. })
  137. }
  138. }
  139. }
  140. }
  141. </script>
  142. <style lang="scss">
  143. .member-bank-form{
  144. .mint-radiolist {
  145. display: flex;
  146. .mint-cell {
  147. flex: 1;
  148. .mint-radio-input:checked + .mint-radio-core {
  149. background-color: $primaryColor !important;
  150. border-color: $primaryColor !important;
  151. }
  152. &:after{display: none}
  153. }
  154. }
  155. }
  156. </style>
  157. <style lang="scss" scoped>
  158. .main-content{background: #fff;padding:0 $pageSpace}
  159. .right-arrow{transform: rotate(-90deg);color:#ddd;font-size:$fontSize;display: inline-block;}
  160. .input-wrap{position: relative;
  161. .i{position: absolute;right:0;top:0;line-height: 2.4rem;display: block;width:2rem;text-align: center;font-size:$h1}
  162. }
  163. </style>