Browse Source

feat(order): 在订单模块中添加供应商价格表功能

- 在PO订单页面添加查看价格表按钮
- 新增供应商可供物料价格表弹窗组件
- 实现按供应商和物料编码查询阶梯价格功能
- 添加价格表表格展示数量范围、单价、价格日期等信息
- 在表格操作列中添加查看价格按钮
- 实现价格表数据加载和错误处理逻辑
- 移除SKU管理中的冗余提示信息
master
qiankanghui 1 month ago
parent
commit
9ca64029a2
  1. 122
      src/views/modules/order/poOrder.vue
  2. 4
      src/views/modules/srmPart/partInfoList.vue

122
src/views/modules/order/poOrder.vue

@ -24,6 +24,7 @@
</el-button>
<el-button v-if="editMode" style="margin-left: 2px" @click="cancelEditMode">取消</el-button>
<el-button type="primary" style="margin-left: 2px" @click="openAddDialog" v-if="!editMode">新增</el-button>
<el-button type="primary" plain style="margin-left: 2px" @click="openCurrentRowPriceDialog" v-if="!editMode" :disabled="!currentRow">查看价格表</el-button>
</el-form-item>
</el-form>
<el-table
@ -676,11 +677,59 @@
<el-table-column prop="partDesc" label="物料描述" min-width="220" header-align="center" align="left" show-overflow-tooltip />
<el-table-column prop="item" label="Item" min-width="120" header-align="center" align="center" show-overflow-tooltip />
<el-table-column prop="sku" label="SKU" min-width="120" header-align="center" align="center" show-overflow-tooltip />
<el-table-column label="操作" width="110" header-align="center" align="center">
<template slot-scope="scope">
<el-button
type="text"
size="small"
@click.stop="openSupplierPartPriceDialog(scope.row)">查看价格</el-button>
</template>
</el-table-column>
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="supplierPartDialogVisible = false">关闭</el-button>
</div>
</el-dialog>
<!--
模态框 #6:供应商可供物料价格表弹窗
用途:按供应商 + 物料编码查询当前生效阶梯价并展示
关联状态:
supplierPartPriceDialogVisible / supplierPartPriceDialogRows / supplierPartPriceDialogLoading
supplierPartPriceDialogPartNo / supplierPartPriceDialogSupplierNo
-->
<el-dialog
title="供应商可供物料价格表"
v-drag
:visible.sync="supplierPartPriceDialogVisible"
width="680px"
top="8vh"
append-to-body
:close-on-click-modal="false"
@closed="resetSupplierPartPriceDialog">
<div style="margin-bottom: 10px; color: #606266;">
<span>供应商:{{ supplierPartPriceDialogSupplierNo }}</span>
<span style="margin-left: 16px;">物料编码:{{ supplierPartPriceDialogPartNo }}</span>
</div>
<el-table
:data="supplierPartPriceDialogRows"
:height="360"
border
stripe
v-loading="supplierPartPriceDialogLoading"
empty-text="该供应商物料未维护价格表">
<el-table-column prop="qtyStart" label="数量起" min-width="100" header-align="center" align="center" />
<el-table-column label="数量止" min-width="100" header-align="center" align="center">
<template slot-scope="scope">{{ scope.row.qtyEnd === null || scope.row.qtyEnd === undefined || scope.row.qtyEnd === '' ? '∞' : scope.row.qtyEnd }}</template>
</el-table-column>
<el-table-column prop="unitPrice" label="单价" min-width="100" header-align="center" align="center" />
<el-table-column prop="priceDate" label="价格日期" min-width="120" header-align="center" align="center" />
<el-table-column prop="remark" label="备注" min-width="160" header-align="center" align="left" show-overflow-tooltip />
</el-table>
<div slot="footer" class="dialog-footer">
<el-button @click="supplierPartPriceDialogVisible = false">关闭</el-button>
</div>
</el-dialog>
</div>
</template>
@ -953,6 +1002,12 @@ export default {
supplierPartDialogSupplierNo: '',
supplierPartDialogSite: '',
supplierPartDialogItemFilter: '',
// 供应商可供物料价格表弹窗状态
supplierPartPriceDialogVisible: false,
supplierPartPriceDialogLoading: false,
supplierPartPriceDialogRows: [],
supplierPartPriceDialogPartNo: '',
supplierPartPriceDialogSupplierNo: '',
addPriceLookupTimer: null,
addPriceLookupSeq: 0,
selectedCustomerScope: null,
@ -4052,6 +4107,73 @@ export default {
this.supplierPartDialogSite = ''
this.supplierPartDialogItemFilter = ''
},
// 打开供应商可供物料价格表弹窗:按当前供应商 + 行物料编码查当前生效阶梯价
openSupplierPartPriceDialog (row) {
if (!row) {
return
}
const site = this.supplierPartDialogSite
const supplierCode = this.supplierPartDialogSupplierNo
const partNo = String(row.partNo || '').trim()
if (!site || !supplierCode || !partNo) {
this.$message.warning('缺少供应商或物料编码,无法查询价格')
return
}
this.loadSupplierPartPriceDialog({ site, supplierCode, partNo })
},
// 主页面:查看当前选中行(供应商 + 物料)的价格表
openCurrentRowPriceDialog () {
const row = this.currentRow
if (!row) {
this.$message.warning('请先选择一行数据')
return
}
const site = String(row.site || this.$store.state.user.site || '').trim()
const supplierCode = String(row.supplierNo || row.supplier_no || row.supplierCode || row.supplier_code || '').trim()
const partNo = String(row.partNo || row.part_no || '').trim()
if (!site || !supplierCode || !partNo) {
this.$message.warning('当前行缺少供应商或物料编码,无法查询价格')
return
}
this.loadSupplierPartPriceDialog({ site, supplierCode, partNo })
},
// 共用的阶梯价加载:拉取当前生效阶梯价并渲染到价格弹窗
loadSupplierPartPriceDialog ({ site, supplierCode, partNo }) {
this.supplierPartPriceDialogPartNo = partNo
this.supplierPartPriceDialogSupplierNo = supplierCode
this.supplierPartPriceDialogRows = []
this.supplierPartPriceDialogVisible = true
this.supplierPartPriceDialogLoading = true
listPoCurrentTierPrice({
site,
supplierCode,
partNo
}).then(({ data }) => {
if (data && data.code === 0) {
this.supplierPartPriceDialogRows = (data.rows || []).map(item => ({
qtyStart: (item.qtyStart === null || item.qtyStart === undefined) ? '' : item.qtyStart,
qtyEnd: (item.qtyEnd === null || item.qtyEnd === undefined) ? '' : item.qtyEnd,
unitPrice: (item.unitPrice === null || item.unitPrice === undefined) ? '' : item.unitPrice,
priceDate: item.priceDate || '',
remark: item.remark || ''
}))
return
}
this.supplierPartPriceDialogRows = []
this.$message.error((data && data.msg) || '获取供应商价格表失败')
}).catch(() => {
this.supplierPartPriceDialogRows = []
this.$message.error('获取供应商价格表失败')
}).finally(() => {
this.supplierPartPriceDialogLoading = false
})
},
resetSupplierPartPriceDialog () {
this.supplierPartPriceDialogLoading = false
this.supplierPartPriceDialogRows = []
this.supplierPartPriceDialogPartNo = ''
this.supplierPartPriceDialogSupplierNo = ''
},
resolveAddOrderTypeByCustomer () {
const customerOrderType = this.selectedCustomerScope && this.selectedCustomerScope.orderType

4
src/views/modules/srmPart/partInfoList.vue

@ -1863,11 +1863,11 @@ export default {
msg = `SKU ${sku} 已在 SKU 管理中维护基准料号 ${data.dbBasePartNo},与本次的基准料号不一致。`
}
if (skipNavigation) {
this.$message.error(`${msg}基准料号与 SKU 需一一对应,请先到 SKU 管理页手动维护后再指定。`)
this.$message.error(`${msg}请先到 SKU 管理页手动维护后再指定。`)
return
}
this.$confirm(
`${msg}基准料号与 SKU 需一一对应,是否前往 SKU 管理页手动维护?前往后将不再保存本次新增。`,
`${msg}是否前往 SKU 管理页手动维护?前往后将不再保存本次新增。`,
'SKU与基准料号冲突',
{
confirmButtonText: '是',

Loading…
Cancel
Save