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

fix: 移除规格属性必填,待支付订单对接建行b2b支付

parent 6b09739c
......@@ -41,7 +41,6 @@ const AddAtttribute: React.FC<{}> = () => {
const [isSee, setIsSee] = useState(false) // 判断查看依据
const [isSpecial, setIsSpecial] = useState(false) //特殊属性禁用展示方式
const [submitLoading, setSubmitLoading] = useState<boolean>(false)
const [isDisabledEmpty, setIsDisabledEmpty] = useState<boolean>(false) // 禁用必填
useEffect(() => {
const { location } = history
......@@ -161,16 +160,6 @@ const AddAtttribute: React.FC<{}> = () => {
menuForm.setFieldsValue({ isDate: false })
}
const priceAttributeChange = (e) => {
if(e.target.checked) {
setIsDisabledEmpty(true)
menuForm.setFieldsValue({"isEmpty": true})
} else {
setIsDisabledEmpty(false)
menuForm.setFieldsValue({"isEmpty": false})
}
}
return <PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description={intl.formatMessage({ id: 'classAndProperty.attribute.addAttribute.back' })}/>}
......@@ -257,7 +246,7 @@ const AddAtttribute: React.FC<{}> = () => {
<Row>
<Col span={24}>
<Form.Item name="isEmpty" valuePropName="checked" initialValue={false} noStyle>
<Checkbox disabled={isSee || isDisabledEmpty}>{intl.formatMessage({ id: 'classAndProperty.attribute.addAttribute.form.isEmpty' })}</Checkbox>
<Checkbox disabled={isSee}>{intl.formatMessage({ id: 'classAndProperty.attribute.addAttribute.form.isEmpty' })}</Checkbox>
</Form.Item>
</Col>
{/* <Col span={24}>
......@@ -276,7 +265,6 @@ const AddAtttribute: React.FC<{}> = () => {
{/* 规格属性 -> 原价格属性 */}
<Form.Item name="isPrice" valuePropName="checked" initialValue={false} noStyle>
<Checkbox
onChange={priceAttributeChange}
disabled={isSee}>{intl.formatMessage({ id: 'classAndProperty.attribute.addAttribute.form.isPrice' })}
</Checkbox>
</Form.Item>
......
......@@ -261,23 +261,11 @@ const AddProducts: React.FC<{}> = (props) => {
}
_params.unitPriceAndPicList = _productAttributeAndImageParams
} else { // 编辑时没有点击商品图片(新增没有点击也就没有数据)
if (productInfoByEdit) {
_params.unitPriceAndPicList = productInfoByEdit.unitPriceAndPicList
_params.isAllAttributePic = productInfoByEdit.isAllAttributePic
// 没有点击图片单单修改了商品价格 取原有的图片和新的价格合成(编辑属性组合变更,不点击图片,直接报存)
// if (clickTabIndex.indexOf("4") !== -1) {
// _params.unitPriceAndPicList = priceAttributeParams.map((item, index) => {
// return {
// id: item.id,
// goods: { id: item.goodsId },
// attributeAndValueList: item.attributeAndValueList,
// unitPrice: item.unitPrice,
// priceRate: item.priceRate,
// commodityPic: productInfoByEdit.unitPriceAndPicList[index].commodityPic
// }
// })
// }
try {
try {
if (productInfoByEdit) {
_params.unitPriceAndPicList = productInfoByEdit.unitPriceAndPicList
_params.isAllAttributePic = productInfoByEdit.isAllAttributePic
// 没有点击图片单单修改了商品价格 取原有的图片和新的价格合成(编辑属性组合变更,不点击图片,直接报存)
if (clickTabIndex.indexOf("4") !== -1) {
_params.unitPriceAndPicList = priceAttributeParams.map((item, index) => {
const pic = productInfoByEdit.unitPriceAndPicList[index]?.commodityPic
......@@ -286,17 +274,19 @@ const AddProducts: React.FC<{}> = (props) => {
}
return {
id: item.id,
goods: { id: item.goodsId },
attributeAndValueList: item.attributeAndValueList,
unitPrice: item.unitPrice,
priceRate: item.priceRate,
commodityPic: pic
goods: { id: item.goodsId },
attributeAndValueList: item.attributeAndValueList,
unitPrice: item.unitPrice,
priceRate: item.priceRate,
commodityPic: pic
}
})
}
} catch (e) {
return e
} else {
throw new Error('请上传商品图片!')
}
} catch (e) {
return e
}
}
......
......@@ -71,7 +71,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
}
}, [])
//timer start
// timer start
const [openTimer, setOpenTimer] = useState(0); // timer
useEffect(() => {
if(openTimer === 1) runTimerJump()
......@@ -80,7 +80,7 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
const runTimerJump = () => {
timeChange = setInterval(() => pollPayResult(), 3000)
}
//timer ending
// timer ending
useEffect(() => {
if (!visible) {
......@@ -408,11 +408,10 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
window.open(res.data.codeUrl, '_blank')
} else if(checked.id === 16) {
console.log(current, checked, '建行b2b跳转')
console.log(res.data)
// setCurrent(1000)
// setVisible(false)
// setPayResultVisible(true)
// window.open(res.data.codeUrl, '_blank')
setCurrent(1000)
setVisible(false)
setPayResultVisible(true)
window.open(res.data.codeUrl, '_blank')
} else {
history.goBack()
}
......
......@@ -52,8 +52,8 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
</RowStyle>
})
/** 销售发货单 新增 */
const AddSaleDelevedOrder:React.FC<{}> = () => {
/** 新增采购收货单 */
const AddPurchaseReceiveOrder: React.FC<{}> = () => {
const memberRef = useRef<any>({})
const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false)
......@@ -182,6 +182,6 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
</div>)
}
AddSaleDelevedOrder.defaultProps = {}
AddPurchaseReceiveOrder.defaultProps = {}
export default AddSaleDelevedOrder
export default AddPurchaseReceiveOrder
......@@ -8,7 +8,7 @@ const basicInfo: ISchema = {
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
title: getIntl().formatMessage({ id: 'purchaseRequisition.jibenxinxi', defaultMessage: '基本信息' }),
title: '基本信息',
id: 'basicInfo',
},
properties: {
......@@ -29,7 +29,7 @@ const basicInfo: ISchema = {
type: 'string',
title: '单据类型',
"x-component": 'text',
default: '销售发货单',
default: '采购收货单',
},
digest: {
type: 'string',
......@@ -111,7 +111,7 @@ const relatedInfo: ISchema = {
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
title: getIntl().formatMessage({ id: 'saleOrder.xiangguanxinxi', defaultMessage: '相关信息' }),
title: '相关信息',
id: 'relatedInfo',
},
properties: {
......@@ -145,7 +145,7 @@ const relatedInfo: ISchema = {
},
address: {
type: 'string',
title: '货地址',
title: '货地址',
"x-component": 'text',
},
memberName: {
......
......@@ -7,7 +7,7 @@ const basicInfo: ISchema = {
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
title: getIntl().formatMessage({ id: 'purchaseRequisition.jibenxinxi', defaultMessage: '基本信息' }),
title: '基本信息',
id: 'basicInfo',
},
properties: {
......
import React, { useEffect } from 'react'
import ModalTable, { ModalTableProps } from '@/components/ModalTable'
import { fetchOrderApi } from '../../apis'
import { useModalTable } from '../../model/useModalTable'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd'
import { memberColumns } from '../../constant'
import { useIntl } from 'umi'
export interface MemberModalTableProps extends ModalTableProps {
type?: 'radio' | 'checkbox',
schemaAction: ISchemaFormActions | ISchemaFormAsyncActions,
currentRef?: any,
confirmModal?(),
productRef?: any,
}
const MemberModalTable:React.FC<MemberModalTableProps> = (props) => {
const { type = 'radio', schemaAction, confirmModal, currentRef, ...restProps } = props
const { visible, setVisible, rowSelection, rowSelectionCtl } = useModalTable({type, customKey: 'memberId'})
const intl = useIntl()
useEffect(() => {
if (currentRef) {
currentRef.current = {
setVisible,
visible,
rowSelectionCtl
}
}
}, [])
useEffect(() => {
if(visible) {
const memberId = schemaAction.getFieldValue('vendorMemberId')
rowSelectionCtl.setSelectedRowKeys([memberId])
}
}, [visible])
const handleConfirm = () => {
const rowItem = rowSelectionCtl.selectRow[0]
console.log(rowItem, 'row')
if (rowItem) {
schemaAction.setFieldValue('vendorRoleId', rowItem.roleId)
schemaAction.setFieldValue('vendorMemberId', rowItem.memberId)
schemaAction.setFieldValue('vendorMemberName', rowItem.name)
}
confirmModal && confirmModal()
setVisible(false)
}
return (
<ModalTable
modalTitle={intl.formatMessage({ id: 'purchaseRequisition.xuanzegongyinghui', defaultMessage: '选择供应会员' })}
columns={memberColumns}
visible={visible}
confirm={handleConfirm}
cancel={() => setVisible(false)}
fetchTableData={(params) => fetchOrderApi.getMemberListByMemberName({...params})}
rowSelection={rowSelection}
modalType='memberByDefault'
tableProps={{
rowKey: 'memberId'
}}
{...restProps}
/>
)
}
MemberModalTable.defaultProps = {}
export default MemberModalTable
......@@ -5,7 +5,7 @@ import { FormDetailContext } from '@/formSchema/context';
import { getLogisticsSelectListMemberShipperAddress } from '@/services/LogisticsV2Api';
import { useIntl } from 'umi';
export interface MaterialTableCellProps {
export interface ProductTableCellProps {
title: React.ReactNode;
editable: boolean;
children: React.ReactNode;
......@@ -19,7 +19,7 @@ export interface MaterialTableCellProps {
const EditableContext = React.createContext<any>({});
export const MaterialEditableRow: React.FC<any> = ({...props }) => {
export const ProductEditableRow: React.FC<any> = ({...props }) => {
const [form] = Form.useForm();
const ctx = {
......@@ -35,7 +35,7 @@ export const MaterialEditableRow: React.FC<any> = ({...props }) => {
};
export const MaterialTableCell:React.FC<MaterialTableCellProps> = ({
export const ProductTableCell:React.FC<ProductTableCellProps> = ({
title,
editable,
children,
......@@ -196,6 +196,6 @@ export const MaterialTableCell:React.FC<MaterialTableCellProps> = ({
return <td {...restProps}>{childNode}</td>;
}
MaterialTableCell.defaultProps = {}
ProductTableCell.defaultProps = {}
export default MaterialTableCell
export default ProductTableCell
......@@ -49,63 +49,9 @@ export const procurementProcessField = (value) => {
return value
}
// 会员列
export const memberColumns: any[] = [
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.huiyuanID', defaultMessage: '会员ID' }),
dataIndex: 'memberId',
align: 'center',
key: 'memberId',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.huiyuanmingcheng', defaultMessage: '会员名称' }),
dataIndex: 'name',
align: 'center',
key: 'name',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.gongsileixing', defaultMessage: '公司类型' }),
dataIndex: 'memberTypeName',
align: 'center',
key: 'memberTypeName',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.gongsijuese', defaultMessage: '公司角色' }),
dataIndex: 'roleName',
align: 'center',
key: 'roleName',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.gongsidengji', defaultMessage: '公司等级' }),
dataIndex: 'levelTag',
align: 'center',
key: 'levelTag',
},
]
//组织机构部门列
export const departmentColumns: any[] = [
{
title: 'Id',
dataIndex: 'id',
key: 'id',
className: 'commonHide'
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.jigoudaima', defaultMessage: '机构代码' }),
dataIndex: 'code',
key: 'code',
},
{
title: getIntl().formatMessage({ id: 'purchaseRequisition.jigoumingcheng', defaultMessage: '机构名称' }),
dataIndex: 'title',
key: 'title',
},
]
// 合同下单 物料列表
export const materialInfoColumns: any[] = [
// 单据明细 商品列表
export const productInfoColumns: any[] = [
{
title: 'ID',
dataIndex: 'id',
......
import React, { useRef, useState, useEffect } from 'react'
import React, { useState, useEffect } from 'react'
import { history, useIntl } from 'umi'
import { usePageStatus } from '@/hooks/usePageStatus'
import { Button, Col, message, Row } from 'antd'
import { createFormActions, registerVirtualBox, useFormSpy } from '@formily/antd'
import { SaveOutlined, LinkOutlined } from '@ant-design/icons'
import { SaveOutlined } from '@ant-design/icons'
import NiceForm from '@/components/NiceForm'
import { increaseSchema } from './schema'
import { useMaterialTableChangeForAmount } from './effects'
import { procurementProcessField, procurementRenderField, procurmentRenderInit } from './constant'
import { useUpdate } from '@umijs/hooks'
import { help } from '../../common'
import { useMaterialTable } from './model/useMaterialTable'
import MemberModalTable from './components/memberModalTable'
import { useProductTable } from './model/useProductTable'
import styled from 'styled-components'
import FormDetailHeader from '@/components/FormDetailHeader'
import FormDetailWrapper from '@/components/FormDetailWrapper'
......@@ -52,9 +51,8 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', () => {
</RowStyle>
})
/** 销售发货单 新增 */
/** 新增销售发货单 */
const AddSaleDelevedOrder:React.FC<{}> = () => {
const memberRef = useRef<any>({})
const [formLoading, setFormLoading] = useState(false)
const [btnLoading, setBtnLoading] = useState(false)
const update = useUpdate()
......@@ -63,8 +61,8 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
const { formContext } = useFormDetail()
const intl = useIntl()
// 请购单物料
const { materialColumns, materialComponents } = useMaterialTable(addSchemaAction)
// 单据商品明细
const { productColumns, productComponents } = useProductTable(addSchemaAction)
useEffect(() => {
if (id) {
......@@ -87,7 +85,6 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
let fnResult = null
// 新增订单/编辑订单
const params = { ...value }
console.log(value)
if(formContext.innerFormErrors) {
throw new Error(intl.formatMessage({ id: 'purchaseRequisition.qingwanshandingdan', defaultMessage: '请完善订单物料数据' }))
}
......@@ -105,7 +102,6 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
setBtnLoading(true)
const _params = procurementProcessField(params)
console.log(_params)
if(id) {
fnResult = await postPurchaseRequisitionUpdate({..._params, id})
} else {
......@@ -121,17 +117,9 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
} catch (error) {
setBtnLoading(false)
error?.message && message.error(error.message)
console.log(error)
}
}
// 选择会员弹窗
const handleOrderMember = () => {
memberRef.current.setVisible(true)
}
const memberBtn = <div className='connectBtn' onClick={handleOrderMember}><LinkOutlined style={{marginRight: 4}}/>{intl.formatMessage({ id: 'saleOrder.xuanze', defaultMessage: '选择' })}</div>
const providerValue = {
schemaActions: addSchemaAction,
formContext,
......@@ -167,18 +155,14 @@ const AddSaleDelevedOrder:React.FC<{}> = () => {
}}
expressionScope={{
memberBtn,
materialColumns,
materialComponents,
productColumns,
productComponents,
help,
}}
/>
</FormDetailWrapper>
</FormDetailContext.Provider>
{/* 选择供应会员 */}
<MemberModalTable currentRef={memberRef} schemaAction={addSchemaAction}/>
</div>)
}
......
import { useState } from 'react'
import { ISchemaFormActions, ISchemaFormAsyncActions } from '@formily/antd';
import { Button } from 'antd';
import { materialInfoColumns } from '../constant';
import MaterialTableCell, { MaterialEditableRow } from '../components/materialTableCell';
import { productInfoColumns } from '../constant';
import { useIntl } from 'umi';
import ProductTableCell, { ProductEditableRow } from '../components/productTableCell';
export const getUnitPriceTotal = (record) => {
const purchaseCount = Number(record['quantity']) || 0
......@@ -14,7 +13,7 @@ export const getUnitPriceTotal = (record) => {
/**
* @param ctx schemaAction
*/
export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
export const useProductTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const intl = useIntl()
const handleDelete = (record) => {
......@@ -25,17 +24,17 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
ctx.setFieldValue('products', newData)
}
const [materialColumns, setMaterialColumns] = useState(() => {
const [productColumns, setProductColumns] = useState(() => {
// 渲染操作
materialInfoColumns[materialInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({ id: 'purchaseRequisition.shanchu', defaultMessage: '删除' })}</Button>
materialInfoColumns[materialInfoColumns.length - 2].render = (t, r) => r.amount && <span style={{color: 'red'}}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency'})} {Number(r.amount).toFixed(2)}</span>
return materialInfoColumns
productInfoColumns[productInfoColumns.length - 1].render = (text, record) => <Button type='link' onClick={() => handleDelete(record)}>{intl.formatMessage({ id: 'purchaseRequisition.shanchu', defaultMessage: '删除' })}</Button>
productInfoColumns[productInfoColumns.length - 2].render = (t, r) => r.amount && <span style={{color: 'red'}}>{intl.formatMessage({ id: 'commodity.products.directChannel.columns.currency'})} {Number(r.amount).toFixed(2)}</span>
return productInfoColumns
})
const materialComponents = {
const productComponents = {
body: {
row: MaterialEditableRow,
cell: MaterialTableCell
row: ProductEditableRow,
cell: ProductTableCell
}
}
......@@ -55,7 +54,7 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
})
};
const materialMergeColumns = materialColumns.map(col => {
const productMergeColumns = productColumns.map(col => {
if (!col.editable) {
return col;
}
......@@ -74,7 +73,7 @@ export const useMaterialTable = (ctx: ISchemaFormActions | ISchemaFormAsyncActio
})
return {
materialColumns: materialMergeColumns,
materialComponents,
productColumns: productMergeColumns,
productComponents,
}
}
......@@ -8,7 +8,7 @@ const basicInfo: ISchema = {
type: 'object',
"x-component": 'MellowCard',
"x-component-props": {
title: getIntl().formatMessage({ id: 'purchaseRequisition.jibenxinxi', defaultMessage: '基本信息' }),
title: '基本信息',
id: 'basicInfo',
},
properties: {
......@@ -175,8 +175,8 @@ const material: ISchema = {
required: true,
"x-component-props": {
rowKey: 'id',
columns: "{{materialColumns}}",
components: "{{materialComponents}}",
columns: "{{productColumns}}",
components: "{{productComponents}}",
},
},
NO_SUBMIT_SPY: {
......
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