Commit 65e54c08 authored by 前端-黄佳鑫's avatar 前端-黄佳鑫
parents 1c99235f 6d5f3452
......@@ -3,7 +3,7 @@
* @Date: 2020-07-31 19:56:22
* @LastEditors: XieZhiXiong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-22 20:53:52
* @LastEditTime: 2020-09-23 09:35:27
*/
const TranactionRoute = {
......@@ -358,16 +358,16 @@ const TranactionRoute = {
name: 'analysis',
component: '@/pages/transaction/supplierEvaluation/analysis',
},
{
path: '/memberCenter/tranactionAbility/supplierEvaluation/received',
name: 'received',
component: '@/pages/transaction/supplierEvaluation/received',
},
{
path: '/memberCenter/tranactionAbility/supplierEvaluation/sent',
name: 'sent',
component: '@/pages/transaction/supplierEvaluation/sent',
},
// {
// path: '/memberCenter/tranactionAbility/supplierEvaluation/received',
// name: 'received',
// component: '@/pages/transaction/supplierEvaluation/received',
// },
// {
// path: '/memberCenter/tranactionAbility/supplierEvaluation/sent',
// name: 'sent',
// component: '@/pages/transaction/supplierEvaluation/sent',
// },
],
},
]
......
......@@ -141,7 +141,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
)}
collapsed={collapsed}
onCollapse={handleMenuCollapse}
disableContentMargin={currentRouter.noMargin !== undefined}
disableContentMargin={currentRouter?.noMargin !== undefined}
breadcrumbRender={(routers = []) => [
]}
......
......@@ -5,8 +5,8 @@ import { getAuth, setAuth, setRouters } from '@/utils/auth';
import { PublicApi } from '@/services/api';
interface MemberRole {
memberRoleId: number;
memberRoleName: string;
memberRoleId: number;
memberRoleName: string;
};
const Roles: React.FC = () => {
......@@ -14,12 +14,12 @@ const Roles: React.FC = () => {
const [roles, setRoles] = useState<MemberRole[]>([]);
useEffect(() => {
const userInfo = getAuth();
setRoles(userInfo.roles || []);
const userInfo = getAuth() || {};
setRoles(userInfo.roles || []);
if (userInfo.roles && userInfo.roles.length) {
const current = userInfo.roles.find(item => item.memberRoleId === userInfo.memberRoleId);
setCurRole(current);
setCurRole(current);
}
}, []);
......@@ -30,19 +30,19 @@ const Roles: React.FC = () => {
}
const msg = message.loading({
content: '正在切换角色...',
duration: 0,
content: '正在切换角色...',
duration: 0,
});
PublicApi.postMemberLoginSwitchrole({
memberRoleId,
memberRoleId,
}).then(res => {
if (res.code !== 1000) {
return;
}
msg();
setAuth(res.data);
setRouters(res.data.urls);
setRouters(res.data.urls);
setTimeout(() => {
window.location.replace('/memberCenter/home');
}, 800);
......@@ -62,9 +62,9 @@ const Roles: React.FC = () => {
);
return (
<Dropdown
overlay={menuHeaderDropdown}
placement="bottomRight"
<Dropdown
overlay={menuHeaderDropdown}
placement="bottomRight"
>
<Space size={5} style={{ cursor: 'pointer', padding: '0 15px' }}>
{curRole?.memberRoleName}
......@@ -72,6 +72,6 @@ const Roles: React.FC = () => {
</Space>
</Dropdown>
)
};
};
export default Roles;
\ No newline at end of file
......@@ -138,7 +138,7 @@ const SetPrice:React.FC<IProps> = (props) => {
render: (text, record) => {
if (!text || JSON.stringify(text)==='{}') return null
return Object.keys(text).map((v, i) => {
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{text[v]}</span></span><br /></>
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{priceType===3?'':'¥'}{text[v]}</span></span><br /></>
})
}
})
......
......@@ -43,7 +43,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const updateFlag = useRef(true) // 是否第一次构建
const [priceForm] = Form.useForm()
const [setPriceForm] = Form.useForm()
const [planPrice, setPlanPrice] = useState(1) //商品定价类型
const [planPrice, setPlanPrice] = useState(1) //商品定价类型 ref替代
// const priceTypeRef = useRef<number>(1)
const [unitData, setUnitData] = useState<any>([])
const [unitValue, setUnitValue] = useState(undefined)
const [setPriceModal, setSetPriceModal] = useState(false)
......@@ -76,8 +77,9 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
onRef(priceFormRef)
if(history.location.query?.id){ // 编辑情况下 用于判断价格类型和显示单位
setPlanPrice(productInfoByEdit?.priceType)
// priceTypeRef.current = productInfoByEdit?.priceType
handleUnitSearch(getPriceAttributeFormParamsByEdit.unitName)
setMinOrderNumber(productInfoByEdit?.minOrder) // 先设置最小起订数 便于后续价格校验
setMinOrderNumber(productInfoByEdit?.minOrder)
}
return ()=>{
console.log('价格属性组件卸载')
......@@ -87,8 +89,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
useEffect(()=>{
constructedCallback()
console.log(productSelectAttribute, 'productSelectAttribute')
},[productName,selectedGoods, productSelectAttribute, planPrice])
// console.log(productSelectAttribute, 'productSelectAttribute')
},[productName, selectedGoods, productSelectAttribute, planPrice])
/* 生成建表所需要的属性 属性值等数组数据 */
const generateNeedData = (hasAttribute: IProductSelectAttribute[]) => {
......@@ -225,7 +227,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
}
}
if(_attributeNameArr?.length>0){ // ?*9.12*
if(_attributeNameArr?.length>0){
_attributeNameArr.map( _attr => {
_col.push({
title: _attr,
......@@ -243,7 +245,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let _priceRange = _tableDataSource[record['索引']]["单价"]
if (!_priceRange || JSON.stringify(_priceRange)==='{}') return null
return Object.keys(_priceRange).map((v, i) => {
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{_priceRange[v]}</span></span><br /></>
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{planPrice===3?'':'¥'}{_priceRange[v]}</span></span><br /></>
})
}
})
......@@ -277,7 +279,6 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
Array.isArray(_rowArr) ? _rowArr.map((__rowArr, index) => {
_tempObj[_attributeNameArr[index]] = __rowArr
}) : _tempObj[_attributeNameArr[i]||_attributeNameArr[0]] = _rowArr // 当一项变动的时候 找_attributeNameArr可能会找不到 找不到的情况下置为索引0的那项
if(productInfoByEdit?.id){
// 编辑的时候,先指定数据中的货品id,如果是重新组合的不存在id就使用选择的货品中的第一个,如果没有置为0;同理,不存在单价就置为{}
_tempObj['对应货品'] = productInfoByEdit.unitPriceAndPicList[i]?.goods?.id || selectedGoods[0]?.id || 0
......@@ -293,16 +294,18 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let _tempObj: any = { 索引: 0 ,商品名称: productName }
_tempObj['对应货品'] = selectedGoods.length > 0 ? selectedGoods[0].id : 0 // 编辑情况下 对应货品id和单价 特殊处理
_tempObj['单价'] = productInfoByEdit?.unitPriceAndPicList[0]?.unitPrice || {}
_tableData.push(_tempObj)
}
// console.log(_tableData, '_tableData') // 只有一项 变动情况下表格数据的key获取不到
_tableDataSource = _tableData
// 有前面tab变动引起的二次构建 需要清空价格数据
if(updateFlag.current){
// *****bug编辑积分商品(非现货价格)会导致价格类型变动引发重复渲染*****
updateFlag.current = false
} else {
_tableDataSource.map(item => item['单价'] = {})
// ***** 编辑情况下且是积分商品 不做清空单价处理*****
if(!(productInfoByEdit?.id && planPrice === 3))
_tableDataSource.map(item => item['单价'] = {})
}
setTableDataSource(productName ? _tableDataSource : []) // 通过商品名称来判断是否显示表格数据
......@@ -406,6 +409,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
setPriceForm.resetFields()
setLadderPrice(false)
setPlanPrice(v.target.value)
// priceTypeRef.current = v.target.value
}
const setPriceOk = () => {
......@@ -686,7 +690,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
initialValues={{ladderPrice: false}}
>
{
planPrice!==3 &&
planPrice!==3 &&
<Form.Item
label=""
name="ladderPrice"
......
......@@ -41,7 +41,6 @@ const ModifyDirectChannel:React.FC<{}> = () => {
const [visibleAddSpec, setVisibleAddSpec] = useState(false)
const [channelDetails, setChannelDetails] = useState<any>()
const [priceType, setPriceType] = useState<any>()
const [specColumn, setSpecColumn] = useState<any[]>([])
const [specTableData, setSpecTableData] = useState<any[]>([])
const [originTableData, setOriginTableData] = useState<any[]>([])
......@@ -56,6 +55,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
const [submitParams, setSubmitParams] = useState<any>()
const flagRef = useRef(false) // 价格数据是否被模态框替换
const priceTypeRef = useRef<number>()
useEffect(() => {
......@@ -66,9 +66,9 @@ const ModifyDirectChannel:React.FC<{}> = () => {
const { data } = res
if(res.code === 1000){
setChannelDetails(data)
setPriceType(data.channelCommodity.commodity.priceType)
priceTypeRef.current = data.channelCommodity.commodity.priceType
formPrice.setFieldsValue({isMemberPrice: data?.isMemberPrice})
structureTable(data.unitPriceAndPicList, data.channelCommodity.commodity.name, true) // 初始已有规格
structureTable(data.unitPriceAndPicList, data.channelCommodity.commodity, true) // 初始已有规格
}
})
}, [])
......@@ -97,8 +97,8 @@ const ModifyDirectChannel:React.FC<{}> = () => {
}
/** name<string>商品名称 noModal<boolean>不执行规格modla的操作 */
const structureTable = (data: any, name?: string, noModal?: boolean) => {
console.log(data, 'structureTableData')
const structureTable = (data: any, commodity?: any, noModal?: boolean) => {
console.log(data,'structureTableData')
// 构建规格弹框table 列columns
let col: any = []
let temp: any = []
......@@ -134,13 +134,13 @@ const ModifyDirectChannel:React.FC<{}> = () => {
},
...temp,
{
title: priceType === 3 ? '积分' : '单价',
title: priceTypeRef.current === 3 ? '积分' : '单价',
dataIndex: '单价',
key: '单价',
render: (text, record) => {
if (!text || JSON.stringify(text)==='{}') return null
return Object.keys(text).map((v, i) => {
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{text[v]}</span></span><br /></>
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{priceTypeRef.current===3?'':'¥'}{text[v]}</span></span><br /></>
})
}
})
......@@ -156,7 +156,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
"id": item.id, // 行数据id
"goodsId": item.goods?.id || '', // 货品ID 可能为null
"索引": index,
"商品名称": name || channelDetails?.channelCommodity?.commodity?.name,
"商品名称": commodity?.name || channelDetails?.channelCommodity?.commodity?.name,
"对应货品": item.goods?.name || '',
...temp,
"单价": item.unitPrice
......@@ -186,7 +186,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
render: (text: any, record: any) => {
return (
<>
<Button type='link' onClick={()=>clickSetPrice(record)}>{priceType===3?'设置积分':'设置价格'}</Button>
<Button type='link' onClick={()=>clickSetPrice(record)}>{priceTypeRef.current===3?'设置积分':'设置价格'}</Button>
{ channelDetails.status !== 6 && <Button type='link' onClick={()=>clickDelete(record)}>删除</Button> }
</>
)
......@@ -407,14 +407,14 @@ const ModifyDirectChannel:React.FC<{}> = () => {
<PlusOutlined /> 选择商品规格
</Button>
{
priceTableData.length > 0 && priceType != 2 &&
priceTableData.length > 0 && priceTypeRef.current != 2 &&
<Button
type="text"
style={{float: 'right'}}
onClick={clickBatchSetPrice}
>
<SettingOutlined />
{priceType === 3 ? '批量设置积分' : '批量设置价格'}
{priceTypeRef.current === 3 ? '批量设置积分' : '批量设置价格'}
</Button>
}
<Table rowKey="id" dataSource={priceTableData} columns={priceColumn} style={{clear: 'both'}} />
......@@ -423,7 +423,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
</Card>
<Modal
title={priceType===3 ? (isBatchSetting ? '批量设置积分' : '设置积分') : (isBatchSetting? '批量设置价格' : '设置价格')}
title={priceTypeRef.current===3 ? (isBatchSetting ? '批量设置积分' : '设置积分') : (isBatchSetting? '批量设置价格' : '设置价格')}
visible={modifyModal}
onOk={handlePriceOk}
onCancel={()=>setModifyModal(false)}
......@@ -437,7 +437,7 @@ const ModifyDirectChannel:React.FC<{}> = () => {
initialValues={{ladderPrice: false}}
>
{
priceType!==3 &&
priceTypeRef.current!==3 &&
<Form.Item
label=""
name="ladderPrice"
......@@ -561,21 +561,21 @@ const ModifyDirectChannel:React.FC<{}> = () => {
}}
</Form.List>
</Form.Item> : <Form.Item
label={priceType===3?"所需积分":"单价"}
label={priceTypeRef.current===3?"所需积分":"单价"}
name="uniquePrice"
rules={[
{
required: true,
type: 'number',
message: priceType===3?'请输入积分!':'请输入价格!'
message: priceTypeRef.current===3?'请输入积分!':'请输入价格!'
},
{
pattern: priceType!==3 ? /^\d+(\.\d{1,4})?$/ : /^[1-9]\d*$/,
message: priceType!==3 ? '小数点后仅限四位' : '请正确输入积分',
pattern: priceTypeRef.current!==3 ? /^\d+(\.\d{1,4})?$/ : /^[1-9]\d*$/,
message: priceTypeRef.current!==3 ? '小数点后仅限四位' : '请正确输入积分',
}
]}
>
<InputNumber min={0} style={{width: '100%'}} placeholder={priceType===3?"请输入积分":"请输入价格"} />
<InputNumber min={0} style={{width: '100%'}} placeholder={priceTypeRef.current===3?"请输入积分":"请输入价格"} />
</Form.Item>
}
</Form>
......
......@@ -69,7 +69,7 @@ const ViewDriectChannel: React.FC<{}> = () => {
render: (text, record) => {
if (!text || JSON.stringify(text)==='{}') return null
return Object.keys(text).map((v, i) => {
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{text[v]}</span></span><br /></>
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{commodity.priceType===3?'':'¥'}{text[v]}</span></span><br /></>
})
}
})
......
......@@ -55,7 +55,7 @@ const viewProducts: React.FC<{}> = () => {
console.log(data, 'data')
setPorductDetail(data)
renderDataByTab(data)
constructTableData(data.name, data.unitPriceAndPicList)
constructTableData(data, data.unitPriceAndPicList)
if(data.status===1) setFixStep(0)
else if(data.status===2) setFixStep(1)
else if(data.status===3) setFixStep(2)
......@@ -94,6 +94,7 @@ const viewProducts: React.FC<{}> = () => {
title: '序号',
dataIndex: 'memberRoleId',
key: 'memberRoleId',
render: (t, c, i) => i + 1
},
{
title: '角色',
......@@ -239,9 +240,9 @@ const viewProducts: React.FC<{}> = () => {
}
/* 构建表格数据 */
const constructTableData = (productName: string, unitPriceAndPicList: GetProductCommodityGetCommodityResponse["unitPriceAndPicList"]) => {
const constructTableData = (product: any, unitPriceAndPicList: GetProductCommodityGetCommodityResponse["unitPriceAndPicList"]) => {
// 构建列
console.log(productName, unitPriceAndPicList, '构建列')
console.log(product, unitPriceAndPicList, '构建列')
let _col = [];
let col_productName = { title: '商品名称', dataIndex: '商品名称', key: '索引' }
_col.push(col_productName)
......@@ -272,13 +273,13 @@ const viewProducts: React.FC<{}> = () => {
}
}
_col.push({
title: productDetail?.priceType===3?'所需积分':'单价(元)',
title: product?.priceType===3?'所需积分':'单价(元)',
dataIndex: '单价',
key: '单价',
render: (text, record) => {
if (JSON.stringify(text)==='{}') return null
return Object.keys(text).map((v, i) => {
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{text[v]}</span></span><br /></>
return <><span key={i}>{v==='0-0'?'':`${v}:`} <span style={{color:'red'}}>{product?.priceType===3?'':'¥'}{text[v]}</span></span><br /></>
})
}
})
......@@ -291,7 +292,6 @@ const viewProducts: React.FC<{}> = () => {
let _imageArrByImageRender: any[] = []
_tableData = unitPriceAndPicList.map((item, index) => {
_imageArrByImageRender.push(item.commodityPic)
console.log(item)
let attrArrayWithObj = item.attributeAndValueList.map(_item=>{
let _temp = {}
_temp[_item.customerAttribute.name] = _item.customerAttributeValue.value
......@@ -304,7 +304,7 @@ const viewProducts: React.FC<{}> = () => {
_attributeArrByImageRender.push(attrWithObj)
let temp = {
"索引": index,
"商品名称": productName,
"商品名称": product.name,
"对应货品": item.goods?.code+'/'+item.goods?.name+'/'+item.goods?.type,
...attrWithObj,
"单价": item.unitPrice,
......
......@@ -43,7 +43,8 @@ const detailInfo: React.FC<{}> = () => {
let [dataInfo, setdataInfo] = useState<any>({
status: '',
digest: '',
logisticsOrderNo:'',
logisticsOrderCode:'',
invoicesNo:'',
companyName:'',
invoicesTime:'',
detailList:[],
......@@ -84,7 +85,7 @@ const detailInfo: React.FC<{}> = () => {
base: {
title: '基本信息',
leftElem: [
{ title: '对应发货单号:', key: 'shipmentOrderNo',value: dataInfo.shipmentOrderNo },
{ title: '对应发货单号:', key: 'shipmentOrderNo',value: dataInfo.shipmentOrderCode },
{ title: '对应订单号/售后单:', key: '',value: dataInfo.invoicesNo }
],
centerElem: [
......@@ -233,7 +234,7 @@ const detailInfo: React.FC<{}> = () => {
})
}
//物流单处理 物流单查询
if (pathname === '/memberCenter/logisticsAbility/logisticsResult/orderResultDeatil') {
PublicApi.getLogisticsOrderConfirmGet({ id: id }).then(res => {
setdataInfo(res.data)
......
/*
* @Author: LeeJiancong
* @Date: 2020-09-23 10:24:42
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-23 11:29:20
* 外部流转记录
*/
import React, { Component,useRef,ReactNode } from 'react';
import { PublicApi } from '@/services/api'
import {StandardTable} from 'god'
import {Badge} from 'antd'
import {ColumnType} from 'antd/lib/table/interface'
import moment from 'moment'
const columns: ColumnType<any>[] = [
{
title: '序号',
dataIndex: 'operatorRoleId',
align: 'center',
key: 'operatorRoleId',
},
{
title: '操作角色',
dataIndex: 'operatorRoleName',
align: 'center',
key: 'operatorRoleName',
},
{
title: '状态',
dataIndex: 'status',
align: 'left',
key: 'status',
render: (text: number, record: any) => {
let component: ReactNode = null;
text === 1 ? component = <Badge status='default' text="待提交" />:
text === 2 ? component = <Badge status='processing' text="待确认" />:
text === 3 ? component = <Badge status='success' text="接受物流单" />:
component = <Badge status='error' text="不接受物流单" />
return component;
},
},
{
title: '操作',
dataIndex: 'type',
align: 'center',
key: 'type',
render: (text: number ,record:any) =>
<>{text === 1 ?'提交物流单':'确认物流单'}</>
},
{
title: '操作时间',
dataIndex: 'operateTime',
align: 'center',
key: 'operateTime',
render:(text: any, record: any) => <>{moment(text).format('YYYY-MM-DD HH:mm:ss')}</>
},
{
title: '审核意见',
dataIndex: 'remark',
align: 'center',
key: 'remark',
width: 300
},
];
export interface Params{
id: string | number,
pathName?: string,
type: string //Submit 能力中心待提交
}
const Log: React.FC<Params> = (props) => {
const ref = useRef<any>({})
const fetchData = (params: any) => {
if(!props.id){
return
}
if(props.type === 'Submit'){
return new Promise((resolve, reject) => {
PublicApi.getLogisticsOrderWaitSubmitPageOrderLog({...params,orderId:props.id}).then(res => {
if(res.code === 1000){
resolve(res.data)
}
})
});
}
};
return <StandardTable
tableProps={{rowKey:'id'}}
currentRef={ref}
columns={columns}
fetchTableData={(params: any) => fetchData(params)}
/>
}
Log.defaultProps= {
type:"Submit"
}
export default Log
\ No newline at end of file
......@@ -3,7 +3,7 @@
* @Date: 2020-07-28 11:25:30
* @LastEditors: LeeJiancong
* @Copyright: 1549414730@qq.com
* @LastEditTime: 2020-09-22 16:48:27
* @LastEditTime: 2020-09-23 15:39:49
*/
import React, { Component, useEffect, useRef, useState, ReactNode } from 'react'
......@@ -17,6 +17,7 @@ import { PATTERN_MAPS } from '@/constants/regExp'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
import { PageStatus, usePageStatus } from '@/hooks/usePageStatus'
import ListMadal from '../components/sumbitOrderModal'
import OrderLog from '../components/pageOrderLog'
import { PublicApi } from '@/services/api'
import {
Submit,
......@@ -327,16 +328,32 @@ const Deatail: React.FC<{}> = () => {
</Button>
)
/**
* @description: 保存
* @param {type}
* @return {type}
*/
const FormSubmit = (values: any) => {
let value = { ...values }
console.log('value', value, JSON.stringify(value))
PublicApi.postLogisticsOrderWaitSubmitAdd(value).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack()
}, 1000)
}
})
if(id){
value['id'] = id
PublicApi.postLogisticsOrderWaitSubmitUpdate(value).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack()
}, 1000)
}
})
}else{
PublicApi.postLogisticsOrderWaitSubmitAdd(value).then(res => {
if (res.code === 1000) {
setTimeout(() => {
history.goBack()
}, 1000)
}
})
}
}
const headList = [
{
......@@ -390,28 +407,37 @@ const Deatail: React.FC<{}> = () => {
onFieldValueChange$('detailList').subscribe(({ value }) => {
setFieldValue('detailList', value)
let detailData = value
let _totalCarton = 0, _totalVolume = 0, _totalWeight = 0
if (detailData && detailData.length > 0) {
detailData.forEach(v => {
if (v.amount && v.carton) {
_totalCarton += Number(v.amount) * Number(v.carton)
}
if (v.amount && v.volume) {
_totalVolume += Number(v.amount) * Number(v.volume)
}
if (v.amount && v.weight) {
_totalWeight += Number(v.amount) * Number(v.weight)
}
});
setTotalCarton(_totalCarton)
setTotalVolume(_totalVolume)
setTotalWeight(_totalWeight)
}
computedALL(detailData)
})
}
/**
* @description: 结算 计算
* @param {type}
* @return {type}
*/
const computedALL = (data) => {
let _totalCarton = 0, _totalVolume = 0, _totalWeight = 0
if (data && data.length > 0) {
data.forEach(v => {
if (v.amount && v.carton) {
_totalCarton += Number(v.carton)
}
if (v.amount && v.volume) {
_totalVolume += Number(v.volume)
}
if (v.amount && v.weight) {
_totalWeight += Number(v.weight)
}
});
}
setTotalCarton(_totalCarton)
setTotalVolume(_totalVolume)
setTotalWeight(_totalWeight)
}
/**
* @description: 订单 || 发货单弹窗
* @param {type}
* @return {type}
......@@ -427,17 +453,17 @@ const Deatail: React.FC<{}> = () => {
setvisibleObj({ ...visibleObj, ModalSeletOrder1: false })
break;
case 2://发货单
// memberName 收货方
let {deliveryAddresId, fullAddress,memberName } = values[0]
setShipmentOrderID(id)
setReceiverAddress(address)
actions.setFieldValue('shipmentOrderCode', orderNo)
actions.setFieldValue("receiverName",memberName)
actions.setFieldValue("receiverAddressId",deliveryAddresId)
actions.setFieldValue("receiverFullAddress",fullAddress)
setvisibleObj({ ...visibleObj, ModalSeletOrder2: false })
break;
}
}
......@@ -536,16 +562,9 @@ const Deatail: React.FC<{}> = () => {
</Col>
</Row>
<FormItem name="id2" label='收货方'>
<>
{}
</>
</FormItem>
<FormItem label='收货地址'>
<>
{receiverAddress}
</>
</FormItem>
<FormItem editable={false} name="receiverName" label='收货方' component={Input}/>
<FormItem display={false} editable={false} name="receiverAddressId" label='收货地址id' component={Input}/>
<FormItem editable={false} name="receiverFullAddress" label='收货地址' component={Input}/>
<FormItem name="shipperAddressId" label="发货地址" dataSource={shipperAddress} required component={Select} />
</Col>
</Row>
......@@ -575,7 +594,15 @@ const Deatail: React.FC<{}> = () => {
}
</Row>
{state.value.map((item: any, index: any) => {
const onRemove = (index: number) => mutators.remove(index)
const onRemove = (index: number) => {
mutators.remove(index)
console.log(index)
let list = actions.getFieldValue('detailList')
let _list = list.splice(1,index)
console.log('_list',_list)
actions.setFieldValue('detailList',..._list)
computedALL(_list)
}
return (
<>
<Row gutter={[10, 10]} key={'index' + index}>
......@@ -661,7 +688,7 @@ const Deatail: React.FC<{}> = () => {
/>
</Col>
<Col span={1}>
<Button type='link' onClick={onRemove.bind(null, index)}>删除</Button>
<Button type='link' onClick={() => onRemove(index)}>删除</Button>
</Col>
</Row>
......@@ -701,12 +728,7 @@ const Deatail: React.FC<{}> = () => {
</FormItem>
</TabPane>
<TabPane key='tab-4' tab='流转记录'>
<StandardTable
tableProps={{ rowKey: 'id' }}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchData(params)}
/>
<OrderLog id={id} type="Submit"/>
</TabPane>
</Tabs>
......@@ -728,13 +750,6 @@ const Deatail: React.FC<{}> = () => {
dialogVisible={visibleObj.ModalSeletOrder2}
onCancel={() => setvisibleObj({ ...visibleObj, ModalSeletOrder2: false })}
/>
{/*
<ListMadal title='选择商品'
columns={columns3}
type={3}
dialogVisible={visibleObj.ModalSeletOrder3}
onCancel={() => setvisibleObj({ ...visibleObj, ModalSeletOrder3: false })}
/> */}
<ModalTable
modalTitle='选择商品'
confirm={handleConfirmProduct}
......
......@@ -42,6 +42,8 @@ const Order: React.FC<OrderPropsType> = (props) => {
const [selectAddressInfo, setSelectAddressInfo] = useState<GetLogisticsReceiverAddressGetResponse>()
const [selectInvoiceInfo, setSelectInvoiceInfo] = useState<any>()
const [logisticsFee, setLogisticsFee] = useState<number>(0)
const [isElectronicContract, setIsElectronicContract] = useState<boolean>(false) // 是否选用电子合同
const [contractInfo, setContractInfo] = useState()
useEffect(() => {
if (!spam_id) {
......@@ -75,12 +77,28 @@ const Order: React.FC<OrderPropsType> = (props) => {
item.orderList = tempOrderList
result.push(item)
}
const productId = sessionOrderInfo?.orderList[0]?.orderList[0].id
if (productId) {
try {
const rulesRes = await PublicApi.getOrderTradingRulesByProductId({ productId })
const { data } = rulesRes
if (data) {
// 是否选用电子合同
if (data.isElectronicContract) {
setIsElectronicContract(true)
}
}
} catch (error) {
console.log("获取交易规则失败")
}
}
setOrderList(result)
setOrderInfo(sessionOrderInfo)
setSpinningState(false)
}
const renderLogisticsInfo = (type, logisticsInfo) => {
switch (type) {
case 1:
......@@ -245,6 +263,7 @@ const Order: React.FC<OrderPropsType> = (props) => {
}
const checkOrder = () => {
message.destroy()
if (isEmpty(selectPayWay)) {
message.info('请选择支付方式')
return
......@@ -256,12 +275,17 @@ const Order: React.FC<OrderPropsType> = (props) => {
}
}
if (!needTheContract) {
if (isElectronicContract && !needTheContract) {
message.info('请先同意签订电子合同')
return
}
setSignModalVisible(true)
// submitOrder()
// 根据状态判断是否需要签订电子合同
if (isElectronicContract) {
setSignModalVisible(true)
} else {
submitOrder()
}
}
const handleSignModalConfirm = () => {
......@@ -287,7 +311,9 @@ const Order: React.FC<OrderPropsType> = (props) => {
<PayWay selectItem={selectPayWay} payWayList={orderInfo.payWayList} onChange={(val) => setSelectPayWay(val)} />
{/* <Delivery /> */}
<Invoice state={needTheInvoice} onChange={(val) => setNeedTheInvoice(val)} onSelect={(val) => setSelectInvoiceInfo(val)} />
<Contract state={needTheContract} onChange={(val) => setneedTheContract(val)} />
{
isElectronicContract && <Contract state={needTheContract} onChange={(val) => setneedTheContract(val)} />
}
<div className={styles.common_title}>
<span>订单信息</span>
</div>
......
......@@ -16,6 +16,7 @@ import {
DownOutlined,
} from '@ant-design/icons';
import { StandardTable } from 'god';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd';
import EyePreview from '@/components/EyePreview';
......@@ -41,8 +42,21 @@ import { MEMBER_OUTER_STATUS_TYPE, MEMBER_STATUS_TAG_MAP } from '../constant';
const formActions = createFormActions();
const fetchListData = async (params: any) => {
let res = await PublicApi.getMemberAbilitySubPage(params);
return res.data;
const { startDate = null, endDate = null } = params;
const payload = { ...params };
if (startDate) {
payload.startDate = moment(+startDate).format('YYYY-MM-DD');
}
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilitySubPage(payload);
if (res.code === 1000) {
return res.data;
}
return [];
};
const MemberMaintain: React.FC<[]> = () => {
......
......@@ -12,6 +12,7 @@ import {
DownOutlined,
} from '@ant-design/icons';
import { StandardTable } from 'god';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
......@@ -38,8 +39,21 @@ import { coverColFiltersItem } from '../utils';
const formActions = createFormActions();
const fetchData = async (params: any) => {
let res = await PublicApi.getMemberAbilityMaintenancePage(params);
return res.data;
const { startDate = null, endDate = null } = params;
const payload = { ...params };
if (startDate) {
payload.startDate = moment(+startDate).format('YYYY-MM-DD');
}
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilityMaintenancePage(payload);
if (res.code === 1000) {
return res.data;
}
return [];
};
const MemberMaintain: React.FC<[]> = () => {
......
......@@ -3,6 +3,7 @@ import { history } from 'umi';
import { Card, Space, Button, Badge, Modal, message } from 'antd';
import { ClockCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { StandardTable } from 'god';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd';
import EyePreview from '@/components/EyePreview';
......@@ -126,8 +127,22 @@ const MemberPr1: React.FC<{}> = props => {
};
const fetchListData = async (params: any) => {
let res = await PublicApi.getMemberAbilityValidateStep1Page(params);
return res.data;
const { startDate = null, endDate = null } = params;
const payload = { ...params };
if (startDate) {
payload.startDate = moment(+startDate).format('YYYY-MM-DD');
}
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilityValidateStep1Page(payload);
if (res.code === 1000) {
return res.data;
}
return [];
};
const handleBatch = () => {
......
......@@ -3,6 +3,7 @@ import { history } from 'umi';
import { Card, Space, Button, Badge, Modal, message } from 'antd';
import { ClockCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { StandardTable } from 'god';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd';
import EyePreview from '@/components/EyePreview';
......@@ -126,8 +127,22 @@ const MemberPr2: React.FC<{}> = props => {
};
const fetchListData = async (params: any) => {
let res = await PublicApi.getMemberAbilityValidateStep2Page(params);
return res.data;
const { startDate = null, endDate = null } = params;
const payload = { ...params };
if (startDate) {
payload.startDate = moment(+startDate).format('YYYY-MM-DD');
}
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilityValidateStep2Page(payload);
if (res.code === 1000) {
return res.data;
}
return [];
};
const handleBatch = () => {
......
......@@ -3,6 +3,7 @@ import { history } from 'umi';
import { Card, Space, Button, Badge, Modal, message } from 'antd';
import { ClockCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { StandardTable } from 'god';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd';
import EyePreview from '@/components/EyePreview';
......@@ -129,8 +130,22 @@ const MemberPrConfirm: React.FC<{}> = props => {
};
const fetchListData = async (params: any) => {
let res = await PublicApi.getMemberAbilityValidateConfirmPage(params);
return res.data;
const { startDate = null, endDate = null } = params;
const payload = { ...params };
if (startDate) {
payload.startDate = moment(+startDate).format('YYYY-MM-DD');
}
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilityValidateConfirmPage(payload);
if (res.code === 1000) {
return res.data;
}
return [];
};
const handleBatch = () => {
......
......@@ -3,6 +3,7 @@ import { history } from 'umi';
import { Card, Space, Button, Badge, Modal, message } from 'antd';
import { ClockCircleOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { StandardTable } from 'god';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd';
import EyePreview from '@/components/EyePreview';
......@@ -126,8 +127,22 @@ const MemberPrSubmit: React.FC<{}> = props => {
};
const fetchListData = async (params: any) => {
let res = await PublicApi.getMemberAbilityValidateCommitPage(params);
return res.data;
const { startDate = null, endDate = null } = params;
const payload = { ...params };
if (startDate) {
payload.startDate = moment(+startDate).format('YYYY-MM-DD');
}
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilityValidateCommitPage(payload);
if (res.code === 1000) {
return res.data;
}
return [];
};
const handleBatch = () => {
......
import React from 'react'
import cx from 'classnames'
import { Button, Pagination } from 'antd'
import { StarFilled } from '@ant-design/icons'
import shop_icon from '@/assets/imgs/shop_icon.png'
import credit_icon from '@/assets/imgs/credit_icon.png'
import styles from './index.less'
const Commodity: React.FC = () => {
let CommodityList = Array.apply({}, new Array(7))
return (
<div>
Commodity
</div>
<>
<div className={styles.commodity_list}>
{
CommodityList.map((item, index) => (
<div className={styles.commodity_list_item} key={`commodity_list_item_${index}`}>
<div className={cx(styles.commodity_list_item_item, styles.morehalf)}>
<div className={styles.shop_header_info}>
<div className={styles.shop_header_info_logo}>
<img src="https://shushangyun01.oss-cn-shenzhen.aliyuncs.com/69f3f329d5a848119dc89029a10acb081600332395671.jpg" />
</div>
<div className={styles.shop_header_info_content}>
<p className={styles.commodity_name}>0.8-1.0mm黑色手折纹胎水牛皮</p>
<ul className={styles.tags_list}>
<li className={styles.tags_list_item} key={`tags_list_item`}>黄牛头皮层自然摔纹</li>
<li className={styles.tags_list_item} key={`tags_list_item`}>硬度适中偏软</li>
<li className={styles.tags_list_item} key={`tags_list_item`}>手感舒适</li>
</ul>
</div>
</div>
</div>
<div className={cx(styles.commodity_list_item_item)}>
<div className={styles.shop_header_info_content_about_item}>
<i className={styles.icon}><img src={credit_icon} /></i>
<span>1288</span>
</div>
<div className={styles.commodity_shopname}>温州市龙昌皮业有限公司</div>
</div>
<div className={cx(styles.commodity_list_item_item)}>
{/* <div className={styles.commodity_price}>
<span>¥</span>
<label>79.00</label>
</div> */}
{/* <div className={styles.commodity_tag}>在线询价</div> */}
<div className={styles.commodity_point}>
2,000~3,000积分
</div>
</div>
<div className={cx(styles.commodity_list_item_item)}>
<span className={styles.date}>2020-10-25 10:58</span>
</div>
<div className={cx(styles.commodity_list_item_item)}>
<div className={styles.collection_state_wrap}>
<div className={cx(styles.collection_state)}>
<StarFilled />
<label>收藏</label>
</div>
<Button className={styles.collection_state_wrap_btn} type="primary">再次购买</Button>
</div>
</div>
</div>
))
}
</div>
<div className={styles.pagination_wrap}>
<Pagination showSizeChanger={false} defaultCurrent={1} total={100} />
</div>
</>
)
}
......
......@@ -152,6 +152,195 @@
}
}
.commodity_list {
&_item {
position: relative;
display: flex;
margin-bottom: 16px;
&_item {
flex: 1;
display: flex;
justify-content: center;
flex-direction: column;
.commodity_shopname {
color: #909399;
font-size: 12px;
margin-top: 4px;
}
.commodity_price {
color: #D32F2F;
}
.commodity_point {
color: #EA8000;
}
.commodity_tag {
width: 68px;
height: 24px;
line-height: 24px;
text-align: center;
background-color: #F0F8FF;
color: #3F7ED2;
font-size: 12px;
}
&.morehalf {
flex: 1.5;
}
.shop_header_info {
position: relative;
display: flex;
&_logo {
border-radius: 4px;
overflow: hidden;
width: 72px;
height: 72px;
margin-right: 16px;
&>img {
width: 72px;
height: 72px;
}
}
&_content {
position: relative;
display: flex;
flex-direction: column;
justify-content: center;
.commodity_name {
color: #303133;
margin-bottom: 4px;
max-width: 300px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.tags_list {
padding: 0;
margin: 0;
&_item {
display: inline-block;
list-style: none;
color: #999999;
font-size: 12px;
margin-right: 20px;
}
}
&_name {
font-size: 14px;
color: #333333;
font-weight: 500;
}
&_about {
display: flex;
margin-top: 10px;
&_item {
// flex: 1;
display: flex;
align-items: center;
margin-right: 16px;
&>span {
font-size: 14px;
color: #333333;
line-height: 20px;
&.red {
color: #D32F2F;
margin-right: 4px;
}
}
&>.icon {
position: relative;
top: -1px;
overflow: hidden;
margin-right: 5px;
&>img {
width: 20px;
height: 20px;
}
}
}
}
&_icon {
color: #cccccc;
font-size: 12px;
margin-left: 6px;
}
}
}
.date {
color: #909399;
font-size: 12px;
}
.collection_state_wrap {
display: flex;
align-items: center;
&_btn {
margin-left: 28px;
}
}
.collection_state {
font-size: 14px;
color: #00B37A;
cursor: pointer;
&>label {
margin-left: 4px;
cursor: pointer;
}
}
.rate_wrap {
font-size: 12px;
:global {
.ant-rate {
font-size: 14px;
}
}
}
.level_icon {
width: 54px;
height: 16px;
margin-bottom: 4px;
display: block;
background-size: 100% 100%;
background-repeat: no-repeat;
&.level3 {
background-image: url(/static/imgs/level2@2x.png);
}
}
}
}
}
.information_list {
&_item {
position: relative;
......
......@@ -15,7 +15,7 @@ const Collection: React.FC = () => {
return (
<PageHeaderWrapper>
<div className={styles.collection_wrap}>
<Tabs defaultActiveKey="information" className={styles.collection_tabs} >
<Tabs defaultActiveKey="commodity" className={styles.collection_tabs} >
<TabPane tab="商品收藏" key="commodity">
<Commodity />
</TabPane>
......
......@@ -24,9 +24,20 @@ export const billsTypeDetailSchema: ISchema = {
title: '单据类型编号',
'x-component-props': {
placeholder: '最长10个字符',
maxLength: 5,
maxLength: 10,
},
required: true,
'x-rules': [
{
required: true,
message: '请输入单据类型编号',
},
{
validator: value => {
const CNReg = /[\u4E00-\u9FA5]/g;
return CNReg.test(value) ? '请输入非中文字符,可以是字母 + 数字 + 字符的组合' : '';
},
},
],
},
name: {
type: 'string',
......
......@@ -110,7 +110,16 @@ export const warehouseDetailSchema: ISchema = {
'x-component-props': {
label: '仓库名称',
wrapperCol: 24,
required: true,
'x-rules': [
{
required: true,
message: '请输入仓库名称',
},
{
limitByte: true, // 自定义校验规则
maxByte: 20,
}
],
},
properties: {
MEGA_LAYOUT1_1: {
......@@ -185,7 +194,13 @@ export const warehouseDetailSchema: ISchema = {
principal: {
type: 'string',
title: '仓库负责人',
'x-component-props': {},
'x-component-props': {},
'x-rules': [
{
limitByte: true, // 自定义校验规则
maxByte: 16,
}
],
},
MEGA_LAYOUT2: {
type: 'object',
......@@ -221,10 +236,6 @@ export const warehouseDetailSchema: ISchema = {
},
'x-rules': [
{
required: true,
message: '请输入你的手机号码',
},
{
pattern: PATTERN_MAPS.phone,
message: '请输入正确格式的手机号',
},
......
......@@ -100,7 +100,7 @@ const Analysis: React.FC = () => {
<TabPane tab="概览" key="1">
<Shelves title="评价统计">
<Row gutter={24}>
<Col span={8}>
<Col flex="399px">
<Pie
hasLegend
subTitle="累计评价"
......@@ -114,7 +114,7 @@ const Analysis: React.FC = () => {
/>
</Col>
<Col span={16}>
<Col flex="auto">
<PolymericTable
dataSource={evaluate}
columns={evaluateColumns}
......
......@@ -8,6 +8,7 @@
padding: 14px 16px;
line-height: 14px;
display: flex;
align-items: center;
background: #FAFBFC;
color: #303133;
......
......@@ -28,10 +28,11 @@ const AddRule:React.FC<{}> = (props) => {
values.products = values.products.map(item => ({ productId: item.id, productName: item.name, category: item.customerCategoryName, productPrice: item.priceType, brand: item.brandName }))
values.isElectronicContract = values.isElectronicContract ? 1 : 0
const params = omit(values, ['state']) // 移除不需要的字段
await PublicApi.postOrderTradingRulesAdd(params)
setTimeout(() => {
history.goBack(-1)
}, 1000)
console.log(params, 'params')
// await PublicApi.postOrderTradingRulesAdd(params)
// setTimeout(() => {
// history.goBack(-1)
// }, 1000)
}
return (
......
import React, {useState} from 'react'
import React, {useEffect, useState} from 'react'
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'
import { useInitValue } from '@/formSchema/effects/useInitValue'
import EyePreview from '@/components/EyePreview'
......@@ -33,15 +33,14 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
const { addSchemaAction, schema, formSubmit, onFieldChange = () => {} } = props
const [visibleChannelRroduct, setVisibleChannelRroduct] = useState(false)
const [productRowSelection, productRowCtl] = useRowSelectionTable({customKey: 'id'})
const [productsLength, setProductsLength] = useState(0)
const [initValue, setInitialValue] = useState({});
const {
id,
preview,
pageStatus
} = usePageStatus()
const initValue = useInitValue(PublicApi.getOrderTradingRulesDetails)
useUnitPreview(initValue, addSchemaAction)
const fetchProductList = async (params) => {
const shopIds = addSchemaAction.getFieldValue('shopIds')
......@@ -63,7 +62,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
// table删除商品
const handleDeleteTable = (id) => {
const value = addSchemaAction.getFieldValue('products')
addSchemaAction.setFieldValue('products', findItemAndDelete(value, id, 'productId'))
addSchemaAction.setFieldValue('products', findItemAndDelete(value, id))
}
const handleAddProductBtn = () => {
......@@ -73,7 +72,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
// return false
// }
const checkBoxs = addSchemaAction.getFieldValue('products')
productRowCtl.setSelectedRowKeys(checkBoxs.map(v => v.productId))
productRowCtl.setSelectedRowKeys(checkBoxs.map(v => v.id))
productRowCtl.setSelectRow(checkBoxs)
setVisibleChannelRroduct(true)
}
......@@ -94,13 +93,13 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
render: (_, record) => <EyePreview url={`/memberCenter/commodityAbility/commodity/products/viewProducts?id=${record.id}`}>{_}</EyePreview>
},
{
dataIndex: 'customerCategoryName',
dataIndex: 'customerCategoryName',
title: '品类',
key: 'customerCategoryName'
},
{
dataIndex: 'brandName',
title: '品牌',
title: '品牌',
key: 'brandName'
},
{
......@@ -131,6 +130,7 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
// 商品添加弹窗控制
const handleOkAddProduct = async () => {
setVisibleChannelRroduct(false)
setProductsLength(productRowCtl.selectRow.length);
addSchemaAction.setFieldValue('products', productRowCtl.selectRow)
}
......@@ -238,6 +238,38 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
}
}
useEffect(() => {
async function getInitValue() {
const { data } = await PublicApi.getOrderTradingRulesDetails({id: id});
if(data.isTacitlyApprove === 2) {
const res = await getBindingProducts({id: id.toString(), current: '1', pageSize: '10'});
addSchemaAction.setFieldState('products', (state) => {
state.value = res.data
})
setProductsLength(res.totalCount);
}
addSchemaAction.setFieldValue('isElectronicContract', data?.isElectronicContract ? true : false)
addSchemaAction.setFieldValue('isTacitlyApprove', data?.isTacitlyApprove)
setInitialValue(data)
}
if(id != '') {
getInitValue();
}
}, [id])
// 拿到绑定的商品
const getBindingProducts = async ({id = '1', current = '1', pageSize = '10'}) => {
const res = await PublicApi.getOrderTradingRulesProductList({tradingRulesId: id, current, pageSize});
return res.data
}
const paginationChange = async (page: number, size: number) => {
if(id !== '') {
const result = await getBindingProducts({id, current: page.toString(), pageSize: size.toString()})
addSchemaAction.setFieldValue('products', result.data)
}
}
return (
<>
<NiceForm
......@@ -247,6 +279,8 @@ const RuleSetting:React.FC<RuleSettingProps> = (props) => {
expressionScope={{
tableColumns,
tableAddButton,
paginationChange,
productsLength
}}
components={{
SelectProcesss,
......
......@@ -22,15 +22,6 @@ export const createAddContractTemplateEffect = (context: ISchemaFormActions) =>
export const useUnitPreview = (initValue, context) => {
useEffect(() => {
context.setFieldValue('isElectronicContract', initValue?.isElectronicContract ? true : false)
// console.log(initValue, 'init')
// if (initValue) {
// context.setFieldState('inventory', state => {
// if (!state.props['x-props']) {
// state.props['x-props'] = {}
// }
// state.props['x-props'].addonAfter = <div style={{marginLeft: 4}}>{initValue.unit}</div>
// })
// context.setFieldValue('itemNo', initValue.itemNo)
// }
context.setFieldValue('isTacitlyApprove', initValue?.isTacitlyApprove)
}, [initValue])
}
\ No newline at end of file
......@@ -173,7 +173,7 @@ export const ruleDetailSchema: ISchema = padRequiredMessage({
type: 'array:number',
"x-component": 'MultTable',
"x-component-props": {
rowKey: 'productId',
rowKey: 'id',
columns: "{{tableColumns}}",
prefix: "{{tableAddButton}}"
}
......
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