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

277 rivejä
8.9 KiB

  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="main_box" style="margin-bottom: 10px;">
  14. <van-field v-model="value" placeholder="粘贴信息,自动拆分收款方、收款账号" @input="changeInform" />
  15. </div>
  16. <van-form @submit="goAdd" @failed="getError" :show-error-message="false" scroll-to-error validate-first>
  17. <p class="main_title">基础信息</p>
  18. <div class="main_box">
  19. <van-field label="收款方" required :rules="[{ required: true , message:'请输入收款方' }]" v-model="form.payee" placeholder="请输入收款方" input-align="right" label-width="auto"/>
  20. <van-field label="收款账户" required :rules="[{ required: true , message:'请输入收款账户' }]" v-model="form.payeeAccount" placeholder="请输入收款账户" input-align="right" label-width="auto"/>
  21. <van-field
  22. readonly
  23. clickable
  24. label="所属银行"
  25. placeholder="请选择"
  26. v-model="bankType"
  27. @click="showBankType = true"
  28. input-align="right"
  29. right-icon="arrow-down"
  30. label-width="auto"
  31. required
  32. :rules="[{ required: true , message:'请选择所属银行' }]"
  33. />
  34. <van-popup v-model="showBankType" position="bottom">
  35. <van-picker
  36. show-toolbar
  37. :columns="bankTypeOptions"
  38. @confirm="onConfirmBankType"
  39. @cancel="showBankType = false"
  40. />
  41. </van-popup>
  42. <van-field
  43. readonly
  44. clickable
  45. label="开户银行"
  46. placeholder="请选择"
  47. @click="showBankDeposit = true"
  48. v-model="bankDeposit"
  49. input-align="right"
  50. right-icon="arrow-down"
  51. label-width="auto"
  52. required
  53. :rules="[{ required: true , message:'请选择开户银行' }]"
  54. />
  55. <van-popup v-model="showBankDeposit" position="bottom">
  56. <van-picker
  57. show-toolbar
  58. :columns="bankDepositOptions"
  59. @confirm="onConfirmBankDeposit"
  60. @cancel="showBankDeposit = false"
  61. />
  62. </van-popup>
  63. <van-field label="联行号" readonly required :rules="[{ required: true , message:'请输入联行号' }]" v-model="form.payeePaymentLines" input-align="right" label-width="auto"/>
  64. </div>
  65. <div class="main_box" style="margin-top: 10px;">
  66. <van-field label="备注" v-model="form.remark" type="textarea" placeholder="请输入备注" input-align="right" rows="3" label-width="auto"/>
  67. </div>
  68. <div class="main_box" style="margin-top: 10px;">
  69. <van-cell title="账户类型" required>
  70. <template #right-icon>
  71. <van-radio-group direction="horizontal" required :rules="[{ required: true , message:'请选择账户类型' }]" v-model="form.accountType">
  72. <van-radio name="1">公户</van-radio>
  73. <van-radio name="2">私户</van-radio>
  74. </van-radio-group>
  75. </template>
  76. </van-cell>
  77. <van-field
  78. readonly
  79. clickable
  80. label="收款人类型"
  81. placeholder="请选择"
  82. v-model="payeeType"
  83. @click="showPayeeType = true"
  84. input-align="right"
  85. right-icon="arrow-down"
  86. label-width="auto"
  87. required
  88. :rules="[{ required: true , message:'请选择收款人类型' }]"
  89. />
  90. <van-popup v-model="showPayeeType" position="bottom">
  91. <van-picker
  92. show-toolbar
  93. :columns="payeeTypeOptions"
  94. @confirm="onConfirmPayeeType"
  95. @cancel="showPayeeType = false"
  96. />
  97. </van-popup>
  98. <van-cell title="数据状态" required>
  99. <template #right-icon>
  100. <van-radio-group direction="horizontal" required :rules="[{ required: true , message:'请选择数据状态' }]" v-model="form.status">
  101. <van-radio name="0">正常</van-radio>
  102. <van-radio name="1">停用</van-radio>
  103. </van-radio-group>
  104. </template>
  105. </van-cell>
  106. </div>
  107. <div style="padding: 16px 0;">
  108. <van-row>
  109. <van-col span="24" align="center">
  110. <van-button type="info" native-type="submit" class="submitButton">保<i style="margin-right: 1em;"></i>存</van-button>
  111. </van-col>
  112. </van-row>
  113. <div class="clear"></div>
  114. </div>
  115. </van-form>
  116. </div>
  117. </template>
  118. <script>
  119. import { addPayee,listDeposit } from "@/api/onlineHome/bankAgriculture/collectionAccount";
  120. export default {
  121. name: "collectionAdd",
  122. data() {
  123. return {
  124. showBankType:false,
  125. showBankDeposit:false,
  126. showPayeeType:false,
  127. form:{
  128. accountType:'1',
  129. status:'0'
  130. },
  131. bankType:'',
  132. payeeType:'',
  133. bankDeposit:'',
  134. bankTypeOptions:[],
  135. statusOptions:[],
  136. accountTypeOptions:[],
  137. payeeTypeOptions:[],
  138. bankDepositOptions:[],
  139. value:''
  140. };
  141. },
  142. created() {
  143. this.getDictionaries();
  144. },
  145. methods: {
  146. getDictionaries(){
  147. this.houseGetDicts("bank_type_all").then((res) => {
  148. for(var i = 0 ; i < res.data.length ; i++){
  149. this.bankTypeOptions.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
  150. }
  151. });
  152. this.houseGetDicts("sys_normal_disable").then((res) => {
  153. console.log(res)
  154. for(var i = 0 ; i < res.data.length ; i++){
  155. this.statusOptions.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
  156. }
  157. });
  158. this.houseGetDicts("bank_account_type").then((res) => {
  159. console.log(res)
  160. for(var i = 0 ; i < res.data.length ; i++){
  161. this.accountTypeOptions.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
  162. }
  163. });
  164. this.houseGetDicts("payee_type").then((res) => {
  165. for(var i = 0 ; i < res.data.length ; i++){
  166. this.payeeTypeOptions.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
  167. }
  168. });
  169. },
  170. changeInform(val){
  171. console.log(val)
  172. var that = this;
  173. var str = val;
  174. var numArr = str.match(/\d+/g)
  175. var nameArr = str.match(/[\u4e00-\u9fa5]/g).join("")
  176. console.log(numArr)
  177. console.log(nameArr)
  178. if (numArr) {
  179. numArr.map(rr=>{
  180. if (rr.length>16) {
  181. const carId = this.isBankCard(rr);
  182. if (carId) {
  183. that.form.payee = nameArr;
  184. that.form.payeeAccount = rr
  185. }
  186. }
  187. })
  188. }
  189. },
  190. getError(e){
  191. this.$notify({ type: 'danger', message: e.errors[0].message });
  192. },
  193. onConfirmBankType(data){
  194. this.bankType = data.text;
  195. this.form.bankType = data.value;
  196. this.bankDeposit = ""
  197. this.form.payeePaymentLines = ""
  198. this.showBankType = false;
  199. let queryParams={
  200. "bankType":this.form.bankType,
  201. "status": "0",
  202. }
  203. listDeposit(queryParams).then(response => {
  204. this.bankDepositOptions = []
  205. for(var i = 0 ; i < response.rows.length ; i++){
  206. this.bankDepositOptions.push({"text":response.rows[i].bankDeposit,"value":response.rows[i].id,
  207. "payeePaymentLines":response.rows[i].payeePaymentLines,"institutionNumber":response.rows[i].institutionNumber});
  208. }
  209. });
  210. },
  211. onConfirmBankDeposit(data){
  212. this.bankDeposit = data.text
  213. this.form.bankDeposit = data.text
  214. this.form.payeePaymentLines = data.payeePaymentLines
  215. this.form.alternateField10 = data.institutionNumber
  216. this.showBankDeposit = false;
  217. },
  218. onConfirmPayeeType(data){
  219. this.payeeType = data.text;
  220. this.form.payeeType = data.value;
  221. this.showPayeeType = false;
  222. },
  223. goAdd(){
  224. addPayee(this.form).then(response => {
  225. this.$toast.success('新增成功');
  226. setTimeout(function(){
  227. history.go(-1)
  228. },2000)
  229. });
  230. },
  231. goBack(){
  232. window.history.go(-1)
  233. }
  234. },
  235. }
  236. </script>
  237. <style scoped lang="scss">
  238. .app-container {
  239. padding: 2% 0;
  240. }
  241. .main_title{
  242. font-size: 0.4rem;
  243. color: #1D6FE9;
  244. margin: 0.2rem 6%;
  245. margin-top: 0;
  246. position: relative;
  247. }
  248. .main_box{
  249. width: 96%;
  250. margin: 0 auto;
  251. border-radius: 6px;
  252. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  253. overflow: hidden;
  254. background-color: #FFF;
  255. }
  256. .submitButton{
  257. width: 80%;
  258. margin: 0 auto;
  259. background-color: #1D6FE9;
  260. }
  261. .addFamily{
  262. position: absolute;
  263. top: -2px;
  264. right: 0;
  265. border-radius: 50%;
  266. }
  267. </style>