payBankBind.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <script>
  2. import api from '@/api'
  3. export default {
  4. data() {
  5. return {
  6. form: {
  7. phone: '',
  8. bank_card: '',
  9. name: '',
  10. id_card: ''
  11. },
  12. sign_url: '', // 签约 webview url
  13. popupShow: false,
  14. type: 1, // 1 储蓄卡 | 信用卡
  15. chuxuka: [], // 储蓄卡
  16. xinyongka: [] // 信用卡
  17. }
  18. },
  19. created() {
  20. this.getYlBindCanSignList()
  21. },
  22. methods: {
  23. validate() {
  24. if (!this.form.name) {
  25. this.$common.toast('请输入姓名')
  26. return
  27. } else if (!this.form.id_card) {
  28. this.$common.toast('请输入证件号')
  29. return
  30. } else if (!this.form.bank_card) {
  31. this.$common.toast('请输入卡号')
  32. return
  33. } else if (!this.form.phone) {
  34. this.$common.toast('请输入手机号')
  35. return
  36. }
  37. return true
  38. },
  39. async bind() {
  40. if (!this.validate()) return
  41. let res = await api.userToSignBank(this.form)
  42. this.sign_url = res.sign_url
  43. this.$refs.modal.show = true
  44. },
  45. async getYlBindCanSignList() {
  46. let res = await api.ylBindCanSignList()
  47. this.chuxuka = res.chuxuka
  48. this.xinyongka = res.xinyongka
  49. },
  50. jumpBrowser() {
  51. plus.runtime.openURL(this.sign_url)
  52. this.$refs.modal.show = false
  53. }
  54. }
  55. }
  56. </script>
  57. <template>
  58. <view class="page bg-white">
  59. <view class="flex flex-between" @click="popupShow = true">
  60. <view class="title">查看可支持的银行</view>
  61. <u-icon name="arrow-right"></u-icon>
  62. </view>
  63. <view class="item borderTop flex align-center">
  64. <view class="item-title">姓名</view>
  65. <input
  66. v-model="form.name"
  67. type="text"
  68. class="input"
  69. placeholder="请填写证件姓名"
  70. placeholder-style="color:#BDBDC0"
  71. />
  72. </view>
  73. <view class="item flex align-center">
  74. <view class="item-title">身份证号</view>
  75. <input
  76. v-model="form.id_card"
  77. type="text"
  78. class="input"
  79. placeholder="请输入证件号"
  80. placeholder-style="color:#BDBDC0"
  81. />
  82. </view>
  83. <view class="item flex align-center">
  84. <view class="item-title">银行卡号</view>
  85. <input
  86. type="text"
  87. v-model="form.bank_card"
  88. class="input"
  89. placeholder="请输入卡号"
  90. placeholder-style="color:#BDBDC0"
  91. />
  92. </view>
  93. <view class="item flex align-center">
  94. <view class="item-title">手机号</view>
  95. <input
  96. v-model="form.phone"
  97. type="text"
  98. class="input"
  99. placeholder="请输入手机号"
  100. placeholder-style="color:#BDBDC0"
  101. />
  102. </view>
  103. <u-button
  104. text="确定绑定"
  105. color="#F7C363"
  106. @click="bind"
  107. shape="circle"
  108. customStyle="width:650rpx;height:108rpx; position:fixed;bottom:100rpx;left:50%;transform:translate(-50%)"
  109. ></u-button>
  110. <u-popup :show="popupShow" @close="popupShow = false" round="40" customStyle="padding:52rpx 0">
  111. <view class="head flex align-center">
  112. <view class="title flex1" :class="{ active: type === 1 }" @click="type = 1"
  113. >储蓄银行卡</view
  114. >
  115. <view class="title flex1" :class="{ active: type === 2 }" @click="type = 2">信用卡</view>
  116. </view>
  117. <view class="popup-list">
  118. <view class="popup-item" v-for="(item, i) in type === 1 ? chuxuka : xinyongka" :key="i">
  119. {{ item }}
  120. </view>
  121. </view>
  122. </u-popup>
  123. <!-- <web-view v-if="sign_url != ''" :src="sign_url"></web-view> -->
  124. <!-- <u-button
  125. v-if="sign_url != ''"
  126. text="签约成功或取消请点击"
  127. @click="sign_url = ''"
  128. shape="circle"
  129. color="var(--theme)"
  130. customStyle="position: fixed; left:0;top:0;z-index:10999;height:108rpx"
  131. ></u-button> -->
  132. <custom-modal ref="modal" :showBtn="false">
  133. <u-text
  134. text="请在浏览器完成签约,签约成功后再返回app继续支付"
  135. size="30rpx"
  136. align="center"
  137. ></u-text>
  138. <u-button
  139. text="去签约"
  140. color="var(--theme)"
  141. shape="circle"
  142. customStyle="width:500rpx;margin:40rpx 0 0"
  143. @click="jumpBrowser"
  144. ></u-button>
  145. </custom-modal>
  146. </view>
  147. </template>
  148. <style lang="scss" scoped>
  149. .page {
  150. padding: 50rpx;
  151. .title {
  152. font-size: 30rpx;
  153. font-weight: 500;
  154. color: #232323;
  155. line-height: 32rpx;
  156. }
  157. .item {
  158. height: 120rpx;
  159. box-sizing: border-box;
  160. border-bottom: 1px solid #f0f0f0;
  161. .item-title {
  162. font-size: 30rpx;
  163. font-weight: 500;
  164. color: #232323;
  165. line-height: 32rpx;
  166. min-width: 200rpx;
  167. &:after {
  168. content: '*';
  169. color: #f76363;
  170. }
  171. }
  172. &.borderTop {
  173. border-top: 1px solid #f0f0f0;
  174. margin-top: 36rpx;
  175. }
  176. }
  177. }
  178. /deep/.u-fade-enter-active {
  179. z-index: 0 !important;
  180. }
  181. .head {
  182. height: 80rpx;
  183. .title {
  184. height: 80rpx;
  185. font-size: 32rpx;
  186. font-weight: 500;
  187. color: #232323;
  188. line-height: 36rpx;
  189. position: relative;
  190. text-align: center;
  191. &.active {
  192. font-weight: bold;
  193. &:after {
  194. content: '';
  195. display: block;
  196. width: 40rpx;
  197. height: 10rpx;
  198. background-color: #000;
  199. margin: 20rpx auto 0;
  200. }
  201. }
  202. }
  203. }
  204. .popup-list {
  205. height: 580rpx;
  206. overflow: auto;
  207. padding-left: 80rpx;
  208. .popup-item {
  209. height: 100rpx;
  210. line-height: 100rpx;
  211. font-size: 30rpx;
  212. font-weight: 500;
  213. color: #232323;
  214. }
  215. }
  216. </style>