移动端
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.

bankOfDepositAdd.vue 7.9 KiB

2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <div class="app-container">
  3. <!-- <van-nav-bar-->
  4. <!-- left-arrow-->
  5. <!-- fixed-->
  6. <!-- placeholder-->
  7. <!-- @click-left="$router.back(-1)"-->
  8. <!-- >-->
  9. <!-- <template #title>-->
  10. <!-- <p style="font-weight: bold;">添加开户行</p>-->
  11. <!-- </template>-->
  12. <!-- </van-nav-bar>-->
  13. <div class="header_main">
  14. 添加开户行
  15. <div class="return_btn" @click="onClickLeft"></div>
  16. </div>
  17. <van-form @submit="goModify" @failed="getError" :show-error-message="false" scroll-to-error validate-first>
  18. <div class="main_box">
  19. <FieldCascadeSelect :required="true" :rules="[{ required: true , message:'请选择省市' }]" data-key="value" value-key="label" :columns="regionOptions" v-model="form.region" placeholder="请选择开户省市" label="开户省市" label-width="auto" @input="onRegionChanged"/>
  20. <FieldSelect
  21. label="所属银行"
  22. placeholder="请选择"
  23. v-model="form.bankType"
  24. label-width="auto"
  25. :required="true"
  26. :rules="[{ required: true , message:'请选择所属银行' }]"
  27. :columns="bankTypeOptions"
  28. data-key="dictValue"
  29. value-key="dictLabel"
  30. />
  31. <van-field label="开户行" required :rules="[{ required: true , message:'请输入开户行' }]" v-model="form.bankDeposit" placeholder="请输入开户行" input-align="right" label-width="auto">
  32. <template #button>
  33. <van-button :disabled="!canFetch" size="small" type="primary" native-type="button" @click="searchBankAddress">手动检索</van-button>
  34. </template>
  35. </van-field>
  36. <van-popup v-model:show="showBankAddress" position="bottom">
  37. <van-picker
  38. show-toolbar
  39. value-key="bankDeposit"
  40. :columns="bankAddressOption"
  41. @confirm="onConfirmBankAddress"
  42. @cancel="showBankAddress = false"
  43. />
  44. </van-popup>
  45. <van-field label="联行号" required :rules="[{ required: true , message:'请输入联行号' }]" v-model="form.payeePaymentLines" placeholder="请输入联行号" input-align="right" label-width="auto"/>
  46. <van-field label="上级清算行" v-model="form.clearingBank" input-align="right" label-width="auto" disabled/>
  47. <van-field label="机构号" v-model="form.institutionNumber" placeholder="请输入机构号" input-align="right" label-width="auto"/>
  48. </div>
  49. <div style="padding: 16px 0;">
  50. <van-row>
  51. <van-col span="24" align="center">
  52. <van-button type="info" native-type="submit" class="submitButton">保<i style="margin-right: 1em;"></i>存</van-button>
  53. </van-col>
  54. </van-row>
  55. <div class="clear"></div>
  56. </div>
  57. </van-form>
  58. </div>
  59. </template>
  60. <script>
  61. import { addDeposit } from "@/api/onlineHome/bankAgriculture/bankOfDeposit";
  62. import {options} from "@/api/user";
  63. import FieldCascadeSelect from "@/components/form/FieldCascadeSelect";
  64. import {listDeposit, realtimeBankList} from "@/api/onlineHome/bankAgriculture/paymentAccount";
  65. import FieldSelect from "@/components/form/FieldSelect";
  66. export default {
  67. name: "paymentAccountAdd",
  68. components: {FieldSelect, FieldCascadeSelect},
  69. data() {
  70. return {
  71. showBankType:false,
  72. bankType:'',
  73. // 所属银行字典
  74. bankTypeOptions: [],
  75. showBankAddress: false,
  76. bankAddressOption: [],
  77. form:{
  78. sheng: "", //省 必填
  79. shi: "", //市 必填
  80. bankType: "", //所属银行 必填
  81. bankDeposit: "", //开户行 必填
  82. payeePaymentLines: "", //联行号 //必填
  83. clearingBank: "", //上级清算行
  84. region: [],
  85. },
  86. };
  87. },
  88. created() {
  89. this.getDetail();
  90. },
  91. methods: {
  92. validator(val){
  93. return /^\d{6,}$/.test(val);
  94. },
  95. getDetail(){
  96. // 所属银行
  97. this.getDicts("bank_type_all").then(res => {
  98. this.bankTypeOptions = res.data;
  99. });
  100. },
  101. getError(e){
  102. this.$notify({ type: 'danger', message: e.errors[0].message });
  103. },
  104. onConfirmBankType(val){
  105. this.showBankType = false
  106. this.bankType = val.text
  107. this.$set(this.form, "bankType", val.value);
  108. },
  109. goModify(){
  110. console.log(this.form)
  111. this.form.balance = this.form.initialBalance;
  112. addDeposit(this.form).then((response) => {
  113. this.$toast.success('添加成功');
  114. setTimeout(function(){
  115. history.go(-1)
  116. },2000)
  117. });
  118. },
  119. goBack(){
  120. window.history.go(-1)
  121. },
  122. onRegionChanged(val) {
  123. val = val || [];
  124. this.form.sheng = val.length > 0 ? val[0] : null;
  125. this.form.shi = val.length > 1 ? val[1] : null;
  126. },
  127. onConfirmBankAddress(value){
  128. this.form.bankAddress = value.bankDeposit;
  129. this.form.payeePaymentLines = value.payeePaymentLines;
  130. this.form.clearingBank = data.clearingBank
  131. this.form.bankDeposit = value.bankDeposit;
  132. this.showBankAddress = false;
  133. },
  134. checkFormField(what, desc) {
  135. if(!this.form[what])
  136. {
  137. this.$toast({
  138. icon: 'fail',
  139. message: '请选择' + desc,
  140. duration:"1000",
  141. });
  142. return false;
  143. }
  144. return true;
  145. },
  146. searchBankAddress(){
  147. if(!this.checkFormField('sheng', '省')) return;
  148. if(!this.checkFormField('shi', '市')) return;
  149. if(!this.checkFormField('bankType', '所属银行')) return;
  150. if(!this.checkFormField('bankDeposit', '关键词')) return;
  151. let data = {
  152. sheng: this.form.sheng,
  153. shi: this.form.shi,
  154. bankType: this.form.bankType,
  155. bankDeposit: this.form.bankDeposit,
  156. }
  157. listDeposit(data).then(response => {
  158. if (response.rows.length<1){
  159. realtimeBankList(data, false).then(response2 => {
  160. this.bankAddressOption = response2.data;
  161. this.showBankAddress = true;
  162. });
  163. }else{
  164. this.bankAddressOption = response.rows;
  165. this.showBankAddress = true;
  166. }
  167. });
  168. },
  169. },
  170. computed: {
  171. regionOptions() {
  172. return options;
  173. },
  174. canFetch() {
  175. return this.form.sheng && this.form.shi && this.form.bankType && this.form.bankDeposit;
  176. },
  177. },
  178. }
  179. </script>
  180. <style scoped lang="scss">
  181. .app-container {
  182. padding-bottom: 2%;
  183. .header_main{
  184. height: 116px;
  185. background: url('../../../../assets/images/sunVillage_info/list_head.png') no-repeat;
  186. background-size: 100% 100%;
  187. position: fixed;
  188. top: 0;
  189. left: 0;
  190. width: 100%;
  191. font-size: 36px;
  192. line-height: 116px;
  193. text-align: center;
  194. color: #fff;
  195. position: relative;
  196. margin-bottom: 2%;
  197. .return_btn{
  198. width: 24px;
  199. height: 43.2px;
  200. background: url('../../../../assets/images/sunVillage_info/list_icon_5.png') center center no-repeat;
  201. background-size: 20px 36px;
  202. position: absolute;
  203. left: 38px;
  204. top: 36px;
  205. }
  206. .add_btn{
  207. width: 20PX;
  208. height: 20PX;
  209. background: url('../../../../../static/images/icon/icon_flow.png') center center no-repeat;
  210. background-size: 20PX 20PX;
  211. position: absolute;
  212. right: 38px;
  213. top: 36px;
  214. }
  215. }
  216. }
  217. .main_title{
  218. font-size: 0.4rem;
  219. color: #1D6FE9;
  220. margin: 0.2rem 6%;
  221. margin-top: 0;
  222. position: relative;
  223. }
  224. .main_box{
  225. width: 96%;
  226. margin: 0 auto;
  227. border-radius: 6px;
  228. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  229. overflow: hidden;
  230. background-color: #FFF;
  231. }
  232. .submitButton{
  233. width: 80%;
  234. margin: 0 auto;
  235. background-color: #1D6FE9;
  236. }
  237. .addFamily{
  238. position: absolute;
  239. top: -2px;
  240. right: 0;
  241. border-radius: 50%;
  242. }
  243. </style>