Commit 7a07d622 authored by 前端-李俊鑫's avatar 前端-李俊鑫
parents 83b265b8 1c4b5a78
......@@ -61,9 +61,9 @@
"@formily/antd": "^1.3.3",
"@formily/antd-components": "^1.3.3",
"@lingxi-disign/core": "^1.0.6",
"@lingxi-disign/react": "^1.0.6",
"@lingxi-disign/react": "^1.0.7",
"@lingxi-disign/react-web": "^1.0.2",
"@lingxi-disign/ui": "^1.0.5",
"@lingxi-disign/ui": "^1.0.6",
"@turf/turf": "^6.4.0",
"@types/crypto-js": "^4.0.1",
"@types/js-cookie": "^2.2.6",
......
......@@ -10,6 +10,8 @@ import {
ORDER_TYPE_INQUIRY_CONTRACT,
ORDER_TYPE_BIDDING_CONTRACT,
ORDER_TYPE_TENDER_CONTRACT,
ORDER_TYPE_POINTS,
ORDER_TYPE_CHANNEL_POINTS,
} from '@/constants/order';
// 供应会员列表列
......@@ -78,10 +80,11 @@ const supplierSchema: ISchema = {
},
};
// 过滤积分订单,渠道积分订单
const orderTypeArr = GlobalConfig.web.orderType.map((item) => ({
label: item.platformWayName,
value: item.id,
}));
})).filter((item) => (item.value !== ORDER_TYPE_POINTS && item.value !== ORDER_TYPE_CHANNEL_POINTS));
export const addSchema = (orderType: number): ISchema => {
const isMateriel = (
......
......@@ -307,7 +307,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
title: planPrice===3?'积分(副单位)':'单价(副单位)',
dataIndex: '副单价',
key: '副单价',
width: 200,
render: (text, record) => {
const assistPrice = _tableDataSource[record['索引']]["副单价"]
if(assistPrice && Array.isArray(assistPrice)) {
......
......@@ -177,6 +177,14 @@ const viewProducts: React.FC<{}> = () => {
})
}
})
_col.push({
title: product?.planPrice===3?'积分(副单位)':'单价(副单位)',
dataIndex: '副单价',
key: '副单价',
render: (text) => {
return product?.planPrice===3 ? text : `¥${text}`
}
})
setTableColumns(_col)
......@@ -184,7 +192,7 @@ const viewProducts: React.FC<{}> = () => {
let _tableData: any[] = []
let _attributeArrByImageRender: any[] = []
let _imageArrByImageRender: any[] = []
_tableData = unitPriceAndPicList.map((item, index) => {
_tableData = unitPriceAndPicList.map((item: any, index: number) => {
_imageArrByImageRender.push(item.commodityPic)
let attrArrayWithObj = item.attributeAndValueList.map(_item=>{
let _temp = {}
......@@ -196,12 +204,19 @@ const viewProducts: React.FC<{}> = () => {
attrWithObj = {...attrWithObj, ...t}
}
_attributeArrByImageRender.push(attrWithObj)
const _price = orderlyLadderPrice(item.unitPrice)
const _priceRate = item.priceRate
const _priceNumber = Object.keys(_price)[0] === '0-0' ? Object.values(_price)[0] : Object.values(_price)
let temp = {
"索引": index,
"商品名称": product.name,
"对应货品": item.goods?.code+'/'+item.goods?.name+'/'+item.goods?.type,
...attrWithObj,
"单价": orderlyLadderPrice(item.unitPrice),
"单价": _price,
'副单价率': _priceRate,
'副单价': Array.isArray(_priceNumber) ? _priceNumber.map(_p => (Number(_p) * Number(_priceRate) / 100).toFixed(2)) : (Number(_priceNumber) * Number(_priceRate) / 100).toFixed(2)
}
return temp
})
......
......@@ -60,22 +60,26 @@ const ChannelRedirectTypeList = [
},
{
value: 2,
label: '积分',
label: '分类',
},
{
value: 3,
label: '资讯',
label: '积分',
},
{
value: 4,
label: '消息',
label: '资讯',
},
{
value: 5,
label: '进货单',
label: '消息',
},
{
value: 6,
label: '进货单',
},
{
value: 7,
label: '我的',
}
];
......
......@@ -337,7 +337,7 @@ const CardNavItem: React.FC<CardNavItemProps> = (props: CardNavItemProps) => {
const list = await getFirstCategoryList()
return {
type: LAYOUT_TYPE.own ? RedirectTypeList_Own : RedirectTypeList,
type: layoutType === LAYOUT_TYPE.own ? RedirectTypeList_Own : RedirectTypeList,
id: list,
channel: _getTypeList,
}
......
......@@ -58,6 +58,9 @@ export function useFilterSameOption() {
}
childNodes.forEach(_son => {
const sonData = pageConfig[_son];
if (!sonData) {
return;
}
const tempData = keyFunc[type]?.(sonData.props);
result[name].push(tempData.id);
});
......
......@@ -28,7 +28,9 @@ const template = {
},
},
childComponentName: 'SimpleCommodityList.Item',
props: {},
props: {
title: '秒杀'
},
childNodes: [],
otherProps: {
type: 'flashSale'
......@@ -44,7 +46,9 @@ const template = {
type: "saleRankingItem"
},
},
props: {},
props: {
title: '品类销量排行'
},
childNodes: [],
otherProps: {
type: 'saleRanking'
......@@ -198,7 +202,9 @@ const tabContent: PageConfigType = {
title: '秒杀',
addBtnText: '添加秒杀商品',
childComponentName: 'SimpleCommodityList.Item',
props: {},
props: {
title: '秒杀'
},
childNodes: ["6-2-1"]
},
"6-2-1": {
......@@ -215,7 +221,9 @@ const tabContent: PageConfigType = {
title: '品类销量排行',
addBtnText: '添加销量排行商品',
childComponentName: 'SimpleCommodityList.Item',
props: {},
props: {
title: '品类销量排行'
},
childNodes: ["6-3-1"]
},
"6-3-1": {
......
......@@ -81,6 +81,10 @@ const EditPanel = () => {
if (targetSchema) {
/** 这里需要处理一下FormVlaue */
const tempFormValue = {
tabItem: {
primary: selectedInfo?.props?.id,
title: selectedInfo?.props?.title,
},
secondaryItem: {
secondary: selectedInfo?.props?.id,
title: selectedInfo?.props?.name,
......@@ -133,7 +137,6 @@ const EditPanel = () => {
message.info("当前商品展示类型为自动排序,不能进行单个商品设置");
return;
}
console.log(tempFormValue[componentType])
setFormValue(tempFormValue[componentType]);
setSchema(targetSchema);
......@@ -231,7 +234,7 @@ const EditPanel = () => {
setVisible(false);
handleOnClose();
/** 这里reset 是为了修改自定义组件在mutator.change 之后无法setValue 的bug */
formActions.reset();
// formActions.reset();
};
......@@ -264,7 +267,6 @@ const EditPanel = () => {
const hasSelectedTabKeys = Object.keys(sameKeyState).filter((_item) => /tabItem_\d+$/.test(_item));
formActions.setFieldState('layout.primary', (state) => {
const tempData = state.originAsyncData || [];
console.log(state);
FormPath.setIn(state, 'props.enum', tempData.map((_item) => {
return {
// ..._item,
......@@ -291,13 +293,13 @@ const EditPanel = () => {
categoryId: activeKey!.toString(),
memberId: userAuth.memberId.toString(),
}
const postData = isSelfMall ? omit(common, 'memberId') : common
const postData = isSelfMall ? {...common, memberRoleId: userAuth.memberRoleId.toString()} : common
const { data, code } = await service(postData as any);
if (code === 1000) {
// const source = data.map((_item) => ({label: _item.name, value: _item.id}));
const source = data?.map((_item) => ({label: _item.name, value: _item.id, disabled: sameKeyState[`tabItem_${activeKey}_secondary`].includes(_item.id)} ));
const source = data?.map((_item) => ({label: _item.name, value: _item.id, disabled: sameKeyState[`tabItem_${activeKey}_secondary`].includes(_item.id)} )) || [];
console.log("source", source)
formActions.setFieldState('secondary', (state) => {
state.originAsyncData = source;
FormPath.setIn(state, 'props.enum', source);
......@@ -346,7 +348,7 @@ const EditPanel = () => {
</div>
<div className={styles.footer}>
<Space>
<Button>取消</Button>
<Button onClick={() => setVisible(false)}>取消</Button>
<Button type="primary" onClick={() => formActions.submit()}>确认</Button>
</Space>
</div>
......
......@@ -126,9 +126,9 @@ const CategoryNavigation = () => {
categoryAdornContent: postData as any,
});
setLoading(false);
if (code === 1000) {
history.goBack();
}
// if (code === 1000) {
// history.goBack();
// }
// const { data, code }
};
......
......@@ -11,7 +11,6 @@ import {
} from '@ant-design/icons'
import { Button, message, Tooltip, Input } from 'antd'
import NiceForm from '@/components/NiceForm'
import { GlobalConfig } from '@/global/config'
import { columnsUnitProduct, memberColumns } from '../../constant'
import { constructTableData, transformDataForNiceForm } from '../../effect'
import PriceModal from './priceModal'
......
......@@ -20,7 +20,7 @@ export const configSourceData: IConfigSource[] = [
description: '启用显示商品价格曲线。鼠标移到价格一栏时,显示当前规格商品的历史价格变化。',
icon: price_line,
type: 'commodity',
isSettting: false
isSettting: true
},
{
id: 2,
......@@ -28,7 +28,7 @@ export const configSourceData: IConfigSource[] = [
description: '启用自动确认收货。当发货后超过收货天数后未确认收货,系统默认收货。',
icon: auto_receive,
type: 'order',
isSettting: false
isSettting: true
},
{
id: 3,
......@@ -36,7 +36,7 @@ export const configSourceData: IConfigSource[] = [
description: '启用送货预约时长。可预约下单时间后可预约时长(天数)内送货。',
icon: forcast_time,
type: 'order',
isSettting: false
isSettting: true
},
{
id: 4,
......@@ -44,6 +44,6 @@ export const configSourceData: IConfigSource[] = [
description: '启用配送时间段。可选择配送时间段内的时间。',
icon: express_time,
type: 'order',
isSettting: false
isSettting: true
},
]
......@@ -2,8 +2,6 @@ import React, {useState, useEffect} from 'react';
import { Button, Row, Col, Switch, Drawer, Card, InputNumber, Form, Space, TimePicker } from 'antd';
import { PageHeaderWrapper } from '@ant-design/pro-layout';
import { PublicApi } from '@/services/api';
import { history } from 'umi';
import price_line from '@/assets/imgs/price_line.png';
import MellowCard from '@/components/MellowCard';
import cx from 'classnames'
import styles from './index.less'
......@@ -55,28 +53,30 @@ const ParameterSetting: React.FC<{}> = () => {
fn = PublicApi.getOrderParamGetDeliveryTime
}
fn && fn().then(res => {
const { data } = res
setShopLists(() => [...shopLists].map(item => {
const filterData = data.filter(_item => _item.shopId === item.shopId)
if(filterData.length) {
return {
...item,
...filterData[0],
paramList: expressTimeVisible ? filterData[0]['paramList'].map(param => {
return {
timeRange: [moment(param.startTime, 'HH:mm:ss'), moment(param.endTime, 'HH:mm:ss')]
}
}) : []
}
} else {
return {
...item,
days: null,
status: 0
const { code, data } = res
if(code === 1000) {
setShopLists(() => [...shopLists].map(item => {
const filterData = data.filter(_item => _item.shopId === item.shopId)
if(filterData.length) {
return {
...item,
...filterData[0],
paramList: expressTimeVisible ? filterData[0]['paramList'].map(param => {
return {
timeRange: [moment(param.startTime, 'HH:mm:ss'), moment(param.endTime, 'HH:mm:ss')]
}
}) : []
}
} else {
return {
...item,
days: null,
status: 0
}
}
}
}))
}))
}
})
}, [autoReceiveVisible, forcastTimeVisible, expressTimeVisible])
......@@ -102,14 +102,14 @@ const ParameterSetting: React.FC<{}> = () => {
})
}
const onChangeShowSetBtn = (value, index) => {
setConfigSource(() => {
return [...configSource].map(item => ({
...item,
isSettting: item.id === index ? value : item.isSettting
}))
})
}
// const onChangeShowSetBtn = (value, index) => {
// setConfigSource(() => {
// return [...configSource].map(item => ({
// ...item,
// isSettting: item.id === index ? value : item.isSettting
// }))
// })
// }
const onChangeReceiveStatus = (value, index) => {
setShopLists(() => [...shopLists].map(item => {
......@@ -146,10 +146,9 @@ const ParameterSetting: React.FC<{}> = () => {
paramList: values.deadLine?.length ? values.deadLine.map((v) => {
if(v?.timeRange) {
const time = v.timeRange
console.log(v.timeRange)
return {
startTime: moment(time[0]).format('HH:mm:ss'),
endTime: moment(time[1]).format('HH:mm:ss')
startTime: moment(time[0]).format('HH:mm'),
endTime: moment(time[1]).format('HH:mm')
}
}
}) : []
......@@ -209,7 +208,7 @@ const ParameterSetting: React.FC<{}> = () => {
{
item.isSettting ? <a onClick={()=> handleVisibleModalType(item.id)}>设置适用商城</a> : null
}
<Switch defaultChecked={item.isSettting} onChange={(v) => onChangeShowSetBtn(v, item.id)} />
{/* <Switch defaultChecked={item.isSettting} onChange={(v) => onChangeShowSetBtn(v, item.id)} /> */}
</div>
</div>
</MellowCard>))
......@@ -349,7 +348,7 @@ const ParameterSetting: React.FC<{}> = () => {
fieldKey={[fieldKey, 'timeRange']}
rules={[{ required: true, message: '请选择时间段' }]}
>
<TimePicker.RangePicker format="HH:mm:ss" style={{width: '100%'}} />
<TimePicker.RangePicker format="HH:mm" style={{width: '100%'}} />
</Form.Item>
<Button onClick={() => remove(name)} icon={<MinusOutlined />} />
</Space>
......
......@@ -18,7 +18,6 @@ import ModalForm from '@/components/ModalForm'
import { useHttpRequest } from '@/hooks/useHttpRequest'
import TableOperation from '@/components/TableOperation'
import { ORDER_TYPE_POINTS } from '@/constants/order'
import axios from 'axios'
import { getAuth } from '@/utils/auth'
import moment from 'moment'
......@@ -66,12 +65,6 @@ const formActions = createFormActions();
const destroyActions = createFormActions()
const adjustActions = createFormActions();
// const showDataSource = [
// { id: 1, name: "换货"},
// { id: 2, name: "退货"},
// { id: 3, name: "维修"},
// ]
const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
const [saleVisible, setSaleVisible] = useState<any>(false)
const [checkedId, setCheckedId] = useState<any>()
......@@ -187,7 +180,7 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
align: 'center',
dataIndex: 'ctl',
key: 'ctl',
render: (text: any, record: any) => renderOptionButton(record)
render: (text, record) => renderOptionButton(record)
}
])
}
......@@ -232,21 +225,51 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
const handleAdjust = async (record) => {
adjustRef.current.setVisible(true)
const { code, data } = await PublicApi.getOrderBuyerGetDeliveryTime({ shopId: record.shopId, orderId: record.orderId })
const { code, data: _data } = await PublicApi.getOrderBuyerGetDeliveryTime({ shopId: record.shopId, orderId: record.orderId })
if(code === 1000) {
// const _data = {
// isAppointmentDay: true,
// days: 3,
// deliverDate: "2021-10-19T19:39:42.799",
// isDeliveryTime: true,
// paramList: [{ startTime: '02:12', endTime: '03:45' }, { startTime: '05:45', endTime: '07:00' }],
// reason: 888888,
// }
adjustActions.setFieldValue('orderId', record.orderId)
adjustActions.setFieldValue('reason', data.reason)
adjustActions.setFieldValue('deliverDate', data.deliverDate)
adjustActions.setFieldValue('reason', _data.reason)
if(_data.deliverDate) {
adjustActions.setFieldValue('deliverDate', moment(_data.deliverDate).format('YYYY-MM-DD HH:mm'))
}
adjustActions.setFieldState('deliverDate', state => {
state.props['x-component-props'].disabledDate = (current) => {
// 有预约天数
if(_data.isAppointmentDay && _data?.days) {
return current && (current < moment().startOf('day') || current > moment().add(_data.days, 'days'))
} else {
return current && current < moment().startOf('day')
}
}
})
adjustActions.setFieldState('timeLine', prevState => {
prevState.visible = data.isShow
prevState.visible = _data.isDeliveryTime
if(_data.paramList?.length) {
prevState.props.enum = _data.paramList.map(item => ({label: `${item.startTime}-${item.endTime}`, value: `${item.startTime}-${item.endTime}`}))
} else {
prevState.visible = false
}
})
}
}
const handleSubmitAdjust = () => {
adjustActions.submit().then(async ({values}: any) => {
console.log(values, 'adjust')
const result = await PublicApi.postOrderBuyerUpdateDeliveryTime(values)
let params = {...values}
if(values?.timeLine) {
const timeLineArray = values.timeLine.split('-')
params.startTime = timeLineArray[0]
params.endTime = timeLineArray[1]
}
const result = await PublicApi.postOrderBuyerUpdateDeliveryTime(params)
if (result.code === 1000) {
adjustActions.reset()
adjustRef.current.setVisible(false)
......@@ -394,20 +417,18 @@ const PurchaseOrder: React.FC<PurchaseOrderProps> = (props) => {
title: '送货时间',
required: true,
"x-component-props": {
disabledDate: current => {
return current && current < moment().startOf('day')
},
// disabledDate: current => {
// return current && current < moment().startOf('day')
// },
showTime: true,
format: 'YYYY-MM-DD HH:mm',
style: { width: '100%' }
}
},
timeLine: {
title: '时间段',
type: 'radio',
enum: [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 },
],
enum: [],
"x-component-props": {
disabled: false,
optionType: 'button',
......
......@@ -299,9 +299,9 @@ export const paymentInformationColumns: any[] = [
export const productInfoColumns: any[] = [
{
title: 'ID',
dataIndex: 'productId',
dataIndex: 'id',
align: 'center',
key: 'productId',
key: 'id',
},
{
title: '商品名称',
......
......@@ -3,6 +3,7 @@ import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { useLinkageUtils } from '@/utils/formEffectUtils';
import { fetchOrderApi } from '../apis';
import { PublicApi } from '@/services/api';
import moment from 'moment';
// 异步填充表格字段
const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, productValue: any) => {
......@@ -105,11 +106,29 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
})
}
// 异步处理发货 时间配置
export const useOrderDeliverTimeEffect = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, shopId) => {
PublicApi.getOrderParamFindDeliveryDate({shopId}).then(res => {
console.log(res.data, '商城变动驱动送货时间段')
})
// 异步处理发货 预约时间 时间段配置
export const useOrderDeliverTimeEffect = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, shopId) => {
if(shopId) {
const { code, data } = await PublicApi.getOrderParamFindDeliveryDate({shopId})
if(code !== 1000) { return false; }
ctx.setFieldState('deliverDate', state => {
state.props['x-component-props'].disabledDate = (current) => {
if(data?.days) {
return current && (current < moment().startOf('day') || current > moment().add(data.days, 'days'))
} else {
return current && current < moment().startOf('day')
}
}
})
ctx.setFieldState('timeLine', state => {
if(data.paramList?.length) {
state.props.enum = data.paramList.map(item => ({label: `${item.startTime}-${item.endTime}`, value: `${item.startTime}-${item.endTime}`}))
} else {
state.visible = false
}
})
}
}
// 表单初始化时,对应操作
......
......@@ -273,6 +273,10 @@ const AgentOrderDetail:React.FC<AgentOrderDetailProps> = (props) => {
telephone: addressDetail.tel,
defaultConsignee: !!addressDetail.isDefault,
}
if(params?.timeLine) {
params.consignee.startTime = params.timeLine.split('-')[0]
params.consignee.endTime = params.timeLine.split('-')[1]
}
}
// 其他需求
......
......@@ -98,19 +98,19 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
// 渲染单价
productInfoColumns[5].render = (t, r) => {
if(orderMode === OrderModalType["HAND_ORDER"]) {
return <PriceComp priceSection={r.unitPrice}/>
} else {
// if(orderMode === OrderModalType["HAND_ORDER"]) {
// return <PriceComp priceSection={r.unitPrice}/>
// } else {
return r.price ? <span style={{color: 'red'}}>{r.price}</span> : <PriceComp priceSection={r.unitPrice}/>
}
// }
}
// 渲染商品ID
productInfoColumns[0].render = (t, r) => {
if(orderMode === OrderModalType["HAND_ORDER"]) {
// if(orderMode === OrderModalType["HAND_ORDER"]) {
return r.id
} else {
return r.productId || r.id
}
// } else {
// return r.productId || r.id
// }
}
} else {
......@@ -151,7 +151,7 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('products')];
console.log(newData, row)
const index = newData.findIndex(item => row.commodityId === item.commodityId);
const index = newData.findIndex(item => row.id === item.id);
const item = newData[index];
row['money'] = getUnitPriceTotal(row)
row['productId'] = row.commodityId
......
import { format } from './../../../common/dateFormat';
import { ISchema } from '@formily/antd';
import moment from 'moment'
......@@ -224,19 +225,18 @@ const submitInfo: ISchema = {
title: '送货时间',
required: true,
"x-component-props": {
disabledDate: current => {
return current && current < moment().startOf('day')
},
// disabledDate: current => {
// return current && current < moment().startOf('day')
// },
showTime: true,
format: 'YYYY-MM-DD HH:mm',
style: { width: 400 }
}
},
timeLine: {
// title: '配送时间段',
title: ' ',
type: 'radio',
enum: [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 },
],
enum: [],
"x-component-props": {
disabled: false,
optionType: 'button',
......
......@@ -47,7 +47,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
const shopIds = addSchemaAction.getFieldValue('shopIds')
if(shopIds.length){
let shopInfo: any = GlobalConfig.web.shopInfo.filter(item => item.id === shopIds[0])
console.log(shopIds, shopInfo)
const res = await PublicApi.getProductCommodityCommonGetCommodityListBySeller({
...params,
shopType: shopInfo[0].type,
......
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