Commit 375678e3 authored by 前端-许佳敏's avatar 前端-许佳敏

转化商城类型

parent a2c341bd
......@@ -11,7 +11,7 @@ import {
PlusOutlined,
LinkOutlined,
} from '@ant-design/icons'
import { Button } from 'antd'
import { Button, message } from 'antd'
import NiceForm from '@/components/NiceForm'
import ModalTable from '@/components/ModalTable'
import { GlobalConfig } from '@/global/config'
......@@ -27,10 +27,7 @@ const fetchMemberList = async (params) => {
return res.data
}
const fetchProductList = async (params) => {
const res = await PublicApi.getProductCommodityGetCommodityDetailList(params)
return res.data
}
const PositionSetting:React.FC<PositionSettingProps> = (props) => {
const { addSchemaAction, schema, formSubmit } = props
......@@ -47,6 +44,14 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
const initValue = useInitValue(PublicApi.getWarehouseFreightSpaceDetails)
useUnitPreview(initValue, addSchemaAction)
const fetchProductList = async (params) => {
const res = await PublicApi.getProductCommodityCommonGetCommodityDetailList({
...params,
shopType: addSchemaAction.getFieldValue('shopType')
})
return res.data
}
// 会员选择后的表格
const handleDeleteTable = (id) => {
const value = addSchemaAction.getFieldValue('applyMember')
......@@ -62,6 +67,11 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
// 弹出商品选择
const handleAddProductBtn = () => {
const shopType = addSchemaAction.getFieldValue('shopType')
if (!shopType) {
message.error('请先选择商城类型')
return false
}
productRowCtl.setSelectedRowKeys([])
productRowCtl.setSelectRow([])
setVisibleChannelRroduct(true)
......@@ -209,18 +219,11 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
const formProduct: ISchema = {
type: 'object',
properties: {
id: {
type: 'string',
"x-component": 'Search',
"x-component-props": {
placeholder: '请输入商品ID'
}
},
name: {
type: 'string',
"x-component": 'Search',
"x-component-props": {
placeholder: '请输入商品名称'
placeholder: '请输入商品名称或者ID'
}
}
}
......
......@@ -8,11 +8,12 @@ import { SHOP_TYPES } from '@/constants';
// 将获取的商城转化为可用类型
const getShopTypeMap = (() => {
return GlobalConfig.web.shopInfo.reduce((prev, next) => {
if (!prev.find(v => v.value === next.id)) {
prev.push({
label: next.name,
value: next.id
})
const shopTypeEnumValue = SHOP_TYPES.find(v => v.value === next.type)
if (!shopTypeEnumValue) {
return prev
}
if (!prev.find(v => v.value === shopTypeEnumValue.value)) {
prev.push(shopTypeEnumValue)
}
return prev
}, [])
......
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