Browse Source

零售端-订单列表状态显示

ouyang 1 tuần trước cách đây
mục cha
commit
66263c9649

+ 7 - 9
mallApp/src/components/order/order-item.vue

@@ -75,6 +75,8 @@
 </template>
 
 <script>
+import { getSystemStatusDesc } from '@/utils/orderStatus'
+
 export default {
   name: "OrderItem",
   props: {
@@ -85,16 +87,12 @@ export default {
     }
   },
   computed: {
-    /** 订单状态文案 */
+    /** 订单状态文案(优先接口 statusDesc,与 OrderStatusUtil::getSystemStatusDesc 一致) */
     getStatusName() {
-      const statusMap = {
-        '1': '待付款',
-        '2': '待配送',
-        '3': '待收货',
-        '4': '已完成',
-        '5': '已取消'
-      };
-      return statusMap[String(this.info.status)] || '';
+      if (this.info.statusDesc) {
+        return this.info.statusDesc
+      }
+      return getSystemStatusDesc(this.info.status)
     },
     /** 拼团状态文案(有 groupBuyId 时展示) */
     groupBuyStatusText() {

+ 16 - 0
mallApp/src/utils/orderStatus.js

@@ -0,0 +1,16 @@
+/**
+ * 订单 status 文案,与后端 OrderStatusUtil::getSystemStatusDesc 保持一致
+ * @param {number|string} status 系统订单状态 1-5
+ * @returns {string}
+ */
+export function getSystemStatusDesc(status) {
+  const map = {
+    1: '待付款',
+    2: '待配送',
+    3: '配送中',
+    4: '已完成',
+    5: '已取消'
+  }
+  const key = Number(status)
+  return map[key] || '未知状态'
+}