Commit 1d8a931d authored by 前端-钟卫鹏's avatar 前端-钟卫鹏

fix:

parent c6081af3
import React, {useState, useRef, useEffect} from 'react'
import React, {useState} from 'react'
import { history } from 'umi';
import { Button, Form, Card, Tabs, message } from 'antd'
import { Button, Card, Tabs, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
PlusOutlined,
SaveOutlined,
} from '@ant-design/icons'
import { ColumnType } from 'antd/lib/table/interface';
import { SaveOutlined } from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle';
import styles from './index.less'
import SelectProduct from './addChannelItem/selectProduct'
import SelectChannel from './addChannelItem/selectChannel'
import SetPrice from './addChannelItem/setPrice'
import SetLogistics from './addChannelItem/setLogistics'
import { store } from '@/store'
import { inject, observer } from 'mobx-react'
import { PublicApi } from '@/services/api';
......@@ -28,8 +21,6 @@ const AddDirectChannel:React.FC<{}> = (props) => {
const { ChannelProudctStore } = store
const {
priceType,
productName,
productSelectRowInStore,
tableDataInSetPrice,
selectedRole,
......@@ -50,7 +41,6 @@ const AddDirectChannel:React.FC<{}> = (props) => {
})
Promise.all(data).then((values) => {
let params: any = {}
console.log(values, 'vvv')
values.map((item, index) => {
if(!item.deliveryType)
params = { ...params, ...item }
......@@ -83,13 +73,10 @@ const AddDirectChannel:React.FC<{}> = (props) => {
}).catch(_e => {
setIsDisabledSave(false)
message.error(_e.errorFields[0].errors[0] || '请完善渠道商品必填信息!')
console.log(_e, _e.message, '_e')
})
} catch (e) {
setIsDisabledSave(false)
message.error(e.message || '请完善相关信息!')
console.log(e, 'error')
}
}
......
import React, { useState, useRef, useEffect, createContext } from 'react'
import React, { useState, useRef, useEffect } from 'react'
import { history } from 'umi';
import { Button, Card, Tabs, message, Badge } from 'antd'
import { Button, Card, Tabs, message } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import {
SaveOutlined,
EditFilled,
} from '@ant-design/icons'
import { SaveOutlined } from '@ant-design/icons'
import ReutrnEle from '@/components/ReturnEle'
import BasicInfoForm from './addProductsItem/basicInfoForm'
......@@ -65,7 +62,7 @@ const AddProducts: React.FC<{}> = (props) => {
const makeRequest = async () => {
const productRes = await PublicApi.getProductCommodityGetCommodity({ id: id })
const { data } = productRes
// setProductInfoByEdit(data) // *** 仅保存需要的数据 ***
/** 仅保存需要的数据 */
setProductInfoByEdit({
name: data.name,
brand: data.brand,
......@@ -153,7 +150,6 @@ const AddProducts: React.FC<{}> = (props) => {
})
Promise.all(data).then((values) => {
// 提交的数据进行处理
// console.log(values, productSelectAttribute, productAttributeAndImageParams, '所有数据')
productSelectAttribute.length > 0 && productSelectAttribute.map(_itme => {
_itme.customerAttribute = { id: _itme.customerAttributeId }
delete _itme.attributeName
......@@ -292,7 +288,6 @@ const AddProducts: React.FC<{}> = (props) => {
// 校验属性单位重量是否提供发票
try {
// if(!_params.commodityAttributeList.length || !_params?.unitId || typeof(_params.isInvoice) !== 'boolean' || !_params?.logistics?.weight){
if(!_params?.unitId || typeof(_params.isInvoice) !== 'boolean' || (_params.logistics.deliveryType === 1 && !_params.logistics?.weight)){
throw new Error('请完善商品其他信息!')
}
......@@ -317,7 +312,6 @@ const AddProducts: React.FC<{}> = (props) => {
if (numberKeys.length > 0)
numberKeys.map(item => delete _params[item])
// console.log(_params, 'params')
PublicApi.postProductCommoditySaveOrUpdateCommodity(_params).then(res => {
if (res.code === 1000) {
setIsEnableCheck(false)
......
import React, { useState, useEffect, useRef, useContext } from 'react'
import React, { useState, useEffect, useRef } from 'react'
import { history } from 'umi';
import { Button, Form, Select, Tabs, Input, Tooltip, Cascader, Tag, Spin } from 'antd'
import { Button, Form, Select, Input, Tooltip, Cascader, Tag, Spin } from 'antd'
import {
QuestionCircleOutlined,
PlusOutlined,
......@@ -9,12 +9,11 @@ import {
import { PublicApi } from '@/services/api';
import { inject, observer } from 'mobx-react'
// import { IProductModule } from '@/module/productModule'
// import { IStore } from '@/store';
import { store } from '@/store'
import { validatorByte } from '@/utils/regExp';
import { GetProductCustomerGetCustomerCategoryTreeResponse } from '@/services/ProductApi';
import { GetManageAreaAllResponse } from '@/services/PassApi';
import { customerCategoryTypeLabel } from '../constant';
const { Option } = Select
const layout = {
......@@ -162,25 +161,12 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
areaParams.cityName = selected[1].name
areaParams.cityCode = selected[1].code
}
// console.log(value, selected, areaParams, 'area')
}
const onChangeName = (value: any) => {
setProductName(value)
}
const renderCategoryType = () => {
// 1-实物商品、2-虚拟商品、3-服务商品、4-积分兑换商品
if(showCategory === 1)
return '实物商品'
else if(showCategory === 2)
return '虚拟商品'
else if(showCategory === 3)
return '服务商品'
else if(showCategory === 4)
return '积分兑换商品'
}
const checkSellingPoint = (rule, value, callback) => {
try {
if(Array.isArray(value)){
......@@ -208,10 +194,8 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
form={basicForm}
name="basic-form"
labelAlign="left"
// onFinish={onFinish}
colon={false}
ref={basicFormRef}
// initialValues={productInfoByEdit?.id ? getBasicFormParamsByEdit : {}}
autoComplete="off"
>
<Form.Item
......@@ -226,24 +210,16 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
>
<Cascader
allowClear={false}
// disabled={!isUpdateAttribute}
disabled={history.location.query?.id}
options={customerCategoryTree}
fieldNames={{ label: 'title', value: 'id', children: 'children' }}
onChange={onCustomerCategoryChange}
placeholder="请选择品类"
// notFoundContent={<Spin size="small" />}
/>
</Form.Item>
<Form.Item
name="brandId"
label="商品品牌"
// rules={[
// {
// required: true,
// message: '请选择商品品牌'
// }
// ]}
>
<Select
disabled={!isUpdateAttribute}
......@@ -295,10 +271,6 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
</span>
}
rules={[
// {
// required: true,
// message: '请填入商品标语'
// },
{
validator: (r, v, c) => validatorByte(r, v, c, 90)
}
......@@ -348,22 +320,10 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
</Tooltip>
</span>
}
// rules={[
// {
// required: true,
// message: '请选择地区'
// }
// ]}
key={field.key}
>
<Form.Item
{...field}
// rules={[
// {
// required: true,
// message: "请选择地区",
// },
// ]}
noStyle
>
<Cascader
......@@ -387,7 +347,7 @@ const BasicInfoForm: React.FC<Iprops> = (props) => {
<Form.Item
label='品类类型'
>
{showCategory && <><span className="commonStatusValid"></span>{renderCategoryType()}</>}
{showCategory && <><span className="commonStatusValid"></span>{customerCategoryTypeLabel[showCategory]}</>}
</Form.Item>
</Form>
</>)
......
import React, { useState, useEffect, useRef } from 'react'
import {history} from 'umi'
import { Form, Select, Checkbox, Tabs, Input, DatePicker, Row, Col } from 'antd'
import { inject, observer } from 'mobx-react'
import { store } from '@/store'
import { validatorByte } from '@/utils/regExp'
......@@ -14,7 +13,6 @@ const layout = {
span: 12,
},
}
export interface Iprops {
attributesData: any[];
onRef: (refs: any) => void;
......@@ -52,7 +50,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
useEffect(() => {
// 属性变动 表明品类品牌变动 清空页面全局参数组合和store的选中属性 重置表单 (只对新增有效)
// console.log('属性变动', isClearFormAndDataInEdit)
if(history.location.query?.id){
// 编辑第一次执行不清空,之后的变动需要清空
if(isClearFormAndDataInEdit){
......@@ -76,11 +73,16 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
* @param {Object} attrItem 属性数据对象
*/
const onChange = (value, attrItem) => {
let params = { customerAttributeId: attrItem.id, attributeName: attrItem.name, isPrice: attrItem.isPrice, isDate: attrItem.isDate, customerAttributeValueList: [] } // 添加日期属性用于特殊处理
// console.log(value, attrItem, params, attributesData, 'params')
if(attrItem.type!==3){
let params = {
customerAttributeId: attrItem.id,
attributeName: attrItem.name,
isPrice: attrItem.isPrice,
isDate: attrItem.isDate,
customerAttributeValueList: []
} // 添加日期属性用于特殊处理
if(attrItem.type!==3) {
//.... 在此处单独处理日期属性 ....//
if(attrItem.type === 2 && attrItem.isDate){
if(attrItem.type === 2 && attrItem.isDate) {
// 日期属性 暂定属性值id为null
params.customerAttributeValueList.push({
id: null,
......@@ -114,7 +116,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
})
}
paramsArray.push(params)
// console.log(paramsArray,'paramsArray')
let _resultParams = Object.values(paramsArray.reduce((item, next)=>{
item[next.customerAttributeId] = next;
......@@ -124,14 +125,12 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
// 遍历 排空
let resultParams = _resultParams.filter((_item: any)=>_item.customerAttributeValueList.length!=0)
// console.log(resultParams,'resultParams') // 最终传输数据
setProductSelectAttribute(resultParams)
}
/* 编辑情况下,利用商品信息中的属性值转换为结果参数,用于后续表格生成 */
/** 编辑情况下,利用商品信息中的属性值转换为结果参数,用于后续表格生成 */
const constructProductSelectAttribute = () => {
let _selectAttributeByEdit = productInfoByEdit.commodityAttributeList.map((item, index) => {
// console.log(item,'__edit__',attributeLists[index])
return {
attributeName: item.customerAttribute.name,
customerAttributeId: item.customerAttribute.id,
......@@ -139,7 +138,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
isPrice: attributeLists.filter(_item => _item.name === item.customerAttribute.name)[0]?.isPrice
}
})
// console.log(_selectAttributeByEdit, '__selectAttributeByEdit__', attributeLists)
paramsArray = _selectAttributeByEdit
setProductSelectAttribute(_selectAttributeByEdit)
}
......@@ -258,7 +256,6 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
labelAlign="left"
ref={productAttributeFormRef}
colon={false}
// initialValues={productInfoByEdit?.id ? getProductAttributeFormParamsByEdit : {}}
>
<Tabs defaultActiveKey="1" tabPosition="left">
{
......
import React, { useState, useEffect, useRef } from 'react'
import {history} from 'umi'
import { Form, Checkbox } from 'antd'
// import styles from './index.less'
import { PublicApi } from '@/services/api'
import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import { EyeOutlined } from '@ant-design/icons'
import { GetProductGoodsGetGoodsListResponseDetail } from '@/services/ProductApi';
import { inject, observer } from 'mobx-react'
import { store } from '@/store'
......@@ -46,7 +44,6 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
item[next.id] = next;
return item
},{}))
// console.log(goodsArr, 'goods')
if(goodsArr?.length>0){
setIsChecked(true)
setIsSelectGoods(true)
......@@ -81,7 +78,6 @@ const SelectGoodsForm: React.FC<{}> = (props) => {
className="commonPickColor"
href={`/memberCenter/commodityAbility/commodity/goods/detail?id=${record.id}&isSee=true`}
target="blank"
// onClick={() => history.push(`/memberCenter/commodityAbility/commodity/goods/detail?id=${record.id}&isSee=true`)}
>
{text}&nbsp;<EyeOutlined />
</a>
......
......@@ -17,12 +17,13 @@ export const productStatusLabel = [
'未上架'
]
/** 品类类型&商品类型 */
/** 品类类型 */
export const customerCategoryTypeLabel = [
'',
'实物商品',
'虚拟商品',
'服务商品',
'积分兑换商品'
]
/** 商品定价类型 */
......
......@@ -27,6 +27,7 @@ import { searchBrandOptionEffect, searchCustomerCategoryOptionEffect } from './e
import EyePreview from '@/components/EyePreview'
import moment from 'moment'
import { GetProductChannelCommodityGetShopResponse } from '@/services/ProductApi'
import { productStatusLabel } from './constant'
// 定义选择的行数据的类型
interface Item {
......@@ -133,19 +134,6 @@ const DirectChannel: React.FC<{}> = () => {
key: 'id',
render: (text, record) => text === 1 ? '上级渠道' : '渠道自有'
},
// {
// title: '产品定价',
// dataIndex: ['channelCommodity', 'commodity', 'priceType'],
// key: 'id',
// render: (text:any, reocrd:any)=>{
// if(text===1)
// return '现货价格'
// else if(text===2)
// return '价格需要询价'
// else if(text===3)
// return '积分兑换商品'
// }
// },
{
title: '操作时间',
dataIndex: ['channelCommodity', 'createTime'],
......@@ -156,16 +144,7 @@ const DirectChannel: React.FC<{}> = () => {
title: '商品状态',
dataIndex: 'status',
key: 'id',
render: (text:any, record:any) => {
let component: ReactNode = null
if(text === 5)
component = (<span style={{color:'#00B37A',padding:'2px 5px',background:'rgba(235,247,242,1)',borderRadius:'4px'}}>已上架</span>)
else if(text === 6)
component = (<span style={{padding:'2px 5px',background:'rgba(244,245,247,1)',borderRadius:'4px'}}>已下架</span>)
else if(text === 7)
component = (<span style={{color:'#E63F3B',padding:'2px 5px',background:'rgba(255,235,230,1)',borderRadius:'4px'}}>未上架</span>)
return component
}
render: (text: any, record: any) => <><span className="commonStatusModify"></span>{productStatusLabel[text]}</>
},
{
title: '操作',
......@@ -365,28 +344,6 @@ const DirectChannel: React.FC<{}> = () => {
}
}
// if(isUp)
// if(checkedValues.length > 0){
// PublicApi.postProductChannelCommodityPublishCommodity(params).then(res => {
// setUpDownModal(false)
// ref.current.reload()
// setIsDisabledOKbtn(false)
// })
// }else{
// setIsDisabledOKbtn(false)
// message.error('请选择需要上架的渠道商城')
// }
// else
// PublicApi.postProductChannelCommodityOffPublishCommodity(params).then(res => {
// setUpDownModal(false)
// ref.current.reload()
// setIsDisabledOKbtn(false)
// })
}
const handleCancelUpDown = () => {
setUpDownModal(false)
}
const handleMenuClick = (param) => { // param: 1.批量删除 2.批量上架 3.批量下架
......
......@@ -16,7 +16,7 @@ import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilte
import { searchCustomerCategoryOptionEffect, searchBrandOptionEffect } from './effect'
import { fastSchema } from './schema/productSchema'
import { FORM_FILTER_PATH } from '@/formSchema/const'
import { validatorNumberRange } from './constant'
import { priceTypeLabel, productStatusLabel, validatorNumberRange } from './constant'
const formActions = createFormActions();
......@@ -70,14 +70,7 @@ const FastModifyPrice: React.FC<{}> = () => {
title: '商品定价',
dataIndex: 'priceType',
key: 'priceType',
render: (t, r) => {
if(t === 1)
return '现货价格'
if(t === 2)
return '价格需要询价'
if(t === 3)
return '积分兑换商品'
}
render: (t, r) => priceTypeLabel[t]
},
{
title: '价格',
......@@ -110,49 +103,7 @@ const FastModifyPrice: React.FC<{}> = () => {
title: '状态',
dataIndex: 'status',
key: 'status',
render: (text: any, record: any) => {
let component: ReactNode = null
if (record.status === 1)
component = (<><span className="commonStatusStop"></span>待提交审核</>)
else if (record.status === 2)
component = (<><span className="commonStatusModify"></span>待审核</>)
else if (record.status === 3)
component = (<><span className="commonStatusInvalid"></span>审核不通过</>)
else if (record.status === 4)
component = (<><span className="commonStatusValid"></span>审核通过</>)
else if (record.status === 5)
component = (<span style={{ color: '#00B37A', padding: '2px 5px', background: 'rgba(235,247,242,1)', borderRadius: '4px' }}>已上架</span>)
else if (record.status === 6)
component = (<span style={{ padding: '2px 5px', background: 'rgba(244,245,247,1)', borderRadius: '4px' }}>已下架</span>)
return component
},
// filters: [
// {
// text: '待提交审核',
// value: 1,
// },
// {
// text: '待审核',
// value: 2,
// },
// {
// text: '审核通过',
// value: 3,
// },
// {
// text: '审核不通过',
// value: 4,
// },
// {
// text: '已上架',
// value: 5,
// },
// {
// text: '已下架',
// value: 6,
// }
// ],
// onFilter: (value, record) => record.status === value,
render: (text: any, record: any) => <><span className="commonStatusModify"></span>{productStatusLabel[text]}</>
},
{
title: '操作',
......
......@@ -112,9 +112,9 @@ const SaleSideOrderCols: any[] = [
},
{
title: '操作人',
dataIndex: 'roleName',
dataIndex: 'operator',
align: 'center',
key: 'roleName',
key: 'operator',
},
{
title: '部门',
......@@ -124,16 +124,16 @@ const SaleSideOrderCols: any[] = [
},
{
title: '职位',
dataIndex: 'position',
dataIndex: 'jobTitle',
align: 'center',
key: 'position',
key: 'jobTitle',
},
{
title: '状态',
dataIndex: 'state',
dataIndex: 'statusName',
align: 'center',
key: 'state',
render: (text, record) => <StatusColors status={text} type='transformSaleInside' text={record.stateName} />
key: 'statusName',
// render: (text, record) => <StatusColors status={text} type='transformSaleInside' text={record.stateName} />
},
{
title: '操作',
......@@ -143,16 +143,16 @@ const SaleSideOrderCols: any[] = [
},
{
title: '操作时间',
dataIndex: 'operationTime',
dataIndex: 'createTime',
align: 'center',
key: 'operationTime',
key: 'createTime',
render: text => formatTimeString(text)
},
{
title: '审核意见',
dataIndex: 'auditOpinion',
dataIndex: 'remark',
align: 'center',
key: 'auditOpinion',
key: 'remark',
},
]
// 订单流转记录
......
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