离线合同

This commit is contained in:
zhangdingyu
2019-11-11 14:47:32 +08:00
parent 7d5b85b239
commit 20e285c397

View File

@@ -220,20 +220,19 @@
<el-input v-model="supplierName0" placeholder="供应商" size="small" style="width: 140px" clearable/>
<el-button type="success" size="small" icon="el-icon-search" style="margin-left: 10px" @click="pageCurrent2=1;pageSize2=10000;total2=0;searchTable2()">查询</el-button>
<el-tooltip :open-delay="1000" effect="dark" content="将勾选的物料库中物料选入到选中的离线合同" placement="top">
<el-button type="warning" size="small" style="margin-left: 10px" @click="addMateriel">选入物料</el-button>
<el-button type="warning" size="small" style="margin-left: 40px" @click="addMateriel">选入物料</el-button>
</el-tooltip>
<el-button type="primary" size="small" style="margin-left: 50px" @click="addOfflineContract">创建离线合同</el-button>
<el-tooltip :open-delay="1000" effect="dark" content="生成合同" placement="top">
<el-button :disabled="disable" type="success" size="mini" style="float:right;margin-left:10px" @click="doneOfflineContact">生成</el-button>
</el-tooltip>
<el-button :disabled="disable" type="info" size="mini" style="float:right" @click="saveContract">保存</el-button>
<!--<el-button :disabled="disable" type="info" size="mini" style="float:right" @click="saveContract">保存</el-button>-->
<el-tooltip :content="hasTax" placement="top">
<el-switch v-model="hasTax" active-color="#13ce66" inactive-color="#ff4949" active-value="含税" inactive-value="未税" style="margin: 3px;float:right"/>
</el-tooltip>
<el-input v-model="taxRate" style="float:right;width:100px" placeholder="税率" size="mini"/>
<el-input v-model="taxRate" style="float:right;width:100px;" placeholder="税率" size="mini"/>
<h4 style="float:right;width: 40px;margin: 5px">税率:</h4>
<el-tooltip :open-delay="1000" effect="dark" content="生成合同" placement="top">
<el-button :disabled="disable" type="success" size="small" style="float:right;margin-left:10px;margin-right: 10px" @click="doneOfflineContact">生成离线合同</el-button>
</el-tooltip>
<el-button type="primary" size="small" style="float:right;margin-left:10px;" @click="addOfflineContract">创建离线合同</el-button>
<!--<el-button v-if="quickChangePrice" size="mini" style="float:right; width: 100px" @click="quickChangePrice=!quickChangePrice">快速修改价格</el-button>-->
<!--<el-button v-else size="mini" style="float:right;" @click="quickChangePrice=!quickChangePrice">还原</el-button>-->
</div>
@@ -324,7 +323,7 @@
</el-table-column>
<el-table-column label="数量" align="center" min-width="100">
<template slot-scope="scope">
<el-input v-direction="{x: 0, y: scope.$index}" v-if="quickChangePrice" v-model="scope.row.数量" :disabled="disable" size="mini" style="width:60px"/>
<el-input v-direction="{x: 0, y: scope.$index}" v-if="quickChangePrice" v-model="scope.row.数量" :disabled="disable" size="mini" style="width:60px" @change="saveContract()"/>
<b v-else>{{ scope.row.数量 }}</b>
</template>
</el-table-column>
@@ -340,13 +339,13 @@
</el-table-column>
<el-table-column label="单价(未税)" align="center" width="110" prop="单价">
<template slot-scope="scope">
<el-input v-direction="{x: 1, y: scope.$index}" v-if="hasTax==='未税'" v-model="scope.row.未税单价" :disabled="disable" size="mini" style="width:70px"/>
<el-input v-direction="{x: 1, y: scope.$index}" v-if="hasTax==='未税'" v-model="scope.row.未税单价" :disabled="disable" size="mini" style="width:70px" @change="saveContract()"/>
<b v-show="hasTax!=='未税'">{{ (scope.row.单价 / (1 + taxRate)).toFixed(2) }}</b>
</template>
</el-table-column>
<el-table-column label="单价(含税)" align="center" min-width="140" prop="单价">
<template slot-scope="scope">
<el-input v-direction="{x: 1, y: scope.$index}" v-if="hasTax==='含税'" v-model="scope.row.单价" :disabled="disable" size="mini" style="width:120px"/>
<el-input v-direction="{x: 1, y: scope.$index}" v-if="hasTax==='含税'" v-model="scope.row.单价" :disabled="disable" size="mini" style="width:120px" @change="saveContract()"/>
<b v-show="hasTax!=='含税'">{{ (scope.row.未税单价 * (1 + taxRate)).toFixed(2) }}</b>
</template>
</el-table-column>
@@ -362,13 +361,13 @@
</el-table-column>
<el-table-column label="备注" align="center" min-width="140" prop="备注">
<template slot-scope="scope">
<el-input v-direction="{x: 3, y: scope.$index}" v-if="quickChangePrice" v-model="scope.row.备注" :disabled="disable" size="mini" style="width:120px"/>
<el-input v-direction="{x: 3, y: scope.$index}" v-if="quickChangePrice" v-model="scope.row.备注" :disabled="disable" size="mini" style="width:120px" @change="saveContract()"/>
<b v-else>{{ scope.row.备注 || '—' }}</b>
</template>
</el-table-column>
<el-table-column label="交货期" align="center" min-width="130" prop="交货期要求">
<template slot-scope="scope">
<el-input v-direction="{x: 2, y: scope.$index}" v-if="quickChangePrice" v-model="scope.row.交货期要求" :disabled="disable" size="mini" style="width:90px"/>
<el-input v-direction="{x: 2, y: scope.$index}" v-if="quickChangePrice" v-model="scope.row.交货期要求" :disabled="disable" size="mini" style="width:90px" @change="saveContract()"/>
<b v-else>{{ scope.row.交货期要求 || '—' }}</b>
</template>
</el-table-column>
@@ -1333,46 +1332,48 @@ export default {
})
},
saveContract() {
this.$confirm('确定保存合同?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.totalPrice = 0
this.partGroup = []
this.numGroup = []
this.priceGroup = []
const dateGroup = []
const remarkGroup = []
for (let i = 0; i < this.tableData3.length; i++) {
this.totalPrice += this.tableData3[i].数量 * this.tableData3[i].单价
this.partGroup.push(this.tableData3[i].离线合同明细流水号)
this.numGroup.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].备注)
console.log(11111)
this.totalPrice = 0
this.partGroup = []
this.numGroup = []
this.priceGroup = []
const dateGroup = []
const remarkGroup = []
for (let i = 0; i < this.tableData3.length; i++) {
this.totalPrice += this.tableData3[i].数量 * this.tableData3[i].单价
this.partGroup.push(this.tableData3[i].离线合同明细流水号)
this.numGroup.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, this.taxRate * 100).then(response => {
if (response.data[0].result !== '1') {
this.$message.error('离线合同保存失败')
// 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))
// })
// })
}
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('离线合同保存失败') }
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消操作'
})
})
// this.$confirm('确定保存合同?', '提示', {
// confirmButtonText: '确定',
// cancelButtonText: '取消',
// type: 'warning'
// }).then(() => {
// }).catch(() => {
// this.$message({
// type: 'info',
// message: '已取消操作'
// })
// })
},
doneOfflineContact() { // 生成离线合同
let judge = true