This commit is contained in:
liushuai
2020-03-23 17:59:00 +08:00
parent cb61a19abe
commit 94e5561fdf
20 changed files with 942 additions and 527 deletions

View File

@@ -234,6 +234,7 @@ export default {
交货期组: [],
备注组: [],
companyAddress: '',
count: 0,
sendAddress: ''
}
},
@@ -738,6 +739,7 @@ export default {
`
},
async editContract() { // 选择一个询价单,整成合同明细
console.log(this.tableData1, 'tableData')
this.openDeal = false
const date = new Date()
this.year = date.getFullYear()
@@ -854,55 +856,65 @@ export default {
// this.content = `自定义`
// },
generateContract() { // 生成采购合同
this.content = this.contentNew.replace(/ /g, '')
this.content = this.content.replace(/\n/g, '')
this.content = this.content.replace(/==/g, '= =') // 更新tinymce中的东西到html中后续会用到
this.组件零件流水号组 = []
this.组件零件基本件流水号组 = []
this.数量组 = []
this.单价组 = []
this.交货期组 = []
this.hasTax === '含税' ? this.单价是否含税 = 1 : this.单价是否含税 = 0
const inquiryDetailNum_old = [] // 需要转移到新询价单的物料的询价单明细流水号
this.tableData1.map(v => {
if ((this.hasTax === '含税' && Number(v.含税单价)) || (this.hasTax === '未税' && Number(v.未税单价))) { // 筛掉未询到价格的物料
this.组件零件流水号组.push(v.组件零件流水号)
this.组件零件基本件流水号组.push(v.组件零件基本件流水号)
this.数量组.push(v.数量)
this.hasTax === '含税' ? this.单价组.push(v.含税单价) : this.单价组.push(v.未税单价)
this.交货期组.push(v.交货期)
this.备注组.push(v.备注)
} else { // 获取未询到价格的物料的询价单明细流水号们
inquiryDetailNum_old.push(v.询价单明细流水号)
}
})
if (this.contractNumValue) {
if (this.demoRadio) {
this.$confirm('此采购合同将递交审核,递交后该合同不可删除,确认完成编辑?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
doneContract(this.contractNum, this.contractName, this.deliveryDate, this.payDate, this.payMethod, this.invoiceInfo, this.otherInfo, this.actualTotal, this.id, this.supplierValue, this.单价是否含税, this.组件零件流水号组, this.组件零件基本件流水号组, this.数量组, this.单价组, this.交货期组, this.content, this.taxRate * 100, inquiryDetailNum_old, this.备注组).then(response => {
if (response.data[0].result === '1') {
this.$message.success('合同生成成功')
this.openDeal = true
this.reload()
} else {
this.$message.error('生成合同失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
} else {
this.$message.warning('请先选择模板进行预览')
for (let i = 0; i < this.tableData1.length; i++) {
if (this.tableData1[i].含税单价 === '') {
console.log(this.tableData1[i].含税单价, '含税单价')
this.count++
}
}
if (this.count === this.tableData1.length) {
this.$message.error('该合同未绑定物料信息')
} else {
this.$message.warning('请先选择合同进行编辑')
this.content = this.contentNew.replace(/&nbsp;/g, '')
this.content = this.content.replace(/\n/g, '')
this.content = this.content.replace(/==/g, '= =') // 更新tinymce中的东西到html中后续会用到
this.组件零件流水号组 = []
this.组件零件基本件流水号组 = []
this.数量组 = []
this.单价组 = []
this.交货期组 = []
this.hasTax === '含税' ? this.单价是否含税 = 1 : this.单价是否含税 = 0
const inquiryDetailNum_old = [] // 需要转移到新询价单的物料的询价单明细流水号
this.tableData1.map(v => {
if ((this.hasTax === '含税' && Number(v.含税单价)) || (this.hasTax === '未税' && Number(v.未税单价))) { // 筛掉未询到价格的物料
this.组件零件流水号组.push(v.组件零件流水号)
this.组件零件基本件流水号组.push(v.组件零件基本件流水号)
this.数量组.push(v.数量)
this.hasTax === '含税' ? this.单价组.push(v.含税单价) : this.单价组.push(v.未税单价)
this.交货期组.push(v.交货期)
this.备注组.push(v.备注)
} else { // 获取未询到价格的物料的询价单明细流水号们
inquiryDetailNum_old.push(v.询价单明细流水号)
}
})
if (this.contractNumValue) {
if (this.demoRadio) {
this.$confirm('此采购合同将递交审核,递交后该合同不可删除,确认完成编辑?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
doneContract(this.contractNum, this.contractName, this.deliveryDate, this.payDate, this.payMethod, this.invoiceInfo, this.otherInfo, this.actualTotal, this.id, this.supplierValue, this.单价是否含税, this.组件零件流水号组, this.组件零件基本件流水号组, this.数量组, this.单价组, this.交货期组, this.content, this.taxRate * 100, inquiryDetailNum_old, this.备注组).then(response => {
if (response.data[0].result === '1') {
this.$message.success('合同生成成功')
this.openDeal = true
this.reload()
} else {
this.$message.error('生成合同失败')
}
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
} else {
this.$message.warning('请先选择模板进行预览')
}
} else {
this.$message.warning('请先选择合同进行编辑')
}
}
}
}