Commit 8a2ca2a8 authored by 前端-钟卫鹏's avatar 前端-钟卫鹏
parents 817dc831 25ddf9c3
......@@ -14,7 +14,7 @@ import sideIcon from '../../asserts/home-icon-28.png'
import { ImemberData, IorderData, ItodayAdd } from './common/interface';
import {useInViewport} from '@umijs/hooks';
const PROCESS_STATUS = ["default", "warning", "warning", "processing"]
const PROCESS_STATUS = ["default", "warning", "warning", "processing"];
const Home: React.FC<{}> = () => {
const [memberData, setMemberData] = useState<ImemberData | {}>({});
......
......@@ -37,7 +37,9 @@ const Message: React.FC<{}> = () => {
}
}
const handlePaginationChange = (page, pageSize) => {
const handlePaginationChange = (page: number, pageSize: number | undefined) => {
//@ts-ignore
setPagation((state) => ({...state, current: page, pageSize: pageSize}))
getList({page, pageSize})
.then((data) => {
setDataSource(data);
......
......@@ -42,10 +42,10 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
useEffect(() => {
fetchBrandsList()
}, [filterParam])
}, [filterParam, current, pageSize])
const fetchBrandsList = () => {
let param = {
let param: any = {
type: 0,
templateId: templateid,
categoryId: categoryid,
......@@ -55,7 +55,7 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
if (filterParam) {
param = Object.assign(param, filterParam)
}
//@ts-ignore
PublicApi.getTemplatePlatformFindBrandList(param).then((res: any) => {
if (res.code === 1000) {
const dataInfo = res.data
......@@ -86,13 +86,9 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
setPageSize(pageSize || 10)
}
useEffect(() => {
fetchBrandsList()
}, [current, pageSize])
const handleSearch = () => {
setCurrent(1)
let param = filterProps(form.getFieldsValue())
const param = filterProps(form.getFieldsValue())
setFilterParam(param)
}
......@@ -115,7 +111,7 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
// if (selectBrandList.length <= 0) {
// message.error("请选择要推荐的品牌")
// return
// } else
// } else
if (selectBrandList.length > 6) {
message.error("最多推荐6个品牌")
return
......@@ -138,13 +134,13 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
const saveBrand = () => {
return new Promise((resolve, reject) => {
let param: any = {
const param: any = {
templateId: templateid,
categoryId: categoryid,
}
let ids: number[] = []
const ids: number[] = []
for (let item of selectBrandList) {
for (const item of selectBrandList) {
ids.push(item.brandId)
}
param.brandIds = ids
......@@ -160,8 +156,8 @@ const BrandSetting: React.FC<ShopSettingPropsType> = (props) => {
const handleChangeOprationType = (type: string) => {
setOprationType(type)
let keys: number[] = []
for (let item of selectBrandList) {
const keys: number[] = []
for (const item of selectBrandList) {
keys.push(item.brandId)
}
setBrandIds(keys)
......
......@@ -32,7 +32,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const [form] = Form.useForm()
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [operationType, setOprationType] = useState<string>(OPERATION_TYPE.list) // 操作类型:list:显示已选列表;select:选择列表
let [isHighSearch, setIsHighSearch] = useState(false)
const [isHighSearch, setIsHighSearch] = useState(false)
const { templateid, categoryid, goodsList = [] } = props
const [current, setCurrent] = useState<number>(1)
const [pageSize, setPageSize] = useState<number>(10)
......@@ -60,24 +60,24 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
useEffect(() => {
fetchGoodsList()
}, [filterParam])
}, [filterParam, current, pageSize])
const fetchCategoryList = () => {
let param = {
const param: any = {
categoryId: categoryid,
templateId: templateid
}
setSpinLoading(true)
//@ts-ignore
PublicApi.getTemplatePlatformFindCategoryList(param).then(res => {
const data = res.data
setCategoryResponseList(data.categoryBOList || [])
setSpinLoading(false)
if (res.code === 1000) {
const data = res.data
setCategoryResponseList(data.categoryBOList || [])
}
})
}
const fetchBrandsList = () => {
let param = {
const param: any = {
type: 0,
templateId: templateid,
categoryId: categoryid,
......@@ -85,7 +85,6 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
pageSize: 100
}
//@ts-ignore
PublicApi.getTemplatePlatformFindBrandList(param).then((res: any) => {
if (res.code === 1000) {
const dataInfo = res.data
......@@ -95,7 +94,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
}
const fetchGoodsList = () => {
let param = {
let param: any = {
type: 0,
templateId: templateid,
categoryId: categoryid,
......@@ -103,17 +102,18 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
pageSize
}
if (filterParam) {
param = Object.assign(param, filterParam)
console.log(filterParam, param)
}
//@ts-ignore
setSpinLoading(true)
PublicApi.getTemplatePlatformFindGoodsList(param).then((res: any) => {
if (res.code === 1000) {
const dataInfo = res.data
setTotalCount(dataInfo.totalCount)
setNoSelectGoods(dataInfo.data || [])
}
setSpinLoading(false)
})
}
......@@ -145,14 +145,11 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
}
useEffect(() => {
fetchGoodsList()
}, [current, pageSize])
const handleSearch = () => {
setCurrent(1)
console.log(form.getFieldsValue())
let param = filterProps(form.getFieldsValue())
const param = filterProps(form.getFieldsValue())
setFilterParam(param)
}
......@@ -175,7 +172,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
// if (selectGoodsList.length <= 0) {
// message.error("请选择要推荐的商品")
// return
// } else
// } else
if (selectGoodsList.length > 10) {
message.error("最多推荐10件商品")
return
......@@ -223,13 +220,13 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const saveGoods = () => {
return new Promise((resolve, reject) => {
let param: any = {
const param: any = {
templateId: templateid,
categoryId: categoryid,
}
let ids: number[] = []
const ids: number[] = []
for (let item of selectGoodsList) {
for (const item of selectGoodsList) {
ids.push(item.goodsId)
}
param.goodsIds = ids
......@@ -245,8 +242,8 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
const handleChangeOprationType = (type: string) => {
setOprationType(type)
let keys: number[] = []
for (let item of selectGoodsList) {
const keys: number[] = []
for (const item of selectGoodsList) {
keys.push(item.goodsId)
}
setGoodsIds(keys)
......@@ -301,7 +298,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
</Col>
<Col>
<Button onClick={() => setIsHighSearch(isHighSearch = !isHighSearch)}>高级筛选{isHighSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}</Button>
<Button onClick={() => setIsHighSearch(!isHighSearch)}>高级筛选{isHighSearch ? <CaretUpOutlined /> : <CaretDownOutlined />}</Button>
</Col>
<Col>
<Button onClick={() => handleReset()}>重置</Button>
......@@ -331,7 +328,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
>
<Select placeholder="品类" style={{ width: 180 }} onChange={handleSearch}>
{
categoryResponseList.map((item, index) => <Select.Option kye={`select_category_item_${index}`} value={item.categoryId}>{item.categoryName}</Select.Option>)
categoryResponseList.map((item, index) => <Select.Option key={`select_category_item_${index}`} value={item.categoryId}>{item.categoryName}</Select.Option>)
}
</Select>
</Form.Item>
......@@ -343,7 +340,7 @@ const GoodsSetting: React.FC<GoodsSettingPropsType> = (props) => {
>
<Select placeholder="品牌" style={{ width: 180 }} onChange={handleSearch}>
{
noSelectBrands.map((item, index) => (<Select.Option kye={`select_brand_item_${index}`} value={item.brandId}>{item.brandName}</Select.Option>))
noSelectBrands.map((item, index) => (<Select.Option key={`select_brand_item_${index}`} value={item.brandId}>{item.brandName}</Select.Option>))
}
</Select>
......
......@@ -42,10 +42,10 @@ const ShopSetting: React.FC<ShopSettingPropsType> = (props) => {
useEffect(() => {
fetchShopsList()
}, [filterParam])
}, [filterParam, current, pageSize])
const fetchShopsList = () => {
let param = {
let param: any = {
type: 0,
templateId: templateid,
categoryId: categoryid,
......@@ -55,7 +55,7 @@ const ShopSetting: React.FC<ShopSettingPropsType> = (props) => {
if (filterParam) {
param = Object.assign(param, filterParam)
}
//@ts-ignore
PublicApi.getTemplatePlatformFindShopList(param).then((res: any) => {
if (res.code === 1000) {
const dataInfo = res.data
......@@ -86,13 +86,9 @@ const ShopSetting: React.FC<ShopSettingPropsType> = (props) => {
setPageSize(pageSize || 10)
}
useEffect(() => {
fetchShopsList()
}, [current, pageSize])
const handleSearch = () => {
setCurrent(1)
let param = filterProps(form.getFieldsValue())
const param = filterProps(form.getFieldsValue())
setFilterParam(param)
}
......@@ -116,7 +112,7 @@ const ShopSetting: React.FC<ShopSettingPropsType> = (props) => {
// if (selectShopsList.length <= 0) {
// message.error("请选择要推荐的店铺")
// return
// } else
// } else
if (selectShopsList.length > 5) {
message.error("最多推荐5个店铺")
return
......@@ -154,13 +150,13 @@ const ShopSetting: React.FC<ShopSettingPropsType> = (props) => {
const saveShop = () => {
return new Promise((resolve, reject) => {
let param: any = {
const param: any = {
templateId: templateid,
categoryId: categoryid,
}
let ids: number[] = []
const ids: number[] = []
for (let item of selectShopsList) {
for (const item of selectShopsList) {
ids.push(item.shopId)
}
param.shopIds = ids
......@@ -176,8 +172,8 @@ const ShopSetting: React.FC<ShopSettingPropsType> = (props) => {
const handleChangeOprationType = (type: string) => {
setOprationType(type)
let keys: number[] = []
for (let item of selectShopsList) {
const keys: number[] = []
for (const item of selectShopsList) {
keys.push(item.shopId)
}
setShopsIds(keys)
......
......@@ -428,9 +428,7 @@ const PaySetting: React.FC<{}> = () => {
if (params.memberIdRoleIds.length === 0 && values.isSelected === 0) {
message.error('请选择指定的会员');
return
} else {
delete params.memberIdRoleIds
}
}
if (!usePageStatus().id) {
console.log('params', params)
PublicApi.postPayPayMemberTacticsAdd({ ...params }).then(res => {
......
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