Commit 2ac60452 authored by 张子雨's avatar 张子雨

Merge branch 'feature/meal-3.0' of...

Merge branch 'feature/meal-3.0' of http://git.quantgroup.cn/ui/merchant-manage-ui into feature/meal-3.0
parents 32cbdb6f 329fb141
import React, { useState, useEffect } from 'react';
import { Checkbox, Space, message, Modal, notification } from 'antd';
import { weekOptions } from '../staticData/goods';
import { apiMealInfoUpdate } from '../service';
import { apiMealInfoUpdate, apiCheckInfo } from '../service';
const SaleDateModal = props => {
const [value, setValue] = useState([]);
......@@ -21,6 +21,22 @@ const SaleDateModal = props => {
message.error('请选择可售日期');
return;
}
if (props.productType === 4) {
const data = props.dataSource.map(item => {
const obj = {
saleDateList: item.saleDate,
tabCateList: item.tabCateList,
};
if (props.item.skuId === item.skuId) {
obj.saleDateList = value;
}
return obj;
});
const res = await apiCheckInfo(data);
if (!res || !res.success) {
return;
}
}
if (props.id) {
const params = {
id: props.id,
......
import React, { useState, useEffect } from 'react';
import { Checkbox, Space, Modal, notification, message } from 'antd';
import { mealColumn } from '../staticData/goods';
import { apiMealInfoUpdate, apiEnterpriseInfo } from '../service';
import { apiMealInfoUpdate, apiEnterpriseInfo, apiCheckInfo } from '../service';
const SaleDateModal = props => {
const [value, setValue] = useState([]);
......@@ -23,6 +23,22 @@ const SaleDateModal = props => {
message.error('请选择餐段');
return;
}
if (props.productType === 4) {
const data = props.dataSource.map(item => {
const obj = {
saleDateList: item.saleDate,
tabCateList: item.tabCateList,
};
if (props.item.skuId === item.skuId) {
obj.tabCateList = value.map(v => ({ tabId: v }));
}
return obj;
});
const res = await apiCheckInfo(data);
if (!res || !res.success) {
return;
}
}
if (props.id) {
const params = {
id: props.id,
......
......@@ -171,3 +171,13 @@ export async function apiEnterpriseInfo(id) {
prefix: roleApi,
});
}
/**
* 企业团餐->虚拟商品 校验是否可修改餐段和可售日期
* http://yapi.quantgroups.com/project/389/interface/api/65674
*/
export async function apiCheckInfo(data) {
return request.post(`${apiPrefix}/product/enterprise/virtual/addParamCheck`, {
data,
prefix: roleApi,
});
}
......@@ -237,6 +237,8 @@ const VirtualGoodsInfo = props => {
visible={visibleSaleDate}
item={editItem}
type="saleDate"
productType={4}
dataSource={dataSource}
handleRefresh={v => refreshList('saleDate', v)}
handleClose={() => setVisibleSaleDate(false)}
/>
......@@ -248,6 +250,8 @@ const VirtualGoodsInfo = props => {
item={editItem}
type="tabCate"
enterpriseID={id}
productType={4}
dataSource={dataSource}
handleRefresh={v => refreshList('tabCate', v)}
handleClose={() => setVisibleSaleSection(false)}
/>
......
/* eslint-disable class-methods-use-this */
class IframeBridge {
constructor() {
console.info('use iframeBridge');
this.mountEventBus();
}
run(data, callbackName) {
return new Promise(resolve => {
if (!data.event) {
resolve(false);
return;
}
console.log('childIframe', data);
window.parent.postMessage(data, '*');
!callbackName && resolve(true);
});
}
mountEventBus() {
window.addEventListener('message', info => {
// 来源页面地址
console.log('addEventListenerCallBack', info);
});
}
// async closeBrowser() {
// return await this.run({ event: 'closeBrowser' });
// }
// async getToken() {
// return await this.run({ event: 'getToken' }, 'getTokenSuccess');
// }
// async openNewUrl(data: RunData = {}) {
// if (!data.event) {
// data.event = 'openNewUrl';
// }
// return await this.run(data);
// }
}
export default IframeBridge;
......@@ -9,6 +9,7 @@ import { notification } from 'antd';
import { getUrlSearchParams, getToken } from './utils';
import localStorage from './localStorage';
import config from '../../config/env.config';
import IframeBridge from './iframeBridge';
let isRefreshing = true;
let subscriber = [];
......@@ -125,10 +126,12 @@ request.interceptors.response.use(async (response, options) => {
notification.warning({
message: data.msg,
});
if (isTob) {
localStorage.remove('tobToken');
} else {
if (!isTob) {
window.location.href = loginPath;
} else {
console.log('isTob 4011 :>> ', isTob, 4011);
const iframeBridgeModel = new IframeBridge();
iframeBridgeModel.run({ event: 'toLogin' });
}
}
if (data.businessCode && data.businessCode !== '0000' && !options.notTip) {
......
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