From 1c1a1f7ece1a036cb6ecf5f9fbda03a79c059913 Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Thu, 18 Dec 2025 15:48:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E6=9C=9F=E9=80=89=E6=8B=A9=E5=99=A8?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/agent/addCustomCoupon.vue | 497 ++++++++++++++++++++---------------- 1 file changed, 274 insertions(+), 223 deletions(-) diff --git a/src/views/agent/addCustomCoupon.vue b/src/views/agent/addCustomCoupon.vue index dfeae90..d0afb54 100644 --- a/src/views/agent/addCustomCoupon.vue +++ b/src/views/agent/addCustomCoupon.vue @@ -2,10 +2,12 @@
- +
-

{{curTabInfo.name}}使用说明

+

{{ curTabInfo.name }}使用说明 +

1. {{ curTabInfo.desc1 }}

2. {{ curTabInfo.desc2 }}

@@ -13,7 +15,8 @@

基础规则

- +
@@ -21,10 +24,13 @@
-
- -
{{item.name}}
-
{{ item.desc1 }}
+
+ +
{{ item.name }}
+
{{ item.desc1 }}
@@ -32,14 +38,16 @@
-
+
- -
+ +
- +
@@ -51,64 +59,40 @@
- +
-
- 适用服务类型 - - -
- -
- {{ item.name }} + +
+ +
+ {{ item.name }} +
-
- - {{ item.name }} - - - - - - - {{ item.name }} - - - - -
+ + {{ item.name }} + + +
+ + + + {{ item.name }} + + + + +
@@ -119,18 +103,29 @@
- +
- - + +
- + -
- +
+ + +
@@ -155,63 +150,86 @@ export default { GuipRadio, }, data() { + const today = new Date(); + const fixedStartDate = this.formatDate(today); + + // 计算默认结束日期(例如:一周后) + const defaultEndDate = new Date(today); + defaultEndDate.setDate(today.getDate() + 7); + return { - fastWords:[ + // 日期范围值 - 固定起始日期为今天 + dateRange: [fixedStartDate, ''], + defaultDateRange: [new Date(), ''], + pickerOptions: { + disabledDate: (time) => { + // 禁用今天之前的日期 + const today = new Date(); + today.setHours(0, 0, 0, 0); + return time.getTime() < today.getTime(); + }, + + }, + // 固定起始日期(不可修改) + fixedStartDate: fixedStartDate, + // 是否显示日期信息 + fastWords: [ { - name:'不限', - id:0, + name: '不限', + id: 0, }, { - name:'查重服务', - id:1, + name: '查重服务', + id: 1, }, { - name:'写作辅助', - id:2, + name: '写作辅助', + id: 2, } ], - searchDate:[], + // 标记是否正在修正日期(防止无限循环) + // 选择器选项配置 curAddTab: this.$route.query.type || '1', - searchWord:'', + searchWord: '', // curTabInfo:null, - numsList:[ + numsList: [ { - name:'满减卡', - type:'1', - desc1:'使用规则:领卡用户消费满额立减,永久有效。一张卡券只能使用一次,适用于名下所有站点。', - desc2:'资金冻结:发卡即冻结面额资金;用户使用或卡券过期,资金解冻。CopyCheck不冻结资金,按单独约定结算。' + name: '满减卡', + type: '1', + desc1: '使用规则:领卡用户消费满额立减,永久有效。一张卡券只能使用一次,适用于名下所有站点。', + desc2: '资金冻结:发卡即冻结面额资金;用户使用或卡券过期,资金解冻。CopyCheck不冻结资金,按单独约定结算。' }, { - name:'现金卡', - type:'2', - desc1:'使用规则:领卡用户使用无门槛、永久有效,每订单限用1张', - desc2:'资金冻结:发卡即冻结面额资金;用户使用或卡券过期,资金解冻。CopyCheck不冻结资金,按单独约定结算。' + name: '现金卡', + type: '2', + desc1: '使用规则:领卡用户使用无门槛、永久有效,每订单限用1张', + desc2: '资金冻结:发卡即冻结面额资金;用户使用或卡券过期,资金解冻。CopyCheck不冻结资金,按单独约定结算。' }, { - name:'次数卡', - type:'3', - desc1:'使用规则:领卡用户使用无门槛、永久有效,每订单限用1张', - desc2:'资金冻结:发卡即冻结面额资金;用户使用或卡券过期,资金解冻。CopyCheck不冻结资金,按单独约定结算。' + name: '次数卡', + type: '3', + desc1: '使用规则:领卡用户使用无门槛、永久有效,每订单限用1张', + desc2: '资金冻结:发卡即冻结面额资金;用户使用或卡券过期,资金解冻。CopyCheck不冻结资金,按单独约定结算。' }, { - name:'折扣卡', - type:'4', - title:'满减卡使用说明', - desc1:'使用规则:领卡用户付款时按比例打折,每订单限用1张,每张检测卡限用1次。', - desc2:'资金冻结:发卡即冻结面额资金;用户使用或卡券过期,资金解冻。CopyCheck不冻结资金,按单独约定结算。' + name: '折扣卡', + type: '4', + title: '满减卡使用说明', + desc1: '使用规则:领卡用户付款时按比例打折,每订单限用1张,每张检测卡限用1次。', + desc2: '资金冻结:发卡即冻结面额资金;用户使用或卡券过期,资金解冻。CopyCheck不冻结资金,按单独约定结算。' }, { - name:'时间卡', - type:'5', - title:'满减卡使用说明', - desc1:'使用规则:领卡用户在规定时间范围内,每天有免费次数,用完后当天不可再用,但第二天次数会重置。适用于名下所有站点。', - desc2:'开放范围:仅开放给图尼丁、CopyCheck、Grammarly、AI智能降重、AI范文、AI论文工具、AI校园写作、AI职业写作下的检测服务类型' + name: '时间卡', + type: '5', + title: '满减卡使用说明', + desc1: '使用规则:领卡用户在规定时间范围内,每天有免费次数,用完后当天不可再用,但第二天次数会重置。适用于名下所有站点。', + desc2: '开放范围:仅开放给图尼丁、CopyCheck、Grammarly、AI智能降重、AI范文、AI论文工具、AI校园写作、AI职业写作下的检测服务类型' }, ], - createType:1, + createType: 1, createTypeList: [ { value: 1, @@ -222,7 +240,7 @@ export default { label: '单张生成,适用于临时场景,一次仅生成一张券。', } ], - domainType:1, + domainType: 1, domainTypes: [ { value: 1, @@ -245,67 +263,67 @@ export default { label: '一年', }, ], - walletList:[ + walletList: [ { type: 1, name: '卡密自提', - desc1:'生成链接,用户点击自提', - show:['3','4','5'] + desc1: '生成链接,用户点击自提', + show: ['3', '4', '5'] }, { type: 2, name: '自有渠道发放', - desc1:'生成卡号,自行发放', - show:['1','2','3','4','5'] + desc1: '生成卡号,自行发放', + show: ['1', '2', '3', '4', '5'] }, { type: 3, name: '公众号发放', - desc1:'通过公众号回复,自动发放', - show:['3','4','5'] + desc1: '通过公众号回复,自动发放', + show: ['3', '4', '5'] } - + ], - walletType:1, - link:'', + walletType: 1, + link: '', allData: [ - { - id: '1', - name: '餐饮服务', - children: [ - { id: '0', name: '不限服务' }, - { id: '11', name: '中餐厅' }, - { id: '12', name: '西餐厅' }, - { id: '13', name: '快餐店' } - ] - }, - { - id: '2', - name: '医疗服务', - children: [ - { id: '0', name: '不限服务' }, - { id: '21', name: '综合医院' }, - { id: '22', name: '专科医院' }, - { id: '23', name: '诊所' } - ] - }, - { - id: '3', - name: '教育培训', - children: [] // 没有二级数据 - }, - { - id: '4', - name: '金融服务', - children: [ - { id: '0', name: '不限服务' }, - { id: '41', name: '银行' }, - { id: '42', name: '证券' }, - { id: '43', name: '保险' } - ] - } - ], - + { + id: '1', + name: '餐饮服务', + children: [ + { id: '0', name: '不限服务' }, + { id: '11', name: '中餐厅' }, + { id: '12', name: '西餐厅' }, + { id: '13', name: '快餐店' } + ] + }, + { + id: '2', + name: '医疗服务', + children: [ + { id: '0', name: '不限服务' }, + { id: '21', name: '综合医院' }, + { id: '22', name: '专科医院' }, + { id: '23', name: '诊所' } + ] + }, + { + id: '3', + name: '教育培训', + children: [] // 没有二级数据 + }, + { + id: '4', + name: '金融服务', + children: [ + { id: '0', name: '不限服务' }, + { id: '41', name: '银行' }, + { id: '42', name: '证券' }, + { id: '43', name: '保险' } + ] + } + ], + firstSelected: '', // 一级选择值 secondSelected: '0', // 二级选择值,默认为"不限服务" showSecondSelect: false, // 是否显示二级选择框 @@ -314,20 +332,26 @@ export default { } }, mounted() { - // this.firstOptions = this.allData.map(item => ({ - // value: item.id, - // label: item.name - // })); + }, + created() { + // 确保初始值正确显示 + }, computed: { // 计算当前tab的信息 curTabInfo() { const tab = this.numsList.find(item => item.type == this.curAddTab); return tab || this.numsList[0]; // 如果找不到,返回第一个 + }, + displayDateRange() { + if (this.dateRange[1]) { + return `${this.fixedStartDate} 至 ${this.dateRange[1]}`; + } + return this.fixedStartDate; } }, watch: { - '$route.query.type': function(newVal) { + '$route.query.type': function (newVal) { if (newVal && newVal !== this.curAddTab) { this.curAddTab = newVal; } @@ -337,33 +361,59 @@ export default { console.log('curAddTab变化:', newVal, '类型:', typeof newVal); }, immediate: true - } + }, + }, methods: { - checkFastWord(name){ - this.searchWord = name + // 禁用今天之前的日期 + disabledDate(time) { + const today = new Date(); + today.setHours(0, 0, 0, 0); + return time.getTime() < today.getTime(); + }, + // 格式化日期为 YYYY-MM-DD + formatDate(date) { + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + return `${year}-${month}-${day}`; + }, + // 处理日期变化 + handleDateChange(value) { + console.log('日期范围变化:', value); + + // 确保起始日期始终为固定值 + if (value && value[0] !== this.fixedStartDate) { + // 如果用户尝试修改起始日期,强制改回固定值 + setTimeout(() => { + this.dateRange = [this.fixedStartDate, value[1] || '']; + }, 0); + } + + // 更新显示信息 + this.showDateInfo = true; + }, + checkFastWord(item) { + this.searchWord = item.name; + this.searchWordId = item.id; }, handleFirstChange(value) { - // 根据一级选择的值,找到对应的数据项 + // 根据一级选择的值,找到对应的数据项 const selectedItem = this.allData.find(item => item.id === value); - + if (selectedItem && selectedItem.children && selectedItem.children.length > 0) { // 有二级数据,显示二级选择框 this.showSecondSelect = true; - + // 动态赋值二级选项 - this.secondOptions = selectedItem.children - // .map(child => ({ - // value: child.id, - // label: child.name - // })); - + this.secondOptions = selectedItem.children; + // 设置默认值为"不限服务" const hasUnlimited = selectedItem.children.some(child => child.id === '0'); if (hasUnlimited) { this.secondSelected = '0'; } else if (this.secondOptions.length > 0) { - // 如果没有"不限服务"选项,默认选择第一个 + // 如果没有"不限服务"选项,默认选择第一个 this.secondSelected = this.secondOptions[0].value; } } else { @@ -373,14 +423,6 @@ export default { this.secondSelected = ''; } }, - - handleClickCopy(){ - this.$copy(this.form.input1, { - successMsg: '内容已复制到剪贴板', - errorMsg: '复制失败,请按Ctrl+C手动复制', - vm: this - }); - }, validateSelection() { this.departType = this.departType.filter(item => item !== 0); }, @@ -405,12 +447,12 @@ export default { } } } - \ No newline at end of file