diff --git a/src/components/redPackets/index.jsx b/src/components/redPackets/index.jsx index 2349ddd8..cb0f37f8 100644 --- a/src/components/redPackets/index.jsx +++ b/src/components/redPackets/index.jsx @@ -41,8 +41,7 @@ export default class addKnockGold extends Component { constructor(props) { super(props); this.state = { - ...model, - isEdit: !!this.props.data?.id /* 是否为编辑 */ + ...model(this.props) }; } diff --git a/src/components/redPackets/static.js b/src/components/redPackets/static.js index 878d217a..f26fcd5c 100644 --- a/src/components/redPackets/static.js +++ b/src/components/redPackets/static.js @@ -31,47 +31,50 @@ export const week = [ export const earlyPerList = ['70', '50', '30', '20']; /* 表单数据 */ -export const model = { - model: { - channel: '1', // 渠道 - redPackets_type: '1', // 红包类型 - redPackets_batch_id: uuid(28, 18), // 红包批次号 - batch_goods_name: '', // 批次商品名称 - redPackets_number: '', // 红包个数 - denomination: '', // 面额 - all_budget: '', // 总预算 - day_budget: '', // 单天预算 - receive_number: '', //领取个数 - receive_type: 'all', //领取类型 - entry_time: [], // 生效时间 - usable_time: 'notSet', //领取时间段类型 - fixed_time: [], //固定时间 - effect_date_type: '', //生效日期类型 - effect_date: '', //生效日期 - irregularDate: [[]], //不规则日期 - irregularTime: [[]], //不规则时间 - ruleDate: [[]], //规则日期 - ruleWeek: [], //规则周 - instruction: defaultInstructionZfb, //'使用说明', - early_per: [], //'预警百分比', - early_notifier: [] //'预警通知人', - }, - TimeDiffer: '', - warningInput: [], //预警输入框 - input_early_per: '', //预警百分比输入框 - getTimeList: [ - { - key: '0', - text: '立即生效', - disabled: false +export function model(props) { + return { + model: { + channel: '1', // 渠道 + redPackets_type: '1', // 红包类型 + redPackets_batch_id: uuid(28, 18), // 红包批次号 + batch_goods_name: '', // 批次商品名称 + redPackets_number: '', // 红包个数 + denomination: '', // 面额 + all_budget: '', // 总预算 + day_budget: '', // 单天预算 + receive_number: '', //领取个数 + receive_type: 'all', //领取类型 + entry_time: [], // 生效时间 + usable_time: 'notSet', //领取时间段类型 + fixed_time: [], //固定时间 + effect_date_type: '', //生效日期类型 + effect_date: '', //生效日期 + irregularDate: [[]], //不规则日期 + irregularTime: [[]], //不规则时间 + ruleDate: [[]], //规则日期 + ruleWeek: [], //规则周 + instruction: defaultInstructionZfb, //'使用说明', + early_per: [], //'预警百分比', + early_notifier: [] //'预警通知人', }, - { - key: '1', - text: '次日生效', - disabled: false - } - ], - //预警人数据 - userSelectList: [], - form_data: {} -}; + TimeDiffer: '', + warningInput: [], //预警输入框 + input_early_per: '', //预警百分比输入框 + getTimeList: [ + { + key: '0', + text: '立即生效', + disabled: false + }, + { + key: '1', + text: '次日生效', + disabled: false + } + ], + //预警人数据 + userSelectList: [], + form_data: {}, + isEdit: !!props.data?.id /* 是否为编辑 */ + }; +}