You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

187 lines
4.0 KiB

1 year ago
  1. <template>
  2. <view>
  3. <u-navbar
  4. :title="$t('page.editBankCart.title')"
  5. :safeAreaInsetTop="false"
  6. placeholder
  7. @leftClick="leftClick"
  8. >
  9. </u-navbar>
  10. <u--form
  11. labelPosition="left"
  12. :model="model1"
  13. :rules="rules"
  14. class="line"
  15. ref="uForm"
  16. >
  17. <u-form-item
  18. :label="$t('page.editBankCart.name')"
  19. prop="userInfo.name"
  20. borderBottom
  21. labelWidth="80px"
  22. >
  23. <u--input
  24. v-model="model1.userInfo.name"
  25. :placeholder="$t('page.editBankCart.name-placeholder')"
  26. border="none"
  27. ></u--input>
  28. </u-form-item>
  29. <u-form-item
  30. :label="$t('page.editBankCart.Bank-of-deposit')"
  31. prop="userInfo.title"
  32. borderBottom
  33. labelWidth="80px"
  34. @click="showIdType = true"
  35. >
  36. <u--input
  37. v-model="model1.userInfo.title"
  38. border="none"
  39. @focus="showIdType = true"
  40. :placeholder="$t('page.editBankCart.Bank-of-deposit-placeholder')"
  41. @blur="bankOfDepositeditBankCart"
  42. ></u--input>
  43. <!-- 选择开户行 -->
  44. <!-- <u-action-sheet
  45. :show="showIdType"
  46. :actions="bankOfDepositActions"
  47. :title="$t('page.editBankCart.Bank-of-deposit-placeholder')"
  48. @close="showIdType = false"
  49. @select="bankOfDepositSelect"
  50. ></u-action-sheet> -->
  51. </u-form-item>
  52. <u-form-item
  53. :label="$t('page.editBankCart.cart-number')"
  54. prop="userInfo.no"
  55. borderBottom
  56. labelWidth="80px"
  57. >
  58. <u--input
  59. v-model="model1.userInfo.no"
  60. :placeholder="$t('page.editBankCart.cart-number-placeholder')"
  61. border="none"
  62. ></u--input>
  63. </u-form-item>
  64. </u--form>
  65. <u-button class="submit"
  66. size="large" @click="submit"
  67. :text="$t('page.editBankCart.submit')"></u-button>
  68. </view>
  69. </template>
  70. <script>
  71. export default {
  72. data() {
  73. return {
  74. showIdType : false,
  75. bankOfDepositActions : [
  76. {
  77. name: '交通银行',
  78. },
  79. {
  80. name : '中国人民银行'
  81. },
  82. {
  83. name : '中国农商银行'
  84. }
  85. ],
  86. model1: {
  87. userInfo: {
  88. name: '',
  89. title : '',
  90. no : '',
  91. uid : 1
  92. },
  93. },
  94. rules: {
  95. 'userInfo.name': {
  96. type: 'string',
  97. required: true,
  98. message: this.$t('page.editBankCart.name-placeholder'),
  99. trigger: ['blur', 'change']
  100. },
  101. 'userInfo.title': {
  102. type: 'string',
  103. required: true,
  104. message: this.$t('page.editBankCart.Bank-of-deposit-placeholder'),
  105. trigger: ['blur', 'change']
  106. },
  107. 'userInfo.no': {
  108. type: 'string',
  109. required: true,
  110. message: this.$t('page.editBankCart.cart-number-placeholder'),
  111. trigger: ['blur', 'change']
  112. },
  113. },
  114. }
  115. },
  116. methods: {
  117. leftClick(){
  118. if(this.$route.query.type == 1){
  119. return uni.navigateTo({
  120. url:'/pages/user/bankCardWithdrawal/bankCardWithdrawal'
  121. });
  122. }
  123. uni.navigateTo({
  124. url: '/pages/user/bankCart/bankCart'
  125. })
  126. },
  127. addBankCart(){ //添加银行卡
  128. this.request('saveBankCardPage',this.model1.userInfo).then(res=>{
  129. if(res.code === 200){
  130. uni.$u.toast(this.$t('page.editBankCart.add-success'));
  131. setTimeout(()=>{
  132. if(this.$route.query.type == 1){
  133. return uni.navigateTo({
  134. url:'/pages/user/bankCardWithdrawal/bankCardWithdrawal'
  135. });
  136. }
  137. uni.navigateTo({
  138. url: "/pages/user/bankCart/bankCart"
  139. })
  140. },500)
  141. }
  142. })
  143. },
  144. submit(){
  145. this.$refs.uForm.validate().then(res => {
  146. this.addBankCart();
  147. })
  148. },
  149. bankOfDepositSelect(e){
  150. this.model1.userInfo.title = e.name
  151. },
  152. bankOfDepositeditBankCart(){
  153. let a = false
  154. this.bankOfDepositActions.forEach(n => {
  155. if(n.name == this.model1.userInfo.bankOfDeposit){
  156. a = true
  157. }
  158. })
  159. if(!a){
  160. this.model1.userInfo.bankOfDeposit = ''
  161. }
  162. }
  163. }
  164. }
  165. </script>
  166. <style scoped lang="scss">
  167. .line{
  168. background-color: #fff;
  169. padding: 5px 10px;
  170. margin-top: 10px;
  171. .celi{
  172. border-radius: 10px;
  173. margin: 10px 0;
  174. }
  175. }
  176. .submit{
  177. border-radius: 30px;
  178. background-color: #ED762F;
  179. color: #fff;
  180. margin: 10px;
  181. width: calc(100% - 20px);
  182. }
  183. </style>