Commit 1b3ad9a0 authored by XieZhiXiong's avatar XieZhiXiong
parents 91bac5ea 1b8e8777
......@@ -5,8 +5,10 @@ import { GlobalConfig } from "@/global/config"
const useStoreId = (layoutType: LAYOUT_TYPE) => {
const [storeId, setStoreId] = useState<number>()
const getStoreIdByLayoutType = () => {
switch(layoutType) {
const getStoreIdByLayoutType = (newLayoutType?: LAYOUT_TYPE) => {
const type = newLayoutType ? newLayoutType : layoutType
switch(type) {
case LAYOUT_TYPE.mall:
setStoreId(getStoreId(SHOP_TYPE.mall))
break
......@@ -29,6 +31,10 @@ const useStoreId = (layoutType: LAYOUT_TYPE) => {
getStoreIdByLayoutType()
}, [layoutType])
const uploadStoreId = (newLayoutType: LAYOUT_TYPE) => {
getStoreIdByLayoutType(newLayoutType)
}
const getStoreId = (mallType: number) => {
const shopList = GlobalConfig.web.shopInfo
const shopInfo:any = shopList.filter(item => item.environment === 1 && item.type === mallType)[0] || {}
......@@ -36,7 +42,8 @@ const useStoreId = (layoutType: LAYOUT_TYPE) => {
}
return {
storeId
storeId,
uploadStoreId
}
}
......
......@@ -47,6 +47,7 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
const UserStore = useLocalStore(() => store.UserStore)
const FilterStore = useLocalStore(() => store.FilterStore)
const { userInfo } = UserStore
const [initLoad, setInitLoad] = useState<boolean>(true)
const [modalVisible, setModalVisible] = useState<boolean>(false)
const [confirmLoading, setConfirmLoading] = useState<boolean>(false)
const [commonlyUsedName, setCommonlyUsedName] = useState<string>("")
......@@ -63,11 +64,19 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
useEffect(() => {
if (categoryId && categoryName) {
onFilter({
key: [categoryId],
title: decodeURIComponent(atob(categoryName)),
type: FILTER_TYPE.category,
})
if(layoutType === LAYOUT_TYPE.mall) {
onFilter({
key: [categoryId],
title: decodeURIComponent(atob(categoryName)),
type: FILTER_TYPE.category,
})
} else {
onFilter({
key: [categoryId],
title: decodeURIComponent(atob(categoryName)),
type: FILTER_TYPE.customerCategory,
})
}
}
if (brandId && brandName) {
onFilter({
......@@ -85,9 +94,22 @@ const Commodity: React.FC<CommodityPropsType> = (props) => {
}
}, [props.location.query])
const checkInitLoad = () => {
let load = true
if(categoryId || categoryName || brandId || brandName || priceType ) {
if(initLoad) {
setInitLoad(false)
load = false
}
}
if(load) {
fetchCommodityList(1)
}
}
useEffect(() => {
setCurrent(1)
fetchCommodityList(1)
checkInitLoad()
}, [filterParam])
useEffect(() => {
......
......@@ -98,7 +98,7 @@ const CommodityDetail = (props) => {
const [commonCategoryCommodityList, setCommonCategoryCommodityList] = useState([])
const [spinLoading, setSpinLoading] = useState<boolean>(true)
const [errorInfo, setErrorInfo] = useState<any>()
const { storeId } = useStoreId(getLayoutType(layoutType, Number(type)))
const { storeId, uploadStoreId } = useStoreId(getLayoutType(layoutType, Number(type)))
let clickFlag = true
......@@ -213,8 +213,10 @@ const CommodityDetail = (props) => {
setErrorInfo(null)
setCommodityDetail(res.data)
initAttributeAndValueList(res.data)
getPayWayListByMemberId(res.data?.memberId)
getPayWayListByMemberId(res.data?.memberId, res.data?.memberRoleId)
if(!type) {
uploadStoreId(getLayoutType(layoutType, Number(res.data.priceType)))
}
if (res.data.customerCategory) {
fetchCommonCategoryCommodityList(res.data.customerCategory.id, res.data.priceType)
}
......@@ -234,12 +236,13 @@ const CommodityDetail = (props) => {
* 获取供货商的支付方式
* @param memberId
*/
const getPayWayListByMemberId = (memberId: number) => {
const getPayWayListByMemberId = (memberId: number, memberRoleId) => {
if (!memberId) {
return
}
const param: any = {
memberId
memberId,
memberRoleId,
}
PublicApi.getPayPayWayList(param).then(res => {
if (res.code === 1000) {
......
......@@ -34,8 +34,8 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
const getCommodityListByCategoryIds = async () => {
let result = []
for (let id of categoryIds) {
let resList: any = await getListById(id)
for (const id of categoryIds) {
const resList: any = await getListById(id)
result = [...result, ...resList]
if (result && result.length >= 5) {
setList(result)
......@@ -61,7 +61,7 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
const getListById = (categoryId: number) => {
return new Promise((resolve) => {
let param: any = {
const param: any = {
current: 1,
pageSize: 5,
categoryId
......@@ -102,7 +102,7 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
const fetchFirstCategory = () => {
return new Promise((resolve) => {
let getFn
let param: any ={}
const param: any ={}
switch (layoutType) {
case LAYOUT_TYPE.channel:
case LAYOUT_TYPE.ichannel:
......@@ -127,7 +127,7 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
*/
const fetchCategoryById = (categoryId) => {
return new Promise((resolve) => {
let param: any = {
const param: any = {
categoryId
}
......@@ -151,7 +151,6 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
}
param.templateId = templateId
// @ts-ignore
getFn && getFn(param).then(res => {
if (res.code === 1000) {
resolve(res.data)
......@@ -161,9 +160,9 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
}
const getCategoryComponents = async () => {
let firstCategory: any = await fetchFirstCategory()
const firstCategory: any = await fetchFirstCategory()
if (firstCategory[0]) {
let categoryDetail: any = await fetchCategoryById(firstCategory[0].id)
const categoryDetail: any = await fetchCategoryById(firstCategory[0].id)
setList(changeDataKey(categoryDetail.goodsBOList))
}
}
......@@ -190,7 +189,7 @@ const Recommand: React.FC<RecommandPropsType> = (props) => {
<div className={styles.recommand_list}>
{
list && list.map((item, index) => index < 5 && (
<a href={getCommodityDetailLink(item)} key={`recommand_list_item_${index}`} target="_blank">
<a href={getCommodityDetailLink(item)} key={`recommand_list_item_${index}`} target="_blank" rel="noreferrer">
<div className={styles.recommand_list_item}>
<div className={styles.recommand_list_item_img}>
<ImageBox width={224} height={224} imgUrl={item.mainPic} direction="column" />
......
......@@ -118,7 +118,13 @@ const Order: React.FC<OrderPropsType> = (props) => {
// 根据商品ID获取工作流信息,判断是否需要签署合同
if (productId) {
try {
const rulesRes = await PublicApi.getOrderTradingRulesByProductId({ productId })
const param: any = {
productId,
shopId, storeId,
memberId: orderInfo.supplyMembersId,
memberRoleId: orderInfo.supplyMembersRoleId,
}
const rulesRes = await PublicApi.getOrderTradingRulesByProductId(param)
const { data } = rulesRes
if (data) {
// 是否选用电子合同
......
......@@ -82,7 +82,8 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
id: Number(orderId),
paymentInformationId: Number(payInfo.paymentInformationId),
payTypeId: payInfo.paymentChannelsId,
payPassword: encryptedByAES(payPassword)
payPassword: encryptedByAES(payPassword),
payType: 1,
}
setConfirmLoading(true)
PublicApi.postOrderPendingOrderPay(param).then(res => {
......@@ -148,4 +149,4 @@ const BablancePayWay: React.FC<BablancePayWayPropsType> = (props) => {
)
}
export default BablancePayWay
\ No newline at end of file
export default BablancePayWay
......@@ -22,11 +22,11 @@ const BankPayWay: React.FC<BankPayWayPropsType> = (props) => {
if (status !== 'uploading') {
console.log(info.file, info.fileList);
}
if (status === 'done') {
// if (status === 'done') {
} else if (status === 'error') {
// } else if (status === 'error') {
}
// }
},
};
......
......@@ -81,7 +81,8 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
id: Number(orderId),
paymentInformationId: Number(payInfo.paymentInformationId),
payTypeId: payInfo.paymentChannelsId,
payPassword: encryptedByAES(payPassword)
payPassword: encryptedByAES(payPassword),
payType: 3,
}
setConfirmLoading(true)
PublicApi.postOrderPendingOrderPay(param).then(res => {
......@@ -146,4 +147,4 @@ const CreditPayWay: React.FC<CreditPayWayPropsType> = (props) => {
)
}
export default CreditPayWay
\ No newline at end of file
export default CreditPayWay
......@@ -86,7 +86,8 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
relType,
paymentInformationId: Number(payInfo.paymentInformationId),
payTypeId: payInfo.paymentChannelsId,
payPassword: encryptedByAES(payPassword)
payPassword: encryptedByAES(payPassword),
payType: 0,
}
setConfirmLoading(true)
......@@ -174,4 +175,4 @@ const PointPayWay: React.FC<PointPayWayPropsType> = (props) => {
)
}
export default PointPayWay
\ No newline at end of file
export default PointPayWay
......@@ -69,14 +69,15 @@ const TransferPayWay: React.FC<TransferPayWayPropsType> = (props) => {
message.info("请上传支付凭证")
return
}
let param = {
const param: any = {
id: Number(orderId),
paymentInformationId: payInfo.paymentInformationId,
payTypeId: payInfo.paymentChannelsId,
payOrderUrls: JSON.stringify([payOrderUrl])
payOrderUrls: JSON.stringify([payOrderUrl]),
payType: 2,
}
setConfirmLoading(true)
//@ts-ignore
PublicApi.postOrderPendingOrderPay(param).then(res => {
if (res.code === 1000) {
message.destroy()
......
......@@ -39,13 +39,13 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
}
const pay = () => {
let param = {
const param: any = {
id: Number(orderId),
paymentInformationId: payInfo.paymentInformationId,
payTypeId: payInfo.paymentChannelsId,
payType: 1,
}
//@ts-ignore
PublicApi.postOrderPendingOrderPay(param).then(res => {
if(res.code === 1000) {
message.destroy()
......@@ -64,12 +64,12 @@ const WechatPayWay: React.FC<WechatPayWayPropsType> = (props) => {
const checkPayState = () => {
if (checkCount < 24) {
let param = {
const param: any = {
id: Number(orderId),
paymentInformationId: payInfo.paymentInformationId,
payTypeId: payInfo.paymentChannelsId,
}
//@ts-ignore
PublicApi.getOrderPayResultsl(param).then(res => {
const { data, code } = res
if (code === 1000) {
......
......@@ -8,8 +8,6 @@ import BankPayWay from './components/bank'
import TransferPayWay from './components/transfer'
import { PublicApi } from '@/services/api'
import { GetOrderOrderPayDetailsResponse } from '@/services/OrderApi'
import { useLocalStore, observer } from 'mobx-react'
import { store } from '@/store'
import { LAYOUT_TYPE } from '@/constants'
import styles from './index.less'
import { message, Button } from 'antd'
......@@ -117,7 +115,7 @@ const PayPage: React.FC<PayPagePropsType> = (props) => {
return null
}
}
const backHome = () => {
window.location.href = '/'
}
......
......@@ -42,7 +42,9 @@ const Commodity: React.FC = () => {
const param: any = {
commodityId: detail.commodity.id,
type: detail.type,
channelMemberId: detail.channelMemberId
}
if(detail.channelMemberId) {
param.channelMemberId = detail.channelMemberId
}
setBuyLoading(true)
PublicApi.getSearchShopCommonGetCommodityIsPublish(param).then(res => {
......@@ -53,16 +55,16 @@ const Commodity: React.FC = () => {
switch (detail.type) {
case 1:
case 2:
el.href = `/shop/commodity/detail?id=${detail.commodity.id}&shopId=${btoa(JSON.stringify({ shopId: detail.commodity.storeId, memberId: detail.commodity.memberId, roleId: detail.commodity.memberRoleId }))}`;
el.href = `/shop/commodity/detail?id=${detail.commodity.id}&type=${detail.commodity.priceType}&shopId=${btoa(JSON.stringify({ shopId: detail.commodity.storeId, memberId: detail.commodity.memberId, roleId: detail.commodity.memberRoleId }))}`;
break
case 3:
el.href = `${GlobalConfig.channelRootRoute}/commodity/detail?id=${detail.commodity.id}&channelId=${btoa(JSON.stringify({ memberId: detail.channelMemberId }))}`;
el.href = `${GlobalConfig.channelRootRoute}/commodity/detail?id=${detail.commodity.id}&type=${detail.commodity.priceType}&channelId=${btoa(JSON.stringify({ memberId: detail.channelMemberId }))}`;
break
case 4:
el.href = `${GlobalConfig.ichannelRootRoute}/commodity/detail?id=${detail.commodity.id}&channelId=${btoa(JSON.stringify({ memberId: detail.channelMemberId }))}`;
el.href = `${GlobalConfig.ichannelRootRoute}/commodity/detail?id=${detail.commodity.id}&type=${detail.commodity.priceType}&channelId=${btoa(JSON.stringify({ memberId: detail.channelMemberId }))}`;
break
case 5:
el.href = `${GlobalConfig.channelRootRoute}/commodity/detail?id=${detail.commodity.id}&channelId=${btoa(JSON.stringify({ memberId: detail.channelMemberId }))}`;
el.href = `${GlobalConfig.channelRootRoute}/commodity/detail?id=${detail.commodity.id}&type=${detail.commodity.priceType}&channelId=${btoa(JSON.stringify({ memberId: detail.channelMemberId }))}`;
break
}
el.target = '_blank';
......
......@@ -243,7 +243,7 @@ const Details: React.FC<parmas> = (props) => {
if (type === 'rfq') {
// 代表的是查看询价
setview(1)
PublicApi.getOrderProductInquiryDetails({ id }).then(res => {
PublicApi.getOrderNotarizeEnquiryQuotedPriceDetails({ id }).then(res => {
if (res.code === 1000) {
setdata(res.data)
}
......
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