|
@@ -23,7 +23,13 @@
|
|
|
<el-option v-for="dict in order_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
<el-option v-for="dict in order_status" :key="dict.value" :label="dict.label" :value="dict.value" />
|
|
|
</el-select>
|
|
</el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
-
|
|
|
|
|
|
|
+ <el-form-item label="确认状态" prop="confirmStatus">
|
|
|
|
|
+ <el-select v-model="confirmStatus" placeholder="请选择" clearable>
|
|
|
|
|
+ <el-option label="待确认" value="0" />
|
|
|
|
|
+ <el-option label="已确认" value="1" />
|
|
|
|
|
+ <el-option label="已取消" value="2" />
|
|
|
|
|
+ </el-select>
|
|
|
|
|
+ </el-form-item>
|
|
|
<el-form-item label="提交时间" prop="orderTime">
|
|
<el-form-item label="提交时间" prop="orderTime">
|
|
|
<el-date-picker
|
|
<el-date-picker
|
|
|
v-model="dateRange"
|
|
v-model="dateRange"
|
|
@@ -70,6 +76,9 @@
|
|
|
<el-button :type="queryParams.orderStatus === '2' ? 'primary' : ''" :plain="queryParams.orderStatus !== '2'" @click="handleQuery('2')"
|
|
<el-button :type="queryParams.orderStatus === '2' ? 'primary' : ''" :plain="queryParams.orderStatus !== '2'" @click="handleQuery('2')"
|
|
|
>待发货</el-button
|
|
>待发货</el-button
|
|
|
>
|
|
>
|
|
|
|
|
+ <el-button :type="queryParams.orderStatus === '3' ? 'primary' : ''" :plain="queryParams.orderStatus !== '3'" @click="handleQuery('3')"
|
|
|
|
|
+ >部分发货</el-button
|
|
|
|
|
+ >
|
|
|
<!-- {{ orderStatusStats.pendingShipmentCount }} -->
|
|
<!-- {{ orderStatusStats.pendingShipmentCount }} -->
|
|
|
<el-button :type="queryParams.orderStatus === '4' ? 'primary' : ''" :plain="queryParams.orderStatus !== '4'" @click="handleQuery('4')"
|
|
<el-button :type="queryParams.orderStatus === '4' ? 'primary' : ''" :plain="queryParams.orderStatus !== '4'" @click="handleQuery('4')"
|
|
|
>已发货</el-button
|
|
>已发货</el-button
|
|
@@ -91,21 +100,21 @@
|
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
<el-table-column type="selection" width="55" align="center" />
|
|
|
<el-table-column label="订单时间" align="center" prop="orderTime" />
|
|
<el-table-column label="订单时间" align="center" prop="orderTime" />
|
|
|
<el-table-column label="订单编号" align="center" prop="orderNo" />
|
|
<el-table-column label="订单编号" align="center" prop="orderNo" />
|
|
|
- <el-table-column label="客户编号" align="center" prop="customerCode" />
|
|
|
|
|
- <el-table-column label="订单总金额" align="center" prop="totalAmount" />
|
|
|
|
|
- <el-table-column label="支付方式" align="center" prop="payType">
|
|
|
|
|
|
|
+ <el-table-column label="关联单号" align="center" prop="parentOrderNo" :resizable="false" />
|
|
|
|
|
+ <el-table-column label="平台\项目订单号" align="center" prop="projectOrderNo">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
- <dict-tag :options="pay_method" :value="scope.row.payType" />
|
|
|
|
|
|
|
+ <span>{{ scope.row._crrcOrderNo || '' }}</span>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
- <el-table-column label="业务员" align="center" prop="businessStaff" />
|
|
|
|
|
- <el-table-column label="客服" align="center" prop="customerService" />
|
|
|
|
|
- <el-table-column label="归属部门" align="center" prop="businessDept" />
|
|
|
|
|
|
|
+ <!-- <el-table-column label="客户编号" align="center" prop="customerCode" /> -->
|
|
|
|
|
+ <el-table-column label="订单总金额" align="center" prop="totalAmount" />
|
|
|
<el-table-column label="订单来源" align="center" prop="orderSource">
|
|
<el-table-column label="订单来源" align="center" prop="orderSource">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<dict-tag :options="order_source" :value="scope.row.orderSource" />
|
|
<dict-tag :options="order_source" :value="scope.row.orderSource" />
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
+ <el-table-column label="所属项目" align="center" prop="dataSourceStr" />
|
|
|
|
|
+
|
|
|
<!-- <el-table-column label="审核状态" align="center" prop="checkStatus">
|
|
<!-- <el-table-column label="审核状态" align="center" prop="checkStatus">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<dict-tag :options="order_check_status" :value="scope.row.checkStatus" />
|
|
<dict-tag :options="order_check_status" :value="scope.row.checkStatus" />
|
|
@@ -116,7 +125,11 @@
|
|
|
<dict-tag :options="order_status" :value="scope.row.orderStatus" />
|
|
<dict-tag :options="order_status" :value="scope.row.orderStatus" />
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
-
|
|
|
|
|
|
|
+ <el-table-column label="确认状态" align="center" prop="orderStatus">
|
|
|
|
|
+ <template #default="scope">
|
|
|
|
|
+ {{ scope.row.orderStatus === '7' ? '已取消' : scope.row.orderStatus >= '2' ? '已确认' : '待确认' }}
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
|
|
<template #default="scope">
|
|
<template #default="scope">
|
|
|
<template v-for="btn in getActionButtons(scope.row)" :key="btn.label">
|
|
<template v-for="btn in getActionButtons(scope.row)" :key="btn.label">
|
|
@@ -152,7 +165,7 @@ import {
|
|
|
import { OrderMainVO, OrderMainQuery, OrderMainForm } from '@/api/order/orderMain/types';
|
|
import { OrderMainVO, OrderMainQuery, OrderMainForm } from '@/api/order/orderMain/types';
|
|
|
import DeliverDialog from './deliverDialog.vue';
|
|
import DeliverDialog from './deliverDialog.vue';
|
|
|
import LogisticsDetail from './logisticsDetail.vue';
|
|
import LogisticsDetail from './logisticsDetail.vue';
|
|
|
-
|
|
|
|
|
|
|
+import { getOrderMainCrrcExt } from '@/api/order/orderMainCrrcExt';
|
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
const { proxy } = getCurrentInstance() as ComponentInternalInstance;
|
|
|
const { order_status, order_check_status, pay_method, order_source } = toRefs<any>(
|
|
const { order_status, order_check_status, pay_method, order_source } = toRefs<any>(
|
|
|
proxy?.useDict('order_status', 'order_check_status', 'pay_method', 'order_source')
|
|
proxy?.useDict('order_status', 'order_check_status', 'pay_method', 'order_source')
|
|
@@ -176,7 +189,7 @@ const showDeliverDialog = ref(false);
|
|
|
const currentOrderId = ref<string | number>();
|
|
const currentOrderId = ref<string | number>();
|
|
|
const currentOrderNo = ref<string>();
|
|
const currentOrderNo = ref<string>();
|
|
|
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
|
|
const dateRange = ref<[DateModelType, DateModelType]>(['', '']);
|
|
|
-
|
|
|
|
|
|
|
+const confirmStatus = ref<string>();
|
|
|
const showLogisticsDialog = ref(false);
|
|
const showLogisticsDialog = ref(false);
|
|
|
const logisticsOrderId = ref<string | number>();
|
|
const logisticsOrderId = ref<string | number>();
|
|
|
|
|
|
|
@@ -319,13 +332,43 @@ const { queryParams, form, rules } = toRefs(data);
|
|
|
/** 查询订单主信息列表 */
|
|
/** 查询订单主信息列表 */
|
|
|
const getList = async () => {
|
|
const getList = async () => {
|
|
|
loading.value = true;
|
|
loading.value = true;
|
|
|
|
|
+ // 确认状态映射为订单状态
|
|
|
|
|
+ if (confirmStatus.value === '0') {
|
|
|
|
|
+ queryParams.value.orderStatuses = '0,1';
|
|
|
|
|
+ } else if (confirmStatus.value === '1') {
|
|
|
|
|
+ queryParams.value.orderStatuses = '2,3,4,5,6';
|
|
|
|
|
+ } else if (confirmStatus.value === '2') {
|
|
|
|
|
+ queryParams.value.orderStatuses = '7';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ queryParams.value.orderStatuses = undefined;
|
|
|
|
|
+ }
|
|
|
const res = await listOrderMain(proxy?.addDateRange(queryParams.value, dateRange.value));
|
|
const res = await listOrderMain(proxy?.addDateRange(queryParams.value, dateRange.value));
|
|
|
orderMainList.value = res.rows;
|
|
orderMainList.value = res.rows;
|
|
|
|
|
+ await fetchCrrcOrderNos(orderMainList.value);
|
|
|
total.value = res.total;
|
|
total.value = res.total;
|
|
|
loading.value = false;
|
|
loading.value = false;
|
|
|
queryOrderStatusStatsMethod();
|
|
queryOrderStatusStatsMethod();
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+// 批量获取平台订单号
|
|
|
|
|
+const fetchCrrcOrderNos = async (rows: OrderMainVO[]) => {
|
|
|
|
|
+ const results = await Promise.allSettled(
|
|
|
|
|
+ rows.map((row) => {
|
|
|
|
|
+ const id = row.parentOrderId || row.id;
|
|
|
|
|
+ if (!id) return Promise.resolve(null);
|
|
|
|
|
+ return getOrderMainCrrcExt(id);
|
|
|
|
|
+ })
|
|
|
|
|
+ );
|
|
|
|
|
+ rows.forEach((row, i) => {
|
|
|
|
|
+ const result = results[i];
|
|
|
|
|
+ if (result.status === 'fulfilled') {
|
|
|
|
|
+ (row as any)._crrcOrderNo = result.value?.data?.crrcOrderNo || '';
|
|
|
|
|
+ } else {
|
|
|
|
|
+ (row as any)._crrcOrderNo = '';
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
const queryOrderStatusStatsMethod = async () => {
|
|
const queryOrderStatusStatsMethod = async () => {
|
|
|
const res = await queryOrderStatusStats();
|
|
const res = await queryOrderStatusStats();
|
|
|
orderStatusStats.value = res as any;
|
|
orderStatusStats.value = res as any;
|
|
@@ -347,6 +390,7 @@ const reset = () => {
|
|
|
const handleQuery = (orderStatus?: string) => {
|
|
const handleQuery = (orderStatus?: string) => {
|
|
|
if (orderStatus) {
|
|
if (orderStatus) {
|
|
|
queryParams.value.orderStatus = orderStatus;
|
|
queryParams.value.orderStatus = orderStatus;
|
|
|
|
|
+ confirmStatus.value = undefined;
|
|
|
} else {
|
|
} else {
|
|
|
queryParams.value.orderStatus = undefined;
|
|
queryParams.value.orderStatus = undefined;
|
|
|
}
|
|
}
|
|
@@ -357,6 +401,7 @@ const handleQuery = (orderStatus?: string) => {
|
|
|
/** 重置按钮操作 */
|
|
/** 重置按钮操作 */
|
|
|
const resetQuery = () => {
|
|
const resetQuery = () => {
|
|
|
dateRange.value = ['', ''];
|
|
dateRange.value = ['', ''];
|
|
|
|
|
+ confirmStatus.value = undefined;
|
|
|
queryFormRef.value?.resetFields();
|
|
queryFormRef.value?.resetFields();
|
|
|
handleQuery();
|
|
handleQuery();
|
|
|
};
|
|
};
|
|
@@ -389,109 +434,19 @@ const handleReview = (row?: OrderMainVO) => {
|
|
|
const handleAffirm = (row?: OrderMainVO) => {
|
|
const handleAffirm = (row?: OrderMainVO) => {
|
|
|
router.push({
|
|
router.push({
|
|
|
path: '/order-manage/order-affirm',
|
|
path: '/order-manage/order-affirm',
|
|
|
- query: { id: row.id }
|
|
|
|
|
|
|
+ query: { id: row.id, source: 'order-project' }
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
-/** 审核按钮操作 */
|
|
|
|
|
-const handleCheck = async (row?: OrderMainVO) => {
|
|
|
|
|
- const oldValue = row.checkStatus; // 保存旧值
|
|
|
|
|
-
|
|
|
|
|
- // 弹出审核选择对话框
|
|
|
|
|
- try {
|
|
|
|
|
- await ElMessageBox({
|
|
|
|
|
- title: '审核',
|
|
|
|
|
- message: h('div', { style: 'padding: 10px 0' }, [
|
|
|
|
|
- h('p', { style: 'margin-bottom: 15px; font-size: 14px' }, '请选择审核结果:'),
|
|
|
|
|
- h('div', { style: 'display: flex; flex-direction: column; gap: 12px' }, [
|
|
|
|
|
- h(
|
|
|
|
|
- 'label',
|
|
|
|
|
- {
|
|
|
|
|
- style: 'display: flex; align-items: center; cursor: pointer; font-size: 14px',
|
|
|
|
|
- onClick: () => {
|
|
|
|
|
- checkStatusValue.value = '1';
|
|
|
|
|
- const radio = document.querySelector('input[name="checkStatus"][value="1"]') as HTMLInputElement;
|
|
|
|
|
- if (radio) radio.checked = true;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- [
|
|
|
|
|
- h('input', {
|
|
|
|
|
- type: 'radio',
|
|
|
|
|
- name: 'checkStatus',
|
|
|
|
|
- value: '1',
|
|
|
|
|
- checked: true,
|
|
|
|
|
- style: 'margin-right: 8px; cursor: pointer',
|
|
|
|
|
- onChange: () => {
|
|
|
|
|
- checkStatusValue.value = '1';
|
|
|
|
|
- }
|
|
|
|
|
- }),
|
|
|
|
|
- h('span', null, '审核通过')
|
|
|
|
|
- ]
|
|
|
|
|
- ),
|
|
|
|
|
- h(
|
|
|
|
|
- 'label',
|
|
|
|
|
- {
|
|
|
|
|
- style: 'display: flex; align-items: center; cursor: pointer; font-size: 14px',
|
|
|
|
|
- onClick: () => {
|
|
|
|
|
- checkStatusValue.value = '2';
|
|
|
|
|
- const radio = document.querySelector('input[name="checkStatus"][value="2"]') as HTMLInputElement;
|
|
|
|
|
- if (radio) radio.checked = true;
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
- [
|
|
|
|
|
- h('input', {
|
|
|
|
|
- type: 'radio',
|
|
|
|
|
- name: 'checkStatus',
|
|
|
|
|
- value: '2',
|
|
|
|
|
- style: 'margin-right: 8px; cursor: pointer',
|
|
|
|
|
- onChange: () => {
|
|
|
|
|
- checkStatusValue.value = '2';
|
|
|
|
|
- }
|
|
|
|
|
- }),
|
|
|
|
|
- h('span', null, '驳回')
|
|
|
|
|
- ]
|
|
|
|
|
- )
|
|
|
|
|
- ])
|
|
|
|
|
- ]),
|
|
|
|
|
- showCancelButton: true,
|
|
|
|
|
- confirmButtonText: '确定',
|
|
|
|
|
- cancelButtonText: '取消',
|
|
|
|
|
- beforeClose: (action, instance, done) => {
|
|
|
|
|
- if (action === 'confirm') {
|
|
|
|
|
- done();
|
|
|
|
|
- } else {
|
|
|
|
|
- done();
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
-
|
|
|
|
|
- // 调用接口,传入用户选择的值
|
|
|
|
|
- await changeCheckStatus(row.id, checkStatusValue.value);
|
|
|
|
|
- getList();
|
|
|
|
|
- proxy?.$modal.msgSuccess('操作成功');
|
|
|
|
|
- } catch (error) {
|
|
|
|
|
- // 用户取消或操作失败
|
|
|
|
|
- if (error !== 'cancel' && error !== 'close') {
|
|
|
|
|
- row.checkStatus = oldValue; // 失败回滚
|
|
|
|
|
- proxy?.$modal.msgError('操作失败,请重试');
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-};
|
|
|
|
|
-
|
|
|
|
|
-/** 审核按钮操作 */
|
|
|
|
|
|
|
+/** 取消订单按钮操作 */
|
|
|
const handleCancel = async (row?: OrderMainVO) => {
|
|
const handleCancel = async (row?: OrderMainVO) => {
|
|
|
- const oldValue = row.checkStatus; // 保存旧值
|
|
|
|
|
-
|
|
|
|
|
- // 弹出审核选择对话框
|
|
|
|
|
try {
|
|
try {
|
|
|
- // 调用接口,传入用户选择的值
|
|
|
|
|
|
|
+ await proxy?.$modal.confirm('是否确认取消该订单?');
|
|
|
await changeStatus(row.id, '7');
|
|
await changeStatus(row.id, '7');
|
|
|
getList();
|
|
getList();
|
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
proxy?.$modal.msgSuccess('操作成功');
|
|
|
} catch (error) {
|
|
} catch (error) {
|
|
|
- // 用户取消或操作失败
|
|
|
|
|
if (error !== 'cancel' && error !== 'close') {
|
|
if (error !== 'cancel' && error !== 'close') {
|
|
|
- row.checkStatus = oldValue; // 失败回滚
|
|
|
|
|
proxy?.$modal.msgError('操作失败,请重试');
|
|
proxy?.$modal.msgError('操作失败,请重试');
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -604,9 +559,9 @@ const getButtonsByStatus = (orderStatus: string, checkStatus: string): ActionBut
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
// 待发货或部分发货:显示发货按钮
|
|
// 待发货或部分发货:显示发货按钮
|
|
|
- if (orderStatus === OrderStatus.PENDING_SHIPMENT || orderStatus === OrderStatus.PARTIAL_SHIPMENT) {
|
|
|
|
|
- buttons.push({ label: '发货', handler: handleDeliver });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // if (orderStatus === OrderStatus.PENDING_SHIPMENT || orderStatus === OrderStatus.PARTIAL_SHIPMENT) {
|
|
|
|
|
+ // buttons.push({ label: '发货', handler: handleDeliver });
|
|
|
|
|
+ // }
|
|
|
|
|
|
|
|
// 待发货、部分发货、发货完成、已完成:显示查看订单信息按钮
|
|
// 待发货、部分发货、发货完成、已完成:显示查看订单信息按钮
|
|
|
if (
|
|
if (
|
|
@@ -623,7 +578,7 @@ const getButtonsByStatus = (orderStatus: string, checkStatus: string): ActionBut
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 非已取消和已关闭状态:显示取消订单按钮
|
|
// 非已取消和已关闭状态:显示取消订单按钮
|
|
|
- if (orderStatus !== OrderStatus.CANCELLED && orderStatus !== OrderStatus.CLOSED && orderStatus !== OrderStatus.SHIPMENT_COMPLETED) {
|
|
|
|
|
|
|
+ if ([OrderStatus.PENDING_PAYMENT, OrderStatus.PENDING_CONFIRM].includes(orderStatus as OrderStatus)) {
|
|
|
buttons.push({ label: '取消订单', handler: handleCancel });
|
|
buttons.push({ label: '取消订单', handler: handleCancel });
|
|
|
}
|
|
}
|
|
|
|
|
|