|
|
@@ -3,6 +3,7 @@ import { |
|
|
|
InputNumber, |
|
|
|
Row, |
|
|
|
Col, |
|
|
|
Switch, |
|
|
|
Checkbox, |
|
|
|
Space, |
|
|
|
Steps, |
|
|
@@ -123,6 +124,7 @@ const CreateForm = (props) => { |
|
|
|
result = quantityLimit[key].limit; |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(result); |
|
|
|
return result; |
|
|
|
}; |
|
|
|
const uploadProp = { |
|
|
@@ -151,7 +153,17 @@ const CreateForm = (props) => { |
|
|
|
let fileData = null; |
|
|
|
GetCosRequestURL({ directory: "activity", fileExtension: ext, method: "PUT" }).then((r) => { |
|
|
|
action = r.allUrl; |
|
|
|
var index = file.name.lastIndexOf("."); |
|
|
|
//获取后缀 |
|
|
|
var ext = file.name.substr(index + 1); |
|
|
|
const reader = new FileReader(); |
|
|
|
|
|
|
|
if (['png', 'jpg', 'jpeg', 'bmp', 'gif', 'webp', 'psd', 'svg', 'tiff'].indexOf(ext) == -1) |
|
|
|
{ |
|
|
|
message.error(`${file.name} 不是图片文件`); |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
reader.readAsArrayBuffer(file); |
|
|
|
reader.onload = (e) => { |
|
|
|
fileData = e.target.result; |
|
|
@@ -252,25 +264,89 @@ const CreateForm = (props) => { |
|
|
|
{'买满赠送(商品)'} |
|
|
|
</Option> |
|
|
|
<Option key={6} value={6}> |
|
|
|
{'消费次数换购(阶梯)'} |
|
|
|
{'累计消费换购(阶梯)'} |
|
|
|
</Option> |
|
|
|
<Option key={7} value={7}> |
|
|
|
{'消费次数换购(循环)'} |
|
|
|
{'累计消费换购(循环)'} |
|
|
|
</Option > |
|
|
|
<Option key={8} value={8}> |
|
|
|
{'加价换购'} |
|
|
|
</Option> |
|
|
|
</Select > |
|
|
|
</Form.Item > |
|
|
|
|
|
|
|
<Form.Item |
|
|
|
noStyle |
|
|
|
shouldUpdate={(prevValues, currentValues) => |
|
|
|
prevValues.activityType !== currentValues.activityType |
|
|
|
} |
|
|
|
> |
|
|
|
} > |
|
|
|
{({ getFieldValue }) => |
|
|
|
(getFieldValue('activityType') == '6' || getFieldValue('activityType') == '7') ? ( |
|
|
|
<Form.Item> |
|
|
|
<Form.Item |
|
|
|
name="isGiftGoodsParticipate" |
|
|
|
label="赠送商品是否参与活动" |
|
|
|
rules={[ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
}, |
|
|
|
]} |
|
|
|
> |
|
|
|
<Select |
|
|
|
showSearch |
|
|
|
optionFilterProp="children" |
|
|
|
filterOption={(input, option) => |
|
|
|
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
|
|
|
} |
|
|
|
placeholder="请选活动消费类型" |
|
|
|
> |
|
|
|
<Option key={1} value={1}> |
|
|
|
{'是'} |
|
|
|
</Option> |
|
|
|
<Option key={0} value={0}> |
|
|
|
{'否'} |
|
|
|
</Option> |
|
|
|
</Select > |
|
|
|
</Form.Item> |
|
|
|
<Form.Item |
|
|
|
name="consumptionType" |
|
|
|
label="活动消费类型" |
|
|
|
rules={[ |
|
|
|
{ |
|
|
|
required: true, |
|
|
|
}, |
|
|
|
]} |
|
|
|
> |
|
|
|
<Select |
|
|
|
showSearch |
|
|
|
optionFilterProp="children" |
|
|
|
filterOption={(input, option) => |
|
|
|
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
|
|
|
} |
|
|
|
placeholder="请选活动消费类型" |
|
|
|
> |
|
|
|
<Option key={1} value={1}> |
|
|
|
{'钱(元)'} |
|
|
|
</Option> |
|
|
|
<Option key={2} value={2}> |
|
|
|
{'数量(杯/碗/盒/个/.....)'} |
|
|
|
</Option> |
|
|
|
</Select > |
|
|
|
</Form.Item> |
|
|
|
</Form.Item> |
|
|
|
|
|
|
|
) : null |
|
|
|
} |
|
|
|
</Form.Item> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<Form.Item |
|
|
|
noStyle |
|
|
|
shouldUpdate={(prevValues, currentValues) => |
|
|
|
prevValues.activityType !== currentValues.activityType |
|
|
|
} > |
|
|
|
{({ getFieldValue }) => |
|
|
|
// (getFieldValue('activityType') == '6' || getFieldValue('activityType') == '7') ? ( |
|
|
|
|
|
|
|
// <Form.Item label="消费次数"> |
|
|
@@ -376,12 +452,12 @@ const CreateForm = (props) => { |
|
|
|
})} |
|
|
|
</Select>) : |
|
|
|
(getFieldValue('activityType') == '5' || getFieldValue('activityType') == '8') ? ( |
|
|
|
<Select style={{ width: 200 }} |
|
|
|
showSearch |
|
|
|
optionFilterProp="children" |
|
|
|
filterOption={(input, option) => |
|
|
|
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
|
|
|
} > |
|
|
|
<Select style={{ width: 200 }} |
|
|
|
showSearch |
|
|
|
optionFilterProp="children" |
|
|
|
filterOption={(input, option) => |
|
|
|
option.children.toLowerCase().indexOf(input.toLowerCase()) >= 0 |
|
|
|
} > |
|
|
|
{goodsInfo.map((item, index) => { |
|
|
|
return ( |
|
|
|
<Option index={index} value={item.id} key={item.id}> |
|
|
@@ -533,7 +609,7 @@ const CreateForm = (props) => { |
|
|
|
type: 'number', |
|
|
|
min: 0, |
|
|
|
max: parseInt( |
|
|
|
getFieldValue('activityType') == 4 ? 999999999 : canUseCountOrlimit(key, props.values.activityRewards, 2), |
|
|
|
getFieldValue('activityType') == 4 ? 999999999 : canUseCountOrlimit(key, props.values.activityRewards, 1), |
|
|
|
), |
|
|
|
message: '超出领取限制', |
|
|
|
}, |
|
|
@@ -541,7 +617,7 @@ const CreateForm = (props) => { |
|
|
|
> |
|
|
|
<InputNumber |
|
|
|
min={0} |
|
|
|
max={getFieldValue('activityType') == 4 ? 999999999 : canUseCountOrlimit(key, props.values.activityRewards, 2)} |
|
|
|
max={getFieldValue('activityType') == 4 ? 999999999 : canUseCountOrlimit(key, props.values.activityRewards, 1)} |
|
|
|
placeholder={getFieldValue('activityType') == 4 ? "兑换值" : "每次领取数量"} |
|
|
|
/> |
|
|
|
</Form.Item> |
|
|
@@ -571,7 +647,10 @@ const CreateForm = (props) => { |
|
|
|
style={{ float: 'left' }} |
|
|
|
rules={[{ required: true }]} |
|
|
|
> |
|
|
|
<DatePicker placeholder="开始时间" /> |
|
|
|
<DatePicker placeholder="开始时间" |
|
|
|
disabledDate={(current) => { |
|
|
|
return current && current > form.getFieldValue('activityEndTime'); |
|
|
|
}} /> |
|
|
|
</Form.Item> |
|
|
|
<Form.Item |
|
|
|
name="activityEndTime" |
|
|
@@ -579,7 +658,11 @@ const CreateForm = (props) => { |
|
|
|
style={{ float: 'left', marginLeft: 20 }} |
|
|
|
rules={[{ required: true }]} |
|
|
|
> |
|
|
|
<DatePicker placeholder="结束时间" /> |
|
|
|
<DatePicker placeholder="结束时间" |
|
|
|
disabledDate={(current) => { |
|
|
|
|
|
|
|
return current && current < form.getFieldValue('activityStartTime'); |
|
|
|
}} /> |
|
|
|
</Form.Item> |
|
|
|
</Form.Item> |
|
|
|
</Form.Item> |
|
|
|