当前编辑的产品; 价格表i18n;

perf/export-docx
Lei OT 1 year ago
parent efc12c25a9
commit efa3f052a6

@ -49,7 +49,7 @@
"KM": "KM", "KM": "KM",
"RecommendsRate": "RecommendsRate", "RecommendsRate": "RecommendsRate",
"OpenWeekdays": "Open Weekdays", "OpenWeekdays": "Open Weekdays",
"DisplayToC": "DisplayToC", "DisplayToC": "Display To C",
"Dept": "Dept", "Dept": "Dept",
"productProject": "Product project", "productProject": "Product project",
@ -94,18 +94,22 @@
"Child": "Child" "Child": "Child"
}, },
"save":"save",
"edit":"edit",
"delete":"delete",
"cancel":"cancel",
"sureCancel":"Sure you want to cancel?",
"sureDelete":"Sure you want to delete?",
"CopyFormMsg": { "CopyFormMsg": {
"requiredVendor": "Please pick a target vendor", "requiredVendor": "Please pick a target vendor",
"requiredTypes": "Please select product types", "requiredTypes": "Please select product types",
"requiredDept": "Please pick a owner department" "requiredDept": "Please pick a owner department"
}, },
"quotationTable": {
"Adult": "Adult",
"Child": "Child",
"Currency": "Currency",
"Unit": "Unit",
"GroupSize": "Group Size",
"UseDates": "Use Dates",
"Operation": "Operation",
"Weekdays": "Weekdays"
},
"#": "#" "#": "#"
} }

@ -95,18 +95,22 @@
"Child": "儿童" "Child": "儿童"
}, },
"save":"保存",
"edit":"编辑",
"delete":"删除",
"cancel":"取消",
"sureCancel": "确定取消?",
"sureDelete":"确定删除?",
"CopyFormMsg": { "CopyFormMsg": {
"requiredVendor": "请选择目标供应商", "requiredVendor": "请选择目标供应商",
"requiredTypes": "请选择产品类型", "requiredTypes": "请选择产品类型",
"requiredDept": "请选择所属小组" "requiredDept": "请选择所属小组"
}, },
"quotationTable": {
"Adult": "成人",
"Child": "儿童",
"Currency": "币种",
"Unit": "类型",
"GroupSize": "人等",
"UseDates": "使用日期",
"Weekdays": "周末",
"Operation": "Operation"
},
"#": "#" "#": "#"
} }

