更新
This commit is contained in:
@@ -45,6 +45,14 @@ export interface PromotionAutomationConfig {
|
||||
welcome_schedule: WelcomeSlot[]
|
||||
}
|
||||
|
||||
export type PromotionAutomationSaveConfig = Omit<PromotionAutomationConfig,
|
||||
'tags_enabled' | 'remark_enabled' | 'description_enabled' | 'welcome_schedule_enabled'> & {
|
||||
tags_enabled: 0 | 1
|
||||
remark_enabled: 0 | 1
|
||||
description_enabled: 0 | 1
|
||||
welcome_schedule_enabled: 0 | 1
|
||||
}
|
||||
|
||||
export const weekdays = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日']
|
||||
export const templateTokens = [
|
||||
{ label: '客户昵称', value: '{customer_name}' },
|
||||
@@ -93,6 +101,17 @@ export function cloneAutomationConfig(source?: Partial<PromotionAutomationConfig
|
||||
}
|
||||
}
|
||||
|
||||
/** Keep the save payload compatible with backends and transports that use 0/1 switches. */
|
||||
export function serializeAutomationConfig(config: PromotionAutomationConfig): PromotionAutomationSaveConfig {
|
||||
return {
|
||||
...config,
|
||||
tags_enabled: config.tags_enabled ? 1 : 0,
|
||||
remark_enabled: config.remark_enabled ? 1 : 0,
|
||||
description_enabled: config.description_enabled ? 1 : 0,
|
||||
welcome_schedule_enabled: config.welcome_schedule_enabled ? 1 : 0
|
||||
}
|
||||
}
|
||||
|
||||
export function previewTemplate(template: string, employee = '小陈', limit?: number): string {
|
||||
const date = new Intl.DateTimeFormat('en-CA', {
|
||||
timeZone: 'Asia/Shanghai', year: 'numeric', month: '2-digit', day: '2-digit'
|
||||
|
||||
@@ -474,7 +474,7 @@
|
||||
:disabled="accessForm.action === 'grant' && !operator.can_grant"
|
||||
/>
|
||||
</el-select>
|
||||
<span class="form-tip">添加时仅可选择已启用且拥有本页面权限的账号;失效账号仍可用于移除历史授权。</span>
|
||||
<span class="form-tip">添加时可选择当前管理范围内的启用账号;授权后账号会自动获得本页面入口,且只能访问已授权方案。</span>
|
||||
</el-form-item>
|
||||
<div v-if="accessDialogPools.length" class="access-pool-preview">
|
||||
<strong>当前授权</strong>
|
||||
@@ -538,7 +538,7 @@ import type { WecomPromotionCustomerChatStatus } from '@/api/first_visit'
|
||||
|
||||
import WecomFloatingWidgetBuilder from './components/WecomFloatingWidgetBuilder.vue'
|
||||
import PromotionAutomationForm from './components/PromotionAutomationForm.vue'
|
||||
import { cloneAutomationConfig, defaultAutomationConfig, isWebUrl, validateAutomationConfig } from './components/promotion-automation'
|
||||
import { cloneAutomationConfig, defaultAutomationConfig, isWebUrl, serializeAutomationConfig, validateAutomationConfig } from './components/promotion-automation'
|
||||
|
||||
type TabName = 'links' | 'customer-stats' | 'configuration' | 'install'
|
||||
|
||||
@@ -734,9 +734,7 @@ function operatorOptionLabel(operator: PromotionOperatorOption) {
|
||||
const departments = Array.isArray(operator.dept_names) && operator.dept_names.length
|
||||
? operator.dept_names.join(' / ')
|
||||
: '未分部门'
|
||||
const unavailable = Number(operator.disable) === 1
|
||||
? ' · 已禁用'
|
||||
: (!operator.can_grant ? ' · 无页面权限' : '')
|
||||
const unavailable = Number(operator.disable) === 1 ? ' · 已禁用' : ''
|
||||
return `${operator.name} · ${departments}${unavailable}`
|
||||
}
|
||||
|
||||
@@ -806,7 +804,7 @@ async function savePool() {
|
||||
...base,
|
||||
name: poolForm.name.trim(),
|
||||
fallback_url: poolForm.fallback_url.trim(),
|
||||
...(overview.automation_installed ? { automation_config: automation } : {})
|
||||
...(overview.automation_installed ? { automation_config: serializeAutomationConfig(automation) } : {})
|
||||
})
|
||||
poolDialogVisible.value = false
|
||||
await loadOverview()
|
||||
|
||||
Reference in New Issue
Block a user