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