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

collectionAdd.vue 8.9 KiB

3 年之前
3 年之前
3 年之前
2 年之前
2 年之前
3 年之前
3 年之前
2 年之前
3 年之前
3 年之前
2 年之前
2 年之前
2 年之前
3 年之前
3 年之前
3 年之前
2 年之前
3 年之前
3 年之前
3 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  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. import { isBankCard} from "@/utils/utils";
  121. export default {
  122. name: "collectionAdd",
  123. data() {
  124. return {
  125. showBankType:false,
  126. showBankDeposit:false,
  127. showPayeeType:false,
  128. form:{
  129. accountType:'1',
  130. status:'0'
  131. },
  132. bankType:'',
  133. payeeType:'',
  134. bankDeposit:'',
  135. bankTypeOptions:[],
  136. statusOptions:[],
  137. accountTypeOptions:[],
  138. payeeTypeOptions:[],
  139. bankDepositOptions:[],
  140. value:''
  141. };
  142. },
  143. created() {
  144. this.getDictionaries();
  145. },
  146. methods: {
  147. getDictionaries(){
  148. this.houseGetDicts("bank_type_all").then((res) => {
  149. for(var i = 0 ; i < res.data.length ; i++){
  150. this.bankTypeOptions.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
  151. }
  152. });
  153. this.houseGetDicts("sys_normal_disable").then((res) => {
  154. console.log(res)
  155. for(var i = 0 ; i < res.data.length ; i++){
  156. this.statusOptions.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
  157. }
  158. });
  159. this.houseGetDicts("bank_account_type").then((res) => {
  160. console.log(res)
  161. for(var i = 0 ; i < res.data.length ; i++){
  162. this.accountTypeOptions.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
  163. }
  164. });
  165. this.houseGetDicts("payee_type").then((res) => {
  166. for(var i = 0 ; i < res.data.length ; i++){
  167. this.payeeTypeOptions.push({text:res.data[i].dictLabel,value:res.data[i].dictValue});
  168. }
  169. });
  170. },
  171. changeInform(val){
  172. console.log(val)
  173. var that = this;
  174. var str = val;
  175. var numArr = str.match(/\d+/g)
  176. var nameArr = str.match(/[\u4e00-\u9fa5]/g)
  177. if(nameArr != null){
  178. nameArr = nameArr.join("")
  179. }
  180. if (numArr) {
  181. numArr.map(rr=>{
  182. if (rr.length>=16) {
  183. const carId = isBankCard(rr);
  184. if (carId) {
  185. that.form.payee = nameArr;
  186. that.form.payeeAccount = rr
  187. }
  188. }
  189. })
  190. }
  191. },
  192. getError(e){
  193. this.$notify({ type: 'danger', message: e.errors[0].message });
  194. },
  195. onConfirmBankType(data){
  196. this.bankType = data.text;
  197. this.form.bankType = data.value;
  198. this.bankDeposit = ""
  199. this.form.payeePaymentLines = ""
  200. this.showBankType = false;
  201. let queryParams={
  202. "bankType":this.form.bankType,
  203. "status": "0",
  204. }
  205. listDeposit(queryParams).then(response => {
  206. this.bankDepositOptions = []
  207. for(var i = 0 ; i < response.rows.length ; i++){
  208. this.bankDepositOptions.push({"text":response.rows[i].bankDeposit,"value":response.rows[i].id,
  209. "payeePaymentLines":response.rows[i].payeePaymentLines,"institutionNumber":response.rows[i].institutionNumber});
  210. }
  211. });
  212. },
  213. onConfirmBankDeposit(data){
  214. this.bankDeposit = data.text
  215. this.form.bankDeposit = data.text
  216. this.form.payeePaymentLines = data.payeePaymentLines
  217. this.form.alternateField10 = data.institutionNumber
  218. this.showBankDeposit = false;
  219. },
  220. onConfirmPayeeType(data){
  221. this.payeeType = data.text;
  222. this.form.payeeType = data.value;
  223. this.showPayeeType = false;
  224. },
  225. goAdd(){
  226. addPayee(this.form).then(response => {
  227. this.$toast.success('新增成功');
  228. setTimeout(function(){
  229. history.go(-1)
  230. },2000)
  231. });
  232. },
  233. goBack(){
  234. window.history.go(-1)
  235. }
  236. },
  237. }
  238. </script>
  239. <style scoped lang="scss">
  240. .app-container {
  241. padding: 2% 0;
  242. }
  243. .main_title{
  244. font-size: 0.4rem;
  245. color: #1D6FE9;
  246. margin: 0.2rem 6%;
  247. margin-top: 0;
  248. position: relative;
  249. }
  250. .main_box{
  251. width: 96%;
  252. margin: 0 auto;
  253. border-radius: 6px;
  254. box-shadow: 0px 3px 6px 0px rgba(0,0,0,0.16);
  255. overflow: hidden;
  256. background-color: #FFF;
  257. }
  258. .submitButton{
  259. width: 80%;
  260. margin: 0 auto;
  261. background-color: #1D6FE9;
  262. }
  263. .addFamily{
  264. position: absolute;
  265. top: -2px;
  266. right: 0;
  267. border-radius: 50%;
  268. }
  269. </style>