Commit ec1bae36 authored by 武广's avatar 武广

fix: 处理外卖商品全线

parent 94dbfc8f
...@@ -172,7 +172,6 @@ class goodsManage extends Component { ...@@ -172,7 +172,6 @@ class goodsManage extends Component {
<FormItem label="商品类型" name="productType"> <FormItem label="商品类型" name="productType">
<Select style={selectW} placeholder="请选择商品类型" onChange={this.onChangeProductType}> <Select style={selectW} placeholder="请选择商品类型" onChange={this.onChangeProductType}>
<Option value={1}>实体商品</Option> <Option value={1}>实体商品</Option>
<Option value={2}>虚拟商品</Option>
<Option value={4}>服务类商品</Option> <Option value={4}>服务类商品</Option>
<Option value={5}>外卖商品</Option> <Option value={5}>外卖商品</Option>
</Select> </Select>
......
...@@ -8,6 +8,15 @@ import { apiChangeStateGoods, apiGoodsActionBatch } from './service'; ...@@ -8,6 +8,15 @@ import { apiChangeStateGoods, apiGoodsActionBatch } from './service';
const { confirm } = Modal; const { confirm } = Modal;
export const NormalProduct = 1;
export const ServiceProduct = 4;
export const TakeawayProduct = 5;
export const GoodTypes = {
[NormalProduct]: '实体商品',
[ServiceProduct]: '服务类商品',
[TakeawayProduct]: '外卖商品',
};
export const productType = [ export const productType = [
{ {
value: 1, value: 1,
......
...@@ -7,7 +7,7 @@ export const formItemLayout = { ...@@ -7,7 +7,7 @@ export const formItemLayout = {
}, },
}; };
export const TaskList = (canAddService, canAddNormal) => [ export const TaskList = (canAddService, canAddNormal, canTakeawayService) => [
{ {
name: '实体商品', name: '实体商品',
type: 1, type: 1,
...@@ -33,31 +33,31 @@ export const TaskList = (canAddService, canAddNormal) => [ ...@@ -33,31 +33,31 @@ export const TaskList = (canAddService, canAddNormal) => [
}, },
}, },
}, },
{ // {
name: '虚拟商品', // name: '虚拟商品',
type: 2, // type: 2,
desc: '无需物流', // desc: '无需物流',
hide: !canAddNormal, // hide: !canAddNormal,
imgConfig: { // imgConfig: {
commonImageList: { // commonImageList: {
title: '公共滑动图', // title: '公共滑动图',
rule: false, // rule: false,
limit: null, // limit: null,
renderExtra: () => '(图片最大上传2M)', // renderExtra: () => '(图片最大上传2M)',
}, // },
imageList: { // imageList: {
rule: false, // rule: false,
limit: null, // limit: null,
renderExtra: () => '(图片最大上传2M)', // renderExtra: () => '(图片最大上传2M)',
}, // },
detailImageList: { // detailImageList: {
title: '详情图', // title: '详情图',
rule: true, // rule: true,
limit: null, // limit: null,
renderExtra: () => '(图片最大上传2M)', // renderExtra: () => '(图片最大上传2M)',
}, // },
}, // },
}, // },
{ {
name: '服务类商品', name: '服务类商品',
type: 4, type: 4,
...@@ -94,7 +94,7 @@ export const TaskList = (canAddService, canAddNormal) => [ ...@@ -94,7 +94,7 @@ export const TaskList = (canAddService, canAddNormal) => [
name: '外卖商品', name: '外卖商品',
type: 5, type: 5,
desc: '无需物流', desc: '无需物流',
// hide: !canAddService, hide: !canTakeawayService,
imgConfig: { imgConfig: {
commonImageList: { commonImageList: {
title: '封面图片', title: '封面图片',
...@@ -324,10 +324,7 @@ export const StaticColumns = customer => [ ...@@ -324,10 +324,7 @@ export const StaticColumns = customer => [
}, },
]; ];
export const ENUM_REPERTORY = [{ label: '单规格', value: '1' }, { label: '多规格', value: '2' }]; export const ENUM_REPERTORY = [{ label: '单规格', value: '1' }, { label: '多规格', value: '2' }];
export const ENUM_SET_REPERTORY = [ export const ENUM_SET_REPERTORY = [{ label: '清零', value: '0' }, { label: '最大', value: '1' }];
{ label: '清零', value: '0' },
{ label: '最大', value: '1' },
];
export const ENUM_WEEK = [ export const ENUM_WEEK = [
{ value: '1', label: '周一' }, { value: '1', label: '周一' },
{ value: '2', label: '周二' }, { value: '2', label: '周二' },
......
...@@ -46,7 +46,7 @@ const ServiceGoods = options => { ...@@ -46,7 +46,7 @@ const ServiceGoods = options => {
} = options; } = options;
const canAddService = permissions[GOOD_MANAGE.ADD_SERVICE_GOODS]; const canAddService = permissions[GOOD_MANAGE.ADD_SERVICE_GOODS];
const canAddNormal = permissions[GOOD_MANAGE.ADD_NORMAL_GOODS]; const canAddNormal = permissions[GOOD_MANAGE.ADD_NORMAL_GOODS];
// const canTakeawayService = permissions[GOOD_MANAGE.ADD_TAKEAWAY_GOODS]; const canTakeawayService = permissions[GOOD_MANAGE.ADD_TAKEAWAY_GOODS];
// const canTakeawayService = true // const canTakeawayService = true
const basicRef = useRef(null); const basicRef = useRef(null);
const stockRef = useRef(null); const stockRef = useRef(null);
...@@ -60,7 +60,9 @@ const ServiceGoods = options => { ...@@ -60,7 +60,9 @@ const ServiceGoods = options => {
const [categoryIds, setCategoryIds] = useState([]); // 商品品类ID const [categoryIds, setCategoryIds] = useState([]); // 商品品类ID
const [isEdit, setIsEdit] = useState(false); // 是否是编辑状态 const [isEdit, setIsEdit] = useState(false); // 是否是编辑状态
const [isUseCache, setIsUseCache] = useState(false); // 是否使用缓存 const [isUseCache, setIsUseCache] = useState(false); // 是否使用缓存
const [productType, setProductType] = useState(canAddNormal ? 1 : 4); // 商品状态 let ptype = canTakeawayService ? 5 : 4;
ptype = canAddNormal ? 1 : ptype;
const [productType, setProductType] = useState(ptype); // 商品状态
const [pageLoading, setPageLoading] = useState(false); // 页面加载状态 const [pageLoading, setPageLoading] = useState(false); // 页面加载状态
const [afterAddressList, setAfterAddressList] = useState([]); // 售后地址 const [afterAddressList, setAfterAddressList] = useState([]); // 售后地址
const [supplierIdList, setSupplierIdList] = useState([]); // 适用们店列表 const [supplierIdList, setSupplierIdList] = useState([]); // 适用们店列表
...@@ -160,7 +162,7 @@ const ServiceGoods = options => { ...@@ -160,7 +162,7 @@ const ServiceGoods = options => {
const onResetData = refresh => { const onResetData = refresh => {
setPageId(null); setPageId(null);
setIsEdit(false); setIsEdit(false);
setProductType(canAddNormal ? 1 : 4); setProductType(ptype);
setEditData({}); setEditData({});
setSpecKeyList([]); setSpecKeyList([]);
resetForm(); resetForm();
...@@ -383,7 +385,7 @@ const ServiceGoods = options => { ...@@ -383,7 +385,7 @@ const ServiceGoods = options => {
}, [isEdit, options.visible]); }, [isEdit, options.visible]);
useEffect(() => { useEffect(() => {
setProductType(canAddNormal ? 1 : 4); setProductType(ptype);
}, [canAddNormal]); }, [canAddNormal]);
const onSpecCommonImgEvent = useCallback( const onSpecCommonImgEvent = useCallback(
...@@ -489,7 +491,7 @@ const ServiceGoods = options => { ...@@ -489,7 +491,7 @@ const ServiceGoods = options => {
productType, productType,
canAddService, // 是否可以添加服务商品(电子卡券) canAddService, // 是否可以添加服务商品(电子卡券)
canAddNormal, // 是否可以添加实物商品 canAddNormal, // 是否可以添加实物商品
// canTakeawayService, // 是否可以添加外卖商品 canTakeawayService, // 是否可以添加外卖商品
isCard: productType === 4, isCard: productType === 4,
isTakeawayService: productType === 5, isTakeawayService: productType === 5,
// 0, "商品删除" 1, "新建" 2, "提交审核" 3, "待审核" 4, "驳回" 5, "未上架" 6, "已上架" 7, "已下架" // 0, "商品删除" 1, "新建" 2, "提交审核" 3, "待审核" 4, "驳回" 5, "未上架" 6, "已上架" 7, "已下架"
......
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