feat:增加换货单的逻辑,已发货短信模板更改

This commit is contained in:
一休哥哥6666
2026-06-15 13:42:52 +08:00
parent dfef98814b
commit 2991dd88bb
28 changed files with 575 additions and 628 deletions

View File

@@ -172,15 +172,6 @@
@click="handleQuickFilter('exchangeRejected')"
>拒绝换货申请</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
size="mini"
@click="handleBatchCompleteExchangeRejected"
v-hasPermi="['jysystem:order:edit']"
>更新拒绝换货申请为已完成</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@@ -200,17 +191,22 @@
</el-table-column>
<el-table-column label="B价格" align="center" width="90">
<template slot-scope="scope">
<span>{{ formatPriceB(scope.row) }}</span>
<span>{{ formatPriceAmount(formatPriceB(scope.row)) }}</span>
</template>
</el-table-column>
<el-table-column label="C价格" align="center" width="90">
<template slot-scope="scope">
<span>{{ formatPriceC(scope.row) }}</span>
<span>{{ formatPriceAmount(formatPriceC(scope.row)) }}</span>
</template>
</el-table-column>
<el-table-column label="物流费用" align="center" width="90">
<template slot-scope="scope">
<span>{{ formatPriceAmount(formatLogisticsFee(scope.row)) }}</span>
</template>
</el-table-column>
<el-table-column label="渐进多焦点价格" align="center" width="120">
<template slot-scope="scope">
<span>{{ formatProgressiveMultifocalPrice(scope.row) }}</span>
<span>{{ formatPriceAmount(formatProgressiveMultifocalPrice(scope.row)) }}</span>
</template>
</el-table-column>
<el-table-column label="订单状态" align="center" prop="orderStatus" width="130">
@@ -850,21 +846,21 @@
</el-descriptions-item>
<el-descriptions-item label="B合计">
<el-tag
v-if="isPendingTagText(formatPriceAmount(formatPriceTotal(detail, 'priceB')))"
v-if="isPendingTagText(formatPriceAmount(formatDetailPriceTotal(detail, 'priceB')))"
type="danger"
size="small"
:disable-transitions="true"
>{{ formatPriceAmount(formatPriceTotal(detail, 'priceB')) }}</el-tag>
<span v-else class="price-total-value">{{ formatPriceAmount(formatPriceTotal(detail, 'priceB')) }}</span>
>{{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceB')) }}</el-tag>
<span v-else class="price-total-value">{{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceB')) }}</span>
</el-descriptions-item>
<el-descriptions-item label="C合计">
<el-tag
v-if="isPendingTagText(formatPriceAmount(formatPriceTotal(detail, 'priceC')))"
v-if="isPendingTagText(formatPriceAmount(formatDetailPriceTotal(detail, 'priceC')))"
type="danger"
size="small"
:disable-transitions="true"
>{{ formatPriceAmount(formatPriceTotal(detail, 'priceC')) }}</el-tag>
<span v-else class="price-total-value">{{ formatPriceAmount(formatPriceTotal(detail, 'priceC')) }}</span>
>{{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceC')) }}</el-tag>
<span v-else class="price-total-value">{{ formatPriceAmount(formatDetailPriceTotal(detail, 'priceC')) }}</span>
</el-descriptions-item>
</el-descriptions>
<div class="detail-logistics-fee-block">
@@ -876,26 +872,6 @@
<span>{{ formatPriceAmount(formatLogisticsLogFee(scope.row, detail)) }}</span>
</template>
</el-table-column>
<el-table-column label="应收结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogSaleSettleStatus(scope.row) != null"
:options="dict.type.jy_sale_settle_status"
:value="formatLogSaleSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="应付结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogPurchaseSettleStatus(scope.row) != null"
:options="dict.type.jy_purchase_settle_status"
:value="formatLogPurchaseSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="发货日期" align="center" width="120">
<template slot-scope="scope">
<span>{{ formatShipDate(scope.row.operateTime) }}</span>
@@ -1021,26 +997,6 @@
<dict-tag :options="dict.type.jy_order_status" :value="scope.row.orderStatus" />
</template>
</el-table-column>
<el-table-column label="应收结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogSaleSettleStatus(scope.row) != null"
:options="dict.type.jy_sale_settle_status"
:value="formatLogSaleSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="应付结算" align="center" width="100">
<template slot-scope="scope">
<dict-tag
v-if="formatLogPurchaseSettleStatus(scope.row) != null"
:options="dict.type.jy_purchase_settle_status"
:value="formatLogPurchaseSettleStatus(scope.row)"
/>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="备注" align="center" prop="remark" min-width="160" show-overflow-tooltip />
<el-table-column label="操作人" align="center" prop="operator" width="100" />
<el-table-column label="操作时间" align="center" prop="operateTime" width="160" />
@@ -1124,7 +1080,7 @@
/>
</el-form-item>
<el-alert
title="仅汇总所选年月内已完成状态的订单品牌方生成应收(AR)镜片厂生成应付(AP)"
title="仅汇总所选年月内已完成或换货完成状态的订单品牌方生成应收(AR)镜片厂生成应付(AP)"
type="info"
:closable="false"
show-icon
@@ -1142,7 +1098,7 @@
import axios from 'axios'
import { getToken } from '@/utils/auth'
import { isExternal } from '@/utils/validate'
import { listOrder, getOrder, getOrderLogistics, delOrder, addOrder, updateOrder, previewAssignPrice, assignOrder, rejectOrder, closeOrder, completeOrder, agreeExchangeOrder, rejectExchangeOrder, completeExchangeRejectedOrder, completeAllExchangeRejectedOrder, changeOrderStatus } from "@/api/jysystem/order";
import { listOrder, getOrder, getOrderLogistics, delOrder, addOrder, updateOrder, previewAssignPrice, assignOrder, rejectOrder, closeOrder, completeOrder, agreeExchangeOrder, rejectExchangeOrder, changeOrderStatus } from "@/api/jysystem/order";
import { checkPermi } from "@/utils/permission";
import { listBrandTenant, listLensFactoryTenant } from "@/api/jysystem/tenant";
import { listLensOptions } from "@/api/jysystem/lens";
@@ -1216,6 +1172,9 @@ export default {
ORDER_STATUS_SHIPPED: '8',
ORDER_STATUS_COMPLETED: '9',
ORDER_STATUS_EXCHANGE_APPLY: '12',
ORDER_STATUS_EXCHANGE_AGREED: '13',
ORDER_STATUS_EXCHANGE_LOGISTICS: '15',
ORDER_STATUS_EXCHANGE_COMPLETED: '17',
ORDER_STATUS_EXCHANGE_REJECTED: '21',
logisticsDialogVisible: false,
logisticsBasic: null,
@@ -1368,20 +1327,42 @@ export default {
},
formatPriceB(row) {
if (!row) return '-';
if (this.isExchangeOrder(row)) return '-';
if (this.isPendingAssign(row)) return '未核算';
return row.priceB != null ? row.priceB : '-';
},
formatPriceC(row) {
if (!row) return '-';
if (this.isExchangeOrder(row)) return '-';
if (this.isPendingAssign(row)) return '未核算';
return row.priceC != null ? row.priceC : '-';
},
formatProgressiveMultifocalPrice(row) {
if (!row) return '-';
if (this.isExchangeOrder(row)) return '-';
if (Number(row.progressiveMultifocal) !== 1) return '-';
if (this.isPendingAssign(row)) return '未核算';
return row.progressiveMultifocalPrice != null ? row.progressiveMultifocalPrice : '-';
},
isExchangeOrder(row) {
if (!row) return false;
if (row.orderNo && String(row.orderNo).startsWith('HH')) return true;
const status = row.orderStatus != null ? String(row.orderStatus) : '';
return status === this.ORDER_STATUS_EXCHANGE_APPLY
|| status === this.ORDER_STATUS_EXCHANGE_AGREED
|| status === this.ORDER_STATUS_EXCHANGE_LOGISTICS
|| status === this.ORDER_STATUS_EXCHANGE_COMPLETED;
},
formatDetailPriceTotal(detail, priceKey) {
if (this.isExchangeOrder(detail)) return this.formatDetailLogisticsFee(detail);
return this.formatPriceTotal(detail, priceKey);
},
formatLogisticsFee(row) {
if (!row) return '-';
if (!this.isExchangeOrder(row)) return '-';
const fee = this.parseLogisticsFeeValue(row.logisticsFee);
return fee != null ? fee : '-';
},
formatPriceBC(row) {
return `${this.formatPriceB(row)} / ${this.formatPriceC(row)}`;
},
@@ -1430,7 +1411,7 @@ export default {
hasFee = true;
}
});
if (!hasFee && logs.length > 0 && detail.logisticsFee != null) {
if (!hasFee && detail.logisticsFee != null) {
const legacyFee = this.parseLogisticsFeeValue(detail.logisticsFee);
if (legacyFee != null) return legacyFee;
}
@@ -1440,24 +1421,6 @@ export default {
formatDetailLogisticsFee(detail) {
return this.sumDetailLogisticsFee(detail);
},
formatLogSaleSettleStatus(log) {
if (!log || log.expressNo == null || String(log.expressNo).trim() === '') {
return null;
}
if (log.saleSettleStatus != null && log.saleSettleStatus !== '') {
return log.saleSettleStatus;
}
return '0';
},
formatLogPurchaseSettleStatus(log) {
if (!log || log.expressNo == null || String(log.expressNo).trim() === '') {
return null;
}
if (log.purchaseSettleStatus != null && log.purchaseSettleStatus !== '') {
return log.purchaseSettleStatus;
}
return '0';
},
formatShipDate(time) {
if (!time) {
return '-';
@@ -1730,13 +1693,17 @@ export default {
},
canViewLogistics(row) {
if (!row || row.orderStatus == null) return false;
const status = Number(row.orderStatus);
return status === Number(this.ORDER_STATUS_SHIPPED) || status === 9;
const status = String(row.orderStatus);
return status === this.ORDER_STATUS_SHIPPED
|| status === this.ORDER_STATUS_EXCHANGE_LOGISTICS
|| status === this.ORDER_STATUS_COMPLETED
|| status === this.ORDER_STATUS_EXCHANGE_COMPLETED;
},
canCompleteOrder(row) {
if (!row || row.orderStatus == null) return false;
const status = String(row.orderStatus);
return status === this.ORDER_STATUS_SHIPPED || status === this.ORDER_STATUS_EXCHANGE_REJECTED;
return status === this.ORDER_STATUS_SHIPPED
|| status === this.ORDER_STATUS_EXCHANGE_LOGISTICS;
},
handleViewLogistics(row) {
if (!row || !row.id) return;
@@ -1864,28 +1831,13 @@ export default {
if (!row || !row.id) {
return;
}
const isExchangeRejected = String(row.orderStatus) === this.ORDER_STATUS_EXCHANGE_REJECTED;
const confirmMsg = isExchangeRejected
? `确认将拒绝换货申请订单"${row.orderNo}"标记为已完成吗?`
: `确认完成订单"${row.orderNo}"吗?`;
const requestFn = isExchangeRejected
? () => completeExchangeRejectedOrder({ orderId: row.id })
: () => completeOrder({ orderId: row.id });
this.$modal.confirm(confirmMsg).then(() => {
return requestFn();
this.$modal.confirm(`确认完成订单"${row.orderNo}"吗?`).then(() => {
return completeOrder({ orderId: row.id });
}).then(() => {
this.$modal.msgSuccess('操作成功');
this.getList();
}).catch(() => {});
},
handleBatchCompleteExchangeRejected() {
this.$modal.confirm('确认将所有拒绝换货申请状态的订单更新为已完成吗?').then(() => {
return completeAllExchangeRejectedOrder();
}).then((res) => {
this.$modal.msgSuccess((res && res.msg) || '操作成功');
this.getList();
}).catch(() => {});
},
handleAgreeExchange(row) {
if (!row || !row.id) {
return;