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 | 90 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 87 insertions(+), 3 deletions(-)
diff --git a/pages/marketing/coupon/activity/index.vue b/pages/marketing/coupon/activity/index.vue
index 5826244..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,10 +40,22 @@
if (!isNew) {
row.usageTypeStr = getActivityEffectiveTime(row)
row.getStartDateStr = getActivityReceiveTime(row)
+ getImageUrlRules(row,this.tableConfig.form)
}
+
},
columns: [
...couponColumn(),
+ {
+ label: '优惠券图片',
+ formatter: (row) => (
+ <el-bus-image
+ style="width:50px;height:50px"
+ lazy={true}
+ src={row.imageUrl}
+ />
+ ),
+ },
{
label: '领取时间',
formatter: getActivityReceiveTime,
@@ -53,6 +66,7 @@
formatter: getActivityEffectiveTime,
minWidth: 320,
},
+ { label: '领取渠道', prop: 'getTypeName', minWidth: 120 },
{ label: '已领取总数', prop: 'getNum', minWidth: 150 },
{ label: '剩余未领取总数', prop: 'unGetNum', minWidth: 150 },
{ label: '状态', prop: 'statusName', minWidth: 120 },
@@ -88,8 +102,19 @@
searchForm: [
{
type: 'row',
- items: [...couponSearchForm()],
+ items: [...couponSearchForm(),
+ {
+ label: '领取渠道:',
+ id: 'getType',
+ type: 'bus-select-dict',
+ el: {
+ code: 'COUPON_GET_TYPE',
+ style: 'width:100%',
+ },
+ },
+ ],
},
+
],
form: [
...couponForm(),
@@ -104,6 +129,36 @@
str: true,
strKey: 'getTypeName',
rules: { required: true, message: '请选择领取渠道' },
+ on: {
+ change: (e, updateForm,obj) => {
+
+ if(e[0]==='home'){
+ // 如果是首页领取的话,则图片为必传递
+ this.updateImageUrlRules(this.tableConfig.form,"imageUrl",true,"图片为必填项目")
+ }else{
+ this.updateImageUrlRules(this.tableConfig.form,"imageUrl",false,"请输入图片")
+ }
+ },
+ },
+
+ },
+ {
+ label: '优惠券图片:',
+ id: 'imageUrl',
+ type: 'bus-upload',
+ el: {
+ listType: 'picture-card',
+ limit: 1,
+ limitSize: 2,
+ tipText: '大小不超过2M',
+ valueType: 'string',
+ },
+ forceDisabled: true,
+ rules: {
+ required: true,
+ message: '请上传商品图片',
+ trigger: 'blur',
+ },
},
{
label: '领取时间:',
@@ -214,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('确定要发布吗?')
@@ -258,5 +328,19 @@
title: '活动优惠券',
}
},
+ methods: {
+ updateImageUrlRules(form,id,required,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;
+ }
+ },
+ },
}
</script>
--
Gitblit v1.9.3