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.
538 lines
22 KiB
538 lines
22 KiB
<template>
|
|
<div class="customer-css">
|
|
<el-form :inline="true" label-position="top" :model="searchData">
|
|
<el-form-item label="产品编码">
|
|
<el-input v-model="searchData.partNo" clearable style="width: 150px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="物料名称">
|
|
<el-input v-model="searchData.partDesc" clearable style="width: 150px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label="状态">
|
|
<el-input v-model="searchData.remark1" clearable style="width: 120px"></el-input>
|
|
</el-form-item>
|
|
<el-form-item label=" ">
|
|
<el-button type="primary" @click="searchTable()">查询</el-button>
|
|
<!-- <el-button type="primary" @click="addModal()" v-if="shouldShowButton">新增</el-button> -->
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<el-table
|
|
:data="dataList"
|
|
:height="searchData.height"
|
|
border
|
|
v-loading="dataListLoading"
|
|
style="width: 100%;">
|
|
<el-table-column
|
|
v-for="(item, index) in columnList"
|
|
:key="index"
|
|
:sortable="item.columnSortable"
|
|
:prop="item.columnProp"
|
|
:header-align="item.headerAlign"
|
|
:show-overflow-tooltip="item.showOverflowTooltip"
|
|
:align="item.align"
|
|
:fixed="item.fixed == '' ? false : item.fixed"
|
|
:min-width="item.columnWidth"
|
|
:label="item.columnLabel">
|
|
<template slot-scope="scope">
|
|
<span v-if="!item.columnHidden">{{ formatColumn(scope.row, item) }}</span>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column
|
|
fixed="right"
|
|
header-align="center"
|
|
align="center"
|
|
width="100"
|
|
label="操作">
|
|
<template slot-scope="scope">
|
|
<el-link style="cursor: pointer" @click="openPriceSheet(scope.row)">价格表查询</el-link>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
|
|
<!-- 新增/编辑弹窗 -->
|
|
<el-dialog :title="dialogTitle" :close-on-click-modal="false" v-drag :visible.sync="dialogVisible" width="900px">
|
|
<div class="dialog-content">
|
|
<el-form label-position="top" :model="formData" :rules="formRules" ref="formRef">
|
|
<el-row :gutter="20">
|
|
<el-col :span="8">
|
|
<el-form-item label="产品编码" prop="partNo">
|
|
<el-input v-model="formData.partNo" placeholder="请输入产品编码"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="物料名称" prop="partDesc">
|
|
<el-input v-model="formData.partDesc" placeholder="请输入物料名称"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="计量单位" prop="umid">
|
|
<el-input v-model="formData.umid" placeholder="请输入计量单位"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="8">
|
|
<el-form-item label="询价数量" prop="qty">
|
|
<el-input v-model="formData.qty" type="number" placeholder="请输入询价数量"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="状态" prop="remark1">
|
|
<el-select v-model="formData.remark1" placeholder="请选择状态" clearable style="width: 100%">
|
|
<el-option label="询价中" value="询价中"></el-option>
|
|
<el-option label="报价中" value="报价中"></el-option>
|
|
<el-option label="已完成" value="已完成"></el-option>
|
|
<el-option label="已取消" value="已取消"></el-option>
|
|
</el-select>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="材料费用" prop="materialCost">
|
|
<el-input v-model="formData.materialCost" type="number" placeholder="请输入材料费用"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="8">
|
|
<el-form-item label="加工费" prop="produceFee">
|
|
<el-input v-model="formData.produceFee" type="number" placeholder="请输入加工费"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="表面处理费" prop="surfaceFee">
|
|
<el-input v-model="formData.surfaceFee" type="number" placeholder="请输入表面处理费"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="利润" prop="profit">
|
|
<el-input v-model="formData.profit" type="number" placeholder="请输入利润"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="8">
|
|
<el-form-item label="未税单价" prop="price">
|
|
<el-input v-model="formData.price" type="number" placeholder="请输入未税单价"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="税率(%)" prop="taxRate">
|
|
<el-input v-model="formData.taxRate" type="number" placeholder="请输入税率"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="含税单价" prop="tax">
|
|
<el-input v-model="formData.tax" type="number" placeholder="请输入含税单价"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="8">
|
|
<el-form-item label="关税" prop="duty">
|
|
<el-input v-model="formData.duty" type="number" placeholder="请输入关税"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="采购周期(天)" prop="purchaseCycle">
|
|
<el-input v-model="formData.purchaseCycle" type="number" placeholder="请输入采购周期"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="模具费" prop="mouldFee">
|
|
<el-input v-model="formData.mouldFee" type="number" placeholder="请输入模具费"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="8">
|
|
<el-form-item label="附加费用" prop="additionalCost">
|
|
<el-input v-model="formData.additionalCost" type="number" placeholder="请输入附加费用"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="运费" prop="freight">
|
|
<el-input v-model="formData.freight" type="number" placeholder="请输入运费"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
<el-col :span="8">
|
|
<el-form-item label="报价日期" prop="createdDate">
|
|
<el-date-picker v-model="formData.createdDate" type="date" placeholder="选择日期" value-format="yyyy-MM-dd" style="width: 100%"></el-date-picker>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
<el-row :gutter="20">
|
|
<el-col :span="24">
|
|
<el-form-item label="备注" prop="remark">
|
|
<el-input type="textarea" :rows="3" v-model="formData.remark" placeholder="请输入备注"></el-input>
|
|
</el-form-item>
|
|
</el-col>
|
|
</el-row>
|
|
</el-form>
|
|
</div>
|
|
<div slot="footer" class="dialog-footer" style="margin-top: 20px">
|
|
<el-button type="primary" @click="submitData()">保存</el-button>
|
|
<el-button @click="dialogVisible = false">取消</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
|
|
<el-dialog
|
|
title="价格表查询"
|
|
:visible.sync="priceSheetDialogVisible"
|
|
width="700px"
|
|
:close-on-click-modal="false"
|
|
v-drag
|
|
append-to-body
|
|
>
|
|
<el-form :inline="true" label-position="top" class="price-sheet-header-form">
|
|
<el-form-item label="产品编码">
|
|
<el-input :value="displayText(priceSheetHeader.partNo)" disabled style="width: 140px" />
|
|
</el-form-item>
|
|
<el-form-item label="物料名称">
|
|
<el-input :value="displayText(priceSheetHeader.partDesc)" disabled style="width: 180px" />
|
|
</el-form-item>
|
|
<el-form-item label="价格日期">
|
|
<el-input :value="displayText(formatDateOnly(priceSheetHeader.priceDate))" disabled style="width: 120px" />
|
|
</el-form-item>
|
|
<el-form-item label="供应商编码">
|
|
<el-input :value="displayText(priceSheetHeader.supplierId)" disabled style="width: 120px" />
|
|
</el-form-item>
|
|
<el-form-item label="供应商名称">
|
|
<el-input :value="displayText(priceSheetHeader.supplierName)" disabled style="width: 160px" />
|
|
</el-form-item>
|
|
<el-form-item label="币种">
|
|
<el-input :value="displayText(priceSheetHeader.currency)" disabled style="width: 70px" />
|
|
</el-form-item>
|
|
</el-form>
|
|
|
|
<el-table
|
|
:data="priceSheetDetailList"
|
|
:height="320"
|
|
border
|
|
stripe
|
|
v-loading="priceSheetLoading"
|
|
style="width: 100%"
|
|
>
|
|
<el-table-column prop="qtyStart" label="开始数量" min-width="110" header-align="center" align="right">
|
|
<template slot-scope="scope">
|
|
{{ formatNumber(scope.row.qtyStart) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="qtyEnd" label="结束数量" min-width="110" header-align="center" align="right">
|
|
<template slot-scope="scope">
|
|
{{ formatNumber(scope.row.qtyEnd) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="unitPrice" label="价格" min-width="120" header-align="center" align="right">
|
|
<template slot-scope="scope">
|
|
{{ formatNumber(scope.row.unitPrice) }}
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column prop="remark" label="备注" min-width="200" header-align="center" align="left" show-overflow-tooltip />
|
|
</el-table>
|
|
<div slot="footer" class="dialog-footer">
|
|
<el-button type="primary" @click="priceSheetDialogVisible = false">关闭</el-button>
|
|
</div>
|
|
</el-dialog>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
// 请根据实际API路径调整导入
|
|
import {
|
|
getPurReplyPriceSheet,
|
|
searchPurReplyHistList
|
|
} from '@/api/supplier/purReplyHist.js'
|
|
import { formatPartColumn } from '@/utils/purQuotationPartDisplay.js'
|
|
|
|
export default {
|
|
name: 'QuotationRecord',
|
|
data() {
|
|
return {
|
|
dataList: [],
|
|
dataListLoading: false,
|
|
searchData: {
|
|
partNo: '',
|
|
partDesc: '',
|
|
remark1: '',
|
|
height: '200',
|
|
page: 1,
|
|
limit: 1000
|
|
},
|
|
type: 'add', // 假设类型
|
|
dialogVisible: false,
|
|
dialogTitle: '新增报价记录',
|
|
formData: {
|
|
id: '',
|
|
partNo: '',
|
|
partDesc: '',
|
|
umid: '',
|
|
qty: '',
|
|
remark1: '',
|
|
materialCost: '',
|
|
produceFee: '',
|
|
surfaceFee: '',
|
|
profit: '',
|
|
price: '',
|
|
taxRate: '',
|
|
tax: '',
|
|
duty: '',
|
|
purchaseCycle: '',
|
|
mouldFee: '',
|
|
additionalCost: '',
|
|
freight: '',
|
|
createdDate: '',
|
|
remark: '',
|
|
createdBy: ''
|
|
},
|
|
formRules: {
|
|
partNo: [{ required: true, message: '请输入产品编码', trigger: 'blur' }]
|
|
},
|
|
priceSheetDialogVisible: false,
|
|
priceSheetLoading: false,
|
|
priceSheetHeader: {
|
|
quotationReplyHistId: null,
|
|
partNo: '',
|
|
partDesc: '',
|
|
priceDate: '',
|
|
supplierId: '',
|
|
supplierName: '',
|
|
currency: ''
|
|
},
|
|
priceSheetDetailList: [],
|
|
columnList: [
|
|
{ columnProp: 'partNo', headerAlign: 'center', align: 'left', columnLabel: '产品编码', columnWidth: 120, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'partDesc', headerAlign: 'center', align: 'left', columnLabel: '物料名称', columnWidth: 150, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'partNoOri', headerAlign: 'center', align: 'left', columnLabel: '临时编码', columnWidth: 120, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'partDescOri', headerAlign: 'center', align: 'left', columnLabel: '临时名称', columnWidth: 150, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'umid', headerAlign: 'center', align: 'center', columnLabel: '计量单位', columnWidth: 90, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'qty', headerAlign: 'center', align: 'right', columnLabel: '询价数量', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
|
|
// { columnProp: 'remark1', headerAlign: 'center', align: 'center', columnLabel: '状态', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'materialCost', headerAlign: 'center', align: 'right', columnLabel: '材料费用', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'produceFee', headerAlign: 'center', align: 'right', columnLabel: '加工费', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'surfaceFee', headerAlign: 'center', align: 'right', columnLabel: '表面处理费', columnWidth: 110, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'profit', headerAlign: 'center', align: 'right', columnLabel: '利润', columnWidth: 90, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'price', headerAlign: 'center', align: 'right', columnLabel: '未税单价', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'taxRate', headerAlign: 'center', align: 'right', columnLabel: '税率', columnWidth: 80, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'tax', headerAlign: 'center', align: 'right', columnLabel: '含税单价', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'duty', headerAlign: 'center', align: 'right', columnLabel: '关税', columnWidth: 90, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'purchaseCycle', headerAlign: 'center', align: 'center', columnLabel: '采购周期', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'mouldFee', headerAlign: 'center', align: 'right', columnLabel: '模具费', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'additionalCost', headerAlign: 'center', align: 'right', columnLabel: '附加费用', columnWidth: 100, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'freight', headerAlign: 'center', align: 'right', columnLabel: '运费', columnWidth: 90, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'createdDate', headerAlign: 'center', align: 'center', columnLabel: '报价日期', columnWidth: 120, fixed: '', columnHidden: false, columnSortable: true },
|
|
{ columnProp: 'remark', headerAlign: 'center', align: 'left', columnLabel: '备注', columnWidth: 180, fixed: '', columnHidden: false, columnSortable: false },
|
|
{ columnProp: 'createdBy', headerAlign: 'center', align: 'center', columnLabel: '最近更改人', columnWidth: 120, fixed: '', columnHidden: false, columnSortable: false }
|
|
]
|
|
}
|
|
},
|
|
computed: {
|
|
shouldShowButton() {
|
|
// 根据类型返回布尔值
|
|
return this.type === 'add';
|
|
}
|
|
},
|
|
methods: {
|
|
formatColumn(row, item) {
|
|
return formatPartColumn(row, item.columnProp)
|
|
},
|
|
displayText(value) {
|
|
if (value === null || value === undefined || value === '') {
|
|
return '-'
|
|
}
|
|
return value
|
|
},
|
|
formatDateOnly(value) {
|
|
if (!value) return ''
|
|
if (typeof value === 'string') {
|
|
return value.length >= 10 ? value.slice(0, 10) : value
|
|
}
|
|
const date = new Date(value)
|
|
if (Number.isNaN(date.getTime())) {
|
|
return ''
|
|
}
|
|
const pad = num => String(num).padStart(2, '0')
|
|
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`
|
|
},
|
|
formatNumber(value) {
|
|
if (value === null || value === undefined || value === '') {
|
|
return '0'
|
|
}
|
|
const num = Number(value)
|
|
if (Number.isNaN(num)) {
|
|
return '0'
|
|
}
|
|
return String(Object.is(num, -0) ? 0 : num)
|
|
},
|
|
openPriceSheet(row) {
|
|
if (!row || !row.id) {
|
|
this.$message.warning('当前报价记录缺少主键,无法查询价格表')
|
|
return
|
|
}
|
|
const params = {
|
|
site: this.$store.state.user.site,
|
|
quotationReplyHistId: row.id
|
|
}
|
|
this.priceSheetDialogVisible = true
|
|
this.priceSheetLoading = true
|
|
this.priceSheetHeader = {
|
|
quotationReplyHistId: row.id,
|
|
partNo: row.partNo || '',
|
|
partDesc: row.partDesc || '',
|
|
priceDate: row.createdDate || '',
|
|
supplierId: '',
|
|
supplierName: '',
|
|
currency: ''
|
|
}
|
|
this.priceSheetDetailList = []
|
|
getPurReplyPriceSheet(params).then(({ data }) => {
|
|
if (data && data.code === 0 && data.row) {
|
|
const responseRow = data.row
|
|
this.priceSheetHeader = {
|
|
quotationReplyHistId: responseRow.quotationReplyHistId || row.id,
|
|
partNo: responseRow.partNo || row.partNo || '',
|
|
partDesc: responseRow.partDesc || row.partDesc || '',
|
|
priceDate: responseRow.priceDate || row.createdDate || '',
|
|
supplierId: responseRow.supplierId || '',
|
|
supplierName: responseRow.supplierName || '',
|
|
currency: responseRow.currency || ''
|
|
}
|
|
this.priceSheetDetailList = responseRow.tierPriceList || []
|
|
} else {
|
|
this.priceSheetDetailList = []
|
|
this.$message.error((data && data.msg) || '获取价格表失败')
|
|
}
|
|
this.priceSheetLoading = false
|
|
}).catch(() => {
|
|
this.priceSheetLoading = false
|
|
this.priceSheetDetailList = []
|
|
this.$message.error('获取价格表失败')
|
|
})
|
|
},
|
|
// 初始化方法,供父组件调用
|
|
init(inData) {
|
|
if (inData) {
|
|
this.searchData = { ...this.searchData, ...inData }
|
|
}
|
|
this.searchTable()
|
|
},
|
|
// 查询列表
|
|
searchTable() {
|
|
this.dataListLoading = true
|
|
// TODO: 请替换为实际接口调用
|
|
searchPurReplyHistList(this.searchData).then(({ data }) => {
|
|
if (data && data.code === 0) {
|
|
this.dataList = data.rows
|
|
} else {
|
|
this.dataList = []
|
|
}
|
|
this.dataListLoading = false
|
|
})
|
|
|
|
},
|
|
// 新增
|
|
addModal() {
|
|
this.dialogTitle = '新增报价记录'
|
|
this.formData = {
|
|
id: '',
|
|
partNo: '',
|
|
partDesc: '',
|
|
umid: '',
|
|
qty: '',
|
|
remark1: '',
|
|
materialCost: '',
|
|
produceFee: '',
|
|
surfaceFee: '',
|
|
profit: '',
|
|
price: '',
|
|
taxRate: '',
|
|
tax: '',
|
|
duty: '',
|
|
purchaseCycle: '',
|
|
mouldFee: '',
|
|
additionalCost: '',
|
|
freight: '',
|
|
createdDate: '',
|
|
remark: '',
|
|
createdBy: (this.$store && this.$store.state && this.$store.state.user && this.$store.state.user.name) || ''
|
|
}
|
|
this.dialogVisible = true
|
|
this.$nextTick(() => {
|
|
if (this.$refs.formRef) {
|
|
this.$refs.formRef.clearValidate()
|
|
}
|
|
})
|
|
},
|
|
// 编辑
|
|
editModel(row) {
|
|
this.dialogTitle = '编辑报价记录'
|
|
this.formData = JSON.parse(JSON.stringify(row))
|
|
this.dialogVisible = true
|
|
this.$nextTick(() => {
|
|
if (this.$refs.formRef) {
|
|
this.$refs.formRef.clearValidate()
|
|
}
|
|
})
|
|
},
|
|
// 提交保存
|
|
submitData() {
|
|
this.$refs.formRef.validate((valid) => {
|
|
if (!valid) return
|
|
|
|
// TODO: 请替换为实际接口调用
|
|
// const api = this.formData.id ? updateQuotation : createQuotation
|
|
// api(this.formData).then(({ data }) => {
|
|
// if (data && data.code === 0) {
|
|
// this.$message.success(data.msg)
|
|
// this.dialogVisible = false
|
|
// this.searchTable()
|
|
// } else {
|
|
// this.$message.warning(data.msg)
|
|
// }
|
|
// })
|
|
|
|
// 模拟保存,实际使用时请删除
|
|
this.$message.success('保存成功')
|
|
this.dialogVisible = false
|
|
this.searchTable()
|
|
})
|
|
},
|
|
// 删除
|
|
deleteData(row) {
|
|
this.$confirm('确认删除该条报价记录吗?', '提示', {
|
|
confirmButtonText: '确认',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
// TODO: 请替换为实际接口调用
|
|
// deleteQuotation(row.id).then(({ data }) => {
|
|
// if (data.code === 0) {
|
|
// this.$message.success('删除成功')
|
|
// this.searchTable()
|
|
// }
|
|
// })
|
|
|
|
// 模拟删除,实际使用时请删除
|
|
this.$message.success('删除成功')
|
|
this.searchTable()
|
|
}).catch(() => {})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style scoped lang="scss">
|
|
.dialog-content {
|
|
width: 100%;
|
|
max-height: 60vh;
|
|
overflow-y: auto;
|
|
padding-right: 10px;
|
|
}
|
|
|
|
.customer-css {
|
|
padding: 10px;
|
|
}
|
|
|
|
.price-sheet-header-form {
|
|
margin-bottom: 8px;
|
|
}
|
|
</style>
|