From 998e70a753438e3f384878dc2e49bed14b662e4d Mon Sep 17 00:00:00 2001 From: wangsongsole Date: Thu, 25 May 2023 11:10:43 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E7=BA=A2=E5=8C=85=E7=BB=84=E4=BB=B6=E6=95=B0=E6=8D=AE=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/redPackets/index.jsx | 3 +- src/components/redPackets/static.js | 89 +++++++++++++++-------------- 2 files changed, 47 insertions(+), 45 deletions(-) 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 /* 是否为编辑 */ + }; +}