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

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

@ -49,7 +49,7 @@
"KM": "KM",
"RecommendsRate": "RecommendsRate",
"OpenWeekdays": "Open Weekdays",
"DisplayToC": "DisplayToC",
"DisplayToC": "Display To C",
"Dept": "Dept",
"productProject": "Product project",
@ -94,18 +94,22 @@
"Child": "Child"
},
"save":"save",
"edit":"edit",
"delete":"delete",
"cancel":"cancel",
"sureCancel":"Sure you want to cancel?",
"sureDelete":"Sure you want to delete?",
"CopyFormMsg": {
"requiredVendor": "Please pick a target vendor",
"requiredTypes": "Please select product types",
"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": "儿童"
},
"save":"保存",
"edit":"编辑",
"delete":"删除",
"cancel":"取消",
"sureCancel": "确定取消?",
"sureDelete":"确定删除?",
"CopyFormMsg": {
"requiredVendor": "请选择目标供应商",
"requiredTypes": "请选择产品类型",
"requiredDept": "请选择所属小组"
},
"quotationTable": {
"Adult": "成人",
"Child": "儿童",
"Currency": "币种",
"Unit": "类型",
"GroupSize": "人等",
"UseDates": "使用日期",
"Weekdays": "周末",
"Operation": "Operation"
},
"#": "#"
}

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

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

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

@ -58,7 +58,9 @@ const Header = ({ title, agency, refresh, ...props }) => {
const PriceTable = ({ productType, dataSource, refresh }) => {
const { t } = useTranslation('products');
const { travel_agency_id, use_year, audit_state } = useParams();
const [loading, activeAgency] = useProductsStore((state) => [state.loading, state.activeAgency]);
const [setEditingProduct] = useProductsStore((state) => [state.setEditingProduct]);
const { message, notification } = App.useApp();
const stateMapVal = useProductsAuditStatesMapVal();
@ -92,7 +94,10 @@ const PriceTable = ({ productType, dataSource, refresh }) => {
};
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')}] : []),
{ 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}`)}` },
@ -114,11 +119,12 @@ const PriceTable = ({ productType, dataSource, refresh }) => {
key: 'state',
title: t('State'),
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',
render: (_, r) =>
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 { useTranslation } from 'react-i18next';
import { App, Table, Button, Modal, Popconfirm } from 'antd';
@ -24,11 +24,12 @@ const NewAddonModal = ({ onPick, ...props }) => {
const onSearchProducts = async (values) => {
const copyObject = cloneDeep(values);
const { starttime, endtime, ...param } = copyObject;
const { starttime, endtime, year, ...param } = copyObject;
setSearchLoading(true);
setSearchResult([]);
// 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 || []);
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>
<SearchForm
fieldsConfig={{
shows: ['dates', 'year', 'keyword'],
shows: [ 'year', 'keyword'], // 'dates',
fieldProps: {
dates: { label: t('products:CreateDate') },
keyword: { label: t('products:Title'), col: 4 },

Loading…
Cancel
Save