Commit 07f04e1b authored by GuanHua's avatar GuanHua

feat:属性筛选和装修的参数添加

parent 362c1aa1
......@@ -2,6 +2,6 @@ export default {
'/api': {
'target': 'http://10.0.0.25:8100/',
'changeOrigin': true,
'pathRewrite': { '^/api' : '' },
'pathRewrite': { '^/api': '' },
}
}
\ No newline at end of file
......@@ -138,7 +138,11 @@ export enum FILTER_TYPE {
/**
* 信用从高到低
*/
creditSort = 'creditSort'
creditSort = 'creditSort',
/**
* 属性筛选
*/
attribute = 'attribute'
}
// 商城类型
......@@ -192,8 +196,8 @@ export const VIP_RULE_COMMENT = 3; // 评论
export const MEMBER_STATUS_NORMAL = 1; // 正常的
export const MEMBER_STATUS_FROZEN = 2; // 冻结的
export const MEMBER_STATUS = {
[MEMBER_STATUS_NORMAL]: '正常',
[MEMBER_STATUS_FROZEN]: '冻结',
[MEMBER_STATUS_NORMAL]: '正常',
[MEMBER_STATUS_FROZEN]: '冻结',
};
// 会员类型
......@@ -202,10 +206,10 @@ export const MEMBER_TYPE_INDIVIDUAL = 2; // 个人会员
export const MEMBER_TYPE_CHANNEL_CORPORATE = 3; // 渠道企业会员
export const MEMBER_TYPE_CHANNEL_INDIVIDUAL = 4; // 渠道个人会员
export const MEMBER_TYPE = {
[MEMBER_TYPE_CORPORATE]: '企业会员',
[MEMBER_TYPE_INDIVIDUAL]: '个人会员',
[MEMBER_TYPE_CHANNEL_CORPORATE]: '渠道企业会员',
[MEMBER_TYPE_CHANNEL_INDIVIDUAL]: '渠道个人会员',
[MEMBER_TYPE_CORPORATE]: '企业会员',
[MEMBER_TYPE_INDIVIDUAL]: '个人会员',
[MEMBER_TYPE_CHANNEL_CORPORATE]: '渠道企业会员',
[MEMBER_TYPE_CHANNEL_INDIVIDUAL]: '渠道个人会员',
};
// 会员内部状态
......@@ -217,11 +221,11 @@ export const MEMBER_INNER_STATUS_FAILED = 4; // 审核不通过
export const MEMBER_INNER_STATUS_SUCCESS = 5; // 审核通过
export const MEMBER_INNER_STATUS = {
[MEMBER_INNER_STATUS_REGISTERED]: '申请注册',
[MEMBER_INNER_STATUS_UNCOMMITTED]: '待提交审核',
[MEMBER_INNER_STATUS_UNREVIEWED_1]: '待一级审核',
[MEMBER_INNER_STATUS_UNREVIEWED_2]: '待二级审核',
[MEMBER_INNER_STATUS_FAILED]: '审核不通过',
[MEMBER_INNER_STATUS_SUCCESS]: '审核通过',
[MEMBER_INNER_STATUS_UNCOMMITTED]: '待提交审核',
[MEMBER_INNER_STATUS_UNREVIEWED_1]: '待一级审核',
[MEMBER_INNER_STATUS_UNREVIEWED_2]: '待二级审核',
[MEMBER_INNER_STATUS_FAILED]: '审核不通过',
[MEMBER_INNER_STATUS_SUCCESS]: '审核通过',
};
// 会员外部状态
......@@ -230,10 +234,10 @@ export const MEMBER_OUTER_STATUS_UNREVIEWED = 1; // 待审核
export const MEMBER_OUTER_STATUS_FAILED = 2; // 审核不通过
export const MEMBER_OUTER_STATUS_SUCCESS = 3; // 审核通过
export const MEMBER_OUTER_STATUS = {
[MEMBER_OUTER_STATUS_UNCOMMITTED]: '待提交',
[MEMBER_OUTER_STATUS_UNREVIEWED]: '待审核',
[MEMBER_OUTER_STATUS_FAILED]: '审核不通过',
[MEMBER_OUTER_STATUS_SUCCESS]: '审核通过',
[MEMBER_OUTER_STATUS_UNCOMMITTED]: '待提交',
[MEMBER_OUTER_STATUS_UNREVIEWED]: '待审核',
[MEMBER_OUTER_STATUS_FAILED]: '审核不通过',
[MEMBER_OUTER_STATUS_SUCCESS]: '审核通过',
};
// 会员等级类型枚举
......@@ -241,9 +245,9 @@ export const MEMBER_LEVEL_TYPE_PLATFORM = 1; // 平台会员
export const MEMBER_LEVEL_TYPE_MERCHANT = 2; // 商户会员
export const MEMBER_LEVEL_TYPE_CHANNEL = 3; // 渠道会员
export const MEMBER_LEVEL_TYPE = {
[MEMBER_LEVEL_TYPE_PLATFORM]: '平台会员',
[MEMBER_LEVEL_TYPE_MERCHANT]: '商户会员',
[MEMBER_LEVEL_TYPE_CHANNEL]: '渠道会员',
[MEMBER_LEVEL_TYPE_PLATFORM]: '平台会员',
[MEMBER_LEVEL_TYPE_MERCHANT]: '商户会员',
[MEMBER_LEVEL_TYPE_CHANNEL]: '渠道会员',
};
export const ORDER_TYPE = ['',
......@@ -274,22 +278,22 @@ export const DELIVERY_TYPE_ENUM = [
export const POSITION_STATUS_EFFECTIVE = 1; // 有效的
export const POSITION_STATUS_INVALID = 0; // 无效的
export const POSITION_STATUS = {
[POSITION_STATUS_EFFECTIVE]: '有效',
[POSITION_STATUS_INVALID]: '无效',
[POSITION_STATUS_EFFECTIVE]: '有效',
[POSITION_STATUS_INVALID]: '无效',
};
// 单据类型状态
export const DOC_TYPE_STATUS_EFFECTIVE = 1; // 有效的
export const DOC_TYPE_STATUS_INVALID = 0; // 无效的
export const DOC_TYPE_STATUS = {
[DOC_TYPE_STATUS_EFFECTIVE]: '有效',
[DOC_TYPE_STATUS_INVALID]: '无效',
[DOC_TYPE_STATUS_EFFECTIVE]: '有效',
[DOC_TYPE_STATUS_INVALID]: '无效',
};
// 单据类型方向
export const DOC_DIRECTION_WAREHOUSING = 1; // 入库
export const DOC_DIRECTION_OUTGOING = 2; // 出库
export const DOC_DIRECTION = {
[DOC_DIRECTION_WAREHOUSING]: '入库 + ',
[DOC_DIRECTION_OUTGOING]: '出库 - ',
[DOC_DIRECTION_WAREHOUSING]: '入库 + ',
[DOC_DIRECTION_OUTGOING]: '出库 - ',
};
\ No newline at end of file
......@@ -8,6 +8,7 @@ import { isEmpty } from '@formily/antd/esm/shared'
import { PublicApi } from '@/services/api'
import { clearSelectedStatus, changeProps } from 'lingxi-editor-core';
import { ArrowUpOutlined, DeleteOutlined, PlusOutlined, ArrowDownOutlined, CaretDownOutlined, CaretUpOutlined } from '@ant-design/icons'
import { addTempalteIdToList } from '../../../../utils'
import styles from './index.less'
interface advertItemType {
......@@ -241,10 +242,9 @@ const AdvertSetting: React.FC<AdvertSettingPropsType> = forwardRef((props, ref)
let param: any = {
templateId: templateid,
type: getAdvertType(type),
adverts: advertList
adverts: addTempalteIdToList(advertList, templateid)
}
let postFn;
console.log(param)
if (templateType === 'channel') {
postFn = PublicApi.postTemplateChannelSaveAdvert
} else {
......
......@@ -157,4 +157,15 @@ export const getAdvertType = (type) => {
case 'interact':
return 2
}
}
/**
* 往数组添加模板id字段
* @param list
*/
export const addTempalteIdToList = (list, templateId) => {
return list.map(item => {
item.templateId = templateId
return item
})
}
\ No newline at end of file
......@@ -125,7 +125,6 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
getFn(param).then(res => {
setLoading(false)
if (res.code === 1000) {
console.log(res.data.data)
setCommodityList(res.data.data)
setTotalCount(res.data.totalCount)
}
......
......@@ -563,7 +563,7 @@ const CommodityDetail = (props) => {
<div className={styles.prompt_goods_price_item}>
<div className={cx(styles.label, styles.price)}>价格(CNY)</div>
{
(commodityDetail?.isMemberPrice && parameter) && <div className={cx(styles.label, styles.mprice)}>会员价格(CNY)</div>
(commodityDetail?.isMemberPrice && (parameter || parameter === 0)) && <div className={cx(styles.label, styles.mprice)}>会员价格(CNY)</div>
}
<div className={cx(styles.label, styles.count)}>数量({commodityDetail?.unitName})</div>
</div>
......@@ -573,7 +573,7 @@ const CommodityDetail = (props) => {
<div className={cx(styles.prompt_goods_price_list_item, (commodityPriceInfo.length > 1 && Number(buyCount) >= item.min && Number(buyCount) <= item.max) ? styles.active : "")} key={`prompt_goods_price_list_item_${index}`}>
<div className={styles.price}>{priceFormat(item.price)}</div>
{
(commodityDetail?.isMemberPrice && parameter) && <div className={styles.member_price}>{priceFormat(item.price * parameter)}</div>
(commodityDetail?.isMemberPrice && (parameter || parameter === 0)) && <div className={styles.member_price}>{priceFormat(item.price * parameter)}</div>
}
<div className={styles.count}>{item.range === '0-0' ? '不限' : item.range}</div>
</div>
......
......@@ -117,8 +117,8 @@ const Category: React.FC<CategoryPropsType> = (props) => {
<div className={styles.category_type_right_wrap}>
<div className={styles.category_advert}>
{
(item.brandBOList && item.brandBOList.length > 0) && item.brandBOList.map(brandItem => (
<div key={`category_advert_item_${brandItem.category_advert_item}`} className={styles.category_advert_item}>
(item.brandBOList && item.brandBOList.length > 0) && item.brandBOList.map((brandItem, brandIndex) => (
<div key={`category_advert_item_${brandIndex}`} className={styles.category_advert_item}>
<Link to={getBrandLink(brandItem)}> <img src={brandItem.brandLogo} /></Link>
</div>
))
......
......@@ -23,10 +23,13 @@
overflow: hidden;
cursor: pointer;
&>img {
display: block;
&>.img {
width: 80px;
height: 40px;
margin: 0 auto;
display: block;
background-repeat: no-repeat;
background-size: 100% auto;
background-position: center center;
}
}
}
......
......@@ -4,6 +4,7 @@ import { PublicApi } from '@/services/api'
import { GetSearchShopEnterpriseGetBrandResponse } from '@/services'
import { LAYOUT_TYPE, FILTER_TYPE } from '@/constants'
import styles from './index.less'
import url from '*.svg'
interface BrandPropsType {
FilterStore?: any;
......@@ -57,7 +58,7 @@ const Brand: React.FC<BrandPropsType> = (props) => {
brandList.map(item => (
<li className={styles.filter_brand_list_item} title={item.name} key={item.id} onClick={() => handleSelectBrand(item)}>
<div className={styles.brand_img}>
<img src={item.logoUrl} />
<div className={styles.img} style={{ backgroundImage: `url(${item.logoUrl})` }}></div>
</div>
</li>
))
......
import React, { useEffect, useState, Fragment } from 'react'
import { Tree, Checkbox } from 'antd'
import FilterBox from '../FilterBox'
import { observer } from 'mobx-react'
import { LAYOUT_TYPE, FILTER_TYPE } from '@/constants'
import { PublicApi } from '@/services/api'
import isEmpty from 'lodash/isEmpty'
......@@ -23,11 +24,12 @@ const Category: React.FC<CategoryPropsType> = (props) => {
const [categoryList, setCategoryList] = useState<any>([])
const [lastCategoryId, setLastCategoryId] = useState<number>()
const [attributeList, setAttributeList] = useState<any>([])
const [selectAttrbuteList, setSelectAttrbuteList] = useState<any>([])
// const [selectAttrbuteList, setSelectAttrbuteList] = useState<any>([])
useEffect(() => {
if (isEmpty(filterList)) {
setSelectedKeys([])
setLastCategoryId(null)
} else {
let initKeys = []
for (let item of filterList) {
......@@ -89,11 +91,15 @@ const Category: React.FC<CategoryPropsType> = (props) => {
getAttributeFn = PublicApi.getSearchShopStoreGetCustomerAttributeByCategoryId
break;
}
getAttributeFn(param).then(res => {
if (res.code === 1000) {
setAttributeList(initAttributeList(res.data))
}
})
if (getAttributeFn) {
getAttributeFn(param).then(res => {
if (res.code === 1000) {
setAttributeList(initAttributeList(res.data))
}
})
}
} else {
setAttributeList([])
}
}, [lastCategoryId])
......@@ -133,10 +139,10 @@ const Category: React.FC<CategoryPropsType> = (props) => {
title: secondCategoryItem.title,
key: secondCategoryItem.id,
children: secondCategoryItem.children.map(thirdCategoryItem => {
if (!lastCategoryId && flag) {
flag = false
setLastCategoryId(thirdCategoryItem.id)
}
// if (!lastCategoryId && flag) {
// flag = false
// setLastCategoryId(thirdCategoryItem.id)
// }
return {
title: <span className={styles.sub_category_title}>{thirdCategoryItem.title}</span>,
name: thirdCategoryItem.title,
......@@ -162,7 +168,7 @@ const Category: React.FC<CategoryPropsType> = (props) => {
}
}
onFilter({
type: 'category',
type: FILTER_TYPE.category,
key: selectedKeys,
title: typeof title === 'string' ? title : name
})
......@@ -172,38 +178,70 @@ const Category: React.FC<CategoryPropsType> = (props) => {
setExpandedKeys(expandedKeys)
}
const styleOptions = [
{ label: '荔枝纹', value: '1' },
{ label: '网纹', value: '2' },
{ label: '自然摔纹', value: '3' },
];
// "customerAttributeList": [{
// "customerAttributeId": 1,
// "customerAttributeValueList": [{
// "id": 3
// }, {
// "id": 4
// }]
// }, {
// "customerAttributeId": 2,
// "customerAttributeValueList": [{
// "id": 5
// }, {
// "id": 6
// }]
// }]
const getDetailById = (attrId, attrValId, state = 2) => {
let detail = {}
for (let item of attributeList) {
if (item.id === attrId) {
if (state === 1) {
detail = item
} else {
for (let childItem of item.attributeValueList) {
if (childItem.value === attrValId) {
detail = childItem
}
}
}
}
}
return detail
}
const handleChange = (attrId, checkedList) => {
let tempSelect = []
let attrInfo: any = getDetailById(attrId, attrId, 1)
let tempItem = {
customerAttributeId: attrId,
customerAttributeName: attrInfo.name,
customerAttributeValueList: checkedList.map(item => {
let detail: any = getDetailById(attrId, item)
return {
id: item
id: detail.value,
name: detail.label
}
})
}
console.log(tempItem, "tempItem")
if (tempSelect.some(item => item.customerAttributeId === attrId)) {
tempSelect = tempSelect.map(childItem => {
if (childItem.customerAttributeId === attrId) {
return tempItem
} else {
return childItem
}
})
} else {
tempSelect.push(tempItem)
}
if (tempSelect.length > 0) {
console.log(tempSelect, "tempSelect")
onFilter({
type: FILTER_TYPE.attribute,
key: JSON.stringify(tempSelect),
title: `${tempSelect.map(tsItem => {
return `${tsItem.customerAttributeName}${tsItem.customerAttributeValueList.map(cabItem => cabItem.name)}`
}).join(';')}`
})
// for (let item of tempSelect) {
// onFilter({
// type: `attribute-${item.customerAttributeId}`,
// key: item.customerAttributeValueList.map(caItem => caItem.id),
// title: `${item.customerAttributeName}: ${item.customerAttributeValueList.map(caItem => caItem.name)}`
// })
// }
}
}
return (
......@@ -222,9 +260,9 @@ const Category: React.FC<CategoryPropsType> = (props) => {
</div>
</FilterBox>
{
showAttr && attributeList.length > 0 && attributeList.map((attrItem) => (
showAttr && attributeList.length > 0 && attributeList.map((attrItem, attrIndex) => (
<FilterBox
key={attrItem.id}
key={`filter_box_${attrItem.id}_${attrIndex}`}
title={attrItem.name}
>
<div className={styles.filter_style}>
......@@ -237,4 +275,4 @@ const Category: React.FC<CategoryPropsType> = (props) => {
)
}
export default Category
export default observer(Category)
......@@ -51,7 +51,6 @@ const LXMallLayout: React.FC<LXMallLayoutPropsType> = (props) => {
const getWebMallInfo = () => {
const shopInfo = GlobalConfig.web.shopInfo
let webMallInfo = shopInfo.filter(item => item.environment === 1 && item.type === 1)[0]
console.log(webMallInfo, "webMallInfo")
setMallInfo(webMallInfo)
}
......
......@@ -155,6 +155,9 @@ class FilterStore {
case FILTER_TYPE.priceSortLowToHigh:
tempFilterParam.orderType = 4
break
case FILTER_TYPE.attribute:
tempFilterParam.customerAttributeList = filterItem.key
break
default:
break
}
......
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