bank.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. <style lang="scss">
  2. .app-body{
  3. padding: 10px 0;
  4. .input-form {
  5. background: #fff;
  6. .item{
  7. padding: 35rpx 20rpx;
  8. border-bottom: 1px solid #f1f1f1;
  9. .label{
  10. width: 86px;
  11. font-weight: 400;
  12. color: #333;
  13. }
  14. .value{
  15. width: calc(100% - 86px);
  16. }
  17. }
  18. }
  19. }
  20. .input-placeholder {
  21. color: #999;
  22. }
  23. .sbtn{
  24. font-size: 14px;
  25. color: #DB292B;
  26. margin-right: 10rpx;
  27. }
  28. .no-sbtn{
  29. font-size: 14px;
  30. color: #999999;
  31. margin-right: 10rpx;
  32. }
  33. .foot{
  34. padding: 40rpx 60rpx;
  35. }
  36. .btn{
  37. background: #DB292B;
  38. border-radius: 60rpx;
  39. text-align: center;
  40. font-weight: bold;
  41. font-size: 28rpx;
  42. padding: 30rpx 0;
  43. color: #FAFAFA;
  44. }
  45. </style>
  46. <template>
  47. <view class="app-body">
  48. <view class="input-form">
  49. <view class="item fx-r fx-bc">
  50. <view class="label">姓名</view>
  51. <view class="value">
  52. <input type="text" v-model="form.name" placeholder-class="input-placeholder" placeholder="请输入真实姓名" />
  53. </view>
  54. </view>
  55. <view class="item fx-r fx-bc">
  56. <view class="label">银行卡号</view>
  57. <view class="value">
  58. <input type="number" v-model="form.payment" placeholder-class="input-placeholder" placeholder="请输入银行卡号" />
  59. </view>
  60. </view>
  61. <view class="item fx-r fx-bc">
  62. <view class="label">所属银行</view>
  63. <view class="value">
  64. <input type="text" v-model="form.bank_name" placeholder-class="input-placeholder" placeholder="请输入所属银行" />
  65. </view>
  66. </view>
  67. <view class="item fx-r fx-bc">
  68. <view class="label">所属支行</view>
  69. <view class="value">
  70. <input type="text" v-model="form.bank" placeholder-class="input-placeholder" placeholder="请输入所属支行" />
  71. </view>
  72. </view>
  73. <view class="item fx-r fx-bc">
  74. <view class="label">验证码</view>
  75. <view class="value fx-r ">
  76. <input type="number" v-model="form.verify" placeholder-class="input-placeholder" style="width: 186px;" placeholder="请输入验证码" />
  77. <view class="fx-g1"></view>
  78. <view v-if="verifyCount <= 0" class="sbtn" @tap="getVcode">验证码</view>
  79. <view v-else class="no-sbtn">{{ verifyCount }} S</view>
  80. </view>
  81. </view>
  82. </view>
  83. <view class="foot">
  84. <view class="btn ihover" @tap="tapSubmit">保存</view>
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import {mapState,mapMutations} from 'vuex';
  90. export default {
  91. computed: mapState(['user']),
  92. data() {
  93. return {
  94. form : {},
  95. verifyCount : 0,
  96. type : 3
  97. }
  98. },
  99. onLoad(options) {
  100. this.getData();
  101. },
  102. methods: {
  103. getData:function(e){
  104. uni.showLoading({ title: '获取数据中..' });
  105. var that = this;
  106. this
  107. .request
  108. .post("getBankItem",{type : this.type})
  109. .then(res => {
  110. uni.hideLoading();
  111. if(res.code == 200) {
  112. if(res.data != null) this.form = res.data;
  113. } else {
  114. that.utils.Tip(res.msg);
  115. }
  116. }).catch(res => {
  117. uni.hideLoading();
  118. that.utils.Tip(res.msg);
  119. });
  120. },
  121. getVcode: function() {
  122. if (this.verifyCount > 0) return;
  123. uni.showLoading({ title: "获取中..."});
  124. this
  125. .request
  126. .post("userYzm",{type : "bank"})
  127. .then(res => {
  128. uni.hideLoading();
  129. if (res.code == 200) {
  130. if (res.data.status == 2) {
  131. this.utils.CountDowm(res.data.time, (e, s) => {
  132. this.verifyCount = e;
  133. });
  134. }
  135. if (res.data.status == 1) {
  136. this.utils.CountDowm(120, (e, s) => {
  137. this.verifyCount = e;
  138. });
  139. }
  140. } else {
  141. uni.showToast({
  142. title: res.msg,
  143. mask: true,
  144. icon: 'none'
  145. });
  146. }
  147. })
  148. .catch(err => {
  149. uni.showToast({
  150. title: '获取失败',
  151. mask: true,
  152. icon: 'none'
  153. });
  154. uni.hideLoading();
  155. });
  156. },
  157. tapSubmit:function(e){
  158. if(this.form.name == ""){
  159. uni.showToast({
  160. title:"请输入真实姓名",icon:"none",mask:true
  161. })
  162. return;
  163. }
  164. if(this.form.payment == ""){
  165. uni.showToast({
  166. title:"请输入银行卡号",icon:"none",mask:true
  167. })
  168. return;
  169. }
  170. if(this.form.bank == ""){
  171. uni.showToast({
  172. title:"请输入卡归属银行",icon:"none",mask:true
  173. })
  174. return;
  175. }
  176. if (this.form.verify == '') {
  177. uni.showToast({
  178. title: '请输入验证码',
  179. mask: true,
  180. icon: 'none'
  181. });
  182. return;
  183. }
  184. uni.showLoading({ title: '提交数据中..' });
  185. this.request
  186. .post("bankSave",{
  187. ...this.form,
  188. type : this.type
  189. })
  190. .then(res=>{
  191. uni.hideLoading();
  192. if(res.code == 200) {
  193. uni.navigateBack();
  194. } else {
  195. uni.showToast({ title:res.msg,icon:"none",mask:true});
  196. }
  197. })
  198. .catch(res=>{
  199. uni.hideLoading();
  200. uni.showModal({title: '系统提示',content: '加载失败,重新点击尝试!',showCancel: false});
  201. });
  202. }
  203. }
  204. }
  205. </script>