Commit 5d7abf4e authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 237fde78 9bde2495
// 价格策略
btnCode 是pass 平台配置唯一表示
btnCode 是pass 平台配置唯一表示
menuCode 是 pass平台菜单属性relationParentCode":"commodityAbility",
// 价格策略
priceManage.add" 价格策略列表新曾
priceManage.del 价格策略列表删除
......@@ -10,7 +12,23 @@ goods.batch :'货品列表批量'
goods.see :'货品列表查看'
goods.del :'货品列表删除'
goods.edit :'货品列表修改'
// 商品
// 商品没有改完 改不动
products.add :'商品新曾'
products.batch:'商品批量操作'
products.copy:'商品拷贝'
\ No newline at end of file
products.copy:'商品拷贝'
// 快捷修改单价
fastModifyPrice.edit :'快捷修改单价'
fastModifyPrice.see:'快捷修改查看'
//渠道直采商品
directChannel.add :渠道直采商品新曾
directChannel.del:渠道直采商品删除
directChannel.see:渠道直采商品查看
directChannel.batch :渠道直采商品批量按钮
directChannel.edit: 渠道直采商品编辑按钮
directChannel.state:渠道直采商品上架下架
//品类及属性
//品牌管理
//仓位 pass 已经加上去 等待页面处理
\ No newline at end of file
import React, { useState, useEffect } from 'react';
import { IApiRequest } from '@/utils/request';
import { IRequestSuccess } from '..';
export interface IHttpRequestReturn<T> {
data: T | null,
export type CombineService<R, P extends any[]> = ((...args: P) => Promise<IRequestSuccess<R>>)
export interface IHttpRequestReturn<R, P extends any[]> {
data: R | null,
loading: boolean,
err: any,
run(params?: any, config?: any)
run: CombineService<R, P>,
}
export interface useHttpRequestConfig extends IApiRequest {
autoRun?: boolean
/**
* 是否手动触发请求,默认 true
*/
manual?: boolean
}
/**
* 简易版本的useRequest hooks, 用于处理带有loading的业务场景
* @auth xjm
*/
export function useHttpRequest<T>(api: (params?, config?) => Promise<T>, selfConfig?: useHttpRequestConfig): IHttpRequestReturn<T> {
export function useHttpRequest<R, P extends any[] = any>(api: CombineService<R, P>, selfConfig?: useHttpRequestConfig): IHttpRequestReturn<R, P> {
const {
manual = true,
} = selfConfig || {}
const [loading, setLoading] = useState(false)
const [data, setData] = useState<T | null>(null)
const [data, setData] = useState<R | null>(null)
const [err, setErr] = useState()
const run = (params, config?) => {
const run: CombineService<R, P> = (...rest) => {
return new Promise((resolve, reject) => {
setLoading(true)
api(params, config).then((res: any) => {
api(...rest).then((res) => {
setData(res.data)
resolve(res)
}).catch(err => {
......@@ -37,6 +48,13 @@ export function useHttpRequest<T>(api: (params?, config?) => Promise<T>, selfCon
})
}
useEffect(() => {
if (!manual) {
// @ts-ignore
run();
}
}, [])
return {
data,
loading,
......
/**
* @Description: 售后申请商品组件
*/
import React from 'react';
import MellowCard, { MellowCardProps } from '@/components/MellowCard';
import PolymericTable from '@/components/PolymericTable';
import { EditableColumns } from '@/components/PolymericTable/interface';
interface AsProductListProps {
/**
* 数据
*/
dataSource: {
[key: string]: any,
}[];
/**
* 标题
*/
title: string;
/**
* 表格列
*/
columns: EditableColumns[];
/**
* 行 key
*/
rowKey?: string;
/**
* Table loading
*/
loading?: boolean;
};
const AsProductList: React.FC<AsProductListProps> = ({
dataSource = [],
title = '',
columns = [],
rowKey = 'id',
loading = false,
}) => {
return (
<MellowCard
title={title}
>
<PolymericTable
rowKey={rowKey}
dataSource={dataSource}
columns={columns}
loading={loading}
pagination={null}
/>
</MellowCard>
);
};
export default AsProductList;
\ No newline at end of file
......@@ -30,7 +30,7 @@ export type OuterHistoryData = ListRes & {};
export type InnerHistoryData = ListRes & {};
interface AsFlowRecordsProps extends FlowRecordsProps {
export interface AsFlowRecordsProps extends FlowRecordsProps {
/**
* 外部流转记录,不能与 fetchOuterHistory 共存
*/
......
......@@ -81,11 +81,6 @@ interface ReturnInfoProps extends MellowCardProps {
innerStatus: number;
/**
* 历史记录目标路径
*/
target: string;
/**
* 是否可编辑
*/
isEdit?: boolean;
......@@ -114,7 +109,6 @@ const ReturnInfo: React.FC<ReturnInfoProps> = ({
onConfirmReturnDeliver,
onConfirmReturnReceive,
innerStatus,
target,
isEdit = false,
afterType,
deliveryType,
......
......@@ -68,7 +68,7 @@ export type PayListItem = {
/**
* 支付配置:1.平台代收2.会员直接到账
*/
payRuleId: number,
payRuleId?: number,
/**
* 支付外部状态
* 这个字段现在没用了,支付信息返回的都是 确认到账 的数据,后台说写死
......
......@@ -649,7 +649,6 @@ const DetailInfo: React.FC<DetailInfoProps> = ({
detailed={detailInfo && detailInfo.returnDeliveryGoodsList ? detailInfo.returnDeliveryGoodsList : []}
onConfirmReturnReceive={handleReceivedConfirmReturnReceive}
innerStatus={detailInfo?.innerStatus}
target={target}
isEdit={isEditRefundDeliver}
afterType={3}
deliveryType={detailInfo?.returnGoodsAddress?.deliveryType}
......
import React from 'react';
import {
getAsReturnGoodsGetDetailBySupplier,
getAsReturnGoodsPageInnerWorkflowRecord,
getAsReturnGoodsPageOuterWorkflowRecord,
} from '@/services/AfterServiceV2Api';
import { usePageStatus } from '@/hooks/usePageStatus';
import DetailInfo from '../components/DetailInfo';
import { useHttpRequest } from '@/hooks/useHttpRequest';
import AsReturnProfile, { AsReturnInfo } from '../components/AsReturnProfile';
import { InnerHistoryData, OuterHistoryData } from '../../components/FlowRecords';
const ReturnQueryDetail: React.FC = () => {
const { id, creditId } = usePageStatus();
const { id } = usePageStatus();
const {
data,
loading,
} = useHttpRequest<AsReturnInfo>(() => getAsReturnGoodsGetDetailBySupplier({ returnId: id }), { manual: false });
const fetchOuterHistory = (params): Promise<OuterHistoryData> => {
return new Promise((resolve, reject) => {
getAsReturnGoodsPageOuterWorkflowRecord({
...params,
dataId: id,
})
.then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject(res);
})
.catch(err => {
reject(err);
});
});
};
const fetchInnerHistory = (params): Promise<InnerHistoryData> => {
return new Promise((resolve, reject) => {
getAsReturnGoodsPageInnerWorkflowRecord({
...params,
dataId: id,
})
.then(res => {
if (res.code === 1000) {
resolve(res.data);
}
reject(res);
})
.catch(err => {
reject(err);
});
});
};
return (
<DetailInfo
id={id}
target="/memberCenter/afterService/returnManage/returnQuery"
<AsReturnProfile
data={data}
loading={loading}
orderDetailedPrefix="/memberCenter/afterService/returnManage/returnQuery"
fetchOuterHistory={fetchOuterHistory}
fetchInnerHistory={fetchInnerHistory}
/>
);
};
......
......@@ -26,6 +26,8 @@ import { productStatusColor, productStatusLabel } from './constant'
import { getProductChannelCommodityGetChannelCommodityList, getProductChannelCommodityGetShop, getProductChannelCommodityGetShopBatch, GetProductChannelCommodityGetShopResponse, postProductChannelCommodityBatchOffPublishCommodity, postProductChannelCommodityBatchPublishCommodity, postProductChannelCommodityDeleteBatchChannelCommodity, postProductChannelCommodityPublishCommodity } from '@/services/ProductV2Api'
import { getTemplateWebMemberChannelWebFindCurrMemberChannel } from '@/services/TemplateV2Api'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import AuthButton from '@/components/AuthButton'
import { AuthUrl } from '@/components/AuthButton/AuthUrl'
const { confirm } = Modal;
const formActions = createFormActions();
......@@ -143,10 +145,17 @@ const DirectChannel: React.FC<{}> = () => {
render: (text: any, record: any) => {
return (
<>
{(record.status === 5) ? <Button type='link' onClick={() => clickUp(0, record.id)}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.option.button.1' })}</Button> : ''}
{(record.status === 5) ?
<AuthButton btnCode='directChannel.state' menuCode='commodityAbility' >
<Button type='link' onClick={() => clickUp(0, record.id)}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.option.button.1' })}</Button>
</AuthButton>
: ''}
{(record.status === 6) ?
<>
<Button type='link' onClick={() => clickUp(1, record.id)}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.option.button.2' })}</Button>
<AuthButton btnCode='directChannel.state' menuCode='commodityAbility' >
<Button type='link' onClick={() => clickUp(1, record.id)}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.option.button.2' })}</Button>
</AuthButton>
<Button type='link' onClick={() => clickModify(record)}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.option.button.3' })}</Button>
</>
: ''}
......@@ -155,8 +164,13 @@ const DirectChannel: React.FC<{}> = () => {
<Button type='link' onClick={() => clickUp(1, record.id)}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.option.button.2' })}</Button>
<Dropdown overlay={
<Menu>
<Menu.Item><Button type='link' onClick={() => clickModify(record)}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.option.button.3' })}</Button></Menu.Item>
<Menu.Item><Button type='link' onClick={() => clickDelete(record.id)}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.option.button.4' })}</Button></Menu.Item>
<AuthButton btnCode='directChannel.edit' menuCode='commodityAbility' >
<Menu.Item><Button type='link' onClick={() => clickModify(record)}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.option.button.3' })}</Button></Menu.Item>
</AuthButton>
<AuthButton btnCode='directChannel.del' menuCode='commodityAbility' >
<Menu.Item><Button type='link' onClick={() => clickDelete(record.id)}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.option.button.4' })}</Button></Menu.Item>
</AuthButton>
</Menu>
}>
<a className="ant-dropdown-link" onClick={e => e.preventDefault()}>
......@@ -350,17 +364,22 @@ const DirectChannel: React.FC<{}> = () => {
const controllerBtns = (
<Space>
<Button
type='primary'
onClick={() => history.push('/memberCenter/commodityAbility/commodity/products/directChannel/add')}
>
<PlusOutlined />{intl.formatMessage({ id: 'commodity.products.directChannel.controllerBtns.button.1' })}
</Button>
<Dropdown overlay={menuMore} trigger={['click']}>
<Button>
{intl.formatMessage({ id: 'commodity.products.directChannel.controllerBtns.button.2' })} <DownOutlined />
<AuthButton btnCode='directChannel.add' menuCode='commodityAbility' >
<Button
type='primary'
onClick={() => history.push('/memberCenter/commodityAbility/commodity/products/directChannel/add')}
>
<PlusOutlined />{intl.formatMessage({ id: 'commodity.products.directChannel.controllerBtns.button.1' })}
</Button>
</Dropdown>
</AuthButton>
<AuthButton btnCode='directChannel.batch' menuCode='commodityAbility' >
<Dropdown overlay={menuMore} trigger={['click']}>
<Button>
{intl.formatMessage({ id: 'commodity.products.directChannel.controllerBtns.button.2' })} <DownOutlined />
</Button>
</Dropdown>
</AuthButton>
</Space>
);
......
......@@ -18,6 +18,8 @@ import { fastSchema } from './schema/productSchema'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { priceTypeLabel, productStatusColor, productStatusLabel, validatorNumberRange } from './constant'
import { getProductCommodityGetCommodityDetailList, getProductCommodityGetCommodityPrice, postProductCommodityUpdateCommodityPrice } from '@/services/ProductV2Api'
import AuthButton from '@/components/AuthButton'
import { AuthUrl } from '@/components/AuthButton/AuthUrl'
const formActions = createFormActions();
......@@ -48,6 +50,7 @@ const FastModifyPrice: React.FC<{}> = () => {
key: 'name',
className: 'commonPickColor',
render: (text: any, record: any) => <EyePreview
type={AuthUrl('fastModifyPrice.see', 'commodityAbility') ? 'link' : 'button'}
url={`/memberCenter/commodityAbility/commodity/products/detail?id=${record.commodityId}`}
>
{text}
......@@ -114,7 +117,10 @@ const FastModifyPrice: React.FC<{}> = () => {
render: (text: any, record: any) => {
return (
<>
<Button type='link' className="padLeft0" onClick={() => handleModify(record)}>{record.priceType === 3 ? intl.formatMessage({ id: 'commodity.products.fastModifyPrice.columns.option.1' }) : intl.formatMessage({ id: 'commodity.products.fastModifyPrice.columns.option.2' })}</Button>
<AuthButton btnCode='fastModifyPrice.edit' menuCode='commodityAbility'>
<Button type='link' className="padLeft0" onClick={() => handleModify(record)}>{record.priceType === 3 ? intl.formatMessage({ id: 'commodity.products.fastModifyPrice.columns.option.1' }) : intl.formatMessage({ id: 'commodity.products.fastModifyPrice.columns.option.2' })}</Button>
</AuthButton>
</>
)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment