Commit 27f5a09a authored by GuanHua's avatar GuanHua

merge: 合并代码

parents 5a199ff6 28503bbc
...@@ -2,6 +2,7 @@ import common from './zh-CN/common' ...@@ -2,6 +2,7 @@ import common from './zh-CN/common'
import menu from './zh-CN/menu' import menu from './zh-CN/menu'
import home from './zh-CN/home' import home from './zh-CN/home'
import shop from './zh-CN/shop' import shop from './zh-CN/shop'
import priceManage from './zh-CN/priceManage'
export default { export default {
'global.siteName': '瓴犀', 'global.siteName': '瓴犀',
...@@ -9,4 +10,5 @@ export default { ...@@ -9,4 +10,5 @@ export default {
...menu, ...menu,
...home, ...home,
...shop, ...shop,
...priceManage,
} }
export default {
'priceManage.constant.columnsSetMember.name' : '会员名称',
'priceManage.constant.columnsSetMember.memberTypeName' : '会员类型',
'priceManage.constant.columnsSetMember.roleName' : '会员角色',
'priceManage.constant.columnsSetMember.levelTag' : '会员等级',
'priceManage.constant.columnsSetProduct.code' : '商品编号',
'priceManage.constant.columnsSetProduct.name' : '商品名称',
'priceManage.constant.columnsSetProduct.customerCategory' : '品类',
'priceManage.constant.columnsSetProduct.brand' : '品牌',
'priceManage.constant.columnsSetProduct.unitName' : '单位',
'priceManage.constant.columnsSetProduct.priceType' : '商品定价',
'priceManage.constant.columnsSetProduct.priceType.1' : '现货价格',
'priceManage.constant.columnsSetProduct.priceType.2' : '价格需要询问',
'priceManage.constant.columnsUnitProduct.index' : '索引',
'priceManage.constant.columnsUnitProduct.goodsId' : '货品ID',
'priceManage.constant.columnsUnitProduct.name' : '商品名称',
'priceManage.constant.memberColumns.name' : '会员名称',
'priceManage.constant.memberColumns.memberTypeName' : '会员类型',
'priceManage.constant.memberColumns.roleName' : '角色',
'priceManage.constant.memberColumns.ctl' : '操作',
'priceManage.effect.goods' : '对应货品',
'priceManage.effect.unitPrice' : '单价',
'priceManage.effect.index' : '索引',
'priceManage.effect.goodsId' : '货品ID',
'priceManage.effect.goodsName' : '商品名称',
'priceManage.priceStrategy.columns.id' : '价格策略ID',
'priceManage.priceStrategy.columns.name' : '价格策略名称',
'priceManage.priceStrategy.columns.commodityCode' : '商品编号',
'priceManage.priceStrategy.columns.commodityName' : '商品名称',
'priceManage.priceStrategy.columns.customerCategory' : '品类',
'priceManage.priceStrategy.columns.brand' : '品牌',
'priceManage.priceStrategy.columns.unitName' : '单位',
'priceManage.priceStrategy.columns.priceType' : '商品定价',
'priceManage.priceStrategy.columns.priceType.1' : '现货价格',
'priceManage.priceStrategy.columns.priceType.2' : '价格需要询价',
'priceManage.priceStrategy.columns.priceType.3' : '积分兑换商品',
'priceManage.priceStrategy.columns.min' : '价格',
'priceManage.priceStrategy.columns.currency' : '¥',
'priceManage.priceStrategy.columns.isEnable' : '状态',
'priceManage.priceStrategy.columns.isEnable.1' : '有效',
'priceManage.priceStrategy.columns.isEnable.2' : '无效',
'priceManage.priceStrategy.columns.option' : '操作',
'priceManage.priceStrategy.popconfirm.title' : '确定要执行该操作?',
'priceManage.priceStrategy.popconfirm.okText' : '确定',
'priceManage.priceStrategy.popconfirm.cancelText' : '取消',
'priceManage.priceStrategy.popconfirm.link' : '删除',
'priceManage.priceStrategy.controllerBtns' : '新建',
'priceManage.priceStrategy.setStrategy.description' : '返回',
'priceManage.priceStrategy.setStrategy.title1' : '查看商品价格策略',
'priceManage.priceStrategy.setStrategy.title2' : '新建商品价格策略',
'priceManage.priceStrategy.setStrategy.title3' : '编辑商品价格策略',
'priceManage.priceStrategy.setStrategy.extra' : '保存',
'priceManage.priceStrategy.memberModal.modalTitle' : '选择会员',
'priceManage.priceStrategy.priceModal.unitPrice' : '单价',
'priceManage.priceStrategy.priceModal.index' : '索引',
'priceManage.priceStrategy.priceModal.error.1' : '请正确输入阶梯数量范围',
'priceManage.priceStrategy.priceModal.error.2' : '阶段的起始值必须为最小起订数',
'priceManage.priceStrategy.priceModal.title.1' : '批量设置价格',
'priceManage.priceStrategy.priceModal.title.2' : '设置价格',
'priceManage.priceStrategy.priceModal.ladderPrice' : '阶梯价格',
'priceManage.priceStrategy.priceModal.ladderPrice.rule' : '阶梯范围为必填项',
'priceManage.priceStrategy.priceModal.numberMin' : '最小数量',
'priceManage.priceStrategy.priceModal.numberMin.rule.1' : '阶梯最小数量为必填项',
'priceManage.priceStrategy.priceModal.numberMin.rule.2' : '阶梯数值仅限三位小数',
'priceManage.priceStrategy.priceModal.numberMax' : '最大数量',
'priceManage.priceStrategy.priceModal.numberMax.rule.1' : '阶梯最大数量为必填项',
'priceManage.priceStrategy.priceModal.numberMax.rule.2' : '阶梯数值仅限三位小数',
'priceManage.priceStrategy.priceModal.numberPrice' : '请输入单价',
'priceManage.priceStrategy.priceModal.numberPrice.rule.1' : '阶梯单价为必填项',
'priceManage.priceStrategy.priceModal.numberPrice.rule.2' : '阶梯单价仅限四位小数',
'priceManage.priceStrategy.priceModal.uniquePrice' : '请输入价格',
'priceManage.priceStrategy.priceModal.uniquePrice.label' : '单价',
'priceManage.priceStrategy.priceModal.uniquePrice.rule.1' : '请输入价格',
'priceManage.priceStrategy.priceModal.uniquePrice.rule.2' : '小数点后仅限四位',
'priceManage.priceStrategy.priceSetting.error.1' : '请先选择适用商城或商品',
'priceManage.priceStrategy.priceSetting.error.2' : '请先选择适用商城',
'priceManage.priceStrategy.priceSetting.error.3' : '请先选择适用商城或商品',
'priceManage.priceStrategy.priceSetting.ctl' : '操作',
'priceManage.priceStrategy.priceSetting.ctl.button' : '设置价格',
'priceManage.priceStrategy.priceSetting.unitPrice' : '单价',
'priceManage.priceStrategy.priceSetting.delete' : '删除',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton' : '会员名称',
'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button' : '选择指定会员',
'priceManage.priceStrategy.priceSetting.batchPriceButton.button' : '批量设置价格',
'priceManage.priceStrategy.priceSetting.connectProduct.button' : '选择',
'priceManage.priceStrategy.priceSetting.questionNameLabel' : '价格策略名称',
'priceManage.priceStrategy.priceSetting.questionNameLabel.tooltip' : '建议名称 :商品名称+会员名称',
'priceManage.priceStrategy.priceSetting.questionPriceTypeLabel' : '商品定价',
'priceManage.priceStrategy.priceSetting.questionPriceTypeLabel.tooltip' : '现货价格:表示是现货销售的价格,价格明码标价,采购时按照标价下单,价格需要询价:表示价格未设定,需要询价报价后再下单采购',
'priceManage.priceStrategy.productModal.modalTitle' : '选择商品',
'priceManage.schema.schema.name' : '价格策略名称',
'priceManage.schema.schema.commodityName' : '商品编号或名称',
'priceManage.schema.schema.priceType' : '商品定价',
'priceManage.schema.schema.priceType.1' : '所有',
'priceManage.schema.schema.priceType.2' : '现货价格',
'priceManage.schema.schema.priceType.3' : '价格需要询价',
'priceManage.schema.schema.brandId' : '商品品牌',
'priceManage.schema.schema.customerCategoryId' : '商品品类',
'priceManage.schema.schema.min' : '最低价格',
'priceManage.schema.schema.max' : '最高价格',
'priceManage.schema.schema.submit' : '查询',
'priceManage.schema.setPriceSchema.tab-1' : '选择商品',
'priceManage.schema.setPriceSchema.name' : '最长60个字符,30字汉字',
'priceManage.schema.setPriceSchema.name.rule' : '请填写价格策略名称',
'priceManage.schema.setPriceSchema.shopId' : '适用商城',
'priceManage.schema.setPriceSchema.productName' : '商品名称',
'priceManage.schema.setPriceSchema.priceType.1' : '现货价格',
'priceManage.schema.setPriceSchema.priceType.2' : '价格需要询问',
'priceManage.schema.setPriceSchema.tab-2' : '价格设置',
'priceManage.schema.setPriceSchema.tab-3' : '适用会员',
'priceManage.schema.formSearch.name' : '请输入会员名字',
'priceManage.schema.formSearch.submit' : '查询',
'priceManage.schema.formProduct.name' : '请输入商品编号/名称',
'priceManage.schema.formProduct.customerCategoryId' : '商品品类',
'priceManage.schema.formProduct.brandId' : '请选择品牌',
'priceManage.schema.formProduct.submit' : '查询',
}
// 选择商品和会员弹框的列 // 选择商品和会员弹框的列
import { getIntl } from 'umi';
export const columnsSetMember: any[] = [ export const columnsSetMember: any[] = [
{ {
title: 'ID', title: 'ID',
dataIndex: 'memberId', dataIndex: 'memberId',
align: 'center', align: 'center',
key: 'memberId', key: 'memberId',
}, },
{ {
title: '会员名称', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.name' }),
dataIndex: 'name', dataIndex: 'name',
align: 'center', align: 'center',
key: 'name', key: 'name',
}, },
{ {
title: '会员类型', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.memberTypeName' }),
dataIndex: 'memberTypeName', dataIndex: 'memberTypeName',
align: 'center', align: 'center',
key: 'memberTypeName', key: 'memberTypeName',
}, },
{ {
title: '会员角色', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.roleName' }),
dataIndex: 'roleName', dataIndex: 'roleName',
align: 'center', align: 'center',
key: 'roleName', key: 'roleName',
}, },
{ {
title: '会员等级', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetMember.levelTag' }),
dataIndex: 'levelTag', dataIndex: 'levelTag',
align: 'center', align: 'center',
key: 'levelTag', key: 'levelTag',
} }
] ]
export const columnsSetProduct: any[] = [ export const columnsSetProduct: any[] = [
{ {
title: '商品编号', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetProduct.code' }),
dataIndex: 'code', dataIndex: 'code',
align: 'center', align: 'center',
key: 'code', key: 'code',
}, },
{ {
title: '商品名称', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetProduct.name' }),
dataIndex: 'name', dataIndex: 'name',
align: 'center', align: 'center',
key: 'name', key: 'name',
width: 210, width: 210,
ellipsis: true, ellipsis: true,
}, },
{ {
title: '品类', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetProduct.customerCategory' }),
dataIndex: ['customerCategory', 'name'], dataIndex: ['customerCategory', 'name'],
align: 'center', align: 'center',
key: 'customerCategory', key: 'customerCategory',
}, },
{ {
title: '品牌', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetProduct.brand' }),
dataIndex: ['brand', 'name'], dataIndex: ['brand', 'name'],
align: 'center', align: 'center',
key: 'brand', key: 'brand',
}, },
{ {
title: '单位', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetProduct.unitName' }),
dataIndex: 'unitName', dataIndex: 'unitName',
align: 'center', align: 'center',
key: 'unitName', key: 'unitName',
}, },
{ {
title: '商品定价', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsSetProduct.priceType' }),
dataIndex: 'priceType', dataIndex: 'priceType',
align: 'center', align: 'center',
key: 'priceType', key: 'priceType',
render: (t, r) => t===1 ? '现货价格' : '价格需要询问' render: (t, r) => t === 1 ? getIntl().formatMessage({ id: 'priceManage.constant.columnsSetProduct.priceType.1' }) : getIntl().formatMessage({ id: 'priceManage.constant.columnsSetProduct.priceType.2' })
}, },
] ]
// 和商品规格 // 和商品规格
export const columnsUnitProduct: any[] = [ export const columnsUnitProduct: any[] = [
{ {
title: '索引', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsUnitProduct.index' }),
dataIndex: '索引', dataIndex: getIntl().formatMessage({ id: 'priceManage.constant.columnsUnitProduct.index' }),
key: '索引', key: getIntl().formatMessage({ id: 'priceManage.constant.columnsUnitProduct.index' }),
align: 'center', align: 'center',
className: 'commonHide' className: 'commonHide'
}, },
...@@ -91,17 +92,17 @@ export const columnsUnitProduct: any[] = [ ...@@ -91,17 +92,17 @@ export const columnsUnitProduct: any[] = [
className: "commonHide" className: "commonHide"
}, },
{ {
title: '货品ID', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsUnitProduct.goodsId' }),
dataIndex: '货品ID', dataIndex: getIntl().formatMessage({ id: 'priceManage.constant.columnsUnitProduct.goodsId' }),
key: '货品ID', key: getIntl().formatMessage({ id: 'priceManage.constant.columnsUnitProduct.goodsId' }),
align: 'center', align: 'center',
className: 'commonHide' className: 'commonHide'
}, },
{ {
dataIndex: '商品名称', dataIndex: getIntl().formatMessage({ id: 'priceManage.constant.columnsUnitProduct.name' }),
key: '商品名称', key: getIntl().formatMessage({ id: 'priceManage.constant.columnsUnitProduct.name' }),
align: 'center', align: 'center',
title: '商品名称', title: getIntl().formatMessage({ id: 'priceManage.constant.columnsUnitProduct.name' }),
}, },
// ..., // ...,
// { // {
...@@ -134,16 +135,16 @@ export const memberColumns: any[] = [ ...@@ -134,16 +135,16 @@ export const memberColumns: any[] = [
{ {
dataIndex: 'name', dataIndex: 'name',
align: 'center', align: 'center',
title: '会员名称' title: getIntl().formatMessage({ id: 'priceManage.constant.memberColumns.name' })
}, },
{ {
dataIndex: 'memberTypeName', dataIndex: 'memberTypeName',
title: '会员类型', title: getIntl().formatMessage({ id: 'priceManage.constant.memberColumns.memberTypeName' }),
align: 'center' align: 'center'
}, },
{ {
dataIndex: 'roleName', dataIndex: 'roleName',
title: '角色', title: getIntl().formatMessage({ id: 'priceManage.constant.memberColumns.roleName' }),
align: 'center' align: 'center'
}, },
// { // {
...@@ -153,7 +154,7 @@ export const memberColumns: any[] = [ ...@@ -153,7 +154,7 @@ export const memberColumns: any[] = [
// }, // },
{ {
dataIndex: 'ctl', dataIndex: 'ctl',
title: '操作', title: getIntl().formatMessage({ id: 'priceManage.constant.memberColumns.ctl' }),
align: 'center', align: 'center',
} }
] ]
import { useIntl } from 'umi';
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'; import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { columnsUnitProduct } from '../constant'; import { columnsUnitProduct } from '../constant';
import { GlobalConfig } from '@/global/config'; import { GlobalConfig } from '@/global/config';
...@@ -32,66 +33,68 @@ export const searchCustomerCategoryOptionEffect = (context: any, fieldName: stri ...@@ -32,66 +33,68 @@ export const searchCustomerCategoryOptionEffect = (context: any, fieldName: stri
// 构建设置价格 table 所需要的data和columns // 构建设置价格 table 所需要的data和columns
export const constructTableData = (data: any, ctx: ISchemaFormActions | ISchemaFormAsyncActions, pageStatus: any) => { export const constructTableData = (data: any, ctx: ISchemaFormActions | ISchemaFormAsyncActions, pageStatus: any) => {
let col: any = [...columnsUnitProduct] const intl = useIntl();
let temp: any = [] let col: any = [...columnsUnitProduct]
// 兼容编辑价格策略 新增使用data 编辑使用data[0].commodityUnitPrice let temp: any = []
let _data_column = pageStatus === PageStatus.ADD ? data[0] : data[0]["commodityUnitPrice"] // 兼容编辑价格策略 新增使用data 编辑使用data[0].commodityUnitPrice
_data_column.attributeAndValueList.map(_item => { let _data_column = pageStatus === PageStatus.ADD ? data[0] : data[0]["commodityUnitPrice"]
temp.push({title: _item.customerAttribute.name, dataIndex: [_item.customerAttribute.name, 'value'], key: _item.customerAttribute.name}) _data_column.attributeAndValueList.map(_item => {
}) temp.push({ title: _item.customerAttribute.name, dataIndex: [_item.customerAttribute.name, 'value'], key: _item.customerAttribute.name })
})
col.push( col.push(
{ {
title: '对应货品', title: intl.formatMessage({ id: 'priceManage.effect.goods' }),
dataIndex: '对应货品', dataIndex: intl.formatMessage({ id: 'priceManage.effect.goods' }),
key: '对应货品' key: intl.formatMessage({ id: 'priceManage.effect.goods' })
}, },
...temp, ...temp,
{ {
title: '单价', title: intl.formatMessage({ id: 'priceManage.effect.unitPrice' }),
dataIndex: '单价', dataIndex: intl.formatMessage({ id: 'priceManage.effect.unitPrice' }),
key: '单价', key: intl.formatMessage({ id: 'priceManage.effect.unitPrice' }),
render: (text, record) => { render: (text, record) => {
if (!text || JSON.stringify(text)==='{}') return null if (!text || JSON.stringify(text) === '{}') return null
return Object.keys(text).map((v, i) => { return Object.keys(text).map((v, i) => {
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{text[v]}</span></span><br /></> return <><span key={i}>{v === '0-0' ? '' : `${v}:`} <span style={{ color: 'red' }}>{text[v]}</span></span><br /></>
}) })
} }
}) })
// 兼容编辑价格策略 新增使用data 编辑使用data -> item -> commodityUnitPrice // 兼容编辑价格策略 新增使用data 编辑使用data -> item -> commodityUnitPrice
let _tableData: any = [] let _tableData: any = []
data.map((item, index) => { data.map((item, index) => {
let temp: any = {} let temp: any = {}
let _item_differ = pageStatus === PageStatus.ADD ? item : item["commodityUnitPrice"] let _item_differ = pageStatus === PageStatus.ADD ? item : item["commodityUnitPrice"]
_item_differ.attributeAndValueList.map(_item => { _item_differ.attributeAndValueList.map(_item => {
temp[_item.customerAttribute.name] = { temp[_item.customerAttribute.name] = {
value: _item.customerAttributeValue.value, value: _item.customerAttributeValue.value,
vId: _item.customerAttributeValue.id, vId: _item.customerAttributeValue.id,
id: _item.customerAttribute.id id: _item.customerAttribute.id
} }
}) })
_tableData.push({ _tableData.push({
"id": _item_differ.id, "id": _item_differ.id,
"索引": index, [intl.formatMessage({ id: 'priceManage.effect.index' })]: index,
"货品ID": _item_differ.goods?.id || '', [intl.formatMessage({ id: 'priceManage.effect.goodsId' })]: _item_differ.goods?.id || '',
"商品名称": ctx.getFieldValue("productName"), [intl.formatMessage({ id: 'priceManage.effect.goodsName' })]: ctx.getFieldValue("productName"),
"对应货品": _item_differ.goods?.name || '', [intl.formatMessage({ id: 'priceManage.effect.goods' })]: _item_differ.goods?.name || '',
...temp, ...temp,
"单价": orderlyLadderPrice(item.unitPrice) [intl.formatMessage({ id: 'priceManage.effect.unitPrice' })]: orderlyLadderPrice(item.unitPrice)
})
}) })
})
return { return {
columsUnit: col, columsUnit: col,
tableUnitData: _tableData tableUnitData: _tableData
} }
} }
// 生成 Api 所需要的参数 // 生成 Api 所需要的参数
export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISchemaFormAsyncActions) => { export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const intl = useIntl();
let _params: any = {} let _params: any = {}
_params["name"] = data.name _params["name"] = data.name
_params["priceType"] = data.priceType _params["priceType"] = data.priceType
...@@ -101,7 +104,7 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche ...@@ -101,7 +104,7 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche
_params["type"] = shopInfo["type"] _params["type"] = shopInfo["type"]
_params["environment"] = shopInfo["environment"] _params["environment"] = shopInfo["environment"]
_params["commodity"] = { id: data.productId } _params["commodity"] = { id: data.productId }
if(data?.commodityMemberList) { if (data?.commodityMemberList) {
_params["commodityMemberList"] = data.commodityMemberList.map(item => ({ _params["commodityMemberList"] = data.commodityMemberList.map(item => ({
memberId: item.memberId, memberId: item.memberId,
memberName: item.name, memberName: item.name,
...@@ -112,7 +115,7 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche ...@@ -112,7 +115,7 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche
} }
_params["memberUnitPriceList"] = data.memberUnitPriceList.map(item => ({ _params["memberUnitPriceList"] = data.memberUnitPriceList.map(item => ({
commodityUnitPrice: { id: item.id }, commodityUnitPrice: { id: item.id },
unitPrice: item["单价"] unitPrice: item[intl.formatMessage({ id: 'priceManage.effect.unitPrice' })]
})) }))
return { return {
...@@ -122,7 +125,7 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche ...@@ -122,7 +125,7 @@ export const transformParamsForApi = (data: any, ctx: ISchemaFormActions | ISche
// 生成前端Form所需要的参数 // 生成前端Form所需要的参数
export const transformDataForNiceForm = (value: any, ctx: ISchemaFormActions | ISchemaFormAsyncActions) => { export const transformDataForNiceForm = (value: any, ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
if(value && JSON.stringify(value) !== '{}') { if (value && JSON.stringify(value) !== '{}') {
let initValue: any = {}; let initValue: any = {};
initValue["name"] = value.name initValue["name"] = value.name
initValue["priceType"] = value.priceType initValue["priceType"] = value.priceType
......
import React, {useEffect} from 'react' import React, { useEffect } from 'react'
import { useIntl } from 'umi';
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd' import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useModalTable } from '../../model/useModalTable' import { useModalTable } from '../../model/useModalTable'
import ModalTable from '@/components/ModalTable' import ModalTable from '@/components/ModalTable'
import { columnsSetMember } from '../../constant' import { columnsSetMember } from '../../constant'
import {formSearch } from '../../schema' import { formSearch } from '../../schema'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch' import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const' import { FORM_FILTER_PATH } from '@/formSchema/const'
import ModalSearch from '@/components/NiceForm/components/Search' import ModalSearch from '@/components/NiceForm/components/Search'
...@@ -19,15 +20,15 @@ export interface MemberModalProps { ...@@ -19,15 +20,15 @@ export interface MemberModalProps {
currentRef?: any, currentRef?: any,
} }
const MemberModal:React.FC<MemberModalProps> = (props) => { const MemberModal: React.FC<MemberModalProps> = (props) => {
const { type = "checkbox", schemaAction, currentRef, ...restProps } = props const { type = "checkbox", schemaAction, currentRef, ...restProps } = props
const intl = useIntl();
const { const {
visible, visible,
setVisible, setVisible,
rowSelection, rowSelection,
rowSelectionCtl, rowSelectionCtl,
} = useModalTable({type, customKey: "memberId"}) } = useModalTable({ type, customKey: "memberId" })
const { const {
id, id,
...@@ -54,7 +55,7 @@ const MemberModal:React.FC<MemberModalProps> = (props) => { ...@@ -54,7 +55,7 @@ const MemberModal:React.FC<MemberModalProps> = (props) => {
// schemaAction.setFieldValue('commodityMemberList', rowSelectionCtl.selectRow) // schemaAction.setFieldValue('commodityMemberList', rowSelectionCtl.selectRow)
// // rowSelectionCtl.setSelectedRowKeys([]) // // rowSelectionCtl.setSelectedRowKeys([])
if(pageStatus === PageStatus.EDIT) { if (pageStatus === PageStatus.EDIT) {
schemaAction.setFieldState('commodityMemberList', state => { schemaAction.setFieldState('commodityMemberList', state => {
state.isDelete = true state.isDelete = true
}) })
...@@ -77,9 +78,9 @@ const MemberModal:React.FC<MemberModalProps> = (props) => { ...@@ -77,9 +78,9 @@ const MemberModal:React.FC<MemberModalProps> = (props) => {
} }
const fetchMemberList = async (params) => { const fetchMemberList = async (params) => {
const excludeIds = await getProductCommodityGetStrategyMemberByCommodityId({commodityId: schemaAction.getFieldValue("productId")}, {ctlType: 'none'}) const excludeIds = await getProductCommodityGetStrategyMemberByCommodityId({ commodityId: schemaAction.getFieldValue("productId") }, { ctlType: 'none' })
let checkedMember = schemaAction.getFieldValue('commodityMemberList') let checkedMember = schemaAction.getFieldValue('commodityMemberList')
if(schemaAction.getFieldState('commodityMemberList').isDelete) { if (schemaAction.getFieldState('commodityMemberList').isDelete) {
params.excludeList = checkedMember.map(item => ({ params.excludeList = checkedMember.map(item => ({
memberId: item.memberId, memberId: item.memberId,
roleId: item.roleId, roleId: item.roleId,
...@@ -90,13 +91,13 @@ const MemberModal:React.FC<MemberModalProps> = (props) => { ...@@ -90,13 +91,13 @@ const MemberModal:React.FC<MemberModalProps> = (props) => {
roleId: item.memberRoleId, roleId: item.memberRoleId,
})) }))
} }
const res = await postMemberManageLowerConsumerPage(params, {ctlType: 'none'}); const res = await postMemberManageLowerConsumerPage(params, { ctlType: 'none' });
return res.data return res.data
} }
return ( return (
<ModalTable <ModalTable
modalTitle='选择会员' modalTitle={intl.formatMessage({ id: 'priceManage.priceStrategy.memberModal.modalTitle' })}
confirm={handleOkAddMember} confirm={handleOkAddMember}
cancel={handleCancelAddMember} cancel={handleCancelAddMember}
visible={visible} visible={visible}
......
import React, { useState, useEffect, useRef } from 'react' import React, { useState, useEffect, useRef } from 'react'
import { useIntl } from 'umi';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus' import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { ISchemaFormActions, ISchema, FormEffectHooks } from '@formily/antd' import { ISchemaFormActions, ISchema, FormEffectHooks } from '@formily/antd'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable' import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
...@@ -29,11 +30,12 @@ export interface PriceSettingProps { ...@@ -29,11 +30,12 @@ export interface PriceSettingProps {
} }
const fetchShopLists = async () => { const fetchShopLists = async () => {
return await fectchShopListsSource({type: 1}) return await fectchShopListsSource({ type: 1 })
} }
const PriceSetting:React.FC<PriceSettingProps> = (props) => { const PriceSetting: React.FC<PriceSettingProps> = (props) => {
const { addSchemaAction, schema, formSubmit, onFieldChange = () => {} } = props const intl = useIntl();
const { addSchemaAction, schema, formSubmit, onFieldChange = () => { } } = props
const priceRef = useRef<any>({}) const priceRef = useRef<any>({})
const productRef = useRef<any>({}) const productRef = useRef<any>({})
const memberRef = useRef<any>({}) const memberRef = useRef<any>({})
...@@ -83,7 +85,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => { ...@@ -83,7 +85,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
const shopId = addSchemaAction.getFieldValue('shopId'); const shopId = addSchemaAction.getFieldValue('shopId');
const productId = addSchemaAction.getFieldValue('productId'); const productId = addSchemaAction.getFieldValue('productId');
if (!shopId || !productId) { if (!shopId || !productId) {
message.error('请先选择适用商城或商品'); message.error(intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.error.1' }));
return; return;
} }
...@@ -108,7 +110,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => { ...@@ -108,7 +110,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
const handleAddProductBtn = () => { const handleAddProductBtn = () => {
const shopId = addSchemaAction.getFieldValue('shopId') const shopId = addSchemaAction.getFieldValue('shopId')
if (!shopId) { if (!shopId) {
message.error('请先选择适用商城') message.error(intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.error.2' }))
return false return false
} }
productRef.current.setVisible(true) productRef.current.setVisible(true)
...@@ -125,7 +127,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => { ...@@ -125,7 +127,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
priceRef.current.setIsBatchSetting(true) priceRef.current.setIsBatchSetting(true)
priceRef.current.setVisible(true) priceRef.current.setVisible(true)
} else { } else {
message.error('请先选择适用商城或商品') message.error(intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.error.3' }))
} }
} }
...@@ -155,22 +157,22 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => { ...@@ -155,22 +157,22 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
state.dataSource = source // 存源数据 state.dataSource = source // 存源数据
priceType !== 2 ? columsUnit.push({ priceType !== 2 ? columsUnit.push({
dataIndex: 'ctl', dataIndex: 'ctl',
title: '操作', title: intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.ctl' }),
align: 'center', align: 'center',
render: (_i, _r) => <Button disabled={pageStatus === PageStatus.PREVIEW} type='link' onClick={() => handleSetProductPrice(_r)}>设置价格</Button> render: (_i, _r) => <Button disabled={pageStatus === PageStatus.PREVIEW} type='link' onClick={() => handleSetProductPrice(_r)}>{intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.ctl.button' })}</Button>
}) })
: :
columsUnit.pop() columsUnit.pop()
state.props["x-component-props"].columns = columsUnit state.props["x-component-props"].columns = columsUnit
}) })
ctx.setFieldValue("memberUnitPriceList", priceType === 2 ? tableUnitData.map(item => { delete item["单价"]; return item }) : tableUnitData) ctx.setFieldValue("memberUnitPriceList", priceType === 2 ? tableUnitData.map(item => { delete item[intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.unitPrice' })]; return item }) : tableUnitData)
// console.log(columsUnit, tableUnitData, source) // console.log(columsUnit, tableUnitData, source)
// 填充适用会员table // 填充适用会员table
ctx.setFieldState("commodityMemberList", state => { ctx.setFieldState("commodityMemberList", state => {
memberColumns[memberColumns.length - 1].render = (text, record) => { memberColumns[memberColumns.length - 1].render = (text, record) => {
return <Button disabled={pageStatus === PageStatus.PREVIEW} type='link' onClick={() => handleDeleteMemberTable(record)}>删除</Button> return <Button disabled={pageStatus === PageStatus.PREVIEW} type='link' onClick={() => handleDeleteMemberTable(record)}>{intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.delete' })}</Button>
} }
state.props["x-component-props"].columns = memberColumns state.props["x-component-props"].columns = memberColumns
}) })
...@@ -180,30 +182,30 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => { ...@@ -180,30 +182,30 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
const tableAddMemberButton = pageStatus !== PageStatus.PREVIEW && <> const tableAddMemberButton = pageStatus !== PageStatus.PREVIEW && <>
<p style={{ display: 'flex', justifyContent: 'flex-end', flexWrap: 'wrap' }}> <p style={{ display: 'flex', justifyContent: 'flex-end', flexWrap: 'wrap' }}>
<Search <Search
placeholder="会员名称" placeholder={intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.tableAddMemberButton' })}
onSearch={value => searchMember(value)} onSearch={value => searchMember(value)}
style={{ width: 256 }} style={{ width: 256 }}
/> />
</p> </p>
<Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={handleAddMemberBtn} type='dashed'>选择指定会员</Button> <Button style={{ marginBottom: 16 }} block icon={<PlusOutlined />} onClick={handleAddMemberBtn} type='dashed'>{intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.tableAddMemberButton.button' })}</Button>
</> </>
// 批量设置价格按钮 // 批量设置价格按钮
const batchPriceButton = pageStatus !== PageStatus.PREVIEW && priceType !== 2 && <Button type="text" onClick={clickBatchSetPrice} style={{ marginBottom: 12, float: "right" }}><SettingOutlined /> 批量设置价格</Button> const batchPriceButton = pageStatus !== PageStatus.PREVIEW && priceType !== 2 && <Button type="text" onClick={clickBatchSetPrice} style={{ marginBottom: 12, float: "right" }}><SettingOutlined /> {intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.batchPriceButton.button' })}</Button>
// 选择商品 // 选择商品
const connectProduct = pageStatus === PageStatus.ADD && <div className='connectBtn' onClick={handleAddProductBtn}><LinkOutlined style={{ marginRight: 4 }} />选择</div> const connectProduct = pageStatus === PageStatus.ADD && <div className='connectBtn' onClick={handleAddProductBtn}><LinkOutlined style={{ marginRight: 4 }} />{intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.connectProduct.button' })}</div>
const questionNameLabel = <> const questionNameLabel = <>
价格策略名称&nbsp; {intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.questionNameLabel' })}&nbsp;
<Tooltip title="建议名称 :商品名称+会员名称"> <Tooltip title={intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.questionNameLabel.tooltip' })}>
<QuestionCircleOutlined /> <QuestionCircleOutlined />
</Tooltip> </Tooltip>
</> </>
const questionPriceTypeLabel = <> const questionPriceTypeLabel = <>
商品定价&nbsp; {intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.questionPriceTypeLabel' })}&nbsp;
<Tooltip title="现货价格:表示是现货销售的价格,价格明码标价,采购时按照标价下单,价格需要询价:表示价格未设定,需要询价报价后再下单采购"> <Tooltip title={intl.formatMessage({ id: 'priceManage.priceStrategy.priceSetting.questionPriceTypeLabel.tooltip' })}>
<QuestionCircleOutlined /> <QuestionCircleOutlined />
</Tooltip> </Tooltip>
</> </>
...@@ -237,7 +239,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => { ...@@ -237,7 +239,7 @@ const PriceSetting:React.FC<PriceSettingProps> = (props) => {
// state.dataSource = pageStatus === PageStatus.PREVIEW ? // state.dataSource = pageStatus === PageStatus.PREVIEW ?
// GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value && state.value.includes(v.id)) // GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value && state.value.includes(v.id))
// : // :
// state.dataSource = GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value) // state.dataSource = GlobalConfig.web.shopInfo.filter(v => v.id === parentState.value)
if (pageStatus === PageStatus.EDIT) { if (pageStatus === PageStatus.EDIT) {
state.props['x-component-props'].disabled = true; state.props['x-component-props'].disabled = true;
......
import React, { useEffect} from 'react' import React, { useEffect } from 'react'
import { useIntl } from 'umi';
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd' import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { useModalTable } from '../../model/useModalTable' import { useModalTable } from '../../model/useModalTable'
import ModalTable from '@/components/ModalTable' import ModalTable from '@/components/ModalTable'
...@@ -22,15 +23,16 @@ export interface ProductModalProps { ...@@ -22,15 +23,16 @@ export interface ProductModalProps {
currentRef?: any, currentRef?: any,
} }
const ProductModal:React.FC<ProductModalProps> = (props) => { const ProductModal: React.FC<ProductModalProps> = (props) => {
const { type = "radio" ,schemaAction, currentRef, ...restProps } = props const { type = "radio", schemaAction, currentRef, ...restProps } = props
const intl = useIntl();
const { const {
visible, visible,
setVisible, setVisible,
rowSelection, rowSelection,
rowSelectionCtl, rowSelectionCtl,
} = useModalTable({type}) } = useModalTable({ type })
useEffect(() => { useEffect(() => {
if (currentRef) { if (currentRef) {
...@@ -42,8 +44,8 @@ const ProductModal:React.FC<ProductModalProps> = (props) => { ...@@ -42,8 +44,8 @@ const ProductModal:React.FC<ProductModalProps> = (props) => {
} }
}, []) }, [])
// 指定商品 // 指定商品
const fetchProductList = async (params) => { const fetchProductList = async (params) => {
const shopId = schemaAction.getFieldValue('shopId') const shopId = schemaAction.getFieldValue('shopId')
let shopInfo: any = GlobalConfig.web.shopInfo.filter(item => item.id === shopId) let shopInfo: any = GlobalConfig.web.shopInfo.filter(item => item.id === shopId)
...@@ -79,7 +81,7 @@ const ProductModal:React.FC<ProductModalProps> = (props) => { ...@@ -79,7 +81,7 @@ const ProductModal:React.FC<ProductModalProps> = (props) => {
return ( return (
<ModalTable <ModalTable
modalTitle='选择商品' modalTitle={intl.formatMessage({ id: 'priceManage.priceStrategy.productModal.modalTitle' })}
confirm={handleOkAddProduct} confirm={handleOkAddProduct}
cancel={handleCancel} cancel={handleCancel}
visible={visible} visible={visible}
......
import React, { useRef } from 'react' import React, { useRef } from 'react'
import { Button, Popconfirm, Card, Space} from 'antd' import { Button, Popconfirm, Card, Space } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { StandardTable } from 'god' import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface' import { ColumnType } from 'antd/lib/table/interface'
...@@ -10,7 +10,7 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte ...@@ -10,7 +10,7 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import { searchCustomerCategoryOptionEffect, searchBrandOptionEffect } from '../effect' import { searchCustomerCategoryOptionEffect, searchBrandOptionEffect } from '../effect'
import { schema } from '../schema' import { schema } from '../schema'
import { FORM_FILTER_PATH } from '@/formSchema/const' import { FORM_FILTER_PATH } from '@/formSchema/const'
import {history} from 'umi' import { history, useIntl } from 'umi'
import StatusSwitch from '@/components/StatusSwitch' import StatusSwitch from '@/components/StatusSwitch'
import { PlusOutlined } from '@ant-design/icons' import { PlusOutlined } from '@ant-design/icons'
import { getProductCommodityGetUnitPriceStrategyList, postProductCommodityDeleteUnitPriceStrategy, postProductCommodityUpdateUnitPriceStrategyStatus } from '@/services/ProductV2Api' import { getProductCommodityGetUnitPriceStrategyList, postProductCommodityDeleteUnitPriceStrategy, postProductCommodityUpdateUnitPriceStrategyStatus } from '@/services/ProductV2Api'
...@@ -18,16 +18,17 @@ import { getProductCommodityGetUnitPriceStrategyList, postProductCommodityDelete ...@@ -18,16 +18,17 @@ import { getProductCommodityGetUnitPriceStrategyList, postProductCommodityDelete
const formActions = createFormActions(); const formActions = createFormActions();
const PriceManage: React.FC<{}> = () => { const PriceManage: React.FC<{}> = () => {
const intl = useIntl();
const ref = useRef<any>({}) const ref = useRef<any>({})
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
title: '价格策略ID', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.id' }),
dataIndex: 'id', dataIndex: 'id',
key: 'id', key: 'id',
}, },
{ {
title: '价格策略名称', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.name' }),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
className: 'commonPickColor', className: 'commonPickColor',
...@@ -43,66 +44,66 @@ const PriceManage: React.FC<{}> = () => { ...@@ -43,66 +44,66 @@ const PriceManage: React.FC<{}> = () => {
// key: 'commodity', // key: 'commodity',
// }, // },
{ {
title: '商品编号', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.commodityCode' }),
dataIndex: ["commodity", "code"], dataIndex: ["commodity", "code"],
key: 'commodity', key: 'commodity',
}, },
{ {
title: '商品名称', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.commodityName' }),
dataIndex: ["commodity", "name"], dataIndex: ["commodity", "name"],
key: "commodity", key: "commodity",
}, },
{ {
title: '品类', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.customerCategory' }),
dataIndex: ["commodity", "customerCategory", "name"], dataIndex: ["commodity", "customerCategory", "name"],
key: 'commodity', key: 'commodity',
}, },
{ {
title: '品牌', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.brand' }),
dataIndex: ["commodity", "brand", "name"], dataIndex: ["commodity", "brand", "name"],
key: 'commodity', key: 'commodity',
}, },
{ {
title: '单位', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.unitName' }),
dataIndex: ["commodity", "unitName"], dataIndex: ["commodity", "unitName"],
key: 'commodity', key: 'commodity',
}, },
{ {
title: '商品定价', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.priceType' }),
dataIndex: 'priceType', dataIndex: 'priceType',
key: 'priceType', key: 'priceType',
render: (t, r) => { render: (t, r) => {
if(t === 1) if (t === 1)
return '现货价格' return intl.formatMessage({ id: 'priceManage.priceStrategy.columns.priceType.1' })
if(t === 2) if (t === 2)
return '价格需要询价' return intl.formatMessage({ id: 'priceManage.priceStrategy.columns.priceType.2' })
if(t === 3) if (t === 3)
return '积分兑换商品' return intl.formatMessage({ id: 'priceManage.priceStrategy.columns.priceType.3' })
} }
}, },
{ {
title: '价格', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.min' }),
dataIndex: 'min', dataIndex: 'min',
key: 'min', key: 'min',
render: (text:any, reocrd:any) => { render: (text: any, reocrd: any) => {
if(reocrd.priceType === 1){ if (reocrd.priceType === 1) {
if(reocrd.max === reocrd.min) if (reocrd.max === reocrd.min)
return <>{reocrd.min}</> return <>{intl.formatMessage({ id: 'priceManage.priceStrategy.columns.currency' })}{reocrd.min}</>
else else
return <>{reocrd.min} ~ ¥{reocrd.max}</> return <>{intl.formatMessage({ id: 'priceManage.priceStrategy.columns.currency' })}{reocrd.min} ~ {intl.formatMessage({ id: 'priceManage.priceStrategy.columns.currency' })}{reocrd.max}</>
} }
if(reocrd.priceType === 3){ if (reocrd.priceType === 3) {
if(reocrd.max === reocrd.min) if (reocrd.max === reocrd.min)
return <>{reocrd.min}</> return <>{reocrd.min}</>
else else
return <>{reocrd.min} ~ {reocrd.max}</> return <>{reocrd.min} ~ {reocrd.max}</>
} }
if(reocrd.priceType === 2) if (reocrd.priceType === 2)
return null return null
} }
}, },
{ {
title: '状态', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.isEnable' }),
dataIndex: 'isEnable', dataIndex: 'isEnable',
key: 'isEnable', key: 'isEnable',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
...@@ -115,26 +116,26 @@ const PriceManage: React.FC<{}> = () => { ...@@ -115,26 +116,26 @@ const PriceManage: React.FC<{}> = () => {
), ),
filters: [ filters: [
{ {
text: '有效', text: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.isEnable.1' }),
value: true, value: true,
}, },
{ {
text: '无效', text: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.isEnable.2' }),
value: false, value: false,
} }
], ],
onFilter: (value, record) => record.isEnable === value, onFilter: (value, record) => record.isEnable === value,
}, },
{ {
title: '操作', title: intl.formatMessage({ id: 'priceManage.priceStrategy.columns.option' }),
dataIndex: 'option', dataIndex: 'option',
width: 128, width: 128,
render: (text: any, record: any) => { render: (text: any, record: any) => {
return ( return (
<> <>
<Button type='link' className="padLeft0" onClick={() => handleModify(record)}>修改</Button> <Button type='link' className="padLeft0" onClick={() => handleModify(record)}>修改</Button>
<Popconfirm title="确定要执行该操作?" okText="确定" cancelText="取消" onConfirm={() => handleDelete(record)}> <Popconfirm title={intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.title' })} okText={intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.okText' })} cancelText={intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.cancelText' })} onConfirm={() => handleDelete(record)}>
<Button type='link' className="padLeft0">删除</Button> <Button type='link' className="padLeft0">{intl.formatMessage({ id: 'priceManage.priceStrategy.popconfirm.link' })}</Button>
</Popconfirm> </Popconfirm>
</> </>
) )
...@@ -152,8 +153,8 @@ const PriceManage: React.FC<{}> = () => { ...@@ -152,8 +153,8 @@ const PriceManage: React.FC<{}> = () => {
} }
const handleUpdateState = (record: any) => { const handleUpdateState = (record: any) => {
postProductCommodityUpdateUnitPriceStrategyStatus({id: record.id, isEnable: !record.isEnable}).then(res => { postProductCommodityUpdateUnitPriceStrategyStatus({ id: record.id, isEnable: !record.isEnable }).then(res => {
if(res.code === 1000) { if (res.code === 1000) {
setTimeout(() => { setTimeout(() => {
ref.current.reload() ref.current.reload()
}, 1000) }, 1000)
...@@ -167,7 +168,7 @@ const PriceManage: React.FC<{}> = () => { ...@@ -167,7 +168,7 @@ const PriceManage: React.FC<{}> = () => {
const handleDelete = (record: any) => { const handleDelete = (record: any) => {
postProductCommodityDeleteUnitPriceStrategy({ id: record.id }).then(res => { postProductCommodityDeleteUnitPriceStrategy({ id: record.id }).then(res => {
if(res.code === 1000) { if (res.code === 1000) {
setTimeout(() => { setTimeout(() => {
ref.current.reload() ref.current.reload()
}, 1000) }, 1000)
...@@ -179,9 +180,9 @@ const PriceManage: React.FC<{}> = () => { ...@@ -179,9 +180,9 @@ const PriceManage: React.FC<{}> = () => {
<Space> <Space>
<Button <Button
type='primary' type='primary'
onClick={()=>history.push('/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/add')} onClick={() => history.push('/memberCenter/commodityAbility/priceManage/priceStrategy/setStrategy/add')}
> >
<PlusOutlined />新建 <PlusOutlined />{intl.formatMessage({ id: 'priceManage.priceStrategy.controllerBtns' })}
</Button> </Button>
</Space> </Space>
) )
...@@ -197,7 +198,7 @@ const PriceManage: React.FC<{}> = () => { ...@@ -197,7 +198,7 @@ const PriceManage: React.FC<{}> = () => {
controlRender={ controlRender={
<NiceForm <NiceForm
actions={formActions} actions={formActions}
onSubmit={values =>ref.current.reload(values)} onSubmit={values => ref.current.reload(values)}
expressionScope={{ expressionScope={{
controllerBtns, controllerBtns,
}} }}
......
import React, { useCallback, useState } from 'react' import React, { useCallback, useState } from 'react'
import { Button, Card, } from 'antd' import { Button, Card, } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { history } from "umi" import { history, useIntl } from "umi"
import ReutrnEle from '@/components/ReturnEle' import ReutrnEle from '@/components/ReturnEle'
import { SaveOutlined } from '@ant-design/icons' import { SaveOutlined } from '@ant-design/icons'
import { createFormActions } from '@formily/antd' import { createFormActions } from '@formily/antd'
...@@ -15,6 +15,7 @@ import { postProductCommoditySaveOrUpdateUnitPriceStrategy } from '@/services/Pr ...@@ -15,6 +15,7 @@ import { postProductCommoditySaveOrUpdateUnitPriceStrategy } from '@/services/Pr
const addSchemaAction = createFormActions() const addSchemaAction = createFormActions()
const SetStrategy: React.FC<{}> = () => { const SetStrategy: React.FC<{}> = () => {
const intl = useIntl();
const { const {
id, id,
preview, preview,
...@@ -31,35 +32,35 @@ const SetStrategy: React.FC<{}> = () => { ...@@ -31,35 +32,35 @@ const SetStrategy: React.FC<{}> = () => {
// message.error('请选择指定适用会员') // message.error('请选择指定适用会员')
// setBtnLoading(false) // setBtnLoading(false)
// } else { // } else {
const { params } = transformParamsForApi(values, addSchemaAction) const { params } = transformParamsForApi(values, addSchemaAction)
let _params = {} let _params = {}
if(id) { if (id) {
_params["id"] = Number(id) _params["id"] = Number(id)
} }
let res = await postProductCommoditySaveOrUpdateUnitPriceStrategy({...params, ..._params}) let res = await postProductCommoditySaveOrUpdateUnitPriceStrategy({ ...params, ..._params })
if(res.code === 1000) { if (res.code === 1000) {
setTimeout(() => { setTimeout(() => {
history.goBack(-1) history.goBack(-1)
}, 1000) }, 1000)
} }
setBtnLoading(false) setBtnLoading(false)
// } // }
}, []) }, [])
return ( return (
<PageHeaderWrapper <PageHeaderWrapper
onBack={() => history.goBack()} onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />} backIcon={<ReutrnEle description={intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.description' })} />}
className="setStrategy" className="setStrategy"
title={pageStatus === PageStatus.PREVIEW ? '查看商品价格策略' : ( pageStatus === PageStatus.ADD ? '新建商品价格策略' : '编辑商品价格策略')} title={pageStatus === PageStatus.PREVIEW ? intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.title1' }) : (pageStatus === PageStatus.ADD ? intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.title2' }) : intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.title3' }))}
extra={( extra={(
pageStatus !== PageStatus.PREVIEW pageStatus !== PageStatus.PREVIEW
? ( ? (
<Button key="1" loading={btnLoading} onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}> <Button key="1" loading={btnLoading} onClick={() => addSchemaAction.submit()} type="primary" icon={<SaveOutlined />}>
保存 {intl.formatMessage({ id: 'priceManage.priceStrategy.setStrategy.extra' })}
</Button> </Button>
) )
: null : null
)} )}
> >
......
import {getIntl} from 'umi';
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { getProductSelectGetSelectBrand } from '@/services/ProductV2Api'; import { getProductSelectGetSelectBrand } from '@/services/ProductV2Api';
...@@ -28,7 +29,7 @@ export const schema: ISchema = { ...@@ -28,7 +29,7 @@ export const schema: ISchema = {
type: 'string', type: 'string',
'x-component': 'Search', 'x-component': 'Search',
'x-component-props': { 'x-component-props': {
placeholder: '价格策略名称', placeholder: getIntl().formatMessage({id: 'priceManage.schema.schema.name'}),
}, },
}, },
}, },
...@@ -48,7 +49,7 @@ export const schema: ISchema = { ...@@ -48,7 +49,7 @@ export const schema: ISchema = {
commodityName: { commodityName: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '商品编号或名称', placeholder: getIntl().formatMessage({id: 'priceManage.schema.schema.commodityName'}),
style: { width: '174px' }, style: { width: '174px' },
} }
}, },
...@@ -56,15 +57,15 @@ export const schema: ISchema = { ...@@ -56,15 +57,15 @@ export const schema: ISchema = {
type: 'string', type: 'string',
enum: [ enum: [
{ {
label: '所有', label: getIntl().formatMessage({id: 'priceManage.schema.schema.priceType.1'}),
value: 0, value: 0,
}, },
{ {
label: '现货价格', label: getIntl().formatMessage({id: 'priceManage.schema.schema.priceType.2'}),
value: 1, value: 1,
}, },
{ {
label: '价格需要询价', label: getIntl().formatMessage({id: 'priceManage.schema.schema.priceType.3'}),
value: 2, value: 2,
}, },
// { // {
...@@ -73,7 +74,7 @@ export const schema: ISchema = { ...@@ -73,7 +74,7 @@ export const schema: ISchema = {
// } // }
], ],
'x-component-props': { 'x-component-props': {
placeholder: '商品定价', placeholder: getIntl().formatMessage({id: 'priceManage.schema.schema.priceType'}),
style: { width: '174px' }, style: { width: '174px' },
}, },
}, },
...@@ -81,7 +82,7 @@ export const schema: ISchema = { ...@@ -81,7 +82,7 @@ export const schema: ISchema = {
type: 'string', type: 'string',
'x-component': 'CustomInputSearch', 'x-component': 'CustomInputSearch',
'x-component-props': { 'x-component-props': {
placeholder: '商品品牌', placeholder: getIntl().formatMessage({id: 'priceManage.schema.schema.brandId'}),
showSearch: true, showSearch: true,
showArrow: true, showArrow: true,
defaultActiveFirstOption: false, defaultActiveFirstOption: false,
...@@ -96,7 +97,7 @@ export const schema: ISchema = { ...@@ -96,7 +97,7 @@ export const schema: ISchema = {
type: 'string', type: 'string',
'x-component': 'CustomCategorySearch', 'x-component': 'CustomCategorySearch',
'x-component-props': { 'x-component-props': {
placeholder: '商品品类', placeholder: getIntl().formatMessage({id: 'priceManage.schema.schema.customerCategoryId'}),
showSearch: true, showSearch: true,
notFoundContent: null, notFoundContent: null,
style: { width: '174px' }, style: { width: '174px' },
...@@ -108,7 +109,7 @@ export const schema: ISchema = { ...@@ -108,7 +109,7 @@ export const schema: ISchema = {
type: 'number', type: 'number',
'x-component': 'NumberRange', 'x-component': 'NumberRange',
'x-component-props': { 'x-component-props': {
placeholder: ['最低价格', '最高价格'], placeholder: [getIntl().formatMessage({id: 'priceManage.schema.schema.min'}), getIntl().formatMessage({id: 'priceManage.schema.schema.max'})],
}, },
}, },
submit: { submit: {
...@@ -117,7 +118,7 @@ export const schema: ISchema = { ...@@ -117,7 +118,7 @@ export const schema: ISchema = {
span: 1, span: 1,
}, },
'x-component-props': { 'x-component-props': {
children: '查询', children: getIntl().formatMessage({id: 'priceManage.schema.schema.submit'}),
}, },
}, },
}, },
...@@ -143,7 +144,7 @@ export const setPriceSchema: ISchema = { ...@@ -143,7 +144,7 @@ export const setPriceSchema: ISchema = {
"type": "object", "type": "object",
"x-component": "tabpane", "x-component": "tabpane",
"x-component-props": { "x-component-props": {
"tab": "选择商品", "tab": getIntl().formatMessage({id: 'priceManage.schema.setPriceSchema.tab-1'}),
}, },
"properties": { "properties": {
MEGA_LAYOUT1: { MEGA_LAYOUT1: {
...@@ -159,12 +160,12 @@ export const setPriceSchema: ISchema = { ...@@ -159,12 +160,12 @@ export const setPriceSchema: ISchema = {
type: 'string', type: 'string',
title: '{{questionNameLabel}}', title: '{{questionNameLabel}}',
"x-component-props": { "x-component-props": {
placeholder: '最长60个字符,30字汉字' placeholder: getIntl().formatMessage({id: 'priceManage.schema.setPriceSchema.name'})
}, },
"x-rules": [ "x-rules": [
{ {
required: true, required: true,
message: '请填写价格策略名称' message: getIntl().formatMessage({id: 'priceManage.schema.setPriceSchema.name.rule'})
}, },
{ {
limitByte: true, limitByte: true,
...@@ -175,7 +176,7 @@ export const setPriceSchema: ISchema = { ...@@ -175,7 +176,7 @@ export const setPriceSchema: ISchema = {
shopId: { shopId: {
type: 'number', type: 'number',
enum: [], enum: [],
title: '适用商城', title: getIntl().formatMessage({id: 'priceManage.schema.setPriceSchema.shopId'}),
required: true, required: true,
"x-component-props": { "x-component-props": {
disabled: false, disabled: false,
...@@ -183,7 +184,7 @@ export const setPriceSchema: ISchema = { ...@@ -183,7 +184,7 @@ export const setPriceSchema: ISchema = {
}, },
productName: { productName: {
type: 'string', type: 'string',
title: '商品名称', title: getIntl().formatMessage({id: 'priceManage.schema.setPriceSchema.productName'}),
"x-mega-props": { "x-mega-props": {
full: true full: true
}, },
...@@ -207,11 +208,11 @@ export const setPriceSchema: ISchema = { ...@@ -207,11 +208,11 @@ export const setPriceSchema: ISchema = {
required: true, required: true,
enum: [ enum: [
{ {
label: '现货价格', label: getIntl().formatMessage({id: 'priceManage.schema.setPriceSchema.priceType.1'}),
value: 1 value: 1
}, },
{ {
label: '价格需要询问', label: getIntl().formatMessage({id: 'priceManage.schema.setPriceSchema.priceType.2'}),
value: 2 value: 2
} }
], ],
...@@ -228,7 +229,7 @@ export const setPriceSchema: ISchema = { ...@@ -228,7 +229,7 @@ export const setPriceSchema: ISchema = {
"type": "object", "type": "object",
"x-component": "tabpane", "x-component": "tabpane",
"x-component-props": { "x-component-props": {
"tab": "价格设置" "tab": getIntl().formatMessage({id: 'priceManage.schema.setPriceSchema.tab-2'})
}, },
"properties": { "properties": {
MEGA_LAYOUT2: { MEGA_LAYOUT2: {
...@@ -260,7 +261,7 @@ export const setPriceSchema: ISchema = { ...@@ -260,7 +261,7 @@ export const setPriceSchema: ISchema = {
type: 'object', type: 'object',
"x-component": 'tabpane', "x-component": 'tabpane',
"x-component-props": { "x-component-props": {
"tab": "适用会员" "tab": getIntl().formatMessage({id: 'priceManage.schema.setPriceSchema.tab-3'})
}, },
properties: { properties: {
MEGA_LAYOUT3: { MEGA_LAYOUT3: {
...@@ -302,7 +303,7 @@ export const setPriceSchema: ISchema = { ...@@ -302,7 +303,7 @@ export const setPriceSchema: ISchema = {
type: 'string', type: 'string',
'x-component': 'ModalSearch', 'x-component': 'ModalSearch',
'x-component-props': { 'x-component-props': {
placeholder: '请输入会员名字', placeholder: getIntl().formatMessage({id: 'priceManage.schema.formSearch.name'}),
align: 'flex-left', align: 'flex-left',
advanced: false, advanced: false,
}, },
...@@ -328,7 +329,7 @@ export const setPriceSchema: ISchema = { ...@@ -328,7 +329,7 @@ export const setPriceSchema: ISchema = {
span: 1 span: 1
}, },
"x-component-props": { "x-component-props": {
children: '查询', children: getIntl().formatMessage({id: 'priceManage.schema.formSearch.submit'}),
} }
} }
} }
...@@ -342,7 +343,7 @@ export const formProduct: ISchema = { ...@@ -342,7 +343,7 @@ export const formProduct: ISchema = {
type: 'string', type: 'string',
'x-component': 'ModalSearch', 'x-component': 'ModalSearch',
'x-component-props': { 'x-component-props': {
placeholder: '请输入商品编号/名称', placeholder: getIntl().formatMessage({id: 'priceManage.schema.formProduct.submit'}),
align: 'flex-left', align: 'flex-left',
}, },
}, },
...@@ -365,7 +366,7 @@ export const formProduct: ISchema = { ...@@ -365,7 +366,7 @@ export const formProduct: ISchema = {
type: 'string', type: 'string',
'x-component': 'CustomCategorySearch', 'x-component': 'CustomCategorySearch',
'x-component-props': { 'x-component-props': {
placeholder: '商品品类', placeholder: getIntl().formatMessage({id: 'priceManage.schema.formProduct.customerCategoryId'}),
showSearch: true, showSearch: true,
notFoundContent: null, notFoundContent: null,
style: { width: '174px' }, style: { width: '174px' },
...@@ -377,7 +378,7 @@ export const formProduct: ISchema = { ...@@ -377,7 +378,7 @@ export const formProduct: ISchema = {
type: 'string', type: 'string',
"x-component": 'SearchSelect', "x-component": 'SearchSelect',
"x-component-props": { "x-component-props": {
placeholder: '请选择品牌', placeholder: getIntl().formatMessage({id: 'priceManage.schema.formProduct.brandId'}),
fetchSearch: getProductSelectGetSelectBrand, fetchSearch: getProductSelectGetSelectBrand,
style: { style: {
width: 160 width: 160
...@@ -390,7 +391,7 @@ export const formProduct: ISchema = { ...@@ -390,7 +391,7 @@ export const formProduct: ISchema = {
span: 1 span: 1
}, },
"x-component-props": { "x-component-props": {
children: '查询' children: getIntl().formatMessage({id: 'priceManage.schema.formProduct.submit'})
} }
} }
} }
......
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