@ -39,7 +39,6 @@ export const DeptSelector = ({show_all, isLeaf,...props}) => {
<div> <div>
<Select <Select
mode={props.mode} mode={props.mode}
style={{ width: '100%' }}
placeholder="选择小组" placeholder="选择小组"
labelInValue labelInValue
maxTagCount={1} maxTagCount={1}

@ -213,7 +213,6 @@ function getFields(props) {
99, 99,
<Form.Item name={`invoiceStatus`} initialValue={at(props, 'initialValue.invoiceStatus')[0] || { value: '0', label: 'Status' }}> <Form.Item name={`invoiceStatus`} initialValue={at(props, 'initialValue.invoiceStatus')[0] || { value: '0', label: 'Status' }}>
<Select <Select
style={{ width: '100%' }}
labelInValue labelInValue
options={[ options={[
{ value: '0', label: 'Status' }, { value: '0', label: 'Status' },

@ -88,6 +88,7 @@ const initialState = {
agencyList: [], agencyList: [],
activeAgency: {}, activeAgency: {},
agencyProducts: {}, agencyProducts: {},
editingProduct: {},
}; };
export const useProductsStore = create( export const useProductsStore = create(
devtools((set, get) => ({ devtools((set, get) => ({
@ -100,6 +101,7 @@ export const useProductsStore = create(
setAgencyList: (agencyList) => set({ agencyList }), setAgencyList: (agencyList) => set({ agencyList }),
setActiveAgency: (activeAgency) => set({ activeAgency }), setActiveAgency: (activeAgency) => set({ activeAgency }),
setAgencyProducts: (agencyProducts) => set({ agencyProducts }), setAgencyProducts: (agencyProducts) => set({ agencyProducts }),
setEditingProduct: (editingProduct) => set({ editingProduct }),
reset: () => set(initialState), reset: () => set(initialState),

@ -58,7 +58,9 @@ const Header = ({ title, agency, refresh, ...props }) => {
const PriceTable = ({ productType, dataSource, refresh }) => { const PriceTable = ({ productType, dataSource, refresh }) => {
const { t } = useTranslation('products'); const { t } = useTranslation('products');
const { travel_agency_id, use_year, audit_state } = useParams();
const [loading, activeAgency] = useProductsStore((state) => [state.loading, state.activeAgency]); const [loading, activeAgency] = useProductsStore((state) => [state.loading, state.activeAgency]);
const [setEditingProduct] = useProductsStore((state) => [state.setEditingProduct]);
const { message, notification } = App.useApp(); const { message, notification } = App.useApp();
const stateMapVal = useProductsAuditStatesMapVal(); const stateMapVal = useProductsAuditStatesMapVal();
@ -92,7 +94,10 @@ const PriceTable = ({ productType, dataSource, refresh }) => {
}; };
const columns = [ const columns = [
{ key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan, }), className: 'bg-white', render: (text, r) => text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || '' }, { key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan, }), className: 'bg-white', render: (text, r) => {
const title = text || r.lgc_details?.['2']?.title || r.lgc_details?.['1']?.title || '';
return <Link to={`/products/${travel_agency_id}/${use_year}/${audit_state}/edit`} onClick={() => setEditingProduct(r.info)}>{title}</Link>;
} },
...(productType === 'B' ? [{ key: 'km', dataIndex: ['info', 'km'], title: t('KM')}] : []), ...(productType === 'B' ? [{ key: 'km', dataIndex: ['info', 'km'], title: t('KM')}] : []),
{ key: 'adult', title: t('AgeType.Adult'), render: (_, { adult_cost, currency, unit_id, unit_name }) => `${adult_cost} ${currency} / ${t(`PriceUnit.${unit_id}`)}` }, { key: 'adult', title: t('AgeType.Adult'), render: (_, { adult_cost, currency, unit_id, unit_name }) => `${adult_cost} ${currency} / ${t(`PriceUnit.${unit_id}`)}` },
{ key: 'child', title: t('AgeType.Child'), render: (_, { child_cost, currency, unit_id, unit_name }) => `${child_cost} ${currency} / ${t(`PriceUnit.${unit_id}`)}` }, { key: 'child', title: t('AgeType.Child'), render: (_, { child_cost, currency, unit_id, unit_name }) => `${child_cost} ${currency} / ${t(`PriceUnit.${unit_id}`)}` },
@ -114,11 +119,12 @@ const PriceTable = ({ productType, dataSource, refresh }) => {
key: 'state', key: 'state',
title: t('State'), title: t('State'),
render: (_, r) => { render: (_, r) => {
return <span className={`text-${stateMapVal[`${r.audit_state_id}`]?.color}`}>{stateMapVal[`${r.audit_state_id}`]?.label}</span>; const stateCls = `text-${stateMapVal[`${r.audit_state_id}`]?.color} `;
return <span className={stateCls}>{stateMapVal[`${r.audit_state_id}`]?.label}</span>;
}, },
}, },
{ {
title: '价格审核', title: '',
key: 'action', key: 'action',
render: (_, r) => render: (_, r) =>
r.audit_state_id <= 0 ? ( r.audit_state_id <= 0 ? (

@ -1,4 +1,4 @@
import { useEffect, useState } from 'react'; import { useEffect, useState, useSyncExternalStore } from 'react';
import { useParams } from 'react-router-dom'; import { useParams } from 'react-router-dom';
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { App, Table, Button, Modal, Popconfirm } from 'antd'; import { App, Table, Button, Modal, Popconfirm } from 'antd';
@ -24,11 +24,12 @@ const NewAddonModal = ({ onPick, ...props }) => {
const onSearchProducts = async (values) => { const onSearchProducts = async (values) => {
const copyObject = cloneDeep(values); const copyObject = cloneDeep(values);
const { starttime, endtime, ...param } = copyObject; const { starttime, endtime, year, ...param } = copyObject;
setSearchLoading(true); setSearchLoading(true);
setSearchResult([]); setSearchResult([]);
// debug: audit_state: '1', // debug: audit_state: '1',
const result = await getAgencyProductsAction({ ...param, audit_state: '0', travel_agency_id, use_year }); const search_year = year || use_year;
const result = await getAgencyProductsAction({ ...param, travel_agency_id, use_year: search_year, audit_state: '0', });
setSearchResult(result?.products || []); setSearchResult(result?.products || []);
setSearchLoading(false); setSearchLoading(false);
}; };
@ -71,7 +72,7 @@ const NewAddonModal = ({ onPick, ...props }) => {
<Modal width={'95%'} style={{ top: 20 }} open={open} title={'添加附加'} footer={false} onCancel={() => setOpen(false)} destroyOnClose> <Modal width={'95%'} style={{ top: 20 }} open={open} title={'添加附加'} footer={false} onCancel={() => setOpen(false)} destroyOnClose>
<SearchForm <SearchForm
fieldsConfig={{ fieldsConfig={{
shows: ['dates', 'year', 'keyword'], shows: [ 'year', 'keyword'], // 'dates',
fieldProps: { fieldProps: {
dates: { label: t('products:CreateDate') }, dates: { label: t('products:CreateDate') },
keyword: { label: t('products:Title'), col: 4 }, keyword: { label: t('products:Title'), col: 4 },

Loading…
Cancel
Save