Commit 3d5b83d4 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

Merge branch 'dev' into test

parents f0e03866 a63820dd
registry = "http://10.0.0.19:7001" registry="http://10.0.0.19:4873"
# registry = "https://registry.npmjs.org/" # registry = "https://registry.npmjs.org/"
...@@ -978,6 +978,7 @@ export enum DeliverySideState { ...@@ -978,6 +978,7 @@ export enum DeliverySideState {
// 订单外部显示文案 // 订单外部显示文案
export const PurchaseOrderOutWorkStateTexts = { export const PurchaseOrderOutWorkStateTexts = {
"-1": "取消订单", "-1": "取消订单",
0: '订单完成',
1: '待提交订单', 1: '待提交订单',
2: '待确认订单', 2: '待确认订单',
3: '待确认电子合同', 3: '待确认电子合同',
...@@ -1051,6 +1052,7 @@ export const SaleOrderInsideWorkStateTexts = { ...@@ -1051,6 +1052,7 @@ export const SaleOrderInsideWorkStateTexts = {
// 订单流转记录外部状态 // 订单流转记录外部状态
export const OrderTransformOutWorkStateTexts = { export const OrderTransformOutWorkStateTexts = {
"-1": '取消订单', "-1": '取消订单',
0: '订单完成',
1: '待确认', 1: '待确认',
2: '待确认电子合同', 2: '待确认电子合同',
3: '待支付', 3: '待支付',
...@@ -1074,6 +1076,7 @@ export const OrderTransformOutWorkStateTexts = { ...@@ -1074,6 +1076,7 @@ export const OrderTransformOutWorkStateTexts = {
// 采购订单流转记录内部状态 // 采购订单流转记录内部状态
export const PurchaseOrderTransformInsideWorkStateTexts = { export const PurchaseOrderTransformInsideWorkStateTexts = {
"-1": '取消订单', "-1": '取消订单',
0: '订单完成',
1: '待提交审核', 1: '待提交审核',
2: '提交审核通过', 2: '提交审核通过',
3: '审核通过', 3: '审核通过',
......
...@@ -33,7 +33,7 @@ const { Option } = Select ...@@ -33,7 +33,7 @@ const { Option } = Select
let _tableDataSource: any = [] let _tableDataSource: any = []
const PriceAttributeForm: React.FC<Iprops> = (props) => { const PriceAttributeForm: React.FC<Iprops> = (props) => {
const { onRef } = props const { onRef } = props
const priceFormRef = useRef() const priceFormRef = useRef()
const updateFlag = useRef(true) // 是否第一次构建 const updateFlag = useRef(true) // 是否第一次构建
...@@ -58,15 +58,15 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -58,15 +58,15 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
const [colums, setColumns] = useState<ColumnType<any>[]>() const [colums, setColumns] = useState<ColumnType<any>[]>()
const { ProductStore } = store const { ProductStore } = store
const { const {
productName, productName,
selectedGoods, selectedGoods,
productSelectAttribute, productSelectAttribute,
setProductSelectAttribute, setProductSelectAttribute,
tableDataSource, tableDataSource,
setTableDataSource, setTableDataSource,
clearData, clearData,
setPriceAttributeParams, setPriceAttributeParams,
productInfoByEdit, productInfoByEdit,
getPriceAttributeFormParamsByEdit, getPriceAttributeFormParamsByEdit,
selectCategoryId, selectCategoryId,
...@@ -136,7 +136,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -136,7 +136,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
useEffect(() => { useEffect(() => {
// 品类 变动清空form和属性组合 // 品类 变动清空form和属性组合
if(history.location.query?.id && !flagRef.current) { if(history.location.query?.id && !flagRef.current) {
flagRef.current = true flagRef.current = true
} else { } else {
// setProductSelectAttribute([]) // setProductSelectAttribute([])
priceForm.resetFields() priceForm.resetFields()
...@@ -147,7 +147,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -147,7 +147,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
/** /**
* 添加clearPrice.current依赖,处理在未渲染价格属性前已经变动了价格属性组合,此时需要清空价格数据 * 添加clearPrice.current依赖,处理在未渲染价格属性前已经变动了价格属性组合,此时需要清空价格数据
* bug: 在不改变那价格属性组合情况下修改价格可以保留,当属性组合变动之后,修改价格再做其他修改时会清空价格(原因:clearPrice.current始终为true) * bug: 在不改变那价格属性组合情况下修改价格可以保留,当属性组合变动之后,修改价格再做其他修改时会清空价格(原因:clearPrice.current始终为true)
* 添加 tabClickItem * 添加 tabClickItem
* 价格属性变动引发的构建,清空价格(仅清空一次)之后置为false * 价格属性变动引发的构建,清空价格(仅清空一次)之后置为false
*/ */
useEffect(()=>{ useEffect(()=>{
...@@ -170,7 +170,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -170,7 +170,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if(hasAttribute.length){ // 提取价格属性 属性名数组 属性值SKU数组 /*编辑情况下直接进入此页面length为空 此时需获取调用接口返回的数据生成*/ if(hasAttribute.length){ // 提取价格属性 属性名数组 属性值SKU数组 /*编辑情况下直接进入此页面length为空 此时需获取调用接口返回的数据生成*/
hasAttribute.map(_item=>{ hasAttribute.map(_item=>{
_attributeNameArr.push(_item.attributeName) // 用于列header _attributeNameArr.push(_item.attributeName) // 用于列header
_temp_attributeObjArr.push({attributeName: _item.attributeName, customerAttributeId: _item.customerAttributeId}) _temp_attributeObjArr.push({attributeName: _item.attributeName, customerAttributeId: _item.customerAttributeId})
let _tempArr = [] let _tempArr = []
let _tempObjArr = [] // 取id备用 //....若为日期属性,此处应获取日期段的每一天 进行特殊处理....// let _tempObjArr = [] // 取id备用 //....若为日期属性,此处应获取日期段的每一天 进行特殊处理....//
// if(_item.isDate){ // if(_item.isDate){
...@@ -273,14 +273,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -273,14 +273,14 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if(_attributeNameArr?.length>0){ if(_attributeNameArr?.length>0){
_attributeNameArr.map( _attr => { _attributeNameArr.map( _attr => {
_col.push({ _col.push({
title: _attr, title: _attr,
dataIndex: _attr, dataIndex: _attr,
key: _attr key: _attr
}) })
}) })
} }
_col.push({ _col.push({
title: planPrice===3?'所需积分':'单价(元)', title: planPrice===3?'所需积分':'单价(元)',
dataIndex: '单价', dataIndex: '单价',
key: '单价', key: '单价',
width: 200, width: 200,
...@@ -389,21 +389,21 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -389,21 +389,21 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
let _tempArr: any = [] let _tempArr: any = []
Array.isArray(item) ? item.map((_item, _index) => { /* code2 */ Array.isArray(item) ? item.map((_item, _index) => { /* code2 */
let _tempObject: any = {}; let _tempObject: any = {};
_tempObject.customerAttribute = { _tempObject.customerAttribute = {
id: attributeObjArr[_index].customerAttributeId, id: attributeObjArr[_index].customerAttributeId,
name: attributeObjArr[_index].attributeName name: attributeObjArr[_index].attributeName
} }
_tempObject.customerAttributeValue = { _tempObject.customerAttributeValue = {
id: attributeValObjArr.map(__item => __item.find(_ => _.value===_item)).filter(__ => __)[0].id, id: attributeValObjArr.map(__item => __item.find(_ => _.value===_item)).filter(__ => __)[0].id,
value: item[_index] value: item[_index]
} }
_tempArr.push(_tempObject) _tempArr.push(_tempObject)
}) : ( /* code3 */ }) : ( /* code3 */
// ** 可能是单一多选 attributeValObjArr可能为多个 // ** 可能是单一多选 attributeValObjArr可能为多个
_tempArr.push({ _tempArr.push({
customerAttribute: { customerAttribute: {
id: attributeObjArr[0].customerAttributeId, id: attributeObjArr[0].customerAttributeId,
name: attributeObjArr[0].attributeName name: attributeObjArr[0].attributeName
}, },
customerAttributeValue: { customerAttributeValue: {
...@@ -414,7 +414,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -414,7 +414,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
) /* code3 end */ /* code2 end */ ) /* code3 end */ /* code2 end */
_paramsArray.push({ _paramsArray.push({
goodsId: _tableDataSource[index] ? _tableDataSource[index]['对应货品'] : 0, goodsId: _tableDataSource[index] ? _tableDataSource[index]['对应货品'] : 0,
attributeAndValueList: _tempArr, attributeAndValueList: _tempArr,
unitPrice: _tableDataSource[index]&&_tableDataSource[index]['单价'], unitPrice: _tableDataSource[index]&&_tableDataSource[index]['单价'],
id: _tableDataSource[index]&&_tableDataSource[index]['规格ID'], id: _tableDataSource[index]&&_tableDataSource[index]['规格ID'],
}) /*带上货品id 带上单价*/ }) /*带上货品id 带上单价*/
...@@ -432,7 +432,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -432,7 +432,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
/** /**
* @description table选择货品改变对应的data数据 * @description table选择货品改变对应的data数据
* @param v modal数据对象 * @param v modal数据对象
* @param record table行记录 * @param record table行记录
*/ */
const tableSelelctChange = (v: number, record: any) => { const tableSelelctChange = (v: number, record: any) => {
let _row = { ...record, 对应货品: v } let _row = { ...record, 对应货品: v }
...@@ -526,12 +526,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -526,12 +526,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
if(numberArray[0][0] === minOrder){ if(numberArray[0][0] === minOrder){
let tempArr = []; let tempArr = [];
numberArray.map((_item, _index) => { numberArray.map((_item, _index) => {
tempArr.push({ numberPrice: priceArray[_index], numberRange: { numberMin: _item[0], numberMax: _item[1] } }) tempArr.push({ numberPrice: priceArray[_index], numberRange: { numberMin: _item[0], numberMax: _item[1] } })
}) })
setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr}) setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr})
}else{ }else{
let tempArr = []; let tempArr = [];
tempArr.push({ numberPrice: null, numberRange: { numberMin: minOrder, numberMax: null } }) tempArr.push({ numberPrice: null, numberRange: { numberMin: minOrder, numberMax: null } })
setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr}) setPriceForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr})
} }
} }
...@@ -558,6 +558,25 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -558,6 +558,25 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// 校验阶梯范围 // 校验阶梯范围
const validatorNumberRange = (rule, value, callback) => { const validatorNumberRange = (rule, value, callback) => {
let minOrder = Number(minOrderNumber)
let precision;
if(Number.isInteger(minOrder)) { // 整数取1
precision = 1
} else { // 小数取最小精度(最多三位)
switch(minOrderNumber.toString().split(".")[1].length) {
case 1:
precision = 0.1
break;
case 2:
precision = 0.01
break;
case 3:
precision = 0.001
break;
default:
precision = 1
}
}
try { try {
if(Array.isArray(value)){ if(Array.isArray(value)){
let range = value.map(item => { let range = value.map(item => {
...@@ -565,6 +584,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -565,6 +584,12 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
return Object.values(item.numberRange) return Object.values(item.numberRange)
}).reduce( }).reduce(
function(a, b) { function(a, b) {
// 判断首位数是否满足精度
if(a.length && b.length) {
if((Number(b[0])*1000 - Number(a[a.length-1])*1000)/1000 !== precision) {
throw new Error('请正确输入阶梯数量范围');
}
}
return a.concat(b); return a.concat(b);
}, },
[] []
...@@ -589,8 +614,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -589,8 +614,8 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
/** /**
* 按属性归类 * 按属性归类
* @param objectArray * @param objectArray
* @param {string} property * @param {string} property
*/ */
const groupBy = (objectArray, property) => { const groupBy = (objectArray, property) => {
...@@ -615,7 +640,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -615,7 +640,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
// initialValues={productInfoByEdit?.id ? getPriceAttributeFormParamsByEdit : {isMemberPrice: false, priceType: planPrice}} // initialValues={productInfoByEdit?.id ? getPriceAttributeFormParamsByEdit : {isMemberPrice: false, priceType: planPrice}}
autoComplete="off" autoComplete="off"
> >
<Form.Item <Form.Item
name="unitId" name="unitId"
label={ label={
<span> <span>
...@@ -725,10 +750,10 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -725,10 +750,10 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
{ {
planPrice != 2 && productName && <Button type="text" style={{float: 'right'}} onClick={clickBatchSetPrice}><SettingOutlined />{planPrice === 3 ? '批量设置积分' : '批量设置价格'}</Button> planPrice != 2 && productName && <Button type="text" style={{float: 'right'}} onClick={clickBatchSetPrice}><SettingOutlined />{planPrice === 3 ? '批量设置积分' : '批量设置价格'}</Button>
} }
<Table <Table
rowKey="索引" rowKey="索引"
dataSource={tableDataSource} dataSource={tableDataSource}
columns={planPrice === 2 ? colums.slice(0, colums.length-2) : colums} columns={planPrice === 2 ? colums.slice(0, colums.length-2) : colums}
pagination={false} pagination={false}
locale={{emptyText:<>暂无数据<br />请先完善商品基本信息项!</>}} locale={{emptyText:<>暂无数据<br />请先完善商品基本信息项!</>}}
style={{clear: 'both'}} style={{clear: 'both'}}
...@@ -750,7 +775,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -750,7 +775,7 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
initialValues={{ladderPrice: false}} initialValues={{ladderPrice: false}}
autoComplete="off" autoComplete="off"
> >
{ {
planPrice!==3 && planPrice!==3 &&
<Form.Item <Form.Item
label="" label=""
...@@ -874,4 +899,4 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => { ...@@ -874,4 +899,4 @@ const PriceAttributeForm: React.FC<Iprops> = (props) => {
</>) </>)
} }
export default observer(PriceAttributeForm) export default observer(PriceAttributeForm)
\ No newline at end of file
...@@ -197,7 +197,7 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -197,7 +197,7 @@ const FastModifyPrice: React.FC<{}> = () => {
let priceArray = Object.values(data) let priceArray = Object.values(data)
let tempArr = []; let tempArr = [];
numberArray.map((_item, _index) => { numberArray.map((_item, _index) => {
tempArr.push({ numberPrice: priceArray[_index], numberRange: { numberMin: _item[0], numberMax: _item[1] } }) tempArr.push({ numberPrice: priceArray[_index], numberRange: { numberMin: _item[0], numberMax: _item[1] } })
}) })
setForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr}) setForm.setFieldsValue({ladderPrice: true, ladderRange: tempArr})
} }
...@@ -237,6 +237,25 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -237,6 +237,25 @@ const FastModifyPrice: React.FC<{}> = () => {
// 校验阶梯范围 // 校验阶梯范围
const validatorNumberRange = (rule, value, callback) => { const validatorNumberRange = (rule, value, callback) => {
let minOrder = Number(currentRow.minOrder)
let precision;
if(Number.isInteger(minOrder)) { // 整数取1
precision = 1
} else { // 小数取最小精度(最多三位)
switch(minOrder.toString().split(".")[1].length) {
case 1:
precision = 0.1
break;
case 2:
precision = 0.01
break;
case 3:
precision = 0.001
break;
default:
precision = 1
}
}
try { try {
if(Array.isArray(value)){ if(Array.isArray(value)){
let range = value.map(item => { let range = value.map(item => {
...@@ -244,6 +263,12 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -244,6 +263,12 @@ const FastModifyPrice: React.FC<{}> = () => {
return Object.values(item.numberRange) return Object.values(item.numberRange)
}).reduce( }).reduce(
function(a, b) { function(a, b) {
// 判断首位数是否满足精度
if(a.length && b.length) {
if((Number(b[0])*1000 - Number(a[1])*1000)/1000 !== precision) {
throw new Error('请正确输入阶梯数量范围');
}
}
return a.concat(b); return a.concat(b);
}, },
[] []
...@@ -283,7 +308,7 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -283,7 +308,7 @@ const FastModifyPrice: React.FC<{}> = () => {
FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state => { FormEffectHooks.onFieldChange$('customerCategoryId').subscribe(state => {
searchCustomerCategoryOptionEffect(actions, 'customerCategoryId') searchCustomerCategoryOptionEffect(actions, 'customerCategoryId')
}) })
}} }}
schema={fastSchema} schema={fastSchema}
/> />
} }
...@@ -406,9 +431,9 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -406,9 +431,9 @@ const FastModifyPrice: React.FC<{}> = () => {
label={priceType===3 ? "积分" : "单价"} label={priceType===3 ? "积分" : "单价"}
name="uniquePrice" name="uniquePrice"
rules={[ rules={[
{ {
required: true, required: true,
message: priceType===3 ? '请输入积分!' : '请输入单价!' message: priceType===3 ? '请输入积分!' : '请输入单价!'
}, },
{ {
pattern: priceType!==3 ? /^\d+(\.\d{1,4})?$/ : /^[1-9]\d*$/, pattern: priceType!==3 ? /^\d+(\.\d{1,4})?$/ : /^[1-9]\d*$/,
...@@ -425,4 +450,4 @@ const FastModifyPrice: React.FC<{}> = () => { ...@@ -425,4 +450,4 @@ const FastModifyPrice: React.FC<{}> = () => {
) )
} }
export default FastModifyPrice export default FastModifyPrice
\ No newline at end of file
...@@ -14,10 +14,10 @@ import cx from 'classnames' ...@@ -14,10 +14,10 @@ import cx from 'classnames'
import ReutrnEle from '@/components/ReturnEle' import ReutrnEle from '@/components/ReturnEle'
import styles from "./index.less" import styles from "./index.less"
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { import {
GetProductCommodityGetCommodityResponse, GetProductCommodityGetCommodityResponse,
GetProductCommodityGetCommodityCheckRecordResponse, GetProductCommodityGetCommodityCheckRecordResponse,
GetProductCommodityGetShopResponse GetProductCommodityGetShopResponse
} from '@/services/ProductApi' } from '@/services/ProductApi'
import moment from 'moment' import moment from 'moment'
import { isGetAccessor } from 'typescript' import { isGetAccessor } from 'typescript'
...@@ -92,13 +92,13 @@ const viewProducts: React.FC<{}> = () => { ...@@ -92,13 +92,13 @@ const viewProducts: React.FC<{}> = () => {
setLogisticResourceSendAddress(provinceName + cityName + districtName + address) setLogisticResourceSendAddress(provinceName + cityName + districtName + address)
}) })
}, [productDetail]) }, [productDetail])
const columns: ColumnType<any>[] = [ const columns: ColumnType<any>[] = [
{ {
title: '序号', title: '序号',
dataIndex: 'memberRoleId', dataIndex: 'memberRoleId',
key: 'memberRoleId', key: 'memberRoleId',
render: (t, c, i) => i + 1 render: (t, c, i) => i + 1
}, },
{ {
title: '角色', title: '角色',
...@@ -139,7 +139,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -139,7 +139,7 @@ const viewProducts: React.FC<{}> = () => {
title: '操作时间', title: '操作时间',
dataIndex: 'createTime', dataIndex: 'createTime',
key: 'createTime', key: 'createTime',
render: (text: any) => moment(text).format("YYYY-MM-DD HH:mm:ss") render: (text: any) => moment(text).format("YYYY-MM-DD HH:mm:ss")
}, },
{ {
title: '意见', title: '意见',
...@@ -190,7 +190,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -190,7 +190,7 @@ const viewProducts: React.FC<{}> = () => {
component = null component = null
}else }else
if (status === 5) if (status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>) component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (status === 6) else if (status === 6)
component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>) component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>)
else else
...@@ -212,7 +212,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -212,7 +212,7 @@ const viewProducts: React.FC<{}> = () => {
<Descriptions.Item label="商品品牌">{productDetail?.brand?.name}</Descriptions.Item> <Descriptions.Item label="商品品牌">{productDetail?.brand?.name}</Descriptions.Item>
<Descriptions.Item label="商品品类">{productDetail?.customerCategory?.fullName}</Descriptions.Item> <Descriptions.Item label="商品品类">{productDetail?.customerCategory?.fullName}</Descriptions.Item>
{/* { {/* {
productDetail?.commodityShopList?.length>0 && productDetail?.commodityShopList?.length>0 &&
<Descriptions.Item label="上架商城"> <Descriptions.Item label="上架商城">
{ {
productDetail.commodityShopList.map((item, index)=><span key={index}><img width="24" height="24" style={{borderRadius: '50%', marginRight: 4}} src={item.logoUrl} title={item.name} alt={item.name}/></span>) productDetail.commodityShopList.map((item, index)=><span key={index}><img width="24" height="24" style={{borderRadius: '50%', marginRight: 4}} src={item.logoUrl} title={item.name} alt={item.name}/></span>)
...@@ -224,7 +224,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -224,7 +224,7 @@ const viewProducts: React.FC<{}> = () => {
<Descriptions.Item label="商品类型"><span className="commonStatusValid"></span>{renderCustomerCategoryType(productDetail?.customerCategory?.type)}</Descriptions.Item> <Descriptions.Item label="商品类型"><span className="commonStatusValid"></span>{renderCustomerCategoryType(productDetail?.customerCategory?.type)}</Descriptions.Item>
</Descriptions> </Descriptions>
</> </>
const renderPriceType = (type: number) => { const renderPriceType = (type: number) => {
if(type === 1 ) return '现货价格' if(type === 1 ) return '现货价格'
if(type === 2 ) return '价格需要询价' if(type === 2 ) return '价格需要询价'
...@@ -262,22 +262,22 @@ const viewProducts: React.FC<{}> = () => { ...@@ -262,22 +262,22 @@ const viewProducts: React.FC<{}> = () => {
}) })
attributeByValue.map(_ => { attributeByValue.map(_ => {
_col.push({ _col.push({
title: _.name, title: _.name,
dataIndex: _.name, dataIndex: _.name,
key: '索引' key: '索引'
}) })
}) })
} }
if(item.goods?.id){ // 存在货品 if(item.goods?.id){ // 存在货品
_col.push({ _col.push({
title: '对应货品', title: '对应货品',
dataIndex: '对应货品', dataIndex: '对应货品',
key: '索引', key: '索引',
}) })
} }
} }
_col.push({ _col.push({
title: product?.priceType===3?'所需积分':'单价(元)', title: product?.priceType===3?'所需积分':'单价(元)',
dataIndex: '单价', dataIndex: '单价',
key: '单价', key: '单价',
render: (text, record) => { render: (text, record) => {
...@@ -344,8 +344,8 @@ const viewProducts: React.FC<{}> = () => { ...@@ -344,8 +344,8 @@ const viewProducts: React.FC<{}> = () => {
return <> return <>
<p> <p>
{ {
str === 'area' str === 'area'
? ?
showDataSource.map((_item, _i) => <p key={_i}>{_item.provinceName+'/'+(_item.cityName||'')}</p>) showDataSource.map((_item, _i) => <p key={_i}>{_item.provinceName+'/'+(_item.cityName||'')}</p>)
: :
showDataSource.map((_item, _i) => <p key={_i}>{_item.name}</p>) showDataSource.map((_item, _i) => <p key={_i}>{_item.name}</p>)
...@@ -419,7 +419,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -419,7 +419,7 @@ const viewProducts: React.FC<{}> = () => {
</Col> </Col>
</Row> </Row>
{ {
productDetail?.commodityShopList?.length>0 && productDetail?.commodityShopList?.length>0 &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>上架商城:</p> <p>上架商城:</p>
...@@ -438,7 +438,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -438,7 +438,7 @@ const viewProducts: React.FC<{}> = () => {
<Col span={8}> <Col span={8}>
<Card headStyle={{borderBottom:'none'}} title="物流信息" style={{height:'100%'}}> <Card headStyle={{borderBottom:'none'}} title="物流信息" style={{height:'100%'}}>
{ {
renderDeliveryType(productDetail?.logistics?.deliveryType) && renderDeliveryType(productDetail?.logistics?.deliveryType) &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>配送方式:</p> <p>配送方式:</p>
...@@ -460,7 +460,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -460,7 +460,7 @@ const viewProducts: React.FC<{}> = () => {
</Row> </Row>
} }
{ {
productDetail?.logistics?.weight && productDetail?.logistics?.weight &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>重量:</p> <p>重量:</p>
...@@ -471,7 +471,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -471,7 +471,7 @@ const viewProducts: React.FC<{}> = () => {
</Row> </Row>
} }
{ {
logisticTemplateName && logisticTemplateName &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>运费模版:</p> <p>运费模版:</p>
...@@ -482,7 +482,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -482,7 +482,7 @@ const viewProducts: React.FC<{}> = () => {
</Row> </Row>
} }
{ {
logisticResourceCompanyName && logisticResourceCompanyName &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>物流公司:</p> <p>物流公司:</p>
...@@ -493,7 +493,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -493,7 +493,7 @@ const viewProducts: React.FC<{}> = () => {
</Row> </Row>
} }
{ {
logisticResourceSendAddress && logisticResourceSendAddress &&
<Row> <Row>
<Col span={4}> <Col span={4}>
<p>发货地址:</p> <p>发货地址:</p>
...@@ -613,7 +613,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -613,7 +613,7 @@ const viewProducts: React.FC<{}> = () => {
<Col span={6}> <Col span={6}>
<p> <p>
{ {
productDetail?.isMemberPrice && '允许使用会员折扣购买' productDetail?.isMemberPrice ? '允许使用会员折扣购买' : '无'
} }
</p> </p>
</Col> </Col>
...@@ -637,7 +637,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -637,7 +637,7 @@ const viewProducts: React.FC<{}> = () => {
{/* 没有价格属性默认一行直接显示图片 */} {/* 没有价格属性默认一行直接显示图片 */}
<div className={styles.productImgBox}> <div className={styles.productImgBox}>
{ {
productDetail?.unitPriceAndPicList[0].commodityPic.length>0 && productDetail?.unitPriceAndPicList[0].commodityPic.map((_item, index) => productDetail?.unitPriceAndPicList[0].commodityPic.length>0 && productDetail?.unitPriceAndPicList[0].commodityPic.map((_item, index) =>
<div key={index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/> <div key={index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/>
</div>) </div>)
} }
...@@ -665,7 +665,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -665,7 +665,7 @@ const viewProducts: React.FC<{}> = () => {
<Divider /> <Divider />
<div className={styles.productImgBox}> <div className={styles.productImgBox}>
{ {
imageArrByImageRender.length>0 && imageArrByImageRender[index].map((_item, _index) => imageArrByImageRender.length>0 && imageArrByImageRender[index].map((_item, _index) =>
<div key={_index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/> <div key={_index} className={styles.imgItem}><img className={styles.pic} src={_item} alt=""/>
</div>) </div>)
} }
...@@ -680,7 +680,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -680,7 +680,7 @@ const viewProducts: React.FC<{}> = () => {
<Card headStyle={{borderBottom:'none'}} title="商品描述"> <Card headStyle={{borderBottom:'none'}} title="商品描述">
{/* 文字区块 */} {/* 文字区块 */}
{ {
productDetail?.commodityRemark?.word?.length>0 && productDetail?.commodityRemark?.word?.length>0 &&
<div className={cx(styles.descriptionBox, styles.descriptionWordBox)}> <div className={cx(styles.descriptionBox, styles.descriptionWordBox)}>
{ {
productDetail?.commodityRemark?.word.map((_item, _index) => productDetail?.commodityRemark?.word.map((_item, _index) =>
...@@ -691,7 +691,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -691,7 +691,7 @@ const viewProducts: React.FC<{}> = () => {
} }
{/* 视频区块 */} {/* 视频区块 */}
{ {
productDetail?.commodityRemark?.video?.length>0 && productDetail?.commodityRemark?.video?.length>0 &&
<div className={styles.descriptionBox}> <div className={styles.descriptionBox}>
{ {
productDetail?.commodityRemark?.video.map((_item, _index)=> <div key={_index} className={styles.videoItem}> productDetail?.commodityRemark?.video.map((_item, _index)=> <div key={_index} className={styles.videoItem}>
...@@ -704,7 +704,7 @@ const viewProducts: React.FC<{}> = () => { ...@@ -704,7 +704,7 @@ const viewProducts: React.FC<{}> = () => {
} }
{/* 图片区块 */} {/* 图片区块 */}
{ {
productDetail?.commodityRemark?.image?.length>0 && productDetail?.commodityRemark?.image?.length>0 &&
<div className={styles.descriptionBox}> <div className={styles.descriptionBox}>
{ {
productDetail?.commodityRemark?.image.map((_item, _index)=> _item && <div key={_index} className={styles.imgItem}> productDetail?.commodityRemark?.image.map((_item, _index)=> _item && <div key={_index} className={styles.imgItem}>
......
...@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react' ...@@ -2,6 +2,7 @@ import React, { useState, useEffect } from 'react'
import cx from 'classnames' import cx from 'classnames'
import { PublicApi } from '@/services/api' import { PublicApi } from '@/services/api'
import { GetPayCreditGetCreditResponse } from '@/services/PayApi' import { GetPayCreditGetCreditResponse } from '@/services/PayApi'
import { message } from 'antd'
import { DownOutlined } from '@ant-design/icons' import { DownOutlined } from '@ant-design/icons'
import alipayIcon from '@/assets/imgs/alipay_icon.png' import alipayIcon from '@/assets/imgs/alipay_icon.png'
import wechatIcon from '@/assets/imgs/wechat_icon.png' import wechatIcon from '@/assets/imgs/wechat_icon.png'
...@@ -48,6 +49,7 @@ const PayWay: React.FC<PayWayProps> = (props) => { ...@@ -48,6 +49,7 @@ const PayWay: React.FC<PayWayProps> = (props) => {
} }
PublicApi.getPayCreditGetCredit(param).then(res => { PublicApi.getPayCreditGetCredit(param).then(res => {
message.destroy()
if(res.code === 1000) { if(res.code === 1000) {
setCreditInfo(res.data) setCreditInfo(res.data)
} }
......
...@@ -206,8 +206,6 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => { ...@@ -206,8 +206,6 @@ const OrderPayModal: React.FC<OrderPayModalProps> = (props) => {
}).then(res => { }).then(res => {
if(res.code === 1000) { if(res.code === 1000) {
setBalanceInfo(res.data) setBalanceInfo(res.data)
} else {
message.error(res.message)
} }
setIsSpin(false) setIsSpin(false)
}) })
......
import { ISchemaFormActions, FormEffectHooks, IFieldState, ISchemaFormAsyncActions, createEffectHook } from '@formily/antd'; import { ISchemaFormActions, FormEffectHooks, IFieldState, ISchemaFormAsyncActions, createEffectHook } from '@formily/antd';
import { usePageStatus, PageStatus } from '@/hooks/usePageStatus'; import { usePageStatus, PageStatus } from '@/hooks/usePageStatus';
import { useLinkageUtils } from '@/utils/formEffectUtils'; import { useLinkageUtils } from '@/utils/formEffectUtils';
import { orderCombination } from '../constant'; import { orderCombination } from '../constant';
import { history } from 'umi'; import { history } from 'umi';
import { fetchOrderApi } from '../apis'; import { fetchOrderApi } from '../apis';
import { useUpdate } from '@umijs/hooks'; import { useUpdate } from '@umijs/hooks';
import { PublicApi } from '@/services/api'; import { PublicApi } from '@/services/api';
import { filterProductDataById } from '../components/productModalTable' import { filterProductDataById } from '../components/productModalTable'
import { getUnitPriceTotal } from '../model/useProductTable'; import { getUnitPriceTotal } from '../model/useProductTable';
// 异步填充表格字段 // 异步填充表格字段
const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, productValue: any) => { const asyncPadDataForProduct = async (ctx: ISchemaFormActions | ISchemaFormAsyncActions, productValue: any) => {
const productData = productValue.value const productData = productValue.value
const loading = productValue.loading const loading = productValue.loading
if (productData.length === 0 || loading) { if (productData.length === 0 || loading) {
return false return false
} }
ctx.setFieldState(productValue.path, state => { ctx.setFieldState(productValue.path, state => {
state.loading = true state.loading = true
}) })
// 折扣请求 // 折扣请求
const asyncPriceRequests: any[] = await Promise.all(productData.filter(v => v.memberPrice === undefined).map(async v => { const asyncPriceRequests: any[] = await Promise.all(productData.filter(v => v.memberPrice === undefined).map(async v => {
const {code, data} = await PublicApi.getMemberManageUpperCreditParamGet({ const {code, data} = await PublicApi.getMemberManageUpperCreditParamGet({
parentMemberId: v.memberId, parentMemberId: v.memberId,
parentMemberRoleId: v.memberRoleId parentMemberRoleId: v.memberRoleId
}, {ttl: 60 * 1000, useCache: true}) }, {ttl: 60 * 1000, useCache: true})
// return code === 1000 ? { value: (data.parameter * 100) + '%', id: v.id } : { value: '', id: 0 } // return code === 1000 ? { value: (data.parameter * 100) + '%', id: v.id } : { value: '', id: 0 }
return code === 1000 ? { value: data.parameter, id: v.id } : { value: '', id: 0 } return code === 1000 ? { value: data.parameter, id: v.id } : { value: '', id: 0 }
} }
)) ))
// const asyncAddressRequests = await Promise.all(productData.filter(v => v.memberPrice === undefined).map(async v => { // const asyncAddressRequests = await Promise.all(productData.filter(v => v.memberPrice === undefined).map(async v => {
// const {code, data} = await PublicApi.getLogisticsShipperAddressGet({ // const {code, data} = await PublicApi.getLogisticsShipperAddressGet({
// id: v.logistics.sendAddress // id: v.logistics.sendAddress
// }, {ttl: 60 * 1000, useCache: true}) // }, {ttl: 60 * 1000, useCache: true})
// return code === 1000 ? data : null // return code === 1000 ? data : null
// } // }
// )) // ))
// 存在需要异步请求的, 则进行赋值 // 存在需要异步请求的, 则进行赋值
if (asyncPriceRequests.length > 0) { if (asyncPriceRequests.length > 0) {
const newData = productData.map((v, i) => { const newData = productData.map((v, i) => {
if (!v.memberPrice) { if (!v.memberPrice) {
v.memberPrice = asyncPriceRequests.find(j => j.id === v.id)?.value || '' v.memberPrice = asyncPriceRequests.find(j => j.id === v.id)?.value || ''
} }
return v return v
}) })
ctx.setFieldValue('orderProductRequests', newData) ctx.setFieldValue('orderProductRequests', newData)
} }
ctx.setFieldState(productValue.path, state => { ctx.setFieldState(productValue.path, state => {
state.loading = false state.loading = false
}) })
// if (asyncAddressRequests.length > 0) { // if (asyncAddressRequests.length > 0) {
// ctx.setFieldValue('orderProductRequests', productData.map((v, i) => { // ctx.setFieldValue('orderProductRequests', productData.map((v, i) => {
// v.memberPrice = asyncPriceRequests[i] // v.memberPrice = asyncPriceRequests[i]
// return v // return v
// })) // }))
// } // }
// 配送方式请求 // 配送方式请求
// const asyncAddressRequests = productData.filter(v => v.distributeMode !== undefined) // const asyncAddressRequests = productData.filter(v => v.distributeMode !== undefined)
} }
export const createEffects = context => () => { export const createEffects = context => () => {
} }
export const useModelTypeChange = (callback) => { export const useModelTypeChange = (callback) => {
const utils = useLinkageUtils() const utils = useLinkageUtils()
// 下单模式发生改变时 // 下单模式发生改变时
FormEffectHooks.onFieldValueChange$('orderModel').subscribe(state => { FormEffectHooks.onFieldValueChange$('orderModel').subscribe(state => {
callback(state) callback(state)
}) })
} }
export const useEditHideField = () => { export const useEditHideField = () => {
const { pageStatus } = usePageStatus() const { pageStatus } = usePageStatus()
const utils = useLinkageUtils() const utils = useLinkageUtils()
FormEffectHooks.onFormInit$().subscribe(() => { FormEffectHooks.onFormInit$().subscribe(() => {
if (pageStatus === PageStatus.ADD) { if (pageStatus === PageStatus.ADD) {
utils.hide('orderNo') utils.hide('orderNo')
utils.hide('createTime') utils.hide('createTime')
} }
}) })
} }
export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => { export const useProductTableChangeForPay = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, update) => {
const { pageStatus } = usePageStatus() const { pageStatus } = usePageStatus()
FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => { FormEffectHooks.onFieldValueChange$('orderProductRequests').subscribe(state => {
const { value } = state const { value } = state
const payInfoData = ctx.getFieldValue('paymentInformationResponses') const payInfoData = ctx.getFieldValue('paymentInformationResponses')
// 强制渲染一次, 用于触发金额总数 // 强制渲染一次, 用于触发金额总数
update() update()
// // 已经存在数据 无需请求 // // 已经存在数据 无需请求
// if (payInfoData && payInfoData.length > 0) { // if (payInfoData && payInfoData.length > 0) {
// } else // } else
if (value && value.length > 0){ if (value && value.length > 0){
// 请求一次并复制给支付信息 // 请求一次并复制给支付信息
const productItem = value[0] const productItem = value[0]
if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现 console.log(productItem, 'pp')
if(pageStatus === PageStatus.EDIT) { // 编辑下 支付信息联动实现
} else if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数
fetchOrderApi.getPayInfoList({ } else if(pageStatus === PageStatus.ADD) { // 新增下 需要支付信息生成支付次数
productId: productItem?.commodityId ? productItem.id : productItem.productId, fetchOrderApi.getPayInfoList({
memberId: productItem.memberId, productId: productItem?.commodityId ? productItem.id : productItem.productId,
memberRoleId: productItem.memberRoleId, memberId: productItem?.memberId || ctx.getFieldValue('supplyMembersId'),
orderModel: ctx.getFieldValue('orderModel'), memberRoleId: productItem?.memberRoleId || ctx.getFieldValue('supplyMembersRoleId'),
}).then(data => { orderModel: ctx.getFieldValue('orderModel'),
ctx.setFieldValue('paymentInformationResponses', data) }).then(data => {
}).catch(err => { ctx.setFieldValue('paymentInformationResponses', data)
}).catch(err => {
})
} })
} }
}
// 确认后 需根据商品id请求会员折扣接口, 以及配送方式
// 由于商品存在多个, 需对接口做一定缓存 // 确认后 需根据商品id请求会员折扣接口, 以及配送方式
asyncPadDataForProduct(ctx, state) // 由于商品存在多个, 需对接口做一定缓存
}) asyncPadDataForProduct(ctx, state)
} })
}
// 表单初始化时,对应操作
export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => { // 表单初始化时,对应操作
const { modelType = 0, spam_id } = history.location.query export const useOrderFormInitEffect = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
const typeEnums = parseInt(modelType) const { modelType = 0, spam_id } = history.location.query
let auth = JSON.parse(localStorage.getItem('auth')) const typeEnums = parseInt(modelType)
FormEffectHooks.onFormMount$().subscribe(async () => { let auth = JSON.parse(localStorage.getItem('auth'))
FormEffectHooks.onFormMount$().subscribe(async () => {
ctx.setFieldState('orderModel', state => {
state.props.enum = state.props.enum.map(v => { ctx.setFieldState('orderModel', state => {
const assign: any = Object.assign({}, v) state.props.enum = state.props.enum.map(v => {
// 过滤服务提供者 const assign: any = Object.assign({}, v)
if (auth.memberRoleType === 2) { // 采购商 // 过滤服务提供者
// 企业+个人 if (auth.memberRoleType === 2) { // 采购商
// if ((auth.memberType === 1 || auth.memberType === 2) && (assign.value > 9 && assign.value !== 24)) { // 企业+个人
if ((auth.memberType === 1 || auth.memberType === 2) && assign.value > 9) { // if ((auth.memberType === 1 || auth.memberType === 2) && (assign.value > 9 && assign.value !== 24)) {
assign.disabled = true if ((auth.memberType === 1 || auth.memberType === 2) && assign.value > 9) {
} assign.disabled = true
// 渠道(企业+个人) }
if ((auth.memberType === 3 || auth.memberType === 4) && assign.value < 10) { // 渠道(企业+个人)
assign.disabled = true if ((auth.memberType === 3 || auth.memberType === 4) && assign.value < 10) {
} assign.disabled = true
// 商城下单 }
if (orderCombination.queryPageOrderModal.includes(assign.value) && typeEnums !== assign.value) { // 商城下单
assign.disabled = true if (orderCombination.queryPageOrderModal.includes(assign.value) && typeEnums !== assign.value) {
} assign.disabled = true
} else { }
assign.disabled = true } else {
} assign.disabled = true
}
// if (orderCombination.queryPageOrderModal.includes(assign.value) && typeEnums !== assign.value) {
// assign.disabled = true // if (orderCombination.queryPageOrderModal.includes(assign.value) && typeEnums !== assign.value) {
// } // assign.disabled = true
return assign // }
}).sort((prev, next) => prev.disabled ? prev.value : next.value - prev.value) return assign
}).sort((prev, next) => prev.disabled ? prev.value : next.value - prev.value)
})
})
// query中存在modelType参数, 则是从其他页面跳转而来,需禁用其余query选项
// 商城跳转过来的数据 // query中存在modelType参数, 则是从其他页面跳转而来,需禁用其余query选项
const initValue = JSON.parse(window.sessionStorage.getItem(spam_id)) // 商城跳转过来的数据
const initValue = JSON.parse(window.sessionStorage.getItem(spam_id))
// 从商城跳转, 需回显数据
if (initValue) { // 从商城跳转, 需回显数据
const fn = async (initValue) => { if (initValue) {
const productInfo = initValue.orderList[0].orderList const fn = async (initValue) => {
ctx.setFieldValue('supplyMembersId', initValue.supplyMembersId) const productInfo = initValue.orderList[0].orderList
ctx.setFieldValue('supplyMembersRoleId', initValue.supplyMembersRoleId) ctx.setFieldValue('shopId', initValue.shopId)
ctx.setFieldValue('supplyMembersName', initValue.supplyMembersName) ctx.setFieldValue('supplyMembersId', initValue.supplyMembersId)
initValue.idList && ctx.setFieldValue('idList', initValue.idList) ctx.setFieldValue('supplyMembersRoleId', initValue.supplyMembersRoleId)
initValue.productType && ctx.setFieldValue('productType', initValue.productType) ctx.setFieldValue('supplyMembersName', initValue.supplyMembersName)
initValue.idList && ctx.setFieldValue('idList', initValue.idList)
ctx.setFieldValue('orderProductRequests', await filterProductDataById([], productInfo.map(v => { initValue.productType && ctx.setFieldValue('productType', initValue.productType)
return {
...v, ctx.setFieldValue('orderProductRequests', await filterProductDataById([], productInfo.map(v => {
unitPrice: v.priceRange.reduce((prev, next) => { return {
prev[next.range] = next.price ...v,
return prev unitPrice: v.priceRange.reduce((prev, next) => {
}, {}), prev[next.range] = next.price
isMemberPrice: v.isMemberPrice, return prev
purchaseCount: v.count, }, {}),
money: v.count * v.unitPrice, isMemberPrice: v.isMemberPrice,
productId: v.id, purchaseCount: v.count,
memberId: initValue.supplyMembersId, // 添加 memberId 字段 money: v.count * v.unitPrice,
commodityId: v.id, // 添加commodityId用于判断是商品价格是使用price字段还是unitPrice字段(也可判断是报价订单还是其他) productId: v.id,
memberPrice: v.memberDiscount !== 1 ? v.memberDiscount : 1, // 添加会员折扣 memberId: initValue.supplyMembersId, // 添加 memberId 字段
} commodityId: v.id, // 添加commodityId用于判断是商品价格是使用price字段还是unitPrice字段(也可判断是报价订单还是其他)
}) memberPrice: v.memberDiscount !== 1 ? v.memberDiscount : 1, // 添加会员折扣
)) }
} })
))
// 回显的数据保存在表单中, 当切换下单模式时,可以再次回显 }
ctx.setFieldState('orderModel', state => {
state.remoteDataFn = fn // 回显的数据保存在表单中, 当切换下单模式时,可以再次回显
}) ctx.setFieldState('orderModel', state => {
// ctx.setFormState(state => { state.remoteDataFn = fn
// state.remoteDataFn = fn })
// }) // ctx.setFormState(state => {
// state.remoteDataFn = fn
fn(initValue) // })
}
fn(initValue)
// 写入收货地址数据 }
useProductAddress(ctx)
}) // 写入收货地址数据
useProductAddress(ctx)
FormEffectHooks.onFieldValueChange$('needTheInvoice').subscribe(state => { })
if (state.value) {
useInvoiceList(ctx) FormEffectHooks.onFieldValueChange$('needTheInvoice').subscribe(state => {
} if (state.value) {
}) useInvoiceList(ctx)
} }
})
export const useProductAddress = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => { }
fetchOrderApi.getProductAddressAll().then(data => { export const useProductAddress = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
ctx.setFieldState('deliveryAddresId', state => {
if (data.length > 0 && !state.value) { fetchOrderApi.getProductAddressAll().then(data => {
// 初始化时存在数据, 默认帮用户选中第一个(默认地址) ctx.setFieldState('deliveryAddresId', state => {
state.value = data[0] if (data.length > 0 && !state.value) {
} // 初始化时存在数据, 默认帮用户选中第一个(默认地址)
state.dataSource = data state.value = data[0]
state.showMore = data.length > 3 }
}) state.dataSource = data
}) state.showMore = data.length > 3
} })
})
// 获取发票信息 }
export const useInvoiceList = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
fetchOrderApi.getInvoicesList().then(data => { // 获取发票信息
ctx.setFieldState('theInvoiceId', state => { export const useInvoiceList = (ctx: ISchemaFormActions | ISchemaFormAsyncActions) => {
if (data.length > 0 && !state.value) { fetchOrderApi.getInvoicesList().then(data => {
// 初始化时存在数据, 默认帮用户选中第一个 ctx.setFieldState('theInvoiceId', state => {
state.value = data[0] if (data.length > 0 && !state.value) {
} // 初始化时存在数据, 默认帮用户选中第一个
state.dataSource = data state.value = data[0]
state.showMore = data.length > 3 }
}) state.dataSource = data
}) state.showMore = data.length > 3
} })
})
}
...@@ -71,7 +71,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => { ...@@ -71,7 +71,7 @@ export const MoneyTotalBox = registerVirtualBox('moneyTotalBox', props => {
orderProductList: logsiticsDataMaps.map(v => ({ orderProductList: logsiticsDataMaps.map(v => ({
templateId: v.logistics.templateId, templateId: v.logistics.templateId,
weight: v.logistics.weight, weight: v.logistics.weight,
count: v?.purchaseCount || null count: v?.purchaseCount || 0
})), })),
receiverAddressId: typeof receiverAddressId === 'object' ? receiverAddressId.id : receiverAddressId receiverAddressId: typeof receiverAddressId === 'object' ? receiverAddressId.id : receiverAddressId
}, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => { }, {ttl: 10 * 1000, useCache: true, ctlType: 'none'}).then(res => {
......
...@@ -9,7 +9,7 @@ import { message } from 'antd' ...@@ -9,7 +9,7 @@ import { message } from 'antd'
export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, orderProducts: any): any => { export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions, memberId: any, memberRoleId: any, orderProducts: any): any => {
const paywayData = useRef<any>({}) const paywayData = useRef<any>({})
const [columns, setColumns] = useState<any[]>(paymentInformationColumns) const [columns, setColumns] = useState<any[]>(paymentInformationColumns)
const { productSumPrice } = useContext(ReadyAddOrderDetailContext) // const { schemaActions, detailData } = useContext(ReadyAddOrderDetailContext)
const components = { const components = {
body: { body: {
row: EditableRow, row: EditableRow,
...@@ -68,6 +68,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -68,6 +68,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
// }) // })
// }, []) // }, [])
useEffect(() => { useEffect(() => {
// 当选择报价单/会员/商品时有memberId传入时 调用支付方式api // 当选择报价单/会员/商品时有memberId传入时 调用支付方式api
if(memberId) { if(memberId) {
...@@ -75,28 +76,36 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -75,28 +76,36 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
} }
}, [memberId]) }, [memberId])
// useEffect(() => {
// // 当有商品数据传入的时 判断商品只有是物流的才能使用到付
// if(orderProducts?.length) {
// const newColumns = [...columns]
// let options = newColumns[5].formItemProps.options
// if(orderProducts.filter(item => item.deliveryType === 1).length !== orderProducts.length) {
// if(options.filter(_item => _item.payType === 4).length) {
// options.filter(_item => _item.payType === 4)[0].disabled = true
// }
// } else {
// if(options.filter(_item => _item.payType === 4).length) {
// options.filter(_item => _item.payType === 4)[0].disabled = false
// }
// }
// // 多次支付也要禁用到付
// if(ctx.getFieldValue('paymentInformationResponses').length > 1) {
// if(options.filter(_item => _item.payType === 4).length)
// options.filter(_item => _item.payType === 4)[0].disabled = true
// } else {
// if(options.filter(_item => _item.payType === 4).length)
// options.filter(_item => _item.payType === 4)[0].disabled = false
// }
// }
// }, [orderProducts, columns])
useEffect(() => { useEffect(() => {
// 当有商品数据传入的时 判断商品只有是物流的才能使用到付
if(orderProducts?.length) { if(orderProducts?.length) {
const newColumns = [...columns] restrictArrivalPay(columns, orderProducts)
let options = newColumns[5].formItemProps.options
if(orderProducts.filter(item => item.deliveryType === 1).length !== orderProducts.length) {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = true
} else {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = false
}
// 多次支付也要禁用到付
if(ctx.getFieldValue('paymentInformationResponses').length > 1) {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = true
} else {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = false
}
} }
}, [orderProducts, columns]) }, [orderProducts])
const getPayLists = (memberId, memberRoleId) => { const getPayLists = (memberId, memberRoleId) => {
PublicApi.getPayPayWayList({memberId, memberRoleId}).then(res => { PublicApi.getPayPayWayList({memberId, memberRoleId}).then(res => {
...@@ -105,7 +114,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -105,7 +114,7 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
const newColumns = [...columns] const newColumns = [...columns]
newColumns[5].formItemProps.options = initPayWayList(data) newColumns[5].formItemProps.options = initPayWayList(data)
paywayData.current = data paywayData.current = data
restrictArrivalPay(newColumns, orderProducts)
setColumns(newColumns) setColumns(newColumns)
} else { } else {
message.error(res.message) message.error(res.message)
...@@ -113,6 +122,39 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions ...@@ -113,6 +122,39 @@ export const usePaymentInfo = (ctx: ISchemaFormActions | ISchemaFormAsyncActions
}) })
} }
// 限制使用到付(多次支付和商品仅有物流)
const restrictArrivalPay = (cols, pros) => {
if(pros?.length) {
// const newColumns = [...columns]
const newColumns = [...cols]
let options = newColumns[5].formItemProps.options
if(pros.filter(item => item.deliveryType === 1).length !== pros.length) {
if(options.filter(_item => _item.payType === 4).length) {
options.filter(_item => _item.payType === 4)[0].disabled = true
}
} else {
if(options.filter(_item => _item.payType === 4).length) {
options.filter(_item => _item.payType === 4)[0].disabled = false
}
}
setTimeout(() => {
let payment = ctx.getFieldValue('paymentInformationResponses')
// 多次支付也要禁用到付
if(payment?.length > 1) {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = true
}
else {
if(options.filter(_item => _item.payType === 4).length)
options.filter(_item => _item.payType === 4)[0].disabled = false
}
} , 1000)
setColumns(newColumns)
}
}
const handleSave = row => { const handleSave = row => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const newData = [...ctx.getFieldValue('paymentInformationResponses')]; const newData = [...ctx.getFieldValue('paymentInformationResponses')];
......
import { ISchema } from '@formily/antd'; import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const'; import { FORM_FILTER_PATH } from '@/formSchema/const';
import { GlobalConfig } from '@/global/config'; import { GlobalConfig } from '@/global/config';
import moment from 'moment' import moment from 'moment'
import { DELIVERY_TYPE_ENUM } from '@/constants'; import { DELIVERY_TYPE_ENUM } from '@/constants';
/** /**
* 除了订单必填字段, 默认 * 除了订单必填字段, 默认
*/ */
export const tableListSchema: ISchema = { export const tableListSchema: ISchema = {
type: 'object', type: 'object',
properties: { properties: {
orderNo: { orderNo: {
type: 'string', type: 'string',
"x-component": 'SearchFilter', "x-component": 'SearchFilter',
'x-component-props': { 'x-component-props': {
placeholder: '请输入订单编号', placeholder: '请输入订单编号',
align: 'flex-end', align: 'flex-end',
}, },
}, },
[FORM_FILTER_PATH]: { [FORM_FILTER_PATH]: {
type: 'object', type: 'object',
'x-component': 'flex-layout', 'x-component': 'flex-layout',
'x-component-props': { 'x-component-props': {
inline: true, inline: true,
colStyle: { colStyle: {
marginLeft: 20 marginLeft: 20
} }
}, },
properties: { properties: {
orderThe: { orderThe: {
type: 'string', type: 'string',
'x-component-props': { 'x-component-props': {
placeholder: '请输入订单摘要', placeholder: '请输入订单摘要',
} }
}, },
"supplyMembersName": { "supplyMembersName": {
type: 'string', type: 'string',
"x-component-props": { "x-component-props": {
placeholder: '请输入供应会员名称' placeholder: '请输入供应会员名称'
} }
}, },
"[startCreateTime,endCreateTime]": { "[startCreateTime,endCreateTime]": {
type: 'array', type: 'array',
"x-component": 'DateRangePickerUnix', "x-component": 'DateRangePickerUnix',
'x-component-props': { 'x-component-props': {
placeholder: ['开始时间','结束时间'], placeholder: ['开始时间','结束时间'],
}, },
}, },
submit: { submit: {
'x-component': 'Submit', 'x-component': 'Submit',
'x-component-props': { 'x-component-props': {
children: '查询', children: '查询',
}, },
}, },
}, },
}, },
} }
} }
// 基本信息 // 基本信息
const basicInfo: ISchema = { const basicInfo: ISchema = {
type: 'object', type: 'object',
"x-component": 'tabpane', "x-component": 'tabpane',
"x-component-props": { "x-component-props": {
tab: '基本信息', tab: '基本信息',
className: 'useConnectBtnWrapper' className: 'useConnectBtnWrapper'
}, },
properties: { properties: {
NO_SUBMIT_LAYOUT: { NO_SUBMIT_LAYOUT: {
type: 'object', type: 'object',
"x-component": 'mega-layout', "x-component": 'mega-layout',
"x-component-props": { "x-component-props": {
labelCol: 4, labelCol: 4,
labelAlign: 'left', labelAlign: 'left',
wrapperCol: 10 wrapperCol: 10
}, },
properties: { properties: {
orderModel: { orderModel: {
type: 'string', type: 'string',
required: true, required: true,
enum: GlobalConfig.web.orderMode.map(v => { delete v.platformType ;return v}), enum: GlobalConfig.web.orderMode.map(v => { delete v.platformType ;return v}),
title: '下单模式', title: '下单模式',
"x-linkages": [ "x-linkages": [
// 联动显示单据字段 // 联动显示单据字段
{ {
type: 'value:visible', type: 'value:visible',
"target": "quotationNo", "target": "quotationNo",
"condition": `{{orderCombination.showQuotationNoOrder.includes($value)}}` "condition": `{{orderCombination.showQuotationNoOrder.includes($value)}}`
}, },
// 联动显示单据按钮 // 联动显示单据按钮
{ {
type: "value:schema", type: "value:schema",
"target": "quotationNo", "target": "quotationNo",
condition: `{{!!$value && orderCombination.showQuotationNoOrderBtn.includes($value)}}`, condition: `{{!!$value && orderCombination.showQuotationNoOrderBtn.includes($value)}}`,
schema: { schema: {
"x-component-props": { "x-component-props": {
disabled: true, disabled: true,
addonAfter: "{{orderNoPrice}}" addonAfter: "{{orderNoPrice}}"
} }
}, },
otherwise: { otherwise: {
visible: true, visible: true,
"x-component-props": { "x-component-props": {
disabled: true, disabled: true,
addonAfter: "" addonAfter: ""
} }
} }
}, },
// 联动显示供应会员按钮 // 联动显示供应会员按钮
{ {
type: "value:schema", type: "value:schema",
"target": "supplyMembersName", "target": "supplyMembersName",
condition: `{{$self.editable && $value && orderCombination.showSupplyMembersNameBtn.includes($value)}}`, condition: `{{$self.editable && $value && orderCombination.showSupplyMembersNameBtn.includes($value)}}`,
schema: { schema: {
"x-component-props": { "x-component-props": {
disabled: true, disabled: true,
addonAfter: "{{orderMember}}" addonAfter: "{{orderMember}}"
} }
}, },
otherwise: { otherwise: {
visible: true, visible: true,
"x-component-props": { "x-component-props": {
disabled: true, disabled: true,
addonAfter: "" addonAfter: ""
} }
} }
}, },
], ],
}, },
orderThe: { orderThe: {
type: 'string', type: 'string',
title: '订单摘要', title: '订单摘要',
required: true, required: true,
"x-rules": [ "x-rules": [
{ {
limitByte: true, limitByte: true,
maxByte: 60 maxByte: 60
} }
] ]
}, },
quotationNo: { quotationNo: {
type: 'string', type: 'string',
title: '对应报价单号', title: '对应报价单号',
visible: false, visible: false,
"x-component-props": { "x-component-props": {
disabled: true, disabled: true,
}, },
"x-linkages": [ "x-linkages": [
{ {
type: 'value:schema', type: 'value:schema',
target: "supplyMembersName", target: "supplyMembersName",
condition: `{{$self.editable && handleQuotation($value)}}`, condition: `{{$self.editable && handleQuotation($value)}}`,
schema: { schema: {
"x-component-props": { "x-component-props": {
disabled: true, disabled: true,
addonAfter: "" addonAfter: ""
} }
} }
} }
], ],
}, },
supplyMembersName: { supplyMembersName: {
type: 'string', type: 'string',
title: '供应会员', title: '供应会员',
"x-component-props": { "x-component-props": {
disabled: true, disabled: true,
}, },
required: true, required: true,
}, },
supplyMembersId: { supplyMembersId: {
type: 'string', type: 'string',
display: false display: false
}, },
supplyMembersRoleId: { supplyMembersRoleId: {
type: 'string', type: 'string',
display: false display: false
}, },
idList: { idList: {
type: 'array', type: 'array',
display: false display: false
}, },
productType: { productType: {
type: 'number', type: 'number',
display: false display: false
}, },
orderNo: { orderNo: {
type: 'string', type: 'string',
title: '订单编号', title: '订单编号',
"x-component": 'text', "x-component": 'text',
visible: false visible: false
}, },
type: { type: {
type: 'string', type: 'string',
title: '订单类型', title: '订单类型',
"x-component": 'text' "x-component": 'text'
}, },
createTime: { createTime: {
type: 'string', type: 'string',
title: '下单时间', title: '下单时间',
visible: false visible: false
}, },
interiorState: { interiorState: {
type: 'string', type: 'string',
title: '内部状态', title: '内部状态',
visible: false visible: false
}, },
externalState: { externalState: {
type: 'string', type: 'string',
title: '外部状态', title: '外部状态',
visible: false visible: false
}, },
} }
}, },
} }
} }
// 订单商品 // 订单商品
const orderProduct: ISchema = { const orderProduct: ISchema = {
type: 'object', type: 'object',
"x-component": 'tabpane', "x-component": 'tabpane',
"x-component-props": { "x-component-props": {
tab: '订单商品' tab: '订单商品'
}, },
properties: { properties: {
orderProductRequests: { orderProductRequests: {
type: 'array', type: 'array',
"x-component": 'MultTable', "x-component": 'MultTable',
"x-component-props": { "x-component-props": {
rowKey: 'id', rowKey: 'id',
columns: "{{productColumns}}", columns: "{{productColumns}}",
components: "{{productComponents}}", components: "{{productComponents}}",
}, },
// default: [{id: 904}] // default: [{id: 904}]
}, },
NO_SUBMIT_SPY: { NO_SUBMIT_SPY: {
type: 'object', type: 'object',
"x-component": "moneyTotalBox" "x-component": "moneyTotalBox"
} }
} }
} }
// 支付信息 // 支付信息
const payInfo: ISchema = { const payInfo: ISchema = {
type: 'object', type: 'object',
"x-component": 'tabpane', "x-component": 'tabpane',
"x-component-props": { "x-component-props": {
tab: '支付信息', tab: '支付信息',
}, },
properties: { properties: {
paymentInformationResponses: { paymentInformationResponses: {
type: 'array', type: 'array',
"x-component": 'MultTable', "x-component": 'MultTable',
"x-component-props": { "x-component-props": {
rowKey: 'payCount', rowKey: 'payCount',
columns: "{{paymentColumns}}", columns: "{{paymentColumns}}",
components: "{{paymentComponents}}" components: "{{paymentComponents}}"
}, },
// default: [ // default: [
// { // {
// payCount: 1, // payCount: 1,
// id: 1, // id: 1,
// payRatio: 123 // payRatio: 123
// } // }
// ] // ]
} }
} }
} }
// 交付信息 // 交付信息
const submitInfo: ISchema = { const submitInfo: ISchema = {
type: 'object', type: 'object',
"x-component": 'tabpane', "x-component": 'tabpane',
"x-component-props": { "x-component-props": {
tab: '交付信息' tab: '交付信息'
}, },
properties: { properties: {
NO_SUBMIT_LAYOUT_2: { NO_SUBMIT_LAYOUT_2: {
type: 'object', type: 'object',
"x-component": 'mega-layout', "x-component": 'mega-layout',
'x-component-props': { 'x-component-props': {
labelCol: 6, labelCol: 6,
labelAlign: 'left', labelAlign: 'left',
grid: true, grid: true,
columns: 2, columns: 2,
full: true full: true
}, },
properties: { properties: {
FLEX_LAYOUT_LEFT: { FLEX_LAYOUT_LEFT: {
type: 'object', type: 'object',
"x-component": 'mega-layout', "x-component": 'mega-layout',
properties: { properties: {
deliveryTime: { deliveryTime: {
type: 'string', type: 'string',
"x-component": 'date', "x-component": 'date',
title: '交付日期', title: '交付日期',
required: true, required: true,
"x-component-props": { "x-component-props": {
disabledDate: current => { disabledDate: current => {
return current && current < moment().startOf('day') return current && current < moment().startOf('day')
} }
} }
}, },
} }
}, },
deliveryAddresId: { deliveryAddresId: {
type: 'string', type: 'string',
"x-component": 'SelectAddress', "x-component": 'SelectAddress',
"x-mega-props": { "x-mega-props": {
style: { style: {
full: true full: true
} }
}, },
"x-component-props": { "x-component-props": {
dataSource: [] dataSource: []
}, },
"x-rules": [ "x-rules": [
{ {
required: true, required: true,
message: '请选择收货方式' message: '请选择收货方式'
} }
], ],
title: '收货方式' title: '收货方式'
} }
} }
} }
} }
} }
// 其他信息 // 其他信息
const ortherInfo: ISchema = { const ortherInfo: ISchema = {
type: 'object', type: 'object',
"x-component": 'tabpane', "x-component": 'tabpane',
"x-component-props": { "x-component-props": {
tab: '其他信息' tab: '其他信息'
}, },
properties: { properties: {
NO_SUBMIT_LAYOUT_ORTHER: { NO_SUBMIT_LAYOUT_ORTHER: {
type: 'object', type: 'object',
"x-component": 'mega-layout', "x-component": 'mega-layout',
"x-component-props": { "x-component-props": {
labelAlign: 'left', labelAlign: 'left',
labelCol: 4, labelCol: 4,
wrapperCol: 10 wrapperCol: 10
}, },
properties: { properties: {
needTheInvoice: { needTheInvoice: {
type: 'number', type: 'number',
"x-component": 'CheckboxSingle', "x-component": 'CheckboxSingle',
"x-component-props": { "x-component-props": {
children: '需要发票' children: '需要发票'
}, },
title: '发票', title: '发票',
default: 0, default: 0,
"x-linkages": [ "x-linkages": [
{ {
type: 'value:visible', type: 'value:visible',
target: 'theInvoiceId', target: 'theInvoiceId',
condition: "{{!!$value}}" condition: "{{!!$value}}"
} }
] ]
}, },
theInvoiceId: { theInvoiceId: {
type: 'number', type: 'number',
title: ' ', title: ' ',
"x-component": "theInvoiceList", "x-component": "theInvoiceList",
}, },
pageRequire: { pageRequire: {
type: 'string', type: 'string',
"x-component": 'textarea', "x-component": 'textarea',
"x-component-props": { "x-component-props": {
rows: 4 rows: 4
}, },
title: '包装要求', title: '包装要求',
"x-rules": [ "x-rules": [
{ {
limitByte: true, limitByte: true,
maxByte: 100 maxByte: 100
} }
] ]
}, },
restsRequire: { restsRequire: {
type: 'string', type: 'string',
"x-component": 'textarea', "x-component": 'textarea',
"x-component-props": { "x-component-props": {
rows: 4 rows: 4
}, },
title: '其他要求', title: '其他要求',
"x-rules": [ "x-rules": [
{ {
limitByte: true, limitByte: true,
maxByte: 100 maxByte: 100
} }
] ]
} },
} // 仅进货单下单传入接口使用
} shopId: {
} type: 'string',
} title: '店铺ID',
visible: false
// 审核单据 },
const auditRecord: ISchema = { }
type: 'object', }
"x-component": 'tabpane', }
"x-component-props": { }
tab: '审核单据'
}, // 审核单据
properties: { const auditRecord: ISchema = {
NO_SUBMIT_LAYOUT_3: { type: 'object',
type: 'object', "x-component": 'tabpane',
"x-component": 'mega-layout', "x-component-props": {
"x-component-props": { tab: '审核单据'
labelAlign: 'left', },
labelCol: 4, properties: {
wrapperCol: 10 NO_SUBMIT_LAYOUT_3: {
}, type: 'object',
properties: { "x-component": 'mega-layout',
state: { "x-component-props": {
title: '是否审核通过', labelAlign: 'left',
type: 'radio', labelCol: 4,
required: true, wrapperCol: 10
enum: [ },
{ properties: {
label: '审核通过', state: {
value: 1 title: '是否审核通过',
}, type: 'radio',
{ required: true,
label: '审核不通过', enum: [
value: 0 {
} label: '审核通过',
], value: 1
editable: true, },
default: 1, {
"x-linkages": [ label: '审核不通过',
{ value: 0
type: 'value:visible', }
target: 'cause', ],
condition: "{{$value === 0}}" editable: true,
} default: 1,
] "x-linkages": [
}, {
cause: { type: 'value:visible',
type: 'textarea', target: 'cause',
title: '审核不通过原因', condition: "{{$value === 0}}"
required: true, }
"x-component-props": { ]
rows: 3 },
}, cause: {
editable: true, type: 'textarea',
} title: '审核不通过原因',
} required: true,
} "x-component-props": {
rows: 3
} },
} editable: true,
}
// 电子合同 }
const electronicResult: ISchema = { }
type: 'object',
"x-component": 'tabpane', }
"x-component-props": { }
tab: '电子合同'
}, // 电子合同
properties: { const electronicResult: ISchema = {
NO_SUBMIT_LAYOUT_3: { type: 'object',
type: 'object', "x-component": 'tabpane',
"x-component": 'mega-layout', "x-component-props": {
"x-component-props": { tab: '电子合同'
labelAlign: 'left', },
labelCol: 4, properties: {
wrapperCol: 10 NO_SUBMIT_LAYOUT_3: {
}, type: 'object',
properties: { "x-component": 'mega-layout',
electronic: { "x-component-props": {
title: '电子合同', labelAlign: 'left',
type: 'checkbox', labelCol: 4,
required: true, wrapperCol: 10
enum: [ },
{ properties: {
label: 'pdf', electronic: {
value: true title: '电子合同',
} type: 'checkbox',
], required: true,
editable: true, enum: [
default: false {
} label: 'pdf',
} value: true
} }
],
} editable: true,
} default: false
// 流转记录 }
const transformRecord: ISchema = { }
type: 'object', }
"x-component": 'tabpane',
"x-component-props": { }
tab: '流转记录' }
}, // 流转记录
properties: { const transformRecord: ISchema = {
RECORD: { type: 'object',
type: 'object', "x-component": 'tabpane',
"x-component": 'VirtualChildren', "x-component-props": {
"x-component-props": { tab: '流转记录'
children: "{{CirculationRecord}}" },
} properties: {
} RECORD: {
} type: 'object',
} "x-component": 'VirtualChildren',
// 新增订单详情 "x-component-props": {
export const orderDetailSchema: ISchema = { children: "{{CirculationRecord}}"
type: 'object', }
properties: { }
NO_SUBMIT_TABS: { }
type: 'object', }
"x-component": 'tab', // 新增订单详情
properties: { export const orderDetailSchema: ISchema = {
basicInfo, type: 'object',
submitInfo, properties: {
orderProduct, NO_SUBMIT_TABS: {
payInfo, type: 'object',
ortherInfo, "x-component": 'tab',
transformRecord, properties: {
} basicInfo,
} submitInfo,
} orderProduct,
} payInfo,
ortherInfo,
// 一级审核详情 transformRecord,
export const auditOneSchema: ISchema = { }
type: 'object', }
properties: { }
NO_SUBMIT_TABS: { }
type: 'object',
"x-component": 'tab', // 一级审核详情
properties: { export const auditOneSchema: ISchema = {
basicInfo, type: 'object',
submitInfo, properties: {
orderProduct, NO_SUBMIT_TABS: {
payInfo, type: 'object',
ortherInfo, "x-component": 'tab',
auditRecord, properties: {
transformRecord basicInfo,
} submitInfo,
} orderProduct,
} payInfo,
} ortherInfo,
auditRecord,
// 新增时使用的schema transformRecord
export const orderAddSchema: ISchema = { }
type: 'object', }
properties: { }
NO_SUBMIT_TABS: { }
type: 'object',
"x-component": 'tab', // 新增时使用的schema
properties: { export const orderAddSchema: ISchema = {
basicInfo, type: 'object',
submitInfo, properties: {
orderProduct, NO_SUBMIT_TABS: {
payInfo, type: 'object',
ortherInfo, "x-component": 'tab',
} properties: {
} basicInfo,
} submitInfo,
} orderProduct,
payInfo,
// 确认电子合同 ortherInfo,
export const orderElectronicSchema: ISchema = { }
type: 'object', }
properties: { }
NO_SUBMIT_TABS: { }
type: 'object',
"x-component": 'tab', // 确认电子合同
properties: { export const orderElectronicSchema: ISchema = {
basicInfo, type: 'object',
submitInfo, properties: {
orderProduct, NO_SUBMIT_TABS: {
payInfo, type: 'object',
ortherInfo, "x-component": 'tab',
electronicResult, properties: {
transformRecord basicInfo,
} submitInfo,
} orderProduct,
} payInfo,
} ortherInfo,
electronicResult,
// 根据传入的query参数 判断当前使用哪个schema transformRecord
export const mergeAllSchemas = { }
// 新增订单详情 }
"-1": orderDetailSchema, }
0: orderAddSchema, }
// 一级审核详情
1: auditOneSchema, // 根据传入的query参数 判断当前使用哪个schema
// 二级审核详情 export const mergeAllSchemas = {
2: auditOneSchema, // 新增订单详情
// 待提交订单详情 "-1": orderDetailSchema,
3: orderDetailSchema, 0: orderAddSchema,
// 电子合同详情 // 一级审核详情
4: orderElectronicSchema, 1: auditOneSchema,
// 订单支付 // 二级审核详情
5: orderDetailSchema 2: auditOneSchema,
} // 待提交订单详情
3: orderDetailSchema,
// 电子合同详情
4: orderElectronicSchema,
// 订单支付
5: orderDetailSchema
}
...@@ -95,6 +95,9 @@ export const useSelfTable = () => { ...@@ -95,6 +95,9 @@ export const useSelfTable = () => {
{ record.purchaseOrderInteriorState === SaleOrderInsideWorkState.DELIVERY_APPROVED_SUCCESS && { record.purchaseOrderInteriorState === SaleOrderInsideWorkState.DELIVERY_APPROVED_SUCCESS &&
<Button type='link' onClick={() => handlePreview(record)}>查看物流单</Button> <Button type='link' onClick={() => handlePreview(record)}>查看物流单</Button>
} }
{ record.purchaseOrderInteriorState === SaleOrderInsideWorkState.NOT_ACCEPTED_DELIVERY &&
<Button type='link' onClick={() => handleModify(record)}>修改物流单</Button>
}
</> </>
} }
] ]
...@@ -115,6 +118,11 @@ export const useSelfTable = () => { ...@@ -115,6 +118,11 @@ export const useSelfTable = () => {
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList/detail?id=${logisticsId}&invoicesTypeId=2`) history.push(`/memberCenter/logisticsAbility/logisticsSubmit/orderSubmitSearchList/detail?id=${logisticsId}&invoicesTypeId=2`)
} }
const handleModify = async (record) => {
const logisticsId = record.logisticsId
history.push(`/memberCenter/logisticsAbility/logisticsSubmit/toOrderSumitList/edit?id=${logisticsId}`)
}
return { return {
columns: customOrderColumns columns: customOrderColumns
} }
......
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