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

仓位接口对接

parent de18b38b
{"userRegister":{"useType":{"memberType":[{"id":1,"typeName":"企业会员"},{"id":3,"typeName":"渠道企业会员"},{"id":4,"typeName":"渠道个人会员"},{"id":2,"typeName":"个人会员"}],"businessType":[{"id":1,"typeName":"采购"},{"id":24,"typeName":"供应"},{"id":33,"typeName":"hcx供应商"},{"id":34,"typeName":"test3"},{"id":35,"typeName":"test4"},{"id":36,"typeName":"test5"},{"id":37,"typeName":"test6"}]}},"global":{"logo":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/logo.png","countryList":[{"name":"简体中文-ZH","key":"zh-CN","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png"},{"name":"English-EN","key":"en-US","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png"},{"name":"日本語-JP","key":"jp","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/japen.png"},{"name":"한국어-KO","key":"ko","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png"}],"menuList":[{"code":"/memberCenter/commodityAbility","children":[{"code":"/mem"}]},{"code":"/memberCenter/commodityAbility/classAndProperty/class"}]}}
{"userRegister":{"useType":{"memberType":[{"id":1,"typeName":"企业会员"},{"id":3,"typeName":"渠道企业会员"},{"id":4,"typeName":"渠道个人会员"},{"id":2,"typeName":"个人会员"}],"businessType":[{"id":1,"typeName":"采购"},{"id":24,"typeName":"供应"},{"id":33,"typeName":"hcx供应商"},{"id":34,"typeName":"test3"},{"id":35,"typeName":"test4"},{"id":36,"typeName":"test5"},{"id":37,"typeName":"test6"}]}},"web":{"shopInfo":[{"id":302,"name":"云鲜采企业商城","type":1,"environment":1,"logoUrl":"https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/5b19a059530a4060984fc045125da1f81597395561658.png","describe":null,"state":1,"url":"/"},{"id":303,"name":"云鲜采渠道商城","type":3,"environment":1,"logoUrl":"https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/a63c8c81e74947f88c64d4c72bfb565c1597395598958.png","describe":null,"state":1,"url":"/shop"}]},"global":{"siteId":502,"siteUrl":"http://localhost:4396","logo":"https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/4db4e7c5424c471c968ab540bce027f31597319423082.png","countryList":[{"name":"简体中文-ZH","key":"zh-CN","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/china.png"},{"name":"English-EN","key":"en-US","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/us.png"},{"name":"日本語-JP","key":"jp","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/japen.png"},{"name":"한국어-KO","key":"ko","icon":"http://lingxi-frontend-test.oss-cn-hangzhou.aliyuncs.com/images/koren.png"}]}}
......@@ -26,7 +26,10 @@ const serviceConfig = {
},
web: {
shopInfo: {
url: '/manage/shop/all',
url: '/manage/shop/findShopsBySiteId',
params: {
siteId: 502
},
method: 'get'
},
// site: {
......
......@@ -9,7 +9,8 @@ import '@/global/styles/global.less'; // 导入全局样式
import 'antd/dist/antd.less'
import { isDev } from '@/constants'
import { setup } from '@formily/antd-components';
import { getRouters, getAuth, asyncRouter } from './utils/auth';
import { getRouters, getAuth, asyncRouter, setAuth, setRouters } from './utils/auth';
import { PublicApi } from './services/api';
setup()
......@@ -53,6 +54,19 @@ export function patchRoutes({ routes }: IRoutes) {
* @export
*/
export function render(oldRender:Function) {
const authInfo = getAuth()
if (authInfo) {
PublicApi.getMemberLoginReget().then(res => {
const { data } = res
setAuth({
memberId: data.memberId,
userId: data.userId,
token: data.token
})
setRouters(data.urls)
})
}
oldRender()
}
......
......@@ -23,7 +23,7 @@ export interface ShopInfo {
type: number;
environment: number;
logoUrl: string;
describe: string;
describe?: any;
state: number;
url: string;
}
......
......@@ -21,15 +21,19 @@ export function useHttpRequest<T>(api: (params?, config?) => Promise<T>, selfCon
const [data, setData] = useState<T | null>(null)
const [err, setErr] = useState()
const run = (params) => {
setLoading(true)
api(params).then((res: any) => {
setData(res.data)
}).catch(err => {
setErr(err)
}).finally(() => {
setTimeout(() => {
setLoading(false)
}, 200)
return new Promise((resolve, reject) => {
setLoading(true)
api(params).then((res: any) => {
setData(res.data)
resolve(res)
}).catch(err => {
setErr(err)
reject(err)
}).finally(() => {
setTimeout(() => {
setLoading(false)
}, 200)
})
})
}
......
......@@ -71,6 +71,7 @@ export default {
'menu.memberAbility.memberManage.memberUpgradeRule': '会员升级规则',
'menu.memberAbility.memberManage.memberLevel': '会员等级',
'menu.memberAbility.memberManage.addEquity': '会员权益设置',
'menu.memberAbility.memberManage.maintainDetail': '未命名',
// 店铺能力
'menu.shopAbility': '店铺',
......
......@@ -25,15 +25,7 @@ import { useInitValue } from '@/formSchema/effects/useInitValue'
import { useWarehouseSelect, createAddRepositoryEffect, useUnitPreview } from './effects'
import ModalTable from '@/components/ModalTable'
import PositionSetting from './components/PositionSetting'
const fetchMemberList = async (params) => {
const res = await PublicApi.getMemberMaintenancePage(params)
return res.data
}
const fetchProductList = async (params) => {
const res = await PublicApi.getProductCommodityGetCommodityDetailList(params)
return res.data
}
import { useHttpRequest } from '@/hooks/useHttpRequest'
const addSchemaAction = createFormActions()
......@@ -43,6 +35,7 @@ const AddRepository:React.FC<{}> = (props) => {
preview,
pageStatus
} = usePageStatus()
const initValue = useInitValue(PublicApi.getWarehouseFreightSpaceDetails)
useUnitPreview(initValue, addSchemaAction)
......
......@@ -18,6 +18,7 @@ import { useInitValue } from '@/formSchema/effects/useInitValue'
import { useLinkageUtils } from '@/utils/formEffectUtils'
import { useUnitPreview } from './effects'
import PositionSetting from './components/PositionSetting'
import { useHttpRequest } from '@/hooks/useHttpRequest'
const addSchemaAction = createFormActions()
const repositInAction = createAsyncFormActions()
......@@ -30,6 +31,9 @@ const AddRepository:React.FC<{}> = (props) => {
// 获取到的所有仓库, 用于选中后获得仓库库存
const [reposits, setReposits] = useState<any>([])
const { data: foldValue, loading: foldLoading, run: foldFn } = useHttpRequest(PublicApi.postWarehouseFreightSpaceAllotFold)
const { data: exportValue, loading: exportLoading, run: exportFn } = useHttpRequest(PublicApi.postWarehouseFreightSpaceAllotExport)
const fetchRepositRecord = async (params) => {
const { data } = await PublicApi.getWarehouseFreightSpaceAllotFoldLog({
id,
......@@ -88,7 +92,7 @@ const AddRepository:React.FC<{}> = (props) => {
params[key] = value
}
})
const { data } = await PublicApi.postWarehouseFreightSpaceAllotFold(params)
const { data } = await foldFn(params)
const { callInInventory, bringUpTheInventory } = data
repositInAction.setFieldValue('NO_SUBMIT2', bringUpTheInventory)
......@@ -104,7 +108,7 @@ const AddRepository:React.FC<{}> = (props) => {
params[key] = value
}
})
const { data } = await PublicApi.postWarehouseFreightSpaceAllotExport(params)
const { data } = await exportFn(params)
const { callInInventory, bringUpTheInventory } = data
......@@ -114,10 +118,10 @@ const AddRepository:React.FC<{}> = (props) => {
}
const transforInBtn = <Row justify='center'>
<Button type='primary' htmlType='submit'>调入</Button>
<Button type='primary' htmlType='submit' loading={foldLoading}>调入</Button>
</Row>
const transforOutBtn = <Row justify='center'>
<Button type='primary' htmlType='submit'>调出</Button>
<Button type='primary' htmlType='submit' loading={exportLoading}>调出</Button>
</Row>
const topTableChange = (tabs) => {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
import { isDev } from '@/constants'
export interface AuthInfo {
userId: number,
memberId: number,
......@@ -10,19 +12,24 @@ export const setAuth = (info: AuthInfo) => {
export const getAuth = () => {
try {
return JSON.parse(window.localStorage.getItem('auth')) || {}
return JSON.parse(window.localStorage.getItem('auth')) || null
} catch (error) {
return {}
}
}
export const setRouters = (routers: any[]) => {
window.sessionStorage.setItem('rt', JSON.stringify(routers))
}
export const getRouters = () => {
try {
return JSON.parse(window.sessionStorage.getItem('rt')) || []
return JSON.parse(window.sessionStorage.getItem('rt')).concat([
'/memberCenter/commodityAbility',
'/memberCenter/commodityAbility/classAndProperty',
'/memberCenter/commodityAbility/classAndProperty/attribute'
]) || []
} catch (error) {
return []
}
......
......@@ -106,6 +106,7 @@ class ApiRequest {
if (res.code === 1101) {
removeAuth()
history.replace('/user/login')
message.error(res.message)
return false
}
......
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