恢复文件
This commit is contained in:
parent
1e393e5571
commit
b15550f65c
|
@ -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()}>
|
||||||
|
|
Loading…
Reference in New Issue