恢复文件

This commit is contained in:
Wind-58 2022-09-07 12:11:39 +08:00
parent 1e393e5571
commit b15550f65c
1 changed files with 44 additions and 29 deletions

View File

@ -184,8 +184,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
product_title: "", product_title: "",
showScopePop: false, showScopePop: false,
scopePopType: "", scopePopType: "",
productData: [], productData: []
selectGoodsScopeData: []
}) })
// //
@ -232,9 +231,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
let el_setup2 = form_rule_el.current.validator() let el_setup2 = form_rule_el.current.validator()
// console.log("el_setup2 =>", el_setup2); // console.log("el_setup2 =>", el_setup2);
// console.log(" =>", form_rule_data); // console.log(" =>", form_rule_data);
//
console.log("用户商品范围 =>", state.selectGoodsScopeData)
} }
const onReturn = () => {} const onReturn = () => {}
@ -261,18 +257,31 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
} }
const onPageChange = () => {} const onPageChange = () => {}
const onCountChange = () => {} const onCountChange = () => {}
// const selectionFun = (e) => {
// console.log("e =>", e) //
// let arr = [] const clearStorageData = () => {
// _.map(e, (item) => { if (state.tableData.length <= 0) {
// let obj = {} sessionStorage.setItem("productData", "")
// obj.key = item.product_id sessionStorage.setItem("knockGoldData", "")
// obj.text = item.product_name }
// arr.push(obj)
// return obj //
// }) let product_data = state.tableData.filter((item) => item.goods_type === 1)
// setState({ selectGoodsScopeData: arr }) if (product_data.length <= 0) {
// } sessionStorage.setItem("productData", "")
} else {
sessionStorage.setItem("productData", JSON.stringify(product_data))
}
//
let knockGold_data = state.tableData.filter((item) => item.goods_type === 2)
if (knockGold_data.length <= 0) {
sessionStorage.setItem("knockGoldData", "")
} else {
sessionStorage.setItem("knockGoldData", JSON.stringify(knockGold_data))
}
}
const addProduct = (type) => { const addProduct = (type) => {
try { try {
// id // id
@ -282,7 +291,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
return return
} }
// //
// clearStorageData() clearStorageData()
// : // :
if (type === "addProduct") { if (type === "addProduct") {
@ -291,11 +300,6 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
addProductBtnLoading: true, addProductBtnLoading: true,
scopePopType: "addProduct" scopePopType: "addProduct"
}) })
//
// console.log("--------1", state.tableData);
// data = JSON.parse(sessionStorage.getItem('productData')).filter(
// (item) => item.type !== 2
// )
} else { } else {
setState({ setState({
product_title: "新增立减金", product_title: "新增立减金",
@ -410,14 +414,23 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
try { try {
// //
let data_new = data let data_new = data
data_new.key_batch_id = form_info_data.key_batch_id.key
data_new.effectDate = `${form_info_data.date_time[0]}${form_info_data.date_time[1]}`
let new_table = state.tableData let new_table = state.tableData
new_table.push(data_new) new_table.push(data_new)
console.log("table_data =>", new_table)
//
let select_opt = []
new_table.map((item) => {
let obj = {}
obj.key = item //
obj.text = item.product_name
select_opt.push(obj)
})
// //
setState({ setState({
tableData: new_table, tableData: new_table,
rankoptions: [] rankoptions: select_opt
}) })
} catch (err) { } catch (err) {
console.log("err =>", err) console.log("err =>", err)
@ -646,7 +659,10 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
return ( return (
<div> <div>
<span className='grid-link'>编辑</span> <span className='grid-link'>编辑</span>
<span style={{ color: "red" }} className='grid-link'> <span
style={{ color: "red" }}
className='grid-link'
onClick={() => deleteGoodsScope(rowIndex)}>
删除 删除
</span> </span>
</div> </div>
@ -654,12 +670,11 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
} }
if (com === "goods_type") { if (com === "goods_type") {
return <span>{rowData.type === 1 ? "商品" : "立减金"}</span> return <span>{rowData.goods_type === 1 ? "商品" : "立减金"}</span>
} }
}} }}
/> />
</Card> </Card>
{isAuditButton ? ( {isAuditButton ? (
<div className='step-btn-group'> <div className='step-btn-group'>
<Button type='primary' onClick={() => submit()}> <Button type='primary' onClick={() => submit()}>