|
|
@ -26,9 +26,9 @@ function CouponRules() { |
|
|
|
const [showEdit, setShowEdit] = useState(false) |
|
|
|
|
|
|
|
const [formData, setFormData] = useSetState({ |
|
|
|
name: defaultParams ? defaultParams.name : '', |
|
|
|
status: defaultParams ? defaultParams.status : '0', |
|
|
|
coupon_type: defaultParams ? defaultParams.coupon_type : '0', |
|
|
|
name: defaultParams.name ? defaultParams.name : '', |
|
|
|
status: defaultParams.status ? defaultParams.status : '0', |
|
|
|
coupon_type: defaultParams.coupon_type != undefined ? defaultParams.coupon_type : 0, |
|
|
|
}) |
|
|
|
const [operatorOptions, setOperatorOptions] = useState([]) // 运营商下拉框 |
|
|
|
const [departOptions, setDepartOptions] = useState([]) |
|
|
@ -257,7 +257,7 @@ function CouponRules() { |
|
|
|
|
|
|
|
const addCoupon = ()=>{ |
|
|
|
setShowEdit(true) |
|
|
|
setCurrentCouponInfo({type: 1}) |
|
|
|
setCurrentCouponInfo({type: 1, mode: 1, partner: '青岛'}) |
|
|
|
} |
|
|
|
|
|
|
|
const onTransferChange = (nextTargetKeys, direction, moveKeys) => { |
|
|
@ -383,7 +383,7 @@ function CouponRules() { |
|
|
|
} |
|
|
|
}else if(currentCouponInfo.type == 2){ // 满减 |
|
|
|
if(!currentCouponInfo.value){ |
|
|
|
message.error('优惠券面值不能为空') |
|
|
|
message.error('优惠券面值不能为空或者0') |
|
|
|
return false |
|
|
|
} |
|
|
|
if(!currentCouponInfo.value_condition){ |
|
|
@ -400,9 +400,16 @@ function CouponRules() { |
|
|
|
message.error('欠费时长不能为空') |
|
|
|
return false |
|
|
|
} |
|
|
|
if(currentCouponInfo.effective_date == 1 && currentCouponInfo.effctive_value?.length == 1){ |
|
|
|
message.error('固定日期不能为空') |
|
|
|
return false |
|
|
|
if(currentCouponInfo.effective_date == 1){ |
|
|
|
if(currentCouponInfo.effctive_value?.length == 1){ |
|
|
|
message.error('固定日期不能为空') |
|
|
|
return false |
|
|
|
} |
|
|
|
if(new Date().getTime() - new Date(currentCouponInfo.effctive_value.split(',')[0]).getTime() > 24*3600*1000){ |
|
|
|
message.error('固定日期只能选择当前时间以后的时间段') |
|
|
|
return false |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(currentCouponInfo.use_scope == 1 && currentCouponInfo.use_content == ''){ |
|
|
@ -444,7 +451,7 @@ function CouponRules() { |
|
|
|
useEffect(()=>{ |
|
|
|
if(currentCouponInfo.effective_date == 1 ){ |
|
|
|
if(!currentCouponInfo.effctive_value){ |
|
|
|
setCurrentCouponInfo({...currentCouponInfo, effctive_value: utils.createTimeRange(180) }) |
|
|
|
setCurrentCouponInfo({...currentCouponInfo, effctive_value: utils.createTimeRange(-180) }) |
|
|
|
} |
|
|
|
} |
|
|
|
if(currentCouponInfo.effective_date == 2 ){ |
|
|
@ -513,7 +520,7 @@ function CouponRules() { |
|
|
|
<FormSelect |
|
|
|
yisaLabel="优惠券类型" |
|
|
|
yisaData={sysConfig.coupon} |
|
|
|
defaultValue={ formData.coupon_type || null } |
|
|
|
defaultValue={ formData.coupon_type } |
|
|
|
placeholder="" |
|
|
|
hasUnlimited={ false } |
|
|
|
showClose={true} |
|
|
@ -712,6 +719,8 @@ function CouponRules() { |
|
|
|
yisaLabel="优惠券名称" |
|
|
|
isRequired={true} |
|
|
|
placeholder="" |
|
|
|
showCount={true} |
|
|
|
maxLength={20} |
|
|
|
disabled={justCheck} |
|
|
|
value={currentCouponInfo.name} |
|
|
|
showClose={true} |
|
|
@ -719,16 +728,24 @@ function CouponRules() { |
|
|
|
/> |
|
|
|
<FormRadio |
|
|
|
yisaLabel="模式" |
|
|
|
required={true} |
|
|
|
isRequired={true} |
|
|
|
disabled={justCheck} |
|
|
|
value={currentCouponInfo.mode} |
|
|
|
options={[{value: 1, label: '自有券'},{value: 2, label: '合作券'}]} |
|
|
|
onChange={e=>{setCurrentCouponInfo({...currentCouponInfo, mode: e.target.value});}} |
|
|
|
onChange={e=>{ |
|
|
|
if(e.target.value == 1){ |
|
|
|
setCurrentCouponInfo({...currentCouponInfo, mode: 1, partner: '青岛'}); |
|
|
|
} else{ |
|
|
|
setCurrentCouponInfo({...currentCouponInfo, mode: 2, partner: ''}); |
|
|
|
} |
|
|
|
}} |
|
|
|
/> |
|
|
|
<FormInput |
|
|
|
yisaLabel="合作方" |
|
|
|
isRequired={true} |
|
|
|
placeholder="" |
|
|
|
showCount={true} |
|
|
|
maxLength={20} |
|
|
|
value={currentCouponInfo.partner} |
|
|
|
disabled={justCheck | currentCouponInfo.mode == 1 } |
|
|
|
showClose={true} |
|
|
@ -848,12 +865,12 @@ function CouponRules() { |
|
|
|
yisaLabel=" " |
|
|
|
disabled={justCheck} |
|
|
|
isRequired={true} |
|
|
|
format="YYYY-MM-DD" |
|
|
|
limit={180} |
|
|
|
format="YYYY-MM-DD HH:mm:ss" |
|
|
|
limit={720} |
|
|
|
labelPosition="left" |
|
|
|
showTime={false} |
|
|
|
// showTime={true} |
|
|
|
onChange={(e)=>{setCurrentCouponInfo({...currentCouponInfo, effctive_value: e.join(',')})}} |
|
|
|
value={currentCouponInfo.effctive_value ? currentCouponInfo.effctive_value : utils.createTimeRange(180)} |
|
|
|
value={currentCouponInfo.effctive_value ? currentCouponInfo.effctive_value : utils.createTimeRange(-180)} |
|
|
|
/> : |
|
|
|
currentCouponInfo.effective_date == 2? |
|
|
|
<div className="custom-time-setting"> |
|
|
|