Commit 1c4b5a78 authored by GuanHua's avatar GuanHua
parents e1e4ab19 69caf2cf
......@@ -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
})
......
......@@ -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);
});
......
......@@ -67,7 +67,6 @@ const EditPanel = () => {
message.info("请先选择一级导航类型");
}
const primaryTabProps = pageConfig[domKey!].props;
console.warn("fukc you", primaryTabProps)
setFormValue({
primary: primaryTabProps?.id,
title: primaryTabProps?.name,
......@@ -79,7 +78,6 @@ const EditPanel = () => {
const componentType: keyof typeof ComponentSchema = (selectedInfo as any)?.otherProps?.type;
const targetSchema = ComponentSchema[componentType] || null;
console.warn(selectedInfo, componentType)
if (targetSchema) {
/** 这里需要处理一下FormVlaue */
const tempFormValue = {
......@@ -350,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>
......
......@@ -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'
......@@ -30,7 +29,7 @@ export interface PriceSettingProps {
}
const fetchShopLists = async () => {
return await fectchShopListsSource({type: 1});
return await fectchShopListsSource({type: 1})
}
const PriceSetting:React.FC<PriceSettingProps> = (props) => {
......
......@@ -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