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

适用商城添加

parent 6226b7ff
...@@ -19,6 +19,30 @@ export const Environment_Status = { ...@@ -19,6 +19,30 @@ export const Environment_Status = {
3: "APP" 3: "APP"
} }
// 商城类型
export const SHOP_TYPES = [
{
value: 1,
label: "企业商城"
},
{
value: 2,
label: "积分商城"
},
{
value: 3,
label: "渠道商城"
},
{
value: 4,
label: "渠道自有商城"
},
{
value: 5,
label: "渠道积分商城"
},
]
// 1是阿里云oss服务器, 2是本地文件服务器 // 1是阿里云oss服务器, 2是本地文件服务器
export const UPLOAD_TYPE = isDev ? 2 : 1 export const UPLOAD_TYPE = isDev ? 2 : 1
......
...@@ -17,8 +17,19 @@ export interface UserRegister { ...@@ -17,8 +17,19 @@ export interface UserRegister {
useType: UseType; useType: UseType;
} }
export interface ShopInfo {
id: number;
name: string;
type: number;
environment: number;
logoUrl: string;
describe: string;
state: number;
url: string;
}
export interface Web { export interface Web {
shopInfo: any[]; shopInfo: ShopInfo[];
} }
export interface PayConfig { export interface PayConfig {
......
...@@ -14,6 +14,7 @@ import { ...@@ -14,6 +14,7 @@ import {
import { Button } from 'antd' import { Button } from 'antd'
import NiceForm from '@/components/NiceForm' import NiceForm from '@/components/NiceForm'
import ModalTable from '@/components/ModalTable' import ModalTable from '@/components/ModalTable'
import { GlobalConfig } from '@/global/config'
export interface PositionSettingProps { export interface PositionSettingProps {
addSchemaAction: ISchemaFormActions, addSchemaAction: ISchemaFormActions,
...@@ -229,8 +230,16 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => { ...@@ -229,8 +230,16 @@ const PositionSetting:React.FC<PositionSettingProps> = (props) => {
tableAddButton, tableAddButton,
connectProduct connectProduct
}} }}
effects={() => { effects={($, { setFieldState }) => {
createAddRepositoryEffect(addSchemaAction) createAddRepositoryEffect(addSchemaAction)
$('onFieldValueChange', 'shopType').subscribe(parentState => {
if (parentState.value) {
console.log('review')
setFieldState('shopIds', state => {
state.props["x-component-props"].dataSource = GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value)
})
}
})
}} }}
onSubmit={handleSubmit} onSubmit={handleSubmit}
actions={addSchemaAction} actions={addSchemaAction}
......
...@@ -189,12 +189,6 @@ const Repositories: React.FC<{}> = () => { ...@@ -189,12 +189,6 @@ const Repositories: React.FC<{}> = () => {
'search', 'search',
FORM_FILTER_PATH, FORM_FILTER_PATH,
); );
$('onFieldChange', FORM_FILTER_PATH).subscribe(state => {
console.log(state)
})
// 填充下拉框
// useAsyncInitSelect(['category'], async () => (await PublicApi.getProductSelectGetSelectCategory({name: ''})).data.map(v => ({label: v.name, value: v.id})))
// useAsyncInitSelect(['brand'], async () => (await PublicApi.getProductSelectGetSelectBrand({name: ''})).data.map(v => ({label: v.name, value: v.id})))
}} }}
schema={repositSchema} schema={repositSchema}
/> />
......
...@@ -3,6 +3,20 @@ import { ISchema } from '@formily/antd'; ...@@ -3,6 +3,20 @@ import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { GlobalConfig } from '@/global/config'; import { GlobalConfig } from '@/global/config';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
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
})
}
return prev
}, [])
})()
export const repositSchema: ISchema = { export const repositSchema: ISchema = {
type: 'object', type: 'object',
...@@ -155,6 +169,12 @@ export const repositMoreSchema: ISchema = { ...@@ -155,6 +169,12 @@ export const repositMoreSchema: ISchema = {
placeholder: '建议名称:商品名称+商城名称+渠道描述' placeholder: '建议名称:商品名称+商城名称+渠道描述'
} }
}, },
shopType: {
type: 'string',
enum: SHOP_TYPES,
title: '商城类型',
required: true
},
productName: { productName: {
type: 'string', type: 'string',
title: '商品名称', title: '商品名称',
...@@ -253,7 +273,7 @@ export const repositMoreSchema: ISchema = { ...@@ -253,7 +273,7 @@ export const repositMoreSchema: ISchema = {
"type": "array:number", "type": "array:number",
"x-component": 'CardCheckBox', "x-component": 'CardCheckBox',
"x-component-props": { "x-component-props": {
dataSource: GlobalConfig.web.shopInfo dataSource: []
}, },
"title": "适用商城", "title": "适用商城",
"x-rules": [ "x-rules": [
...@@ -352,6 +372,12 @@ export const repositDetailSchema: ISchema = { ...@@ -352,6 +372,12 @@ export const repositDetailSchema: ISchema = {
placeholder: '建议名称:商品名称+商城名称+渠道描述' placeholder: '建议名称:商品名称+商城名称+渠道描述'
} }
}, },
shopType: {
type: 'string',
enum: getShopTypeMap,
title: '商城类型',
required: true
},
productName: { productName: {
type: 'string', type: 'string',
title: '商品名称', title: '商品名称',
...@@ -443,7 +469,7 @@ export const repositDetailSchema: ISchema = { ...@@ -443,7 +469,7 @@ export const repositDetailSchema: ISchema = {
"type": "array:number", "type": "array:number",
"x-component": 'CardCheckBox', "x-component": 'CardCheckBox',
"x-component-props": { "x-component-props": {
dataSource: GlobalConfig.web.shopInfo dataSource: []
}, },
"title": "适用商城", "title": "适用商城",
required: true, required: true,
...@@ -538,6 +564,12 @@ export const repositTabOneSchema: ISchema = { ...@@ -538,6 +564,12 @@ export const repositTabOneSchema: ISchema = {
placeholder: '建议名称:商品名称+商城名称+渠道描述' placeholder: '建议名称:商品名称+商城名称+渠道描述'
} }
}, },
shopType: {
type: 'string',
enum: getShopTypeMap,
title: '商城类型',
required: true
},
productName: { productName: {
type: 'string', type: 'string',
title: '商品名称', title: '商品名称',
...@@ -630,7 +662,7 @@ export const repositTabOneSchema: ISchema = { ...@@ -630,7 +662,7 @@ export const repositTabOneSchema: ISchema = {
"type": "array:number", "type": "array:number",
"x-component": 'CardCheckBox', "x-component": 'CardCheckBox',
"x-component-props": { "x-component-props": {
dataSource: GlobalConfig.web.shopInfo dataSource: []
}, },
"title": "适用商城", "title": "适用商城",
required: true, required: true,
......
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