|
|
@@ -1,52 +1,23 @@
|
|
|
<template>
|
|
|
<div>
|
|
|
<el-button size="mini" type="text" @click="editBtn">编 辑</el-button>
|
|
|
- <el-dialog title="编辑收款条件" append-to-body :visible.sync="dialogFormVisible" width="40%" @close="dialogFormVisible = false;$refs.form.resetFields();$emit('onSuccess');isErrorInvoiceapply=false;isErrorLogistics=false;isErrorOrder=false">
|
|
|
+ <el-dialog title="编辑收款条件" append-to-body :visible.sync="dialogFormVisible" width="800px" @close="onClose">
|
|
|
<el-row :gutter="20">
|
|
|
<el-form :model="form" :rules="rules" ref="form" label-width="140px" label-position="right" size="mini">
|
|
|
<el-col :span="24">
|
|
|
<el-form-item label="立账节点" prop="accountingnodes">
|
|
|
- <div>
|
|
|
- <div style="float: left;margin-bottom: 10px">
|
|
|
- <el-checkbox v-model="form.accountingnodes.ordercheck.isused" true-label="1" false-label="0">订单审核</el-checkbox>
|
|
|
- <span style="margin-left: 50px">后置天数:</span>
|
|
|
- <el-input type="number" style="width: 100px" v-model="form.accountingnodes.ordercheck.days" placeholder="请输入" ></el-input>
|
|
|
- <span style="margin-left: 5px">天</span>
|
|
|
- <span style="margin-left: 50px">立账额度:</span>
|
|
|
+ <div style="max-height: 450px;overflow: auto">
|
|
|
+ <div>
|
|
|
+ <el-checkbox v-model="auditIsUsed" true-label="1" false-label="0" @change="isUsedChange('审核')">订单审核</el-checkbox>
|
|
|
+ <setInfo ref="audit" :isUsed="auditIsUsed"></setInfo>
|
|
|
</div>
|
|
|
- <div style="float: left;margin-bottom: 10px">
|
|
|
- <el-input type="number" style="width: 100px" v-model="form.accountingnodes.ordercheck.amountrate" placeholder="请输入" :class="{ 'is-error': isErrorOrder }" @change="checkAmountrate(form.accountingnodes.ordercheck.amountrate,'订单审核')"></el-input>
|
|
|
- <span style="margin-left: 5px">%</span>
|
|
|
- <p v-if="isErrorOrder" style="color: red;font-size: 12px">立账额度范围(0-100)</p>
|
|
|
+ <div>
|
|
|
+ <el-checkbox v-model="shipmentIsUsed" true-label="1" false-label="0" @change="isUsedChange('出货')">订单出货</el-checkbox>
|
|
|
+ <setInfo ref="shipment" :isUsed="shipmentIsUsed"></setInfo>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <div style="float: left;margin-bottom: 10px">
|
|
|
- <el-checkbox v-model="form.accountingnodes.logisticscheck.isused" true-label="1" false-label="0">订单出货</el-checkbox>
|
|
|
- <span style="margin-left: 50px">后置天数:</span>
|
|
|
- <el-input type="number" style="width: 100px" v-model="form.accountingnodes.logisticscheck.days" placeholder="请输入"></el-input>
|
|
|
- <span style="margin-left: 5px">天</span>
|
|
|
- <span style="margin-left: 50px">立账额度:</span>
|
|
|
- </div>
|
|
|
- <div style="float: left;margin-bottom: 10px">
|
|
|
- <el-input type="number" style="width: 100px" v-model="form.accountingnodes.logisticscheck.amountrate" placeholder="请输入" :class="{ 'is-error': isErrorLogistics }" @change="checkAmountrate(form.accountingnodes.logisticscheck.amountrate,'订单出货')"></el-input>
|
|
|
- <span style="margin-left: 5px">%</span>
|
|
|
- <p v-if="isErrorLogistics" style="color: red;font-size: 12px">立账额度范围(0-100)</p>
|
|
|
- </div>
|
|
|
-
|
|
|
- </div>
|
|
|
- <div>
|
|
|
- <div style="float: left">
|
|
|
- <el-checkbox v-model="form.accountingnodes.invoiceapplycheck.isused" true-label="1" false-label="0">订单开票</el-checkbox>
|
|
|
- <span style="margin-left: 50px">后置天数:</span>
|
|
|
- <el-input type="number" style="width: 100px" v-model="form.accountingnodes.invoiceapplycheck.days" placeholder="请输入"></el-input>
|
|
|
- <span style="margin-left: 5px">天</span>
|
|
|
- <span style="margin-left: 50px">立账额度:</span>
|
|
|
- </div>
|
|
|
- <div style="float: left">
|
|
|
- <el-input type="number" style="width: 100px" v-model="form.accountingnodes.invoiceapplycheck.amountrate" placeholder="请输入" :class="{ 'is-error': isErrorInvoiceapply }" @change="checkAmountrate(form.accountingnodes.invoiceapplycheck.amountrate,'订单开票')"></el-input>
|
|
|
- <span style="margin-left: 5px">%</span>
|
|
|
- <p v-if="isErrorInvoiceapply" style="color: red;font-size: 12px">立账额度范围(0-100)</p>
|
|
|
+ <div>
|
|
|
+ <el-checkbox v-model="invoiceIsUsed" true-label="1" false-label="0" @change="isUsedChange('开票')">订单开票</el-checkbox>
|
|
|
+ <setInfo ref="invoice" :isUsed="invoiceIsUsed"></setInfo>
|
|
|
</div>
|
|
|
</div>
|
|
|
</el-form-item>
|
|
|
@@ -64,17 +35,19 @@
|
|
|
</el-form>
|
|
|
</el-row>
|
|
|
<div class="dialog-footer">
|
|
|
- <el-button size="small" @click="dialogFormVisible = false;$refs.form.resetFields();$emit('onSuccess');isErrorInvoiceapply=false;isErrorLogistics=false;isErrorOrder=false" class="normal-btn-width">取 消</el-button>
|
|
|
- <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">确 定</el-button>
|
|
|
+ <el-button size="small" @click="onClose" class="normal-btn-width">取 消</el-button>
|
|
|
+ <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width" :disabled="auditIsUsed == '0' && shipmentIsUsed == '0' && invoiceIsUsed == '0' && form.remarks == ''">确 定</el-button>
|
|
|
</div>
|
|
|
</el-dialog>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import setInfo from "@/HDrpManagement/collectionRule/components/setInfo";
|
|
|
export default {
|
|
|
name: "edit",
|
|
|
props:['data'],
|
|
|
+ components:{setInfo},
|
|
|
data(){
|
|
|
var NumberSize = (rule, value, callback) => {
|
|
|
if (+value >= 0 && +value <= 100) {
|
|
|
@@ -85,30 +58,16 @@ export default {
|
|
|
}
|
|
|
return {
|
|
|
dialogFormVisible:false,
|
|
|
+ auditIsUsed:0,
|
|
|
+ shipmentIsUsed:0,
|
|
|
+ invoiceIsUsed:0,
|
|
|
+ auditList:[],
|
|
|
+ shipmentList:[],
|
|
|
+ invoiceList:[],
|
|
|
form:{
|
|
|
"sa_receivableruleid":0,
|
|
|
- "days":"10",
|
|
|
- "amountrate":'',
|
|
|
- "point":"",
|
|
|
"remarks":"",
|
|
|
- "isdefault":1,
|
|
|
- "accountingnodes": {
|
|
|
- "ordercheck": {//订单审核
|
|
|
- "days": "",//后置天数
|
|
|
- "amountrate": "",//立账额度
|
|
|
- "isused": "0"//是否勾选
|
|
|
- },
|
|
|
- "logisticscheck": {//订单出货
|
|
|
- "days": "",
|
|
|
- "amountrate": "",
|
|
|
- "isused": "0"
|
|
|
- },
|
|
|
- "invoiceapplycheck": {//订单开票
|
|
|
- "days": "",
|
|
|
- "amountrate": "",
|
|
|
- "isused": "0"
|
|
|
- }
|
|
|
- }
|
|
|
+ "isdefault":1
|
|
|
},
|
|
|
rules:{
|
|
|
point:[
|
|
|
@@ -128,25 +87,32 @@ export default {
|
|
|
{ required: false, message: '请输入描述', trigger: 'blur'}
|
|
|
],
|
|
|
},
|
|
|
- isErrorOrder: false,
|
|
|
- isErrorLogistics:false,
|
|
|
- isErrorInvoiceapply:false
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
editBtn () {
|
|
|
this.dialogFormVisible = true
|
|
|
this.form = Object.assign({},this.form,this.data)
|
|
|
- console.log(this.form,'form1')
|
|
|
- if (this.form.accountingnodes){
|
|
|
- /* this.form.accountingnodes.ordercheck.amountrate = Math.round((this.form.accountingnodes.ordercheck.amountrate*100)*100)/100
|
|
|
- this.form.accountingnodes.logisticscheck.amountrate = Math.round((this.form.accountingnodes.logisticscheck.amountrate*100)*100)/100
|
|
|
- this.form.accountingnodes.invoiceapplycheck.amountrate = Math.round((this.form.accountingnodes.invoiceapplycheck.amountrate*100)*100)/100*/
|
|
|
- }else {
|
|
|
- this.form.accountingnodes.ordercheck.amountrate = ''
|
|
|
- this.form.accountingnodes.logisticscheck.amountrate = ''
|
|
|
- this.form.accountingnodes.invoiceapplycheck.amountrate = ''
|
|
|
- }
|
|
|
+ this.auditList = this.data.accountingnodes.ordercheck
|
|
|
+ this.shipmentList = this.data.accountingnodes.logisticscheck
|
|
|
+ this.invoiceList = this.data.accountingnodes.invoiceapplycheck
|
|
|
+ this.auditIsUsed = this.auditList?this.auditList.length>0?this.auditList[0].isused:'0':'0'
|
|
|
+ this.shipmentIsUsed = this.shipmentList?this.shipmentList.length>0?this.shipmentList[0].isused:'0':'0'
|
|
|
+ this.invoiceIsUsed = this.invoiceList?this.invoiceList.length>0?this.invoiceList[0].isused:'0':'0'
|
|
|
+ this.$nextTick(()=>{
|
|
|
+ this.auditList.forEach(item=>{
|
|
|
+ item.amountrate = Math.round((item.amountrate * 100)*100)/100
|
|
|
+ })
|
|
|
+ this.$refs.audit.list = this.auditList
|
|
|
+ this.shipmentList.forEach(item=>{
|
|
|
+ item.amountrate = Math.round((item.amountrate * 100)*100)/100
|
|
|
+ })
|
|
|
+ this.$refs.shipment.list = this.shipmentList
|
|
|
+ this.invoiceList.forEach(item=>{
|
|
|
+ item.amountrate = Math.round((item.amountrate * 100)*100)/100
|
|
|
+ })
|
|
|
+ this.$refs.invoice.list = this.invoiceList
|
|
|
+ })
|
|
|
|
|
|
},
|
|
|
checkAmountrate(val,key){
|
|
|
@@ -168,47 +134,92 @@ export default {
|
|
|
}
|
|
|
}
|
|
|
},
|
|
|
- onSubmit(){
|
|
|
- console.log(this.form)
|
|
|
- const order = this.form.accountingnodes.ordercheck.isused == '1'?this.form.accountingnodes.ordercheck.amountrate:0
|
|
|
- const logistics = this.form.accountingnodes.logisticscheck.isused == '1'?this.form.accountingnodes.logisticscheck.amountrate:0
|
|
|
- const invoiceapply = this.form.accountingnodes.invoiceapplycheck.isused == '1'?this.form.accountingnodes.invoiceapplycheck.amountrate:0
|
|
|
- console.log(order + logistics + invoiceapply)
|
|
|
- if (parseFloat(order) + parseFloat(logistics) + parseFloat(invoiceapply) !== 100 ){
|
|
|
- this.$message.error('已选节点立账额度合计需等于100%');
|
|
|
+ async onSubmit(){
|
|
|
+ if (this.auditIsUsed == '1') {
|
|
|
+ this.auditList = this.$refs.audit.list.map(item=>{
|
|
|
+ return {
|
|
|
+ "days":item.days,
|
|
|
+ "amountrate":(item.amountrate/100).toFixed(4),
|
|
|
+ "isused":"1",
|
|
|
+ "point":"订单审核"
|
|
|
+ }
|
|
|
+ })
|
|
|
}else {
|
|
|
- this.$refs['form'].validate(async (valid) => {
|
|
|
- if (!valid) return false
|
|
|
- /*this.form.amountrate = (this.form.amountrate /100).toFixed(4)*/
|
|
|
- this.form.accountingnodes.ordercheck.amountrate = (this.form.accountingnodes.ordercheck.amountrate/100).toFixed(4)
|
|
|
- this.form.accountingnodes.logisticscheck.amountrate = (this.form.accountingnodes.logisticscheck.amountrate/100).toFixed(4)
|
|
|
- this.form.accountingnodes.invoiceapplycheck.amountrate = (this.form.accountingnodes.invoiceapplycheck.amountrate/100).toFixed(4)
|
|
|
- const res = await this.$api.requested({
|
|
|
- "id": "20230110095903",
|
|
|
- "content": this.form
|
|
|
- })
|
|
|
- this.tool.showMessage(res,()=>{
|
|
|
- this.$emit('onSuccess')
|
|
|
- this.$refs['form'].resetFields();
|
|
|
- this.dialogFormVisible = false
|
|
|
- })
|
|
|
+ this.auditList = []
|
|
|
+ }
|
|
|
+ if (this.shipmentIsUsed == '1') {
|
|
|
+ this.shipmentList = this.$refs.shipment.list.map(item=>{
|
|
|
+ return {
|
|
|
+ "days":item.days,
|
|
|
+ "amountrate":(item.amountrate/100).toFixed(4),
|
|
|
+ "isused":"1",
|
|
|
+ "point":"订单出货"
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ this.shipmentList = []
|
|
|
+ }
|
|
|
+ if (this.invoiceIsUsed == '1') {
|
|
|
+ this.invoiceList = this.$refs.invoice.list.map(item=>{
|
|
|
+ return {
|
|
|
+ "days":item.days,
|
|
|
+ "amountrate":(item.amountrate/100).toFixed(4),
|
|
|
+ "isused":"1",
|
|
|
+ "point":"订单开票"
|
|
|
+ }
|
|
|
})
|
|
|
+ }else {
|
|
|
+ this.invoiceList = []
|
|
|
}
|
|
|
- /* console.log(this.form)
|
|
|
- this.$refs['form'].validate(async (valid) => {
|
|
|
- if (!valid) return false
|
|
|
- this.form.amountrate = (this.form.amountrate /100).toFixed(4)
|
|
|
+ let newArr = this.auditList.concat(this.shipmentList.concat(this.invoiceList))
|
|
|
+ let allAmountrate = parseFloat(0)
|
|
|
+ newArr.forEach(item=>{
|
|
|
+ allAmountrate = parseFloat(allAmountrate) + parseFloat(item.amountrate)
|
|
|
+ })
|
|
|
+ if (allAmountrate !== 1){
|
|
|
+ this.$message({
|
|
|
+ message: '已选节点立账额度合计需等于100%',
|
|
|
+ center: true,
|
|
|
+ type: 'error',
|
|
|
+ offset:260
|
|
|
+ });
|
|
|
+ }else {
|
|
|
+ this.form.accountingnodes.ordercheck = this.auditList
|
|
|
+ this.form.accountingnodes.logisticscheck = this.shipmentList
|
|
|
+ this.form.accountingnodes.invoiceapplycheck = this.invoiceList
|
|
|
const res = await this.$api.requested({
|
|
|
"id": "20230110095903",
|
|
|
- "version":1,
|
|
|
"content": this.form
|
|
|
})
|
|
|
this.tool.showMessage(res,()=>{
|
|
|
- this.$emit('onSuccess')
|
|
|
- this.$refs['form'].resetFields();
|
|
|
+ this.onClose()
|
|
|
this.dialogFormVisible = false
|
|
|
})
|
|
|
- })*/
|
|
|
+ }
|
|
|
+ },
|
|
|
+ isUsedChange(value){
|
|
|
+ if (value === '订单'){
|
|
|
+ if (this.auditIsUsed !== 1){
|
|
|
+ this.$refs.audit.list = [{
|
|
|
+ days:'',
|
|
|
+ amountrate:'',
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ }else if (value === '出货'){
|
|
|
+ this.$refs.shipment.list = [{
|
|
|
+ days:'',
|
|
|
+ amountrate:'',
|
|
|
+ }]
|
|
|
+ }else if (value === '开票'){
|
|
|
+ this.$refs.invoice.list = [{
|
|
|
+ days:'',
|
|
|
+ amountrate:'',
|
|
|
+ }]
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onClose(){
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ this.dialogFormVisible = false
|
|
|
}
|
|
|
}
|
|
|
}
|