Commit 86d2fc4c authored by Bill's avatar Bill

Merge branch 'fix418' into 'v2-220418'

feat: 对接商品列表删除导入批次 See merge request linkseeks-design/pro-platform!110
parents 484dc138 b1992d07
......@@ -163,12 +163,12 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
}
const handleAdd = () => {
setLoading(true)
addForm.submit()
}
const addSubmit = (values) => {
postProductCustomerSaveOrUpdateCustomerAttributeValue({
setLoading(true)
values?.value ? postProductCustomerSaveOrUpdateCustomerAttributeValue({
customerAttribute: { id: values.id, name: values.name, groupName: currentRow.current.groupName },
isEnable: true,
value: values.value
......@@ -188,7 +188,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
setAddVisible(false)
setLoading(false)
}
})
}) : setLoading(false)
}
const handleCancel = () => {
......@@ -203,7 +203,7 @@ const ProductAttributeForm: React.FC<Iprops> = (props) => {
const addItem = (e, record) => {
e.preventDefault();
postProductCustomerSaveOrUpdateCustomerAttributeValue({
newValue && postProductCustomerSaveOrUpdateCustomerAttributeValue({
customerAttribute: { id: record.id, name: record.name, groupName: record.groupName },
isEnable: true,
value: newValue
......
......@@ -29,7 +29,28 @@ import useSetSearchValueInTable from '@/hooks/useSetSearchValueInTable'
import { priceTypeLabel, productStatusColor, productStatusLabel } from './constant'
import EyePreview from '@/components/EyePreview'
import UpperProductModalTable from './components/upperProductModalTable'
import { getProductCommodityExportCommodityTemplate, getProductCommodityGetCommodityList, getProductCommodityGetShop, GetProductCommodityGetShopResponse, postProductCommodityApplyCheckCommodity, postProductCommodityCopyCommodity, postProductCommodityDeleteBatchCommodity, postProductCommodityExportCommodityQrCode, postProductCommodityExportCommoditySkuByCommodityIdList, postProductCommodityGetCommodityIsExistStock, postProductCommodityGetCommoditySkuIdList, postProductCommodityGetShopBatch, postProductCommodityOffPublishCommodity, postProductCommodityOffPublishCommodityBatch, postProductCommodityPublishCommodity, postProductCommodityPublishCommodityBatch } from '@/services/ProductV2Api'
import {
getProductCommodityExportCommodityTemplate,
getProductCommodityGetCommodityList,
getProductCommodityGetShop,
GetProductCommodityGetShopResponse,
postProductCommodityApplyCheckCommodity,
postProductCommodityCopyCommodity,
postProductCommodityDeleteBatchCommodity,
postProductCommodityExportCommodityQrCode,
postProductCommodityExportCommoditySkuByCommodityIdList,
postProductCommodityGetCommodityIsExistStock,
postProductCommodityGetCommoditySkuIdList,
postProductCommodityGetShopBatch,
postProductCommodityOffPublishCommodity,
postProductCommodityOffPublishCommodityBatch,
postProductCommodityPublishCommodity,
postProductCommodityPublishCommodityBatch,
getProductCommodityGetCommodityDraftList,
postProductCommodityDeleteCommodityDraftBatch,
getProductCommodityGetCommodityImportBath,
postProductCommodityDeleteCommodityByImportBath
} from '@/services/ProductV2Api'
import { getTemplateWebMemberShopWebFindCurrMemberShop } from '@/services/TemplateV2Api'
import PutawayGuide, { GuideMenu } from './components/putawayGuide'
import { useRowSelectionTable, useRowSelectionTableCtl } from '@/hooks/useRowSelectionTable'
......@@ -37,7 +58,6 @@ import AuthButton from '@/components/AuthButton'
import { AuthUrl } from '@/components/AuthButton/AuthUrl'
import { postOrderCommonProductProcessFind } from '@/services/OrderNewV2Api'
import { ProductView, ProductSel } from './productModal'
import { getProductCommodityGetCommodityDraftList, postProductCommodityDeleteCommodityDraftBatch } from '@/services/ProductV2Api'
const { confirm } = Modal;
......@@ -69,6 +89,8 @@ const Products: React.FC<{}> = () => {
const [giudeStep, setGiudeStep] = useState<number>()
const [inconformityProductIds, setInconformityProductIds] = useState<number[]>([])
const { token } = getAuth() || {}
const [importBathData, setImportBathData] = useState<any>([])
const [importBathValue, setImportBathValue] = useState(undefined)
// 上游弹窗
const [upModal, setUpModal] = useState(false)
......@@ -475,16 +497,23 @@ const Products: React.FC<{}> = () => {
const [exceptionContent, setExceptionContent] = useState<string>()
const [exceptionCheck, setExceptionCheck] = useState(false); // 默认无异常
const [importLoading, setImportLoading] = useState(false)
const [loading, setLoading] = useState(false)
const handleOkDeleteBatch = () => {
setDeleteBatchModal(false)
console.log('删除批次')
setLoading(true)
if(importBathValue) {
postProductCommodityDeleteCommodityByImportBath({commodityImportBath: importBathValue}).then(({code}) => {
if(code === 1000) {
setLoading(false)
ref.current.reload()
}
setDeleteBatchModal(false)
})
}
}
const handleCancelDelete = () => {
setDeleteBatchModal(false)
console.log('取消删除')
}
const clickUp = (param: number, record: any) => { // param: 0 下架 1上架 record.id为null批量上架
......@@ -859,9 +888,9 @@ const Products: React.FC<{}> = () => {
<Menu.Item key="0" icon={<ImportOutlined />}>
{intl.formatMessage({ id: 'commodity.products.menuMore.1' })}
</Menu.Item>
{/* <Menu.Item key="2" icon={<DeleteOutlined />}>
删除导入批次
</Menu.Item> */}
<Menu.Item key="2" icon={<DeleteOutlined />}>
{intl.formatMessage({ id: 'commodity.products.modal.title.1' })}
</Menu.Item>
<Menu.Item key="3" icon={<ArrowUpOutlined />}>
{intl.formatMessage({ id: 'commodity.products.menuMore.2' })}
</Menu.Item>
......@@ -908,6 +937,17 @@ const Products: React.FC<{}> = () => {
console.log(key, 'key')
}
const handleImportBathSearch = (value?: string) => {
getProductCommodityGetCommodityImportBath({ name: value || '' }).then(res => {
if (res.code === 1000)
setImportBathData(res.data)
})
}
const handleImportBathChange = (value, options) => {
setImportBathValue(value)
}
// 导入商品
const importProps = {
name: 'file',
......@@ -919,7 +959,7 @@ const Products: React.FC<{}> = () => {
maxCount: 1,
className: styles.importBtn,
onChange(info) {
setImportLoading(true)
setLoading(true)
setModalTitle(intl.formatMessage({ id: 'commodity.products.modalTitle.1' }))
if (info.file.status !== 'uploading') {
console.log(info.file);
......@@ -936,7 +976,9 @@ const Products: React.FC<{}> = () => {
setExceptionCheck(true)
setStep1DescriptState(step1Exception)
}
setLoading(false)
} else if (info.file.status === 'error') {
setLoading(false)
console.log(info.file)
}
},
......@@ -1013,7 +1055,7 @@ const Products: React.FC<{}> = () => {
title={step0Description}
extra={
<Upload {...importProps}>
<Button style={{ width: '100%' }} type="primary" loading={importLoading}>{intl.formatMessage({ id: 'commodity.products.modal.button.1' })}</Button>
<Button style={{ width: '100%' }} type="primary" loading={loading}>{intl.formatMessage({ id: 'commodity.products.modal.button.1' })}</Button>
</Upload>
}
/>
......@@ -1043,13 +1085,26 @@ const Products: React.FC<{}> = () => {
onOk={handleOkDeleteBatch}
onCancel={handleCancelDelete}
okButtonProps={{ danger: true }}
confirmLoading={loading}
>
<Form
layout="vertical"
>
<Form.Item label={intl.formatMessage({ id: 'commodity.products.modal.form.label' })}>
<Select placeholder={intl.formatMessage({ id: 'commodity.products.modal.form.placeholder' })}>
<Select.Option value="542424">4245242452</Select.Option>
<Select
showSearch={true}
showArrow={true}
placeholder={intl.formatMessage({ id: 'commodity.products.modal.form.placeholder' })}
allowClear
value={importBathValue}
defaultActiveFirstOption={false}
filterOption={false}
onSearch={handleImportBathSearch}
onChange={handleImportBathChange}
onFocus={() => handleImportBathSearch(null)}
style={{ width: '100%' }}
>
{importBathData.map(d => <Option value={d} key={d}>{d}</Option>)}
</Select>
</Form.Item>
</Form>
......
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