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.
 
 
 
 
 
 

997 lines
55 KiB

<template>
<div class="app-container">
<div>
<div class="tab-header webtop">
<div>{{ viewTitle }}</div>
<div>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="saveEdit()">保存</el-button>
<el-button type="primary" size="small" :disabled="submitdisabled" @click="submitVehicleApply()">确认</el-button>
<el-button type="info" size="small" @click="handleReturn()">关闭</el-button>
</div>
</div>
<div class="listconadd">
<div class="titwu"><span>车辆入库申请单</span></div>
<el-form ref="form_obj" :model="formobj" :rules="rules" class="formaddcopy02">
<el-row class="rowStyle">
<el-col :span="24" class="tleftb colOneStyle">
<div><span style="font-size: 16px">金额单位</span></div>
</el-col>
</el-row>
<el-row style="border-top: 1px solid #E0E3EB">
<el-col :span="8">
<div class="span-sty spanOneWidth"><span>分公司</span></div>
<el-form-item><span class="addinputInfo addinputwOne">{{ formobj.useOrgName }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty spanOneWidth">发起日期</div>
<el-form-item><span class="addinputInfo addinputwOne">{{ formobj.applicationDate }}</span></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty spanOneWidth"><span>申请人</span></div>
<el-form-item><span class="addinputInfo addinputwOne">{{ formobj.applicationName }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<div class="span-sty spanOneWidth"><span>采购订单编号</span></div>
<el-form-item><el-input v-model="formobj.purchaseOrderNo" placeholder="" clearable class="addinputw addinputwOne" style="width: 75% !important;"/></el-form-item>
</el-col>
<el-col :span="12">
<div class="span-sty spanOneWidth"><span>内部编码</span></div>
<el-form-item><span class="addinputInfo addinputwOne">{{ formobj.insideCode }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty spanOneWidth"><span>车型</span></div>
<el-form-item><span class="addinputInfo addinputwOne">{{ formobj.modelName }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<div class="span-sty spanOneWidth"><span>全款/贷款销售指导价</span></div>
<el-form-item><span class="addinputInfo addinputwOne">{{ formobj.guidedPrice }}</span></el-form-item>
</el-col>
<el-col :span="12">
<div class="span-sty spanOneWidth"><span>最新更新时间</span></div>
<el-form-item>
<span class="addinputInfo addinputwOne" style="color: red;font-weight: bold" v-if="!formobj.isNow">{{ formobj.newUpdateDate }}</span>
<span class="addinputInfo addinputwOne" v-else>{{ formobj.newUpdateDate }}</span>
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24" class="tlineheightb">
<div class="span-sty spanOneWidth"><span>常用配置</span></div>
<el-form-item><span class="addinputwOne">{{ formobj.configName }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="span-sty spanOneWidth"><span>厂家合同价</span></div>
<el-form-item><el-input @input="inputContractPrice" v-model="formobj.contractPrice" placeholder="" clearable @keyup.native="formobj.contractPrice = oninput(formobj.contractPrice,2)" class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty spanOneWidth"><span>其中上装价格</span></div>
<el-form-item><el-input v-model="formobj.amongSzPrice" @keyup.native="formobj.amongSzPrice = oninput(formobj.amongSzPrice,2)" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty spanOneWidth"><span>上装价格计算依据</span></div>
<el-form-item><el-input v-model="formobj.szPriceCalBasis" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="8">
<div class="spanTwoWidth"><span>其中含运费</span></div>
</el-col>
<el-col :span="8">
<div class="span-sty spanOneWidth">一次运费</div>
<el-form-item><el-input @input="inputOnceFreight" v-model="formobj.onceFreight" placeholder="" clearable @keyup.native="formobj.onceFreight = oninput(formobj.onceFreight,2)" class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty spanOneWidth">二次运费</div>
<el-form-item><el-input @input="inputSecondaryFreight" v-model="formobj.secondaryFreight" placeholder="" clearable @keyup.native="formobj.secondaryFreight = oninput(formobj.secondaryFreight,2)" class="addinputw addinputwOne"/></el-form-item>
</el-col>
</el-row>
<div class="title">
<div>政策详情(仅适用于陕汽品牌)</div>
<el-checkbox @change="changeFreight" v-model="freightChecked"><span style="color: #FFFFFF">扣减运费</span></el-checkbox>
</div>
<el-row>
<el-col :span="6">
<div class="span-sty spanOneWidth"><span>政策1</span></div>
<el-form-item><el-input v-model="formobj.policyOne" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="6">
<div class="span-sty spanOneWidth"><span>可享受金额</span></div>
<el-form-item><el-input @input="inputEligibleAmountOne" @keyup.native="formobj.eligibleAmountOne = oninput(formobj.eligibleAmountOne,2)" v-model="formobj.eligibleAmountOne" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="12" style="border-bottom: 0px !important;">
<div class="spanThreeWidth">
<span>计算政策3时:
<el-checkbox @change="changePolicyOne" style="padding-left: 5px;margin-right: 5px !important;" v-model="policyOneChecked">扣减政策1</el-checkbox>
<el-checkbox @change="changePolicyOneTwo" style="padding-left: 5px" v-model="policyOneTwoChecked">扣减政策2</el-checkbox>
</span>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<div class="span-sty spanOneWidth"><span>政策2</span></div>
<el-form-item><el-input v-model="formobj.policyTwoo" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="6">
<div class="span-sty spanOneWidth"><span>可享受金额</span></div>
<el-form-item><el-input @input="inputEligibleAmountTwo" @keyup.native="formobj.eligibleAmountTwo = oninput(formobj.eligibleAmountTwo,2)" v-model="formobj.eligibleAmountTwo" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="12">
<div class="spanThreeWidth">
<span>计算政策4时:
<el-checkbox @change="changePolicyTwo" style="padding-left: 5px;margin-right: 5px !important;" v-model="policyTwoChecked">扣减政策1</el-checkbox>
<el-checkbox @change="changePolicyThree" style="padding-left: 5px;margin-right: 5px !important;" v-model="policyThreeChecked">扣减政策2</el-checkbox>
<el-checkbox @change="changePolicyThreeByThree" v-model="policyThreeByThreeChecked">扣减政策3</el-checkbox>
</span>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<div class="span-sty spanOneWidth"><span>政策3</span></div>
<el-form-item><el-input v-model="formobj.policyTwo" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="6">
<div class="span-sty spanOneWidth"><span>可享受比例(%)</span></div>
<el-form-item><el-input @input="inputEligibleProportionTwo" v-model="formobj.eligibleProportionTwo" @keyup.native="formobj.eligibleProportionTwo = UpNumberRatio(formobj.eligibleProportionTwo,2)" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="12">
<div class="span-sty spanOneWidth"><span>对应金额</span></div>
<el-form-item><span class="addinputInfo addinputwOne">{{ formobj.corrMoneyTwo }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<div class="span-sty spanOneWidth"><span>政策4</span></div>
<el-form-item><el-input v-model="formobj.policyThree" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="6">
<div class="span-sty spanOneWidth"><span>可享受比例(%)</span></div>
<el-form-item><el-input @input="inputEligibleProportionThree" v-model="formobj.eligibleProportionThree" @keyup.native="formobj.eligibleProportionThree = UpNumberRatio(formobj.eligibleProportionThree,2)" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="12">
<div class="span-sty spanOneWidth"><span>对应金额</span></div>
<el-form-item><span class="addinputInfo addinputwOne">{{ formobj.corrMoneyThree }}</span></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="6">
<div class="span-sty spanOneWidth"><span>金额合计</span></div>
<el-form-item><el-input v-model="formobj.moneyCount" @keyup.native="formobj.moneyCount = UpNumberRatio(formobj.moneyCount,2)" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
<el-col :span="18">
<div class="span-sty spanOneWidth"><span>政策备注</span></div>
<el-form-item><el-input v-model="formobj.policyRemarks" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty spanOneWidth"><span>厂家政策截图</span></div>
<upload_picture ref="imgUpload" v-model="imgList" bucket="map" :upload-data="{type:'0001'}" class="addinputw addinputwOne"/>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty spanOneWidth"><span>厂家结算价</span></div>
<el-form-item><span class="addinputInfo addinputwOne">{{ inputMoneyCount() }}</span></el-form-item>
</el-col>
</el-row>
<div class="title">
<div>车辆列表</div>
</div>
<el-table :key="tableKey" :data="formobj.vehicleList" :index="index" border style="width: 100%">
<el-table-column fixed width="60px" label="序号" type="index" :index="index + 1" align="center" />
<el-table-column label="车架号" align="left" header-align="center">
<template slot-scope="scope">
<el-input v-model.trim="scope.row.vinNo" placeholder="" style="width: 80%" @change="changeVinNo" clearable type="text" maxlength="17"/>
</template>
</el-table-column>
<el-table-column label="发动机号" align="left" header-align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.engineNo" placeholder="" style="width: 80%" clearable/>
</template>
</el-table-column>
<el-table-column label="备注" header-align="center">
<template slot-scope="scope">
<el-input v-model="scope.row.remarks" placeholder="" style="width: 80%" clearable />
</template>
</el-table-column>
</el-table>
<el-row>
<el-col :span="8">
<div class="span-sty spanOneWidth"><span>厂家入库日期</span></div>
<el-form-item><el-date-picker value-format="yyyy-MM-dd" v-model="formobj.priceDate" clearable type="date" class="addinputw addinputwOne" placeholder=""/></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty spanOneWidth"><span>公司入库日期</span></div>
<el-form-item><el-date-picker value-format="yyyy-MM-dd" v-model="formobj.orgPriceDate" :picker-options="pickerOptions" clearable type="date" class="addinputw addinputwOne" placeholder=""/></el-form-item>
</el-col>
<el-col :span="8">
<div class="span-sty spanOneWidth"><span>物流发车日期</span></div>
<el-form-item><el-date-picker value-format="yyyy-MM-dd" v-model="formobj.departureDate" clearable type="date" class="addinputw addinputwOne" placeholder=""/></el-form-item>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="span-sty spanOneWidth"><span>备注</span></div>
<el-form-item><el-input v-model="formobj.remarks" placeholder="" clearable class="addinputw addinputwOne"/></el-form-item>
</el-col>
</el-row>
</el-form>
</div>
</div>
</div>
</template>
<script>
import req from '@/api/ruzhang/scmapplyinbound'
import upload_picture from '@/components/uploadFile/upload_picture'
import { getOrgSidByPath, fetchBySid } from '@/api/cheliang/dictcommons'
export default {
name: 'RuzhangAdd',
components: {
upload_picture
},
data() {
return {
pickerOptions: {
disabledDate(time) {
let oneDay = 3600 * 1000 * 24 * 3
return Date.now() < time.getTime() || time.getTime() < Date.now() - oneDay
}
},
viewTitle: '',
index: 0,
tableKey: 0,
freightChecked: false, // 扣减运费
policyOneChecked: false, // 计算政策:3: 扣减政策1
policyOneTwoChecked: false, // 计算政策3: 扣减政策2
policyTwoChecked: false, // 计算政策4: 扣减政策1
policyThreeChecked: false, // 计算政策4: 扣减政策2
policyThreeByThreeChecked: false, // 计算政策4: 扣减政策3
imgList: [],
// 表单数据
formobj: {
amongSzPrice: '',
applicationCode: '',
applicationDate: '',
applicationName: '',
applicationSid: '',
configName: '',
configSid: '',
contractPrice: '',
corrMoneyThree: '',
corrMoneyTwo: '',
costPrice: '',
departureDate: '',
eligibleAmountOne: '',
eligibleAmountTwo: '',
eligibleProportionThree: '',
eligibleProportionTwo: '',
insideCode: '',
modelName: '',
modelSid: '',
moneyCount: '',
nodeState: '',
num: '',
onceFreight: '',
policyOne: '',
policyRemarks: '',
policyThree: '',
policyTwo: '', // 政策3
policyTwoo: '', // 政策2
priceDate: '',
purchaseOrderNo: '',
remarks: '',
secondaryFreight: '',
userSid: '',
useOrgName: '',
useOrgSid: '',
deductionFreight: '',
deductionPolicyThreeOne: '',
deductionPolicyThreeTwo: '',
deductionPolicyThreeTwoo: '', // 计算政策3: 扣减政策2
deductionPolicyTwoOne: '',
deductionPolicyFourThree: '', // 计算政策4: 扣减政策3
scmFiles: [],
vehicleList: [],
vehicleOrderSid: '',
orgPath: '',
orgPriceDate: '',
guidedPrice: '',
newUpdateDate: ''
},
rules: {},
submitdisabled: false
}
},
methods: {
init() {
getOrgSidByPath({ orgPath: window.sessionStorage.getItem('defaultOrgPath') }).then((resp) => {
if (resp.success) {
this.formobj.useOrgSid = resp.data
fetchBySid(this.formobj.useOrgSid).then((res) => {
if (res.success) {
this.formobj.useOrgName = res.data.name
}
})
}
})
},
// 输入数字正则
oninput(val, limit = 0) {
val = val.replace(/[^\d]/g, '') // 保留数字
val = val.replace(/^00/, '0'); // 开头不能有两个0
/^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
const reg = new RegExp(str)
if (limit === 0) {
// 不需要小数点
val = val.replace(reg, '$1')
} else {
// 通过正则保留小数点后指定的位数
val = val.replace(reg, '$1.$2')
}
return val
},
UpNumberRatio(val, limit = 2) {
val = val.replace(/[^\d.]/g, '') // 保留数字
val = val.replace(/^00/, '0.') // 开头不能有两个0
val = val.replace(/^\./g, '0.') // 开头为小数点转换为0.
val = val.replace(/\.{2,}/g, '.') // 两个以上的小数点转换成一个
val = val.replace('.', '$#$').replace(/\./g, '').replace('$#$', '.'); // 只保留一个小数点
/^0\d+/.test(val) ? val = val.slice(1) : '' // 两位以上数字开头不能为0
const str = '^(\\d+)\\.(\\d{' + limit + '}).*$'
const reg = new RegExp(str)
if (limit === 0) {
// 不需要小数点
val = val.replace(reg, '$1')
} else {
// 通过正则保留小数点后指定的位数
val = val.replace(reg, '$1.$2')
}
return val
},
inputContractPrice() {
if (this.formobj.contractPrice !== '' && this.formobj.contractPrice !== null) {
this.inputEligibleAmountOne()
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
}
},
inputOnceFreight() {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
},
inputSecondaryFreight() {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
},
changeFreight() {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
},
changePolicyOne() {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
},
changePolicyOneTwo() {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
},
changePolicyTwo() {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
},
changePolicyThree() {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
},
changePolicyThreeByThree() {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
},
inputEligibleAmountOne() {
if (this.formobj.eligibleAmountOne !== '') {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
} else {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
}
},
inputEligibleAmountTwo() {
if (this.formobj.eligibleAmountTwo !== '') {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
} else {
this.inputEligibleProportionTwo()
this.inputEligibleProportionThree()
}
},
// 计算政策3
inputEligibleProportionTwo() {
if (this.formobj.eligibleProportionTwo !== '') {
if (this.policyOneChecked && this.policyOneTwoChecked) { // 计算政策3时:勾选扣减政策1、扣减政策2
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
}
} else {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
}
} else if (this.policyOneChecked && !this.policyOneTwoChecked) { // 计算政策3时:勾选扣减政策1
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.eligibleAmountOne)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
}
} else {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
}
} else if (!this.policyOneChecked && this.policyOneTwoChecked) { // 计算政策3时:勾选扣减政策2
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
}
} else {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
}
} else { // 计算政策3时:未勾选任何扣减政策
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyTwo = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight)), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
} else {
this.formobj.corrMoneyTwo = this.multiplication(parseFloat(this.formobj.contractPrice), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
}
} else {
this.formobj.corrMoneyTwo = this.multiplication(parseFloat(this.formobj.contractPrice), (parseFloat(this.formobj.eligibleProportionTwo) / 100))
}
}
} else {
this.formobj.corrMoneyTwo = 0
}
if (this.formobj.eligibleAmountOne === '' && this.formobj.eligibleAmountTwo === '') {
this.formobj.moneyCount = parseFloat(0) + parseFloat(this.formobj.corrMoneyTwo) + parseFloat(this.formobj.corrMoneyThree)
} else if (this.formobj.eligibleAmountOne !== '' && this.formobj.eligibleAmountTwo === '') {
this.formobj.moneyCount = parseFloat(this.formobj.eligibleAmountOne) + parseFloat(this.formobj.corrMoneyTwo) + parseFloat(this.formobj.corrMoneyThree)
} else if (this.formobj.eligibleAmountOne === '' && this.formobj.eligibleAmountTwo !== '') {
this.formobj.moneyCount = parseFloat(this.formobj.eligibleAmountTwo) + parseFloat(this.formobj.corrMoneyTwo) + parseFloat(this.formobj.corrMoneyThree)
} else {
this.formobj.moneyCount = parseFloat(this.formobj.eligibleAmountOne) + parseFloat(this.formobj.eligibleAmountTwo) + parseFloat(this.formobj.corrMoneyTwo) + parseFloat(this.formobj.corrMoneyThree)
}
if (this.formobj.eligibleProportionThree !== '') {
this.inputEligibleProportionThree()
}
return this.formobj.corrMoneyTwo
},
// 计算政策4
inputEligibleProportionThree() {
if (this.formobj.eligibleProportionThree !== '') {
if (this.policyTwoChecked && this.policyThreeChecked && this.policyThreeByThreeChecked) { // 计算政策4时:勾选扣减政策1、扣减政策2、扣减政策3
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else if (this.policyTwoChecked && !this.policyThreeChecked && this.policyThreeByThreeChecked) { // 计算政策4时:勾选扣减政策1、扣减政策3
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else if (!this.policyTwoChecked && this.policyThreeChecked && this.policyThreeByThreeChecked) { // 计算政策4时:勾选扣减政策2、扣减政策3
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.corrMoneyTwo) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.corrMoneyTwo) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.corrMoneyTwo) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.corrMoneyTwo) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.corrMoneyTwo) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else if (this.policyTwoChecked && this.policyThreeChecked && !this.policyThreeByThreeChecked) { // 计算政策4时:勾选扣减政策1、扣减政策2
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else if (!this.policyTwoChecked && !this.policyThreeChecked && this.policyThreeByThreeChecked) { // 计算政策4时:勾选扣减政策3
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.corrMoneyTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else if (this.policyTwoChecked && !this.policyThreeChecked && !this.policyThreeByThreeChecked) { // 计算政策4时:勾选扣减政策1
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.eligibleAmountOne)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountOne)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountOne)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else if (!this.policyTwoChecked && this.policyThreeChecked && !this.policyThreeByThreeChecked) { // 计算政策4时:勾选扣减政策2
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.eligibleAmountTwo)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else { // 计算政策4时:未勾选任何一个扣减政策
if (this.freightChecked) {
if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight) - parseFloat(this.formobj.secondaryFreight)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight !== '' && this.formobj.secondaryFreight === '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.onceFreight)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else if (this.formobj.onceFreight === '' && this.formobj.secondaryFreight !== '') {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.secondaryFreight)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
} else {
this.formobj.corrMoneyThree = this.multiplication((parseFloat(this.formobj.contractPrice)), (parseFloat(this.formobj.eligibleProportionThree) / 100))
}
}
} else {
this.formobj.corrMoneyThree = 0
}
if (this.formobj.eligibleAmountOne === '' && this.formobj.eligibleAmountTwo === '') {
this.formobj.moneyCount = parseFloat(0) + parseFloat(this.formobj.corrMoneyTwo) + parseFloat(this.formobj.corrMoneyThree)
} else if (this.formobj.eligibleAmountOne !== '' && this.formobj.eligibleAmountTwo === '') {
this.formobj.moneyCount = parseFloat(this.formobj.eligibleAmountOne) + parseFloat(this.formobj.corrMoneyTwo) + parseFloat(this.formobj.corrMoneyThree)
} else if (this.formobj.eligibleAmountOne === '' && this.formobj.eligibleAmountTwo !== '') {
this.formobj.moneyCount = parseFloat(this.formobj.eligibleAmountTwo) + parseFloat(this.formobj.corrMoneyTwo) + parseFloat(this.formobj.corrMoneyThree)
} else {
this.formobj.moneyCount = parseFloat(this.formobj.eligibleAmountOne) + parseFloat(this.formobj.eligibleAmountTwo) + parseFloat(this.formobj.corrMoneyTwo) + parseFloat(this.formobj.corrMoneyThree)
}
return this.formobj.corrMoneyThree
},
inputMoneyCount() {
if (this.formobj.moneyCount === '') {
this.formobj.moneyCount = 0
}
if (this.formobj.contractPrice !== '' && this.formobj.contractPrice !== null) {
this.formobj.costPrice = parseFloat(this.formobj.contractPrice) - parseFloat(this.formobj.moneyCount)
}
return this.formobj.costPrice
},
multiplication(arg1, arg2) {
var m = 0
var s1 = arg1.toString()
var s2 = arg2.toString()
try {
m += s1.split('.')[1].length
} catch (e) {
console.log(e)
}
try {
m += s2.split('.')[1].length
} catch (e) {
console.log(e)
}
return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m)
},
showEdit(sid, row) {
this.$nextTick(() => {
this.$refs['form_obj'].clearValidate()
})
this.viewTitle = '【编辑】入库单'
console.log('编辑回显', sid, row)
req.fetchBySid(sid).then(resp => {
const data = resp.data
this.formobj = data
this.formobj.userSid = window.sessionStorage.getItem('userSid')
this.formobj.orgPath = window.sessionStorage.getItem('defaultOrgPath')
if (this.formobj.scmFiles.length > 0) {
this.formobj.scmFiles.forEach((e) => {
this.imgList.push({
name: e.fileName,
filePath: e.filePath,
size: e.fileSize,
url: e.filePath
})
})
}
if (this.formobj.deductionFreight === '0') {
this.freightChecked = true
} else {
this.freightChecked = false
}
if (this.formobj.deductionPolicyTwoOne === '0') {
this.policyOneChecked = true
} else {
this.policyOneChecked = false
}
if (this.formobj.deductionPolicyThreeOne === '0') {
this.policyTwoChecked = true
} else {
this.policyTwoChecked = false
}
if (this.formobj.deductionPolicyThreeTwo === '0') {
this.policyThreeChecked = true
} else {
this.policyThreeChecked = false
}
if (this.formobj.deductionPolicyThreeTwoo === '0') {
this.policyOneTwoChecked = true
} else {
this.policyOneTwoChecked = false
}
if (this.formobj.deductionPolicyFourThree === '0') {
this.policyThreeByThreeChecked = true
} else {
this.policyThreeByThreeChecked = false
}
this.$nextTick(() => {
this.init()
})
}).catch(e => {
this.formobj = row
})
},
getUrl() {
if (this.imgList.length > 0) {
const aa = []
for (var i = 0; i < this.imgList.length; i++) {
aa.push({
attachType: '',
fileName: this.imgList[i].name,
filePath: this.imgList[i].filePath,
fileSize: this.imgList[i].size,
fileType: this.imgList[i].name.substr(this.imgList[i].name.lastIndexOf('.')),
linkSid: '',
name: window.sessionStorage.getItem('name'),
sid: ''
})
}
this.formobj.scmFiles = aa
}
},
changeVinNo(val) {
if (val.length < 17 && val.length !== 8) {
const message = '车架号的长度应为8位或17位'
this.$message({ showClose: true, type: 'error', message: message })
}
},
saveEdit() {
this.getUrl()
if (this.formobj.departureDate === '') {
this.$message({ showClose: true, type: 'error', message: '厂家发车日期不能为空' })
return
}
if (this.formobj.onceFreight === '') {
this.$message({ showClose: true, type: 'error', message: '一次运费不能为空' })
return
}
for (var i = 0; i < this.formobj.vehicleList.length; i++) {
if (this.formobj.vehicleList[i].vinNo !== '' && this.formobj.vehicleList[i].engineNo === '') {
this.$message({ showClose: true, type: 'error', message: '车架号:' + this.formobj.vehicleList[i].vinNo + '的发动机号不能为空' })
return
}
}
if (this.freightChecked) {
this.formobj.deductionFreight = 0
} else {
this.formobj.deductionFreight = 1
}
if (this.policyOneChecked) {
this.formobj.deductionPolicyTwoOne = 0
} else {
this.formobj.deductionPolicyTwoOne = 1
}
if (this.policyTwoChecked) {
this.formobj.deductionPolicyThreeOne = 0
} else {
this.formobj.deductionPolicyThreeOne = 1
}
if (this.policyThreeChecked) {
this.formobj.deductionPolicyThreeTwo = 0
} else {
this.formobj.deductionPolicyThreeTwo = 1
}
if (this.policyOneTwoChecked) {
this.formobj.deductionPolicyThreeTwoo = 0
} else {
this.formobj.deductionPolicyThreeTwoo = 1
}
if (this.policyThreeByThreeChecked) {
this.formobj.deductionPolicyFourThree = 0
} else {
this.formobj.deductionPolicyFourThree = 1
}
this.$refs['form_obj'].validate(valid => {
if (valid) {
this.submitdisabled = true
req.saveOrUpdate(this.formobj).then((resp) => {
if (resp.success) {
this.$message({ showClose: true, type: 'success', message: '保存成功' })
this.handleReturn('true')
} else {
this.submitdisabled = false
}
}).catch(() => {
this.submitdisabled = false
})
} else {
return false
}
})
},
submitVehicleApply() {
this.getUrl()
if (this.formobj.purchaseOrderNo === '') {
this.$message({ showClose: true, type: 'error', message: '采购订单编号不能为空' })
return
}
if (this.formobj.onceFreight === '') {
this.$message({ showClose: true, type: 'error', message: '一次运费不能为空' })
return
}
if (this.formobj.priceDate === '' || this.formobj.priceDate === null) {
this.$message({ showClose: true, type: 'error', message: '厂家入库日期不能为空' })
return
}
if (this.formobj.orgPriceDate === '') {
this.$message({ showClose: true, type: 'error', message: '公司入库日期不能为空' })
return
}
if (this.formobj.departureDate === '') {
this.$message({ showClose: true, type: 'error', message: '物流发车日期不能为空' })
return
}
for (var k = 0; k < this.formobj.vehicleList.length; k++) {
if (this.formobj.vehicleList[k].vinNo !== '' && this.formobj.vehicleList[k].engineNo === '') {
this.$message({ showClose: true, type: 'error', message: '车架号:' + this.formobj.vehicleList[k].vinNo + '的发动机号不能为空' })
return
}
}
if (this.freightChecked) {
this.formobj.deductionFreight = 0
} else {
this.formobj.deductionFreight = 1
}
if (this.policyOneChecked) {
this.formobj.deductionPolicyTwoOne = 0
} else {
this.formobj.deductionPolicyTwoOne = 1
}
if (this.policyTwoChecked) {
this.formobj.deductionPolicyThreeOne = 0
} else {
this.formobj.deductionPolicyThreeOne = 1
}
if (this.policyThreeChecked) {
this.formobj.deductionPolicyThreeTwo = 0
} else {
this.formobj.deductionPolicyThreeTwo = 1
}
if (this.policyOneTwoChecked) {
this.formobj.deductionPolicyThreeTwoo = 0
} else {
this.formobj.deductionPolicyThreeTwoo = 1
}
if (this.policyThreeByThreeChecked) {
this.formobj.deductionPolicyFourThree = 0
} else {
this.formobj.deductionPolicyFourThree = 1
}
// 判断车辆列表不能为空
var hint1 = 0
if (this.formobj.vehicleList.length > 0) {
for (var i = 0; i < this.formobj.vehicleList.length; i++) {
if (this.formobj.vehicleList[i].vinNo !== '') {
hint1 = 1
break
}
}
}
if (hint1 === 0) {
this.$message({ showClose: true, type: 'error', message: '车辆列表不能为空' })
return
}
// 判断车辆列表中是否有未填写的车架号记录,如果有则进行分批入库的功能
var hint = 0
if (this.formobj.vehicleList.length > 0) {
for (var i = 0; i < this.formobj.vehicleList.length; i++) {
if (this.formobj.vehicleList[i].vinNo === '') {
hint = 1
break
}
}
}
if (hint !== 0) {
const tip = '有些车架号没有填写,是否分批入库'
this.$confirm(tip, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$refs['form_obj'].validate(valid => {
if (valid) {
this.submitdisabled = true
req.confirmRZ(this.formobj).then((res) => {
if (res.success) {
this.$message({
showClose: true,
type: 'success',
message: '提交成功'
})
this.handleReturn('true')
} else {
this.submitdisabled = false
}
}).catch(() => {
this.submitdisabled = false
})
}
})
}).catch(() => {
hint = 0
hint1 = 0
})
} else {
this.$refs['form_obj'].validate(valid => {
if (valid) {
this.submitdisabled = true
req.confirmRZ(this.formobj).then((res) => {
if (res.success) {
this.$message({
showClose: true,
type: 'success',
message: '提交成功'
})
this.handleReturn('true')
} else {
this.submitdisabled = false
}
}).catch(() => {
this.submitdisabled = false
})
}
})
}
},
// 返回(===既判断又赋值)
handleReturn(isreload) {
if (isreload === 'true') this.$emit('reloadlist')
this.$refs['form_obj'].resetFields()
this.imgList = []
this.submitdisabled = false
this.$emit('doback')
}
}
}
</script>
<style scoped>
.title {
display: flex;
justify-content: space-between;
align-items: center;
}
.rowStyle {
border-left: 0px;
}
.colOneStyle {
border-right: 0px !important;
border-bottom: 0px !important;
}
.tlineheightb {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
/deep/ .tlineheightb .el-form-item .el-form-item__content {
line-height: 15px !important;
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
}
.spanOneWidth {
width: 140px !important;
}
.spanTwoWidth {
line-height: 42px;
text-align: center;
font-size: 14px;
color: #606266;
font-weight: 600;
padding-right: 5px;
width: 100%;
}
.spanThreeWidth {
line-height: 42px;
text-align: left;
font-size: 14px;
color: #606266;
font-weight: 600;
padding-right: 5px;
width: 100%;
}
.addinputw {
width: 40% !important;
}
.addinputwOne {
margin-left: 130px !important;
}
</style>