Commit ee2f4da4 authored by Gavin Peng's avatar Gavin Peng

Merge branch 'v2-220418' of http://10.0.0.22:3000/lingxi/lingxi-business-paltform into v2-220418

parents 88c0875d f26e5e10
......@@ -117,6 +117,7 @@ export default {
'commodity.products.buttonGroup.5' : '上架',
'commodity.products.buttonGroup.6' : '下架',
'commodity.products.buttonGroup.7' : '查看供应商品',
'commodity.products.buttonGroup.8' : '查看上游商品',
'commodity.products.operationHandler.1' : '复制',
'commodity.products.operationHandler.2' : '提交审核',
'commodity.products.operationHandler.3' : '修改',
......@@ -124,6 +125,7 @@ export default {
'commodity.products.operationHandler.5' : '上架',
'commodity.products.operationHandler.6' : '下架',
'commodity.products.operationHandler.7' : '查看供应商品',
'commodity.products.operationHandler.8' : '查看上游商品',
'commodity.products.step0Description.text.1' : '点击下载 EXCEL文件模板',
'commodity.products.step0Description.text.2' : '按照模板整理货品资料',
'commodity.products.step0Description.text.3' : '点击导入按钮,导入整理好的货品资料',
......
......@@ -829,7 +829,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
>
<InputNumber style={{ width: '100%' }} min={0} placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.form.minOrder.placeholder' })} onChange={(e: number) => setMinOrderNumber(e)} />
</Form.Item>
{/* <Form.Item
<Form.Item
name="type"
label={
<span>
......@@ -846,7 +846,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
<Radio value={1}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.form.type.radio1' })}</Radio>
<Radio value={2}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.priceAttributeForm.form.type.radio2' })}</Radio>
</Radio.Group>
</Form.Item> */}
</Form.Item>
<Form.Item
name="isCrossBorder"
label={
......
import React, { useState, useEffect, useRef, useMemo } from 'react'
import { history, useIntl } from 'umi'
import { Button, Form, Card, Modal, Result, Progress, Select, Tooltip, Checkbox, Row, Col, Dropdown, Menu, Space, message, Badge } from 'antd'
import { Button, Form, Card, Modal, Result, Progress, Select, Tooltip, Checkbox, Row, Col, Dropdown, Menu, Space, message, Badge, Table } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
......@@ -38,6 +38,7 @@ import AuthButton from '@/components/AuthButton'
import { AuthUrl } from '@/components/AuthButton/AuthUrl'
import allRouters from '../../../../config/router.config.json'
import { postOrderCommonProductProcessFind } from '@/services/OrderNewV2Api'
import { ProductView, ProductSel } from './productModal'
const { confirm } = Modal;
......@@ -71,6 +72,12 @@ const Products: React.FC<{}> = () => {
const [giudeStep, setGiudeStep] = useState<number>()
const [inconformityProductIds, setInconformityProductIds] = useState<number[]>([])
// 上游弹窗
const [upModal, setUpModal] = useState(false)
const [uppId, setUpId] = useState<number>();
const [upSelModal, setUpSelModal] = useState(false)
const [downSelModal, setDownSelModal] = useState(false)
// const [shopId, setShopId] = useState<any>()
const shopIdRef = useRef<any>()
/** 带参数查询,给表单带默认值 */
......@@ -141,6 +148,14 @@ const Products: React.FC<{}> = () => {
render: t => t ? t : intl.formatMessage({ id: 'commodity.products.columns.upperMemberName.1' })
},
{
title: '商品类型',
dataIndex: 'CommodityType',
key: 'CommodityType',
render: t => {
return t === 1 ? '自营商品' : '上游供应商品'
}
},
{
title: intl.formatMessage({ id: 'commodity.products.columns.min' }),
dataIndex: 'min',
key: 'min',
......@@ -185,6 +200,10 @@ const Products: React.FC<{}> = () => {
history.push(`/memberCenter/commodityAbility/commodity/products/detail?id=${upId}`)
}
const upModalFn = (id: number) => {
setUpId(id);
setUpModal(true);
};
/** 参照后台数据生成 */
const renderOptionButton = (record) => {
......@@ -207,6 +226,7 @@ const Products: React.FC<{}> = () => {
[intl.formatMessage({ id: 'commodity.products.buttonGroup.5' })]: record.isOnPublish,
[intl.formatMessage({ id: 'commodity.products.buttonGroup.6' })]: record.isOffPublish,
[intl.formatMessage({ id: 'commodity.products.buttonGroup.7' })]: record.isUpperCommodity,
[intl.formatMessage({ id: 'commodity.products.buttonGroup.8' })]: record.type === 2,
}
const operationHandler = {
......@@ -217,6 +237,7 @@ const Products: React.FC<{}> = () => {
[intl.formatMessage({ id: 'commodity.products.operationHandler.5' })]: () => clickUp(1, record.id),
[intl.formatMessage({ id: 'commodity.products.operationHandler.6' })]: () => clickUp(0, record.id),
[intl.formatMessage({ id: 'commodity.products.operationHandler.7' })]: () => previewUpper(record.upperCommodityId),
[intl.formatMessage({ id: 'commodity.products.operationHandler.8' })]: () => upModalFn(record.id),
}
return (
......@@ -624,6 +645,10 @@ const Products: React.FC<{}> = () => {
return message.error(intl.formatMessage({ id: 'commodity.products.schema.fastSchema.qingxuanzeshangjiashangpin' }))
}
selectedRowKeys.length ? setExportQrcodeModal(true) : message.error(intl.formatMessage({ id: 'commodity.products.handleBatchDelete.error' }))
} else if (e.key === '6') {
setUpSelModal(true)
} else if (e.key === '7') {
setDownSelModal(true)
}
}
......@@ -722,6 +747,14 @@ const Products: React.FC<{}> = () => {
<Menu.Item key="5" icon={<ExportOutlined />}>
{intl.formatMessage({ id: 'commodity.products.menuMore.5' })}
</Menu.Item>
<Menu.Item key="6" icon={<ExportOutlined />}>
获取上游供应商品
{/* {intl.formatMessage({ id: 'commodity.products.menuMore.5' })} */}
</Menu.Item>
<Menu.Item key="7" icon={<ExportOutlined />}>
获取下游销售商品
{/* {intl.formatMessage({ id: 'commodity.products.menuMore.5' })} */}
</Menu.Item>
</Menu>
)
......@@ -904,6 +937,9 @@ const Products: React.FC<{}> = () => {
<p>{intl.formatMessage({ id: 'commodity.products.textthree' })}</p>
<p>{intl.formatMessage({ id: 'commodity.products.textfour' })}</p>
</Modal>
<ProductView visible={upModal} setVisible={setUpModal} productId={uppId} />
<ProductSel visible={upSelModal} setVisible={setUpSelModal} title="upperMemberName" />
<ProductSel visible={downSelModal} setVisible={setDownSelModal} title="subMemberName" />
{/* 选择上游商品 */}
<UpperProductModalTable currentRef={upperRef} type="checkbox" tableRef={ref} />
{/* 商品上架引导 */}
......
import NiceForm from '@/components/NiceForm';
import StandardTable from '@/components/StandardTable';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable';
// import {
// getProductCommodityGetSubCommodityListS2B,
// getProductCommodityGetUpperCommodityListS2B,
// } from '@/services/ProductV2Api';
import { PlusOutlined } from '@ant-design/icons';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { Button, Modal, Table } from 'antd';
import { useEffect, useMemo, useRef, useState } from 'react';
import { getIntl } from 'umi';
import {
searchBrandOptionEffect,
searchCustomerCategoryOptionEffect,
} from './effect';
// 快捷修改单价高级筛选
export const newSchema = (key: string) => ({
type: 'object',
properties: {
mageLayout: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
},
colStyle: {
marginLeft: 20,
},
},
properties: {
productId: {
type: 'string',
'x-component-props': {
placeholder: '商品ID',
},
},
name: {
type: 'string',
'x-component-props': {
placeholder: getIntl().formatMessage({
id: 'commodity.products.schema.productSchema.name',
}),
},
},
priceTypeList: {
type: 'string',
enum: [
{
label: getIntl().formatMessage({
id: 'commodity.products.schema.productSchema.priceTypeList.1',
}),
value: 1,
},
{
label: getIntl().formatMessage({
id: 'commodity.products.schema.productSchema.priceTypeList.2',
}),
value: 2,
},
{
label: getIntl().formatMessage({
id: 'commodity.products.schema.productSchema.priceTypeList.3',
}),
value: 3,
},
{
label: getIntl().formatMessage({
id: 'commodity.products.schema.productSchema.priceTypeList.4',
}),
value: 4,
},
],
'x-component-props': {
placeholder: getIntl().formatMessage({
id:
'commodity.products.schema.productSchema.priceTypeList.placeholder',
}),
style: { width: '174px' },
},
},
brandId: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: getIntl().formatMessage({
id: 'commodity.products.schema.productSchema.brandId',
}),
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
style: { width: '174px' },
searchValue: null,
dataoption: [],
},
},
customerCategoryId: {
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: getIntl().formatMessage({
id: 'commodity.products.schema.productSchema.customerCategoryId',
}),
showSearch: true,
notFoundContent: null,
style: { width: '174px' },
dataoption: [],
fieldNames: { label: 'title', value: 'id', children: 'children' },
},
},
upgyhy: {
type: 'string',
'x-component-props': {
placeholder:
key === 'upperMemberName'
? '上游供应选择商品'
: '下游销售选择商品',
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '',
},
},
},
},
},
});
export const ProductView = props => {
// 查看上游弹窗
const { visible, setVisible, productId } = props;
const columns = [
{
title: '序号',
dataIndex: 'num',
key: 'num',
},
{
title: '上游供应会员名称',
dataIndex: 'upperMemberName',
key: 'upperMemberName',
},
{
title: '上游供应商品ID',
dataIndex: 'id',
key: 'id',
},
{
title: '上游供应商品名称',
dataIndex: 'name',
key: 'name',
},
{
title: '品类',
dataIndex: 'customerCategory',
key: 'customerCategory',
render: text => text.name,
},
{
title: '品牌',
dataIndex: 'brand',
key: 'brand',
render: text => text.name,
},
{
title: '单位',
dataIndex: 'unitName',
key: 'unitName',
},
{
title: '商品定价',
dataIndex: 'priceType',
key: 'priceType',
render: text => {
switch (text) {
case 1:
return '现货价格';
case 2:
return '价格需要询价';
case 3:
return '积分兑换商品';
}
},
},
{
title: '价格',
dataIndex: 'min',
key: 'min',
render: (text, record) => {
return `¥${text}~¥${record.max}`;
},
},
];
const [dataSource, setDataSource] = useState<any>([]);
const [loading, setLoading] = useState<boolean>(false);
useEffect(() => {
if (productId) {
// setLoading(true);
// getProductCommodityGetUpperCommodityListS2B().then(res => {
// if (res.code === 1000) {
// setDataSource(res.data.data);
// setLoading(false);
// }
// });
}
}, [productId]);
return (
<Modal
title="查看上游商品"
visible={visible}
width={1200}
onCancel={() => setVisible(false)}
confirmLoading={loading}
>
<Table dataSource={dataSource} columns={columns} />;
</Modal>
);
};
export const ProductSel = props => {
// 选择商品
const { visible, setVisible, key, productId } = props;
/** 带参数查询,给表单带默认值 */
const { clear } = useSetSearchValueInTable();
const ref = useRef<any>({});
const [rowSelection, RowCtl] = useRowSelectionTable({ customKey: 'id' });
const columns = (key: string) => {
const arr = [
{
title: '商品ID',
dataIndex: 'id',
key: 'id',
},
{
title: '商品名称',
dataIndex: 'name',
key: 'name',
},
{
title: '品类',
dataIndex: 'customerCategory',
key: 'customerCategory',
render: text => text.name,
},
{
title: '品牌',
dataIndex: 'brand',
key: 'brand',
render: text => text.name,
},
{
title: '单位',
dataIndex: 'unitName',
key: 'unitName',
},
{
title: '商品定价',
dataIndex: 'priceType',
key: 'priceType',
render: text => {
switch (text) {
case 1:
return '现货价格';
case 2:
return '价格需要询价';
case 3:
return '积分兑换商品';
}
},
},
{
title: `${key === 'upperMemberName' ? '上游供应会员' : '下游销售会员'}`,
dataIndex: key,
key: key,
},
{
title: '单价',
dataIndex: 'min',
key: 'min',
render: (text, record) => {
return `¥${text}~¥${record.max}`;
},
},
{
title: '状态',
dataIndex: 'status',
key: 'status',
},
];
if (key === 'subMemberName') {
arr.splice(7, 1);
}
return arr;
};
const formActions = createFormActions();
const fetchData = (item: any) => {
const params = {
current: '1',
pageSize: '10',
productId,
// name: '',
// priceType: '',
// customerCategoryName: '',
// memberName: '',
// brandName: '',
...item,
};
return new Promise(resolve => {
// getProductCommodityGetSubCommodityListS2B(params).then(res => {
// resolve({
// totalCount: res.data.totalCount,
// data: res.data.data,
// });
// });
});
};
return (
<Modal
title={
key === 'upperMemberName' ? '选择上游供应商品' : '选择下游销售商品'
}
visible={visible}
width={1200}
// onOk={handleExportQrcode}
onCancel={() => setVisible(false)}
// confirmLoading={exportLoading}
>
<StandardTable
columns={columns(key)}
currentRef={ref}
rowSelection={rowSelection}
tableProps={{
rowKey: 'id',
}}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
expressionScope={
{
// controllerBtns,
}
}
effects={($, actions) => {
FormEffectHooks.onFieldChange$('brandId').subscribe(() => {
searchBrandOptionEffect(actions, 'brandId');
});
FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(
() => {
searchCustomerCategoryOptionEffect(
actions,
'customerCategoryId',
);
},
);
}}
schema={newSchema(key)}
// onReset={() => {
// clear();
// }}
/>
}
/>
{/* <Table dataSource={dataSource} columns={columns} />; */}
</Modal>
);
};
......@@ -97,15 +97,26 @@ const Repositories: React.FC<{}> = () => {
dataIndex: 'alreadyiInventory',
key: 'alreadyiInventory',
},
// {
// title: intl.formatMessage({ id: 'repositories.columns.upperMemberName' }),
// dataIndex: 'upperMemberName',
// key: 'upperMemberName',
// },
// {
// title: intl.formatMessage({ id: 'repositories.columns.upperStockCount' }),
// dataIndex: 'upperStockCount',
// key: 'upperStockCount',
// },
{
title: intl.formatMessage({ id: 'repositories.columns.upperMemberName' }),
dataIndex: 'upperMemberName',
key: 'upperMemberName',
},
{
title: intl.formatMessage({ id: 'repositories.columns.upperStockCount' }),
title: <span>
上游商品库存&ensp;
<Tooltip title='关联的所有上游供应会员的上游供应商品的库存总数量'>
<QuestionCircleOutlined />
</Tooltip>
</span>,
dataIndex: 'upperStockCount',
key: 'upperStockCount',
render: text => text || '-',
},
{
title: intl.formatMessage({ id: 'repositories.columns.status' }),
......
......@@ -4,6 +4,8 @@ import { FORM_FILTER_PATH } from '@/formSchema/const';
import { GlobalConfig } from '@/global/config';
import { SHOP_TYPES } from '@/constants';
import { padRequiredMessage } from '@/utils';
import { Tooltip } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
// 将获取的商城转化为可用类型
const getShopTypeMap = (() => {
......@@ -281,6 +283,16 @@ export const repositDetailSchema: ISchema = padRequiredMessage({
title: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.goodsName' }),
default: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.goodsName.default' })
},
sy: {
type: 'string',
"x-component": 'Text',
title: <span>
上游商品库存&ensp;
<Tooltip title='关联的所有上游供应会员的上游供应商品的库存总数量'>
<QuestionCircleOutlined />
</Tooltip>
</span>,
},
NO_SUBMIT3: {
type: 'string',
"x-component": 'Text',
......@@ -310,39 +322,39 @@ export const repositDetailSchema: ISchema = padRequiredMessage({
},
]
},
inventoryDeductWay: {
type: 'radio',
title: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.inventoryDeductWay' }),
"x-rules": [
{
required: true,
message: getIntl().formatMessage({ id: 'common.form.input.placeholder' })
}
],
enum: [
{
label: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.inventoryDeductWay.1' }),
value: 1
},
// {
// label: '按仓库位置远近扣除',
// value: 2
// }
],
default: 1
},
upperMemberName: {
type: 'string',
title: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.upperMemberName' }),
"x-component": 'Text',
default: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.upperMemberName.default' })
},
upperStockCount: {
type: 'number',
title: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.upperStockCount' }),
"x-component": 'Text',
default: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.upperStockCount.default' })
},
// inventoryDeductWay: {
// type: 'radio',
// title: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.inventoryDeductWay' }),
// "x-rules": [
// {
// required: true,
// message: getIntl().formatMessage({ id: 'common.form.input.placeholder' })
// }
// ],
// enum: [
// {
// label: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.inventoryDeductWay.1' }),
// value: 1
// },
// // {
// // label: '按仓库位置远近扣除',
// // value: 2
// // }
// ],
// default: 1
// },
// upperMemberName: {
// type: 'string',
// title: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.upperMemberName' }),
// "x-component": 'Text',
// default: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.upperMemberName.default' })
// },
// upperStockCount: {
// type: 'number',
// title: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.upperStockCount' }),
// "x-component": 'Text',
// default: getIntl().formatMessage({ id: 'repositories.schema.repositDetailSchema.upperStockCount.default' })
// },
}
}
}
......@@ -499,25 +511,25 @@ export const batchRepositDetailSchema: ISchema = padRequiredMessage({
},
]
},
inventoryDeductWay: {
type: 'radio',
title: getIntl().formatMessage({ id: 'repositories.schema.batchRepositDetailSchema.inventoryDeductWay' }),
'x-rules': [{
required: true,
message: `${getIntl().formatMessage({ id: 'common.text.pleaseSelect' })}`
}],
enum: [
{
label: getIntl().formatMessage({ id: 'repositories.schema.batchRepositDetailSchema.inventoryDeductWay.1' }),
value: 1
},
// {
// label: '按仓库位置远近扣除',
// value: 2
// }
],
default: 1
}
// inventoryDeductWay: {
// type: 'radio',
// title: getIntl().formatMessage({ id: 'repositories.schema.batchRepositDetailSchema.inventoryDeductWay' }),
// 'x-rules': [{
// required: true,
// message: `${getIntl().formatMessage({ id: 'common.text.pleaseSelect' })}`
// }],
// enum: [
// {
// label: getIntl().formatMessage({ id: 'repositories.schema.batchRepositDetailSchema.inventoryDeductWay.1' }),
// value: 1
// },
// // {
// // label: '按仓库位置远近扣除',
// // value: 2
// // }
// ],
// default: 1
// }
}
}
}
......@@ -758,37 +770,37 @@ export const repositTabOneSchema: ISchema = padRequiredMessage({
}],
title: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.inventory' }),
},
inventoryDeductWay: {
type: 'radio',
title: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.inventoryDeductWay' }),
'x-rules': [{
required: true,
message: `${getIntl().formatMessage({ id: 'common.text.pleaseSelect' })}`
}],
enum: [
{
label: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.inventoryDeductWay.1' }),
value: 1
},
// {
// label: '按仓库位置远近扣除',
// value: 2
// }
],
default: 1
},
upperMemberName: {
type: 'string',
title: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.upperMemberName' }),
"x-component": 'Text',
default: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.upperMemberName.default' })
},
upperStockCount: {
type: 'number',
title: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.upperStockCount' }),
"x-component": 'Text',
default: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.upperStockCount.default' })
},
// inventoryDeductWay: {
// type: 'radio',
// title: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.inventoryDeductWay' }),
// 'x-rules': [{
// required: true,
// message: `${getIntl().formatMessage({ id: 'common.text.pleaseSelect' })}`
// }],
// enum: [
// {
// label: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.inventoryDeductWay.1' }),
// value: 1
// },
// // {
// // label: '按仓库位置远近扣除',
// // value: 2
// // }
// ],
// default: 1
// },
// upperMemberName: {
// type: 'string',
// title: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.upperMemberName' }),
// "x-component": 'Text',
// default: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.upperMemberName.default' })
// },
// upperStockCount: {
// type: 'number',
// title: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.upperStockCount' }),
// "x-component": 'Text',
// default: getIntl().formatMessage({ id: 'repositories.schema.repositTabOneSchema.upperStockCount.default' })
// },
}
}
}
......
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