Procházet zdrojové kódy

feat(order): 更新订单管理页面字段和逻辑

- 修改订单状态标签对应值,将"已退款"从"3"改为"5"
- 移除商品类型相关配置及注释
- 更新表格列字段:productName 改为 name,quantity 改为 couponCount,paidAmount 改为 finalPrice
- 下单时间字段调整:隐藏旧字段,新增 buyTime 字段展示下单时间
- 优化搜索功能,移除输入框 placeholder 属性
- 调整 initParam 参数获取方式,去除默认值 "1"
- 新增日期格式化函数 formatDate
- 处理订单时间查询参数,转换为 startTime 和 endTime 并删除原字段
- 在提交优惠券时增加 expirationDate 和 getStatus 参数
congxuesong před 4 týdny
rodič
revize
42cc095b23

+ 30 - 33
src/views/orderManagement/index.vue

@@ -50,21 +50,14 @@ const allTabOptions = [
   { label: "全部", name: "" },
   { label: "待使用", name: "1" },
   { label: "已完成", name: "2" },
-  { label: "已退款", name: "3" }
-];
-
-// 商品类型选项
-const statusEnum = [
-  { label: "团购", value: "1" },
-  { label: "代金券", value: "2" },
-  { label: "优惠券", value: "3" }
+  { label: "已退款", name: "5" }
 ];
 
 // 状态映射
 const statusMap: Record<string, string> = {
   "1": "待使用",
   "2": "已完成",
-  "3": "已退款"
+  "5": "已退款"
 };
 
 // 表格配置项
@@ -81,41 +74,25 @@ const columns = reactive<ColumnProps<any>[]>([
     prop: "orderNo",
     label: "订单编号",
     search: {
-      el: "input",
-      props: { placeholder: "订单编号" }
+      el: "input"
     }
   },
   {
-    prop: "productName",
+    prop: "name",
     label: "商品名称",
     search: {
-      el: "input",
-      props: { placeholder: "商品名称" }
+      el: "input"
     }
   },
-  // {
-  //   prop: "productType",
-  //   label: "商品类型",
-  //   render: (scope: any) => {
-  //     const type = statusEnum.find(item => item.value === scope.row.productType);
-  //     return type ? type.label : "--";
-  //   },
-  //   search: {
-  //     el: "select",
-  //     props: { placeholder: "请选择" }
-  //   },
-  //   enum: statusEnum,
-  //   fieldNames: { label: "label", value: "value" }
-  // },
   {
-    prop: "quantity",
+    prop: "couponCount",
     label: "数量"
   },
   {
-    prop: "paidAmount",
+    prop: "finalPrice",
     label: "实付款",
     render: (scope: any) => {
-      return scope.row.paidAmount ? `¥${scope.row.paidAmount}` : "--";
+      return scope.row.finalPrice ? `¥${scope.row.finalPrice}` : "--";
     }
   },
   {
@@ -128,6 +105,7 @@ const columns = reactive<ColumnProps<any>[]>([
   {
     prop: "orderTime",
     label: "下单时间",
+    isShow: false,
     search: {
       el: "date-picker",
       props: {
@@ -139,6 +117,10 @@ const columns = reactive<ColumnProps<any>[]>([
     }
   },
   {
+    prop: "buyTime",
+    label: "下单时间"
+  },
+  {
     prop: "status",
     label: "状态",
     render: (scope: any) => {
@@ -150,8 +132,8 @@ const columns = reactive<ColumnProps<any>[]>([
 
 // 如果表格需要初始化请求参数,直接定义传给 ProTable (之后每次请求都会自动带上该参数,此参数更改之后也会一直带上,改变此参数会自动刷新表格数据)
 const initParam = reactive({
-  storeId: localGet("createdId") || "",
-  groupType: localGet("businessSection") || "1",
+  storeId: localGet("createdId"),
+  groupType: localGet("businessSection"),
   status: activeName
 });
 const type = ref(false);
@@ -174,6 +156,15 @@ const dataCallback = (data: any) => {
   };
 };
 
+// 格式化日期为 yyyy/mm/dd
+const formatDate = (date: string | Date) => {
+  const d = new Date(date);
+  const year = d.getFullYear();
+  const month = String(d.getMonth() + 1).padStart(2, "0");
+  const day = String(d.getDate()).padStart(2, "0");
+  return `${year}-${month}-${day}`;
+};
+
 // 获取表格列表
 const getTableList = (params: any) => {
   let newParams = JSON.parse(JSON.stringify(params));
@@ -181,6 +172,12 @@ const getTableList = (params: any) => {
   if (activeName.value) {
     newParams.status = activeName.value;
   }
+  // 处理 orderTime 参数,转换为 startTime 和 endTime
+  if (newParams.orderTime && Array.isArray(newParams.orderTime) && newParams.orderTime.length === 2) {
+    newParams.startTime = formatDate(newParams.orderTime[0]);
+    newParams.endTime = formatDate(newParams.orderTime[1]);
+    delete newParams.orderTime;
+  }
   return getThaliList(newParams);
 };
 

+ 2 - 0
src/views/ticketManagement/newCoupon.vue

@@ -311,6 +311,8 @@ const handleSubmit = async (submitType?: string) => {
   params.couponId = "";
   params.couponStatus = submitType ? 0 : 1;
   params.restrictedQuantity = 0;
+  params.expirationDate = 0;
+  params.getStatus = 1;
   params.type = 1;
   if (submitType) {
     if (!couponModel.value.name) {