Commit ad2b117d authored by tjy's avatar tjy
parents 57400535 d441a906
......@@ -34,7 +34,7 @@
"@umijs/test": "^3.2.0",
"bizcharts": "^4.0.7",
"copy-to-clipboard": "^3.3.1",
"god": "0.1.18",
"god": "^0.1.18",
"lint-staged": "^10.0.7",
"mobx": "^5.15.4",
"mobx-react": "^6.2.2",
......
......@@ -58,7 +58,10 @@ const AddAtttribute: React.FC<{}> = () => {
delete values.attributeShow
if(JSON.stringify(values.attribute)==='{}')
delete values.attribute
PublicApi.postProductCustomerSaveOrUpdateCustomerAttribute(values)
PublicApi.postProductCustomerSaveOrUpdateCustomerAttribute(values).then(res => {
if(res.code === 1000)
history.goBack()
})
}).catch(error => {
console.error(error)
})
......
......@@ -65,6 +65,7 @@ const ClassProperty: React.FC<{}> = () => {
setTreeStatus(FormState.ADD)
},
addChildNode(node) {
formActions.reset({ validate: false })
setNodeRecord({
...node,
parentId: node.id, // 添加子级的时候 使用上一级的id作为parentId
......
......@@ -80,7 +80,10 @@ const AddPropertyValue: React.FC<{}> = () => {
if(JSON.stringify(pararms.attributeValue)==='{}')
delete pararms.attributeValue
//@ts-ignore
PublicApi.postProductCustomerSaveOrUpdateCustomerAttributeValue(pararms)
PublicApi.postProductCustomerSaveOrUpdateCustomerAttributeValue(pararms).then(res => {
if(res.code === 1000)
history.goBack()
})
}).catch(error => {
console.error(error)
......
......@@ -15,6 +15,7 @@ import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface'
import styles from "./index.less"
import { PublicApi } from '@/services/api'
import { useRowSelectionTable } from '@/hooks/useRowSelectionTable'
const { Option } = Select;
......@@ -54,6 +55,8 @@ const Goods: React.FC<{}> = () => {
const [brandValue, setBrandValue] = useState(undefined)
const [classData, setClassData] = useState<any>([])
const [classValue, setClassValue] = useState(undefined)
const [batchDeleteKeys, setBatchDeleteKeys] = useState<any>([])
const [goodsRowSelection, goodsRowCtl] = useRowSelectionTable()
const columns: ColumnType<any>[] = [
{
......@@ -153,6 +156,7 @@ const Goods: React.FC<{}> = () => {
onChange: (selectedRowKeys: any, selectedRows: any) => {
setSelectRow(selectedRows);
setSelectedRowKeys(selectedRowKeys);
setBatchDeleteKeys([...batchDeleteKeys, ...selectedRowKeys]);
console.log(`selectedRowKeys: ${selectedRowKeys}`, 'selectedRows: ', selectedRows);
}
}
......@@ -221,7 +225,6 @@ const Goods: React.FC<{}> = () => {
const [step1DescriptState, setStep1DescriptState] = useState(step1Description)
const [step2DescriptState, setStep2DescriptState] = useState(step2Description)
// timer 计时器模拟导入过程
const [exceptionCheck, setExceptionCheck] = useState(false); // 默认无异常
const [exceptionData, setExceptionData] = useState(false); // 默认无异常
......@@ -280,9 +283,9 @@ const Goods: React.FC<{}> = () => {
)
const handleMenuClick = (e: any) => {
console.log('menu', e, selectedRowKeys); // 1 批量删除;2 删除导入批次
// console.log('menu', e, selectedRowKeys); // 1 批量删除;2 删除导入批次
if(e.key === '1'){
PublicApi.postProductGoodsDeleteBatchGoods({idList: selectedRowKeys}).then(res=>{
PublicApi.postProductGoodsDeleteBatchGoods({idList: goodsRowCtl.selectedRowKeys}).then(res=>{
//@ts-ignore
ref.current.reload()
})
......@@ -369,7 +372,7 @@ const Goods: React.FC<{}> = () => {
<StandardTable
columns={columns}
currentRef={ref}
rowSelection={rowSelection}
rowSelection={goodsRowSelection}
tableProps={{rowKey: "id"}}
fetchTableData={(params: any) => fetchData(params)}
controlRender={
......
import React, { useState, useEffect, useRef } from 'react'
import { history } from 'umi'
import { Form, Select, Radio, Input } from 'antd'
import { Form, Select, Radio, Input, Checkbox } from 'antd'
import { PublicApi } from '@/services/api'
import { GetLogisticsSelectListCompanyResponse, GetLogisticsSelectListShipperAddressResponse } from '@/services'
import { GetLogisticsSelectListCompanyResponse, GetLogisticsSelectListShipperAddressResponse, GetLogisticsSelectListFreightTemplateResponse } from '@/services'
import { store } from '@/store'
const { ProductStore } = store
......@@ -28,13 +28,15 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
const [logisticsForm] = Form.useForm()
const [logisticsCompanyLists, setLogisticsCompanyLists] = useState<GetLogisticsSelectListCompanyResponse>()
const [logisticsAddressList, setLogisticsAddressList] = useState<GetLogisticsSelectListShipperAddressResponse>()
const [logisticsTemplateList, setLogisticsTemplateList] = useState<GetLogisticsSelectListFreightTemplateResponse>()
const [isTemplate, setIsTemplate] = useState<boolean>(false)
const { productInfoByEdit } = ProductStore
useEffect(()=>{
//传入ref给父级
onRef(logisticsFormRef)
// 获取发货地址 物流公司
// 获取发货地址 物流公司 运费模板
PublicApi.getLogisticsSelectListShipperAddress().then(res=>{
setLogisticsAddressList(res.data)
})
......@@ -43,8 +45,16 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
setLogisticsCompanyLists(res.data)
})
PublicApi.getLogisticsSelectListFreightTemplate().then(res=>{
setLogisticsTemplateList(res.data)
})
}, [])
const onChangeTemplate = (e) => {
setIsTemplate(e.target.checked)
}
return (<>
<Form
{...layout}
......@@ -103,21 +113,29 @@ const LogisticsForm: React.FC<Iprops> = (props) => {
]}
>
<Input suffix="KG" placeholder="请输入重量" />
{/* <Checkbox>使用运费模板(只有买家承担运费才能选择)</Checkbox> */}
</Form.Item>
{/* <Form.Item
name="chargeTemplate"
label="运费模板"
<Form.Item
name="useTemplate"
valuePropName="checked"
label=" "
>
<Select
placeholder="请选择运费模板"
allowClear
<Checkbox onChange={onChangeTemplate}>使用运费模板(只有买家承担运费才能选择)</Checkbox>
</Form.Item>
{
isTemplate && <Form.Item
name="templateId"
label="运费模板"
>
<Option value="SF">顺丰模板</Option>
<Option value="EMS">EMS模板</Option>
<Option value="COM">一般快递模板</Option>
</Select>
</Form.Item> */}
<Select
placeholder="请选择运费模板"
allowClear
>
{
logisticsTemplateList?.length>0 && logisticsTemplateList.map(_ => <Option key={_.id} value={_.id}>{_.name}</Option>)
}
</Select>
</Form.Item>
}
<Form.Item
name="sendAddress"
label="发货地址"
......
......@@ -418,6 +418,7 @@ const Products: React.FC<{}> = () => {
setCurrentOptionId(id)
PublicApi.getProductCommodityGetShop({id: id}).then(res => {
setShopsOption(res.data)
setCheckedValues(res.data.filter(_=>_.isCheck))
})
setIsUp(param)
setUpDownModal(true)
......@@ -428,10 +429,16 @@ const Products: React.FC<{}> = () => {
id: currentOptionId,
shopList: checkedValues
}
PublicApi.postProductCommodityPublishCommodity(params).then(res => {
if(res.code === 1000)
setUpDownModal(false)
})
if(isUp)
PublicApi.postProductCommodityPublishCommodity(params).then(res => {
if(res.code === 1000)
setUpDownModal(false)
})
else
PublicApi.postProductCommodityOffPublishCommodity(params).then(res => {
if(res.code === 1000)
setUpDownModal(false)
})
}
const handleCancelUp = () => {
......@@ -758,6 +765,7 @@ const Products: React.FC<{}> = () => {
visible={upDownModal}
onOk={handleUp}
onCancel={handleCancelUp}
forceRender={true}
>
<Form
layout="vertical"
......@@ -769,11 +777,11 @@ const Products: React.FC<{}> = () => {
<QuestionCircleOutlined />
</Tooltip>
</span>}>
<Checkbox.Group style={{ width: '100%' }} onChange={onChangeUpShop}>
<Checkbox.Group style={{ width: '100%' }} onChange={onChangeUpShop} value={checkedValues}>
<Row>
{
Array.isArray(shopsOption) && shopsOption.map((item, index) => <Col key={index} span={6}>
<Checkbox checked={item.isCheck} value={item}>{item.name}</Checkbox>
<Checkbox value={item}>{item.name}</Checkbox>
</Col>)
}
</Row>
......
......@@ -32,7 +32,6 @@ const { Step } = Steps;
const { TabPane } = Tabs;
const viewProducts: React.FC<{}> = () => {
const [productDetail, setPorductDetail] = useState<GetProductCommodityGetCommodityResponse>()
const [checkRecord, setCheckRecord] = useState<GetProductCommodityGetCommodityCheckRecordResponse>()
const [fixStep, setFixStep] = useState(0)
......@@ -42,6 +41,9 @@ const viewProducts: React.FC<{}> = () => {
const [tableRenderDatas, setTableRenderDatas] = useState<any[]>([])
const [attributeArrByImageRender, setAttributeArrByImageRender] = useState<any[]>([])
const [imageArrByImageRender, setImageArrByImageRender] = useState<any[]>([])
const [logisticTemplateName, setLogisticTemplateName] = useState<string>()
const [logisticResourceCompanyName, setLogisticResourceCompanyName] = useState<string>()
const [logisticResourceSendAddress, setLogisticResourceSendAddress] = useState<string>()
useEffect(() => {
const { id } = history.location.query
......@@ -69,6 +71,22 @@ const viewProducts: React.FC<{}> = () => {
})
}
}, [])
useEffect(() => {
if(productDetail?.logistics?.templateId)
PublicApi.getLogisticsFreightTemplateGet({id: productDetail?.logistics?.templateId + ''}).then(res => {
setLogisticTemplateName(res.data.name)
})
if(productDetail?.logistics?.company)
PublicApi.getLogisticsCompanyGet({id: productDetail?.logistics?.company + ''}).then(res => {
setLogisticResourceCompanyName(res.data.name)
})
if(productDetail?.logistics?.sendAddress)
PublicApi.getLogisticsShipperAddressGet({id: productDetail?.logistics?.sendAddress + ''}).then(res => {
const { provinceName, cityName, districtName, address } = res.data
setLogisticResourceSendAddress(provinceName + cityName + districtName + address)
})
}, [productDetail])
const columns: ColumnType<any>[] = [
{
......@@ -373,7 +391,7 @@ const viewProducts: React.FC<{}> = () => {
<p>运费模版:</p>
</Col>
<Col span={20}>
<p>快递按重量计算运费模版</p>
<p>{logisticTemplateName}</p>
</Col>
</Row>
<Row>
......@@ -381,7 +399,7 @@ const viewProducts: React.FC<{}> = () => {
<p>物流公司:</p>
</Col>
<Col span={20}>
<p>{productDetail?.logistics?.company}</p>
<p>{logisticResourceCompanyName}</p>
</Col>
</Row>
<Row>
......@@ -389,7 +407,7 @@ const viewProducts: React.FC<{}> = () => {
<p>发货地址:</p>
</Col>
<Col span={20}>
<p>{productDetail?.logistics?.sendAddress}</p>
<p>{logisticResourceSendAddress}</p>
</Col>
</Row>
</Card>
......
......@@ -68,7 +68,6 @@ const AddRepository:React.FC<{}> = (props) => {
const [memberRowSelection, memberRowCtl] = useRowSelectionTable()
const [productRowSelection, productRowCtl] = useRowSelectionTable({type: 'radio'})
useUnitPreview(initValue, addSchemaAction)
const columnsSetMember: ColumnType<any>[] = [
{
......
......@@ -31,9 +31,9 @@ function beforeLogoUpload(file: UploadFile) {
if (!isJpgOrPng) {
message.error('仅支持上传JPEG/JPG/PNG文件!');
}
const isLt2M = file.size / 1024 / 1024 < 2;
const isLt2M = file.size / 1024 / 10 < 6;
if (!isLt2M) {
message.error('上传图片不超过2MB!');
message.error('上传图片不超过60K!');
}
return isJpgOrPng && isLt2M;
}
......@@ -61,6 +61,7 @@ const AddBrand: React.FC<{}> = () => {
const [isEnableCheck, setIsEnableCheck] = useState(true)
const [responseId, setReponseId] = useState<number>(null)
const [formValues, setFormValues] = useState<any>({})
const [banSomeField, setBanSomeField] = useState<boolean>(false)
useEffect(()=>{
const { id } = history.location.query
......@@ -69,8 +70,10 @@ const AddBrand: React.FC<{}> = () => {
if(res.code===1000){
const { data } = res
setFormValues(data)
form.setFieldsValue(data) // 不变动的情况下会丢失图片列表
form.setFieldsValue(data)
setlogoUrl(data.logoUrl)
if(data.status === 4)
setBanSomeField(true)
// 多图回显
let proveImgs = Object.values(data.proveUrl)
let files = [];
......@@ -168,7 +171,7 @@ const AddBrand: React.FC<{}> = () => {
<PageHeaderWrapper
onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回"/>}
title="新建品牌"
title={history.location.query?.id?'修改品牌':'新建品牌'}
extra={[
<Button key="2" disabled={isEnableCheck} onClick={handleApplyCheck}>直接提交审核</Button>,
<Button icon={<SaveOutlined />} key="1" type="primary" onClick={handleSave}>
......@@ -197,7 +200,7 @@ const AddBrand: React.FC<{}> = () => {
<Card headStyle={{borderBottom:'none'}} title="基本信息">
<Form.Item
name='name'
label='品牌名称'
label={<span>品牌名称&nbsp;&nbsp;</span>}
rules={[
{
required: true,
......@@ -205,7 +208,7 @@ const AddBrand: React.FC<{}> = () => {
},
]}
>
<Input placeholder="输入品牌名称" />
<Input disabled={banSomeField} placeholder="输入品牌名称" />
</Form.Item>
{/* <Form.Item
label='审核状态'
......@@ -225,7 +228,7 @@ const AddBrand: React.FC<{}> = () => {
</Form.Item> */}
<Form.Item
name="logoUrl"
label="品牌LOGO"
label={<span>品牌LOGO&nbsp;&nbsp;</span>}
// valuePropName="fileList"
extra="支持JPG/PNG/JPEG,最大不超过 60K,为了减少加载数据量,只建议一级项目使用"
rules={[
......@@ -236,6 +239,7 @@ const AddBrand: React.FC<{}> = () => {
]}
>
<Upload
disabled={banSomeField}
name="file"
listType="picture-card"
className="avatar-uploader"
......@@ -272,7 +276,7 @@ const AddBrand: React.FC<{}> = () => {
data={{fileType:2}}
showUploadList={{ showPreviewIcon: false }}
>
{fileList.length >= 4 ? null : uploadButton}
{fileList.length >= 20 ? null : uploadButton}
</Upload>
</Form.Item>
</Col>
......
......@@ -3,6 +3,7 @@
height:120px;
border:1px solid rgba(235,236,240,1);
img {
width: 100%;
height: 100%;
padding: 18px;
}
......
......@@ -15,7 +15,7 @@ import moment from 'moment'
import { PublicApi } from '@/services/api'
const Trademark: React.FC<{}> = () => {
const ref = useRef({})
const ref = useRef<any>({})
const fetchData = (params: any) => {
return new Promise((resolve, reject) => {
......@@ -132,7 +132,6 @@ const Trademark: React.FC<{}> = () => {
const confirm = (record: any) => {
PublicApi.postProductBrandUpdateBrandEnable({ id: record.id, isEnable: !record.isEnable }).then(res => {
//@ts-ignore
ref.current.reload()
})
}
......@@ -143,13 +142,11 @@ const Trademark: React.FC<{}> = () => {
const handelDelete = (record: any) => {
PublicApi.postProductBrandDeleteBrand({ id: record.id }).then(res => {
//@ts-ignore
ref.current.reload()
})
}
const handleApplyCheck = (record:any) => {
PublicApi.postProductBrandApplyCheckBrand({id: record.id}).then(res=>{
//@ts-ignore
ref.current.reload()
})
}
......
......@@ -150,6 +150,7 @@ const viewBrand: React.FC<{}> = () => {
type="primary"
onClick={()=>history.push(`/memberCenter/commodityAbility/trademark/addBrand?id=${brandInfo.id}`)}
disabled={!(brandInfo.status===1||brandInfo.status===3)}
style={{display: !(brandInfo.status===1||brandInfo.status===3)?'none':'block'}}
>
修改
</Button>,
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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