diff --git a/src/utils/orderStatus.js b/src/utils/orderStatus.js
new file mode 100644
index 0000000..7d53214
--- /dev/null
+++ b/src/utils/orderStatus.js
@@ -0,0 +1,91 @@
+// 订单状态映射
+const orderStatusMap = {
+ 0: "未进行",
+ 1: "进行中",
+ 2: "已完成",
+ 3: "已取消",
+ 4: "待确认"
+};
+
+// 结算状态映射 - 用于载物订单和生成订单
+const settlementStatusMap = {
+ 0: "未结算",
+ 1: "结算中",
+ 2: "结算完成"
+};
+
+// 结算状态映射 - 用于订单详情
+const settlementDetailStatusMap = {
+ 0: "结算中",
+ 1: "已确认",
+ 2: "结算完成",
+ 3: "已取消"
+};
+
+// 状态颜色样式映射
+const statusColorMap = {
+ default: 'status-default', // 默认状态
+ pending: 'status-pending', // 未进行/未结算
+ processing: 'status-processing', // 进行中/结算中
+ success: 'status-success', // 已完成/已结算
+ warning: 'status-warning', // 待确认
+ danger: 'status-danger' // 已取消
+};
+
+/**
+ * 获取订单状态文本
+ * @param {number} status 订单状态码
+ * @returns {string} 状态文本
+ */
+export function getOrderStatusText(status) {
+ return orderStatusMap[status] || "未知状态";
+}
+
+/**
+ * 获取结算状态文本
+ * @param {number} status 结算状态码
+ * @param {boolean} isDetail 是否为详情页面
+ * @returns {string} 状态文本
+ */
+export function getSettlementStatusText(status, isDetail = false) {
+ const statusMap = isDetail ? settlementDetailStatusMap : settlementStatusMap;
+ return statusMap[status] || "未知状态";
+}
+
+/**
+ * 获取订单状态样式类
+ * @param {number} status 订单状态码
+ * @returns {Object} 状态样式类
+ */
+export function getOrderStatusClass(status) {
+ return {
+ [statusColorMap.pending]: status === 0, // 未进行
+ [statusColorMap.processing]: status === 1, // 进行中
+ [statusColorMap.success]: status === 2, // 已完成
+ [statusColorMap.danger]: status === 3, // 已取消
+ [statusColorMap.warning]: status === 4 // 待确认
+ };
+}
+
+/**
+ * 获取结算状态样式类
+ * @param {number} status 结算状态码
+ * @param {boolean} isDetail 是否为详情页面
+ * @returns {Object} 状态样式类
+ */
+export function getSettlementStatusClass(status, isDetail = false) {
+ if (isDetail) {
+ return {
+ [statusColorMap.processing]: status === 0, // 结算中
+ [statusColorMap.warning]: status === 1, // 已确认
+ [statusColorMap.success]: status === 2, // 结算完成
+ [statusColorMap.danger]: status === 3 // 已取消
+ };
+ } else {
+ return {
+ [statusColorMap.pending]: status === 0, // 未结算
+ [statusColorMap.processing]: status === 1, // 结算中
+ [statusColorMap.success]: status === 2 // 结算完成
+ };
+ }
+}
diff --git a/src/views/order/loadOrder/index.vue b/src/views/order/loadOrder/index.vue
index c4480dd..151d480 100644
--- a/src/views/order/loadOrder/index.vue
+++ b/src/views/order/loadOrder/index.vue
@@ -75,25 +75,15 @@
-
- {{ scope.row.status }}
+
+ {{ getOrderStatusText(scope.row.mainOrderStatus) }}
-
- {{ scope.row.settlementStatus }}
+
+ {{ getSettlementStatusText(scope.row.settlementStatus) }}
@@ -135,6 +125,7 @@ import { allCustomer } from "@/api/system/customer";
import { getList } from "@/api/system/pilot";
import { getOrderDetail } from "@/api/order";
import { getUser } from "@/api/system/user";
+import { getOrderStatusText, getSettlementStatusText, getOrderStatusClass, getSettlementStatusClass } from "@/utils/orderStatus";
import store from "@/store";
export default {
@@ -168,6 +159,10 @@ export default {
};
},
methods: {
+ getOrderStatusText,
+ getSettlementStatusText,
+ getOrderStatusClass,
+ getSettlementStatusClass,
getList() {
this.loading = true;
const params = {
@@ -200,10 +195,8 @@ export default {
route: record.routeName,
initiator: initiator ? initiator.name : "未知发起人",
type: record.orderType === 1 ? "载物飞行" : "载人飞行",
- status: this.getOrderStatus(record.mainOrderStatus),
- settlementStatus: this.getSettlementStatus(
- record.settlementStatus
- ),
+ mainOrderStatus: record.mainOrderStatus,
+ settlementStatus: record.settlementStatus,
id: record.id,
};
});
@@ -298,25 +291,6 @@ export default {
console.error("获取订单详情失败:", error);
}
},
- // 获取订单状态显示文本
- getOrderStatus(status) {
- const statusMap = {
- 0: "未进行",
- 1: "进行中",
- 2: "已完成",
- 3: "已取消",
- };
- return statusMap[status] || "未知状态";
- },
- // 获取结算状态显示文本
- getSettlementStatus(status) {
- const statusMap = {
- 0: "未结算",
- 1: "结算中",
- 2: "结算完成",
- };
- return statusMap[status] || "未知状态";
- },
handleSearch() {
this.page.current = 1;
this.getList();
@@ -372,12 +346,12 @@ export default {
// padding: 2px 25px;
// }
-.status-text {
- color: #f56c6c;
- &.success {
- color: #67c23a;
- }
-}
+.status-default { color: #909399; }
+.status-pending { color: #909399; }
+.status-processing { color: #409EFF; }
+.status-success { color: #67c23a; }
+.status-warning { color: #e6a23c; }
+.status-danger { color: #f56c6c; }
.el-button--text {
color: #409eff;
diff --git a/src/views/order/loadOrder/loadOrderDetail/index.vue b/src/views/order/loadOrder/loadOrderDetail/index.vue
index 2aee210..3dc8ed1 100644
--- a/src/views/order/loadOrder/loadOrderDetail/index.vue
+++ b/src/views/order/loadOrder/loadOrderDetail/index.vue
@@ -97,7 +97,7 @@
-
+
@@ -123,7 +123,13 @@
-
+
+
+
+ {{ scope.row.status }}
+
+
+
查看视频
@@ -249,6 +255,15 @@ export default {
this.taskPage.page = 1
})
},
+ getTaskStatusClass(status) {
+ return {
+ 'status-pending': status === '未进行',
+ 'status-processing': status === '进行中',
+ 'status-success': status === '已完成',
+ 'status-warning': status === '待确认',
+ 'status-danger': status === '已取消'
+ }
+ },
handlePreview(url) {
this.previewUrl = url
this.previewVisible = true
@@ -356,4 +371,11 @@ export default {
}
}
}
+
+.status-default { color: #909399; }
+.status-pending { color: #909399; }
+.status-processing { color: #409EFF; }
+.status-success { color: #67c23a; }
+.status-warning { color: #e6a23c; }
+.status-danger { color: #f56c6c; }
diff --git a/src/views/order/settlementOrder/generateOrder/index.vue b/src/views/order/settlementOrder/generateOrder/index.vue
index 9a58db0..ce255d3 100644
--- a/src/views/order/settlementOrder/generateOrder/index.vue
+++ b/src/views/order/settlementOrder/generateOrder/index.vue
@@ -69,15 +69,15 @@
-
- {{ scope.row.orderStatus }}
+
+ {{ getOrderStatusText(scope.row.mainOrderStatus) }}
-
- {{ scope.row.settlementStatus }}
+
+ {{ getSettlementStatusText(scope.row.settlementStatus) }}
@@ -137,6 +137,7 @@ import { allScenic } from "@/api/system/scenic";
import { allCustomer } from "@/api/system/customer";
import { getList } from "@/api/system/pilot";
import { getUser } from "@/api/system/user";
+import { getOrderStatusText, getSettlementStatusText, getOrderStatusClass, getSettlementStatusClass } from "@/utils/orderStatus";
import store from "@/store";
export default {
@@ -173,6 +174,10 @@ export default {
}
},
methods: {
+ getOrderStatusText,
+ getSettlementStatusText,
+ getOrderStatusClass,
+ getSettlementStatusClass,
getList() {
this.loading = true;
const params = {
@@ -205,8 +210,8 @@ export default {
route: record.routeName,
initiator: initiator ? initiator.name : "未知发起人",
orderType: record.orderType === 1 ? "载物飞行" : "载人飞行",
- orderStatus: this.getOrderStatus(record.mainOrderStatus),
- settlementStatus: this.getSettlementStatus(record.settlementStatus),
+ mainOrderStatus: record.mainOrderStatus,
+ settlementStatus: record.settlementStatus,
};
});
this.page.total = Number(response.total) || 0;
@@ -271,25 +276,6 @@ export default {
}
},
- getOrderStatus(status) {
- const statusMap = {
- 0: "未进行",
- 1: "进行中",
- 2: "已完成",
- 3: "已取消"
- };
- return statusMap[status] || "未知状态";
- },
-
- getSettlementStatus(status) {
- const statusMap = {
- 0: "未结算",
- 1: "结算中",
- 2: "结算完成"
- };
- return statusMap[status] || "未知状态";
- },
-
handleSearch() {
this.page.current = 1;
this.getList();
@@ -384,13 +370,6 @@ export default {
diff --git a/src/views/order/settlementOrder/orderDetail/index.vue b/src/views/order/settlementOrder/orderDetail/index.vue
index ac94486..5bb8b19 100644
--- a/src/views/order/settlementOrder/orderDetail/index.vue
+++ b/src/views/order/settlementOrder/orderDetail/index.vue
@@ -89,8 +89,8 @@
align="center"
>
-
- {{ getOrderStatus(scope.row.mainOrderStatus) }}
+
+ {{ getOrderStatusText(scope.row.mainOrderStatus) }}
@@ -100,8 +100,8 @@
align="center"
>
-
- {{ getSettlementStatusText(scope.row.settlementStatus) }}
+
+ {{ getSettlementStatusText(scope.row.settlementStatus, true) }}
@@ -158,6 +158,7 @@