恢复文件

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