|
@ -31,6 +31,7 @@ function Add(props) { |
|
|
const [couponList, setCouponList] = useState([{ key: createKey() }]); |
|
|
const [couponList, setCouponList] = useState([{ key: createKey() }]); |
|
|
const [ modalVisible, setModalVisible] = useState(false) |
|
|
const [ modalVisible, setModalVisible] = useState(false) |
|
|
const [fileList, setFileList] = useState([]); |
|
|
const [fileList, setFileList] = useState([]); |
|
|
|
|
|
const [phones, setPhones] = useState([]) |
|
|
function createKey() { |
|
|
function createKey() { |
|
|
return Math.random().toString(36).substr(2, 5); |
|
|
return Math.random().toString(36).substr(2, 5); |
|
|
} |
|
|
} |
|
@ -57,7 +58,7 @@ function Add(props) { |
|
|
return item; |
|
|
return item; |
|
|
}); |
|
|
}); |
|
|
setCouponList(_couponList); |
|
|
setCouponList(_couponList); |
|
|
console.log(_couponList); |
|
|
|
|
|
|
|
|
// console.log(_couponList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
const uploadProps = { |
|
|
const uploadProps = { |
|
@ -89,9 +90,11 @@ function Add(props) { |
|
|
}, |
|
|
}, |
|
|
}) |
|
|
}) |
|
|
.then((res) => { console.log(res); return res.json()}) |
|
|
.then((res) => { console.log(res); return res.json()}) |
|
|
.then(() => { |
|
|
|
|
|
|
|
|
.then((res) => { |
|
|
|
|
|
// console.log(res.data.list) |
|
|
message.success('上传成功'); |
|
|
message.success('上传成功'); |
|
|
getData(); |
|
|
|
|
|
|
|
|
// getData(); |
|
|
|
|
|
setPhones(res.data.list) |
|
|
setModalVisible(false) |
|
|
setModalVisible(false) |
|
|
}) |
|
|
}) |
|
|
.catch(() => { |
|
|
.catch(() => { |
|
@ -108,7 +111,7 @@ function Add(props) { |
|
|
.validateFields() |
|
|
.validateFields() |
|
|
.then((values) => { |
|
|
.then((values) => { |
|
|
|
|
|
|
|
|
console.log(values, 'submit values') |
|
|
|
|
|
|
|
|
// console.log(values, 'submit values') |
|
|
let temp = 0; |
|
|
let temp = 0; |
|
|
values.info.map(item=>{ |
|
|
values.info.map(item=>{ |
|
|
temp += parseInt(item.num) |
|
|
temp += parseInt(item.num) |
|
@ -125,12 +128,14 @@ function Add(props) { |
|
|
// num: item.num |
|
|
// num: item.num |
|
|
// }; |
|
|
// }; |
|
|
// }), |
|
|
// }), |
|
|
|
|
|
phones: phones, |
|
|
total: temp |
|
|
total: temp |
|
|
}; |
|
|
}; |
|
|
ajax.handleDistributionOperate(params).then((res) => { |
|
|
ajax.handleDistributionOperate(params).then((res) => { |
|
|
if (res.status === 20000) { |
|
|
if (res.status === 20000) { |
|
|
message.success("添加成功"); |
|
|
message.success("添加成功"); |
|
|
// close(); |
|
|
// close(); |
|
|
|
|
|
getData(); |
|
|
setShowEdit(false); |
|
|
setShowEdit(false); |
|
|
form.resetFields(); |
|
|
form.resetFields(); |
|
|
} |
|
|
} |
|
@ -144,7 +149,7 @@ function Add(props) { |
|
|
|
|
|
|
|
|
return ( |
|
|
return ( |
|
|
<> |
|
|
<> |
|
|
<Form form={form} initialValues={{info: [{key:createKey()}]}} > |
|
|
|
|
|
|
|
|
<Form form={form} initialValues={{info: [{key:createKey()}], sending_type: '2'}} > |
|
|
<Form.Item |
|
|
<Form.Item |
|
|
label="活动名称" |
|
|
label="活动名称" |
|
|
name="activity_name" |
|
|
name="activity_name" |
|
@ -221,7 +226,8 @@ function Add(props) { |
|
|
{/* <Input style={{ width: "20%" }} /> */} |
|
|
{/* <Input style={{ width: "20%" }} /> */} |
|
|
<Select |
|
|
<Select |
|
|
style={{ width: "20%" }} |
|
|
style={{ width: "20%" }} |
|
|
options={[{label: '按用户标签', value: '1'},{label: "按手机", value: "2"}]} |
|
|
|
|
|
|
|
|
// options={[{label: '按用户标签', value: '1'},{label: "按手机", value: "2"}]} |
|
|
|
|
|
options={[{label: "按手机", value: "2"}]} |
|
|
></Select> |
|
|
></Select> |
|
|
</Form.Item> |
|
|
</Form.Item> |
|
|
<Form.Item noStyle shouldUpdate={(prevValues, curValues) => prevValues.sending_type == '1'}> |
|
|
<Form.Item noStyle shouldUpdate={(prevValues, curValues) => prevValues.sending_type == '1'}> |
|
|