|
|
|
@ -3,7 +3,7 @@ import { useParams } from 'react-router-dom';
|
|
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
import { App, Table, Button, Modal, Popconfirm } from 'antd';
|
|
|
|
|
import { getAgencyProductExtrasAction, getAgencyProductsAction, addProductExtraAction, delProductExtrasAction } from '@/stores/Products/Index';
|
|
|
|
|
import { cloneDeep } from '@/utils/commons';
|
|
|
|
|
import { cloneDeep, pick } from '@/utils/commons';
|
|
|
|
|
import SearchForm from '@/components/SearchForm';
|
|
|
|
|
|
|
|
|
|
import RequireAuth from '@/components/RequireAuth';
|
|
|
|
@ -46,7 +46,7 @@ const NewAddonModal = ({ onPick, ...props }) => {
|
|
|
|
|
title: t('products:price'),
|
|
|
|
|
dataIndex: ['quotation', '0', 'adult_cost'],
|
|
|
|
|
width: '10rem',
|
|
|
|
|
render: (_, { quotation }) => `${quotation[0].adult_cost} ${quotation[0].currency} / ${quotation[0].unit_name}`, // todo: 成人 儿童
|
|
|
|
|
render: (_, { quotation }) => `${quotation[0].adult_cost} ${quotation[0].currency} / ${quotation[0].unit_name}`,
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
key: 'action',
|
|
|
|
@ -120,15 +120,15 @@ const Extras = ({ productId, onChange, ...props }) => {
|
|
|
|
|
const handleNewAddOn = async (item) => {
|
|
|
|
|
setExtrasData(prev => [].concat(prev, [item]));
|
|
|
|
|
// todo: 提交后端; 重复绑定同一个
|
|
|
|
|
const newSuccess = await addProductExtraAction({ travel_agency_id, id: productId, extras: [2] });
|
|
|
|
|
newSuccess ? message.success(t('Action')+t('Success')) : message.error(t('Action')+t('Failed'));
|
|
|
|
|
const _item = pick(item.info, ['id', 'title', 'code']);
|
|
|
|
|
const newSuccess = await addProductExtraAction({ travel_agency_id, id: productId, extras: [_item] });
|
|
|
|
|
newSuccess ? message.success(`${t('Success')}`) : message.error(`${t('Failed')}`);
|
|
|
|
|
await handleGetAgencyProductExtras();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleDelAddon = async (item) => {
|
|
|
|
|
// todo: 提交后端
|
|
|
|
|
const delSuccess = await delProductExtrasAction({ travel_agency_id, id: productId, extras: [2] });
|
|
|
|
|
delSuccess ? message.success(t('Action')+t('Success')) : message.error(t('Action')+t('Failed'));
|
|
|
|
|
const delSuccess = await delProductExtrasAction({ travel_agency_id, id: productId, extras: [item.info.id] });
|
|
|
|
|
delSuccess ? message.success(`${t('Success')}`) : message.error(`${t('Failed')}`);
|
|
|
|
|
await handleGetAgencyProductExtras();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|