1) 增加优惠券时间

This commit is contained in:
zhangds 2022-09-05 18:33:24 +08:00
parent 9e7055ed52
commit 5c6328a49c
2 changed files with 100 additions and 9 deletions

View File

@ -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;

View File

@ -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) {