diff --git a/src/stores/Products/Index.js b/src/stores/Products/Index.js
index 02989f6..139d030 100644
--- a/src/stores/Products/Index.js
+++ b/src/stores/Products/Index.js
@@ -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),
diff --git a/src/views/products/Audit.jsx b/src/views/products/Audit.jsx
index 37d2bd5..d9ec03d 100644
--- a/src/views/products/Audit.jsx
+++ b/src/views/products/Audit.jsx
@@ -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 setEditingProduct(r.info)}>{title};
+ } },
...(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 {stateMapVal[`${r.audit_state_id}`]?.label};
+ const stateCls = `text-${stateMapVal[`${r.audit_state_id}`]?.color} `;
+ return {stateMapVal[`${r.audit_state_id}`]?.label};
},
},
{
- title: '价格审核',
+ title: '',
key: 'action',
render: (_, r) =>
r.audit_state_id <= 0 ? (
diff --git a/src/views/products/Detail/Extras.jsx b/src/views/products/Detail/Extras.jsx
index 0f2d23c..e3b162c 100644
--- a/src/views/products/Detail/Extras.jsx
+++ b/src/views/products/Detail/Extras.jsx
@@ -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 }) => {
setOpen(false)} destroyOnClose>