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

collectionApprovalAdd.vue 9.1 KiB

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