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