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

Merge branch 'feature-20240613-gold' into 'master'

Feature 20240613 gold

See merge request !113
parents a4757a83 17f1e5f0
/**
* 投资类黄金(商品类目)
* 商品新增编辑页,重量显示为克并且回显的时候把重量*1000 提交的时候重量再除以1000(接口只接受kg,但是产品希望看到g)
* * */
export const GoldCategory = 6151;
...@@ -30,6 +30,7 @@ import Takeaway from './Takeaway'; ...@@ -30,6 +30,7 @@ import Takeaway from './Takeaway';
import { GOOD_MANAGE } from '@/../config/permission.config'; import { GOOD_MANAGE } from '@/../config/permission.config';
import LocalStroage from '@/utils/localStorage'; import LocalStroage from '@/utils/localStorage';
import configApi from '@/../config/env.config'; import configApi from '@/../config/env.config';
import { GoldCategory } from '@/config/app.config';
@connect(({ goodsManage, menu }) => ({ @connect(({ goodsManage, menu }) => ({
goodsManage, goodsManage,
...@@ -343,6 +344,14 @@ class goodsManage extends Component { ...@@ -343,6 +344,14 @@ class goodsManage extends Component {
if (data) { if (data) {
const SourceData = ProcessEditData(data, row); const SourceData = ProcessEditData(data, row);
console.log('index.js=============>', SourceData); console.log('index.js=============>', SourceData);
// 投资金商品重量单位转换 从g转换为kg
if (SourceData?.infoMation?.categoryId.includes(GoldCategory)) {
SourceData.skuList?.forEach(item => {
if (item.weight) {
item.weight = +(item.weight * 1000).toFixed(2);
}
});
}
this.setState({ this.setState({
serviceData: SourceData, serviceData: SourceData,
serviceVisble: true, serviceVisble: true,
......
...@@ -223,21 +223,21 @@ export const StaticColumns = customer => [ ...@@ -223,21 +223,21 @@ export const StaticColumns = customer => [
disabeldRender: () => customer.isDisabled, disabeldRender: () => customer.isDisabled,
}, },
{ {
title: '重量(kg)', title: `重量(${customer.isGold ? 'g' : 'kg'})`,
dataIndex: 'weight', dataIndex: 'weight',
editable: true, editable: true,
batchRole: [1], batchRole: [1],
batchProps: { batchProps: {
min: 0, min: 0,
precision: 3, precision: customer.isGold ? 2 : 3,
max: 999999.999, max: customer.isGold ? 100 : 999999.999,
}, },
role: [1], role: [1],
roleRules: { required: true }, roleRules: { required: true },
roleProps: { roleProps: {
min: 0, min: 0,
precision: 3, precision: customer.isGold ? 2 : 3,
max: 999999.999, max: customer.isGold ? 100 : 999999.999,
}, },
disabeldRender: () => customer.isDisabled, disabeldRender: () => customer.isDisabled,
}, },
......
...@@ -29,6 +29,7 @@ import { isUrl, filterSendData, clearCurrent, onAutoSaveValue, localAutoSaveKey ...@@ -29,6 +29,7 @@ import { isUrl, filterSendData, clearCurrent, onAutoSaveValue, localAutoSaveKey
import { ServiceContext } from './context'; import { ServiceContext } from './context';
import { GOOD_MANAGE } from '@/../config/permission.config'; import { GOOD_MANAGE } from '@/../config/permission.config';
import styles from './common.less'; import styles from './common.less';
import { GoldCategory } from '@/config/app.config';
/** /**
* 服务商品改造-商品模块 * 服务商品改造-商品模块
...@@ -374,7 +375,7 @@ const ServiceGoods = options => { ...@@ -374,7 +375,7 @@ const ServiceGoods = options => {
} }
setPageLoading(false); setPageLoading(false);
})(); })();
}, [SourceData]); }, [SourceData, categoryIds]);
useEffect(() => { useEffect(() => {
if (options.visible) { if (options.visible) {
...@@ -439,6 +440,15 @@ const ServiceGoods = options => { ...@@ -439,6 +440,15 @@ const ServiceGoods = options => {
// 切换类目 // 切换类目
const onCategoryChange = e => { const onCategoryChange = e => {
setCategoryIds(e); setCategoryIds(e);
let txt = '';
if (categoryIds.includes(GoldCategory)) {
txt = '千克';
} else if (e.includes(GoldCategory)) {
txt = '';
}
if (txt) {
message.warning(`商品品类已切换,规格重量单位已自动切换为${txt}`, 6);
}
}; };
// 保存草稿 // 保存草稿
...@@ -504,6 +514,7 @@ const ServiceGoods = options => { ...@@ -504,6 +514,7 @@ const ServiceGoods = options => {
canTakeawayService, // 是否可以添加外卖商品 canTakeawayService, // 是否可以添加外卖商品
isCard: productType === 4, isCard: productType === 4,
isTakeawayService: productType === 5, isTakeawayService: productType === 5,
isGold: categoryIds.includes(GoldCategory), // 投资金 重量显示克
// 0, "商品删除" 1, "新建" 2, "提交审核" 3, "待审核" 4, "驳回" 5, "未上架" 6, "已上架" 7, "已下架" // 0, "商品删除" 1, "新建" 2, "提交审核" 3, "待审核" 4, "驳回" 5, "未上架" 6, "已上架" 7, "已下架"
isNormal: SourceData.state && SourceData.state !== 4, // 商品不是驳回状态 isNormal: SourceData.state && SourceData.state !== 4, // 商品不是驳回状态
// 当商品进行编辑 & 类型不为电子卡券 & 商品状态不为驳回 禁用当前功能 // 当商品进行编辑 & 类型不为电子卡券 & 商品状态不为驳回 禁用当前功能
...@@ -516,7 +527,7 @@ const ServiceGoods = options => { ...@@ -516,7 +527,7 @@ const ServiceGoods = options => {
return ( return (
<Modal <Modal
title={isEdit ? '修改商品' : '新增商品'} title={isEdit ? '修改商品' : '新增商品'}
visible={options.visible} open={options.visible}
onCancel={() => handleCancel()} onCancel={() => handleCancel()}
destroyOnClose destroyOnClose
width={1050} width={1050}
......
...@@ -3,6 +3,7 @@ import { sortBy } from 'lodash'; ...@@ -3,6 +3,7 @@ import { sortBy } from 'lodash';
import UUID from '../../utils/uuid'; import UUID from '../../utils/uuid';
import localStorage from '@/utils/localStorage'; import localStorage from '@/utils/localStorage';
import { debounce, getObjectType, isClass } from '@/utils/utils'; import { debounce, getObjectType, isClass } from '@/utils/utils';
import { GoldCategory } from '@/config/app.config';
export const clearCurrent = currentList => currentList.filter(item => item.current); export const clearCurrent = currentList => currentList.filter(item => item.current);
...@@ -94,6 +95,11 @@ const filterItems = (type, props) => { ...@@ -94,6 +95,11 @@ const filterItems = (type, props) => {
item.firstSpecId = infoSpecData.firstSpecId; item.firstSpecId = infoSpecData.firstSpecId;
item.secondSpecId = infoSpecData.secondSpecId || null; item.secondSpecId = infoSpecData.secondSpecId || null;
console.log('setMealContent :>> ', setMealContent); console.log('setMealContent :>> ', setMealContent);
// 投资金 提交的时候 重量要从克转换成千克
if (infoMation.categoryId.includes(GoldCategory) && +item.weight) {
const w = +item.weight / 1000;
item.weight = w.toFixed(5);
}
if (type === 4) { if (type === 4) {
item.serviceItem = { item.serviceItem = {
...serviceItem, ...serviceItem,
......
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