Merge branch 'couponV2.0' of codeup.aliyun.com:5f9118049cffa29cfdd3be1c/marketing/frontend into couponV2.0

This commit is contained in:
wangsongsole 2022-10-24 11:41:42 +08:00
commit dd29248466
3 changed files with 20 additions and 2 deletions

View File

@ -216,6 +216,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
status: -1,
statusDisabled: false, // 312
productType: 1,
checkedProduct: [],
});
//
@ -850,6 +851,14 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
}
};
// ()
const getCheckedProduct = () => {
console.log("state.tableData =>", state.tableData);
let arr = state.tableData.map((item) => item.product_id);
return arr;
};
//
const addProduct = (type) => {
try {
// id
@ -870,6 +879,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
setState({
product_title: "新建商品",
scopePopType: "addProduct",
checkedProduct: getCheckedProduct(), //
productData: null,
table_index: -1,
productType: 1,
@ -1423,6 +1433,7 @@ const UseCouponAddEdit = forwardRef((props, ref) => {
productData={state.productData}
onClose={() => scopePopClose()}
tableData={state.tableData}
checkedProduct={state.checkedProduct}
table_index={state.table_index}
directResellerId={state.direct_reseller_id}
productType={state.productType}

View File

@ -19,6 +19,7 @@ const UseGoodsScopePop = forwardRef((props, ref) => {
table_index,
directResellerId,
productType,
checkedProduct,
} = props;
// ref
@ -131,6 +132,7 @@ const UseGoodsScopePop = forwardRef((props, ref) => {
) : (
<UseProductPop
ref={productEl}
checkedProduct={checkedProduct}
productData={productData}
directResellerId={directResellerId}
productType={productType}

View File

@ -61,7 +61,7 @@ const formRules = {
};
const UseProductPop = forwardRef((props, ref) => {
const { productData, directResellerId, productType } = props;
const { productData, checkedProduct, directResellerId, productType } = props;
const formEl = useRef(null);
const swiperWrapperEl = useRef(null);
@ -160,13 +160,18 @@ const UseProductPop = forwardRef((props, ref) => {
setState({
productDataAll: req.data,
});
let optArr = req.data.map((item) => {
return {
key: item.id,
text: item.title,
disabled:
checkedProduct.indexOf(item.id) !== -1 ? true : false,
};
});
console.log("opt-arr =>", optArr);
console.log("checkedProduct =>", checkedProduct);
//
setState({ productOption: optArr });
resolve(optArr);
},