Commit 4865061c authored by guang.wu's avatar guang.wu

Merge branch 'master' of git.quantgroup.cn:ui/merchant-manage-ui into feature-20240715-bank-company

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