21
This commit is contained in:
parent
98dddd684b
commit
8f37f268b8
|
|
@ -2,36 +2,23 @@ import { request, type ApiResponse, type PagedResult } from '@/utils/request'
|
|||
|
||||
// ==================== 盒子类型枚举 ====================
|
||||
|
||||
/** 盒子类型枚举 */
|
||||
/**
|
||||
* 盒子类型枚举
|
||||
* 注意:这里的值对应数据库 goods_types 表的 value 字段
|
||||
*/
|
||||
export enum GoodsType {
|
||||
YiFanShang = 1, // 一番赏
|
||||
WuXianShang = 2, // 无限赏
|
||||
LeiTaiShang = 3, // 擂台赏
|
||||
FuDai = 5, // 福袋
|
||||
XingYunShang = 6, // 幸运赏
|
||||
LingZhuShang = 8, // 领主赏
|
||||
LianJiShang = 9, // 连击赏
|
||||
MangHe = 10, // 盲盒
|
||||
XingYunShangNew = 11, // 幸运赏(新)
|
||||
ShangChengShang = 10, // 商城赏
|
||||
FuLiWu = 15, // 福利屋
|
||||
FanBeiShang = 16, // 翻倍赏
|
||||
TeShuHeZi = 17, // 特殊盒子
|
||||
}
|
||||
|
||||
/** 盒子类型标签映射 */
|
||||
export const GoodsTypeLabels: Record<number, string> = {
|
||||
[GoodsType.YiFanShang]: '一番赏',
|
||||
[GoodsType.WuXianShang]: '无限赏',
|
||||
[GoodsType.LeiTaiShang]: '擂台赏',
|
||||
[GoodsType.FuDai]: '福袋',
|
||||
[GoodsType.XingYunShang]: '幸运赏',
|
||||
[GoodsType.LingZhuShang]: '领主赏',
|
||||
[GoodsType.LianJiShang]: '连击赏',
|
||||
[GoodsType.MangHe]: '盲盒',
|
||||
[GoodsType.XingYunShangNew]: '幸运赏(新)',
|
||||
[GoodsType.ShangChengShang]: '商城赏',
|
||||
[GoodsType.FuLiWu]: '福利屋',
|
||||
[GoodsType.FanBeiShang]: '翻倍赏',
|
||||
[GoodsType.TeShuHeZi]: '特殊盒子',
|
||||
}
|
||||
|
||||
// ==================== 盒子相关类型定义 ====================
|
||||
|
|
|
|||
|
|
@ -18,11 +18,7 @@
|
|||
v-model="formData.title"
|
||||
placeholder="请输入标题"
|
||||
maxlength="100"
|
||||
:disabled="!isTitleEditable"
|
||||
/>
|
||||
<div v-if="!isTitleEditable" class="form-tip">
|
||||
系统预设单页标题不可编辑
|
||||
</div>
|
||||
</el-form-item>
|
||||
|
||||
<el-form-item label="内容" prop="content">
|
||||
|
|
@ -140,11 +136,6 @@ const editorConfig: Partial<IEditorConfig> = {
|
|||
const formRef = ref<FormInstance>()
|
||||
const submitLoading = ref(false)
|
||||
|
||||
// 标题是否可编辑
|
||||
const isTitleEditable = computed(() => {
|
||||
return props.danye?.isTitleEditable ?? true
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
const formData = reactive({
|
||||
title: '',
|
||||
|
|
@ -276,13 +267,9 @@ const handleSubmit = async () => {
|
|||
submitLoading.value = true
|
||||
try {
|
||||
const submitData: DanyeUpdateRequest = {
|
||||
title: formData.title,
|
||||
content: formData.content
|
||||
}
|
||||
|
||||
// 只有标题可编辑时才提交标题
|
||||
if (isTitleEditable.value) {
|
||||
submitData.title = formData.title
|
||||
}
|
||||
|
||||
await updateDanye(props.danye.id, submitData)
|
||||
ElMessage.success('保存成功')
|
||||
|
|
|
|||
|
|
@ -295,38 +295,32 @@ const prizeLevelOptions = ref<PrizeLevelOptionResponse[]>([])
|
|||
|
||||
// 根据盒子类型判断显示哪些字段
|
||||
const showQuantity = computed(() => {
|
||||
// 一番赏、商城赏、福利屋显示数量
|
||||
return [
|
||||
GoodsType.YiFanShang,
|
||||
GoodsType.LeiTaiShang,
|
||||
GoodsType.FuDai,
|
||||
GoodsType.XingYunShang,
|
||||
GoodsType.MangHe,
|
||||
GoodsType.XingYunShangNew,
|
||||
GoodsType.FuLiWu,
|
||||
GoodsType.TeShuHeZi
|
||||
GoodsType.ShangChengShang,
|
||||
GoodsType.FuLiWu
|
||||
].includes(props.goodsType)
|
||||
})
|
||||
|
||||
const showProbability = computed(() => {
|
||||
return [
|
||||
GoodsType.WuXianShang,
|
||||
GoodsType.LingZhuShang,
|
||||
GoodsType.LianJiShang,
|
||||
GoodsType.FanBeiShang,
|
||||
GoodsType.TeShuHeZi
|
||||
].includes(props.goodsType)
|
||||
// 无限赏显示概率
|
||||
return [GoodsType.WuXianShang].includes(props.goodsType)
|
||||
})
|
||||
|
||||
const showDoubling = computed(() => {
|
||||
return [GoodsType.FanBeiShang, GoodsType.TeShuHeZi].includes(props.goodsType)
|
||||
// 暂无类型显示翻倍
|
||||
return false
|
||||
})
|
||||
|
||||
const showLingzhu = computed(() => {
|
||||
return props.goodsType === GoodsType.LingZhuShang
|
||||
// 暂无类型显示领主
|
||||
return false
|
||||
})
|
||||
|
||||
const showLianji = computed(() => {
|
||||
return props.goodsType === GoodsType.LianJiShang
|
||||
// 暂无类型显示连击
|
||||
return false
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
|
|
|
|||
|
|
@ -291,38 +291,32 @@ const prizeLevelOptions = ref<PrizeLevelOptionResponse[]>([])
|
|||
|
||||
// 根据盒子类型判断显示哪些字段
|
||||
const showQuantity = computed(() => {
|
||||
// 一番赏、商城赏、福利屋显示数量
|
||||
return [
|
||||
GoodsType.YiFanShang,
|
||||
GoodsType.LeiTaiShang,
|
||||
GoodsType.FuDai,
|
||||
GoodsType.XingYunShang,
|
||||
GoodsType.MangHe,
|
||||
GoodsType.XingYunShangNew,
|
||||
GoodsType.FuLiWu,
|
||||
GoodsType.TeShuHeZi
|
||||
GoodsType.ShangChengShang,
|
||||
GoodsType.FuLiWu
|
||||
].includes(props.goodsType)
|
||||
})
|
||||
|
||||
const showProbability = computed(() => {
|
||||
return [
|
||||
GoodsType.WuXianShang,
|
||||
GoodsType.LingZhuShang,
|
||||
GoodsType.LianJiShang,
|
||||
GoodsType.FanBeiShang,
|
||||
GoodsType.TeShuHeZi
|
||||
].includes(props.goodsType)
|
||||
// 无限赏显示概率
|
||||
return [GoodsType.WuXianShang].includes(props.goodsType)
|
||||
})
|
||||
|
||||
const showDoubling = computed(() => {
|
||||
return [GoodsType.FanBeiShang, GoodsType.TeShuHeZi].includes(props.goodsType)
|
||||
// 暂无类型显示翻倍
|
||||
return false
|
||||
})
|
||||
|
||||
const showLingzhu = computed(() => {
|
||||
return props.goodsType === GoodsType.LingZhuShang
|
||||
// 暂无类型显示领主
|
||||
return false
|
||||
})
|
||||
|
||||
const showLianji = computed(() => {
|
||||
return props.goodsType === GoodsType.LianJiShang
|
||||
// 暂无类型显示连击
|
||||
return false
|
||||
})
|
||||
|
||||
// 表单数据
|
||||
|
|
|
|||
|
|
@ -7,20 +7,13 @@
|
|||
|
||||
/**
|
||||
* 盒子类型枚举
|
||||
* 注意:这里的值对应数据库 goods_types 表的 value 字段
|
||||
*/
|
||||
export enum GoodsType {
|
||||
YiFanShang = 1, // 一番赏
|
||||
WuXianShang = 2, // 无限赏
|
||||
LeiTaiShang = 3, // 擂台赏
|
||||
FuDai = 5, // 福袋
|
||||
XingYunShang = 6, // 幸运赏
|
||||
LingZhuShang = 8, // 领主赏
|
||||
LianJiShang = 9, // 连击赏
|
||||
MangHe = 10, // 盲盒
|
||||
XingYunShangNew = 11, // 幸运赏(新)
|
||||
ShangChengShang = 10, // 商城赏(原盲盒)
|
||||
FuLiWu = 15, // 福利屋
|
||||
FanBeiShang = 16, // 翻倍赏
|
||||
TeShuHeZi = 17, // 特殊盒子
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -29,16 +22,8 @@ export enum GoodsType {
|
|||
export const GoodsTypeLabels: Record<number, string> = {
|
||||
[GoodsType.YiFanShang]: '一番赏',
|
||||
[GoodsType.WuXianShang]: '无限赏',
|
||||
[GoodsType.LeiTaiShang]: '擂台赏',
|
||||
[GoodsType.FuDai]: '福袋',
|
||||
[GoodsType.XingYunShang]: '幸运赏',
|
||||
[GoodsType.LingZhuShang]: '领主赏',
|
||||
[GoodsType.LianJiShang]: '连击赏',
|
||||
[GoodsType.MangHe]: '盲盒',
|
||||
[GoodsType.XingYunShangNew]: '幸运赏(新)',
|
||||
[GoodsType.ShangChengShang]: '商城赏',
|
||||
[GoodsType.FuLiWu]: '福利屋',
|
||||
[GoodsType.FanBeiShang]: '翻倍赏',
|
||||
[GoodsType.TeShuHeZi]: '特殊盒子',
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -150,9 +135,15 @@ export const defaultFieldConfig: GoodsTypeFieldConfig = {
|
|||
/**
|
||||
* 盒子类型字段配置映射
|
||||
* 根据不同的盒子类型,显示/隐藏不同的表单字段
|
||||
*
|
||||
* 当前使用的盒子类型(根据数据库 goods_types 表):
|
||||
* - value=1: 一番赏 - 支付方式:微信、钻石、HH币、积分券、优惠券
|
||||
* - value=2: 无限赏 - 支付方式:微信、钻石、HH币、积分券、优惠券
|
||||
* - value=10: 商城赏 - 支付方式:积分券
|
||||
* - value=15: 福利屋 - 支付方式:钻石
|
||||
*/
|
||||
export const GoodsTypeFieldConfigs: Record<number, GoodsTypeFieldConfig> = {
|
||||
// 一番赏:套数、锁箱、每日限购
|
||||
// 一番赏:套数、锁箱、每日限购、首抽五折、首页显示
|
||||
[GoodsType.YiFanShang]: {
|
||||
showStock: true, showLock: true, showDailyLimit: true,
|
||||
showRage: false, showItemCard: false, showLingzhu: false,
|
||||
|
|
@ -162,116 +153,36 @@ export const GoodsTypeFieldConfigs: Record<number, GoodsTypeFieldConfig> = {
|
|||
showCoverImage: true, showDetailImage: true,
|
||||
showPrice: true, showShouZhe: true,
|
||||
},
|
||||
// 无限赏:怒气值、道具卡
|
||||
// 无限赏:不需要套数、锁箱,需要首抽五折
|
||||
[GoodsType.WuXianShang]: {
|
||||
showStock: false, showLock: false, showDailyLimit: false,
|
||||
showRage: true, showItemCard: true, showLingzhu: false,
|
||||
showLianji: false, showTimeConfig: false, showAutoXiajia: false,
|
||||
showCoupon: true, showIntegral: true, showDescription: false,
|
||||
showQuanjuXiangou: false, showShowIs: false, showUnlockAmount: true,
|
||||
showCoverImage: true, showDetailImage: true,
|
||||
showPrice: true, showShouZhe: true,
|
||||
},
|
||||
// 擂台赏(商城赏):不需要详情图
|
||||
[GoodsType.LeiTaiShang]: {
|
||||
showStock: false, showLock: false, showDailyLimit: false,
|
||||
showRage: false, showItemCard: false, showLingzhu: false,
|
||||
showLianji: false, showTimeConfig: false, showAutoXiajia: false,
|
||||
showCoupon: true, showIntegral: true, showDescription: false,
|
||||
showQuanjuXiangou: false, showShowIs: false, showUnlockAmount: true,
|
||||
showCoverImage: true, showDetailImage: false,
|
||||
showPrice: true, showShouZhe: true,
|
||||
},
|
||||
// 福袋:套数
|
||||
[GoodsType.FuDai]: {
|
||||
showStock: true, showLock: false, showDailyLimit: false,
|
||||
showRage: false, showItemCard: false, showLingzhu: false,
|
||||
showLianji: false, showTimeConfig: false, showAutoXiajia: false,
|
||||
showCoupon: false, showIntegral: false, showDescription: false,
|
||||
showQuanjuXiangou: false, showShowIs: false, showUnlockAmount: true,
|
||||
showCoverImage: true, showDetailImage: true,
|
||||
showPrice: true, showShouZhe: true,
|
||||
},
|
||||
// 幸运赏:套数、锁箱、每日限购
|
||||
[GoodsType.XingYunShang]: {
|
||||
showStock: true, showLock: true, showDailyLimit: true,
|
||||
showRage: false, showItemCard: false, showLingzhu: false,
|
||||
showLianji: false, showTimeConfig: false, showAutoXiajia: false,
|
||||
showCoupon: true, showIntegral: true, showDescription: false,
|
||||
showQuanjuXiangou: false, showShowIs: true, showUnlockAmount: true,
|
||||
showCoverImage: true, showDetailImage: true,
|
||||
showPrice: true, showShouZhe: true,
|
||||
},
|
||||
// 领主赏:领主开关、领主返还、领主奖品
|
||||
[GoodsType.LingZhuShang]: {
|
||||
showStock: false, showLock: false, showDailyLimit: false,
|
||||
showRage: false, showItemCard: false, showLingzhu: true,
|
||||
showLianji: false, showTimeConfig: false, showAutoXiajia: false,
|
||||
showCoupon: true, showIntegral: true, showDescription: false,
|
||||
showQuanjuXiangou: false, showShowIs: true, showUnlockAmount: true,
|
||||
showCoverImage: true, showDetailImage: true,
|
||||
showPrice: true, showShouZhe: true,
|
||||
},
|
||||
// 连击赏:连击次数、连击奖品
|
||||
[GoodsType.LianJiShang]: {
|
||||
showStock: false, showLock: false, showDailyLimit: false,
|
||||
showRage: false, showItemCard: false, showLingzhu: false,
|
||||
showLianji: true, showTimeConfig: false, showAutoXiajia: false,
|
||||
showCoupon: true, showIntegral: true, showDescription: false,
|
||||
showQuanjuXiangou: false, showShowIs: true, showUnlockAmount: true,
|
||||
showCoverImage: true, showDetailImage: true,
|
||||
showPrice: true, showShouZhe: true,
|
||||
},
|
||||
// 盲盒:套数、盒子描述
|
||||
[GoodsType.MangHe]: {
|
||||
// 商城赏:套数、盒子描述,不需要详情图、首抽五折
|
||||
[GoodsType.ShangChengShang]: {
|
||||
showStock: true, showLock: false, showDailyLimit: false,
|
||||
showRage: false, showItemCard: false, showLingzhu: false,
|
||||
showLianji: false, showTimeConfig: false, showAutoXiajia: false,
|
||||
showCoupon: false, showIntegral: false, showDescription: true,
|
||||
showQuanjuXiangou: false, showShowIs: false, showUnlockAmount: true,
|
||||
showCoverImage: true, showDetailImage: true,
|
||||
showPrice: true, showShouZhe: true,
|
||||
showCoverImage: true, showDetailImage: false,
|
||||
showPrice: true, showShouZhe: false,
|
||||
},
|
||||
// 幸运赏(新):套数、锁箱、每日限购
|
||||
[GoodsType.XingYunShangNew]: {
|
||||
showStock: true, showLock: true, showDailyLimit: true,
|
||||
showRage: false, showItemCard: false, showLingzhu: false,
|
||||
showLianji: false, showTimeConfig: false, showAutoXiajia: false,
|
||||
showCoupon: true, showIntegral: true, showDescription: false,
|
||||
showQuanjuXiangou: false, showShowIs: true, showUnlockAmount: true,
|
||||
showCoverImage: true, showDetailImage: true,
|
||||
showPrice: true, showShouZhe: true,
|
||||
},
|
||||
// 福利屋:开始/结束/开奖时间,不需要封面图、详情图、价格、首抽五折、限购次数
|
||||
// 福利屋:时间配置、盒子描述,不需要封面图、详情图、价格、首抽五折
|
||||
[GoodsType.FuLiWu]: {
|
||||
showStock: false, showLock: false, showDailyLimit: false,
|
||||
showRage: false, showItemCard: false, showLingzhu: false,
|
||||
showLianji: false, showTimeConfig: true, showAutoXiajia: false,
|
||||
showCoupon: false, showIntegral: false, showDescription: true,
|
||||
showQuanjuXiangou: false, showShowIs: false, showUnlockAmount: true,
|
||||
showQuanjuXiangou: false, showShowIs: false, showUnlockAmount: false,
|
||||
showCoverImage: false, showDetailImage: false,
|
||||
showPrice: false, showShouZhe: false,
|
||||
},
|
||||
// 翻倍赏:怒气值、道具卡
|
||||
[GoodsType.FanBeiShang]: {
|
||||
showStock: false, showLock: false, showDailyLimit: false,
|
||||
showRage: true, showItemCard: true, showLingzhu: false,
|
||||
showLianji: false, showTimeConfig: false, showAutoXiajia: false,
|
||||
showCoupon: true, showIntegral: true, showDescription: false,
|
||||
showQuanjuXiangou: false, showShowIs: false, showUnlockAmount: true,
|
||||
showCoverImage: true, showDetailImage: true,
|
||||
showPrice: true, showShouZhe: true,
|
||||
},
|
||||
// 特殊盒子
|
||||
[GoodsType.TeShuHeZi]: {
|
||||
showStock: false, showLock: false, showDailyLimit: true,
|
||||
showRage: false, showItemCard: false, showLingzhu: false,
|
||||
showLianji: false, showTimeConfig: false, showAutoXiajia: false,
|
||||
showCoupon: false, showIntegral: false, showDescription: false,
|
||||
showQuanjuXiangou: false, showShowIs: false, showUnlockAmount: false,
|
||||
showCoverImage: true, showDetailImage: true,
|
||||
showPrice: true, showShouZhe: true,
|
||||
},
|
||||
}
|
||||
|
||||
// ==================== 奖品列表动态列配置 ====================
|
||||
|
|
@ -291,14 +202,14 @@ export interface PrizeColumnConfig {
|
|||
* 获取奖品列表的动态列配置
|
||||
*/
|
||||
export function getPrizeColumnConfig(goodsType: number): PrizeColumnConfig {
|
||||
// 显示数量列的类型:一番赏、擂台赏、福袋、幸运赏、盲盒、幸运赏(新)、福利屋、特殊盒子
|
||||
const showQuantityTypes = [1, 3, 5, 6, 10, 11, 15, 17]
|
||||
// 显示概率列的类型:无限赏、领主赏、连击赏、翻倍赏、特殊盒子
|
||||
const showProbabilityTypes = [2, 8, 9, 16, 17]
|
||||
// 显示赠送倍率的类型:翻倍赏、特殊盒子
|
||||
const showGiftMultipleTypes = [16, 17]
|
||||
// 显示是否领主的类型:领主赏
|
||||
const showIsLingzhuTypes = [8]
|
||||
// 显示数量列的类型:一番赏、商城赏、福利屋
|
||||
const showQuantityTypes = [1, 10, 15]
|
||||
// 显示概率列的类型:无限赏
|
||||
const showProbabilityTypes = [2]
|
||||
// 显示赠送倍率的类型:暂无
|
||||
const showGiftMultipleTypes: number[] = []
|
||||
// 显示是否领主的类型:暂无
|
||||
const showIsLingzhuTypes: number[] = []
|
||||
|
||||
return {
|
||||
showQuantity: showQuantityTypes.includes(goodsType),
|
||||
|
|
@ -335,14 +246,14 @@ export function getPrizeCategoryName(category: number): string {
|
|||
* 判断盒子类型是否使用概率模式(而非数量模式)
|
||||
*/
|
||||
export function isProbabilityMode(goodsType: number): boolean {
|
||||
// 无限赏、领主赏、连击赏、翻倍赏使用概率模式
|
||||
return [2, 8, 9, 16].includes(goodsType)
|
||||
// 无限赏使用概率模式
|
||||
return [2].includes(goodsType)
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断盒子类型是否支持宝箱奖品
|
||||
*/
|
||||
export function supportsTreasureBox(goodsType: number): boolean {
|
||||
// 一番赏、幸运赏、幸运赏(新)支持宝箱
|
||||
return [1, 6, 11].includes(goodsType)
|
||||
// 一番赏支持宝箱
|
||||
return [1].includes(goodsType)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user