|
@@ -2,16 +2,31 @@
|
|
|
<div>
|
|
|
<div v-for="(item, index) in list" :key="index">
|
|
|
<el-row>
|
|
|
- <el-col :span="20"> <containerTitle title="账单"></containerTitle></el-col>
|
|
|
- <el-col :span="4"><span class="delete_group" v-if="list.length !== 1" @click="deleteGroup(index)">删除组</span></el-col>
|
|
|
+ <el-col :span="24"><span class="delete_group" v-if="list.length !== 1" @click="deleteGroup(index)">删除组</span></el-col>
|
|
|
</el-row>
|
|
|
<basic-container>
|
|
|
<avue-form :option="option" ref="form" v-model="item.form">
|
|
|
<template slot-scope="scope" slot="corpId">
|
|
|
<selectComponent v-model="corpId" :configuration="configuration"/>
|
|
|
</template>
|
|
|
+ <template slot-scope="scope" slot="price">
|
|
|
+ <el-input
|
|
|
+ v-model="item.form.price"
|
|
|
+ autocomplete="off"
|
|
|
+ placeholder="请输入 单价"
|
|
|
+ @input="calculate(item.form)"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
+ <template slot-scope="scope" slot="quantity">
|
|
|
+ <el-input
|
|
|
+ v-model="item.form.quantity"
|
|
|
+ autocomplete="off"
|
|
|
+ placeholder="请输入 数量"
|
|
|
+ @input="calculate(item.form)"
|
|
|
+ ></el-input>
|
|
|
+ </template>
|
|
|
<template slot-scope="scope" slot="currency">
|
|
|
- <el-select v-model="item.form.currency" size="small" placeholder="请选择" clearable filterable>
|
|
|
+ <el-select v-model="item.form.currency" size="small" placeholder="请选择 币别" @change="currencyChange(item.form)" clearable filterable>
|
|
|
<el-option v-for="(item,index) in currencyDic" :key="index" :label="item.dictValue" :value="item.dictValue"></el-option>
|
|
|
</el-select>
|
|
|
</template>
|
|
@@ -30,6 +45,7 @@
|
|
|
|
|
|
<script>
|
|
|
import { applyLoan,paymentApply } from "@/api/financialManagement/paymentRequest";
|
|
|
+ import _ from "lodash";
|
|
|
|
|
|
export default {
|
|
|
name: "applyPayment",
|
|
@@ -55,7 +71,7 @@
|
|
|
configuration:{
|
|
|
multipleChoices:false,
|
|
|
multiple:false,
|
|
|
- disabled:false,
|
|
|
+ disabled:true,
|
|
|
searchShow:true,
|
|
|
collapseTags:false,
|
|
|
placeholder:'请点击右边按钮选择',
|
|
@@ -70,34 +86,79 @@
|
|
|
{
|
|
|
label: '合同号',
|
|
|
prop: 'srcOrderno',
|
|
|
- span: 12,
|
|
|
+ span: 8,
|
|
|
disabled:true,
|
|
|
- },
|
|
|
- {
|
|
|
- label: '合同日期',
|
|
|
- type:"date",
|
|
|
- prop: 'accDate',
|
|
|
- span: 12,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
label: '客户名称',
|
|
|
prop: 'corpId',
|
|
|
- span: 12,
|
|
|
+ span: 16,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '提单号',
|
|
|
+ prop: 'accDate',
|
|
|
+ span: 8,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
label: '费用名称',
|
|
|
prop: 'costType',
|
|
|
- span: 12,
|
|
|
+ span: 8,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
+ },
|
|
|
+ {
|
|
|
+ label: '合同日期',
|
|
|
+ type:"date",
|
|
|
+ prop: 'accDate',
|
|
|
+ span: 8,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
label: '单价',
|
|
|
prop: 'price',
|
|
|
- span: 12,
|
|
|
+ span: 8,
|
|
|
rules: [
|
|
|
{
|
|
|
pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
|
|
|
message: ' ',
|
|
|
trigger: 'blur'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
@@ -105,46 +166,97 @@
|
|
|
label: '数量',
|
|
|
prop: 'quantity',
|
|
|
value:1,
|
|
|
- span: 12,
|
|
|
+ span: 8,
|
|
|
rules: [
|
|
|
{
|
|
|
pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
|
|
|
message: ' ',
|
|
|
trigger: 'blur'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
label: '金额',
|
|
|
prop: 'amount',
|
|
|
- span: 12,
|
|
|
+ span: 8,
|
|
|
rules: [
|
|
|
{
|
|
|
pattern: /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/,
|
|
|
message: ' ',
|
|
|
trigger: 'blur'
|
|
|
+ },
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
}
|
|
|
]
|
|
|
},
|
|
|
{
|
|
|
label: '计价单位',
|
|
|
prop: 'unit',
|
|
|
- span: 12,
|
|
|
+ type:"select",
|
|
|
+ span: 8,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=unit",
|
|
|
+ props: {
|
|
|
+ label: "dictValue",
|
|
|
+ value: "dictKey"
|
|
|
+ }
|
|
|
},
|
|
|
{
|
|
|
label: '币别',
|
|
|
prop: 'currency',
|
|
|
- span: 12,
|
|
|
+ span: 8,
|
|
|
+ type:"select",
|
|
|
+ dicUrl: "/api/blade-system/dict-biz/dictionary?code=currency",
|
|
|
+ props: {
|
|
|
+ label: "dictValue",
|
|
|
+ value: "dictKey"
|
|
|
+ },
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
label: '汇率',
|
|
|
prop: 'exchangeRate',
|
|
|
- span: 12,
|
|
|
+ disabled:true,
|
|
|
+ span: 8,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
label: '税率',
|
|
|
prop: 'taxRate',
|
|
|
- span: 12,
|
|
|
+ span: 8,
|
|
|
+ rules: [
|
|
|
+ {
|
|
|
+ required: true,
|
|
|
+ message: ' ',
|
|
|
+ trigger: 'blur'
|
|
|
+ }
|
|
|
+ ]
|
|
|
},
|
|
|
{
|
|
|
label: '备注',
|
|
@@ -165,6 +277,8 @@
|
|
|
this.currencyDic = res.data.data
|
|
|
})
|
|
|
this.form.form = this.billData
|
|
|
+ this.corpId = this.billData.corpId
|
|
|
+ this.configuration.dicData = this.billData.corpsName
|
|
|
this.addForm();
|
|
|
},
|
|
|
methods:{
|
|
@@ -175,27 +289,83 @@
|
|
|
deleteGroup(index){
|
|
|
this.list.splice(index, 1);
|
|
|
},
|
|
|
- submit(){
|
|
|
- const itemsList = this.list.map(item =>{ item.form.corpId = this.corpId; return item.form})
|
|
|
- const params = {
|
|
|
- billType : this.billType,
|
|
|
- itemsList: itemsList
|
|
|
+ //计算单价 数量
|
|
|
+ calculate(valueForm){
|
|
|
+ if(valueForm.price && valueForm.quantity){
|
|
|
+ valueForm.amount = _.multiply(valueForm.price, valueForm.quantity).toFixed(2);
|
|
|
}
|
|
|
- if(this.billType === "销售"){ //销售订单 => 账单明细
|
|
|
- paymentApply(params).then(res=>{
|
|
|
- if(res.data.success){
|
|
|
- this.$message.success("操作成功!")
|
|
|
- this.$emit("choceFun");
|
|
|
- }
|
|
|
- })
|
|
|
- }else{ //采购订单 => 付款申请
|
|
|
- applyLoan(params).then(res =>{
|
|
|
- if(res.data.success){
|
|
|
- this.$message.success("操作成功!")
|
|
|
- this.$emit("choceFun");
|
|
|
- }
|
|
|
- })
|
|
|
+ },
|
|
|
+ //币别选择
|
|
|
+ currencyChange(valueForm){
|
|
|
+ if(valueForm.currency === "USD"){
|
|
|
+ valueForm.exchangeRate = 6.3686;
|
|
|
+ }else{
|
|
|
+ valueForm.exchangeRate = 1;
|
|
|
}
|
|
|
+ },
|
|
|
+ async submit(){
|
|
|
+ let result = [];
|
|
|
+ await this.handleRulesValid(["form"],result)
|
|
|
+ if (result.some(item => item)) {
|
|
|
+ const itemsList = this.list.map(item =>{ item.form.corpId = this.corpId; return item.form})
|
|
|
+ const params = {
|
|
|
+ billType : this.billType,
|
|
|
+ itemsList: itemsList
|
|
|
+ }
|
|
|
+ if(this.billType === "销售"){ //销售订单 => 账单明细
|
|
|
+ paymentApply(params).then(res=>{
|
|
|
+ if(res.data.success){
|
|
|
+ this.$message.success("操作成功!")
|
|
|
+ this.$emit("choceFun");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else{ //采购订单 => 付款申请
|
|
|
+ applyLoan(params).then(res =>{
|
|
|
+ if(res.data.success){
|
|
|
+ this.$message.success("操作成功!")
|
|
|
+ this.$emit("choceFun");
|
|
|
+ //跳转付款申请页面
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @param instance 实例
|
|
|
+ * @param result 校验结果数组
|
|
|
+ * 递归校验每个表格实例
|
|
|
+ */
|
|
|
+ handleValid(instance,result) {
|
|
|
+ if(!instance) {
|
|
|
+ result.push(true)
|
|
|
+ }else if(Array.isArray(instance)) {
|
|
|
+ instance.map(item => this.handleValid(item,result))
|
|
|
+ }else{
|
|
|
+ if(instance.validate) {
|
|
|
+ instance.validate(valid => {
|
|
|
+ result.push(valid)
|
|
|
+ instance.hide && instance.hide()
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ instance.validateCellForm().then(msg=>{
|
|
|
+ if((msg && !Object.keys(msg).length) || undefined === msg){
|
|
|
+ result.push(true)
|
|
|
+ }else{
|
|
|
+ result.push(false)
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ },
|
|
|
+ /**
|
|
|
+ * @param resultArr 校验结果数组
|
|
|
+ * 统一校验方法
|
|
|
+ */
|
|
|
+ handleRulesValid(refsList,resultArr) {
|
|
|
+ refsList.map(item => this.handleValid(this.$refs[`${item}`],resultArr))
|
|
|
}
|
|
|
}
|
|
|
}
|