Commit df76b62b authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

Merge branch 'v2-220318' of http://10.0.0.22:3000/lingxi/lingxi-business-paltform into v2-220318

parents 8c56bf1a 7e38d25c
......@@ -270,4 +270,7 @@
'editor.shopfloorline.goods': 'Product Recommendation Settings',
'editor.shopfloorline.category': 'Classification Recommendation Settings',
'editor.mainnav.title': 'Navigation bar editor',
'editor.cateogry.show.title': 'Whether to show recommended categories',
'editor.cateogry.show.yes': 'Yes',
'editor.cateogry.show.no': 'No',
}
......@@ -270,5 +270,8 @@ export default {
'editor.shopfloorline.goods': '상품 추천 설정',
'editor.shopfloorline.category': '분류 권장 설정',
'editor.mainnav.title': '탐색 모음 편집기',
'editor.cateogry.show.title': '추천 카테고리 표시 여부',
'editor.cateogry.show.yes': '예',
'editor.cateogry.show.no': '아니요',
}
......@@ -270,5 +270,8 @@ export default {
'editor.shopfloorline.goods': '商品推荐设置',
'editor.shopfloorline.category': '分类推荐设置',
'editor.mainnav.title': '导航栏编辑',
'editor.cateogry.show.title': '是否展示推荐分类',
'editor.cateogry.show.yes': '是',
'editor.cateogry.show.no': '否',
}
......@@ -45,7 +45,7 @@ const common_columns: any = [
}
},
{ title: getIntl().formatMessage({ id: 'balance.settleRules.memberSettle.info.commonColumns.memberTypeName' }), dataIndex: 'memberTypeName' },
{ title: getIntl().formatMessage({ id: 'balance.settleRules.memberSettle.info.commonColumns.roleName' }), dataIndex: 'roleName' },
// { title: getIntl().formatMessage({ id: 'balance.settleRules.memberSettle.info.commonColumns.roleName' }), dataIndex: 'roleName' },
{
title: getIntl().formatMessage({ id: 'balance.settleRules.memberSettle.info.commonColumns.levelTag' }),
dataIndex: 'levelTag',
......@@ -208,7 +208,7 @@ const Info = () => {
roleId: item.roleId,
memberName: item.name,
memberTypeName: item.memberTypeName,
roleName: item.roleName,
// roleName: item.roleName,
levelName: item.levelTag,
}
));
......
/*
* @Author: Bill
* @Date: 2020-10-19 16:54:15
* @Description: 新建会员策略支付策略
*/
import React, { useEffect, useState } from 'react';
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import NiceForm from '@/components/NiceForm';
import { Card, Button, message } from 'antd';
import { createFormActions } from '@formily/antd';
import { PlusOutlined } from '@ant-design/icons'
import ModalTable from '@/components/ModalTable';
import SearchSelect from '@/components/NiceForm/components/SearchSelect'
import Search from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { addSchema, memberSchema } from './schema';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncSelect } from '@/formSchema/effects/useAsyncSelect';
import SettleMethod from '../../components/SettleMethod';
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable';
import { usePageStatus } from '@/hooks/usePageStatus';
import { history, Prompt, useIntl, getIntl } from 'umi'
import { fetchOptions } from '../../common';
import {
getSettleAccountsCommonGetStrategySettlementOrderType,
getSettleAccountsPlatformConfigGetMemberSettlementStrategyDetail,
getSettleAccountsPlatformSettlementTypeList,
postSettleAccountsPlatformConfigAddMemberSettlementStrategy,
postSettleAccountsPlatformConfigUpdateMemberSettlementStrategy
} from '@/services/SettleV2Api';
import { getMemberManageLowerPageBynamerole, getMemberManageRoleSubList, getMemberManageUpperPage } from '@/services/MemberV2Api';
import { getManageRuleConfigurationList } from '@/services/ManageV2Api';
import { getOrderPlatformSettlementCategoryList, getOrderPlatformSettlementTypeList } from '@/services/OrderNewV2Api';
const formActions = createFormActions();
const common_columns: any = [
{ title: getIntl().formatMessage({ id: 'balance.settleRules.memberSettle.info.commonColumns.memberId' }), dataIndex: 'memberId' },
{
title: getIntl().formatMessage({ id: 'balance.settleRules.memberSettle.info.commonColumns.name' }),
dataIndex: 'name',
render: (text: string, record: any) => {
return record.name || record.memberName
}
},
{ title: getIntl().formatMessage({ id: 'balance.settleRules.memberSettle.info.commonColumns.memberTypeName' }), dataIndex: 'memberTypeName' },
{ title: getIntl().formatMessage({ id: 'balance.settleRules.memberSettle.info.commonColumns.roleName' }), dataIndex: 'roleName' },
{
title: getIntl().formatMessage({ id: 'balance.settleRules.memberSettle.info.commonColumns.levelTag' }),
dataIndex: 'levelTag',
render: (text: string, record: any) => {
return record.levelTag || record.levelName
}
},
]
const MemberSettleAdd: React.FC = () => {
const intl = useIntl();
const [visible, setVisible] = useState(false)
const [memberRowSelection, memberRowCtl] = useRowSelectionTable({ customKey: 'uniqueId' });
const [initialValue, setInitialValue] = useState({});
const { id, preview } = usePageStatus();
const [submitLoading, setSubmitLoading] = useState(false);
const [unsaved, setUnsaved] = useState(true);
const isAdd = !id && !preview;
const isEdit = history.location.pathname.includes("edit");
const tableAddButton = () => {
return (
<div>
{
isAdd || isEdit
? <Button
onClick={handleVisible}
style={{ marginBottom: 16 }}
block
icon={<PlusOutlined />}
type='dashed'
>
{intl.formatMessage({ id: 'balance.settleRules.memberSettle.info.tableAddButton' })}
</Button>
: null
}
</div>
)
}
const columns = common_columns.concat(
isAdd || isEdit
? [
{
title: intl.formatMessage({ id: 'balance.settleRules.memberSettle.info.columns.operation' }),
render: (text, record) => {
return (
<a onClick={() => handleRemove(record.uniqueId)}>{intl.formatMessage({ id: 'balance.settleRules.memberSettle.info.columns.operation.button' })}</a>
)
}
}
]
: []
);
const handleVisible = () => {
setVisible(true);
}
const handleCancelAddMember = () => {
setVisible(false);
}
// 从PAAS平台--规则配置--平台规则配置取已勾选的结算方式决定是否显示结算方式
const fetchBalancedMethods = async () => {
const { data, code } = await getOrderPlatformSettlementCategoryList();
// const length = data.length
let config = {
days: false,
month: false,
}
if (code !== 1000) {
return config
}
const codeToMap = ["", "days", "month"]
data.forEach((_item) => {
config[codeToMap[_item.methodCode]] = true
})
return config
}
// 获取适用会员
const fetchMemberData = async (params: any) => {
console.log(params);
// 如果单据类型是订单,获取当前会员的上级会员,如果是生产通知单和物流单那么获取他的下级
const isOrderType = formActions.getFieldValue('Tabs.basicTab.layout.settlementOrderType') === 3;
const service = isOrderType ? getMemberManageUpperPage : getMemberManageLowerPageBynamerole
const { data } = await service(params);
return {
...data,
data: data.data.map((v) => ({ ...v, uniqueId: v.memberId + "_" + v.roleId })),
totalCount: data.totalCount
}
}
// 获取适用会员下拉搜索框
const fetchMemberSearchFilter = async () => {
// /member/manage/role/sub/list
const { data } = await getMemberManageRoleSubList({}, { method: 'GET', ctlType: "none" });
// console.log(data);
return data
}
// 使用会员弹框确认
const handleOkAddMember = () => {
formActions.setFieldValue('Tabs.memberTab.someLists', memberRowCtl.selectRow);
setVisible(false);
}
// 提交
const handleSubmit = async (value) => {
const memberList = value.someLists.map((item) => (
{
memberId: item.memberId,
roleId: item.roleId,
memberName: item.name,
memberTypeName: item.memberTypeName,
roleName: item.roleName,
levelName: item.levelTag,
}
));
const tempData = {
name: value.name,
settlementOrderType: value.settlementOrderType,
memberList: memberList,
settlementWay: value.settlementWay.active,
settlementDays: value.settlementWay.otherValues[0],
settlementDate: value.settlementWay.otherValues[1],
settlementPaymentType: value.settlementPaymentType,
}
const serviceActions = isAdd
? postSettleAccountsPlatformConfigAddMemberSettlementStrategy
: postSettleAccountsPlatformConfigUpdateMemberSettlementStrategy
let postData: any = tempData;
if (!isAdd) {
postData = { ...postData, id: id };
}
try {
setSubmitLoading(true);
setUnsaved(false);
const { data, code, message: msg } = await serviceActions(postData, { ctlType: 'none' });
if (code !== 1000) {
message.error(msg);
return;
}
history.push('/memberCenter/balance/settleRules/memberSettleList')
} finally {
setSubmitLoading(false);
}
}
// 提交
const handleClick = () => {
formActions.submit()
}
//
const handleRemove = (id: number) => {
const string = 'Tabs.memberTab.someLists';
const chooseList = formActions.getFieldValue(string);
const res = chooseList.filter((item) => item.uniqueId !== id);
formActions.setFieldValue(string, res);
// 必须设置key
memberRowCtl.setSelectRow(res);
memberRowCtl.setSelectedRowKeys(res.map((item) => item.uniqueId))
}
// 从PAAS平台--规则配置--平台规则配置取已勾选的结算方式决定是否显示结算方式
useEffect(() => {
fetchBalancedMethods().then(data => {
formActions.setFieldState('Tabs.basicTab.layout.settlementWay', (state) => {
state.props['x-component-props']['options'] = data;
})
})
}, [])
/**
* 进入详情页之后,初始化数据
*/
useEffect(() => {
if (id) {
async function getInfo() {
const res = await getSettleAccountsPlatformConfigGetMemberSettlementStrategyDetail({ id })
if (res.code === 1000) {
setInitialValue({
name: res.data.name,
settlementOrderType: res.data.settlementOrderType.toString(),
memberList: res.data.memberList,
settlementWay: {
active: res.data.settlementWay,
otherValues: [res.data.settlementDays, res.data.settlementDate],
},
settlementPaymentType: res.data.settlementPaymentType,
})
const list = res.data.memberList.map((item) => ({
...item,
uniqueId: item.memberId + "_" + item.roleId,
name: item.memberName,
levelTag: item.levelName,
}))
formActions.setFieldValue('Tabs.memberTab.someLists', list);
// 必须设置key
memberRowCtl.setSelectRow(list);
memberRowCtl.setSelectedRowKeys(res.data.memberList.map((item) => item.memberId + "_" + item.roleId))
} else {
message.error({ content: res.message })
}
}
getInfo();
}
}, [])
const fetchPaymentType = async () => {
const { data, code } = await getSettleAccountsPlatformSettlementTypeList();
if (code === 1000) {
return data.map((_item) => ({value: _item.methodCode, label: _item.methodName}))
}
return []
}
return (
<PageHeaderWrapper
onBack={() => window.history.back()}
extra={
(
<Button loading={submitLoading} key="1" type="primary" onClick={handleClick} style={{ display: isAdd || isEdit ? 'block' : 'none' }}>
{intl.formatMessage({ id: 'balance.settleRules.memberSettle.info.extra' })}
</Button>
)
}
>
<Card>
<NiceForm
editable={isAdd || isEdit}
actions={formActions}
initialValues={initialValue}
expressionScope={{
tableAddButton: tableAddButton(),
tableColumns: columns
}}
components={{ SettleMethod }}
onSubmit={values => handleSubmit(values)}
schema={addSchema}
effects={() => {
useAsyncSelect(
"settlementOrderType",
fetchOptions(getSettleAccountsCommonGetStrategySettlementOrderType)
),
useAsyncSelect(
"settlementPaymentType",
fetchPaymentType
)
}}
/>
<ModalTable
modalTitle={intl.formatMessage({ id: 'balance.settleRules.memberSettle.info.modalTitle' })}
confirm={handleOkAddMember}
cancel={handleCancelAddMember}
forceRender
visible={visible}
columns={common_columns}
rowSelection={memberRowSelection}
fetchTableData={params => fetchMemberData(params)}
tableProps={{
rowKey: 'uniqueId',
}}
formilyProps={
{
ctx: {
schema: memberSchema,
actions: formActions,
components: { ModalSearch: Search, SearchSelect, Submit },
effects: ($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
)
useAsyncSelect(
'roleId',
fetchMemberSearchFilter,
['roleName', 'roleId']
)
}
}
}
}
/>
</Card>
<Prompt when={unsaved && (isAdd || isEdit)} message={intl.formatMessage({ id: 'balance.settleRules.memberSettle.info.prompt' })} />
</PageHeaderWrapper>
)
}
export default MemberSettleAdd
......@@ -312,7 +312,8 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
......@@ -253,7 +253,8 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
......@@ -228,7 +228,7 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
for (const item of firstCategory) {
if (item.categoryId ){
const categoryDetail: any = await fetchCategoryById(item.categoryId)
if (categoryDetail?.isShow !== 1) return
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
......@@ -249,7 +249,8 @@ const OwnMallEdit: React.FC<ShopEditPropsType> = (props) => {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
import React, { useState, useEffect, useCallback } from 'react'
import { Checkbox, Row, Col, message, Modal } from 'antd'
import { Checkbox, Row, Col, message, Modal, Radio } from 'antd'
import { useIntl } from 'umi'
import UploadImage from '@/components/UploadImage'
import SettingPanel from '../../../../components/SettingPanel'
......@@ -20,16 +20,26 @@ interface CategoryRecommendSettingPropsType {
categoryid?: number;
templateType: 'channel' | 'shop' | 'own',
shopId: number,
isShow: number
}
const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (props) => {
const { categoryList = [], categoryAdvertPicUrl = '', shopId, onChange, templateid, categoryid, templateType } = props
const { categoryList = [], categoryAdvertPicUrl = '', shopId, isShow, templateid, categoryid, templateType } = props
const [imgUrl, setImgUrl] = useState<string>(categoryAdvertPicUrl)
const [selectKeys, setSelectKeys] = useState<number[]>([])
const [categoryResponseList, setCategoryResponseList] = useState<any>([])
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [newProps, setNewProps] = useState(props)
const intl = useIntl()
const [showState, setShowState] = useState<number>(1)
useEffect(() => {
if (isShow) {
setShowState(1)
} else {
setShowState(0)
}
}, [isShow])
const changeNewProps = (key: string, data: any) => {
const result = { ...newProps }
......@@ -119,7 +129,8 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
templateId: templateid,
categoryId: categoryid,
categoryAdvertPicUrl,
twoCategoryIds: selectKeys
twoCategoryIds: selectKeys,
isShow: showState
}
let postFn;
if (templateType === 'channel') {
......@@ -157,6 +168,11 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
}
}, [newProps])
const options = [
{ label: intl.formatMessage({ id: 'editor.cateogry.show.yes' }), value: 1 },
{ label: intl.formatMessage({ id: 'editor.cateogry.show.no' }), value: 0 },
];
return (
<SettingPanel
confirmLoading={confirmLoading}
......@@ -165,6 +181,15 @@ const CategoryRecommendSetting: React.FC<CategoryRecommendSettingPropsType> = (p
>
<div className={styles.category_recommend}>
<div className={styles.category_recommend_title}>
<span>{intl.formatMessage({ id: 'editor.cateogry.show.title' })}</span>
</div>
<div className={styles.category_recommend_body}>
<Radio.Group options={options} value={showState} onChange={(e) => {
changeNewProps('isShow', e.target.value);
setShowState(e.target.value)
}} />
</div>
<div className={styles.category_recommend_title}>
<span>{intl.formatMessage({ id: 'editor.setting.category.first.title' })}</span>
</div>
<div className={styles.category_recommend_body}>
......
......@@ -203,7 +203,8 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
......@@ -291,7 +291,7 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
for (const item of firstCategory) {
if(item.categoryId) {
const categoryDetail: any = await fetchCategoryById(item.categoryId)
if (categoryDetail?.isShow !== 1) return
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
......@@ -312,7 +312,8 @@ const ChannelPreview: React.FC<ChannelPreviewPropsType> = (props) => {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
linkdisable: true,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
......@@ -181,7 +181,7 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
for (const item of firstCategory) {
if (item.categoryId ){
const categoryDetail: any = await fetchCategoryById(item.categoryId)
if (categoryDetail?.isShow !== 1) return
let floorLineConfigItem = {}
floorLineKeys.push(String(initIndex + 1))
......@@ -201,7 +201,8 @@ const ShopEdit: React.FC<ShopEditPropsType> = (props) => {
"props": {
categoryAdvertPicUrl: categoryDetail.categoryAdvertPicUrl,
categoryid: item.categoryId,
categoryList: categoryDetail.categoryBOList
categoryList: categoryDetail.categoryBOList,
isShow: categoryDetail?.isShow
},
},
}
......
......@@ -120,9 +120,9 @@ export const OVERLAYACTIVITYTYPE = (int) => {
{ label: `${intl.formatMessage({ id: 'selfManagement.quotaPromotion' })}`, value: ACTIVITY_TYPE_5 },
],
C: [
{ label: `${intl.formatMessage({ id: 'selfManagement.moreThanAPromotion' })}`, value: ACTIVITY_TYPE_6 },
{ label: `${intl.formatMessage({ id: 'selfManagement.combinationOfPromotion' })}`, value: ACTIVITY_TYPE_7 },
{ label: `${intl.formatMessage({ id: 'selfManagement.buy' })}`, value: ACTIVITY_TYPE_8 },
{ label: `${intl.formatMessage({ id: 'selfManagement.giftPromotion' })}`, value: ACTIVITY_TYPE_6 },
{ label: `${intl.formatMessage({ id: 'selfManagement.moreThanAPromotion' })}`, value: ACTIVITY_TYPE_7 },
{ label: `${intl.formatMessage({ id: 'selfManagement.combinationOfPromotion' })}`, value: ACTIVITY_TYPE_8 },
],
}
}
......
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