|
|
@@ -41,7 +41,7 @@
|
|
|
<el-input
|
|
|
placeholder=""
|
|
|
v-model="row.receiveQuantity"
|
|
|
- :disabled="type == 'receipt' && itemData.sendStatus == 4"
|
|
|
+ :disabled="type == 'receipt' && (itemData.sendStatus == 4 || itemData.sendStatus == 3)"
|
|
|
>
|
|
|
<template slot="append">{{ row.measuringUnit }}</template>
|
|
|
</el-input>
|
|
|
@@ -50,6 +50,16 @@
|
|
|
<template v-slot:rootCategoryLevelId="{ row }">
|
|
|
<el-tag>{{ typeName[Number(row.rootCategoryLevelId)] }}</el-tag>
|
|
|
</template>
|
|
|
+
|
|
|
+ <template v-slot:status="{ row }">
|
|
|
+ <el-tag :type="getStatusInfo(row.status).type">
|
|
|
+ {{ getStatusInfo(row.status).label }}
|
|
|
+ </el-tag>
|
|
|
+ </template>
|
|
|
+
|
|
|
+ <template v-slot:isMeasuring="{ row }">
|
|
|
+ <span>{{ row.isMeasuring == 1 ? "是" : "否"}}</span>
|
|
|
+ </template>
|
|
|
</ele-pro-table>
|
|
|
|
|
|
<template v-slot:footer v-if="type != 'detail' && itemData.sendStatus != 4">
|
|
|
@@ -89,8 +99,18 @@
|
|
|
id: '',
|
|
|
title: '',
|
|
|
type: '',
|
|
|
+ isReceiptDetail: true,
|
|
|
itemData: {},
|
|
|
- loading: null
|
|
|
+ loading: null,
|
|
|
+ // 在制品发货状态:键为后端 status,值为 el-tag 显示配置
|
|
|
+ statusMap: {
|
|
|
+ 0: { label: '待发货', type: 'info' },
|
|
|
+ 1: { label: '已发货', type: 'success' },
|
|
|
+ 2: { label: '已收货', type: 'success' },
|
|
|
+ 7: { label: '部分发货', type: 'success' },
|
|
|
+ 8: { label: '部分收货', type: 'success' },
|
|
|
+ 9: { label: '部分驳回', type: 'success' }
|
|
|
+ }
|
|
|
};
|
|
|
},
|
|
|
|
|
|
@@ -195,27 +215,68 @@
|
|
|
label: '类型',
|
|
|
align: 'center',
|
|
|
showOverflowTooltip: true
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'status',
|
|
|
+ slot: 'status',
|
|
|
+ label: '状态',
|
|
|
+ align: 'center',
|
|
|
+ minWidth: 110,
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ show: this.type == 'detail' ? true : false
|
|
|
+ },
|
|
|
+ {
|
|
|
+ prop: 'isMeasuring',
|
|
|
+ slot: 'isMeasuring',
|
|
|
+ label: '是否收货',
|
|
|
+ align: 'center',
|
|
|
+ showOverflowTooltip: true,
|
|
|
+ show: this.type == 'receipt' && !this.isReceiptDetail ? true : false
|
|
|
}
|
|
|
];
|
|
|
}
|
|
|
},
|
|
|
|
|
|
methods: {
|
|
|
- open(item, type) {
|
|
|
+ // 根据后端 status 返回对应的展示文案和 el-tag 类型,未匹配时回落为驳回
|
|
|
+ getStatusInfo(status) {
|
|
|
+ return this.statusMap[Number(status)] || { label: '驳回', type: 'success' };
|
|
|
+ },
|
|
|
+
|
|
|
+ open(item, type, detailType) {
|
|
|
this.visible = true;
|
|
|
this.type = type;
|
|
|
this.title = this.type != 'receipt' ? '发货单' : '收货单';
|
|
|
this.itemData = item;
|
|
|
this.id = item.id;
|
|
|
- this.getDetail(item.id);
|
|
|
+ // 重置 isReceiptDetail:仅当 type 为 receipt 且传入了 detailType 时,才是收货操作(false)
|
|
|
+ // 其余情况(收货详情、发货、详情等)保持为 true
|
|
|
+ this.isReceiptDetail = !(type === 'receipt' && detailType);
|
|
|
+ this.getDetail(item.id, detailType);
|
|
|
},
|
|
|
|
|
|
- async getDetail(id) {
|
|
|
- const detailType = this.type == 'receipt' ? 2 : 1;
|
|
|
- await pleaseEntrustGoodsDetail({
|
|
|
+ async getDetail(id, type) {
|
|
|
+ let detailType = this.type == 'receipt' ? 2 : 1;
|
|
|
+ const params = {
|
|
|
id,
|
|
|
detailType
|
|
|
- }).then(async (res) => {
|
|
|
+ };
|
|
|
+ if(this.type === "detail") {
|
|
|
+ params.detailType = 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ //用type来区分收货详情与收货 存在type则是收货
|
|
|
+ if(this.type === "receipt") {
|
|
|
+ params.detailType = 4;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.type === 'receipt' && type) {
|
|
|
+ params.detailType = type;
|
|
|
+ params.status = 3;
|
|
|
+ // isReceiptDetail 在 open() 里已经重置,此处只处理 params
|
|
|
+ }
|
|
|
+
|
|
|
+ await pleaseEntrustGoodsDetail(params).then(async (res) => {
|
|
|
this.goodsList = [];
|
|
|
res.data.forEach((item) => {
|
|
|
if (this.type == 'receipt' && this.itemData.sendStatus != 4) {
|
|
|
@@ -291,10 +352,15 @@
|
|
|
|
|
|
chooseData(dataList) {
|
|
|
if (dataList.length === 0) return;
|
|
|
- this.goodsList = dataList.map((item) => {
|
|
|
- item.quantity = item.remainingDeliverableQuantity;
|
|
|
- return this.deepCopy(item);
|
|
|
- }).filter(item => item.quantity > 0);
|
|
|
+ this.goodsList = dataList
|
|
|
+ .map((item) => {
|
|
|
+ // 精度处理:后端 totalQuantity - quantity 会出现 6.9999999999 之类的浮点尾数
|
|
|
+ item.quantity = Number(
|
|
|
+ Number(item.remainingDeliverableQuantity || 0).toFixed(2)
|
|
|
+ );
|
|
|
+ return this.deepCopy(item);
|
|
|
+ })
|
|
|
+ .filter((item) => item.quantity > 0);
|
|
|
},
|
|
|
|
|
|
rejectReason() {},
|