debug: 搜索可以绑定的附加项目; 价格value改为adult_cost;

feature/price_manager
Lei OT 1 year ago
parent 4b77aa689e
commit 1534ce6979

@ -1,4 +1,5 @@
{
"ProductType": "ProductType",
"type": {
"Experience": "Experience",
"Car": "Transport Services",

@ -1,4 +1,5 @@
{
"ProductType": "项目类型",
"type": {
"Experience": "综费",
"Car": "车费",
@ -78,7 +79,7 @@
"GroupSize": "人等",
"UseDates": "使用日期",
"Weekdays": "有效日/周X",
"Weekdays": "周末",
"OnWeekdays": "周: ",
"Unlimited": "不限",

@ -1,5 +1,7 @@
import { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import useAuthStore from '@/stores/Auth';
import { PERM_OVERSEA, PERM_AIR_TICKET, PERM_PRODUCTS_MANAGEMENT } from '@/config';
/**
* 产品管理 相关的预设数据
@ -89,17 +91,26 @@ export const useProductsAuditStatesMapVal = (value) => {
/**
* @ignore
*/
export const useProductsTypesFieldsets = (type, role) => {
const infoDefault = ['code', 'title'];
export const useProductsTypesFieldsets = (type) => {
const [isPermitted] = useAuthStore((state) => [state.isPermitted]);
const infoDefault = [['code'], ['title']];
const infoAdmin = ['remarks', 'dept', 'display_to_c'];
const infoTypesMap = {
'6': [],
'B': ['city_id', 'km'],
'J': ['description', 'city_id', 'recommends_rate', 'duration', 'display_to_c'],
'Q': ['description', 'city_id', 'duration', ],
'D': ['description', 'city_id', 'recommends_rate','duration',],
'7': ['description', 'city_id', 'recommends_rate', 'duration', 'display_to_c', 'open_weekdays'], // todo: 怎么是2个图
'C': ['description', 'city_id',],
'8': [], // todo: ?
'6': [[],[]],
'B': [['city_id', 'km'], []],
'J': [['city_id', 'recommends_rate', 'duration', 'display_to_c'], ['description',]],
'Q': [['city_id', 'duration', ], ['description',]],
'D': [['city_id', 'recommends_rate','duration',], ['description',]],
'7': [['city_id', 'recommends_rate', 'duration', 'display_to_c', 'open_weekdays'], ['description',]], // todo: 怎么是2个图
'C': [['city_id',], ['description',]],
'8': [[],[]], // todo: ?
};
};
const thisTypeFieldset = (_type) => {
const adminSet = isPermitted(PERM_PRODUCTS_MANAGEMENT) ? infoAdmin : [];
return [
[...infoDefault[0], ...infoTypesMap[_type][0], ...adminSet],
[...infoDefault[1], ...infoTypesMap[_type][1]]
];
};
return thisTypeFieldset(type);
}

@ -86,8 +86,8 @@ const PriceTable = ({ dataSource, refresh }) => {
const columns = [
{ key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('Title'), onCell: (r, index) => ({ rowSpan: r.rowSpan }), render: (text, r) => text || r.lgc_details?.['2']?.title || '' },
{ key: 'adult', title: t('AgeType.Adult'), render: (_, { value, currency, unit_name }) => `${value} ${currency} / ${unit_name}` },
{ key: 'child', title: t('AgeType.Child'), render: (_, { value, currency, unit_name }) => `${value} ${currency} / ${unit_name}` },
{ key: 'adult', title: t('AgeType.Adult'), render: (_, { adult_cost, currency, unit_name }) => `${adult_cost} ${currency} / ${unit_name}` },
{ key: 'child', title: t('AgeType.Child'), render: (_, { child_cost, currency, unit_name }) => `${child_cost} ${currency} / ${unit_name}` },
// {key: 'price', title: t('Currency'), },
// {key: 'currency', title: t('Currency'), },
// {key: 'unit', title: t('Unit'), },

@ -24,27 +24,26 @@ const NewAddonModal = ({ onPick, ...props }) => {
const { starttime, endtime, ...param } = copyObject;
setSearchLoading(true);
setSearchResult([]);
const result = await getAgencyProductsAction({ ...param, audit_state: '1', travel_agency_id, use_year });
// debug: audit_state: '1',
const result = await getAgencyProductsAction({ ...param, audit_state: '0', travel_agency_id, use_year });
setSearchResult(result?.products || []);
setSearchLoading(false);
};
const handleAddExtras = async (item) => {
// const success = await fetchBindOrder({ coli_sn, conversationid: currentConversationID });
// success ? message.success('') : message.error('');
// setOpen(false);
if (typeof onPick === 'function') {
onPick(item);
}
};
// todo:
// todo:
const searchResultColumns = [
{ key: 'ptype', dataIndex: ['info', 'product_type_name'], width: '6rem', title: t('products:ProductType') },
{ key: 'title', dataIndex: ['info', 'title'], width: '16rem', title: t('products:Title') },
{
title: t('products:price'),
dataIndex: ['quotation', '0', 'value'],
dataIndex: ['quotation', '0', 'adult_cost'],
width: '10rem',
render: (_, { quotation }) => `${quotation[0].value} ${quotation[0].currency} / ${quotation[0].unit_name}`, // todo:
render: (_, { quotation }) => `${quotation[0].adult_cost} ${quotation[0].currency} / ${quotation[0].unit_name}`, // todo:
},
{
key: 'action',
@ -143,7 +142,7 @@ const Extras = ({ productId, onChange, ...props }) => {
dataIndex: ['quotation', '0', 'value'],
width: '10rem',
render: (_, { quotation }) => `${quotation[0].value} ${quotation[0].currency} / ${quotation[0].unit_name}`, // todo:
render: (_, { quotation }) => `${quotation[0].adult_cost} ${quotation[0].currency} / ${quotation[0].unit_name}`, // todo:
},
// { title: t('products:Types'), dataIndex: 'age_type', width: '40%', },
{

Loading…
Cancel
Save