Commit 1f504a1e authored by 武广's avatar 武广

fix: 修改获取企业列表接口

parent 27a6d72c
import RoleType, { isPlatForm } from './role.config';
const isProduction = process.env.NODE_ENV === 'production';
const isPre = process.env.PRE_ENV === 'pre';
const environment = 'sc';
const environment = 'yxm2';
const envAPi = {
api: `https://security-${environment}.liangkebang.net`, //'https://security-xyqb.liangkebang.net',
......
......@@ -230,7 +230,7 @@ const CustomerInfo = props => {
obj.mealTimePeriod = [];
}
obj.mealLimit = {};
if (res.data.mealLimit) {
if (res.data.mealLimit && res.data.mealLimit.length) {
res.data.mealLimit.forEach(item => {
obj.mealLimit[`limit${item.mealPeriodType}`] = {};
item.limit.forEach(limit => {
......@@ -245,12 +245,16 @@ const CustomerInfo = props => {
if (+res.data.hideImage) {
obj.hideInfo.push('hideImage');
}
obj.mealType = res.data.mealType.map(item => `${item}`);
if (res.data.mealType) {
obj.mealType = res.data.mealType.map(item => `${item}`);
}
setMealTypes(obj.mealType);
const json = {};
res.data.mealTimePeriod.forEach(item => {
json[item.mealPeriodType] = mealSections[item.mealPeriodType];
});
if (res.data.mealTimePeriod) {
res.data.mealTimePeriod.forEach(item => {
json[item.mealPeriodType] = mealSections[item.mealPeriodType];
});
}
setMeals(json);
form.setFieldsValue(obj);
}
......
......@@ -2,10 +2,11 @@ import debounce from 'lodash/debounce';
import { apiEnterpriseList, apiShopList, apiShopListByPickSelfID } from './index';
// 获取企业列表
export const getEnterpriseList = async () => {
export const getEnterpriseList = async (param = {}) => {
const res = await apiEnterpriseList({
page: 1,
size: 10000,
data: param,
});
if (res && res.data && res.data.records) {
const data = res.data.records;
......
......@@ -136,7 +136,9 @@ const TakeawayGoods = () => {
// 获取企业列表
const getList = async () => {
const obj = await getEnterpriseList();
const obj = await getEnterpriseList({
type: 1,
});
if (obj.list && Object.keys(obj.list).length) {
setEnterprises(obj.list);
setEnterpriseId(`${obj.id}`);
......
......@@ -84,7 +84,9 @@ const VirtualGoods = () => {
// 获取企业列表
const getList = async () => {
const obj = await getEnterpriseList();
const obj = await getEnterpriseList({
type: 2,
});
if (obj.list && Object.keys(obj.list).length) {
setEnterprises(obj.list);
setEnterpriseId(`${obj.id}`);
......
......@@ -90,8 +90,11 @@ const VirtualGoodsInfo = props => {
// 删除
const onDel = i => {
const arr = [...dataSource];
const keys = [...selectedRowKeys];
arr.splice(i, 1);
keys.splice(i, 1);
setDataSource(arr);
setSelectedRowKeys(keys);
};
// 根据企业ID获取店铺列表
......
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