1) 增加优惠券时间
This commit is contained in:
parent
9e7055ed52
commit
5c6328a49c
|
@ -0,0 +1,96 @@
|
|||
import React, { forwardRef, useImperativeHandle, useRef } from "react";
|
||||
import { Card, Drawer, Button } from "zent";
|
||||
|
||||
import Productform from "@/pages/plan/product/add"; /* 商品 */
|
||||
import KnockGold from "@/components/knockGold"; /* 立减金 */
|
||||
|
||||
import _ from "lodash";
|
||||
|
||||
const UseGoodsScopePop = forwardRef((props, ref) => {
|
||||
const { product_title, drawerVisible, onClose, type, productData, submit } =
|
||||
props;
|
||||
|
||||
// 如果需要 通过ref 控制此组件 放开注释
|
||||
// useImperativeHandle(ref, () => ({
|
||||
// submit: submitPop,
|
||||
// }));
|
||||
|
||||
const product_el = useRef(null);
|
||||
const knockGold_el = useRef(null);
|
||||
|
||||
// 提交数据
|
||||
const submitPop = async () => {
|
||||
let scope_table_data = [];
|
||||
let temp = null;
|
||||
let concatData = [];
|
||||
|
||||
// 第一步:判断是立减金还是新建商品
|
||||
let visible = false;
|
||||
if (type === "addProduct") {
|
||||
visible = await product_el.current.submit();
|
||||
} else {
|
||||
visible = await knockGold_el.current.submit();
|
||||
}
|
||||
|
||||
try {
|
||||
if (visible) {
|
||||
scope_table_data = sessionStorage.getItem("productData");
|
||||
if (scope_table_data) {
|
||||
scope_table_data = JSON.parse(scope_table_data);
|
||||
}
|
||||
// 第二步: 数据格式化
|
||||
if (type === "addProduct") {
|
||||
}
|
||||
console.log("提交数据 =>", scope_table_data);
|
||||
|
||||
// submit(JSON.parse(scope_table_data));
|
||||
onClose();
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("err =>", err);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
className="draw"
|
||||
width={"86%"}
|
||||
title={product_title}
|
||||
footer={
|
||||
<div style={{ textAlign: "center" }}>
|
||||
<Button
|
||||
type="primary"
|
||||
onClick={(e) => {
|
||||
submitPop();
|
||||
}}
|
||||
>
|
||||
提交
|
||||
</Button>
|
||||
<Button onClick={(e) => onClose()}>取消</Button>
|
||||
</div>
|
||||
}
|
||||
visible={drawerVisible}
|
||||
onClose={(e) => onClose()}
|
||||
maskClosable={false}
|
||||
>
|
||||
<div className="draw2">
|
||||
<Card
|
||||
className="borderNone"
|
||||
style={{ width: "95%", margin: "10px auto" }}
|
||||
>
|
||||
{type === "addKnockGold" ? (
|
||||
<KnockGold
|
||||
className="addKnockGold"
|
||||
data={productData}
|
||||
ref={knockGold_el}
|
||||
/>
|
||||
) : (
|
||||
<Productform data={productData} ref={product_el}></Productform>
|
||||
)}
|
||||
</Card>
|
||||
</div>
|
||||
</Drawer>
|
||||
);
|
||||
});
|
||||
|
||||
export default UseGoodsScopePop;
|
|
@ -1,6 +1,8 @@
|
|||
import React, { forwardRef, useImperativeHandle, useRef } from "react";
|
||||
import { Card, Drawer, Button } from "zent";
|
||||
|
||||
import { deWeightThree } from "@/utils";
|
||||
|
||||
import Productform from "@/pages/plan/product/add"; /* 商品 */
|
||||
import KnockGold from "@/components/knockGold"; /* 立减金 */
|
||||
|
||||
|
@ -21,9 +23,6 @@ const UseGoodsScopePop = forwardRef((props, ref) => {
|
|||
// 提交数据
|
||||
const submitPop = async () => {
|
||||
let scope_table_data = [];
|
||||
let temp = null;
|
||||
let concatData = [];
|
||||
|
||||
// 第一步:判断是立减金还是新建商品
|
||||
let visible = false;
|
||||
if (type === "addProduct") {
|
||||
|
@ -34,16 +33,12 @@ const UseGoodsScopePop = forwardRef((props, ref) => {
|
|||
|
||||
try {
|
||||
if (visible) {
|
||||
// 第二步:数据格式化
|
||||
scope_table_data = sessionStorage.getItem("productData");
|
||||
if (scope_table_data) {
|
||||
scope_table_data = JSON.parse(scope_table_data);
|
||||
}
|
||||
// 第二步: 数据格式化
|
||||
if (type === "addProduct") {
|
||||
}
|
||||
console.log("提交数据 =>", scope_table_data);
|
||||
|
||||
// submit(JSON.parse(scope_table_data));
|
||||
console.log("所有数据:", scope_table_data);
|
||||
onClose();
|
||||
}
|
||||
} catch (err) {
|
||||
|
|
Loading…
Reference in New Issue