pages/marketing/coupon/activity/index.vue
@@ -9,6 +9,7 @@
  couponSearchForm,
  getActivityEffectiveTime,
  getActivityReceiveTime,
  getImageUrlRules,
  couponColumn,
} from '@/utils/coupon-form'
export default {
@@ -39,7 +40,9 @@
          if (!isNew) {
            row.usageTypeStr = getActivityEffectiveTime(row)
            row.getStartDateStr = getActivityReceiveTime(row)
            getImageUrlRules(row,this.tableConfig.form)
          }
        },
        columns: [
          ...couponColumn(),
@@ -67,7 +70,6 @@
          { label: '已领取总数', prop: 'getNum', minWidth: 150 },
          { label: '剩余未领取总数', prop: 'unGetNum', minWidth: 150 },
          { label: '状态', prop: 'statusName', minWidth: 120 },
          { label: '领取渠道', prop: 'getTypeName', minWidth: 120 },
          { label: '操作人', prop: 'createByName', minWidth: 120 },
        ],
        // 页面上要到分,后端要传到秒
@@ -267,8 +269,23 @@
        extraButtons: [
          {
            text: '发布',
            show: (row) =>
              row.status === 'inactive' || row.status === 'expired',
            show: (row) =>{
              // row.status === 'inactive' || row.status === 'expired'
              // const now = new Date(); // 获取当前时间
              // const startDate = new Date(row.getStartDate); // 获取开始时间
              // const endDate = new Date(row.getEndDate); // 获取结束时间
              // // 判断当前时间是否在开始时间和结束时间之间
              // const isInTimeRange = now >= startDate && now <= endDate;
              const now = new Date(); // 获取当前时间
              const endDate = new Date(row.getEndDate); // 获取结束时间
              // 判断当前时间是否已经超过领取结束时间
              const isAfterEndDate = now <= endDate;
              if (isAfterEndDate && (row.status === 'inactive' || row.status === 'expired')) {
                  return true;
              }
              return false;
            },
            atClick: async (row) => {
              try {
                await this.$elBusUtil.confirm('确定要发布吗?')