From 11acfd3894f38312940621e7f28acb639968e3db Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期三, 18 九月 2024 14:46:42 +0800
Subject: [PATCH] Merge branch 'master' of http://47.96.225.205:8888/r/operation_pc-v2
---
pages/marketing/coupon/activity/index.vue | 23 ++++++++++++++++++++---
utils/coupon-form.js | 21 +++++++++++++++++++++
2 files changed, 41 insertions(+), 3 deletions(-)
diff --git a/pages/marketing/coupon/activity/index.vue b/pages/marketing/coupon/activity/index.vue
index 265bbb3..71db735 100644
--- a/pages/marketing/coupon/activity/index.vue
+++ b/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('确定要发布吗?')
diff --git a/utils/coupon-form.js b/utils/coupon-form.js
index 49fa43e..caced4f 100644
--- a/utils/coupon-form.js
+++ b/utils/coupon-form.js
@@ -169,3 +169,24 @@
},
}
}
+
+
+export const getImageUrlRules = (row,form) => {
+ const id="imageUrl"
+ let required=false;
+ let message="";
+ if(row.getType==="home"){
+ required=true;
+ message="图片为必填项目";
+ }
+ const curField =form.find(
+ (field) => field.id === id
+ );
+ if (curField && curField.rules && required) {
+ curField.rules.required = true;
+ curField.rules.message = message;
+ }else if(curField && curField.rules){
+ curField.rules.required = false;
+ curField.rules.message = message;
+ }
+}
--
Gitblit v1.9.3