card-comfirm.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  1. <template>
  2. <view class="container card clearfix">
  3. <view class="card-content">
  4. <view class="card-row">
  5. <view class="form-label">卡号</view>
  6. <view class="form-input">{{ params.cardNumber | formatAccNo }}</view>
  7. </view>
  8. <view class="card-row picker">
  9. <view class="form-label">卡类型</view>
  10. <view class="form-input">
  11. <picker @change="bindPicker($event)" :value="index" :range="stateActions" range-key="name">
  12. <input
  13. class="form-input"
  14. :class="cardTytpeText === '请选择卡类型' ? 'none' : ''"
  15. type="text"
  16. disabled="false"
  17. v-model="cardTytpeText"
  18. value=""
  19. placeholder="请选择"
  20. />
  21. </picker>
  22. </view>
  23. <view class="iconfont icon-xiayibu"></view>
  24. </view>
  25. <view class="card-row">
  26. <view class="form-label">姓名</view>
  27. <input
  28. class="form-input"
  29. type="number"
  30. name="input"
  31. v-model="params.name"
  32. placeholder="请输入您的姓名"
  33. maxlength="10"
  34. />
  35. </view>
  36. <view class="card-row">
  37. <view class="form-label">身份证</view>
  38. <input
  39. class="form-input"
  40. type="number"
  41. name="input"
  42. v-model="params.number"
  43. placeholder="请输入您的身份证号"
  44. maxlength="18"
  45. />
  46. </view>
  47. <view class="card-row">
  48. <view class="form-label">预留手机号</view>
  49. <input
  50. class="form-input"
  51. type="number"
  52. name="input"
  53. v-model="params.bindMobile"
  54. placeholder="请输入您的银行预留手机号"
  55. maxlength="11"
  56. />
  57. </view>
  58. <view class="card-row" v-if="params.type === 2">
  59. <view class="form-label">有效期</view>
  60. <input
  61. class="form-input"
  62. type="number"
  63. name="input"
  64. v-model="params.time"
  65. placeholder="请选择贷记卡有效期"
  66. maxlength="11"
  67. />
  68. </view>
  69. <view class="card-row" v-if="params.type === 2">
  70. <view class="form-label">CVV2</view>
  71. <input
  72. class="form-input"
  73. type="number"
  74. name="input"
  75. v-model="params.cvv"
  76. placeholder="请输入贷记卡背面的安全码"
  77. maxlength="3"
  78. />
  79. </view>
  80. <view class="card-mains-btn">
  81. <button class="add-btn" :disabled="disabled" :class="[disabled ? 'disabled' : '']" @click="handleAddCard">
  82. {{ subButtonText }}
  83. </button>
  84. </view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. export default {
  90. data() {
  91. return {
  92. params: {
  93. type:1,
  94. name:'',
  95. number:'',
  96. bindMobile:'',
  97. clubId: 0,
  98. time:'',
  99. cvv:'',
  100. cardNumber: '6228481456743154778'
  101. },
  102. showCardNumber: '',
  103. maxLen: 30,
  104. subType: 1 ,// 1直接绑卡 2//
  105. cardTytpeText:'请选择卡类型',
  106. subButtonText:'确认绑卡',
  107. stateActions: [
  108. { name: '借记卡', value: 1 },
  109. { name: '贷记卡', value: 2 },
  110. ]
  111. }
  112. },
  113. onLoad() {
  114. // this.GetAccountInitData()
  115. },
  116. filters: {
  117. formatAccNo(value) {
  118. const newValue = value.replace(/([^0-9])/g, '') // 只允许输入数字
  119. const formatValue = newValue.replace(/(\d{4})(?=\d)/g, '$1 ') // 每4个数字后面加一个空格
  120. return formatValue
  121. }
  122. },
  123. computed: {
  124. disabled() {
  125. if (this.params.cardNumber.length > 12) {
  126. return false
  127. } else {
  128. return true
  129. }
  130. }
  131. },
  132. methods: {
  133. handleAddCard() {
  134. //提交卡号
  135. },
  136. handleClearInput() {
  137. //清空银行卡
  138. this.params.cardNumber = this.showCardNumber = ''
  139. },
  140. handleInput(e) {
  141. this.params.cardNumber = e.detail.value
  142. this.showCardNumber = this.formatAccNo(e.detail.value)
  143. },
  144. handleGoSusList() {
  145. // 跳转支持银行
  146. this.$api.navigateTo(`/pages/user/pay/card-sus-list`)
  147. },
  148. bindPicker(e){//选择联系人身份
  149. this.cardTytpeText = this.stateActions[e.target.value].name
  150. this.params.type= this.stateActions[e.target.value].value
  151. },
  152. getOriginValue() {
  153. //获取input的原始值
  154. return this.showCardNumber.split(' ').join('')
  155. }
  156. },
  157. onShow() {
  158. // this.beansList = []
  159. }
  160. }
  161. </script>
  162. <style lang="scss">
  163. page,
  164. .container {
  165. background: #ffffff;
  166. height: 100%;
  167. }
  168. .card-content{
  169. width: 100%;
  170. height: auto;
  171. box-sizing: border-box;
  172. padding: 32rpx;
  173. .card-row{
  174. width: 100%;
  175. height: 100rpx;
  176. box-sizing: border-box;
  177. border-bottom: 1px solid #e1e1e1;
  178. position: relative;
  179. float: left;
  180. &.picker{
  181. padding-right: 60rpx;
  182. }
  183. .form-label {
  184. float: left;
  185. height: 100%;
  186. line-height: 98rpx;
  187. font-size: $font-size-28;
  188. text-align: left;
  189. color: #666666;
  190. }
  191. .form-input {
  192. min-width: 500rpx;
  193. height: 98rpx;
  194. line-height: 98rpx;
  195. font-size: $font-size-28;
  196. text-align: right;
  197. color: #333333;
  198. float: right;
  199. }
  200. .icon-xiayibu {
  201. width: 60rpx;
  202. height: 100rpx;
  203. position: absolute;
  204. right: 0;
  205. top: 0;
  206. line-height: 100rpx;
  207. text-align: center;
  208. color: #b2b2b2;
  209. }
  210. }
  211. .card-mains-btn {
  212. width: 100%;
  213. height: auto;
  214. box-sizing: border-box;
  215. padding: 0 43rpx;
  216. margin-top: 180rpx;
  217. float: left;
  218. .add-btn {
  219. width: 100%;
  220. height: 90rpx;
  221. font-size: $font-size-30;
  222. line-height: 90rpx;
  223. color: #ffffff;
  224. text-align: center;
  225. background: $btn-confirm;
  226. border-radius: 45rpx;
  227. border-radius: 44rpx;
  228. margin-top: 80rpx;
  229. &.disabled {
  230. background: #e1e1e1;
  231. border-radius: 44rpx;
  232. }
  233. }
  234. }
  235. }
  236. </style>