Commit da72d387 authored by Bill's avatar Bill

Merge branch 'dev' of 10.0.0.22:lingxi/lingxi-business-paltform into dev

parents f18a0db9 14796604
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -1019,8 +1019,8 @@ export const PurchaseOrderOutWorkStateTexts = {
9: '待新增采购入库单',
10: '订单收货待确认',
11: '待确认回单',
12: '订单归档供应商',
13: '订单归档采购商',
12: '待归档',
13: '待归档',
14: '完成订单',
20: '不接受订单',
21: '确认没到账',
......@@ -1060,7 +1060,7 @@ export const SaleOrderInsideWorkStateTexts = {
2: '待审核订单(一级)',
3: '待审核订单(二级)',
4: '待确认订单',
5: '接受订单',
5: '接受订单',
6: '不接受订单',
7: '提交审核订单不通过(一级)',
8: '提交审核订单不通过(二级)',
......@@ -1069,7 +1069,7 @@ export const SaleOrderInsideWorkStateTexts = {
16: '支付结果确认到账',
17: '支付结果没到账',
18: '待审核销售发货单',
18: '待新增销售发货单',
19: '待新增物流单',
20: '订单发货待确认',
23: '待确认回单',
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2020-11-05 18:02:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-01-28 10:22:16
* @LastEditTime: 2021-02-02 10:36:12
* @Description: 退款明细
*/
import React, { useState } from 'react';
......@@ -20,6 +20,7 @@ import {
PAY_CHANNEL_COD,
RETURN_OUTER_STATUS_TO_BE_REFUNDED,
RETURN_OUTER_STATUS_UNCONFIRMED_REFUNDED,
RETURN_OUTER_STATUS_NOT_RECEIVED,
} from '@/constants';
import Stamp from '../Stamp';
import CheckVoucherModal from '../CheckVoucherModal';
......@@ -263,7 +264,7 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
setCurrentDetailItem({
fileList: record.payProve.fileList ? record.payProve.fileList.map(item => normalizeFiledata(item.proveUrl)) : [],
});
setVisibleResult(true);
setVoucherVisible(true);
};
const handleRefundConfirm = (values, modalName) => {
......@@ -321,7 +322,10 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
{
isEdit &&
!isPurchaser &&
outerStatus === RETURN_OUTER_STATUS_TO_BE_REFUNDED &&
(
outerStatus === RETURN_OUTER_STATUS_TO_BE_REFUNDED ||
outerStatus === RETURN_OUTER_STATUS_NOT_RECEIVED
) &&
!!item.canRefund && (
item.outerStatus === REFUND_OUTER_STATUS_NOT_RECEIVED ||
item.innerStatus === REFUND_INNER_STATUS_NO_REFUND ||
......@@ -409,7 +413,7 @@ const ReturnDetailInfo: React.FC<ReturnDetailInfoProps> = ({
),
currentDetailItem.id && (
<Button
key="2"
key="3"
type="primary"
loading={receivedLoading}
onClick={() => handleConfirm(currentDetailItem.id, 1)}
......
import React, { useState, useEffect } from 'react'
import { Button, Input, Select, Checkbox, message } from 'antd'
import React, { useState } from 'react'
import { Button, Input, message } from 'antd'
import { PlusOutlined, DeleteOutlined } from '@ant-design/icons'
import { changeProps } from 'lingxi-editor-core'
import { ReactSortable } from "react-sortablejs"
import ImageBox from '@/components/ImageBox'
import cx from 'classnames'
import isEmpty from 'lodash/isEmpty'
import ModalTable from '@/components/ModalTable'
import UploadImage from '@/components/UploadImage'
import { PublicApi } from '@/services/api'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { numFormat, priceFormat } from '@/utils/numberFomat'
import { priceFormat } from '@/utils/numberFomat'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch'
import SearchSelect from '@/components/NiceForm/components/SearchSelect'
import Search from '@/components/NiceForm/components/Search'
import Submit from '@/components/NiceForm/components/Submit'
import { formProduct, basicSchema } from './contant/schema'
import { basicSchema } from './contant/schema'
import promptCommodityColumn from './contant/column'
import arrowRightIcon from '@/assets/icons/arrow_right.png'
import arrowLeftIcon from '@/assets/icons/arrow_left.png'
import arrowUpIcon from '@/assets/icons/arrow_up.png'
import arrowDownIcon from '@/assets/icons/arrow_down.png'
import sortIcon from '@/assets/icons/sort_icon.png'
import styles from './index.less'
......@@ -44,63 +38,16 @@ interface BannerPropsType {
title: string,
}
const RedirectTypeList = [
{
value: 1,
label: '商品详情',
},
{
value: 2,
label: '积分详情',
},
{
value: 5,
label: '不跳转',
},
]
const modalWidthMap = {
1: 960,
2: 960,
3: 600,
4: 600
}
const RecommendCommodity: React.FC<BannerPropsType> = (props) => {
const { selectInfo, title, storeId, productIdList } = props
const { title, storeId, productIdList, dataList } = props
const [expandState, setExpandState] = useState<boolean>(true)
const [list, setList] = useState<DataItemType[]>([])
const [modalVisible, setModalVisible] = useState<boolean>(false)
const [currentInfo, setCurrentInfo] = useState<DataItemType>()
const [recommendTitle, setRecommendTitle] = useState<string>(title)
const [productRowSelection, productRowCtl] = useRowSelectionTable()
/**
* 根据选中的类型和id获取信息
* @param data
*/
const getSelectInfo = (data: DataItemType) => {
return new Promise((resolve) => {
let getFn: any = null
const param: any = {}
switch(data.type) {
case 1:
case 2:
param.commodityId = data.id
getFn = PublicApi.getSearchMobileShopStoreGetCommodityDetail
break
default:
break
}
getFn && getFn(param).then(res => {
resolve(res.data)
})
})
}
/**
* 修改名称
* @param value
* @param id
......@@ -112,21 +59,48 @@ const RecommendCommodity: React.FC<BannerPropsType> = (props) => {
})
}
const getDataListByList = (list) => {
let result: any = []
if(list) {
list.forEach((listItem) => {
if (listItem.productList && listItem.productList.length > 0) {
result = [...result, ...listItem.productList]
}
})
}
return result
}
/**
* 删除跳转选项
* @param sort
* 删除已选商品
*/
const handleDeleteSelectItem = (sort: number) => {
const newList = [...list]
newList.map(item => {
if (item.sort === sort) {
item.id = 0,
item.selectInfo = null
const handleDeleteItem = (id: number) => {
let productIds = [...productIdList]
productIds = productIds.filter(item => item !== id)
const commodityList = []
dataList.forEach((listItem: any) => {
if (listItem.productList && listItem.productList.length > 0) {
const temp = listItem
const tempProductList = []
listItem.productList.forEach((productItem) => {
if(productItem.id !== id) {
tempProductList.push(productItem)
}
})
if(tempProductList.length > 0) {
temp.productList = tempProductList
commodityList.push(temp)
}
}
})
setList(newList)
changeProps({
props:Object.assign({ ...props }, { dataList: newList })
props:Object.assign({ ...props }, {
productIdList: productIds,
dataList: commodityList,
})
})
}
......@@ -134,11 +108,13 @@ const RecommendCommodity: React.FC<BannerPropsType> = (props) => {
* 根据类型显示选择的信息
* @param type 1-商品详情 2-积分详情 3-店铺主页 4-资讯详情 5-不跳转
*/
const renderSelectItemByType = (dataList: any[]) => {
const renderSelectItemByType = (list: any[]) => {
const selectList = getDataListByList(list)
return (
<div>
{
dataList && dataList.map(selectItem => (
selectList && selectList.map(selectItem => (
<div className={styles.setting_line_addItem_line} key={selectItem.id}>
<div className={styles.setting_line_addItem_line_label}></div>
<div className={styles.setting_line_addItem_line_brief}>
......@@ -148,7 +124,7 @@ const RecommendCommodity: React.FC<BannerPropsType> = (props) => {
<div className={styles.selectInfo_name}>{selectItem.name}</div>
<div className={styles.selectInfo_price}>{priceFormat(selectItem.min)}</div>
</div>
<div className={styles.selectInfoBox_delete}>
<div className={styles.selectInfoBox_delete} onClick={() => handleDeleteItem(selectItem.id)}>
<DeleteOutlined />
</div>
</div>
......@@ -175,9 +151,14 @@ const RecommendCommodity: React.FC<BannerPropsType> = (props) => {
idList
}
PublicApi.postSearchMobileShopStoreGetCategoryByCommodityId(param).then((res) => {
message.destroy()
if (res.code === 1000) {
resolve(changeData(res.data))
} else {
resolve([])
}
}).catch(() => {
resolve([])
})
})
}
......@@ -207,17 +188,17 @@ const RecommendCommodity: React.FC<BannerPropsType> = (props) => {
}
const handleModalOk = async () => {
const selectResult = productRowCtl.selectRow
if (!selectResult || isEmpty(selectResult)) {
let selectedRowKeys = productRowCtl.selectedRowKeys
if (!selectedRowKeys || isEmpty(selectedRowKeys)) {
message.info("请选择")
return null
}
const commodityList = await fetchCategoryByCommodityId(productRowCtl.selectedRowKeys)
selectedRowKeys = [...productIdList, ...selectedRowKeys]
const commodityList = await fetchCategoryByCommodityId(selectedRowKeys)
changeProps({
props:Object.assign({ ...props }, {
productIdList: productRowCtl.selectedRowKeys,
productIdList: selectedRowKeys,
dataList: commodityList,
selectInfo: selectResult
})
})
setModalVisible(false)
......@@ -276,7 +257,7 @@ const RecommendCommodity: React.FC<BannerPropsType> = (props) => {
</div>
</div>
{
(selectInfo && selectInfo.length > 0) ? renderSelectItemByType(selectInfo) : null
(dataList && dataList.length > 0) ? renderSelectItemByType(dataList) : null
}
</div>
)
......
......@@ -47,7 +47,7 @@
cursor: pointer;
&.active {
color: #D32F2F;
color: var(--mall_main_color);
}
}
}
......@@ -147,4 +147,4 @@
}
}
}
}
\ No newline at end of file
}
......@@ -86,7 +86,7 @@ const ShopInfo: React.FC<ShopInfoPropsType> = (props) => {
<div className={styles.shop_info_list}>
<div className={styles.shop_info_list_item}>
<div className={styles.label}>信用积分:</div>
<div className={styles.breif}></div>
<div className={styles.breif}>{shopInfo?.creditPoint || 0}</div>
</div>
<div className={styles.shop_info_list_item}>
<div className={styles.label}>注册资本:</div>
......
......@@ -189,6 +189,52 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
}
}
const changeData = (dataList) => {
if(dataList) {
return dataList.map((dataItem) => {
return {
categoryId: dataItem.id,
categoryName: dataItem.name,
categoryImage: dataItem.imageUrl || "",
productList: dataItem.commodityResponseList ? dataItem.commodityResponseList.map((commodityItem) => {
return {
id: commodityItem.id,
name: commodityItem.name,
sellPoints: commodityItem.sellingPoint,
min: commodityItem.min,
unitName: commodityItem.unitName,
sold: commodityItem.sold,
mainPic: commodityItem.mainPic,
}
}) : []
}
})
}
return []
}
/**
* 根据商品id,查询商品根据分类的列表
* @param idList
*/
const fetchCategoryByCommodityId = (idList: number[]) => {
return new Promise((resolve) => {
const param = {
idList
}
PublicApi.postSearchMobileShopStoreGetCategoryByCommodityId(param).then((res) => {
message.destroy()
if (res.code === 1000) {
resolve(changeData(res.data))
} else {
resolve([])
}
}).catch(() => {
resolve([])
})
})
}
const getComponentsConfig = async () => {
try {
const appConfig = await getAppShopConfig()
......@@ -211,10 +257,12 @@ const mobileShopTempleteEdit: React.FC<ShopPreviewPropsType> = (props) => {
}
if(appConfig?.productBO) {
const dataList = await fetchCategoryByCommodityId(appConfig.productBO.productIdList)
mobileShopCommodityList[mobileShopCommodityList.key].props = {
storeId: shopInfo.id,
title: appConfig.productBO.title,
productIdList: appConfig.productBO.productIdList
productIdList: appConfig.productBO.productIdList,
dataList,
}
} else {
mobileShopCommodityList[mobileShopCommodityList.key].props.storeId = shopInfo.id
......
import React from 'react'
import AuditProcess from '@/components/AuditProcess'
import { findLastIndexFlowState } from '@/utils'
import OrderProductTable from '../../components/orderProductTable'
import SaleOrderProductTable from '../../components/saleOrderProductTable'
import OrderPayTabs from '../../components/orderPayTabs'
import OrderMergeInfo from '../../components/orderMergeInfo'
import OrderDeleveRecord from '../../components/orderDeleveRecord'
import OrderTransformRecord from '../../components/orderTransformRecord'
import OrderSaleRecord from '../orderSaleRecord'
export interface OrderDetailSectionProps {
formContext: any,
type?: 'purchaseOrder' | 'saleOrder',
}
const OrderDetailSection:React.FC<OrderDetailSectionProps> = ({formContext, type = 'purchaseOrder'}) => {
return (
formContext.data && <div className='gray-wrap'>
<AuditProcess
customTitleKey='operationalProcess'
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(formContext.data.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formContext.data.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={
formContext.data.externalWorkflowFlowRecordLogResponses ?
formContext.data.externalWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
innerVerifySteps={
formContext.data.interiorWorkflowFlowRecordLogResponses ?
formContext.data.interiorWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
></AuditProcess>
{ type === 'saleOrder' ? <SaleOrderProductTable/> : <OrderProductTable editable /> }
<OrderPayTabs />
<OrderMergeInfo />
{ type === 'saleOrder' ? <OrderSaleRecord /> : <OrderDeleveRecord /> }
<OrderTransformRecord type={type}/>
</div>
)
}
OrderDetailSection.defaultProps = {}
export default OrderDetailSection
\ No newline at end of file
import React from 'react'
import AuditProcess from '@/components/AuditProcess'
import { findLastIndexFlowState } from '@/utils'
import OrderProductTable from '../../components/orderProductTable'
import SaleOrderProductTable from '../../components/saleOrderProductTable'
import OrderPayTabs from '../../components/orderPayTabs'
import OrderMergeInfo from '../../components/orderMergeInfo'
import OrderDeleveRecord from '../../components/orderDeleveRecord'
import OrderTransformRecord from '../../components/orderTransformRecord'
import OrderSaleRecord from '../orderSaleRecord'
export interface OrderDetailSectionProps {
formContext: any,
type?: 'purchaseOrder' | 'saleOrder',
}
const OrderDetailSection:React.FC<OrderDetailSectionProps> = ({formContext, type = 'purchaseOrder'}) => {
return (
formContext.data && <div className='gray-wrap'>
<AuditProcess
customTitleKey='operationalProcess'
customKey='state'
outerVerifyCurrent={findLastIndexFlowState(formContext.data.externalWorkflowFlowRecordLogResponses)}
innerVerifyCurrent={findLastIndexFlowState(formContext.data.interiorWorkflowFlowRecordLogResponses)}
outerVerifySteps={
formContext.data.externalWorkflowFlowRecordLogResponses ?
formContext.data.externalWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
innerVerifySteps={
formContext.data.interiorWorkflowFlowRecordLogResponses ?
formContext.data.interiorWorkflowFlowRecordLogResponses.map(item => ({
...item,
status: item.isExecute ? 'finish' : 'wait',
})) :
[]
}
></AuditProcess>
{ type === 'saleOrder' ? <SaleOrderProductTable/> : <OrderProductTable editable /> }
<OrderPayTabs />
<OrderMergeInfo />
{ type === 'saleOrder' ? <OrderSaleRecord /> : <OrderDeleveRecord /> }
<OrderTransformRecord type={type}/>
</div>
)
}
OrderDetailSection.defaultProps = {}
export default OrderDetailSection
import React, { useContext, useEffect, useState } from 'react'
import style from './index.less'
import { Tabs, Row, Col, Modal, List } from 'antd'
import { Tabs, Row, Col, Modal, List, Tooltip } from 'antd'
import { OrderDetailContext } from '../../_public/order/context'
import MellowCard from '@/components/MellowCard'
import StatusColors from '../StatusColors'
import moment from 'moment'
import { PayOutWorkState } from '@/constants'
import OverflowText from '@/components/OverflowText'
import { isTemplateExpression } from 'typescript'
import { QuestionCircleOutlined } from '@ant-design/icons'
/**
* 展示 支付比例和简单流程的发货信息
......@@ -56,6 +56,12 @@ const OrderPayTabs:React.FC<OrderPayTabsProps> = (props) => {
<div className={style.smallnumber}>
{dataSource.channel !== 0 && '¥'}
{dataSource.payPrice || 0}
{
dataSource.refundPrice &&
<Tooltip title={`本次实际支付金额(¥${data.payPrice})=本次订单待支付金额(¥${data.payPrice+data.refundPrice})-售后待退款金额(¥${data.refundPrice})`}>
<QuestionCircleOutlined />
</Tooltip>
}
</div>
</Col>
<Col>
......
......@@ -71,4 +71,10 @@ export const fetchOrderApi = {
return data
},
// 获取合并订单列表
async getMergeOrderList(params) {
const { data } = await PublicApi.getOrderMergeOrderList(params)
return data
},
}
.order {
display: flex;
flex-direction: column;
height: 100%;
&-head {
flex-shrink: 0;
}
&-body {
flex: 1;
overflow: auto;
}
&-foot {
flex-shrink: 0;
margin-top: 32px;
text-align: right;
}
}
import { ISchema } from "@formily/antd";
import { PATTERN_MAPS } from '@/constants/regExp';
import { PublicApi } from '@/services/api';
import { FORM_FILTER_PATH } from "@/formSchema/const";
export const mergeSearchSchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
orderNo: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '输入订单号搜索',
align: 'flex-left',
// tip: '输入 订单号 进行搜索',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 6,
},
properties: {
orderThe: {
type: 'string',
'x-component-props': {
placeholder: '订单摘要',
allowClear: true,
},
},
membersName: {
type: 'string',
'x-component-props': {
placeholder: '采购商',
allowClear: true,
},
},
activityName: {
type: 'string',
'x-component-props': {
placeholder: '活动名称',
allowClear: true,
},
},
'[startCreateTime, endCreateTime]': {
type: 'string',
default: '',
'x-component': 'dateSelect',
'x-component-props': {
placeholder: '下单时间(全部)',
allowClear: true,
},
},
'[startActivityTime, endActivityTime]': {
type: 'string',
default: '',
'x-component': 'dateSelect',
'x-component-props': {
placeholder: '活动时间(全部)',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
......@@ -44,7 +44,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
formItemProps={},
...restProps
}) => {
const formItemRef = useRef<any>();
// const formItemRef = useRef<any>();
const { form } = useContext(EditableContext);
const save = async e => {
try {
......@@ -56,10 +56,23 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
}
};
const chooseFormItem = (type) => {
const chooseFormItem = (type, v) => {
switch(type) {
case 'input': {
return <Input style={{width: 140}} type='number' ref={formItemRef} onChange={save} {...formItemProps} id={dataIndex + record.id}/>
// 用于合并订单采购数量回显
let keyValue = {}
keyValue[dataIndex] = v
form.setFieldsValue(keyValue)
return <Input
style={{width: 140}}
type='number'
// ref={formItemRef}
onChange={save}
{...formItemProps}
id={dataIndex + record.id}
className="purchase_amount_input"
/>
}
}
}
......@@ -82,7 +95,7 @@ export const ProductTableCell:React.FC<ProductTableCellProps> = ({
},
]}
>
{chooseFormItem(formItem)}
{chooseFormItem(formItem, record[dataIndex] || '')}
</Form.Item>
}
......
......@@ -337,7 +337,8 @@ export const productInfoColumns: any[] = [
},
]
export const mergeOrderColumns: any[] = [
// 合并订单父级表格列
export const mergeParentTableColumns: any[] = [
{
title: '订单号',
dataIndex: 'orderNo',
......@@ -375,3 +376,56 @@ export const mergeOrderColumns: any[] = [
key: 'none',
}
]
// 合并订单子级表格列
export const mergeChildrenTableColumns: any[] = [
{
title: 'ID',
dataIndex: 'productId',
align: 'center',
key: 'productId',
},
{
title: '商品名称',
dataIndex: 'productName',
align: 'center',
key: 'productName',
},
{
title: '品类',
dataIndex: 'category',
align: 'center',
key: 'category',
},
{
title: '品牌',
dataIndex: 'brand',
align: 'center',
key: 'brand',
},
{
title: '单位',
dataIndex: 'unit',
align: 'center',
key: 'unit',
},
{
title: '单价',
dataIndex: 'price',
align: 'center',
key: 'price',
},
{
title: '原订单数量',
dataIndex: 'purchaseCount',
align: 'center',
key: 'purchaseCount',
},
{
title: '原订单金额',
dataIndex: 'id',
align: 'center',
key: 'id',
render: (t, r) => `¥${(r.purchaseCount*100) * (r.price*100) / 10000}`
}
]
......@@ -5,14 +5,12 @@ import { useLinkageUtils } from '@/utils/formEffectUtils';
import { orderCombination } from '../constant';
import { history } from 'umi';
import { fetchOrderApi } from '../apis';
import { useUpdate } from '@umijs/hooks';
import { PublicApi } from '@/services/api';
import { filterProductDataById } from '../components/productModalTable'
import { getUnitPriceTotal } from '../model/useProductTable';
import moment from 'moment';
import { OrderModalType } from '@/constants';
let updateFlag = false
// 异步填充表格字段
const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, productValue: any) => {
......@@ -101,13 +99,13 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
// if (payInfoData && payInfoData.length > 0) {
// } else
const orderModel = ctx.getFieldValue('orderModel')
if (value && value.length > 0 && !state.loading){ // 添加loading判断避免二次调用
// 请求一次并复制给支付信息
const productItem = value[0]
if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现
} else if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数
const orderModel = ctx.getFieldValue('orderModel')
fetchOrderApi.getPayInfoList({
productId: orderModel === OrderModalType["HAND_ORDER"] ? productItem.id : productItem.productId,
memberId: productItem?.memberId || ctx.getFieldValue('supplyMembersId'),
......@@ -124,6 +122,23 @@ export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFor
// 确认后 需根据商品id请求会员折扣接口, 以及配送方式
// 由于商品存在多个, 需对接口做一定缓存
asyncPadDataForProduct(ctx, state)
// 下单模式为合并订单 禁用编辑采购数量
if(orderModel === OrderModalType["CONSOLIDATED_ORDER"]) {
let numberInputs = document.getElementsByClassName("purchase_amount_input")
if(numberInputs?.length) {
for(let i = 0; i < numberInputs.length; i++) {
numberInputs[i].setAttribute("disabled", "true")
}
}
} else {
let numberInputs = document.getElementsByClassName("purchase_amount_input")
if(numberInputs?.length) {
for(let i = 0; i < numberInputs.length; i++) {
numberInputs[i].removeAttribute("disabled")
}
}
}
})
}
......@@ -178,7 +193,6 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
ctx.setFieldValue('supplyMembersName', initValue.supplyMembersName)
initValue.idList && ctx.setFieldValue('idList', initValue.idList)
initValue.productType && ctx.setFieldValue('productType', initValue.productType)
ctx.setFieldValue('orderProductRequests', await filterProductDataById([], productInfo.map(v => {
return {
...v,
......@@ -194,6 +208,7 @@ export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyn
memberRoleId: initValue.supplyMembersRoleId,
commodityId: v.id, // 添加commodityId用于判断是商品价格是使用price字段还是unitPrice字段(也可判断是报价订单还是其他)
memberPrice: v.memberDiscount !== 1 ? v.memberDiscount : 1, // 添加会员折扣
name: v.attribute?.length ? v.name + '/' + v.attribute.map(item => item.customerAttributeValue.value).join('/') : v.name,
}
})
))
......@@ -296,7 +311,7 @@ export const useOrderUpdateChangeOther = (ctx: ISchemaFormActions | ISchemaFormA
PublicApi.postOrderProcurementOrderUpdate({
...values,
deliveryTime: moment(values.deliveryTime).valueOf(),
theInvoiceId: value.id,
theInvoiceId: value.id || null,
needTheInvoice: Number(values.needTheInvoice),
deliveryAddresId: values.deliveryAddresId,
id,
......
......@@ -33,6 +33,7 @@ import AuditProcess from '@/components/AuditProcess'
import styles from './index.less'
import SimpleElectronModal from './components/simpleElectronModal'
import { fetchOrderApi } from './apis'
import MergeOrderModalTable from './components/mergeOrderModalTable'
export interface PurchaseOrderDetailProps {}
......@@ -126,6 +127,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
const inquiryRef = useRef<any>({})
const demandRef = useRef<any>({})
const contractRef = useRef<any>({})
const mergeRef = useRef<any>({})
const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false)
const update = useUpdate()
......@@ -154,7 +156,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
addSchemaAction.getFieldValue('supplyMembersRoleId'),
pageStatus === PageStatus.ADD ? addSchemaAction.getFieldValue('orderProductRequests') : initFormValue.orderProductRequests
)
const { productAddButton, productRef, productColumns, productComponents, ...sectionProps } = useProductTable(addSchemaAction)
const { productAddButton, productRef, productColumns, productComponents, ...sectionProps } = useProductTable(addSchemaAction, mergeRef)
let timerSignature = null
// 页面进入时, 当前所处的下单模式
......@@ -192,7 +194,7 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}, [])
const handleSubmit = async (value) => {
// console.log(value, 'value')
console.log(value, 'value', addSchemaAction.getFieldValue("orderProductRequests"))
let _orderProductRequests = JSON.parse(JSON.stringify(value.orderProductRequests))
let processEnum = value['processEnum']
let usingElectronicContracts = value['usingElectronicContracts']
......@@ -328,7 +330,16 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
}
})
setBtnLoading(true)
fnResult = id ? await PublicApi.postOrderProcurementOrderUpdate({...params, id}) : await PublicApi.postOrderProcurementOrderAddReinsurancePolicy(params)
fnResult = id ?
await PublicApi.postOrderProcurementOrderUpdate({...params, id})
:
(params.orderModel===9 ?
await PublicApi.postOrderProcurementOrderAddMerge({
...params,
ordeProducts: addSchemaAction.getFieldValue("ordeProducts")
})
:
await PublicApi.postOrderProcurementOrderAddReinsurancePolicy(params))
break;
}
}
......@@ -542,31 +553,33 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
// 商品信息的改动 驱动支付信息变化
useProductTableChangeForPay(ctx, update)
//编辑 地址和发票信息变动 触发订单更新
// 编辑 地址和发票信息变动 触发订单更新
useOrderUpdateChangeOther(ctx)
// address初始下只有id change后为object
// $('onFieldValueChange', 'NO_SUBMIT_TABS.*.*.*(theInvoiceId, needTheInvoice, deliveryAddresId)').subscribe(state => {
// const { value, path } = state
// if(pageStatus === PageStatus.EDIT){
// if(state?.dataSource?.length && state.loading) {
// ctx.submit((values) => {
// console.log(value, path)
// if(values){
// PublicApi.postOrderProcurementOrderUpdate({
// ...values,
// deliveryTime: moment(values.deliveryTime).valueOf(),
// theInvoiceId: value.id,
// needTheInvoice: Number(values.needTheInvoice),
// deliveryAddresId: path.indexOf("deliveryAddresId") !== -1 ? ( value?.id ? value.id : value ) : values.deliveryAddresId,
// id,
// }, { ctlType: "none" })
// }
// })
// } else {
// ctx.setFieldState(path, _state => _state.loading = true)
// }
// }
// })
// 合并订单模式下 只选择供应会员 出现选择商品按钮
$('onFieldValueChange', 'supplyMembersName').subscribe(state => {
const quotationOrderValue = ctx.getFieldValue('quotationNo')
const modelType = ctx.getFieldValue('orderModel')
if(state.value && !quotationOrderValue && modelType === 9) {
addSchemaAction.setFieldState('orderProductRequests', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
prefix: productAddButton,
}
})
}
})
$('onFieldValueChange', 'quotationNo').subscribe(state => {
const modelType = ctx.getFieldValue('orderModel')
if(state.value && modelType === 9) {
addSchemaAction.setFieldState('orderProductRequests', productState => {
productState.props["x-component-props"] = {
...productState.props["x-component-props"],
prefix: "",
}
})
}
})
}}
expressionScope={{
......@@ -598,6 +611,15 @@ const PurchaseOrderDetail:React.FC<PurchaseOrderDetailProps> = (props) => {
{/* 简单流程签合同弹窗 */}
<SimpleElectronModal currentRef={contractRef} schemaAction={addSchemaAction}/>
{/* 选择待合并订单弹窗 */}
<MergeOrderModalTable
title="选择待合并订单"
currentRef={mergeRef}
schemaAction={addSchemaAction}
handleUpdate={update}
// confirmModal
/>
</ReadyAddOrderDetailContext.Provider>
</PageHeaderWrapper>
)
......
......@@ -53,10 +53,16 @@ export const getUnitPriceTotal = (record) => {
return Number((unitPrice * purchaseCount).toFixed(2))
}
}
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
/**
* @param ctx schemaAction
* @param mergeRef 操作合并订单的ref
*/
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, mergeRef: any) => {
const productRef = useRef<any>({})
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type: 'checkbox'})
const { pageStatus } = usePageStatus()
const handleDelete = (record) => {
const newData = [...ctx.getFieldValue('orderProductRequests')]
// 删除formvalue
......@@ -81,12 +87,22 @@ export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncAction
// ctx.setFieldValue('paymentInformationResponses', paymentInfo)
}
}
const clickMergeButton = (recrod) => {
mergeRef.current.setVisible(true)
mergeRef.current.setCurrentClickRow(recrod)
}
const [productColumns, setProductColumns] = useState(() => {
if (pageStatus === PageStatus.ADD) {
productInfoColumns[productInfoColumns.length - 1].render = (text, record) => {
const orderModel = ctx.getFieldValue('orderModel')
return <>
{
// 合并下单
orderModel === 9 && <Button type='link' onClick={() => clickMergeButton(record)}>选择合并订单</Button>
}
<Button type='link' onClick={() => handleDelete(record)}>删除</Button>
{/* <Button type='link'>选择合并订单</Button> */}
</>
}
} else {
......
......@@ -232,7 +232,12 @@ const orderProduct: ISchema = {
columns: "{{productColumns}}",
components: "{{productComponents}}",
},
// default: [{id: 904}]
},
// 仅合并下单时备用参数数据
ordeProducts: {
type: 'array',
title: '合并下单记录',
visible: false
},
NO_SUBMIT_SPY: {
type: 'object',
......
......@@ -16,6 +16,7 @@ const AddBills: React.FC = () => {
relevanceInvoices={relevanceInvoices}
relevanceInvoicesId={relevanceInvoicesId}
source={+source as (1 | 2)}
isEdit
/>
);
};
......
/*
* @Author: XieZhiXiong
* @Date: 2021-01-06 11:36:35
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-02-01 10:15:34
* @Description:
*/
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import BillsForm from './components/BillsForm';
......@@ -5,8 +12,7 @@ import BillsForm from './components/BillsForm';
const BillsDetail: React.FC = () => {
const {
id = 0,
deliveryNo = 0,
storageNo = 0,
invoicesNo = '',
invoicesTypeId, // 单据类型ID
relevanceInvoices, // 对应单据
relevanceInvoicesId, // 单据id,可能是待新增销售发货单,待新增采购入库单跳转过来的
......@@ -15,8 +21,7 @@ const BillsDetail: React.FC = () => {
return (
<BillsForm
id={id}
deliveryNo={deliveryNo}
storageNo={storageNo}
invoicesNo={invoicesNo}
invoicesTypeId={invoicesTypeId}
relevanceInvoices={relevanceInvoices}
relevanceInvoicesId={relevanceInvoicesId}
......
......@@ -1825,14 +1825,14 @@ const BillsForm: React.FC<BillsFormProps> = ({
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />}
title={
!id ?
!id && isEdit ?
'新建单据' :
isEdit ?
'编辑单据' :
'查看单据'
}
extra={
(isEdit || !id)
(isEdit)
? [
<Button
key="1"
......@@ -1859,7 +1859,7 @@ const BillsForm: React.FC<BillsFormProps> = ({
RadioGroup: Radio.Group,
ArrayTable,
}}
editable={isEdit || !id}
editable={isEdit}
effects={($, actions) => {
createEffects($, actions)
onFormInputChange$().subscribe(() => {
......
......@@ -76,7 +76,7 @@ const GetBack: React.FC = () => {
}
if (PATTERN_MAPS.email.test(fieldState.value)) {
// 校验邮箱格式通过时, 需请求接口判断邮箱是否存在数据库
PublicApi.getMemberRegisterEmailCheck({
PublicApi.postMemberRegisterEmailCheck({
email: fieldState.value
}, { ctlType: 'none', useCache: true, ttl: 60 * 1000 }).then(({ code, data }) => {
if (code === 1000) {
......
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