diff --git a/src/api/PurchasingCenter/OfflineContract.js b/src/api/PurchasingCenter/OfflineContract.js
index 11414bc7..37be21be 100644
--- a/src/api/PurchasingCenter/OfflineContract.js
+++ b/src/api/PurchasingCenter/OfflineContract.js
@@ -135,26 +135,26 @@ export function deleteMateriel(num) {
})
}
// 保存离线合同
-export function saveOfflineContact(contractNum, total, partGroup, numGroup, priceGroup, dateGroup, remarkGroup) {
+export function saveOfflineContact(contractNum, total, partGroup, numGroup, priceGroup, dateGroup, remarkGroup, taxRate) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '采购管理_离线合同_保存合同',
- param: `离线合同流水号=${contractNum}&合同总额=${total}&离线合同明细流水号组=${partGroup}&数量组=${numGroup}&单价组=${priceGroup}&交货期要求组=${dateGroup}&备注组=${remarkGroup}`
+ param: `离线合同流水号=${contractNum}&合同总额=${total}&离线合同明细流水号组=${partGroup}&数量组=${numGroup}&单价组=${priceGroup}&交货期要求组=${dateGroup}&备注组=${remarkGroup}&税率=${taxRate}`
}
})
}
// 生成离线合同
-export function doneOfflineContact(contractNum, total, partGroup, numGroup, priceGroup, dateGroup, remarkGroup) {
+export function doneOfflineContact(contractNum, total, partGroup, numGroup, priceGroup, dateGroup, remarkGroup, taxRate) {
return request({
url: '',
method: 'post',
data: {
type: '2',
name: '采购管理_离线合同_生成合同',
- param: `离线合同流水号=${contractNum}&合同总额=${total}&离线合同明细流水号组=${partGroup}&数量组=${numGroup}&单价组=${priceGroup}&交货期要求组=${dateGroup}&备注组=${remarkGroup}`
+ param: `离线合同流水号=${contractNum}&合同总额=${total}&离线合同明细流水号组=${partGroup}&数量组=${numGroup}&单价组=${priceGroup}&交货期要求组=${dateGroup}&备注组=${remarkGroup}&税率=${taxRate}`
}
})
}
diff --git a/src/views/PurchasingCenter/OfflineContract/index.vue b/src/views/PurchasingCenter/OfflineContract/index.vue
index 0f7f426b..4cbe4b4f 100644
--- a/src/views/PurchasingCenter/OfflineContract/index.vue
+++ b/src/views/PurchasingCenter/OfflineContract/index.vue
@@ -344,6 +344,17 @@
@current-change="handleCurrentChange2"/>
生成
保存
+
+
+
+
+
税率:
@@ -381,14 +392,26 @@
{{ scope.row.参考价格 }}
-
+
-
+
+ {{ (scope.row.单价 / (1 + taxRate)).toFixed(2) }}
-
+
- {{ (Number(scope.row.单价||0) * Number(scope.row.数量||0)).toFixed(2) }}
+
+ {{ (scope.row.未税单价 * (1 + taxRate)).toFixed(2) }}
+
+
+
+
+ {{ hasTax==='未税' ? scope.row.未税总额 = (Number(scope.row.数量) * Number(scope.row.未税单价)).toFixed(2) : scope.row.未税总额 = (scope.row.含税总额 / (1+taxRate)).toFixed(2) }}
+
+
+
+
+ {{ hasTax==='含税' ? scope.row.含税总额 = (Number(scope.row.数量) * Number(scope.row.单价)).toFixed(2) : scope.row.含税总额 = (scope.row.未税总额 * (1+taxRate)).toFixed(2) }}
@@ -669,6 +692,8 @@ export default {
name: '', // 离线合同
data() {
return {
+ hasTax: '含税',
+ taxRate: 0.13,
source: [
{
text: 'BZ',
@@ -1052,7 +1077,10 @@ export default {
searchMateriel(this.offlineContractNum).then(response => {
this.tableData3 = response.data
this.tableData3.map(v => {
+ this.$set(v, '未税总额', 0)
+ this.$set(v, '含税总额', 0)
!v.单价 ? v.单价 = v.参考价格 : v.单价
+ this.$set(v, '未税单价', v.单价 / (1 + this.taxRate))
})
})
} else { this.$message.error('数据占用,删除失败') }
@@ -1124,7 +1152,10 @@ export default {
console.log(response.data)
this.tableData3 = response.data
this.tableData3.map(v => {
+ this.$set(v, '未税总额', 0)
+ this.$set(v, '含税总额', 0)
!v.单价 ? v.单价 = v.参考价格 : v.单价
+ this.$set(v, '未税单价', v.单价 / (1 + this.taxRate))
})
})
Number(row.离线合同状态) !== 1 ? this.disable = true : this.disable = false // 是否为编辑模式
@@ -1135,8 +1166,23 @@ export default {
columns.forEach((column, index) => {
if (index === 0) {
sums[index] = '总价'
- } else if (index === 7) {
- const values = data.map(item => Number(Number(item['单价']) * Number(item['数量'])))
+ } else if (index === 9) {
+ const values = data.map(item => Number(item['未税总额']))
+ if (!values.every(value => isNaN(value))) {
+ sums[index] = values.reduce((prev, curr) => {
+ const value = Number(curr)
+ if (!isNaN(value)) {
+ return Number((prev + curr).toFixed(2))
+ } else {
+ return Number((prev).toFixed(2))
+ }
+ }, 0)
+ sums[index] += ' 元'
+ } else {
+ sums[index] = 'N/A'
+ }
+ } else if (index === 10) {
+ const values = data.map(item => Number(item['含税总额']))
if (!values.every(value => isNaN(value))) {
sums[index] = values.reduce((prev, curr) => {
const value = Number(curr)
@@ -1168,7 +1214,10 @@ export default {
searchMateriel(this.offlineContractNum).then(response => {
this.tableData3 = response.data
this.tableData3.map(v => {
+ this.$set(v, '未税总额', 0)
+ this.$set(v, '含税总额', 0)
!v.单价 ? v.单价 = v.参考价格 : v.单价
+ this.$set(v, '未税单价', v.单价 / (1 + this.taxRate))
})
})
} else { this.$message.error('选入失败') }
@@ -1187,7 +1236,10 @@ export default {
searchMateriel(this.offlineContractNum).then(response => {
this.tableData3 = response.data
this.tableData3.map(v => {
+ this.$set(v, '未税总额', 0)
+ this.$set(v, '含税总额', 0)
!v.单价 ? v.单价 = v.参考价格 : v.单价
+ this.$set(v, '未税单价', v.单价 / (1 + this.taxRate))
})
})
} else { this.$message.error('移除失败') }
@@ -1215,18 +1267,21 @@ export default {
this.totalPrice += this.tableData3[i].数量 * this.tableData3[i].单价
this.partGroup.push(this.tableData3[i].离线合同明细流水号)
this.numGroup.push(this.tableData3[i].数量)
- this.priceGroup.push(this.tableData3[i].单价)
+ this.hasTax === '含税' ? this.priceGroup.push(this.tableData3[i].单价) : this.priceGroup.push(this.tableData3[i].未税单价 * (1 + this.taxRate))
dateGroup.push(this.tableData3[i].交货期要求)
remarkGroup.push(this.tableData3[i].备注)
}
- saveOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup).then(response => {
+ saveOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup, this.taxRate * 100).then(response => {
if (response.data[0].result === '1') {
this.$message.success('离线合同保存成功')
this.searchTable2()
searchMateriel(this.offlineContractNum).then(response => {
this.tableData3 = response.data
this.tableData3.map(v => {
+ this.$set(v, '未税总额', 0)
+ this.$set(v, '含税总额', 0)
!v.单价 ? v.单价 = v.参考价格 : v.单价
+ this.$set(v, '未税单价', v.单价 / (1 + this.taxRate))
})
})
} else { this.$message.error('离线合同保存失败') }
@@ -1254,18 +1309,21 @@ export default {
this.totalPrice += this.tableData3[i].数量 * this.tableData3[i].单价
this.partGroup.push(this.tableData3[i].离线合同明细流水号)
this.numGroup.push(this.tableData3[i].数量)
- this.priceGroup.push(this.tableData3[i].单价)
+ this.hasTax === '含税' ? this.priceGroup.push(this.tableData3[i].单价) : this.priceGroup.push(this.tableData3[i].未税单价 * (1 + this.taxRate))
dateGroup.push(this.tableData3[i].交货期要求)
remarkGroup.push(this.tableData3[i].备注)
}
- doneOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup).then(response => {
+ doneOfflineContact(this.offlineContractNum, this.totalPrice, this.partGroup, this.numGroup, this.priceGroup, dateGroup, remarkGroup, this.taxRate * 100).then(response => {
if (response.data[0].result === '1') {
this.$message.success('离线合同生成成功')
this.searchTable2()
searchMateriel(this.offlineContractNum).then(response => {
this.tableData3 = response.data
this.tableData3.map(v => {
+ this.$set(v, '未税总额', 0)
+ this.$set(v, '含税总额', 0)
!v.单价 ? v.单价 = v.参考价格 : v.单价
+ this.$set(v, '未税单价', v.单价 / (1 + this.taxRate))
})
this.disable = true // 是否为编辑模式
})