Browse Source

fix(date-format): 统一日期格式为斜杠分隔

- 修改 couponDetail.vue 中的日期格式化逻辑,将连接符替换为斜杠
- 更新 orderManagement/detail.vue 中的下单时间显示格式
- 调整 ticketManagement/detail.vue 中的日期和时间格式化函数
- 在订单管理列表页增加 buyTime 字段的格式化渲染
- 在票券管理列表页统一 endDate 和 endGetDate 的显示格式
congxuesong 3 weeks ago
parent
commit
13bc2c3824

+ 1 - 1
src/views/orderManagement/detail.vue

@@ -29,7 +29,7 @@
           <div class="detail-item">
             <div class="detail-label">下单时间</div>
             <div class="detail-value">
-              {{ formData.createdTime || "--" }}
+              {{ formData.createdTime?.replace(/-/g, "/") || "--" }}
             </div>
           </div>
           <!-- 原价 -->

+ 4 - 1
src/views/orderManagement/index.vue

@@ -127,7 +127,10 @@ const columns = reactive<ColumnProps<any>[]>([
   },
   {
     prop: "buyTime",
-    label: "下单时间"
+    label: "下单时间",
+    render: (scope: any) => {
+      return scope.row.buyTime?.replace(/-/g, "/") || "--";
+    }
   },
   {
     prop: "status",

+ 1 - 1
src/views/ticketManagement/couponDetail.vue

@@ -209,7 +209,7 @@ const loadDetailData = async () => {
  */
 const formatDate = (date: string) => {
   if (!date) return "--";
-  return date.replace(/-/g, ".");
+  return date.replace(/-/g, "/");
 };
 
 /**

+ 5 - 5
src/views/ticketManagement/detail.vue

@@ -315,7 +315,7 @@ const loadDetailData = async () => {
  */
 const formatDate = (date: string) => {
   if (!date) return "--";
-  return date.replace(/-/g, ".");
+  return date.replace(/-/g, "/");
 };
 
 /**
@@ -325,7 +325,7 @@ const getUsageTimeText = () => {
   if (voucherModel.value.buyUseStartTime && voucherModel.value.buyUseEndTime) {
     const startHour = formatHour(voucherModel.value.buyUseStartTime);
     const endHour = formatHour(voucherModel.value.buyUseEndTime);
-    return `${startHour}-${endHour}`;
+    return `${startHour}${endHour}`;
   }
   return "--";
 };
@@ -333,12 +333,12 @@ const getUsageTimeText = () => {
 /**
  * 格式化小时
  * @param hour 小时值(字符串或数字)
- * @returns 格式化后的小时文本(如:7:00
+ * @returns 格式化后的小时文本(如:7
  */
 const formatHour = (hour: string | number) => {
   if (!hour && hour !== 0) return "";
   const hourNum = typeof hour === "string" ? parseInt(hour) : hour;
-  return `${hourNum}:00`;
+  return `${hourNum}`;
 };
 
 /**
@@ -358,7 +358,7 @@ const getExpirationText = () => {
     ) {
       const startDate = formatDate(voucherModel.value.validityPeriod[0]);
       const endDate = formatDate(voucherModel.value.validityPeriod[1]);
-      return `${startDate}-${endDate}`;
+      return `${startDate}${endDate}`;
     }
     return "--";
   }

+ 8 - 2
src/views/ticketManagement/index.vue

@@ -272,7 +272,10 @@ const voucherColumns = reactive<ColumnProps<any>[]>([
   },
   {
     prop: "endDate",
-    label: "结束时间"
+    label: "结束时间",
+    render: (scope: any) => {
+      return scope.row.endDate?.replace(/-/g, "/") || "--";
+    }
   },
   {
     prop: "status",
@@ -316,7 +319,10 @@ const couponColumns = reactive<ColumnProps<any>[]>([
   },
   {
     prop: "endGetDate",
-    label: "结束时间"
+    label: "结束时间",
+    render: (scope: any) => {
+      return scope.row.endGetDate?.replace(/-/g, "/") || "--";
+    }
   },
   {
     prop: "couponStatus",