Commit 4dd6b52c authored by 卢均锐's avatar 卢均锐

feat: 商品能力-商品模块国际化

parent 674dd4e9
......@@ -10,6 +10,7 @@ import member from './zh-CN/member'
import purchase from './zh-CN/purchase'
import editor from './zh-CN/editor'
import content from './zh-CN/content'
import commodity from './zh-CN/commodity'
export default {
'global.siteName': '瓴犀',
......@@ -21,9 +22,9 @@ export default {
...priceManage,
...handling,
...classAndProperty,
...commodity,
...member,
...purchase,
...editor,
...content,
}
This diff is collapsed.
......@@ -6,7 +6,7 @@ import {
} from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle';
import styles from './index.less'
import { history } from 'umi'
import { history, useIntl } from 'umi'
import { validatorByte } from '@/utils/regExp';
import { getProductCustomerGetCustomerCategoryTree, GetProductCustomerGetCustomerCategoryTreeResponse, getProductGoodsGetGoods, getProductSelectGetSelectBrand, getProductSelectGetSelectCnUnit, getProductSelectGetSelectCustomerCategory, postProductGoodsSaveOrUpdateGoods } from '@/services/ProductV2Api';
......@@ -27,6 +27,7 @@ const tailLayout = {
};
const AddGoods = () => {
const intl = useIntl();
const [form] = Form.useForm();
const [brandData, setBrandData] = useState<any>([])
const [brandValue, setBrandValue] = useState(undefined)
......@@ -118,8 +119,8 @@ const AddGoods = () => {
return (<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={queryId ? `${isSee ? '查看货品' : '编辑货品'}` : '新建货品'}
backIcon={<ReutrnEle description={intl.formatMessage({ id: 'commodity.goods.addGoods.back' })} />}
title={queryId ? `${isSee ? intl.formatMessage({ id: 'commodity.goods.addGoods.title.1' }) : intl.formatMessage({ id: 'commodity.goods.addGoods.title.2' })}` : intl.formatMessage({ id: 'commodity.goods.addGoods.title.3' })}
>
<Card>
<Form
......@@ -133,49 +134,49 @@ const AddGoods = () => {
>
<Form.Item
name="code"
label="货号"
label={intl.formatMessage({ id: 'commodity.goods.addGoods.form.code' })}
rules={[
{
required: true,
message: '请输入货号'
message: intl.formatMessage({ id: 'commodity.goods.addGoods.form.code.message.1' })
},
{
pattern: /^(?=.*\d)(?=.*[a-z_A-Z])(?=.*[~!@#$%^&*-_])[\da-zA-Z~!@#$%^&*-_]{1,20}$/,
message: '最长20个字符(由字母、数组、特殊字符组成)'
message: intl.formatMessage({ id: 'commodity.goods.addGoods.form.code.message.2' })
}
]}
>
<Input placeholder="最长20个字符(由字母、数组、特殊字符组成)" maxLength={20} disabled={isSee} />
<Input placeholder={intl.formatMessage({ id: 'commodity.goods.addGoods.form.code.placeholder' })} maxLength={20} disabled={isSee} />
</Form.Item>
<Form.Item
name="name"
label="货品名称"
label={intl.formatMessage({ id: 'commodity.goods.addGoods.form.name' })}
rules={[
{
required: true,
message: '请输入货品名称'
message: intl.formatMessage({ id: 'commodity.goods.addGoods.form.name.message' })
},
{
validator: (r, v, c) => validatorByte(r, v, c, 40)
}
]}
>
<Input placeholder="最长40个字符20个汉字" disabled={isSee} />
<Input placeholder={intl.formatMessage({ id: 'commodity.goods.addGoods.form.name.placeholder' })} disabled={isSee} />
</Form.Item>
<Form.Item
name="type"
label="规格型号"
label={intl.formatMessage({ id: 'commodity.goods.addGoods.form.type' })}
rules={[
{
required: true,
message: '请输入规格型号'
message: intl.formatMessage({ id: 'commodity.goods.addGoods.form.type.message' })
},
{
validator: (r, v, c) => validatorByte(r, v, c, 40)
}
]}
>
<Input placeholder="最长40个字符20个汉字" disabled={isSee} />
<Input placeholder={intl.formatMessage({ id: 'commodity.goods.addGoods.form.type.placeholder' })} disabled={isSee} />
</Form.Item>
{/* <Form.Item
name={['customerCategory', 'id']}
......@@ -206,11 +207,11 @@ const AddGoods = () => {
</Form.Item> */}
<Form.Item
name={['customerCategory', 'id']}
label="品类"
label={intl.formatMessage({ id: 'commodity.goods.addGoods.form.customerCategory' })}
rules={[
{
required: true,
message: '请选择品类'
message: intl.formatMessage({ id: 'commodity.goods.addGoods.form.customerCategory.message' })
},
]}
>
......@@ -218,13 +219,13 @@ const AddGoods = () => {
disabled={isSee}
options={customerCategoryTree}
fieldNames={{ label: 'title', value: 'id', children: 'children' }}
placeholder="请选择品类"
placeholder={intl.formatMessage({ id: 'commodity.goods.addGoods.form.customerCategory.placeholder' })}
// notFoundContent={<Spin size="small" />}
/>
</Form.Item>
<Form.Item
name={['brand', 'id']}
label="品牌"
label={intl.formatMessage({ id: 'commodity.goods.addGoods.form.brand' })}
// rules={[
// {
// required: true,
......@@ -236,7 +237,7 @@ const AddGoods = () => {
<Select
showSearch={true}
showArrow={true}
placeholder="请选择品牌"
placeholder={intl.formatMessage({ id: 'commodity.goods.addGoods.form.brand.placeholder' })}
value={brandValue}
defaultActiveFirstOption={false}
filterOption={false}
......@@ -252,18 +253,18 @@ const AddGoods = () => {
</Form.Item>
<Form.Item
name="unitId"
label="单位"
label={intl.formatMessage({ id: 'commodity.goods.addGoods.form.unitId' })}
rules={[
{
required: true,
message: '请选择单位'
message: intl.formatMessage({ id: 'commodity.goods.addGoods.form.unitId.message' })
},
]}
>
<Select
showSearch={true}
showArrow={true}
placeholder="请选择单位"
placeholder={intl.formatMessage({ id: 'commodity.goods.addGoods.form.unitId.placeholder' })}
value={unitValue}
defaultActiveFirstOption={false}
filterOption={false}
......@@ -282,8 +283,8 @@ const AddGoods = () => {
// label="成本价"
label={
<span>
成本价&nbsp;
<Tooltip title="成本价即该商品销售时不能低于此价,如在商品发布时商品销售价低于成本价,则将触发风控预警。">
{intl.formatMessage({ id: 'commodity.goods.addGoods.form.costPrice' })}&nbsp;
<Tooltip title={intl.formatMessage({ id: 'commodity.goods.addGoods.form.costPrice.tooltip' })}>
<QuestionCircleOutlined />
</Tooltip>
</span>
......@@ -291,24 +292,24 @@ const AddGoods = () => {
rules={[
{
required: true,
message: '请输入成本价',
message: intl.formatMessage({ id: 'commodity.goods.addGoods.form.costPrice.message.1' }),
},
{
pattern: /^\d+(\.\d{1,4})?$/,
message: '小数点后仅限四位',
message: intl.formatMessage({ id: 'commodity.goods.addGoods.form.costPrice.message.2' }),
}
]}
>
<InputNumber placeholder="请输入成本价" style={{ width: '100%' }} min={0} disabled={isSee} />
<InputNumber placeholder={intl.formatMessage({ id: 'commodity.goods.addGoods.form.costPrice.placeholder' })} style={{ width: '100%' }} min={0} disabled={isSee} />
</Form.Item>
{!isSee && <Form.Item {...tailLayout}>
<Button type="primary" htmlType="submit">
保存
</Button>
<Popconfirm title="确定要取消吗?" okText="是" cancelText="否" onConfirm={() => history.goBack()}>
{intl.formatMessage({ id: 'commodity.goods.addGoods.form.ctr.button.1' })}
</Button>
<Popconfirm title={intl.formatMessage({ id: 'commodity.goods.addGoods.form.ctr.button.2.popconfirm.title' })} okText={intl.formatMessage({ id: 'commodity.goods.addGoods.form.ctr.button.2.popconfirm.okText' })} cancelText={intl.formatMessage({ id: 'commodity.goods.addGoods.form.ctr.button.2.popconfirm.cancelText' })} onConfirm={() => history.goBack()}>
<Button className={styles.ml20}>
取消
</Button>
{intl.formatMessage({ id: 'commodity.goods.addGoods.form.ctr.button.2' })}
</Button>
</Popconfirm>
</Form.Item>}
</Form>
......
This diff is collapsed.
import { ISchema } from '@formily/antd';
import { getIntl } from 'umi';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const goodsSchema: ISchema = {
......@@ -26,7 +27,7 @@ export const goodsSchema: ISchema = {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '货品名称',
placeholder: getIntl().formatMessage({ id: 'commodity.goods.schema.goodsSchema.name' }),
},
},
},
......@@ -46,14 +47,14 @@ export const goodsSchema: ISchema = {
code: {
type: 'string',
'x-component-props': {
placeholder: '货号'
placeholder: getIntl().formatMessage({ id: 'commodity.goods.schema.goodsSchema.code' })
},
},
brandId: {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品牌',
placeholder: getIntl().formatMessage({ id: 'commodity.goods.schema.goodsSchema.brandId' }),
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
......@@ -68,7 +69,7 @@ export const goodsSchema: ISchema = {
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: '商品品类',
placeholder: getIntl().formatMessage({ id: 'commodity.goods.schema.goodsSchema.customerCategoryId' }),
showSearch: true,
notFoundContent: null,
style: { width: '174px' },
......@@ -79,7 +80,7 @@ export const goodsSchema: ISchema = {
batch: {
type: 'string',
'x-component-props': {
placeholder: '导入批次'
placeholder: getIntl().formatMessage({ id: 'commodity.goods.schema.goodsSchema.batch' })
},
},
submit: {
......@@ -88,7 +89,7 @@ export const goodsSchema: ISchema = {
span: 1,
},
'x-component-props': {
children: '查询',
children: getIntl().formatMessage({ id: 'commodity.goods.schema.goodsSchema.submit' }),
},
},
},
......
import React, {useState, useRef, useEffect} from 'react'
import React, { useState, useRef, useEffect } from 'react'
import { useIntl } from 'umi';
import { Button, Form, Radio, Table } from 'antd'
import {
PlusOutlined,
......@@ -36,14 +37,15 @@ interface IProps {
const productFormActions = createAsyncFormActions()
const SelectProduct:React.FC<IProps> = (props) => {
const SelectProduct: React.FC<IProps> = (props) => {
const intl = useIntl();
const { onRef } = props
const productRef = useRef<any>({})
const productFormRef = useRef()
const [formProduct] = Form.useForm()
const [source, setSource] = useState(1)
const [visibleAddTabs, setVisibleAddTabs] = useState(false)
const [productRowSelection, productRowCtl] = useRowSelectionTable({type: 'radio'})
const [productRowSelection, productRowCtl] = useRowSelectionTable({ type: 'radio' })
const [selectProduct, setSelectProduct] = useState<GetProductChannelCommodityGetCommodityListResponseDetail[]>()
const { ChannelProudctStore } = store
......@@ -56,24 +58,24 @@ const SelectProduct:React.FC<IProps> = (props) => {
key: 'id',
},
{
title: '商品名称',
title: intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.productColumns.name' }),
dataIndex: 'name',
key: 'name',
width: 300,
ellipsis: true,
},
{
title: '品类',
title: intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.productColumns.customerCategory' }),
dataIndex: ['customerCategory', 'name'],
key: 'customerCategory',
},
{
title: '品牌',
title: intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.productColumns.brand' }),
dataIndex: ['brand', 'name'],
key: 'brand',
},
{
title: '单位',
title: intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.productColumns.unitName' }),
dataIndex: 'unitName',
key: 'unitName',
}
......@@ -86,32 +88,32 @@ const SelectProduct:React.FC<IProps> = (props) => {
key: 'id',
},
{
title: '商品名称',
title: intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.productedColumns.name' }),
dataIndex: 'name',
key: 'name',
},
{
title: '品类',
title: intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.productedColumns.customerCategory' }),
dataIndex: ['customerCategory', 'name'],
key: 'customerCategory',
},
{
title: '品牌',
title: intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.productedColumns.brand' }),
dataIndex: ['brand', 'name'],
key: 'brand',
},
{
title: '单位',
title: intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.productedColumns.unitName' }),
dataIndex: 'unitName',
key: 'unitName',
},
{
title: '操作',
title: intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.productedColumns.option' }),
dataIndex: 'option',
render: (text: any, record: any) => {
return (
<>
<Button type='link' onClick={()=>clickDelete(record)}>删除</Button>
<Button type='link' onClick={() => clickDelete(record)}>{intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.productedColumns.option.button' })}</Button>
</>
)
}
......@@ -121,7 +123,7 @@ const SelectProduct:React.FC<IProps> = (props) => {
useEffect(() => {
onRef(formProduct)
formProduct.setFieldsValue({source: source})
formProduct.setFieldsValue({ source: source })
// 获取会员角色列表
getMemberManageChannelLowerRoleList().then(res => {
const { data } = res
......@@ -133,7 +135,7 @@ const SelectProduct:React.FC<IProps> = (props) => {
}, [source])
useEffect(() => {
if(productRowCtl.selectRow.length>0){
if (productRowCtl.selectRow.length > 0) {
setPriceType(productRowCtl.selectRow[0].priceType)
setProductName(productRowCtl.selectRow[0].name)
setProductSelectRowInStore(productRowCtl.selectRow[0])
......@@ -141,17 +143,17 @@ const SelectProduct:React.FC<IProps> = (props) => {
}, [productRowCtl.selectRow])
useEffect(() => {
if(visibleAddTabs)
if (visibleAddTabs)
productRef?.current?.schemaAction?.setFieldState('parentMemberId', state => {
console.log('parentMemberId')
state.visible = source===1 ? true : false
state.visible = source === 1 ? true : false
})
}, [visibleAddTabs])
// 获取渠道商品
const fetchProductData = (params: any) => {
return new Promise((resolve, reject) => {
getProductChannelCommodityGetCommodityList({...params, source: source}).then(res => {
getProductChannelCommodityGetCommodityList({ ...params, source: source }).then(res => {
const { data } = res
resolve(data)
})
......@@ -164,7 +166,7 @@ const SelectProduct:React.FC<IProps> = (props) => {
return data.map(v => ({ label: v.name, value: v.memberId }))
}
const handleSourceChange = (v:any) => {
const handleSourceChange = (v: any) => {
console.log(v.target.value)
setProductSourceInStore(v.target.value)
setSource(v.target.value)
......@@ -200,32 +202,32 @@ const SelectProduct:React.FC<IProps> = (props) => {
>
<Form.Item
name="source"
label="选择商品来源"
label={intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.form.source' })}
rules={[{
required: true,
message: '请选择商品来源'
message: intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.form.source.message' })
}]}
>
<Radio.Group onChange={handleSourceChange}>
<Radio value={1}>上级渠道商品</Radio>
<Radio value={2}>渠道自有商品</Radio>
<Radio value={1}>{intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.form.source.option.1' })}</Radio>
<Radio value={2}>{intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.form.source.option.2' })}</Radio>
</Radio.Group>
</Form.Item>
</Form>
<Button onClick={()=>setVisibleAddTabs(true)} style={{width:'100%', marginTop: 24, marginBottom: 24, backgroundColor: '#fafbfc'}}>
<PlusOutlined /> 新增{source===1?'上级渠道商品':'渠道自有商品'}
<Button onClick={() => setVisibleAddTabs(true)} style={{ width: '100%', marginTop: 24, marginBottom: 24, backgroundColor: '#fafbfc' }}>
<PlusOutlined /> {source === 1 ? intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.button.1' }) : intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.button.2' })}
</Button>
<Table rowKey="id" dataSource={selectProduct} columns={productedColumns} />
{/* 选择商品 */}
<ModalTable
modalTitle={source===1?'选择上级渠道商品':'选择渠道自有商品'}
modalTitle={source === 1 ? intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.modalTable.1' }) : intl.formatMessage({ id: 'commodity.products.addChannelItem.selectProduct.modalTable.2' })}
confirm={handleOkAddTabs}
cancel={handleCancelAddTabs}
visible={visibleAddTabs}
resetModal={{destroyOnClose: true}}
resetModal={{ destroyOnClose: true }}
columns={productColumns}
rowSelection={productRowSelection}
fetchTableData={(params:any) => fetchProductData(params)}
fetchTableData={(params: any) => fetchProductData(params)}
currentRef={productRef}
forceRender={false}
tableProps={{
......@@ -242,7 +244,7 @@ const SelectProduct:React.FC<IProps> = (props) => {
ctx: {
schema: addChannelSchema,
actions: productFormActions,
components: { ModalSearch: Search, SearchSelect, Submit } ,
components: { ModalSearch: Search, SearchSelect, Submit },
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
......
import React, {useState} from 'react'
import { history } from 'umi';
import React, { useState } from 'react'
import { history, useIntl } from 'umi';
import { Button, Card, Tabs, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { SaveOutlined } from '@ant-design/icons'
......@@ -14,7 +14,8 @@ import { postProductChannelCommoditySaveChannelCommodity } from '@/services/Prod
const { TabPane } = Tabs
const AddDirectChannel:React.FC<{}> = (props) => {
const AddDirectChannel: React.FC<{}> = (props) => {
const intl = useIntl();
const [queryId, setQueryId] = useState<number>()
const [isDisabledSave, setIsDisabledSave] = useState<boolean>(false)
let [formRefs, setFormRefs] = useState([]) //子form的ref数组
......@@ -43,7 +44,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
Promise.all(data).then((values) => {
let params: any = {}
values.map((item, index) => {
if(!item.deliveryType)
if (!item.deliveryType)
params = { ...params, ...item }
else
params.logistics = { ...item }
......@@ -56,64 +57,64 @@ const AddDirectChannel:React.FC<{}> = (props) => {
params.commodityMemberList = selectChannel?.length ? selectChannel.map(item => ({ memberId: item.memberId, memberName: item.name })) : []
params.source = productSourceInStore
if(!tableDataInSetPrice.length){
message.error('请选择商品规格!')
if (!tableDataInSetPrice.length) {
message.error(intl.formatMessage({ id: 'commodity.products.addDirectChannel.onSave.error.1' }))
setIsDisabledSave(false)
return ;
return;
}
if(params.childMemberRoleName)
postProductChannelCommoditySaveChannelCommodity(params).then(res=>{
if (params.childMemberRoleName)
postProductChannelCommoditySaveChannelCommodity(params).then(res => {
setIsDisabledSave(false)
if(res.code === 1000)
if (res.code === 1000)
history.goBack()
})
else{
message.error('暂无渠道角色数据!')
else {
message.error(intl.formatMessage({ id: 'commodity.products.addDirectChannel.onSave.error.2' }))
setIsDisabledSave(false)
}
}).catch(_e => {
console.log(_e)
setIsDisabledSave(false)
message.error(_e.errorFields[0].errors[0] || '请完善渠道商品必填信息!')
message.error(_e.errorFields[0].errors[0] || intl.formatMessage({ id: 'commodity.products.addDirectChannel.onSave.error.3' }))
})
} catch (e) {
console.log(e)
setIsDisabledSave(false)
message.error(e.message || '请完善相关信息!')
message.error(e.message || intl.formatMessage({ id: 'commodity.products.addDirectChannel.onSave.error.4' }))
}
}
return (<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title={queryId ? "编辑渠道直采商品" : "新建渠道直采商品"}
backIcon={<ReutrnEle description={intl.formatMessage({ id: 'commodity.products.addDirectChannel.back' })} />}
title={queryId ? intl.formatMessage({ id: 'commodity.products.addDirectChannel.title.1' }) : intl.formatMessage({ id: 'commodity.products.addDirectChannel.title.2' })}
extra={[
<Button key="123" type="primary" icon={<SaveOutlined />} onClick={onSave} disabled={isDisabledSave}>
保存
{intl.formatMessage({ id: 'commodity.products.addDirectChannel.extra' })}
</Button>,
]}
>
<Card>
<Tabs onChange={callback} type="card">
<TabPane tab="选择商品" key="1">
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addDirectChannel.tab.1' })} key="1">
<SelectProduct
onRef={(refs)=>setFormRefs([...formRefs, refs])}
onRef={(refs) => setFormRefs([...formRefs, refs])}
/>
</TabPane>
<TabPane tab="设置价格" key="2">
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addDirectChannel.tab.2' })} key="2">
<SetPrice
onRef={(refs)=>setFormRefs([...formRefs, refs])}
onRef={(refs) => setFormRefs([...formRefs, refs])}
/>
</TabPane>
<TabPane tab="物流信息" key="4">
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addDirectChannel.tab.3' })} key="4">
<SetLogistics
onRef={(refs)=>setFormRefs([...formRefs, refs])}
onRef={(refs) => setFormRefs([...formRefs, refs])}
/>
</TabPane>
<TabPane tab="适用渠道" key="3">
<TabPane tab={intl.formatMessage({ id: 'commodity.products.addDirectChannel.tab.4' })} key="3">
<SelectChannel
onRef={(refs)=>setFormRefs([...formRefs, refs])}
onRef={(refs) => setFormRefs([...formRefs, refs])}
/>
</TabPane>
</Tabs>
......
import React, { useEffect, useRef, useState } from 'react'
import { history } from 'umi'
import { history, useIntl } from 'umi'
import { Form, Radio, Input, Tooltip } from 'antd'
import { store } from '@/store'
import { validatorByte } from '@/utils/regExp'
......@@ -22,6 +22,7 @@ export interface Iprops {
const { TextArea } = Input
const OtherForm: React.FC<Iprops> = (props) => {
const intl = useIntl();
const { onRef } = props
const otherFormRef = useRef()
const flagRef = useRef<boolean>(false)
......@@ -31,10 +32,10 @@ const OtherForm: React.FC<Iprops> = (props) => {
const { id } = history.location.query
useEffect(()=>{
useEffect(() => {
//传入ref给父级
onRef(otherFormRef)
if(id){
if (id) {
console.log(getOtherFormParamsByEdit, 'getOtherFormParamsByEdit')
otherForm.setFieldsValue(getOtherFormParamsByEdit)
}
......@@ -42,7 +43,7 @@ const OtherForm: React.FC<Iprops> = (props) => {
useEffect(() => {
// 品类 变动清空form
if(history.location.query?.id && !flagRef.current) {
if (history.location.query?.id && !flagRef.current) {
flagRef.current = true
} else {
otherForm.resetFields()
......@@ -50,11 +51,11 @@ const OtherForm: React.FC<Iprops> = (props) => {
}, [selectCategoryId])
useEffect(() => {
if(productPriceType === 3) {
otherForm.setFieldsValue({"isInvoice": false})
if (productPriceType === 3) {
otherForm.setFieldsValue({ "isInvoice": false })
setDisabledInvoice(true)
} else {
otherForm.setFieldsValue({"isInvoice": true})
otherForm.setFieldsValue({ "isInvoice": true })
setDisabledInvoice(false)
}
}, [productPriceType])
......@@ -71,53 +72,53 @@ const OtherForm: React.FC<Iprops> = (props) => {
>
<Form.Item
name="isInvoice"
label="提供发票"
label={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.isInvoice' })}
rules={[{
required: true,
message: "请选择是否提供发票"
message: intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.isInvoice.message' })
}]}
style={{ display: "none" }}
initialValue={true}
>
<Radio.Group size="small" disabled={disabledInvoice}>
<Radio.Button value={true} style={{ width: 100, textAlign: 'center' }}></Radio.Button>
<Radio.Button value={false} style={{ width: 100, textAlign: 'center' }}></Radio.Button>
<Radio.Button value={true} style={{ width: 100, textAlign: 'center' }}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.isInvoice.radio.1' })}</Radio.Button>
<Radio.Button value={false} style={{ width: 100, textAlign: 'center' }}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.isInvoice.radio.2' })}</Radio.Button>
</Radio.Group>
</Form.Item>
<Form.Item
name="marks"
label="唛头"
label={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.marks' })}
rules={[
{
validator: (r, v, c) => validatorByte(r, v, c, 50)
}
]}
>
<Input placeholder="最长50个字符25个汉字" />
<Input placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.marks.placeholder' })} />
</Form.Item>
<Form.Item
name="packing"
label="包装清单"
label={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.packing' })}
rules={[
{
validator: (r, v, c) => validatorByte(r, v, c, 120)
}
]}
>
<TextArea rows={4} placeholder="最长120个字符60个汉字" />
<TextArea rows={4} placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.packing.placeholder' })} />
</Form.Item>
<Form.Item
name="afterService"
label="售后服务"
label={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.afterService' })}
rules={[
{
validator: (r, v, c) => validatorByte(r, v, c, 300)
}
]}
>
<TextArea rows={4} placeholder="最长300个字符150个汉字" />
<TextArea rows={4} placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.afterService.placeholder' })} />
</Form.Item>
<Form.Item label="SEO优化">
<Form.Item label={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.seo' })}>
<span className="ant-form-text"></span>
</Form.Item>
<Form.Item
......@@ -125,7 +126,7 @@ const OtherForm: React.FC<Iprops> = (props) => {
label={
<span>
Title&nbsp;
<Tooltip title="用于显示在页面title标签的内容,便于搜索引擎抓取">
<Tooltip title={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.title.tooltip' })}>
<QuestionCircleOutlined />
</Tooltip>
</span>
......@@ -136,14 +137,14 @@ const OtherForm: React.FC<Iprops> = (props) => {
}
]}
>
<Input placeholder="最长50个汉字" />
<Input placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.title.placeholder' })} />
</Form.Item>
<Form.Item
name="description"
label={
<span>
Description&nbsp;
<Tooltip title="用于显示在页面Description标签的内容,便于搜索引擎抓取">
<Tooltip title={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.description.tooltip' })}>
<QuestionCircleOutlined />
</Tooltip>
</span>
......@@ -154,14 +155,14 @@ const OtherForm: React.FC<Iprops> = (props) => {
}
]}
>
<TextArea rows={4} placeholder="最长200个汉字" />
<TextArea rows={4} placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.description.placeholder' })} />
</Form.Item>
<Form.Item
name="keywords"
label={
<span>
Keywords&nbsp;
<Tooltip title="用于显示在页面Keywords标签的内容,便于搜索引擎通过关键词搜索时抓取页面,多个关键词用豆号分隔">
<Tooltip title={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.keywords.tooltip' })}>
<QuestionCircleOutlined />
</Tooltip>
</span>
......@@ -172,7 +173,7 @@ const OtherForm: React.FC<Iprops> = (props) => {
}
]}
>
<Input placeholder="最长100个汉字" />
<Input placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.otherForm.form.keywords.placeholder' })} />
</Form.Item>
</Form>
</>)
......
import React, { useState, useEffect, useRef } from 'react'
import {history} from 'umi'
import { history, useIntl } from 'umi'
import { Form, Select, Checkbox, Tabs, Input, DatePicker, Row, Col } from 'antd'
import { inject, observer } from 'mobx-react'
import { store } from '@/store'
......@@ -26,6 +26,7 @@ const { RangePicker } = DatePicker
let paramsArray = [];
const ProductAttributeForm: React.FC<Iprops> = (props) => {
const intl = useIntl();
const { attributesData, onRef } = props
const [isClearFormAndDataInEdit, setIsClearFormAndDataInEdit] = useState<boolean>(false) // 编辑情况下 是否要清空商品属性表单数据和页面全局数据
const productAttributeFormRef = useRef()
......@@ -40,10 +41,10 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
setIsRecombination
} = ProductStore
useEffect(()=>{
useEffect(() => {
onRef(productAttributeFormRef)
// 编辑情况下 构建选中属性数据 给paramsArray初始化数据用于编辑 设置表单数据
if(history.location.query?.id){
if (history.location.query?.id) {
constructProductSelectAttribute()
attributeForm.setFieldsValue(getProductAttributeFormParamsByEdit)
}
......@@ -51,17 +52,17 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
useEffect(() => {
// 属性变动 表明品类品牌变动 清空页面全局参数组合和store的选中属性 重置表单 (只对新增有效)
if(history.location.query?.id){
if (history.location.query?.id) {
// 编辑第一次执行不清空,之后的变动需要清空
if(isClearFormAndDataInEdit){
if (isClearFormAndDataInEdit) {
paramsArray = []
setProductSelectAttribute([])
attributeForm.resetFields()
clearProductDetailsUnitPriceAndPicListInEdit([]) // 清空商品编辑数据中的商品属性
}else{
} else {
setIsClearFormAndDataInEdit(true)
}
}else{
} else {
paramsArray = []
setProductSelectAttribute([])
attributeForm.resetFields()
......@@ -82,36 +83,36 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
isDate: attrItem.isDate,
customerAttributeValueList: []
} // 添加日期属性用于特殊处理
if(attrItem.type!==3) {
if (attrItem.type !== 3) {
//.... 在此处单独处理日期属性 ....//
if(attrItem.type === 2 && attrItem.isDate) {
if (attrItem.type === 2 && attrItem.isDate) {
// 日期属性 暂定属性值id为null
params.customerAttributeValueList.push({
id: null,
value: value.map(item => item.format('YYYY-MM-DD')),
})
}else{
for(let item of attrItem?.customerAttributeValueList){
if(value?.length){
for(let i of value){
if(item.id===i){
} else {
for (let item of attrItem?.customerAttributeValueList) {
if (value?.length) {
for (let i of value) {
if (item.id === i) {
params.customerAttributeValueList.push({
id: i,
value: item.value,
})
}
}
} else { // 输入
if (item.id === value) {
params.customerAttributeValueList.push({
id: i,
id: value,
value: item.value,
})
}
}
}else{ // 输入
if(item.id===value){
params.customerAttributeValueList.push({
id: value,
value: item.value,
})
}
}
}
}
}else{
} else {
params.customerAttributeValueList.push({
id: null,
value: value.target.value,
......@@ -119,13 +120,13 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
}
paramsArray.push(params)
let _resultParams = Object.values(paramsArray.reduce((item, next)=>{
let _resultParams = Object.values(paramsArray.reduce((item, next) => {
item[next.customerAttributeId] = next;
return item
},{}))
}, {}))
// 遍历 排空
let resultParams = _resultParams.filter((_item: any)=>_item.customerAttributeValueList.length!=0)
let resultParams = _resultParams.filter((_item: any) => _item.customerAttributeValueList.length != 0)
setProductSelectAttribute(resultParams)
}
......@@ -148,12 +149,12 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
let _isPrice = null
let _isUpdateAttribute = null
let _isDisabled = false
if(history.location.query?.id){
if (history.location.query?.id) {
_isPrice = attrItem.isPrice
_isUpdateAttribute = productInfoByEdit.isUpdateAttribute
_isDisabled = _isPrice && !_isUpdateAttribute
// 编辑中 过滤后续添加的属性
if(!_isUpdateAttribute && (attrItem.createTime > productInfoByEdit.createTime)) {
if (!_isUpdateAttribute && (attrItem.createTime > productInfoByEdit.createTime)) {
return null
}
}
......@@ -167,14 +168,14 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
label={attrItem.name}
rules={attrItem.isEmpty && [{
required: true,
message: '此项为必填项'
message: intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.message' })
}]}
>
<Select
disabled={_isDisabled}
placeholder="请选择"
placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.placeholder.1' })}
allowClear
onChange={(v)=>onChange(v, attrItem)}
onChange={(v) => onChange(v, attrItem)}
>
{
attrItem?.customerAttributeValueList.length > 0 && attrItem.customerAttributeValueList.map((item: any) => (
......@@ -185,18 +186,18 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
</Form.Item>
}
{
attrItem.type === 2 && ( attrItem.isDate ?
attrItem.type === 2 && (attrItem.isDate ?
<Form.Item
label={attrItem.name}
name={attrItem.id}
rules={attrItem.isEmpty && [{
required: true,
message: '此项为必填项'
message: intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.message' })
}]}
>
<RangePicker
disabled={_isDisabled}
onChange={(v)=>onChange(v, attrItem)}
onChange={(v) => onChange(v, attrItem)}
format="YYYY-MM-DD"
/>
</Form.Item>
......@@ -206,13 +207,13 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
name={attrItem.id}
rules={attrItem.isEmpty && [{
required: true,
message: '此项为必填项'
message: intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.message' })
}]}
>
<Checkbox.Group
onChange={(v)=>onChange(v, attrItem)}
onChange={(v) => onChange(v, attrItem)}
disabled={_isDisabled}
style={{width: "100%"}}
style={{ width: "100%" }}
>
<Row>
{
......@@ -234,18 +235,18 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
label={attrItem.name}
rules={attrItem.isEmpty ? [{
required: true,
message: '此项为必填项'
},{
message: intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.message' })
}, {
validator: (r, v, c) => validatorByte(r, v, c, 60)
}] : [{
validator: (r, v, c) => validatorByte(r, v, c, 60)
}]
}
}
>
<TextArea
disabled={_isDisabled}
onChange={(v)=>onChange(v, attrItem)}
placeholder="最多输入60个字符,30个汉字"
onChange={(v) => onChange(v, attrItem)}
placeholder={intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.placeholder.2' })}
rows={4}
/>
</Form.Item>
......@@ -275,7 +276,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
}
</Tabs>
</Form>
{attributesData?.length === 0 && <span style={{opacity: 0.6}}>暂无数据!</span>}
{attributesData?.length === 0 && <span style={{ opacity: 0.6 }}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.productAttributeForm.none' })}</span>}
</>)
}
......
import React, { useState, useEffect, useRef } from 'react'
import {history} from 'umi'
import { history, useIntl } from 'umi'
import { Form, Checkbox } from 'antd'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
......@@ -18,6 +18,7 @@ const layout = {
}
const SelectGoodsForm: React.FC<{}> = (props) => {
const intl = useIntl();
const ref = useRef<any>({})
const [selectGoodsForm] = Form.useForm()
const [isSelectGoods, setIsSelectGoods] = useState<boolean>(true) // 货品table显示隐藏
......@@ -31,23 +32,23 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
// 品类 品牌变动重新渲染货品表格 清空选择 清空store
setSelectedGoodsRowKeys([])
ProductStore.setSelectedGoods([])
if(ref.current.reload)
if (ref.current.reload)
ref.current.reload()
}, [selectCategoryId, selectBrandId])
useEffect(()=>{
useEffect(() => {
const { id } = history.location.query
if(id){
let _goodsArr: any = productInfoByEdit?.unitPriceAndPicList.map(_ => _.goods)
let goodsArr: any = _goodsArr && _goodsArr.indexOf(null)===-1 && _goodsArr.length>0 && Object.values(_goodsArr.reduce((item, next)=>{
if (id) {
let _goodsArr: any = productInfoByEdit?.unitPriceAndPicList.map(_ => _.goods)
let goodsArr: any = _goodsArr && _goodsArr.indexOf(null) === -1 && _goodsArr.length > 0 && Object.values(_goodsArr.reduce((item, next) => {
item[next.id] = next;
return item
},{}))
if(goodsArr?.length>0){
}, {}))
if (goodsArr?.length > 0) {
setIsChecked(true)
setIsSelectGoods(true)
//@ts-ignore
setSelectedGoodsRowKeys(goodsArr.map(__=>__.id))
setSelectedGoodsRowKeys(goodsArr.map(__ => __.id))
ProductStore.setSelectedGoods(goodsArr)
}
}
......@@ -55,7 +56,7 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
let obj = { ...params, brandId: selectBrandId || productInfoByEdit?.brand?.id, customerCategoryId: selectCategoryId || productInfoByEdit?.customerCategory?.id}
let obj = { ...params, brandId: selectBrandId || productInfoByEdit?.brand?.id, customerCategoryId: selectCategoryId || productInfoByEdit?.customerCategory?.id }
getProductGoodsGetGoodsList(obj).then(res => {
resolve(res.data)
})
......@@ -64,12 +65,12 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
const goodsColumns: ColumnType<any>[] = [
{
title: '货号',
title: intl.formatMessage({ id: 'commodity.products.addProductsItem.selectGoodsForm.goodsColumns.code' }),
dataIndex: 'code',
key: 'code',
},
{
title: '货品名称',
title: intl.formatMessage({ id: 'commodity.products.addProductsItem.selectGoodsForm.goodsColumns.name' }),
dataIndex: 'name',
key: 'name',
className: 'commonPickColor',
......@@ -82,22 +83,22 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
</a>
},
{
title: '规格型号',
title: intl.formatMessage({ id: 'commodity.products.addProductsItem.selectGoodsForm.goodsColumns.type' }),
dataIndex: 'type',
key: 'type',
},
{
title: '品类',
title: intl.formatMessage({ id: 'commodity.products.addProductsItem.selectGoodsForm.goodsColumns.customerCategory' }),
dataIndex: ['customerCategory', 'name'],
key: 'customerCategory',
},
{
title: '品牌',
title: intl.formatMessage({ id: 'commodity.products.addProductsItem.selectGoodsForm.goodsColumns.brand' }),
dataIndex: ['brand', 'name'],
key: 'brand',
},
{
title: '成单价',
title: intl.formatMessage({ id: 'commodity.products.addProductsItem.selectGoodsForm.goodsColumns.costPrice' }),
dataIndex: 'costPrice',
key: 'costPrice',
},
......@@ -130,9 +131,9 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
colon={false}
>
<Form.Item
label="是否选择货品"
label={intl.formatMessage({ id: 'commodity.products.addProductsItem.selectGoodsForm.form.selectGoods' })}
>
<Checkbox checked={isChecked} onChange={onSelectGoodsChange}>选择货品</Checkbox>
<Checkbox checked={isChecked} onChange={onSelectGoodsChange}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.selectGoodsForm.form.selectGoods.check' })}</Checkbox>
</Form.Item>
</Form>
{
......@@ -144,7 +145,7 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
fetchTableData={(params: any) => fetchData(params)}
/>
}
</> : <span style={{opacity: 0.6}}>暂无数据!</span>
</> : <span style={{ opacity: 0.6 }}>{intl.formatMessage({ id: 'commodity.products.addProductsItem.selectGoodsForm.none' })}</span>
}
</>)
}
......
import React, { useState, useEffect, useRef } from 'react'
import { useIntl } from 'umi';
import cx from 'classnames'
import styles from '../../index.less'
import { Button, Tooltip } from 'antd'
......@@ -26,7 +27,8 @@ interface DragItem {
}
const ImageItem: React.FC<RenderProps> = (props) => {
const {id, key, index, item, handleAddlink, handleDelete, changePosition} = props
const intl = useIntl();
const { id, key, index, item, handleAddlink, handleDelete, changePosition } = props
const ref = useRef<HTMLDivElement>(null)
const [, drop] = useDrop({
......@@ -76,13 +78,13 @@ const ImageItem: React.FC<RenderProps> = (props) => {
return <div key={index} className={cx(styles.descriptBox, styles.mediaContentBox)} ref={ref}>
<p className={styles.divImage}><img src={item['url']} /></p>
<div className={styles.rightBtn}>
<Tooltip title="删除图片">
<Button size="small" onClick={()=>handleDelete(index)} icon={<DeleteOutlined />} />
<Tooltip title={intl.formatMessage({ id: 'commodity.products.components.dragSortImageList.tooltip.1' })}>
<Button size="small" onClick={() => handleDelete(index)} icon={<DeleteOutlined />} />
</Tooltip>
<Tooltip title="添加图片链接">
<Button size="small" onClick={()=>handleAddlink(index)} icon={<LinkOutlined />} />
<Tooltip title={intl.formatMessage({ id: 'commodity.products.components.dragSortImageList.tooltip.2' })}>
<Button size="small" onClick={() => handleAddlink(index)} icon={<LinkOutlined />} />
</Tooltip>
<Tooltip title="拖拽排序">
<Tooltip title={intl.formatMessage({ id: 'commodity.products.components.dragSortImageList.tooltip.3' })}>
<Button size="small" icon={<DragOutlined />} />
</Tooltip>
</div>
......@@ -103,6 +105,7 @@ interface DragSortImageListProps {
}
const DragSortImageList: React.FC<DragSortImageListProps> = (props) => {
const intl = useIntl();
const { imageList, handleDelete, handleAddlink, changePosition } = props
const renderImageList = (item: ImageItemProps, index: number) => {
......@@ -119,16 +122,16 @@ const DragSortImageList: React.FC<DragSortImageListProps> = (props) => {
return <div>
{
imageList?.length>0
?
imageList.map((item, index)=> renderImageList(item, index))
:
<div className={styles.descriptBox}>
<p>图片区域</p>
<div className={styles.rightBtn}>
<Button size="small" icon={<DeleteOutlined />} />
imageList?.length > 0
?
imageList.map((item, index) => renderImageList(item, index))
:
<div className={styles.descriptBox}>
<p>{intl.formatMessage({ id: 'commodity.products.components.dragSortImageList.descriptBox' })}</p>
<div className={styles.rightBtn}>
<Button size="small" icon={<DeleteOutlined />} />
</div>
</div>
</div>
}
</div>
}
......
import React, { useEffect, useState } from 'react'
import { useIntl } from 'umi';
import ModalTable, { ModalTableProps } from '@/components/ModalTable'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { upperCommodityColumns, upperCommoditySchema } from '../../constant'
......@@ -19,10 +20,11 @@ export interface UpperProductModalTableProps extends ModalTableProps {
// 选择采购合同弹窗
const UpperProductModalTable: React.FC<UpperProductModalTableProps> = (props) => {
const intl = useIntl();
const { type = 'radio', currentRef, tableRef, ...restProps } = props
const [visible, setVisible] = useState(false)
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({type})
const [rowSelection, rowSelectionCtl] = useRowSelectionTable({ type })
useEffect(() => {
if (currentRef) {
......@@ -40,7 +42,7 @@ const UpperProductModalTable: React.FC<UpperProductModalTableProps> = (props) =>
setConfirmLoading(true)
postProductCommoditySaveUpperCommodity({ idList: items.map(item => item.id) }).then(res => {
const { data, code } = res
if(code === 1000) {
if (code === 1000) {
rowSelectionCtl.setSelectedRowKeys([])
setVisible(false)
setTimeout(() => {
......@@ -53,16 +55,16 @@ const UpperProductModalTable: React.FC<UpperProductModalTableProps> = (props) =>
return (
<ModalTable
modalTitle='选择上游商品'
modalTitle={intl.formatMessage({ id: 'commodity.products.components.upperProductModalTable' })}
width={900}
columns={upperCommodityColumns}
visible={visible}
confirm={handleConfirm}
loading={confirmLoading}
cancel={() => setVisible(false)}
fetchTableData={async (params) => (await getProductCommodityGetUpperCommodityList({...params})).data}
fetchTableData={async (params) => (await getProductCommodityGetUpperCommodityList({ ...params })).data}
rowSelection={rowSelection}
resetModal={{destroyOnClose: true, forceRender: true}}
resetModal={{ destroyOnClose: true, forceRender: true }}
modalType='none'
tableProps={{
rowKey: 'id',
......
This diff is collapsed.
import { ISchema } from '@formily/antd';
import { getIntl } from 'umi';
import { FORM_FILTER_PATH } from '@/formSchema/const';
// 渠道商品列表高级搜索
......@@ -27,7 +28,7 @@ export const channelSchema: ISchema = {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '商品名称',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.name' }),
},
},
},
......@@ -47,14 +48,14 @@ export const channelSchema: ISchema = {
memberName: {
type: 'string',
'x-component-props': {
placeholder: '适用渠道',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.memberName' }),
style: { width: 100 },
},
},
memberRoleName: {
type: 'string',
'x-component-props': {
placeholder: '渠道会员角色',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.memberRoleName' }),
style: { width: 100 },
},
},
......@@ -62,7 +63,7 @@ export const channelSchema: ISchema = {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品牌',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.brandId' }),
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
......@@ -77,7 +78,7 @@ export const channelSchema: ISchema = {
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: '商品品类',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.customerCategoryId' }),
showSearch: true,
notFoundContent: null,
style: { width: '174px' },
......@@ -89,16 +90,16 @@ export const channelSchema: ISchema = {
type: 'string',
enum: [
{
label: '上级渠道',
label: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.source.1' }),
value: 1,
},
{
label: '渠道自有',
label: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.source.2' }),
value: 2,
}
],
'x-component-props': {
placeholder: '商品来源',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.source.placeholder' }),
style: { width: 100 },
},
},
......@@ -106,20 +107,20 @@ export const channelSchema: ISchema = {
type: 'string',
enum: [
{
label: '未上架',
label: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.statusList.1' }),
value: 7,
},
{
label: '已上架',
label: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.statusList.2' }),
value: 5,
},
{
label: '已下架',
label: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.statusList.3' }),
value: 6,
}
],
'x-component-props': {
placeholder: '商品状态',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.statusList.placeholder' }),
style: { width: 100 },
},
},
......@@ -148,7 +149,7 @@ export const channelSchema: ISchema = {
type: 'number',
'x-component': 'NumberRange',
'x-component-props': {
placeholder: ['最低价格', '最高价格'],
placeholder: [getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.min' }), getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.max' })],
},
},
submit: {
......@@ -157,7 +158,7 @@ export const channelSchema: ISchema = {
span: 1,
},
'x-component-props': {
children: '查询',
children: getIntl().formatMessage({ id: 'commodity.products.schema.channelSchema.submit' }),
},
},
},
......@@ -175,7 +176,7 @@ export const addChannelSchema: ISchema = {
type: 'string',
'x-component': 'ModalSearch',
'x-component-props': {
placeholder: '商品名称',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.addChannelSchema.name' }),
align: 'flex-left',
},
},
......@@ -198,7 +199,7 @@ export const addChannelSchema: ISchema = {
type: 'string',
// "x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请输入品类',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.addChannelSchema.customerCategoryName' }),
// className: 'fixed-ant-selected-down',
// fetchSearch: getProductSelectGetSelectCategory,
}
......@@ -207,7 +208,7 @@ export const addChannelSchema: ISchema = {
type: 'string',
// "x-component": 'SearchSelect',
"x-component-props": {
placeholder: '请输入品牌',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.addChannelSchema.brandName' }),
// fetchSearch: getProductSelectGetSelectBrand,
}
},
......@@ -215,7 +216,7 @@ export const addChannelSchema: ISchema = {
type: 'string',
enum: [],
'x-component-props': {
placeholder: '上级渠道',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.addChannelSchema.parentMemberId' }),
},
},
submit: {
......@@ -224,7 +225,7 @@ export const addChannelSchema: ISchema = {
span: 1
},
"x-component-props": {
children: '查询'
children: getIntl().formatMessage({ id: 'commodity.products.schema.addChannelSchema.submit' })
}
}
}
......
import { ISchema } from '@formily/antd';
import { getIntl } from 'umi';
import { FORM_FILTER_PATH } from '@/formSchema/const';
// 商品列表高级搜索
......@@ -27,7 +28,7 @@ export const productSchema: ISchema = {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '商品名称',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.name' }),
},
},
},
......@@ -48,24 +49,24 @@ export const productSchema: ISchema = {
type: 'string',
enum: [
{
label: '现货价格',
label: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.priceTypeList.1' }),
value: 1,
},
{
label: '价格需要询价',
label: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.priceTypeList.2' }),
value: 2,
},
{
label: '积分兑换商品',
label: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.priceTypeList.3' }),
value: 3,
},
{
label: '赠品',
label: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.priceTypeList.4' }),
value: 4,
}
],
'x-component-props': {
placeholder: '商品定价',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.priceTypeList.placeholder' }),
style: { width: '174px' },
},
},
......@@ -73,7 +74,7 @@ export const productSchema: ISchema = {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品牌',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.brandId' }),
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
......@@ -88,7 +89,7 @@ export const productSchema: ISchema = {
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: '商品品类',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.customerCategoryId' }),
showSearch: true,
notFoundContent: null,
style: { width: '174px' },
......@@ -100,32 +101,32 @@ export const productSchema: ISchema = {
type: 'string',
enum: [
{
label: '待提交审核',
label: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.statusList.1' }),
value: 1,
},
{
label: '待审核',
label: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.statusList.2' }),
value: 2,
},
{
label: '审核不通过',
label: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.statusList.3' }),
value: 3,
},
{
label: '审核通过',
label: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.statusList.4' }),
value: 4,
},
{
label: '上架',
label: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.statusList.5' }),
value: 5,
},
{
label: '下架',
label: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.statusList.6' }),
value: 6,
}
],
'x-component-props': {
placeholder: '商品状态',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.statusList.placeholder' }),
style: { width: '174px' },
},
},
......@@ -133,7 +134,7 @@ export const productSchema: ISchema = {
type: 'number',
'x-component': 'NumberRange',
'x-component-props': {
placeholder: ['最低价格', '最高价格'],
placeholder: [getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.min' }), getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.max' })],
},
},
submit: {
......@@ -142,7 +143,7 @@ export const productSchema: ISchema = {
span: 1,
},
'x-component-props': {
children: '查询',
children: getIntl().formatMessage({ id: 'commodity.products.schema.productSchema.submit' }),
},
},
},
......@@ -171,7 +172,7 @@ export const fastSchema: ISchema = {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '商品名称',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.fastSchema.name' }),
},
},
},
......@@ -192,20 +193,20 @@ export const fastSchema: ISchema = {
type: 'string',
enum: [
{
label: '所有',
label: getIntl().formatMessage({ id: 'commodity.products.schema.fastSchema.priceTypeList.1' }),
value: 0,
},
{
label: '现货价格',
label: getIntl().formatMessage({ id: 'commodity.products.schema.fastSchema.priceTypeList.2' }),
value: 1,
},
{
label: '积分兑换商品',
label: getIntl().formatMessage({ id: 'commodity.products.schema.fastSchema.priceTypeList.3' }),
value: 3,
}
],
'x-component-props': {
placeholder: '商品定价',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.fastSchema.priceTypeList.placeholder' }),
style: { width: '174px' },
},
},
......@@ -213,7 +214,7 @@ export const fastSchema: ISchema = {
type: 'string',
'x-component': 'CustomInputSearch',
'x-component-props': {
placeholder: '商品品牌',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.fastSchema.brandId' }),
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
......@@ -228,7 +229,7 @@ export const fastSchema: ISchema = {
type: 'string',
'x-component': 'CustomCategorySearch',
'x-component-props': {
placeholder: '商品品类',
placeholder: getIntl().formatMessage({ id: 'commodity.products.schema.fastSchema.customerCategoryId' }),
showSearch: true,
notFoundContent: null,
style: { width: '174px' },
......@@ -240,7 +241,7 @@ export const fastSchema: ISchema = {
type: 'number',
'x-component': 'NumberRange',
'x-component-props': {
placeholder: ['最低价格', '最高价格'],
placeholder: [getIntl().formatMessage({ id: 'commodity.products.schema.fastSchema.min' }), getIntl().formatMessage({ id: 'commodity.products.schema.fastSchema.max' })],
},
},
submit: {
......@@ -249,7 +250,7 @@ export const fastSchema: ISchema = {
span: 1,
},
'x-component-props': {
children: '查询',
children: getIntl().formatMessage({ id: 'commodity.products.schema.fastSchema.submit' }),
},
},
},
......
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