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

适用商城添加

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