Commit 07588db3 authored by 前端-彭佳文's avatar 前端-彭佳文

Merge branch 'v2-220418-order' into 'v2-220418'

V2 220418 order See merge request linkseeks-design/pro-platform!161
parents 0118ec50 9046abe8
......@@ -28,6 +28,8 @@
.vscode
config/base.config.json
config/base.router.ts
# 各开发成员如非必要修改到里面初始化路由配置,请勿随意提交
config/routes/index.ts
src/global/config/global.d.ts
src/global/config/navigation.config.ts
......
......@@ -17,7 +17,7 @@ import MemberRoute from './memberRoute' // 会员能力路由
// import DealAbilityRoute from './dealAbilityRoute'; //
// import marketingRoute from './marketingRoute';
// import BalancedRoute from './balanceRoute';
// import OrderRoute from './orderRoute'; // 订单能力
import OrderRoute from './orderRoute'; // 订单能力
import asyncRoutes from '../router.config.json';
// import ProcurementRoute from './procurementRoute'; // todo wuting
import MaterialRoute from './materialRoute';
......@@ -35,7 +35,7 @@ const homeRoute = {
key: 'home',
component: '@/pages/home',
};
const routes = isDev ? [ homeRoute, MaterialRoute ] : asyncRoutes;
const routes = isDev ? [ homeRoute, OrderRoute ] : asyncRoutes;
// const routes = isDev ? [ CommodityRoute ] : asyncRoutes;
const memberCenterRoute = {
......
......@@ -31,6 +31,22 @@ const DeliveryPlanManagement = [
component: '@/pages/order/deliveryPlanManagement/deliveryPlanAwaitSRM'
},
{
/** 待提交送货计划 SRM 新增*/
path: '/memberCenter/order/deliveryPlanManagement/awaitSRM/create',
name: '待提交送货计划(SRM)新增',
component: '@/pages/order/deliveryPlanManagement/deliveryPlanAwaitSRM/create',
hideInMenu: true,
noMargin: true,
},
{
/** 待提交送货计划 SRM 修改*/
path: '/memberCenter/order/deliveryPlanManagement/awaitSRM/update',
name: '待提交送货计划(SRM)修改',
component: '@/pages/order/deliveryPlanManagement/deliveryPlanAwaitSRM/update',
hideInMenu: true,
noMargin: true,
},
{
/** 待提交送货计划 SRM 详情*/
path: '/memberCenter/order/deliveryPlanManagement/awaitSRM/details',
name: '待提交送货计划(SRM)详情',
......
......@@ -54,6 +54,9 @@ export const ConfirmDeliveryNotice = '确认送货通知单';
export const DeliveryPlanText = '送货计划'
export const DeliveryPlanRemark = '最长600个字符,300个汉字'
export const CreateDeliveryPlanTitleSRM = '新增送货计划(SRM)'
export const CreateDeliveryPlanTitleB2B = '新增送货计划(B2B)'
......
......@@ -74,7 +74,7 @@ const DeliveryPlanAwaitB2BDetails: React.FC = () => {
const [selectedDate, setSelectedDate] = useState<Array<string>>([])
// 选中 会员信息
const [selectedMember, setSelectedMember] = useState<any>({})
//
// 计划送货商品 列表
const [goodsTableData, setGoodsTableData] = useState<any>(null)
const [details, setDetails] = useState<any>({})
......@@ -130,9 +130,9 @@ const DeliveryPlanAwaitB2BDetails: React.FC = () => {
const dates = getDayAll(startDate, endDate)
datesRef.current = dates
setSelectedDate([startDate, endDate])
const datesColumn = dates.map((item, i) => ({ title: item.substr(2), dataIndex: item, key: item, width: 120, align: 'center', }))
const datesColumn = dates.map((item, i) => ({ title: item.substr(1), dataIndex: item, key: item, width: 120, align: 'center', }))
const datesExpandIconColumn = dates.map((item, i) => ({
title: item.substr(2),
title: item.substr(1),
dataIndex: item,
key: item,
width: 80,
......
......@@ -4,6 +4,7 @@
* @description: 与B2B内容大致相同,文件分开方便后续对接以及日后变动修改二开
*/
import React, { useRef } from 'react'
import { history } from 'umi'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { Button, Card, Space, Tag } from 'antd'
import { PlusOutlined } from '@ant-design/icons'
......@@ -16,25 +17,24 @@ import { createFormActions } from '@formily/antd'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { deliveryPlanManagementAwaitSRMSchema } from './schema'
import { godBtoa, TagStatus } from '../../utils'
import { ExternalStateColumn, OperationColumn, PlannedEndDateColumn, PlannedStartDateColumn, PlanNumberColumn, PlanSummaryColumn, SupplyMemberColumn } from '../../constants/table-column'
import { getOrderDeliveryPlanBuyerPage } from '@/services/OrderNewV2Api'
import moment from 'moment'
const tagStatusColor = {
// 待提交
2: { color: '#f4f5f7', fontColor: '#5c626a' },
// 待确认
3: { color: '#ecf2fe', fontColor: '#4787f0' },
// 待修改
4: { color: '#eae6ff', fontColor: '#9963d8' },
// 已确认
5: { color: '#ebf9f6', fontColor: '#00a98f' }
}
// 外部状态1-待提交 2-已确认
const STATUS = 2
// 订单类型1-B2B 2-SRM
const OEDER_TYPE = 2
const tagStatus = new TagStatus()
const statusTxt = new Map([[1, '待提交'], [2, '待确认'], [3, '待修订'],[4,'已确认'],[5,'已删除']])
const DeliveryPlanManagementAwaitSRM: React.FC = () => {
const ref = useRef<any>({})
const formActions = createFormActions()
const controllerBtns = (
<Space>
<Button type='primary' icon={<PlusOutlined/>}>新增</Button>
<Button type='primary' icon={<PlusOutlined/>} onClick={() => history.push(`/memberCenter/order/deliveryPlanManagement/awaitSRM/create`)}>新增</Button>
</Space>
)
const renderOptionButton = (record: any) => {
......@@ -45,17 +45,18 @@ const tagStatusColor = {
'查看': 'DevTest',
}
const buttonGroup = {
'提交': true,
'修改': true,
'删除': true,
'提交': record.status <= 1,
'修改': record.status >= 1,
'删除': record.status <= 1,
'查看': true,
}
const operationHandler = {
'提交': () => { console.log('提交 :>> ',) },
'修改': () => { console.log('修改 :>> ',) },
'修改': () => history.push(`/memberCenter/order/deliveryPlanManagement/awaitSRM/update?i=${godBtoa(record.id)}`),
'删除': () => { console.log('删除 :>> ',) },
'查看': () => { console.log('查看 :>> ',) },
'查看': () => history.push(`/memberCenter/order/deliveryPlanManagement/awaitSRM/details?i=${godBtoa(record.id)}`),
}
return (
<TableOperation
buttonTextFieldMap={buttonGroup}
......@@ -66,48 +67,47 @@ const tagStatusColor = {
}
const columns: ColumnType<unknown>[] = [
{
title: '计划编号',
dataIndex: 'id',
key: 'id',
width: 160,
render: (text: unknown, record: unknown) => <EyePreview url='/memberCenter/order/deliveryPlanManagement/awaitSRM/details'>{text}</EyePreview>
...PlanNumberColumn,
dataIndex: 'planNo',
key: 'planNo',
// width: 160,
render: (text: unknown, record: any) => <EyePreview url={`/memberCenter/order/deliveryPlanManagement/awaitSRM/details?i=${godBtoa(record.id)}`}>{text}</EyePreview>
},
{ title: '计划摘要', dataIndex: 'id2', key: 'id2' },
{ title: '计划开始日期', dataIndex: 'id3', key: 'id3' },
{ title: '计划结束日期', dataIndex: 'id4', key: 'id4' },
{ title: '供应会员', dataIndex: 'id5', key: 'id5' },
{ ...PlanSummaryColumn, dataIndex: 'digest', key: 'digest' },
{ ...PlannedStartDateColumn, dataIndex: 'planStartTime', key: 'planStartTime', render: (text: string, record: any) => (moment(text).format('YYYY-MM-DD')) },
{ ...PlannedEndDateColumn, dataIndex: 'planEndTime', key: 'planEndTime', render: (text: string, record: any) => (moment(text).format('YYYY-MM-DD')) },
{ ...SupplyMemberColumn, dataIndex: 'memberName', key: 'memberName' },
{
title: '外部状态',
dataIndex: 'id6',
key: 'id6',
render: (text: string, record: any) => (
<Tag color={tagStatusColor[record.id]?.color}>
<span style={{ color: tagStatusColor[record.id]?.fontColor }}>{text}</span>
</Tag>
)
...ExternalStateColumn,
dataIndex: 'status',
key: 'status',
render: (text: string, record: any) => {
const sytle = tagStatus.getTagStyle(record.status);
return (
<Tag color={sytle.bgColor}>
<span style={{ color: sytle.fontColor }}>{statusTxt.get(record.status)}</span>
</Tag>
)
}
},
{
title: '操作',
...OperationColumn,
dataIndex: '',
key: 'x',
key: '',
align: 'center',
render: (record) => renderOptionButton(record)
},
]
const fetchData = (params: unknown) => {
console.log('params :>> ', params);
const fetchData = (params: any) => {
return new Promise((resolve) => {
const data = {
totalCount: 1, data: [
{ id: 1, id2: 2, id3: 3, id4: 4, id5: 5, id6: 6 },
{ id: 2, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
{ id: 3, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
{ id: 4, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 },
{ id: 5, id2: 3, id3: 4, id4: 5, id5: 6, id6: 7 }
]
}
resolve(data)
getOrderDeliveryPlanBuyerPage({
...params,
status: STATUS,
orderType: OEDER_TYPE,
}).then((res) => {
resolve(res.data);
})
})
}
......
// 公共组装类工具
/**
* 数组转对象 默认赋值 0 (示例:['$04-01','$04-02'] = { '$04-01': {}, '$04-02': {} })
* 数组转对象 默认赋值 0
* - 原数组: ['$04-01','$04-02']
* - 转换后: { '$04-01': {}, '$04-02': {} }
* @param arr
* @returns
*/
const convertArrtoObj = (arr) => {
return arr.reduce((obj,currVal) => {
return{
...obj,
return arr.reduce((obj, currVal) => {
return {
...obj,
[currVal]: { day: currVal.substr(1), planCount: 0, createNotice: false, createDelivery: false }
}
}, {})
}, {})
}
/**
* 整合对象成所需使用格式
* - 原对象: { 04-01: 20, 04-02: 30 }
* - 整合后: { $04-01: 20, $04-02: 30 }
* @param obj
* @returns
*/
const integrationOjb = (obj) => {
return Object.keys(obj).reduce((prev, currVal) => {
return {
...prev,
[`$${currVal}`]: obj[currVal]
}
},{})
}
/**
* 整合数组成所需使用格式对象
* - 原数组: [{ day: '04-01', planCount: 0, createNotice: false, createDelivery: false }]
* - 整合后: { $04-01: { day: '04-01', planCount: 0, createNotice: false, createDelivery: false }}
* @param arr
* @returns
*/
const integrationArrtoObj = (arr) => {
return arr.reduce((obj, currVal, idx) => {
return {
...obj,
[`$${currVal.day}`]: arr[idx]
}
}, {})
}
// -用于浏览器url参数传递或其他传递参数做一次编译,忽悠一下门外汉,称之为 神 函数,没试过大数据量测试(关键点: 涉及url带参限制),id, name, phone等私密信息等可使用
/**
* 比较无聊的工具类 神-加密
* @param str
* @returns
*/
const godBtoa = (str: string) => {
return str ? window.btoa(encodeURIComponent(str)) : str
}
/**
* 比较无聊的工具类 神-解密
* @param str
* @returns
*/
const godAtob = (str: string) => {
return str ? decodeURIComponent(window.atob(str)) : str
}
export {
convertArrtoObj
convertArrtoObj,
integrationOjb,
integrationArrtoObj,
godBtoa,
godAtob,
}
\ No newline at end of file
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