Commit 2ed2c378 authored by GuanHua's avatar GuanHua

feat:1.修改所有商品列表接口价格类型字段;2.商品详情询价保存商品参数到sessionstorage

parent 4442f6d2
......@@ -26,6 +26,17 @@
.browse_records_product_list {
.inquiry_price {
color: #FFF;
background-color: var(--mall_main_color);
font-size: 14px;
height: 18px;
line-height: 14px;
padding: 2px 8px;
display: inline-block;
margin-top: 4px;
}
&_item {
padding: 0 15px;
margin-bottom: 10px;
......
......@@ -43,6 +43,31 @@ const BrowseRecords: React.FC<BrowseRecordsPropsType> = (props) => {
return link
}
const showPriceByType = (info: any) => {
if(info) {
switch (info.priceType) {
case COMMODITY_TYPE.inquiry:
return (
<div className={styles.inquiry_price}>
<label>在线询价</label>
</div>
)
case COMMODITY_TYPE.integral:
return (
<div className={cx(styles.product_price, styles.integral)}>
{info.min === info.max ? `${numFormat(info.min)}积分` : `${numFormat(info.min)}~${numFormat(info.max)}积分`}
</div>
)
case COMMODITY_TYPE.prompt:
return <div className={styles.product_price}>{priceFormat(info.min)}</div>
default:
return null
break
}
}
return null
}
return (priceType && list.length > 0) ? (
<div className={styles.browse_records}>
<div className={styles.browse_records_title}>
......@@ -63,8 +88,7 @@ const BrowseRecords: React.FC<BrowseRecordsPropsType> = (props) => {
<ImageBox width={110} height={110} imgUrl={childItem.mainPic} direction="column" />
</div>
{
priceType === COMMODITY_TYPE.integral ? <div className={cx(styles.product_price, styles.integral)}>{numFormat(childItem.min)}~{numFormat(childItem.max)}积分</div> :
<div className={styles.product_price}>{priceFormat(childItem.min)}</div>
showPriceByType(childItem)
}
</a>
</div>
......
......@@ -10,6 +10,16 @@
font-weight: bold;
}
.inquiry_price {
color: #FFF;
background-color: var(--mall_main_color);
font-size: 14px;
height: 18px;
line-height: 14px;
padding: 2px 8px;
display: inline-block;
}
.interested_product_list {
&_item {
padding: 0 20px;
......
import React, { useEffect, useState } from 'react'
import { COMMODITY_TYPE, LAYOUT_TYPE } from '@/constants'
import cx from 'classnames'
import { message } from 'antd'
import { PublicApi } from '@/services/api'
import ImageBox from '@/components/ImageBox'
import { GlobalConfig } from '@/global/config'
......@@ -26,34 +27,44 @@ const Interested: React.FC<InterestedPropsType> = (props) => {
const getchLatelyCommodity = () => {
let getFn
let param: any = {}
let param: any = {
current: 1,
pageSize: 5
}
switch (layoutType) {
case LAYOUT_TYPE.shop:
case LAYOUT_TYPE.mall:
param.storeId = shopInfo.id
if (priceType === COMMODITY_TYPE.integral) {
param.isScore = true
} else {
param.isScore = false
param.priceTypeList = [3]
getFn = PublicApi.postSearchShopScoreGetCommodityList
} else if (priceType === COMMODITY_TYPE.inquiry) {
param.priceTypeList = [2]
getFn = PublicApi.postSearchShopStoreGetCommodityList
} else if (priceType === COMMODITY_TYPE.prompt) {
param.priceTypeList = [1]
getFn = PublicApi.postSearchShopStoreGetCommodityList
}
getFn = PublicApi.getSearchShopStoreGetLatelyCommodity
break
case LAYOUT_TYPE.channel:
case LAYOUT_TYPE.ichannel:
param.channelMemberId = shopInfo.memberId
if (priceType === COMMODITY_TYPE.integral) {
param.isScore = true
} else {
param.isScore = false
param.priceTypeList = [3]
} else if (priceType === COMMODITY_TYPE.inquiry) {
param.priceTypeList = [2]
} else if (priceType === COMMODITY_TYPE.prompt) {
param.priceTypeList = [1]
}
getFn = PublicApi.getSearchShopChannelGetLatelyCommodity
getFn = PublicApi.postSearchShopChannelGetCommodityList
break
default:
break;
}
getFn && getFn(param).then(res => {
if (res.code === 1000) {
setCommodityList(res.data)
message.destroy()
setCommodityList(res.data.data)
}
})
}
......@@ -73,6 +84,32 @@ const Interested: React.FC<InterestedPropsType> = (props) => {
return link
}
const showPriceByType = (info: any ) => {
if (info) {
switch (info.priceType) {
case COMMODITY_TYPE.inquiry:
return (
<div className={styles.inquiry_price}>
<label>在线询价</label>
</div>
)
case COMMODITY_TYPE.integral:
return (
<div className={cx(styles.interested_product_list_item_price, styles.integral)}>
{info.min === info.max ? `${numFormat(info.min)}积分` : `${numFormat(info.min)}~${numFormat(info.max)}积分`}
</div>
)
case COMMODITY_TYPE.prompt:
return <div className={styles.interested_product_list_item_price}><span></span> {priceFormat(info.min)}</div>
default:
return null
break
}
}
return null
}
return (
<div className={styles.interested}>
<div className={styles.interested_title}>最近销售</div>
......@@ -86,8 +123,7 @@ const Interested: React.FC<InterestedPropsType> = (props) => {
</div>
<div className={styles.interested_product_list_item_name}>{item.name}</div>
{
priceType === COMMODITY_TYPE.integral ? <div className={cx(styles.interested_product_list_item_price, styles.integral)}>{item.min === item.max ? `${numFormat(item.min)}积分` : `${numFormat(item.min)}~${numFormat(item.max)}积分`}</div> :
<div className={styles.interested_product_list_item_price}><span></span> {priceFormat(item.min)}</div>
showPriceByType(item)
}
</div>
</a>
......
......@@ -11,6 +11,16 @@
padding-left: 20px;
}
.inquiry_price {
color: #FFF;
background-color: var(--mall_main_color);
font-size: 14px;
height: 18px;
line-height: 14px;
padding: 2px 8px;
display: inline-block;
}
.recommand_list {
display: flex;
flex-wrap: wrap;
......@@ -44,6 +54,10 @@
color: #D32F2F;
margin-top: 10px;
&.integral {
color: #EA8000;
}
&>span {
font-size: 12px;
}
......
import React from 'react'
import { LAYOUT_TYPE } from '@/constants'
import { LAYOUT_TYPE, COMMODITY_TYPE } from '@/constants'
import ImageBox from '@/components/ImageBox'
import { GlobalConfig } from '@/global/config'
import cx from 'classnames'
import { numFormat, priceFormat } from '@/utils/numberFomat'
import styles from './index.less'
interface RecommandPropsTyep {
......@@ -28,6 +30,32 @@ const Recommand: React.FC<RecommandPropsTyep> = (props) => {
return link
}
const showPriceByType = (info: any) => {
if (info) {
switch (info.priceType) {
case COMMODITY_TYPE.inquiry:
return (
<div className={styles.inquiry_price}>
<label>在线询价</label>
</div>
)
case COMMODITY_TYPE.integral:
return (
<div className={cx(styles.recommand_list_item_price, styles.integral)}>
{info.min === info.max ? `${numFormat(info.min)}积分` : `${numFormat(info.min)}~${numFormat(info.max)}积分`}
</div>
)
case COMMODITY_TYPE.prompt:
return <div className={styles.recommand_list_item_price}>{priceFormat(info.min)}</div>
default:
return null
break
}
}
return null
}
return (dataList && dataList.length > 0) && (
<div className={styles.recommand}>
<div className={styles.recommand_title}>买家还在看</div>
......@@ -40,10 +68,9 @@ const Recommand: React.FC<RecommandPropsTyep> = (props) => {
<ImageBox width={184} height={184} imgUrl={item.mainPic} direction="column" />
</div>
<div className={styles.recommand_list_item_name}>{item.name}</div>
<div className={styles.recommand_list_item_price}>
<span></span>
{item.min}
</div>
{
showPriceByType(item)
}
</div>
</a>
))
......
......@@ -96,47 +96,49 @@ const CommodityDetail = (props) => {
let getListFn
switch (layoutType) {
case LAYOUT_TYPE.shop:
param.storeId = shopId
switch (priceType) {
case COMMODITY_TYPE.prompt:
param.storeId = shopId
param.priceTypeList = [1]
getListFn = PublicApi.postSearchShopStoreGetCommodityList
break
case COMMODITY_TYPE.inquiry:
getListFn = PublicApi.postSearchShopScoreGetCommodityList
param.priceTypeList = [2]
getListFn = PublicApi.postSearchShopStoreGetCommodityList
break
case COMMODITY_TYPE.integral:
param.priceTypeList = [3]
getListFn = PublicApi.postSearchShopScoreGetCommodityList
break
default:
break
}
break;
case LAYOUT_TYPE.channel:
headers = {
type: 3
}
param.channelMemberId = memberId
if (priceType === COMMODITY_TYPE.prompt) {
param.channelMemberId = memberId
headers = {
type: 3
}
param.priceTypeList = [1]
} else if (priceType === COMMODITY_TYPE.inquiry) {
param.priceTypeList = [2]
} else {
param.channelMemberId = memberId
param.priceType = 3
headers = {
type: 3
}
param.priceTypeList = [3]
}
getListFn = PublicApi.postSearchShopChannelGetCommodityList
break
case LAYOUT_TYPE.ichannel:
headers = {
type: 4
}
param.channelMemberId = memberId
if (priceType === COMMODITY_TYPE.prompt) {
param.channelMemberId = memberId
headers = {
type: 4
}
param.priceTypeList = [1]
} else if (priceType === COMMODITY_TYPE.inquiry) {
param.priceTypeList = [2]
} else {
param.channelMemberId = memberId
param.priceType = 3
headers = {
type: 4
}
param.priceTypeList = [3]
}
getListFn = PublicApi.postSearchShopChannelGetCommodityList
break
......@@ -194,6 +196,8 @@ const CommodityDetail = (props) => {
if (getAuth() && res.data?.isMemberPrice) {
getMemberCredit(res.data?.memberId, res.data?.memberRoleId)
}
} else {
message.info(res.message)
}
})
}
......@@ -518,7 +522,22 @@ const CommodityDetail = (props) => {
if (!checkoutUserInfo()) {
return
}
window.location.href = `/memberCenter/tranactionAbility/goodsOffer/addEnquiryOrder/rfq?id=${id}&memberId=${memberId}`
let inquiryParam = {
id: selectCommodityId,
brand: commodityDetail.brand,
logistics: commodityDetail.logistics,
memberId: commodityDetail.memberId,
memberRoleId: commodityDetail.memberRoleId,
memberRoleName: commodityDetail.memberRoleName,
name: commodityDetail.name,
packing: commodityDetail.packing,
unitName: commodityDetail.unitName,
}
let sessionKey = `inquiry${selectCommodityId}${new Date().getTime()}`
updateOrderInfo(inquiryParam, sessionKey).then(() => {
window.location.href = `/memberCenter/tranactionAbility/goodsOffer/addEnquiryOrder/rfq?id=${id}&memberId=${memberId}&spam_id=${sessionKey}`
})
}
/**
......
import { action, computed, observable, runInAction } from 'mobx'
import isEmpty from 'lodash/isEmpty'
import { action, observable, runInAction } from 'mobx'
import { PublicApi } from '@/services/api'
import { FILTER_TYPE } from '@/constants'
......@@ -143,7 +142,7 @@ class FilterStore {
tempFilterParam.brandId = filterItem.key
break
case FILTER_TYPE.commodityType:
tempFilterParam.priceType = filterItem.key
tempFilterParam.priceTypeList = [filterItem.key]
break
case FILTER_TYPE.minPoints:
case FILTER_TYPE.minPrice:
......@@ -211,7 +210,7 @@ class FilterStore {
tempFilterParam.brandName = filterItem.title
break
case FILTER_TYPE.commodityType:
tempFilterParam.priceType = filterItem.key
tempFilterParam.priceTypeList = [filterItem.key]
break
case FILTER_TYPE.minPrice:
tempFilterParam.min = filterItem.key
......@@ -347,7 +346,7 @@ class FilterStore {
if (data.priceType) {
tempFilter.push({
type: FILTER_TYPE.commodityType,
title: getItemText(data.priceType),
title: [getItemText(data.priceType)],
key: data.priceType
})
}
......
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