Commit 6b321f7e authored by XieZhiXiong's avatar XieZhiXiong
parents 0f9c762b be10e206
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
"@umijs/test": "^3.2.0", "@umijs/test": "^3.2.0",
"bizcharts": "^4.0.14", "bizcharts": "^4.0.14",
"copy-to-clipboard": "^3.3.1", "copy-to-clipboard": "^3.3.1",
"god": "0.1.24", "god": "^0.1.25",
"lingxi-design": "^1.0.7", "lingxi-design": "^1.0.7",
"lingxi-design-ui": "^1.0.8", "lingxi-design-ui": "^1.0.8",
"lingxi-editor-core": "^1.0.6", "lingxi-editor-core": "^1.0.6",
......
...@@ -10,13 +10,11 @@ import { ...@@ -10,13 +10,11 @@ import {
QuestionCircleOutlined QuestionCircleOutlined
} from '@ant-design/icons' } from '@ant-design/icons'
import { ColumnType } from 'antd/lib/table/interface'; import { ColumnType } from 'antd/lib/table/interface';
import { StandardTable } from 'god'
import { IFormFilter, IButtonFilter } from 'god/dist/src/standard-table/TableController';
import ReutrnEle from '@/components/ReturnEle'; import ReutrnEle from '@/components/ReturnEle';
import styles from './index.less' import styles from './index.less'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'; import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import NiceForm from '@/components/NiceForm'; import NiceForm from '@/components/NiceForm';
import { createFormActions, createAsyncFormActions, FormEffectHooks } from '@formily/antd'; import { createAsyncFormActions, FormEffectHooks } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'; import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from './effect'; import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from './effect';
...@@ -25,7 +23,9 @@ import { PublicApi } from '@/services/api'; ...@@ -25,7 +23,9 @@ import { PublicApi } from '@/services/api';
import ModalTable from '@/components/ModalTable' import ModalTable from '@/components/ModalTable'
import { GetProductChannelCommodityGetChannelCommodityResponse, GetProductChannelCommodityGetCommodityListResponseDetail } from '@/services'; import { GetProductChannelCommodityGetChannelCommodityResponse, GetProductChannelCommodityGetCommodityListResponseDetail } from '@/services';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect'; import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import { query } from 'express'; import SearchSelect from '@/components/NiceForm/components/SearchSelect'
import Search from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit'
const {Item}:any = Form const {Item}:any = Form
...@@ -56,7 +56,6 @@ const productFormActions = createAsyncFormActions() ...@@ -56,7 +56,6 @@ const productFormActions = createAsyncFormActions()
const AddDirectChannel:React.FC<{}> = (props) => { const AddDirectChannel:React.FC<{}> = (props) => {
const productRef = useRef<any>({}) const productRef = useRef<any>({})
const ref = useRef<any>({})
const [formProduct] = Form.useForm() const [formProduct] = Form.useForm()
const [formPrice] = Form.useForm() const [formPrice] = Form.useForm()
const [formMember] = Form.useForm() const [formMember] = Form.useForm()
...@@ -193,9 +192,10 @@ const AddDirectChannel:React.FC<{}> = (props) => { ...@@ -193,9 +192,10 @@ const AddDirectChannel:React.FC<{}> = (props) => {
useEffect(() => { useEffect(() => {
if(visibleAddTabs) if(visibleAddTabs)
productFormActions.setFieldState('parentMemberId', state => { console.log(productRef.current, productFormActions,'132456')
state.visible = source===1 ? true : false // productRef.current.schemaAction.setFieldState('parentMemberId', state => {
}) // state.visible = source===1 ? true : false
// })
}, [visibleAddTabs]) }, [visibleAddTabs])
// 获取渠道商品 // 获取渠道商品
...@@ -582,6 +582,7 @@ const AddDirectChannel:React.FC<{}> = (props) => { ...@@ -582,6 +582,7 @@ const AddDirectChannel:React.FC<{}> = (props) => {
if(productRowCtl.selectRow.length > 0){ if(productRowCtl.selectRow.length > 0){
params.commodityId = productRowCtl.selectRow[0].commodityId params.commodityId = productRowCtl.selectRow[0].commodityId
params.parentMemberId = productRowCtl.selectRow[0].parentMemberId params.parentMemberId = productRowCtl.selectRow[0].parentMemberId
params.parentMemberName = productRowCtl.selectRow[0].parentMemberName
} }
if(memberRowCtl.selectRow.length > 0) if(memberRowCtl.selectRow.length > 0)
params.purchaserList = memberRowCtl.selectedRowKeys params.purchaserList = memberRowCtl.selectedRowKeys
...@@ -747,31 +748,52 @@ const AddDirectChannel:React.FC<{}> = (props) => { ...@@ -747,31 +748,52 @@ const AddDirectChannel:React.FC<{}> = (props) => {
}, },
}) })
}} }}
controlRender={ formilyProps={
<NiceForm {
actions={productFormActions} ctx: {
onSubmit={values =>productRef.current.reload(values)} schema: addChannelSchema,
effects={($, actions) => { actions: productFormActions,
useStateFilterSearchLinkageEffect( components: { ModalSearch: Search, SearchSelect, Submit } ,
$, effects: ($, actions) => {
actions, useStateFilterSearchLinkageEffect(
'name', $,
FORM_FILTER_PATH, actions,
) 'name',
FormEffectHooks.onFieldChange$('brandId').subscribe(state => { FORM_FILTER_PATH,
searchBrandOptionEffect(actions, 'brandId') )
}) useAsyncSelect(
FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state => { 'parentMemberId',
searchCustomerCategoryOptionEffect(actions, 'customerCategoryId') fetchSelectOptions,
}) )
useAsyncSelect( }
'parentMemberId', }
fetchSelectOptions, }
)
}}
schema={addChannelSchema}
/>
} }
// controlRender={
// <NiceForm
// actions={productFormActions}
// onSubmit={values =>productRef.current.reload(values)}
// effects={($, actions) => {
// useStateFilterSearchLinkageEffect(
// $,
// actions,
// 'name',
// FORM_FILTER_PATH,
// )
// FormEffectHooks.onFieldChange$('brandId').subscribe(state => {
// searchBrandOptionEffect(actions, 'brandId')
// })
// FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state => {
// searchCustomerCategoryOptionEffect(actions, 'customerCategoryId')
// })
// useAsyncSelect(
// 'parentMemberId',
// fetchSelectOptions,
// )
// }}
// schema={addChannelSchema}
// />
// }
/> />
<Modal <Modal
......
...@@ -56,7 +56,7 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -56,7 +56,7 @@ const AddProducts: React.FC<{}> = (props) => {
makeRequest() makeRequest()
} }
return ()=>{ return () => {
clearData([]) clearData([])
console.log('添加商品组件卸载') console.log('添加商品组件卸载')
} }
...@@ -154,12 +154,18 @@ const AddProducts: React.FC<{}> = (props) => { ...@@ -154,12 +154,18 @@ const AddProducts: React.FC<{}> = (props) => {
return e return e
} }
_params.unitPriceAndPicList = productAttributeAndImageParams _params.unitPriceAndPicList = productAttributeAndImageParams
} }else{
else{
_params.unitPriceAndPicList = productInfoByEdit.unitPriceAndPicList _params.unitPriceAndPicList = productInfoByEdit.unitPriceAndPicList
} }
if(clickTabIndex.indexOf("3")===-1) if(clickTabIndex.indexOf("3")===-1)
_params.commodityAttributeList = productInfoByEdit.commodityAttributeList _params.commodityAttributeList = productInfoByEdit.commodityAttributeList
if(clickTabIndex.indexOf("4")===-1){
_params.unitId = productInfoByEdit.unitId
_params.unitName = productInfoByEdit.unitName
_params.minOrder = productInfoByEdit.minOrder
_params.priceType = productInfoByEdit.priceType
_params.isMemberPrice = productInfoByEdit.isMemberPrice
}
if(clickTabIndex.indexOf("6")===-1) if(clickTabIndex.indexOf("6")===-1)
_params.commodityRemark = productInfoByEdit.commodityRemark _params.commodityRemark = productInfoByEdit.commodityRemark
if(clickTabIndex.indexOf("7")===-1) if(clickTabIndex.indexOf("7")===-1)
......
...@@ -119,6 +119,10 @@ const LogisticsForm: React.FC<Iprops> = (props) => { ...@@ -119,6 +119,10 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
{ {
required: true, required: true,
message: '请正确输入重量', message: '请正确输入重量',
},
{
pattern: /^\d+(\.\d{1,3})?$/,
message: '重量数值小数点后仅限三位',
} }
]} ]}
noStyle noStyle
......
...@@ -593,7 +593,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -593,7 +593,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
} }
]} ]}
> >
<InputNumber style={{ width: 100, textAlign: 'center' }} placeholder="最小数量" /> <InputNumber min={0} style={{ width: 100, textAlign: 'center' }} placeholder="最小数量" />
</Form.Item> </Form.Item>
<Input <Input
style={{ style={{
...@@ -620,6 +620,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -620,6 +620,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
]} ]}
> >
<InputNumber <InputNumber
min={0}
className={styles.siteInputRight} className={styles.siteInputRight}
style={{ style={{
width: 100, width: 100,
...@@ -647,7 +648,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -647,7 +648,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
} }
]} ]}
> >
<InputNumber style={{ width: '50%', marginLeft: 24 }} placeholder="请输入单价" /> <InputNumber min={0} style={{ width: '50%', marginLeft: 24 }} placeholder="请输入单价" />
</Item> </Item>
</Col> </Col>
<Col span={4}> <Col span={4}>
......
...@@ -26,8 +26,8 @@ export interface Iprops { ...@@ -26,8 +26,8 @@ export interface Iprops {
const SelectGoodsForm: React.FC<Iprops> = (props) => { const SelectGoodsForm: React.FC<Iprops> = (props) => {
const [selectGoodsForm] = Form.useForm() const [selectGoodsForm] = Form.useForm()
const [showSelectGoods, setIsSelectGoods] = useState(false) const [showSelectGoods, setIsSelectGoods] = useState<boolean>(false)
const [isChecked, setIsChecked] = useState(false) const [isChecked, setIsChecked] = useState<boolean>(true)
const [selectGoodsRow, setSelectGoodsRow] = useState<GetProductGoodsGetGoodsListResponseDetail[]>([]) // 模态框选择的行数据 const [selectGoodsRow, setSelectGoodsRow] = useState<GetProductGoodsGetGoodsListResponseDetail[]>([]) // 模态框选择的行数据
const [selectedGoodsRowKeys, setSelectedGoodsRowKeys] = useState<Array<number>>([]) const [selectedGoodsRowKeys, setSelectedGoodsRowKeys] = useState<Array<number>>([])
const { ProductStore } = store const { ProductStore } = store
...@@ -47,7 +47,6 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => { ...@@ -47,7 +47,6 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
//@ts-ignore //@ts-ignore
setSelectedGoodsRowKeys(goodsArr.map(__=>__.id)) setSelectedGoodsRowKeys(goodsArr.map(__=>__.id))
ProductStore.setSelectedGoods(goodsArr) ProductStore.setSelectedGoods(goodsArr)
// console.log(_goodsArr, goodsArr, 'goodArr')
} }
} }
}, [productInfoByEdit]) }, [productInfoByEdit])
...@@ -114,7 +113,6 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => { ...@@ -114,7 +113,6 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
ProductStore.setSelectedGoods(selectedRows) ProductStore.setSelectedGoods(selectedRows)
setSelectGoodsRow(selectedRows); setSelectGoodsRow(selectedRows);
setSelectedGoodsRowKeys(selectedRowKeys); setSelectedGoodsRowKeys(selectedRowKeys);
// console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
} }
} }
...@@ -132,12 +130,15 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => { ...@@ -132,12 +130,15 @@ const SelectGoodsForm: React.FC<Iprops> = (props) => {
<Checkbox checked={isChecked} onChange={onSelectGoodsChange}>选择货品</Checkbox> <Checkbox checked={isChecked} onChange={onSelectGoodsChange}>选择货品</Checkbox>
</Form.Item> </Form.Item>
</Form> </Form>
{showSelectGoods && <StandardTable {/* {
columns={goodsColumns} showSelectGoods && */}
rowSelection={rowSelection} <StandardTable
tableProps={{ rowKey: "id" }} columns={goodsColumns}
fetchTableData={(params: any) => fetchData(params)} rowSelection={rowSelection}
/>} tableProps={{ rowKey: "id" }}
fetchTableData={(params: any) => fetchData(params)}
/>
{/* } */}
</>) </>)
} }
......
...@@ -233,13 +233,13 @@ const DirectChannel: React.FC<{}> = () => { ...@@ -233,13 +233,13 @@ const DirectChannel: React.FC<{}> = () => {
const onChangeUpShop = (values) => { const onChangeUpShop = (values) => {
// 判断上架之前是否有店铺 有即可以上下架 // 判断上架之前是否有店铺 有即可以上下架
PublicApi.getTemplateShopFindShop().then(res => { // PublicApi.getTemplateShopFindShop().then(res => {
if(res.data.logo){ // if(res.data.logo){
setCheckedValues(values) setCheckedValues(values)
}else{ // }else{
message.error('您还没有开通店铺,无法上下架商品!') // message.error('您还没有开通店铺,无法上下架商品!')
} // }
}) // })
} }
const handleUpDown = () => { const handleUpDown = () => {
......
...@@ -78,6 +78,7 @@ const Products: React.FC<{}> = () => { ...@@ -78,6 +78,7 @@ const Products: React.FC<{}> = () => {
const [brandValue, setBrandValue] = useState(undefined) const [brandValue, setBrandValue] = useState(undefined)
const [classData, setClassData] = useState<any>([]) const [classData, setClassData] = useState<any>([])
const [classValue, setClassValue] = useState(undefined) const [classValue, setClassValue] = useState(undefined)
const [shopId, setShopId] = useState<number>()
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
...@@ -441,7 +442,8 @@ const Products: React.FC<{}> = () => { ...@@ -441,7 +442,8 @@ const Products: React.FC<{}> = () => {
const onChangeUpShop = (values) => { const onChangeUpShop = (values) => {
// 判断上架之前是否有店铺 有即可以上下架 // 判断上架之前是否有店铺 有即可以上下架
PublicApi.getTemplateShopFindShop().then(res => { PublicApi.getTemplateShopFindShop().then(res => {
if(res.data.logo){ if(res.data.shopId){
setShopId(res.data.shopId)
setCheckedValues(values) setCheckedValues(values)
}else{ }else{
message.error('您还没有开通店铺,无法上下架商品!') message.error('您还没有开通店铺,无法上下架商品!')
...@@ -466,7 +468,7 @@ const Products: React.FC<{}> = () => { ...@@ -466,7 +468,7 @@ const Products: React.FC<{}> = () => {
shopList: checkedValues shopList: checkedValues
} }
if(isUp) if(isUp)
PublicApi.postProductCommodityPublishCommodity(params).then(res => { PublicApi.postProductCommodityPublishCommodity({storeId: shopId, ...params}).then(res => {
setUpDownModal(false) setUpDownModal(false)
ref.current.reload() ref.current.reload()
setIsDisabledOKbtn(false) setIsDisabledOKbtn(false)
...@@ -835,7 +837,7 @@ const Products: React.FC<{}> = () => { ...@@ -835,7 +837,7 @@ const Products: React.FC<{}> = () => {
<Checkbox.Group style={{ width: '100%' }} onChange={onChangeUpShop} value={checkedValues}> <Checkbox.Group style={{ width: '100%' }} onChange={onChangeUpShop} value={checkedValues}>
<Row> <Row>
{ {
Array.isArray(shopsOption) && shopsOption.map((item, index) => <Col key={index} span={6}> Array.isArray(shopsOption) && shopsOption.map((item, index) => <Col key={index} span={8}>
<Checkbox value={item}>{item.name}</Checkbox> <Checkbox value={item}>{item.name}</Checkbox>
</Col>) </Col>)
} }
......
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { PublicApi } from '@/services/api';
// 渠道商品列表高级搜索 // 渠道商品列表高级搜索
...@@ -196,89 +197,159 @@ export const channelSchema: ISchema = { ...@@ -196,89 +197,159 @@ export const channelSchema: ISchema = {
// 添加渠道商品模态框高级筛选 // 添加渠道商品模态框高级筛选
export const addChannelSchema: ISchema = { export const addChannelSchema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
mageLayout: { name: {
type: 'object', type: 'string',
'x-component': 'mega-layout', 'x-component': 'ModalSearch',
properties: { 'x-component-props': {
topLayout: { placeholder: '商品名称',
type: 'object', align: 'flex-left',
'x-component': 'mega-layout', },
'x-component-props': { },
grid: true, [FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'flex-layout',
'x-component-props': {
rowStyle: {
flexWrap: 'nowrap',
style: {
marginRight: 0
}
}, },
properties: { colStyle: {
name: { marginTop: 20,
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '商品名称',
},
},
}, },
}, },
[FORM_FILTER_PATH]: { properties: {
type: 'object', categoryId: {
'x-component': 'flex-layout', type: 'string',
'x-component-props': { "x-component": 'SearchSelect',
rowStyle: { "x-component-props": {
flexWrap: 'nowrap', placeholder: '请选择品类',
justifyContent: 'flex-start' className: 'fixed-ant-selected-down', // 该类强制将显示的下拉框出现在select下, 只有这里出现问题, ??
}, fetchSearch: PublicApi.getProductSelectGetSelectCategory,
colStyle: { style: {
marginLeft: 20, width: 160
}, }
}
}, },
properties: { brandId: {
brandId: { type: 'string',
type: 'string', "x-component": 'SearchSelect',
'x-component': 'CustomInputSearch', "x-component-props": {
'x-component-props': { placeholder: '请选择品牌',
placeholder: '商品品牌', fetchSearch: PublicApi.getProductSelectGetSelectBrand,
showSearch: true, style: {
showArrow: true, width: 160
defaultActiveFirstOption: false, }
filterOption: false, }
notFoundContent: null, },
searchValue: null, parentMemberId: {
dataoption: [], type: 'string',
}, enum: [],
}, 'x-component-props': {
customerCategoryId: { placeholder: '上级渠道',
type: 'string', style: {
'x-component': 'CustomInputSearch', width: 160
'x-component-props': { }
placeholder: '商品品类',
showSearch: true,
showArrow: true,
defaultActiveFirstOption: false,
filterOption: false,
notFoundContent: null,
searchValue: null,
dataoption: []
},
},
parentMemberId: {
type: 'string',
enum: [
],
'x-component-props': {
placeholder: '上级渠道',
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
}, },
}, },
}, submit: {
}, "x-component": 'Submit',
}, "x-mega-props": {
}, span: 1
},
"x-component-props": {
children: '查询'
}
}
}
}
}
// type: 'object',
// properties: {
// mageLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// properties: {
// topLayout: {
// type: 'object',
// 'x-component': 'mega-layout',
// 'x-component-props': {
// grid: true,
// },
// properties: {
// name: {
// type: 'string',
// 'x-component': 'Search',
// 'x-component-props': {
// placeholder: '商品名称',
// },
// },
// },
// },
// [FORM_FILTER_PATH]: {
// type: 'object',
// 'x-component': 'flex-layout',
// 'x-component-props': {
// rowStyle: {
// flexWrap: 'nowrap',
// justifyContent: 'flex-start'
// },
// colStyle: {
// marginLeft: 20,
// },
// },
// properties: {
// brandId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品牌',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// customerCategoryId: {
// type: 'string',
// 'x-component': 'CustomInputSearch',
// 'x-component-props': {
// placeholder: '商品品类',
// showSearch: true,
// showArrow: true,
// defaultActiveFirstOption: false,
// filterOption: false,
// notFoundContent: null,
// searchValue: null,
// dataoption: [],
// },
// },
// parentMemberId: {
// type: 'string',
// enum: [],
// 'x-component-props': {
// placeholder: '上级渠道',
// },
// },
// submit: {
// 'x-component': 'Submit',
// 'x-mega-props': {
// span: 1,
// },
// 'x-component-props': {
// children: '查询',
// },
// },
// },
// },
// },
// },
// },
} }
\ No newline at end of file
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